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.

22782 lines
607KB

  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 threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. If you want instead to delay in seconds, append 's' to number.
  533. @end table
  534. @subsection Examples
  535. @itemize
  536. @item
  537. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  538. the second channel (and any other channels that may be present) unchanged.
  539. @example
  540. adelay=1500|0|500
  541. @end example
  542. @item
  543. Delay second channel by 500 samples, the third channel by 700 samples and leave
  544. the first channel (and any other channels that may be present) unchanged.
  545. @example
  546. adelay=0|500S|700S
  547. @end example
  548. @end itemize
  549. @section aderivative, aintegral
  550. Compute derivative/integral of audio stream.
  551. Applying both filters one after another produces original audio.
  552. @section aecho
  553. Apply echoing to the input audio.
  554. Echoes are reflected sound and can occur naturally amongst mountains
  555. (and sometimes large buildings) when talking or shouting; digital echo
  556. effects emulate this behaviour and are often used to help fill out the
  557. sound of a single instrument or vocal. The time difference between the
  558. original signal and the reflection is the @code{delay}, and the
  559. loudness of the reflected signal is the @code{decay}.
  560. Multiple echoes can have different delays and decays.
  561. A description of the accepted parameters follows.
  562. @table @option
  563. @item in_gain
  564. Set input gain of reflected signal. Default is @code{0.6}.
  565. @item out_gain
  566. Set output gain of reflected signal. Default is @code{0.3}.
  567. @item delays
  568. Set list of time intervals in milliseconds between original signal and reflections
  569. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  570. Default is @code{1000}.
  571. @item decays
  572. Set list of loudness of reflected signals separated by '|'.
  573. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  574. Default is @code{0.5}.
  575. @end table
  576. @subsection Examples
  577. @itemize
  578. @item
  579. Make it sound as if there are twice as many instruments as are actually playing:
  580. @example
  581. aecho=0.8:0.88:60:0.4
  582. @end example
  583. @item
  584. If delay is very short, then it sound like a (metallic) robot playing music:
  585. @example
  586. aecho=0.8:0.88:6:0.4
  587. @end example
  588. @item
  589. A longer delay will sound like an open air concert in the mountains:
  590. @example
  591. aecho=0.8:0.9:1000:0.3
  592. @end example
  593. @item
  594. Same as above but with one more mountain:
  595. @example
  596. aecho=0.8:0.9:1000|1800:0.3|0.25
  597. @end example
  598. @end itemize
  599. @section aemphasis
  600. Audio emphasis filter creates or restores material directly taken from LPs or
  601. emphased CDs with different filter curves. E.g. to store music on vinyl the
  602. signal has to be altered by a filter first to even out the disadvantages of
  603. this recording medium.
  604. Once the material is played back the inverse filter has to be applied to
  605. restore the distortion of the frequency response.
  606. The filter accepts the following options:
  607. @table @option
  608. @item level_in
  609. Set input gain.
  610. @item level_out
  611. Set output gain.
  612. @item mode
  613. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  614. use @code{production} mode. Default is @code{reproduction} mode.
  615. @item type
  616. Set filter type. Selects medium. Can be one of the following:
  617. @table @option
  618. @item col
  619. select Columbia.
  620. @item emi
  621. select EMI.
  622. @item bsi
  623. select BSI (78RPM).
  624. @item riaa
  625. select RIAA.
  626. @item cd
  627. select Compact Disc (CD).
  628. @item 50fm
  629. select 50µs (FM).
  630. @item 75fm
  631. select 75µs (FM).
  632. @item 50kf
  633. select 50µs (FM-KF).
  634. @item 75kf
  635. select 75µs (FM-KF).
  636. @end table
  637. @end table
  638. @section aeval
  639. Modify an audio signal according to the specified expressions.
  640. This filter accepts one or more expressions (one for each channel),
  641. which are evaluated and used to modify a corresponding audio signal.
  642. It accepts the following parameters:
  643. @table @option
  644. @item exprs
  645. Set the '|'-separated expressions list for each separate channel. If
  646. the number of input channels is greater than the number of
  647. expressions, the last specified expression is used for the remaining
  648. output channels.
  649. @item channel_layout, c
  650. Set output channel layout. If not specified, the channel layout is
  651. specified by the number of expressions. If set to @samp{same}, it will
  652. use by default the same input channel layout.
  653. @end table
  654. Each expression in @var{exprs} can contain the following constants and functions:
  655. @table @option
  656. @item ch
  657. channel number of the current expression
  658. @item n
  659. number of the evaluated sample, starting from 0
  660. @item s
  661. sample rate
  662. @item t
  663. time of the evaluated sample expressed in seconds
  664. @item nb_in_channels
  665. @item nb_out_channels
  666. input and output number of channels
  667. @item val(CH)
  668. the value of input channel with number @var{CH}
  669. @end table
  670. Note: this filter is slow. For faster processing you should use a
  671. dedicated filter.
  672. @subsection Examples
  673. @itemize
  674. @item
  675. Half volume:
  676. @example
  677. aeval=val(ch)/2:c=same
  678. @end example
  679. @item
  680. Invert phase of the second channel:
  681. @example
  682. aeval=val(0)|-val(1)
  683. @end example
  684. @end itemize
  685. @anchor{afade}
  686. @section afade
  687. Apply fade-in/out effect to input audio.
  688. A description of the accepted parameters follows.
  689. @table @option
  690. @item type, t
  691. Specify the effect type, can be either @code{in} for fade-in, or
  692. @code{out} for a fade-out effect. Default is @code{in}.
  693. @item start_sample, ss
  694. Specify the number of the start sample for starting to apply the fade
  695. effect. Default is 0.
  696. @item nb_samples, ns
  697. Specify the number of samples for which the fade effect has to last. At
  698. the end of the fade-in effect the output audio will have the same
  699. volume as the input audio, at the end of the fade-out transition
  700. the output audio will be silence. Default is 44100.
  701. @item start_time, st
  702. Specify the start time of the fade effect. Default is 0.
  703. The value must be specified as a time duration; see
  704. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  705. for the accepted syntax.
  706. If set this option is used instead of @var{start_sample}.
  707. @item duration, d
  708. Specify the duration of the fade effect. See
  709. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the accepted syntax.
  711. At the end of the fade-in effect the output audio will have the same
  712. volume as the input audio, at the end of the fade-out transition
  713. the output audio will be silence.
  714. By default the duration is determined by @var{nb_samples}.
  715. If set this option is used instead of @var{nb_samples}.
  716. @item curve
  717. Set curve for fade transition.
  718. It accepts the following values:
  719. @table @option
  720. @item tri
  721. select triangular, linear slope (default)
  722. @item qsin
  723. select quarter of sine wave
  724. @item hsin
  725. select half of sine wave
  726. @item esin
  727. select exponential sine wave
  728. @item log
  729. select logarithmic
  730. @item ipar
  731. select inverted parabola
  732. @item qua
  733. select quadratic
  734. @item cub
  735. select cubic
  736. @item squ
  737. select square root
  738. @item cbr
  739. select cubic root
  740. @item par
  741. select parabola
  742. @item exp
  743. select exponential
  744. @item iqsin
  745. select inverted quarter of sine wave
  746. @item ihsin
  747. select inverted half of sine wave
  748. @item dese
  749. select double-exponential seat
  750. @item desi
  751. select double-exponential sigmoid
  752. @item losi
  753. select logistic sigmoid
  754. @item nofade
  755. no fade applied
  756. @end table
  757. @end table
  758. @subsection Examples
  759. @itemize
  760. @item
  761. Fade in first 15 seconds of audio:
  762. @example
  763. afade=t=in:ss=0:d=15
  764. @end example
  765. @item
  766. Fade out last 25 seconds of a 900 seconds audio:
  767. @example
  768. afade=t=out:st=875:d=25
  769. @end example
  770. @end itemize
  771. @section afftdn
  772. Denoise audio samples with FFT.
  773. A description of the accepted parameters follows.
  774. @table @option
  775. @item nr
  776. Set the noise reduction in dB, allowed range is 0.01 to 97.
  777. Default value is 12 dB.
  778. @item nf
  779. Set the noise floor in dB, allowed range is -80 to -20.
  780. Default value is -50 dB.
  781. @item nt
  782. Set the noise type.
  783. It accepts the following values:
  784. @table @option
  785. @item w
  786. Select white noise.
  787. @item v
  788. Select vinyl noise.
  789. @item s
  790. Select shellac noise.
  791. @item c
  792. Select custom noise, defined in @code{bn} option.
  793. Default value is white noise.
  794. @end table
  795. @item bn
  796. Set custom band noise for every one of 15 bands.
  797. Bands are separated by ' ' or '|'.
  798. @item rf
  799. Set the residual floor in dB, allowed range is -80 to -20.
  800. Default value is -38 dB.
  801. @item tn
  802. Enable noise tracking. By default is disabled.
  803. With this enabled, noise floor is automatically adjusted.
  804. @item tr
  805. Enable residual tracking. By default is disabled.
  806. @item om
  807. Set the output mode.
  808. It accepts the following values:
  809. @table @option
  810. @item i
  811. Pass input unchanged.
  812. @item o
  813. Pass noise filtered out.
  814. @item n
  815. Pass only noise.
  816. Default value is @var{o}.
  817. @end table
  818. @end table
  819. @subsection Commands
  820. This filter supports the following commands:
  821. @table @option
  822. @item sample_noise, sn
  823. Start or stop measuring noise profile.
  824. Syntax for the command is : "start" or "stop" string.
  825. After measuring noise profile is stopped it will be
  826. automatically applied in filtering.
  827. @item noise_reduction, nr
  828. Change noise reduction. Argument is single float number.
  829. Syntax for the command is : "@var{noise_reduction}"
  830. @item noise_floor, nf
  831. Change noise floor. Argument is single float number.
  832. Syntax for the command is : "@var{noise_floor}"
  833. @item output_mode, om
  834. Change output mode operation.
  835. Syntax for the command is : "i", "o" or "n" string.
  836. @end table
  837. @section afftfilt
  838. Apply arbitrary expressions to samples in frequency domain.
  839. @table @option
  840. @item real
  841. Set frequency domain real expression for each separate channel separated
  842. by '|'. Default is "re".
  843. If the number of input channels is greater than the number of
  844. expressions, the last specified expression is used for the remaining
  845. output channels.
  846. @item imag
  847. Set frequency domain imaginary expression for each separate channel
  848. separated by '|'. Default is "im".
  849. Each expression in @var{real} and @var{imag} can contain the following
  850. constants and functions:
  851. @table @option
  852. @item sr
  853. sample rate
  854. @item b
  855. current frequency bin number
  856. @item nb
  857. number of available bins
  858. @item ch
  859. channel number of the current expression
  860. @item chs
  861. number of channels
  862. @item pts
  863. current frame pts
  864. @item re
  865. current real part of frequency bin of current channel
  866. @item im
  867. current imaginary part of frequency bin of current channel
  868. @item real(b, ch)
  869. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  870. @item imag(b, ch)
  871. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  872. @end table
  873. @item win_size
  874. Set window size.
  875. It accepts the following values:
  876. @table @samp
  877. @item w16
  878. @item w32
  879. @item w64
  880. @item w128
  881. @item w256
  882. @item w512
  883. @item w1024
  884. @item w2048
  885. @item w4096
  886. @item w8192
  887. @item w16384
  888. @item w32768
  889. @item w65536
  890. @end table
  891. Default is @code{w4096}
  892. @item win_func
  893. Set window function. Default is @code{hann}.
  894. @item overlap
  895. Set window overlap. If set to 1, the recommended overlap for selected
  896. window function will be picked. Default is @code{0.75}.
  897. @end table
  898. @subsection Examples
  899. @itemize
  900. @item
  901. Leave almost only low frequencies in audio:
  902. @example
  903. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  904. @end example
  905. @end itemize
  906. @anchor{afir}
  907. @section afir
  908. Apply an arbitrary Frequency Impulse Response filter.
  909. This filter is designed for applying long FIR filters,
  910. up to 60 seconds long.
  911. It can be used as component for digital crossover filters,
  912. room equalization, cross talk cancellation, wavefield synthesis,
  913. auralization, ambiophonics, ambisonics and spatialization.
  914. This filter uses second stream as FIR coefficients.
  915. If second stream holds single channel, it will be used
  916. for all input channels in first stream, otherwise
  917. number of channels in second stream must be same as
  918. number of channels in first stream.
  919. It accepts the following parameters:
  920. @table @option
  921. @item dry
  922. Set dry gain. This sets input gain.
  923. @item wet
  924. Set wet gain. This sets final output gain.
  925. @item length
  926. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  927. @item gtype
  928. Enable applying gain measured from power of IR.
  929. Set which approach to use for auto gain measurement.
  930. @table @option
  931. @item none
  932. Do not apply any gain.
  933. @item peak
  934. select peak gain, very conservative approach. This is default value.
  935. @item dc
  936. select DC gain, limited application.
  937. @item gn
  938. select gain to noise approach, this is most popular one.
  939. @end table
  940. @item irgain
  941. Set gain to be applied to IR coefficients before filtering.
  942. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  943. @item irfmt
  944. Set format of IR stream. Can be @code{mono} or @code{input}.
  945. Default is @code{input}.
  946. @item maxir
  947. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  948. Allowed range is 0.1 to 60 seconds.
  949. @item response
  950. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  951. By default it is disabled.
  952. @item channel
  953. Set for which IR channel to display frequency response. By default is first channel
  954. displayed. This option is used only when @var{response} is enabled.
  955. @item size
  956. Set video stream size. This option is used only when @var{response} is enabled.
  957. @item rate
  958. Set video stream frame rate. This option is used only when @var{response} is enabled.
  959. @item minp
  960. Set minimal partition size used for convolution. Default is @var{8192}.
  961. Allowed range is from @var{8} to @var{32768}.
  962. Lower values decreases latency at cost of higher CPU usage.
  963. @item maxp
  964. Set maximal partition size used for convolution. Default is @var{8192}.
  965. Allowed range is from @var{8} to @var{32768}.
  966. Lower values may increase CPU usage.
  967. @end table
  968. @subsection Examples
  969. @itemize
  970. @item
  971. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  972. @example
  973. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  974. @end example
  975. @end itemize
  976. @anchor{aformat}
  977. @section aformat
  978. Set output format constraints for the input audio. The framework will
  979. negotiate the most appropriate format to minimize conversions.
  980. It accepts the following parameters:
  981. @table @option
  982. @item sample_fmts
  983. A '|'-separated list of requested sample formats.
  984. @item sample_rates
  985. A '|'-separated list of requested sample rates.
  986. @item channel_layouts
  987. A '|'-separated list of requested channel layouts.
  988. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  989. for the required syntax.
  990. @end table
  991. If a parameter is omitted, all values are allowed.
  992. Force the output to either unsigned 8-bit or signed 16-bit stereo
  993. @example
  994. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  995. @end example
  996. @section agate
  997. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  998. processing reduces disturbing noise between useful signals.
  999. Gating is done by detecting the volume below a chosen level @var{threshold}
  1000. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1001. floor is set via @var{range}. Because an exact manipulation of the signal
  1002. would cause distortion of the waveform the reduction can be levelled over
  1003. time. This is done by setting @var{attack} and @var{release}.
  1004. @var{attack} determines how long the signal has to fall below the threshold
  1005. before any reduction will occur and @var{release} sets the time the signal
  1006. has to rise above the threshold to reduce the reduction again.
  1007. Shorter signals than the chosen attack time will be left untouched.
  1008. @table @option
  1009. @item level_in
  1010. Set input level before filtering.
  1011. Default is 1. Allowed range is from 0.015625 to 64.
  1012. @item range
  1013. Set the level of gain reduction when the signal is below the threshold.
  1014. Default is 0.06125. Allowed range is from 0 to 1.
  1015. @item threshold
  1016. If a signal rises above this level the gain reduction is released.
  1017. Default is 0.125. Allowed range is from 0 to 1.
  1018. @item ratio
  1019. Set a ratio by which the signal is reduced.
  1020. Default is 2. Allowed range is from 1 to 9000.
  1021. @item attack
  1022. Amount of milliseconds the signal has to rise above the threshold before gain
  1023. reduction stops.
  1024. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1025. @item release
  1026. Amount of milliseconds the signal has to fall below the threshold before the
  1027. reduction is increased again. Default is 250 milliseconds.
  1028. Allowed range is from 0.01 to 9000.
  1029. @item makeup
  1030. Set amount of amplification of signal after processing.
  1031. Default is 1. Allowed range is from 1 to 64.
  1032. @item knee
  1033. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1034. Default is 2.828427125. Allowed range is from 1 to 8.
  1035. @item detection
  1036. Choose if exact signal should be taken for detection or an RMS like one.
  1037. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1038. @item link
  1039. Choose if the average level between all channels or the louder channel affects
  1040. the reduction.
  1041. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1042. @end table
  1043. @section aiir
  1044. Apply an arbitrary Infinite Impulse Response filter.
  1045. It accepts the following parameters:
  1046. @table @option
  1047. @item z
  1048. Set numerator/zeros coefficients.
  1049. @item p
  1050. Set denominator/poles coefficients.
  1051. @item k
  1052. Set channels gains.
  1053. @item dry_gain
  1054. Set input gain.
  1055. @item wet_gain
  1056. Set output gain.
  1057. @item f
  1058. Set coefficients format.
  1059. @table @samp
  1060. @item tf
  1061. transfer function
  1062. @item zp
  1063. Z-plane zeros/poles, cartesian (default)
  1064. @item pr
  1065. Z-plane zeros/poles, polar radians
  1066. @item pd
  1067. Z-plane zeros/poles, polar degrees
  1068. @end table
  1069. @item r
  1070. Set kind of processing.
  1071. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1072. @item e
  1073. Set filtering precision.
  1074. @table @samp
  1075. @item dbl
  1076. double-precision floating-point (default)
  1077. @item flt
  1078. single-precision floating-point
  1079. @item i32
  1080. 32-bit integers
  1081. @item i16
  1082. 16-bit integers
  1083. @end table
  1084. @item response
  1085. Show IR frequency reponse, magnitude and phase in additional video stream.
  1086. By default it is disabled.
  1087. @item channel
  1088. Set for which IR channel to display frequency response. By default is first channel
  1089. displayed. This option is used only when @var{response} is enabled.
  1090. @item size
  1091. Set video stream size. This option is used only when @var{response} is enabled.
  1092. @end table
  1093. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1094. order.
  1095. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1096. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1097. imaginary unit.
  1098. Different coefficients and gains can be provided for every channel, in such case
  1099. use '|' to separate coefficients or gains. Last provided coefficients will be
  1100. used for all remaining channels.
  1101. @subsection Examples
  1102. @itemize
  1103. @item
  1104. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1105. @example
  1106. 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
  1107. @end example
  1108. @item
  1109. Same as above but in @code{zp} format:
  1110. @example
  1111. 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
  1112. @end example
  1113. @end itemize
  1114. @section alimiter
  1115. The limiter prevents an input signal from rising over a desired threshold.
  1116. This limiter uses lookahead technology to prevent your signal from distorting.
  1117. It means that there is a small delay after the signal is processed. Keep in mind
  1118. that the delay it produces is the attack time you set.
  1119. The filter accepts the following options:
  1120. @table @option
  1121. @item level_in
  1122. Set input gain. Default is 1.
  1123. @item level_out
  1124. Set output gain. Default is 1.
  1125. @item limit
  1126. Don't let signals above this level pass the limiter. Default is 1.
  1127. @item attack
  1128. The limiter will reach its attenuation level in this amount of time in
  1129. milliseconds. Default is 5 milliseconds.
  1130. @item release
  1131. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1132. Default is 50 milliseconds.
  1133. @item asc
  1134. When gain reduction is always needed ASC takes care of releasing to an
  1135. average reduction level rather than reaching a reduction of 0 in the release
  1136. time.
  1137. @item asc_level
  1138. Select how much the release time is affected by ASC, 0 means nearly no changes
  1139. in release time while 1 produces higher release times.
  1140. @item level
  1141. Auto level output signal. Default is enabled.
  1142. This normalizes audio back to 0dB if enabled.
  1143. @end table
  1144. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1145. with @ref{aresample} before applying this filter.
  1146. @section allpass
  1147. Apply a two-pole all-pass filter with central frequency (in Hz)
  1148. @var{frequency}, and filter-width @var{width}.
  1149. An all-pass filter changes the audio's frequency to phase relationship
  1150. without changing its frequency to amplitude relationship.
  1151. The filter accepts the following options:
  1152. @table @option
  1153. @item frequency, f
  1154. Set frequency in Hz.
  1155. @item width_type, t
  1156. Set method to specify band-width of filter.
  1157. @table @option
  1158. @item h
  1159. Hz
  1160. @item q
  1161. Q-Factor
  1162. @item o
  1163. octave
  1164. @item s
  1165. slope
  1166. @item k
  1167. kHz
  1168. @end table
  1169. @item width, w
  1170. Specify the band-width of a filter in width_type units.
  1171. @item channels, c
  1172. Specify which channels to filter, by default all available are filtered.
  1173. @end table
  1174. @subsection Commands
  1175. This filter supports the following commands:
  1176. @table @option
  1177. @item frequency, f
  1178. Change allpass frequency.
  1179. Syntax for the command is : "@var{frequency}"
  1180. @item width_type, t
  1181. Change allpass width_type.
  1182. Syntax for the command is : "@var{width_type}"
  1183. @item width, w
  1184. Change allpass width.
  1185. Syntax for the command is : "@var{width}"
  1186. @end table
  1187. @section aloop
  1188. Loop audio samples.
  1189. The filter accepts the following options:
  1190. @table @option
  1191. @item loop
  1192. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1193. Default is 0.
  1194. @item size
  1195. Set maximal number of samples. Default is 0.
  1196. @item start
  1197. Set first sample of loop. Default is 0.
  1198. @end table
  1199. @anchor{amerge}
  1200. @section amerge
  1201. Merge two or more audio streams into a single multi-channel stream.
  1202. The filter accepts the following options:
  1203. @table @option
  1204. @item inputs
  1205. Set the number of inputs. Default is 2.
  1206. @end table
  1207. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1208. the channel layout of the output will be set accordingly and the channels
  1209. will be reordered as necessary. If the channel layouts of the inputs are not
  1210. disjoint, the output will have all the channels of the first input then all
  1211. the channels of the second input, in that order, and the channel layout of
  1212. the output will be the default value corresponding to the total number of
  1213. channels.
  1214. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1215. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1216. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1217. first input, b1 is the first channel of the second input).
  1218. On the other hand, if both input are in stereo, the output channels will be
  1219. in the default order: a1, a2, b1, b2, and the channel layout will be
  1220. arbitrarily set to 4.0, which may or may not be the expected value.
  1221. All inputs must have the same sample rate, and format.
  1222. If inputs do not have the same duration, the output will stop with the
  1223. shortest.
  1224. @subsection Examples
  1225. @itemize
  1226. @item
  1227. Merge two mono files into a stereo stream:
  1228. @example
  1229. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1230. @end example
  1231. @item
  1232. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1233. @example
  1234. 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
  1235. @end example
  1236. @end itemize
  1237. @section amix
  1238. Mixes multiple audio inputs into a single output.
  1239. Note that this filter only supports float samples (the @var{amerge}
  1240. and @var{pan} audio filters support many formats). If the @var{amix}
  1241. input has integer samples then @ref{aresample} will be automatically
  1242. inserted to perform the conversion to float samples.
  1243. For example
  1244. @example
  1245. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1246. @end example
  1247. will mix 3 input audio streams to a single output with the same duration as the
  1248. first input and a dropout transition time of 3 seconds.
  1249. It accepts the following parameters:
  1250. @table @option
  1251. @item inputs
  1252. The number of inputs. If unspecified, it defaults to 2.
  1253. @item duration
  1254. How to determine the end-of-stream.
  1255. @table @option
  1256. @item longest
  1257. The duration of the longest input. (default)
  1258. @item shortest
  1259. The duration of the shortest input.
  1260. @item first
  1261. The duration of the first input.
  1262. @end table
  1263. @item dropout_transition
  1264. The transition time, in seconds, for volume renormalization when an input
  1265. stream ends. The default value is 2 seconds.
  1266. @item weights
  1267. Specify weight of each input audio stream as sequence.
  1268. Each weight is separated by space. By default all inputs have same weight.
  1269. @end table
  1270. @section amultiply
  1271. Multiply first audio stream with second audio stream and store result
  1272. in output audio stream. Multiplication is done by multiplying each
  1273. sample from first stream with sample at same position from second stream.
  1274. With this element-wise multiplication one can create amplitude fades and
  1275. amplitude modulations.
  1276. @section anequalizer
  1277. High-order parametric multiband equalizer for each channel.
  1278. It accepts the following parameters:
  1279. @table @option
  1280. @item params
  1281. This option string is in format:
  1282. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1283. Each equalizer band is separated by '|'.
  1284. @table @option
  1285. @item chn
  1286. Set channel number to which equalization will be applied.
  1287. If input doesn't have that channel the entry is ignored.
  1288. @item f
  1289. Set central frequency for band.
  1290. If input doesn't have that frequency the entry is ignored.
  1291. @item w
  1292. Set band width in hertz.
  1293. @item g
  1294. Set band gain in dB.
  1295. @item t
  1296. Set filter type for band, optional, can be:
  1297. @table @samp
  1298. @item 0
  1299. Butterworth, this is default.
  1300. @item 1
  1301. Chebyshev type 1.
  1302. @item 2
  1303. Chebyshev type 2.
  1304. @end table
  1305. @end table
  1306. @item curves
  1307. With this option activated frequency response of anequalizer is displayed
  1308. in video stream.
  1309. @item size
  1310. Set video stream size. Only useful if curves option is activated.
  1311. @item mgain
  1312. Set max gain that will be displayed. Only useful if curves option is activated.
  1313. Setting this to a reasonable value makes it possible to display gain which is derived from
  1314. neighbour bands which are too close to each other and thus produce higher gain
  1315. when both are activated.
  1316. @item fscale
  1317. Set frequency scale used to draw frequency response in video output.
  1318. Can be linear or logarithmic. Default is logarithmic.
  1319. @item colors
  1320. Set color for each channel curve which is going to be displayed in video stream.
  1321. This is list of color names separated by space or by '|'.
  1322. Unrecognised or missing colors will be replaced by white color.
  1323. @end table
  1324. @subsection Examples
  1325. @itemize
  1326. @item
  1327. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1328. for first 2 channels using Chebyshev type 1 filter:
  1329. @example
  1330. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1331. @end example
  1332. @end itemize
  1333. @subsection Commands
  1334. This filter supports the following commands:
  1335. @table @option
  1336. @item change
  1337. Alter existing filter parameters.
  1338. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1339. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1340. error is returned.
  1341. @var{freq} set new frequency parameter.
  1342. @var{width} set new width parameter in herz.
  1343. @var{gain} set new gain parameter in dB.
  1344. Full filter invocation with asendcmd may look like this:
  1345. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1346. @end table
  1347. @section anlmdn
  1348. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1349. Each sample is adjusted by looking for other samples with similar contexts. This
  1350. context similarity is defined by comparing their surrounding patches of size
  1351. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1352. The filter accepts the following options.
  1353. @table @option
  1354. @item s
  1355. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1356. @item p
  1357. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1358. Default value is 2 milliseconds.
  1359. @item r
  1360. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1361. Default value is 6 milliseconds.
  1362. @end table
  1363. @section anull
  1364. Pass the audio source unchanged to the output.
  1365. @section apad
  1366. Pad the end of an audio stream with silence.
  1367. This can be used together with @command{ffmpeg} @option{-shortest} to
  1368. extend audio streams to the same length as the video stream.
  1369. A description of the accepted options follows.
  1370. @table @option
  1371. @item packet_size
  1372. Set silence packet size. Default value is 4096.
  1373. @item pad_len
  1374. Set the number of samples of silence to add to the end. After the
  1375. value is reached, the stream is terminated. This option is mutually
  1376. exclusive with @option{whole_len}.
  1377. @item whole_len
  1378. Set the minimum total number of samples in the output audio stream. If
  1379. the value is longer than the input audio length, silence is added to
  1380. the end, until the value is reached. This option is mutually exclusive
  1381. with @option{pad_len}.
  1382. @item pad_dur
  1383. Specify the duration of samples of silence to add. See
  1384. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1385. for the accepted syntax. Used only if set to non-zero value.
  1386. @item whole_dur
  1387. Specify the minimum total duration in the output audio stream. See
  1388. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1389. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1390. the input audio length, silence is added to the end, until the value is reached.
  1391. This option is mutually exclusive with @option{pad_dur}
  1392. @end table
  1393. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1394. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1395. the input stream indefinitely.
  1396. @subsection Examples
  1397. @itemize
  1398. @item
  1399. Add 1024 samples of silence to the end of the input:
  1400. @example
  1401. apad=pad_len=1024
  1402. @end example
  1403. @item
  1404. Make sure the audio output will contain at least 10000 samples, pad
  1405. the input with silence if required:
  1406. @example
  1407. apad=whole_len=10000
  1408. @end example
  1409. @item
  1410. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1411. video stream will always result the shortest and will be converted
  1412. until the end in the output file when using the @option{shortest}
  1413. option:
  1414. @example
  1415. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1416. @end example
  1417. @end itemize
  1418. @section aphaser
  1419. Add a phasing effect to the input audio.
  1420. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1421. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1422. A description of the accepted parameters follows.
  1423. @table @option
  1424. @item in_gain
  1425. Set input gain. Default is 0.4.
  1426. @item out_gain
  1427. Set output gain. Default is 0.74
  1428. @item delay
  1429. Set delay in milliseconds. Default is 3.0.
  1430. @item decay
  1431. Set decay. Default is 0.4.
  1432. @item speed
  1433. Set modulation speed in Hz. Default is 0.5.
  1434. @item type
  1435. Set modulation type. Default is triangular.
  1436. It accepts the following values:
  1437. @table @samp
  1438. @item triangular, t
  1439. @item sinusoidal, s
  1440. @end table
  1441. @end table
  1442. @section apulsator
  1443. Audio pulsator is something between an autopanner and a tremolo.
  1444. But it can produce funny stereo effects as well. Pulsator changes the volume
  1445. of the left and right channel based on a LFO (low frequency oscillator) with
  1446. different waveforms and shifted phases.
  1447. This filter have the ability to define an offset between left and right
  1448. channel. An offset of 0 means that both LFO shapes match each other.
  1449. The left and right channel are altered equally - a conventional tremolo.
  1450. An offset of 50% means that the shape of the right channel is exactly shifted
  1451. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1452. an autopanner. At 1 both curves match again. Every setting in between moves the
  1453. phase shift gapless between all stages and produces some "bypassing" sounds with
  1454. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1455. the 0.5) the faster the signal passes from the left to the right speaker.
  1456. The filter accepts the following options:
  1457. @table @option
  1458. @item level_in
  1459. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1460. @item level_out
  1461. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1462. @item mode
  1463. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1464. sawup or sawdown. Default is sine.
  1465. @item amount
  1466. Set modulation. Define how much of original signal is affected by the LFO.
  1467. @item offset_l
  1468. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1469. @item offset_r
  1470. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1471. @item width
  1472. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1473. @item timing
  1474. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1475. @item bpm
  1476. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1477. is set to bpm.
  1478. @item ms
  1479. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1480. is set to ms.
  1481. @item hz
  1482. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1483. if timing is set to hz.
  1484. @end table
  1485. @anchor{aresample}
  1486. @section aresample
  1487. Resample the input audio to the specified parameters, using the
  1488. libswresample library. If none are specified then the filter will
  1489. automatically convert between its input and output.
  1490. This filter is also able to stretch/squeeze the audio data to make it match
  1491. the timestamps or to inject silence / cut out audio to make it match the
  1492. timestamps, do a combination of both or do neither.
  1493. The filter accepts the syntax
  1494. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1495. expresses a sample rate and @var{resampler_options} is a list of
  1496. @var{key}=@var{value} pairs, separated by ":". See the
  1497. @ref{Resampler Options,,"Resampler Options" section in the
  1498. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1499. for the complete list of supported options.
  1500. @subsection Examples
  1501. @itemize
  1502. @item
  1503. Resample the input audio to 44100Hz:
  1504. @example
  1505. aresample=44100
  1506. @end example
  1507. @item
  1508. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1509. samples per second compensation:
  1510. @example
  1511. aresample=async=1000
  1512. @end example
  1513. @end itemize
  1514. @section areverse
  1515. Reverse an audio clip.
  1516. Warning: This filter requires memory to buffer the entire clip, so trimming
  1517. is suggested.
  1518. @subsection Examples
  1519. @itemize
  1520. @item
  1521. Take the first 5 seconds of a clip, and reverse it.
  1522. @example
  1523. atrim=end=5,areverse
  1524. @end example
  1525. @end itemize
  1526. @section asetnsamples
  1527. Set the number of samples per each output audio frame.
  1528. The last output packet may contain a different number of samples, as
  1529. the filter will flush all the remaining samples when the input audio
  1530. signals its end.
  1531. The filter accepts the following options:
  1532. @table @option
  1533. @item nb_out_samples, n
  1534. Set the number of frames per each output audio frame. The number is
  1535. intended as the number of samples @emph{per each channel}.
  1536. Default value is 1024.
  1537. @item pad, p
  1538. If set to 1, the filter will pad the last audio frame with zeroes, so
  1539. that the last frame will contain the same number of samples as the
  1540. previous ones. Default value is 1.
  1541. @end table
  1542. For example, to set the number of per-frame samples to 1234 and
  1543. disable padding for the last frame, use:
  1544. @example
  1545. asetnsamples=n=1234:p=0
  1546. @end example
  1547. @section asetrate
  1548. Set the sample rate without altering the PCM data.
  1549. This will result in a change of speed and pitch.
  1550. The filter accepts the following options:
  1551. @table @option
  1552. @item sample_rate, r
  1553. Set the output sample rate. Default is 44100 Hz.
  1554. @end table
  1555. @section ashowinfo
  1556. Show a line containing various information for each input audio frame.
  1557. The input audio is not modified.
  1558. The shown line contains a sequence of key/value pairs of the form
  1559. @var{key}:@var{value}.
  1560. The following values are shown in the output:
  1561. @table @option
  1562. @item n
  1563. The (sequential) number of the input frame, starting from 0.
  1564. @item pts
  1565. The presentation timestamp of the input frame, in time base units; the time base
  1566. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1567. @item pts_time
  1568. The presentation timestamp of the input frame in seconds.
  1569. @item pos
  1570. position of the frame in the input stream, -1 if this information in
  1571. unavailable and/or meaningless (for example in case of synthetic audio)
  1572. @item fmt
  1573. The sample format.
  1574. @item chlayout
  1575. The channel layout.
  1576. @item rate
  1577. The sample rate for the audio frame.
  1578. @item nb_samples
  1579. The number of samples (per channel) in the frame.
  1580. @item checksum
  1581. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1582. audio, the data is treated as if all the planes were concatenated.
  1583. @item plane_checksums
  1584. A list of Adler-32 checksums for each data plane.
  1585. @end table
  1586. @anchor{astats}
  1587. @section astats
  1588. Display time domain statistical information about the audio channels.
  1589. Statistics are calculated and displayed for each audio channel and,
  1590. where applicable, an overall figure is also given.
  1591. It accepts the following option:
  1592. @table @option
  1593. @item length
  1594. Short window length in seconds, used for peak and trough RMS measurement.
  1595. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1596. @item metadata
  1597. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1598. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1599. disabled.
  1600. Available keys for each channel are:
  1601. DC_offset
  1602. Min_level
  1603. Max_level
  1604. Min_difference
  1605. Max_difference
  1606. Mean_difference
  1607. RMS_difference
  1608. Peak_level
  1609. RMS_peak
  1610. RMS_trough
  1611. Crest_factor
  1612. Flat_factor
  1613. Peak_count
  1614. Bit_depth
  1615. Dynamic_range
  1616. Zero_crossings
  1617. Zero_crossings_rate
  1618. and for Overall:
  1619. DC_offset
  1620. Min_level
  1621. Max_level
  1622. Min_difference
  1623. Max_difference
  1624. Mean_difference
  1625. RMS_difference
  1626. Peak_level
  1627. RMS_level
  1628. RMS_peak
  1629. RMS_trough
  1630. Flat_factor
  1631. Peak_count
  1632. Bit_depth
  1633. Number_of_samples
  1634. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1635. this @code{lavfi.astats.Overall.Peak_count}.
  1636. For description what each key means read below.
  1637. @item reset
  1638. Set number of frame after which stats are going to be recalculated.
  1639. Default is disabled.
  1640. @end table
  1641. A description of each shown parameter follows:
  1642. @table @option
  1643. @item DC offset
  1644. Mean amplitude displacement from zero.
  1645. @item Min level
  1646. Minimal sample level.
  1647. @item Max level
  1648. Maximal sample level.
  1649. @item Min difference
  1650. Minimal difference between two consecutive samples.
  1651. @item Max difference
  1652. Maximal difference between two consecutive samples.
  1653. @item Mean difference
  1654. Mean difference between two consecutive samples.
  1655. The average of each difference between two consecutive samples.
  1656. @item RMS difference
  1657. Root Mean Square difference between two consecutive samples.
  1658. @item Peak level dB
  1659. @item RMS level dB
  1660. Standard peak and RMS level measured in dBFS.
  1661. @item RMS peak dB
  1662. @item RMS trough dB
  1663. Peak and trough values for RMS level measured over a short window.
  1664. @item Crest factor
  1665. Standard ratio of peak to RMS level (note: not in dB).
  1666. @item Flat factor
  1667. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1668. (i.e. either @var{Min level} or @var{Max level}).
  1669. @item Peak count
  1670. Number of occasions (not the number of samples) that the signal attained either
  1671. @var{Min level} or @var{Max level}.
  1672. @item Bit depth
  1673. Overall bit depth of audio. Number of bits used for each sample.
  1674. @item Dynamic range
  1675. Measured dynamic range of audio in dB.
  1676. @item Zero crossings
  1677. Number of points where the waveform crosses the zero level axis.
  1678. @item Zero crossings rate
  1679. Rate of Zero crossings and number of audio samples.
  1680. @end table
  1681. @section atempo
  1682. Adjust audio tempo.
  1683. The filter accepts exactly one parameter, the audio tempo. If not
  1684. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1685. be in the [0.5, 100.0] range.
  1686. Note that tempo greater than 2 will skip some samples rather than
  1687. blend them in. If for any reason this is a concern it is always
  1688. possible to daisy-chain several instances of atempo to achieve the
  1689. desired product tempo.
  1690. @subsection Examples
  1691. @itemize
  1692. @item
  1693. Slow down audio to 80% tempo:
  1694. @example
  1695. atempo=0.8
  1696. @end example
  1697. @item
  1698. To speed up audio to 300% tempo:
  1699. @example
  1700. atempo=3
  1701. @end example
  1702. @item
  1703. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1704. @example
  1705. atempo=sqrt(3),atempo=sqrt(3)
  1706. @end example
  1707. @end itemize
  1708. @section atrim
  1709. Trim the input so that the output contains one continuous subpart of the input.
  1710. It accepts the following parameters:
  1711. @table @option
  1712. @item start
  1713. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1714. sample with the timestamp @var{start} will be the first sample in the output.
  1715. @item end
  1716. Specify time of the first audio sample that will be dropped, i.e. the
  1717. audio sample immediately preceding the one with the timestamp @var{end} will be
  1718. the last sample in the output.
  1719. @item start_pts
  1720. Same as @var{start}, except this option sets the start timestamp in samples
  1721. instead of seconds.
  1722. @item end_pts
  1723. Same as @var{end}, except this option sets the end timestamp in samples instead
  1724. of seconds.
  1725. @item duration
  1726. The maximum duration of the output in seconds.
  1727. @item start_sample
  1728. The number of the first sample that should be output.
  1729. @item end_sample
  1730. The number of the first sample that should be dropped.
  1731. @end table
  1732. @option{start}, @option{end}, and @option{duration} are expressed as time
  1733. duration specifications; see
  1734. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1735. Note that the first two sets of the start/end options and the @option{duration}
  1736. option look at the frame timestamp, while the _sample options simply count the
  1737. samples that pass through the filter. So start/end_pts and start/end_sample will
  1738. give different results when the timestamps are wrong, inexact or do not start at
  1739. zero. Also note that this filter does not modify the timestamps. If you wish
  1740. to have the output timestamps start at zero, insert the asetpts filter after the
  1741. atrim filter.
  1742. If multiple start or end options are set, this filter tries to be greedy and
  1743. keep all samples that match at least one of the specified constraints. To keep
  1744. only the part that matches all the constraints at once, chain multiple atrim
  1745. filters.
  1746. The defaults are such that all the input is kept. So it is possible to set e.g.
  1747. just the end values to keep everything before the specified time.
  1748. Examples:
  1749. @itemize
  1750. @item
  1751. Drop everything except the second minute of input:
  1752. @example
  1753. ffmpeg -i INPUT -af atrim=60:120
  1754. @end example
  1755. @item
  1756. Keep only the first 1000 samples:
  1757. @example
  1758. ffmpeg -i INPUT -af atrim=end_sample=1000
  1759. @end example
  1760. @end itemize
  1761. @section bandpass
  1762. Apply a two-pole Butterworth band-pass filter with central
  1763. frequency @var{frequency}, and (3dB-point) band-width width.
  1764. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1765. instead of the default: constant 0dB peak gain.
  1766. The filter roll off at 6dB per octave (20dB per decade).
  1767. The filter accepts the following options:
  1768. @table @option
  1769. @item frequency, f
  1770. Set the filter's central frequency. Default is @code{3000}.
  1771. @item csg
  1772. Constant skirt gain if set to 1. Defaults to 0.
  1773. @item width_type, t
  1774. Set method to specify band-width of filter.
  1775. @table @option
  1776. @item h
  1777. Hz
  1778. @item q
  1779. Q-Factor
  1780. @item o
  1781. octave
  1782. @item s
  1783. slope
  1784. @item k
  1785. kHz
  1786. @end table
  1787. @item width, w
  1788. Specify the band-width of a filter in width_type units.
  1789. @item channels, c
  1790. Specify which channels to filter, by default all available are filtered.
  1791. @end table
  1792. @subsection Commands
  1793. This filter supports the following commands:
  1794. @table @option
  1795. @item frequency, f
  1796. Change bandpass frequency.
  1797. Syntax for the command is : "@var{frequency}"
  1798. @item width_type, t
  1799. Change bandpass width_type.
  1800. Syntax for the command is : "@var{width_type}"
  1801. @item width, w
  1802. Change bandpass width.
  1803. Syntax for the command is : "@var{width}"
  1804. @end table
  1805. @section bandreject
  1806. Apply a two-pole Butterworth band-reject filter with central
  1807. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1808. The filter roll off at 6dB per octave (20dB per decade).
  1809. The filter accepts the following options:
  1810. @table @option
  1811. @item frequency, f
  1812. Set the filter's central frequency. Default is @code{3000}.
  1813. @item width_type, t
  1814. Set method to specify band-width of filter.
  1815. @table @option
  1816. @item h
  1817. Hz
  1818. @item q
  1819. Q-Factor
  1820. @item o
  1821. octave
  1822. @item s
  1823. slope
  1824. @item k
  1825. kHz
  1826. @end table
  1827. @item width, w
  1828. Specify the band-width of a filter in width_type units.
  1829. @item channels, c
  1830. Specify which channels to filter, by default all available are filtered.
  1831. @end table
  1832. @subsection Commands
  1833. This filter supports the following commands:
  1834. @table @option
  1835. @item frequency, f
  1836. Change bandreject frequency.
  1837. Syntax for the command is : "@var{frequency}"
  1838. @item width_type, t
  1839. Change bandreject width_type.
  1840. Syntax for the command is : "@var{width_type}"
  1841. @item width, w
  1842. Change bandreject width.
  1843. Syntax for the command is : "@var{width}"
  1844. @end table
  1845. @section bass, lowshelf
  1846. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1847. shelving filter with a response similar to that of a standard
  1848. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1849. The filter accepts the following options:
  1850. @table @option
  1851. @item gain, g
  1852. Give the gain at 0 Hz. Its useful range is about -20
  1853. (for a large cut) to +20 (for a large boost).
  1854. Beware of clipping when using a positive gain.
  1855. @item frequency, f
  1856. Set the filter's central frequency and so can be used
  1857. to extend or reduce the frequency range to be boosted or cut.
  1858. The default value is @code{100} Hz.
  1859. @item width_type, t
  1860. Set method to specify band-width of filter.
  1861. @table @option
  1862. @item h
  1863. Hz
  1864. @item q
  1865. Q-Factor
  1866. @item o
  1867. octave
  1868. @item s
  1869. slope
  1870. @item k
  1871. kHz
  1872. @end table
  1873. @item width, w
  1874. Determine how steep is the filter's shelf transition.
  1875. @item channels, c
  1876. Specify which channels to filter, by default all available are filtered.
  1877. @end table
  1878. @subsection Commands
  1879. This filter supports the following commands:
  1880. @table @option
  1881. @item frequency, f
  1882. Change bass frequency.
  1883. Syntax for the command is : "@var{frequency}"
  1884. @item width_type, t
  1885. Change bass width_type.
  1886. Syntax for the command is : "@var{width_type}"
  1887. @item width, w
  1888. Change bass width.
  1889. Syntax for the command is : "@var{width}"
  1890. @item gain, g
  1891. Change bass gain.
  1892. Syntax for the command is : "@var{gain}"
  1893. @end table
  1894. @section biquad
  1895. Apply a biquad IIR filter with the given coefficients.
  1896. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1897. are the numerator and denominator coefficients respectively.
  1898. and @var{channels}, @var{c} specify which channels to filter, by default all
  1899. available are filtered.
  1900. @subsection Commands
  1901. This filter supports the following commands:
  1902. @table @option
  1903. @item a0
  1904. @item a1
  1905. @item a2
  1906. @item b0
  1907. @item b1
  1908. @item b2
  1909. Change biquad parameter.
  1910. Syntax for the command is : "@var{value}"
  1911. @end table
  1912. @section bs2b
  1913. Bauer stereo to binaural transformation, which improves headphone listening of
  1914. stereo audio records.
  1915. To enable compilation of this filter you need to configure FFmpeg with
  1916. @code{--enable-libbs2b}.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item profile
  1920. Pre-defined crossfeed level.
  1921. @table @option
  1922. @item default
  1923. Default level (fcut=700, feed=50).
  1924. @item cmoy
  1925. Chu Moy circuit (fcut=700, feed=60).
  1926. @item jmeier
  1927. Jan Meier circuit (fcut=650, feed=95).
  1928. @end table
  1929. @item fcut
  1930. Cut frequency (in Hz).
  1931. @item feed
  1932. Feed level (in Hz).
  1933. @end table
  1934. @section channelmap
  1935. Remap input channels to new locations.
  1936. It accepts the following parameters:
  1937. @table @option
  1938. @item map
  1939. Map channels from input to output. The argument is a '|'-separated list of
  1940. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1941. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1942. channel (e.g. FL for front left) or its index in the input channel layout.
  1943. @var{out_channel} is the name of the output channel or its index in the output
  1944. channel layout. If @var{out_channel} is not given then it is implicitly an
  1945. index, starting with zero and increasing by one for each mapping.
  1946. @item channel_layout
  1947. The channel layout of the output stream.
  1948. @end table
  1949. If no mapping is present, the filter will implicitly map input channels to
  1950. output channels, preserving indices.
  1951. @subsection Examples
  1952. @itemize
  1953. @item
  1954. For example, assuming a 5.1+downmix input MOV file,
  1955. @example
  1956. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1957. @end example
  1958. will create an output WAV file tagged as stereo from the downmix channels of
  1959. the input.
  1960. @item
  1961. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1962. @example
  1963. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1964. @end example
  1965. @end itemize
  1966. @section channelsplit
  1967. Split each channel from an input audio stream into a separate output stream.
  1968. It accepts the following parameters:
  1969. @table @option
  1970. @item channel_layout
  1971. The channel layout of the input stream. The default is "stereo".
  1972. @item channels
  1973. A channel layout describing the channels to be extracted as separate output streams
  1974. or "all" to extract each input channel as a separate stream. The default is "all".
  1975. Choosing channels not present in channel layout in the input will result in an error.
  1976. @end table
  1977. @subsection Examples
  1978. @itemize
  1979. @item
  1980. For example, assuming a stereo input MP3 file,
  1981. @example
  1982. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1983. @end example
  1984. will create an output Matroska file with two audio streams, one containing only
  1985. the left channel and the other the right channel.
  1986. @item
  1987. Split a 5.1 WAV file into per-channel files:
  1988. @example
  1989. ffmpeg -i in.wav -filter_complex
  1990. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1991. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1992. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1993. side_right.wav
  1994. @end example
  1995. @item
  1996. Extract only LFE from a 5.1 WAV file:
  1997. @example
  1998. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1999. -map '[LFE]' lfe.wav
  2000. @end example
  2001. @end itemize
  2002. @section chorus
  2003. Add a chorus effect to the audio.
  2004. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2005. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2006. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2007. The modulation depth defines the range the modulated delay is played before or after
  2008. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2009. sound tuned around the original one, like in a chorus where some vocals are slightly
  2010. off key.
  2011. It accepts the following parameters:
  2012. @table @option
  2013. @item in_gain
  2014. Set input gain. Default is 0.4.
  2015. @item out_gain
  2016. Set output gain. Default is 0.4.
  2017. @item delays
  2018. Set delays. A typical delay is around 40ms to 60ms.
  2019. @item decays
  2020. Set decays.
  2021. @item speeds
  2022. Set speeds.
  2023. @item depths
  2024. Set depths.
  2025. @end table
  2026. @subsection Examples
  2027. @itemize
  2028. @item
  2029. A single delay:
  2030. @example
  2031. chorus=0.7:0.9:55:0.4:0.25:2
  2032. @end example
  2033. @item
  2034. Two delays:
  2035. @example
  2036. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2037. @end example
  2038. @item
  2039. Fuller sounding chorus with three delays:
  2040. @example
  2041. 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
  2042. @end example
  2043. @end itemize
  2044. @section compand
  2045. Compress or expand the audio's dynamic range.
  2046. It accepts the following parameters:
  2047. @table @option
  2048. @item attacks
  2049. @item decays
  2050. A list of times in seconds for each channel over which the instantaneous level
  2051. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2052. increase of volume and @var{decays} refers to decrease of volume. For most
  2053. situations, the attack time (response to the audio getting louder) should be
  2054. shorter than the decay time, because the human ear is more sensitive to sudden
  2055. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2056. a typical value for decay is 0.8 seconds.
  2057. If specified number of attacks & decays is lower than number of channels, the last
  2058. set attack/decay will be used for all remaining channels.
  2059. @item points
  2060. A list of points for the transfer function, specified in dB relative to the
  2061. maximum possible signal amplitude. Each key points list must be defined using
  2062. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2063. @code{x0/y0 x1/y1 x2/y2 ....}
  2064. The input values must be in strictly increasing order but the transfer function
  2065. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2066. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2067. function are @code{-70/-70|-60/-20|1/0}.
  2068. @item soft-knee
  2069. Set the curve radius in dB for all joints. It defaults to 0.01.
  2070. @item gain
  2071. Set the additional gain in dB to be applied at all points on the transfer
  2072. function. This allows for easy adjustment of the overall gain.
  2073. It defaults to 0.
  2074. @item volume
  2075. Set an initial volume, in dB, to be assumed for each channel when filtering
  2076. starts. This permits the user to supply a nominal level initially, so that, for
  2077. example, a very large gain is not applied to initial signal levels before the
  2078. companding has begun to operate. A typical value for audio which is initially
  2079. quiet is -90 dB. It defaults to 0.
  2080. @item delay
  2081. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2082. delayed before being fed to the volume adjuster. Specifying a delay
  2083. approximately equal to the attack/decay times allows the filter to effectively
  2084. operate in predictive rather than reactive mode. It defaults to 0.
  2085. @end table
  2086. @subsection Examples
  2087. @itemize
  2088. @item
  2089. Make music with both quiet and loud passages suitable for listening to in a
  2090. noisy environment:
  2091. @example
  2092. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2093. @end example
  2094. Another example for audio with whisper and explosion parts:
  2095. @example
  2096. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2097. @end example
  2098. @item
  2099. A noise gate for when the noise is at a lower level than the signal:
  2100. @example
  2101. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2102. @end example
  2103. @item
  2104. Here is another noise gate, this time for when the noise is at a higher level
  2105. than the signal (making it, in some ways, similar to squelch):
  2106. @example
  2107. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2108. @end example
  2109. @item
  2110. 2:1 compression starting at -6dB:
  2111. @example
  2112. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2113. @end example
  2114. @item
  2115. 2:1 compression starting at -9dB:
  2116. @example
  2117. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2118. @end example
  2119. @item
  2120. 2:1 compression starting at -12dB:
  2121. @example
  2122. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2123. @end example
  2124. @item
  2125. 2:1 compression starting at -18dB:
  2126. @example
  2127. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2128. @end example
  2129. @item
  2130. 3:1 compression starting at -15dB:
  2131. @example
  2132. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2133. @end example
  2134. @item
  2135. Compressor/Gate:
  2136. @example
  2137. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2138. @end example
  2139. @item
  2140. Expander:
  2141. @example
  2142. 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
  2143. @end example
  2144. @item
  2145. Hard limiter at -6dB:
  2146. @example
  2147. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2148. @end example
  2149. @item
  2150. Hard limiter at -12dB:
  2151. @example
  2152. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2153. @end example
  2154. @item
  2155. Hard noise gate at -35 dB:
  2156. @example
  2157. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2158. @end example
  2159. @item
  2160. Soft limiter:
  2161. @example
  2162. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2163. @end example
  2164. @end itemize
  2165. @section compensationdelay
  2166. Compensation Delay Line is a metric based delay to compensate differing
  2167. positions of microphones or speakers.
  2168. For example, you have recorded guitar with two microphones placed in
  2169. different location. Because the front of sound wave has fixed speed in
  2170. normal conditions, the phasing of microphones can vary and depends on
  2171. their location and interposition. The best sound mix can be achieved when
  2172. these microphones are in phase (synchronized). Note that distance of
  2173. ~30 cm between microphones makes one microphone to capture signal in
  2174. antiphase to another microphone. That makes the final mix sounding moody.
  2175. This filter helps to solve phasing problems by adding different delays
  2176. to each microphone track and make them synchronized.
  2177. The best result can be reached when you take one track as base and
  2178. synchronize other tracks one by one with it.
  2179. Remember that synchronization/delay tolerance depends on sample rate, too.
  2180. Higher sample rates will give more tolerance.
  2181. It accepts the following parameters:
  2182. @table @option
  2183. @item mm
  2184. Set millimeters distance. This is compensation distance for fine tuning.
  2185. Default is 0.
  2186. @item cm
  2187. Set cm distance. This is compensation distance for tightening distance setup.
  2188. Default is 0.
  2189. @item m
  2190. Set meters distance. This is compensation distance for hard distance setup.
  2191. Default is 0.
  2192. @item dry
  2193. Set dry amount. Amount of unprocessed (dry) signal.
  2194. Default is 0.
  2195. @item wet
  2196. Set wet amount. Amount of processed (wet) signal.
  2197. Default is 1.
  2198. @item temp
  2199. Set temperature degree in Celsius. This is the temperature of the environment.
  2200. Default is 20.
  2201. @end table
  2202. @section crossfeed
  2203. Apply headphone crossfeed filter.
  2204. Crossfeed is the process of blending the left and right channels of stereo
  2205. audio recording.
  2206. It is mainly used to reduce extreme stereo separation of low frequencies.
  2207. The intent is to produce more speaker like sound to the listener.
  2208. The filter accepts the following options:
  2209. @table @option
  2210. @item strength
  2211. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2212. This sets gain of low shelf filter for side part of stereo image.
  2213. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2214. @item range
  2215. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2216. This sets cut off frequency of low shelf filter. Default is cut off near
  2217. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2218. @item level_in
  2219. Set input gain. Default is 0.9.
  2220. @item level_out
  2221. Set output gain. Default is 1.
  2222. @end table
  2223. @section crystalizer
  2224. Simple algorithm to expand audio dynamic range.
  2225. The filter accepts the following options:
  2226. @table @option
  2227. @item i
  2228. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2229. (unchanged sound) to 10.0 (maximum effect).
  2230. @item c
  2231. Enable clipping. By default is enabled.
  2232. @end table
  2233. @section dcshift
  2234. Apply a DC shift to the audio.
  2235. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2236. in the recording chain) from the audio. The effect of a DC offset is reduced
  2237. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2238. a signal has a DC offset.
  2239. @table @option
  2240. @item shift
  2241. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2242. the audio.
  2243. @item limitergain
  2244. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2245. used to prevent clipping.
  2246. @end table
  2247. @section drmeter
  2248. Measure audio dynamic range.
  2249. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2250. is found in transition material. And anything less that 8 have very poor dynamics
  2251. and is very compressed.
  2252. The filter accepts the following options:
  2253. @table @option
  2254. @item length
  2255. Set window length in seconds used to split audio into segments of equal length.
  2256. Default is 3 seconds.
  2257. @end table
  2258. @section dynaudnorm
  2259. Dynamic Audio Normalizer.
  2260. This filter applies a certain amount of gain to the input audio in order
  2261. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2262. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2263. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2264. This allows for applying extra gain to the "quiet" sections of the audio
  2265. while avoiding distortions or clipping the "loud" sections. In other words:
  2266. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2267. sections, in the sense that the volume of each section is brought to the
  2268. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2269. this goal *without* applying "dynamic range compressing". It will retain 100%
  2270. of the dynamic range *within* each section of the audio file.
  2271. @table @option
  2272. @item f
  2273. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2274. Default is 500 milliseconds.
  2275. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2276. referred to as frames. This is required, because a peak magnitude has no
  2277. meaning for just a single sample value. Instead, we need to determine the
  2278. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2279. normalizer would simply use the peak magnitude of the complete file, the
  2280. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2281. frame. The length of a frame is specified in milliseconds. By default, the
  2282. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2283. been found to give good results with most files.
  2284. Note that the exact frame length, in number of samples, will be determined
  2285. automatically, based on the sampling rate of the individual input audio file.
  2286. @item g
  2287. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2288. number. Default is 31.
  2289. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2290. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2291. is specified in frames, centered around the current frame. For the sake of
  2292. simplicity, this must be an odd number. Consequently, the default value of 31
  2293. takes into account the current frame, as well as the 15 preceding frames and
  2294. the 15 subsequent frames. Using a larger window results in a stronger
  2295. smoothing effect and thus in less gain variation, i.e. slower gain
  2296. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2297. effect and thus in more gain variation, i.e. faster gain adaptation.
  2298. In other words, the more you increase this value, the more the Dynamic Audio
  2299. Normalizer will behave like a "traditional" normalization filter. On the
  2300. contrary, the more you decrease this value, the more the Dynamic Audio
  2301. Normalizer will behave like a dynamic range compressor.
  2302. @item p
  2303. Set the target peak value. This specifies the highest permissible magnitude
  2304. level for the normalized audio input. This filter will try to approach the
  2305. target peak magnitude as closely as possible, but at the same time it also
  2306. makes sure that the normalized signal will never exceed the peak magnitude.
  2307. A frame's maximum local gain factor is imposed directly by the target peak
  2308. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2309. It is not recommended to go above this value.
  2310. @item m
  2311. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2312. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2313. factor for each input frame, i.e. the maximum gain factor that does not
  2314. result in clipping or distortion. The maximum gain factor is determined by
  2315. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2316. additionally bounds the frame's maximum gain factor by a predetermined
  2317. (global) maximum gain factor. This is done in order to avoid excessive gain
  2318. factors in "silent" or almost silent frames. By default, the maximum gain
  2319. factor is 10.0, For most inputs the default value should be sufficient and
  2320. it usually is not recommended to increase this value. Though, for input
  2321. with an extremely low overall volume level, it may be necessary to allow even
  2322. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2323. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2324. Instead, a "sigmoid" threshold function will be applied. This way, the
  2325. gain factors will smoothly approach the threshold value, but never exceed that
  2326. value.
  2327. @item r
  2328. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2329. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2330. This means that the maximum local gain factor for each frame is defined
  2331. (only) by the frame's highest magnitude sample. This way, the samples can
  2332. be amplified as much as possible without exceeding the maximum signal
  2333. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2334. Normalizer can also take into account the frame's root mean square,
  2335. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2336. determine the power of a time-varying signal. It is therefore considered
  2337. that the RMS is a better approximation of the "perceived loudness" than
  2338. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2339. frames to a constant RMS value, a uniform "perceived loudness" can be
  2340. established. If a target RMS value has been specified, a frame's local gain
  2341. factor is defined as the factor that would result in exactly that RMS value.
  2342. Note, however, that the maximum local gain factor is still restricted by the
  2343. frame's highest magnitude sample, in order to prevent clipping.
  2344. @item n
  2345. Enable channels coupling. By default is enabled.
  2346. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2347. amount. This means the same gain factor will be applied to all channels, i.e.
  2348. the maximum possible gain factor is determined by the "loudest" channel.
  2349. However, in some recordings, it may happen that the volume of the different
  2350. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2351. In this case, this option can be used to disable the channel coupling. This way,
  2352. the gain factor will be determined independently for each channel, depending
  2353. only on the individual channel's highest magnitude sample. This allows for
  2354. harmonizing the volume of the different channels.
  2355. @item c
  2356. Enable DC bias correction. By default is disabled.
  2357. An audio signal (in the time domain) is a sequence of sample values.
  2358. In the Dynamic Audio Normalizer these sample values are represented in the
  2359. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2360. audio signal, or "waveform", should be centered around the zero point.
  2361. That means if we calculate the mean value of all samples in a file, or in a
  2362. single frame, then the result should be 0.0 or at least very close to that
  2363. value. If, however, there is a significant deviation of the mean value from
  2364. 0.0, in either positive or negative direction, this is referred to as a
  2365. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2366. Audio Normalizer provides optional DC bias correction.
  2367. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2368. the mean value, or "DC correction" offset, of each input frame and subtract
  2369. that value from all of the frame's sample values which ensures those samples
  2370. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2371. boundaries, the DC correction offset values will be interpolated smoothly
  2372. between neighbouring frames.
  2373. @item b
  2374. Enable alternative boundary mode. By default is disabled.
  2375. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2376. around each frame. This includes the preceding frames as well as the
  2377. subsequent frames. However, for the "boundary" frames, located at the very
  2378. beginning and at the very end of the audio file, not all neighbouring
  2379. frames are available. In particular, for the first few frames in the audio
  2380. file, the preceding frames are not known. And, similarly, for the last few
  2381. frames in the audio file, the subsequent frames are not known. Thus, the
  2382. question arises which gain factors should be assumed for the missing frames
  2383. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2384. to deal with this situation. The default boundary mode assumes a gain factor
  2385. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2386. "fade out" at the beginning and at the end of the input, respectively.
  2387. @item s
  2388. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2389. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2390. compression. This means that signal peaks will not be pruned and thus the
  2391. full dynamic range will be retained within each local neighbourhood. However,
  2392. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2393. normalization algorithm with a more "traditional" compression.
  2394. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2395. (thresholding) function. If (and only if) the compression feature is enabled,
  2396. all input frames will be processed by a soft knee thresholding function prior
  2397. to the actual normalization process. Put simply, the thresholding function is
  2398. going to prune all samples whose magnitude exceeds a certain threshold value.
  2399. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2400. value. Instead, the threshold value will be adjusted for each individual
  2401. frame.
  2402. In general, smaller parameters result in stronger compression, and vice versa.
  2403. Values below 3.0 are not recommended, because audible distortion may appear.
  2404. @end table
  2405. @section earwax
  2406. Make audio easier to listen to on headphones.
  2407. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2408. so that when listened to on headphones the stereo image is moved from
  2409. inside your head (standard for headphones) to outside and in front of
  2410. the listener (standard for speakers).
  2411. Ported from SoX.
  2412. @section equalizer
  2413. Apply a two-pole peaking equalisation (EQ) filter. With this
  2414. filter, the signal-level at and around a selected frequency can
  2415. be increased or decreased, whilst (unlike bandpass and bandreject
  2416. filters) that at all other frequencies is unchanged.
  2417. In order to produce complex equalisation curves, this filter can
  2418. be given several times, each with a different central frequency.
  2419. The filter accepts the following options:
  2420. @table @option
  2421. @item frequency, f
  2422. Set the filter's central frequency in Hz.
  2423. @item width_type, t
  2424. Set method to specify band-width of filter.
  2425. @table @option
  2426. @item h
  2427. Hz
  2428. @item q
  2429. Q-Factor
  2430. @item o
  2431. octave
  2432. @item s
  2433. slope
  2434. @item k
  2435. kHz
  2436. @end table
  2437. @item width, w
  2438. Specify the band-width of a filter in width_type units.
  2439. @item gain, g
  2440. Set the required gain or attenuation in dB.
  2441. Beware of clipping when using a positive gain.
  2442. @item channels, c
  2443. Specify which channels to filter, by default all available are filtered.
  2444. @end table
  2445. @subsection Examples
  2446. @itemize
  2447. @item
  2448. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2449. @example
  2450. equalizer=f=1000:t=h:width=200:g=-10
  2451. @end example
  2452. @item
  2453. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2454. @example
  2455. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2456. @end example
  2457. @end itemize
  2458. @subsection Commands
  2459. This filter supports the following commands:
  2460. @table @option
  2461. @item frequency, f
  2462. Change equalizer frequency.
  2463. Syntax for the command is : "@var{frequency}"
  2464. @item width_type, t
  2465. Change equalizer width_type.
  2466. Syntax for the command is : "@var{width_type}"
  2467. @item width, w
  2468. Change equalizer width.
  2469. Syntax for the command is : "@var{width}"
  2470. @item gain, g
  2471. Change equalizer gain.
  2472. Syntax for the command is : "@var{gain}"
  2473. @end table
  2474. @section extrastereo
  2475. Linearly increases the difference between left and right channels which
  2476. adds some sort of "live" effect to playback.
  2477. The filter accepts the following options:
  2478. @table @option
  2479. @item m
  2480. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2481. (average of both channels), with 1.0 sound will be unchanged, with
  2482. -1.0 left and right channels will be swapped.
  2483. @item c
  2484. Enable clipping. By default is enabled.
  2485. @end table
  2486. @section firequalizer
  2487. Apply FIR Equalization using arbitrary frequency response.
  2488. The filter accepts the following option:
  2489. @table @option
  2490. @item gain
  2491. Set gain curve equation (in dB). The expression can contain variables:
  2492. @table @option
  2493. @item f
  2494. the evaluated frequency
  2495. @item sr
  2496. sample rate
  2497. @item ch
  2498. channel number, set to 0 when multichannels evaluation is disabled
  2499. @item chid
  2500. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2501. multichannels evaluation is disabled
  2502. @item chs
  2503. number of channels
  2504. @item chlayout
  2505. channel_layout, see libavutil/channel_layout.h
  2506. @end table
  2507. and functions:
  2508. @table @option
  2509. @item gain_interpolate(f)
  2510. interpolate gain on frequency f based on gain_entry
  2511. @item cubic_interpolate(f)
  2512. same as gain_interpolate, but smoother
  2513. @end table
  2514. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2515. @item gain_entry
  2516. Set gain entry for gain_interpolate function. The expression can
  2517. contain functions:
  2518. @table @option
  2519. @item entry(f, g)
  2520. store gain entry at frequency f with value g
  2521. @end table
  2522. This option is also available as command.
  2523. @item delay
  2524. Set filter delay in seconds. Higher value means more accurate.
  2525. Default is @code{0.01}.
  2526. @item accuracy
  2527. Set filter accuracy in Hz. Lower value means more accurate.
  2528. Default is @code{5}.
  2529. @item wfunc
  2530. Set window function. Acceptable values are:
  2531. @table @option
  2532. @item rectangular
  2533. rectangular window, useful when gain curve is already smooth
  2534. @item hann
  2535. hann window (default)
  2536. @item hamming
  2537. hamming window
  2538. @item blackman
  2539. blackman window
  2540. @item nuttall3
  2541. 3-terms continuous 1st derivative nuttall window
  2542. @item mnuttall3
  2543. minimum 3-terms discontinuous nuttall window
  2544. @item nuttall
  2545. 4-terms continuous 1st derivative nuttall window
  2546. @item bnuttall
  2547. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2548. @item bharris
  2549. blackman-harris window
  2550. @item tukey
  2551. tukey window
  2552. @end table
  2553. @item fixed
  2554. If enabled, use fixed number of audio samples. This improves speed when
  2555. filtering with large delay. Default is disabled.
  2556. @item multi
  2557. Enable multichannels evaluation on gain. Default is disabled.
  2558. @item zero_phase
  2559. Enable zero phase mode by subtracting timestamp to compensate delay.
  2560. Default is disabled.
  2561. @item scale
  2562. Set scale used by gain. Acceptable values are:
  2563. @table @option
  2564. @item linlin
  2565. linear frequency, linear gain
  2566. @item linlog
  2567. linear frequency, logarithmic (in dB) gain (default)
  2568. @item loglin
  2569. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2570. @item loglog
  2571. logarithmic frequency, logarithmic gain
  2572. @end table
  2573. @item dumpfile
  2574. Set file for dumping, suitable for gnuplot.
  2575. @item dumpscale
  2576. Set scale for dumpfile. Acceptable values are same with scale option.
  2577. Default is linlog.
  2578. @item fft2
  2579. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2580. Default is disabled.
  2581. @item min_phase
  2582. Enable minimum phase impulse response. Default is disabled.
  2583. @end table
  2584. @subsection Examples
  2585. @itemize
  2586. @item
  2587. lowpass at 1000 Hz:
  2588. @example
  2589. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2590. @end example
  2591. @item
  2592. lowpass at 1000 Hz with gain_entry:
  2593. @example
  2594. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2595. @end example
  2596. @item
  2597. custom equalization:
  2598. @example
  2599. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2600. @end example
  2601. @item
  2602. higher delay with zero phase to compensate delay:
  2603. @example
  2604. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2605. @end example
  2606. @item
  2607. lowpass on left channel, highpass on right channel:
  2608. @example
  2609. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2610. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2611. @end example
  2612. @end itemize
  2613. @section flanger
  2614. Apply a flanging effect to the audio.
  2615. The filter accepts the following options:
  2616. @table @option
  2617. @item delay
  2618. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2619. @item depth
  2620. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2621. @item regen
  2622. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2623. Default value is 0.
  2624. @item width
  2625. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2626. Default value is 71.
  2627. @item speed
  2628. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2629. @item shape
  2630. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2631. Default value is @var{sinusoidal}.
  2632. @item phase
  2633. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2634. Default value is 25.
  2635. @item interp
  2636. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2637. Default is @var{linear}.
  2638. @end table
  2639. @section haas
  2640. Apply Haas effect to audio.
  2641. Note that this makes most sense to apply on mono signals.
  2642. With this filter applied to mono signals it give some directionality and
  2643. stretches its stereo image.
  2644. The filter accepts the following options:
  2645. @table @option
  2646. @item level_in
  2647. Set input level. By default is @var{1}, or 0dB
  2648. @item level_out
  2649. Set output level. By default is @var{1}, or 0dB.
  2650. @item side_gain
  2651. Set gain applied to side part of signal. By default is @var{1}.
  2652. @item middle_source
  2653. Set kind of middle source. Can be one of the following:
  2654. @table @samp
  2655. @item left
  2656. Pick left channel.
  2657. @item right
  2658. Pick right channel.
  2659. @item mid
  2660. Pick middle part signal of stereo image.
  2661. @item side
  2662. Pick side part signal of stereo image.
  2663. @end table
  2664. @item middle_phase
  2665. Change middle phase. By default is disabled.
  2666. @item left_delay
  2667. Set left channel delay. By default is @var{2.05} milliseconds.
  2668. @item left_balance
  2669. Set left channel balance. By default is @var{-1}.
  2670. @item left_gain
  2671. Set left channel gain. By default is @var{1}.
  2672. @item left_phase
  2673. Change left phase. By default is disabled.
  2674. @item right_delay
  2675. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2676. @item right_balance
  2677. Set right channel balance. By default is @var{1}.
  2678. @item right_gain
  2679. Set right channel gain. By default is @var{1}.
  2680. @item right_phase
  2681. Change right phase. By default is enabled.
  2682. @end table
  2683. @section hdcd
  2684. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2685. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2686. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2687. of HDCD, and detects the Transient Filter flag.
  2688. @example
  2689. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2690. @end example
  2691. When using the filter with wav, note the default encoding for wav is 16-bit,
  2692. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2693. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2694. @example
  2695. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2696. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2697. @end example
  2698. The filter accepts the following options:
  2699. @table @option
  2700. @item disable_autoconvert
  2701. Disable any automatic format conversion or resampling in the filter graph.
  2702. @item process_stereo
  2703. Process the stereo channels together. If target_gain does not match between
  2704. channels, consider it invalid and use the last valid target_gain.
  2705. @item cdt_ms
  2706. Set the code detect timer period in ms.
  2707. @item force_pe
  2708. Always extend peaks above -3dBFS even if PE isn't signaled.
  2709. @item analyze_mode
  2710. Replace audio with a solid tone and adjust the amplitude to signal some
  2711. specific aspect of the decoding process. The output file can be loaded in
  2712. an audio editor alongside the original to aid analysis.
  2713. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2714. Modes are:
  2715. @table @samp
  2716. @item 0, off
  2717. Disabled
  2718. @item 1, lle
  2719. Gain adjustment level at each sample
  2720. @item 2, pe
  2721. Samples where peak extend occurs
  2722. @item 3, cdt
  2723. Samples where the code detect timer is active
  2724. @item 4, tgm
  2725. Samples where the target gain does not match between channels
  2726. @end table
  2727. @end table
  2728. @section headphone
  2729. Apply head-related transfer functions (HRTFs) to create virtual
  2730. loudspeakers around the user for binaural listening via headphones.
  2731. The HRIRs are provided via additional streams, for each channel
  2732. one stereo input stream is needed.
  2733. The filter accepts the following options:
  2734. @table @option
  2735. @item map
  2736. Set mapping of input streams for convolution.
  2737. The argument is a '|'-separated list of channel names in order as they
  2738. are given as additional stream inputs for filter.
  2739. This also specify number of input streams. Number of input streams
  2740. must be not less than number of channels in first stream plus one.
  2741. @item gain
  2742. Set gain applied to audio. Value is in dB. Default is 0.
  2743. @item type
  2744. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2745. processing audio in time domain which is slow.
  2746. @var{freq} is processing audio in frequency domain which is fast.
  2747. Default is @var{freq}.
  2748. @item lfe
  2749. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2750. @item size
  2751. Set size of frame in number of samples which will be processed at once.
  2752. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2753. @item hrir
  2754. Set format of hrir stream.
  2755. Default value is @var{stereo}. Alternative value is @var{multich}.
  2756. If value is set to @var{stereo}, number of additional streams should
  2757. be greater or equal to number of input channels in first input stream.
  2758. Also each additional stream should have stereo number of channels.
  2759. If value is set to @var{multich}, number of additional streams should
  2760. be exactly one. Also number of input channels of additional stream
  2761. should be equal or greater than twice number of channels of first input
  2762. stream.
  2763. @end table
  2764. @subsection Examples
  2765. @itemize
  2766. @item
  2767. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2768. each amovie filter use stereo file with IR coefficients as input.
  2769. The files give coefficients for each position of virtual loudspeaker:
  2770. @example
  2771. ffmpeg -i input.wav -lavfi-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],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2772. output.wav
  2773. @end example
  2774. @item
  2775. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2776. but now in @var{multich} @var{hrir} format.
  2777. @example
  2778. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2779. output.wav
  2780. @end example
  2781. @end itemize
  2782. @section highpass
  2783. Apply a high-pass filter with 3dB point frequency.
  2784. The filter can be either single-pole, or double-pole (the default).
  2785. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2786. The filter accepts the following options:
  2787. @table @option
  2788. @item frequency, f
  2789. Set frequency in Hz. Default is 3000.
  2790. @item poles, p
  2791. Set number of poles. Default is 2.
  2792. @item width_type, t
  2793. Set method to specify band-width of filter.
  2794. @table @option
  2795. @item h
  2796. Hz
  2797. @item q
  2798. Q-Factor
  2799. @item o
  2800. octave
  2801. @item s
  2802. slope
  2803. @item k
  2804. kHz
  2805. @end table
  2806. @item width, w
  2807. Specify the band-width of a filter in width_type units.
  2808. Applies only to double-pole filter.
  2809. The default is 0.707q and gives a Butterworth response.
  2810. @item channels, c
  2811. Specify which channels to filter, by default all available are filtered.
  2812. @end table
  2813. @subsection Commands
  2814. This filter supports the following commands:
  2815. @table @option
  2816. @item frequency, f
  2817. Change highpass frequency.
  2818. Syntax for the command is : "@var{frequency}"
  2819. @item width_type, t
  2820. Change highpass width_type.
  2821. Syntax for the command is : "@var{width_type}"
  2822. @item width, w
  2823. Change highpass width.
  2824. Syntax for the command is : "@var{width}"
  2825. @end table
  2826. @section join
  2827. Join multiple input streams into one multi-channel stream.
  2828. It accepts the following parameters:
  2829. @table @option
  2830. @item inputs
  2831. The number of input streams. It defaults to 2.
  2832. @item channel_layout
  2833. The desired output channel layout. It defaults to stereo.
  2834. @item map
  2835. Map channels from inputs to output. The argument is a '|'-separated list of
  2836. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2837. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2838. can be either the name of the input channel (e.g. FL for front left) or its
  2839. index in the specified input stream. @var{out_channel} is the name of the output
  2840. channel.
  2841. @end table
  2842. The filter will attempt to guess the mappings when they are not specified
  2843. explicitly. It does so by first trying to find an unused matching input channel
  2844. and if that fails it picks the first unused input channel.
  2845. Join 3 inputs (with properly set channel layouts):
  2846. @example
  2847. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2848. @end example
  2849. Build a 5.1 output from 6 single-channel streams:
  2850. @example
  2851. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2852. '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'
  2853. out
  2854. @end example
  2855. @section ladspa
  2856. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2857. To enable compilation of this filter you need to configure FFmpeg with
  2858. @code{--enable-ladspa}.
  2859. @table @option
  2860. @item file, f
  2861. Specifies the name of LADSPA plugin library to load. If the environment
  2862. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2863. each one of the directories specified by the colon separated list in
  2864. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2865. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2866. @file{/usr/lib/ladspa/}.
  2867. @item plugin, p
  2868. Specifies the plugin within the library. Some libraries contain only
  2869. one plugin, but others contain many of them. If this is not set filter
  2870. will list all available plugins within the specified library.
  2871. @item controls, c
  2872. Set the '|' separated list of controls which are zero or more floating point
  2873. values that determine the behavior of the loaded plugin (for example delay,
  2874. threshold or gain).
  2875. Controls need to be defined using the following syntax:
  2876. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2877. @var{valuei} is the value set on the @var{i}-th control.
  2878. Alternatively they can be also defined using the following syntax:
  2879. @var{value0}|@var{value1}|@var{value2}|..., where
  2880. @var{valuei} is the value set on the @var{i}-th control.
  2881. If @option{controls} is set to @code{help}, all available controls and
  2882. their valid ranges are printed.
  2883. @item sample_rate, s
  2884. Specify the sample rate, default to 44100. Only used if plugin have
  2885. zero inputs.
  2886. @item nb_samples, n
  2887. Set the number of samples per channel per each output frame, default
  2888. is 1024. Only used if plugin have zero inputs.
  2889. @item duration, d
  2890. Set the minimum duration of the sourced audio. See
  2891. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2892. for the accepted syntax.
  2893. Note that the resulting duration may be greater than the specified duration,
  2894. as the generated audio is always cut at the end of a complete frame.
  2895. If not specified, or the expressed duration is negative, the audio is
  2896. supposed to be generated forever.
  2897. Only used if plugin have zero inputs.
  2898. @end table
  2899. @subsection Examples
  2900. @itemize
  2901. @item
  2902. List all available plugins within amp (LADSPA example plugin) library:
  2903. @example
  2904. ladspa=file=amp
  2905. @end example
  2906. @item
  2907. List all available controls and their valid ranges for @code{vcf_notch}
  2908. plugin from @code{VCF} library:
  2909. @example
  2910. ladspa=f=vcf:p=vcf_notch:c=help
  2911. @end example
  2912. @item
  2913. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2914. plugin library:
  2915. @example
  2916. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2917. @end example
  2918. @item
  2919. Add reverberation to the audio using TAP-plugins
  2920. (Tom's Audio Processing plugins):
  2921. @example
  2922. ladspa=file=tap_reverb:tap_reverb
  2923. @end example
  2924. @item
  2925. Generate white noise, with 0.2 amplitude:
  2926. @example
  2927. ladspa=file=cmt:noise_source_white:c=c0=.2
  2928. @end example
  2929. @item
  2930. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2931. @code{C* Audio Plugin Suite} (CAPS) library:
  2932. @example
  2933. ladspa=file=caps:Click:c=c1=20'
  2934. @end example
  2935. @item
  2936. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2937. @example
  2938. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2939. @end example
  2940. @item
  2941. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2942. @code{SWH Plugins} collection:
  2943. @example
  2944. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2945. @end example
  2946. @item
  2947. Attenuate low frequencies using Multiband EQ from Steve Harris
  2948. @code{SWH Plugins} collection:
  2949. @example
  2950. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2951. @end example
  2952. @item
  2953. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2954. (CAPS) library:
  2955. @example
  2956. ladspa=caps:Narrower
  2957. @end example
  2958. @item
  2959. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2960. @example
  2961. ladspa=caps:White:.2
  2962. @end example
  2963. @item
  2964. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2965. @example
  2966. ladspa=caps:Fractal:c=c1=1
  2967. @end example
  2968. @item
  2969. Dynamic volume normalization using @code{VLevel} plugin:
  2970. @example
  2971. ladspa=vlevel-ladspa:vlevel_mono
  2972. @end example
  2973. @end itemize
  2974. @subsection Commands
  2975. This filter supports the following commands:
  2976. @table @option
  2977. @item cN
  2978. Modify the @var{N}-th control value.
  2979. If the specified value is not valid, it is ignored and prior one is kept.
  2980. @end table
  2981. @section loudnorm
  2982. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2983. Support for both single pass (livestreams, files) and double pass (files) modes.
  2984. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2985. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2986. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2987. The filter accepts the following options:
  2988. @table @option
  2989. @item I, i
  2990. Set integrated loudness target.
  2991. Range is -70.0 - -5.0. Default value is -24.0.
  2992. @item LRA, lra
  2993. Set loudness range target.
  2994. Range is 1.0 - 20.0. Default value is 7.0.
  2995. @item TP, tp
  2996. Set maximum true peak.
  2997. Range is -9.0 - +0.0. Default value is -2.0.
  2998. @item measured_I, measured_i
  2999. Measured IL of input file.
  3000. Range is -99.0 - +0.0.
  3001. @item measured_LRA, measured_lra
  3002. Measured LRA of input file.
  3003. Range is 0.0 - 99.0.
  3004. @item measured_TP, measured_tp
  3005. Measured true peak of input file.
  3006. Range is -99.0 - +99.0.
  3007. @item measured_thresh
  3008. Measured threshold of input file.
  3009. Range is -99.0 - +0.0.
  3010. @item offset
  3011. Set offset gain. Gain is applied before the true-peak limiter.
  3012. Range is -99.0 - +99.0. Default is +0.0.
  3013. @item linear
  3014. Normalize linearly if possible.
  3015. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3016. to be specified in order to use this mode.
  3017. Options are true or false. Default is true.
  3018. @item dual_mono
  3019. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3020. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3021. If set to @code{true}, this option will compensate for this effect.
  3022. Multi-channel input files are not affected by this option.
  3023. Options are true or false. Default is false.
  3024. @item print_format
  3025. Set print format for stats. Options are summary, json, or none.
  3026. Default value is none.
  3027. @end table
  3028. @section lowpass
  3029. Apply a low-pass filter with 3dB point frequency.
  3030. The filter can be either single-pole or double-pole (the default).
  3031. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3032. The filter accepts the following options:
  3033. @table @option
  3034. @item frequency, f
  3035. Set frequency in Hz. Default is 500.
  3036. @item poles, p
  3037. Set number of poles. Default is 2.
  3038. @item width_type, t
  3039. Set method to specify band-width of filter.
  3040. @table @option
  3041. @item h
  3042. Hz
  3043. @item q
  3044. Q-Factor
  3045. @item o
  3046. octave
  3047. @item s
  3048. slope
  3049. @item k
  3050. kHz
  3051. @end table
  3052. @item width, w
  3053. Specify the band-width of a filter in width_type units.
  3054. Applies only to double-pole filter.
  3055. The default is 0.707q and gives a Butterworth response.
  3056. @item channels, c
  3057. Specify which channels to filter, by default all available are filtered.
  3058. @end table
  3059. @subsection Examples
  3060. @itemize
  3061. @item
  3062. Lowpass only LFE channel, it LFE is not present it does nothing:
  3063. @example
  3064. lowpass=c=LFE
  3065. @end example
  3066. @end itemize
  3067. @subsection Commands
  3068. This filter supports the following commands:
  3069. @table @option
  3070. @item frequency, f
  3071. Change lowpass frequency.
  3072. Syntax for the command is : "@var{frequency}"
  3073. @item width_type, t
  3074. Change lowpass width_type.
  3075. Syntax for the command is : "@var{width_type}"
  3076. @item width, w
  3077. Change lowpass width.
  3078. Syntax for the command is : "@var{width}"
  3079. @end table
  3080. @section lv2
  3081. Load a LV2 (LADSPA Version 2) plugin.
  3082. To enable compilation of this filter you need to configure FFmpeg with
  3083. @code{--enable-lv2}.
  3084. @table @option
  3085. @item plugin, p
  3086. Specifies the plugin URI. You may need to escape ':'.
  3087. @item controls, c
  3088. Set the '|' separated list of controls which are zero or more floating point
  3089. values that determine the behavior of the loaded plugin (for example delay,
  3090. threshold or gain).
  3091. If @option{controls} is set to @code{help}, all available controls and
  3092. their valid ranges are printed.
  3093. @item sample_rate, s
  3094. Specify the sample rate, default to 44100. Only used if plugin have
  3095. zero inputs.
  3096. @item nb_samples, n
  3097. Set the number of samples per channel per each output frame, default
  3098. is 1024. Only used if plugin have zero inputs.
  3099. @item duration, d
  3100. Set the minimum duration of the sourced audio. See
  3101. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3102. for the accepted syntax.
  3103. Note that the resulting duration may be greater than the specified duration,
  3104. as the generated audio is always cut at the end of a complete frame.
  3105. If not specified, or the expressed duration is negative, the audio is
  3106. supposed to be generated forever.
  3107. Only used if plugin have zero inputs.
  3108. @end table
  3109. @subsection Examples
  3110. @itemize
  3111. @item
  3112. Apply bass enhancer plugin from Calf:
  3113. @example
  3114. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3115. @end example
  3116. @item
  3117. Apply vinyl plugin from Calf:
  3118. @example
  3119. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3120. @end example
  3121. @item
  3122. Apply bit crusher plugin from ArtyFX:
  3123. @example
  3124. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3125. @end example
  3126. @end itemize
  3127. @section mcompand
  3128. Multiband Compress or expand the audio's dynamic range.
  3129. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3130. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3131. response when absent compander action.
  3132. It accepts the following parameters:
  3133. @table @option
  3134. @item args
  3135. This option syntax is:
  3136. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3137. For explanation of each item refer to compand filter documentation.
  3138. @end table
  3139. @anchor{pan}
  3140. @section pan
  3141. Mix channels with specific gain levels. The filter accepts the output
  3142. channel layout followed by a set of channels definitions.
  3143. This filter is also designed to efficiently remap the channels of an audio
  3144. stream.
  3145. The filter accepts parameters of the form:
  3146. "@var{l}|@var{outdef}|@var{outdef}|..."
  3147. @table @option
  3148. @item l
  3149. output channel layout or number of channels
  3150. @item outdef
  3151. output channel specification, of the form:
  3152. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3153. @item out_name
  3154. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3155. number (c0, c1, etc.)
  3156. @item gain
  3157. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3158. @item in_name
  3159. input channel to use, see out_name for details; it is not possible to mix
  3160. named and numbered input channels
  3161. @end table
  3162. If the `=' in a channel specification is replaced by `<', then the gains for
  3163. that specification will be renormalized so that the total is 1, thus
  3164. avoiding clipping noise.
  3165. @subsection Mixing examples
  3166. For example, if you want to down-mix from stereo to mono, but with a bigger
  3167. factor for the left channel:
  3168. @example
  3169. pan=1c|c0=0.9*c0+0.1*c1
  3170. @end example
  3171. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3172. 7-channels surround:
  3173. @example
  3174. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3175. @end example
  3176. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3177. that should be preferred (see "-ac" option) unless you have very specific
  3178. needs.
  3179. @subsection Remapping examples
  3180. The channel remapping will be effective if, and only if:
  3181. @itemize
  3182. @item gain coefficients are zeroes or ones,
  3183. @item only one input per channel output,
  3184. @end itemize
  3185. If all these conditions are satisfied, the filter will notify the user ("Pure
  3186. channel mapping detected"), and use an optimized and lossless method to do the
  3187. remapping.
  3188. For example, if you have a 5.1 source and want a stereo audio stream by
  3189. dropping the extra channels:
  3190. @example
  3191. pan="stereo| c0=FL | c1=FR"
  3192. @end example
  3193. Given the same source, you can also switch front left and front right channels
  3194. and keep the input channel layout:
  3195. @example
  3196. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3197. @end example
  3198. If the input is a stereo audio stream, you can mute the front left channel (and
  3199. still keep the stereo channel layout) with:
  3200. @example
  3201. pan="stereo|c1=c1"
  3202. @end example
  3203. Still with a stereo audio stream input, you can copy the right channel in both
  3204. front left and right:
  3205. @example
  3206. pan="stereo| c0=FR | c1=FR"
  3207. @end example
  3208. @section replaygain
  3209. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3210. outputs it unchanged.
  3211. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3212. @section resample
  3213. Convert the audio sample format, sample rate and channel layout. It is
  3214. not meant to be used directly.
  3215. @section rubberband
  3216. Apply time-stretching and pitch-shifting with librubberband.
  3217. To enable compilation of this filter, you need to configure FFmpeg with
  3218. @code{--enable-librubberband}.
  3219. The filter accepts the following options:
  3220. @table @option
  3221. @item tempo
  3222. Set tempo scale factor.
  3223. @item pitch
  3224. Set pitch scale factor.
  3225. @item transients
  3226. Set transients detector.
  3227. Possible values are:
  3228. @table @var
  3229. @item crisp
  3230. @item mixed
  3231. @item smooth
  3232. @end table
  3233. @item detector
  3234. Set detector.
  3235. Possible values are:
  3236. @table @var
  3237. @item compound
  3238. @item percussive
  3239. @item soft
  3240. @end table
  3241. @item phase
  3242. Set phase.
  3243. Possible values are:
  3244. @table @var
  3245. @item laminar
  3246. @item independent
  3247. @end table
  3248. @item window
  3249. Set processing window size.
  3250. Possible values are:
  3251. @table @var
  3252. @item standard
  3253. @item short
  3254. @item long
  3255. @end table
  3256. @item smoothing
  3257. Set smoothing.
  3258. Possible values are:
  3259. @table @var
  3260. @item off
  3261. @item on
  3262. @end table
  3263. @item formant
  3264. Enable formant preservation when shift pitching.
  3265. Possible values are:
  3266. @table @var
  3267. @item shifted
  3268. @item preserved
  3269. @end table
  3270. @item pitchq
  3271. Set pitch quality.
  3272. Possible values are:
  3273. @table @var
  3274. @item quality
  3275. @item speed
  3276. @item consistency
  3277. @end table
  3278. @item channels
  3279. Set channels.
  3280. Possible values are:
  3281. @table @var
  3282. @item apart
  3283. @item together
  3284. @end table
  3285. @end table
  3286. @section sidechaincompress
  3287. This filter acts like normal compressor but has the ability to compress
  3288. detected signal using second input signal.
  3289. It needs two input streams and returns one output stream.
  3290. First input stream will be processed depending on second stream signal.
  3291. The filtered signal then can be filtered with other filters in later stages of
  3292. processing. See @ref{pan} and @ref{amerge} filter.
  3293. The filter accepts the following options:
  3294. @table @option
  3295. @item level_in
  3296. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3297. @item threshold
  3298. If a signal of second stream raises above this level it will affect the gain
  3299. reduction of first stream.
  3300. By default is 0.125. Range is between 0.00097563 and 1.
  3301. @item ratio
  3302. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3303. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3304. Default is 2. Range is between 1 and 20.
  3305. @item attack
  3306. Amount of milliseconds the signal has to rise above the threshold before gain
  3307. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3308. @item release
  3309. Amount of milliseconds the signal has to fall below the threshold before
  3310. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3311. @item makeup
  3312. Set the amount by how much signal will be amplified after processing.
  3313. Default is 1. Range is from 1 to 64.
  3314. @item knee
  3315. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3316. Default is 2.82843. Range is between 1 and 8.
  3317. @item link
  3318. Choose if the @code{average} level between all channels of side-chain stream
  3319. or the louder(@code{maximum}) channel of side-chain stream affects the
  3320. reduction. Default is @code{average}.
  3321. @item detection
  3322. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3323. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3324. @item level_sc
  3325. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3326. @item mix
  3327. How much to use compressed signal in output. Default is 1.
  3328. Range is between 0 and 1.
  3329. @end table
  3330. @subsection Examples
  3331. @itemize
  3332. @item
  3333. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3334. depending on the signal of 2nd input and later compressed signal to be
  3335. merged with 2nd input:
  3336. @example
  3337. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3338. @end example
  3339. @end itemize
  3340. @section sidechaingate
  3341. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3342. filter the detected signal before sending it to the gain reduction stage.
  3343. Normally a gate uses the full range signal to detect a level above the
  3344. threshold.
  3345. For example: If you cut all lower frequencies from your sidechain signal
  3346. the gate will decrease the volume of your track only if not enough highs
  3347. appear. With this technique you are able to reduce the resonation of a
  3348. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3349. guitar.
  3350. It needs two input streams and returns one output stream.
  3351. First input stream will be processed depending on second stream signal.
  3352. The filter accepts the following options:
  3353. @table @option
  3354. @item level_in
  3355. Set input level before filtering.
  3356. Default is 1. Allowed range is from 0.015625 to 64.
  3357. @item range
  3358. Set the level of gain reduction when the signal is below the threshold.
  3359. Default is 0.06125. Allowed range is from 0 to 1.
  3360. @item threshold
  3361. If a signal rises above this level the gain reduction is released.
  3362. Default is 0.125. Allowed range is from 0 to 1.
  3363. @item ratio
  3364. Set a ratio about which the signal is reduced.
  3365. Default is 2. Allowed range is from 1 to 9000.
  3366. @item attack
  3367. Amount of milliseconds the signal has to rise above the threshold before gain
  3368. reduction stops.
  3369. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3370. @item release
  3371. Amount of milliseconds the signal has to fall below the threshold before the
  3372. reduction is increased again. Default is 250 milliseconds.
  3373. Allowed range is from 0.01 to 9000.
  3374. @item makeup
  3375. Set amount of amplification of signal after processing.
  3376. Default is 1. Allowed range is from 1 to 64.
  3377. @item knee
  3378. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3379. Default is 2.828427125. Allowed range is from 1 to 8.
  3380. @item detection
  3381. Choose if exact signal should be taken for detection or an RMS like one.
  3382. Default is rms. Can be peak or rms.
  3383. @item link
  3384. Choose if the average level between all channels or the louder channel affects
  3385. the reduction.
  3386. Default is average. Can be average or maximum.
  3387. @item level_sc
  3388. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3389. @end table
  3390. @section silencedetect
  3391. Detect silence in an audio stream.
  3392. This filter logs a message when it detects that the input audio volume is less
  3393. or equal to a noise tolerance value for a duration greater or equal to the
  3394. minimum detected noise duration.
  3395. The printed times and duration are expressed in seconds.
  3396. The filter accepts the following options:
  3397. @table @option
  3398. @item noise, n
  3399. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3400. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3401. @item duration, d
  3402. Set silence duration until notification (default is 2 seconds).
  3403. @item mono, m
  3404. Process each channel separately, instead of combined. By default is disabled.
  3405. @end table
  3406. @subsection Examples
  3407. @itemize
  3408. @item
  3409. Detect 5 seconds of silence with -50dB noise tolerance:
  3410. @example
  3411. silencedetect=n=-50dB:d=5
  3412. @end example
  3413. @item
  3414. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3415. tolerance in @file{silence.mp3}:
  3416. @example
  3417. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3418. @end example
  3419. @end itemize
  3420. @section silenceremove
  3421. Remove silence from the beginning, middle or end of the audio.
  3422. The filter accepts the following options:
  3423. @table @option
  3424. @item start_periods
  3425. This value is used to indicate if audio should be trimmed at beginning of
  3426. the audio. A value of zero indicates no silence should be trimmed from the
  3427. beginning. When specifying a non-zero value, it trims audio up until it
  3428. finds non-silence. Normally, when trimming silence from beginning of audio
  3429. the @var{start_periods} will be @code{1} but it can be increased to higher
  3430. values to trim all audio up to specific count of non-silence periods.
  3431. Default value is @code{0}.
  3432. @item start_duration
  3433. Specify the amount of time that non-silence must be detected before it stops
  3434. trimming audio. By increasing the duration, bursts of noises can be treated
  3435. as silence and trimmed off. Default value is @code{0}.
  3436. @item start_threshold
  3437. This indicates what sample value should be treated as silence. For digital
  3438. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3439. you may wish to increase the value to account for background noise.
  3440. Can be specified in dB (in case "dB" is appended to the specified value)
  3441. or amplitude ratio. Default value is @code{0}.
  3442. @item start_silence
  3443. Specify max duration of silence at beginning that will be kept after
  3444. trimming. Default is 0, which is equal to trimming all samples detected
  3445. as silence.
  3446. @item start_mode
  3447. Specify mode of detection of silence end in start of multi-channel audio.
  3448. Can be @var{any} or @var{all}. Default is @var{any}.
  3449. With @var{any}, any sample that is detected as non-silence will cause
  3450. stopped trimming of silence.
  3451. With @var{all}, only if all channels are detected as non-silence will cause
  3452. stopped trimming of silence.
  3453. @item stop_periods
  3454. Set the count for trimming silence from the end of audio.
  3455. To remove silence from the middle of a file, specify a @var{stop_periods}
  3456. that is negative. This value is then treated as a positive value and is
  3457. used to indicate the effect should restart processing as specified by
  3458. @var{start_periods}, making it suitable for removing periods of silence
  3459. in the middle of the audio.
  3460. Default value is @code{0}.
  3461. @item stop_duration
  3462. Specify a duration of silence that must exist before audio is not copied any
  3463. more. By specifying a higher duration, silence that is wanted can be left in
  3464. the audio.
  3465. Default value is @code{0}.
  3466. @item stop_threshold
  3467. This is the same as @option{start_threshold} but for trimming silence from
  3468. the end of audio.
  3469. Can be specified in dB (in case "dB" is appended to the specified value)
  3470. or amplitude ratio. Default value is @code{0}.
  3471. @item stop_silence
  3472. Specify max duration of silence at end that will be kept after
  3473. trimming. Default is 0, which is equal to trimming all samples detected
  3474. as silence.
  3475. @item stop_mode
  3476. Specify mode of detection of silence start in end of multi-channel audio.
  3477. Can be @var{any} or @var{all}. Default is @var{any}.
  3478. With @var{any}, any sample that is detected as non-silence will cause
  3479. stopped trimming of silence.
  3480. With @var{all}, only if all channels are detected as non-silence will cause
  3481. stopped trimming of silence.
  3482. @item detection
  3483. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3484. and works better with digital silence which is exactly 0.
  3485. Default value is @code{rms}.
  3486. @item window
  3487. Set duration in number of seconds used to calculate size of window in number
  3488. of samples for detecting silence.
  3489. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3490. @end table
  3491. @subsection Examples
  3492. @itemize
  3493. @item
  3494. The following example shows how this filter can be used to start a recording
  3495. that does not contain the delay at the start which usually occurs between
  3496. pressing the record button and the start of the performance:
  3497. @example
  3498. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3499. @end example
  3500. @item
  3501. Trim all silence encountered from beginning to end where there is more than 1
  3502. second of silence in audio:
  3503. @example
  3504. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3505. @end example
  3506. @end itemize
  3507. @section sofalizer
  3508. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3509. loudspeakers around the user for binaural listening via headphones (audio
  3510. formats up to 9 channels supported).
  3511. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3512. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3513. Austrian Academy of Sciences.
  3514. To enable compilation of this filter you need to configure FFmpeg with
  3515. @code{--enable-libmysofa}.
  3516. The filter accepts the following options:
  3517. @table @option
  3518. @item sofa
  3519. Set the SOFA file used for rendering.
  3520. @item gain
  3521. Set gain applied to audio. Value is in dB. Default is 0.
  3522. @item rotation
  3523. Set rotation of virtual loudspeakers in deg. Default is 0.
  3524. @item elevation
  3525. Set elevation of virtual speakers in deg. Default is 0.
  3526. @item radius
  3527. Set distance in meters between loudspeakers and the listener with near-field
  3528. HRTFs. Default is 1.
  3529. @item type
  3530. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3531. processing audio in time domain which is slow.
  3532. @var{freq} is processing audio in frequency domain which is fast.
  3533. Default is @var{freq}.
  3534. @item speakers
  3535. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3536. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3537. Each virtual loudspeaker is described with short channel name following with
  3538. azimuth and elevation in degrees.
  3539. Each virtual loudspeaker description is separated by '|'.
  3540. For example to override front left and front right channel positions use:
  3541. 'speakers=FL 45 15|FR 345 15'.
  3542. Descriptions with unrecognised channel names are ignored.
  3543. @item lfegain
  3544. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3545. @item framesize
  3546. Set custom frame size in number of samples. Default is 1024.
  3547. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3548. is set to @var{freq}.
  3549. @item normalize
  3550. Should all IRs be normalized upon importing SOFA file.
  3551. By default is enabled.
  3552. @item interpolate
  3553. Should nearest IRs be interpolated with neighbor IRs if exact position
  3554. does not match. By default is disabled.
  3555. @item minphase
  3556. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3557. @item anglestep
  3558. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3559. @item radstep
  3560. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3561. @end table
  3562. @subsection Examples
  3563. @itemize
  3564. @item
  3565. Using ClubFritz6 sofa file:
  3566. @example
  3567. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3568. @end example
  3569. @item
  3570. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3571. @example
  3572. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3573. @end example
  3574. @item
  3575. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3576. and also with custom gain:
  3577. @example
  3578. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3579. @end example
  3580. @end itemize
  3581. @section stereotools
  3582. This filter has some handy utilities to manage stereo signals, for converting
  3583. M/S stereo recordings to L/R signal while having control over the parameters
  3584. or spreading the stereo image of master track.
  3585. The filter accepts the following options:
  3586. @table @option
  3587. @item level_in
  3588. Set input level before filtering for both channels. Defaults is 1.
  3589. Allowed range is from 0.015625 to 64.
  3590. @item level_out
  3591. Set output level after filtering for both channels. Defaults is 1.
  3592. Allowed range is from 0.015625 to 64.
  3593. @item balance_in
  3594. Set input balance between both channels. Default is 0.
  3595. Allowed range is from -1 to 1.
  3596. @item balance_out
  3597. Set output balance between both channels. Default is 0.
  3598. Allowed range is from -1 to 1.
  3599. @item softclip
  3600. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3601. clipping. Disabled by default.
  3602. @item mutel
  3603. Mute the left channel. Disabled by default.
  3604. @item muter
  3605. Mute the right channel. Disabled by default.
  3606. @item phasel
  3607. Change the phase of the left channel. Disabled by default.
  3608. @item phaser
  3609. Change the phase of the right channel. Disabled by default.
  3610. @item mode
  3611. Set stereo mode. Available values are:
  3612. @table @samp
  3613. @item lr>lr
  3614. Left/Right to Left/Right, this is default.
  3615. @item lr>ms
  3616. Left/Right to Mid/Side.
  3617. @item ms>lr
  3618. Mid/Side to Left/Right.
  3619. @item lr>ll
  3620. Left/Right to Left/Left.
  3621. @item lr>rr
  3622. Left/Right to Right/Right.
  3623. @item lr>l+r
  3624. Left/Right to Left + Right.
  3625. @item lr>rl
  3626. Left/Right to Right/Left.
  3627. @item ms>ll
  3628. Mid/Side to Left/Left.
  3629. @item ms>rr
  3630. Mid/Side to Right/Right.
  3631. @end table
  3632. @item slev
  3633. Set level of side signal. Default is 1.
  3634. Allowed range is from 0.015625 to 64.
  3635. @item sbal
  3636. Set balance of side signal. Default is 0.
  3637. Allowed range is from -1 to 1.
  3638. @item mlev
  3639. Set level of the middle signal. Default is 1.
  3640. Allowed range is from 0.015625 to 64.
  3641. @item mpan
  3642. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3643. @item base
  3644. Set stereo base between mono and inversed channels. Default is 0.
  3645. Allowed range is from -1 to 1.
  3646. @item delay
  3647. Set delay in milliseconds how much to delay left from right channel and
  3648. vice versa. Default is 0. Allowed range is from -20 to 20.
  3649. @item sclevel
  3650. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3651. @item phase
  3652. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3653. @item bmode_in, bmode_out
  3654. Set balance mode for balance_in/balance_out option.
  3655. Can be one of the following:
  3656. @table @samp
  3657. @item balance
  3658. Classic balance mode. Attenuate one channel at time.
  3659. Gain is raised up to 1.
  3660. @item amplitude
  3661. Similar as classic mode above but gain is raised up to 2.
  3662. @item power
  3663. Equal power distribution, from -6dB to +6dB range.
  3664. @end table
  3665. @end table
  3666. @subsection Examples
  3667. @itemize
  3668. @item
  3669. Apply karaoke like effect:
  3670. @example
  3671. stereotools=mlev=0.015625
  3672. @end example
  3673. @item
  3674. Convert M/S signal to L/R:
  3675. @example
  3676. "stereotools=mode=ms>lr"
  3677. @end example
  3678. @end itemize
  3679. @section stereowiden
  3680. This filter enhance the stereo effect by suppressing signal common to both
  3681. channels and by delaying the signal of left into right and vice versa,
  3682. thereby widening the stereo effect.
  3683. The filter accepts the following options:
  3684. @table @option
  3685. @item delay
  3686. Time in milliseconds of the delay of left signal into right and vice versa.
  3687. Default is 20 milliseconds.
  3688. @item feedback
  3689. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3690. effect of left signal in right output and vice versa which gives widening
  3691. effect. Default is 0.3.
  3692. @item crossfeed
  3693. Cross feed of left into right with inverted phase. This helps in suppressing
  3694. the mono. If the value is 1 it will cancel all the signal common to both
  3695. channels. Default is 0.3.
  3696. @item drymix
  3697. Set level of input signal of original channel. Default is 0.8.
  3698. @end table
  3699. @section superequalizer
  3700. Apply 18 band equalizer.
  3701. The filter accepts the following options:
  3702. @table @option
  3703. @item 1b
  3704. Set 65Hz band gain.
  3705. @item 2b
  3706. Set 92Hz band gain.
  3707. @item 3b
  3708. Set 131Hz band gain.
  3709. @item 4b
  3710. Set 185Hz band gain.
  3711. @item 5b
  3712. Set 262Hz band gain.
  3713. @item 6b
  3714. Set 370Hz band gain.
  3715. @item 7b
  3716. Set 523Hz band gain.
  3717. @item 8b
  3718. Set 740Hz band gain.
  3719. @item 9b
  3720. Set 1047Hz band gain.
  3721. @item 10b
  3722. Set 1480Hz band gain.
  3723. @item 11b
  3724. Set 2093Hz band gain.
  3725. @item 12b
  3726. Set 2960Hz band gain.
  3727. @item 13b
  3728. Set 4186Hz band gain.
  3729. @item 14b
  3730. Set 5920Hz band gain.
  3731. @item 15b
  3732. Set 8372Hz band gain.
  3733. @item 16b
  3734. Set 11840Hz band gain.
  3735. @item 17b
  3736. Set 16744Hz band gain.
  3737. @item 18b
  3738. Set 20000Hz band gain.
  3739. @end table
  3740. @section surround
  3741. Apply audio surround upmix filter.
  3742. This filter allows to produce multichannel output from audio stream.
  3743. The filter accepts the following options:
  3744. @table @option
  3745. @item chl_out
  3746. Set output channel layout. By default, this is @var{5.1}.
  3747. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3748. for the required syntax.
  3749. @item chl_in
  3750. Set input channel layout. By default, this is @var{stereo}.
  3751. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3752. for the required syntax.
  3753. @item level_in
  3754. Set input volume level. By default, this is @var{1}.
  3755. @item level_out
  3756. Set output volume level. By default, this is @var{1}.
  3757. @item lfe
  3758. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3759. @item lfe_low
  3760. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3761. @item lfe_high
  3762. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3763. @item fc_in
  3764. Set front center input volume. By default, this is @var{1}.
  3765. @item fc_out
  3766. Set front center output volume. By default, this is @var{1}.
  3767. @item lfe_in
  3768. Set LFE input volume. By default, this is @var{1}.
  3769. @item lfe_out
  3770. Set LFE output volume. By default, this is @var{1}.
  3771. @end table
  3772. @section treble, highshelf
  3773. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3774. shelving filter with a response similar to that of a standard
  3775. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3776. The filter accepts the following options:
  3777. @table @option
  3778. @item gain, g
  3779. Give the gain at whichever is the lower of ~22 kHz and the
  3780. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3781. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3782. @item frequency, f
  3783. Set the filter's central frequency and so can be used
  3784. to extend or reduce the frequency range to be boosted or cut.
  3785. The default value is @code{3000} Hz.
  3786. @item width_type, t
  3787. Set method to specify band-width of filter.
  3788. @table @option
  3789. @item h
  3790. Hz
  3791. @item q
  3792. Q-Factor
  3793. @item o
  3794. octave
  3795. @item s
  3796. slope
  3797. @item k
  3798. kHz
  3799. @end table
  3800. @item width, w
  3801. Determine how steep is the filter's shelf transition.
  3802. @item channels, c
  3803. Specify which channels to filter, by default all available are filtered.
  3804. @end table
  3805. @subsection Commands
  3806. This filter supports the following commands:
  3807. @table @option
  3808. @item frequency, f
  3809. Change treble frequency.
  3810. Syntax for the command is : "@var{frequency}"
  3811. @item width_type, t
  3812. Change treble width_type.
  3813. Syntax for the command is : "@var{width_type}"
  3814. @item width, w
  3815. Change treble width.
  3816. Syntax for the command is : "@var{width}"
  3817. @item gain, g
  3818. Change treble gain.
  3819. Syntax for the command is : "@var{gain}"
  3820. @end table
  3821. @section tremolo
  3822. Sinusoidal amplitude modulation.
  3823. The filter accepts the following options:
  3824. @table @option
  3825. @item f
  3826. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3827. (20 Hz or lower) will result in a tremolo effect.
  3828. This filter may also be used as a ring modulator by specifying
  3829. a modulation frequency higher than 20 Hz.
  3830. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3831. @item d
  3832. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3833. Default value is 0.5.
  3834. @end table
  3835. @section vibrato
  3836. Sinusoidal phase modulation.
  3837. The filter accepts the following options:
  3838. @table @option
  3839. @item f
  3840. Modulation frequency in Hertz.
  3841. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3842. @item d
  3843. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3844. Default value is 0.5.
  3845. @end table
  3846. @section volume
  3847. Adjust the input audio volume.
  3848. It accepts the following parameters:
  3849. @table @option
  3850. @item volume
  3851. Set audio volume expression.
  3852. Output values are clipped to the maximum value.
  3853. The output audio volume is given by the relation:
  3854. @example
  3855. @var{output_volume} = @var{volume} * @var{input_volume}
  3856. @end example
  3857. The default value for @var{volume} is "1.0".
  3858. @item precision
  3859. This parameter represents the mathematical precision.
  3860. It determines which input sample formats will be allowed, which affects the
  3861. precision of the volume scaling.
  3862. @table @option
  3863. @item fixed
  3864. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3865. @item float
  3866. 32-bit floating-point; this limits input sample format to FLT. (default)
  3867. @item double
  3868. 64-bit floating-point; this limits input sample format to DBL.
  3869. @end table
  3870. @item replaygain
  3871. Choose the behaviour on encountering ReplayGain side data in input frames.
  3872. @table @option
  3873. @item drop
  3874. Remove ReplayGain side data, ignoring its contents (the default).
  3875. @item ignore
  3876. Ignore ReplayGain side data, but leave it in the frame.
  3877. @item track
  3878. Prefer the track gain, if present.
  3879. @item album
  3880. Prefer the album gain, if present.
  3881. @end table
  3882. @item replaygain_preamp
  3883. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3884. Default value for @var{replaygain_preamp} is 0.0.
  3885. @item eval
  3886. Set when the volume expression is evaluated.
  3887. It accepts the following values:
  3888. @table @samp
  3889. @item once
  3890. only evaluate expression once during the filter initialization, or
  3891. when the @samp{volume} command is sent
  3892. @item frame
  3893. evaluate expression for each incoming frame
  3894. @end table
  3895. Default value is @samp{once}.
  3896. @end table
  3897. The volume expression can contain the following parameters.
  3898. @table @option
  3899. @item n
  3900. frame number (starting at zero)
  3901. @item nb_channels
  3902. number of channels
  3903. @item nb_consumed_samples
  3904. number of samples consumed by the filter
  3905. @item nb_samples
  3906. number of samples in the current frame
  3907. @item pos
  3908. original frame position in the file
  3909. @item pts
  3910. frame PTS
  3911. @item sample_rate
  3912. sample rate
  3913. @item startpts
  3914. PTS at start of stream
  3915. @item startt
  3916. time at start of stream
  3917. @item t
  3918. frame time
  3919. @item tb
  3920. timestamp timebase
  3921. @item volume
  3922. last set volume value
  3923. @end table
  3924. Note that when @option{eval} is set to @samp{once} only the
  3925. @var{sample_rate} and @var{tb} variables are available, all other
  3926. variables will evaluate to NAN.
  3927. @subsection Commands
  3928. This filter supports the following commands:
  3929. @table @option
  3930. @item volume
  3931. Modify the volume expression.
  3932. The command accepts the same syntax of the corresponding option.
  3933. If the specified expression is not valid, it is kept at its current
  3934. value.
  3935. @item replaygain_noclip
  3936. Prevent clipping by limiting the gain applied.
  3937. Default value for @var{replaygain_noclip} is 1.
  3938. @end table
  3939. @subsection Examples
  3940. @itemize
  3941. @item
  3942. Halve the input audio volume:
  3943. @example
  3944. volume=volume=0.5
  3945. volume=volume=1/2
  3946. volume=volume=-6.0206dB
  3947. @end example
  3948. In all the above example the named key for @option{volume} can be
  3949. omitted, for example like in:
  3950. @example
  3951. volume=0.5
  3952. @end example
  3953. @item
  3954. Increase input audio power by 6 decibels using fixed-point precision:
  3955. @example
  3956. volume=volume=6dB:precision=fixed
  3957. @end example
  3958. @item
  3959. Fade volume after time 10 with an annihilation period of 5 seconds:
  3960. @example
  3961. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3962. @end example
  3963. @end itemize
  3964. @section volumedetect
  3965. Detect the volume of the input video.
  3966. The filter has no parameters. The input is not modified. Statistics about
  3967. the volume will be printed in the log when the input stream end is reached.
  3968. In particular it will show the mean volume (root mean square), maximum
  3969. volume (on a per-sample basis), and the beginning of a histogram of the
  3970. registered volume values (from the maximum value to a cumulated 1/1000 of
  3971. the samples).
  3972. All volumes are in decibels relative to the maximum PCM value.
  3973. @subsection Examples
  3974. Here is an excerpt of the output:
  3975. @example
  3976. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3977. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3978. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3979. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3980. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3981. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3982. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3983. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3984. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3985. @end example
  3986. It means that:
  3987. @itemize
  3988. @item
  3989. The mean square energy is approximately -27 dB, or 10^-2.7.
  3990. @item
  3991. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3992. @item
  3993. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3994. @end itemize
  3995. In other words, raising the volume by +4 dB does not cause any clipping,
  3996. raising it by +5 dB causes clipping for 6 samples, etc.
  3997. @c man end AUDIO FILTERS
  3998. @chapter Audio Sources
  3999. @c man begin AUDIO SOURCES
  4000. Below is a description of the currently available audio sources.
  4001. @section abuffer
  4002. Buffer audio frames, and make them available to the filter chain.
  4003. This source is mainly intended for a programmatic use, in particular
  4004. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4005. It accepts the following parameters:
  4006. @table @option
  4007. @item time_base
  4008. The timebase which will be used for timestamps of submitted frames. It must be
  4009. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4010. @item sample_rate
  4011. The sample rate of the incoming audio buffers.
  4012. @item sample_fmt
  4013. The sample format of the incoming audio buffers.
  4014. Either a sample format name or its corresponding integer representation from
  4015. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4016. @item channel_layout
  4017. The channel layout of the incoming audio buffers.
  4018. Either a channel layout name from channel_layout_map in
  4019. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4020. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4021. @item channels
  4022. The number of channels of the incoming audio buffers.
  4023. If both @var{channels} and @var{channel_layout} are specified, then they
  4024. must be consistent.
  4025. @end table
  4026. @subsection Examples
  4027. @example
  4028. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4029. @end example
  4030. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4031. Since the sample format with name "s16p" corresponds to the number
  4032. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4033. equivalent to:
  4034. @example
  4035. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4036. @end example
  4037. @section aevalsrc
  4038. Generate an audio signal specified by an expression.
  4039. This source accepts in input one or more expressions (one for each
  4040. channel), which are evaluated and used to generate a corresponding
  4041. audio signal.
  4042. This source accepts the following options:
  4043. @table @option
  4044. @item exprs
  4045. Set the '|'-separated expressions list for each separate channel. In case the
  4046. @option{channel_layout} option is not specified, the selected channel layout
  4047. depends on the number of provided expressions. Otherwise the last
  4048. specified expression is applied to the remaining output channels.
  4049. @item channel_layout, c
  4050. Set the channel layout. The number of channels in the specified layout
  4051. must be equal to the number of specified expressions.
  4052. @item duration, d
  4053. Set the minimum duration of the sourced audio. See
  4054. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4055. for the accepted syntax.
  4056. Note that the resulting duration may be greater than the specified
  4057. duration, as the generated audio is always cut at the end of a
  4058. complete frame.
  4059. If not specified, or the expressed duration is negative, the audio is
  4060. supposed to be generated forever.
  4061. @item nb_samples, n
  4062. Set the number of samples per channel per each output frame,
  4063. default to 1024.
  4064. @item sample_rate, s
  4065. Specify the sample rate, default to 44100.
  4066. @end table
  4067. Each expression in @var{exprs} can contain the following constants:
  4068. @table @option
  4069. @item n
  4070. number of the evaluated sample, starting from 0
  4071. @item t
  4072. time of the evaluated sample expressed in seconds, starting from 0
  4073. @item s
  4074. sample rate
  4075. @end table
  4076. @subsection Examples
  4077. @itemize
  4078. @item
  4079. Generate silence:
  4080. @example
  4081. aevalsrc=0
  4082. @end example
  4083. @item
  4084. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4085. 8000 Hz:
  4086. @example
  4087. aevalsrc="sin(440*2*PI*t):s=8000"
  4088. @end example
  4089. @item
  4090. Generate a two channels signal, specify the channel layout (Front
  4091. Center + Back Center) explicitly:
  4092. @example
  4093. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4094. @end example
  4095. @item
  4096. Generate white noise:
  4097. @example
  4098. aevalsrc="-2+random(0)"
  4099. @end example
  4100. @item
  4101. Generate an amplitude modulated signal:
  4102. @example
  4103. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4104. @end example
  4105. @item
  4106. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4107. @example
  4108. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4109. @end example
  4110. @end itemize
  4111. @section anullsrc
  4112. The null audio source, return unprocessed audio frames. It is mainly useful
  4113. as a template and to be employed in analysis / debugging tools, or as
  4114. the source for filters which ignore the input data (for example the sox
  4115. synth filter).
  4116. This source accepts the following options:
  4117. @table @option
  4118. @item channel_layout, cl
  4119. Specifies the channel layout, and can be either an integer or a string
  4120. representing a channel layout. The default value of @var{channel_layout}
  4121. is "stereo".
  4122. Check the channel_layout_map definition in
  4123. @file{libavutil/channel_layout.c} for the mapping between strings and
  4124. channel layout values.
  4125. @item sample_rate, r
  4126. Specifies the sample rate, and defaults to 44100.
  4127. @item nb_samples, n
  4128. Set the number of samples per requested frames.
  4129. @end table
  4130. @subsection Examples
  4131. @itemize
  4132. @item
  4133. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4134. @example
  4135. anullsrc=r=48000:cl=4
  4136. @end example
  4137. @item
  4138. Do the same operation with a more obvious syntax:
  4139. @example
  4140. anullsrc=r=48000:cl=mono
  4141. @end example
  4142. @end itemize
  4143. All the parameters need to be explicitly defined.
  4144. @section flite
  4145. Synthesize a voice utterance using the libflite library.
  4146. To enable compilation of this filter you need to configure FFmpeg with
  4147. @code{--enable-libflite}.
  4148. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4149. The filter accepts the following options:
  4150. @table @option
  4151. @item list_voices
  4152. If set to 1, list the names of the available voices and exit
  4153. immediately. Default value is 0.
  4154. @item nb_samples, n
  4155. Set the maximum number of samples per frame. Default value is 512.
  4156. @item textfile
  4157. Set the filename containing the text to speak.
  4158. @item text
  4159. Set the text to speak.
  4160. @item voice, v
  4161. Set the voice to use for the speech synthesis. Default value is
  4162. @code{kal}. See also the @var{list_voices} option.
  4163. @end table
  4164. @subsection Examples
  4165. @itemize
  4166. @item
  4167. Read from file @file{speech.txt}, and synthesize the text using the
  4168. standard flite voice:
  4169. @example
  4170. flite=textfile=speech.txt
  4171. @end example
  4172. @item
  4173. Read the specified text selecting the @code{slt} voice:
  4174. @example
  4175. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4176. @end example
  4177. @item
  4178. Input text to ffmpeg:
  4179. @example
  4180. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4181. @end example
  4182. @item
  4183. Make @file{ffplay} speak the specified text, using @code{flite} and
  4184. the @code{lavfi} device:
  4185. @example
  4186. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4187. @end example
  4188. @end itemize
  4189. For more information about libflite, check:
  4190. @url{http://www.festvox.org/flite/}
  4191. @section anoisesrc
  4192. Generate a noise audio signal.
  4193. The filter accepts the following options:
  4194. @table @option
  4195. @item sample_rate, r
  4196. Specify the sample rate. Default value is 48000 Hz.
  4197. @item amplitude, a
  4198. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4199. is 1.0.
  4200. @item duration, d
  4201. Specify the duration of the generated audio stream. Not specifying this option
  4202. results in noise with an infinite length.
  4203. @item color, colour, c
  4204. Specify the color of noise. Available noise colors are white, pink, brown,
  4205. blue and violet. Default color is white.
  4206. @item seed, s
  4207. Specify a value used to seed the PRNG.
  4208. @item nb_samples, n
  4209. Set the number of samples per each output frame, default is 1024.
  4210. @end table
  4211. @subsection Examples
  4212. @itemize
  4213. @item
  4214. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4215. @example
  4216. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4217. @end example
  4218. @end itemize
  4219. @section hilbert
  4220. Generate odd-tap Hilbert transform FIR coefficients.
  4221. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4222. the signal by 90 degrees.
  4223. This is used in many matrix coding schemes and for analytic signal generation.
  4224. The process is often written as a multiplication by i (or j), the imaginary unit.
  4225. The filter accepts the following options:
  4226. @table @option
  4227. @item sample_rate, s
  4228. Set sample rate, default is 44100.
  4229. @item taps, t
  4230. Set length of FIR filter, default is 22051.
  4231. @item nb_samples, n
  4232. Set number of samples per each frame.
  4233. @item win_func, w
  4234. Set window function to be used when generating FIR coefficients.
  4235. @end table
  4236. @section sinc
  4237. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4238. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4239. The filter accepts the following options:
  4240. @table @option
  4241. @item sample_rate, r
  4242. Set sample rate, default is 44100.
  4243. @item nb_samples, n
  4244. Set number of samples per each frame. Default is 1024.
  4245. @item hp
  4246. Set high-pass frequency. Default is 0.
  4247. @item lp
  4248. Set low-pass frequency. Default is 0.
  4249. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4250. is higher than 0 then filter will create band-pass filter coefficients,
  4251. otherwise band-reject filter coefficients.
  4252. @item phase
  4253. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4254. @item beta
  4255. Set Kaiser window beta.
  4256. @item att
  4257. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4258. @item round
  4259. Enable rounding, by default is disabled.
  4260. @item hptaps
  4261. Set number of taps for high-pass filter.
  4262. @item lptaps
  4263. Set number of taps for low-pass filter.
  4264. @end table
  4265. @section sine
  4266. Generate an audio signal made of a sine wave with amplitude 1/8.
  4267. The audio signal is bit-exact.
  4268. The filter accepts the following options:
  4269. @table @option
  4270. @item frequency, f
  4271. Set the carrier frequency. Default is 440 Hz.
  4272. @item beep_factor, b
  4273. Enable a periodic beep every second with frequency @var{beep_factor} times
  4274. the carrier frequency. Default is 0, meaning the beep is disabled.
  4275. @item sample_rate, r
  4276. Specify the sample rate, default is 44100.
  4277. @item duration, d
  4278. Specify the duration of the generated audio stream.
  4279. @item samples_per_frame
  4280. Set the number of samples per output frame.
  4281. The expression can contain the following constants:
  4282. @table @option
  4283. @item n
  4284. The (sequential) number of the output audio frame, starting from 0.
  4285. @item pts
  4286. The PTS (Presentation TimeStamp) of the output audio frame,
  4287. expressed in @var{TB} units.
  4288. @item t
  4289. The PTS of the output audio frame, expressed in seconds.
  4290. @item TB
  4291. The timebase of the output audio frames.
  4292. @end table
  4293. Default is @code{1024}.
  4294. @end table
  4295. @subsection Examples
  4296. @itemize
  4297. @item
  4298. Generate a simple 440 Hz sine wave:
  4299. @example
  4300. sine
  4301. @end example
  4302. @item
  4303. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4304. @example
  4305. sine=220:4:d=5
  4306. sine=f=220:b=4:d=5
  4307. sine=frequency=220:beep_factor=4:duration=5
  4308. @end example
  4309. @item
  4310. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4311. pattern:
  4312. @example
  4313. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4314. @end example
  4315. @end itemize
  4316. @c man end AUDIO SOURCES
  4317. @chapter Audio Sinks
  4318. @c man begin AUDIO SINKS
  4319. Below is a description of the currently available audio sinks.
  4320. @section abuffersink
  4321. Buffer audio frames, and make them available to the end of filter chain.
  4322. This sink is mainly intended for programmatic use, in particular
  4323. through the interface defined in @file{libavfilter/buffersink.h}
  4324. or the options system.
  4325. It accepts a pointer to an AVABufferSinkContext structure, which
  4326. defines the incoming buffers' formats, to be passed as the opaque
  4327. parameter to @code{avfilter_init_filter} for initialization.
  4328. @section anullsink
  4329. Null audio sink; do absolutely nothing with the input audio. It is
  4330. mainly useful as a template and for use in analysis / debugging
  4331. tools.
  4332. @c man end AUDIO SINKS
  4333. @chapter Video Filters
  4334. @c man begin VIDEO FILTERS
  4335. When you configure your FFmpeg build, you can disable any of the
  4336. existing filters using @code{--disable-filters}.
  4337. The configure output will show the video filters included in your
  4338. build.
  4339. Below is a description of the currently available video filters.
  4340. @section alphaextract
  4341. Extract the alpha component from the input as a grayscale video. This
  4342. is especially useful with the @var{alphamerge} filter.
  4343. @section alphamerge
  4344. Add or replace the alpha component of the primary input with the
  4345. grayscale value of a second input. This is intended for use with
  4346. @var{alphaextract} to allow the transmission or storage of frame
  4347. sequences that have alpha in a format that doesn't support an alpha
  4348. channel.
  4349. For example, to reconstruct full frames from a normal YUV-encoded video
  4350. and a separate video created with @var{alphaextract}, you might use:
  4351. @example
  4352. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4353. @end example
  4354. Since this filter is designed for reconstruction, it operates on frame
  4355. sequences without considering timestamps, and terminates when either
  4356. input reaches end of stream. This will cause problems if your encoding
  4357. pipeline drops frames. If you're trying to apply an image as an
  4358. overlay to a video stream, consider the @var{overlay} filter instead.
  4359. @section amplify
  4360. Amplify differences between current pixel and pixels of adjacent frames in
  4361. same pixel location.
  4362. This filter accepts the following options:
  4363. @table @option
  4364. @item radius
  4365. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4366. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4367. @item factor
  4368. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4369. @item threshold
  4370. Set threshold for difference amplification. Any differrence greater or equal to
  4371. this value will not alter source pixel. Default is 10.
  4372. Allowed range is from 0 to 65535.
  4373. @item low
  4374. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4375. This option controls maximum possible value that will decrease source pixel value.
  4376. @item high
  4377. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4378. This option controls maximum possible value that will increase source pixel value.
  4379. @item planes
  4380. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4381. @end table
  4382. @section ass
  4383. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4384. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4385. Substation Alpha) subtitles files.
  4386. This filter accepts the following option in addition to the common options from
  4387. the @ref{subtitles} filter:
  4388. @table @option
  4389. @item shaping
  4390. Set the shaping engine
  4391. Available values are:
  4392. @table @samp
  4393. @item auto
  4394. The default libass shaping engine, which is the best available.
  4395. @item simple
  4396. Fast, font-agnostic shaper that can do only substitutions
  4397. @item complex
  4398. Slower shaper using OpenType for substitutions and positioning
  4399. @end table
  4400. The default is @code{auto}.
  4401. @end table
  4402. @section atadenoise
  4403. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4404. The filter accepts the following options:
  4405. @table @option
  4406. @item 0a
  4407. Set threshold A for 1st plane. Default is 0.02.
  4408. Valid range is 0 to 0.3.
  4409. @item 0b
  4410. Set threshold B for 1st plane. Default is 0.04.
  4411. Valid range is 0 to 5.
  4412. @item 1a
  4413. Set threshold A for 2nd plane. Default is 0.02.
  4414. Valid range is 0 to 0.3.
  4415. @item 1b
  4416. Set threshold B for 2nd plane. Default is 0.04.
  4417. Valid range is 0 to 5.
  4418. @item 2a
  4419. Set threshold A for 3rd plane. Default is 0.02.
  4420. Valid range is 0 to 0.3.
  4421. @item 2b
  4422. Set threshold B for 3rd plane. Default is 0.04.
  4423. Valid range is 0 to 5.
  4424. Threshold A is designed to react on abrupt changes in the input signal and
  4425. threshold B is designed to react on continuous changes in the input signal.
  4426. @item s
  4427. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4428. number in range [5, 129].
  4429. @item p
  4430. Set what planes of frame filter will use for averaging. Default is all.
  4431. @end table
  4432. @section avgblur
  4433. Apply average blur filter.
  4434. The filter accepts the following options:
  4435. @table @option
  4436. @item sizeX
  4437. Set horizontal radius size.
  4438. @item planes
  4439. Set which planes to filter. By default all planes are filtered.
  4440. @item sizeY
  4441. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4442. Default is @code{0}.
  4443. @end table
  4444. @section bbox
  4445. Compute the bounding box for the non-black pixels in the input frame
  4446. luminance plane.
  4447. This filter computes the bounding box containing all the pixels with a
  4448. luminance value greater than the minimum allowed value.
  4449. The parameters describing the bounding box are printed on the filter
  4450. log.
  4451. The filter accepts the following option:
  4452. @table @option
  4453. @item min_val
  4454. Set the minimal luminance value. Default is @code{16}.
  4455. @end table
  4456. @section bitplanenoise
  4457. Show and measure bit plane noise.
  4458. The filter accepts the following options:
  4459. @table @option
  4460. @item bitplane
  4461. Set which plane to analyze. Default is @code{1}.
  4462. @item filter
  4463. Filter out noisy pixels from @code{bitplane} set above.
  4464. Default is disabled.
  4465. @end table
  4466. @section blackdetect
  4467. Detect video intervals that are (almost) completely black. Can be
  4468. useful to detect chapter transitions, commercials, or invalid
  4469. recordings. Output lines contains the time for the start, end and
  4470. duration of the detected black interval expressed in seconds.
  4471. In order to display the output lines, you need to set the loglevel at
  4472. least to the AV_LOG_INFO value.
  4473. The filter accepts the following options:
  4474. @table @option
  4475. @item black_min_duration, d
  4476. Set the minimum detected black duration expressed in seconds. It must
  4477. be a non-negative floating point number.
  4478. Default value is 2.0.
  4479. @item picture_black_ratio_th, pic_th
  4480. Set the threshold for considering a picture "black".
  4481. Express the minimum value for the ratio:
  4482. @example
  4483. @var{nb_black_pixels} / @var{nb_pixels}
  4484. @end example
  4485. for which a picture is considered black.
  4486. Default value is 0.98.
  4487. @item pixel_black_th, pix_th
  4488. Set the threshold for considering a pixel "black".
  4489. The threshold expresses the maximum pixel luminance value for which a
  4490. pixel is considered "black". The provided value is scaled according to
  4491. the following equation:
  4492. @example
  4493. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4494. @end example
  4495. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4496. the input video format, the range is [0-255] for YUV full-range
  4497. formats and [16-235] for YUV non full-range formats.
  4498. Default value is 0.10.
  4499. @end table
  4500. The following example sets the maximum pixel threshold to the minimum
  4501. value, and detects only black intervals of 2 or more seconds:
  4502. @example
  4503. blackdetect=d=2:pix_th=0.00
  4504. @end example
  4505. @section blackframe
  4506. Detect frames that are (almost) completely black. Can be useful to
  4507. detect chapter transitions or commercials. Output lines consist of
  4508. the frame number of the detected frame, the percentage of blackness,
  4509. the position in the file if known or -1 and the timestamp in seconds.
  4510. In order to display the output lines, you need to set the loglevel at
  4511. least to the AV_LOG_INFO value.
  4512. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4513. The value represents the percentage of pixels in the picture that
  4514. are below the threshold value.
  4515. It accepts the following parameters:
  4516. @table @option
  4517. @item amount
  4518. The percentage of the pixels that have to be below the threshold; it defaults to
  4519. @code{98}.
  4520. @item threshold, thresh
  4521. The threshold below which a pixel value is considered black; it defaults to
  4522. @code{32}.
  4523. @end table
  4524. @section blend, tblend
  4525. Blend two video frames into each other.
  4526. The @code{blend} filter takes two input streams and outputs one
  4527. stream, the first input is the "top" layer and second input is
  4528. "bottom" layer. By default, the output terminates when the longest input terminates.
  4529. The @code{tblend} (time blend) filter takes two consecutive frames
  4530. from one single stream, and outputs the result obtained by blending
  4531. the new frame on top of the old frame.
  4532. A description of the accepted options follows.
  4533. @table @option
  4534. @item c0_mode
  4535. @item c1_mode
  4536. @item c2_mode
  4537. @item c3_mode
  4538. @item all_mode
  4539. Set blend mode for specific pixel component or all pixel components in case
  4540. of @var{all_mode}. Default value is @code{normal}.
  4541. Available values for component modes are:
  4542. @table @samp
  4543. @item addition
  4544. @item grainmerge
  4545. @item and
  4546. @item average
  4547. @item burn
  4548. @item darken
  4549. @item difference
  4550. @item grainextract
  4551. @item divide
  4552. @item dodge
  4553. @item freeze
  4554. @item exclusion
  4555. @item extremity
  4556. @item glow
  4557. @item hardlight
  4558. @item hardmix
  4559. @item heat
  4560. @item lighten
  4561. @item linearlight
  4562. @item multiply
  4563. @item multiply128
  4564. @item negation
  4565. @item normal
  4566. @item or
  4567. @item overlay
  4568. @item phoenix
  4569. @item pinlight
  4570. @item reflect
  4571. @item screen
  4572. @item softlight
  4573. @item subtract
  4574. @item vividlight
  4575. @item xor
  4576. @end table
  4577. @item c0_opacity
  4578. @item c1_opacity
  4579. @item c2_opacity
  4580. @item c3_opacity
  4581. @item all_opacity
  4582. Set blend opacity for specific pixel component or all pixel components in case
  4583. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4584. @item c0_expr
  4585. @item c1_expr
  4586. @item c2_expr
  4587. @item c3_expr
  4588. @item all_expr
  4589. Set blend expression for specific pixel component or all pixel components in case
  4590. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4591. The expressions can use the following variables:
  4592. @table @option
  4593. @item N
  4594. The sequential number of the filtered frame, starting from @code{0}.
  4595. @item X
  4596. @item Y
  4597. the coordinates of the current sample
  4598. @item W
  4599. @item H
  4600. the width and height of currently filtered plane
  4601. @item SW
  4602. @item SH
  4603. Width and height scale for the plane being filtered. It is the
  4604. ratio between the dimensions of the current plane to the luma plane,
  4605. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4606. the luma plane and @code{0.5,0.5} for the chroma planes.
  4607. @item T
  4608. Time of the current frame, expressed in seconds.
  4609. @item TOP, A
  4610. Value of pixel component at current location for first video frame (top layer).
  4611. @item BOTTOM, B
  4612. Value of pixel component at current location for second video frame (bottom layer).
  4613. @end table
  4614. @end table
  4615. The @code{blend} filter also supports the @ref{framesync} options.
  4616. @subsection Examples
  4617. @itemize
  4618. @item
  4619. Apply transition from bottom layer to top layer in first 10 seconds:
  4620. @example
  4621. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4622. @end example
  4623. @item
  4624. Apply linear horizontal transition from top layer to bottom layer:
  4625. @example
  4626. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4627. @end example
  4628. @item
  4629. Apply 1x1 checkerboard effect:
  4630. @example
  4631. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4632. @end example
  4633. @item
  4634. Apply uncover left effect:
  4635. @example
  4636. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4637. @end example
  4638. @item
  4639. Apply uncover down effect:
  4640. @example
  4641. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4642. @end example
  4643. @item
  4644. Apply uncover up-left effect:
  4645. @example
  4646. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4647. @end example
  4648. @item
  4649. Split diagonally video and shows top and bottom layer on each side:
  4650. @example
  4651. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4652. @end example
  4653. @item
  4654. Display differences between the current and the previous frame:
  4655. @example
  4656. tblend=all_mode=grainextract
  4657. @end example
  4658. @end itemize
  4659. @section bm3d
  4660. Denoise frames using Block-Matching 3D algorithm.
  4661. The filter accepts the following options.
  4662. @table @option
  4663. @item sigma
  4664. Set denoising strength. Default value is 1.
  4665. Allowed range is from 0 to 999.9.
  4666. The denoising algorith is very sensitive to sigma, so adjust it
  4667. according to the source.
  4668. @item block
  4669. Set local patch size. This sets dimensions in 2D.
  4670. @item bstep
  4671. Set sliding step for processing blocks. Default value is 4.
  4672. Allowed range is from 1 to 64.
  4673. Smaller values allows processing more reference blocks and is slower.
  4674. @item group
  4675. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4676. When set to 1, no block matching is done. Larger values allows more blocks
  4677. in single group.
  4678. Allowed range is from 1 to 256.
  4679. @item range
  4680. Set radius for search block matching. Default is 9.
  4681. Allowed range is from 1 to INT32_MAX.
  4682. @item mstep
  4683. Set step between two search locations for block matching. Default is 1.
  4684. Allowed range is from 1 to 64. Smaller is slower.
  4685. @item thmse
  4686. Set threshold of mean square error for block matching. Valid range is 0 to
  4687. INT32_MAX.
  4688. @item hdthr
  4689. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4690. Larger values results in stronger hard-thresholding filtering in frequency
  4691. domain.
  4692. @item estim
  4693. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4694. Default is @code{basic}.
  4695. @item ref
  4696. If enabled, filter will use 2nd stream for block matching.
  4697. Default is disabled for @code{basic} value of @var{estim} option,
  4698. and always enabled if value of @var{estim} is @code{final}.
  4699. @item planes
  4700. Set planes to filter. Default is all available except alpha.
  4701. @end table
  4702. @subsection Examples
  4703. @itemize
  4704. @item
  4705. Basic filtering with bm3d:
  4706. @example
  4707. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4708. @end example
  4709. @item
  4710. Same as above, but filtering only luma:
  4711. @example
  4712. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4713. @end example
  4714. @item
  4715. Same as above, but with both estimation modes:
  4716. @example
  4717. 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
  4718. @end example
  4719. @item
  4720. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4721. @example
  4722. 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
  4723. @end example
  4724. @end itemize
  4725. @section boxblur
  4726. Apply a boxblur algorithm to the input video.
  4727. It accepts the following parameters:
  4728. @table @option
  4729. @item luma_radius, lr
  4730. @item luma_power, lp
  4731. @item chroma_radius, cr
  4732. @item chroma_power, cp
  4733. @item alpha_radius, ar
  4734. @item alpha_power, ap
  4735. @end table
  4736. A description of the accepted options follows.
  4737. @table @option
  4738. @item luma_radius, lr
  4739. @item chroma_radius, cr
  4740. @item alpha_radius, ar
  4741. Set an expression for the box radius in pixels used for blurring the
  4742. corresponding input plane.
  4743. The radius value must be a non-negative number, and must not be
  4744. greater than the value of the expression @code{min(w,h)/2} for the
  4745. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4746. planes.
  4747. Default value for @option{luma_radius} is "2". If not specified,
  4748. @option{chroma_radius} and @option{alpha_radius} default to the
  4749. corresponding value set for @option{luma_radius}.
  4750. The expressions can contain the following constants:
  4751. @table @option
  4752. @item w
  4753. @item h
  4754. The input width and height in pixels.
  4755. @item cw
  4756. @item ch
  4757. The input chroma image width and height in pixels.
  4758. @item hsub
  4759. @item vsub
  4760. The horizontal and vertical chroma subsample values. For example, for the
  4761. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4762. @end table
  4763. @item luma_power, lp
  4764. @item chroma_power, cp
  4765. @item alpha_power, ap
  4766. Specify how many times the boxblur filter is applied to the
  4767. corresponding plane.
  4768. Default value for @option{luma_power} is 2. If not specified,
  4769. @option{chroma_power} and @option{alpha_power} default to the
  4770. corresponding value set for @option{luma_power}.
  4771. A value of 0 will disable the effect.
  4772. @end table
  4773. @subsection Examples
  4774. @itemize
  4775. @item
  4776. Apply a boxblur filter with the luma, chroma, and alpha radii
  4777. set to 2:
  4778. @example
  4779. boxblur=luma_radius=2:luma_power=1
  4780. boxblur=2:1
  4781. @end example
  4782. @item
  4783. Set the luma radius to 2, and alpha and chroma radius to 0:
  4784. @example
  4785. boxblur=2:1:cr=0:ar=0
  4786. @end example
  4787. @item
  4788. Set the luma and chroma radii to a fraction of the video dimension:
  4789. @example
  4790. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4791. @end example
  4792. @end itemize
  4793. @section bwdif
  4794. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4795. Deinterlacing Filter").
  4796. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4797. interpolation algorithms.
  4798. It accepts the following parameters:
  4799. @table @option
  4800. @item mode
  4801. The interlacing mode to adopt. It accepts one of the following values:
  4802. @table @option
  4803. @item 0, send_frame
  4804. Output one frame for each frame.
  4805. @item 1, send_field
  4806. Output one frame for each field.
  4807. @end table
  4808. The default value is @code{send_field}.
  4809. @item parity
  4810. The picture field parity assumed for the input interlaced video. It accepts one
  4811. of the following values:
  4812. @table @option
  4813. @item 0, tff
  4814. Assume the top field is first.
  4815. @item 1, bff
  4816. Assume the bottom field is first.
  4817. @item -1, auto
  4818. Enable automatic detection of field parity.
  4819. @end table
  4820. The default value is @code{auto}.
  4821. If the interlacing is unknown or the decoder does not export this information,
  4822. top field first will be assumed.
  4823. @item deint
  4824. Specify which frames to deinterlace. Accept one of the following
  4825. values:
  4826. @table @option
  4827. @item 0, all
  4828. Deinterlace all frames.
  4829. @item 1, interlaced
  4830. Only deinterlace frames marked as interlaced.
  4831. @end table
  4832. The default value is @code{all}.
  4833. @end table
  4834. @section chromahold
  4835. Remove all color information for all colors except for certain one.
  4836. The filter accepts the following options:
  4837. @table @option
  4838. @item color
  4839. The color which will not be replaced with neutral chroma.
  4840. @item similarity
  4841. Similarity percentage with the above color.
  4842. 0.01 matches only the exact key color, while 1.0 matches everything.
  4843. @item yuv
  4844. Signals that the color passed is already in YUV instead of RGB.
  4845. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4846. This can be used to pass exact YUV values as hexadecimal numbers.
  4847. @end table
  4848. @section chromakey
  4849. YUV colorspace color/chroma keying.
  4850. The filter accepts the following options:
  4851. @table @option
  4852. @item color
  4853. The color which will be replaced with transparency.
  4854. @item similarity
  4855. Similarity percentage with the key color.
  4856. 0.01 matches only the exact key color, while 1.0 matches everything.
  4857. @item blend
  4858. Blend percentage.
  4859. 0.0 makes pixels either fully transparent, or not transparent at all.
  4860. Higher values result in semi-transparent pixels, with a higher transparency
  4861. the more similar the pixels color is to the key color.
  4862. @item yuv
  4863. Signals that the color passed is already in YUV instead of RGB.
  4864. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4865. This can be used to pass exact YUV values as hexadecimal numbers.
  4866. @end table
  4867. @subsection Examples
  4868. @itemize
  4869. @item
  4870. Make every green pixel in the input image transparent:
  4871. @example
  4872. ffmpeg -i input.png -vf chromakey=green out.png
  4873. @end example
  4874. @item
  4875. Overlay a greenscreen-video on top of a static black background.
  4876. @example
  4877. 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
  4878. @end example
  4879. @end itemize
  4880. @section chromashift
  4881. Shift chroma pixels horizontally and/or vertically.
  4882. The filter accepts the following options:
  4883. @table @option
  4884. @item cbh
  4885. Set amount to shift chroma-blue horizontally.
  4886. @item cbv
  4887. Set amount to shift chroma-blue vertically.
  4888. @item crh
  4889. Set amount to shift chroma-red horizontally.
  4890. @item crv
  4891. Set amount to shift chroma-red vertically.
  4892. @item edge
  4893. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4894. @end table
  4895. @section ciescope
  4896. Display CIE color diagram with pixels overlaid onto it.
  4897. The filter accepts the following options:
  4898. @table @option
  4899. @item system
  4900. Set color system.
  4901. @table @samp
  4902. @item ntsc, 470m
  4903. @item ebu, 470bg
  4904. @item smpte
  4905. @item 240m
  4906. @item apple
  4907. @item widergb
  4908. @item cie1931
  4909. @item rec709, hdtv
  4910. @item uhdtv, rec2020
  4911. @end table
  4912. @item cie
  4913. Set CIE system.
  4914. @table @samp
  4915. @item xyy
  4916. @item ucs
  4917. @item luv
  4918. @end table
  4919. @item gamuts
  4920. Set what gamuts to draw.
  4921. See @code{system} option for available values.
  4922. @item size, s
  4923. Set ciescope size, by default set to 512.
  4924. @item intensity, i
  4925. Set intensity used to map input pixel values to CIE diagram.
  4926. @item contrast
  4927. Set contrast used to draw tongue colors that are out of active color system gamut.
  4928. @item corrgamma
  4929. Correct gamma displayed on scope, by default enabled.
  4930. @item showwhite
  4931. Show white point on CIE diagram, by default disabled.
  4932. @item gamma
  4933. Set input gamma. Used only with XYZ input color space.
  4934. @end table
  4935. @section codecview
  4936. Visualize information exported by some codecs.
  4937. Some codecs can export information through frames using side-data or other
  4938. means. For example, some MPEG based codecs export motion vectors through the
  4939. @var{export_mvs} flag in the codec @option{flags2} option.
  4940. The filter accepts the following option:
  4941. @table @option
  4942. @item mv
  4943. Set motion vectors to visualize.
  4944. Available flags for @var{mv} are:
  4945. @table @samp
  4946. @item pf
  4947. forward predicted MVs of P-frames
  4948. @item bf
  4949. forward predicted MVs of B-frames
  4950. @item bb
  4951. backward predicted MVs of B-frames
  4952. @end table
  4953. @item qp
  4954. Display quantization parameters using the chroma planes.
  4955. @item mv_type, mvt
  4956. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4957. Available flags for @var{mv_type} are:
  4958. @table @samp
  4959. @item fp
  4960. forward predicted MVs
  4961. @item bp
  4962. backward predicted MVs
  4963. @end table
  4964. @item frame_type, ft
  4965. Set frame type to visualize motion vectors of.
  4966. Available flags for @var{frame_type} are:
  4967. @table @samp
  4968. @item if
  4969. intra-coded frames (I-frames)
  4970. @item pf
  4971. predicted frames (P-frames)
  4972. @item bf
  4973. bi-directionally predicted frames (B-frames)
  4974. @end table
  4975. @end table
  4976. @subsection Examples
  4977. @itemize
  4978. @item
  4979. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4980. @example
  4981. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4982. @end example
  4983. @item
  4984. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4985. @example
  4986. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4987. @end example
  4988. @end itemize
  4989. @section colorbalance
  4990. Modify intensity of primary colors (red, green and blue) of input frames.
  4991. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4992. regions for the red-cyan, green-magenta or blue-yellow balance.
  4993. A positive adjustment value shifts the balance towards the primary color, a negative
  4994. value towards the complementary color.
  4995. The filter accepts the following options:
  4996. @table @option
  4997. @item rs
  4998. @item gs
  4999. @item bs
  5000. Adjust red, green and blue shadows (darkest pixels).
  5001. @item rm
  5002. @item gm
  5003. @item bm
  5004. Adjust red, green and blue midtones (medium pixels).
  5005. @item rh
  5006. @item gh
  5007. @item bh
  5008. Adjust red, green and blue highlights (brightest pixels).
  5009. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5010. @end table
  5011. @subsection Examples
  5012. @itemize
  5013. @item
  5014. Add red color cast to shadows:
  5015. @example
  5016. colorbalance=rs=.3
  5017. @end example
  5018. @end itemize
  5019. @section colorkey
  5020. RGB colorspace color keying.
  5021. The filter accepts the following options:
  5022. @table @option
  5023. @item color
  5024. The color which will be replaced with transparency.
  5025. @item similarity
  5026. Similarity percentage with the key color.
  5027. 0.01 matches only the exact key color, while 1.0 matches everything.
  5028. @item blend
  5029. Blend percentage.
  5030. 0.0 makes pixels either fully transparent, or not transparent at all.
  5031. Higher values result in semi-transparent pixels, with a higher transparency
  5032. the more similar the pixels color is to the key color.
  5033. @end table
  5034. @subsection Examples
  5035. @itemize
  5036. @item
  5037. Make every green pixel in the input image transparent:
  5038. @example
  5039. ffmpeg -i input.png -vf colorkey=green out.png
  5040. @end example
  5041. @item
  5042. Overlay a greenscreen-video on top of a static background image.
  5043. @example
  5044. 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
  5045. @end example
  5046. @end itemize
  5047. @section colorlevels
  5048. Adjust video input frames using levels.
  5049. The filter accepts the following options:
  5050. @table @option
  5051. @item rimin
  5052. @item gimin
  5053. @item bimin
  5054. @item aimin
  5055. Adjust red, green, blue and alpha input black point.
  5056. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5057. @item rimax
  5058. @item gimax
  5059. @item bimax
  5060. @item aimax
  5061. Adjust red, green, blue and alpha input white point.
  5062. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5063. Input levels are used to lighten highlights (bright tones), darken shadows
  5064. (dark tones), change the balance of bright and dark tones.
  5065. @item romin
  5066. @item gomin
  5067. @item bomin
  5068. @item aomin
  5069. Adjust red, green, blue and alpha output black point.
  5070. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5071. @item romax
  5072. @item gomax
  5073. @item bomax
  5074. @item aomax
  5075. Adjust red, green, blue and alpha output white point.
  5076. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5077. Output levels allows manual selection of a constrained output level range.
  5078. @end table
  5079. @subsection Examples
  5080. @itemize
  5081. @item
  5082. Make video output darker:
  5083. @example
  5084. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5085. @end example
  5086. @item
  5087. Increase contrast:
  5088. @example
  5089. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5090. @end example
  5091. @item
  5092. Make video output lighter:
  5093. @example
  5094. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5095. @end example
  5096. @item
  5097. Increase brightness:
  5098. @example
  5099. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5100. @end example
  5101. @end itemize
  5102. @section colorchannelmixer
  5103. Adjust video input frames by re-mixing color channels.
  5104. This filter modifies a color channel by adding the values associated to
  5105. the other channels of the same pixels. For example if the value to
  5106. modify is red, the output value will be:
  5107. @example
  5108. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5109. @end example
  5110. The filter accepts the following options:
  5111. @table @option
  5112. @item rr
  5113. @item rg
  5114. @item rb
  5115. @item ra
  5116. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5117. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5118. @item gr
  5119. @item gg
  5120. @item gb
  5121. @item ga
  5122. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5123. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5124. @item br
  5125. @item bg
  5126. @item bb
  5127. @item ba
  5128. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5129. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5130. @item ar
  5131. @item ag
  5132. @item ab
  5133. @item aa
  5134. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5135. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5136. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5137. @end table
  5138. @subsection Examples
  5139. @itemize
  5140. @item
  5141. Convert source to grayscale:
  5142. @example
  5143. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5144. @end example
  5145. @item
  5146. Simulate sepia tones:
  5147. @example
  5148. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5149. @end example
  5150. @end itemize
  5151. @section colormatrix
  5152. Convert color matrix.
  5153. The filter accepts the following options:
  5154. @table @option
  5155. @item src
  5156. @item dst
  5157. Specify the source and destination color matrix. Both values must be
  5158. specified.
  5159. The accepted values are:
  5160. @table @samp
  5161. @item bt709
  5162. BT.709
  5163. @item fcc
  5164. FCC
  5165. @item bt601
  5166. BT.601
  5167. @item bt470
  5168. BT.470
  5169. @item bt470bg
  5170. BT.470BG
  5171. @item smpte170m
  5172. SMPTE-170M
  5173. @item smpte240m
  5174. SMPTE-240M
  5175. @item bt2020
  5176. BT.2020
  5177. @end table
  5178. @end table
  5179. For example to convert from BT.601 to SMPTE-240M, use the command:
  5180. @example
  5181. colormatrix=bt601:smpte240m
  5182. @end example
  5183. @section colorspace
  5184. Convert colorspace, transfer characteristics or color primaries.
  5185. Input video needs to have an even size.
  5186. The filter accepts the following options:
  5187. @table @option
  5188. @anchor{all}
  5189. @item all
  5190. Specify all color properties at once.
  5191. The accepted values are:
  5192. @table @samp
  5193. @item bt470m
  5194. BT.470M
  5195. @item bt470bg
  5196. BT.470BG
  5197. @item bt601-6-525
  5198. BT.601-6 525
  5199. @item bt601-6-625
  5200. BT.601-6 625
  5201. @item bt709
  5202. BT.709
  5203. @item smpte170m
  5204. SMPTE-170M
  5205. @item smpte240m
  5206. SMPTE-240M
  5207. @item bt2020
  5208. BT.2020
  5209. @end table
  5210. @anchor{space}
  5211. @item space
  5212. Specify output colorspace.
  5213. The accepted values are:
  5214. @table @samp
  5215. @item bt709
  5216. BT.709
  5217. @item fcc
  5218. FCC
  5219. @item bt470bg
  5220. BT.470BG or BT.601-6 625
  5221. @item smpte170m
  5222. SMPTE-170M or BT.601-6 525
  5223. @item smpte240m
  5224. SMPTE-240M
  5225. @item ycgco
  5226. YCgCo
  5227. @item bt2020ncl
  5228. BT.2020 with non-constant luminance
  5229. @end table
  5230. @anchor{trc}
  5231. @item trc
  5232. Specify output transfer characteristics.
  5233. The accepted values are:
  5234. @table @samp
  5235. @item bt709
  5236. BT.709
  5237. @item bt470m
  5238. BT.470M
  5239. @item bt470bg
  5240. BT.470BG
  5241. @item gamma22
  5242. Constant gamma of 2.2
  5243. @item gamma28
  5244. Constant gamma of 2.8
  5245. @item smpte170m
  5246. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5247. @item smpte240m
  5248. SMPTE-240M
  5249. @item srgb
  5250. SRGB
  5251. @item iec61966-2-1
  5252. iec61966-2-1
  5253. @item iec61966-2-4
  5254. iec61966-2-4
  5255. @item xvycc
  5256. xvycc
  5257. @item bt2020-10
  5258. BT.2020 for 10-bits content
  5259. @item bt2020-12
  5260. BT.2020 for 12-bits content
  5261. @end table
  5262. @anchor{primaries}
  5263. @item primaries
  5264. Specify output color primaries.
  5265. The accepted values are:
  5266. @table @samp
  5267. @item bt709
  5268. BT.709
  5269. @item bt470m
  5270. BT.470M
  5271. @item bt470bg
  5272. BT.470BG or BT.601-6 625
  5273. @item smpte170m
  5274. SMPTE-170M or BT.601-6 525
  5275. @item smpte240m
  5276. SMPTE-240M
  5277. @item film
  5278. film
  5279. @item smpte431
  5280. SMPTE-431
  5281. @item smpte432
  5282. SMPTE-432
  5283. @item bt2020
  5284. BT.2020
  5285. @item jedec-p22
  5286. JEDEC P22 phosphors
  5287. @end table
  5288. @anchor{range}
  5289. @item range
  5290. Specify output color range.
  5291. The accepted values are:
  5292. @table @samp
  5293. @item tv
  5294. TV (restricted) range
  5295. @item mpeg
  5296. MPEG (restricted) range
  5297. @item pc
  5298. PC (full) range
  5299. @item jpeg
  5300. JPEG (full) range
  5301. @end table
  5302. @item format
  5303. Specify output color format.
  5304. The accepted values are:
  5305. @table @samp
  5306. @item yuv420p
  5307. YUV 4:2:0 planar 8-bits
  5308. @item yuv420p10
  5309. YUV 4:2:0 planar 10-bits
  5310. @item yuv420p12
  5311. YUV 4:2:0 planar 12-bits
  5312. @item yuv422p
  5313. YUV 4:2:2 planar 8-bits
  5314. @item yuv422p10
  5315. YUV 4:2:2 planar 10-bits
  5316. @item yuv422p12
  5317. YUV 4:2:2 planar 12-bits
  5318. @item yuv444p
  5319. YUV 4:4:4 planar 8-bits
  5320. @item yuv444p10
  5321. YUV 4:4:4 planar 10-bits
  5322. @item yuv444p12
  5323. YUV 4:4:4 planar 12-bits
  5324. @end table
  5325. @item fast
  5326. Do a fast conversion, which skips gamma/primary correction. This will take
  5327. significantly less CPU, but will be mathematically incorrect. To get output
  5328. compatible with that produced by the colormatrix filter, use fast=1.
  5329. @item dither
  5330. Specify dithering mode.
  5331. The accepted values are:
  5332. @table @samp
  5333. @item none
  5334. No dithering
  5335. @item fsb
  5336. Floyd-Steinberg dithering
  5337. @end table
  5338. @item wpadapt
  5339. Whitepoint adaptation mode.
  5340. The accepted values are:
  5341. @table @samp
  5342. @item bradford
  5343. Bradford whitepoint adaptation
  5344. @item vonkries
  5345. von Kries whitepoint adaptation
  5346. @item identity
  5347. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5348. @end table
  5349. @item iall
  5350. Override all input properties at once. Same accepted values as @ref{all}.
  5351. @item ispace
  5352. Override input colorspace. Same accepted values as @ref{space}.
  5353. @item iprimaries
  5354. Override input color primaries. Same accepted values as @ref{primaries}.
  5355. @item itrc
  5356. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5357. @item irange
  5358. Override input color range. Same accepted values as @ref{range}.
  5359. @end table
  5360. The filter converts the transfer characteristics, color space and color
  5361. primaries to the specified user values. The output value, if not specified,
  5362. is set to a default value based on the "all" property. If that property is
  5363. also not specified, the filter will log an error. The output color range and
  5364. format default to the same value as the input color range and format. The
  5365. input transfer characteristics, color space, color primaries and color range
  5366. should be set on the input data. If any of these are missing, the filter will
  5367. log an error and no conversion will take place.
  5368. For example to convert the input to SMPTE-240M, use the command:
  5369. @example
  5370. colorspace=smpte240m
  5371. @end example
  5372. @section convolution
  5373. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5374. The filter accepts the following options:
  5375. @table @option
  5376. @item 0m
  5377. @item 1m
  5378. @item 2m
  5379. @item 3m
  5380. Set matrix for each plane.
  5381. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5382. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5383. @item 0rdiv
  5384. @item 1rdiv
  5385. @item 2rdiv
  5386. @item 3rdiv
  5387. Set multiplier for calculated value for each plane.
  5388. If unset or 0, it will be sum of all matrix elements.
  5389. @item 0bias
  5390. @item 1bias
  5391. @item 2bias
  5392. @item 3bias
  5393. Set bias for each plane. This value is added to the result of the multiplication.
  5394. Useful for making the overall image brighter or darker. Default is 0.0.
  5395. @item 0mode
  5396. @item 1mode
  5397. @item 2mode
  5398. @item 3mode
  5399. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5400. Default is @var{square}.
  5401. @end table
  5402. @subsection Examples
  5403. @itemize
  5404. @item
  5405. Apply sharpen:
  5406. @example
  5407. 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"
  5408. @end example
  5409. @item
  5410. Apply blur:
  5411. @example
  5412. 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"
  5413. @end example
  5414. @item
  5415. Apply edge enhance:
  5416. @example
  5417. 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"
  5418. @end example
  5419. @item
  5420. Apply edge detect:
  5421. @example
  5422. 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"
  5423. @end example
  5424. @item
  5425. Apply laplacian edge detector which includes diagonals:
  5426. @example
  5427. 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"
  5428. @end example
  5429. @item
  5430. Apply emboss:
  5431. @example
  5432. 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"
  5433. @end example
  5434. @end itemize
  5435. @section convolve
  5436. Apply 2D convolution of video stream in frequency domain using second stream
  5437. as impulse.
  5438. The filter accepts the following options:
  5439. @table @option
  5440. @item planes
  5441. Set which planes to process.
  5442. @item impulse
  5443. Set which impulse video frames will be processed, can be @var{first}
  5444. or @var{all}. Default is @var{all}.
  5445. @end table
  5446. The @code{convolve} filter also supports the @ref{framesync} options.
  5447. @section copy
  5448. Copy the input video source unchanged to the output. This is mainly useful for
  5449. testing purposes.
  5450. @anchor{coreimage}
  5451. @section coreimage
  5452. Video filtering on GPU using Apple's CoreImage API on OSX.
  5453. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5454. processed by video hardware. However, software-based OpenGL implementations
  5455. exist which means there is no guarantee for hardware processing. It depends on
  5456. the respective OSX.
  5457. There are many filters and image generators provided by Apple that come with a
  5458. large variety of options. The filter has to be referenced by its name along
  5459. with its options.
  5460. The coreimage filter accepts the following options:
  5461. @table @option
  5462. @item list_filters
  5463. List all available filters and generators along with all their respective
  5464. options as well as possible minimum and maximum values along with the default
  5465. values.
  5466. @example
  5467. list_filters=true
  5468. @end example
  5469. @item filter
  5470. Specify all filters by their respective name and options.
  5471. Use @var{list_filters} to determine all valid filter names and options.
  5472. Numerical options are specified by a float value and are automatically clamped
  5473. to their respective value range. Vector and color options have to be specified
  5474. by a list of space separated float values. Character escaping has to be done.
  5475. A special option name @code{default} is available to use default options for a
  5476. filter.
  5477. It is required to specify either @code{default} or at least one of the filter options.
  5478. All omitted options are used with their default values.
  5479. The syntax of the filter string is as follows:
  5480. @example
  5481. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5482. @end example
  5483. @item output_rect
  5484. Specify a rectangle where the output of the filter chain is copied into the
  5485. input image. It is given by a list of space separated float values:
  5486. @example
  5487. output_rect=x\ y\ width\ height
  5488. @end example
  5489. If not given, the output rectangle equals the dimensions of the input image.
  5490. The output rectangle is automatically cropped at the borders of the input
  5491. image. Negative values are valid for each component.
  5492. @example
  5493. output_rect=25\ 25\ 100\ 100
  5494. @end example
  5495. @end table
  5496. Several filters can be chained for successive processing without GPU-HOST
  5497. transfers allowing for fast processing of complex filter chains.
  5498. Currently, only filters with zero (generators) or exactly one (filters) input
  5499. image and one output image are supported. Also, transition filters are not yet
  5500. usable as intended.
  5501. Some filters generate output images with additional padding depending on the
  5502. respective filter kernel. The padding is automatically removed to ensure the
  5503. filter output has the same size as the input image.
  5504. For image generators, the size of the output image is determined by the
  5505. previous output image of the filter chain or the input image of the whole
  5506. filterchain, respectively. The generators do not use the pixel information of
  5507. this image to generate their output. However, the generated output is
  5508. blended onto this image, resulting in partial or complete coverage of the
  5509. output image.
  5510. The @ref{coreimagesrc} video source can be used for generating input images
  5511. which are directly fed into the filter chain. By using it, providing input
  5512. images by another video source or an input video is not required.
  5513. @subsection Examples
  5514. @itemize
  5515. @item
  5516. List all filters available:
  5517. @example
  5518. coreimage=list_filters=true
  5519. @end example
  5520. @item
  5521. Use the CIBoxBlur filter with default options to blur an image:
  5522. @example
  5523. coreimage=filter=CIBoxBlur@@default
  5524. @end example
  5525. @item
  5526. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5527. its center at 100x100 and a radius of 50 pixels:
  5528. @example
  5529. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5530. @end example
  5531. @item
  5532. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5533. given as complete and escaped command-line for Apple's standard bash shell:
  5534. @example
  5535. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5536. @end example
  5537. @end itemize
  5538. @section crop
  5539. Crop the input video to given dimensions.
  5540. It accepts the following parameters:
  5541. @table @option
  5542. @item w, out_w
  5543. The width of the output video. It defaults to @code{iw}.
  5544. This expression is evaluated only once during the filter
  5545. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5546. @item h, out_h
  5547. The height of the output video. It defaults to @code{ih}.
  5548. This expression is evaluated only once during the filter
  5549. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5550. @item x
  5551. The horizontal position, in the input video, of the left edge of the output
  5552. video. It defaults to @code{(in_w-out_w)/2}.
  5553. This expression is evaluated per-frame.
  5554. @item y
  5555. The vertical position, in the input video, of the top edge of the output video.
  5556. It defaults to @code{(in_h-out_h)/2}.
  5557. This expression is evaluated per-frame.
  5558. @item keep_aspect
  5559. If set to 1 will force the output display aspect ratio
  5560. to be the same of the input, by changing the output sample aspect
  5561. ratio. It defaults to 0.
  5562. @item exact
  5563. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5564. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5565. It defaults to 0.
  5566. @end table
  5567. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5568. expressions containing the following constants:
  5569. @table @option
  5570. @item x
  5571. @item y
  5572. The computed values for @var{x} and @var{y}. They are evaluated for
  5573. each new frame.
  5574. @item in_w
  5575. @item in_h
  5576. The input width and height.
  5577. @item iw
  5578. @item ih
  5579. These are the same as @var{in_w} and @var{in_h}.
  5580. @item out_w
  5581. @item out_h
  5582. The output (cropped) width and height.
  5583. @item ow
  5584. @item oh
  5585. These are the same as @var{out_w} and @var{out_h}.
  5586. @item a
  5587. same as @var{iw} / @var{ih}
  5588. @item sar
  5589. input sample aspect ratio
  5590. @item dar
  5591. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5592. @item hsub
  5593. @item vsub
  5594. horizontal and vertical chroma subsample values. For example for the
  5595. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5596. @item n
  5597. The number of the input frame, starting from 0.
  5598. @item pos
  5599. the position in the file of the input frame, NAN if unknown
  5600. @item t
  5601. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5602. @end table
  5603. The expression for @var{out_w} may depend on the value of @var{out_h},
  5604. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5605. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5606. evaluated after @var{out_w} and @var{out_h}.
  5607. The @var{x} and @var{y} parameters specify the expressions for the
  5608. position of the top-left corner of the output (non-cropped) area. They
  5609. are evaluated for each frame. If the evaluated value is not valid, it
  5610. is approximated to the nearest valid value.
  5611. The expression for @var{x} may depend on @var{y}, and the expression
  5612. for @var{y} may depend on @var{x}.
  5613. @subsection Examples
  5614. @itemize
  5615. @item
  5616. Crop area with size 100x100 at position (12,34).
  5617. @example
  5618. crop=100:100:12:34
  5619. @end example
  5620. Using named options, the example above becomes:
  5621. @example
  5622. crop=w=100:h=100:x=12:y=34
  5623. @end example
  5624. @item
  5625. Crop the central input area with size 100x100:
  5626. @example
  5627. crop=100:100
  5628. @end example
  5629. @item
  5630. Crop the central input area with size 2/3 of the input video:
  5631. @example
  5632. crop=2/3*in_w:2/3*in_h
  5633. @end example
  5634. @item
  5635. Crop the input video central square:
  5636. @example
  5637. crop=out_w=in_h
  5638. crop=in_h
  5639. @end example
  5640. @item
  5641. Delimit the rectangle with the top-left corner placed at position
  5642. 100:100 and the right-bottom corner corresponding to the right-bottom
  5643. corner of the input image.
  5644. @example
  5645. crop=in_w-100:in_h-100:100:100
  5646. @end example
  5647. @item
  5648. Crop 10 pixels from the left and right borders, and 20 pixels from
  5649. the top and bottom borders
  5650. @example
  5651. crop=in_w-2*10:in_h-2*20
  5652. @end example
  5653. @item
  5654. Keep only the bottom right quarter of the input image:
  5655. @example
  5656. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5657. @end example
  5658. @item
  5659. Crop height for getting Greek harmony:
  5660. @example
  5661. crop=in_w:1/PHI*in_w
  5662. @end example
  5663. @item
  5664. Apply trembling effect:
  5665. @example
  5666. 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)
  5667. @end example
  5668. @item
  5669. Apply erratic camera effect depending on timestamp:
  5670. @example
  5671. 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)"
  5672. @end example
  5673. @item
  5674. Set x depending on the value of y:
  5675. @example
  5676. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5677. @end example
  5678. @end itemize
  5679. @subsection Commands
  5680. This filter supports the following commands:
  5681. @table @option
  5682. @item w, out_w
  5683. @item h, out_h
  5684. @item x
  5685. @item y
  5686. Set width/height of the output video and the horizontal/vertical position
  5687. in the input video.
  5688. The command accepts the same syntax of the corresponding option.
  5689. If the specified expression is not valid, it is kept at its current
  5690. value.
  5691. @end table
  5692. @section cropdetect
  5693. Auto-detect the crop size.
  5694. It calculates the necessary cropping parameters and prints the
  5695. recommended parameters via the logging system. The detected dimensions
  5696. correspond to the non-black area of the input video.
  5697. It accepts the following parameters:
  5698. @table @option
  5699. @item limit
  5700. Set higher black value threshold, which can be optionally specified
  5701. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5702. value greater to the set value is considered non-black. It defaults to 24.
  5703. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5704. on the bitdepth of the pixel format.
  5705. @item round
  5706. The value which the width/height should be divisible by. It defaults to
  5707. 16. The offset is automatically adjusted to center the video. Use 2 to
  5708. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5709. encoding to most video codecs.
  5710. @item reset_count, reset
  5711. Set the counter that determines after how many frames cropdetect will
  5712. reset the previously detected largest video area and start over to
  5713. detect the current optimal crop area. Default value is 0.
  5714. This can be useful when channel logos distort the video area. 0
  5715. indicates 'never reset', and returns the largest area encountered during
  5716. playback.
  5717. @end table
  5718. @anchor{cue}
  5719. @section cue
  5720. Delay video filtering until a given wallclock timestamp. The filter first
  5721. passes on @option{preroll} amount of frames, then it buffers at most
  5722. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5723. it forwards the buffered frames and also any subsequent frames coming in its
  5724. input.
  5725. The filter can be used synchronize the output of multiple ffmpeg processes for
  5726. realtime output devices like decklink. By putting the delay in the filtering
  5727. chain and pre-buffering frames the process can pass on data to output almost
  5728. immediately after the target wallclock timestamp is reached.
  5729. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5730. some use cases.
  5731. @table @option
  5732. @item cue
  5733. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5734. @item preroll
  5735. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5736. @item buffer
  5737. The maximum duration of content to buffer before waiting for the cue expressed
  5738. in seconds. Default is 0.
  5739. @end table
  5740. @anchor{curves}
  5741. @section curves
  5742. Apply color adjustments using curves.
  5743. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5744. component (red, green and blue) has its values defined by @var{N} key points
  5745. tied from each other using a smooth curve. The x-axis represents the pixel
  5746. values from the input frame, and the y-axis the new pixel values to be set for
  5747. the output frame.
  5748. By default, a component curve is defined by the two points @var{(0;0)} and
  5749. @var{(1;1)}. This creates a straight line where each original pixel value is
  5750. "adjusted" to its own value, which means no change to the image.
  5751. The filter allows you to redefine these two points and add some more. A new
  5752. curve (using a natural cubic spline interpolation) will be define to pass
  5753. smoothly through all these new coordinates. The new defined points needs to be
  5754. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5755. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5756. the vector spaces, the values will be clipped accordingly.
  5757. The filter accepts the following options:
  5758. @table @option
  5759. @item preset
  5760. Select one of the available color presets. This option can be used in addition
  5761. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5762. options takes priority on the preset values.
  5763. Available presets are:
  5764. @table @samp
  5765. @item none
  5766. @item color_negative
  5767. @item cross_process
  5768. @item darker
  5769. @item increase_contrast
  5770. @item lighter
  5771. @item linear_contrast
  5772. @item medium_contrast
  5773. @item negative
  5774. @item strong_contrast
  5775. @item vintage
  5776. @end table
  5777. Default is @code{none}.
  5778. @item master, m
  5779. Set the master key points. These points will define a second pass mapping. It
  5780. is sometimes called a "luminance" or "value" mapping. It can be used with
  5781. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5782. post-processing LUT.
  5783. @item red, r
  5784. Set the key points for the red component.
  5785. @item green, g
  5786. Set the key points for the green component.
  5787. @item blue, b
  5788. Set the key points for the blue component.
  5789. @item all
  5790. Set the key points for all components (not including master).
  5791. Can be used in addition to the other key points component
  5792. options. In this case, the unset component(s) will fallback on this
  5793. @option{all} setting.
  5794. @item psfile
  5795. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5796. @item plot
  5797. Save Gnuplot script of the curves in specified file.
  5798. @end table
  5799. To avoid some filtergraph syntax conflicts, each key points list need to be
  5800. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5801. @subsection Examples
  5802. @itemize
  5803. @item
  5804. Increase slightly the middle level of blue:
  5805. @example
  5806. curves=blue='0/0 0.5/0.58 1/1'
  5807. @end example
  5808. @item
  5809. Vintage effect:
  5810. @example
  5811. 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'
  5812. @end example
  5813. Here we obtain the following coordinates for each components:
  5814. @table @var
  5815. @item red
  5816. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5817. @item green
  5818. @code{(0;0) (0.50;0.48) (1;1)}
  5819. @item blue
  5820. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5821. @end table
  5822. @item
  5823. The previous example can also be achieved with the associated built-in preset:
  5824. @example
  5825. curves=preset=vintage
  5826. @end example
  5827. @item
  5828. Or simply:
  5829. @example
  5830. curves=vintage
  5831. @end example
  5832. @item
  5833. Use a Photoshop preset and redefine the points of the green component:
  5834. @example
  5835. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5836. @end example
  5837. @item
  5838. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5839. and @command{gnuplot}:
  5840. @example
  5841. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5842. gnuplot -p /tmp/curves.plt
  5843. @end example
  5844. @end itemize
  5845. @section datascope
  5846. Video data analysis filter.
  5847. This filter shows hexadecimal pixel values of part of video.
  5848. The filter accepts the following options:
  5849. @table @option
  5850. @item size, s
  5851. Set output video size.
  5852. @item x
  5853. Set x offset from where to pick pixels.
  5854. @item y
  5855. Set y offset from where to pick pixels.
  5856. @item mode
  5857. Set scope mode, can be one of the following:
  5858. @table @samp
  5859. @item mono
  5860. Draw hexadecimal pixel values with white color on black background.
  5861. @item color
  5862. Draw hexadecimal pixel values with input video pixel color on black
  5863. background.
  5864. @item color2
  5865. Draw hexadecimal pixel values on color background picked from input video,
  5866. the text color is picked in such way so its always visible.
  5867. @end table
  5868. @item axis
  5869. Draw rows and columns numbers on left and top of video.
  5870. @item opacity
  5871. Set background opacity.
  5872. @end table
  5873. @section dctdnoiz
  5874. Denoise frames using 2D DCT (frequency domain filtering).
  5875. This filter is not designed for real time.
  5876. The filter accepts the following options:
  5877. @table @option
  5878. @item sigma, s
  5879. Set the noise sigma constant.
  5880. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5881. coefficient (absolute value) below this threshold with be dropped.
  5882. If you need a more advanced filtering, see @option{expr}.
  5883. Default is @code{0}.
  5884. @item overlap
  5885. Set number overlapping pixels for each block. Since the filter can be slow, you
  5886. may want to reduce this value, at the cost of a less effective filter and the
  5887. risk of various artefacts.
  5888. If the overlapping value doesn't permit processing the whole input width or
  5889. height, a warning will be displayed and according borders won't be denoised.
  5890. Default value is @var{blocksize}-1, which is the best possible setting.
  5891. @item expr, e
  5892. Set the coefficient factor expression.
  5893. For each coefficient of a DCT block, this expression will be evaluated as a
  5894. multiplier value for the coefficient.
  5895. If this is option is set, the @option{sigma} option will be ignored.
  5896. The absolute value of the coefficient can be accessed through the @var{c}
  5897. variable.
  5898. @item n
  5899. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5900. @var{blocksize}, which is the width and height of the processed blocks.
  5901. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5902. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5903. on the speed processing. Also, a larger block size does not necessarily means a
  5904. better de-noising.
  5905. @end table
  5906. @subsection Examples
  5907. Apply a denoise with a @option{sigma} of @code{4.5}:
  5908. @example
  5909. dctdnoiz=4.5
  5910. @end example
  5911. The same operation can be achieved using the expression system:
  5912. @example
  5913. dctdnoiz=e='gte(c, 4.5*3)'
  5914. @end example
  5915. Violent denoise using a block size of @code{16x16}:
  5916. @example
  5917. dctdnoiz=15:n=4
  5918. @end example
  5919. @section deband
  5920. Remove banding artifacts from input video.
  5921. It works by replacing banded pixels with average value of referenced pixels.
  5922. The filter accepts the following options:
  5923. @table @option
  5924. @item 1thr
  5925. @item 2thr
  5926. @item 3thr
  5927. @item 4thr
  5928. Set banding detection threshold for each plane. Default is 0.02.
  5929. Valid range is 0.00003 to 0.5.
  5930. If difference between current pixel and reference pixel is less than threshold,
  5931. it will be considered as banded.
  5932. @item range, r
  5933. Banding detection range in pixels. Default is 16. If positive, random number
  5934. in range 0 to set value will be used. If negative, exact absolute value
  5935. will be used.
  5936. The range defines square of four pixels around current pixel.
  5937. @item direction, d
  5938. Set direction in radians from which four pixel will be compared. If positive,
  5939. random direction from 0 to set direction will be picked. If negative, exact of
  5940. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5941. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5942. column.
  5943. @item blur, b
  5944. If enabled, current pixel is compared with average value of all four
  5945. surrounding pixels. The default is enabled. If disabled current pixel is
  5946. compared with all four surrounding pixels. The pixel is considered banded
  5947. if only all four differences with surrounding pixels are less than threshold.
  5948. @item coupling, c
  5949. If enabled, current pixel is changed if and only if all pixel components are banded,
  5950. e.g. banding detection threshold is triggered for all color components.
  5951. The default is disabled.
  5952. @end table
  5953. @section deblock
  5954. Remove blocking artifacts from input video.
  5955. The filter accepts the following options:
  5956. @table @option
  5957. @item filter
  5958. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5959. This controls what kind of deblocking is applied.
  5960. @item block
  5961. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5962. @item alpha
  5963. @item beta
  5964. @item gamma
  5965. @item delta
  5966. Set blocking detection thresholds. Allowed range is 0 to 1.
  5967. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5968. Using higher threshold gives more deblocking strength.
  5969. Setting @var{alpha} controls threshold detection at exact edge of block.
  5970. Remaining options controls threshold detection near the edge. Each one for
  5971. below/above or left/right. Setting any of those to @var{0} disables
  5972. deblocking.
  5973. @item planes
  5974. Set planes to filter. Default is to filter all available planes.
  5975. @end table
  5976. @subsection Examples
  5977. @itemize
  5978. @item
  5979. Deblock using weak filter and block size of 4 pixels.
  5980. @example
  5981. deblock=filter=weak:block=4
  5982. @end example
  5983. @item
  5984. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5985. deblocking more edges.
  5986. @example
  5987. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5988. @end example
  5989. @item
  5990. Similar as above, but filter only first plane.
  5991. @example
  5992. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5993. @end example
  5994. @item
  5995. Similar as above, but filter only second and third plane.
  5996. @example
  5997. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5998. @end example
  5999. @end itemize
  6000. @anchor{decimate}
  6001. @section decimate
  6002. Drop duplicated frames at regular intervals.
  6003. The filter accepts the following options:
  6004. @table @option
  6005. @item cycle
  6006. Set the number of frames from which one will be dropped. Setting this to
  6007. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6008. Default is @code{5}.
  6009. @item dupthresh
  6010. Set the threshold for duplicate detection. If the difference metric for a frame
  6011. is less than or equal to this value, then it is declared as duplicate. Default
  6012. is @code{1.1}
  6013. @item scthresh
  6014. Set scene change threshold. Default is @code{15}.
  6015. @item blockx
  6016. @item blocky
  6017. Set the size of the x and y-axis blocks used during metric calculations.
  6018. Larger blocks give better noise suppression, but also give worse detection of
  6019. small movements. Must be a power of two. Default is @code{32}.
  6020. @item ppsrc
  6021. Mark main input as a pre-processed input and activate clean source input
  6022. stream. This allows the input to be pre-processed with various filters to help
  6023. the metrics calculation while keeping the frame selection lossless. When set to
  6024. @code{1}, the first stream is for the pre-processed input, and the second
  6025. stream is the clean source from where the kept frames are chosen. Default is
  6026. @code{0}.
  6027. @item chroma
  6028. Set whether or not chroma is considered in the metric calculations. Default is
  6029. @code{1}.
  6030. @end table
  6031. @section deconvolve
  6032. Apply 2D deconvolution of video stream in frequency domain using second stream
  6033. as impulse.
  6034. The filter accepts the following options:
  6035. @table @option
  6036. @item planes
  6037. Set which planes to process.
  6038. @item impulse
  6039. Set which impulse video frames will be processed, can be @var{first}
  6040. or @var{all}. Default is @var{all}.
  6041. @item noise
  6042. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6043. and height are not same and not power of 2 or if stream prior to convolving
  6044. had noise.
  6045. @end table
  6046. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6047. @section dedot
  6048. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6049. It accepts the following options:
  6050. @table @option
  6051. @item m
  6052. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6053. @var{rainbows} for cross-color reduction.
  6054. @item lt
  6055. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6056. @item tl
  6057. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6058. @item tc
  6059. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6060. @item ct
  6061. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6062. @end table
  6063. @section deflate
  6064. Apply deflate effect to the video.
  6065. This filter replaces the pixel by the local(3x3) average by taking into account
  6066. only values lower than the pixel.
  6067. It accepts the following options:
  6068. @table @option
  6069. @item threshold0
  6070. @item threshold1
  6071. @item threshold2
  6072. @item threshold3
  6073. Limit the maximum change for each plane, default is 65535.
  6074. If 0, plane will remain unchanged.
  6075. @end table
  6076. @section deflicker
  6077. Remove temporal frame luminance variations.
  6078. It accepts the following options:
  6079. @table @option
  6080. @item size, s
  6081. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6082. @item mode, m
  6083. Set averaging mode to smooth temporal luminance variations.
  6084. Available values are:
  6085. @table @samp
  6086. @item am
  6087. Arithmetic mean
  6088. @item gm
  6089. Geometric mean
  6090. @item hm
  6091. Harmonic mean
  6092. @item qm
  6093. Quadratic mean
  6094. @item cm
  6095. Cubic mean
  6096. @item pm
  6097. Power mean
  6098. @item median
  6099. Median
  6100. @end table
  6101. @item bypass
  6102. Do not actually modify frame. Useful when one only wants metadata.
  6103. @end table
  6104. @section dejudder
  6105. Remove judder produced by partially interlaced telecined content.
  6106. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6107. source was partially telecined content then the output of @code{pullup,dejudder}
  6108. will have a variable frame rate. May change the recorded frame rate of the
  6109. container. Aside from that change, this filter will not affect constant frame
  6110. rate video.
  6111. The option available in this filter is:
  6112. @table @option
  6113. @item cycle
  6114. Specify the length of the window over which the judder repeats.
  6115. Accepts any integer greater than 1. Useful values are:
  6116. @table @samp
  6117. @item 4
  6118. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6119. @item 5
  6120. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6121. @item 20
  6122. If a mixture of the two.
  6123. @end table
  6124. The default is @samp{4}.
  6125. @end table
  6126. @section delogo
  6127. Suppress a TV station logo by a simple interpolation of the surrounding
  6128. pixels. Just set a rectangle covering the logo and watch it disappear
  6129. (and sometimes something even uglier appear - your mileage may vary).
  6130. It accepts the following parameters:
  6131. @table @option
  6132. @item x
  6133. @item y
  6134. Specify the top left corner coordinates of the logo. They must be
  6135. specified.
  6136. @item w
  6137. @item h
  6138. Specify the width and height of the logo to clear. They must be
  6139. specified.
  6140. @item band, t
  6141. Specify the thickness of the fuzzy edge of the rectangle (added to
  6142. @var{w} and @var{h}). The default value is 1. This option is
  6143. deprecated, setting higher values should no longer be necessary and
  6144. is not recommended.
  6145. @item show
  6146. When set to 1, a green rectangle is drawn on the screen to simplify
  6147. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6148. The default value is 0.
  6149. The rectangle is drawn on the outermost pixels which will be (partly)
  6150. replaced with interpolated values. The values of the next pixels
  6151. immediately outside this rectangle in each direction will be used to
  6152. compute the interpolated pixel values inside the rectangle.
  6153. @end table
  6154. @subsection Examples
  6155. @itemize
  6156. @item
  6157. Set a rectangle covering the area with top left corner coordinates 0,0
  6158. and size 100x77, and a band of size 10:
  6159. @example
  6160. delogo=x=0:y=0:w=100:h=77:band=10
  6161. @end example
  6162. @end itemize
  6163. @section deshake
  6164. Attempt to fix small changes in horizontal and/or vertical shift. This
  6165. filter helps remove camera shake from hand-holding a camera, bumping a
  6166. tripod, moving on a vehicle, etc.
  6167. The filter accepts the following options:
  6168. @table @option
  6169. @item x
  6170. @item y
  6171. @item w
  6172. @item h
  6173. Specify a rectangular area where to limit the search for motion
  6174. vectors.
  6175. If desired the search for motion vectors can be limited to a
  6176. rectangular area of the frame defined by its top left corner, width
  6177. and height. These parameters have the same meaning as the drawbox
  6178. filter which can be used to visualise the position of the bounding
  6179. box.
  6180. This is useful when simultaneous movement of subjects within the frame
  6181. might be confused for camera motion by the motion vector search.
  6182. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6183. then the full frame is used. This allows later options to be set
  6184. without specifying the bounding box for the motion vector search.
  6185. Default - search the whole frame.
  6186. @item rx
  6187. @item ry
  6188. Specify the maximum extent of movement in x and y directions in the
  6189. range 0-64 pixels. Default 16.
  6190. @item edge
  6191. Specify how to generate pixels to fill blanks at the edge of the
  6192. frame. Available values are:
  6193. @table @samp
  6194. @item blank, 0
  6195. Fill zeroes at blank locations
  6196. @item original, 1
  6197. Original image at blank locations
  6198. @item clamp, 2
  6199. Extruded edge value at blank locations
  6200. @item mirror, 3
  6201. Mirrored edge at blank locations
  6202. @end table
  6203. Default value is @samp{mirror}.
  6204. @item blocksize
  6205. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6206. default 8.
  6207. @item contrast
  6208. Specify the contrast threshold for blocks. Only blocks with more than
  6209. the specified contrast (difference between darkest and lightest
  6210. pixels) will be considered. Range 1-255, default 125.
  6211. @item search
  6212. Specify the search strategy. Available values are:
  6213. @table @samp
  6214. @item exhaustive, 0
  6215. Set exhaustive search
  6216. @item less, 1
  6217. Set less exhaustive search.
  6218. @end table
  6219. Default value is @samp{exhaustive}.
  6220. @item filename
  6221. If set then a detailed log of the motion search is written to the
  6222. specified file.
  6223. @end table
  6224. @section despill
  6225. Remove unwanted contamination of foreground colors, caused by reflected color of
  6226. greenscreen or bluescreen.
  6227. This filter accepts the following options:
  6228. @table @option
  6229. @item type
  6230. Set what type of despill to use.
  6231. @item mix
  6232. Set how spillmap will be generated.
  6233. @item expand
  6234. Set how much to get rid of still remaining spill.
  6235. @item red
  6236. Controls amount of red in spill area.
  6237. @item green
  6238. Controls amount of green in spill area.
  6239. Should be -1 for greenscreen.
  6240. @item blue
  6241. Controls amount of blue in spill area.
  6242. Should be -1 for bluescreen.
  6243. @item brightness
  6244. Controls brightness of spill area, preserving colors.
  6245. @item alpha
  6246. Modify alpha from generated spillmap.
  6247. @end table
  6248. @section detelecine
  6249. Apply an exact inverse of the telecine operation. It requires a predefined
  6250. pattern specified using the pattern option which must be the same as that passed
  6251. to the telecine filter.
  6252. This filter accepts the following options:
  6253. @table @option
  6254. @item first_field
  6255. @table @samp
  6256. @item top, t
  6257. top field first
  6258. @item bottom, b
  6259. bottom field first
  6260. The default value is @code{top}.
  6261. @end table
  6262. @item pattern
  6263. A string of numbers representing the pulldown pattern you wish to apply.
  6264. The default value is @code{23}.
  6265. @item start_frame
  6266. A number representing position of the first frame with respect to the telecine
  6267. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6268. @end table
  6269. @section dilation
  6270. Apply dilation effect to the video.
  6271. This filter replaces the pixel by the local(3x3) maximum.
  6272. It accepts the following options:
  6273. @table @option
  6274. @item threshold0
  6275. @item threshold1
  6276. @item threshold2
  6277. @item threshold3
  6278. Limit the maximum change for each plane, default is 65535.
  6279. If 0, plane will remain unchanged.
  6280. @item coordinates
  6281. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6282. pixels are used.
  6283. Flags to local 3x3 coordinates maps like this:
  6284. 1 2 3
  6285. 4 5
  6286. 6 7 8
  6287. @end table
  6288. @section displace
  6289. Displace pixels as indicated by second and third input stream.
  6290. It takes three input streams and outputs one stream, the first input is the
  6291. source, and second and third input are displacement maps.
  6292. The second input specifies how much to displace pixels along the
  6293. x-axis, while the third input specifies how much to displace pixels
  6294. along the y-axis.
  6295. If one of displacement map streams terminates, last frame from that
  6296. displacement map will be used.
  6297. Note that once generated, displacements maps can be reused over and over again.
  6298. A description of the accepted options follows.
  6299. @table @option
  6300. @item edge
  6301. Set displace behavior for pixels that are out of range.
  6302. Available values are:
  6303. @table @samp
  6304. @item blank
  6305. Missing pixels are replaced by black pixels.
  6306. @item smear
  6307. Adjacent pixels will spread out to replace missing pixels.
  6308. @item wrap
  6309. Out of range pixels are wrapped so they point to pixels of other side.
  6310. @item mirror
  6311. Out of range pixels will be replaced with mirrored pixels.
  6312. @end table
  6313. Default is @samp{smear}.
  6314. @end table
  6315. @subsection Examples
  6316. @itemize
  6317. @item
  6318. Add ripple effect to rgb input of video size hd720:
  6319. @example
  6320. 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
  6321. @end example
  6322. @item
  6323. Add wave effect to rgb input of video size hd720:
  6324. @example
  6325. 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
  6326. @end example
  6327. @end itemize
  6328. @section drawbox
  6329. Draw a colored box on the input image.
  6330. It accepts the following parameters:
  6331. @table @option
  6332. @item x
  6333. @item y
  6334. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6335. @item width, w
  6336. @item height, h
  6337. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6338. the input width and height. It defaults to 0.
  6339. @item color, c
  6340. Specify the color of the box to write. For the general syntax of this option,
  6341. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6342. value @code{invert} is used, the box edge color is the same as the
  6343. video with inverted luma.
  6344. @item thickness, t
  6345. The expression which sets the thickness of the box edge.
  6346. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6347. See below for the list of accepted constants.
  6348. @item replace
  6349. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6350. will overwrite the video's color and alpha pixels.
  6351. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6352. @end table
  6353. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6354. following constants:
  6355. @table @option
  6356. @item dar
  6357. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6358. @item hsub
  6359. @item vsub
  6360. horizontal and vertical chroma subsample values. For example for the
  6361. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6362. @item in_h, ih
  6363. @item in_w, iw
  6364. The input width and height.
  6365. @item sar
  6366. The input sample aspect ratio.
  6367. @item x
  6368. @item y
  6369. The x and y offset coordinates where the box is drawn.
  6370. @item w
  6371. @item h
  6372. The width and height of the drawn box.
  6373. @item t
  6374. The thickness of the drawn box.
  6375. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6376. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6377. @end table
  6378. @subsection Examples
  6379. @itemize
  6380. @item
  6381. Draw a black box around the edge of the input image:
  6382. @example
  6383. drawbox
  6384. @end example
  6385. @item
  6386. Draw a box with color red and an opacity of 50%:
  6387. @example
  6388. drawbox=10:20:200:60:red@@0.5
  6389. @end example
  6390. The previous example can be specified as:
  6391. @example
  6392. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6393. @end example
  6394. @item
  6395. Fill the box with pink color:
  6396. @example
  6397. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6398. @end example
  6399. @item
  6400. Draw a 2-pixel red 2.40:1 mask:
  6401. @example
  6402. 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
  6403. @end example
  6404. @end itemize
  6405. @section drawgrid
  6406. Draw a grid on the input image.
  6407. It accepts the following parameters:
  6408. @table @option
  6409. @item x
  6410. @item y
  6411. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6412. @item width, w
  6413. @item height, h
  6414. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6415. input width and height, respectively, minus @code{thickness}, so image gets
  6416. framed. Default to 0.
  6417. @item color, c
  6418. Specify the color of the grid. For the general syntax of this option,
  6419. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6420. value @code{invert} is used, the grid color is the same as the
  6421. video with inverted luma.
  6422. @item thickness, t
  6423. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6424. See below for the list of accepted constants.
  6425. @item replace
  6426. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6427. will overwrite the video's color and alpha pixels.
  6428. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6429. @end table
  6430. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6431. following constants:
  6432. @table @option
  6433. @item dar
  6434. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6435. @item hsub
  6436. @item vsub
  6437. horizontal and vertical chroma subsample values. For example for the
  6438. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6439. @item in_h, ih
  6440. @item in_w, iw
  6441. The input grid cell width and height.
  6442. @item sar
  6443. The input sample aspect ratio.
  6444. @item x
  6445. @item y
  6446. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6447. @item w
  6448. @item h
  6449. The width and height of the drawn cell.
  6450. @item t
  6451. The thickness of the drawn cell.
  6452. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6453. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6454. @end table
  6455. @subsection Examples
  6456. @itemize
  6457. @item
  6458. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6459. @example
  6460. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6461. @end example
  6462. @item
  6463. Draw a white 3x3 grid with an opacity of 50%:
  6464. @example
  6465. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6466. @end example
  6467. @end itemize
  6468. @anchor{drawtext}
  6469. @section drawtext
  6470. Draw a text string or text from a specified file on top of a video, using the
  6471. libfreetype library.
  6472. To enable compilation of this filter, you need to configure FFmpeg with
  6473. @code{--enable-libfreetype}.
  6474. To enable default font fallback and the @var{font} option you need to
  6475. configure FFmpeg with @code{--enable-libfontconfig}.
  6476. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6477. @code{--enable-libfribidi}.
  6478. @subsection Syntax
  6479. It accepts the following parameters:
  6480. @table @option
  6481. @item box
  6482. Used to draw a box around text using the background color.
  6483. The value must be either 1 (enable) or 0 (disable).
  6484. The default value of @var{box} is 0.
  6485. @item boxborderw
  6486. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6487. The default value of @var{boxborderw} is 0.
  6488. @item boxcolor
  6489. The color to be used for drawing box around text. For the syntax of this
  6490. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6491. The default value of @var{boxcolor} is "white".
  6492. @item line_spacing
  6493. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6494. The default value of @var{line_spacing} is 0.
  6495. @item borderw
  6496. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6497. The default value of @var{borderw} is 0.
  6498. @item bordercolor
  6499. Set the color to be used for drawing border around text. For the syntax of this
  6500. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6501. The default value of @var{bordercolor} is "black".
  6502. @item expansion
  6503. Select how the @var{text} is expanded. Can be either @code{none},
  6504. @code{strftime} (deprecated) or
  6505. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6506. below for details.
  6507. @item basetime
  6508. Set a start time for the count. Value is in microseconds. Only applied
  6509. in the deprecated strftime expansion mode. To emulate in normal expansion
  6510. mode use the @code{pts} function, supplying the start time (in seconds)
  6511. as the second argument.
  6512. @item fix_bounds
  6513. If true, check and fix text coords to avoid clipping.
  6514. @item fontcolor
  6515. The color to be used for drawing fonts. For the syntax of this option, check
  6516. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6517. The default value of @var{fontcolor} is "black".
  6518. @item fontcolor_expr
  6519. String which is expanded the same way as @var{text} to obtain dynamic
  6520. @var{fontcolor} value. By default this option has empty value and is not
  6521. processed. When this option is set, it overrides @var{fontcolor} option.
  6522. @item font
  6523. The font family to be used for drawing text. By default Sans.
  6524. @item fontfile
  6525. The font file to be used for drawing text. The path must be included.
  6526. This parameter is mandatory if the fontconfig support is disabled.
  6527. @item alpha
  6528. Draw the text applying alpha blending. The value can
  6529. be a number between 0.0 and 1.0.
  6530. The expression accepts the same variables @var{x, y} as well.
  6531. The default value is 1.
  6532. Please see @var{fontcolor_expr}.
  6533. @item fontsize
  6534. The font size to be used for drawing text.
  6535. The default value of @var{fontsize} is 16.
  6536. @item text_shaping
  6537. If set to 1, attempt to shape the text (for example, reverse the order of
  6538. right-to-left text and join Arabic characters) before drawing it.
  6539. Otherwise, just draw the text exactly as given.
  6540. By default 1 (if supported).
  6541. @item ft_load_flags
  6542. The flags to be used for loading the fonts.
  6543. The flags map the corresponding flags supported by libfreetype, and are
  6544. a combination of the following values:
  6545. @table @var
  6546. @item default
  6547. @item no_scale
  6548. @item no_hinting
  6549. @item render
  6550. @item no_bitmap
  6551. @item vertical_layout
  6552. @item force_autohint
  6553. @item crop_bitmap
  6554. @item pedantic
  6555. @item ignore_global_advance_width
  6556. @item no_recurse
  6557. @item ignore_transform
  6558. @item monochrome
  6559. @item linear_design
  6560. @item no_autohint
  6561. @end table
  6562. Default value is "default".
  6563. For more information consult the documentation for the FT_LOAD_*
  6564. libfreetype flags.
  6565. @item shadowcolor
  6566. The color to be used for drawing a shadow behind the drawn text. For the
  6567. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6568. ffmpeg-utils manual,ffmpeg-utils}.
  6569. The default value of @var{shadowcolor} is "black".
  6570. @item shadowx
  6571. @item shadowy
  6572. The x and y offsets for the text shadow position with respect to the
  6573. position of the text. They can be either positive or negative
  6574. values. The default value for both is "0".
  6575. @item start_number
  6576. The starting frame number for the n/frame_num variable. The default value
  6577. is "0".
  6578. @item tabsize
  6579. The size in number of spaces to use for rendering the tab.
  6580. Default value is 4.
  6581. @item timecode
  6582. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6583. format. It can be used with or without text parameter. @var{timecode_rate}
  6584. option must be specified.
  6585. @item timecode_rate, rate, r
  6586. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6587. integer. Minimum value is "1".
  6588. Drop-frame timecode is supported for frame rates 30 & 60.
  6589. @item tc24hmax
  6590. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6591. Default is 0 (disabled).
  6592. @item text
  6593. The text string to be drawn. The text must be a sequence of UTF-8
  6594. encoded characters.
  6595. This parameter is mandatory if no file is specified with the parameter
  6596. @var{textfile}.
  6597. @item textfile
  6598. A text file containing text to be drawn. The text must be a sequence
  6599. of UTF-8 encoded characters.
  6600. This parameter is mandatory if no text string is specified with the
  6601. parameter @var{text}.
  6602. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6603. @item reload
  6604. If set to 1, the @var{textfile} will be reloaded before each frame.
  6605. Be sure to update it atomically, or it may be read partially, or even fail.
  6606. @item x
  6607. @item y
  6608. The expressions which specify the offsets where text will be drawn
  6609. within the video frame. They are relative to the top/left border of the
  6610. output image.
  6611. The default value of @var{x} and @var{y} is "0".
  6612. See below for the list of accepted constants and functions.
  6613. @end table
  6614. The parameters for @var{x} and @var{y} are expressions containing the
  6615. following constants and functions:
  6616. @table @option
  6617. @item dar
  6618. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6619. @item hsub
  6620. @item vsub
  6621. horizontal and vertical chroma subsample values. For example for the
  6622. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6623. @item line_h, lh
  6624. the height of each text line
  6625. @item main_h, h, H
  6626. the input height
  6627. @item main_w, w, W
  6628. the input width
  6629. @item max_glyph_a, ascent
  6630. the maximum distance from the baseline to the highest/upper grid
  6631. coordinate used to place a glyph outline point, for all the rendered
  6632. glyphs.
  6633. It is a positive value, due to the grid's orientation with the Y axis
  6634. upwards.
  6635. @item max_glyph_d, descent
  6636. the maximum distance from the baseline to the lowest grid coordinate
  6637. used to place a glyph outline point, for all the rendered glyphs.
  6638. This is a negative value, due to the grid's orientation, with the Y axis
  6639. upwards.
  6640. @item max_glyph_h
  6641. maximum glyph height, that is the maximum height for all the glyphs
  6642. contained in the rendered text, it is equivalent to @var{ascent} -
  6643. @var{descent}.
  6644. @item max_glyph_w
  6645. maximum glyph width, that is the maximum width for all the glyphs
  6646. contained in the rendered text
  6647. @item n
  6648. the number of input frame, starting from 0
  6649. @item rand(min, max)
  6650. return a random number included between @var{min} and @var{max}
  6651. @item sar
  6652. The input sample aspect ratio.
  6653. @item t
  6654. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6655. @item text_h, th
  6656. the height of the rendered text
  6657. @item text_w, tw
  6658. the width of the rendered text
  6659. @item x
  6660. @item y
  6661. the x and y offset coordinates where the text is drawn.
  6662. These parameters allow the @var{x} and @var{y} expressions to refer
  6663. each other, so you can for example specify @code{y=x/dar}.
  6664. @end table
  6665. @anchor{drawtext_expansion}
  6666. @subsection Text expansion
  6667. If @option{expansion} is set to @code{strftime},
  6668. the filter recognizes strftime() sequences in the provided text and
  6669. expands them accordingly. Check the documentation of strftime(). This
  6670. feature is deprecated.
  6671. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6672. If @option{expansion} is set to @code{normal} (which is the default),
  6673. the following expansion mechanism is used.
  6674. The backslash character @samp{\}, followed by any character, always expands to
  6675. the second character.
  6676. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6677. braces is a function name, possibly followed by arguments separated by ':'.
  6678. If the arguments contain special characters or delimiters (':' or '@}'),
  6679. they should be escaped.
  6680. Note that they probably must also be escaped as the value for the
  6681. @option{text} option in the filter argument string and as the filter
  6682. argument in the filtergraph description, and possibly also for the shell,
  6683. that makes up to four levels of escaping; using a text file avoids these
  6684. problems.
  6685. The following functions are available:
  6686. @table @command
  6687. @item expr, e
  6688. The expression evaluation result.
  6689. It must take one argument specifying the expression to be evaluated,
  6690. which accepts the same constants and functions as the @var{x} and
  6691. @var{y} values. Note that not all constants should be used, for
  6692. example the text size is not known when evaluating the expression, so
  6693. the constants @var{text_w} and @var{text_h} will have an undefined
  6694. value.
  6695. @item expr_int_format, eif
  6696. Evaluate the expression's value and output as formatted integer.
  6697. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6698. The second argument specifies the output format. Allowed values are @samp{x},
  6699. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6700. @code{printf} function.
  6701. The third parameter is optional and sets the number of positions taken by the output.
  6702. It can be used to add padding with zeros from the left.
  6703. @item gmtime
  6704. The time at which the filter is running, expressed in UTC.
  6705. It can accept an argument: a strftime() format string.
  6706. @item localtime
  6707. The time at which the filter is running, expressed in the local time zone.
  6708. It can accept an argument: a strftime() format string.
  6709. @item metadata
  6710. Frame metadata. Takes one or two arguments.
  6711. The first argument is mandatory and specifies the metadata key.
  6712. The second argument is optional and specifies a default value, used when the
  6713. metadata key is not found or empty.
  6714. @item n, frame_num
  6715. The frame number, starting from 0.
  6716. @item pict_type
  6717. A 1 character description of the current picture type.
  6718. @item pts
  6719. The timestamp of the current frame.
  6720. It can take up to three arguments.
  6721. The first argument is the format of the timestamp; it defaults to @code{flt}
  6722. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6723. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6724. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6725. @code{localtime} stands for the timestamp of the frame formatted as
  6726. local time zone time.
  6727. The second argument is an offset added to the timestamp.
  6728. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6729. supplied to present the hour part of the formatted timestamp in 24h format
  6730. (00-23).
  6731. If the format is set to @code{localtime} or @code{gmtime},
  6732. a third argument may be supplied: a strftime() format string.
  6733. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6734. @end table
  6735. @subsection Examples
  6736. @itemize
  6737. @item
  6738. Draw "Test Text" with font FreeSerif, using the default values for the
  6739. optional parameters.
  6740. @example
  6741. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6742. @end example
  6743. @item
  6744. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6745. and y=50 (counting from the top-left corner of the screen), text is
  6746. yellow with a red box around it. Both the text and the box have an
  6747. opacity of 20%.
  6748. @example
  6749. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6750. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6751. @end example
  6752. Note that the double quotes are not necessary if spaces are not used
  6753. within the parameter list.
  6754. @item
  6755. Show the text at the center of the video frame:
  6756. @example
  6757. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6758. @end example
  6759. @item
  6760. Show the text at a random position, switching to a new position every 30 seconds:
  6761. @example
  6762. 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)"
  6763. @end example
  6764. @item
  6765. Show a text line sliding from right to left in the last row of the video
  6766. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6767. with no newlines.
  6768. @example
  6769. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6770. @end example
  6771. @item
  6772. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6773. @example
  6774. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6775. @end example
  6776. @item
  6777. Draw a single green letter "g", at the center of the input video.
  6778. The glyph baseline is placed at half screen height.
  6779. @example
  6780. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6781. @end example
  6782. @item
  6783. Show text for 1 second every 3 seconds:
  6784. @example
  6785. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6786. @end example
  6787. @item
  6788. Use fontconfig to set the font. Note that the colons need to be escaped.
  6789. @example
  6790. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6791. @end example
  6792. @item
  6793. Print the date of a real-time encoding (see strftime(3)):
  6794. @example
  6795. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6796. @end example
  6797. @item
  6798. Show text fading in and out (appearing/disappearing):
  6799. @example
  6800. #!/bin/sh
  6801. DS=1.0 # display start
  6802. DE=10.0 # display end
  6803. FID=1.5 # fade in duration
  6804. FOD=5 # fade out duration
  6805. 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 @}"
  6806. @end example
  6807. @item
  6808. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6809. and the @option{fontsize} value are included in the @option{y} offset.
  6810. @example
  6811. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6812. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6813. @end example
  6814. @end itemize
  6815. For more information about libfreetype, check:
  6816. @url{http://www.freetype.org/}.
  6817. For more information about fontconfig, check:
  6818. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6819. For more information about libfribidi, check:
  6820. @url{http://fribidi.org/}.
  6821. @section edgedetect
  6822. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6823. The filter accepts the following options:
  6824. @table @option
  6825. @item low
  6826. @item high
  6827. Set low and high threshold values used by the Canny thresholding
  6828. algorithm.
  6829. The high threshold selects the "strong" edge pixels, which are then
  6830. connected through 8-connectivity with the "weak" edge pixels selected
  6831. by the low threshold.
  6832. @var{low} and @var{high} threshold values must be chosen in the range
  6833. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6834. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6835. is @code{50/255}.
  6836. @item mode
  6837. Define the drawing mode.
  6838. @table @samp
  6839. @item wires
  6840. Draw white/gray wires on black background.
  6841. @item colormix
  6842. Mix the colors to create a paint/cartoon effect.
  6843. @item canny
  6844. Apply Canny edge detector on all selected planes.
  6845. @end table
  6846. Default value is @var{wires}.
  6847. @item planes
  6848. Select planes for filtering. By default all available planes are filtered.
  6849. @end table
  6850. @subsection Examples
  6851. @itemize
  6852. @item
  6853. Standard edge detection with custom values for the hysteresis thresholding:
  6854. @example
  6855. edgedetect=low=0.1:high=0.4
  6856. @end example
  6857. @item
  6858. Painting effect without thresholding:
  6859. @example
  6860. edgedetect=mode=colormix:high=0
  6861. @end example
  6862. @end itemize
  6863. @section eq
  6864. Set brightness, contrast, saturation and approximate gamma adjustment.
  6865. The filter accepts the following options:
  6866. @table @option
  6867. @item contrast
  6868. Set the contrast expression. The value must be a float value in range
  6869. @code{-2.0} to @code{2.0}. The default value is "1".
  6870. @item brightness
  6871. Set the brightness expression. The value must be a float value in
  6872. range @code{-1.0} to @code{1.0}. The default value is "0".
  6873. @item saturation
  6874. Set the saturation expression. The value must be a float in
  6875. range @code{0.0} to @code{3.0}. The default value is "1".
  6876. @item gamma
  6877. Set the gamma expression. The value must be a float in range
  6878. @code{0.1} to @code{10.0}. The default value is "1".
  6879. @item gamma_r
  6880. Set the gamma expression for red. The value must be a float in
  6881. range @code{0.1} to @code{10.0}. The default value is "1".
  6882. @item gamma_g
  6883. Set the gamma expression for green. The value must be a float in range
  6884. @code{0.1} to @code{10.0}. The default value is "1".
  6885. @item gamma_b
  6886. Set the gamma expression for blue. The value must be a float in range
  6887. @code{0.1} to @code{10.0}. The default value is "1".
  6888. @item gamma_weight
  6889. Set the gamma weight expression. It can be used to reduce the effect
  6890. of a high gamma value on bright image areas, e.g. keep them from
  6891. getting overamplified and just plain white. The value must be a float
  6892. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6893. gamma correction all the way down while @code{1.0} leaves it at its
  6894. full strength. Default is "1".
  6895. @item eval
  6896. Set when the expressions for brightness, contrast, saturation and
  6897. gamma expressions are evaluated.
  6898. It accepts the following values:
  6899. @table @samp
  6900. @item init
  6901. only evaluate expressions once during the filter initialization or
  6902. when a command is processed
  6903. @item frame
  6904. evaluate expressions for each incoming frame
  6905. @end table
  6906. Default value is @samp{init}.
  6907. @end table
  6908. The expressions accept the following parameters:
  6909. @table @option
  6910. @item n
  6911. frame count of the input frame starting from 0
  6912. @item pos
  6913. byte position of the corresponding packet in the input file, NAN if
  6914. unspecified
  6915. @item r
  6916. frame rate of the input video, NAN if the input frame rate is unknown
  6917. @item t
  6918. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6919. @end table
  6920. @subsection Commands
  6921. The filter supports the following commands:
  6922. @table @option
  6923. @item contrast
  6924. Set the contrast expression.
  6925. @item brightness
  6926. Set the brightness expression.
  6927. @item saturation
  6928. Set the saturation expression.
  6929. @item gamma
  6930. Set the gamma expression.
  6931. @item gamma_r
  6932. Set the gamma_r expression.
  6933. @item gamma_g
  6934. Set gamma_g expression.
  6935. @item gamma_b
  6936. Set gamma_b expression.
  6937. @item gamma_weight
  6938. Set gamma_weight expression.
  6939. The command accepts the same syntax of the corresponding option.
  6940. If the specified expression is not valid, it is kept at its current
  6941. value.
  6942. @end table
  6943. @section erosion
  6944. Apply erosion effect to the video.
  6945. This filter replaces the pixel by the local(3x3) minimum.
  6946. It accepts the following options:
  6947. @table @option
  6948. @item threshold0
  6949. @item threshold1
  6950. @item threshold2
  6951. @item threshold3
  6952. Limit the maximum change for each plane, default is 65535.
  6953. If 0, plane will remain unchanged.
  6954. @item coordinates
  6955. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6956. pixels are used.
  6957. Flags to local 3x3 coordinates maps like this:
  6958. 1 2 3
  6959. 4 5
  6960. 6 7 8
  6961. @end table
  6962. @section extractplanes
  6963. Extract color channel components from input video stream into
  6964. separate grayscale video streams.
  6965. The filter accepts the following option:
  6966. @table @option
  6967. @item planes
  6968. Set plane(s) to extract.
  6969. Available values for planes are:
  6970. @table @samp
  6971. @item y
  6972. @item u
  6973. @item v
  6974. @item a
  6975. @item r
  6976. @item g
  6977. @item b
  6978. @end table
  6979. Choosing planes not available in the input will result in an error.
  6980. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6981. with @code{y}, @code{u}, @code{v} planes at same time.
  6982. @end table
  6983. @subsection Examples
  6984. @itemize
  6985. @item
  6986. Extract luma, u and v color channel component from input video frame
  6987. into 3 grayscale outputs:
  6988. @example
  6989. 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
  6990. @end example
  6991. @end itemize
  6992. @section elbg
  6993. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6994. For each input image, the filter will compute the optimal mapping from
  6995. the input to the output given the codebook length, that is the number
  6996. of distinct output colors.
  6997. This filter accepts the following options.
  6998. @table @option
  6999. @item codebook_length, l
  7000. Set codebook length. The value must be a positive integer, and
  7001. represents the number of distinct output colors. Default value is 256.
  7002. @item nb_steps, n
  7003. Set the maximum number of iterations to apply for computing the optimal
  7004. mapping. The higher the value the better the result and the higher the
  7005. computation time. Default value is 1.
  7006. @item seed, s
  7007. Set a random seed, must be an integer included between 0 and
  7008. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7009. will try to use a good random seed on a best effort basis.
  7010. @item pal8
  7011. Set pal8 output pixel format. This option does not work with codebook
  7012. length greater than 256.
  7013. @end table
  7014. @section entropy
  7015. Measure graylevel entropy in histogram of color channels of video frames.
  7016. It accepts the following parameters:
  7017. @table @option
  7018. @item mode
  7019. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7020. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7021. between neighbour histogram values.
  7022. @end table
  7023. @section fade
  7024. Apply a fade-in/out effect to the input video.
  7025. It accepts the following parameters:
  7026. @table @option
  7027. @item type, t
  7028. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7029. effect.
  7030. Default is @code{in}.
  7031. @item start_frame, s
  7032. Specify the number of the frame to start applying the fade
  7033. effect at. Default is 0.
  7034. @item nb_frames, n
  7035. The number of frames that the fade effect lasts. At the end of the
  7036. fade-in effect, the output video will have the same intensity as the input video.
  7037. At the end of the fade-out transition, the output video will be filled with the
  7038. selected @option{color}.
  7039. Default is 25.
  7040. @item alpha
  7041. If set to 1, fade only alpha channel, if one exists on the input.
  7042. Default value is 0.
  7043. @item start_time, st
  7044. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7045. effect. If both start_frame and start_time are specified, the fade will start at
  7046. whichever comes last. Default is 0.
  7047. @item duration, d
  7048. The number of seconds for which the fade effect has to last. At the end of the
  7049. fade-in effect the output video will have the same intensity as the input video,
  7050. at the end of the fade-out transition the output video will be filled with the
  7051. selected @option{color}.
  7052. If both duration and nb_frames are specified, duration is used. Default is 0
  7053. (nb_frames is used by default).
  7054. @item color, c
  7055. Specify the color of the fade. Default is "black".
  7056. @end table
  7057. @subsection Examples
  7058. @itemize
  7059. @item
  7060. Fade in the first 30 frames of video:
  7061. @example
  7062. fade=in:0:30
  7063. @end example
  7064. The command above is equivalent to:
  7065. @example
  7066. fade=t=in:s=0:n=30
  7067. @end example
  7068. @item
  7069. Fade out the last 45 frames of a 200-frame video:
  7070. @example
  7071. fade=out:155:45
  7072. fade=type=out:start_frame=155:nb_frames=45
  7073. @end example
  7074. @item
  7075. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7076. @example
  7077. fade=in:0:25, fade=out:975:25
  7078. @end example
  7079. @item
  7080. Make the first 5 frames yellow, then fade in from frame 5-24:
  7081. @example
  7082. fade=in:5:20:color=yellow
  7083. @end example
  7084. @item
  7085. Fade in alpha over first 25 frames of video:
  7086. @example
  7087. fade=in:0:25:alpha=1
  7088. @end example
  7089. @item
  7090. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7091. @example
  7092. fade=t=in:st=5.5:d=0.5
  7093. @end example
  7094. @end itemize
  7095. @section fftfilt
  7096. Apply arbitrary expressions to samples in frequency domain
  7097. @table @option
  7098. @item dc_Y
  7099. Adjust the dc value (gain) of the luma plane of the image. The filter
  7100. accepts an integer value in range @code{0} to @code{1000}. The default
  7101. value is set to @code{0}.
  7102. @item dc_U
  7103. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7104. filter accepts an integer value in range @code{0} to @code{1000}. The
  7105. default value is set to @code{0}.
  7106. @item dc_V
  7107. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7108. filter accepts an integer value in range @code{0} to @code{1000}. The
  7109. default value is set to @code{0}.
  7110. @item weight_Y
  7111. Set the frequency domain weight expression for the luma plane.
  7112. @item weight_U
  7113. Set the frequency domain weight expression for the 1st chroma plane.
  7114. @item weight_V
  7115. Set the frequency domain weight expression for the 2nd chroma plane.
  7116. @item eval
  7117. Set when the expressions are evaluated.
  7118. It accepts the following values:
  7119. @table @samp
  7120. @item init
  7121. Only evaluate expressions once during the filter initialization.
  7122. @item frame
  7123. Evaluate expressions for each incoming frame.
  7124. @end table
  7125. Default value is @samp{init}.
  7126. The filter accepts the following variables:
  7127. @item X
  7128. @item Y
  7129. The coordinates of the current sample.
  7130. @item W
  7131. @item H
  7132. The width and height of the image.
  7133. @item N
  7134. The number of input frame, starting from 0.
  7135. @end table
  7136. @subsection Examples
  7137. @itemize
  7138. @item
  7139. High-pass:
  7140. @example
  7141. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7142. @end example
  7143. @item
  7144. Low-pass:
  7145. @example
  7146. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7147. @end example
  7148. @item
  7149. Sharpen:
  7150. @example
  7151. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7152. @end example
  7153. @item
  7154. Blur:
  7155. @example
  7156. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7157. @end example
  7158. @end itemize
  7159. @section fftdnoiz
  7160. Denoise frames using 3D FFT (frequency domain filtering).
  7161. The filter accepts the following options:
  7162. @table @option
  7163. @item sigma
  7164. Set the noise sigma constant. This sets denoising strength.
  7165. Default value is 1. Allowed range is from 0 to 30.
  7166. Using very high sigma with low overlap may give blocking artifacts.
  7167. @item amount
  7168. Set amount of denoising. By default all detected noise is reduced.
  7169. Default value is 1. Allowed range is from 0 to 1.
  7170. @item block
  7171. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7172. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7173. block size in pixels is 2^4 which is 16.
  7174. @item overlap
  7175. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7176. @item prev
  7177. Set number of previous frames to use for denoising. By default is set to 0.
  7178. @item next
  7179. Set number of next frames to to use for denoising. By default is set to 0.
  7180. @item planes
  7181. Set planes which will be filtered, by default are all available filtered
  7182. except alpha.
  7183. @end table
  7184. @section field
  7185. Extract a single field from an interlaced image using stride
  7186. arithmetic to avoid wasting CPU time. The output frames are marked as
  7187. non-interlaced.
  7188. The filter accepts the following options:
  7189. @table @option
  7190. @item type
  7191. Specify whether to extract the top (if the value is @code{0} or
  7192. @code{top}) or the bottom field (if the value is @code{1} or
  7193. @code{bottom}).
  7194. @end table
  7195. @section fieldhint
  7196. Create new frames by copying the top and bottom fields from surrounding frames
  7197. supplied as numbers by the hint file.
  7198. @table @option
  7199. @item hint
  7200. Set file containing hints: absolute/relative frame numbers.
  7201. There must be one line for each frame in a clip. Each line must contain two
  7202. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7203. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7204. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7205. for @code{relative} mode. First number tells from which frame to pick up top
  7206. field and second number tells from which frame to pick up bottom field.
  7207. If optionally followed by @code{+} output frame will be marked as interlaced,
  7208. else if followed by @code{-} output frame will be marked as progressive, else
  7209. it will be marked same as input frame.
  7210. If line starts with @code{#} or @code{;} that line is skipped.
  7211. @item mode
  7212. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7213. @end table
  7214. Example of first several lines of @code{hint} file for @code{relative} mode:
  7215. @example
  7216. 0,0 - # first frame
  7217. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7218. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7219. 1,0 -
  7220. 0,0 -
  7221. 0,0 -
  7222. 1,0 -
  7223. 1,0 -
  7224. 1,0 -
  7225. 0,0 -
  7226. 0,0 -
  7227. 1,0 -
  7228. 1,0 -
  7229. 1,0 -
  7230. 0,0 -
  7231. @end example
  7232. @section fieldmatch
  7233. Field matching filter for inverse telecine. It is meant to reconstruct the
  7234. progressive frames from a telecined stream. The filter does not drop duplicated
  7235. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7236. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7237. The separation of the field matching and the decimation is notably motivated by
  7238. the possibility of inserting a de-interlacing filter fallback between the two.
  7239. If the source has mixed telecined and real interlaced content,
  7240. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7241. But these remaining combed frames will be marked as interlaced, and thus can be
  7242. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7243. In addition to the various configuration options, @code{fieldmatch} can take an
  7244. optional second stream, activated through the @option{ppsrc} option. If
  7245. enabled, the frames reconstruction will be based on the fields and frames from
  7246. this second stream. This allows the first input to be pre-processed in order to
  7247. help the various algorithms of the filter, while keeping the output lossless
  7248. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7249. or brightness/contrast adjustments can help.
  7250. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7251. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7252. which @code{fieldmatch} is based on. While the semantic and usage are very
  7253. close, some behaviour and options names can differ.
  7254. The @ref{decimate} filter currently only works for constant frame rate input.
  7255. If your input has mixed telecined (30fps) and progressive content with a lower
  7256. framerate like 24fps use the following filterchain to produce the necessary cfr
  7257. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7258. The filter accepts the following options:
  7259. @table @option
  7260. @item order
  7261. Specify the assumed field order of the input stream. Available values are:
  7262. @table @samp
  7263. @item auto
  7264. Auto detect parity (use FFmpeg's internal parity value).
  7265. @item bff
  7266. Assume bottom field first.
  7267. @item tff
  7268. Assume top field first.
  7269. @end table
  7270. Note that it is sometimes recommended not to trust the parity announced by the
  7271. stream.
  7272. Default value is @var{auto}.
  7273. @item mode
  7274. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7275. sense that it won't risk creating jerkiness due to duplicate frames when
  7276. possible, but if there are bad edits or blended fields it will end up
  7277. outputting combed frames when a good match might actually exist. On the other
  7278. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7279. but will almost always find a good frame if there is one. The other values are
  7280. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7281. jerkiness and creating duplicate frames versus finding good matches in sections
  7282. with bad edits, orphaned fields, blended fields, etc.
  7283. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7284. Available values are:
  7285. @table @samp
  7286. @item pc
  7287. 2-way matching (p/c)
  7288. @item pc_n
  7289. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7290. @item pc_u
  7291. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7292. @item pc_n_ub
  7293. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7294. still combed (p/c + n + u/b)
  7295. @item pcn
  7296. 3-way matching (p/c/n)
  7297. @item pcn_ub
  7298. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7299. detected as combed (p/c/n + u/b)
  7300. @end table
  7301. The parenthesis at the end indicate the matches that would be used for that
  7302. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7303. @var{top}).
  7304. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7305. the slowest.
  7306. Default value is @var{pc_n}.
  7307. @item ppsrc
  7308. Mark the main input stream as a pre-processed input, and enable the secondary
  7309. input stream as the clean source to pick the fields from. See the filter
  7310. introduction for more details. It is similar to the @option{clip2} feature from
  7311. VFM/TFM.
  7312. Default value is @code{0} (disabled).
  7313. @item field
  7314. Set the field to match from. It is recommended to set this to the same value as
  7315. @option{order} unless you experience matching failures with that setting. In
  7316. certain circumstances changing the field that is used to match from can have a
  7317. large impact on matching performance. Available values are:
  7318. @table @samp
  7319. @item auto
  7320. Automatic (same value as @option{order}).
  7321. @item bottom
  7322. Match from the bottom field.
  7323. @item top
  7324. Match from the top field.
  7325. @end table
  7326. Default value is @var{auto}.
  7327. @item mchroma
  7328. Set whether or not chroma is included during the match comparisons. In most
  7329. cases it is recommended to leave this enabled. You should set this to @code{0}
  7330. only if your clip has bad chroma problems such as heavy rainbowing or other
  7331. artifacts. Setting this to @code{0} could also be used to speed things up at
  7332. the cost of some accuracy.
  7333. Default value is @code{1}.
  7334. @item y0
  7335. @item y1
  7336. These define an exclusion band which excludes the lines between @option{y0} and
  7337. @option{y1} from being included in the field matching decision. An exclusion
  7338. band can be used to ignore subtitles, a logo, or other things that may
  7339. interfere with the matching. @option{y0} sets the starting scan line and
  7340. @option{y1} sets the ending line; all lines in between @option{y0} and
  7341. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7342. @option{y0} and @option{y1} to the same value will disable the feature.
  7343. @option{y0} and @option{y1} defaults to @code{0}.
  7344. @item scthresh
  7345. Set the scene change detection threshold as a percentage of maximum change on
  7346. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7347. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7348. @option{scthresh} is @code{[0.0, 100.0]}.
  7349. Default value is @code{12.0}.
  7350. @item combmatch
  7351. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7352. account the combed scores of matches when deciding what match to use as the
  7353. final match. Available values are:
  7354. @table @samp
  7355. @item none
  7356. No final matching based on combed scores.
  7357. @item sc
  7358. Combed scores are only used when a scene change is detected.
  7359. @item full
  7360. Use combed scores all the time.
  7361. @end table
  7362. Default is @var{sc}.
  7363. @item combdbg
  7364. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7365. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7366. Available values are:
  7367. @table @samp
  7368. @item none
  7369. No forced calculation.
  7370. @item pcn
  7371. Force p/c/n calculations.
  7372. @item pcnub
  7373. Force p/c/n/u/b calculations.
  7374. @end table
  7375. Default value is @var{none}.
  7376. @item cthresh
  7377. This is the area combing threshold used for combed frame detection. This
  7378. essentially controls how "strong" or "visible" combing must be to be detected.
  7379. Larger values mean combing must be more visible and smaller values mean combing
  7380. can be less visible or strong and still be detected. Valid settings are from
  7381. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7382. be detected as combed). This is basically a pixel difference value. A good
  7383. range is @code{[8, 12]}.
  7384. Default value is @code{9}.
  7385. @item chroma
  7386. Sets whether or not chroma is considered in the combed frame decision. Only
  7387. disable this if your source has chroma problems (rainbowing, etc.) that are
  7388. causing problems for the combed frame detection with chroma enabled. Actually,
  7389. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7390. where there is chroma only combing in the source.
  7391. Default value is @code{0}.
  7392. @item blockx
  7393. @item blocky
  7394. Respectively set the x-axis and y-axis size of the window used during combed
  7395. frame detection. This has to do with the size of the area in which
  7396. @option{combpel} pixels are required to be detected as combed for a frame to be
  7397. declared combed. See the @option{combpel} parameter description for more info.
  7398. Possible values are any number that is a power of 2 starting at 4 and going up
  7399. to 512.
  7400. Default value is @code{16}.
  7401. @item combpel
  7402. The number of combed pixels inside any of the @option{blocky} by
  7403. @option{blockx} size blocks on the frame for the frame to be detected as
  7404. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7405. setting controls "how much" combing there must be in any localized area (a
  7406. window defined by the @option{blockx} and @option{blocky} settings) on the
  7407. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7408. which point no frames will ever be detected as combed). This setting is known
  7409. as @option{MI} in TFM/VFM vocabulary.
  7410. Default value is @code{80}.
  7411. @end table
  7412. @anchor{p/c/n/u/b meaning}
  7413. @subsection p/c/n/u/b meaning
  7414. @subsubsection p/c/n
  7415. We assume the following telecined stream:
  7416. @example
  7417. Top fields: 1 2 2 3 4
  7418. Bottom fields: 1 2 3 4 4
  7419. @end example
  7420. The numbers correspond to the progressive frame the fields relate to. Here, the
  7421. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7422. When @code{fieldmatch} is configured to run a matching from bottom
  7423. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7424. @example
  7425. Input stream:
  7426. T 1 2 2 3 4
  7427. B 1 2 3 4 4 <-- matching reference
  7428. Matches: c c n n c
  7429. Output stream:
  7430. T 1 2 3 4 4
  7431. B 1 2 3 4 4
  7432. @end example
  7433. As a result of the field matching, we can see that some frames get duplicated.
  7434. To perform a complete inverse telecine, you need to rely on a decimation filter
  7435. after this operation. See for instance the @ref{decimate} filter.
  7436. The same operation now matching from top fields (@option{field}=@var{top})
  7437. looks like this:
  7438. @example
  7439. Input stream:
  7440. T 1 2 2 3 4 <-- matching reference
  7441. B 1 2 3 4 4
  7442. Matches: c c p p c
  7443. Output stream:
  7444. T 1 2 2 3 4
  7445. B 1 2 2 3 4
  7446. @end example
  7447. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7448. basically, they refer to the frame and field of the opposite parity:
  7449. @itemize
  7450. @item @var{p} matches the field of the opposite parity in the previous frame
  7451. @item @var{c} matches the field of the opposite parity in the current frame
  7452. @item @var{n} matches the field of the opposite parity in the next frame
  7453. @end itemize
  7454. @subsubsection u/b
  7455. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7456. from the opposite parity flag. In the following examples, we assume that we are
  7457. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7458. 'x' is placed above and below each matched fields.
  7459. With bottom matching (@option{field}=@var{bottom}):
  7460. @example
  7461. Match: c p n b u
  7462. x x x x x
  7463. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7464. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7465. x x x x x
  7466. Output frames:
  7467. 2 1 2 2 2
  7468. 2 2 2 1 3
  7469. @end example
  7470. With top matching (@option{field}=@var{top}):
  7471. @example
  7472. Match: c p n b u
  7473. x x x x x
  7474. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7475. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7476. x x x x x
  7477. Output frames:
  7478. 2 2 2 1 2
  7479. 2 1 3 2 2
  7480. @end example
  7481. @subsection Examples
  7482. Simple IVTC of a top field first telecined stream:
  7483. @example
  7484. fieldmatch=order=tff:combmatch=none, decimate
  7485. @end example
  7486. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7487. @example
  7488. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7489. @end example
  7490. @section fieldorder
  7491. Transform the field order of the input video.
  7492. It accepts the following parameters:
  7493. @table @option
  7494. @item order
  7495. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7496. for bottom field first.
  7497. @end table
  7498. The default value is @samp{tff}.
  7499. The transformation is done by shifting the picture content up or down
  7500. by one line, and filling the remaining line with appropriate picture content.
  7501. This method is consistent with most broadcast field order converters.
  7502. If the input video is not flagged as being interlaced, or it is already
  7503. flagged as being of the required output field order, then this filter does
  7504. not alter the incoming video.
  7505. It is very useful when converting to or from PAL DV material,
  7506. which is bottom field first.
  7507. For example:
  7508. @example
  7509. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7510. @end example
  7511. @section fifo, afifo
  7512. Buffer input images and send them when they are requested.
  7513. It is mainly useful when auto-inserted by the libavfilter
  7514. framework.
  7515. It does not take parameters.
  7516. @section fillborders
  7517. Fill borders of the input video, without changing video stream dimensions.
  7518. Sometimes video can have garbage at the four edges and you may not want to
  7519. crop video input to keep size multiple of some number.
  7520. This filter accepts the following options:
  7521. @table @option
  7522. @item left
  7523. Number of pixels to fill from left border.
  7524. @item right
  7525. Number of pixels to fill from right border.
  7526. @item top
  7527. Number of pixels to fill from top border.
  7528. @item bottom
  7529. Number of pixels to fill from bottom border.
  7530. @item mode
  7531. Set fill mode.
  7532. It accepts the following values:
  7533. @table @samp
  7534. @item smear
  7535. fill pixels using outermost pixels
  7536. @item mirror
  7537. fill pixels using mirroring
  7538. @item fixed
  7539. fill pixels with constant value
  7540. @end table
  7541. Default is @var{smear}.
  7542. @item color
  7543. Set color for pixels in fixed mode. Default is @var{black}.
  7544. @end table
  7545. @section find_rect
  7546. Find a rectangular object
  7547. It accepts the following options:
  7548. @table @option
  7549. @item object
  7550. Filepath of the object image, needs to be in gray8.
  7551. @item threshold
  7552. Detection threshold, default is 0.5.
  7553. @item mipmaps
  7554. Number of mipmaps, default is 3.
  7555. @item xmin, ymin, xmax, ymax
  7556. Specifies the rectangle in which to search.
  7557. @end table
  7558. @subsection Examples
  7559. @itemize
  7560. @item
  7561. Generate a representative palette of a given video using @command{ffmpeg}:
  7562. @example
  7563. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7564. @end example
  7565. @end itemize
  7566. @section cover_rect
  7567. Cover a rectangular object
  7568. It accepts the following options:
  7569. @table @option
  7570. @item cover
  7571. Filepath of the optional cover image, needs to be in yuv420.
  7572. @item mode
  7573. Set covering mode.
  7574. It accepts the following values:
  7575. @table @samp
  7576. @item cover
  7577. cover it by the supplied image
  7578. @item blur
  7579. cover it by interpolating the surrounding pixels
  7580. @end table
  7581. Default value is @var{blur}.
  7582. @end table
  7583. @subsection Examples
  7584. @itemize
  7585. @item
  7586. Generate a representative palette of a given video using @command{ffmpeg}:
  7587. @example
  7588. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7589. @end example
  7590. @end itemize
  7591. @section floodfill
  7592. Flood area with values of same pixel components with another values.
  7593. It accepts the following options:
  7594. @table @option
  7595. @item x
  7596. Set pixel x coordinate.
  7597. @item y
  7598. Set pixel y coordinate.
  7599. @item s0
  7600. Set source #0 component value.
  7601. @item s1
  7602. Set source #1 component value.
  7603. @item s2
  7604. Set source #2 component value.
  7605. @item s3
  7606. Set source #3 component value.
  7607. @item d0
  7608. Set destination #0 component value.
  7609. @item d1
  7610. Set destination #1 component value.
  7611. @item d2
  7612. Set destination #2 component value.
  7613. @item d3
  7614. Set destination #3 component value.
  7615. @end table
  7616. @anchor{format}
  7617. @section format
  7618. Convert the input video to one of the specified pixel formats.
  7619. Libavfilter will try to pick one that is suitable as input to
  7620. the next filter.
  7621. It accepts the following parameters:
  7622. @table @option
  7623. @item pix_fmts
  7624. A '|'-separated list of pixel format names, such as
  7625. "pix_fmts=yuv420p|monow|rgb24".
  7626. @end table
  7627. @subsection Examples
  7628. @itemize
  7629. @item
  7630. Convert the input video to the @var{yuv420p} format
  7631. @example
  7632. format=pix_fmts=yuv420p
  7633. @end example
  7634. Convert the input video to any of the formats in the list
  7635. @example
  7636. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7637. @end example
  7638. @end itemize
  7639. @anchor{fps}
  7640. @section fps
  7641. Convert the video to specified constant frame rate by duplicating or dropping
  7642. frames as necessary.
  7643. It accepts the following parameters:
  7644. @table @option
  7645. @item fps
  7646. The desired output frame rate. The default is @code{25}.
  7647. @item start_time
  7648. Assume the first PTS should be the given value, in seconds. This allows for
  7649. padding/trimming at the start of stream. By default, no assumption is made
  7650. about the first frame's expected PTS, so no padding or trimming is done.
  7651. For example, this could be set to 0 to pad the beginning with duplicates of
  7652. the first frame if a video stream starts after the audio stream or to trim any
  7653. frames with a negative PTS.
  7654. @item round
  7655. Timestamp (PTS) rounding method.
  7656. Possible values are:
  7657. @table @option
  7658. @item zero
  7659. round towards 0
  7660. @item inf
  7661. round away from 0
  7662. @item down
  7663. round towards -infinity
  7664. @item up
  7665. round towards +infinity
  7666. @item near
  7667. round to nearest
  7668. @end table
  7669. The default is @code{near}.
  7670. @item eof_action
  7671. Action performed when reading the last frame.
  7672. Possible values are:
  7673. @table @option
  7674. @item round
  7675. Use same timestamp rounding method as used for other frames.
  7676. @item pass
  7677. Pass through last frame if input duration has not been reached yet.
  7678. @end table
  7679. The default is @code{round}.
  7680. @end table
  7681. Alternatively, the options can be specified as a flat string:
  7682. @var{fps}[:@var{start_time}[:@var{round}]].
  7683. See also the @ref{setpts} filter.
  7684. @subsection Examples
  7685. @itemize
  7686. @item
  7687. A typical usage in order to set the fps to 25:
  7688. @example
  7689. fps=fps=25
  7690. @end example
  7691. @item
  7692. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7693. @example
  7694. fps=fps=film:round=near
  7695. @end example
  7696. @end itemize
  7697. @section framepack
  7698. Pack two different video streams into a stereoscopic video, setting proper
  7699. metadata on supported codecs. The two views should have the same size and
  7700. framerate and processing will stop when the shorter video ends. Please note
  7701. that you may conveniently adjust view properties with the @ref{scale} and
  7702. @ref{fps} filters.
  7703. It accepts the following parameters:
  7704. @table @option
  7705. @item format
  7706. The desired packing format. Supported values are:
  7707. @table @option
  7708. @item sbs
  7709. The views are next to each other (default).
  7710. @item tab
  7711. The views are on top of each other.
  7712. @item lines
  7713. The views are packed by line.
  7714. @item columns
  7715. The views are packed by column.
  7716. @item frameseq
  7717. The views are temporally interleaved.
  7718. @end table
  7719. @end table
  7720. Some examples:
  7721. @example
  7722. # Convert left and right views into a frame-sequential video
  7723. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7724. # Convert views into a side-by-side video with the same output resolution as the input
  7725. 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
  7726. @end example
  7727. @section framerate
  7728. Change the frame rate by interpolating new video output frames from the source
  7729. frames.
  7730. This filter is not designed to function correctly with interlaced media. If
  7731. you wish to change the frame rate of interlaced media then you are required
  7732. to deinterlace before this filter and re-interlace after this filter.
  7733. A description of the accepted options follows.
  7734. @table @option
  7735. @item fps
  7736. Specify the output frames per second. This option can also be specified
  7737. as a value alone. The default is @code{50}.
  7738. @item interp_start
  7739. Specify the start of a range where the output frame will be created as a
  7740. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7741. the default is @code{15}.
  7742. @item interp_end
  7743. Specify the end of a range where the output frame will be created as a
  7744. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7745. the default is @code{240}.
  7746. @item scene
  7747. Specify the level at which a scene change is detected as a value between
  7748. 0 and 100 to indicate a new scene; a low value reflects a low
  7749. probability for the current frame to introduce a new scene, while a higher
  7750. value means the current frame is more likely to be one.
  7751. The default is @code{8.2}.
  7752. @item flags
  7753. Specify flags influencing the filter process.
  7754. Available value for @var{flags} is:
  7755. @table @option
  7756. @item scene_change_detect, scd
  7757. Enable scene change detection using the value of the option @var{scene}.
  7758. This flag is enabled by default.
  7759. @end table
  7760. @end table
  7761. @section framestep
  7762. Select one frame every N-th frame.
  7763. This filter accepts the following option:
  7764. @table @option
  7765. @item step
  7766. Select frame after every @code{step} frames.
  7767. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7768. @end table
  7769. @section freezedetect
  7770. Detect frozen video.
  7771. This filter logs a message and sets frame metadata when it detects that the
  7772. input video has no significant change in content during a specified duration.
  7773. Video freeze detection calculates the mean average absolute difference of all
  7774. the components of video frames and compares it to a noise floor.
  7775. The printed times and duration are expressed in seconds. The
  7776. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7777. whose timestamp equals or exceeds the detection duration and it contains the
  7778. timestamp of the first frame of the freeze. The
  7779. @code{lavfi.freezedetect.freeze_duration} and
  7780. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7781. after the freeze.
  7782. The filter accepts the following options:
  7783. @table @option
  7784. @item noise, n
  7785. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7786. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7787. 0.001.
  7788. @item duration, d
  7789. Set freeze duration until notification (default is 2 seconds).
  7790. @end table
  7791. @anchor{frei0r}
  7792. @section frei0r
  7793. Apply a frei0r effect to the input video.
  7794. To enable the compilation of this filter, you need to install the frei0r
  7795. header and configure FFmpeg with @code{--enable-frei0r}.
  7796. It accepts the following parameters:
  7797. @table @option
  7798. @item filter_name
  7799. The name of the frei0r effect to load. If the environment variable
  7800. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7801. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7802. Otherwise, the standard frei0r paths are searched, in this order:
  7803. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7804. @file{/usr/lib/frei0r-1/}.
  7805. @item filter_params
  7806. A '|'-separated list of parameters to pass to the frei0r effect.
  7807. @end table
  7808. A frei0r effect parameter can be a boolean (its value is either
  7809. "y" or "n"), a double, a color (specified as
  7810. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7811. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7812. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7813. a position (specified as @var{X}/@var{Y}, where
  7814. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7815. The number and types of parameters depend on the loaded effect. If an
  7816. effect parameter is not specified, the default value is set.
  7817. @subsection Examples
  7818. @itemize
  7819. @item
  7820. Apply the distort0r effect, setting the first two double parameters:
  7821. @example
  7822. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7823. @end example
  7824. @item
  7825. Apply the colordistance effect, taking a color as the first parameter:
  7826. @example
  7827. frei0r=colordistance:0.2/0.3/0.4
  7828. frei0r=colordistance:violet
  7829. frei0r=colordistance:0x112233
  7830. @end example
  7831. @item
  7832. Apply the perspective effect, specifying the top left and top right image
  7833. positions:
  7834. @example
  7835. frei0r=perspective:0.2/0.2|0.8/0.2
  7836. @end example
  7837. @end itemize
  7838. For more information, see
  7839. @url{http://frei0r.dyne.org}
  7840. @section fspp
  7841. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7842. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7843. processing filter, one of them is performed once per block, not per pixel.
  7844. This allows for much higher speed.
  7845. The filter accepts the following options:
  7846. @table @option
  7847. @item quality
  7848. Set quality. This option defines the number of levels for averaging. It accepts
  7849. an integer in the range 4-5. Default value is @code{4}.
  7850. @item qp
  7851. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7852. If not set, the filter will use the QP from the video stream (if available).
  7853. @item strength
  7854. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7855. more details but also more artifacts, while higher values make the image smoother
  7856. but also blurrier. Default value is @code{0} − PSNR optimal.
  7857. @item use_bframe_qp
  7858. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7859. option may cause flicker since the B-Frames have often larger QP. Default is
  7860. @code{0} (not enabled).
  7861. @end table
  7862. @section gblur
  7863. Apply Gaussian blur filter.
  7864. The filter accepts the following options:
  7865. @table @option
  7866. @item sigma
  7867. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7868. @item steps
  7869. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7870. @item planes
  7871. Set which planes to filter. By default all planes are filtered.
  7872. @item sigmaV
  7873. Set vertical sigma, if negative it will be same as @code{sigma}.
  7874. Default is @code{-1}.
  7875. @end table
  7876. @section geq
  7877. Apply generic equation to each pixel.
  7878. The filter accepts the following options:
  7879. @table @option
  7880. @item lum_expr, lum
  7881. Set the luminance expression.
  7882. @item cb_expr, cb
  7883. Set the chrominance blue expression.
  7884. @item cr_expr, cr
  7885. Set the chrominance red expression.
  7886. @item alpha_expr, a
  7887. Set the alpha expression.
  7888. @item red_expr, r
  7889. Set the red expression.
  7890. @item green_expr, g
  7891. Set the green expression.
  7892. @item blue_expr, b
  7893. Set the blue expression.
  7894. @end table
  7895. The colorspace is selected according to the specified options. If one
  7896. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7897. options is specified, the filter will automatically select a YCbCr
  7898. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7899. @option{blue_expr} options is specified, it will select an RGB
  7900. colorspace.
  7901. If one of the chrominance expression is not defined, it falls back on the other
  7902. one. If no alpha expression is specified it will evaluate to opaque value.
  7903. If none of chrominance expressions are specified, they will evaluate
  7904. to the luminance expression.
  7905. The expressions can use the following variables and functions:
  7906. @table @option
  7907. @item N
  7908. The sequential number of the filtered frame, starting from @code{0}.
  7909. @item X
  7910. @item Y
  7911. The coordinates of the current sample.
  7912. @item W
  7913. @item H
  7914. The width and height of the image.
  7915. @item SW
  7916. @item SH
  7917. Width and height scale depending on the currently filtered plane. It is the
  7918. ratio between the corresponding luma plane number of pixels and the current
  7919. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7920. @code{0.5,0.5} for chroma planes.
  7921. @item T
  7922. Time of the current frame, expressed in seconds.
  7923. @item p(x, y)
  7924. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7925. plane.
  7926. @item lum(x, y)
  7927. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7928. plane.
  7929. @item cb(x, y)
  7930. Return the value of the pixel at location (@var{x},@var{y}) of the
  7931. blue-difference chroma plane. Return 0 if there is no such plane.
  7932. @item cr(x, y)
  7933. Return the value of the pixel at location (@var{x},@var{y}) of the
  7934. red-difference chroma plane. Return 0 if there is no such plane.
  7935. @item r(x, y)
  7936. @item g(x, y)
  7937. @item b(x, y)
  7938. Return the value of the pixel at location (@var{x},@var{y}) of the
  7939. red/green/blue component. Return 0 if there is no such component.
  7940. @item alpha(x, y)
  7941. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7942. plane. Return 0 if there is no such plane.
  7943. @end table
  7944. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7945. automatically clipped to the closer edge.
  7946. @subsection Examples
  7947. @itemize
  7948. @item
  7949. Flip the image horizontally:
  7950. @example
  7951. geq=p(W-X\,Y)
  7952. @end example
  7953. @item
  7954. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7955. wavelength of 100 pixels:
  7956. @example
  7957. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7958. @end example
  7959. @item
  7960. Generate a fancy enigmatic moving light:
  7961. @example
  7962. 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
  7963. @end example
  7964. @item
  7965. Generate a quick emboss effect:
  7966. @example
  7967. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7968. @end example
  7969. @item
  7970. Modify RGB components depending on pixel position:
  7971. @example
  7972. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7973. @end example
  7974. @item
  7975. Create a radial gradient that is the same size as the input (also see
  7976. the @ref{vignette} filter):
  7977. @example
  7978. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7979. @end example
  7980. @end itemize
  7981. @section gradfun
  7982. Fix the banding artifacts that are sometimes introduced into nearly flat
  7983. regions by truncation to 8-bit color depth.
  7984. Interpolate the gradients that should go where the bands are, and
  7985. dither them.
  7986. It is designed for playback only. Do not use it prior to
  7987. lossy compression, because compression tends to lose the dither and
  7988. bring back the bands.
  7989. It accepts the following parameters:
  7990. @table @option
  7991. @item strength
  7992. The maximum amount by which the filter will change any one pixel. This is also
  7993. the threshold for detecting nearly flat regions. Acceptable values range from
  7994. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7995. valid range.
  7996. @item radius
  7997. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7998. gradients, but also prevents the filter from modifying the pixels near detailed
  7999. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8000. values will be clipped to the valid range.
  8001. @end table
  8002. Alternatively, the options can be specified as a flat string:
  8003. @var{strength}[:@var{radius}]
  8004. @subsection Examples
  8005. @itemize
  8006. @item
  8007. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8008. @example
  8009. gradfun=3.5:8
  8010. @end example
  8011. @item
  8012. Specify radius, omitting the strength (which will fall-back to the default
  8013. value):
  8014. @example
  8015. gradfun=radius=8
  8016. @end example
  8017. @end itemize
  8018. @section graphmonitor, agraphmonitor
  8019. Show various filtergraph stats.
  8020. With this filter one can debug complete filtergraph.
  8021. Especially issues with links filling with queued frames.
  8022. The filter accepts the following options:
  8023. @table @option
  8024. @item size, s
  8025. Set video output size. Default is @var{hd720}.
  8026. @item opacity, o
  8027. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8028. @item mode, m
  8029. Set output mode, can be @var{fulll} or @var{compact}.
  8030. In @var{compact} mode only filters with some queued frames have displayed stats.
  8031. @item flags, f
  8032. Set flags which enable which stats are shown in video.
  8033. Available values for flags are:
  8034. @table @samp
  8035. @item queue
  8036. Display number of queued frames in each link.
  8037. @item frame_count_in
  8038. Display number of frames taken from filter.
  8039. @item frame_count_out
  8040. Display number of frames given out from filter.
  8041. @item pts
  8042. Display current filtered frame pts.
  8043. @item time
  8044. Display current filtered frame time.
  8045. @item timebase
  8046. Display time base for filter link.
  8047. @item format
  8048. Display used format for filter link.
  8049. @item size
  8050. Display video size or number of audio channels in case of audio used by filter link.
  8051. @item rate
  8052. Display video frame rate or sample rate in case of audio used by filter link.
  8053. @end table
  8054. @item rate, r
  8055. Set upper limit for video rate of output stream, Default value is @var{25}.
  8056. This guarantee that output video frame rate will not be higher than this value.
  8057. @end table
  8058. @section greyedge
  8059. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8060. and corrects the scene colors accordingly.
  8061. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8062. The filter accepts the following options:
  8063. @table @option
  8064. @item difford
  8065. The order of differentiation to be applied on the scene. Must be chosen in the range
  8066. [0,2] and default value is 1.
  8067. @item minknorm
  8068. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8069. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8070. max value instead of calculating Minkowski distance.
  8071. @item sigma
  8072. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8073. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8074. can't be euqal to 0 if @var{difford} is greater than 0.
  8075. @end table
  8076. @subsection Examples
  8077. @itemize
  8078. @item
  8079. Grey Edge:
  8080. @example
  8081. greyedge=difford=1:minknorm=5:sigma=2
  8082. @end example
  8083. @item
  8084. Max Edge:
  8085. @example
  8086. greyedge=difford=1:minknorm=0:sigma=2
  8087. @end example
  8088. @end itemize
  8089. @anchor{haldclut}
  8090. @section haldclut
  8091. Apply a Hald CLUT to a video stream.
  8092. First input is the video stream to process, and second one is the Hald CLUT.
  8093. The Hald CLUT input can be a simple picture or a complete video stream.
  8094. The filter accepts the following options:
  8095. @table @option
  8096. @item shortest
  8097. Force termination when the shortest input terminates. Default is @code{0}.
  8098. @item repeatlast
  8099. Continue applying the last CLUT after the end of the stream. A value of
  8100. @code{0} disable the filter after the last frame of the CLUT is reached.
  8101. Default is @code{1}.
  8102. @end table
  8103. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8104. filters share the same internals).
  8105. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8106. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8107. @subsection Workflow examples
  8108. @subsubsection Hald CLUT video stream
  8109. Generate an identity Hald CLUT stream altered with various effects:
  8110. @example
  8111. 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
  8112. @end example
  8113. Note: make sure you use a lossless codec.
  8114. Then use it with @code{haldclut} to apply it on some random stream:
  8115. @example
  8116. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8117. @end example
  8118. The Hald CLUT will be applied to the 10 first seconds (duration of
  8119. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8120. to the remaining frames of the @code{mandelbrot} stream.
  8121. @subsubsection Hald CLUT with preview
  8122. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8123. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8124. biggest possible square starting at the top left of the picture. The remaining
  8125. padding pixels (bottom or right) will be ignored. This area can be used to add
  8126. a preview of the Hald CLUT.
  8127. Typically, the following generated Hald CLUT will be supported by the
  8128. @code{haldclut} filter:
  8129. @example
  8130. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8131. pad=iw+320 [padded_clut];
  8132. smptebars=s=320x256, split [a][b];
  8133. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8134. [main][b] overlay=W-320" -frames:v 1 clut.png
  8135. @end example
  8136. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8137. bars are displayed on the right-top, and below the same color bars processed by
  8138. the color changes.
  8139. Then, the effect of this Hald CLUT can be visualized with:
  8140. @example
  8141. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8142. @end example
  8143. @section hflip
  8144. Flip the input video horizontally.
  8145. For example, to horizontally flip the input video with @command{ffmpeg}:
  8146. @example
  8147. ffmpeg -i in.avi -vf "hflip" out.avi
  8148. @end example
  8149. @section histeq
  8150. This filter applies a global color histogram equalization on a
  8151. per-frame basis.
  8152. It can be used to correct video that has a compressed range of pixel
  8153. intensities. The filter redistributes the pixel intensities to
  8154. equalize their distribution across the intensity range. It may be
  8155. viewed as an "automatically adjusting contrast filter". This filter is
  8156. useful only for correcting degraded or poorly captured source
  8157. video.
  8158. The filter accepts the following options:
  8159. @table @option
  8160. @item strength
  8161. Determine the amount of equalization to be applied. As the strength
  8162. is reduced, the distribution of pixel intensities more-and-more
  8163. approaches that of the input frame. The value must be a float number
  8164. in the range [0,1] and defaults to 0.200.
  8165. @item intensity
  8166. Set the maximum intensity that can generated and scale the output
  8167. values appropriately. The strength should be set as desired and then
  8168. the intensity can be limited if needed to avoid washing-out. The value
  8169. must be a float number in the range [0,1] and defaults to 0.210.
  8170. @item antibanding
  8171. Set the antibanding level. If enabled the filter will randomly vary
  8172. the luminance of output pixels by a small amount to avoid banding of
  8173. the histogram. Possible values are @code{none}, @code{weak} or
  8174. @code{strong}. It defaults to @code{none}.
  8175. @end table
  8176. @section histogram
  8177. Compute and draw a color distribution histogram for the input video.
  8178. The computed histogram is a representation of the color component
  8179. distribution in an image.
  8180. Standard histogram displays the color components distribution in an image.
  8181. Displays color graph for each color component. Shows distribution of
  8182. the Y, U, V, A or R, G, B components, depending on input format, in the
  8183. current frame. Below each graph a color component scale meter is shown.
  8184. The filter accepts the following options:
  8185. @table @option
  8186. @item level_height
  8187. Set height of level. Default value is @code{200}.
  8188. Allowed range is [50, 2048].
  8189. @item scale_height
  8190. Set height of color scale. Default value is @code{12}.
  8191. Allowed range is [0, 40].
  8192. @item display_mode
  8193. Set display mode.
  8194. It accepts the following values:
  8195. @table @samp
  8196. @item stack
  8197. Per color component graphs are placed below each other.
  8198. @item parade
  8199. Per color component graphs are placed side by side.
  8200. @item overlay
  8201. Presents information identical to that in the @code{parade}, except
  8202. that the graphs representing color components are superimposed directly
  8203. over one another.
  8204. @end table
  8205. Default is @code{stack}.
  8206. @item levels_mode
  8207. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8208. Default is @code{linear}.
  8209. @item components
  8210. Set what color components to display.
  8211. Default is @code{7}.
  8212. @item fgopacity
  8213. Set foreground opacity. Default is @code{0.7}.
  8214. @item bgopacity
  8215. Set background opacity. Default is @code{0.5}.
  8216. @end table
  8217. @subsection Examples
  8218. @itemize
  8219. @item
  8220. Calculate and draw histogram:
  8221. @example
  8222. ffplay -i input -vf histogram
  8223. @end example
  8224. @end itemize
  8225. @anchor{hqdn3d}
  8226. @section hqdn3d
  8227. This is a high precision/quality 3d denoise filter. It aims to reduce
  8228. image noise, producing smooth images and making still images really
  8229. still. It should enhance compressibility.
  8230. It accepts the following optional parameters:
  8231. @table @option
  8232. @item luma_spatial
  8233. A non-negative floating point number which specifies spatial luma strength.
  8234. It defaults to 4.0.
  8235. @item chroma_spatial
  8236. A non-negative floating point number which specifies spatial chroma strength.
  8237. It defaults to 3.0*@var{luma_spatial}/4.0.
  8238. @item luma_tmp
  8239. A floating point number which specifies luma temporal strength. It defaults to
  8240. 6.0*@var{luma_spatial}/4.0.
  8241. @item chroma_tmp
  8242. A floating point number which specifies chroma temporal strength. It defaults to
  8243. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8244. @end table
  8245. @anchor{hwdownload}
  8246. @section hwdownload
  8247. Download hardware frames to system memory.
  8248. The input must be in hardware frames, and the output a non-hardware format.
  8249. Not all formats will be supported on the output - it may be necessary to insert
  8250. an additional @option{format} filter immediately following in the graph to get
  8251. the output in a supported format.
  8252. @section hwmap
  8253. Map hardware frames to system memory or to another device.
  8254. This filter has several different modes of operation; which one is used depends
  8255. on the input and output formats:
  8256. @itemize
  8257. @item
  8258. Hardware frame input, normal frame output
  8259. Map the input frames to system memory and pass them to the output. If the
  8260. original hardware frame is later required (for example, after overlaying
  8261. something else on part of it), the @option{hwmap} filter can be used again
  8262. in the next mode to retrieve it.
  8263. @item
  8264. Normal frame input, hardware frame output
  8265. If the input is actually a software-mapped hardware frame, then unmap it -
  8266. that is, return the original hardware frame.
  8267. Otherwise, a device must be provided. Create new hardware surfaces on that
  8268. device for the output, then map them back to the software format at the input
  8269. and give those frames to the preceding filter. This will then act like the
  8270. @option{hwupload} filter, but may be able to avoid an additional copy when
  8271. the input is already in a compatible format.
  8272. @item
  8273. Hardware frame input and output
  8274. A device must be supplied for the output, either directly or with the
  8275. @option{derive_device} option. The input and output devices must be of
  8276. different types and compatible - the exact meaning of this is
  8277. system-dependent, but typically it means that they must refer to the same
  8278. underlying hardware context (for example, refer to the same graphics card).
  8279. If the input frames were originally created on the output device, then unmap
  8280. to retrieve the original frames.
  8281. Otherwise, map the frames to the output device - create new hardware frames
  8282. on the output corresponding to the frames on the input.
  8283. @end itemize
  8284. The following additional parameters are accepted:
  8285. @table @option
  8286. @item mode
  8287. Set the frame mapping mode. Some combination of:
  8288. @table @var
  8289. @item read
  8290. The mapped frame should be readable.
  8291. @item write
  8292. The mapped frame should be writeable.
  8293. @item overwrite
  8294. The mapping will always overwrite the entire frame.
  8295. This may improve performance in some cases, as the original contents of the
  8296. frame need not be loaded.
  8297. @item direct
  8298. The mapping must not involve any copying.
  8299. Indirect mappings to copies of frames are created in some cases where either
  8300. direct mapping is not possible or it would have unexpected properties.
  8301. Setting this flag ensures that the mapping is direct and will fail if that is
  8302. not possible.
  8303. @end table
  8304. Defaults to @var{read+write} if not specified.
  8305. @item derive_device @var{type}
  8306. Rather than using the device supplied at initialisation, instead derive a new
  8307. device of type @var{type} from the device the input frames exist on.
  8308. @item reverse
  8309. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8310. and map them back to the source. This may be necessary in some cases where
  8311. a mapping in one direction is required but only the opposite direction is
  8312. supported by the devices being used.
  8313. This option is dangerous - it may break the preceding filter in undefined
  8314. ways if there are any additional constraints on that filter's output.
  8315. Do not use it without fully understanding the implications of its use.
  8316. @end table
  8317. @anchor{hwupload}
  8318. @section hwupload
  8319. Upload system memory frames to hardware surfaces.
  8320. The device to upload to must be supplied when the filter is initialised. If
  8321. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8322. option.
  8323. @anchor{hwupload_cuda}
  8324. @section hwupload_cuda
  8325. Upload system memory frames to a CUDA device.
  8326. It accepts the following optional parameters:
  8327. @table @option
  8328. @item device
  8329. The number of the CUDA device to use
  8330. @end table
  8331. @section hqx
  8332. Apply a high-quality magnification filter designed for pixel art. This filter
  8333. was originally created by Maxim Stepin.
  8334. It accepts the following option:
  8335. @table @option
  8336. @item n
  8337. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8338. @code{hq3x} and @code{4} for @code{hq4x}.
  8339. Default is @code{3}.
  8340. @end table
  8341. @section hstack
  8342. Stack input videos horizontally.
  8343. All streams must be of same pixel format and of same height.
  8344. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8345. to create same output.
  8346. The filter accept the following option:
  8347. @table @option
  8348. @item inputs
  8349. Set number of input streams. Default is 2.
  8350. @item shortest
  8351. If set to 1, force the output to terminate when the shortest input
  8352. terminates. Default value is 0.
  8353. @end table
  8354. @section hue
  8355. Modify the hue and/or the saturation of the input.
  8356. It accepts the following parameters:
  8357. @table @option
  8358. @item h
  8359. Specify the hue angle as a number of degrees. It accepts an expression,
  8360. and defaults to "0".
  8361. @item s
  8362. Specify the saturation in the [-10,10] range. It accepts an expression and
  8363. defaults to "1".
  8364. @item H
  8365. Specify the hue angle as a number of radians. It accepts an
  8366. expression, and defaults to "0".
  8367. @item b
  8368. Specify the brightness in the [-10,10] range. It accepts an expression and
  8369. defaults to "0".
  8370. @end table
  8371. @option{h} and @option{H} are mutually exclusive, and can't be
  8372. specified at the same time.
  8373. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8374. expressions containing the following constants:
  8375. @table @option
  8376. @item n
  8377. frame count of the input frame starting from 0
  8378. @item pts
  8379. presentation timestamp of the input frame expressed in time base units
  8380. @item r
  8381. frame rate of the input video, NAN if the input frame rate is unknown
  8382. @item t
  8383. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8384. @item tb
  8385. time base of the input video
  8386. @end table
  8387. @subsection Examples
  8388. @itemize
  8389. @item
  8390. Set the hue to 90 degrees and the saturation to 1.0:
  8391. @example
  8392. hue=h=90:s=1
  8393. @end example
  8394. @item
  8395. Same command but expressing the hue in radians:
  8396. @example
  8397. hue=H=PI/2:s=1
  8398. @end example
  8399. @item
  8400. Rotate hue and make the saturation swing between 0
  8401. and 2 over a period of 1 second:
  8402. @example
  8403. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8404. @end example
  8405. @item
  8406. Apply a 3 seconds saturation fade-in effect starting at 0:
  8407. @example
  8408. hue="s=min(t/3\,1)"
  8409. @end example
  8410. The general fade-in expression can be written as:
  8411. @example
  8412. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8413. @end example
  8414. @item
  8415. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8416. @example
  8417. hue="s=max(0\, min(1\, (8-t)/3))"
  8418. @end example
  8419. The general fade-out expression can be written as:
  8420. @example
  8421. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8422. @end example
  8423. @end itemize
  8424. @subsection Commands
  8425. This filter supports the following commands:
  8426. @table @option
  8427. @item b
  8428. @item s
  8429. @item h
  8430. @item H
  8431. Modify the hue and/or the saturation and/or brightness of the input video.
  8432. The command accepts the same syntax of the corresponding option.
  8433. If the specified expression is not valid, it is kept at its current
  8434. value.
  8435. @end table
  8436. @section hysteresis
  8437. Grow first stream into second stream by connecting components.
  8438. This makes it possible to build more robust edge masks.
  8439. This filter accepts the following options:
  8440. @table @option
  8441. @item planes
  8442. Set which planes will be processed as bitmap, unprocessed planes will be
  8443. copied from first stream.
  8444. By default value 0xf, all planes will be processed.
  8445. @item threshold
  8446. Set threshold which is used in filtering. If pixel component value is higher than
  8447. this value filter algorithm for connecting components is activated.
  8448. By default value is 0.
  8449. @end table
  8450. @section idet
  8451. Detect video interlacing type.
  8452. This filter tries to detect if the input frames are interlaced, progressive,
  8453. top or bottom field first. It will also try to detect fields that are
  8454. repeated between adjacent frames (a sign of telecine).
  8455. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8456. Multiple frame detection incorporates the classification history of previous frames.
  8457. The filter will log these metadata values:
  8458. @table @option
  8459. @item single.current_frame
  8460. Detected type of current frame using single-frame detection. One of:
  8461. ``tff'' (top field first), ``bff'' (bottom field first),
  8462. ``progressive'', or ``undetermined''
  8463. @item single.tff
  8464. Cumulative number of frames detected as top field first using single-frame detection.
  8465. @item multiple.tff
  8466. Cumulative number of frames detected as top field first using multiple-frame detection.
  8467. @item single.bff
  8468. Cumulative number of frames detected as bottom field first using single-frame detection.
  8469. @item multiple.current_frame
  8470. Detected type of current frame using multiple-frame detection. One of:
  8471. ``tff'' (top field first), ``bff'' (bottom field first),
  8472. ``progressive'', or ``undetermined''
  8473. @item multiple.bff
  8474. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8475. @item single.progressive
  8476. Cumulative number of frames detected as progressive using single-frame detection.
  8477. @item multiple.progressive
  8478. Cumulative number of frames detected as progressive using multiple-frame detection.
  8479. @item single.undetermined
  8480. Cumulative number of frames that could not be classified using single-frame detection.
  8481. @item multiple.undetermined
  8482. Cumulative number of frames that could not be classified using multiple-frame detection.
  8483. @item repeated.current_frame
  8484. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8485. @item repeated.neither
  8486. Cumulative number of frames with no repeated field.
  8487. @item repeated.top
  8488. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8489. @item repeated.bottom
  8490. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8491. @end table
  8492. The filter accepts the following options:
  8493. @table @option
  8494. @item intl_thres
  8495. Set interlacing threshold.
  8496. @item prog_thres
  8497. Set progressive threshold.
  8498. @item rep_thres
  8499. Threshold for repeated field detection.
  8500. @item half_life
  8501. Number of frames after which a given frame's contribution to the
  8502. statistics is halved (i.e., it contributes only 0.5 to its
  8503. classification). The default of 0 means that all frames seen are given
  8504. full weight of 1.0 forever.
  8505. @item analyze_interlaced_flag
  8506. When this is not 0 then idet will use the specified number of frames to determine
  8507. if the interlaced flag is accurate, it will not count undetermined frames.
  8508. If the flag is found to be accurate it will be used without any further
  8509. computations, if it is found to be inaccurate it will be cleared without any
  8510. further computations. This allows inserting the idet filter as a low computational
  8511. method to clean up the interlaced flag
  8512. @end table
  8513. @section il
  8514. Deinterleave or interleave fields.
  8515. This filter allows one to process interlaced images fields without
  8516. deinterlacing them. Deinterleaving splits the input frame into 2
  8517. fields (so called half pictures). Odd lines are moved to the top
  8518. half of the output image, even lines to the bottom half.
  8519. You can process (filter) them independently and then re-interleave them.
  8520. The filter accepts the following options:
  8521. @table @option
  8522. @item luma_mode, l
  8523. @item chroma_mode, c
  8524. @item alpha_mode, a
  8525. Available values for @var{luma_mode}, @var{chroma_mode} and
  8526. @var{alpha_mode} are:
  8527. @table @samp
  8528. @item none
  8529. Do nothing.
  8530. @item deinterleave, d
  8531. Deinterleave fields, placing one above the other.
  8532. @item interleave, i
  8533. Interleave fields. Reverse the effect of deinterleaving.
  8534. @end table
  8535. Default value is @code{none}.
  8536. @item luma_swap, ls
  8537. @item chroma_swap, cs
  8538. @item alpha_swap, as
  8539. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8540. @end table
  8541. @section inflate
  8542. Apply inflate effect to the video.
  8543. This filter replaces the pixel by the local(3x3) average by taking into account
  8544. only values higher than the pixel.
  8545. It accepts the following options:
  8546. @table @option
  8547. @item threshold0
  8548. @item threshold1
  8549. @item threshold2
  8550. @item threshold3
  8551. Limit the maximum change for each plane, default is 65535.
  8552. If 0, plane will remain unchanged.
  8553. @end table
  8554. @section interlace
  8555. Simple interlacing filter from progressive contents. This interleaves upper (or
  8556. lower) lines from odd frames with lower (or upper) lines from even frames,
  8557. halving the frame rate and preserving image height.
  8558. @example
  8559. Original Original New Frame
  8560. Frame 'j' Frame 'j+1' (tff)
  8561. ========== =========== ==================
  8562. Line 0 --------------------> Frame 'j' Line 0
  8563. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8564. Line 2 ---------------------> Frame 'j' Line 2
  8565. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8566. ... ... ...
  8567. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8568. @end example
  8569. It accepts the following optional parameters:
  8570. @table @option
  8571. @item scan
  8572. This determines whether the interlaced frame is taken from the even
  8573. (tff - default) or odd (bff) lines of the progressive frame.
  8574. @item lowpass
  8575. Vertical lowpass filter to avoid twitter interlacing and
  8576. reduce moire patterns.
  8577. @table @samp
  8578. @item 0, off
  8579. Disable vertical lowpass filter
  8580. @item 1, linear
  8581. Enable linear filter (default)
  8582. @item 2, complex
  8583. Enable complex filter. This will slightly less reduce twitter and moire
  8584. but better retain detail and subjective sharpness impression.
  8585. @end table
  8586. @end table
  8587. @section kerndeint
  8588. Deinterlace input video by applying Donald Graft's adaptive kernel
  8589. deinterling. Work on interlaced parts of a video to produce
  8590. progressive frames.
  8591. The description of the accepted parameters follows.
  8592. @table @option
  8593. @item thresh
  8594. Set the threshold which affects the filter's tolerance when
  8595. determining if a pixel line must be processed. It must be an integer
  8596. in the range [0,255] and defaults to 10. A value of 0 will result in
  8597. applying the process on every pixels.
  8598. @item map
  8599. Paint pixels exceeding the threshold value to white if set to 1.
  8600. Default is 0.
  8601. @item order
  8602. Set the fields order. Swap fields if set to 1, leave fields alone if
  8603. 0. Default is 0.
  8604. @item sharp
  8605. Enable additional sharpening if set to 1. Default is 0.
  8606. @item twoway
  8607. Enable twoway sharpening if set to 1. Default is 0.
  8608. @end table
  8609. @subsection Examples
  8610. @itemize
  8611. @item
  8612. Apply default values:
  8613. @example
  8614. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8615. @end example
  8616. @item
  8617. Enable additional sharpening:
  8618. @example
  8619. kerndeint=sharp=1
  8620. @end example
  8621. @item
  8622. Paint processed pixels in white:
  8623. @example
  8624. kerndeint=map=1
  8625. @end example
  8626. @end itemize
  8627. @section lenscorrection
  8628. Correct radial lens distortion
  8629. This filter can be used to correct for radial distortion as can result from the use
  8630. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8631. one can use tools available for example as part of opencv or simply trial-and-error.
  8632. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8633. and extract the k1 and k2 coefficients from the resulting matrix.
  8634. Note that effectively the same filter is available in the open-source tools Krita and
  8635. Digikam from the KDE project.
  8636. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8637. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8638. brightness distribution, so you may want to use both filters together in certain
  8639. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8640. be applied before or after lens correction.
  8641. @subsection Options
  8642. The filter accepts the following options:
  8643. @table @option
  8644. @item cx
  8645. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8646. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8647. width. Default is 0.5.
  8648. @item cy
  8649. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8650. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8651. height. Default is 0.5.
  8652. @item k1
  8653. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8654. no correction. Default is 0.
  8655. @item k2
  8656. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8657. 0 means no correction. Default is 0.
  8658. @end table
  8659. The formula that generates the correction is:
  8660. @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)
  8661. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8662. distances from the focal point in the source and target images, respectively.
  8663. @section lensfun
  8664. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8665. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8666. to apply the lens correction. The filter will load the lensfun database and
  8667. query it to find the corresponding camera and lens entries in the database. As
  8668. long as these entries can be found with the given options, the filter can
  8669. perform corrections on frames. Note that incomplete strings will result in the
  8670. filter choosing the best match with the given options, and the filter will
  8671. output the chosen camera and lens models (logged with level "info"). You must
  8672. provide the make, camera model, and lens model as they are required.
  8673. The filter accepts the following options:
  8674. @table @option
  8675. @item make
  8676. The make of the camera (for example, "Canon"). This option is required.
  8677. @item model
  8678. The model of the camera (for example, "Canon EOS 100D"). This option is
  8679. required.
  8680. @item lens_model
  8681. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8682. option is required.
  8683. @item mode
  8684. The type of correction to apply. The following values are valid options:
  8685. @table @samp
  8686. @item vignetting
  8687. Enables fixing lens vignetting.
  8688. @item geometry
  8689. Enables fixing lens geometry. This is the default.
  8690. @item subpixel
  8691. Enables fixing chromatic aberrations.
  8692. @item vig_geo
  8693. Enables fixing lens vignetting and lens geometry.
  8694. @item vig_subpixel
  8695. Enables fixing lens vignetting and chromatic aberrations.
  8696. @item distortion
  8697. Enables fixing both lens geometry and chromatic aberrations.
  8698. @item all
  8699. Enables all possible corrections.
  8700. @end table
  8701. @item focal_length
  8702. The focal length of the image/video (zoom; expected constant for video). For
  8703. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8704. range should be chosen when using that lens. Default 18.
  8705. @item aperture
  8706. The aperture of the image/video (expected constant for video). Note that
  8707. aperture is only used for vignetting correction. Default 3.5.
  8708. @item focus_distance
  8709. The focus distance of the image/video (expected constant for video). Note that
  8710. focus distance is only used for vignetting and only slightly affects the
  8711. vignetting correction process. If unknown, leave it at the default value (which
  8712. is 1000).
  8713. @item target_geometry
  8714. The target geometry of the output image/video. The following values are valid
  8715. options:
  8716. @table @samp
  8717. @item rectilinear (default)
  8718. @item fisheye
  8719. @item panoramic
  8720. @item equirectangular
  8721. @item fisheye_orthographic
  8722. @item fisheye_stereographic
  8723. @item fisheye_equisolid
  8724. @item fisheye_thoby
  8725. @end table
  8726. @item reverse
  8727. Apply the reverse of image correction (instead of correcting distortion, apply
  8728. it).
  8729. @item interpolation
  8730. The type of interpolation used when correcting distortion. The following values
  8731. are valid options:
  8732. @table @samp
  8733. @item nearest
  8734. @item linear (default)
  8735. @item lanczos
  8736. @end table
  8737. @end table
  8738. @subsection Examples
  8739. @itemize
  8740. @item
  8741. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8742. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8743. aperture of "8.0".
  8744. @example
  8745. 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
  8746. @end example
  8747. @item
  8748. Apply the same as before, but only for the first 5 seconds of video.
  8749. @example
  8750. 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
  8751. @end example
  8752. @end itemize
  8753. @section libvmaf
  8754. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8755. score between two input videos.
  8756. The obtained VMAF score is printed through the logging system.
  8757. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8758. After installing the library it can be enabled using:
  8759. @code{./configure --enable-libvmaf --enable-version3}.
  8760. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8761. The filter has following options:
  8762. @table @option
  8763. @item model_path
  8764. Set the model path which is to be used for SVM.
  8765. Default value: @code{"vmaf_v0.6.1.pkl"}
  8766. @item log_path
  8767. Set the file path to be used to store logs.
  8768. @item log_fmt
  8769. Set the format of the log file (xml or json).
  8770. @item enable_transform
  8771. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8772. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8773. Default value: @code{false}
  8774. @item phone_model
  8775. Invokes the phone model which will generate VMAF scores higher than in the
  8776. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8777. @item psnr
  8778. Enables computing psnr along with vmaf.
  8779. @item ssim
  8780. Enables computing ssim along with vmaf.
  8781. @item ms_ssim
  8782. Enables computing ms_ssim along with vmaf.
  8783. @item pool
  8784. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8785. @item n_threads
  8786. Set number of threads to be used when computing vmaf.
  8787. @item n_subsample
  8788. Set interval for frame subsampling used when computing vmaf.
  8789. @item enable_conf_interval
  8790. Enables confidence interval.
  8791. @end table
  8792. This filter also supports the @ref{framesync} options.
  8793. On the below examples the input file @file{main.mpg} being processed is
  8794. compared with the reference file @file{ref.mpg}.
  8795. @example
  8796. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8797. @end example
  8798. Example with options:
  8799. @example
  8800. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8801. @end example
  8802. @section limiter
  8803. Limits the pixel components values to the specified range [min, max].
  8804. The filter accepts the following options:
  8805. @table @option
  8806. @item min
  8807. Lower bound. Defaults to the lowest allowed value for the input.
  8808. @item max
  8809. Upper bound. Defaults to the highest allowed value for the input.
  8810. @item planes
  8811. Specify which planes will be processed. Defaults to all available.
  8812. @end table
  8813. @section loop
  8814. Loop video frames.
  8815. The filter accepts the following options:
  8816. @table @option
  8817. @item loop
  8818. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8819. Default is 0.
  8820. @item size
  8821. Set maximal size in number of frames. Default is 0.
  8822. @item start
  8823. Set first frame of loop. Default is 0.
  8824. @end table
  8825. @subsection Examples
  8826. @itemize
  8827. @item
  8828. Loop single first frame infinitely:
  8829. @example
  8830. loop=loop=-1:size=1:start=0
  8831. @end example
  8832. @item
  8833. Loop single first frame 10 times:
  8834. @example
  8835. loop=loop=10:size=1:start=0
  8836. @end example
  8837. @item
  8838. Loop 10 first frames 5 times:
  8839. @example
  8840. loop=loop=5:size=10:start=0
  8841. @end example
  8842. @end itemize
  8843. @section lut1d
  8844. Apply a 1D LUT to an input video.
  8845. The filter accepts the following options:
  8846. @table @option
  8847. @item file
  8848. Set the 1D LUT file name.
  8849. Currently supported formats:
  8850. @table @samp
  8851. @item cube
  8852. Iridas
  8853. @end table
  8854. @item interp
  8855. Select interpolation mode.
  8856. Available values are:
  8857. @table @samp
  8858. @item nearest
  8859. Use values from the nearest defined point.
  8860. @item linear
  8861. Interpolate values using the linear interpolation.
  8862. @item cosine
  8863. Interpolate values using the cosine interpolation.
  8864. @item cubic
  8865. Interpolate values using the cubic interpolation.
  8866. @item spline
  8867. Interpolate values using the spline interpolation.
  8868. @end table
  8869. @end table
  8870. @anchor{lut3d}
  8871. @section lut3d
  8872. Apply a 3D LUT to an input video.
  8873. The filter accepts the following options:
  8874. @table @option
  8875. @item file
  8876. Set the 3D LUT file name.
  8877. Currently supported formats:
  8878. @table @samp
  8879. @item 3dl
  8880. AfterEffects
  8881. @item cube
  8882. Iridas
  8883. @item dat
  8884. DaVinci
  8885. @item m3d
  8886. Pandora
  8887. @end table
  8888. @item interp
  8889. Select interpolation mode.
  8890. Available values are:
  8891. @table @samp
  8892. @item nearest
  8893. Use values from the nearest defined point.
  8894. @item trilinear
  8895. Interpolate values using the 8 points defining a cube.
  8896. @item tetrahedral
  8897. Interpolate values using a tetrahedron.
  8898. @end table
  8899. @end table
  8900. This filter also supports the @ref{framesync} options.
  8901. @section lumakey
  8902. Turn certain luma values into transparency.
  8903. The filter accepts the following options:
  8904. @table @option
  8905. @item threshold
  8906. Set the luma which will be used as base for transparency.
  8907. Default value is @code{0}.
  8908. @item tolerance
  8909. Set the range of luma values to be keyed out.
  8910. Default value is @code{0}.
  8911. @item softness
  8912. Set the range of softness. Default value is @code{0}.
  8913. Use this to control gradual transition from zero to full transparency.
  8914. @end table
  8915. @section lut, lutrgb, lutyuv
  8916. Compute a look-up table for binding each pixel component input value
  8917. to an output value, and apply it to the input video.
  8918. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8919. to an RGB input video.
  8920. These filters accept the following parameters:
  8921. @table @option
  8922. @item c0
  8923. set first pixel component expression
  8924. @item c1
  8925. set second pixel component expression
  8926. @item c2
  8927. set third pixel component expression
  8928. @item c3
  8929. set fourth pixel component expression, corresponds to the alpha component
  8930. @item r
  8931. set red component expression
  8932. @item g
  8933. set green component expression
  8934. @item b
  8935. set blue component expression
  8936. @item a
  8937. alpha component expression
  8938. @item y
  8939. set Y/luminance component expression
  8940. @item u
  8941. set U/Cb component expression
  8942. @item v
  8943. set V/Cr component expression
  8944. @end table
  8945. Each of them specifies the expression to use for computing the lookup table for
  8946. the corresponding pixel component values.
  8947. The exact component associated to each of the @var{c*} options depends on the
  8948. format in input.
  8949. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8950. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8951. The expressions can contain the following constants and functions:
  8952. @table @option
  8953. @item w
  8954. @item h
  8955. The input width and height.
  8956. @item val
  8957. The input value for the pixel component.
  8958. @item clipval
  8959. The input value, clipped to the @var{minval}-@var{maxval} range.
  8960. @item maxval
  8961. The maximum value for the pixel component.
  8962. @item minval
  8963. The minimum value for the pixel component.
  8964. @item negval
  8965. The negated value for the pixel component value, clipped to the
  8966. @var{minval}-@var{maxval} range; it corresponds to the expression
  8967. "maxval-clipval+minval".
  8968. @item clip(val)
  8969. The computed value in @var{val}, clipped to the
  8970. @var{minval}-@var{maxval} range.
  8971. @item gammaval(gamma)
  8972. The computed gamma correction value of the pixel component value,
  8973. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8974. expression
  8975. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8976. @end table
  8977. All expressions default to "val".
  8978. @subsection Examples
  8979. @itemize
  8980. @item
  8981. Negate input video:
  8982. @example
  8983. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8984. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8985. @end example
  8986. The above is the same as:
  8987. @example
  8988. lutrgb="r=negval:g=negval:b=negval"
  8989. lutyuv="y=negval:u=negval:v=negval"
  8990. @end example
  8991. @item
  8992. Negate luminance:
  8993. @example
  8994. lutyuv=y=negval
  8995. @end example
  8996. @item
  8997. Remove chroma components, turning the video into a graytone image:
  8998. @example
  8999. lutyuv="u=128:v=128"
  9000. @end example
  9001. @item
  9002. Apply a luma burning effect:
  9003. @example
  9004. lutyuv="y=2*val"
  9005. @end example
  9006. @item
  9007. Remove green and blue components:
  9008. @example
  9009. lutrgb="g=0:b=0"
  9010. @end example
  9011. @item
  9012. Set a constant alpha channel value on input:
  9013. @example
  9014. format=rgba,lutrgb=a="maxval-minval/2"
  9015. @end example
  9016. @item
  9017. Correct luminance gamma by a factor of 0.5:
  9018. @example
  9019. lutyuv=y=gammaval(0.5)
  9020. @end example
  9021. @item
  9022. Discard least significant bits of luma:
  9023. @example
  9024. lutyuv=y='bitand(val, 128+64+32)'
  9025. @end example
  9026. @item
  9027. Technicolor like effect:
  9028. @example
  9029. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9030. @end example
  9031. @end itemize
  9032. @section lut2, tlut2
  9033. The @code{lut2} filter takes two input streams and outputs one
  9034. stream.
  9035. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9036. from one single stream.
  9037. This filter accepts the following parameters:
  9038. @table @option
  9039. @item c0
  9040. set first pixel component expression
  9041. @item c1
  9042. set second pixel component expression
  9043. @item c2
  9044. set third pixel component expression
  9045. @item c3
  9046. set fourth pixel component expression, corresponds to the alpha component
  9047. @item d
  9048. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9049. which means bit depth is automatically picked from first input format.
  9050. @end table
  9051. Each of them specifies the expression to use for computing the lookup table for
  9052. the corresponding pixel component values.
  9053. The exact component associated to each of the @var{c*} options depends on the
  9054. format in inputs.
  9055. The expressions can contain the following constants:
  9056. @table @option
  9057. @item w
  9058. @item h
  9059. The input width and height.
  9060. @item x
  9061. The first input value for the pixel component.
  9062. @item y
  9063. The second input value for the pixel component.
  9064. @item bdx
  9065. The first input video bit depth.
  9066. @item bdy
  9067. The second input video bit depth.
  9068. @end table
  9069. All expressions default to "x".
  9070. @subsection Examples
  9071. @itemize
  9072. @item
  9073. Highlight differences between two RGB video streams:
  9074. @example
  9075. 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)'
  9076. @end example
  9077. @item
  9078. Highlight differences between two YUV video streams:
  9079. @example
  9080. 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)'
  9081. @end example
  9082. @item
  9083. Show max difference between two video streams:
  9084. @example
  9085. 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)))'
  9086. @end example
  9087. @end itemize
  9088. @section maskedclamp
  9089. Clamp the first input stream with the second input and third input stream.
  9090. Returns the value of first stream to be between second input
  9091. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9092. This filter accepts the following options:
  9093. @table @option
  9094. @item undershoot
  9095. Default value is @code{0}.
  9096. @item overshoot
  9097. Default value is @code{0}.
  9098. @item planes
  9099. Set which planes will be processed as bitmap, unprocessed planes will be
  9100. copied from first stream.
  9101. By default value 0xf, all planes will be processed.
  9102. @end table
  9103. @section maskedmerge
  9104. Merge the first input stream with the second input stream using per pixel
  9105. weights in the third input stream.
  9106. A value of 0 in the third stream pixel component means that pixel component
  9107. from first stream is returned unchanged, while maximum value (eg. 255 for
  9108. 8-bit videos) means that pixel component from second stream is returned
  9109. unchanged. Intermediate values define the amount of merging between both
  9110. input stream's pixel components.
  9111. This filter accepts the following options:
  9112. @table @option
  9113. @item planes
  9114. Set which planes will be processed as bitmap, unprocessed planes will be
  9115. copied from first stream.
  9116. By default value 0xf, all planes will be processed.
  9117. @end table
  9118. @section maskfun
  9119. Create mask from input video.
  9120. For example it is useful to create motion masks after @code{tblend} filter.
  9121. This filter accepts the following options:
  9122. @table @option
  9123. @item low
  9124. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9125. @item high
  9126. Set high threshold. Any pixel component higher than this value will be set to max value
  9127. allowed for current pixel format.
  9128. @item planes
  9129. Set planes to filter, by default all available planes are filtered.
  9130. @item fill
  9131. Fill all frame pixels with this value.
  9132. @item sum
  9133. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9134. average, output frame will be completely filled with value set by @var{fill} option.
  9135. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9136. @end table
  9137. @section mcdeint
  9138. Apply motion-compensation deinterlacing.
  9139. It needs one field per frame as input and must thus be used together
  9140. with yadif=1/3 or equivalent.
  9141. This filter accepts the following options:
  9142. @table @option
  9143. @item mode
  9144. Set the deinterlacing mode.
  9145. It accepts one of the following values:
  9146. @table @samp
  9147. @item fast
  9148. @item medium
  9149. @item slow
  9150. use iterative motion estimation
  9151. @item extra_slow
  9152. like @samp{slow}, but use multiple reference frames.
  9153. @end table
  9154. Default value is @samp{fast}.
  9155. @item parity
  9156. Set the picture field parity assumed for the input video. It must be
  9157. one of the following values:
  9158. @table @samp
  9159. @item 0, tff
  9160. assume top field first
  9161. @item 1, bff
  9162. assume bottom field first
  9163. @end table
  9164. Default value is @samp{bff}.
  9165. @item qp
  9166. Set per-block quantization parameter (QP) used by the internal
  9167. encoder.
  9168. Higher values should result in a smoother motion vector field but less
  9169. optimal individual vectors. Default value is 1.
  9170. @end table
  9171. @section mergeplanes
  9172. Merge color channel components from several video streams.
  9173. The filter accepts up to 4 input streams, and merge selected input
  9174. planes to the output video.
  9175. This filter accepts the following options:
  9176. @table @option
  9177. @item mapping
  9178. Set input to output plane mapping. Default is @code{0}.
  9179. The mappings is specified as a bitmap. It should be specified as a
  9180. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9181. mapping for the first plane of the output stream. 'A' sets the number of
  9182. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9183. corresponding input to use (from 0 to 3). The rest of the mappings is
  9184. similar, 'Bb' describes the mapping for the output stream second
  9185. plane, 'Cc' describes the mapping for the output stream third plane and
  9186. 'Dd' describes the mapping for the output stream fourth plane.
  9187. @item format
  9188. Set output pixel format. Default is @code{yuva444p}.
  9189. @end table
  9190. @subsection Examples
  9191. @itemize
  9192. @item
  9193. Merge three gray video streams of same width and height into single video stream:
  9194. @example
  9195. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9196. @end example
  9197. @item
  9198. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9199. @example
  9200. [a0][a1]mergeplanes=0x00010210:yuva444p
  9201. @end example
  9202. @item
  9203. Swap Y and A plane in yuva444p stream:
  9204. @example
  9205. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9206. @end example
  9207. @item
  9208. Swap U and V plane in yuv420p stream:
  9209. @example
  9210. format=yuv420p,mergeplanes=0x000201:yuv420p
  9211. @end example
  9212. @item
  9213. Cast a rgb24 clip to yuv444p:
  9214. @example
  9215. format=rgb24,mergeplanes=0x000102:yuv444p
  9216. @end example
  9217. @end itemize
  9218. @section mestimate
  9219. Estimate and export motion vectors using block matching algorithms.
  9220. Motion vectors are stored in frame side data to be used by other filters.
  9221. This filter accepts the following options:
  9222. @table @option
  9223. @item method
  9224. Specify the motion estimation method. Accepts one of the following values:
  9225. @table @samp
  9226. @item esa
  9227. Exhaustive search algorithm.
  9228. @item tss
  9229. Three step search algorithm.
  9230. @item tdls
  9231. Two dimensional logarithmic search algorithm.
  9232. @item ntss
  9233. New three step search algorithm.
  9234. @item fss
  9235. Four step search algorithm.
  9236. @item ds
  9237. Diamond search algorithm.
  9238. @item hexbs
  9239. Hexagon-based search algorithm.
  9240. @item epzs
  9241. Enhanced predictive zonal search algorithm.
  9242. @item umh
  9243. Uneven multi-hexagon search algorithm.
  9244. @end table
  9245. Default value is @samp{esa}.
  9246. @item mb_size
  9247. Macroblock size. Default @code{16}.
  9248. @item search_param
  9249. Search parameter. Default @code{7}.
  9250. @end table
  9251. @section midequalizer
  9252. Apply Midway Image Equalization effect using two video streams.
  9253. Midway Image Equalization adjusts a pair of images to have the same
  9254. histogram, while maintaining their dynamics as much as possible. It's
  9255. useful for e.g. matching exposures from a pair of stereo cameras.
  9256. This filter has two inputs and one output, which must be of same pixel format, but
  9257. may be of different sizes. The output of filter is first input adjusted with
  9258. midway histogram of both inputs.
  9259. This filter accepts the following option:
  9260. @table @option
  9261. @item planes
  9262. Set which planes to process. Default is @code{15}, which is all available planes.
  9263. @end table
  9264. @section minterpolate
  9265. Convert the video to specified frame rate using motion interpolation.
  9266. This filter accepts the following options:
  9267. @table @option
  9268. @item fps
  9269. 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}.
  9270. @item mi_mode
  9271. Motion interpolation mode. Following values are accepted:
  9272. @table @samp
  9273. @item dup
  9274. Duplicate previous or next frame for interpolating new ones.
  9275. @item blend
  9276. Blend source frames. Interpolated frame is mean of previous and next frames.
  9277. @item mci
  9278. Motion compensated interpolation. Following options are effective when this mode is selected:
  9279. @table @samp
  9280. @item mc_mode
  9281. Motion compensation mode. Following values are accepted:
  9282. @table @samp
  9283. @item obmc
  9284. Overlapped block motion compensation.
  9285. @item aobmc
  9286. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9287. @end table
  9288. Default mode is @samp{obmc}.
  9289. @item me_mode
  9290. Motion estimation mode. Following values are accepted:
  9291. @table @samp
  9292. @item bidir
  9293. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9294. @item bilat
  9295. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9296. @end table
  9297. Default mode is @samp{bilat}.
  9298. @item me
  9299. The algorithm to be used for motion estimation. Following values are accepted:
  9300. @table @samp
  9301. @item esa
  9302. Exhaustive search algorithm.
  9303. @item tss
  9304. Three step search algorithm.
  9305. @item tdls
  9306. Two dimensional logarithmic search algorithm.
  9307. @item ntss
  9308. New three step search algorithm.
  9309. @item fss
  9310. Four step search algorithm.
  9311. @item ds
  9312. Diamond search algorithm.
  9313. @item hexbs
  9314. Hexagon-based search algorithm.
  9315. @item epzs
  9316. Enhanced predictive zonal search algorithm.
  9317. @item umh
  9318. Uneven multi-hexagon search algorithm.
  9319. @end table
  9320. Default algorithm is @samp{epzs}.
  9321. @item mb_size
  9322. Macroblock size. Default @code{16}.
  9323. @item search_param
  9324. Motion estimation search parameter. Default @code{32}.
  9325. @item vsbmc
  9326. 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).
  9327. @end table
  9328. @end table
  9329. @item scd
  9330. 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:
  9331. @table @samp
  9332. @item none
  9333. Disable scene change detection.
  9334. @item fdiff
  9335. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9336. @end table
  9337. Default method is @samp{fdiff}.
  9338. @item scd_threshold
  9339. Scene change detection threshold. Default is @code{5.0}.
  9340. @end table
  9341. @section mix
  9342. Mix several video input streams into one video stream.
  9343. A description of the accepted options follows.
  9344. @table @option
  9345. @item nb_inputs
  9346. The number of inputs. If unspecified, it defaults to 2.
  9347. @item weights
  9348. Specify weight of each input video stream as sequence.
  9349. Each weight is separated by space. If number of weights
  9350. is smaller than number of @var{frames} last specified
  9351. weight will be used for all remaining unset weights.
  9352. @item scale
  9353. Specify scale, if it is set it will be multiplied with sum
  9354. of each weight multiplied with pixel values to give final destination
  9355. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9356. @item duration
  9357. Specify how end of stream is determined.
  9358. @table @samp
  9359. @item longest
  9360. The duration of the longest input. (default)
  9361. @item shortest
  9362. The duration of the shortest input.
  9363. @item first
  9364. The duration of the first input.
  9365. @end table
  9366. @end table
  9367. @section mpdecimate
  9368. Drop frames that do not differ greatly from the previous frame in
  9369. order to reduce frame rate.
  9370. The main use of this filter is for very-low-bitrate encoding
  9371. (e.g. streaming over dialup modem), but it could in theory be used for
  9372. fixing movies that were inverse-telecined incorrectly.
  9373. A description of the accepted options follows.
  9374. @table @option
  9375. @item max
  9376. Set the maximum number of consecutive frames which can be dropped (if
  9377. positive), or the minimum interval between dropped frames (if
  9378. negative). If the value is 0, the frame is dropped disregarding the
  9379. number of previous sequentially dropped frames.
  9380. Default value is 0.
  9381. @item hi
  9382. @item lo
  9383. @item frac
  9384. Set the dropping threshold values.
  9385. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9386. represent actual pixel value differences, so a threshold of 64
  9387. corresponds to 1 unit of difference for each pixel, or the same spread
  9388. out differently over the block.
  9389. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9390. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9391. meaning the whole image) differ by more than a threshold of @option{lo}.
  9392. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9393. 64*5, and default value for @option{frac} is 0.33.
  9394. @end table
  9395. @section negate
  9396. Negate (invert) the input video.
  9397. It accepts the following option:
  9398. @table @option
  9399. @item negate_alpha
  9400. With value 1, it negates the alpha component, if present. Default value is 0.
  9401. @end table
  9402. @anchor{nlmeans}
  9403. @section nlmeans
  9404. Denoise frames using Non-Local Means algorithm.
  9405. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9406. context similarity is defined by comparing their surrounding patches of size
  9407. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9408. around the pixel.
  9409. Note that the research area defines centers for patches, which means some
  9410. patches will be made of pixels outside that research area.
  9411. The filter accepts the following options.
  9412. @table @option
  9413. @item s
  9414. Set denoising strength.
  9415. @item p
  9416. Set patch size.
  9417. @item pc
  9418. Same as @option{p} but for chroma planes.
  9419. The default value is @var{0} and means automatic.
  9420. @item r
  9421. Set research size.
  9422. @item rc
  9423. Same as @option{r} but for chroma planes.
  9424. The default value is @var{0} and means automatic.
  9425. @end table
  9426. @section nnedi
  9427. Deinterlace video using neural network edge directed interpolation.
  9428. This filter accepts the following options:
  9429. @table @option
  9430. @item weights
  9431. Mandatory option, without binary file filter can not work.
  9432. Currently file can be found here:
  9433. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9434. @item deint
  9435. Set which frames to deinterlace, by default it is @code{all}.
  9436. Can be @code{all} or @code{interlaced}.
  9437. @item field
  9438. Set mode of operation.
  9439. Can be one of the following:
  9440. @table @samp
  9441. @item af
  9442. Use frame flags, both fields.
  9443. @item a
  9444. Use frame flags, single field.
  9445. @item t
  9446. Use top field only.
  9447. @item b
  9448. Use bottom field only.
  9449. @item tf
  9450. Use both fields, top first.
  9451. @item bf
  9452. Use both fields, bottom first.
  9453. @end table
  9454. @item planes
  9455. Set which planes to process, by default filter process all frames.
  9456. @item nsize
  9457. Set size of local neighborhood around each pixel, used by the predictor neural
  9458. network.
  9459. Can be one of the following:
  9460. @table @samp
  9461. @item s8x6
  9462. @item s16x6
  9463. @item s32x6
  9464. @item s48x6
  9465. @item s8x4
  9466. @item s16x4
  9467. @item s32x4
  9468. @end table
  9469. @item nns
  9470. Set the number of neurons in predictor neural network.
  9471. Can be one of the following:
  9472. @table @samp
  9473. @item n16
  9474. @item n32
  9475. @item n64
  9476. @item n128
  9477. @item n256
  9478. @end table
  9479. @item qual
  9480. Controls the number of different neural network predictions that are blended
  9481. together to compute the final output value. Can be @code{fast}, default or
  9482. @code{slow}.
  9483. @item etype
  9484. Set which set of weights to use in the predictor.
  9485. Can be one of the following:
  9486. @table @samp
  9487. @item a
  9488. weights trained to minimize absolute error
  9489. @item s
  9490. weights trained to minimize squared error
  9491. @end table
  9492. @item pscrn
  9493. Controls whether or not the prescreener neural network is used to decide
  9494. which pixels should be processed by the predictor neural network and which
  9495. can be handled by simple cubic interpolation.
  9496. The prescreener is trained to know whether cubic interpolation will be
  9497. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9498. The computational complexity of the prescreener nn is much less than that of
  9499. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9500. using the prescreener generally results in much faster processing.
  9501. The prescreener is pretty accurate, so the difference between using it and not
  9502. using it is almost always unnoticeable.
  9503. Can be one of the following:
  9504. @table @samp
  9505. @item none
  9506. @item original
  9507. @item new
  9508. @end table
  9509. Default is @code{new}.
  9510. @item fapprox
  9511. Set various debugging flags.
  9512. @end table
  9513. @section noformat
  9514. Force libavfilter not to use any of the specified pixel formats for the
  9515. input to the next filter.
  9516. It accepts the following parameters:
  9517. @table @option
  9518. @item pix_fmts
  9519. A '|'-separated list of pixel format names, such as
  9520. pix_fmts=yuv420p|monow|rgb24".
  9521. @end table
  9522. @subsection Examples
  9523. @itemize
  9524. @item
  9525. Force libavfilter to use a format different from @var{yuv420p} for the
  9526. input to the vflip filter:
  9527. @example
  9528. noformat=pix_fmts=yuv420p,vflip
  9529. @end example
  9530. @item
  9531. Convert the input video to any of the formats not contained in the list:
  9532. @example
  9533. noformat=yuv420p|yuv444p|yuv410p
  9534. @end example
  9535. @end itemize
  9536. @section noise
  9537. Add noise on video input frame.
  9538. The filter accepts the following options:
  9539. @table @option
  9540. @item all_seed
  9541. @item c0_seed
  9542. @item c1_seed
  9543. @item c2_seed
  9544. @item c3_seed
  9545. Set noise seed for specific pixel component or all pixel components in case
  9546. of @var{all_seed}. Default value is @code{123457}.
  9547. @item all_strength, alls
  9548. @item c0_strength, c0s
  9549. @item c1_strength, c1s
  9550. @item c2_strength, c2s
  9551. @item c3_strength, c3s
  9552. Set noise strength for specific pixel component or all pixel components in case
  9553. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9554. @item all_flags, allf
  9555. @item c0_flags, c0f
  9556. @item c1_flags, c1f
  9557. @item c2_flags, c2f
  9558. @item c3_flags, c3f
  9559. Set pixel component flags or set flags for all components if @var{all_flags}.
  9560. Available values for component flags are:
  9561. @table @samp
  9562. @item a
  9563. averaged temporal noise (smoother)
  9564. @item p
  9565. mix random noise with a (semi)regular pattern
  9566. @item t
  9567. temporal noise (noise pattern changes between frames)
  9568. @item u
  9569. uniform noise (gaussian otherwise)
  9570. @end table
  9571. @end table
  9572. @subsection Examples
  9573. Add temporal and uniform noise to input video:
  9574. @example
  9575. noise=alls=20:allf=t+u
  9576. @end example
  9577. @section normalize
  9578. Normalize RGB video (aka histogram stretching, contrast stretching).
  9579. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9580. For each channel of each frame, the filter computes the input range and maps
  9581. it linearly to the user-specified output range. The output range defaults
  9582. to the full dynamic range from pure black to pure white.
  9583. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9584. changes in brightness) caused when small dark or bright objects enter or leave
  9585. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9586. video camera, and, like a video camera, it may cause a period of over- or
  9587. under-exposure of the video.
  9588. The R,G,B channels can be normalized independently, which may cause some
  9589. color shifting, or linked together as a single channel, which prevents
  9590. color shifting. Linked normalization preserves hue. Independent normalization
  9591. does not, so it can be used to remove some color casts. Independent and linked
  9592. normalization can be combined in any ratio.
  9593. The normalize filter accepts the following options:
  9594. @table @option
  9595. @item blackpt
  9596. @item whitept
  9597. Colors which define the output range. The minimum input value is mapped to
  9598. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9599. The defaults are black and white respectively. Specifying white for
  9600. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9601. normalized video. Shades of grey can be used to reduce the dynamic range
  9602. (contrast). Specifying saturated colors here can create some interesting
  9603. effects.
  9604. @item smoothing
  9605. The number of previous frames to use for temporal smoothing. The input range
  9606. of each channel is smoothed using a rolling average over the current frame
  9607. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9608. smoothing).
  9609. @item independence
  9610. Controls the ratio of independent (color shifting) channel normalization to
  9611. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9612. independent. Defaults to 1.0 (fully independent).
  9613. @item strength
  9614. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9615. expensive no-op. Defaults to 1.0 (full strength).
  9616. @end table
  9617. @subsection Examples
  9618. Stretch video contrast to use the full dynamic range, with no temporal
  9619. smoothing; may flicker depending on the source content:
  9620. @example
  9621. normalize=blackpt=black:whitept=white:smoothing=0
  9622. @end example
  9623. As above, but with 50 frames of temporal smoothing; flicker should be
  9624. reduced, depending on the source content:
  9625. @example
  9626. normalize=blackpt=black:whitept=white:smoothing=50
  9627. @end example
  9628. As above, but with hue-preserving linked channel normalization:
  9629. @example
  9630. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9631. @end example
  9632. As above, but with half strength:
  9633. @example
  9634. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9635. @end example
  9636. Map the darkest input color to red, the brightest input color to cyan:
  9637. @example
  9638. normalize=blackpt=red:whitept=cyan
  9639. @end example
  9640. @section null
  9641. Pass the video source unchanged to the output.
  9642. @section ocr
  9643. Optical Character Recognition
  9644. This filter uses Tesseract for optical character recognition. To enable
  9645. compilation of this filter, you need to configure FFmpeg with
  9646. @code{--enable-libtesseract}.
  9647. It accepts the following options:
  9648. @table @option
  9649. @item datapath
  9650. Set datapath to tesseract data. Default is to use whatever was
  9651. set at installation.
  9652. @item language
  9653. Set language, default is "eng".
  9654. @item whitelist
  9655. Set character whitelist.
  9656. @item blacklist
  9657. Set character blacklist.
  9658. @end table
  9659. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9660. @section ocv
  9661. Apply a video transform using libopencv.
  9662. To enable this filter, install the libopencv library and headers and
  9663. configure FFmpeg with @code{--enable-libopencv}.
  9664. It accepts the following parameters:
  9665. @table @option
  9666. @item filter_name
  9667. The name of the libopencv filter to apply.
  9668. @item filter_params
  9669. The parameters to pass to the libopencv filter. If not specified, the default
  9670. values are assumed.
  9671. @end table
  9672. Refer to the official libopencv documentation for more precise
  9673. information:
  9674. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9675. Several libopencv filters are supported; see the following subsections.
  9676. @anchor{dilate}
  9677. @subsection dilate
  9678. Dilate an image by using a specific structuring element.
  9679. It corresponds to the libopencv function @code{cvDilate}.
  9680. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9681. @var{struct_el} represents a structuring element, and has the syntax:
  9682. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9683. @var{cols} and @var{rows} represent the number of columns and rows of
  9684. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9685. point, and @var{shape} the shape for the structuring element. @var{shape}
  9686. must be "rect", "cross", "ellipse", or "custom".
  9687. If the value for @var{shape} is "custom", it must be followed by a
  9688. string of the form "=@var{filename}". The file with name
  9689. @var{filename} is assumed to represent a binary image, with each
  9690. printable character corresponding to a bright pixel. When a custom
  9691. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9692. or columns and rows of the read file are assumed instead.
  9693. The default value for @var{struct_el} is "3x3+0x0/rect".
  9694. @var{nb_iterations} specifies the number of times the transform is
  9695. applied to the image, and defaults to 1.
  9696. Some examples:
  9697. @example
  9698. # Use the default values
  9699. ocv=dilate
  9700. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9701. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9702. # Read the shape from the file diamond.shape, iterating two times.
  9703. # The file diamond.shape may contain a pattern of characters like this
  9704. # *
  9705. # ***
  9706. # *****
  9707. # ***
  9708. # *
  9709. # The specified columns and rows are ignored
  9710. # but the anchor point coordinates are not
  9711. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9712. @end example
  9713. @subsection erode
  9714. Erode an image by using a specific structuring element.
  9715. It corresponds to the libopencv function @code{cvErode}.
  9716. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9717. with the same syntax and semantics as the @ref{dilate} filter.
  9718. @subsection smooth
  9719. Smooth the input video.
  9720. The filter takes the following parameters:
  9721. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9722. @var{type} is the type of smooth filter to apply, and must be one of
  9723. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9724. or "bilateral". The default value is "gaussian".
  9725. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9726. depend on the smooth type. @var{param1} and
  9727. @var{param2} accept integer positive values or 0. @var{param3} and
  9728. @var{param4} accept floating point values.
  9729. The default value for @var{param1} is 3. The default value for the
  9730. other parameters is 0.
  9731. These parameters correspond to the parameters assigned to the
  9732. libopencv function @code{cvSmooth}.
  9733. @section oscilloscope
  9734. 2D Video Oscilloscope.
  9735. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9736. It accepts the following parameters:
  9737. @table @option
  9738. @item x
  9739. Set scope center x position.
  9740. @item y
  9741. Set scope center y position.
  9742. @item s
  9743. Set scope size, relative to frame diagonal.
  9744. @item t
  9745. Set scope tilt/rotation.
  9746. @item o
  9747. Set trace opacity.
  9748. @item tx
  9749. Set trace center x position.
  9750. @item ty
  9751. Set trace center y position.
  9752. @item tw
  9753. Set trace width, relative to width of frame.
  9754. @item th
  9755. Set trace height, relative to height of frame.
  9756. @item c
  9757. Set which components to trace. By default it traces first three components.
  9758. @item g
  9759. Draw trace grid. By default is enabled.
  9760. @item st
  9761. Draw some statistics. By default is enabled.
  9762. @item sc
  9763. Draw scope. By default is enabled.
  9764. @end table
  9765. @subsection Examples
  9766. @itemize
  9767. @item
  9768. Inspect full first row of video frame.
  9769. @example
  9770. oscilloscope=x=0.5:y=0:s=1
  9771. @end example
  9772. @item
  9773. Inspect full last row of video frame.
  9774. @example
  9775. oscilloscope=x=0.5:y=1:s=1
  9776. @end example
  9777. @item
  9778. Inspect full 5th line of video frame of height 1080.
  9779. @example
  9780. oscilloscope=x=0.5:y=5/1080:s=1
  9781. @end example
  9782. @item
  9783. Inspect full last column of video frame.
  9784. @example
  9785. oscilloscope=x=1:y=0.5:s=1:t=1
  9786. @end example
  9787. @end itemize
  9788. @anchor{overlay}
  9789. @section overlay
  9790. Overlay one video on top of another.
  9791. It takes two inputs and has one output. The first input is the "main"
  9792. video on which the second input is overlaid.
  9793. It accepts the following parameters:
  9794. A description of the accepted options follows.
  9795. @table @option
  9796. @item x
  9797. @item y
  9798. Set the expression for the x and y coordinates of the overlaid video
  9799. on the main video. Default value is "0" for both expressions. In case
  9800. the expression is invalid, it is set to a huge value (meaning that the
  9801. overlay will not be displayed within the output visible area).
  9802. @item eof_action
  9803. See @ref{framesync}.
  9804. @item eval
  9805. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9806. It accepts the following values:
  9807. @table @samp
  9808. @item init
  9809. only evaluate expressions once during the filter initialization or
  9810. when a command is processed
  9811. @item frame
  9812. evaluate expressions for each incoming frame
  9813. @end table
  9814. Default value is @samp{frame}.
  9815. @item shortest
  9816. See @ref{framesync}.
  9817. @item format
  9818. Set the format for the output video.
  9819. It accepts the following values:
  9820. @table @samp
  9821. @item yuv420
  9822. force YUV420 output
  9823. @item yuv422
  9824. force YUV422 output
  9825. @item yuv444
  9826. force YUV444 output
  9827. @item rgb
  9828. force packed RGB output
  9829. @item gbrp
  9830. force planar RGB output
  9831. @item auto
  9832. automatically pick format
  9833. @end table
  9834. Default value is @samp{yuv420}.
  9835. @item repeatlast
  9836. See @ref{framesync}.
  9837. @item alpha
  9838. Set format of alpha of the overlaid video, it can be @var{straight} or
  9839. @var{premultiplied}. Default is @var{straight}.
  9840. @end table
  9841. The @option{x}, and @option{y} expressions can contain the following
  9842. parameters.
  9843. @table @option
  9844. @item main_w, W
  9845. @item main_h, H
  9846. The main input width and height.
  9847. @item overlay_w, w
  9848. @item overlay_h, h
  9849. The overlay input width and height.
  9850. @item x
  9851. @item y
  9852. The computed values for @var{x} and @var{y}. They are evaluated for
  9853. each new frame.
  9854. @item hsub
  9855. @item vsub
  9856. horizontal and vertical chroma subsample values of the output
  9857. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9858. @var{vsub} is 1.
  9859. @item n
  9860. the number of input frame, starting from 0
  9861. @item pos
  9862. the position in the file of the input frame, NAN if unknown
  9863. @item t
  9864. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9865. @end table
  9866. This filter also supports the @ref{framesync} options.
  9867. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9868. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9869. when @option{eval} is set to @samp{init}.
  9870. Be aware that frames are taken from each input video in timestamp
  9871. order, hence, if their initial timestamps differ, it is a good idea
  9872. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9873. have them begin in the same zero timestamp, as the example for
  9874. the @var{movie} filter does.
  9875. You can chain together more overlays but you should test the
  9876. efficiency of such approach.
  9877. @subsection Commands
  9878. This filter supports the following commands:
  9879. @table @option
  9880. @item x
  9881. @item y
  9882. Modify the x and y of the overlay input.
  9883. The command accepts the same syntax of the corresponding option.
  9884. If the specified expression is not valid, it is kept at its current
  9885. value.
  9886. @end table
  9887. @subsection Examples
  9888. @itemize
  9889. @item
  9890. Draw the overlay at 10 pixels from the bottom right corner of the main
  9891. video:
  9892. @example
  9893. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9894. @end example
  9895. Using named options the example above becomes:
  9896. @example
  9897. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9898. @end example
  9899. @item
  9900. Insert a transparent PNG logo in the bottom left corner of the input,
  9901. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9902. @example
  9903. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9904. @end example
  9905. @item
  9906. Insert 2 different transparent PNG logos (second logo on bottom
  9907. right corner) using the @command{ffmpeg} tool:
  9908. @example
  9909. 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
  9910. @end example
  9911. @item
  9912. Add a transparent color layer on top of the main video; @code{WxH}
  9913. must specify the size of the main input to the overlay filter:
  9914. @example
  9915. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9916. @end example
  9917. @item
  9918. Play an original video and a filtered version (here with the deshake
  9919. filter) side by side using the @command{ffplay} tool:
  9920. @example
  9921. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9922. @end example
  9923. The above command is the same as:
  9924. @example
  9925. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9926. @end example
  9927. @item
  9928. Make a sliding overlay appearing from the left to the right top part of the
  9929. screen starting since time 2:
  9930. @example
  9931. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9932. @end example
  9933. @item
  9934. Compose output by putting two input videos side to side:
  9935. @example
  9936. ffmpeg -i left.avi -i right.avi -filter_complex "
  9937. nullsrc=size=200x100 [background];
  9938. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9939. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9940. [background][left] overlay=shortest=1 [background+left];
  9941. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9942. "
  9943. @end example
  9944. @item
  9945. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9946. @example
  9947. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9948. -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]'
  9949. masked.avi
  9950. @end example
  9951. @item
  9952. Chain several overlays in cascade:
  9953. @example
  9954. nullsrc=s=200x200 [bg];
  9955. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9956. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9957. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9958. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9959. [in3] null, [mid2] overlay=100:100 [out0]
  9960. @end example
  9961. @end itemize
  9962. @section owdenoise
  9963. Apply Overcomplete Wavelet denoiser.
  9964. The filter accepts the following options:
  9965. @table @option
  9966. @item depth
  9967. Set depth.
  9968. Larger depth values will denoise lower frequency components more, but
  9969. slow down filtering.
  9970. Must be an int in the range 8-16, default is @code{8}.
  9971. @item luma_strength, ls
  9972. Set luma strength.
  9973. Must be a double value in the range 0-1000, default is @code{1.0}.
  9974. @item chroma_strength, cs
  9975. Set chroma strength.
  9976. Must be a double value in the range 0-1000, default is @code{1.0}.
  9977. @end table
  9978. @anchor{pad}
  9979. @section pad
  9980. Add paddings to the input image, and place the original input at the
  9981. provided @var{x}, @var{y} coordinates.
  9982. It accepts the following parameters:
  9983. @table @option
  9984. @item width, w
  9985. @item height, h
  9986. Specify an expression for the size of the output image with the
  9987. paddings added. If the value for @var{width} or @var{height} is 0, the
  9988. corresponding input size is used for the output.
  9989. The @var{width} expression can reference the value set by the
  9990. @var{height} expression, and vice versa.
  9991. The default value of @var{width} and @var{height} is 0.
  9992. @item x
  9993. @item y
  9994. Specify the offsets to place the input image at within the padded area,
  9995. with respect to the top/left border of the output image.
  9996. The @var{x} expression can reference the value set by the @var{y}
  9997. expression, and vice versa.
  9998. The default value of @var{x} and @var{y} is 0.
  9999. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10000. so the input image is centered on the padded area.
  10001. @item color
  10002. Specify the color of the padded area. For the syntax of this option,
  10003. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10004. manual,ffmpeg-utils}.
  10005. The default value of @var{color} is "black".
  10006. @item eval
  10007. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10008. It accepts the following values:
  10009. @table @samp
  10010. @item init
  10011. Only evaluate expressions once during the filter initialization or when
  10012. a command is processed.
  10013. @item frame
  10014. Evaluate expressions for each incoming frame.
  10015. @end table
  10016. Default value is @samp{init}.
  10017. @item aspect
  10018. Pad to aspect instead to a resolution.
  10019. @end table
  10020. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10021. options are expressions containing the following constants:
  10022. @table @option
  10023. @item in_w
  10024. @item in_h
  10025. The input video width and height.
  10026. @item iw
  10027. @item ih
  10028. These are the same as @var{in_w} and @var{in_h}.
  10029. @item out_w
  10030. @item out_h
  10031. The output width and height (the size of the padded area), as
  10032. specified by the @var{width} and @var{height} expressions.
  10033. @item ow
  10034. @item oh
  10035. These are the same as @var{out_w} and @var{out_h}.
  10036. @item x
  10037. @item y
  10038. The x and y offsets as specified by the @var{x} and @var{y}
  10039. expressions, or NAN if not yet specified.
  10040. @item a
  10041. same as @var{iw} / @var{ih}
  10042. @item sar
  10043. input sample aspect ratio
  10044. @item dar
  10045. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10046. @item hsub
  10047. @item vsub
  10048. The horizontal and vertical chroma subsample values. For example for the
  10049. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10050. @end table
  10051. @subsection Examples
  10052. @itemize
  10053. @item
  10054. Add paddings with the color "violet" to the input video. The output video
  10055. size is 640x480, and the top-left corner of the input video is placed at
  10056. column 0, row 40
  10057. @example
  10058. pad=640:480:0:40:violet
  10059. @end example
  10060. The example above is equivalent to the following command:
  10061. @example
  10062. pad=width=640:height=480:x=0:y=40:color=violet
  10063. @end example
  10064. @item
  10065. Pad the input to get an output with dimensions increased by 3/2,
  10066. and put the input video at the center of the padded area:
  10067. @example
  10068. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10069. @end example
  10070. @item
  10071. Pad the input to get a squared output with size equal to the maximum
  10072. value between the input width and height, and put the input video at
  10073. the center of the padded area:
  10074. @example
  10075. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10076. @end example
  10077. @item
  10078. Pad the input to get a final w/h ratio of 16:9:
  10079. @example
  10080. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10081. @end example
  10082. @item
  10083. In case of anamorphic video, in order to set the output display aspect
  10084. correctly, it is necessary to use @var{sar} in the expression,
  10085. according to the relation:
  10086. @example
  10087. (ih * X / ih) * sar = output_dar
  10088. X = output_dar / sar
  10089. @end example
  10090. Thus the previous example needs to be modified to:
  10091. @example
  10092. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10093. @end example
  10094. @item
  10095. Double the output size and put the input video in the bottom-right
  10096. corner of the output padded area:
  10097. @example
  10098. pad="2*iw:2*ih:ow-iw:oh-ih"
  10099. @end example
  10100. @end itemize
  10101. @anchor{palettegen}
  10102. @section palettegen
  10103. Generate one palette for a whole video stream.
  10104. It accepts the following options:
  10105. @table @option
  10106. @item max_colors
  10107. Set the maximum number of colors to quantize in the palette.
  10108. Note: the palette will still contain 256 colors; the unused palette entries
  10109. will be black.
  10110. @item reserve_transparent
  10111. Create a palette of 255 colors maximum and reserve the last one for
  10112. transparency. Reserving the transparency color is useful for GIF optimization.
  10113. If not set, the maximum of colors in the palette will be 256. You probably want
  10114. to disable this option for a standalone image.
  10115. Set by default.
  10116. @item transparency_color
  10117. Set the color that will be used as background for transparency.
  10118. @item stats_mode
  10119. Set statistics mode.
  10120. It accepts the following values:
  10121. @table @samp
  10122. @item full
  10123. Compute full frame histograms.
  10124. @item diff
  10125. Compute histograms only for the part that differs from previous frame. This
  10126. might be relevant to give more importance to the moving part of your input if
  10127. the background is static.
  10128. @item single
  10129. Compute new histogram for each frame.
  10130. @end table
  10131. Default value is @var{full}.
  10132. @end table
  10133. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10134. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10135. color quantization of the palette. This information is also visible at
  10136. @var{info} logging level.
  10137. @subsection Examples
  10138. @itemize
  10139. @item
  10140. Generate a representative palette of a given video using @command{ffmpeg}:
  10141. @example
  10142. ffmpeg -i input.mkv -vf palettegen palette.png
  10143. @end example
  10144. @end itemize
  10145. @section paletteuse
  10146. Use a palette to downsample an input video stream.
  10147. The filter takes two inputs: one video stream and a palette. The palette must
  10148. be a 256 pixels image.
  10149. It accepts the following options:
  10150. @table @option
  10151. @item dither
  10152. Select dithering mode. Available algorithms are:
  10153. @table @samp
  10154. @item bayer
  10155. Ordered 8x8 bayer dithering (deterministic)
  10156. @item heckbert
  10157. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10158. Note: this dithering is sometimes considered "wrong" and is included as a
  10159. reference.
  10160. @item floyd_steinberg
  10161. Floyd and Steingberg dithering (error diffusion)
  10162. @item sierra2
  10163. Frankie Sierra dithering v2 (error diffusion)
  10164. @item sierra2_4a
  10165. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10166. @end table
  10167. Default is @var{sierra2_4a}.
  10168. @item bayer_scale
  10169. When @var{bayer} dithering is selected, this option defines the scale of the
  10170. pattern (how much the crosshatch pattern is visible). A low value means more
  10171. visible pattern for less banding, and higher value means less visible pattern
  10172. at the cost of more banding.
  10173. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10174. @item diff_mode
  10175. If set, define the zone to process
  10176. @table @samp
  10177. @item rectangle
  10178. Only the changing rectangle will be reprocessed. This is similar to GIF
  10179. cropping/offsetting compression mechanism. This option can be useful for speed
  10180. if only a part of the image is changing, and has use cases such as limiting the
  10181. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10182. moving scene (it leads to more deterministic output if the scene doesn't change
  10183. much, and as a result less moving noise and better GIF compression).
  10184. @end table
  10185. Default is @var{none}.
  10186. @item new
  10187. Take new palette for each output frame.
  10188. @item alpha_threshold
  10189. Sets the alpha threshold for transparency. Alpha values above this threshold
  10190. will be treated as completely opaque, and values below this threshold will be
  10191. treated as completely transparent.
  10192. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10193. @end table
  10194. @subsection Examples
  10195. @itemize
  10196. @item
  10197. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10198. using @command{ffmpeg}:
  10199. @example
  10200. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10201. @end example
  10202. @end itemize
  10203. @section perspective
  10204. Correct perspective of video not recorded perpendicular to the screen.
  10205. A description of the accepted parameters follows.
  10206. @table @option
  10207. @item x0
  10208. @item y0
  10209. @item x1
  10210. @item y1
  10211. @item x2
  10212. @item y2
  10213. @item x3
  10214. @item y3
  10215. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10216. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10217. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10218. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10219. then the corners of the source will be sent to the specified coordinates.
  10220. The expressions can use the following variables:
  10221. @table @option
  10222. @item W
  10223. @item H
  10224. the width and height of video frame.
  10225. @item in
  10226. Input frame count.
  10227. @item on
  10228. Output frame count.
  10229. @end table
  10230. @item interpolation
  10231. Set interpolation for perspective correction.
  10232. It accepts the following values:
  10233. @table @samp
  10234. @item linear
  10235. @item cubic
  10236. @end table
  10237. Default value is @samp{linear}.
  10238. @item sense
  10239. Set interpretation of coordinate options.
  10240. It accepts the following values:
  10241. @table @samp
  10242. @item 0, source
  10243. Send point in the source specified by the given coordinates to
  10244. the corners of the destination.
  10245. @item 1, destination
  10246. Send the corners of the source to the point in the destination specified
  10247. by the given coordinates.
  10248. Default value is @samp{source}.
  10249. @end table
  10250. @item eval
  10251. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10252. It accepts the following values:
  10253. @table @samp
  10254. @item init
  10255. only evaluate expressions once during the filter initialization or
  10256. when a command is processed
  10257. @item frame
  10258. evaluate expressions for each incoming frame
  10259. @end table
  10260. Default value is @samp{init}.
  10261. @end table
  10262. @section phase
  10263. Delay interlaced video by one field time so that the field order changes.
  10264. The intended use is to fix PAL movies that have been captured with the
  10265. opposite field order to the film-to-video transfer.
  10266. A description of the accepted parameters follows.
  10267. @table @option
  10268. @item mode
  10269. Set phase mode.
  10270. It accepts the following values:
  10271. @table @samp
  10272. @item t
  10273. Capture field order top-first, transfer bottom-first.
  10274. Filter will delay the bottom field.
  10275. @item b
  10276. Capture field order bottom-first, transfer top-first.
  10277. Filter will delay the top field.
  10278. @item p
  10279. Capture and transfer with the same field order. This mode only exists
  10280. for the documentation of the other options to refer to, but if you
  10281. actually select it, the filter will faithfully do nothing.
  10282. @item a
  10283. Capture field order determined automatically by field flags, transfer
  10284. opposite.
  10285. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10286. basis using field flags. If no field information is available,
  10287. then this works just like @samp{u}.
  10288. @item u
  10289. Capture unknown or varying, transfer opposite.
  10290. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10291. analyzing the images and selecting the alternative that produces best
  10292. match between the fields.
  10293. @item T
  10294. Capture top-first, transfer unknown or varying.
  10295. Filter selects among @samp{t} and @samp{p} using image analysis.
  10296. @item B
  10297. Capture bottom-first, transfer unknown or varying.
  10298. Filter selects among @samp{b} and @samp{p} using image analysis.
  10299. @item A
  10300. Capture determined by field flags, transfer unknown or varying.
  10301. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10302. image analysis. If no field information is available, then this works just
  10303. like @samp{U}. This is the default mode.
  10304. @item U
  10305. Both capture and transfer unknown or varying.
  10306. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10307. @end table
  10308. @end table
  10309. @section pixdesctest
  10310. Pixel format descriptor test filter, mainly useful for internal
  10311. testing. The output video should be equal to the input video.
  10312. For example:
  10313. @example
  10314. format=monow, pixdesctest
  10315. @end example
  10316. can be used to test the monowhite pixel format descriptor definition.
  10317. @section pixscope
  10318. Display sample values of color channels. Mainly useful for checking color
  10319. and levels. Minimum supported resolution is 640x480.
  10320. The filters accept the following options:
  10321. @table @option
  10322. @item x
  10323. Set scope X position, relative offset on X axis.
  10324. @item y
  10325. Set scope Y position, relative offset on Y axis.
  10326. @item w
  10327. Set scope width.
  10328. @item h
  10329. Set scope height.
  10330. @item o
  10331. Set window opacity. This window also holds statistics about pixel area.
  10332. @item wx
  10333. Set window X position, relative offset on X axis.
  10334. @item wy
  10335. Set window Y position, relative offset on Y axis.
  10336. @end table
  10337. @section pp
  10338. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10339. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10340. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10341. Each subfilter and some options have a short and a long name that can be used
  10342. interchangeably, i.e. dr/dering are the same.
  10343. The filters accept the following options:
  10344. @table @option
  10345. @item subfilters
  10346. Set postprocessing subfilters string.
  10347. @end table
  10348. All subfilters share common options to determine their scope:
  10349. @table @option
  10350. @item a/autoq
  10351. Honor the quality commands for this subfilter.
  10352. @item c/chrom
  10353. Do chrominance filtering, too (default).
  10354. @item y/nochrom
  10355. Do luminance filtering only (no chrominance).
  10356. @item n/noluma
  10357. Do chrominance filtering only (no luminance).
  10358. @end table
  10359. These options can be appended after the subfilter name, separated by a '|'.
  10360. Available subfilters are:
  10361. @table @option
  10362. @item hb/hdeblock[|difference[|flatness]]
  10363. Horizontal deblocking filter
  10364. @table @option
  10365. @item difference
  10366. Difference factor where higher values mean more deblocking (default: @code{32}).
  10367. @item flatness
  10368. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10369. @end table
  10370. @item vb/vdeblock[|difference[|flatness]]
  10371. Vertical deblocking filter
  10372. @table @option
  10373. @item difference
  10374. Difference factor where higher values mean more deblocking (default: @code{32}).
  10375. @item flatness
  10376. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10377. @end table
  10378. @item ha/hadeblock[|difference[|flatness]]
  10379. Accurate horizontal deblocking filter
  10380. @table @option
  10381. @item difference
  10382. Difference factor where higher values mean more deblocking (default: @code{32}).
  10383. @item flatness
  10384. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10385. @end table
  10386. @item va/vadeblock[|difference[|flatness]]
  10387. Accurate vertical deblocking filter
  10388. @table @option
  10389. @item difference
  10390. Difference factor where higher values mean more deblocking (default: @code{32}).
  10391. @item flatness
  10392. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10393. @end table
  10394. @end table
  10395. The horizontal and vertical deblocking filters share the difference and
  10396. flatness values so you cannot set different horizontal and vertical
  10397. thresholds.
  10398. @table @option
  10399. @item h1/x1hdeblock
  10400. Experimental horizontal deblocking filter
  10401. @item v1/x1vdeblock
  10402. Experimental vertical deblocking filter
  10403. @item dr/dering
  10404. Deringing filter
  10405. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10406. @table @option
  10407. @item threshold1
  10408. larger -> stronger filtering
  10409. @item threshold2
  10410. larger -> stronger filtering
  10411. @item threshold3
  10412. larger -> stronger filtering
  10413. @end table
  10414. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10415. @table @option
  10416. @item f/fullyrange
  10417. Stretch luminance to @code{0-255}.
  10418. @end table
  10419. @item lb/linblenddeint
  10420. Linear blend deinterlacing filter that deinterlaces the given block by
  10421. filtering all lines with a @code{(1 2 1)} filter.
  10422. @item li/linipoldeint
  10423. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10424. linearly interpolating every second line.
  10425. @item ci/cubicipoldeint
  10426. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10427. cubically interpolating every second line.
  10428. @item md/mediandeint
  10429. Median deinterlacing filter that deinterlaces the given block by applying a
  10430. median filter to every second line.
  10431. @item fd/ffmpegdeint
  10432. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10433. second line with a @code{(-1 4 2 4 -1)} filter.
  10434. @item l5/lowpass5
  10435. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10436. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10437. @item fq/forceQuant[|quantizer]
  10438. Overrides the quantizer table from the input with the constant quantizer you
  10439. specify.
  10440. @table @option
  10441. @item quantizer
  10442. Quantizer to use
  10443. @end table
  10444. @item de/default
  10445. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10446. @item fa/fast
  10447. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10448. @item ac
  10449. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10450. @end table
  10451. @subsection Examples
  10452. @itemize
  10453. @item
  10454. Apply horizontal and vertical deblocking, deringing and automatic
  10455. brightness/contrast:
  10456. @example
  10457. pp=hb/vb/dr/al
  10458. @end example
  10459. @item
  10460. Apply default filters without brightness/contrast correction:
  10461. @example
  10462. pp=de/-al
  10463. @end example
  10464. @item
  10465. Apply default filters and temporal denoiser:
  10466. @example
  10467. pp=default/tmpnoise|1|2|3
  10468. @end example
  10469. @item
  10470. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10471. automatically depending on available CPU time:
  10472. @example
  10473. pp=hb|y/vb|a
  10474. @end example
  10475. @end itemize
  10476. @section pp7
  10477. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10478. similar to spp = 6 with 7 point DCT, where only the center sample is
  10479. used after IDCT.
  10480. The filter accepts the following options:
  10481. @table @option
  10482. @item qp
  10483. Force a constant quantization parameter. It accepts an integer in range
  10484. 0 to 63. If not set, the filter will use the QP from the video stream
  10485. (if available).
  10486. @item mode
  10487. Set thresholding mode. Available modes are:
  10488. @table @samp
  10489. @item hard
  10490. Set hard thresholding.
  10491. @item soft
  10492. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10493. @item medium
  10494. Set medium thresholding (good results, default).
  10495. @end table
  10496. @end table
  10497. @section premultiply
  10498. Apply alpha premultiply effect to input video stream using first plane
  10499. of second stream as alpha.
  10500. Both streams must have same dimensions and same pixel format.
  10501. The filter accepts the following option:
  10502. @table @option
  10503. @item planes
  10504. Set which planes will be processed, unprocessed planes will be copied.
  10505. By default value 0xf, all planes will be processed.
  10506. @item inplace
  10507. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10508. @end table
  10509. @section prewitt
  10510. Apply prewitt operator to input video stream.
  10511. The filter accepts the following option:
  10512. @table @option
  10513. @item planes
  10514. Set which planes will be processed, unprocessed planes will be copied.
  10515. By default value 0xf, all planes will be processed.
  10516. @item scale
  10517. Set value which will be multiplied with filtered result.
  10518. @item delta
  10519. Set value which will be added to filtered result.
  10520. @end table
  10521. @anchor{program_opencl}
  10522. @section program_opencl
  10523. Filter video using an OpenCL program.
  10524. @table @option
  10525. @item source
  10526. OpenCL program source file.
  10527. @item kernel
  10528. Kernel name in program.
  10529. @item inputs
  10530. Number of inputs to the filter. Defaults to 1.
  10531. @item size, s
  10532. Size of output frames. Defaults to the same as the first input.
  10533. @end table
  10534. The program source file must contain a kernel function with the given name,
  10535. which will be run once for each plane of the output. Each run on a plane
  10536. gets enqueued as a separate 2D global NDRange with one work-item for each
  10537. pixel to be generated. The global ID offset for each work-item is therefore
  10538. the coordinates of a pixel in the destination image.
  10539. The kernel function needs to take the following arguments:
  10540. @itemize
  10541. @item
  10542. Destination image, @var{__write_only image2d_t}.
  10543. This image will become the output; the kernel should write all of it.
  10544. @item
  10545. Frame index, @var{unsigned int}.
  10546. This is a counter starting from zero and increasing by one for each frame.
  10547. @item
  10548. Source images, @var{__read_only image2d_t}.
  10549. These are the most recent images on each input. The kernel may read from
  10550. them to generate the output, but they can't be written to.
  10551. @end itemize
  10552. Example programs:
  10553. @itemize
  10554. @item
  10555. Copy the input to the output (output must be the same size as the input).
  10556. @verbatim
  10557. __kernel void copy(__write_only image2d_t destination,
  10558. unsigned int index,
  10559. __read_only image2d_t source)
  10560. {
  10561. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10562. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10563. float4 value = read_imagef(source, sampler, location);
  10564. write_imagef(destination, location, value);
  10565. }
  10566. @end verbatim
  10567. @item
  10568. Apply a simple transformation, rotating the input by an amount increasing
  10569. with the index counter. Pixel values are linearly interpolated by the
  10570. sampler, and the output need not have the same dimensions as the input.
  10571. @verbatim
  10572. __kernel void rotate_image(__write_only image2d_t dst,
  10573. unsigned int index,
  10574. __read_only image2d_t src)
  10575. {
  10576. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10577. CLK_FILTER_LINEAR);
  10578. float angle = (float)index / 100.0f;
  10579. float2 dst_dim = convert_float2(get_image_dim(dst));
  10580. float2 src_dim = convert_float2(get_image_dim(src));
  10581. float2 dst_cen = dst_dim / 2.0f;
  10582. float2 src_cen = src_dim / 2.0f;
  10583. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10584. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10585. float2 src_pos = {
  10586. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10587. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10588. };
  10589. src_pos = src_pos * src_dim / dst_dim;
  10590. float2 src_loc = src_pos + src_cen;
  10591. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10592. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10593. write_imagef(dst, dst_loc, 0.5f);
  10594. else
  10595. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10596. }
  10597. @end verbatim
  10598. @item
  10599. Blend two inputs together, with the amount of each input used varying
  10600. with the index counter.
  10601. @verbatim
  10602. __kernel void blend_images(__write_only image2d_t dst,
  10603. unsigned int index,
  10604. __read_only image2d_t src1,
  10605. __read_only image2d_t src2)
  10606. {
  10607. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10608. CLK_FILTER_LINEAR);
  10609. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10610. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10611. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10612. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10613. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10614. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10615. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10616. }
  10617. @end verbatim
  10618. @end itemize
  10619. @section pseudocolor
  10620. Alter frame colors in video with pseudocolors.
  10621. This filter accept the following options:
  10622. @table @option
  10623. @item c0
  10624. set pixel first component expression
  10625. @item c1
  10626. set pixel second component expression
  10627. @item c2
  10628. set pixel third component expression
  10629. @item c3
  10630. set pixel fourth component expression, corresponds to the alpha component
  10631. @item i
  10632. set component to use as base for altering colors
  10633. @end table
  10634. Each of them specifies the expression to use for computing the lookup table for
  10635. the corresponding pixel component values.
  10636. The expressions can contain the following constants and functions:
  10637. @table @option
  10638. @item w
  10639. @item h
  10640. The input width and height.
  10641. @item val
  10642. The input value for the pixel component.
  10643. @item ymin, umin, vmin, amin
  10644. The minimum allowed component value.
  10645. @item ymax, umax, vmax, amax
  10646. The maximum allowed component value.
  10647. @end table
  10648. All expressions default to "val".
  10649. @subsection Examples
  10650. @itemize
  10651. @item
  10652. Change too high luma values to gradient:
  10653. @example
  10654. 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'"
  10655. @end example
  10656. @end itemize
  10657. @section psnr
  10658. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10659. Ratio) between two input videos.
  10660. This filter takes in input two input videos, the first input is
  10661. considered the "main" source and is passed unchanged to the
  10662. output. The second input is used as a "reference" video for computing
  10663. the PSNR.
  10664. Both video inputs must have the same resolution and pixel format for
  10665. this filter to work correctly. Also it assumes that both inputs
  10666. have the same number of frames, which are compared one by one.
  10667. The obtained average PSNR is printed through the logging system.
  10668. The filter stores the accumulated MSE (mean squared error) of each
  10669. frame, and at the end of the processing it is averaged across all frames
  10670. equally, and the following formula is applied to obtain the PSNR:
  10671. @example
  10672. PSNR = 10*log10(MAX^2/MSE)
  10673. @end example
  10674. Where MAX is the average of the maximum values of each component of the
  10675. image.
  10676. The description of the accepted parameters follows.
  10677. @table @option
  10678. @item stats_file, f
  10679. If specified the filter will use the named file to save the PSNR of
  10680. each individual frame. When filename equals "-" the data is sent to
  10681. standard output.
  10682. @item stats_version
  10683. Specifies which version of the stats file format to use. Details of
  10684. each format are written below.
  10685. Default value is 1.
  10686. @item stats_add_max
  10687. Determines whether the max value is output to the stats log.
  10688. Default value is 0.
  10689. Requires stats_version >= 2. If this is set and stats_version < 2,
  10690. the filter will return an error.
  10691. @end table
  10692. This filter also supports the @ref{framesync} options.
  10693. The file printed if @var{stats_file} is selected, contains a sequence of
  10694. key/value pairs of the form @var{key}:@var{value} for each compared
  10695. couple of frames.
  10696. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10697. the list of per-frame-pair stats, with key value pairs following the frame
  10698. format with the following parameters:
  10699. @table @option
  10700. @item psnr_log_version
  10701. The version of the log file format. Will match @var{stats_version}.
  10702. @item fields
  10703. A comma separated list of the per-frame-pair parameters included in
  10704. the log.
  10705. @end table
  10706. A description of each shown per-frame-pair parameter follows:
  10707. @table @option
  10708. @item n
  10709. sequential number of the input frame, starting from 1
  10710. @item mse_avg
  10711. Mean Square Error pixel-by-pixel average difference of the compared
  10712. frames, averaged over all the image components.
  10713. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10714. Mean Square Error pixel-by-pixel average difference of the compared
  10715. frames for the component specified by the suffix.
  10716. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10717. Peak Signal to Noise ratio of the compared frames for the component
  10718. specified by the suffix.
  10719. @item max_avg, max_y, max_u, max_v
  10720. Maximum allowed value for each channel, and average over all
  10721. channels.
  10722. @end table
  10723. For example:
  10724. @example
  10725. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10726. [main][ref] psnr="stats_file=stats.log" [out]
  10727. @end example
  10728. On this example the input file being processed is compared with the
  10729. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10730. is stored in @file{stats.log}.
  10731. @anchor{pullup}
  10732. @section pullup
  10733. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10734. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10735. content.
  10736. The pullup filter is designed to take advantage of future context in making
  10737. its decisions. This filter is stateless in the sense that it does not lock
  10738. onto a pattern to follow, but it instead looks forward to the following
  10739. fields in order to identify matches and rebuild progressive frames.
  10740. To produce content with an even framerate, insert the fps filter after
  10741. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10742. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10743. The filter accepts the following options:
  10744. @table @option
  10745. @item jl
  10746. @item jr
  10747. @item jt
  10748. @item jb
  10749. These options set the amount of "junk" to ignore at the left, right, top, and
  10750. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10751. while top and bottom are in units of 2 lines.
  10752. The default is 8 pixels on each side.
  10753. @item sb
  10754. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10755. filter generating an occasional mismatched frame, but it may also cause an
  10756. excessive number of frames to be dropped during high motion sequences.
  10757. Conversely, setting it to -1 will make filter match fields more easily.
  10758. This may help processing of video where there is slight blurring between
  10759. the fields, but may also cause there to be interlaced frames in the output.
  10760. Default value is @code{0}.
  10761. @item mp
  10762. Set the metric plane to use. It accepts the following values:
  10763. @table @samp
  10764. @item l
  10765. Use luma plane.
  10766. @item u
  10767. Use chroma blue plane.
  10768. @item v
  10769. Use chroma red plane.
  10770. @end table
  10771. This option may be set to use chroma plane instead of the default luma plane
  10772. for doing filter's computations. This may improve accuracy on very clean
  10773. source material, but more likely will decrease accuracy, especially if there
  10774. is chroma noise (rainbow effect) or any grayscale video.
  10775. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10776. load and make pullup usable in realtime on slow machines.
  10777. @end table
  10778. For best results (without duplicated frames in the output file) it is
  10779. necessary to change the output frame rate. For example, to inverse
  10780. telecine NTSC input:
  10781. @example
  10782. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10783. @end example
  10784. @section qp
  10785. Change video quantization parameters (QP).
  10786. The filter accepts the following option:
  10787. @table @option
  10788. @item qp
  10789. Set expression for quantization parameter.
  10790. @end table
  10791. The expression is evaluated through the eval API and can contain, among others,
  10792. the following constants:
  10793. @table @var
  10794. @item known
  10795. 1 if index is not 129, 0 otherwise.
  10796. @item qp
  10797. Sequential index starting from -129 to 128.
  10798. @end table
  10799. @subsection Examples
  10800. @itemize
  10801. @item
  10802. Some equation like:
  10803. @example
  10804. qp=2+2*sin(PI*qp)
  10805. @end example
  10806. @end itemize
  10807. @section random
  10808. Flush video frames from internal cache of frames into a random order.
  10809. No frame is discarded.
  10810. Inspired by @ref{frei0r} nervous filter.
  10811. @table @option
  10812. @item frames
  10813. Set size in number of frames of internal cache, in range from @code{2} to
  10814. @code{512}. Default is @code{30}.
  10815. @item seed
  10816. Set seed for random number generator, must be an integer included between
  10817. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10818. less than @code{0}, the filter will try to use a good random seed on a
  10819. best effort basis.
  10820. @end table
  10821. @section readeia608
  10822. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10823. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10824. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10825. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10826. @table @option
  10827. @item lavfi.readeia608.X.cc
  10828. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10829. @item lavfi.readeia608.X.line
  10830. The number of the line on which the EIA-608 data was identified and read.
  10831. @end table
  10832. This filter accepts the following options:
  10833. @table @option
  10834. @item scan_min
  10835. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10836. @item scan_max
  10837. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10838. @item mac
  10839. Set minimal acceptable amplitude change for sync codes detection.
  10840. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10841. @item spw
  10842. Set the ratio of width reserved for sync code detection.
  10843. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10844. @item mhd
  10845. Set the max peaks height difference for sync code detection.
  10846. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10847. @item mpd
  10848. Set max peaks period difference for sync code detection.
  10849. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10850. @item msd
  10851. Set the first two max start code bits differences.
  10852. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10853. @item bhd
  10854. Set the minimum ratio of bits height compared to 3rd start code bit.
  10855. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10856. @item th_w
  10857. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10858. @item th_b
  10859. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10860. @item chp
  10861. Enable checking the parity bit. In the event of a parity error, the filter will output
  10862. @code{0x00} for that character. Default is false.
  10863. @end table
  10864. @subsection Examples
  10865. @itemize
  10866. @item
  10867. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10868. @example
  10869. 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
  10870. @end example
  10871. @end itemize
  10872. @section readvitc
  10873. Read vertical interval timecode (VITC) information from the top lines of a
  10874. video frame.
  10875. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10876. timecode value, if a valid timecode has been detected. Further metadata key
  10877. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10878. timecode data has been found or not.
  10879. This filter accepts the following options:
  10880. @table @option
  10881. @item scan_max
  10882. Set the maximum number of lines to scan for VITC data. If the value is set to
  10883. @code{-1} the full video frame is scanned. Default is @code{45}.
  10884. @item thr_b
  10885. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10886. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10887. @item thr_w
  10888. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10889. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10890. @end table
  10891. @subsection Examples
  10892. @itemize
  10893. @item
  10894. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10895. draw @code{--:--:--:--} as a placeholder:
  10896. @example
  10897. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10898. @end example
  10899. @end itemize
  10900. @section remap
  10901. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10902. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10903. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10904. value for pixel will be used for destination pixel.
  10905. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10906. will have Xmap/Ymap video stream dimensions.
  10907. Xmap and Ymap input video streams are 16bit depth, single channel.
  10908. @section removegrain
  10909. The removegrain filter is a spatial denoiser for progressive video.
  10910. @table @option
  10911. @item m0
  10912. Set mode for the first plane.
  10913. @item m1
  10914. Set mode for the second plane.
  10915. @item m2
  10916. Set mode for the third plane.
  10917. @item m3
  10918. Set mode for the fourth plane.
  10919. @end table
  10920. Range of mode is from 0 to 24. Description of each mode follows:
  10921. @table @var
  10922. @item 0
  10923. Leave input plane unchanged. Default.
  10924. @item 1
  10925. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10926. @item 2
  10927. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10928. @item 3
  10929. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10930. @item 4
  10931. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10932. This is equivalent to a median filter.
  10933. @item 5
  10934. Line-sensitive clipping giving the minimal change.
  10935. @item 6
  10936. Line-sensitive clipping, intermediate.
  10937. @item 7
  10938. Line-sensitive clipping, intermediate.
  10939. @item 8
  10940. Line-sensitive clipping, intermediate.
  10941. @item 9
  10942. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10943. @item 10
  10944. Replaces the target pixel with the closest neighbour.
  10945. @item 11
  10946. [1 2 1] horizontal and vertical kernel blur.
  10947. @item 12
  10948. Same as mode 11.
  10949. @item 13
  10950. Bob mode, interpolates top field from the line where the neighbours
  10951. pixels are the closest.
  10952. @item 14
  10953. Bob mode, interpolates bottom field from the line where the neighbours
  10954. pixels are the closest.
  10955. @item 15
  10956. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10957. interpolation formula.
  10958. @item 16
  10959. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10960. interpolation formula.
  10961. @item 17
  10962. Clips the pixel with the minimum and maximum of respectively the maximum and
  10963. minimum of each pair of opposite neighbour pixels.
  10964. @item 18
  10965. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10966. the current pixel is minimal.
  10967. @item 19
  10968. Replaces the pixel with the average of its 8 neighbours.
  10969. @item 20
  10970. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10971. @item 21
  10972. Clips pixels using the averages of opposite neighbour.
  10973. @item 22
  10974. Same as mode 21 but simpler and faster.
  10975. @item 23
  10976. Small edge and halo removal, but reputed useless.
  10977. @item 24
  10978. Similar as 23.
  10979. @end table
  10980. @section removelogo
  10981. Suppress a TV station logo, using an image file to determine which
  10982. pixels comprise the logo. It works by filling in the pixels that
  10983. comprise the logo with neighboring pixels.
  10984. The filter accepts the following options:
  10985. @table @option
  10986. @item filename, f
  10987. Set the filter bitmap file, which can be any image format supported by
  10988. libavformat. The width and height of the image file must match those of the
  10989. video stream being processed.
  10990. @end table
  10991. Pixels in the provided bitmap image with a value of zero are not
  10992. considered part of the logo, non-zero pixels are considered part of
  10993. the logo. If you use white (255) for the logo and black (0) for the
  10994. rest, you will be safe. For making the filter bitmap, it is
  10995. recommended to take a screen capture of a black frame with the logo
  10996. visible, and then using a threshold filter followed by the erode
  10997. filter once or twice.
  10998. If needed, little splotches can be fixed manually. Remember that if
  10999. logo pixels are not covered, the filter quality will be much
  11000. reduced. Marking too many pixels as part of the logo does not hurt as
  11001. much, but it will increase the amount of blurring needed to cover over
  11002. the image and will destroy more information than necessary, and extra
  11003. pixels will slow things down on a large logo.
  11004. @section repeatfields
  11005. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11006. fields based on its value.
  11007. @section reverse
  11008. Reverse a video clip.
  11009. Warning: This filter requires memory to buffer the entire clip, so trimming
  11010. is suggested.
  11011. @subsection Examples
  11012. @itemize
  11013. @item
  11014. Take the first 5 seconds of a clip, and reverse it.
  11015. @example
  11016. trim=end=5,reverse
  11017. @end example
  11018. @end itemize
  11019. @section rgbashift
  11020. Shift R/G/B/A pixels horizontally and/or vertically.
  11021. The filter accepts the following options:
  11022. @table @option
  11023. @item rh
  11024. Set amount to shift red horizontally.
  11025. @item rv
  11026. Set amount to shift red vertically.
  11027. @item gh
  11028. Set amount to shift green horizontally.
  11029. @item gv
  11030. Set amount to shift green vertically.
  11031. @item bh
  11032. Set amount to shift blue horizontally.
  11033. @item bv
  11034. Set amount to shift blue vertically.
  11035. @item ah
  11036. Set amount to shift alpha horizontally.
  11037. @item av
  11038. Set amount to shift alpha vertically.
  11039. @item edge
  11040. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11041. @end table
  11042. @section roberts
  11043. Apply roberts cross operator to input video stream.
  11044. The filter accepts the following option:
  11045. @table @option
  11046. @item planes
  11047. Set which planes will be processed, unprocessed planes will be copied.
  11048. By default value 0xf, all planes will be processed.
  11049. @item scale
  11050. Set value which will be multiplied with filtered result.
  11051. @item delta
  11052. Set value which will be added to filtered result.
  11053. @end table
  11054. @section rotate
  11055. Rotate video by an arbitrary angle expressed in radians.
  11056. The filter accepts the following options:
  11057. A description of the optional parameters follows.
  11058. @table @option
  11059. @item angle, a
  11060. Set an expression for the angle by which to rotate the input video
  11061. clockwise, expressed as a number of radians. A negative value will
  11062. result in a counter-clockwise rotation. By default it is set to "0".
  11063. This expression is evaluated for each frame.
  11064. @item out_w, ow
  11065. Set the output width expression, default value is "iw".
  11066. This expression is evaluated just once during configuration.
  11067. @item out_h, oh
  11068. Set the output height expression, default value is "ih".
  11069. This expression is evaluated just once during configuration.
  11070. @item bilinear
  11071. Enable bilinear interpolation if set to 1, a value of 0 disables
  11072. it. Default value is 1.
  11073. @item fillcolor, c
  11074. Set the color used to fill the output area not covered by the rotated
  11075. image. For the general syntax of this option, check the
  11076. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11077. If the special value "none" is selected then no
  11078. background is printed (useful for example if the background is never shown).
  11079. Default value is "black".
  11080. @end table
  11081. The expressions for the angle and the output size can contain the
  11082. following constants and functions:
  11083. @table @option
  11084. @item n
  11085. sequential number of the input frame, starting from 0. It is always NAN
  11086. before the first frame is filtered.
  11087. @item t
  11088. time in seconds of the input frame, it is set to 0 when the filter is
  11089. configured. It is always NAN before the first frame is filtered.
  11090. @item hsub
  11091. @item vsub
  11092. horizontal and vertical chroma subsample values. For example for the
  11093. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11094. @item in_w, iw
  11095. @item in_h, ih
  11096. the input video width and height
  11097. @item out_w, ow
  11098. @item out_h, oh
  11099. the output width and height, that is the size of the padded area as
  11100. specified by the @var{width} and @var{height} expressions
  11101. @item rotw(a)
  11102. @item roth(a)
  11103. the minimal width/height required for completely containing the input
  11104. video rotated by @var{a} radians.
  11105. These are only available when computing the @option{out_w} and
  11106. @option{out_h} expressions.
  11107. @end table
  11108. @subsection Examples
  11109. @itemize
  11110. @item
  11111. Rotate the input by PI/6 radians clockwise:
  11112. @example
  11113. rotate=PI/6
  11114. @end example
  11115. @item
  11116. Rotate the input by PI/6 radians counter-clockwise:
  11117. @example
  11118. rotate=-PI/6
  11119. @end example
  11120. @item
  11121. Rotate the input by 45 degrees clockwise:
  11122. @example
  11123. rotate=45*PI/180
  11124. @end example
  11125. @item
  11126. Apply a constant rotation with period T, starting from an angle of PI/3:
  11127. @example
  11128. rotate=PI/3+2*PI*t/T
  11129. @end example
  11130. @item
  11131. Make the input video rotation oscillating with a period of T
  11132. seconds and an amplitude of A radians:
  11133. @example
  11134. rotate=A*sin(2*PI/T*t)
  11135. @end example
  11136. @item
  11137. Rotate the video, output size is chosen so that the whole rotating
  11138. input video is always completely contained in the output:
  11139. @example
  11140. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11141. @end example
  11142. @item
  11143. Rotate the video, reduce the output size so that no background is ever
  11144. shown:
  11145. @example
  11146. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11147. @end example
  11148. @end itemize
  11149. @subsection Commands
  11150. The filter supports the following commands:
  11151. @table @option
  11152. @item a, angle
  11153. Set the angle expression.
  11154. The command accepts the same syntax of the corresponding option.
  11155. If the specified expression is not valid, it is kept at its current
  11156. value.
  11157. @end table
  11158. @section sab
  11159. Apply Shape Adaptive Blur.
  11160. The filter accepts the following options:
  11161. @table @option
  11162. @item luma_radius, lr
  11163. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11164. value is 1.0. A greater value will result in a more blurred image, and
  11165. in slower processing.
  11166. @item luma_pre_filter_radius, lpfr
  11167. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11168. value is 1.0.
  11169. @item luma_strength, ls
  11170. Set luma maximum difference between pixels to still be considered, must
  11171. be a value in the 0.1-100.0 range, default value is 1.0.
  11172. @item chroma_radius, cr
  11173. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11174. greater value will result in a more blurred image, and in slower
  11175. processing.
  11176. @item chroma_pre_filter_radius, cpfr
  11177. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11178. @item chroma_strength, cs
  11179. Set chroma maximum difference between pixels to still be considered,
  11180. must be a value in the -0.9-100.0 range.
  11181. @end table
  11182. Each chroma option value, if not explicitly specified, is set to the
  11183. corresponding luma option value.
  11184. @anchor{scale}
  11185. @section scale
  11186. Scale (resize) the input video, using the libswscale library.
  11187. The scale filter forces the output display aspect ratio to be the same
  11188. of the input, by changing the output sample aspect ratio.
  11189. If the input image format is different from the format requested by
  11190. the next filter, the scale filter will convert the input to the
  11191. requested format.
  11192. @subsection Options
  11193. The filter accepts the following options, or any of the options
  11194. supported by the libswscale scaler.
  11195. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11196. the complete list of scaler options.
  11197. @table @option
  11198. @item width, w
  11199. @item height, h
  11200. Set the output video dimension expression. Default value is the input
  11201. dimension.
  11202. If the @var{width} or @var{w} value is 0, the input width is used for
  11203. the output. If the @var{height} or @var{h} value is 0, the input height
  11204. is used for the output.
  11205. If one and only one of the values is -n with n >= 1, the scale filter
  11206. will use a value that maintains the aspect ratio of the input image,
  11207. calculated from the other specified dimension. After that it will,
  11208. however, make sure that the calculated dimension is divisible by n and
  11209. adjust the value if necessary.
  11210. If both values are -n with n >= 1, the behavior will be identical to
  11211. both values being set to 0 as previously detailed.
  11212. See below for the list of accepted constants for use in the dimension
  11213. expression.
  11214. @item eval
  11215. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11216. @table @samp
  11217. @item init
  11218. Only evaluate expressions once during the filter initialization or when a command is processed.
  11219. @item frame
  11220. Evaluate expressions for each incoming frame.
  11221. @end table
  11222. Default value is @samp{init}.
  11223. @item interl
  11224. Set the interlacing mode. It accepts the following values:
  11225. @table @samp
  11226. @item 1
  11227. Force interlaced aware scaling.
  11228. @item 0
  11229. Do not apply interlaced scaling.
  11230. @item -1
  11231. Select interlaced aware scaling depending on whether the source frames
  11232. are flagged as interlaced or not.
  11233. @end table
  11234. Default value is @samp{0}.
  11235. @item flags
  11236. Set libswscale scaling flags. See
  11237. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11238. complete list of values. If not explicitly specified the filter applies
  11239. the default flags.
  11240. @item param0, param1
  11241. Set libswscale input parameters for scaling algorithms that need them. See
  11242. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11243. complete documentation. If not explicitly specified the filter applies
  11244. empty parameters.
  11245. @item size, s
  11246. Set the video size. For the syntax of this option, check the
  11247. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11248. @item in_color_matrix
  11249. @item out_color_matrix
  11250. Set in/output YCbCr color space type.
  11251. This allows the autodetected value to be overridden as well as allows forcing
  11252. a specific value used for the output and encoder.
  11253. If not specified, the color space type depends on the pixel format.
  11254. Possible values:
  11255. @table @samp
  11256. @item auto
  11257. Choose automatically.
  11258. @item bt709
  11259. Format conforming to International Telecommunication Union (ITU)
  11260. Recommendation BT.709.
  11261. @item fcc
  11262. Set color space conforming to the United States Federal Communications
  11263. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11264. @item bt601
  11265. Set color space conforming to:
  11266. @itemize
  11267. @item
  11268. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11269. @item
  11270. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11271. @item
  11272. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11273. @end itemize
  11274. @item smpte240m
  11275. Set color space conforming to SMPTE ST 240:1999.
  11276. @end table
  11277. @item in_range
  11278. @item out_range
  11279. Set in/output YCbCr sample range.
  11280. This allows the autodetected value to be overridden as well as allows forcing
  11281. a specific value used for the output and encoder. If not specified, the
  11282. range depends on the pixel format. Possible values:
  11283. @table @samp
  11284. @item auto/unknown
  11285. Choose automatically.
  11286. @item jpeg/full/pc
  11287. Set full range (0-255 in case of 8-bit luma).
  11288. @item mpeg/limited/tv
  11289. Set "MPEG" range (16-235 in case of 8-bit luma).
  11290. @end table
  11291. @item force_original_aspect_ratio
  11292. Enable decreasing or increasing output video width or height if necessary to
  11293. keep the original aspect ratio. Possible values:
  11294. @table @samp
  11295. @item disable
  11296. Scale the video as specified and disable this feature.
  11297. @item decrease
  11298. The output video dimensions will automatically be decreased if needed.
  11299. @item increase
  11300. The output video dimensions will automatically be increased if needed.
  11301. @end table
  11302. One useful instance of this option is that when you know a specific device's
  11303. maximum allowed resolution, you can use this to limit the output video to
  11304. that, while retaining the aspect ratio. For example, device A allows
  11305. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11306. decrease) and specifying 1280x720 to the command line makes the output
  11307. 1280x533.
  11308. Please note that this is a different thing than specifying -1 for @option{w}
  11309. or @option{h}, you still need to specify the output resolution for this option
  11310. to work.
  11311. @end table
  11312. The values of the @option{w} and @option{h} options are expressions
  11313. containing the following constants:
  11314. @table @var
  11315. @item in_w
  11316. @item in_h
  11317. The input width and height
  11318. @item iw
  11319. @item ih
  11320. These are the same as @var{in_w} and @var{in_h}.
  11321. @item out_w
  11322. @item out_h
  11323. The output (scaled) width and height
  11324. @item ow
  11325. @item oh
  11326. These are the same as @var{out_w} and @var{out_h}
  11327. @item a
  11328. The same as @var{iw} / @var{ih}
  11329. @item sar
  11330. input sample aspect ratio
  11331. @item dar
  11332. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11333. @item hsub
  11334. @item vsub
  11335. horizontal and vertical input chroma subsample values. For example for the
  11336. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11337. @item ohsub
  11338. @item ovsub
  11339. horizontal and vertical output chroma subsample values. For example for the
  11340. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11341. @end table
  11342. @subsection Examples
  11343. @itemize
  11344. @item
  11345. Scale the input video to a size of 200x100
  11346. @example
  11347. scale=w=200:h=100
  11348. @end example
  11349. This is equivalent to:
  11350. @example
  11351. scale=200:100
  11352. @end example
  11353. or:
  11354. @example
  11355. scale=200x100
  11356. @end example
  11357. @item
  11358. Specify a size abbreviation for the output size:
  11359. @example
  11360. scale=qcif
  11361. @end example
  11362. which can also be written as:
  11363. @example
  11364. scale=size=qcif
  11365. @end example
  11366. @item
  11367. Scale the input to 2x:
  11368. @example
  11369. scale=w=2*iw:h=2*ih
  11370. @end example
  11371. @item
  11372. The above is the same as:
  11373. @example
  11374. scale=2*in_w:2*in_h
  11375. @end example
  11376. @item
  11377. Scale the input to 2x with forced interlaced scaling:
  11378. @example
  11379. scale=2*iw:2*ih:interl=1
  11380. @end example
  11381. @item
  11382. Scale the input to half size:
  11383. @example
  11384. scale=w=iw/2:h=ih/2
  11385. @end example
  11386. @item
  11387. Increase the width, and set the height to the same size:
  11388. @example
  11389. scale=3/2*iw:ow
  11390. @end example
  11391. @item
  11392. Seek Greek harmony:
  11393. @example
  11394. scale=iw:1/PHI*iw
  11395. scale=ih*PHI:ih
  11396. @end example
  11397. @item
  11398. Increase the height, and set the width to 3/2 of the height:
  11399. @example
  11400. scale=w=3/2*oh:h=3/5*ih
  11401. @end example
  11402. @item
  11403. Increase the size, making the size a multiple of the chroma
  11404. subsample values:
  11405. @example
  11406. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11407. @end example
  11408. @item
  11409. Increase the width to a maximum of 500 pixels,
  11410. keeping the same aspect ratio as the input:
  11411. @example
  11412. scale=w='min(500\, iw*3/2):h=-1'
  11413. @end example
  11414. @item
  11415. Make pixels square by combining scale and setsar:
  11416. @example
  11417. scale='trunc(ih*dar):ih',setsar=1/1
  11418. @end example
  11419. @item
  11420. Make pixels square by combining scale and setsar,
  11421. making sure the resulting resolution is even (required by some codecs):
  11422. @example
  11423. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11424. @end example
  11425. @end itemize
  11426. @subsection Commands
  11427. This filter supports the following commands:
  11428. @table @option
  11429. @item width, w
  11430. @item height, h
  11431. Set the output video dimension expression.
  11432. The command accepts the same syntax of the corresponding option.
  11433. If the specified expression is not valid, it is kept at its current
  11434. value.
  11435. @end table
  11436. @section scale_npp
  11437. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11438. format conversion on CUDA video frames. Setting the output width and height
  11439. works in the same way as for the @var{scale} filter.
  11440. The following additional options are accepted:
  11441. @table @option
  11442. @item format
  11443. The pixel format of the output CUDA frames. If set to the string "same" (the
  11444. default), the input format will be kept. Note that automatic format negotiation
  11445. and conversion is not yet supported for hardware frames
  11446. @item interp_algo
  11447. The interpolation algorithm used for resizing. One of the following:
  11448. @table @option
  11449. @item nn
  11450. Nearest neighbour.
  11451. @item linear
  11452. @item cubic
  11453. @item cubic2p_bspline
  11454. 2-parameter cubic (B=1, C=0)
  11455. @item cubic2p_catmullrom
  11456. 2-parameter cubic (B=0, C=1/2)
  11457. @item cubic2p_b05c03
  11458. 2-parameter cubic (B=1/2, C=3/10)
  11459. @item super
  11460. Supersampling
  11461. @item lanczos
  11462. @end table
  11463. @end table
  11464. @section scale2ref
  11465. Scale (resize) the input video, based on a reference video.
  11466. See the scale filter for available options, scale2ref supports the same but
  11467. uses the reference video instead of the main input as basis. scale2ref also
  11468. supports the following additional constants for the @option{w} and
  11469. @option{h} options:
  11470. @table @var
  11471. @item main_w
  11472. @item main_h
  11473. The main input video's width and height
  11474. @item main_a
  11475. The same as @var{main_w} / @var{main_h}
  11476. @item main_sar
  11477. The main input video's sample aspect ratio
  11478. @item main_dar, mdar
  11479. The main input video's display aspect ratio. Calculated from
  11480. @code{(main_w / main_h) * main_sar}.
  11481. @item main_hsub
  11482. @item main_vsub
  11483. The main input video's horizontal and vertical chroma subsample values.
  11484. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11485. is 1.
  11486. @end table
  11487. @subsection Examples
  11488. @itemize
  11489. @item
  11490. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11491. @example
  11492. 'scale2ref[b][a];[a][b]overlay'
  11493. @end example
  11494. @end itemize
  11495. @anchor{selectivecolor}
  11496. @section selectivecolor
  11497. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11498. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11499. by the "purity" of the color (that is, how saturated it already is).
  11500. This filter is similar to the Adobe Photoshop Selective Color tool.
  11501. The filter accepts the following options:
  11502. @table @option
  11503. @item correction_method
  11504. Select color correction method.
  11505. Available values are:
  11506. @table @samp
  11507. @item absolute
  11508. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11509. component value).
  11510. @item relative
  11511. Specified adjustments are relative to the original component value.
  11512. @end table
  11513. Default is @code{absolute}.
  11514. @item reds
  11515. Adjustments for red pixels (pixels where the red component is the maximum)
  11516. @item yellows
  11517. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11518. @item greens
  11519. Adjustments for green pixels (pixels where the green component is the maximum)
  11520. @item cyans
  11521. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11522. @item blues
  11523. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11524. @item magentas
  11525. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11526. @item whites
  11527. Adjustments for white pixels (pixels where all components are greater than 128)
  11528. @item neutrals
  11529. Adjustments for all pixels except pure black and pure white
  11530. @item blacks
  11531. Adjustments for black pixels (pixels where all components are lesser than 128)
  11532. @item psfile
  11533. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11534. @end table
  11535. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11536. 4 space separated floating point adjustment values in the [-1,1] range,
  11537. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11538. pixels of its range.
  11539. @subsection Examples
  11540. @itemize
  11541. @item
  11542. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11543. increase magenta by 27% in blue areas:
  11544. @example
  11545. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11546. @end example
  11547. @item
  11548. Use a Photoshop selective color preset:
  11549. @example
  11550. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11551. @end example
  11552. @end itemize
  11553. @anchor{separatefields}
  11554. @section separatefields
  11555. The @code{separatefields} takes a frame-based video input and splits
  11556. each frame into its components fields, producing a new half height clip
  11557. with twice the frame rate and twice the frame count.
  11558. This filter use field-dominance information in frame to decide which
  11559. of each pair of fields to place first in the output.
  11560. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11561. @section setdar, setsar
  11562. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11563. output video.
  11564. This is done by changing the specified Sample (aka Pixel) Aspect
  11565. Ratio, according to the following equation:
  11566. @example
  11567. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11568. @end example
  11569. Keep in mind that the @code{setdar} filter does not modify the pixel
  11570. dimensions of the video frame. Also, the display aspect ratio set by
  11571. this filter may be changed by later filters in the filterchain,
  11572. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11573. applied.
  11574. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11575. the filter output video.
  11576. Note that as a consequence of the application of this filter, the
  11577. output display aspect ratio will change according to the equation
  11578. above.
  11579. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11580. filter may be changed by later filters in the filterchain, e.g. if
  11581. another "setsar" or a "setdar" filter is applied.
  11582. It accepts the following parameters:
  11583. @table @option
  11584. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11585. Set the aspect ratio used by the filter.
  11586. The parameter can be a floating point number string, an expression, or
  11587. a string of the form @var{num}:@var{den}, where @var{num} and
  11588. @var{den} are the numerator and denominator of the aspect ratio. If
  11589. the parameter is not specified, it is assumed the value "0".
  11590. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11591. should be escaped.
  11592. @item max
  11593. Set the maximum integer value to use for expressing numerator and
  11594. denominator when reducing the expressed aspect ratio to a rational.
  11595. Default value is @code{100}.
  11596. @end table
  11597. The parameter @var{sar} is an expression containing
  11598. the following constants:
  11599. @table @option
  11600. @item E, PI, PHI
  11601. These are approximated values for the mathematical constants e
  11602. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11603. @item w, h
  11604. The input width and height.
  11605. @item a
  11606. These are the same as @var{w} / @var{h}.
  11607. @item sar
  11608. The input sample aspect ratio.
  11609. @item dar
  11610. The input display aspect ratio. It is the same as
  11611. (@var{w} / @var{h}) * @var{sar}.
  11612. @item hsub, vsub
  11613. Horizontal and vertical chroma subsample values. For example, for the
  11614. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11615. @end table
  11616. @subsection Examples
  11617. @itemize
  11618. @item
  11619. To change the display aspect ratio to 16:9, specify one of the following:
  11620. @example
  11621. setdar=dar=1.77777
  11622. setdar=dar=16/9
  11623. @end example
  11624. @item
  11625. To change the sample aspect ratio to 10:11, specify:
  11626. @example
  11627. setsar=sar=10/11
  11628. @end example
  11629. @item
  11630. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11631. 1000 in the aspect ratio reduction, use the command:
  11632. @example
  11633. setdar=ratio=16/9:max=1000
  11634. @end example
  11635. @end itemize
  11636. @anchor{setfield}
  11637. @section setfield
  11638. Force field for the output video frame.
  11639. The @code{setfield} filter marks the interlace type field for the
  11640. output frames. It does not change the input frame, but only sets the
  11641. corresponding property, which affects how the frame is treated by
  11642. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11643. The filter accepts the following options:
  11644. @table @option
  11645. @item mode
  11646. Available values are:
  11647. @table @samp
  11648. @item auto
  11649. Keep the same field property.
  11650. @item bff
  11651. Mark the frame as bottom-field-first.
  11652. @item tff
  11653. Mark the frame as top-field-first.
  11654. @item prog
  11655. Mark the frame as progressive.
  11656. @end table
  11657. @end table
  11658. @anchor{setparams}
  11659. @section setparams
  11660. Force frame parameter for the output video frame.
  11661. The @code{setparams} filter marks interlace and color range for the
  11662. output frames. It does not change the input frame, but only sets the
  11663. corresponding property, which affects how the frame is treated by
  11664. filters/encoders.
  11665. @table @option
  11666. @item field_mode
  11667. Available values are:
  11668. @table @samp
  11669. @item auto
  11670. Keep the same field property (default).
  11671. @item bff
  11672. Mark the frame as bottom-field-first.
  11673. @item tff
  11674. Mark the frame as top-field-first.
  11675. @item prog
  11676. Mark the frame as progressive.
  11677. @end table
  11678. @item range
  11679. Available values are:
  11680. @table @samp
  11681. @item auto
  11682. Keep the same color range property (default).
  11683. @item unspecified, unknown
  11684. Mark the frame as unspecified color range.
  11685. @item limited, tv, mpeg
  11686. Mark the frame as limited range.
  11687. @item full, pc, jpeg
  11688. Mark the frame as full range.
  11689. @end table
  11690. @item color_primaries
  11691. Set the color primaries.
  11692. Available values are:
  11693. @table @samp
  11694. @item auto
  11695. Keep the same color primaries property (default).
  11696. @item bt709
  11697. @item unknown
  11698. @item bt470m
  11699. @item bt470bg
  11700. @item smpte170m
  11701. @item smpte240m
  11702. @item film
  11703. @item bt2020
  11704. @item smpte428
  11705. @item smpte431
  11706. @item smpte432
  11707. @item jedec-p22
  11708. @end table
  11709. @item color_trc
  11710. Set the color transfert.
  11711. Available values are:
  11712. @table @samp
  11713. @item auto
  11714. Keep the same color trc property (default).
  11715. @item bt709
  11716. @item unknown
  11717. @item bt470m
  11718. @item bt470bg
  11719. @item smpte170m
  11720. @item smpte240m
  11721. @item linear
  11722. @item log100
  11723. @item log316
  11724. @item iec61966-2-4
  11725. @item bt1361e
  11726. @item iec61966-2-1
  11727. @item bt2020-10
  11728. @item bt2020-12
  11729. @item smpte2084
  11730. @item smpte428
  11731. @item arib-std-b67
  11732. @end table
  11733. @item colorspace
  11734. Set the colorspace.
  11735. Available values are:
  11736. @table @samp
  11737. @item auto
  11738. Keep the same colorspace property (default).
  11739. @item gbr
  11740. @item bt709
  11741. @item unknown
  11742. @item fcc
  11743. @item bt470bg
  11744. @item smpte170m
  11745. @item smpte240m
  11746. @item ycgco
  11747. @item bt2020nc
  11748. @item bt2020c
  11749. @item smpte2085
  11750. @item chroma-derived-nc
  11751. @item chroma-derived-c
  11752. @item ictcp
  11753. @end table
  11754. @end table
  11755. @section showinfo
  11756. Show a line containing various information for each input video frame.
  11757. The input video is not modified.
  11758. This filter supports the following options:
  11759. @table @option
  11760. @item checksum
  11761. Calculate checksums of each plane. By default enabled.
  11762. @end table
  11763. The shown line contains a sequence of key/value pairs of the form
  11764. @var{key}:@var{value}.
  11765. The following values are shown in the output:
  11766. @table @option
  11767. @item n
  11768. The (sequential) number of the input frame, starting from 0.
  11769. @item pts
  11770. The Presentation TimeStamp of the input frame, expressed as a number of
  11771. time base units. The time base unit depends on the filter input pad.
  11772. @item pts_time
  11773. The Presentation TimeStamp of the input frame, expressed as a number of
  11774. seconds.
  11775. @item pos
  11776. The position of the frame in the input stream, or -1 if this information is
  11777. unavailable and/or meaningless (for example in case of synthetic video).
  11778. @item fmt
  11779. The pixel format name.
  11780. @item sar
  11781. The sample aspect ratio of the input frame, expressed in the form
  11782. @var{num}/@var{den}.
  11783. @item s
  11784. The size of the input frame. For the syntax of this option, check the
  11785. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11786. @item i
  11787. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11788. for bottom field first).
  11789. @item iskey
  11790. This is 1 if the frame is a key frame, 0 otherwise.
  11791. @item type
  11792. The picture type of the input frame ("I" for an I-frame, "P" for a
  11793. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11794. Also refer to the documentation of the @code{AVPictureType} enum and of
  11795. the @code{av_get_picture_type_char} function defined in
  11796. @file{libavutil/avutil.h}.
  11797. @item checksum
  11798. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11799. @item plane_checksum
  11800. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11801. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11802. @end table
  11803. @section showpalette
  11804. Displays the 256 colors palette of each frame. This filter is only relevant for
  11805. @var{pal8} pixel format frames.
  11806. It accepts the following option:
  11807. @table @option
  11808. @item s
  11809. Set the size of the box used to represent one palette color entry. Default is
  11810. @code{30} (for a @code{30x30} pixel box).
  11811. @end table
  11812. @section shuffleframes
  11813. Reorder and/or duplicate and/or drop video frames.
  11814. It accepts the following parameters:
  11815. @table @option
  11816. @item mapping
  11817. Set the destination indexes of input frames.
  11818. This is space or '|' separated list of indexes that maps input frames to output
  11819. frames. Number of indexes also sets maximal value that each index may have.
  11820. '-1' index have special meaning and that is to drop frame.
  11821. @end table
  11822. The first frame has the index 0. The default is to keep the input unchanged.
  11823. @subsection Examples
  11824. @itemize
  11825. @item
  11826. Swap second and third frame of every three frames of the input:
  11827. @example
  11828. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11829. @end example
  11830. @item
  11831. Swap 10th and 1st frame of every ten frames of the input:
  11832. @example
  11833. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11834. @end example
  11835. @end itemize
  11836. @section shuffleplanes
  11837. Reorder and/or duplicate video planes.
  11838. It accepts the following parameters:
  11839. @table @option
  11840. @item map0
  11841. The index of the input plane to be used as the first output plane.
  11842. @item map1
  11843. The index of the input plane to be used as the second output plane.
  11844. @item map2
  11845. The index of the input plane to be used as the third output plane.
  11846. @item map3
  11847. The index of the input plane to be used as the fourth output plane.
  11848. @end table
  11849. The first plane has the index 0. The default is to keep the input unchanged.
  11850. @subsection Examples
  11851. @itemize
  11852. @item
  11853. Swap the second and third planes of the input:
  11854. @example
  11855. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11856. @end example
  11857. @end itemize
  11858. @anchor{signalstats}
  11859. @section signalstats
  11860. Evaluate various visual metrics that assist in determining issues associated
  11861. with the digitization of analog video media.
  11862. By default the filter will log these metadata values:
  11863. @table @option
  11864. @item YMIN
  11865. Display the minimal Y value contained within the input frame. Expressed in
  11866. range of [0-255].
  11867. @item YLOW
  11868. Display the Y value at the 10% percentile within the input frame. Expressed in
  11869. range of [0-255].
  11870. @item YAVG
  11871. Display the average Y value within the input frame. Expressed in range of
  11872. [0-255].
  11873. @item YHIGH
  11874. Display the Y value at the 90% percentile within the input frame. Expressed in
  11875. range of [0-255].
  11876. @item YMAX
  11877. Display the maximum Y value contained within the input frame. Expressed in
  11878. range of [0-255].
  11879. @item UMIN
  11880. Display the minimal U value contained within the input frame. Expressed in
  11881. range of [0-255].
  11882. @item ULOW
  11883. Display the U value at the 10% percentile within the input frame. Expressed in
  11884. range of [0-255].
  11885. @item UAVG
  11886. Display the average U value within the input frame. Expressed in range of
  11887. [0-255].
  11888. @item UHIGH
  11889. Display the U value at the 90% percentile within the input frame. Expressed in
  11890. range of [0-255].
  11891. @item UMAX
  11892. Display the maximum U value contained within the input frame. Expressed in
  11893. range of [0-255].
  11894. @item VMIN
  11895. Display the minimal V value contained within the input frame. Expressed in
  11896. range of [0-255].
  11897. @item VLOW
  11898. Display the V value at the 10% percentile within the input frame. Expressed in
  11899. range of [0-255].
  11900. @item VAVG
  11901. Display the average V value within the input frame. Expressed in range of
  11902. [0-255].
  11903. @item VHIGH
  11904. Display the V value at the 90% percentile within the input frame. Expressed in
  11905. range of [0-255].
  11906. @item VMAX
  11907. Display the maximum V value contained within the input frame. Expressed in
  11908. range of [0-255].
  11909. @item SATMIN
  11910. Display the minimal saturation value contained within the input frame.
  11911. Expressed in range of [0-~181.02].
  11912. @item SATLOW
  11913. Display the saturation value at the 10% percentile within the input frame.
  11914. Expressed in range of [0-~181.02].
  11915. @item SATAVG
  11916. Display the average saturation value within the input frame. Expressed in range
  11917. of [0-~181.02].
  11918. @item SATHIGH
  11919. Display the saturation value at the 90% percentile within the input frame.
  11920. Expressed in range of [0-~181.02].
  11921. @item SATMAX
  11922. Display the maximum saturation value contained within the input frame.
  11923. Expressed in range of [0-~181.02].
  11924. @item HUEMED
  11925. Display the median value for hue within the input frame. Expressed in range of
  11926. [0-360].
  11927. @item HUEAVG
  11928. Display the average value for hue within the input frame. Expressed in range of
  11929. [0-360].
  11930. @item YDIF
  11931. Display the average of sample value difference between all values of the Y
  11932. plane in the current frame and corresponding values of the previous input frame.
  11933. Expressed in range of [0-255].
  11934. @item UDIF
  11935. Display the average of sample value difference between all values of the U
  11936. plane in the current frame and corresponding values of the previous input frame.
  11937. Expressed in range of [0-255].
  11938. @item VDIF
  11939. Display the average of sample value difference between all values of the V
  11940. plane in the current frame and corresponding values of the previous input frame.
  11941. Expressed in range of [0-255].
  11942. @item YBITDEPTH
  11943. Display bit depth of Y plane in current frame.
  11944. Expressed in range of [0-16].
  11945. @item UBITDEPTH
  11946. Display bit depth of U plane in current frame.
  11947. Expressed in range of [0-16].
  11948. @item VBITDEPTH
  11949. Display bit depth of V plane in current frame.
  11950. Expressed in range of [0-16].
  11951. @end table
  11952. The filter accepts the following options:
  11953. @table @option
  11954. @item stat
  11955. @item out
  11956. @option{stat} specify an additional form of image analysis.
  11957. @option{out} output video with the specified type of pixel highlighted.
  11958. Both options accept the following values:
  11959. @table @samp
  11960. @item tout
  11961. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11962. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11963. include the results of video dropouts, head clogs, or tape tracking issues.
  11964. @item vrep
  11965. Identify @var{vertical line repetition}. Vertical line repetition includes
  11966. similar rows of pixels within a frame. In born-digital video vertical line
  11967. repetition is common, but this pattern is uncommon in video digitized from an
  11968. analog source. When it occurs in video that results from the digitization of an
  11969. analog source it can indicate concealment from a dropout compensator.
  11970. @item brng
  11971. Identify pixels that fall outside of legal broadcast range.
  11972. @end table
  11973. @item color, c
  11974. Set the highlight color for the @option{out} option. The default color is
  11975. yellow.
  11976. @end table
  11977. @subsection Examples
  11978. @itemize
  11979. @item
  11980. Output data of various video metrics:
  11981. @example
  11982. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11983. @end example
  11984. @item
  11985. Output specific data about the minimum and maximum values of the Y plane per frame:
  11986. @example
  11987. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11988. @end example
  11989. @item
  11990. Playback video while highlighting pixels that are outside of broadcast range in red.
  11991. @example
  11992. ffplay example.mov -vf signalstats="out=brng:color=red"
  11993. @end example
  11994. @item
  11995. Playback video with signalstats metadata drawn over the frame.
  11996. @example
  11997. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11998. @end example
  11999. The contents of signalstat_drawtext.txt used in the command are:
  12000. @example
  12001. time %@{pts:hms@}
  12002. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12003. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12004. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12005. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12006. @end example
  12007. @end itemize
  12008. @anchor{signature}
  12009. @section signature
  12010. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12011. input. In this case the matching between the inputs can be calculated additionally.
  12012. The filter always passes through the first input. The signature of each stream can
  12013. be written into a file.
  12014. It accepts the following options:
  12015. @table @option
  12016. @item detectmode
  12017. Enable or disable the matching process.
  12018. Available values are:
  12019. @table @samp
  12020. @item off
  12021. Disable the calculation of a matching (default).
  12022. @item full
  12023. Calculate the matching for the whole video and output whether the whole video
  12024. matches or only parts.
  12025. @item fast
  12026. Calculate only until a matching is found or the video ends. Should be faster in
  12027. some cases.
  12028. @end table
  12029. @item nb_inputs
  12030. Set the number of inputs. The option value must be a non negative integer.
  12031. Default value is 1.
  12032. @item filename
  12033. Set the path to which the output is written. If there is more than one input,
  12034. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12035. integer), that will be replaced with the input number. If no filename is
  12036. specified, no output will be written. This is the default.
  12037. @item format
  12038. Choose the output format.
  12039. Available values are:
  12040. @table @samp
  12041. @item binary
  12042. Use the specified binary representation (default).
  12043. @item xml
  12044. Use the specified xml representation.
  12045. @end table
  12046. @item th_d
  12047. Set threshold to detect one word as similar. The option value must be an integer
  12048. greater than zero. The default value is 9000.
  12049. @item th_dc
  12050. Set threshold to detect all words as similar. The option value must be an integer
  12051. greater than zero. The default value is 60000.
  12052. @item th_xh
  12053. Set threshold to detect frames as similar. The option value must be an integer
  12054. greater than zero. The default value is 116.
  12055. @item th_di
  12056. Set the minimum length of a sequence in frames to recognize it as matching
  12057. sequence. The option value must be a non negative integer value.
  12058. The default value is 0.
  12059. @item th_it
  12060. Set the minimum relation, that matching frames to all frames must have.
  12061. The option value must be a double value between 0 and 1. The default value is 0.5.
  12062. @end table
  12063. @subsection Examples
  12064. @itemize
  12065. @item
  12066. To calculate the signature of an input video and store it in signature.bin:
  12067. @example
  12068. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12069. @end example
  12070. @item
  12071. To detect whether two videos match and store the signatures in XML format in
  12072. signature0.xml and signature1.xml:
  12073. @example
  12074. 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 -
  12075. @end example
  12076. @end itemize
  12077. @anchor{smartblur}
  12078. @section smartblur
  12079. Blur the input video without impacting the outlines.
  12080. It accepts the following options:
  12081. @table @option
  12082. @item luma_radius, lr
  12083. Set the luma radius. The option value must be a float number in
  12084. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12085. used to blur the image (slower if larger). Default value is 1.0.
  12086. @item luma_strength, ls
  12087. Set the luma strength. The option value must be a float number
  12088. in the range [-1.0,1.0] that configures the blurring. A value included
  12089. in [0.0,1.0] will blur the image whereas a value included in
  12090. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12091. @item luma_threshold, lt
  12092. Set the luma threshold used as a coefficient to determine
  12093. whether a pixel should be blurred or not. The option value must be an
  12094. integer in the range [-30,30]. A value of 0 will filter all the image,
  12095. a value included in [0,30] will filter flat areas and a value included
  12096. in [-30,0] will filter edges. Default value is 0.
  12097. @item chroma_radius, cr
  12098. Set the chroma radius. The option value must be a float number in
  12099. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12100. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12101. @item chroma_strength, cs
  12102. Set the chroma strength. The option value must be a float number
  12103. in the range [-1.0,1.0] that configures the blurring. A value included
  12104. in [0.0,1.0] will blur the image whereas a value included in
  12105. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12106. @item chroma_threshold, ct
  12107. Set the chroma threshold used as a coefficient to determine
  12108. whether a pixel should be blurred or not. The option value must be an
  12109. integer in the range [-30,30]. A value of 0 will filter all the image,
  12110. a value included in [0,30] will filter flat areas and a value included
  12111. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12112. @end table
  12113. If a chroma option is not explicitly set, the corresponding luma value
  12114. is set.
  12115. @section ssim
  12116. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12117. This filter takes in input two input videos, the first input is
  12118. considered the "main" source and is passed unchanged to the
  12119. output. The second input is used as a "reference" video for computing
  12120. the SSIM.
  12121. Both video inputs must have the same resolution and pixel format for
  12122. this filter to work correctly. Also it assumes that both inputs
  12123. have the same number of frames, which are compared one by one.
  12124. The filter stores the calculated SSIM of each frame.
  12125. The description of the accepted parameters follows.
  12126. @table @option
  12127. @item stats_file, f
  12128. If specified the filter will use the named file to save the SSIM of
  12129. each individual frame. When filename equals "-" the data is sent to
  12130. standard output.
  12131. @end table
  12132. The file printed if @var{stats_file} is selected, contains a sequence of
  12133. key/value pairs of the form @var{key}:@var{value} for each compared
  12134. couple of frames.
  12135. A description of each shown parameter follows:
  12136. @table @option
  12137. @item n
  12138. sequential number of the input frame, starting from 1
  12139. @item Y, U, V, R, G, B
  12140. SSIM of the compared frames for the component specified by the suffix.
  12141. @item All
  12142. SSIM of the compared frames for the whole frame.
  12143. @item dB
  12144. Same as above but in dB representation.
  12145. @end table
  12146. This filter also supports the @ref{framesync} options.
  12147. For example:
  12148. @example
  12149. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12150. [main][ref] ssim="stats_file=stats.log" [out]
  12151. @end example
  12152. On this example the input file being processed is compared with the
  12153. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12154. is stored in @file{stats.log}.
  12155. Another example with both psnr and ssim at same time:
  12156. @example
  12157. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12158. @end example
  12159. @section stereo3d
  12160. Convert between different stereoscopic image formats.
  12161. The filters accept the following options:
  12162. @table @option
  12163. @item in
  12164. Set stereoscopic image format of input.
  12165. Available values for input image formats are:
  12166. @table @samp
  12167. @item sbsl
  12168. side by side parallel (left eye left, right eye right)
  12169. @item sbsr
  12170. side by side crosseye (right eye left, left eye right)
  12171. @item sbs2l
  12172. side by side parallel with half width resolution
  12173. (left eye left, right eye right)
  12174. @item sbs2r
  12175. side by side crosseye with half width resolution
  12176. (right eye left, left eye right)
  12177. @item abl
  12178. above-below (left eye above, right eye below)
  12179. @item abr
  12180. above-below (right eye above, left eye below)
  12181. @item ab2l
  12182. above-below with half height resolution
  12183. (left eye above, right eye below)
  12184. @item ab2r
  12185. above-below with half height resolution
  12186. (right eye above, left eye below)
  12187. @item al
  12188. alternating frames (left eye first, right eye second)
  12189. @item ar
  12190. alternating frames (right eye first, left eye second)
  12191. @item irl
  12192. interleaved rows (left eye has top row, right eye starts on next row)
  12193. @item irr
  12194. interleaved rows (right eye has top row, left eye starts on next row)
  12195. @item icl
  12196. interleaved columns, left eye first
  12197. @item icr
  12198. interleaved columns, right eye first
  12199. Default value is @samp{sbsl}.
  12200. @end table
  12201. @item out
  12202. Set stereoscopic image format of output.
  12203. @table @samp
  12204. @item sbsl
  12205. side by side parallel (left eye left, right eye right)
  12206. @item sbsr
  12207. side by side crosseye (right eye left, left eye right)
  12208. @item sbs2l
  12209. side by side parallel with half width resolution
  12210. (left eye left, right eye right)
  12211. @item sbs2r
  12212. side by side crosseye with half width resolution
  12213. (right eye left, left eye right)
  12214. @item abl
  12215. above-below (left eye above, right eye below)
  12216. @item abr
  12217. above-below (right eye above, left eye below)
  12218. @item ab2l
  12219. above-below with half height resolution
  12220. (left eye above, right eye below)
  12221. @item ab2r
  12222. above-below with half height resolution
  12223. (right eye above, left eye below)
  12224. @item al
  12225. alternating frames (left eye first, right eye second)
  12226. @item ar
  12227. alternating frames (right eye first, left eye second)
  12228. @item irl
  12229. interleaved rows (left eye has top row, right eye starts on next row)
  12230. @item irr
  12231. interleaved rows (right eye has top row, left eye starts on next row)
  12232. @item arbg
  12233. anaglyph red/blue gray
  12234. (red filter on left eye, blue filter on right eye)
  12235. @item argg
  12236. anaglyph red/green gray
  12237. (red filter on left eye, green filter on right eye)
  12238. @item arcg
  12239. anaglyph red/cyan gray
  12240. (red filter on left eye, cyan filter on right eye)
  12241. @item arch
  12242. anaglyph red/cyan half colored
  12243. (red filter on left eye, cyan filter on right eye)
  12244. @item arcc
  12245. anaglyph red/cyan color
  12246. (red filter on left eye, cyan filter on right eye)
  12247. @item arcd
  12248. anaglyph red/cyan color optimized with the least squares projection of dubois
  12249. (red filter on left eye, cyan filter on right eye)
  12250. @item agmg
  12251. anaglyph green/magenta gray
  12252. (green filter on left eye, magenta filter on right eye)
  12253. @item agmh
  12254. anaglyph green/magenta half colored
  12255. (green filter on left eye, magenta filter on right eye)
  12256. @item agmc
  12257. anaglyph green/magenta colored
  12258. (green filter on left eye, magenta filter on right eye)
  12259. @item agmd
  12260. anaglyph green/magenta color optimized with the least squares projection of dubois
  12261. (green filter on left eye, magenta filter on right eye)
  12262. @item aybg
  12263. anaglyph yellow/blue gray
  12264. (yellow filter on left eye, blue filter on right eye)
  12265. @item aybh
  12266. anaglyph yellow/blue half colored
  12267. (yellow filter on left eye, blue filter on right eye)
  12268. @item aybc
  12269. anaglyph yellow/blue colored
  12270. (yellow filter on left eye, blue filter on right eye)
  12271. @item aybd
  12272. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12273. (yellow filter on left eye, blue filter on right eye)
  12274. @item ml
  12275. mono output (left eye only)
  12276. @item mr
  12277. mono output (right eye only)
  12278. @item chl
  12279. checkerboard, left eye first
  12280. @item chr
  12281. checkerboard, right eye first
  12282. @item icl
  12283. interleaved columns, left eye first
  12284. @item icr
  12285. interleaved columns, right eye first
  12286. @item hdmi
  12287. HDMI frame pack
  12288. @end table
  12289. Default value is @samp{arcd}.
  12290. @end table
  12291. @subsection Examples
  12292. @itemize
  12293. @item
  12294. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12295. @example
  12296. stereo3d=sbsl:aybd
  12297. @end example
  12298. @item
  12299. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12300. @example
  12301. stereo3d=abl:sbsr
  12302. @end example
  12303. @end itemize
  12304. @section streamselect, astreamselect
  12305. Select video or audio streams.
  12306. The filter accepts the following options:
  12307. @table @option
  12308. @item inputs
  12309. Set number of inputs. Default is 2.
  12310. @item map
  12311. Set input indexes to remap to outputs.
  12312. @end table
  12313. @subsection Commands
  12314. The @code{streamselect} and @code{astreamselect} filter supports the following
  12315. commands:
  12316. @table @option
  12317. @item map
  12318. Set input indexes to remap to outputs.
  12319. @end table
  12320. @subsection Examples
  12321. @itemize
  12322. @item
  12323. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12324. @example
  12325. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12326. @end example
  12327. @item
  12328. Same as above, but for audio:
  12329. @example
  12330. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12331. @end example
  12332. @end itemize
  12333. @section sobel
  12334. Apply sobel operator to input video stream.
  12335. The filter accepts the following option:
  12336. @table @option
  12337. @item planes
  12338. Set which planes will be processed, unprocessed planes will be copied.
  12339. By default value 0xf, all planes will be processed.
  12340. @item scale
  12341. Set value which will be multiplied with filtered result.
  12342. @item delta
  12343. Set value which will be added to filtered result.
  12344. @end table
  12345. @anchor{spp}
  12346. @section spp
  12347. Apply a simple postprocessing filter that compresses and decompresses the image
  12348. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12349. and average the results.
  12350. The filter accepts the following options:
  12351. @table @option
  12352. @item quality
  12353. Set quality. This option defines the number of levels for averaging. It accepts
  12354. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12355. effect. A value of @code{6} means the higher quality. For each increment of
  12356. that value the speed drops by a factor of approximately 2. Default value is
  12357. @code{3}.
  12358. @item qp
  12359. Force a constant quantization parameter. If not set, the filter will use the QP
  12360. from the video stream (if available).
  12361. @item mode
  12362. Set thresholding mode. Available modes are:
  12363. @table @samp
  12364. @item hard
  12365. Set hard thresholding (default).
  12366. @item soft
  12367. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12368. @end table
  12369. @item use_bframe_qp
  12370. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12371. option may cause flicker since the B-Frames have often larger QP. Default is
  12372. @code{0} (not enabled).
  12373. @end table
  12374. @section sr
  12375. Scale the input by applying one of the super-resolution methods based on
  12376. convolutional neural networks. Supported models:
  12377. @itemize
  12378. @item
  12379. Super-Resolution Convolutional Neural Network model (SRCNN).
  12380. See @url{https://arxiv.org/abs/1501.00092}.
  12381. @item
  12382. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12383. See @url{https://arxiv.org/abs/1609.05158}.
  12384. @end itemize
  12385. Training scripts as well as scripts for model generation are provided in
  12386. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12387. The filter accepts the following options:
  12388. @table @option
  12389. @item dnn_backend
  12390. Specify which DNN backend to use for model loading and execution. This option accepts
  12391. the following values:
  12392. @table @samp
  12393. @item native
  12394. Native implementation of DNN loading and execution.
  12395. @item tensorflow
  12396. TensorFlow backend. To enable this backend you
  12397. need to install the TensorFlow for C library (see
  12398. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12399. @code{--enable-libtensorflow}
  12400. @end table
  12401. Default value is @samp{native}.
  12402. @item model
  12403. Set path to model file specifying network architecture and its parameters.
  12404. Note that different backends use different file formats. TensorFlow backend
  12405. can load files for both formats, while native backend can load files for only
  12406. its format.
  12407. @item scale_factor
  12408. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12409. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12410. input upscaled using bicubic upscaling with proper scale factor.
  12411. @end table
  12412. @anchor{subtitles}
  12413. @section subtitles
  12414. Draw subtitles on top of input video using the libass library.
  12415. To enable compilation of this filter you need to configure FFmpeg with
  12416. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12417. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12418. Alpha) subtitles format.
  12419. The filter accepts the following options:
  12420. @table @option
  12421. @item filename, f
  12422. Set the filename of the subtitle file to read. It must be specified.
  12423. @item original_size
  12424. Specify the size of the original video, the video for which the ASS file
  12425. was composed. For the syntax of this option, check the
  12426. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12427. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12428. correctly scale the fonts if the aspect ratio has been changed.
  12429. @item fontsdir
  12430. Set a directory path containing fonts that can be used by the filter.
  12431. These fonts will be used in addition to whatever the font provider uses.
  12432. @item alpha
  12433. Process alpha channel, by default alpha channel is untouched.
  12434. @item charenc
  12435. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12436. useful if not UTF-8.
  12437. @item stream_index, si
  12438. Set subtitles stream index. @code{subtitles} filter only.
  12439. @item force_style
  12440. Override default style or script info parameters of the subtitles. It accepts a
  12441. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12442. @end table
  12443. If the first key is not specified, it is assumed that the first value
  12444. specifies the @option{filename}.
  12445. For example, to render the file @file{sub.srt} on top of the input
  12446. video, use the command:
  12447. @example
  12448. subtitles=sub.srt
  12449. @end example
  12450. which is equivalent to:
  12451. @example
  12452. subtitles=filename=sub.srt
  12453. @end example
  12454. To render the default subtitles stream from file @file{video.mkv}, use:
  12455. @example
  12456. subtitles=video.mkv
  12457. @end example
  12458. To render the second subtitles stream from that file, use:
  12459. @example
  12460. subtitles=video.mkv:si=1
  12461. @end example
  12462. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12463. @code{DejaVu Serif}, use:
  12464. @example
  12465. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12466. @end example
  12467. @section super2xsai
  12468. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12469. Interpolate) pixel art scaling algorithm.
  12470. Useful for enlarging pixel art images without reducing sharpness.
  12471. @section swaprect
  12472. Swap two rectangular objects in video.
  12473. This filter accepts the following options:
  12474. @table @option
  12475. @item w
  12476. Set object width.
  12477. @item h
  12478. Set object height.
  12479. @item x1
  12480. Set 1st rect x coordinate.
  12481. @item y1
  12482. Set 1st rect y coordinate.
  12483. @item x2
  12484. Set 2nd rect x coordinate.
  12485. @item y2
  12486. Set 2nd rect y coordinate.
  12487. All expressions are evaluated once for each frame.
  12488. @end table
  12489. The all options are expressions containing the following constants:
  12490. @table @option
  12491. @item w
  12492. @item h
  12493. The input width and height.
  12494. @item a
  12495. same as @var{w} / @var{h}
  12496. @item sar
  12497. input sample aspect ratio
  12498. @item dar
  12499. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12500. @item n
  12501. The number of the input frame, starting from 0.
  12502. @item t
  12503. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12504. @item pos
  12505. the position in the file of the input frame, NAN if unknown
  12506. @end table
  12507. @section swapuv
  12508. Swap U & V plane.
  12509. @section telecine
  12510. Apply telecine process to the video.
  12511. This filter accepts the following options:
  12512. @table @option
  12513. @item first_field
  12514. @table @samp
  12515. @item top, t
  12516. top field first
  12517. @item bottom, b
  12518. bottom field first
  12519. The default value is @code{top}.
  12520. @end table
  12521. @item pattern
  12522. A string of numbers representing the pulldown pattern you wish to apply.
  12523. The default value is @code{23}.
  12524. @end table
  12525. @example
  12526. Some typical patterns:
  12527. NTSC output (30i):
  12528. 27.5p: 32222
  12529. 24p: 23 (classic)
  12530. 24p: 2332 (preferred)
  12531. 20p: 33
  12532. 18p: 334
  12533. 16p: 3444
  12534. PAL output (25i):
  12535. 27.5p: 12222
  12536. 24p: 222222222223 ("Euro pulldown")
  12537. 16.67p: 33
  12538. 16p: 33333334
  12539. @end example
  12540. @section threshold
  12541. Apply threshold effect to video stream.
  12542. This filter needs four video streams to perform thresholding.
  12543. First stream is stream we are filtering.
  12544. Second stream is holding threshold values, third stream is holding min values,
  12545. and last, fourth stream is holding max values.
  12546. The filter accepts the following option:
  12547. @table @option
  12548. @item planes
  12549. Set which planes will be processed, unprocessed planes will be copied.
  12550. By default value 0xf, all planes will be processed.
  12551. @end table
  12552. For example if first stream pixel's component value is less then threshold value
  12553. of pixel component from 2nd threshold stream, third stream value will picked,
  12554. otherwise fourth stream pixel component value will be picked.
  12555. Using color source filter one can perform various types of thresholding:
  12556. @subsection Examples
  12557. @itemize
  12558. @item
  12559. Binary threshold, using gray color as threshold:
  12560. @example
  12561. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12562. @end example
  12563. @item
  12564. Inverted binary threshold, using gray color as threshold:
  12565. @example
  12566. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12567. @end example
  12568. @item
  12569. Truncate binary threshold, using gray color as threshold:
  12570. @example
  12571. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12572. @end example
  12573. @item
  12574. Threshold to zero, using gray color as threshold:
  12575. @example
  12576. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12577. @end example
  12578. @item
  12579. Inverted threshold to zero, using gray color as threshold:
  12580. @example
  12581. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12582. @end example
  12583. @end itemize
  12584. @section thumbnail
  12585. Select the most representative frame in a given sequence of consecutive frames.
  12586. The filter accepts the following options:
  12587. @table @option
  12588. @item n
  12589. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12590. will pick one of them, and then handle the next batch of @var{n} frames until
  12591. the end. Default is @code{100}.
  12592. @end table
  12593. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12594. value will result in a higher memory usage, so a high value is not recommended.
  12595. @subsection Examples
  12596. @itemize
  12597. @item
  12598. Extract one picture each 50 frames:
  12599. @example
  12600. thumbnail=50
  12601. @end example
  12602. @item
  12603. Complete example of a thumbnail creation with @command{ffmpeg}:
  12604. @example
  12605. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12606. @end example
  12607. @end itemize
  12608. @section tile
  12609. Tile several successive frames together.
  12610. The filter accepts the following options:
  12611. @table @option
  12612. @item layout
  12613. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12614. this option, check the
  12615. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12616. @item nb_frames
  12617. Set the maximum number of frames to render in the given area. It must be less
  12618. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12619. the area will be used.
  12620. @item margin
  12621. Set the outer border margin in pixels.
  12622. @item padding
  12623. Set the inner border thickness (i.e. the number of pixels between frames). For
  12624. more advanced padding options (such as having different values for the edges),
  12625. refer to the pad video filter.
  12626. @item color
  12627. Specify the color of the unused area. For the syntax of this option, check the
  12628. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12629. The default value of @var{color} is "black".
  12630. @item overlap
  12631. Set the number of frames to overlap when tiling several successive frames together.
  12632. The value must be between @code{0} and @var{nb_frames - 1}.
  12633. @item init_padding
  12634. Set the number of frames to initially be empty before displaying first output frame.
  12635. This controls how soon will one get first output frame.
  12636. The value must be between @code{0} and @var{nb_frames - 1}.
  12637. @end table
  12638. @subsection Examples
  12639. @itemize
  12640. @item
  12641. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12642. @example
  12643. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12644. @end example
  12645. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12646. duplicating each output frame to accommodate the originally detected frame
  12647. rate.
  12648. @item
  12649. Display @code{5} pictures in an area of @code{3x2} frames,
  12650. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12651. mixed flat and named options:
  12652. @example
  12653. tile=3x2:nb_frames=5:padding=7:margin=2
  12654. @end example
  12655. @end itemize
  12656. @section tinterlace
  12657. Perform various types of temporal field interlacing.
  12658. Frames are counted starting from 1, so the first input frame is
  12659. considered odd.
  12660. The filter accepts the following options:
  12661. @table @option
  12662. @item mode
  12663. Specify the mode of the interlacing. This option can also be specified
  12664. as a value alone. See below for a list of values for this option.
  12665. Available values are:
  12666. @table @samp
  12667. @item merge, 0
  12668. Move odd frames into the upper field, even into the lower field,
  12669. generating a double height frame at half frame rate.
  12670. @example
  12671. ------> time
  12672. Input:
  12673. Frame 1 Frame 2 Frame 3 Frame 4
  12674. 11111 22222 33333 44444
  12675. 11111 22222 33333 44444
  12676. 11111 22222 33333 44444
  12677. 11111 22222 33333 44444
  12678. Output:
  12679. 11111 33333
  12680. 22222 44444
  12681. 11111 33333
  12682. 22222 44444
  12683. 11111 33333
  12684. 22222 44444
  12685. 11111 33333
  12686. 22222 44444
  12687. @end example
  12688. @item drop_even, 1
  12689. Only output odd frames, even frames are dropped, generating a frame with
  12690. unchanged height at half frame rate.
  12691. @example
  12692. ------> time
  12693. Input:
  12694. Frame 1 Frame 2 Frame 3 Frame 4
  12695. 11111 22222 33333 44444
  12696. 11111 22222 33333 44444
  12697. 11111 22222 33333 44444
  12698. 11111 22222 33333 44444
  12699. Output:
  12700. 11111 33333
  12701. 11111 33333
  12702. 11111 33333
  12703. 11111 33333
  12704. @end example
  12705. @item drop_odd, 2
  12706. Only output even frames, odd frames are dropped, generating a frame with
  12707. unchanged height at half frame rate.
  12708. @example
  12709. ------> time
  12710. Input:
  12711. Frame 1 Frame 2 Frame 3 Frame 4
  12712. 11111 22222 33333 44444
  12713. 11111 22222 33333 44444
  12714. 11111 22222 33333 44444
  12715. 11111 22222 33333 44444
  12716. Output:
  12717. 22222 44444
  12718. 22222 44444
  12719. 22222 44444
  12720. 22222 44444
  12721. @end example
  12722. @item pad, 3
  12723. Expand each frame to full height, but pad alternate lines with black,
  12724. generating a frame with double height at the same input frame rate.
  12725. @example
  12726. ------> time
  12727. Input:
  12728. Frame 1 Frame 2 Frame 3 Frame 4
  12729. 11111 22222 33333 44444
  12730. 11111 22222 33333 44444
  12731. 11111 22222 33333 44444
  12732. 11111 22222 33333 44444
  12733. Output:
  12734. 11111 ..... 33333 .....
  12735. ..... 22222 ..... 44444
  12736. 11111 ..... 33333 .....
  12737. ..... 22222 ..... 44444
  12738. 11111 ..... 33333 .....
  12739. ..... 22222 ..... 44444
  12740. 11111 ..... 33333 .....
  12741. ..... 22222 ..... 44444
  12742. @end example
  12743. @item interleave_top, 4
  12744. Interleave the upper field from odd frames with the lower field from
  12745. even frames, generating a frame with unchanged height at half frame rate.
  12746. @example
  12747. ------> time
  12748. Input:
  12749. Frame 1 Frame 2 Frame 3 Frame 4
  12750. 11111<- 22222 33333<- 44444
  12751. 11111 22222<- 33333 44444<-
  12752. 11111<- 22222 33333<- 44444
  12753. 11111 22222<- 33333 44444<-
  12754. Output:
  12755. 11111 33333
  12756. 22222 44444
  12757. 11111 33333
  12758. 22222 44444
  12759. @end example
  12760. @item interleave_bottom, 5
  12761. Interleave the lower field from odd frames with the upper field from
  12762. even frames, generating a frame with unchanged height at half frame rate.
  12763. @example
  12764. ------> time
  12765. Input:
  12766. Frame 1 Frame 2 Frame 3 Frame 4
  12767. 11111 22222<- 33333 44444<-
  12768. 11111<- 22222 33333<- 44444
  12769. 11111 22222<- 33333 44444<-
  12770. 11111<- 22222 33333<- 44444
  12771. Output:
  12772. 22222 44444
  12773. 11111 33333
  12774. 22222 44444
  12775. 11111 33333
  12776. @end example
  12777. @item interlacex2, 6
  12778. Double frame rate with unchanged height. Frames are inserted each
  12779. containing the second temporal field from the previous input frame and
  12780. the first temporal field from the next input frame. This mode relies on
  12781. the top_field_first flag. Useful for interlaced video displays with no
  12782. field synchronisation.
  12783. @example
  12784. ------> time
  12785. Input:
  12786. Frame 1 Frame 2 Frame 3 Frame 4
  12787. 11111 22222 33333 44444
  12788. 11111 22222 33333 44444
  12789. 11111 22222 33333 44444
  12790. 11111 22222 33333 44444
  12791. Output:
  12792. 11111 22222 22222 33333 33333 44444 44444
  12793. 11111 11111 22222 22222 33333 33333 44444
  12794. 11111 22222 22222 33333 33333 44444 44444
  12795. 11111 11111 22222 22222 33333 33333 44444
  12796. @end example
  12797. @item mergex2, 7
  12798. Move odd frames into the upper field, even into the lower field,
  12799. generating a double height frame at same frame rate.
  12800. @example
  12801. ------> time
  12802. Input:
  12803. Frame 1 Frame 2 Frame 3 Frame 4
  12804. 11111 22222 33333 44444
  12805. 11111 22222 33333 44444
  12806. 11111 22222 33333 44444
  12807. 11111 22222 33333 44444
  12808. Output:
  12809. 11111 33333 33333 55555
  12810. 22222 22222 44444 44444
  12811. 11111 33333 33333 55555
  12812. 22222 22222 44444 44444
  12813. 11111 33333 33333 55555
  12814. 22222 22222 44444 44444
  12815. 11111 33333 33333 55555
  12816. 22222 22222 44444 44444
  12817. @end example
  12818. @end table
  12819. Numeric values are deprecated but are accepted for backward
  12820. compatibility reasons.
  12821. Default mode is @code{merge}.
  12822. @item flags
  12823. Specify flags influencing the filter process.
  12824. Available value for @var{flags} is:
  12825. @table @option
  12826. @item low_pass_filter, vlfp
  12827. Enable linear vertical low-pass filtering in the filter.
  12828. Vertical low-pass filtering is required when creating an interlaced
  12829. destination from a progressive source which contains high-frequency
  12830. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12831. patterning.
  12832. @item complex_filter, cvlfp
  12833. Enable complex vertical low-pass filtering.
  12834. This will slightly less reduce interlace 'twitter' and Moire
  12835. patterning but better retain detail and subjective sharpness impression.
  12836. @end table
  12837. Vertical low-pass filtering can only be enabled for @option{mode}
  12838. @var{interleave_top} and @var{interleave_bottom}.
  12839. @end table
  12840. @section tmix
  12841. Mix successive video frames.
  12842. A description of the accepted options follows.
  12843. @table @option
  12844. @item frames
  12845. The number of successive frames to mix. If unspecified, it defaults to 3.
  12846. @item weights
  12847. Specify weight of each input video frame.
  12848. Each weight is separated by space. If number of weights is smaller than
  12849. number of @var{frames} last specified weight will be used for all remaining
  12850. unset weights.
  12851. @item scale
  12852. Specify scale, if it is set it will be multiplied with sum
  12853. of each weight multiplied with pixel values to give final destination
  12854. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12855. @end table
  12856. @subsection Examples
  12857. @itemize
  12858. @item
  12859. Average 7 successive frames:
  12860. @example
  12861. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12862. @end example
  12863. @item
  12864. Apply simple temporal convolution:
  12865. @example
  12866. tmix=frames=3:weights="-1 3 -1"
  12867. @end example
  12868. @item
  12869. Similar as above but only showing temporal differences:
  12870. @example
  12871. tmix=frames=3:weights="-1 2 -1":scale=1
  12872. @end example
  12873. @end itemize
  12874. @anchor{tonemap}
  12875. @section tonemap
  12876. Tone map colors from different dynamic ranges.
  12877. This filter expects data in single precision floating point, as it needs to
  12878. operate on (and can output) out-of-range values. Another filter, such as
  12879. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12880. The tonemapping algorithms implemented only work on linear light, so input
  12881. data should be linearized beforehand (and possibly correctly tagged).
  12882. @example
  12883. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12884. @end example
  12885. @subsection Options
  12886. The filter accepts the following options.
  12887. @table @option
  12888. @item tonemap
  12889. Set the tone map algorithm to use.
  12890. Possible values are:
  12891. @table @var
  12892. @item none
  12893. Do not apply any tone map, only desaturate overbright pixels.
  12894. @item clip
  12895. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12896. in-range values, while distorting out-of-range values.
  12897. @item linear
  12898. Stretch the entire reference gamut to a linear multiple of the display.
  12899. @item gamma
  12900. Fit a logarithmic transfer between the tone curves.
  12901. @item reinhard
  12902. Preserve overall image brightness with a simple curve, using nonlinear
  12903. contrast, which results in flattening details and degrading color accuracy.
  12904. @item hable
  12905. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12906. of slightly darkening everything. Use it when detail preservation is more
  12907. important than color and brightness accuracy.
  12908. @item mobius
  12909. Smoothly map out-of-range values, while retaining contrast and colors for
  12910. in-range material as much as possible. Use it when color accuracy is more
  12911. important than detail preservation.
  12912. @end table
  12913. Default is none.
  12914. @item param
  12915. Tune the tone mapping algorithm.
  12916. This affects the following algorithms:
  12917. @table @var
  12918. @item none
  12919. Ignored.
  12920. @item linear
  12921. Specifies the scale factor to use while stretching.
  12922. Default to 1.0.
  12923. @item gamma
  12924. Specifies the exponent of the function.
  12925. Default to 1.8.
  12926. @item clip
  12927. Specify an extra linear coefficient to multiply into the signal before clipping.
  12928. Default to 1.0.
  12929. @item reinhard
  12930. Specify the local contrast coefficient at the display peak.
  12931. Default to 0.5, which means that in-gamut values will be about half as bright
  12932. as when clipping.
  12933. @item hable
  12934. Ignored.
  12935. @item mobius
  12936. Specify the transition point from linear to mobius transform. Every value
  12937. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12938. more accurate the result will be, at the cost of losing bright details.
  12939. Default to 0.3, which due to the steep initial slope still preserves in-range
  12940. colors fairly accurately.
  12941. @end table
  12942. @item desat
  12943. Apply desaturation for highlights that exceed this level of brightness. The
  12944. higher the parameter, the more color information will be preserved. This
  12945. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12946. (smoothly) turning into white instead. This makes images feel more natural,
  12947. at the cost of reducing information about out-of-range colors.
  12948. The default of 2.0 is somewhat conservative and will mostly just apply to
  12949. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12950. This option works only if the input frame has a supported color tag.
  12951. @item peak
  12952. Override signal/nominal/reference peak with this value. Useful when the
  12953. embedded peak information in display metadata is not reliable or when tone
  12954. mapping from a lower range to a higher range.
  12955. @end table
  12956. @section tpad
  12957. Temporarily pad video frames.
  12958. The filter accepts the following options:
  12959. @table @option
  12960. @item start
  12961. Specify number of delay frames before input video stream.
  12962. @item stop
  12963. Specify number of padding frames after input video stream.
  12964. Set to -1 to pad indefinitely.
  12965. @item start_mode
  12966. Set kind of frames added to beginning of stream.
  12967. Can be either @var{add} or @var{clone}.
  12968. With @var{add} frames of solid-color are added.
  12969. With @var{clone} frames are clones of first frame.
  12970. @item stop_mode
  12971. Set kind of frames added to end of stream.
  12972. Can be either @var{add} or @var{clone}.
  12973. With @var{add} frames of solid-color are added.
  12974. With @var{clone} frames are clones of last frame.
  12975. @item start_duration, stop_duration
  12976. Specify the duration of the start/stop delay. See
  12977. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12978. for the accepted syntax.
  12979. These options override @var{start} and @var{stop}.
  12980. @item color
  12981. Specify the color of the padded area. For the syntax of this option,
  12982. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12983. manual,ffmpeg-utils}.
  12984. The default value of @var{color} is "black".
  12985. @end table
  12986. @anchor{transpose}
  12987. @section transpose
  12988. Transpose rows with columns in the input video and optionally flip it.
  12989. It accepts the following parameters:
  12990. @table @option
  12991. @item dir
  12992. Specify the transposition direction.
  12993. Can assume the following values:
  12994. @table @samp
  12995. @item 0, 4, cclock_flip
  12996. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12997. @example
  12998. L.R L.l
  12999. . . -> . .
  13000. l.r R.r
  13001. @end example
  13002. @item 1, 5, clock
  13003. Rotate by 90 degrees clockwise, that is:
  13004. @example
  13005. L.R l.L
  13006. . . -> . .
  13007. l.r r.R
  13008. @end example
  13009. @item 2, 6, cclock
  13010. Rotate by 90 degrees counterclockwise, that is:
  13011. @example
  13012. L.R R.r
  13013. . . -> . .
  13014. l.r L.l
  13015. @end example
  13016. @item 3, 7, clock_flip
  13017. Rotate by 90 degrees clockwise and vertically flip, that is:
  13018. @example
  13019. L.R r.R
  13020. . . -> . .
  13021. l.r l.L
  13022. @end example
  13023. @end table
  13024. For values between 4-7, the transposition is only done if the input
  13025. video geometry is portrait and not landscape. These values are
  13026. deprecated, the @code{passthrough} option should be used instead.
  13027. Numerical values are deprecated, and should be dropped in favor of
  13028. symbolic constants.
  13029. @item passthrough
  13030. Do not apply the transposition if the input geometry matches the one
  13031. specified by the specified value. It accepts the following values:
  13032. @table @samp
  13033. @item none
  13034. Always apply transposition.
  13035. @item portrait
  13036. Preserve portrait geometry (when @var{height} >= @var{width}).
  13037. @item landscape
  13038. Preserve landscape geometry (when @var{width} >= @var{height}).
  13039. @end table
  13040. Default value is @code{none}.
  13041. @end table
  13042. For example to rotate by 90 degrees clockwise and preserve portrait
  13043. layout:
  13044. @example
  13045. transpose=dir=1:passthrough=portrait
  13046. @end example
  13047. The command above can also be specified as:
  13048. @example
  13049. transpose=1:portrait
  13050. @end example
  13051. @section transpose_npp
  13052. Transpose rows with columns in the input video and optionally flip it.
  13053. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13054. It accepts the following parameters:
  13055. @table @option
  13056. @item dir
  13057. Specify the transposition direction.
  13058. Can assume the following values:
  13059. @table @samp
  13060. @item cclock_flip
  13061. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13062. @item clock
  13063. Rotate by 90 degrees clockwise.
  13064. @item cclock
  13065. Rotate by 90 degrees counterclockwise.
  13066. @item clock_flip
  13067. Rotate by 90 degrees clockwise and vertically flip.
  13068. @end table
  13069. @item passthrough
  13070. Do not apply the transposition if the input geometry matches the one
  13071. specified by the specified value. It accepts the following values:
  13072. @table @samp
  13073. @item none
  13074. Always apply transposition. (default)
  13075. @item portrait
  13076. Preserve portrait geometry (when @var{height} >= @var{width}).
  13077. @item landscape
  13078. Preserve landscape geometry (when @var{width} >= @var{height}).
  13079. @end table
  13080. @end table
  13081. @section trim
  13082. Trim the input so that the output contains one continuous subpart of the input.
  13083. It accepts the following parameters:
  13084. @table @option
  13085. @item start
  13086. Specify the time of the start of the kept section, i.e. the frame with the
  13087. timestamp @var{start} will be the first frame in the output.
  13088. @item end
  13089. Specify the time of the first frame that will be dropped, i.e. the frame
  13090. immediately preceding the one with the timestamp @var{end} will be the last
  13091. frame in the output.
  13092. @item start_pts
  13093. This is the same as @var{start}, except this option sets the start timestamp
  13094. in timebase units instead of seconds.
  13095. @item end_pts
  13096. This is the same as @var{end}, except this option sets the end timestamp
  13097. in timebase units instead of seconds.
  13098. @item duration
  13099. The maximum duration of the output in seconds.
  13100. @item start_frame
  13101. The number of the first frame that should be passed to the output.
  13102. @item end_frame
  13103. The number of the first frame that should be dropped.
  13104. @end table
  13105. @option{start}, @option{end}, and @option{duration} are expressed as time
  13106. duration specifications; see
  13107. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13108. for the accepted syntax.
  13109. Note that the first two sets of the start/end options and the @option{duration}
  13110. option look at the frame timestamp, while the _frame variants simply count the
  13111. frames that pass through the filter. Also note that this filter does not modify
  13112. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13113. setpts filter after the trim filter.
  13114. If multiple start or end options are set, this filter tries to be greedy and
  13115. keep all the frames that match at least one of the specified constraints. To keep
  13116. only the part that matches all the constraints at once, chain multiple trim
  13117. filters.
  13118. The defaults are such that all the input is kept. So it is possible to set e.g.
  13119. just the end values to keep everything before the specified time.
  13120. Examples:
  13121. @itemize
  13122. @item
  13123. Drop everything except the second minute of input:
  13124. @example
  13125. ffmpeg -i INPUT -vf trim=60:120
  13126. @end example
  13127. @item
  13128. Keep only the first second:
  13129. @example
  13130. ffmpeg -i INPUT -vf trim=duration=1
  13131. @end example
  13132. @end itemize
  13133. @section unpremultiply
  13134. Apply alpha unpremultiply effect to input video stream using first plane
  13135. of second stream as alpha.
  13136. Both streams must have same dimensions and same pixel format.
  13137. The filter accepts the following option:
  13138. @table @option
  13139. @item planes
  13140. Set which planes will be processed, unprocessed planes will be copied.
  13141. By default value 0xf, all planes will be processed.
  13142. If the format has 1 or 2 components, then luma is bit 0.
  13143. If the format has 3 or 4 components:
  13144. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13145. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13146. If present, the alpha channel is always the last bit.
  13147. @item inplace
  13148. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13149. @end table
  13150. @anchor{unsharp}
  13151. @section unsharp
  13152. Sharpen or blur the input video.
  13153. It accepts the following parameters:
  13154. @table @option
  13155. @item luma_msize_x, lx
  13156. Set the luma matrix horizontal size. It must be an odd integer between
  13157. 3 and 23. The default value is 5.
  13158. @item luma_msize_y, ly
  13159. Set the luma matrix vertical size. It must be an odd integer between 3
  13160. and 23. The default value is 5.
  13161. @item luma_amount, la
  13162. Set the luma effect strength. It must be a floating point number, reasonable
  13163. values lay between -1.5 and 1.5.
  13164. Negative values will blur the input video, while positive values will
  13165. sharpen it, a value of zero will disable the effect.
  13166. Default value is 1.0.
  13167. @item chroma_msize_x, cx
  13168. Set the chroma matrix horizontal size. It must be an odd integer
  13169. between 3 and 23. The default value is 5.
  13170. @item chroma_msize_y, cy
  13171. Set the chroma matrix vertical size. It must be an odd integer
  13172. between 3 and 23. The default value is 5.
  13173. @item chroma_amount, ca
  13174. Set the chroma effect strength. It must be a floating point number, reasonable
  13175. values lay between -1.5 and 1.5.
  13176. Negative values will blur the input video, while positive values will
  13177. sharpen it, a value of zero will disable the effect.
  13178. Default value is 0.0.
  13179. @end table
  13180. All parameters are optional and default to the equivalent of the
  13181. string '5:5:1.0:5:5:0.0'.
  13182. @subsection Examples
  13183. @itemize
  13184. @item
  13185. Apply strong luma sharpen effect:
  13186. @example
  13187. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13188. @end example
  13189. @item
  13190. Apply a strong blur of both luma and chroma parameters:
  13191. @example
  13192. unsharp=7:7:-2:7:7:-2
  13193. @end example
  13194. @end itemize
  13195. @section uspp
  13196. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13197. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13198. shifts and average the results.
  13199. The way this differs from the behavior of spp is that uspp actually encodes &
  13200. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13201. DCT similar to MJPEG.
  13202. The filter accepts the following options:
  13203. @table @option
  13204. @item quality
  13205. Set quality. This option defines the number of levels for averaging. It accepts
  13206. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13207. effect. A value of @code{8} means the higher quality. For each increment of
  13208. that value the speed drops by a factor of approximately 2. Default value is
  13209. @code{3}.
  13210. @item qp
  13211. Force a constant quantization parameter. If not set, the filter will use the QP
  13212. from the video stream (if available).
  13213. @end table
  13214. @section vaguedenoiser
  13215. Apply a wavelet based denoiser.
  13216. It transforms each frame from the video input into the wavelet domain,
  13217. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13218. the obtained coefficients. It does an inverse wavelet transform after.
  13219. Due to wavelet properties, it should give a nice smoothed result, and
  13220. reduced noise, without blurring picture features.
  13221. This filter accepts the following options:
  13222. @table @option
  13223. @item threshold
  13224. The filtering strength. The higher, the more filtered the video will be.
  13225. Hard thresholding can use a higher threshold than soft thresholding
  13226. before the video looks overfiltered. Default value is 2.
  13227. @item method
  13228. The filtering method the filter will use.
  13229. It accepts the following values:
  13230. @table @samp
  13231. @item hard
  13232. All values under the threshold will be zeroed.
  13233. @item soft
  13234. All values under the threshold will be zeroed. All values above will be
  13235. reduced by the threshold.
  13236. @item garrote
  13237. Scales or nullifies coefficients - intermediary between (more) soft and
  13238. (less) hard thresholding.
  13239. @end table
  13240. Default is garrote.
  13241. @item nsteps
  13242. Number of times, the wavelet will decompose the picture. Picture can't
  13243. be decomposed beyond a particular point (typically, 8 for a 640x480
  13244. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13245. @item percent
  13246. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13247. @item planes
  13248. A list of the planes to process. By default all planes are processed.
  13249. @end table
  13250. @section vectorscope
  13251. Display 2 color component values in the two dimensional graph (which is called
  13252. a vectorscope).
  13253. This filter accepts the following options:
  13254. @table @option
  13255. @item mode, m
  13256. Set vectorscope mode.
  13257. It accepts the following values:
  13258. @table @samp
  13259. @item gray
  13260. Gray values are displayed on graph, higher brightness means more pixels have
  13261. same component color value on location in graph. This is the default mode.
  13262. @item color
  13263. Gray values are displayed on graph. Surrounding pixels values which are not
  13264. present in video frame are drawn in gradient of 2 color components which are
  13265. set by option @code{x} and @code{y}. The 3rd color component is static.
  13266. @item color2
  13267. Actual color components values present in video frame are displayed on graph.
  13268. @item color3
  13269. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13270. on graph increases value of another color component, which is luminance by
  13271. default values of @code{x} and @code{y}.
  13272. @item color4
  13273. Actual colors present in video frame are displayed on graph. If two different
  13274. colors map to same position on graph then color with higher value of component
  13275. not present in graph is picked.
  13276. @item color5
  13277. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13278. component picked from radial gradient.
  13279. @end table
  13280. @item x
  13281. Set which color component will be represented on X-axis. Default is @code{1}.
  13282. @item y
  13283. Set which color component will be represented on Y-axis. Default is @code{2}.
  13284. @item intensity, i
  13285. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13286. of color component which represents frequency of (X, Y) location in graph.
  13287. @item envelope, e
  13288. @table @samp
  13289. @item none
  13290. No envelope, this is default.
  13291. @item instant
  13292. Instant envelope, even darkest single pixel will be clearly highlighted.
  13293. @item peak
  13294. Hold maximum and minimum values presented in graph over time. This way you
  13295. can still spot out of range values without constantly looking at vectorscope.
  13296. @item peak+instant
  13297. Peak and instant envelope combined together.
  13298. @end table
  13299. @item graticule, g
  13300. Set what kind of graticule to draw.
  13301. @table @samp
  13302. @item none
  13303. @item green
  13304. @item color
  13305. @end table
  13306. @item opacity, o
  13307. Set graticule opacity.
  13308. @item flags, f
  13309. Set graticule flags.
  13310. @table @samp
  13311. @item white
  13312. Draw graticule for white point.
  13313. @item black
  13314. Draw graticule for black point.
  13315. @item name
  13316. Draw color points short names.
  13317. @end table
  13318. @item bgopacity, b
  13319. Set background opacity.
  13320. @item lthreshold, l
  13321. Set low threshold for color component not represented on X or Y axis.
  13322. Values lower than this value will be ignored. Default is 0.
  13323. Note this value is multiplied with actual max possible value one pixel component
  13324. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13325. is 0.1 * 255 = 25.
  13326. @item hthreshold, h
  13327. Set high threshold for color component not represented on X or Y axis.
  13328. Values higher than this value will be ignored. Default is 1.
  13329. Note this value is multiplied with actual max possible value one pixel component
  13330. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13331. is 0.9 * 255 = 230.
  13332. @item colorspace, c
  13333. Set what kind of colorspace to use when drawing graticule.
  13334. @table @samp
  13335. @item auto
  13336. @item 601
  13337. @item 709
  13338. @end table
  13339. Default is auto.
  13340. @end table
  13341. @anchor{vidstabdetect}
  13342. @section vidstabdetect
  13343. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13344. @ref{vidstabtransform} for pass 2.
  13345. This filter generates a file with relative translation and rotation
  13346. transform information about subsequent frames, which is then used by
  13347. the @ref{vidstabtransform} filter.
  13348. To enable compilation of this filter you need to configure FFmpeg with
  13349. @code{--enable-libvidstab}.
  13350. This filter accepts the following options:
  13351. @table @option
  13352. @item result
  13353. Set the path to the file used to write the transforms information.
  13354. Default value is @file{transforms.trf}.
  13355. @item shakiness
  13356. Set how shaky the video is and how quick the camera is. It accepts an
  13357. integer in the range 1-10, a value of 1 means little shakiness, a
  13358. value of 10 means strong shakiness. Default value is 5.
  13359. @item accuracy
  13360. Set the accuracy of the detection process. It must be a value in the
  13361. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13362. accuracy. Default value is 15.
  13363. @item stepsize
  13364. Set stepsize of the search process. The region around minimum is
  13365. scanned with 1 pixel resolution. Default value is 6.
  13366. @item mincontrast
  13367. Set minimum contrast. Below this value a local measurement field is
  13368. discarded. Must be a floating point value in the range 0-1. Default
  13369. value is 0.3.
  13370. @item tripod
  13371. Set reference frame number for tripod mode.
  13372. If enabled, the motion of the frames is compared to a reference frame
  13373. in the filtered stream, identified by the specified number. The idea
  13374. is to compensate all movements in a more-or-less static scene and keep
  13375. the camera view absolutely still.
  13376. If set to 0, it is disabled. The frames are counted starting from 1.
  13377. @item show
  13378. Show fields and transforms in the resulting frames. It accepts an
  13379. integer in the range 0-2. Default value is 0, which disables any
  13380. visualization.
  13381. @end table
  13382. @subsection Examples
  13383. @itemize
  13384. @item
  13385. Use default values:
  13386. @example
  13387. vidstabdetect
  13388. @end example
  13389. @item
  13390. Analyze strongly shaky movie and put the results in file
  13391. @file{mytransforms.trf}:
  13392. @example
  13393. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13394. @end example
  13395. @item
  13396. Visualize the result of internal transformations in the resulting
  13397. video:
  13398. @example
  13399. vidstabdetect=show=1
  13400. @end example
  13401. @item
  13402. Analyze a video with medium shakiness using @command{ffmpeg}:
  13403. @example
  13404. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13405. @end example
  13406. @end itemize
  13407. @anchor{vidstabtransform}
  13408. @section vidstabtransform
  13409. Video stabilization/deshaking: pass 2 of 2,
  13410. see @ref{vidstabdetect} for pass 1.
  13411. Read a file with transform information for each frame and
  13412. apply/compensate them. Together with the @ref{vidstabdetect}
  13413. filter this can be used to deshake videos. See also
  13414. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13415. the @ref{unsharp} filter, see below.
  13416. To enable compilation of this filter you need to configure FFmpeg with
  13417. @code{--enable-libvidstab}.
  13418. @subsection Options
  13419. @table @option
  13420. @item input
  13421. Set path to the file used to read the transforms. Default value is
  13422. @file{transforms.trf}.
  13423. @item smoothing
  13424. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13425. camera movements. Default value is 10.
  13426. For example a number of 10 means that 21 frames are used (10 in the
  13427. past and 10 in the future) to smoothen the motion in the video. A
  13428. larger value leads to a smoother video, but limits the acceleration of
  13429. the camera (pan/tilt movements). 0 is a special case where a static
  13430. camera is simulated.
  13431. @item optalgo
  13432. Set the camera path optimization algorithm.
  13433. Accepted values are:
  13434. @table @samp
  13435. @item gauss
  13436. gaussian kernel low-pass filter on camera motion (default)
  13437. @item avg
  13438. averaging on transformations
  13439. @end table
  13440. @item maxshift
  13441. Set maximal number of pixels to translate frames. Default value is -1,
  13442. meaning no limit.
  13443. @item maxangle
  13444. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13445. value is -1, meaning no limit.
  13446. @item crop
  13447. Specify how to deal with borders that may be visible due to movement
  13448. compensation.
  13449. Available values are:
  13450. @table @samp
  13451. @item keep
  13452. keep image information from previous frame (default)
  13453. @item black
  13454. fill the border black
  13455. @end table
  13456. @item invert
  13457. Invert transforms if set to 1. Default value is 0.
  13458. @item relative
  13459. Consider transforms as relative to previous frame if set to 1,
  13460. absolute if set to 0. Default value is 0.
  13461. @item zoom
  13462. Set percentage to zoom. A positive value will result in a zoom-in
  13463. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13464. zoom).
  13465. @item optzoom
  13466. Set optimal zooming to avoid borders.
  13467. Accepted values are:
  13468. @table @samp
  13469. @item 0
  13470. disabled
  13471. @item 1
  13472. optimal static zoom value is determined (only very strong movements
  13473. will lead to visible borders) (default)
  13474. @item 2
  13475. optimal adaptive zoom value is determined (no borders will be
  13476. visible), see @option{zoomspeed}
  13477. @end table
  13478. Note that the value given at zoom is added to the one calculated here.
  13479. @item zoomspeed
  13480. Set percent to zoom maximally each frame (enabled when
  13481. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13482. 0.25.
  13483. @item interpol
  13484. Specify type of interpolation.
  13485. Available values are:
  13486. @table @samp
  13487. @item no
  13488. no interpolation
  13489. @item linear
  13490. linear only horizontal
  13491. @item bilinear
  13492. linear in both directions (default)
  13493. @item bicubic
  13494. cubic in both directions (slow)
  13495. @end table
  13496. @item tripod
  13497. Enable virtual tripod mode if set to 1, which is equivalent to
  13498. @code{relative=0:smoothing=0}. Default value is 0.
  13499. Use also @code{tripod} option of @ref{vidstabdetect}.
  13500. @item debug
  13501. Increase log verbosity if set to 1. Also the detected global motions
  13502. are written to the temporary file @file{global_motions.trf}. Default
  13503. value is 0.
  13504. @end table
  13505. @subsection Examples
  13506. @itemize
  13507. @item
  13508. Use @command{ffmpeg} for a typical stabilization with default values:
  13509. @example
  13510. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13511. @end example
  13512. Note the use of the @ref{unsharp} filter which is always recommended.
  13513. @item
  13514. Zoom in a bit more and load transform data from a given file:
  13515. @example
  13516. vidstabtransform=zoom=5:input="mytransforms.trf"
  13517. @end example
  13518. @item
  13519. Smoothen the video even more:
  13520. @example
  13521. vidstabtransform=smoothing=30
  13522. @end example
  13523. @end itemize
  13524. @section vflip
  13525. Flip the input video vertically.
  13526. For example, to vertically flip a video with @command{ffmpeg}:
  13527. @example
  13528. ffmpeg -i in.avi -vf "vflip" out.avi
  13529. @end example
  13530. @section vfrdet
  13531. Detect variable frame rate video.
  13532. This filter tries to detect if the input is variable or constant frame rate.
  13533. At end it will output number of frames detected as having variable delta pts,
  13534. and ones with constant delta pts.
  13535. If there was frames with variable delta, than it will also show min and max delta
  13536. encountered.
  13537. @section vibrance
  13538. Boost or alter saturation.
  13539. The filter accepts the following options:
  13540. @table @option
  13541. @item intensity
  13542. Set strength of boost if positive value or strength of alter if negative value.
  13543. Default is 0. Allowed range is from -2 to 2.
  13544. @item rbal
  13545. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13546. @item gbal
  13547. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13548. @item bbal
  13549. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13550. @item rlum
  13551. Set the red luma coefficient.
  13552. @item glum
  13553. Set the green luma coefficient.
  13554. @item blum
  13555. Set the blue luma coefficient.
  13556. @end table
  13557. @anchor{vignette}
  13558. @section vignette
  13559. Make or reverse a natural vignetting effect.
  13560. The filter accepts the following options:
  13561. @table @option
  13562. @item angle, a
  13563. Set lens angle expression as a number of radians.
  13564. The value is clipped in the @code{[0,PI/2]} range.
  13565. Default value: @code{"PI/5"}
  13566. @item x0
  13567. @item y0
  13568. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13569. by default.
  13570. @item mode
  13571. Set forward/backward mode.
  13572. Available modes are:
  13573. @table @samp
  13574. @item forward
  13575. The larger the distance from the central point, the darker the image becomes.
  13576. @item backward
  13577. The larger the distance from the central point, the brighter the image becomes.
  13578. This can be used to reverse a vignette effect, though there is no automatic
  13579. detection to extract the lens @option{angle} and other settings (yet). It can
  13580. also be used to create a burning effect.
  13581. @end table
  13582. Default value is @samp{forward}.
  13583. @item eval
  13584. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13585. It accepts the following values:
  13586. @table @samp
  13587. @item init
  13588. Evaluate expressions only once during the filter initialization.
  13589. @item frame
  13590. Evaluate expressions for each incoming frame. This is way slower than the
  13591. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13592. allows advanced dynamic expressions.
  13593. @end table
  13594. Default value is @samp{init}.
  13595. @item dither
  13596. Set dithering to reduce the circular banding effects. Default is @code{1}
  13597. (enabled).
  13598. @item aspect
  13599. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13600. Setting this value to the SAR of the input will make a rectangular vignetting
  13601. following the dimensions of the video.
  13602. Default is @code{1/1}.
  13603. @end table
  13604. @subsection Expressions
  13605. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13606. following parameters.
  13607. @table @option
  13608. @item w
  13609. @item h
  13610. input width and height
  13611. @item n
  13612. the number of input frame, starting from 0
  13613. @item pts
  13614. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13615. @var{TB} units, NAN if undefined
  13616. @item r
  13617. frame rate of the input video, NAN if the input frame rate is unknown
  13618. @item t
  13619. the PTS (Presentation TimeStamp) of the filtered video frame,
  13620. expressed in seconds, NAN if undefined
  13621. @item tb
  13622. time base of the input video
  13623. @end table
  13624. @subsection Examples
  13625. @itemize
  13626. @item
  13627. Apply simple strong vignetting effect:
  13628. @example
  13629. vignette=PI/4
  13630. @end example
  13631. @item
  13632. Make a flickering vignetting:
  13633. @example
  13634. vignette='PI/4+random(1)*PI/50':eval=frame
  13635. @end example
  13636. @end itemize
  13637. @section vmafmotion
  13638. Obtain the average vmaf motion score of a video.
  13639. It is one of the component filters of VMAF.
  13640. The obtained average motion score is printed through the logging system.
  13641. In the below example the input file @file{ref.mpg} is being processed and score
  13642. is computed.
  13643. @example
  13644. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13645. @end example
  13646. @section vstack
  13647. Stack input videos vertically.
  13648. All streams must be of same pixel format and of same width.
  13649. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13650. to create same output.
  13651. The filter accept the following option:
  13652. @table @option
  13653. @item inputs
  13654. Set number of input streams. Default is 2.
  13655. @item shortest
  13656. If set to 1, force the output to terminate when the shortest input
  13657. terminates. Default value is 0.
  13658. @end table
  13659. @section w3fdif
  13660. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13661. Deinterlacing Filter").
  13662. Based on the process described by Martin Weston for BBC R&D, and
  13663. implemented based on the de-interlace algorithm written by Jim
  13664. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13665. uses filter coefficients calculated by BBC R&D.
  13666. There are two sets of filter coefficients, so called "simple":
  13667. and "complex". Which set of filter coefficients is used can
  13668. be set by passing an optional parameter:
  13669. @table @option
  13670. @item filter
  13671. Set the interlacing filter coefficients. Accepts one of the following values:
  13672. @table @samp
  13673. @item simple
  13674. Simple filter coefficient set.
  13675. @item complex
  13676. More-complex filter coefficient set.
  13677. @end table
  13678. Default value is @samp{complex}.
  13679. @item deint
  13680. Specify which frames to deinterlace. Accept one of the following values:
  13681. @table @samp
  13682. @item all
  13683. Deinterlace all frames,
  13684. @item interlaced
  13685. Only deinterlace frames marked as interlaced.
  13686. @end table
  13687. Default value is @samp{all}.
  13688. @end table
  13689. @section waveform
  13690. Video waveform monitor.
  13691. The waveform monitor plots color component intensity. By default luminance
  13692. only. Each column of the waveform corresponds to a column of pixels in the
  13693. source video.
  13694. It accepts the following options:
  13695. @table @option
  13696. @item mode, m
  13697. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13698. In row mode, the graph on the left side represents color component value 0 and
  13699. the right side represents value = 255. In column mode, the top side represents
  13700. color component value = 0 and bottom side represents value = 255.
  13701. @item intensity, i
  13702. Set intensity. Smaller values are useful to find out how many values of the same
  13703. luminance are distributed across input rows/columns.
  13704. Default value is @code{0.04}. Allowed range is [0, 1].
  13705. @item mirror, r
  13706. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13707. In mirrored mode, higher values will be represented on the left
  13708. side for @code{row} mode and at the top for @code{column} mode. Default is
  13709. @code{1} (mirrored).
  13710. @item display, d
  13711. Set display mode.
  13712. It accepts the following values:
  13713. @table @samp
  13714. @item overlay
  13715. Presents information identical to that in the @code{parade}, except
  13716. that the graphs representing color components are superimposed directly
  13717. over one another.
  13718. This display mode makes it easier to spot relative differences or similarities
  13719. in overlapping areas of the color components that are supposed to be identical,
  13720. such as neutral whites, grays, or blacks.
  13721. @item stack
  13722. Display separate graph for the color components side by side in
  13723. @code{row} mode or one below the other in @code{column} mode.
  13724. @item parade
  13725. Display separate graph for the color components side by side in
  13726. @code{column} mode or one below the other in @code{row} mode.
  13727. Using this display mode makes it easy to spot color casts in the highlights
  13728. and shadows of an image, by comparing the contours of the top and the bottom
  13729. graphs of each waveform. Since whites, grays, and blacks are characterized
  13730. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13731. should display three waveforms of roughly equal width/height. If not, the
  13732. correction is easy to perform by making level adjustments the three waveforms.
  13733. @end table
  13734. Default is @code{stack}.
  13735. @item components, c
  13736. Set which color components to display. Default is 1, which means only luminance
  13737. or red color component if input is in RGB colorspace. If is set for example to
  13738. 7 it will display all 3 (if) available color components.
  13739. @item envelope, e
  13740. @table @samp
  13741. @item none
  13742. No envelope, this is default.
  13743. @item instant
  13744. Instant envelope, minimum and maximum values presented in graph will be easily
  13745. visible even with small @code{step} value.
  13746. @item peak
  13747. Hold minimum and maximum values presented in graph across time. This way you
  13748. can still spot out of range values without constantly looking at waveforms.
  13749. @item peak+instant
  13750. Peak and instant envelope combined together.
  13751. @end table
  13752. @item filter, f
  13753. @table @samp
  13754. @item lowpass
  13755. No filtering, this is default.
  13756. @item flat
  13757. Luma and chroma combined together.
  13758. @item aflat
  13759. Similar as above, but shows difference between blue and red chroma.
  13760. @item xflat
  13761. Similar as above, but use different colors.
  13762. @item chroma
  13763. Displays only chroma.
  13764. @item color
  13765. Displays actual color value on waveform.
  13766. @item acolor
  13767. Similar as above, but with luma showing frequency of chroma values.
  13768. @end table
  13769. @item graticule, g
  13770. Set which graticule to display.
  13771. @table @samp
  13772. @item none
  13773. Do not display graticule.
  13774. @item green
  13775. Display green graticule showing legal broadcast ranges.
  13776. @item orange
  13777. Display orange graticule showing legal broadcast ranges.
  13778. @end table
  13779. @item opacity, o
  13780. Set graticule opacity.
  13781. @item flags, fl
  13782. Set graticule flags.
  13783. @table @samp
  13784. @item numbers
  13785. Draw numbers above lines. By default enabled.
  13786. @item dots
  13787. Draw dots instead of lines.
  13788. @end table
  13789. @item scale, s
  13790. Set scale used for displaying graticule.
  13791. @table @samp
  13792. @item digital
  13793. @item millivolts
  13794. @item ire
  13795. @end table
  13796. Default is digital.
  13797. @item bgopacity, b
  13798. Set background opacity.
  13799. @end table
  13800. @section weave, doubleweave
  13801. The @code{weave} takes a field-based video input and join
  13802. each two sequential fields into single frame, producing a new double
  13803. height clip with half the frame rate and half the frame count.
  13804. The @code{doubleweave} works same as @code{weave} but without
  13805. halving frame rate and frame count.
  13806. It accepts the following option:
  13807. @table @option
  13808. @item first_field
  13809. Set first field. Available values are:
  13810. @table @samp
  13811. @item top, t
  13812. Set the frame as top-field-first.
  13813. @item bottom, b
  13814. Set the frame as bottom-field-first.
  13815. @end table
  13816. @end table
  13817. @subsection Examples
  13818. @itemize
  13819. @item
  13820. Interlace video using @ref{select} and @ref{separatefields} filter:
  13821. @example
  13822. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13823. @end example
  13824. @end itemize
  13825. @section xbr
  13826. Apply the xBR high-quality magnification filter which is designed for pixel
  13827. art. It follows a set of edge-detection rules, see
  13828. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13829. It accepts the following option:
  13830. @table @option
  13831. @item n
  13832. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13833. @code{3xBR} and @code{4} for @code{4xBR}.
  13834. Default is @code{3}.
  13835. @end table
  13836. @section xstack
  13837. Stack video inputs into custom layout.
  13838. All streams must be of same pixel format.
  13839. The filter accept the following option:
  13840. @table @option
  13841. @item inputs
  13842. Set number of input streams. Default is 2.
  13843. @item layout
  13844. Specify layout of inputs.
  13845. This option requires the desired layout configuration to be explicitly set by the user.
  13846. This sets position of each video input in output. Each input
  13847. is separated by '|'.
  13848. The first number represents the column, and the second number represents the row.
  13849. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13850. where X is video input from which to take width or height.
  13851. Multiple values can be used when separated by '+'. In such
  13852. case values are summed together.
  13853. @item shortest
  13854. If set to 1, force the output to terminate when the shortest input
  13855. terminates. Default value is 0.
  13856. @end table
  13857. @subsection Examples
  13858. @itemize
  13859. @item
  13860. Display 4 inputs into 2x2 grid,
  13861. note that if inputs are of different sizes unused gaps might appear,
  13862. as not all of output video is used.
  13863. @example
  13864. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13865. @end example
  13866. @item
  13867. Display 4 inputs into 1x4 grid,
  13868. note that if inputs are of different sizes unused gaps might appear,
  13869. as not all of output video is used.
  13870. @example
  13871. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13872. @end example
  13873. @item
  13874. Display 9 inputs into 3x3 grid,
  13875. note that if inputs are of different sizes unused gaps might appear,
  13876. as not all of output video is used.
  13877. @example
  13878. 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
  13879. @end example
  13880. @end itemize
  13881. @anchor{yadif}
  13882. @section yadif
  13883. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13884. filter").
  13885. It accepts the following parameters:
  13886. @table @option
  13887. @item mode
  13888. The interlacing mode to adopt. It accepts one of the following values:
  13889. @table @option
  13890. @item 0, send_frame
  13891. Output one frame for each frame.
  13892. @item 1, send_field
  13893. Output one frame for each field.
  13894. @item 2, send_frame_nospatial
  13895. Like @code{send_frame}, but it skips the spatial interlacing check.
  13896. @item 3, send_field_nospatial
  13897. Like @code{send_field}, but it skips the spatial interlacing check.
  13898. @end table
  13899. The default value is @code{send_frame}.
  13900. @item parity
  13901. The picture field parity assumed for the input interlaced video. It accepts one
  13902. of the following values:
  13903. @table @option
  13904. @item 0, tff
  13905. Assume the top field is first.
  13906. @item 1, bff
  13907. Assume the bottom field is first.
  13908. @item -1, auto
  13909. Enable automatic detection of field parity.
  13910. @end table
  13911. The default value is @code{auto}.
  13912. If the interlacing is unknown or the decoder does not export this information,
  13913. top field first will be assumed.
  13914. @item deint
  13915. Specify which frames to deinterlace. Accept one of the following
  13916. values:
  13917. @table @option
  13918. @item 0, all
  13919. Deinterlace all frames.
  13920. @item 1, interlaced
  13921. Only deinterlace frames marked as interlaced.
  13922. @end table
  13923. The default value is @code{all}.
  13924. @end table
  13925. @section yadif_cuda
  13926. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13927. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13928. and/or nvenc.
  13929. It accepts the following parameters:
  13930. @table @option
  13931. @item mode
  13932. The interlacing mode to adopt. It accepts one of the following values:
  13933. @table @option
  13934. @item 0, send_frame
  13935. Output one frame for each frame.
  13936. @item 1, send_field
  13937. Output one frame for each field.
  13938. @item 2, send_frame_nospatial
  13939. Like @code{send_frame}, but it skips the spatial interlacing check.
  13940. @item 3, send_field_nospatial
  13941. Like @code{send_field}, but it skips the spatial interlacing check.
  13942. @end table
  13943. The default value is @code{send_frame}.
  13944. @item parity
  13945. The picture field parity assumed for the input interlaced video. It accepts one
  13946. of the following values:
  13947. @table @option
  13948. @item 0, tff
  13949. Assume the top field is first.
  13950. @item 1, bff
  13951. Assume the bottom field is first.
  13952. @item -1, auto
  13953. Enable automatic detection of field parity.
  13954. @end table
  13955. The default value is @code{auto}.
  13956. If the interlacing is unknown or the decoder does not export this information,
  13957. top field first will be assumed.
  13958. @item deint
  13959. Specify which frames to deinterlace. Accept one of the following
  13960. values:
  13961. @table @option
  13962. @item 0, all
  13963. Deinterlace all frames.
  13964. @item 1, interlaced
  13965. Only deinterlace frames marked as interlaced.
  13966. @end table
  13967. The default value is @code{all}.
  13968. @end table
  13969. @section zoompan
  13970. Apply Zoom & Pan effect.
  13971. This filter accepts the following options:
  13972. @table @option
  13973. @item zoom, z
  13974. Set the zoom expression. Default is 1.
  13975. @item x
  13976. @item y
  13977. Set the x and y expression. Default is 0.
  13978. @item d
  13979. Set the duration expression in number of frames.
  13980. This sets for how many number of frames effect will last for
  13981. single input image.
  13982. @item s
  13983. Set the output image size, default is 'hd720'.
  13984. @item fps
  13985. Set the output frame rate, default is '25'.
  13986. @end table
  13987. Each expression can contain the following constants:
  13988. @table @option
  13989. @item in_w, iw
  13990. Input width.
  13991. @item in_h, ih
  13992. Input height.
  13993. @item out_w, ow
  13994. Output width.
  13995. @item out_h, oh
  13996. Output height.
  13997. @item in
  13998. Input frame count.
  13999. @item on
  14000. Output frame count.
  14001. @item x
  14002. @item y
  14003. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14004. for current input frame.
  14005. @item px
  14006. @item py
  14007. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14008. not yet such frame (first input frame).
  14009. @item zoom
  14010. Last calculated zoom from 'z' expression for current input frame.
  14011. @item pzoom
  14012. Last calculated zoom of last output frame of previous input frame.
  14013. @item duration
  14014. Number of output frames for current input frame. Calculated from 'd' expression
  14015. for each input frame.
  14016. @item pduration
  14017. number of output frames created for previous input frame
  14018. @item a
  14019. Rational number: input width / input height
  14020. @item sar
  14021. sample aspect ratio
  14022. @item dar
  14023. display aspect ratio
  14024. @end table
  14025. @subsection Examples
  14026. @itemize
  14027. @item
  14028. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14029. @example
  14030. 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
  14031. @end example
  14032. @item
  14033. Zoom-in up to 1.5 and pan always at center of picture:
  14034. @example
  14035. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14036. @end example
  14037. @item
  14038. Same as above but without pausing:
  14039. @example
  14040. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14041. @end example
  14042. @end itemize
  14043. @anchor{zscale}
  14044. @section zscale
  14045. Scale (resize) the input video, using the z.lib library:
  14046. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14047. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14048. The zscale filter forces the output display aspect ratio to be the same
  14049. as the input, by changing the output sample aspect ratio.
  14050. If the input image format is different from the format requested by
  14051. the next filter, the zscale filter will convert the input to the
  14052. requested format.
  14053. @subsection Options
  14054. The filter accepts the following options.
  14055. @table @option
  14056. @item width, w
  14057. @item height, h
  14058. Set the output video dimension expression. Default value is the input
  14059. dimension.
  14060. If the @var{width} or @var{w} value is 0, the input width is used for
  14061. the output. If the @var{height} or @var{h} value is 0, the input height
  14062. is used for the output.
  14063. If one and only one of the values is -n with n >= 1, the zscale filter
  14064. will use a value that maintains the aspect ratio of the input image,
  14065. calculated from the other specified dimension. After that it will,
  14066. however, make sure that the calculated dimension is divisible by n and
  14067. adjust the value if necessary.
  14068. If both values are -n with n >= 1, the behavior will be identical to
  14069. both values being set to 0 as previously detailed.
  14070. See below for the list of accepted constants for use in the dimension
  14071. expression.
  14072. @item size, s
  14073. Set the video size. For the syntax of this option, check the
  14074. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14075. @item dither, d
  14076. Set the dither type.
  14077. Possible values are:
  14078. @table @var
  14079. @item none
  14080. @item ordered
  14081. @item random
  14082. @item error_diffusion
  14083. @end table
  14084. Default is none.
  14085. @item filter, f
  14086. Set the resize filter type.
  14087. Possible values are:
  14088. @table @var
  14089. @item point
  14090. @item bilinear
  14091. @item bicubic
  14092. @item spline16
  14093. @item spline36
  14094. @item lanczos
  14095. @end table
  14096. Default is bilinear.
  14097. @item range, r
  14098. Set the color range.
  14099. Possible values are:
  14100. @table @var
  14101. @item input
  14102. @item limited
  14103. @item full
  14104. @end table
  14105. Default is same as input.
  14106. @item primaries, p
  14107. Set the color primaries.
  14108. Possible values are:
  14109. @table @var
  14110. @item input
  14111. @item 709
  14112. @item unspecified
  14113. @item 170m
  14114. @item 240m
  14115. @item 2020
  14116. @end table
  14117. Default is same as input.
  14118. @item transfer, t
  14119. Set the transfer characteristics.
  14120. Possible values are:
  14121. @table @var
  14122. @item input
  14123. @item 709
  14124. @item unspecified
  14125. @item 601
  14126. @item linear
  14127. @item 2020_10
  14128. @item 2020_12
  14129. @item smpte2084
  14130. @item iec61966-2-1
  14131. @item arib-std-b67
  14132. @end table
  14133. Default is same as input.
  14134. @item matrix, m
  14135. Set the colorspace matrix.
  14136. Possible value are:
  14137. @table @var
  14138. @item input
  14139. @item 709
  14140. @item unspecified
  14141. @item 470bg
  14142. @item 170m
  14143. @item 2020_ncl
  14144. @item 2020_cl
  14145. @end table
  14146. Default is same as input.
  14147. @item rangein, rin
  14148. Set the input color range.
  14149. Possible values are:
  14150. @table @var
  14151. @item input
  14152. @item limited
  14153. @item full
  14154. @end table
  14155. Default is same as input.
  14156. @item primariesin, pin
  14157. Set the input color primaries.
  14158. Possible values are:
  14159. @table @var
  14160. @item input
  14161. @item 709
  14162. @item unspecified
  14163. @item 170m
  14164. @item 240m
  14165. @item 2020
  14166. @end table
  14167. Default is same as input.
  14168. @item transferin, tin
  14169. Set the input transfer characteristics.
  14170. Possible values are:
  14171. @table @var
  14172. @item input
  14173. @item 709
  14174. @item unspecified
  14175. @item 601
  14176. @item linear
  14177. @item 2020_10
  14178. @item 2020_12
  14179. @end table
  14180. Default is same as input.
  14181. @item matrixin, min
  14182. Set the input colorspace matrix.
  14183. Possible value are:
  14184. @table @var
  14185. @item input
  14186. @item 709
  14187. @item unspecified
  14188. @item 470bg
  14189. @item 170m
  14190. @item 2020_ncl
  14191. @item 2020_cl
  14192. @end table
  14193. @item chromal, c
  14194. Set the output chroma location.
  14195. Possible values are:
  14196. @table @var
  14197. @item input
  14198. @item left
  14199. @item center
  14200. @item topleft
  14201. @item top
  14202. @item bottomleft
  14203. @item bottom
  14204. @end table
  14205. @item chromalin, cin
  14206. Set the input chroma location.
  14207. Possible values are:
  14208. @table @var
  14209. @item input
  14210. @item left
  14211. @item center
  14212. @item topleft
  14213. @item top
  14214. @item bottomleft
  14215. @item bottom
  14216. @end table
  14217. @item npl
  14218. Set the nominal peak luminance.
  14219. @end table
  14220. The values of the @option{w} and @option{h} options are expressions
  14221. containing the following constants:
  14222. @table @var
  14223. @item in_w
  14224. @item in_h
  14225. The input width and height
  14226. @item iw
  14227. @item ih
  14228. These are the same as @var{in_w} and @var{in_h}.
  14229. @item out_w
  14230. @item out_h
  14231. The output (scaled) width and height
  14232. @item ow
  14233. @item oh
  14234. These are the same as @var{out_w} and @var{out_h}
  14235. @item a
  14236. The same as @var{iw} / @var{ih}
  14237. @item sar
  14238. input sample aspect ratio
  14239. @item dar
  14240. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14241. @item hsub
  14242. @item vsub
  14243. horizontal and vertical input chroma subsample values. For example for the
  14244. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14245. @item ohsub
  14246. @item ovsub
  14247. horizontal and vertical output chroma subsample values. For example for the
  14248. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14249. @end table
  14250. @table @option
  14251. @end table
  14252. @c man end VIDEO FILTERS
  14253. @chapter OpenCL Video Filters
  14254. @c man begin OPENCL VIDEO FILTERS
  14255. Below is a description of the currently available OpenCL video filters.
  14256. To enable compilation of these filters you need to configure FFmpeg with
  14257. @code{--enable-opencl}.
  14258. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14259. @table @option
  14260. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14261. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14262. given device parameters.
  14263. @item -filter_hw_device @var{name}
  14264. Pass the hardware device called @var{name} to all filters in any filter graph.
  14265. @end table
  14266. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14267. @itemize
  14268. @item
  14269. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14270. @example
  14271. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14272. @end example
  14273. @end itemize
  14274. 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.
  14275. @section avgblur_opencl
  14276. Apply average blur filter.
  14277. The filter accepts the following options:
  14278. @table @option
  14279. @item sizeX
  14280. Set horizontal radius size.
  14281. Range is @code{[1, 1024]} and default value is @code{1}.
  14282. @item planes
  14283. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14284. @item sizeY
  14285. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14286. @end table
  14287. @subsection Example
  14288. @itemize
  14289. @item
  14290. 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.
  14291. @example
  14292. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14293. @end example
  14294. @end itemize
  14295. @section boxblur_opencl
  14296. Apply a boxblur algorithm to the input video.
  14297. It accepts the following parameters:
  14298. @table @option
  14299. @item luma_radius, lr
  14300. @item luma_power, lp
  14301. @item chroma_radius, cr
  14302. @item chroma_power, cp
  14303. @item alpha_radius, ar
  14304. @item alpha_power, ap
  14305. @end table
  14306. A description of the accepted options follows.
  14307. @table @option
  14308. @item luma_radius, lr
  14309. @item chroma_radius, cr
  14310. @item alpha_radius, ar
  14311. Set an expression for the box radius in pixels used for blurring the
  14312. corresponding input plane.
  14313. The radius value must be a non-negative number, and must not be
  14314. greater than the value of the expression @code{min(w,h)/2} for the
  14315. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14316. planes.
  14317. Default value for @option{luma_radius} is "2". If not specified,
  14318. @option{chroma_radius} and @option{alpha_radius} default to the
  14319. corresponding value set for @option{luma_radius}.
  14320. The expressions can contain the following constants:
  14321. @table @option
  14322. @item w
  14323. @item h
  14324. The input width and height in pixels.
  14325. @item cw
  14326. @item ch
  14327. The input chroma image width and height in pixels.
  14328. @item hsub
  14329. @item vsub
  14330. The horizontal and vertical chroma subsample values. For example, for the
  14331. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14332. @end table
  14333. @item luma_power, lp
  14334. @item chroma_power, cp
  14335. @item alpha_power, ap
  14336. Specify how many times the boxblur filter is applied to the
  14337. corresponding plane.
  14338. Default value for @option{luma_power} is 2. If not specified,
  14339. @option{chroma_power} and @option{alpha_power} default to the
  14340. corresponding value set for @option{luma_power}.
  14341. A value of 0 will disable the effect.
  14342. @end table
  14343. @subsection Examples
  14344. 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.
  14345. @itemize
  14346. @item
  14347. Apply a boxblur filter with the luma, chroma, and alpha radius
  14348. 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.
  14349. @example
  14350. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14351. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14352. @end example
  14353. @item
  14354. 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.
  14355. For the luma plane, a 2x2 box radius will be run once.
  14356. For the chroma plane, a 4x4 box radius will be run 5 times.
  14357. For the alpha plane, a 3x3 box radius will be run 7 times.
  14358. @example
  14359. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14360. @end example
  14361. @end itemize
  14362. @section convolution_opencl
  14363. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14364. The filter accepts the following options:
  14365. @table @option
  14366. @item 0m
  14367. @item 1m
  14368. @item 2m
  14369. @item 3m
  14370. Set matrix for each plane.
  14371. Matrix is sequence of 9, 25 or 49 signed numbers.
  14372. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14373. @item 0rdiv
  14374. @item 1rdiv
  14375. @item 2rdiv
  14376. @item 3rdiv
  14377. Set multiplier for calculated value for each plane.
  14378. If unset or 0, it will be sum of all matrix elements.
  14379. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14380. @item 0bias
  14381. @item 1bias
  14382. @item 2bias
  14383. @item 3bias
  14384. Set bias for each plane. This value is added to the result of the multiplication.
  14385. Useful for making the overall image brighter or darker.
  14386. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14387. @end table
  14388. @subsection Examples
  14389. @itemize
  14390. @item
  14391. Apply sharpen:
  14392. @example
  14393. -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
  14394. @end example
  14395. @item
  14396. Apply blur:
  14397. @example
  14398. -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
  14399. @end example
  14400. @item
  14401. Apply edge enhance:
  14402. @example
  14403. -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
  14404. @end example
  14405. @item
  14406. Apply edge detect:
  14407. @example
  14408. -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
  14409. @end example
  14410. @item
  14411. Apply laplacian edge detector which includes diagonals:
  14412. @example
  14413. -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
  14414. @end example
  14415. @item
  14416. Apply emboss:
  14417. @example
  14418. -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
  14419. @end example
  14420. @end itemize
  14421. @section dilation_opencl
  14422. Apply dilation effect to the video.
  14423. This filter replaces the pixel by the local(3x3) maximum.
  14424. It accepts the following options:
  14425. @table @option
  14426. @item threshold0
  14427. @item threshold1
  14428. @item threshold2
  14429. @item threshold3
  14430. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14431. If @code{0}, plane will remain unchanged.
  14432. @item coordinates
  14433. Flag which specifies the pixel to refer to.
  14434. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14435. Flags to local 3x3 coordinates region centered on @code{x}:
  14436. 1 2 3
  14437. 4 x 5
  14438. 6 7 8
  14439. @end table
  14440. @subsection Example
  14441. @itemize
  14442. @item
  14443. 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.
  14444. @example
  14445. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14446. @end example
  14447. @end itemize
  14448. @section erosion_opencl
  14449. Apply erosion effect to the video.
  14450. This filter replaces the pixel by the local(3x3) minimum.
  14451. It accepts the following options:
  14452. @table @option
  14453. @item threshold0
  14454. @item threshold1
  14455. @item threshold2
  14456. @item threshold3
  14457. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14458. If @code{0}, plane will remain unchanged.
  14459. @item coordinates
  14460. Flag which specifies the pixel to refer to.
  14461. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14462. Flags to local 3x3 coordinates region centered on @code{x}:
  14463. 1 2 3
  14464. 4 x 5
  14465. 6 7 8
  14466. @end table
  14467. @subsection Example
  14468. @itemize
  14469. @item
  14470. 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.
  14471. @example
  14472. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14473. @end example
  14474. @end itemize
  14475. @section overlay_opencl
  14476. Overlay one video on top of another.
  14477. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14478. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14479. The filter accepts the following options:
  14480. @table @option
  14481. @item x
  14482. Set the x coordinate of the overlaid video on the main video.
  14483. Default value is @code{0}.
  14484. @item y
  14485. Set the x coordinate of the overlaid video on the main video.
  14486. Default value is @code{0}.
  14487. @end table
  14488. @subsection Examples
  14489. @itemize
  14490. @item
  14491. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14492. @example
  14493. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14494. @end example
  14495. @item
  14496. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14497. @example
  14498. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14499. @end example
  14500. @end itemize
  14501. @section prewitt_opencl
  14502. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14503. The filter accepts the following option:
  14504. @table @option
  14505. @item planes
  14506. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14507. @item scale
  14508. Set value which will be multiplied with filtered result.
  14509. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14510. @item delta
  14511. Set value which will be added to filtered result.
  14512. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14513. @end table
  14514. @subsection Example
  14515. @itemize
  14516. @item
  14517. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14518. @example
  14519. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14520. @end example
  14521. @end itemize
  14522. @section roberts_opencl
  14523. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14524. The filter accepts the following option:
  14525. @table @option
  14526. @item planes
  14527. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14528. @item scale
  14529. Set value which will be multiplied with filtered result.
  14530. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14531. @item delta
  14532. Set value which will be added to filtered result.
  14533. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14534. @end table
  14535. @subsection Example
  14536. @itemize
  14537. @item
  14538. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14539. @example
  14540. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14541. @end example
  14542. @end itemize
  14543. @section sobel_opencl
  14544. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14545. The filter accepts the following option:
  14546. @table @option
  14547. @item planes
  14548. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14549. @item scale
  14550. Set value which will be multiplied with filtered result.
  14551. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14552. @item delta
  14553. Set value which will be added to filtered result.
  14554. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14555. @end table
  14556. @subsection Example
  14557. @itemize
  14558. @item
  14559. Apply sobel operator with scale set to 2 and delta set to 10
  14560. @example
  14561. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14562. @end example
  14563. @end itemize
  14564. @section tonemap_opencl
  14565. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14566. It accepts the following parameters:
  14567. @table @option
  14568. @item tonemap
  14569. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14570. @item param
  14571. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14572. @item desat
  14573. Apply desaturation for highlights that exceed this level of brightness. The
  14574. higher the parameter, the more color information will be preserved. This
  14575. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14576. (smoothly) turning into white instead. This makes images feel more natural,
  14577. at the cost of reducing information about out-of-range colors.
  14578. The default value is 0.5, and the algorithm here is a little different from
  14579. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14580. @item threshold
  14581. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14582. is used to detect whether the scene has changed or not. If the distance beween
  14583. the current frame average brightness and the current running average exceeds
  14584. a threshold value, we would re-calculate scene average and peak brightness.
  14585. The default value is 0.2.
  14586. @item format
  14587. Specify the output pixel format.
  14588. Currently supported formats are:
  14589. @table @var
  14590. @item p010
  14591. @item nv12
  14592. @end table
  14593. @item range, r
  14594. Set the output color range.
  14595. Possible values are:
  14596. @table @var
  14597. @item tv/mpeg
  14598. @item pc/jpeg
  14599. @end table
  14600. Default is same as input.
  14601. @item primaries, p
  14602. Set the output color primaries.
  14603. Possible values are:
  14604. @table @var
  14605. @item bt709
  14606. @item bt2020
  14607. @end table
  14608. Default is same as input.
  14609. @item transfer, t
  14610. Set the output transfer characteristics.
  14611. Possible values are:
  14612. @table @var
  14613. @item bt709
  14614. @item bt2020
  14615. @end table
  14616. Default is bt709.
  14617. @item matrix, m
  14618. Set the output colorspace matrix.
  14619. Possible value are:
  14620. @table @var
  14621. @item bt709
  14622. @item bt2020
  14623. @end table
  14624. Default is same as input.
  14625. @end table
  14626. @subsection Example
  14627. @itemize
  14628. @item
  14629. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14630. @example
  14631. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14632. @end example
  14633. @end itemize
  14634. @section unsharp_opencl
  14635. Sharpen or blur the input video.
  14636. It accepts the following parameters:
  14637. @table @option
  14638. @item luma_msize_x, lx
  14639. Set the luma matrix horizontal size.
  14640. Range is @code{[1, 23]} and default value is @code{5}.
  14641. @item luma_msize_y, ly
  14642. Set the luma matrix vertical size.
  14643. Range is @code{[1, 23]} and default value is @code{5}.
  14644. @item luma_amount, la
  14645. Set the luma effect strength.
  14646. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14647. Negative values will blur the input video, while positive values will
  14648. sharpen it, a value of zero will disable the effect.
  14649. @item chroma_msize_x, cx
  14650. Set the chroma matrix horizontal size.
  14651. Range is @code{[1, 23]} and default value is @code{5}.
  14652. @item chroma_msize_y, cy
  14653. Set the chroma matrix vertical size.
  14654. Range is @code{[1, 23]} and default value is @code{5}.
  14655. @item chroma_amount, ca
  14656. Set the chroma effect strength.
  14657. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14658. Negative values will blur the input video, while positive values will
  14659. sharpen it, a value of zero will disable the effect.
  14660. @end table
  14661. All parameters are optional and default to the equivalent of the
  14662. string '5:5:1.0:5:5:0.0'.
  14663. @subsection Examples
  14664. @itemize
  14665. @item
  14666. Apply strong luma sharpen effect:
  14667. @example
  14668. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14669. @end example
  14670. @item
  14671. Apply a strong blur of both luma and chroma parameters:
  14672. @example
  14673. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14674. @end example
  14675. @end itemize
  14676. @c man end OPENCL VIDEO FILTERS
  14677. @chapter Video Sources
  14678. @c man begin VIDEO SOURCES
  14679. Below is a description of the currently available video sources.
  14680. @section buffer
  14681. Buffer video frames, and make them available to the filter chain.
  14682. This source is mainly intended for a programmatic use, in particular
  14683. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14684. It accepts the following parameters:
  14685. @table @option
  14686. @item video_size
  14687. Specify the size (width and height) of the buffered video frames. For the
  14688. syntax of this option, check the
  14689. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14690. @item width
  14691. The input video width.
  14692. @item height
  14693. The input video height.
  14694. @item pix_fmt
  14695. A string representing the pixel format of the buffered video frames.
  14696. It may be a number corresponding to a pixel format, or a pixel format
  14697. name.
  14698. @item time_base
  14699. Specify the timebase assumed by the timestamps of the buffered frames.
  14700. @item frame_rate
  14701. Specify the frame rate expected for the video stream.
  14702. @item pixel_aspect, sar
  14703. The sample (pixel) aspect ratio of the input video.
  14704. @item sws_param
  14705. Specify the optional parameters to be used for the scale filter which
  14706. is automatically inserted when an input change is detected in the
  14707. input size or format.
  14708. @item hw_frames_ctx
  14709. When using a hardware pixel format, this should be a reference to an
  14710. AVHWFramesContext describing input frames.
  14711. @end table
  14712. For example:
  14713. @example
  14714. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14715. @end example
  14716. will instruct the source to accept video frames with size 320x240 and
  14717. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14718. square pixels (1:1 sample aspect ratio).
  14719. Since the pixel format with name "yuv410p" corresponds to the number 6
  14720. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14721. this example corresponds to:
  14722. @example
  14723. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14724. @end example
  14725. Alternatively, the options can be specified as a flat string, but this
  14726. syntax is deprecated:
  14727. @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}]
  14728. @section cellauto
  14729. Create a pattern generated by an elementary cellular automaton.
  14730. The initial state of the cellular automaton can be defined through the
  14731. @option{filename} and @option{pattern} options. If such options are
  14732. not specified an initial state is created randomly.
  14733. At each new frame a new row in the video is filled with the result of
  14734. the cellular automaton next generation. The behavior when the whole
  14735. frame is filled is defined by the @option{scroll} option.
  14736. This source accepts the following options:
  14737. @table @option
  14738. @item filename, f
  14739. Read the initial cellular automaton state, i.e. the starting row, from
  14740. the specified file.
  14741. In the file, each non-whitespace character is considered an alive
  14742. cell, a newline will terminate the row, and further characters in the
  14743. file will be ignored.
  14744. @item pattern, p
  14745. Read the initial cellular automaton state, i.e. the starting row, from
  14746. the specified string.
  14747. Each non-whitespace character in the string is considered an alive
  14748. cell, a newline will terminate the row, and further characters in the
  14749. string will be ignored.
  14750. @item rate, r
  14751. Set the video rate, that is the number of frames generated per second.
  14752. Default is 25.
  14753. @item random_fill_ratio, ratio
  14754. Set the random fill ratio for the initial cellular automaton row. It
  14755. is a floating point number value ranging from 0 to 1, defaults to
  14756. 1/PHI.
  14757. This option is ignored when a file or a pattern is specified.
  14758. @item random_seed, seed
  14759. Set the seed for filling randomly the initial row, must be an integer
  14760. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14761. set to -1, the filter will try to use a good random seed on a best
  14762. effort basis.
  14763. @item rule
  14764. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14765. Default value is 110.
  14766. @item size, s
  14767. Set the size of the output video. For the syntax of this option, check the
  14768. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14769. If @option{filename} or @option{pattern} is specified, the size is set
  14770. by default to the width of the specified initial state row, and the
  14771. height is set to @var{width} * PHI.
  14772. If @option{size} is set, it must contain the width of the specified
  14773. pattern string, and the specified pattern will be centered in the
  14774. larger row.
  14775. If a filename or a pattern string is not specified, the size value
  14776. defaults to "320x518" (used for a randomly generated initial state).
  14777. @item scroll
  14778. If set to 1, scroll the output upward when all the rows in the output
  14779. have been already filled. If set to 0, the new generated row will be
  14780. written over the top row just after the bottom row is filled.
  14781. Defaults to 1.
  14782. @item start_full, full
  14783. If set to 1, completely fill the output with generated rows before
  14784. outputting the first frame.
  14785. This is the default behavior, for disabling set the value to 0.
  14786. @item stitch
  14787. If set to 1, stitch the left and right row edges together.
  14788. This is the default behavior, for disabling set the value to 0.
  14789. @end table
  14790. @subsection Examples
  14791. @itemize
  14792. @item
  14793. Read the initial state from @file{pattern}, and specify an output of
  14794. size 200x400.
  14795. @example
  14796. cellauto=f=pattern:s=200x400
  14797. @end example
  14798. @item
  14799. Generate a random initial row with a width of 200 cells, with a fill
  14800. ratio of 2/3:
  14801. @example
  14802. cellauto=ratio=2/3:s=200x200
  14803. @end example
  14804. @item
  14805. Create a pattern generated by rule 18 starting by a single alive cell
  14806. centered on an initial row with width 100:
  14807. @example
  14808. cellauto=p=@@:s=100x400:full=0:rule=18
  14809. @end example
  14810. @item
  14811. Specify a more elaborated initial pattern:
  14812. @example
  14813. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14814. @end example
  14815. @end itemize
  14816. @anchor{coreimagesrc}
  14817. @section coreimagesrc
  14818. Video source generated on GPU using Apple's CoreImage API on OSX.
  14819. This video source is a specialized version of the @ref{coreimage} video filter.
  14820. Use a core image generator at the beginning of the applied filterchain to
  14821. generate the content.
  14822. The coreimagesrc video source accepts the following options:
  14823. @table @option
  14824. @item list_generators
  14825. List all available generators along with all their respective options as well as
  14826. possible minimum and maximum values along with the default values.
  14827. @example
  14828. list_generators=true
  14829. @end example
  14830. @item size, s
  14831. Specify the size of the sourced video. For the syntax of this option, check the
  14832. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14833. The default value is @code{320x240}.
  14834. @item rate, r
  14835. Specify the frame rate of the sourced video, as the number of frames
  14836. generated per second. It has to be a string in the format
  14837. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14838. number or a valid video frame rate abbreviation. The default value is
  14839. "25".
  14840. @item sar
  14841. Set the sample aspect ratio of the sourced video.
  14842. @item duration, d
  14843. Set the duration of the sourced video. See
  14844. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14845. for the accepted syntax.
  14846. If not specified, or the expressed duration is negative, the video is
  14847. supposed to be generated forever.
  14848. @end table
  14849. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14850. A complete filterchain can be used for further processing of the
  14851. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14852. and examples for details.
  14853. @subsection Examples
  14854. @itemize
  14855. @item
  14856. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14857. given as complete and escaped command-line for Apple's standard bash shell:
  14858. @example
  14859. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14860. @end example
  14861. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14862. need for a nullsrc video source.
  14863. @end itemize
  14864. @section mandelbrot
  14865. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14866. point specified with @var{start_x} and @var{start_y}.
  14867. This source accepts the following options:
  14868. @table @option
  14869. @item end_pts
  14870. Set the terminal pts value. Default value is 400.
  14871. @item end_scale
  14872. Set the terminal scale value.
  14873. Must be a floating point value. Default value is 0.3.
  14874. @item inner
  14875. Set the inner coloring mode, that is the algorithm used to draw the
  14876. Mandelbrot fractal internal region.
  14877. It shall assume one of the following values:
  14878. @table @option
  14879. @item black
  14880. Set black mode.
  14881. @item convergence
  14882. Show time until convergence.
  14883. @item mincol
  14884. Set color based on point closest to the origin of the iterations.
  14885. @item period
  14886. Set period mode.
  14887. @end table
  14888. Default value is @var{mincol}.
  14889. @item bailout
  14890. Set the bailout value. Default value is 10.0.
  14891. @item maxiter
  14892. Set the maximum of iterations performed by the rendering
  14893. algorithm. Default value is 7189.
  14894. @item outer
  14895. Set outer coloring mode.
  14896. It shall assume one of following values:
  14897. @table @option
  14898. @item iteration_count
  14899. Set iteration cound mode.
  14900. @item normalized_iteration_count
  14901. set normalized iteration count mode.
  14902. @end table
  14903. Default value is @var{normalized_iteration_count}.
  14904. @item rate, r
  14905. Set frame rate, expressed as number of frames per second. Default
  14906. value is "25".
  14907. @item size, s
  14908. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14909. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14910. @item start_scale
  14911. Set the initial scale value. Default value is 3.0.
  14912. @item start_x
  14913. Set the initial x position. Must be a floating point value between
  14914. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14915. @item start_y
  14916. Set the initial y position. Must be a floating point value between
  14917. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14918. @end table
  14919. @section mptestsrc
  14920. Generate various test patterns, as generated by the MPlayer test filter.
  14921. The size of the generated video is fixed, and is 256x256.
  14922. This source is useful in particular for testing encoding features.
  14923. This source accepts the following options:
  14924. @table @option
  14925. @item rate, r
  14926. Specify the frame rate of the sourced video, as the number of frames
  14927. generated per second. It has to be a string in the format
  14928. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14929. number or a valid video frame rate abbreviation. The default value is
  14930. "25".
  14931. @item duration, d
  14932. Set the duration of the sourced video. See
  14933. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14934. for the accepted syntax.
  14935. If not specified, or the expressed duration is negative, the video is
  14936. supposed to be generated forever.
  14937. @item test, t
  14938. Set the number or the name of the test to perform. Supported tests are:
  14939. @table @option
  14940. @item dc_luma
  14941. @item dc_chroma
  14942. @item freq_luma
  14943. @item freq_chroma
  14944. @item amp_luma
  14945. @item amp_chroma
  14946. @item cbp
  14947. @item mv
  14948. @item ring1
  14949. @item ring2
  14950. @item all
  14951. @end table
  14952. Default value is "all", which will cycle through the list of all tests.
  14953. @end table
  14954. Some examples:
  14955. @example
  14956. mptestsrc=t=dc_luma
  14957. @end example
  14958. will generate a "dc_luma" test pattern.
  14959. @section frei0r_src
  14960. Provide a frei0r source.
  14961. To enable compilation of this filter you need to install the frei0r
  14962. header and configure FFmpeg with @code{--enable-frei0r}.
  14963. This source accepts the following parameters:
  14964. @table @option
  14965. @item size
  14966. The size of the video to generate. For the syntax of this option, check the
  14967. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14968. @item framerate
  14969. The framerate of the generated video. It may be a string of the form
  14970. @var{num}/@var{den} or a frame rate abbreviation.
  14971. @item filter_name
  14972. The name to the frei0r source to load. For more information regarding frei0r and
  14973. how to set the parameters, read the @ref{frei0r} section in the video filters
  14974. documentation.
  14975. @item filter_params
  14976. A '|'-separated list of parameters to pass to the frei0r source.
  14977. @end table
  14978. For example, to generate a frei0r partik0l source with size 200x200
  14979. and frame rate 10 which is overlaid on the overlay filter main input:
  14980. @example
  14981. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14982. @end example
  14983. @section life
  14984. Generate a life pattern.
  14985. This source is based on a generalization of John Conway's life game.
  14986. The sourced input represents a life grid, each pixel represents a cell
  14987. which can be in one of two possible states, alive or dead. Every cell
  14988. interacts with its eight neighbours, which are the cells that are
  14989. horizontally, vertically, or diagonally adjacent.
  14990. At each interaction the grid evolves according to the adopted rule,
  14991. which specifies the number of neighbor alive cells which will make a
  14992. cell stay alive or born. The @option{rule} option allows one to specify
  14993. the rule to adopt.
  14994. This source accepts the following options:
  14995. @table @option
  14996. @item filename, f
  14997. Set the file from which to read the initial grid state. In the file,
  14998. each non-whitespace character is considered an alive cell, and newline
  14999. is used to delimit the end of each row.
  15000. If this option is not specified, the initial grid is generated
  15001. randomly.
  15002. @item rate, r
  15003. Set the video rate, that is the number of frames generated per second.
  15004. Default is 25.
  15005. @item random_fill_ratio, ratio
  15006. Set the random fill ratio for the initial random grid. It is a
  15007. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15008. It is ignored when a file is specified.
  15009. @item random_seed, seed
  15010. Set the seed for filling the initial random grid, must be an integer
  15011. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15012. set to -1, the filter will try to use a good random seed on a best
  15013. effort basis.
  15014. @item rule
  15015. Set the life rule.
  15016. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15017. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15018. @var{NS} specifies the number of alive neighbor cells which make a
  15019. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15020. which make a dead cell to become alive (i.e. to "born").
  15021. "s" and "b" can be used in place of "S" and "B", respectively.
  15022. Alternatively a rule can be specified by an 18-bits integer. The 9
  15023. high order bits are used to encode the next cell state if it is alive
  15024. for each number of neighbor alive cells, the low order bits specify
  15025. the rule for "borning" new cells. Higher order bits encode for an
  15026. higher number of neighbor cells.
  15027. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15028. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15029. Default value is "S23/B3", which is the original Conway's game of life
  15030. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15031. cells, and will born a new cell if there are three alive cells around
  15032. a dead cell.
  15033. @item size, s
  15034. Set the size of the output video. For the syntax of this option, check the
  15035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15036. If @option{filename} is specified, the size is set by default to the
  15037. same size of the input file. If @option{size} is set, it must contain
  15038. the size specified in the input file, and the initial grid defined in
  15039. that file is centered in the larger resulting area.
  15040. If a filename is not specified, the size value defaults to "320x240"
  15041. (used for a randomly generated initial grid).
  15042. @item stitch
  15043. If set to 1, stitch the left and right grid edges together, and the
  15044. top and bottom edges also. Defaults to 1.
  15045. @item mold
  15046. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15047. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15048. value from 0 to 255.
  15049. @item life_color
  15050. Set the color of living (or new born) cells.
  15051. @item death_color
  15052. Set the color of dead cells. If @option{mold} is set, this is the first color
  15053. used to represent a dead cell.
  15054. @item mold_color
  15055. Set mold color, for definitely dead and moldy cells.
  15056. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15057. ffmpeg-utils manual,ffmpeg-utils}.
  15058. @end table
  15059. @subsection Examples
  15060. @itemize
  15061. @item
  15062. Read a grid from @file{pattern}, and center it on a grid of size
  15063. 300x300 pixels:
  15064. @example
  15065. life=f=pattern:s=300x300
  15066. @end example
  15067. @item
  15068. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15069. @example
  15070. life=ratio=2/3:s=200x200
  15071. @end example
  15072. @item
  15073. Specify a custom rule for evolving a randomly generated grid:
  15074. @example
  15075. life=rule=S14/B34
  15076. @end example
  15077. @item
  15078. Full example with slow death effect (mold) using @command{ffplay}:
  15079. @example
  15080. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15081. @end example
  15082. @end itemize
  15083. @anchor{allrgb}
  15084. @anchor{allyuv}
  15085. @anchor{color}
  15086. @anchor{haldclutsrc}
  15087. @anchor{nullsrc}
  15088. @anchor{pal75bars}
  15089. @anchor{pal100bars}
  15090. @anchor{rgbtestsrc}
  15091. @anchor{smptebars}
  15092. @anchor{smptehdbars}
  15093. @anchor{testsrc}
  15094. @anchor{testsrc2}
  15095. @anchor{yuvtestsrc}
  15096. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15097. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15098. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15099. The @code{color} source provides an uniformly colored input.
  15100. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15101. @ref{haldclut} filter.
  15102. The @code{nullsrc} source returns unprocessed video frames. It is
  15103. mainly useful to be employed in analysis / debugging tools, or as the
  15104. source for filters which ignore the input data.
  15105. The @code{pal75bars} source generates a color bars pattern, based on
  15106. EBU PAL recommendations with 75% color levels.
  15107. The @code{pal100bars} source generates a color bars pattern, based on
  15108. EBU PAL recommendations with 100% color levels.
  15109. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15110. detecting RGB vs BGR issues. You should see a red, green and blue
  15111. stripe from top to bottom.
  15112. The @code{smptebars} source generates a color bars pattern, based on
  15113. the SMPTE Engineering Guideline EG 1-1990.
  15114. The @code{smptehdbars} source generates a color bars pattern, based on
  15115. the SMPTE RP 219-2002.
  15116. The @code{testsrc} source generates a test video pattern, showing a
  15117. color pattern, a scrolling gradient and a timestamp. This is mainly
  15118. intended for testing purposes.
  15119. The @code{testsrc2} source is similar to testsrc, but supports more
  15120. pixel formats instead of just @code{rgb24}. This allows using it as an
  15121. input for other tests without requiring a format conversion.
  15122. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15123. see a y, cb and cr stripe from top to bottom.
  15124. The sources accept the following parameters:
  15125. @table @option
  15126. @item level
  15127. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15128. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15129. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15130. coded on a @code{1/(N*N)} scale.
  15131. @item color, c
  15132. Specify the color of the source, only available in the @code{color}
  15133. source. For the syntax of this option, check the
  15134. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15135. @item size, s
  15136. Specify the size of the sourced video. For the syntax of this option, check the
  15137. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15138. The default value is @code{320x240}.
  15139. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15140. @code{haldclutsrc} filters.
  15141. @item rate, r
  15142. Specify the frame rate of the sourced video, as the number of frames
  15143. generated per second. It has to be a string in the format
  15144. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15145. number or a valid video frame rate abbreviation. The default value is
  15146. "25".
  15147. @item duration, d
  15148. Set the duration of the sourced video. See
  15149. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15150. for the accepted syntax.
  15151. If not specified, or the expressed duration is negative, the video is
  15152. supposed to be generated forever.
  15153. @item sar
  15154. Set the sample aspect ratio of the sourced video.
  15155. @item alpha
  15156. Specify the alpha (opacity) of the background, only available in the
  15157. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15158. 255 (fully opaque, the default).
  15159. @item decimals, n
  15160. Set the number of decimals to show in the timestamp, only available in the
  15161. @code{testsrc} source.
  15162. The displayed timestamp value will correspond to the original
  15163. timestamp value multiplied by the power of 10 of the specified
  15164. value. Default value is 0.
  15165. @end table
  15166. @subsection Examples
  15167. @itemize
  15168. @item
  15169. Generate a video with a duration of 5.3 seconds, with size
  15170. 176x144 and a frame rate of 10 frames per second:
  15171. @example
  15172. testsrc=duration=5.3:size=qcif:rate=10
  15173. @end example
  15174. @item
  15175. The following graph description will generate a red source
  15176. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15177. frames per second:
  15178. @example
  15179. color=c=red@@0.2:s=qcif:r=10
  15180. @end example
  15181. @item
  15182. If the input content is to be ignored, @code{nullsrc} can be used. The
  15183. following command generates noise in the luminance plane by employing
  15184. the @code{geq} filter:
  15185. @example
  15186. nullsrc=s=256x256, geq=random(1)*255:128:128
  15187. @end example
  15188. @end itemize
  15189. @subsection Commands
  15190. The @code{color} source supports the following commands:
  15191. @table @option
  15192. @item c, color
  15193. Set the color of the created image. Accepts the same syntax of the
  15194. corresponding @option{color} option.
  15195. @end table
  15196. @section openclsrc
  15197. Generate video using an OpenCL program.
  15198. @table @option
  15199. @item source
  15200. OpenCL program source file.
  15201. @item kernel
  15202. Kernel name in program.
  15203. @item size, s
  15204. Size of frames to generate. This must be set.
  15205. @item format
  15206. Pixel format to use for the generated frames. This must be set.
  15207. @item rate, r
  15208. Number of frames generated every second. Default value is '25'.
  15209. @end table
  15210. For details of how the program loading works, see the @ref{program_opencl}
  15211. filter.
  15212. Example programs:
  15213. @itemize
  15214. @item
  15215. Generate a colour ramp by setting pixel values from the position of the pixel
  15216. in the output image. (Note that this will work with all pixel formats, but
  15217. the generated output will not be the same.)
  15218. @verbatim
  15219. __kernel void ramp(__write_only image2d_t dst,
  15220. unsigned int index)
  15221. {
  15222. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15223. float4 val;
  15224. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15225. write_imagef(dst, loc, val);
  15226. }
  15227. @end verbatim
  15228. @item
  15229. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15230. @verbatim
  15231. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15232. unsigned int index)
  15233. {
  15234. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15235. float4 value = 0.0f;
  15236. int x = loc.x + index;
  15237. int y = loc.y + index;
  15238. while (x > 0 || y > 0) {
  15239. if (x % 3 == 1 && y % 3 == 1) {
  15240. value = 1.0f;
  15241. break;
  15242. }
  15243. x /= 3;
  15244. y /= 3;
  15245. }
  15246. write_imagef(dst, loc, value);
  15247. }
  15248. @end verbatim
  15249. @end itemize
  15250. @c man end VIDEO SOURCES
  15251. @chapter Video Sinks
  15252. @c man begin VIDEO SINKS
  15253. Below is a description of the currently available video sinks.
  15254. @section buffersink
  15255. Buffer video frames, and make them available to the end of the filter
  15256. graph.
  15257. This sink is mainly intended for programmatic use, in particular
  15258. through the interface defined in @file{libavfilter/buffersink.h}
  15259. or the options system.
  15260. It accepts a pointer to an AVBufferSinkContext structure, which
  15261. defines the incoming buffers' formats, to be passed as the opaque
  15262. parameter to @code{avfilter_init_filter} for initialization.
  15263. @section nullsink
  15264. Null video sink: do absolutely nothing with the input video. It is
  15265. mainly useful as a template and for use in analysis / debugging
  15266. tools.
  15267. @c man end VIDEO SINKS
  15268. @chapter Multimedia Filters
  15269. @c man begin MULTIMEDIA FILTERS
  15270. Below is a description of the currently available multimedia filters.
  15271. @section abitscope
  15272. Convert input audio to a video output, displaying the audio bit scope.
  15273. The filter accepts the following options:
  15274. @table @option
  15275. @item rate, r
  15276. Set frame rate, expressed as number of frames per second. Default
  15277. value is "25".
  15278. @item size, s
  15279. Specify the video size for the output. For the syntax of this option, check the
  15280. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15281. Default value is @code{1024x256}.
  15282. @item colors
  15283. Specify list of colors separated by space or by '|' which will be used to
  15284. draw channels. Unrecognized or missing colors will be replaced
  15285. by white color.
  15286. @end table
  15287. @section ahistogram
  15288. Convert input audio to a video output, displaying the volume histogram.
  15289. The filter accepts the following options:
  15290. @table @option
  15291. @item dmode
  15292. Specify how histogram is calculated.
  15293. It accepts the following values:
  15294. @table @samp
  15295. @item single
  15296. Use single histogram for all channels.
  15297. @item separate
  15298. Use separate histogram for each channel.
  15299. @end table
  15300. Default is @code{single}.
  15301. @item rate, r
  15302. Set frame rate, expressed as number of frames per second. Default
  15303. value is "25".
  15304. @item size, s
  15305. Specify the video size for the output. For the syntax of this option, check the
  15306. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15307. Default value is @code{hd720}.
  15308. @item scale
  15309. Set display scale.
  15310. It accepts the following values:
  15311. @table @samp
  15312. @item log
  15313. logarithmic
  15314. @item sqrt
  15315. square root
  15316. @item cbrt
  15317. cubic root
  15318. @item lin
  15319. linear
  15320. @item rlog
  15321. reverse logarithmic
  15322. @end table
  15323. Default is @code{log}.
  15324. @item ascale
  15325. Set amplitude scale.
  15326. It accepts the following values:
  15327. @table @samp
  15328. @item log
  15329. logarithmic
  15330. @item lin
  15331. linear
  15332. @end table
  15333. Default is @code{log}.
  15334. @item acount
  15335. Set how much frames to accumulate in histogram.
  15336. Defauls is 1. Setting this to -1 accumulates all frames.
  15337. @item rheight
  15338. Set histogram ratio of window height.
  15339. @item slide
  15340. Set sonogram sliding.
  15341. It accepts the following values:
  15342. @table @samp
  15343. @item replace
  15344. replace old rows with new ones.
  15345. @item scroll
  15346. scroll from top to bottom.
  15347. @end table
  15348. Default is @code{replace}.
  15349. @end table
  15350. @section aphasemeter
  15351. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15352. representing mean phase of current audio frame. A video output can also be produced and is
  15353. enabled by default. The audio is passed through as first output.
  15354. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15355. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15356. and @code{1} means channels are in phase.
  15357. The filter accepts the following options, all related to its video output:
  15358. @table @option
  15359. @item rate, r
  15360. Set the output frame rate. Default value is @code{25}.
  15361. @item size, s
  15362. Set the video size for the output. For the syntax of this option, check the
  15363. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15364. Default value is @code{800x400}.
  15365. @item rc
  15366. @item gc
  15367. @item bc
  15368. Specify the red, green, blue contrast. Default values are @code{2},
  15369. @code{7} and @code{1}.
  15370. Allowed range is @code{[0, 255]}.
  15371. @item mpc
  15372. Set color which will be used for drawing median phase. If color is
  15373. @code{none} which is default, no median phase value will be drawn.
  15374. @item video
  15375. Enable video output. Default is enabled.
  15376. @end table
  15377. @section avectorscope
  15378. Convert input audio to a video output, representing the audio vector
  15379. scope.
  15380. The filter is used to measure the difference between channels of stereo
  15381. audio stream. A monoaural signal, consisting of identical left and right
  15382. signal, results in straight vertical line. Any stereo separation is visible
  15383. as a deviation from this line, creating a Lissajous figure.
  15384. If the straight (or deviation from it) but horizontal line appears this
  15385. indicates that the left and right channels are out of phase.
  15386. The filter accepts the following options:
  15387. @table @option
  15388. @item mode, m
  15389. Set the vectorscope mode.
  15390. Available values are:
  15391. @table @samp
  15392. @item lissajous
  15393. Lissajous rotated by 45 degrees.
  15394. @item lissajous_xy
  15395. Same as above but not rotated.
  15396. @item polar
  15397. Shape resembling half of circle.
  15398. @end table
  15399. Default value is @samp{lissajous}.
  15400. @item size, s
  15401. Set the video size for the output. For the syntax of this option, check the
  15402. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15403. Default value is @code{400x400}.
  15404. @item rate, r
  15405. Set the output frame rate. Default value is @code{25}.
  15406. @item rc
  15407. @item gc
  15408. @item bc
  15409. @item ac
  15410. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15411. @code{160}, @code{80} and @code{255}.
  15412. Allowed range is @code{[0, 255]}.
  15413. @item rf
  15414. @item gf
  15415. @item bf
  15416. @item af
  15417. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15418. @code{10}, @code{5} and @code{5}.
  15419. Allowed range is @code{[0, 255]}.
  15420. @item zoom
  15421. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15422. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15423. @item draw
  15424. Set the vectorscope drawing mode.
  15425. Available values are:
  15426. @table @samp
  15427. @item dot
  15428. Draw dot for each sample.
  15429. @item line
  15430. Draw line between previous and current sample.
  15431. @end table
  15432. Default value is @samp{dot}.
  15433. @item scale
  15434. Specify amplitude scale of audio samples.
  15435. Available values are:
  15436. @table @samp
  15437. @item lin
  15438. Linear.
  15439. @item sqrt
  15440. Square root.
  15441. @item cbrt
  15442. Cubic root.
  15443. @item log
  15444. Logarithmic.
  15445. @end table
  15446. @item swap
  15447. Swap left channel axis with right channel axis.
  15448. @item mirror
  15449. Mirror axis.
  15450. @table @samp
  15451. @item none
  15452. No mirror.
  15453. @item x
  15454. Mirror only x axis.
  15455. @item y
  15456. Mirror only y axis.
  15457. @item xy
  15458. Mirror both axis.
  15459. @end table
  15460. @end table
  15461. @subsection Examples
  15462. @itemize
  15463. @item
  15464. Complete example using @command{ffplay}:
  15465. @example
  15466. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15467. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15468. @end example
  15469. @end itemize
  15470. @section bench, abench
  15471. Benchmark part of a filtergraph.
  15472. The filter accepts the following options:
  15473. @table @option
  15474. @item action
  15475. Start or stop a timer.
  15476. Available values are:
  15477. @table @samp
  15478. @item start
  15479. Get the current time, set it as frame metadata (using the key
  15480. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15481. @item stop
  15482. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15483. the input frame metadata to get the time difference. Time difference, average,
  15484. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15485. @code{min}) are then printed. The timestamps are expressed in seconds.
  15486. @end table
  15487. @end table
  15488. @subsection Examples
  15489. @itemize
  15490. @item
  15491. Benchmark @ref{selectivecolor} filter:
  15492. @example
  15493. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15494. @end example
  15495. @end itemize
  15496. @section concat
  15497. Concatenate audio and video streams, joining them together one after the
  15498. other.
  15499. The filter works on segments of synchronized video and audio streams. All
  15500. segments must have the same number of streams of each type, and that will
  15501. also be the number of streams at output.
  15502. The filter accepts the following options:
  15503. @table @option
  15504. @item n
  15505. Set the number of segments. Default is 2.
  15506. @item v
  15507. Set the number of output video streams, that is also the number of video
  15508. streams in each segment. Default is 1.
  15509. @item a
  15510. Set the number of output audio streams, that is also the number of audio
  15511. streams in each segment. Default is 0.
  15512. @item unsafe
  15513. Activate unsafe mode: do not fail if segments have a different format.
  15514. @end table
  15515. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15516. @var{a} audio outputs.
  15517. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15518. segment, in the same order as the outputs, then the inputs for the second
  15519. segment, etc.
  15520. Related streams do not always have exactly the same duration, for various
  15521. reasons including codec frame size or sloppy authoring. For that reason,
  15522. related synchronized streams (e.g. a video and its audio track) should be
  15523. concatenated at once. The concat filter will use the duration of the longest
  15524. stream in each segment (except the last one), and if necessary pad shorter
  15525. audio streams with silence.
  15526. For this filter to work correctly, all segments must start at timestamp 0.
  15527. All corresponding streams must have the same parameters in all segments; the
  15528. filtering system will automatically select a common pixel format for video
  15529. streams, and a common sample format, sample rate and channel layout for
  15530. audio streams, but other settings, such as resolution, must be converted
  15531. explicitly by the user.
  15532. Different frame rates are acceptable but will result in variable frame rate
  15533. at output; be sure to configure the output file to handle it.
  15534. @subsection Examples
  15535. @itemize
  15536. @item
  15537. Concatenate an opening, an episode and an ending, all in bilingual version
  15538. (video in stream 0, audio in streams 1 and 2):
  15539. @example
  15540. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15541. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15542. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15543. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15544. @end example
  15545. @item
  15546. Concatenate two parts, handling audio and video separately, using the
  15547. (a)movie sources, and adjusting the resolution:
  15548. @example
  15549. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15550. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15551. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15552. @end example
  15553. Note that a desync will happen at the stitch if the audio and video streams
  15554. do not have exactly the same duration in the first file.
  15555. @end itemize
  15556. @subsection Commands
  15557. This filter supports the following commands:
  15558. @table @option
  15559. @item next
  15560. Close the current segment and step to the next one
  15561. @end table
  15562. @section drawgraph, adrawgraph
  15563. Draw a graph using input video or audio metadata.
  15564. It accepts the following parameters:
  15565. @table @option
  15566. @item m1
  15567. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15568. @item fg1
  15569. Set 1st foreground color expression.
  15570. @item m2
  15571. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15572. @item fg2
  15573. Set 2nd foreground color expression.
  15574. @item m3
  15575. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15576. @item fg3
  15577. Set 3rd foreground color expression.
  15578. @item m4
  15579. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15580. @item fg4
  15581. Set 4th foreground color expression.
  15582. @item min
  15583. Set minimal value of metadata value.
  15584. @item max
  15585. Set maximal value of metadata value.
  15586. @item bg
  15587. Set graph background color. Default is white.
  15588. @item mode
  15589. Set graph mode.
  15590. Available values for mode is:
  15591. @table @samp
  15592. @item bar
  15593. @item dot
  15594. @item line
  15595. @end table
  15596. Default is @code{line}.
  15597. @item slide
  15598. Set slide mode.
  15599. Available values for slide is:
  15600. @table @samp
  15601. @item frame
  15602. Draw new frame when right border is reached.
  15603. @item replace
  15604. Replace old columns with new ones.
  15605. @item scroll
  15606. Scroll from right to left.
  15607. @item rscroll
  15608. Scroll from left to right.
  15609. @item picture
  15610. Draw single picture.
  15611. @end table
  15612. Default is @code{frame}.
  15613. @item size
  15614. Set size of graph video. For the syntax of this option, check the
  15615. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15616. The default value is @code{900x256}.
  15617. The foreground color expressions can use the following variables:
  15618. @table @option
  15619. @item MIN
  15620. Minimal value of metadata value.
  15621. @item MAX
  15622. Maximal value of metadata value.
  15623. @item VAL
  15624. Current metadata key value.
  15625. @end table
  15626. The color is defined as 0xAABBGGRR.
  15627. @end table
  15628. Example using metadata from @ref{signalstats} filter:
  15629. @example
  15630. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15631. @end example
  15632. Example using metadata from @ref{ebur128} filter:
  15633. @example
  15634. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15635. @end example
  15636. @anchor{ebur128}
  15637. @section ebur128
  15638. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15639. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15640. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15641. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15642. The filter also has a video output (see the @var{video} option) with a real
  15643. time graph to observe the loudness evolution. The graphic contains the logged
  15644. message mentioned above, so it is not printed anymore when this option is set,
  15645. unless the verbose logging is set. The main graphing area contains the
  15646. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15647. the momentary loudness (400 milliseconds), but can optionally be configured
  15648. to instead display short-term loudness (see @var{gauge}).
  15649. The green area marks a +/- 1LU target range around the target loudness
  15650. (-23LUFS by default, unless modified through @var{target}).
  15651. More information about the Loudness Recommendation EBU R128 on
  15652. @url{http://tech.ebu.ch/loudness}.
  15653. The filter accepts the following options:
  15654. @table @option
  15655. @item video
  15656. Activate the video output. The audio stream is passed unchanged whether this
  15657. option is set or no. The video stream will be the first output stream if
  15658. activated. Default is @code{0}.
  15659. @item size
  15660. Set the video size. This option is for video only. For the syntax of this
  15661. option, check the
  15662. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15663. Default and minimum resolution is @code{640x480}.
  15664. @item meter
  15665. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15666. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15667. other integer value between this range is allowed.
  15668. @item metadata
  15669. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15670. into 100ms output frames, each of them containing various loudness information
  15671. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15672. Default is @code{0}.
  15673. @item framelog
  15674. Force the frame logging level.
  15675. Available values are:
  15676. @table @samp
  15677. @item info
  15678. information logging level
  15679. @item verbose
  15680. verbose logging level
  15681. @end table
  15682. By default, the logging level is set to @var{info}. If the @option{video} or
  15683. the @option{metadata} options are set, it switches to @var{verbose}.
  15684. @item peak
  15685. Set peak mode(s).
  15686. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15687. values are:
  15688. @table @samp
  15689. @item none
  15690. Disable any peak mode (default).
  15691. @item sample
  15692. Enable sample-peak mode.
  15693. Simple peak mode looking for the higher sample value. It logs a message
  15694. for sample-peak (identified by @code{SPK}).
  15695. @item true
  15696. Enable true-peak mode.
  15697. If enabled, the peak lookup is done on an over-sampled version of the input
  15698. stream for better peak accuracy. It logs a message for true-peak.
  15699. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15700. This mode requires a build with @code{libswresample}.
  15701. @end table
  15702. @item dualmono
  15703. Treat mono input files as "dual mono". If a mono file is intended for playback
  15704. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15705. If set to @code{true}, this option will compensate for this effect.
  15706. Multi-channel input files are not affected by this option.
  15707. @item panlaw
  15708. Set a specific pan law to be used for the measurement of dual mono files.
  15709. This parameter is optional, and has a default value of -3.01dB.
  15710. @item target
  15711. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15712. This parameter is optional and has a default value of -23LUFS as specified
  15713. by EBU R128. However, material published online may prefer a level of -16LUFS
  15714. (e.g. for use with podcasts or video platforms).
  15715. @item gauge
  15716. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15717. @code{shortterm}. By default the momentary value will be used, but in certain
  15718. scenarios it may be more useful to observe the short term value instead (e.g.
  15719. live mixing).
  15720. @item scale
  15721. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15722. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15723. video output, not the summary or continuous log output.
  15724. @end table
  15725. @subsection Examples
  15726. @itemize
  15727. @item
  15728. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15729. @example
  15730. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15731. @end example
  15732. @item
  15733. Run an analysis with @command{ffmpeg}:
  15734. @example
  15735. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15736. @end example
  15737. @end itemize
  15738. @section interleave, ainterleave
  15739. Temporally interleave frames from several inputs.
  15740. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15741. These filters read frames from several inputs and send the oldest
  15742. queued frame to the output.
  15743. Input streams must have well defined, monotonically increasing frame
  15744. timestamp values.
  15745. In order to submit one frame to output, these filters need to enqueue
  15746. at least one frame for each input, so they cannot work in case one
  15747. input is not yet terminated and will not receive incoming frames.
  15748. For example consider the case when one input is a @code{select} filter
  15749. which always drops input frames. The @code{interleave} filter will keep
  15750. reading from that input, but it will never be able to send new frames
  15751. to output until the input sends an end-of-stream signal.
  15752. Also, depending on inputs synchronization, the filters will drop
  15753. frames in case one input receives more frames than the other ones, and
  15754. the queue is already filled.
  15755. These filters accept the following options:
  15756. @table @option
  15757. @item nb_inputs, n
  15758. Set the number of different inputs, it is 2 by default.
  15759. @end table
  15760. @subsection Examples
  15761. @itemize
  15762. @item
  15763. Interleave frames belonging to different streams using @command{ffmpeg}:
  15764. @example
  15765. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15766. @end example
  15767. @item
  15768. Add flickering blur effect:
  15769. @example
  15770. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15771. @end example
  15772. @end itemize
  15773. @section metadata, ametadata
  15774. Manipulate frame metadata.
  15775. This filter accepts the following options:
  15776. @table @option
  15777. @item mode
  15778. Set mode of operation of the filter.
  15779. Can be one of the following:
  15780. @table @samp
  15781. @item select
  15782. If both @code{value} and @code{key} is set, select frames
  15783. which have such metadata. If only @code{key} is set, select
  15784. every frame that has such key in metadata.
  15785. @item add
  15786. Add new metadata @code{key} and @code{value}. If key is already available
  15787. do nothing.
  15788. @item modify
  15789. Modify value of already present key.
  15790. @item delete
  15791. If @code{value} is set, delete only keys that have such value.
  15792. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15793. the frame.
  15794. @item print
  15795. Print key and its value if metadata was found. If @code{key} is not set print all
  15796. metadata values available in frame.
  15797. @end table
  15798. @item key
  15799. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15800. @item value
  15801. Set metadata value which will be used. This option is mandatory for
  15802. @code{modify} and @code{add} mode.
  15803. @item function
  15804. Which function to use when comparing metadata value and @code{value}.
  15805. Can be one of following:
  15806. @table @samp
  15807. @item same_str
  15808. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15809. @item starts_with
  15810. Values are interpreted as strings, returns true if metadata value starts with
  15811. the @code{value} option string.
  15812. @item less
  15813. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15814. @item equal
  15815. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15816. @item greater
  15817. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15818. @item expr
  15819. Values are interpreted as floats, returns true if expression from option @code{expr}
  15820. evaluates to true.
  15821. @end table
  15822. @item expr
  15823. Set expression which is used when @code{function} is set to @code{expr}.
  15824. The expression is evaluated through the eval API and can contain the following
  15825. constants:
  15826. @table @option
  15827. @item VALUE1
  15828. Float representation of @code{value} from metadata key.
  15829. @item VALUE2
  15830. Float representation of @code{value} as supplied by user in @code{value} option.
  15831. @end table
  15832. @item file
  15833. If specified in @code{print} mode, output is written to the named file. Instead of
  15834. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15835. for standard output. If @code{file} option is not set, output is written to the log
  15836. with AV_LOG_INFO loglevel.
  15837. @end table
  15838. @subsection Examples
  15839. @itemize
  15840. @item
  15841. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15842. between 0 and 1.
  15843. @example
  15844. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15845. @end example
  15846. @item
  15847. Print silencedetect output to file @file{metadata.txt}.
  15848. @example
  15849. silencedetect,ametadata=mode=print:file=metadata.txt
  15850. @end example
  15851. @item
  15852. Direct all metadata to a pipe with file descriptor 4.
  15853. @example
  15854. metadata=mode=print:file='pipe\:4'
  15855. @end example
  15856. @end itemize
  15857. @section perms, aperms
  15858. Set read/write permissions for the output frames.
  15859. These filters are mainly aimed at developers to test direct path in the
  15860. following filter in the filtergraph.
  15861. The filters accept the following options:
  15862. @table @option
  15863. @item mode
  15864. Select the permissions mode.
  15865. It accepts the following values:
  15866. @table @samp
  15867. @item none
  15868. Do nothing. This is the default.
  15869. @item ro
  15870. Set all the output frames read-only.
  15871. @item rw
  15872. Set all the output frames directly writable.
  15873. @item toggle
  15874. Make the frame read-only if writable, and writable if read-only.
  15875. @item random
  15876. Set each output frame read-only or writable randomly.
  15877. @end table
  15878. @item seed
  15879. Set the seed for the @var{random} mode, must be an integer included between
  15880. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15881. @code{-1}, the filter will try to use a good random seed on a best effort
  15882. basis.
  15883. @end table
  15884. Note: in case of auto-inserted filter between the permission filter and the
  15885. following one, the permission might not be received as expected in that
  15886. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15887. perms/aperms filter can avoid this problem.
  15888. @section realtime, arealtime
  15889. Slow down filtering to match real time approximately.
  15890. These filters will pause the filtering for a variable amount of time to
  15891. match the output rate with the input timestamps.
  15892. They are similar to the @option{re} option to @code{ffmpeg}.
  15893. They accept the following options:
  15894. @table @option
  15895. @item limit
  15896. Time limit for the pauses. Any pause longer than that will be considered
  15897. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15898. @end table
  15899. @anchor{select}
  15900. @section select, aselect
  15901. Select frames to pass in output.
  15902. This filter accepts the following options:
  15903. @table @option
  15904. @item expr, e
  15905. Set expression, which is evaluated for each input frame.
  15906. If the expression is evaluated to zero, the frame is discarded.
  15907. If the evaluation result is negative or NaN, the frame is sent to the
  15908. first output; otherwise it is sent to the output with index
  15909. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15910. For example a value of @code{1.2} corresponds to the output with index
  15911. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15912. @item outputs, n
  15913. Set the number of outputs. The output to which to send the selected
  15914. frame is based on the result of the evaluation. Default value is 1.
  15915. @end table
  15916. The expression can contain the following constants:
  15917. @table @option
  15918. @item n
  15919. The (sequential) number of the filtered frame, starting from 0.
  15920. @item selected_n
  15921. The (sequential) number of the selected frame, starting from 0.
  15922. @item prev_selected_n
  15923. The sequential number of the last selected frame. It's NAN if undefined.
  15924. @item TB
  15925. The timebase of the input timestamps.
  15926. @item pts
  15927. The PTS (Presentation TimeStamp) of the filtered video frame,
  15928. expressed in @var{TB} units. It's NAN if undefined.
  15929. @item t
  15930. The PTS of the filtered video frame,
  15931. expressed in seconds. It's NAN if undefined.
  15932. @item prev_pts
  15933. The PTS of the previously filtered video frame. It's NAN if undefined.
  15934. @item prev_selected_pts
  15935. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15936. @item prev_selected_t
  15937. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15938. @item start_pts
  15939. The PTS of the first video frame in the video. It's NAN if undefined.
  15940. @item start_t
  15941. The time of the first video frame in the video. It's NAN if undefined.
  15942. @item pict_type @emph{(video only)}
  15943. The type of the filtered frame. It can assume one of the following
  15944. values:
  15945. @table @option
  15946. @item I
  15947. @item P
  15948. @item B
  15949. @item S
  15950. @item SI
  15951. @item SP
  15952. @item BI
  15953. @end table
  15954. @item interlace_type @emph{(video only)}
  15955. The frame interlace type. It can assume one of the following values:
  15956. @table @option
  15957. @item PROGRESSIVE
  15958. The frame is progressive (not interlaced).
  15959. @item TOPFIRST
  15960. The frame is top-field-first.
  15961. @item BOTTOMFIRST
  15962. The frame is bottom-field-first.
  15963. @end table
  15964. @item consumed_sample_n @emph{(audio only)}
  15965. the number of selected samples before the current frame
  15966. @item samples_n @emph{(audio only)}
  15967. the number of samples in the current frame
  15968. @item sample_rate @emph{(audio only)}
  15969. the input sample rate
  15970. @item key
  15971. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15972. @item pos
  15973. the position in the file of the filtered frame, -1 if the information
  15974. is not available (e.g. for synthetic video)
  15975. @item scene @emph{(video only)}
  15976. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15977. probability for the current frame to introduce a new scene, while a higher
  15978. value means the current frame is more likely to be one (see the example below)
  15979. @item concatdec_select
  15980. The concat demuxer can select only part of a concat input file by setting an
  15981. inpoint and an outpoint, but the output packets may not be entirely contained
  15982. in the selected interval. By using this variable, it is possible to skip frames
  15983. generated by the concat demuxer which are not exactly contained in the selected
  15984. interval.
  15985. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15986. and the @var{lavf.concat.duration} packet metadata values which are also
  15987. present in the decoded frames.
  15988. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15989. start_time and either the duration metadata is missing or the frame pts is less
  15990. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15991. missing.
  15992. That basically means that an input frame is selected if its pts is within the
  15993. interval set by the concat demuxer.
  15994. @end table
  15995. The default value of the select expression is "1".
  15996. @subsection Examples
  15997. @itemize
  15998. @item
  15999. Select all frames in input:
  16000. @example
  16001. select
  16002. @end example
  16003. The example above is the same as:
  16004. @example
  16005. select=1
  16006. @end example
  16007. @item
  16008. Skip all frames:
  16009. @example
  16010. select=0
  16011. @end example
  16012. @item
  16013. Select only I-frames:
  16014. @example
  16015. select='eq(pict_type\,I)'
  16016. @end example
  16017. @item
  16018. Select one frame every 100:
  16019. @example
  16020. select='not(mod(n\,100))'
  16021. @end example
  16022. @item
  16023. Select only frames contained in the 10-20 time interval:
  16024. @example
  16025. select=between(t\,10\,20)
  16026. @end example
  16027. @item
  16028. Select only I-frames contained in the 10-20 time interval:
  16029. @example
  16030. select=between(t\,10\,20)*eq(pict_type\,I)
  16031. @end example
  16032. @item
  16033. Select frames with a minimum distance of 10 seconds:
  16034. @example
  16035. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16036. @end example
  16037. @item
  16038. Use aselect to select only audio frames with samples number > 100:
  16039. @example
  16040. aselect='gt(samples_n\,100)'
  16041. @end example
  16042. @item
  16043. Create a mosaic of the first scenes:
  16044. @example
  16045. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16046. @end example
  16047. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16048. choice.
  16049. @item
  16050. Send even and odd frames to separate outputs, and compose them:
  16051. @example
  16052. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16053. @end example
  16054. @item
  16055. Select useful frames from an ffconcat file which is using inpoints and
  16056. outpoints but where the source files are not intra frame only.
  16057. @example
  16058. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16059. @end example
  16060. @end itemize
  16061. @section sendcmd, asendcmd
  16062. Send commands to filters in the filtergraph.
  16063. These filters read commands to be sent to other filters in the
  16064. filtergraph.
  16065. @code{sendcmd} must be inserted between two video filters,
  16066. @code{asendcmd} must be inserted between two audio filters, but apart
  16067. from that they act the same way.
  16068. The specification of commands can be provided in the filter arguments
  16069. with the @var{commands} option, or in a file specified by the
  16070. @var{filename} option.
  16071. These filters accept the following options:
  16072. @table @option
  16073. @item commands, c
  16074. Set the commands to be read and sent to the other filters.
  16075. @item filename, f
  16076. Set the filename of the commands to be read and sent to the other
  16077. filters.
  16078. @end table
  16079. @subsection Commands syntax
  16080. A commands description consists of a sequence of interval
  16081. specifications, comprising a list of commands to be executed when a
  16082. particular event related to that interval occurs. The occurring event
  16083. is typically the current frame time entering or leaving a given time
  16084. interval.
  16085. An interval is specified by the following syntax:
  16086. @example
  16087. @var{START}[-@var{END}] @var{COMMANDS};
  16088. @end example
  16089. The time interval is specified by the @var{START} and @var{END} times.
  16090. @var{END} is optional and defaults to the maximum time.
  16091. The current frame time is considered within the specified interval if
  16092. it is included in the interval [@var{START}, @var{END}), that is when
  16093. the time is greater or equal to @var{START} and is lesser than
  16094. @var{END}.
  16095. @var{COMMANDS} consists of a sequence of one or more command
  16096. specifications, separated by ",", relating to that interval. The
  16097. syntax of a command specification is given by:
  16098. @example
  16099. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16100. @end example
  16101. @var{FLAGS} is optional and specifies the type of events relating to
  16102. the time interval which enable sending the specified command, and must
  16103. be a non-null sequence of identifier flags separated by "+" or "|" and
  16104. enclosed between "[" and "]".
  16105. The following flags are recognized:
  16106. @table @option
  16107. @item enter
  16108. The command is sent when the current frame timestamp enters the
  16109. specified interval. In other words, the command is sent when the
  16110. previous frame timestamp was not in the given interval, and the
  16111. current is.
  16112. @item leave
  16113. The command is sent when the current frame timestamp leaves the
  16114. specified interval. In other words, the command is sent when the
  16115. previous frame timestamp was in the given interval, and the
  16116. current is not.
  16117. @end table
  16118. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16119. assumed.
  16120. @var{TARGET} specifies the target of the command, usually the name of
  16121. the filter class or a specific filter instance name.
  16122. @var{COMMAND} specifies the name of the command for the target filter.
  16123. @var{ARG} is optional and specifies the optional list of argument for
  16124. the given @var{COMMAND}.
  16125. Between one interval specification and another, whitespaces, or
  16126. sequences of characters starting with @code{#} until the end of line,
  16127. are ignored and can be used to annotate comments.
  16128. A simplified BNF description of the commands specification syntax
  16129. follows:
  16130. @example
  16131. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16132. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16133. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16134. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16135. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16136. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16137. @end example
  16138. @subsection Examples
  16139. @itemize
  16140. @item
  16141. Specify audio tempo change at second 4:
  16142. @example
  16143. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16144. @end example
  16145. @item
  16146. Target a specific filter instance:
  16147. @example
  16148. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16149. @end example
  16150. @item
  16151. Specify a list of drawtext and hue commands in a file.
  16152. @example
  16153. # show text in the interval 5-10
  16154. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16155. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16156. # desaturate the image in the interval 15-20
  16157. 15.0-20.0 [enter] hue s 0,
  16158. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16159. [leave] hue s 1,
  16160. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16161. # apply an exponential saturation fade-out effect, starting from time 25
  16162. 25 [enter] hue s exp(25-t)
  16163. @end example
  16164. A filtergraph allowing to read and process the above command list
  16165. stored in a file @file{test.cmd}, can be specified with:
  16166. @example
  16167. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16168. @end example
  16169. @end itemize
  16170. @anchor{setpts}
  16171. @section setpts, asetpts
  16172. Change the PTS (presentation timestamp) of the input frames.
  16173. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16174. This filter accepts the following options:
  16175. @table @option
  16176. @item expr
  16177. The expression which is evaluated for each frame to construct its timestamp.
  16178. @end table
  16179. The expression is evaluated through the eval API and can contain the following
  16180. constants:
  16181. @table @option
  16182. @item FRAME_RATE, FR
  16183. frame rate, only defined for constant frame-rate video
  16184. @item PTS
  16185. The presentation timestamp in input
  16186. @item N
  16187. The count of the input frame for video or the number of consumed samples,
  16188. not including the current frame for audio, starting from 0.
  16189. @item NB_CONSUMED_SAMPLES
  16190. The number of consumed samples, not including the current frame (only
  16191. audio)
  16192. @item NB_SAMPLES, S
  16193. The number of samples in the current frame (only audio)
  16194. @item SAMPLE_RATE, SR
  16195. The audio sample rate.
  16196. @item STARTPTS
  16197. The PTS of the first frame.
  16198. @item STARTT
  16199. the time in seconds of the first frame
  16200. @item INTERLACED
  16201. State whether the current frame is interlaced.
  16202. @item T
  16203. the time in seconds of the current frame
  16204. @item POS
  16205. original position in the file of the frame, or undefined if undefined
  16206. for the current frame
  16207. @item PREV_INPTS
  16208. The previous input PTS.
  16209. @item PREV_INT
  16210. previous input time in seconds
  16211. @item PREV_OUTPTS
  16212. The previous output PTS.
  16213. @item PREV_OUTT
  16214. previous output time in seconds
  16215. @item RTCTIME
  16216. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16217. instead.
  16218. @item RTCSTART
  16219. The wallclock (RTC) time at the start of the movie in microseconds.
  16220. @item TB
  16221. The timebase of the input timestamps.
  16222. @end table
  16223. @subsection Examples
  16224. @itemize
  16225. @item
  16226. Start counting PTS from zero
  16227. @example
  16228. setpts=PTS-STARTPTS
  16229. @end example
  16230. @item
  16231. Apply fast motion effect:
  16232. @example
  16233. setpts=0.5*PTS
  16234. @end example
  16235. @item
  16236. Apply slow motion effect:
  16237. @example
  16238. setpts=2.0*PTS
  16239. @end example
  16240. @item
  16241. Set fixed rate of 25 frames per second:
  16242. @example
  16243. setpts=N/(25*TB)
  16244. @end example
  16245. @item
  16246. Set fixed rate 25 fps with some jitter:
  16247. @example
  16248. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16249. @end example
  16250. @item
  16251. Apply an offset of 10 seconds to the input PTS:
  16252. @example
  16253. setpts=PTS+10/TB
  16254. @end example
  16255. @item
  16256. Generate timestamps from a "live source" and rebase onto the current timebase:
  16257. @example
  16258. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16259. @end example
  16260. @item
  16261. Generate timestamps by counting samples:
  16262. @example
  16263. asetpts=N/SR/TB
  16264. @end example
  16265. @end itemize
  16266. @section setrange
  16267. Force color range for the output video frame.
  16268. The @code{setrange} filter marks the color range property for the
  16269. output frames. It does not change the input frame, but only sets the
  16270. corresponding property, which affects how the frame is treated by
  16271. following filters.
  16272. The filter accepts the following options:
  16273. @table @option
  16274. @item range
  16275. Available values are:
  16276. @table @samp
  16277. @item auto
  16278. Keep the same color range property.
  16279. @item unspecified, unknown
  16280. Set the color range as unspecified.
  16281. @item limited, tv, mpeg
  16282. Set the color range as limited.
  16283. @item full, pc, jpeg
  16284. Set the color range as full.
  16285. @end table
  16286. @end table
  16287. @section settb, asettb
  16288. Set the timebase to use for the output frames timestamps.
  16289. It is mainly useful for testing timebase configuration.
  16290. It accepts the following parameters:
  16291. @table @option
  16292. @item expr, tb
  16293. The expression which is evaluated into the output timebase.
  16294. @end table
  16295. The value for @option{tb} is an arithmetic expression representing a
  16296. rational. The expression can contain the constants "AVTB" (the default
  16297. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16298. audio only). Default value is "intb".
  16299. @subsection Examples
  16300. @itemize
  16301. @item
  16302. Set the timebase to 1/25:
  16303. @example
  16304. settb=expr=1/25
  16305. @end example
  16306. @item
  16307. Set the timebase to 1/10:
  16308. @example
  16309. settb=expr=0.1
  16310. @end example
  16311. @item
  16312. Set the timebase to 1001/1000:
  16313. @example
  16314. settb=1+0.001
  16315. @end example
  16316. @item
  16317. Set the timebase to 2*intb:
  16318. @example
  16319. settb=2*intb
  16320. @end example
  16321. @item
  16322. Set the default timebase value:
  16323. @example
  16324. settb=AVTB
  16325. @end example
  16326. @end itemize
  16327. @section showcqt
  16328. Convert input audio to a video output representing frequency spectrum
  16329. logarithmically using Brown-Puckette constant Q transform algorithm with
  16330. direct frequency domain coefficient calculation (but the transform itself
  16331. is not really constant Q, instead the Q factor is actually variable/clamped),
  16332. with musical tone scale, from E0 to D#10.
  16333. The filter accepts the following options:
  16334. @table @option
  16335. @item size, s
  16336. Specify the video size for the output. It must be even. For the syntax of this option,
  16337. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16338. Default value is @code{1920x1080}.
  16339. @item fps, rate, r
  16340. Set the output frame rate. Default value is @code{25}.
  16341. @item bar_h
  16342. Set the bargraph height. It must be even. Default value is @code{-1} which
  16343. computes the bargraph height automatically.
  16344. @item axis_h
  16345. Set the axis height. It must be even. Default value is @code{-1} which computes
  16346. the axis height automatically.
  16347. @item sono_h
  16348. Set the sonogram height. It must be even. Default value is @code{-1} which
  16349. computes the sonogram height automatically.
  16350. @item fullhd
  16351. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16352. instead. Default value is @code{1}.
  16353. @item sono_v, volume
  16354. Specify the sonogram volume expression. It can contain variables:
  16355. @table @option
  16356. @item bar_v
  16357. the @var{bar_v} evaluated expression
  16358. @item frequency, freq, f
  16359. the frequency where it is evaluated
  16360. @item timeclamp, tc
  16361. the value of @var{timeclamp} option
  16362. @end table
  16363. and functions:
  16364. @table @option
  16365. @item a_weighting(f)
  16366. A-weighting of equal loudness
  16367. @item b_weighting(f)
  16368. B-weighting of equal loudness
  16369. @item c_weighting(f)
  16370. C-weighting of equal loudness.
  16371. @end table
  16372. Default value is @code{16}.
  16373. @item bar_v, volume2
  16374. Specify the bargraph volume expression. It can contain variables:
  16375. @table @option
  16376. @item sono_v
  16377. the @var{sono_v} evaluated expression
  16378. @item frequency, freq, f
  16379. the frequency where it is evaluated
  16380. @item timeclamp, tc
  16381. the value of @var{timeclamp} option
  16382. @end table
  16383. and functions:
  16384. @table @option
  16385. @item a_weighting(f)
  16386. A-weighting of equal loudness
  16387. @item b_weighting(f)
  16388. B-weighting of equal loudness
  16389. @item c_weighting(f)
  16390. C-weighting of equal loudness.
  16391. @end table
  16392. Default value is @code{sono_v}.
  16393. @item sono_g, gamma
  16394. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16395. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16396. Acceptable range is @code{[1, 7]}.
  16397. @item bar_g, gamma2
  16398. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16399. @code{[1, 7]}.
  16400. @item bar_t
  16401. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16402. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16403. @item timeclamp, tc
  16404. Specify the transform timeclamp. At low frequency, there is trade-off between
  16405. accuracy in time domain and frequency domain. If timeclamp is lower,
  16406. event in time domain is represented more accurately (such as fast bass drum),
  16407. otherwise event in frequency domain is represented more accurately
  16408. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16409. @item attack
  16410. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16411. limits future samples by applying asymmetric windowing in time domain, useful
  16412. when low latency is required. Accepted range is @code{[0, 1]}.
  16413. @item basefreq
  16414. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16415. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16416. @item endfreq
  16417. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16418. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16419. @item coeffclamp
  16420. This option is deprecated and ignored.
  16421. @item tlength
  16422. Specify the transform length in time domain. Use this option to control accuracy
  16423. trade-off between time domain and frequency domain at every frequency sample.
  16424. It can contain variables:
  16425. @table @option
  16426. @item frequency, freq, f
  16427. the frequency where it is evaluated
  16428. @item timeclamp, tc
  16429. the value of @var{timeclamp} option.
  16430. @end table
  16431. Default value is @code{384*tc/(384+tc*f)}.
  16432. @item count
  16433. Specify the transform count for every video frame. Default value is @code{6}.
  16434. Acceptable range is @code{[1, 30]}.
  16435. @item fcount
  16436. Specify the transform count for every single pixel. Default value is @code{0},
  16437. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16438. @item fontfile
  16439. Specify font file for use with freetype to draw the axis. If not specified,
  16440. use embedded font. Note that drawing with font file or embedded font is not
  16441. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16442. option instead.
  16443. @item font
  16444. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16445. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16446. @item fontcolor
  16447. Specify font color expression. This is arithmetic expression that should return
  16448. integer value 0xRRGGBB. It can contain variables:
  16449. @table @option
  16450. @item frequency, freq, f
  16451. the frequency where it is evaluated
  16452. @item timeclamp, tc
  16453. the value of @var{timeclamp} option
  16454. @end table
  16455. and functions:
  16456. @table @option
  16457. @item midi(f)
  16458. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16459. @item r(x), g(x), b(x)
  16460. red, green, and blue value of intensity x.
  16461. @end table
  16462. Default value is @code{st(0, (midi(f)-59.5)/12);
  16463. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16464. r(1-ld(1)) + b(ld(1))}.
  16465. @item axisfile
  16466. Specify image file to draw the axis. This option override @var{fontfile} and
  16467. @var{fontcolor} option.
  16468. @item axis, text
  16469. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16470. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16471. Default value is @code{1}.
  16472. @item csp
  16473. Set colorspace. The accepted values are:
  16474. @table @samp
  16475. @item unspecified
  16476. Unspecified (default)
  16477. @item bt709
  16478. BT.709
  16479. @item fcc
  16480. FCC
  16481. @item bt470bg
  16482. BT.470BG or BT.601-6 625
  16483. @item smpte170m
  16484. SMPTE-170M or BT.601-6 525
  16485. @item smpte240m
  16486. SMPTE-240M
  16487. @item bt2020ncl
  16488. BT.2020 with non-constant luminance
  16489. @end table
  16490. @item cscheme
  16491. Set spectrogram color scheme. This is list of floating point values with format
  16492. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16493. The default is @code{1|0.5|0|0|0.5|1}.
  16494. @end table
  16495. @subsection Examples
  16496. @itemize
  16497. @item
  16498. Playing audio while showing the spectrum:
  16499. @example
  16500. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16501. @end example
  16502. @item
  16503. Same as above, but with frame rate 30 fps:
  16504. @example
  16505. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16506. @end example
  16507. @item
  16508. Playing at 1280x720:
  16509. @example
  16510. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16511. @end example
  16512. @item
  16513. Disable sonogram display:
  16514. @example
  16515. sono_h=0
  16516. @end example
  16517. @item
  16518. A1 and its harmonics: A1, A2, (near)E3, A3:
  16519. @example
  16520. 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),
  16521. asplit[a][out1]; [a] showcqt [out0]'
  16522. @end example
  16523. @item
  16524. Same as above, but with more accuracy in frequency domain:
  16525. @example
  16526. 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),
  16527. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16528. @end example
  16529. @item
  16530. Custom volume:
  16531. @example
  16532. bar_v=10:sono_v=bar_v*a_weighting(f)
  16533. @end example
  16534. @item
  16535. Custom gamma, now spectrum is linear to the amplitude.
  16536. @example
  16537. bar_g=2:sono_g=2
  16538. @end example
  16539. @item
  16540. Custom tlength equation:
  16541. @example
  16542. 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)))'
  16543. @end example
  16544. @item
  16545. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16546. @example
  16547. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16548. @end example
  16549. @item
  16550. Custom font using fontconfig:
  16551. @example
  16552. font='Courier New,Monospace,mono|bold'
  16553. @end example
  16554. @item
  16555. Custom frequency range with custom axis using image file:
  16556. @example
  16557. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16558. @end example
  16559. @end itemize
  16560. @section showfreqs
  16561. Convert input audio to video output representing the audio power spectrum.
  16562. Audio amplitude is on Y-axis while frequency is on X-axis.
  16563. The filter accepts the following options:
  16564. @table @option
  16565. @item size, s
  16566. Specify size of video. For the syntax of this option, check the
  16567. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16568. Default is @code{1024x512}.
  16569. @item mode
  16570. Set display mode.
  16571. This set how each frequency bin will be represented.
  16572. It accepts the following values:
  16573. @table @samp
  16574. @item line
  16575. @item bar
  16576. @item dot
  16577. @end table
  16578. Default is @code{bar}.
  16579. @item ascale
  16580. Set amplitude scale.
  16581. It accepts the following values:
  16582. @table @samp
  16583. @item lin
  16584. Linear scale.
  16585. @item sqrt
  16586. Square root scale.
  16587. @item cbrt
  16588. Cubic root scale.
  16589. @item log
  16590. Logarithmic scale.
  16591. @end table
  16592. Default is @code{log}.
  16593. @item fscale
  16594. Set frequency scale.
  16595. It accepts the following values:
  16596. @table @samp
  16597. @item lin
  16598. Linear scale.
  16599. @item log
  16600. Logarithmic scale.
  16601. @item rlog
  16602. Reverse logarithmic scale.
  16603. @end table
  16604. Default is @code{lin}.
  16605. @item win_size
  16606. Set window size.
  16607. It accepts the following values:
  16608. @table @samp
  16609. @item w16
  16610. @item w32
  16611. @item w64
  16612. @item w128
  16613. @item w256
  16614. @item w512
  16615. @item w1024
  16616. @item w2048
  16617. @item w4096
  16618. @item w8192
  16619. @item w16384
  16620. @item w32768
  16621. @item w65536
  16622. @end table
  16623. Default is @code{w2048}
  16624. @item win_func
  16625. Set windowing function.
  16626. It accepts the following values:
  16627. @table @samp
  16628. @item rect
  16629. @item bartlett
  16630. @item hanning
  16631. @item hamming
  16632. @item blackman
  16633. @item welch
  16634. @item flattop
  16635. @item bharris
  16636. @item bnuttall
  16637. @item bhann
  16638. @item sine
  16639. @item nuttall
  16640. @item lanczos
  16641. @item gauss
  16642. @item tukey
  16643. @item dolph
  16644. @item cauchy
  16645. @item parzen
  16646. @item poisson
  16647. @item bohman
  16648. @end table
  16649. Default is @code{hanning}.
  16650. @item overlap
  16651. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16652. which means optimal overlap for selected window function will be picked.
  16653. @item averaging
  16654. Set time averaging. Setting this to 0 will display current maximal peaks.
  16655. Default is @code{1}, which means time averaging is disabled.
  16656. @item colors
  16657. Specify list of colors separated by space or by '|' which will be used to
  16658. draw channel frequencies. Unrecognized or missing colors will be replaced
  16659. by white color.
  16660. @item cmode
  16661. Set channel display mode.
  16662. It accepts the following values:
  16663. @table @samp
  16664. @item combined
  16665. @item separate
  16666. @end table
  16667. Default is @code{combined}.
  16668. @item minamp
  16669. Set minimum amplitude used in @code{log} amplitude scaler.
  16670. @end table
  16671. @anchor{showspectrum}
  16672. @section showspectrum
  16673. Convert input audio to a video output, representing the audio frequency
  16674. spectrum.
  16675. The filter accepts the following options:
  16676. @table @option
  16677. @item size, s
  16678. Specify the video size for the output. For the syntax of this option, check the
  16679. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16680. Default value is @code{640x512}.
  16681. @item slide
  16682. Specify how the spectrum should slide along the window.
  16683. It accepts the following values:
  16684. @table @samp
  16685. @item replace
  16686. the samples start again on the left when they reach the right
  16687. @item scroll
  16688. the samples scroll from right to left
  16689. @item fullframe
  16690. frames are only produced when the samples reach the right
  16691. @item rscroll
  16692. the samples scroll from left to right
  16693. @end table
  16694. Default value is @code{replace}.
  16695. @item mode
  16696. Specify display mode.
  16697. It accepts the following values:
  16698. @table @samp
  16699. @item combined
  16700. all channels are displayed in the same row
  16701. @item separate
  16702. all channels are displayed in separate rows
  16703. @end table
  16704. Default value is @samp{combined}.
  16705. @item color
  16706. Specify display color mode.
  16707. It accepts the following values:
  16708. @table @samp
  16709. @item channel
  16710. each channel is displayed in a separate color
  16711. @item intensity
  16712. each channel is displayed using the same color scheme
  16713. @item rainbow
  16714. each channel is displayed using the rainbow color scheme
  16715. @item moreland
  16716. each channel is displayed using the moreland color scheme
  16717. @item nebulae
  16718. each channel is displayed using the nebulae color scheme
  16719. @item fire
  16720. each channel is displayed using the fire color scheme
  16721. @item fiery
  16722. each channel is displayed using the fiery color scheme
  16723. @item fruit
  16724. each channel is displayed using the fruit color scheme
  16725. @item cool
  16726. each channel is displayed using the cool color scheme
  16727. @item magma
  16728. each channel is displayed using the magma color scheme
  16729. @item green
  16730. each channel is displayed using the green color scheme
  16731. @item viridis
  16732. each channel is displayed using the viridis color scheme
  16733. @item plasma
  16734. each channel is displayed using the plasma color scheme
  16735. @item cividis
  16736. each channel is displayed using the cividis color scheme
  16737. @item terrain
  16738. each channel is displayed using the terrain color scheme
  16739. @end table
  16740. Default value is @samp{channel}.
  16741. @item scale
  16742. Specify scale used for calculating intensity color values.
  16743. It accepts the following values:
  16744. @table @samp
  16745. @item lin
  16746. linear
  16747. @item sqrt
  16748. square root, default
  16749. @item cbrt
  16750. cubic root
  16751. @item log
  16752. logarithmic
  16753. @item 4thrt
  16754. 4th root
  16755. @item 5thrt
  16756. 5th root
  16757. @end table
  16758. Default value is @samp{sqrt}.
  16759. @item saturation
  16760. Set saturation modifier for displayed colors. Negative values provide
  16761. alternative color scheme. @code{0} is no saturation at all.
  16762. Saturation must be in [-10.0, 10.0] range.
  16763. Default value is @code{1}.
  16764. @item win_func
  16765. Set window function.
  16766. It accepts the following values:
  16767. @table @samp
  16768. @item rect
  16769. @item bartlett
  16770. @item hann
  16771. @item hanning
  16772. @item hamming
  16773. @item blackman
  16774. @item welch
  16775. @item flattop
  16776. @item bharris
  16777. @item bnuttall
  16778. @item bhann
  16779. @item sine
  16780. @item nuttall
  16781. @item lanczos
  16782. @item gauss
  16783. @item tukey
  16784. @item dolph
  16785. @item cauchy
  16786. @item parzen
  16787. @item poisson
  16788. @item bohman
  16789. @end table
  16790. Default value is @code{hann}.
  16791. @item orientation
  16792. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16793. @code{horizontal}. Default is @code{vertical}.
  16794. @item overlap
  16795. Set ratio of overlap window. Default value is @code{0}.
  16796. When value is @code{1} overlap is set to recommended size for specific
  16797. window function currently used.
  16798. @item gain
  16799. Set scale gain for calculating intensity color values.
  16800. Default value is @code{1}.
  16801. @item data
  16802. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16803. @item rotation
  16804. Set color rotation, must be in [-1.0, 1.0] range.
  16805. Default value is @code{0}.
  16806. @item start
  16807. Set start frequency from which to display spectrogram. Default is @code{0}.
  16808. @item stop
  16809. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16810. @item fps
  16811. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16812. @item legend
  16813. Draw time and frequency axes and legends. Default is disabled.
  16814. @end table
  16815. The usage is very similar to the showwaves filter; see the examples in that
  16816. section.
  16817. @subsection Examples
  16818. @itemize
  16819. @item
  16820. Large window with logarithmic color scaling:
  16821. @example
  16822. showspectrum=s=1280x480:scale=log
  16823. @end example
  16824. @item
  16825. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16826. @example
  16827. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16828. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16829. @end example
  16830. @end itemize
  16831. @section showspectrumpic
  16832. Convert input audio to a single video frame, representing the audio frequency
  16833. spectrum.
  16834. The filter accepts the following options:
  16835. @table @option
  16836. @item size, s
  16837. Specify the video size for the output. For the syntax of this option, check the
  16838. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16839. Default value is @code{4096x2048}.
  16840. @item mode
  16841. Specify display mode.
  16842. It accepts the following values:
  16843. @table @samp
  16844. @item combined
  16845. all channels are displayed in the same row
  16846. @item separate
  16847. all channels are displayed in separate rows
  16848. @end table
  16849. Default value is @samp{combined}.
  16850. @item color
  16851. Specify display color mode.
  16852. It accepts the following values:
  16853. @table @samp
  16854. @item channel
  16855. each channel is displayed in a separate color
  16856. @item intensity
  16857. each channel is displayed using the same color scheme
  16858. @item rainbow
  16859. each channel is displayed using the rainbow color scheme
  16860. @item moreland
  16861. each channel is displayed using the moreland color scheme
  16862. @item nebulae
  16863. each channel is displayed using the nebulae color scheme
  16864. @item fire
  16865. each channel is displayed using the fire color scheme
  16866. @item fiery
  16867. each channel is displayed using the fiery color scheme
  16868. @item fruit
  16869. each channel is displayed using the fruit color scheme
  16870. @item cool
  16871. each channel is displayed using the cool color scheme
  16872. @item magma
  16873. each channel is displayed using the magma color scheme
  16874. @item green
  16875. each channel is displayed using the green color scheme
  16876. @item viridis
  16877. each channel is displayed using the viridis color scheme
  16878. @item plasma
  16879. each channel is displayed using the plasma color scheme
  16880. @item cividis
  16881. each channel is displayed using the cividis color scheme
  16882. @item terrain
  16883. each channel is displayed using the terrain color scheme
  16884. @end table
  16885. Default value is @samp{intensity}.
  16886. @item scale
  16887. Specify scale used for calculating intensity color values.
  16888. It accepts the following values:
  16889. @table @samp
  16890. @item lin
  16891. linear
  16892. @item sqrt
  16893. square root, default
  16894. @item cbrt
  16895. cubic root
  16896. @item log
  16897. logarithmic
  16898. @item 4thrt
  16899. 4th root
  16900. @item 5thrt
  16901. 5th root
  16902. @end table
  16903. Default value is @samp{log}.
  16904. @item saturation
  16905. Set saturation modifier for displayed colors. Negative values provide
  16906. alternative color scheme. @code{0} is no saturation at all.
  16907. Saturation must be in [-10.0, 10.0] range.
  16908. Default value is @code{1}.
  16909. @item win_func
  16910. Set window function.
  16911. It accepts the following values:
  16912. @table @samp
  16913. @item rect
  16914. @item bartlett
  16915. @item hann
  16916. @item hanning
  16917. @item hamming
  16918. @item blackman
  16919. @item welch
  16920. @item flattop
  16921. @item bharris
  16922. @item bnuttall
  16923. @item bhann
  16924. @item sine
  16925. @item nuttall
  16926. @item lanczos
  16927. @item gauss
  16928. @item tukey
  16929. @item dolph
  16930. @item cauchy
  16931. @item parzen
  16932. @item poisson
  16933. @item bohman
  16934. @end table
  16935. Default value is @code{hann}.
  16936. @item orientation
  16937. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16938. @code{horizontal}. Default is @code{vertical}.
  16939. @item gain
  16940. Set scale gain for calculating intensity color values.
  16941. Default value is @code{1}.
  16942. @item legend
  16943. Draw time and frequency axes and legends. Default is enabled.
  16944. @item rotation
  16945. Set color rotation, must be in [-1.0, 1.0] range.
  16946. Default value is @code{0}.
  16947. @item start
  16948. Set start frequency from which to display spectrogram. Default is @code{0}.
  16949. @item stop
  16950. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16951. @end table
  16952. @subsection Examples
  16953. @itemize
  16954. @item
  16955. Extract an audio spectrogram of a whole audio track
  16956. in a 1024x1024 picture using @command{ffmpeg}:
  16957. @example
  16958. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16959. @end example
  16960. @end itemize
  16961. @section showvolume
  16962. Convert input audio volume to a video output.
  16963. The filter accepts the following options:
  16964. @table @option
  16965. @item rate, r
  16966. Set video rate.
  16967. @item b
  16968. Set border width, allowed range is [0, 5]. Default is 1.
  16969. @item w
  16970. Set channel width, allowed range is [80, 8192]. Default is 400.
  16971. @item h
  16972. Set channel height, allowed range is [1, 900]. Default is 20.
  16973. @item f
  16974. Set fade, allowed range is [0, 1]. Default is 0.95.
  16975. @item c
  16976. Set volume color expression.
  16977. The expression can use the following variables:
  16978. @table @option
  16979. @item VOLUME
  16980. Current max volume of channel in dB.
  16981. @item PEAK
  16982. Current peak.
  16983. @item CHANNEL
  16984. Current channel number, starting from 0.
  16985. @end table
  16986. @item t
  16987. If set, displays channel names. Default is enabled.
  16988. @item v
  16989. If set, displays volume values. Default is enabled.
  16990. @item o
  16991. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16992. default is @code{h}.
  16993. @item s
  16994. Set step size, allowed range is [0, 5]. Default is 0, which means
  16995. step is disabled.
  16996. @item p
  16997. Set background opacity, allowed range is [0, 1]. Default is 0.
  16998. @item m
  16999. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17000. default is @code{p}.
  17001. @item ds
  17002. Set display scale, can be linear: @code{lin} or log: @code{log},
  17003. default is @code{lin}.
  17004. @item dm
  17005. In second.
  17006. If set to > 0., display a line for the max level
  17007. in the previous seconds.
  17008. default is disabled: @code{0.}
  17009. @item dmc
  17010. The color of the max line. Use when @code{dm} option is set to > 0.
  17011. default is: @code{orange}
  17012. @end table
  17013. @section showwaves
  17014. Convert input audio to a video output, representing the samples waves.
  17015. The filter accepts the following options:
  17016. @table @option
  17017. @item size, s
  17018. Specify the video size for the output. For the syntax of this option, check the
  17019. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17020. Default value is @code{600x240}.
  17021. @item mode
  17022. Set display mode.
  17023. Available values are:
  17024. @table @samp
  17025. @item point
  17026. Draw a point for each sample.
  17027. @item line
  17028. Draw a vertical line for each sample.
  17029. @item p2p
  17030. Draw a point for each sample and a line between them.
  17031. @item cline
  17032. Draw a centered vertical line for each sample.
  17033. @end table
  17034. Default value is @code{point}.
  17035. @item n
  17036. Set the number of samples which are printed on the same column. A
  17037. larger value will decrease the frame rate. Must be a positive
  17038. integer. This option can be set only if the value for @var{rate}
  17039. is not explicitly specified.
  17040. @item rate, r
  17041. Set the (approximate) output frame rate. This is done by setting the
  17042. option @var{n}. Default value is "25".
  17043. @item split_channels
  17044. Set if channels should be drawn separately or overlap. Default value is 0.
  17045. @item colors
  17046. Set colors separated by '|' which are going to be used for drawing of each channel.
  17047. @item scale
  17048. Set amplitude scale.
  17049. Available values are:
  17050. @table @samp
  17051. @item lin
  17052. Linear.
  17053. @item log
  17054. Logarithmic.
  17055. @item sqrt
  17056. Square root.
  17057. @item cbrt
  17058. Cubic root.
  17059. @end table
  17060. Default is linear.
  17061. @item draw
  17062. Set the draw mode. This is mostly useful to set for high @var{n}.
  17063. Available values are:
  17064. @table @samp
  17065. @item scale
  17066. Scale pixel values for each drawn sample.
  17067. @item full
  17068. Draw every sample directly.
  17069. @end table
  17070. Default value is @code{scale}.
  17071. @end table
  17072. @subsection Examples
  17073. @itemize
  17074. @item
  17075. Output the input file audio and the corresponding video representation
  17076. at the same time:
  17077. @example
  17078. amovie=a.mp3,asplit[out0],showwaves[out1]
  17079. @end example
  17080. @item
  17081. Create a synthetic signal and show it with showwaves, forcing a
  17082. frame rate of 30 frames per second:
  17083. @example
  17084. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17085. @end example
  17086. @end itemize
  17087. @section showwavespic
  17088. Convert input audio to a single video frame, representing the samples waves.
  17089. The filter accepts the following options:
  17090. @table @option
  17091. @item size, s
  17092. Specify the video size for the output. For the syntax of this option, check the
  17093. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17094. Default value is @code{600x240}.
  17095. @item split_channels
  17096. Set if channels should be drawn separately or overlap. Default value is 0.
  17097. @item colors
  17098. Set colors separated by '|' which are going to be used for drawing of each channel.
  17099. @item scale
  17100. Set amplitude scale.
  17101. Available values are:
  17102. @table @samp
  17103. @item lin
  17104. Linear.
  17105. @item log
  17106. Logarithmic.
  17107. @item sqrt
  17108. Square root.
  17109. @item cbrt
  17110. Cubic root.
  17111. @end table
  17112. Default is linear.
  17113. @end table
  17114. @subsection Examples
  17115. @itemize
  17116. @item
  17117. Extract a channel split representation of the wave form of a whole audio track
  17118. in a 1024x800 picture using @command{ffmpeg}:
  17119. @example
  17120. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17121. @end example
  17122. @end itemize
  17123. @section sidedata, asidedata
  17124. Delete frame side data, or select frames based on it.
  17125. This filter accepts the following options:
  17126. @table @option
  17127. @item mode
  17128. Set mode of operation of the filter.
  17129. Can be one of the following:
  17130. @table @samp
  17131. @item select
  17132. Select every frame with side data of @code{type}.
  17133. @item delete
  17134. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17135. data in the frame.
  17136. @end table
  17137. @item type
  17138. Set side data type used with all modes. Must be set for @code{select} mode. For
  17139. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17140. in @file{libavutil/frame.h}. For example, to choose
  17141. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17142. @end table
  17143. @section spectrumsynth
  17144. Sythesize audio from 2 input video spectrums, first input stream represents
  17145. magnitude across time and second represents phase across time.
  17146. The filter will transform from frequency domain as displayed in videos back
  17147. to time domain as presented in audio output.
  17148. This filter is primarily created for reversing processed @ref{showspectrum}
  17149. filter outputs, but can synthesize sound from other spectrograms too.
  17150. But in such case results are going to be poor if the phase data is not
  17151. available, because in such cases phase data need to be recreated, usually
  17152. its just recreated from random noise.
  17153. For best results use gray only output (@code{channel} color mode in
  17154. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17155. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17156. @code{data} option. Inputs videos should generally use @code{fullframe}
  17157. slide mode as that saves resources needed for decoding video.
  17158. The filter accepts the following options:
  17159. @table @option
  17160. @item sample_rate
  17161. Specify sample rate of output audio, the sample rate of audio from which
  17162. spectrum was generated may differ.
  17163. @item channels
  17164. Set number of channels represented in input video spectrums.
  17165. @item scale
  17166. Set scale which was used when generating magnitude input spectrum.
  17167. Can be @code{lin} or @code{log}. Default is @code{log}.
  17168. @item slide
  17169. Set slide which was used when generating inputs spectrums.
  17170. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17171. Default is @code{fullframe}.
  17172. @item win_func
  17173. Set window function used for resynthesis.
  17174. @item overlap
  17175. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17176. which means optimal overlap for selected window function will be picked.
  17177. @item orientation
  17178. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17179. Default is @code{vertical}.
  17180. @end table
  17181. @subsection Examples
  17182. @itemize
  17183. @item
  17184. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17185. then resynthesize videos back to audio with spectrumsynth:
  17186. @example
  17187. 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
  17188. 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
  17189. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17190. @end example
  17191. @end itemize
  17192. @section split, asplit
  17193. Split input into several identical outputs.
  17194. @code{asplit} works with audio input, @code{split} with video.
  17195. The filter accepts a single parameter which specifies the number of outputs. If
  17196. unspecified, it defaults to 2.
  17197. @subsection Examples
  17198. @itemize
  17199. @item
  17200. Create two separate outputs from the same input:
  17201. @example
  17202. [in] split [out0][out1]
  17203. @end example
  17204. @item
  17205. To create 3 or more outputs, you need to specify the number of
  17206. outputs, like in:
  17207. @example
  17208. [in] asplit=3 [out0][out1][out2]
  17209. @end example
  17210. @item
  17211. Create two separate outputs from the same input, one cropped and
  17212. one padded:
  17213. @example
  17214. [in] split [splitout1][splitout2];
  17215. [splitout1] crop=100:100:0:0 [cropout];
  17216. [splitout2] pad=200:200:100:100 [padout];
  17217. @end example
  17218. @item
  17219. Create 5 copies of the input audio with @command{ffmpeg}:
  17220. @example
  17221. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17222. @end example
  17223. @end itemize
  17224. @section zmq, azmq
  17225. Receive commands sent through a libzmq client, and forward them to
  17226. filters in the filtergraph.
  17227. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17228. must be inserted between two video filters, @code{azmq} between two
  17229. audio filters. Both are capable to send messages to any filter type.
  17230. To enable these filters you need to install the libzmq library and
  17231. headers and configure FFmpeg with @code{--enable-libzmq}.
  17232. For more information about libzmq see:
  17233. @url{http://www.zeromq.org/}
  17234. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17235. receives messages sent through a network interface defined by the
  17236. @option{bind_address} (or the abbreviation "@option{b}") option.
  17237. Default value of this option is @file{tcp://localhost:5555}. You may
  17238. want to alter this value to your needs, but do not forget to escape any
  17239. ':' signs (see @ref{filtergraph escaping}).
  17240. The received message must be in the form:
  17241. @example
  17242. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17243. @end example
  17244. @var{TARGET} specifies the target of the command, usually the name of
  17245. the filter class or a specific filter instance name. The default
  17246. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17247. but you can override this by using the @samp{filter_name@@id} syntax
  17248. (see @ref{Filtergraph syntax}).
  17249. @var{COMMAND} specifies the name of the command for the target filter.
  17250. @var{ARG} is optional and specifies the optional argument list for the
  17251. given @var{COMMAND}.
  17252. Upon reception, the message is processed and the corresponding command
  17253. is injected into the filtergraph. Depending on the result, the filter
  17254. will send a reply to the client, adopting the format:
  17255. @example
  17256. @var{ERROR_CODE} @var{ERROR_REASON}
  17257. @var{MESSAGE}
  17258. @end example
  17259. @var{MESSAGE} is optional.
  17260. @subsection Examples
  17261. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17262. be used to send commands processed by these filters.
  17263. Consider the following filtergraph generated by @command{ffplay}.
  17264. In this example the last overlay filter has an instance name. All other
  17265. filters will have default instance names.
  17266. @example
  17267. ffplay -dumpgraph 1 -f lavfi "
  17268. color=s=100x100:c=red [l];
  17269. color=s=100x100:c=blue [r];
  17270. nullsrc=s=200x100, zmq [bg];
  17271. [bg][l] overlay [bg+l];
  17272. [bg+l][r] overlay@@my=x=100 "
  17273. @end example
  17274. To change the color of the left side of the video, the following
  17275. command can be used:
  17276. @example
  17277. echo Parsed_color_0 c yellow | tools/zmqsend
  17278. @end example
  17279. To change the right side:
  17280. @example
  17281. echo Parsed_color_1 c pink | tools/zmqsend
  17282. @end example
  17283. To change the position of the right side:
  17284. @example
  17285. echo overlay@@my x 150 | tools/zmqsend
  17286. @end example
  17287. @c man end MULTIMEDIA FILTERS
  17288. @chapter Multimedia Sources
  17289. @c man begin MULTIMEDIA SOURCES
  17290. Below is a description of the currently available multimedia sources.
  17291. @section amovie
  17292. This is the same as @ref{movie} source, except it selects an audio
  17293. stream by default.
  17294. @anchor{movie}
  17295. @section movie
  17296. Read audio and/or video stream(s) from a movie container.
  17297. It accepts the following parameters:
  17298. @table @option
  17299. @item filename
  17300. The name of the resource to read (not necessarily a file; it can also be a
  17301. device or a stream accessed through some protocol).
  17302. @item format_name, f
  17303. Specifies the format assumed for the movie to read, and can be either
  17304. the name of a container or an input device. If not specified, the
  17305. format is guessed from @var{movie_name} or by probing.
  17306. @item seek_point, sp
  17307. Specifies the seek point in seconds. The frames will be output
  17308. starting from this seek point. The parameter is evaluated with
  17309. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17310. postfix. The default value is "0".
  17311. @item streams, s
  17312. Specifies the streams to read. Several streams can be specified,
  17313. separated by "+". The source will then have as many outputs, in the
  17314. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17315. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17316. respectively the default (best suited) video and audio stream. Default
  17317. is "dv", or "da" if the filter is called as "amovie".
  17318. @item stream_index, si
  17319. Specifies the index of the video stream to read. If the value is -1,
  17320. the most suitable video stream will be automatically selected. The default
  17321. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17322. audio instead of video.
  17323. @item loop
  17324. Specifies how many times to read the stream in sequence.
  17325. If the value is 0, the stream will be looped infinitely.
  17326. Default value is "1".
  17327. Note that when the movie is looped the source timestamps are not
  17328. changed, so it will generate non monotonically increasing timestamps.
  17329. @item discontinuity
  17330. Specifies the time difference between frames above which the point is
  17331. considered a timestamp discontinuity which is removed by adjusting the later
  17332. timestamps.
  17333. @end table
  17334. It allows overlaying a second video on top of the main input of
  17335. a filtergraph, as shown in this graph:
  17336. @example
  17337. input -----------> deltapts0 --> overlay --> output
  17338. ^
  17339. |
  17340. movie --> scale--> deltapts1 -------+
  17341. @end example
  17342. @subsection Examples
  17343. @itemize
  17344. @item
  17345. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17346. on top of the input labelled "in":
  17347. @example
  17348. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17349. [in] setpts=PTS-STARTPTS [main];
  17350. [main][over] overlay=16:16 [out]
  17351. @end example
  17352. @item
  17353. Read from a video4linux2 device, and overlay it on top of the input
  17354. labelled "in":
  17355. @example
  17356. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17357. [in] setpts=PTS-STARTPTS [main];
  17358. [main][over] overlay=16:16 [out]
  17359. @end example
  17360. @item
  17361. Read the first video stream and the audio stream with id 0x81 from
  17362. dvd.vob; the video is connected to the pad named "video" and the audio is
  17363. connected to the pad named "audio":
  17364. @example
  17365. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17366. @end example
  17367. @end itemize
  17368. @subsection Commands
  17369. Both movie and amovie support the following commands:
  17370. @table @option
  17371. @item seek
  17372. Perform seek using "av_seek_frame".
  17373. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17374. @itemize
  17375. @item
  17376. @var{stream_index}: If stream_index is -1, a default
  17377. stream is selected, and @var{timestamp} is automatically converted
  17378. from AV_TIME_BASE units to the stream specific time_base.
  17379. @item
  17380. @var{timestamp}: Timestamp in AVStream.time_base units
  17381. or, if no stream is specified, in AV_TIME_BASE units.
  17382. @item
  17383. @var{flags}: Flags which select direction and seeking mode.
  17384. @end itemize
  17385. @item get_duration
  17386. Get movie duration in AV_TIME_BASE units.
  17387. @end table
  17388. @c man end MULTIMEDIA SOURCES