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.

23091 lines
615KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @end table
  1384. @section anull
  1385. Pass the audio source unchanged to the output.
  1386. @section apad
  1387. Pad the end of an audio stream with silence.
  1388. This can be used together with @command{ffmpeg} @option{-shortest} to
  1389. extend audio streams to the same length as the video stream.
  1390. A description of the accepted options follows.
  1391. @table @option
  1392. @item packet_size
  1393. Set silence packet size. Default value is 4096.
  1394. @item pad_len
  1395. Set the number of samples of silence to add to the end. After the
  1396. value is reached, the stream is terminated. This option is mutually
  1397. exclusive with @option{whole_len}.
  1398. @item whole_len
  1399. Set the minimum total number of samples in the output audio stream. If
  1400. the value is longer than the input audio length, silence is added to
  1401. the end, until the value is reached. This option is mutually exclusive
  1402. with @option{pad_len}.
  1403. @item pad_dur
  1404. Specify the duration of samples of silence to add. See
  1405. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1406. for the accepted syntax. Used only if set to non-zero value.
  1407. @item whole_dur
  1408. Specify the minimum total duration in the output audio stream. See
  1409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1410. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1411. the input audio length, silence is added to the end, until the value is reached.
  1412. This option is mutually exclusive with @option{pad_dur}
  1413. @end table
  1414. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1415. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1416. the input stream indefinitely.
  1417. @subsection Examples
  1418. @itemize
  1419. @item
  1420. Add 1024 samples of silence to the end of the input:
  1421. @example
  1422. apad=pad_len=1024
  1423. @end example
  1424. @item
  1425. Make sure the audio output will contain at least 10000 samples, pad
  1426. the input with silence if required:
  1427. @example
  1428. apad=whole_len=10000
  1429. @end example
  1430. @item
  1431. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1432. video stream will always result the shortest and will be converted
  1433. until the end in the output file when using the @option{shortest}
  1434. option:
  1435. @example
  1436. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1437. @end example
  1438. @end itemize
  1439. @section aphaser
  1440. Add a phasing effect to the input audio.
  1441. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1442. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1443. A description of the accepted parameters follows.
  1444. @table @option
  1445. @item in_gain
  1446. Set input gain. Default is 0.4.
  1447. @item out_gain
  1448. Set output gain. Default is 0.74
  1449. @item delay
  1450. Set delay in milliseconds. Default is 3.0.
  1451. @item decay
  1452. Set decay. Default is 0.4.
  1453. @item speed
  1454. Set modulation speed in Hz. Default is 0.5.
  1455. @item type
  1456. Set modulation type. Default is triangular.
  1457. It accepts the following values:
  1458. @table @samp
  1459. @item triangular, t
  1460. @item sinusoidal, s
  1461. @end table
  1462. @end table
  1463. @section apulsator
  1464. Audio pulsator is something between an autopanner and a tremolo.
  1465. But it can produce funny stereo effects as well. Pulsator changes the volume
  1466. of the left and right channel based on a LFO (low frequency oscillator) with
  1467. different waveforms and shifted phases.
  1468. This filter have the ability to define an offset between left and right
  1469. channel. An offset of 0 means that both LFO shapes match each other.
  1470. The left and right channel are altered equally - a conventional tremolo.
  1471. An offset of 50% means that the shape of the right channel is exactly shifted
  1472. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1473. an autopanner. At 1 both curves match again. Every setting in between moves the
  1474. phase shift gapless between all stages and produces some "bypassing" sounds with
  1475. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1476. the 0.5) the faster the signal passes from the left to the right speaker.
  1477. The filter accepts the following options:
  1478. @table @option
  1479. @item level_in
  1480. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1481. @item level_out
  1482. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1483. @item mode
  1484. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1485. sawup or sawdown. Default is sine.
  1486. @item amount
  1487. Set modulation. Define how much of original signal is affected by the LFO.
  1488. @item offset_l
  1489. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1490. @item offset_r
  1491. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1492. @item width
  1493. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1494. @item timing
  1495. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1496. @item bpm
  1497. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1498. is set to bpm.
  1499. @item ms
  1500. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1501. is set to ms.
  1502. @item hz
  1503. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1504. if timing is set to hz.
  1505. @end table
  1506. @anchor{aresample}
  1507. @section aresample
  1508. Resample the input audio to the specified parameters, using the
  1509. libswresample library. If none are specified then the filter will
  1510. automatically convert between its input and output.
  1511. This filter is also able to stretch/squeeze the audio data to make it match
  1512. the timestamps or to inject silence / cut out audio to make it match the
  1513. timestamps, do a combination of both or do neither.
  1514. The filter accepts the syntax
  1515. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1516. expresses a sample rate and @var{resampler_options} is a list of
  1517. @var{key}=@var{value} pairs, separated by ":". See the
  1518. @ref{Resampler Options,,"Resampler Options" section in the
  1519. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1520. for the complete list of supported options.
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Resample the input audio to 44100Hz:
  1525. @example
  1526. aresample=44100
  1527. @end example
  1528. @item
  1529. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1530. samples per second compensation:
  1531. @example
  1532. aresample=async=1000
  1533. @end example
  1534. @end itemize
  1535. @section areverse
  1536. Reverse an audio clip.
  1537. Warning: This filter requires memory to buffer the entire clip, so trimming
  1538. is suggested.
  1539. @subsection Examples
  1540. @itemize
  1541. @item
  1542. Take the first 5 seconds of a clip, and reverse it.
  1543. @example
  1544. atrim=end=5,areverse
  1545. @end example
  1546. @end itemize
  1547. @section asetnsamples
  1548. Set the number of samples per each output audio frame.
  1549. The last output packet may contain a different number of samples, as
  1550. the filter will flush all the remaining samples when the input audio
  1551. signals its end.
  1552. The filter accepts the following options:
  1553. @table @option
  1554. @item nb_out_samples, n
  1555. Set the number of frames per each output audio frame. The number is
  1556. intended as the number of samples @emph{per each channel}.
  1557. Default value is 1024.
  1558. @item pad, p
  1559. If set to 1, the filter will pad the last audio frame with zeroes, so
  1560. that the last frame will contain the same number of samples as the
  1561. previous ones. Default value is 1.
  1562. @end table
  1563. For example, to set the number of per-frame samples to 1234 and
  1564. disable padding for the last frame, use:
  1565. @example
  1566. asetnsamples=n=1234:p=0
  1567. @end example
  1568. @section asetrate
  1569. Set the sample rate without altering the PCM data.
  1570. This will result in a change of speed and pitch.
  1571. The filter accepts the following options:
  1572. @table @option
  1573. @item sample_rate, r
  1574. Set the output sample rate. Default is 44100 Hz.
  1575. @end table
  1576. @section ashowinfo
  1577. Show a line containing various information for each input audio frame.
  1578. The input audio is not modified.
  1579. The shown line contains a sequence of key/value pairs of the form
  1580. @var{key}:@var{value}.
  1581. The following values are shown in the output:
  1582. @table @option
  1583. @item n
  1584. The (sequential) number of the input frame, starting from 0.
  1585. @item pts
  1586. The presentation timestamp of the input frame, in time base units; the time base
  1587. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1588. @item pts_time
  1589. The presentation timestamp of the input frame in seconds.
  1590. @item pos
  1591. position of the frame in the input stream, -1 if this information in
  1592. unavailable and/or meaningless (for example in case of synthetic audio)
  1593. @item fmt
  1594. The sample format.
  1595. @item chlayout
  1596. The channel layout.
  1597. @item rate
  1598. The sample rate for the audio frame.
  1599. @item nb_samples
  1600. The number of samples (per channel) in the frame.
  1601. @item checksum
  1602. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1603. audio, the data is treated as if all the planes were concatenated.
  1604. @item plane_checksums
  1605. A list of Adler-32 checksums for each data plane.
  1606. @end table
  1607. @section asoftclip
  1608. Apply audio soft clipping.
  1609. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1610. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1611. This filter accepts the following options:
  1612. @table @option
  1613. @item type
  1614. Set type of soft-clipping.
  1615. It accepts the following values:
  1616. @table @option
  1617. @item tanh
  1618. @item atan
  1619. @item cubic
  1620. @item exp
  1621. @item alg
  1622. @item quintic
  1623. @item sin
  1624. @end table
  1625. @item param
  1626. Set additional parameter which controls sigmoid function.
  1627. @end table
  1628. @anchor{astats}
  1629. @section astats
  1630. Display time domain statistical information about the audio channels.
  1631. Statistics are calculated and displayed for each audio channel and,
  1632. where applicable, an overall figure is also given.
  1633. It accepts the following option:
  1634. @table @option
  1635. @item length
  1636. Short window length in seconds, used for peak and trough RMS measurement.
  1637. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1638. @item metadata
  1639. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1640. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1641. disabled.
  1642. Available keys for each channel are:
  1643. DC_offset
  1644. Min_level
  1645. Max_level
  1646. Min_difference
  1647. Max_difference
  1648. Mean_difference
  1649. RMS_difference
  1650. Peak_level
  1651. RMS_peak
  1652. RMS_trough
  1653. Crest_factor
  1654. Flat_factor
  1655. Peak_count
  1656. Bit_depth
  1657. Dynamic_range
  1658. Zero_crossings
  1659. Zero_crossings_rate
  1660. Number_of_NaNs
  1661. Number_of_Infs
  1662. Number_of_denormals
  1663. and for Overall:
  1664. DC_offset
  1665. Min_level
  1666. Max_level
  1667. Min_difference
  1668. Max_difference
  1669. Mean_difference
  1670. RMS_difference
  1671. Peak_level
  1672. RMS_level
  1673. RMS_peak
  1674. RMS_trough
  1675. Flat_factor
  1676. Peak_count
  1677. Bit_depth
  1678. Number_of_samples
  1679. Number_of_NaNs
  1680. Number_of_Infs
  1681. Number_of_denormals
  1682. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1683. this @code{lavfi.astats.Overall.Peak_count}.
  1684. For description what each key means read below.
  1685. @item reset
  1686. Set number of frame after which stats are going to be recalculated.
  1687. Default is disabled.
  1688. @item measure_perchannel
  1689. Select the entries which need to be measured per channel. The metadata keys can
  1690. be used as flags, default is @option{all} which measures everything.
  1691. @option{none} disables all per channel measurement.
  1692. @item measure_overall
  1693. Select the entries which need to be measured overall. The metadata keys can
  1694. be used as flags, default is @option{all} which measures everything.
  1695. @option{none} disables all overall measurement.
  1696. @end table
  1697. A description of each shown parameter follows:
  1698. @table @option
  1699. @item DC offset
  1700. Mean amplitude displacement from zero.
  1701. @item Min level
  1702. Minimal sample level.
  1703. @item Max level
  1704. Maximal sample level.
  1705. @item Min difference
  1706. Minimal difference between two consecutive samples.
  1707. @item Max difference
  1708. Maximal difference between two consecutive samples.
  1709. @item Mean difference
  1710. Mean difference between two consecutive samples.
  1711. The average of each difference between two consecutive samples.
  1712. @item RMS difference
  1713. Root Mean Square difference between two consecutive samples.
  1714. @item Peak level dB
  1715. @item RMS level dB
  1716. Standard peak and RMS level measured in dBFS.
  1717. @item RMS peak dB
  1718. @item RMS trough dB
  1719. Peak and trough values for RMS level measured over a short window.
  1720. @item Crest factor
  1721. Standard ratio of peak to RMS level (note: not in dB).
  1722. @item Flat factor
  1723. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1724. (i.e. either @var{Min level} or @var{Max level}).
  1725. @item Peak count
  1726. Number of occasions (not the number of samples) that the signal attained either
  1727. @var{Min level} or @var{Max level}.
  1728. @item Bit depth
  1729. Overall bit depth of audio. Number of bits used for each sample.
  1730. @item Dynamic range
  1731. Measured dynamic range of audio in dB.
  1732. @item Zero crossings
  1733. Number of points where the waveform crosses the zero level axis.
  1734. @item Zero crossings rate
  1735. Rate of Zero crossings and number of audio samples.
  1736. @end table
  1737. @section atempo
  1738. Adjust audio tempo.
  1739. The filter accepts exactly one parameter, the audio tempo. If not
  1740. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1741. be in the [0.5, 100.0] range.
  1742. Note that tempo greater than 2 will skip some samples rather than
  1743. blend them in. If for any reason this is a concern it is always
  1744. possible to daisy-chain several instances of atempo to achieve the
  1745. desired product tempo.
  1746. @subsection Examples
  1747. @itemize
  1748. @item
  1749. Slow down audio to 80% tempo:
  1750. @example
  1751. atempo=0.8
  1752. @end example
  1753. @item
  1754. To speed up audio to 300% tempo:
  1755. @example
  1756. atempo=3
  1757. @end example
  1758. @item
  1759. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1760. @example
  1761. atempo=sqrt(3),atempo=sqrt(3)
  1762. @end example
  1763. @end itemize
  1764. @section atrim
  1765. Trim the input so that the output contains one continuous subpart of the input.
  1766. It accepts the following parameters:
  1767. @table @option
  1768. @item start
  1769. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1770. sample with the timestamp @var{start} will be the first sample in the output.
  1771. @item end
  1772. Specify time of the first audio sample that will be dropped, i.e. the
  1773. audio sample immediately preceding the one with the timestamp @var{end} will be
  1774. the last sample in the output.
  1775. @item start_pts
  1776. Same as @var{start}, except this option sets the start timestamp in samples
  1777. instead of seconds.
  1778. @item end_pts
  1779. Same as @var{end}, except this option sets the end timestamp in samples instead
  1780. of seconds.
  1781. @item duration
  1782. The maximum duration of the output in seconds.
  1783. @item start_sample
  1784. The number of the first sample that should be output.
  1785. @item end_sample
  1786. The number of the first sample that should be dropped.
  1787. @end table
  1788. @option{start}, @option{end}, and @option{duration} are expressed as time
  1789. duration specifications; see
  1790. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1791. Note that the first two sets of the start/end options and the @option{duration}
  1792. option look at the frame timestamp, while the _sample options simply count the
  1793. samples that pass through the filter. So start/end_pts and start/end_sample will
  1794. give different results when the timestamps are wrong, inexact or do not start at
  1795. zero. Also note that this filter does not modify the timestamps. If you wish
  1796. to have the output timestamps start at zero, insert the asetpts filter after the
  1797. atrim filter.
  1798. If multiple start or end options are set, this filter tries to be greedy and
  1799. keep all samples that match at least one of the specified constraints. To keep
  1800. only the part that matches all the constraints at once, chain multiple atrim
  1801. filters.
  1802. The defaults are such that all the input is kept. So it is possible to set e.g.
  1803. just the end values to keep everything before the specified time.
  1804. Examples:
  1805. @itemize
  1806. @item
  1807. Drop everything except the second minute of input:
  1808. @example
  1809. ffmpeg -i INPUT -af atrim=60:120
  1810. @end example
  1811. @item
  1812. Keep only the first 1000 samples:
  1813. @example
  1814. ffmpeg -i INPUT -af atrim=end_sample=1000
  1815. @end example
  1816. @end itemize
  1817. @section bandpass
  1818. Apply a two-pole Butterworth band-pass filter with central
  1819. frequency @var{frequency}, and (3dB-point) band-width width.
  1820. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1821. instead of the default: constant 0dB peak gain.
  1822. The filter roll off at 6dB per octave (20dB per decade).
  1823. The filter accepts the following options:
  1824. @table @option
  1825. @item frequency, f
  1826. Set the filter's central frequency. Default is @code{3000}.
  1827. @item csg
  1828. Constant skirt gain if set to 1. Defaults to 0.
  1829. @item width_type, t
  1830. Set method to specify band-width of filter.
  1831. @table @option
  1832. @item h
  1833. Hz
  1834. @item q
  1835. Q-Factor
  1836. @item o
  1837. octave
  1838. @item s
  1839. slope
  1840. @item k
  1841. kHz
  1842. @end table
  1843. @item width, w
  1844. Specify the band-width of a filter in width_type units.
  1845. @item channels, c
  1846. Specify which channels to filter, by default all available are filtered.
  1847. @end table
  1848. @subsection Commands
  1849. This filter supports the following commands:
  1850. @table @option
  1851. @item frequency, f
  1852. Change bandpass frequency.
  1853. Syntax for the command is : "@var{frequency}"
  1854. @item width_type, t
  1855. Change bandpass width_type.
  1856. Syntax for the command is : "@var{width_type}"
  1857. @item width, w
  1858. Change bandpass width.
  1859. Syntax for the command is : "@var{width}"
  1860. @end table
  1861. @section bandreject
  1862. Apply a two-pole Butterworth band-reject filter with central
  1863. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1864. The filter roll off at 6dB per octave (20dB per decade).
  1865. The filter accepts the following options:
  1866. @table @option
  1867. @item frequency, f
  1868. Set the filter's central frequency. Default is @code{3000}.
  1869. @item width_type, t
  1870. Set method to specify band-width of filter.
  1871. @table @option
  1872. @item h
  1873. Hz
  1874. @item q
  1875. Q-Factor
  1876. @item o
  1877. octave
  1878. @item s
  1879. slope
  1880. @item k
  1881. kHz
  1882. @end table
  1883. @item width, w
  1884. Specify the band-width of a filter in width_type units.
  1885. @item channels, c
  1886. Specify which channels to filter, by default all available are filtered.
  1887. @end table
  1888. @subsection Commands
  1889. This filter supports the following commands:
  1890. @table @option
  1891. @item frequency, f
  1892. Change bandreject frequency.
  1893. Syntax for the command is : "@var{frequency}"
  1894. @item width_type, t
  1895. Change bandreject width_type.
  1896. Syntax for the command is : "@var{width_type}"
  1897. @item width, w
  1898. Change bandreject width.
  1899. Syntax for the command is : "@var{width}"
  1900. @end table
  1901. @section bass, lowshelf
  1902. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1903. shelving filter with a response similar to that of a standard
  1904. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1905. The filter accepts the following options:
  1906. @table @option
  1907. @item gain, g
  1908. Give the gain at 0 Hz. Its useful range is about -20
  1909. (for a large cut) to +20 (for a large boost).
  1910. Beware of clipping when using a positive gain.
  1911. @item frequency, f
  1912. Set the filter's central frequency and so can be used
  1913. to extend or reduce the frequency range to be boosted or cut.
  1914. The default value is @code{100} Hz.
  1915. @item width_type, t
  1916. Set method to specify band-width of filter.
  1917. @table @option
  1918. @item h
  1919. Hz
  1920. @item q
  1921. Q-Factor
  1922. @item o
  1923. octave
  1924. @item s
  1925. slope
  1926. @item k
  1927. kHz
  1928. @end table
  1929. @item width, w
  1930. Determine how steep is the filter's shelf transition.
  1931. @item channels, c
  1932. Specify which channels to filter, by default all available are filtered.
  1933. @end table
  1934. @subsection Commands
  1935. This filter supports the following commands:
  1936. @table @option
  1937. @item frequency, f
  1938. Change bass frequency.
  1939. Syntax for the command is : "@var{frequency}"
  1940. @item width_type, t
  1941. Change bass width_type.
  1942. Syntax for the command is : "@var{width_type}"
  1943. @item width, w
  1944. Change bass width.
  1945. Syntax for the command is : "@var{width}"
  1946. @item gain, g
  1947. Change bass gain.
  1948. Syntax for the command is : "@var{gain}"
  1949. @end table
  1950. @section biquad
  1951. Apply a biquad IIR filter with the given coefficients.
  1952. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1953. are the numerator and denominator coefficients respectively.
  1954. and @var{channels}, @var{c} specify which channels to filter, by default all
  1955. available are filtered.
  1956. @subsection Commands
  1957. This filter supports the following commands:
  1958. @table @option
  1959. @item a0
  1960. @item a1
  1961. @item a2
  1962. @item b0
  1963. @item b1
  1964. @item b2
  1965. Change biquad parameter.
  1966. Syntax for the command is : "@var{value}"
  1967. @end table
  1968. @section bs2b
  1969. Bauer stereo to binaural transformation, which improves headphone listening of
  1970. stereo audio records.
  1971. To enable compilation of this filter you need to configure FFmpeg with
  1972. @code{--enable-libbs2b}.
  1973. It accepts the following parameters:
  1974. @table @option
  1975. @item profile
  1976. Pre-defined crossfeed level.
  1977. @table @option
  1978. @item default
  1979. Default level (fcut=700, feed=50).
  1980. @item cmoy
  1981. Chu Moy circuit (fcut=700, feed=60).
  1982. @item jmeier
  1983. Jan Meier circuit (fcut=650, feed=95).
  1984. @end table
  1985. @item fcut
  1986. Cut frequency (in Hz).
  1987. @item feed
  1988. Feed level (in Hz).
  1989. @end table
  1990. @section channelmap
  1991. Remap input channels to new locations.
  1992. It accepts the following parameters:
  1993. @table @option
  1994. @item map
  1995. Map channels from input to output. The argument is a '|'-separated list of
  1996. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1997. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1998. channel (e.g. FL for front left) or its index in the input channel layout.
  1999. @var{out_channel} is the name of the output channel or its index in the output
  2000. channel layout. If @var{out_channel} is not given then it is implicitly an
  2001. index, starting with zero and increasing by one for each mapping.
  2002. @item channel_layout
  2003. The channel layout of the output stream.
  2004. @end table
  2005. If no mapping is present, the filter will implicitly map input channels to
  2006. output channels, preserving indices.
  2007. @subsection Examples
  2008. @itemize
  2009. @item
  2010. For example, assuming a 5.1+downmix input MOV file,
  2011. @example
  2012. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2013. @end example
  2014. will create an output WAV file tagged as stereo from the downmix channels of
  2015. the input.
  2016. @item
  2017. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2018. @example
  2019. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2020. @end example
  2021. @end itemize
  2022. @section channelsplit
  2023. Split each channel from an input audio stream into a separate output stream.
  2024. It accepts the following parameters:
  2025. @table @option
  2026. @item channel_layout
  2027. The channel layout of the input stream. The default is "stereo".
  2028. @item channels
  2029. A channel layout describing the channels to be extracted as separate output streams
  2030. or "all" to extract each input channel as a separate stream. The default is "all".
  2031. Choosing channels not present in channel layout in the input will result in an error.
  2032. @end table
  2033. @subsection Examples
  2034. @itemize
  2035. @item
  2036. For example, assuming a stereo input MP3 file,
  2037. @example
  2038. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2039. @end example
  2040. will create an output Matroska file with two audio streams, one containing only
  2041. the left channel and the other the right channel.
  2042. @item
  2043. Split a 5.1 WAV file into per-channel files:
  2044. @example
  2045. ffmpeg -i in.wav -filter_complex
  2046. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2047. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2048. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2049. side_right.wav
  2050. @end example
  2051. @item
  2052. Extract only LFE from a 5.1 WAV file:
  2053. @example
  2054. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2055. -map '[LFE]' lfe.wav
  2056. @end example
  2057. @end itemize
  2058. @section chorus
  2059. Add a chorus effect to the audio.
  2060. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2061. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2062. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2063. The modulation depth defines the range the modulated delay is played before or after
  2064. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2065. sound tuned around the original one, like in a chorus where some vocals are slightly
  2066. off key.
  2067. It accepts the following parameters:
  2068. @table @option
  2069. @item in_gain
  2070. Set input gain. Default is 0.4.
  2071. @item out_gain
  2072. Set output gain. Default is 0.4.
  2073. @item delays
  2074. Set delays. A typical delay is around 40ms to 60ms.
  2075. @item decays
  2076. Set decays.
  2077. @item speeds
  2078. Set speeds.
  2079. @item depths
  2080. Set depths.
  2081. @end table
  2082. @subsection Examples
  2083. @itemize
  2084. @item
  2085. A single delay:
  2086. @example
  2087. chorus=0.7:0.9:55:0.4:0.25:2
  2088. @end example
  2089. @item
  2090. Two delays:
  2091. @example
  2092. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2093. @end example
  2094. @item
  2095. Fuller sounding chorus with three delays:
  2096. @example
  2097. 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
  2098. @end example
  2099. @end itemize
  2100. @section compand
  2101. Compress or expand the audio's dynamic range.
  2102. It accepts the following parameters:
  2103. @table @option
  2104. @item attacks
  2105. @item decays
  2106. A list of times in seconds for each channel over which the instantaneous level
  2107. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2108. increase of volume and @var{decays} refers to decrease of volume. For most
  2109. situations, the attack time (response to the audio getting louder) should be
  2110. shorter than the decay time, because the human ear is more sensitive to sudden
  2111. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2112. a typical value for decay is 0.8 seconds.
  2113. If specified number of attacks & decays is lower than number of channels, the last
  2114. set attack/decay will be used for all remaining channels.
  2115. @item points
  2116. A list of points for the transfer function, specified in dB relative to the
  2117. maximum possible signal amplitude. Each key points list must be defined using
  2118. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2119. @code{x0/y0 x1/y1 x2/y2 ....}
  2120. The input values must be in strictly increasing order but the transfer function
  2121. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2122. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2123. function are @code{-70/-70|-60/-20|1/0}.
  2124. @item soft-knee
  2125. Set the curve radius in dB for all joints. It defaults to 0.01.
  2126. @item gain
  2127. Set the additional gain in dB to be applied at all points on the transfer
  2128. function. This allows for easy adjustment of the overall gain.
  2129. It defaults to 0.
  2130. @item volume
  2131. Set an initial volume, in dB, to be assumed for each channel when filtering
  2132. starts. This permits the user to supply a nominal level initially, so that, for
  2133. example, a very large gain is not applied to initial signal levels before the
  2134. companding has begun to operate. A typical value for audio which is initially
  2135. quiet is -90 dB. It defaults to 0.
  2136. @item delay
  2137. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2138. delayed before being fed to the volume adjuster. Specifying a delay
  2139. approximately equal to the attack/decay times allows the filter to effectively
  2140. operate in predictive rather than reactive mode. It defaults to 0.
  2141. @end table
  2142. @subsection Examples
  2143. @itemize
  2144. @item
  2145. Make music with both quiet and loud passages suitable for listening to in a
  2146. noisy environment:
  2147. @example
  2148. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2149. @end example
  2150. Another example for audio with whisper and explosion parts:
  2151. @example
  2152. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2153. @end example
  2154. @item
  2155. A noise gate for when the noise is at a lower level than the signal:
  2156. @example
  2157. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2158. @end example
  2159. @item
  2160. Here is another noise gate, this time for when the noise is at a higher level
  2161. than the signal (making it, in some ways, similar to squelch):
  2162. @example
  2163. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2164. @end example
  2165. @item
  2166. 2:1 compression starting at -6dB:
  2167. @example
  2168. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2169. @end example
  2170. @item
  2171. 2:1 compression starting at -9dB:
  2172. @example
  2173. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2174. @end example
  2175. @item
  2176. 2:1 compression starting at -12dB:
  2177. @example
  2178. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2179. @end example
  2180. @item
  2181. 2:1 compression starting at -18dB:
  2182. @example
  2183. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2184. @end example
  2185. @item
  2186. 3:1 compression starting at -15dB:
  2187. @example
  2188. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2189. @end example
  2190. @item
  2191. Compressor/Gate:
  2192. @example
  2193. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2194. @end example
  2195. @item
  2196. Expander:
  2197. @example
  2198. 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
  2199. @end example
  2200. @item
  2201. Hard limiter at -6dB:
  2202. @example
  2203. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2204. @end example
  2205. @item
  2206. Hard limiter at -12dB:
  2207. @example
  2208. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2209. @end example
  2210. @item
  2211. Hard noise gate at -35 dB:
  2212. @example
  2213. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2214. @end example
  2215. @item
  2216. Soft limiter:
  2217. @example
  2218. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2219. @end example
  2220. @end itemize
  2221. @section compensationdelay
  2222. Compensation Delay Line is a metric based delay to compensate differing
  2223. positions of microphones or speakers.
  2224. For example, you have recorded guitar with two microphones placed in
  2225. different location. Because the front of sound wave has fixed speed in
  2226. normal conditions, the phasing of microphones can vary and depends on
  2227. their location and interposition. The best sound mix can be achieved when
  2228. these microphones are in phase (synchronized). Note that distance of
  2229. ~30 cm between microphones makes one microphone to capture signal in
  2230. antiphase to another microphone. That makes the final mix sounding moody.
  2231. This filter helps to solve phasing problems by adding different delays
  2232. to each microphone track and make them synchronized.
  2233. The best result can be reached when you take one track as base and
  2234. synchronize other tracks one by one with it.
  2235. Remember that synchronization/delay tolerance depends on sample rate, too.
  2236. Higher sample rates will give more tolerance.
  2237. It accepts the following parameters:
  2238. @table @option
  2239. @item mm
  2240. Set millimeters distance. This is compensation distance for fine tuning.
  2241. Default is 0.
  2242. @item cm
  2243. Set cm distance. This is compensation distance for tightening distance setup.
  2244. Default is 0.
  2245. @item m
  2246. Set meters distance. This is compensation distance for hard distance setup.
  2247. Default is 0.
  2248. @item dry
  2249. Set dry amount. Amount of unprocessed (dry) signal.
  2250. Default is 0.
  2251. @item wet
  2252. Set wet amount. Amount of processed (wet) signal.
  2253. Default is 1.
  2254. @item temp
  2255. Set temperature degree in Celsius. This is the temperature of the environment.
  2256. Default is 20.
  2257. @end table
  2258. @section crossfeed
  2259. Apply headphone crossfeed filter.
  2260. Crossfeed is the process of blending the left and right channels of stereo
  2261. audio recording.
  2262. It is mainly used to reduce extreme stereo separation of low frequencies.
  2263. The intent is to produce more speaker like sound to the listener.
  2264. The filter accepts the following options:
  2265. @table @option
  2266. @item strength
  2267. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2268. This sets gain of low shelf filter for side part of stereo image.
  2269. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2270. @item range
  2271. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2272. This sets cut off frequency of low shelf filter. Default is cut off near
  2273. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2274. @item level_in
  2275. Set input gain. Default is 0.9.
  2276. @item level_out
  2277. Set output gain. Default is 1.
  2278. @end table
  2279. @section crystalizer
  2280. Simple algorithm to expand audio dynamic range.
  2281. The filter accepts the following options:
  2282. @table @option
  2283. @item i
  2284. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2285. (unchanged sound) to 10.0 (maximum effect).
  2286. @item c
  2287. Enable clipping. By default is enabled.
  2288. @end table
  2289. @section dcshift
  2290. Apply a DC shift to the audio.
  2291. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2292. in the recording chain) from the audio. The effect of a DC offset is reduced
  2293. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2294. a signal has a DC offset.
  2295. @table @option
  2296. @item shift
  2297. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2298. the audio.
  2299. @item limitergain
  2300. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2301. used to prevent clipping.
  2302. @end table
  2303. @section drmeter
  2304. Measure audio dynamic range.
  2305. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2306. is found in transition material. And anything less that 8 have very poor dynamics
  2307. and is very compressed.
  2308. The filter accepts the following options:
  2309. @table @option
  2310. @item length
  2311. Set window length in seconds used to split audio into segments of equal length.
  2312. Default is 3 seconds.
  2313. @end table
  2314. @section dynaudnorm
  2315. Dynamic Audio Normalizer.
  2316. This filter applies a certain amount of gain to the input audio in order
  2317. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2318. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2319. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2320. This allows for applying extra gain to the "quiet" sections of the audio
  2321. while avoiding distortions or clipping the "loud" sections. In other words:
  2322. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2323. sections, in the sense that the volume of each section is brought to the
  2324. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2325. this goal *without* applying "dynamic range compressing". It will retain 100%
  2326. of the dynamic range *within* each section of the audio file.
  2327. @table @option
  2328. @item f
  2329. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2330. Default is 500 milliseconds.
  2331. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2332. referred to as frames. This is required, because a peak magnitude has no
  2333. meaning for just a single sample value. Instead, we need to determine the
  2334. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2335. normalizer would simply use the peak magnitude of the complete file, the
  2336. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2337. frame. The length of a frame is specified in milliseconds. By default, the
  2338. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2339. been found to give good results with most files.
  2340. Note that the exact frame length, in number of samples, will be determined
  2341. automatically, based on the sampling rate of the individual input audio file.
  2342. @item g
  2343. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2344. number. Default is 31.
  2345. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2346. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2347. is specified in frames, centered around the current frame. For the sake of
  2348. simplicity, this must be an odd number. Consequently, the default value of 31
  2349. takes into account the current frame, as well as the 15 preceding frames and
  2350. the 15 subsequent frames. Using a larger window results in a stronger
  2351. smoothing effect and thus in less gain variation, i.e. slower gain
  2352. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2353. effect and thus in more gain variation, i.e. faster gain adaptation.
  2354. In other words, the more you increase this value, the more the Dynamic Audio
  2355. Normalizer will behave like a "traditional" normalization filter. On the
  2356. contrary, the more you decrease this value, the more the Dynamic Audio
  2357. Normalizer will behave like a dynamic range compressor.
  2358. @item p
  2359. Set the target peak value. This specifies the highest permissible magnitude
  2360. level for the normalized audio input. This filter will try to approach the
  2361. target peak magnitude as closely as possible, but at the same time it also
  2362. makes sure that the normalized signal will never exceed the peak magnitude.
  2363. A frame's maximum local gain factor is imposed directly by the target peak
  2364. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2365. It is not recommended to go above this value.
  2366. @item m
  2367. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2368. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2369. factor for each input frame, i.e. the maximum gain factor that does not
  2370. result in clipping or distortion. The maximum gain factor is determined by
  2371. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2372. additionally bounds the frame's maximum gain factor by a predetermined
  2373. (global) maximum gain factor. This is done in order to avoid excessive gain
  2374. factors in "silent" or almost silent frames. By default, the maximum gain
  2375. factor is 10.0, For most inputs the default value should be sufficient and
  2376. it usually is not recommended to increase this value. Though, for input
  2377. with an extremely low overall volume level, it may be necessary to allow even
  2378. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2379. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2380. Instead, a "sigmoid" threshold function will be applied. This way, the
  2381. gain factors will smoothly approach the threshold value, but never exceed that
  2382. value.
  2383. @item r
  2384. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2385. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2386. This means that the maximum local gain factor for each frame is defined
  2387. (only) by the frame's highest magnitude sample. This way, the samples can
  2388. be amplified as much as possible without exceeding the maximum signal
  2389. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2390. Normalizer can also take into account the frame's root mean square,
  2391. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2392. determine the power of a time-varying signal. It is therefore considered
  2393. that the RMS is a better approximation of the "perceived loudness" than
  2394. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2395. frames to a constant RMS value, a uniform "perceived loudness" can be
  2396. established. If a target RMS value has been specified, a frame's local gain
  2397. factor is defined as the factor that would result in exactly that RMS value.
  2398. Note, however, that the maximum local gain factor is still restricted by the
  2399. frame's highest magnitude sample, in order to prevent clipping.
  2400. @item n
  2401. Enable channels coupling. By default is enabled.
  2402. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2403. amount. This means the same gain factor will be applied to all channels, i.e.
  2404. the maximum possible gain factor is determined by the "loudest" channel.
  2405. However, in some recordings, it may happen that the volume of the different
  2406. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2407. In this case, this option can be used to disable the channel coupling. This way,
  2408. the gain factor will be determined independently for each channel, depending
  2409. only on the individual channel's highest magnitude sample. This allows for
  2410. harmonizing the volume of the different channels.
  2411. @item c
  2412. Enable DC bias correction. By default is disabled.
  2413. An audio signal (in the time domain) is a sequence of sample values.
  2414. In the Dynamic Audio Normalizer these sample values are represented in the
  2415. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2416. audio signal, or "waveform", should be centered around the zero point.
  2417. That means if we calculate the mean value of all samples in a file, or in a
  2418. single frame, then the result should be 0.0 or at least very close to that
  2419. value. If, however, there is a significant deviation of the mean value from
  2420. 0.0, in either positive or negative direction, this is referred to as a
  2421. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2422. Audio Normalizer provides optional DC bias correction.
  2423. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2424. the mean value, or "DC correction" offset, of each input frame and subtract
  2425. that value from all of the frame's sample values which ensures those samples
  2426. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2427. boundaries, the DC correction offset values will be interpolated smoothly
  2428. between neighbouring frames.
  2429. @item b
  2430. Enable alternative boundary mode. By default is disabled.
  2431. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2432. around each frame. This includes the preceding frames as well as the
  2433. subsequent frames. However, for the "boundary" frames, located at the very
  2434. beginning and at the very end of the audio file, not all neighbouring
  2435. frames are available. In particular, for the first few frames in the audio
  2436. file, the preceding frames are not known. And, similarly, for the last few
  2437. frames in the audio file, the subsequent frames are not known. Thus, the
  2438. question arises which gain factors should be assumed for the missing frames
  2439. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2440. to deal with this situation. The default boundary mode assumes a gain factor
  2441. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2442. "fade out" at the beginning and at the end of the input, respectively.
  2443. @item s
  2444. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2445. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2446. compression. This means that signal peaks will not be pruned and thus the
  2447. full dynamic range will be retained within each local neighbourhood. However,
  2448. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2449. normalization algorithm with a more "traditional" compression.
  2450. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2451. (thresholding) function. If (and only if) the compression feature is enabled,
  2452. all input frames will be processed by a soft knee thresholding function prior
  2453. to the actual normalization process. Put simply, the thresholding function is
  2454. going to prune all samples whose magnitude exceeds a certain threshold value.
  2455. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2456. value. Instead, the threshold value will be adjusted for each individual
  2457. frame.
  2458. In general, smaller parameters result in stronger compression, and vice versa.
  2459. Values below 3.0 are not recommended, because audible distortion may appear.
  2460. @end table
  2461. @section earwax
  2462. Make audio easier to listen to on headphones.
  2463. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2464. so that when listened to on headphones the stereo image is moved from
  2465. inside your head (standard for headphones) to outside and in front of
  2466. the listener (standard for speakers).
  2467. Ported from SoX.
  2468. @section equalizer
  2469. Apply a two-pole peaking equalisation (EQ) filter. With this
  2470. filter, the signal-level at and around a selected frequency can
  2471. be increased or decreased, whilst (unlike bandpass and bandreject
  2472. filters) that at all other frequencies is unchanged.
  2473. In order to produce complex equalisation curves, this filter can
  2474. be given several times, each with a different central frequency.
  2475. The filter accepts the following options:
  2476. @table @option
  2477. @item frequency, f
  2478. Set the filter's central frequency in Hz.
  2479. @item width_type, t
  2480. Set method to specify band-width of filter.
  2481. @table @option
  2482. @item h
  2483. Hz
  2484. @item q
  2485. Q-Factor
  2486. @item o
  2487. octave
  2488. @item s
  2489. slope
  2490. @item k
  2491. kHz
  2492. @end table
  2493. @item width, w
  2494. Specify the band-width of a filter in width_type units.
  2495. @item gain, g
  2496. Set the required gain or attenuation in dB.
  2497. Beware of clipping when using a positive gain.
  2498. @item channels, c
  2499. Specify which channels to filter, by default all available are filtered.
  2500. @end table
  2501. @subsection Examples
  2502. @itemize
  2503. @item
  2504. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2505. @example
  2506. equalizer=f=1000:t=h:width=200:g=-10
  2507. @end example
  2508. @item
  2509. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2510. @example
  2511. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2512. @end example
  2513. @end itemize
  2514. @subsection Commands
  2515. This filter supports the following commands:
  2516. @table @option
  2517. @item frequency, f
  2518. Change equalizer frequency.
  2519. Syntax for the command is : "@var{frequency}"
  2520. @item width_type, t
  2521. Change equalizer width_type.
  2522. Syntax for the command is : "@var{width_type}"
  2523. @item width, w
  2524. Change equalizer width.
  2525. Syntax for the command is : "@var{width}"
  2526. @item gain, g
  2527. Change equalizer gain.
  2528. Syntax for the command is : "@var{gain}"
  2529. @end table
  2530. @section extrastereo
  2531. Linearly increases the difference between left and right channels which
  2532. adds some sort of "live" effect to playback.
  2533. The filter accepts the following options:
  2534. @table @option
  2535. @item m
  2536. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2537. (average of both channels), with 1.0 sound will be unchanged, with
  2538. -1.0 left and right channels will be swapped.
  2539. @item c
  2540. Enable clipping. By default is enabled.
  2541. @end table
  2542. @section firequalizer
  2543. Apply FIR Equalization using arbitrary frequency response.
  2544. The filter accepts the following option:
  2545. @table @option
  2546. @item gain
  2547. Set gain curve equation (in dB). The expression can contain variables:
  2548. @table @option
  2549. @item f
  2550. the evaluated frequency
  2551. @item sr
  2552. sample rate
  2553. @item ch
  2554. channel number, set to 0 when multichannels evaluation is disabled
  2555. @item chid
  2556. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2557. multichannels evaluation is disabled
  2558. @item chs
  2559. number of channels
  2560. @item chlayout
  2561. channel_layout, see libavutil/channel_layout.h
  2562. @end table
  2563. and functions:
  2564. @table @option
  2565. @item gain_interpolate(f)
  2566. interpolate gain on frequency f based on gain_entry
  2567. @item cubic_interpolate(f)
  2568. same as gain_interpolate, but smoother
  2569. @end table
  2570. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2571. @item gain_entry
  2572. Set gain entry for gain_interpolate function. The expression can
  2573. contain functions:
  2574. @table @option
  2575. @item entry(f, g)
  2576. store gain entry at frequency f with value g
  2577. @end table
  2578. This option is also available as command.
  2579. @item delay
  2580. Set filter delay in seconds. Higher value means more accurate.
  2581. Default is @code{0.01}.
  2582. @item accuracy
  2583. Set filter accuracy in Hz. Lower value means more accurate.
  2584. Default is @code{5}.
  2585. @item wfunc
  2586. Set window function. Acceptable values are:
  2587. @table @option
  2588. @item rectangular
  2589. rectangular window, useful when gain curve is already smooth
  2590. @item hann
  2591. hann window (default)
  2592. @item hamming
  2593. hamming window
  2594. @item blackman
  2595. blackman window
  2596. @item nuttall3
  2597. 3-terms continuous 1st derivative nuttall window
  2598. @item mnuttall3
  2599. minimum 3-terms discontinuous nuttall window
  2600. @item nuttall
  2601. 4-terms continuous 1st derivative nuttall window
  2602. @item bnuttall
  2603. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2604. @item bharris
  2605. blackman-harris window
  2606. @item tukey
  2607. tukey window
  2608. @end table
  2609. @item fixed
  2610. If enabled, use fixed number of audio samples. This improves speed when
  2611. filtering with large delay. Default is disabled.
  2612. @item multi
  2613. Enable multichannels evaluation on gain. Default is disabled.
  2614. @item zero_phase
  2615. Enable zero phase mode by subtracting timestamp to compensate delay.
  2616. Default is disabled.
  2617. @item scale
  2618. Set scale used by gain. Acceptable values are:
  2619. @table @option
  2620. @item linlin
  2621. linear frequency, linear gain
  2622. @item linlog
  2623. linear frequency, logarithmic (in dB) gain (default)
  2624. @item loglin
  2625. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2626. @item loglog
  2627. logarithmic frequency, logarithmic gain
  2628. @end table
  2629. @item dumpfile
  2630. Set file for dumping, suitable for gnuplot.
  2631. @item dumpscale
  2632. Set scale for dumpfile. Acceptable values are same with scale option.
  2633. Default is linlog.
  2634. @item fft2
  2635. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2636. Default is disabled.
  2637. @item min_phase
  2638. Enable minimum phase impulse response. Default is disabled.
  2639. @end table
  2640. @subsection Examples
  2641. @itemize
  2642. @item
  2643. lowpass at 1000 Hz:
  2644. @example
  2645. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2646. @end example
  2647. @item
  2648. lowpass at 1000 Hz with gain_entry:
  2649. @example
  2650. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2651. @end example
  2652. @item
  2653. custom equalization:
  2654. @example
  2655. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2656. @end example
  2657. @item
  2658. higher delay with zero phase to compensate delay:
  2659. @example
  2660. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2661. @end example
  2662. @item
  2663. lowpass on left channel, highpass on right channel:
  2664. @example
  2665. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2666. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2667. @end example
  2668. @end itemize
  2669. @section flanger
  2670. Apply a flanging effect to the audio.
  2671. The filter accepts the following options:
  2672. @table @option
  2673. @item delay
  2674. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2675. @item depth
  2676. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2677. @item regen
  2678. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2679. Default value is 0.
  2680. @item width
  2681. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2682. Default value is 71.
  2683. @item speed
  2684. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2685. @item shape
  2686. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2687. Default value is @var{sinusoidal}.
  2688. @item phase
  2689. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2690. Default value is 25.
  2691. @item interp
  2692. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2693. Default is @var{linear}.
  2694. @end table
  2695. @section haas
  2696. Apply Haas effect to audio.
  2697. Note that this makes most sense to apply on mono signals.
  2698. With this filter applied to mono signals it give some directionality and
  2699. stretches its stereo image.
  2700. The filter accepts the following options:
  2701. @table @option
  2702. @item level_in
  2703. Set input level. By default is @var{1}, or 0dB
  2704. @item level_out
  2705. Set output level. By default is @var{1}, or 0dB.
  2706. @item side_gain
  2707. Set gain applied to side part of signal. By default is @var{1}.
  2708. @item middle_source
  2709. Set kind of middle source. Can be one of the following:
  2710. @table @samp
  2711. @item left
  2712. Pick left channel.
  2713. @item right
  2714. Pick right channel.
  2715. @item mid
  2716. Pick middle part signal of stereo image.
  2717. @item side
  2718. Pick side part signal of stereo image.
  2719. @end table
  2720. @item middle_phase
  2721. Change middle phase. By default is disabled.
  2722. @item left_delay
  2723. Set left channel delay. By default is @var{2.05} milliseconds.
  2724. @item left_balance
  2725. Set left channel balance. By default is @var{-1}.
  2726. @item left_gain
  2727. Set left channel gain. By default is @var{1}.
  2728. @item left_phase
  2729. Change left phase. By default is disabled.
  2730. @item right_delay
  2731. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2732. @item right_balance
  2733. Set right channel balance. By default is @var{1}.
  2734. @item right_gain
  2735. Set right channel gain. By default is @var{1}.
  2736. @item right_phase
  2737. Change right phase. By default is enabled.
  2738. @end table
  2739. @section hdcd
  2740. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2741. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2742. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2743. of HDCD, and detects the Transient Filter flag.
  2744. @example
  2745. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2746. @end example
  2747. When using the filter with wav, note the default encoding for wav is 16-bit,
  2748. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2749. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2750. @example
  2751. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2752. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2753. @end example
  2754. The filter accepts the following options:
  2755. @table @option
  2756. @item disable_autoconvert
  2757. Disable any automatic format conversion or resampling in the filter graph.
  2758. @item process_stereo
  2759. Process the stereo channels together. If target_gain does not match between
  2760. channels, consider it invalid and use the last valid target_gain.
  2761. @item cdt_ms
  2762. Set the code detect timer period in ms.
  2763. @item force_pe
  2764. Always extend peaks above -3dBFS even if PE isn't signaled.
  2765. @item analyze_mode
  2766. Replace audio with a solid tone and adjust the amplitude to signal some
  2767. specific aspect of the decoding process. The output file can be loaded in
  2768. an audio editor alongside the original to aid analysis.
  2769. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2770. Modes are:
  2771. @table @samp
  2772. @item 0, off
  2773. Disabled
  2774. @item 1, lle
  2775. Gain adjustment level at each sample
  2776. @item 2, pe
  2777. Samples where peak extend occurs
  2778. @item 3, cdt
  2779. Samples where the code detect timer is active
  2780. @item 4, tgm
  2781. Samples where the target gain does not match between channels
  2782. @end table
  2783. @end table
  2784. @section headphone
  2785. Apply head-related transfer functions (HRTFs) to create virtual
  2786. loudspeakers around the user for binaural listening via headphones.
  2787. The HRIRs are provided via additional streams, for each channel
  2788. one stereo input stream is needed.
  2789. The filter accepts the following options:
  2790. @table @option
  2791. @item map
  2792. Set mapping of input streams for convolution.
  2793. The argument is a '|'-separated list of channel names in order as they
  2794. are given as additional stream inputs for filter.
  2795. This also specify number of input streams. Number of input streams
  2796. must be not less than number of channels in first stream plus one.
  2797. @item gain
  2798. Set gain applied to audio. Value is in dB. Default is 0.
  2799. @item type
  2800. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2801. processing audio in time domain which is slow.
  2802. @var{freq} is processing audio in frequency domain which is fast.
  2803. Default is @var{freq}.
  2804. @item lfe
  2805. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2806. @item size
  2807. Set size of frame in number of samples which will be processed at once.
  2808. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2809. @item hrir
  2810. Set format of hrir stream.
  2811. Default value is @var{stereo}. Alternative value is @var{multich}.
  2812. If value is set to @var{stereo}, number of additional streams should
  2813. be greater or equal to number of input channels in first input stream.
  2814. Also each additional stream should have stereo number of channels.
  2815. If value is set to @var{multich}, number of additional streams should
  2816. be exactly one. Also number of input channels of additional stream
  2817. should be equal or greater than twice number of channels of first input
  2818. stream.
  2819. @end table
  2820. @subsection Examples
  2821. @itemize
  2822. @item
  2823. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2824. each amovie filter use stereo file with IR coefficients as input.
  2825. The files give coefficients for each position of virtual loudspeaker:
  2826. @example
  2827. ffmpeg -i input.wav
  2828. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2829. output.wav
  2830. @end example
  2831. @item
  2832. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2833. but now in @var{multich} @var{hrir} format.
  2834. @example
  2835. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2836. output.wav
  2837. @end example
  2838. @end itemize
  2839. @section highpass
  2840. Apply a high-pass filter with 3dB point frequency.
  2841. The filter can be either single-pole, or double-pole (the default).
  2842. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2843. The filter accepts the following options:
  2844. @table @option
  2845. @item frequency, f
  2846. Set frequency in Hz. Default is 3000.
  2847. @item poles, p
  2848. Set number of poles. Default is 2.
  2849. @item width_type, t
  2850. Set method to specify band-width of filter.
  2851. @table @option
  2852. @item h
  2853. Hz
  2854. @item q
  2855. Q-Factor
  2856. @item o
  2857. octave
  2858. @item s
  2859. slope
  2860. @item k
  2861. kHz
  2862. @end table
  2863. @item width, w
  2864. Specify the band-width of a filter in width_type units.
  2865. Applies only to double-pole filter.
  2866. The default is 0.707q and gives a Butterworth response.
  2867. @item channels, c
  2868. Specify which channels to filter, by default all available are filtered.
  2869. @end table
  2870. @subsection Commands
  2871. This filter supports the following commands:
  2872. @table @option
  2873. @item frequency, f
  2874. Change highpass frequency.
  2875. Syntax for the command is : "@var{frequency}"
  2876. @item width_type, t
  2877. Change highpass width_type.
  2878. Syntax for the command is : "@var{width_type}"
  2879. @item width, w
  2880. Change highpass width.
  2881. Syntax for the command is : "@var{width}"
  2882. @end table
  2883. @section join
  2884. Join multiple input streams into one multi-channel stream.
  2885. It accepts the following parameters:
  2886. @table @option
  2887. @item inputs
  2888. The number of input streams. It defaults to 2.
  2889. @item channel_layout
  2890. The desired output channel layout. It defaults to stereo.
  2891. @item map
  2892. Map channels from inputs to output. The argument is a '|'-separated list of
  2893. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2894. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2895. can be either the name of the input channel (e.g. FL for front left) or its
  2896. index in the specified input stream. @var{out_channel} is the name of the output
  2897. channel.
  2898. @end table
  2899. The filter will attempt to guess the mappings when they are not specified
  2900. explicitly. It does so by first trying to find an unused matching input channel
  2901. and if that fails it picks the first unused input channel.
  2902. Join 3 inputs (with properly set channel layouts):
  2903. @example
  2904. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2905. @end example
  2906. Build a 5.1 output from 6 single-channel streams:
  2907. @example
  2908. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2909. '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'
  2910. out
  2911. @end example
  2912. @section ladspa
  2913. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2914. To enable compilation of this filter you need to configure FFmpeg with
  2915. @code{--enable-ladspa}.
  2916. @table @option
  2917. @item file, f
  2918. Specifies the name of LADSPA plugin library to load. If the environment
  2919. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2920. each one of the directories specified by the colon separated list in
  2921. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2922. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2923. @file{/usr/lib/ladspa/}.
  2924. @item plugin, p
  2925. Specifies the plugin within the library. Some libraries contain only
  2926. one plugin, but others contain many of them. If this is not set filter
  2927. will list all available plugins within the specified library.
  2928. @item controls, c
  2929. Set the '|' separated list of controls which are zero or more floating point
  2930. values that determine the behavior of the loaded plugin (for example delay,
  2931. threshold or gain).
  2932. Controls need to be defined using the following syntax:
  2933. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2934. @var{valuei} is the value set on the @var{i}-th control.
  2935. Alternatively they can be also defined using the following syntax:
  2936. @var{value0}|@var{value1}|@var{value2}|..., where
  2937. @var{valuei} is the value set on the @var{i}-th control.
  2938. If @option{controls} is set to @code{help}, all available controls and
  2939. their valid ranges are printed.
  2940. @item sample_rate, s
  2941. Specify the sample rate, default to 44100. Only used if plugin have
  2942. zero inputs.
  2943. @item nb_samples, n
  2944. Set the number of samples per channel per each output frame, default
  2945. is 1024. Only used if plugin have zero inputs.
  2946. @item duration, d
  2947. Set the minimum duration of the sourced audio. See
  2948. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2949. for the accepted syntax.
  2950. Note that the resulting duration may be greater than the specified duration,
  2951. as the generated audio is always cut at the end of a complete frame.
  2952. If not specified, or the expressed duration is negative, the audio is
  2953. supposed to be generated forever.
  2954. Only used if plugin have zero inputs.
  2955. @end table
  2956. @subsection Examples
  2957. @itemize
  2958. @item
  2959. List all available plugins within amp (LADSPA example plugin) library:
  2960. @example
  2961. ladspa=file=amp
  2962. @end example
  2963. @item
  2964. List all available controls and their valid ranges for @code{vcf_notch}
  2965. plugin from @code{VCF} library:
  2966. @example
  2967. ladspa=f=vcf:p=vcf_notch:c=help
  2968. @end example
  2969. @item
  2970. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2971. plugin library:
  2972. @example
  2973. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2974. @end example
  2975. @item
  2976. Add reverberation to the audio using TAP-plugins
  2977. (Tom's Audio Processing plugins):
  2978. @example
  2979. ladspa=file=tap_reverb:tap_reverb
  2980. @end example
  2981. @item
  2982. Generate white noise, with 0.2 amplitude:
  2983. @example
  2984. ladspa=file=cmt:noise_source_white:c=c0=.2
  2985. @end example
  2986. @item
  2987. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2988. @code{C* Audio Plugin Suite} (CAPS) library:
  2989. @example
  2990. ladspa=file=caps:Click:c=c1=20'
  2991. @end example
  2992. @item
  2993. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2994. @example
  2995. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2996. @end example
  2997. @item
  2998. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2999. @code{SWH Plugins} collection:
  3000. @example
  3001. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3002. @end example
  3003. @item
  3004. Attenuate low frequencies using Multiband EQ from Steve Harris
  3005. @code{SWH Plugins} collection:
  3006. @example
  3007. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3008. @end example
  3009. @item
  3010. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3011. (CAPS) library:
  3012. @example
  3013. ladspa=caps:Narrower
  3014. @end example
  3015. @item
  3016. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3017. @example
  3018. ladspa=caps:White:.2
  3019. @end example
  3020. @item
  3021. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3022. @example
  3023. ladspa=caps:Fractal:c=c1=1
  3024. @end example
  3025. @item
  3026. Dynamic volume normalization using @code{VLevel} plugin:
  3027. @example
  3028. ladspa=vlevel-ladspa:vlevel_mono
  3029. @end example
  3030. @end itemize
  3031. @subsection Commands
  3032. This filter supports the following commands:
  3033. @table @option
  3034. @item cN
  3035. Modify the @var{N}-th control value.
  3036. If the specified value is not valid, it is ignored and prior one is kept.
  3037. @end table
  3038. @section loudnorm
  3039. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3040. Support for both single pass (livestreams, files) and double pass (files) modes.
  3041. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3042. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3043. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3044. The filter accepts the following options:
  3045. @table @option
  3046. @item I, i
  3047. Set integrated loudness target.
  3048. Range is -70.0 - -5.0. Default value is -24.0.
  3049. @item LRA, lra
  3050. Set loudness range target.
  3051. Range is 1.0 - 20.0. Default value is 7.0.
  3052. @item TP, tp
  3053. Set maximum true peak.
  3054. Range is -9.0 - +0.0. Default value is -2.0.
  3055. @item measured_I, measured_i
  3056. Measured IL of input file.
  3057. Range is -99.0 - +0.0.
  3058. @item measured_LRA, measured_lra
  3059. Measured LRA of input file.
  3060. Range is 0.0 - 99.0.
  3061. @item measured_TP, measured_tp
  3062. Measured true peak of input file.
  3063. Range is -99.0 - +99.0.
  3064. @item measured_thresh
  3065. Measured threshold of input file.
  3066. Range is -99.0 - +0.0.
  3067. @item offset
  3068. Set offset gain. Gain is applied before the true-peak limiter.
  3069. Range is -99.0 - +99.0. Default is +0.0.
  3070. @item linear
  3071. Normalize linearly if possible.
  3072. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3073. to be specified in order to use this mode.
  3074. Options are true or false. Default is true.
  3075. @item dual_mono
  3076. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3077. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3078. If set to @code{true}, this option will compensate for this effect.
  3079. Multi-channel input files are not affected by this option.
  3080. Options are true or false. Default is false.
  3081. @item print_format
  3082. Set print format for stats. Options are summary, json, or none.
  3083. Default value is none.
  3084. @end table
  3085. @section lowpass
  3086. Apply a low-pass filter with 3dB point frequency.
  3087. The filter can be either single-pole or double-pole (the default).
  3088. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3089. The filter accepts the following options:
  3090. @table @option
  3091. @item frequency, f
  3092. Set frequency in Hz. Default is 500.
  3093. @item poles, p
  3094. Set number of poles. Default is 2.
  3095. @item width_type, t
  3096. Set method to specify band-width of filter.
  3097. @table @option
  3098. @item h
  3099. Hz
  3100. @item q
  3101. Q-Factor
  3102. @item o
  3103. octave
  3104. @item s
  3105. slope
  3106. @item k
  3107. kHz
  3108. @end table
  3109. @item width, w
  3110. Specify the band-width of a filter in width_type units.
  3111. Applies only to double-pole filter.
  3112. The default is 0.707q and gives a Butterworth response.
  3113. @item channels, c
  3114. Specify which channels to filter, by default all available are filtered.
  3115. @end table
  3116. @subsection Examples
  3117. @itemize
  3118. @item
  3119. Lowpass only LFE channel, it LFE is not present it does nothing:
  3120. @example
  3121. lowpass=c=LFE
  3122. @end example
  3123. @end itemize
  3124. @subsection Commands
  3125. This filter supports the following commands:
  3126. @table @option
  3127. @item frequency, f
  3128. Change lowpass frequency.
  3129. Syntax for the command is : "@var{frequency}"
  3130. @item width_type, t
  3131. Change lowpass width_type.
  3132. Syntax for the command is : "@var{width_type}"
  3133. @item width, w
  3134. Change lowpass width.
  3135. Syntax for the command is : "@var{width}"
  3136. @end table
  3137. @section lv2
  3138. Load a LV2 (LADSPA Version 2) plugin.
  3139. To enable compilation of this filter you need to configure FFmpeg with
  3140. @code{--enable-lv2}.
  3141. @table @option
  3142. @item plugin, p
  3143. Specifies the plugin URI. You may need to escape ':'.
  3144. @item controls, c
  3145. Set the '|' separated list of controls which are zero or more floating point
  3146. values that determine the behavior of the loaded plugin (for example delay,
  3147. threshold or gain).
  3148. If @option{controls} is set to @code{help}, all available controls and
  3149. their valid ranges are printed.
  3150. @item sample_rate, s
  3151. Specify the sample rate, default to 44100. Only used if plugin have
  3152. zero inputs.
  3153. @item nb_samples, n
  3154. Set the number of samples per channel per each output frame, default
  3155. is 1024. Only used if plugin have zero inputs.
  3156. @item duration, d
  3157. Set the minimum duration of the sourced audio. See
  3158. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3159. for the accepted syntax.
  3160. Note that the resulting duration may be greater than the specified duration,
  3161. as the generated audio is always cut at the end of a complete frame.
  3162. If not specified, or the expressed duration is negative, the audio is
  3163. supposed to be generated forever.
  3164. Only used if plugin have zero inputs.
  3165. @end table
  3166. @subsection Examples
  3167. @itemize
  3168. @item
  3169. Apply bass enhancer plugin from Calf:
  3170. @example
  3171. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3172. @end example
  3173. @item
  3174. Apply vinyl plugin from Calf:
  3175. @example
  3176. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3177. @end example
  3178. @item
  3179. Apply bit crusher plugin from ArtyFX:
  3180. @example
  3181. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3182. @end example
  3183. @end itemize
  3184. @section mcompand
  3185. Multiband Compress or expand the audio's dynamic range.
  3186. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3187. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3188. response when absent compander action.
  3189. It accepts the following parameters:
  3190. @table @option
  3191. @item args
  3192. This option syntax is:
  3193. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3194. For explanation of each item refer to compand filter documentation.
  3195. @end table
  3196. @anchor{pan}
  3197. @section pan
  3198. Mix channels with specific gain levels. The filter accepts the output
  3199. channel layout followed by a set of channels definitions.
  3200. This filter is also designed to efficiently remap the channels of an audio
  3201. stream.
  3202. The filter accepts parameters of the form:
  3203. "@var{l}|@var{outdef}|@var{outdef}|..."
  3204. @table @option
  3205. @item l
  3206. output channel layout or number of channels
  3207. @item outdef
  3208. output channel specification, of the form:
  3209. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3210. @item out_name
  3211. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3212. number (c0, c1, etc.)
  3213. @item gain
  3214. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3215. @item in_name
  3216. input channel to use, see out_name for details; it is not possible to mix
  3217. named and numbered input channels
  3218. @end table
  3219. If the `=' in a channel specification is replaced by `<', then the gains for
  3220. that specification will be renormalized so that the total is 1, thus
  3221. avoiding clipping noise.
  3222. @subsection Mixing examples
  3223. For example, if you want to down-mix from stereo to mono, but with a bigger
  3224. factor for the left channel:
  3225. @example
  3226. pan=1c|c0=0.9*c0+0.1*c1
  3227. @end example
  3228. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3229. 7-channels surround:
  3230. @example
  3231. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3232. @end example
  3233. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3234. that should be preferred (see "-ac" option) unless you have very specific
  3235. needs.
  3236. @subsection Remapping examples
  3237. The channel remapping will be effective if, and only if:
  3238. @itemize
  3239. @item gain coefficients are zeroes or ones,
  3240. @item only one input per channel output,
  3241. @end itemize
  3242. If all these conditions are satisfied, the filter will notify the user ("Pure
  3243. channel mapping detected"), and use an optimized and lossless method to do the
  3244. remapping.
  3245. For example, if you have a 5.1 source and want a stereo audio stream by
  3246. dropping the extra channels:
  3247. @example
  3248. pan="stereo| c0=FL | c1=FR"
  3249. @end example
  3250. Given the same source, you can also switch front left and front right channels
  3251. and keep the input channel layout:
  3252. @example
  3253. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3254. @end example
  3255. If the input is a stereo audio stream, you can mute the front left channel (and
  3256. still keep the stereo channel layout) with:
  3257. @example
  3258. pan="stereo|c1=c1"
  3259. @end example
  3260. Still with a stereo audio stream input, you can copy the right channel in both
  3261. front left and right:
  3262. @example
  3263. pan="stereo| c0=FR | c1=FR"
  3264. @end example
  3265. @section replaygain
  3266. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3267. outputs it unchanged.
  3268. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3269. @section resample
  3270. Convert the audio sample format, sample rate and channel layout. It is
  3271. not meant to be used directly.
  3272. @section rubberband
  3273. Apply time-stretching and pitch-shifting with librubberband.
  3274. To enable compilation of this filter, you need to configure FFmpeg with
  3275. @code{--enable-librubberband}.
  3276. The filter accepts the following options:
  3277. @table @option
  3278. @item tempo
  3279. Set tempo scale factor.
  3280. @item pitch
  3281. Set pitch scale factor.
  3282. @item transients
  3283. Set transients detector.
  3284. Possible values are:
  3285. @table @var
  3286. @item crisp
  3287. @item mixed
  3288. @item smooth
  3289. @end table
  3290. @item detector
  3291. Set detector.
  3292. Possible values are:
  3293. @table @var
  3294. @item compound
  3295. @item percussive
  3296. @item soft
  3297. @end table
  3298. @item phase
  3299. Set phase.
  3300. Possible values are:
  3301. @table @var
  3302. @item laminar
  3303. @item independent
  3304. @end table
  3305. @item window
  3306. Set processing window size.
  3307. Possible values are:
  3308. @table @var
  3309. @item standard
  3310. @item short
  3311. @item long
  3312. @end table
  3313. @item smoothing
  3314. Set smoothing.
  3315. Possible values are:
  3316. @table @var
  3317. @item off
  3318. @item on
  3319. @end table
  3320. @item formant
  3321. Enable formant preservation when shift pitching.
  3322. Possible values are:
  3323. @table @var
  3324. @item shifted
  3325. @item preserved
  3326. @end table
  3327. @item pitchq
  3328. Set pitch quality.
  3329. Possible values are:
  3330. @table @var
  3331. @item quality
  3332. @item speed
  3333. @item consistency
  3334. @end table
  3335. @item channels
  3336. Set channels.
  3337. Possible values are:
  3338. @table @var
  3339. @item apart
  3340. @item together
  3341. @end table
  3342. @end table
  3343. @section sidechaincompress
  3344. This filter acts like normal compressor but has the ability to compress
  3345. detected signal using second input signal.
  3346. It needs two input streams and returns one output stream.
  3347. First input stream will be processed depending on second stream signal.
  3348. The filtered signal then can be filtered with other filters in later stages of
  3349. processing. See @ref{pan} and @ref{amerge} filter.
  3350. The filter accepts the following options:
  3351. @table @option
  3352. @item level_in
  3353. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3354. @item mode
  3355. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3356. Default is @code{downward}.
  3357. @item threshold
  3358. If a signal of second stream raises above this level it will affect the gain
  3359. reduction of first stream.
  3360. By default is 0.125. Range is between 0.00097563 and 1.
  3361. @item ratio
  3362. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3363. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3364. Default is 2. Range is between 1 and 20.
  3365. @item attack
  3366. Amount of milliseconds the signal has to rise above the threshold before gain
  3367. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3368. @item release
  3369. Amount of milliseconds the signal has to fall below the threshold before
  3370. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3371. @item makeup
  3372. Set the amount by how much signal will be amplified after processing.
  3373. Default is 1. Range is from 1 to 64.
  3374. @item knee
  3375. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3376. Default is 2.82843. Range is between 1 and 8.
  3377. @item link
  3378. Choose if the @code{average} level between all channels of side-chain stream
  3379. or the louder(@code{maximum}) channel of side-chain stream affects the
  3380. reduction. Default is @code{average}.
  3381. @item detection
  3382. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3383. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3384. @item level_sc
  3385. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3386. @item mix
  3387. How much to use compressed signal in output. Default is 1.
  3388. Range is between 0 and 1.
  3389. @end table
  3390. @subsection Examples
  3391. @itemize
  3392. @item
  3393. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3394. depending on the signal of 2nd input and later compressed signal to be
  3395. merged with 2nd input:
  3396. @example
  3397. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3398. @end example
  3399. @end itemize
  3400. @section sidechaingate
  3401. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3402. filter the detected signal before sending it to the gain reduction stage.
  3403. Normally a gate uses the full range signal to detect a level above the
  3404. threshold.
  3405. For example: If you cut all lower frequencies from your sidechain signal
  3406. the gate will decrease the volume of your track only if not enough highs
  3407. appear. With this technique you are able to reduce the resonation of a
  3408. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3409. guitar.
  3410. It needs two input streams and returns one output stream.
  3411. First input stream will be processed depending on second stream signal.
  3412. The filter accepts the following options:
  3413. @table @option
  3414. @item level_in
  3415. Set input level before filtering.
  3416. Default is 1. Allowed range is from 0.015625 to 64.
  3417. @item mode
  3418. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3419. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3420. will be amplified, expanding dynamic range in upward direction.
  3421. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3422. @item range
  3423. Set the level of gain reduction when the signal is below the threshold.
  3424. Default is 0.06125. Allowed range is from 0 to 1.
  3425. Setting this to 0 disables reduction and then filter behaves like expander.
  3426. @item threshold
  3427. If a signal rises above this level the gain reduction is released.
  3428. Default is 0.125. Allowed range is from 0 to 1.
  3429. @item ratio
  3430. Set a ratio about which the signal is reduced.
  3431. Default is 2. Allowed range is from 1 to 9000.
  3432. @item attack
  3433. Amount of milliseconds the signal has to rise above the threshold before gain
  3434. reduction stops.
  3435. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3436. @item release
  3437. Amount of milliseconds the signal has to fall below the threshold before the
  3438. reduction is increased again. Default is 250 milliseconds.
  3439. Allowed range is from 0.01 to 9000.
  3440. @item makeup
  3441. Set amount of amplification of signal after processing.
  3442. Default is 1. Allowed range is from 1 to 64.
  3443. @item knee
  3444. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3445. Default is 2.828427125. Allowed range is from 1 to 8.
  3446. @item detection
  3447. Choose if exact signal should be taken for detection or an RMS like one.
  3448. Default is rms. Can be peak or rms.
  3449. @item link
  3450. Choose if the average level between all channels or the louder channel affects
  3451. the reduction.
  3452. Default is average. Can be average or maximum.
  3453. @item level_sc
  3454. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3455. @end table
  3456. @section silencedetect
  3457. Detect silence in an audio stream.
  3458. This filter logs a message when it detects that the input audio volume is less
  3459. or equal to a noise tolerance value for a duration greater or equal to the
  3460. minimum detected noise duration.
  3461. The printed times and duration are expressed in seconds.
  3462. The filter accepts the following options:
  3463. @table @option
  3464. @item noise, n
  3465. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3466. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3467. @item duration, d
  3468. Set silence duration until notification (default is 2 seconds).
  3469. @item mono, m
  3470. Process each channel separately, instead of combined. By default is disabled.
  3471. @end table
  3472. @subsection Examples
  3473. @itemize
  3474. @item
  3475. Detect 5 seconds of silence with -50dB noise tolerance:
  3476. @example
  3477. silencedetect=n=-50dB:d=5
  3478. @end example
  3479. @item
  3480. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3481. tolerance in @file{silence.mp3}:
  3482. @example
  3483. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3484. @end example
  3485. @end itemize
  3486. @section silenceremove
  3487. Remove silence from the beginning, middle or end of the audio.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item start_periods
  3491. This value is used to indicate if audio should be trimmed at beginning of
  3492. the audio. A value of zero indicates no silence should be trimmed from the
  3493. beginning. When specifying a non-zero value, it trims audio up until it
  3494. finds non-silence. Normally, when trimming silence from beginning of audio
  3495. the @var{start_periods} will be @code{1} but it can be increased to higher
  3496. values to trim all audio up to specific count of non-silence periods.
  3497. Default value is @code{0}.
  3498. @item start_duration
  3499. Specify the amount of time that non-silence must be detected before it stops
  3500. trimming audio. By increasing the duration, bursts of noises can be treated
  3501. as silence and trimmed off. Default value is @code{0}.
  3502. @item start_threshold
  3503. This indicates what sample value should be treated as silence. For digital
  3504. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3505. you may wish to increase the value to account for background noise.
  3506. Can be specified in dB (in case "dB" is appended to the specified value)
  3507. or amplitude ratio. Default value is @code{0}.
  3508. @item start_silence
  3509. Specify max duration of silence at beginning that will be kept after
  3510. trimming. Default is 0, which is equal to trimming all samples detected
  3511. as silence.
  3512. @item start_mode
  3513. Specify mode of detection of silence end in start of multi-channel audio.
  3514. Can be @var{any} or @var{all}. Default is @var{any}.
  3515. With @var{any}, any sample that is detected as non-silence will cause
  3516. stopped trimming of silence.
  3517. With @var{all}, only if all channels are detected as non-silence will cause
  3518. stopped trimming of silence.
  3519. @item stop_periods
  3520. Set the count for trimming silence from the end of audio.
  3521. To remove silence from the middle of a file, specify a @var{stop_periods}
  3522. that is negative. This value is then treated as a positive value and is
  3523. used to indicate the effect should restart processing as specified by
  3524. @var{start_periods}, making it suitable for removing periods of silence
  3525. in the middle of the audio.
  3526. Default value is @code{0}.
  3527. @item stop_duration
  3528. Specify a duration of silence that must exist before audio is not copied any
  3529. more. By specifying a higher duration, silence that is wanted can be left in
  3530. the audio.
  3531. Default value is @code{0}.
  3532. @item stop_threshold
  3533. This is the same as @option{start_threshold} but for trimming silence from
  3534. the end of audio.
  3535. Can be specified in dB (in case "dB" is appended to the specified value)
  3536. or amplitude ratio. Default value is @code{0}.
  3537. @item stop_silence
  3538. Specify max duration of silence at end that will be kept after
  3539. trimming. Default is 0, which is equal to trimming all samples detected
  3540. as silence.
  3541. @item stop_mode
  3542. Specify mode of detection of silence start in end of multi-channel audio.
  3543. Can be @var{any} or @var{all}. Default is @var{any}.
  3544. With @var{any}, any sample that is detected as non-silence will cause
  3545. stopped trimming of silence.
  3546. With @var{all}, only if all channels are detected as non-silence will cause
  3547. stopped trimming of silence.
  3548. @item detection
  3549. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3550. and works better with digital silence which is exactly 0.
  3551. Default value is @code{rms}.
  3552. @item window
  3553. Set duration in number of seconds used to calculate size of window in number
  3554. of samples for detecting silence.
  3555. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3556. @end table
  3557. @subsection Examples
  3558. @itemize
  3559. @item
  3560. The following example shows how this filter can be used to start a recording
  3561. that does not contain the delay at the start which usually occurs between
  3562. pressing the record button and the start of the performance:
  3563. @example
  3564. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3565. @end example
  3566. @item
  3567. Trim all silence encountered from beginning to end where there is more than 1
  3568. second of silence in audio:
  3569. @example
  3570. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3571. @end example
  3572. @end itemize
  3573. @section sofalizer
  3574. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3575. loudspeakers around the user for binaural listening via headphones (audio
  3576. formats up to 9 channels supported).
  3577. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3578. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3579. Austrian Academy of Sciences.
  3580. To enable compilation of this filter you need to configure FFmpeg with
  3581. @code{--enable-libmysofa}.
  3582. The filter accepts the following options:
  3583. @table @option
  3584. @item sofa
  3585. Set the SOFA file used for rendering.
  3586. @item gain
  3587. Set gain applied to audio. Value is in dB. Default is 0.
  3588. @item rotation
  3589. Set rotation of virtual loudspeakers in deg. Default is 0.
  3590. @item elevation
  3591. Set elevation of virtual speakers in deg. Default is 0.
  3592. @item radius
  3593. Set distance in meters between loudspeakers and the listener with near-field
  3594. HRTFs. Default is 1.
  3595. @item type
  3596. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3597. processing audio in time domain which is slow.
  3598. @var{freq} is processing audio in frequency domain which is fast.
  3599. Default is @var{freq}.
  3600. @item speakers
  3601. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3602. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3603. Each virtual loudspeaker is described with short channel name following with
  3604. azimuth and elevation in degrees.
  3605. Each virtual loudspeaker description is separated by '|'.
  3606. For example to override front left and front right channel positions use:
  3607. 'speakers=FL 45 15|FR 345 15'.
  3608. Descriptions with unrecognised channel names are ignored.
  3609. @item lfegain
  3610. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3611. @item framesize
  3612. Set custom frame size in number of samples. Default is 1024.
  3613. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3614. is set to @var{freq}.
  3615. @item normalize
  3616. Should all IRs be normalized upon importing SOFA file.
  3617. By default is enabled.
  3618. @item interpolate
  3619. Should nearest IRs be interpolated with neighbor IRs if exact position
  3620. does not match. By default is disabled.
  3621. @item minphase
  3622. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3623. @item anglestep
  3624. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3625. @item radstep
  3626. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3627. @end table
  3628. @subsection Examples
  3629. @itemize
  3630. @item
  3631. Using ClubFritz6 sofa file:
  3632. @example
  3633. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3634. @end example
  3635. @item
  3636. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3637. @example
  3638. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3639. @end example
  3640. @item
  3641. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3642. and also with custom gain:
  3643. @example
  3644. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3645. @end example
  3646. @end itemize
  3647. @section stereotools
  3648. This filter has some handy utilities to manage stereo signals, for converting
  3649. M/S stereo recordings to L/R signal while having control over the parameters
  3650. or spreading the stereo image of master track.
  3651. The filter accepts the following options:
  3652. @table @option
  3653. @item level_in
  3654. Set input level before filtering for both channels. Defaults is 1.
  3655. Allowed range is from 0.015625 to 64.
  3656. @item level_out
  3657. Set output level after filtering for both channels. Defaults is 1.
  3658. Allowed range is from 0.015625 to 64.
  3659. @item balance_in
  3660. Set input balance between both channels. Default is 0.
  3661. Allowed range is from -1 to 1.
  3662. @item balance_out
  3663. Set output balance between both channels. Default is 0.
  3664. Allowed range is from -1 to 1.
  3665. @item softclip
  3666. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3667. clipping. Disabled by default.
  3668. @item mutel
  3669. Mute the left channel. Disabled by default.
  3670. @item muter
  3671. Mute the right channel. Disabled by default.
  3672. @item phasel
  3673. Change the phase of the left channel. Disabled by default.
  3674. @item phaser
  3675. Change the phase of the right channel. Disabled by default.
  3676. @item mode
  3677. Set stereo mode. Available values are:
  3678. @table @samp
  3679. @item lr>lr
  3680. Left/Right to Left/Right, this is default.
  3681. @item lr>ms
  3682. Left/Right to Mid/Side.
  3683. @item ms>lr
  3684. Mid/Side to Left/Right.
  3685. @item lr>ll
  3686. Left/Right to Left/Left.
  3687. @item lr>rr
  3688. Left/Right to Right/Right.
  3689. @item lr>l+r
  3690. Left/Right to Left + Right.
  3691. @item lr>rl
  3692. Left/Right to Right/Left.
  3693. @item ms>ll
  3694. Mid/Side to Left/Left.
  3695. @item ms>rr
  3696. Mid/Side to Right/Right.
  3697. @end table
  3698. @item slev
  3699. Set level of side signal. Default is 1.
  3700. Allowed range is from 0.015625 to 64.
  3701. @item sbal
  3702. Set balance of side signal. Default is 0.
  3703. Allowed range is from -1 to 1.
  3704. @item mlev
  3705. Set level of the middle signal. Default is 1.
  3706. Allowed range is from 0.015625 to 64.
  3707. @item mpan
  3708. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3709. @item base
  3710. Set stereo base between mono and inversed channels. Default is 0.
  3711. Allowed range is from -1 to 1.
  3712. @item delay
  3713. Set delay in milliseconds how much to delay left from right channel and
  3714. vice versa. Default is 0. Allowed range is from -20 to 20.
  3715. @item sclevel
  3716. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3717. @item phase
  3718. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3719. @item bmode_in, bmode_out
  3720. Set balance mode for balance_in/balance_out option.
  3721. Can be one of the following:
  3722. @table @samp
  3723. @item balance
  3724. Classic balance mode. Attenuate one channel at time.
  3725. Gain is raised up to 1.
  3726. @item amplitude
  3727. Similar as classic mode above but gain is raised up to 2.
  3728. @item power
  3729. Equal power distribution, from -6dB to +6dB range.
  3730. @end table
  3731. @end table
  3732. @subsection Examples
  3733. @itemize
  3734. @item
  3735. Apply karaoke like effect:
  3736. @example
  3737. stereotools=mlev=0.015625
  3738. @end example
  3739. @item
  3740. Convert M/S signal to L/R:
  3741. @example
  3742. "stereotools=mode=ms>lr"
  3743. @end example
  3744. @end itemize
  3745. @section stereowiden
  3746. This filter enhance the stereo effect by suppressing signal common to both
  3747. channels and by delaying the signal of left into right and vice versa,
  3748. thereby widening the stereo effect.
  3749. The filter accepts the following options:
  3750. @table @option
  3751. @item delay
  3752. Time in milliseconds of the delay of left signal into right and vice versa.
  3753. Default is 20 milliseconds.
  3754. @item feedback
  3755. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3756. effect of left signal in right output and vice versa which gives widening
  3757. effect. Default is 0.3.
  3758. @item crossfeed
  3759. Cross feed of left into right with inverted phase. This helps in suppressing
  3760. the mono. If the value is 1 it will cancel all the signal common to both
  3761. channels. Default is 0.3.
  3762. @item drymix
  3763. Set level of input signal of original channel. Default is 0.8.
  3764. @end table
  3765. @section superequalizer
  3766. Apply 18 band equalizer.
  3767. The filter accepts the following options:
  3768. @table @option
  3769. @item 1b
  3770. Set 65Hz band gain.
  3771. @item 2b
  3772. Set 92Hz band gain.
  3773. @item 3b
  3774. Set 131Hz band gain.
  3775. @item 4b
  3776. Set 185Hz band gain.
  3777. @item 5b
  3778. Set 262Hz band gain.
  3779. @item 6b
  3780. Set 370Hz band gain.
  3781. @item 7b
  3782. Set 523Hz band gain.
  3783. @item 8b
  3784. Set 740Hz band gain.
  3785. @item 9b
  3786. Set 1047Hz band gain.
  3787. @item 10b
  3788. Set 1480Hz band gain.
  3789. @item 11b
  3790. Set 2093Hz band gain.
  3791. @item 12b
  3792. Set 2960Hz band gain.
  3793. @item 13b
  3794. Set 4186Hz band gain.
  3795. @item 14b
  3796. Set 5920Hz band gain.
  3797. @item 15b
  3798. Set 8372Hz band gain.
  3799. @item 16b
  3800. Set 11840Hz band gain.
  3801. @item 17b
  3802. Set 16744Hz band gain.
  3803. @item 18b
  3804. Set 20000Hz band gain.
  3805. @end table
  3806. @section surround
  3807. Apply audio surround upmix filter.
  3808. This filter allows to produce multichannel output from audio stream.
  3809. The filter accepts the following options:
  3810. @table @option
  3811. @item chl_out
  3812. Set output channel layout. By default, this is @var{5.1}.
  3813. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3814. for the required syntax.
  3815. @item chl_in
  3816. Set input channel layout. By default, this is @var{stereo}.
  3817. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3818. for the required syntax.
  3819. @item level_in
  3820. Set input volume level. By default, this is @var{1}.
  3821. @item level_out
  3822. Set output volume level. By default, this is @var{1}.
  3823. @item lfe
  3824. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3825. @item lfe_low
  3826. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3827. @item lfe_high
  3828. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3829. @item lfe_mode
  3830. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3831. In @var{add} mode, LFE channel is created from input audio and added to output.
  3832. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3833. also all non-LFE output channels are subtracted with output LFE channel.
  3834. @item angle
  3835. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3836. Default is @var{90}.
  3837. @item fc_in
  3838. Set front center input volume. By default, this is @var{1}.
  3839. @item fc_out
  3840. Set front center output volume. By default, this is @var{1}.
  3841. @item fl_in
  3842. Set front left input volume. By default, this is @var{1}.
  3843. @item fl_out
  3844. Set front left output volume. By default, this is @var{1}.
  3845. @item fr_in
  3846. Set front right input volume. By default, this is @var{1}.
  3847. @item fr_out
  3848. Set front right output volume. By default, this is @var{1}.
  3849. @item sl_in
  3850. Set side left input volume. By default, this is @var{1}.
  3851. @item sl_out
  3852. Set side left output volume. By default, this is @var{1}.
  3853. @item sr_in
  3854. Set side right input volume. By default, this is @var{1}.
  3855. @item sr_out
  3856. Set side right output volume. By default, this is @var{1}.
  3857. @item bl_in
  3858. Set back left input volume. By default, this is @var{1}.
  3859. @item bl_out
  3860. Set back left output volume. By default, this is @var{1}.
  3861. @item br_in
  3862. Set back right input volume. By default, this is @var{1}.
  3863. @item br_out
  3864. Set back right output volume. By default, this is @var{1}.
  3865. @item bc_in
  3866. Set back center input volume. By default, this is @var{1}.
  3867. @item bc_out
  3868. Set back center output volume. By default, this is @var{1}.
  3869. @item lfe_in
  3870. Set LFE input volume. By default, this is @var{1}.
  3871. @item lfe_out
  3872. Set LFE output volume. By default, this is @var{1}.
  3873. @item allx
  3874. Set spread usage of stereo image across X axis for all channels.
  3875. @item ally
  3876. Set spread usage of stereo image across Y axis for all channels.
  3877. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3878. Set spread usage of stereo image across X axis for each channel.
  3879. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3880. Set spread usage of stereo image across Y axis for each channel.
  3881. @item win_size
  3882. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3883. @item win_func
  3884. Set window function.
  3885. It accepts the following values:
  3886. @table @samp
  3887. @item rect
  3888. @item bartlett
  3889. @item hann, hanning
  3890. @item hamming
  3891. @item blackman
  3892. @item welch
  3893. @item flattop
  3894. @item bharris
  3895. @item bnuttall
  3896. @item bhann
  3897. @item sine
  3898. @item nuttall
  3899. @item lanczos
  3900. @item gauss
  3901. @item tukey
  3902. @item dolph
  3903. @item cauchy
  3904. @item parzen
  3905. @item poisson
  3906. @item bohman
  3907. @end table
  3908. Default is @code{hann}.
  3909. @item overlap
  3910. Set window overlap. If set to 1, the recommended overlap for selected
  3911. window function will be picked. Default is @code{0.5}.
  3912. @end table
  3913. @section treble, highshelf
  3914. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3915. shelving filter with a response similar to that of a standard
  3916. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3917. The filter accepts the following options:
  3918. @table @option
  3919. @item gain, g
  3920. Give the gain at whichever is the lower of ~22 kHz and the
  3921. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3922. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3923. @item frequency, f
  3924. Set the filter's central frequency and so can be used
  3925. to extend or reduce the frequency range to be boosted or cut.
  3926. The default value is @code{3000} Hz.
  3927. @item width_type, t
  3928. Set method to specify band-width of filter.
  3929. @table @option
  3930. @item h
  3931. Hz
  3932. @item q
  3933. Q-Factor
  3934. @item o
  3935. octave
  3936. @item s
  3937. slope
  3938. @item k
  3939. kHz
  3940. @end table
  3941. @item width, w
  3942. Determine how steep is the filter's shelf transition.
  3943. @item channels, c
  3944. Specify which channels to filter, by default all available are filtered.
  3945. @end table
  3946. @subsection Commands
  3947. This filter supports the following commands:
  3948. @table @option
  3949. @item frequency, f
  3950. Change treble frequency.
  3951. Syntax for the command is : "@var{frequency}"
  3952. @item width_type, t
  3953. Change treble width_type.
  3954. Syntax for the command is : "@var{width_type}"
  3955. @item width, w
  3956. Change treble width.
  3957. Syntax for the command is : "@var{width}"
  3958. @item gain, g
  3959. Change treble gain.
  3960. Syntax for the command is : "@var{gain}"
  3961. @end table
  3962. @section tremolo
  3963. Sinusoidal amplitude modulation.
  3964. The filter accepts the following options:
  3965. @table @option
  3966. @item f
  3967. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3968. (20 Hz or lower) will result in a tremolo effect.
  3969. This filter may also be used as a ring modulator by specifying
  3970. a modulation frequency higher than 20 Hz.
  3971. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3972. @item d
  3973. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3974. Default value is 0.5.
  3975. @end table
  3976. @section vibrato
  3977. Sinusoidal phase modulation.
  3978. The filter accepts the following options:
  3979. @table @option
  3980. @item f
  3981. Modulation frequency in Hertz.
  3982. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3983. @item d
  3984. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3985. Default value is 0.5.
  3986. @end table
  3987. @section volume
  3988. Adjust the input audio volume.
  3989. It accepts the following parameters:
  3990. @table @option
  3991. @item volume
  3992. Set audio volume expression.
  3993. Output values are clipped to the maximum value.
  3994. The output audio volume is given by the relation:
  3995. @example
  3996. @var{output_volume} = @var{volume} * @var{input_volume}
  3997. @end example
  3998. The default value for @var{volume} is "1.0".
  3999. @item precision
  4000. This parameter represents the mathematical precision.
  4001. It determines which input sample formats will be allowed, which affects the
  4002. precision of the volume scaling.
  4003. @table @option
  4004. @item fixed
  4005. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4006. @item float
  4007. 32-bit floating-point; this limits input sample format to FLT. (default)
  4008. @item double
  4009. 64-bit floating-point; this limits input sample format to DBL.
  4010. @end table
  4011. @item replaygain
  4012. Choose the behaviour on encountering ReplayGain side data in input frames.
  4013. @table @option
  4014. @item drop
  4015. Remove ReplayGain side data, ignoring its contents (the default).
  4016. @item ignore
  4017. Ignore ReplayGain side data, but leave it in the frame.
  4018. @item track
  4019. Prefer the track gain, if present.
  4020. @item album
  4021. Prefer the album gain, if present.
  4022. @end table
  4023. @item replaygain_preamp
  4024. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4025. Default value for @var{replaygain_preamp} is 0.0.
  4026. @item eval
  4027. Set when the volume expression is evaluated.
  4028. It accepts the following values:
  4029. @table @samp
  4030. @item once
  4031. only evaluate expression once during the filter initialization, or
  4032. when the @samp{volume} command is sent
  4033. @item frame
  4034. evaluate expression for each incoming frame
  4035. @end table
  4036. Default value is @samp{once}.
  4037. @end table
  4038. The volume expression can contain the following parameters.
  4039. @table @option
  4040. @item n
  4041. frame number (starting at zero)
  4042. @item nb_channels
  4043. number of channels
  4044. @item nb_consumed_samples
  4045. number of samples consumed by the filter
  4046. @item nb_samples
  4047. number of samples in the current frame
  4048. @item pos
  4049. original frame position in the file
  4050. @item pts
  4051. frame PTS
  4052. @item sample_rate
  4053. sample rate
  4054. @item startpts
  4055. PTS at start of stream
  4056. @item startt
  4057. time at start of stream
  4058. @item t
  4059. frame time
  4060. @item tb
  4061. timestamp timebase
  4062. @item volume
  4063. last set volume value
  4064. @end table
  4065. Note that when @option{eval} is set to @samp{once} only the
  4066. @var{sample_rate} and @var{tb} variables are available, all other
  4067. variables will evaluate to NAN.
  4068. @subsection Commands
  4069. This filter supports the following commands:
  4070. @table @option
  4071. @item volume
  4072. Modify the volume expression.
  4073. The command accepts the same syntax of the corresponding option.
  4074. If the specified expression is not valid, it is kept at its current
  4075. value.
  4076. @item replaygain_noclip
  4077. Prevent clipping by limiting the gain applied.
  4078. Default value for @var{replaygain_noclip} is 1.
  4079. @end table
  4080. @subsection Examples
  4081. @itemize
  4082. @item
  4083. Halve the input audio volume:
  4084. @example
  4085. volume=volume=0.5
  4086. volume=volume=1/2
  4087. volume=volume=-6.0206dB
  4088. @end example
  4089. In all the above example the named key for @option{volume} can be
  4090. omitted, for example like in:
  4091. @example
  4092. volume=0.5
  4093. @end example
  4094. @item
  4095. Increase input audio power by 6 decibels using fixed-point precision:
  4096. @example
  4097. volume=volume=6dB:precision=fixed
  4098. @end example
  4099. @item
  4100. Fade volume after time 10 with an annihilation period of 5 seconds:
  4101. @example
  4102. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4103. @end example
  4104. @end itemize
  4105. @section volumedetect
  4106. Detect the volume of the input video.
  4107. The filter has no parameters. The input is not modified. Statistics about
  4108. the volume will be printed in the log when the input stream end is reached.
  4109. In particular it will show the mean volume (root mean square), maximum
  4110. volume (on a per-sample basis), and the beginning of a histogram of the
  4111. registered volume values (from the maximum value to a cumulated 1/1000 of
  4112. the samples).
  4113. All volumes are in decibels relative to the maximum PCM value.
  4114. @subsection Examples
  4115. Here is an excerpt of the output:
  4116. @example
  4117. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4118. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4119. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4120. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4121. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4122. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4123. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4124. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4125. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4126. @end example
  4127. It means that:
  4128. @itemize
  4129. @item
  4130. The mean square energy is approximately -27 dB, or 10^-2.7.
  4131. @item
  4132. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4133. @item
  4134. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4135. @end itemize
  4136. In other words, raising the volume by +4 dB does not cause any clipping,
  4137. raising it by +5 dB causes clipping for 6 samples, etc.
  4138. @c man end AUDIO FILTERS
  4139. @chapter Audio Sources
  4140. @c man begin AUDIO SOURCES
  4141. Below is a description of the currently available audio sources.
  4142. @section abuffer
  4143. Buffer audio frames, and make them available to the filter chain.
  4144. This source is mainly intended for a programmatic use, in particular
  4145. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4146. It accepts the following parameters:
  4147. @table @option
  4148. @item time_base
  4149. The timebase which will be used for timestamps of submitted frames. It must be
  4150. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4151. @item sample_rate
  4152. The sample rate of the incoming audio buffers.
  4153. @item sample_fmt
  4154. The sample format of the incoming audio buffers.
  4155. Either a sample format name or its corresponding integer representation from
  4156. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4157. @item channel_layout
  4158. The channel layout of the incoming audio buffers.
  4159. Either a channel layout name from channel_layout_map in
  4160. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4161. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4162. @item channels
  4163. The number of channels of the incoming audio buffers.
  4164. If both @var{channels} and @var{channel_layout} are specified, then they
  4165. must be consistent.
  4166. @end table
  4167. @subsection Examples
  4168. @example
  4169. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4170. @end example
  4171. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4172. Since the sample format with name "s16p" corresponds to the number
  4173. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4174. equivalent to:
  4175. @example
  4176. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4177. @end example
  4178. @section aevalsrc
  4179. Generate an audio signal specified by an expression.
  4180. This source accepts in input one or more expressions (one for each
  4181. channel), which are evaluated and used to generate a corresponding
  4182. audio signal.
  4183. This source accepts the following options:
  4184. @table @option
  4185. @item exprs
  4186. Set the '|'-separated expressions list for each separate channel. In case the
  4187. @option{channel_layout} option is not specified, the selected channel layout
  4188. depends on the number of provided expressions. Otherwise the last
  4189. specified expression is applied to the remaining output channels.
  4190. @item channel_layout, c
  4191. Set the channel layout. The number of channels in the specified layout
  4192. must be equal to the number of specified expressions.
  4193. @item duration, d
  4194. Set the minimum duration of the sourced audio. See
  4195. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4196. for the accepted syntax.
  4197. Note that the resulting duration may be greater than the specified
  4198. duration, as the generated audio is always cut at the end of a
  4199. complete frame.
  4200. If not specified, or the expressed duration is negative, the audio is
  4201. supposed to be generated forever.
  4202. @item nb_samples, n
  4203. Set the number of samples per channel per each output frame,
  4204. default to 1024.
  4205. @item sample_rate, s
  4206. Specify the sample rate, default to 44100.
  4207. @end table
  4208. Each expression in @var{exprs} can contain the following constants:
  4209. @table @option
  4210. @item n
  4211. number of the evaluated sample, starting from 0
  4212. @item t
  4213. time of the evaluated sample expressed in seconds, starting from 0
  4214. @item s
  4215. sample rate
  4216. @end table
  4217. @subsection Examples
  4218. @itemize
  4219. @item
  4220. Generate silence:
  4221. @example
  4222. aevalsrc=0
  4223. @end example
  4224. @item
  4225. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4226. 8000 Hz:
  4227. @example
  4228. aevalsrc="sin(440*2*PI*t):s=8000"
  4229. @end example
  4230. @item
  4231. Generate a two channels signal, specify the channel layout (Front
  4232. Center + Back Center) explicitly:
  4233. @example
  4234. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4235. @end example
  4236. @item
  4237. Generate white noise:
  4238. @example
  4239. aevalsrc="-2+random(0)"
  4240. @end example
  4241. @item
  4242. Generate an amplitude modulated signal:
  4243. @example
  4244. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4245. @end example
  4246. @item
  4247. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4248. @example
  4249. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4250. @end example
  4251. @end itemize
  4252. @section anullsrc
  4253. The null audio source, return unprocessed audio frames. It is mainly useful
  4254. as a template and to be employed in analysis / debugging tools, or as
  4255. the source for filters which ignore the input data (for example the sox
  4256. synth filter).
  4257. This source accepts the following options:
  4258. @table @option
  4259. @item channel_layout, cl
  4260. Specifies the channel layout, and can be either an integer or a string
  4261. representing a channel layout. The default value of @var{channel_layout}
  4262. is "stereo".
  4263. Check the channel_layout_map definition in
  4264. @file{libavutil/channel_layout.c} for the mapping between strings and
  4265. channel layout values.
  4266. @item sample_rate, r
  4267. Specifies the sample rate, and defaults to 44100.
  4268. @item nb_samples, n
  4269. Set the number of samples per requested frames.
  4270. @end table
  4271. @subsection Examples
  4272. @itemize
  4273. @item
  4274. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4275. @example
  4276. anullsrc=r=48000:cl=4
  4277. @end example
  4278. @item
  4279. Do the same operation with a more obvious syntax:
  4280. @example
  4281. anullsrc=r=48000:cl=mono
  4282. @end example
  4283. @end itemize
  4284. All the parameters need to be explicitly defined.
  4285. @section flite
  4286. Synthesize a voice utterance using the libflite library.
  4287. To enable compilation of this filter you need to configure FFmpeg with
  4288. @code{--enable-libflite}.
  4289. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4290. The filter accepts the following options:
  4291. @table @option
  4292. @item list_voices
  4293. If set to 1, list the names of the available voices and exit
  4294. immediately. Default value is 0.
  4295. @item nb_samples, n
  4296. Set the maximum number of samples per frame. Default value is 512.
  4297. @item textfile
  4298. Set the filename containing the text to speak.
  4299. @item text
  4300. Set the text to speak.
  4301. @item voice, v
  4302. Set the voice to use for the speech synthesis. Default value is
  4303. @code{kal}. See also the @var{list_voices} option.
  4304. @end table
  4305. @subsection Examples
  4306. @itemize
  4307. @item
  4308. Read from file @file{speech.txt}, and synthesize the text using the
  4309. standard flite voice:
  4310. @example
  4311. flite=textfile=speech.txt
  4312. @end example
  4313. @item
  4314. Read the specified text selecting the @code{slt} voice:
  4315. @example
  4316. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4317. @end example
  4318. @item
  4319. Input text to ffmpeg:
  4320. @example
  4321. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4322. @end example
  4323. @item
  4324. Make @file{ffplay} speak the specified text, using @code{flite} and
  4325. the @code{lavfi} device:
  4326. @example
  4327. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4328. @end example
  4329. @end itemize
  4330. For more information about libflite, check:
  4331. @url{http://www.festvox.org/flite/}
  4332. @section anoisesrc
  4333. Generate a noise audio signal.
  4334. The filter accepts the following options:
  4335. @table @option
  4336. @item sample_rate, r
  4337. Specify the sample rate. Default value is 48000 Hz.
  4338. @item amplitude, a
  4339. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4340. is 1.0.
  4341. @item duration, d
  4342. Specify the duration of the generated audio stream. Not specifying this option
  4343. results in noise with an infinite length.
  4344. @item color, colour, c
  4345. Specify the color of noise. Available noise colors are white, pink, brown,
  4346. blue and violet. Default color is white.
  4347. @item seed, s
  4348. Specify a value used to seed the PRNG.
  4349. @item nb_samples, n
  4350. Set the number of samples per each output frame, default is 1024.
  4351. @end table
  4352. @subsection Examples
  4353. @itemize
  4354. @item
  4355. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4356. @example
  4357. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4358. @end example
  4359. @end itemize
  4360. @section hilbert
  4361. Generate odd-tap Hilbert transform FIR coefficients.
  4362. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4363. the signal by 90 degrees.
  4364. This is used in many matrix coding schemes and for analytic signal generation.
  4365. The process is often written as a multiplication by i (or j), the imaginary unit.
  4366. The filter accepts the following options:
  4367. @table @option
  4368. @item sample_rate, s
  4369. Set sample rate, default is 44100.
  4370. @item taps, t
  4371. Set length of FIR filter, default is 22051.
  4372. @item nb_samples, n
  4373. Set number of samples per each frame.
  4374. @item win_func, w
  4375. Set window function to be used when generating FIR coefficients.
  4376. @end table
  4377. @section sinc
  4378. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4379. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4380. The filter accepts the following options:
  4381. @table @option
  4382. @item sample_rate, r
  4383. Set sample rate, default is 44100.
  4384. @item nb_samples, n
  4385. Set number of samples per each frame. Default is 1024.
  4386. @item hp
  4387. Set high-pass frequency. Default is 0.
  4388. @item lp
  4389. Set low-pass frequency. Default is 0.
  4390. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4391. is higher than 0 then filter will create band-pass filter coefficients,
  4392. otherwise band-reject filter coefficients.
  4393. @item phase
  4394. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4395. @item beta
  4396. Set Kaiser window beta.
  4397. @item att
  4398. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4399. @item round
  4400. Enable rounding, by default is disabled.
  4401. @item hptaps
  4402. Set number of taps for high-pass filter.
  4403. @item lptaps
  4404. Set number of taps for low-pass filter.
  4405. @end table
  4406. @section sine
  4407. Generate an audio signal made of a sine wave with amplitude 1/8.
  4408. The audio signal is bit-exact.
  4409. The filter accepts the following options:
  4410. @table @option
  4411. @item frequency, f
  4412. Set the carrier frequency. Default is 440 Hz.
  4413. @item beep_factor, b
  4414. Enable a periodic beep every second with frequency @var{beep_factor} times
  4415. the carrier frequency. Default is 0, meaning the beep is disabled.
  4416. @item sample_rate, r
  4417. Specify the sample rate, default is 44100.
  4418. @item duration, d
  4419. Specify the duration of the generated audio stream.
  4420. @item samples_per_frame
  4421. Set the number of samples per output frame.
  4422. The expression can contain the following constants:
  4423. @table @option
  4424. @item n
  4425. The (sequential) number of the output audio frame, starting from 0.
  4426. @item pts
  4427. The PTS (Presentation TimeStamp) of the output audio frame,
  4428. expressed in @var{TB} units.
  4429. @item t
  4430. The PTS of the output audio frame, expressed in seconds.
  4431. @item TB
  4432. The timebase of the output audio frames.
  4433. @end table
  4434. Default is @code{1024}.
  4435. @end table
  4436. @subsection Examples
  4437. @itemize
  4438. @item
  4439. Generate a simple 440 Hz sine wave:
  4440. @example
  4441. sine
  4442. @end example
  4443. @item
  4444. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4445. @example
  4446. sine=220:4:d=5
  4447. sine=f=220:b=4:d=5
  4448. sine=frequency=220:beep_factor=4:duration=5
  4449. @end example
  4450. @item
  4451. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4452. pattern:
  4453. @example
  4454. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4455. @end example
  4456. @end itemize
  4457. @c man end AUDIO SOURCES
  4458. @chapter Audio Sinks
  4459. @c man begin AUDIO SINKS
  4460. Below is a description of the currently available audio sinks.
  4461. @section abuffersink
  4462. Buffer audio frames, and make them available to the end of filter chain.
  4463. This sink is mainly intended for programmatic use, in particular
  4464. through the interface defined in @file{libavfilter/buffersink.h}
  4465. or the options system.
  4466. It accepts a pointer to an AVABufferSinkContext structure, which
  4467. defines the incoming buffers' formats, to be passed as the opaque
  4468. parameter to @code{avfilter_init_filter} for initialization.
  4469. @section anullsink
  4470. Null audio sink; do absolutely nothing with the input audio. It is
  4471. mainly useful as a template and for use in analysis / debugging
  4472. tools.
  4473. @c man end AUDIO SINKS
  4474. @chapter Video Filters
  4475. @c man begin VIDEO FILTERS
  4476. When you configure your FFmpeg build, you can disable any of the
  4477. existing filters using @code{--disable-filters}.
  4478. The configure output will show the video filters included in your
  4479. build.
  4480. Below is a description of the currently available video filters.
  4481. @section alphaextract
  4482. Extract the alpha component from the input as a grayscale video. This
  4483. is especially useful with the @var{alphamerge} filter.
  4484. @section alphamerge
  4485. Add or replace the alpha component of the primary input with the
  4486. grayscale value of a second input. This is intended for use with
  4487. @var{alphaextract} to allow the transmission or storage of frame
  4488. sequences that have alpha in a format that doesn't support an alpha
  4489. channel.
  4490. For example, to reconstruct full frames from a normal YUV-encoded video
  4491. and a separate video created with @var{alphaextract}, you might use:
  4492. @example
  4493. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4494. @end example
  4495. Since this filter is designed for reconstruction, it operates on frame
  4496. sequences without considering timestamps, and terminates when either
  4497. input reaches end of stream. This will cause problems if your encoding
  4498. pipeline drops frames. If you're trying to apply an image as an
  4499. overlay to a video stream, consider the @var{overlay} filter instead.
  4500. @section amplify
  4501. Amplify differences between current pixel and pixels of adjacent frames in
  4502. same pixel location.
  4503. This filter accepts the following options:
  4504. @table @option
  4505. @item radius
  4506. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4507. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4508. @item factor
  4509. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4510. @item threshold
  4511. Set threshold for difference amplification. Any difference greater or equal to
  4512. this value will not alter source pixel. Default is 10.
  4513. Allowed range is from 0 to 65535.
  4514. @item tolerance
  4515. Set tolerance for difference amplification. Any difference lower to
  4516. this value will not alter source pixel. Default is 0.
  4517. Allowed range is from 0 to 65535.
  4518. @item low
  4519. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4520. This option controls maximum possible value that will decrease source pixel value.
  4521. @item high
  4522. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4523. This option controls maximum possible value that will increase source pixel value.
  4524. @item planes
  4525. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4526. @end table
  4527. @section ass
  4528. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4529. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4530. Substation Alpha) subtitles files.
  4531. This filter accepts the following option in addition to the common options from
  4532. the @ref{subtitles} filter:
  4533. @table @option
  4534. @item shaping
  4535. Set the shaping engine
  4536. Available values are:
  4537. @table @samp
  4538. @item auto
  4539. The default libass shaping engine, which is the best available.
  4540. @item simple
  4541. Fast, font-agnostic shaper that can do only substitutions
  4542. @item complex
  4543. Slower shaper using OpenType for substitutions and positioning
  4544. @end table
  4545. The default is @code{auto}.
  4546. @end table
  4547. @section atadenoise
  4548. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4549. The filter accepts the following options:
  4550. @table @option
  4551. @item 0a
  4552. Set threshold A for 1st plane. Default is 0.02.
  4553. Valid range is 0 to 0.3.
  4554. @item 0b
  4555. Set threshold B for 1st plane. Default is 0.04.
  4556. Valid range is 0 to 5.
  4557. @item 1a
  4558. Set threshold A for 2nd plane. Default is 0.02.
  4559. Valid range is 0 to 0.3.
  4560. @item 1b
  4561. Set threshold B for 2nd plane. Default is 0.04.
  4562. Valid range is 0 to 5.
  4563. @item 2a
  4564. Set threshold A for 3rd plane. Default is 0.02.
  4565. Valid range is 0 to 0.3.
  4566. @item 2b
  4567. Set threshold B for 3rd plane. Default is 0.04.
  4568. Valid range is 0 to 5.
  4569. Threshold A is designed to react on abrupt changes in the input signal and
  4570. threshold B is designed to react on continuous changes in the input signal.
  4571. @item s
  4572. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4573. number in range [5, 129].
  4574. @item p
  4575. Set what planes of frame filter will use for averaging. Default is all.
  4576. @end table
  4577. @section avgblur
  4578. Apply average blur filter.
  4579. The filter accepts the following options:
  4580. @table @option
  4581. @item sizeX
  4582. Set horizontal radius size.
  4583. @item planes
  4584. Set which planes to filter. By default all planes are filtered.
  4585. @item sizeY
  4586. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4587. Default is @code{0}.
  4588. @end table
  4589. @section bbox
  4590. Compute the bounding box for the non-black pixels in the input frame
  4591. luminance plane.
  4592. This filter computes the bounding box containing all the pixels with a
  4593. luminance value greater than the minimum allowed value.
  4594. The parameters describing the bounding box are printed on the filter
  4595. log.
  4596. The filter accepts the following option:
  4597. @table @option
  4598. @item min_val
  4599. Set the minimal luminance value. Default is @code{16}.
  4600. @end table
  4601. @section bitplanenoise
  4602. Show and measure bit plane noise.
  4603. The filter accepts the following options:
  4604. @table @option
  4605. @item bitplane
  4606. Set which plane to analyze. Default is @code{1}.
  4607. @item filter
  4608. Filter out noisy pixels from @code{bitplane} set above.
  4609. Default is disabled.
  4610. @end table
  4611. @section blackdetect
  4612. Detect video intervals that are (almost) completely black. Can be
  4613. useful to detect chapter transitions, commercials, or invalid
  4614. recordings. Output lines contains the time for the start, end and
  4615. duration of the detected black interval expressed in seconds.
  4616. In order to display the output lines, you need to set the loglevel at
  4617. least to the AV_LOG_INFO value.
  4618. The filter accepts the following options:
  4619. @table @option
  4620. @item black_min_duration, d
  4621. Set the minimum detected black duration expressed in seconds. It must
  4622. be a non-negative floating point number.
  4623. Default value is 2.0.
  4624. @item picture_black_ratio_th, pic_th
  4625. Set the threshold for considering a picture "black".
  4626. Express the minimum value for the ratio:
  4627. @example
  4628. @var{nb_black_pixels} / @var{nb_pixels}
  4629. @end example
  4630. for which a picture is considered black.
  4631. Default value is 0.98.
  4632. @item pixel_black_th, pix_th
  4633. Set the threshold for considering a pixel "black".
  4634. The threshold expresses the maximum pixel luminance value for which a
  4635. pixel is considered "black". The provided value is scaled according to
  4636. the following equation:
  4637. @example
  4638. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4639. @end example
  4640. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4641. the input video format, the range is [0-255] for YUV full-range
  4642. formats and [16-235] for YUV non full-range formats.
  4643. Default value is 0.10.
  4644. @end table
  4645. The following example sets the maximum pixel threshold to the minimum
  4646. value, and detects only black intervals of 2 or more seconds:
  4647. @example
  4648. blackdetect=d=2:pix_th=0.00
  4649. @end example
  4650. @section blackframe
  4651. Detect frames that are (almost) completely black. Can be useful to
  4652. detect chapter transitions or commercials. Output lines consist of
  4653. the frame number of the detected frame, the percentage of blackness,
  4654. the position in the file if known or -1 and the timestamp in seconds.
  4655. In order to display the output lines, you need to set the loglevel at
  4656. least to the AV_LOG_INFO value.
  4657. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4658. The value represents the percentage of pixels in the picture that
  4659. are below the threshold value.
  4660. It accepts the following parameters:
  4661. @table @option
  4662. @item amount
  4663. The percentage of the pixels that have to be below the threshold; it defaults to
  4664. @code{98}.
  4665. @item threshold, thresh
  4666. The threshold below which a pixel value is considered black; it defaults to
  4667. @code{32}.
  4668. @end table
  4669. @section blend, tblend
  4670. Blend two video frames into each other.
  4671. The @code{blend} filter takes two input streams and outputs one
  4672. stream, the first input is the "top" layer and second input is
  4673. "bottom" layer. By default, the output terminates when the longest input terminates.
  4674. The @code{tblend} (time blend) filter takes two consecutive frames
  4675. from one single stream, and outputs the result obtained by blending
  4676. the new frame on top of the old frame.
  4677. A description of the accepted options follows.
  4678. @table @option
  4679. @item c0_mode
  4680. @item c1_mode
  4681. @item c2_mode
  4682. @item c3_mode
  4683. @item all_mode
  4684. Set blend mode for specific pixel component or all pixel components in case
  4685. of @var{all_mode}. Default value is @code{normal}.
  4686. Available values for component modes are:
  4687. @table @samp
  4688. @item addition
  4689. @item grainmerge
  4690. @item and
  4691. @item average
  4692. @item burn
  4693. @item darken
  4694. @item difference
  4695. @item grainextract
  4696. @item divide
  4697. @item dodge
  4698. @item freeze
  4699. @item exclusion
  4700. @item extremity
  4701. @item glow
  4702. @item hardlight
  4703. @item hardmix
  4704. @item heat
  4705. @item lighten
  4706. @item linearlight
  4707. @item multiply
  4708. @item multiply128
  4709. @item negation
  4710. @item normal
  4711. @item or
  4712. @item overlay
  4713. @item phoenix
  4714. @item pinlight
  4715. @item reflect
  4716. @item screen
  4717. @item softlight
  4718. @item subtract
  4719. @item vividlight
  4720. @item xor
  4721. @end table
  4722. @item c0_opacity
  4723. @item c1_opacity
  4724. @item c2_opacity
  4725. @item c3_opacity
  4726. @item all_opacity
  4727. Set blend opacity for specific pixel component or all pixel components in case
  4728. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4729. @item c0_expr
  4730. @item c1_expr
  4731. @item c2_expr
  4732. @item c3_expr
  4733. @item all_expr
  4734. Set blend expression for specific pixel component or all pixel components in case
  4735. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4736. The expressions can use the following variables:
  4737. @table @option
  4738. @item N
  4739. The sequential number of the filtered frame, starting from @code{0}.
  4740. @item X
  4741. @item Y
  4742. the coordinates of the current sample
  4743. @item W
  4744. @item H
  4745. the width and height of currently filtered plane
  4746. @item SW
  4747. @item SH
  4748. Width and height scale for the plane being filtered. It is the
  4749. ratio between the dimensions of the current plane to the luma plane,
  4750. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4751. the luma plane and @code{0.5,0.5} for the chroma planes.
  4752. @item T
  4753. Time of the current frame, expressed in seconds.
  4754. @item TOP, A
  4755. Value of pixel component at current location for first video frame (top layer).
  4756. @item BOTTOM, B
  4757. Value of pixel component at current location for second video frame (bottom layer).
  4758. @end table
  4759. @end table
  4760. The @code{blend} filter also supports the @ref{framesync} options.
  4761. @subsection Examples
  4762. @itemize
  4763. @item
  4764. Apply transition from bottom layer to top layer in first 10 seconds:
  4765. @example
  4766. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4767. @end example
  4768. @item
  4769. Apply linear horizontal transition from top layer to bottom layer:
  4770. @example
  4771. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4772. @end example
  4773. @item
  4774. Apply 1x1 checkerboard effect:
  4775. @example
  4776. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4777. @end example
  4778. @item
  4779. Apply uncover left effect:
  4780. @example
  4781. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4782. @end example
  4783. @item
  4784. Apply uncover down effect:
  4785. @example
  4786. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4787. @end example
  4788. @item
  4789. Apply uncover up-left effect:
  4790. @example
  4791. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4792. @end example
  4793. @item
  4794. Split diagonally video and shows top and bottom layer on each side:
  4795. @example
  4796. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4797. @end example
  4798. @item
  4799. Display differences between the current and the previous frame:
  4800. @example
  4801. tblend=all_mode=grainextract
  4802. @end example
  4803. @end itemize
  4804. @section bm3d
  4805. Denoise frames using Block-Matching 3D algorithm.
  4806. The filter accepts the following options.
  4807. @table @option
  4808. @item sigma
  4809. Set denoising strength. Default value is 1.
  4810. Allowed range is from 0 to 999.9.
  4811. The denoising algorithm is very sensitive to sigma, so adjust it
  4812. according to the source.
  4813. @item block
  4814. Set local patch size. This sets dimensions in 2D.
  4815. @item bstep
  4816. Set sliding step for processing blocks. Default value is 4.
  4817. Allowed range is from 1 to 64.
  4818. Smaller values allows processing more reference blocks and is slower.
  4819. @item group
  4820. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4821. When set to 1, no block matching is done. Larger values allows more blocks
  4822. in single group.
  4823. Allowed range is from 1 to 256.
  4824. @item range
  4825. Set radius for search block matching. Default is 9.
  4826. Allowed range is from 1 to INT32_MAX.
  4827. @item mstep
  4828. Set step between two search locations for block matching. Default is 1.
  4829. Allowed range is from 1 to 64. Smaller is slower.
  4830. @item thmse
  4831. Set threshold of mean square error for block matching. Valid range is 0 to
  4832. INT32_MAX.
  4833. @item hdthr
  4834. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4835. Larger values results in stronger hard-thresholding filtering in frequency
  4836. domain.
  4837. @item estim
  4838. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4839. Default is @code{basic}.
  4840. @item ref
  4841. If enabled, filter will use 2nd stream for block matching.
  4842. Default is disabled for @code{basic} value of @var{estim} option,
  4843. and always enabled if value of @var{estim} is @code{final}.
  4844. @item planes
  4845. Set planes to filter. Default is all available except alpha.
  4846. @end table
  4847. @subsection Examples
  4848. @itemize
  4849. @item
  4850. Basic filtering with bm3d:
  4851. @example
  4852. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4853. @end example
  4854. @item
  4855. Same as above, but filtering only luma:
  4856. @example
  4857. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4858. @end example
  4859. @item
  4860. Same as above, but with both estimation modes:
  4861. @example
  4862. 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
  4863. @end example
  4864. @item
  4865. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4866. @example
  4867. 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
  4868. @end example
  4869. @end itemize
  4870. @section boxblur
  4871. Apply a boxblur algorithm to the input video.
  4872. It accepts the following parameters:
  4873. @table @option
  4874. @item luma_radius, lr
  4875. @item luma_power, lp
  4876. @item chroma_radius, cr
  4877. @item chroma_power, cp
  4878. @item alpha_radius, ar
  4879. @item alpha_power, ap
  4880. @end table
  4881. A description of the accepted options follows.
  4882. @table @option
  4883. @item luma_radius, lr
  4884. @item chroma_radius, cr
  4885. @item alpha_radius, ar
  4886. Set an expression for the box radius in pixels used for blurring the
  4887. corresponding input plane.
  4888. The radius value must be a non-negative number, and must not be
  4889. greater than the value of the expression @code{min(w,h)/2} for the
  4890. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4891. planes.
  4892. Default value for @option{luma_radius} is "2". If not specified,
  4893. @option{chroma_radius} and @option{alpha_radius} default to the
  4894. corresponding value set for @option{luma_radius}.
  4895. The expressions can contain the following constants:
  4896. @table @option
  4897. @item w
  4898. @item h
  4899. The input width and height in pixels.
  4900. @item cw
  4901. @item ch
  4902. The input chroma image width and height in pixels.
  4903. @item hsub
  4904. @item vsub
  4905. The horizontal and vertical chroma subsample values. For example, for the
  4906. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4907. @end table
  4908. @item luma_power, lp
  4909. @item chroma_power, cp
  4910. @item alpha_power, ap
  4911. Specify how many times the boxblur filter is applied to the
  4912. corresponding plane.
  4913. Default value for @option{luma_power} is 2. If not specified,
  4914. @option{chroma_power} and @option{alpha_power} default to the
  4915. corresponding value set for @option{luma_power}.
  4916. A value of 0 will disable the effect.
  4917. @end table
  4918. @subsection Examples
  4919. @itemize
  4920. @item
  4921. Apply a boxblur filter with the luma, chroma, and alpha radii
  4922. set to 2:
  4923. @example
  4924. boxblur=luma_radius=2:luma_power=1
  4925. boxblur=2:1
  4926. @end example
  4927. @item
  4928. Set the luma radius to 2, and alpha and chroma radius to 0:
  4929. @example
  4930. boxblur=2:1:cr=0:ar=0
  4931. @end example
  4932. @item
  4933. Set the luma and chroma radii to a fraction of the video dimension:
  4934. @example
  4935. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4936. @end example
  4937. @end itemize
  4938. @section bwdif
  4939. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4940. Deinterlacing Filter").
  4941. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4942. interpolation algorithms.
  4943. It accepts the following parameters:
  4944. @table @option
  4945. @item mode
  4946. The interlacing mode to adopt. It accepts one of the following values:
  4947. @table @option
  4948. @item 0, send_frame
  4949. Output one frame for each frame.
  4950. @item 1, send_field
  4951. Output one frame for each field.
  4952. @end table
  4953. The default value is @code{send_field}.
  4954. @item parity
  4955. The picture field parity assumed for the input interlaced video. It accepts one
  4956. of the following values:
  4957. @table @option
  4958. @item 0, tff
  4959. Assume the top field is first.
  4960. @item 1, bff
  4961. Assume the bottom field is first.
  4962. @item -1, auto
  4963. Enable automatic detection of field parity.
  4964. @end table
  4965. The default value is @code{auto}.
  4966. If the interlacing is unknown or the decoder does not export this information,
  4967. top field first will be assumed.
  4968. @item deint
  4969. Specify which frames to deinterlace. Accept one of the following
  4970. values:
  4971. @table @option
  4972. @item 0, all
  4973. Deinterlace all frames.
  4974. @item 1, interlaced
  4975. Only deinterlace frames marked as interlaced.
  4976. @end table
  4977. The default value is @code{all}.
  4978. @end table
  4979. @section chromahold
  4980. Remove all color information for all colors except for certain one.
  4981. The filter accepts the following options:
  4982. @table @option
  4983. @item color
  4984. The color which will not be replaced with neutral chroma.
  4985. @item similarity
  4986. Similarity percentage with the above color.
  4987. 0.01 matches only the exact key color, while 1.0 matches everything.
  4988. @item yuv
  4989. Signals that the color passed is already in YUV instead of RGB.
  4990. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4991. This can be used to pass exact YUV values as hexadecimal numbers.
  4992. @end table
  4993. @section chromakey
  4994. YUV colorspace color/chroma keying.
  4995. The filter accepts the following options:
  4996. @table @option
  4997. @item color
  4998. The color which will be replaced with transparency.
  4999. @item similarity
  5000. Similarity percentage with the key color.
  5001. 0.01 matches only the exact key color, while 1.0 matches everything.
  5002. @item blend
  5003. Blend percentage.
  5004. 0.0 makes pixels either fully transparent, or not transparent at all.
  5005. Higher values result in semi-transparent pixels, with a higher transparency
  5006. the more similar the pixels color is to the key color.
  5007. @item yuv
  5008. Signals that the color passed is already in YUV instead of RGB.
  5009. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5010. This can be used to pass exact YUV values as hexadecimal numbers.
  5011. @end table
  5012. @subsection Examples
  5013. @itemize
  5014. @item
  5015. Make every green pixel in the input image transparent:
  5016. @example
  5017. ffmpeg -i input.png -vf chromakey=green out.png
  5018. @end example
  5019. @item
  5020. Overlay a greenscreen-video on top of a static black background.
  5021. @example
  5022. 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
  5023. @end example
  5024. @end itemize
  5025. @section chromashift
  5026. Shift chroma pixels horizontally and/or vertically.
  5027. The filter accepts the following options:
  5028. @table @option
  5029. @item cbh
  5030. Set amount to shift chroma-blue horizontally.
  5031. @item cbv
  5032. Set amount to shift chroma-blue vertically.
  5033. @item crh
  5034. Set amount to shift chroma-red horizontally.
  5035. @item crv
  5036. Set amount to shift chroma-red vertically.
  5037. @item edge
  5038. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5039. @end table
  5040. @section ciescope
  5041. Display CIE color diagram with pixels overlaid onto it.
  5042. The filter accepts the following options:
  5043. @table @option
  5044. @item system
  5045. Set color system.
  5046. @table @samp
  5047. @item ntsc, 470m
  5048. @item ebu, 470bg
  5049. @item smpte
  5050. @item 240m
  5051. @item apple
  5052. @item widergb
  5053. @item cie1931
  5054. @item rec709, hdtv
  5055. @item uhdtv, rec2020
  5056. @end table
  5057. @item cie
  5058. Set CIE system.
  5059. @table @samp
  5060. @item xyy
  5061. @item ucs
  5062. @item luv
  5063. @end table
  5064. @item gamuts
  5065. Set what gamuts to draw.
  5066. See @code{system} option for available values.
  5067. @item size, s
  5068. Set ciescope size, by default set to 512.
  5069. @item intensity, i
  5070. Set intensity used to map input pixel values to CIE diagram.
  5071. @item contrast
  5072. Set contrast used to draw tongue colors that are out of active color system gamut.
  5073. @item corrgamma
  5074. Correct gamma displayed on scope, by default enabled.
  5075. @item showwhite
  5076. Show white point on CIE diagram, by default disabled.
  5077. @item gamma
  5078. Set input gamma. Used only with XYZ input color space.
  5079. @end table
  5080. @section codecview
  5081. Visualize information exported by some codecs.
  5082. Some codecs can export information through frames using side-data or other
  5083. means. For example, some MPEG based codecs export motion vectors through the
  5084. @var{export_mvs} flag in the codec @option{flags2} option.
  5085. The filter accepts the following option:
  5086. @table @option
  5087. @item mv
  5088. Set motion vectors to visualize.
  5089. Available flags for @var{mv} are:
  5090. @table @samp
  5091. @item pf
  5092. forward predicted MVs of P-frames
  5093. @item bf
  5094. forward predicted MVs of B-frames
  5095. @item bb
  5096. backward predicted MVs of B-frames
  5097. @end table
  5098. @item qp
  5099. Display quantization parameters using the chroma planes.
  5100. @item mv_type, mvt
  5101. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5102. Available flags for @var{mv_type} are:
  5103. @table @samp
  5104. @item fp
  5105. forward predicted MVs
  5106. @item bp
  5107. backward predicted MVs
  5108. @end table
  5109. @item frame_type, ft
  5110. Set frame type to visualize motion vectors of.
  5111. Available flags for @var{frame_type} are:
  5112. @table @samp
  5113. @item if
  5114. intra-coded frames (I-frames)
  5115. @item pf
  5116. predicted frames (P-frames)
  5117. @item bf
  5118. bi-directionally predicted frames (B-frames)
  5119. @end table
  5120. @end table
  5121. @subsection Examples
  5122. @itemize
  5123. @item
  5124. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5125. @example
  5126. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5127. @end example
  5128. @item
  5129. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5130. @example
  5131. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5132. @end example
  5133. @end itemize
  5134. @section colorbalance
  5135. Modify intensity of primary colors (red, green and blue) of input frames.
  5136. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5137. regions for the red-cyan, green-magenta or blue-yellow balance.
  5138. A positive adjustment value shifts the balance towards the primary color, a negative
  5139. value towards the complementary color.
  5140. The filter accepts the following options:
  5141. @table @option
  5142. @item rs
  5143. @item gs
  5144. @item bs
  5145. Adjust red, green and blue shadows (darkest pixels).
  5146. @item rm
  5147. @item gm
  5148. @item bm
  5149. Adjust red, green and blue midtones (medium pixels).
  5150. @item rh
  5151. @item gh
  5152. @item bh
  5153. Adjust red, green and blue highlights (brightest pixels).
  5154. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5155. @end table
  5156. @subsection Examples
  5157. @itemize
  5158. @item
  5159. Add red color cast to shadows:
  5160. @example
  5161. colorbalance=rs=.3
  5162. @end example
  5163. @end itemize
  5164. @section colorkey
  5165. RGB colorspace color keying.
  5166. The filter accepts the following options:
  5167. @table @option
  5168. @item color
  5169. The color which will be replaced with transparency.
  5170. @item similarity
  5171. Similarity percentage with the key color.
  5172. 0.01 matches only the exact key color, while 1.0 matches everything.
  5173. @item blend
  5174. Blend percentage.
  5175. 0.0 makes pixels either fully transparent, or not transparent at all.
  5176. Higher values result in semi-transparent pixels, with a higher transparency
  5177. the more similar the pixels color is to the key color.
  5178. @end table
  5179. @subsection Examples
  5180. @itemize
  5181. @item
  5182. Make every green pixel in the input image transparent:
  5183. @example
  5184. ffmpeg -i input.png -vf colorkey=green out.png
  5185. @end example
  5186. @item
  5187. Overlay a greenscreen-video on top of a static background image.
  5188. @example
  5189. 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
  5190. @end example
  5191. @end itemize
  5192. @section colorlevels
  5193. Adjust video input frames using levels.
  5194. The filter accepts the following options:
  5195. @table @option
  5196. @item rimin
  5197. @item gimin
  5198. @item bimin
  5199. @item aimin
  5200. Adjust red, green, blue and alpha input black point.
  5201. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5202. @item rimax
  5203. @item gimax
  5204. @item bimax
  5205. @item aimax
  5206. Adjust red, green, blue and alpha input white point.
  5207. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5208. Input levels are used to lighten highlights (bright tones), darken shadows
  5209. (dark tones), change the balance of bright and dark tones.
  5210. @item romin
  5211. @item gomin
  5212. @item bomin
  5213. @item aomin
  5214. Adjust red, green, blue and alpha output black point.
  5215. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5216. @item romax
  5217. @item gomax
  5218. @item bomax
  5219. @item aomax
  5220. Adjust red, green, blue and alpha output white point.
  5221. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5222. Output levels allows manual selection of a constrained output level range.
  5223. @end table
  5224. @subsection Examples
  5225. @itemize
  5226. @item
  5227. Make video output darker:
  5228. @example
  5229. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5230. @end example
  5231. @item
  5232. Increase contrast:
  5233. @example
  5234. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5235. @end example
  5236. @item
  5237. Make video output lighter:
  5238. @example
  5239. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5240. @end example
  5241. @item
  5242. Increase brightness:
  5243. @example
  5244. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5245. @end example
  5246. @end itemize
  5247. @section colorchannelmixer
  5248. Adjust video input frames by re-mixing color channels.
  5249. This filter modifies a color channel by adding the values associated to
  5250. the other channels of the same pixels. For example if the value to
  5251. modify is red, the output value will be:
  5252. @example
  5253. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5254. @end example
  5255. The filter accepts the following options:
  5256. @table @option
  5257. @item rr
  5258. @item rg
  5259. @item rb
  5260. @item ra
  5261. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5262. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5263. @item gr
  5264. @item gg
  5265. @item gb
  5266. @item ga
  5267. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5268. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5269. @item br
  5270. @item bg
  5271. @item bb
  5272. @item ba
  5273. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5274. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5275. @item ar
  5276. @item ag
  5277. @item ab
  5278. @item aa
  5279. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5280. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5281. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5282. @end table
  5283. @subsection Examples
  5284. @itemize
  5285. @item
  5286. Convert source to grayscale:
  5287. @example
  5288. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5289. @end example
  5290. @item
  5291. Simulate sepia tones:
  5292. @example
  5293. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5294. @end example
  5295. @end itemize
  5296. @section colormatrix
  5297. Convert color matrix.
  5298. The filter accepts the following options:
  5299. @table @option
  5300. @item src
  5301. @item dst
  5302. Specify the source and destination color matrix. Both values must be
  5303. specified.
  5304. The accepted values are:
  5305. @table @samp
  5306. @item bt709
  5307. BT.709
  5308. @item fcc
  5309. FCC
  5310. @item bt601
  5311. BT.601
  5312. @item bt470
  5313. BT.470
  5314. @item bt470bg
  5315. BT.470BG
  5316. @item smpte170m
  5317. SMPTE-170M
  5318. @item smpte240m
  5319. SMPTE-240M
  5320. @item bt2020
  5321. BT.2020
  5322. @end table
  5323. @end table
  5324. For example to convert from BT.601 to SMPTE-240M, use the command:
  5325. @example
  5326. colormatrix=bt601:smpte240m
  5327. @end example
  5328. @section colorspace
  5329. Convert colorspace, transfer characteristics or color primaries.
  5330. Input video needs to have an even size.
  5331. The filter accepts the following options:
  5332. @table @option
  5333. @anchor{all}
  5334. @item all
  5335. Specify all color properties at once.
  5336. The accepted values are:
  5337. @table @samp
  5338. @item bt470m
  5339. BT.470M
  5340. @item bt470bg
  5341. BT.470BG
  5342. @item bt601-6-525
  5343. BT.601-6 525
  5344. @item bt601-6-625
  5345. BT.601-6 625
  5346. @item bt709
  5347. BT.709
  5348. @item smpte170m
  5349. SMPTE-170M
  5350. @item smpte240m
  5351. SMPTE-240M
  5352. @item bt2020
  5353. BT.2020
  5354. @end table
  5355. @anchor{space}
  5356. @item space
  5357. Specify output colorspace.
  5358. The accepted values are:
  5359. @table @samp
  5360. @item bt709
  5361. BT.709
  5362. @item fcc
  5363. FCC
  5364. @item bt470bg
  5365. BT.470BG or BT.601-6 625
  5366. @item smpte170m
  5367. SMPTE-170M or BT.601-6 525
  5368. @item smpte240m
  5369. SMPTE-240M
  5370. @item ycgco
  5371. YCgCo
  5372. @item bt2020ncl
  5373. BT.2020 with non-constant luminance
  5374. @end table
  5375. @anchor{trc}
  5376. @item trc
  5377. Specify output transfer characteristics.
  5378. The accepted values are:
  5379. @table @samp
  5380. @item bt709
  5381. BT.709
  5382. @item bt470m
  5383. BT.470M
  5384. @item bt470bg
  5385. BT.470BG
  5386. @item gamma22
  5387. Constant gamma of 2.2
  5388. @item gamma28
  5389. Constant gamma of 2.8
  5390. @item smpte170m
  5391. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5392. @item smpte240m
  5393. SMPTE-240M
  5394. @item srgb
  5395. SRGB
  5396. @item iec61966-2-1
  5397. iec61966-2-1
  5398. @item iec61966-2-4
  5399. iec61966-2-4
  5400. @item xvycc
  5401. xvycc
  5402. @item bt2020-10
  5403. BT.2020 for 10-bits content
  5404. @item bt2020-12
  5405. BT.2020 for 12-bits content
  5406. @end table
  5407. @anchor{primaries}
  5408. @item primaries
  5409. Specify output color primaries.
  5410. The accepted values are:
  5411. @table @samp
  5412. @item bt709
  5413. BT.709
  5414. @item bt470m
  5415. BT.470M
  5416. @item bt470bg
  5417. BT.470BG or BT.601-6 625
  5418. @item smpte170m
  5419. SMPTE-170M or BT.601-6 525
  5420. @item smpte240m
  5421. SMPTE-240M
  5422. @item film
  5423. film
  5424. @item smpte431
  5425. SMPTE-431
  5426. @item smpte432
  5427. SMPTE-432
  5428. @item bt2020
  5429. BT.2020
  5430. @item jedec-p22
  5431. JEDEC P22 phosphors
  5432. @end table
  5433. @anchor{range}
  5434. @item range
  5435. Specify output color range.
  5436. The accepted values are:
  5437. @table @samp
  5438. @item tv
  5439. TV (restricted) range
  5440. @item mpeg
  5441. MPEG (restricted) range
  5442. @item pc
  5443. PC (full) range
  5444. @item jpeg
  5445. JPEG (full) range
  5446. @end table
  5447. @item format
  5448. Specify output color format.
  5449. The accepted values are:
  5450. @table @samp
  5451. @item yuv420p
  5452. YUV 4:2:0 planar 8-bits
  5453. @item yuv420p10
  5454. YUV 4:2:0 planar 10-bits
  5455. @item yuv420p12
  5456. YUV 4:2:0 planar 12-bits
  5457. @item yuv422p
  5458. YUV 4:2:2 planar 8-bits
  5459. @item yuv422p10
  5460. YUV 4:2:2 planar 10-bits
  5461. @item yuv422p12
  5462. YUV 4:2:2 planar 12-bits
  5463. @item yuv444p
  5464. YUV 4:4:4 planar 8-bits
  5465. @item yuv444p10
  5466. YUV 4:4:4 planar 10-bits
  5467. @item yuv444p12
  5468. YUV 4:4:4 planar 12-bits
  5469. @end table
  5470. @item fast
  5471. Do a fast conversion, which skips gamma/primary correction. This will take
  5472. significantly less CPU, but will be mathematically incorrect. To get output
  5473. compatible with that produced by the colormatrix filter, use fast=1.
  5474. @item dither
  5475. Specify dithering mode.
  5476. The accepted values are:
  5477. @table @samp
  5478. @item none
  5479. No dithering
  5480. @item fsb
  5481. Floyd-Steinberg dithering
  5482. @end table
  5483. @item wpadapt
  5484. Whitepoint adaptation mode.
  5485. The accepted values are:
  5486. @table @samp
  5487. @item bradford
  5488. Bradford whitepoint adaptation
  5489. @item vonkries
  5490. von Kries whitepoint adaptation
  5491. @item identity
  5492. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5493. @end table
  5494. @item iall
  5495. Override all input properties at once. Same accepted values as @ref{all}.
  5496. @item ispace
  5497. Override input colorspace. Same accepted values as @ref{space}.
  5498. @item iprimaries
  5499. Override input color primaries. Same accepted values as @ref{primaries}.
  5500. @item itrc
  5501. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5502. @item irange
  5503. Override input color range. Same accepted values as @ref{range}.
  5504. @end table
  5505. The filter converts the transfer characteristics, color space and color
  5506. primaries to the specified user values. The output value, if not specified,
  5507. is set to a default value based on the "all" property. If that property is
  5508. also not specified, the filter will log an error. The output color range and
  5509. format default to the same value as the input color range and format. The
  5510. input transfer characteristics, color space, color primaries and color range
  5511. should be set on the input data. If any of these are missing, the filter will
  5512. log an error and no conversion will take place.
  5513. For example to convert the input to SMPTE-240M, use the command:
  5514. @example
  5515. colorspace=smpte240m
  5516. @end example
  5517. @section convolution
  5518. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5519. The filter accepts the following options:
  5520. @table @option
  5521. @item 0m
  5522. @item 1m
  5523. @item 2m
  5524. @item 3m
  5525. Set matrix for each plane.
  5526. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5527. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5528. @item 0rdiv
  5529. @item 1rdiv
  5530. @item 2rdiv
  5531. @item 3rdiv
  5532. Set multiplier for calculated value for each plane.
  5533. If unset or 0, it will be sum of all matrix elements.
  5534. @item 0bias
  5535. @item 1bias
  5536. @item 2bias
  5537. @item 3bias
  5538. Set bias for each plane. This value is added to the result of the multiplication.
  5539. Useful for making the overall image brighter or darker. Default is 0.0.
  5540. @item 0mode
  5541. @item 1mode
  5542. @item 2mode
  5543. @item 3mode
  5544. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5545. Default is @var{square}.
  5546. @end table
  5547. @subsection Examples
  5548. @itemize
  5549. @item
  5550. Apply sharpen:
  5551. @example
  5552. 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"
  5553. @end example
  5554. @item
  5555. Apply blur:
  5556. @example
  5557. 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"
  5558. @end example
  5559. @item
  5560. Apply edge enhance:
  5561. @example
  5562. 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"
  5563. @end example
  5564. @item
  5565. Apply edge detect:
  5566. @example
  5567. 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"
  5568. @end example
  5569. @item
  5570. Apply laplacian edge detector which includes diagonals:
  5571. @example
  5572. 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"
  5573. @end example
  5574. @item
  5575. Apply emboss:
  5576. @example
  5577. 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"
  5578. @end example
  5579. @end itemize
  5580. @section convolve
  5581. Apply 2D convolution of video stream in frequency domain using second stream
  5582. as impulse.
  5583. The filter accepts the following options:
  5584. @table @option
  5585. @item planes
  5586. Set which planes to process.
  5587. @item impulse
  5588. Set which impulse video frames will be processed, can be @var{first}
  5589. or @var{all}. Default is @var{all}.
  5590. @end table
  5591. The @code{convolve} filter also supports the @ref{framesync} options.
  5592. @section copy
  5593. Copy the input video source unchanged to the output. This is mainly useful for
  5594. testing purposes.
  5595. @anchor{coreimage}
  5596. @section coreimage
  5597. Video filtering on GPU using Apple's CoreImage API on OSX.
  5598. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5599. processed by video hardware. However, software-based OpenGL implementations
  5600. exist which means there is no guarantee for hardware processing. It depends on
  5601. the respective OSX.
  5602. There are many filters and image generators provided by Apple that come with a
  5603. large variety of options. The filter has to be referenced by its name along
  5604. with its options.
  5605. The coreimage filter accepts the following options:
  5606. @table @option
  5607. @item list_filters
  5608. List all available filters and generators along with all their respective
  5609. options as well as possible minimum and maximum values along with the default
  5610. values.
  5611. @example
  5612. list_filters=true
  5613. @end example
  5614. @item filter
  5615. Specify all filters by their respective name and options.
  5616. Use @var{list_filters} to determine all valid filter names and options.
  5617. Numerical options are specified by a float value and are automatically clamped
  5618. to their respective value range. Vector and color options have to be specified
  5619. by a list of space separated float values. Character escaping has to be done.
  5620. A special option name @code{default} is available to use default options for a
  5621. filter.
  5622. It is required to specify either @code{default} or at least one of the filter options.
  5623. All omitted options are used with their default values.
  5624. The syntax of the filter string is as follows:
  5625. @example
  5626. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5627. @end example
  5628. @item output_rect
  5629. Specify a rectangle where the output of the filter chain is copied into the
  5630. input image. It is given by a list of space separated float values:
  5631. @example
  5632. output_rect=x\ y\ width\ height
  5633. @end example
  5634. If not given, the output rectangle equals the dimensions of the input image.
  5635. The output rectangle is automatically cropped at the borders of the input
  5636. image. Negative values are valid for each component.
  5637. @example
  5638. output_rect=25\ 25\ 100\ 100
  5639. @end example
  5640. @end table
  5641. Several filters can be chained for successive processing without GPU-HOST
  5642. transfers allowing for fast processing of complex filter chains.
  5643. Currently, only filters with zero (generators) or exactly one (filters) input
  5644. image and one output image are supported. Also, transition filters are not yet
  5645. usable as intended.
  5646. Some filters generate output images with additional padding depending on the
  5647. respective filter kernel. The padding is automatically removed to ensure the
  5648. filter output has the same size as the input image.
  5649. For image generators, the size of the output image is determined by the
  5650. previous output image of the filter chain or the input image of the whole
  5651. filterchain, respectively. The generators do not use the pixel information of
  5652. this image to generate their output. However, the generated output is
  5653. blended onto this image, resulting in partial or complete coverage of the
  5654. output image.
  5655. The @ref{coreimagesrc} video source can be used for generating input images
  5656. which are directly fed into the filter chain. By using it, providing input
  5657. images by another video source or an input video is not required.
  5658. @subsection Examples
  5659. @itemize
  5660. @item
  5661. List all filters available:
  5662. @example
  5663. coreimage=list_filters=true
  5664. @end example
  5665. @item
  5666. Use the CIBoxBlur filter with default options to blur an image:
  5667. @example
  5668. coreimage=filter=CIBoxBlur@@default
  5669. @end example
  5670. @item
  5671. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5672. its center at 100x100 and a radius of 50 pixels:
  5673. @example
  5674. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5675. @end example
  5676. @item
  5677. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5678. given as complete and escaped command-line for Apple's standard bash shell:
  5679. @example
  5680. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5681. @end example
  5682. @end itemize
  5683. @section crop
  5684. Crop the input video to given dimensions.
  5685. It accepts the following parameters:
  5686. @table @option
  5687. @item w, out_w
  5688. The width of the output video. It defaults to @code{iw}.
  5689. This expression is evaluated only once during the filter
  5690. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5691. @item h, out_h
  5692. The height of the output video. It defaults to @code{ih}.
  5693. This expression is evaluated only once during the filter
  5694. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5695. @item x
  5696. The horizontal position, in the input video, of the left edge of the output
  5697. video. It defaults to @code{(in_w-out_w)/2}.
  5698. This expression is evaluated per-frame.
  5699. @item y
  5700. The vertical position, in the input video, of the top edge of the output video.
  5701. It defaults to @code{(in_h-out_h)/2}.
  5702. This expression is evaluated per-frame.
  5703. @item keep_aspect
  5704. If set to 1 will force the output display aspect ratio
  5705. to be the same of the input, by changing the output sample aspect
  5706. ratio. It defaults to 0.
  5707. @item exact
  5708. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5709. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5710. It defaults to 0.
  5711. @end table
  5712. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5713. expressions containing the following constants:
  5714. @table @option
  5715. @item x
  5716. @item y
  5717. The computed values for @var{x} and @var{y}. They are evaluated for
  5718. each new frame.
  5719. @item in_w
  5720. @item in_h
  5721. The input width and height.
  5722. @item iw
  5723. @item ih
  5724. These are the same as @var{in_w} and @var{in_h}.
  5725. @item out_w
  5726. @item out_h
  5727. The output (cropped) width and height.
  5728. @item ow
  5729. @item oh
  5730. These are the same as @var{out_w} and @var{out_h}.
  5731. @item a
  5732. same as @var{iw} / @var{ih}
  5733. @item sar
  5734. input sample aspect ratio
  5735. @item dar
  5736. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5737. @item hsub
  5738. @item vsub
  5739. horizontal and vertical chroma subsample values. For example for the
  5740. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5741. @item n
  5742. The number of the input frame, starting from 0.
  5743. @item pos
  5744. the position in the file of the input frame, NAN if unknown
  5745. @item t
  5746. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5747. @end table
  5748. The expression for @var{out_w} may depend on the value of @var{out_h},
  5749. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5750. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5751. evaluated after @var{out_w} and @var{out_h}.
  5752. The @var{x} and @var{y} parameters specify the expressions for the
  5753. position of the top-left corner of the output (non-cropped) area. They
  5754. are evaluated for each frame. If the evaluated value is not valid, it
  5755. is approximated to the nearest valid value.
  5756. The expression for @var{x} may depend on @var{y}, and the expression
  5757. for @var{y} may depend on @var{x}.
  5758. @subsection Examples
  5759. @itemize
  5760. @item
  5761. Crop area with size 100x100 at position (12,34).
  5762. @example
  5763. crop=100:100:12:34
  5764. @end example
  5765. Using named options, the example above becomes:
  5766. @example
  5767. crop=w=100:h=100:x=12:y=34
  5768. @end example
  5769. @item
  5770. Crop the central input area with size 100x100:
  5771. @example
  5772. crop=100:100
  5773. @end example
  5774. @item
  5775. Crop the central input area with size 2/3 of the input video:
  5776. @example
  5777. crop=2/3*in_w:2/3*in_h
  5778. @end example
  5779. @item
  5780. Crop the input video central square:
  5781. @example
  5782. crop=out_w=in_h
  5783. crop=in_h
  5784. @end example
  5785. @item
  5786. Delimit the rectangle with the top-left corner placed at position
  5787. 100:100 and the right-bottom corner corresponding to the right-bottom
  5788. corner of the input image.
  5789. @example
  5790. crop=in_w-100:in_h-100:100:100
  5791. @end example
  5792. @item
  5793. Crop 10 pixels from the left and right borders, and 20 pixels from
  5794. the top and bottom borders
  5795. @example
  5796. crop=in_w-2*10:in_h-2*20
  5797. @end example
  5798. @item
  5799. Keep only the bottom right quarter of the input image:
  5800. @example
  5801. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5802. @end example
  5803. @item
  5804. Crop height for getting Greek harmony:
  5805. @example
  5806. crop=in_w:1/PHI*in_w
  5807. @end example
  5808. @item
  5809. Apply trembling effect:
  5810. @example
  5811. 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)
  5812. @end example
  5813. @item
  5814. Apply erratic camera effect depending on timestamp:
  5815. @example
  5816. 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)"
  5817. @end example
  5818. @item
  5819. Set x depending on the value of y:
  5820. @example
  5821. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5822. @end example
  5823. @end itemize
  5824. @subsection Commands
  5825. This filter supports the following commands:
  5826. @table @option
  5827. @item w, out_w
  5828. @item h, out_h
  5829. @item x
  5830. @item y
  5831. Set width/height of the output video and the horizontal/vertical position
  5832. in the input video.
  5833. The command accepts the same syntax of the corresponding option.
  5834. If the specified expression is not valid, it is kept at its current
  5835. value.
  5836. @end table
  5837. @section cropdetect
  5838. Auto-detect the crop size.
  5839. It calculates the necessary cropping parameters and prints the
  5840. recommended parameters via the logging system. The detected dimensions
  5841. correspond to the non-black area of the input video.
  5842. It accepts the following parameters:
  5843. @table @option
  5844. @item limit
  5845. Set higher black value threshold, which can be optionally specified
  5846. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5847. value greater to the set value is considered non-black. It defaults to 24.
  5848. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5849. on the bitdepth of the pixel format.
  5850. @item round
  5851. The value which the width/height should be divisible by. It defaults to
  5852. 16. The offset is automatically adjusted to center the video. Use 2 to
  5853. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5854. encoding to most video codecs.
  5855. @item reset_count, reset
  5856. Set the counter that determines after how many frames cropdetect will
  5857. reset the previously detected largest video area and start over to
  5858. detect the current optimal crop area. Default value is 0.
  5859. This can be useful when channel logos distort the video area. 0
  5860. indicates 'never reset', and returns the largest area encountered during
  5861. playback.
  5862. @end table
  5863. @anchor{cue}
  5864. @section cue
  5865. Delay video filtering until a given wallclock timestamp. The filter first
  5866. passes on @option{preroll} amount of frames, then it buffers at most
  5867. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5868. it forwards the buffered frames and also any subsequent frames coming in its
  5869. input.
  5870. The filter can be used synchronize the output of multiple ffmpeg processes for
  5871. realtime output devices like decklink. By putting the delay in the filtering
  5872. chain and pre-buffering frames the process can pass on data to output almost
  5873. immediately after the target wallclock timestamp is reached.
  5874. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5875. some use cases.
  5876. @table @option
  5877. @item cue
  5878. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5879. @item preroll
  5880. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5881. @item buffer
  5882. The maximum duration of content to buffer before waiting for the cue expressed
  5883. in seconds. Default is 0.
  5884. @end table
  5885. @anchor{curves}
  5886. @section curves
  5887. Apply color adjustments using curves.
  5888. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5889. component (red, green and blue) has its values defined by @var{N} key points
  5890. tied from each other using a smooth curve. The x-axis represents the pixel
  5891. values from the input frame, and the y-axis the new pixel values to be set for
  5892. the output frame.
  5893. By default, a component curve is defined by the two points @var{(0;0)} and
  5894. @var{(1;1)}. This creates a straight line where each original pixel value is
  5895. "adjusted" to its own value, which means no change to the image.
  5896. The filter allows you to redefine these two points and add some more. A new
  5897. curve (using a natural cubic spline interpolation) will be define to pass
  5898. smoothly through all these new coordinates. The new defined points needs to be
  5899. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5900. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5901. the vector spaces, the values will be clipped accordingly.
  5902. The filter accepts the following options:
  5903. @table @option
  5904. @item preset
  5905. Select one of the available color presets. This option can be used in addition
  5906. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5907. options takes priority on the preset values.
  5908. Available presets are:
  5909. @table @samp
  5910. @item none
  5911. @item color_negative
  5912. @item cross_process
  5913. @item darker
  5914. @item increase_contrast
  5915. @item lighter
  5916. @item linear_contrast
  5917. @item medium_contrast
  5918. @item negative
  5919. @item strong_contrast
  5920. @item vintage
  5921. @end table
  5922. Default is @code{none}.
  5923. @item master, m
  5924. Set the master key points. These points will define a second pass mapping. It
  5925. is sometimes called a "luminance" or "value" mapping. It can be used with
  5926. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5927. post-processing LUT.
  5928. @item red, r
  5929. Set the key points for the red component.
  5930. @item green, g
  5931. Set the key points for the green component.
  5932. @item blue, b
  5933. Set the key points for the blue component.
  5934. @item all
  5935. Set the key points for all components (not including master).
  5936. Can be used in addition to the other key points component
  5937. options. In this case, the unset component(s) will fallback on this
  5938. @option{all} setting.
  5939. @item psfile
  5940. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5941. @item plot
  5942. Save Gnuplot script of the curves in specified file.
  5943. @end table
  5944. To avoid some filtergraph syntax conflicts, each key points list need to be
  5945. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5946. @subsection Examples
  5947. @itemize
  5948. @item
  5949. Increase slightly the middle level of blue:
  5950. @example
  5951. curves=blue='0/0 0.5/0.58 1/1'
  5952. @end example
  5953. @item
  5954. Vintage effect:
  5955. @example
  5956. 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'
  5957. @end example
  5958. Here we obtain the following coordinates for each components:
  5959. @table @var
  5960. @item red
  5961. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5962. @item green
  5963. @code{(0;0) (0.50;0.48) (1;1)}
  5964. @item blue
  5965. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5966. @end table
  5967. @item
  5968. The previous example can also be achieved with the associated built-in preset:
  5969. @example
  5970. curves=preset=vintage
  5971. @end example
  5972. @item
  5973. Or simply:
  5974. @example
  5975. curves=vintage
  5976. @end example
  5977. @item
  5978. Use a Photoshop preset and redefine the points of the green component:
  5979. @example
  5980. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5981. @end example
  5982. @item
  5983. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5984. and @command{gnuplot}:
  5985. @example
  5986. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5987. gnuplot -p /tmp/curves.plt
  5988. @end example
  5989. @end itemize
  5990. @section datascope
  5991. Video data analysis filter.
  5992. This filter shows hexadecimal pixel values of part of video.
  5993. The filter accepts the following options:
  5994. @table @option
  5995. @item size, s
  5996. Set output video size.
  5997. @item x
  5998. Set x offset from where to pick pixels.
  5999. @item y
  6000. Set y offset from where to pick pixels.
  6001. @item mode
  6002. Set scope mode, can be one of the following:
  6003. @table @samp
  6004. @item mono
  6005. Draw hexadecimal pixel values with white color on black background.
  6006. @item color
  6007. Draw hexadecimal pixel values with input video pixel color on black
  6008. background.
  6009. @item color2
  6010. Draw hexadecimal pixel values on color background picked from input video,
  6011. the text color is picked in such way so its always visible.
  6012. @end table
  6013. @item axis
  6014. Draw rows and columns numbers on left and top of video.
  6015. @item opacity
  6016. Set background opacity.
  6017. @end table
  6018. @section dctdnoiz
  6019. Denoise frames using 2D DCT (frequency domain filtering).
  6020. This filter is not designed for real time.
  6021. The filter accepts the following options:
  6022. @table @option
  6023. @item sigma, s
  6024. Set the noise sigma constant.
  6025. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6026. coefficient (absolute value) below this threshold with be dropped.
  6027. If you need a more advanced filtering, see @option{expr}.
  6028. Default is @code{0}.
  6029. @item overlap
  6030. Set number overlapping pixels for each block. Since the filter can be slow, you
  6031. may want to reduce this value, at the cost of a less effective filter and the
  6032. risk of various artefacts.
  6033. If the overlapping value doesn't permit processing the whole input width or
  6034. height, a warning will be displayed and according borders won't be denoised.
  6035. Default value is @var{blocksize}-1, which is the best possible setting.
  6036. @item expr, e
  6037. Set the coefficient factor expression.
  6038. For each coefficient of a DCT block, this expression will be evaluated as a
  6039. multiplier value for the coefficient.
  6040. If this is option is set, the @option{sigma} option will be ignored.
  6041. The absolute value of the coefficient can be accessed through the @var{c}
  6042. variable.
  6043. @item n
  6044. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6045. @var{blocksize}, which is the width and height of the processed blocks.
  6046. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6047. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6048. on the speed processing. Also, a larger block size does not necessarily means a
  6049. better de-noising.
  6050. @end table
  6051. @subsection Examples
  6052. Apply a denoise with a @option{sigma} of @code{4.5}:
  6053. @example
  6054. dctdnoiz=4.5
  6055. @end example
  6056. The same operation can be achieved using the expression system:
  6057. @example
  6058. dctdnoiz=e='gte(c, 4.5*3)'
  6059. @end example
  6060. Violent denoise using a block size of @code{16x16}:
  6061. @example
  6062. dctdnoiz=15:n=4
  6063. @end example
  6064. @section deband
  6065. Remove banding artifacts from input video.
  6066. It works by replacing banded pixels with average value of referenced pixels.
  6067. The filter accepts the following options:
  6068. @table @option
  6069. @item 1thr
  6070. @item 2thr
  6071. @item 3thr
  6072. @item 4thr
  6073. Set banding detection threshold for each plane. Default is 0.02.
  6074. Valid range is 0.00003 to 0.5.
  6075. If difference between current pixel and reference pixel is less than threshold,
  6076. it will be considered as banded.
  6077. @item range, r
  6078. Banding detection range in pixels. Default is 16. If positive, random number
  6079. in range 0 to set value will be used. If negative, exact absolute value
  6080. will be used.
  6081. The range defines square of four pixels around current pixel.
  6082. @item direction, d
  6083. Set direction in radians from which four pixel will be compared. If positive,
  6084. random direction from 0 to set direction will be picked. If negative, exact of
  6085. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6086. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6087. column.
  6088. @item blur, b
  6089. If enabled, current pixel is compared with average value of all four
  6090. surrounding pixels. The default is enabled. If disabled current pixel is
  6091. compared with all four surrounding pixels. The pixel is considered banded
  6092. if only all four differences with surrounding pixels are less than threshold.
  6093. @item coupling, c
  6094. If enabled, current pixel is changed if and only if all pixel components are banded,
  6095. e.g. banding detection threshold is triggered for all color components.
  6096. The default is disabled.
  6097. @end table
  6098. @section deblock
  6099. Remove blocking artifacts from input video.
  6100. The filter accepts the following options:
  6101. @table @option
  6102. @item filter
  6103. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6104. This controls what kind of deblocking is applied.
  6105. @item block
  6106. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6107. @item alpha
  6108. @item beta
  6109. @item gamma
  6110. @item delta
  6111. Set blocking detection thresholds. Allowed range is 0 to 1.
  6112. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6113. Using higher threshold gives more deblocking strength.
  6114. Setting @var{alpha} controls threshold detection at exact edge of block.
  6115. Remaining options controls threshold detection near the edge. Each one for
  6116. below/above or left/right. Setting any of those to @var{0} disables
  6117. deblocking.
  6118. @item planes
  6119. Set planes to filter. Default is to filter all available planes.
  6120. @end table
  6121. @subsection Examples
  6122. @itemize
  6123. @item
  6124. Deblock using weak filter and block size of 4 pixels.
  6125. @example
  6126. deblock=filter=weak:block=4
  6127. @end example
  6128. @item
  6129. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6130. deblocking more edges.
  6131. @example
  6132. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6133. @end example
  6134. @item
  6135. Similar as above, but filter only first plane.
  6136. @example
  6137. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6138. @end example
  6139. @item
  6140. Similar as above, but filter only second and third plane.
  6141. @example
  6142. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6143. @end example
  6144. @end itemize
  6145. @anchor{decimate}
  6146. @section decimate
  6147. Drop duplicated frames at regular intervals.
  6148. The filter accepts the following options:
  6149. @table @option
  6150. @item cycle
  6151. Set the number of frames from which one will be dropped. Setting this to
  6152. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6153. Default is @code{5}.
  6154. @item dupthresh
  6155. Set the threshold for duplicate detection. If the difference metric for a frame
  6156. is less than or equal to this value, then it is declared as duplicate. Default
  6157. is @code{1.1}
  6158. @item scthresh
  6159. Set scene change threshold. Default is @code{15}.
  6160. @item blockx
  6161. @item blocky
  6162. Set the size of the x and y-axis blocks used during metric calculations.
  6163. Larger blocks give better noise suppression, but also give worse detection of
  6164. small movements. Must be a power of two. Default is @code{32}.
  6165. @item ppsrc
  6166. Mark main input as a pre-processed input and activate clean source input
  6167. stream. This allows the input to be pre-processed with various filters to help
  6168. the metrics calculation while keeping the frame selection lossless. When set to
  6169. @code{1}, the first stream is for the pre-processed input, and the second
  6170. stream is the clean source from where the kept frames are chosen. Default is
  6171. @code{0}.
  6172. @item chroma
  6173. Set whether or not chroma is considered in the metric calculations. Default is
  6174. @code{1}.
  6175. @end table
  6176. @section deconvolve
  6177. Apply 2D deconvolution of video stream in frequency domain using second stream
  6178. as impulse.
  6179. The filter accepts the following options:
  6180. @table @option
  6181. @item planes
  6182. Set which planes to process.
  6183. @item impulse
  6184. Set which impulse video frames will be processed, can be @var{first}
  6185. or @var{all}. Default is @var{all}.
  6186. @item noise
  6187. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6188. and height are not same and not power of 2 or if stream prior to convolving
  6189. had noise.
  6190. @end table
  6191. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6192. @section dedot
  6193. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6194. It accepts the following options:
  6195. @table @option
  6196. @item m
  6197. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6198. @var{rainbows} for cross-color reduction.
  6199. @item lt
  6200. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6201. @item tl
  6202. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6203. @item tc
  6204. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6205. @item ct
  6206. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6207. @end table
  6208. @section deflate
  6209. Apply deflate effect to the video.
  6210. This filter replaces the pixel by the local(3x3) average by taking into account
  6211. only values lower than the pixel.
  6212. It accepts the following options:
  6213. @table @option
  6214. @item threshold0
  6215. @item threshold1
  6216. @item threshold2
  6217. @item threshold3
  6218. Limit the maximum change for each plane, default is 65535.
  6219. If 0, plane will remain unchanged.
  6220. @end table
  6221. @section deflicker
  6222. Remove temporal frame luminance variations.
  6223. It accepts the following options:
  6224. @table @option
  6225. @item size, s
  6226. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6227. @item mode, m
  6228. Set averaging mode to smooth temporal luminance variations.
  6229. Available values are:
  6230. @table @samp
  6231. @item am
  6232. Arithmetic mean
  6233. @item gm
  6234. Geometric mean
  6235. @item hm
  6236. Harmonic mean
  6237. @item qm
  6238. Quadratic mean
  6239. @item cm
  6240. Cubic mean
  6241. @item pm
  6242. Power mean
  6243. @item median
  6244. Median
  6245. @end table
  6246. @item bypass
  6247. Do not actually modify frame. Useful when one only wants metadata.
  6248. @end table
  6249. @section dejudder
  6250. Remove judder produced by partially interlaced telecined content.
  6251. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6252. source was partially telecined content then the output of @code{pullup,dejudder}
  6253. will have a variable frame rate. May change the recorded frame rate of the
  6254. container. Aside from that change, this filter will not affect constant frame
  6255. rate video.
  6256. The option available in this filter is:
  6257. @table @option
  6258. @item cycle
  6259. Specify the length of the window over which the judder repeats.
  6260. Accepts any integer greater than 1. Useful values are:
  6261. @table @samp
  6262. @item 4
  6263. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6264. @item 5
  6265. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6266. @item 20
  6267. If a mixture of the two.
  6268. @end table
  6269. The default is @samp{4}.
  6270. @end table
  6271. @section delogo
  6272. Suppress a TV station logo by a simple interpolation of the surrounding
  6273. pixels. Just set a rectangle covering the logo and watch it disappear
  6274. (and sometimes something even uglier appear - your mileage may vary).
  6275. It accepts the following parameters:
  6276. @table @option
  6277. @item x
  6278. @item y
  6279. Specify the top left corner coordinates of the logo. They must be
  6280. specified.
  6281. @item w
  6282. @item h
  6283. Specify the width and height of the logo to clear. They must be
  6284. specified.
  6285. @item band, t
  6286. Specify the thickness of the fuzzy edge of the rectangle (added to
  6287. @var{w} and @var{h}). The default value is 1. This option is
  6288. deprecated, setting higher values should no longer be necessary and
  6289. is not recommended.
  6290. @item show
  6291. When set to 1, a green rectangle is drawn on the screen to simplify
  6292. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6293. The default value is 0.
  6294. The rectangle is drawn on the outermost pixels which will be (partly)
  6295. replaced with interpolated values. The values of the next pixels
  6296. immediately outside this rectangle in each direction will be used to
  6297. compute the interpolated pixel values inside the rectangle.
  6298. @end table
  6299. @subsection Examples
  6300. @itemize
  6301. @item
  6302. Set a rectangle covering the area with top left corner coordinates 0,0
  6303. and size 100x77, and a band of size 10:
  6304. @example
  6305. delogo=x=0:y=0:w=100:h=77:band=10
  6306. @end example
  6307. @end itemize
  6308. @section deshake
  6309. Attempt to fix small changes in horizontal and/or vertical shift. This
  6310. filter helps remove camera shake from hand-holding a camera, bumping a
  6311. tripod, moving on a vehicle, etc.
  6312. The filter accepts the following options:
  6313. @table @option
  6314. @item x
  6315. @item y
  6316. @item w
  6317. @item h
  6318. Specify a rectangular area where to limit the search for motion
  6319. vectors.
  6320. If desired the search for motion vectors can be limited to a
  6321. rectangular area of the frame defined by its top left corner, width
  6322. and height. These parameters have the same meaning as the drawbox
  6323. filter which can be used to visualise the position of the bounding
  6324. box.
  6325. This is useful when simultaneous movement of subjects within the frame
  6326. might be confused for camera motion by the motion vector search.
  6327. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6328. then the full frame is used. This allows later options to be set
  6329. without specifying the bounding box for the motion vector search.
  6330. Default - search the whole frame.
  6331. @item rx
  6332. @item ry
  6333. Specify the maximum extent of movement in x and y directions in the
  6334. range 0-64 pixels. Default 16.
  6335. @item edge
  6336. Specify how to generate pixels to fill blanks at the edge of the
  6337. frame. Available values are:
  6338. @table @samp
  6339. @item blank, 0
  6340. Fill zeroes at blank locations
  6341. @item original, 1
  6342. Original image at blank locations
  6343. @item clamp, 2
  6344. Extruded edge value at blank locations
  6345. @item mirror, 3
  6346. Mirrored edge at blank locations
  6347. @end table
  6348. Default value is @samp{mirror}.
  6349. @item blocksize
  6350. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6351. default 8.
  6352. @item contrast
  6353. Specify the contrast threshold for blocks. Only blocks with more than
  6354. the specified contrast (difference between darkest and lightest
  6355. pixels) will be considered. Range 1-255, default 125.
  6356. @item search
  6357. Specify the search strategy. Available values are:
  6358. @table @samp
  6359. @item exhaustive, 0
  6360. Set exhaustive search
  6361. @item less, 1
  6362. Set less exhaustive search.
  6363. @end table
  6364. Default value is @samp{exhaustive}.
  6365. @item filename
  6366. If set then a detailed log of the motion search is written to the
  6367. specified file.
  6368. @end table
  6369. @section despill
  6370. Remove unwanted contamination of foreground colors, caused by reflected color of
  6371. greenscreen or bluescreen.
  6372. This filter accepts the following options:
  6373. @table @option
  6374. @item type
  6375. Set what type of despill to use.
  6376. @item mix
  6377. Set how spillmap will be generated.
  6378. @item expand
  6379. Set how much to get rid of still remaining spill.
  6380. @item red
  6381. Controls amount of red in spill area.
  6382. @item green
  6383. Controls amount of green in spill area.
  6384. Should be -1 for greenscreen.
  6385. @item blue
  6386. Controls amount of blue in spill area.
  6387. Should be -1 for bluescreen.
  6388. @item brightness
  6389. Controls brightness of spill area, preserving colors.
  6390. @item alpha
  6391. Modify alpha from generated spillmap.
  6392. @end table
  6393. @section detelecine
  6394. Apply an exact inverse of the telecine operation. It requires a predefined
  6395. pattern specified using the pattern option which must be the same as that passed
  6396. to the telecine filter.
  6397. This filter accepts the following options:
  6398. @table @option
  6399. @item first_field
  6400. @table @samp
  6401. @item top, t
  6402. top field first
  6403. @item bottom, b
  6404. bottom field first
  6405. The default value is @code{top}.
  6406. @end table
  6407. @item pattern
  6408. A string of numbers representing the pulldown pattern you wish to apply.
  6409. The default value is @code{23}.
  6410. @item start_frame
  6411. A number representing position of the first frame with respect to the telecine
  6412. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6413. @end table
  6414. @section dilation
  6415. Apply dilation effect to the video.
  6416. This filter replaces the pixel by the local(3x3) maximum.
  6417. It accepts the following options:
  6418. @table @option
  6419. @item threshold0
  6420. @item threshold1
  6421. @item threshold2
  6422. @item threshold3
  6423. Limit the maximum change for each plane, default is 65535.
  6424. If 0, plane will remain unchanged.
  6425. @item coordinates
  6426. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6427. pixels are used.
  6428. Flags to local 3x3 coordinates maps like this:
  6429. 1 2 3
  6430. 4 5
  6431. 6 7 8
  6432. @end table
  6433. @section displace
  6434. Displace pixels as indicated by second and third input stream.
  6435. It takes three input streams and outputs one stream, the first input is the
  6436. source, and second and third input are displacement maps.
  6437. The second input specifies how much to displace pixels along the
  6438. x-axis, while the third input specifies how much to displace pixels
  6439. along the y-axis.
  6440. If one of displacement map streams terminates, last frame from that
  6441. displacement map will be used.
  6442. Note that once generated, displacements maps can be reused over and over again.
  6443. A description of the accepted options follows.
  6444. @table @option
  6445. @item edge
  6446. Set displace behavior for pixels that are out of range.
  6447. Available values are:
  6448. @table @samp
  6449. @item blank
  6450. Missing pixels are replaced by black pixels.
  6451. @item smear
  6452. Adjacent pixels will spread out to replace missing pixels.
  6453. @item wrap
  6454. Out of range pixels are wrapped so they point to pixels of other side.
  6455. @item mirror
  6456. Out of range pixels will be replaced with mirrored pixels.
  6457. @end table
  6458. Default is @samp{smear}.
  6459. @end table
  6460. @subsection Examples
  6461. @itemize
  6462. @item
  6463. Add ripple effect to rgb input of video size hd720:
  6464. @example
  6465. 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
  6466. @end example
  6467. @item
  6468. Add wave effect to rgb input of video size hd720:
  6469. @example
  6470. 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
  6471. @end example
  6472. @end itemize
  6473. @section drawbox
  6474. Draw a colored box on the input image.
  6475. It accepts the following parameters:
  6476. @table @option
  6477. @item x
  6478. @item y
  6479. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6480. @item width, w
  6481. @item height, h
  6482. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6483. the input width and height. It defaults to 0.
  6484. @item color, c
  6485. Specify the color of the box to write. For the general syntax of this option,
  6486. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6487. value @code{invert} is used, the box edge color is the same as the
  6488. video with inverted luma.
  6489. @item thickness, t
  6490. The expression which sets the thickness of the box edge.
  6491. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6492. See below for the list of accepted constants.
  6493. @item replace
  6494. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6495. will overwrite the video's color and alpha pixels.
  6496. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6497. @end table
  6498. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6499. following constants:
  6500. @table @option
  6501. @item dar
  6502. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6503. @item hsub
  6504. @item vsub
  6505. horizontal and vertical chroma subsample values. For example for the
  6506. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6507. @item in_h, ih
  6508. @item in_w, iw
  6509. The input width and height.
  6510. @item sar
  6511. The input sample aspect ratio.
  6512. @item x
  6513. @item y
  6514. The x and y offset coordinates where the box is drawn.
  6515. @item w
  6516. @item h
  6517. The width and height of the drawn box.
  6518. @item t
  6519. The thickness of the drawn box.
  6520. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6521. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6522. @end table
  6523. @subsection Examples
  6524. @itemize
  6525. @item
  6526. Draw a black box around the edge of the input image:
  6527. @example
  6528. drawbox
  6529. @end example
  6530. @item
  6531. Draw a box with color red and an opacity of 50%:
  6532. @example
  6533. drawbox=10:20:200:60:red@@0.5
  6534. @end example
  6535. The previous example can be specified as:
  6536. @example
  6537. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6538. @end example
  6539. @item
  6540. Fill the box with pink color:
  6541. @example
  6542. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6543. @end example
  6544. @item
  6545. Draw a 2-pixel red 2.40:1 mask:
  6546. @example
  6547. 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
  6548. @end example
  6549. @end itemize
  6550. @section drawgrid
  6551. Draw a grid on the input image.
  6552. It accepts the following parameters:
  6553. @table @option
  6554. @item x
  6555. @item y
  6556. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6557. @item width, w
  6558. @item height, h
  6559. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6560. input width and height, respectively, minus @code{thickness}, so image gets
  6561. framed. Default to 0.
  6562. @item color, c
  6563. Specify the color of the grid. For the general syntax of this option,
  6564. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6565. value @code{invert} is used, the grid color is the same as the
  6566. video with inverted luma.
  6567. @item thickness, t
  6568. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6569. See below for the list of accepted constants.
  6570. @item replace
  6571. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6572. will overwrite the video's color and alpha pixels.
  6573. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6574. @end table
  6575. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6576. following constants:
  6577. @table @option
  6578. @item dar
  6579. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6580. @item hsub
  6581. @item vsub
  6582. horizontal and vertical chroma subsample values. For example for the
  6583. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6584. @item in_h, ih
  6585. @item in_w, iw
  6586. The input grid cell width and height.
  6587. @item sar
  6588. The input sample aspect ratio.
  6589. @item x
  6590. @item y
  6591. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6592. @item w
  6593. @item h
  6594. The width and height of the drawn cell.
  6595. @item t
  6596. The thickness of the drawn cell.
  6597. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6598. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6599. @end table
  6600. @subsection Examples
  6601. @itemize
  6602. @item
  6603. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6604. @example
  6605. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6606. @end example
  6607. @item
  6608. Draw a white 3x3 grid with an opacity of 50%:
  6609. @example
  6610. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6611. @end example
  6612. @end itemize
  6613. @anchor{drawtext}
  6614. @section drawtext
  6615. Draw a text string or text from a specified file on top of a video, using the
  6616. libfreetype library.
  6617. To enable compilation of this filter, you need to configure FFmpeg with
  6618. @code{--enable-libfreetype}.
  6619. To enable default font fallback and the @var{font} option you need to
  6620. configure FFmpeg with @code{--enable-libfontconfig}.
  6621. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6622. @code{--enable-libfribidi}.
  6623. @subsection Syntax
  6624. It accepts the following parameters:
  6625. @table @option
  6626. @item box
  6627. Used to draw a box around text using the background color.
  6628. The value must be either 1 (enable) or 0 (disable).
  6629. The default value of @var{box} is 0.
  6630. @item boxborderw
  6631. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6632. The default value of @var{boxborderw} is 0.
  6633. @item boxcolor
  6634. The color to be used for drawing box around text. For the syntax of this
  6635. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6636. The default value of @var{boxcolor} is "white".
  6637. @item line_spacing
  6638. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6639. The default value of @var{line_spacing} is 0.
  6640. @item borderw
  6641. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6642. The default value of @var{borderw} is 0.
  6643. @item bordercolor
  6644. Set the color to be used for drawing border around text. For the syntax of this
  6645. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6646. The default value of @var{bordercolor} is "black".
  6647. @item expansion
  6648. Select how the @var{text} is expanded. Can be either @code{none},
  6649. @code{strftime} (deprecated) or
  6650. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6651. below for details.
  6652. @item basetime
  6653. Set a start time for the count. Value is in microseconds. Only applied
  6654. in the deprecated strftime expansion mode. To emulate in normal expansion
  6655. mode use the @code{pts} function, supplying the start time (in seconds)
  6656. as the second argument.
  6657. @item fix_bounds
  6658. If true, check and fix text coords to avoid clipping.
  6659. @item fontcolor
  6660. The color to be used for drawing fonts. For the syntax of this option, check
  6661. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6662. The default value of @var{fontcolor} is "black".
  6663. @item fontcolor_expr
  6664. String which is expanded the same way as @var{text} to obtain dynamic
  6665. @var{fontcolor} value. By default this option has empty value and is not
  6666. processed. When this option is set, it overrides @var{fontcolor} option.
  6667. @item font
  6668. The font family to be used for drawing text. By default Sans.
  6669. @item fontfile
  6670. The font file to be used for drawing text. The path must be included.
  6671. This parameter is mandatory if the fontconfig support is disabled.
  6672. @item alpha
  6673. Draw the text applying alpha blending. The value can
  6674. be a number between 0.0 and 1.0.
  6675. The expression accepts the same variables @var{x, y} as well.
  6676. The default value is 1.
  6677. Please see @var{fontcolor_expr}.
  6678. @item fontsize
  6679. The font size to be used for drawing text.
  6680. The default value of @var{fontsize} is 16.
  6681. @item text_shaping
  6682. If set to 1, attempt to shape the text (for example, reverse the order of
  6683. right-to-left text and join Arabic characters) before drawing it.
  6684. Otherwise, just draw the text exactly as given.
  6685. By default 1 (if supported).
  6686. @item ft_load_flags
  6687. The flags to be used for loading the fonts.
  6688. The flags map the corresponding flags supported by libfreetype, and are
  6689. a combination of the following values:
  6690. @table @var
  6691. @item default
  6692. @item no_scale
  6693. @item no_hinting
  6694. @item render
  6695. @item no_bitmap
  6696. @item vertical_layout
  6697. @item force_autohint
  6698. @item crop_bitmap
  6699. @item pedantic
  6700. @item ignore_global_advance_width
  6701. @item no_recurse
  6702. @item ignore_transform
  6703. @item monochrome
  6704. @item linear_design
  6705. @item no_autohint
  6706. @end table
  6707. Default value is "default".
  6708. For more information consult the documentation for the FT_LOAD_*
  6709. libfreetype flags.
  6710. @item shadowcolor
  6711. The color to be used for drawing a shadow behind the drawn text. For the
  6712. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6713. ffmpeg-utils manual,ffmpeg-utils}.
  6714. The default value of @var{shadowcolor} is "black".
  6715. @item shadowx
  6716. @item shadowy
  6717. The x and y offsets for the text shadow position with respect to the
  6718. position of the text. They can be either positive or negative
  6719. values. The default value for both is "0".
  6720. @item start_number
  6721. The starting frame number for the n/frame_num variable. The default value
  6722. is "0".
  6723. @item tabsize
  6724. The size in number of spaces to use for rendering the tab.
  6725. Default value is 4.
  6726. @item timecode
  6727. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6728. format. It can be used with or without text parameter. @var{timecode_rate}
  6729. option must be specified.
  6730. @item timecode_rate, rate, r
  6731. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6732. integer. Minimum value is "1".
  6733. Drop-frame timecode is supported for frame rates 30 & 60.
  6734. @item tc24hmax
  6735. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6736. Default is 0 (disabled).
  6737. @item text
  6738. The text string to be drawn. The text must be a sequence of UTF-8
  6739. encoded characters.
  6740. This parameter is mandatory if no file is specified with the parameter
  6741. @var{textfile}.
  6742. @item textfile
  6743. A text file containing text to be drawn. The text must be a sequence
  6744. of UTF-8 encoded characters.
  6745. This parameter is mandatory if no text string is specified with the
  6746. parameter @var{text}.
  6747. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6748. @item reload
  6749. If set to 1, the @var{textfile} will be reloaded before each frame.
  6750. Be sure to update it atomically, or it may be read partially, or even fail.
  6751. @item x
  6752. @item y
  6753. The expressions which specify the offsets where text will be drawn
  6754. within the video frame. They are relative to the top/left border of the
  6755. output image.
  6756. The default value of @var{x} and @var{y} is "0".
  6757. See below for the list of accepted constants and functions.
  6758. @end table
  6759. The parameters for @var{x} and @var{y} are expressions containing the
  6760. following constants and functions:
  6761. @table @option
  6762. @item dar
  6763. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6764. @item hsub
  6765. @item vsub
  6766. horizontal and vertical chroma subsample values. For example for the
  6767. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6768. @item line_h, lh
  6769. the height of each text line
  6770. @item main_h, h, H
  6771. the input height
  6772. @item main_w, w, W
  6773. the input width
  6774. @item max_glyph_a, ascent
  6775. the maximum distance from the baseline to the highest/upper grid
  6776. coordinate used to place a glyph outline point, for all the rendered
  6777. glyphs.
  6778. It is a positive value, due to the grid's orientation with the Y axis
  6779. upwards.
  6780. @item max_glyph_d, descent
  6781. the maximum distance from the baseline to the lowest grid coordinate
  6782. used to place a glyph outline point, for all the rendered glyphs.
  6783. This is a negative value, due to the grid's orientation, with the Y axis
  6784. upwards.
  6785. @item max_glyph_h
  6786. maximum glyph height, that is the maximum height for all the glyphs
  6787. contained in the rendered text, it is equivalent to @var{ascent} -
  6788. @var{descent}.
  6789. @item max_glyph_w
  6790. maximum glyph width, that is the maximum width for all the glyphs
  6791. contained in the rendered text
  6792. @item n
  6793. the number of input frame, starting from 0
  6794. @item rand(min, max)
  6795. return a random number included between @var{min} and @var{max}
  6796. @item sar
  6797. The input sample aspect ratio.
  6798. @item t
  6799. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6800. @item text_h, th
  6801. the height of the rendered text
  6802. @item text_w, tw
  6803. the width of the rendered text
  6804. @item x
  6805. @item y
  6806. the x and y offset coordinates where the text is drawn.
  6807. These parameters allow the @var{x} and @var{y} expressions to refer
  6808. each other, so you can for example specify @code{y=x/dar}.
  6809. @end table
  6810. @anchor{drawtext_expansion}
  6811. @subsection Text expansion
  6812. If @option{expansion} is set to @code{strftime},
  6813. the filter recognizes strftime() sequences in the provided text and
  6814. expands them accordingly. Check the documentation of strftime(). This
  6815. feature is deprecated.
  6816. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6817. If @option{expansion} is set to @code{normal} (which is the default),
  6818. the following expansion mechanism is used.
  6819. The backslash character @samp{\}, followed by any character, always expands to
  6820. the second character.
  6821. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6822. braces is a function name, possibly followed by arguments separated by ':'.
  6823. If the arguments contain special characters or delimiters (':' or '@}'),
  6824. they should be escaped.
  6825. Note that they probably must also be escaped as the value for the
  6826. @option{text} option in the filter argument string and as the filter
  6827. argument in the filtergraph description, and possibly also for the shell,
  6828. that makes up to four levels of escaping; using a text file avoids these
  6829. problems.
  6830. The following functions are available:
  6831. @table @command
  6832. @item expr, e
  6833. The expression evaluation result.
  6834. It must take one argument specifying the expression to be evaluated,
  6835. which accepts the same constants and functions as the @var{x} and
  6836. @var{y} values. Note that not all constants should be used, for
  6837. example the text size is not known when evaluating the expression, so
  6838. the constants @var{text_w} and @var{text_h} will have an undefined
  6839. value.
  6840. @item expr_int_format, eif
  6841. Evaluate the expression's value and output as formatted integer.
  6842. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6843. The second argument specifies the output format. Allowed values are @samp{x},
  6844. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6845. @code{printf} function.
  6846. The third parameter is optional and sets the number of positions taken by the output.
  6847. It can be used to add padding with zeros from the left.
  6848. @item gmtime
  6849. The time at which the filter is running, expressed in UTC.
  6850. It can accept an argument: a strftime() format string.
  6851. @item localtime
  6852. The time at which the filter is running, expressed in the local time zone.
  6853. It can accept an argument: a strftime() format string.
  6854. @item metadata
  6855. Frame metadata. Takes one or two arguments.
  6856. The first argument is mandatory and specifies the metadata key.
  6857. The second argument is optional and specifies a default value, used when the
  6858. metadata key is not found or empty.
  6859. @item n, frame_num
  6860. The frame number, starting from 0.
  6861. @item pict_type
  6862. A 1 character description of the current picture type.
  6863. @item pts
  6864. The timestamp of the current frame.
  6865. It can take up to three arguments.
  6866. The first argument is the format of the timestamp; it defaults to @code{flt}
  6867. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6868. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6869. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6870. @code{localtime} stands for the timestamp of the frame formatted as
  6871. local time zone time.
  6872. The second argument is an offset added to the timestamp.
  6873. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6874. supplied to present the hour part of the formatted timestamp in 24h format
  6875. (00-23).
  6876. If the format is set to @code{localtime} or @code{gmtime},
  6877. a third argument may be supplied: a strftime() format string.
  6878. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6879. @end table
  6880. @subsection Examples
  6881. @itemize
  6882. @item
  6883. Draw "Test Text" with font FreeSerif, using the default values for the
  6884. optional parameters.
  6885. @example
  6886. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6887. @end example
  6888. @item
  6889. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6890. and y=50 (counting from the top-left corner of the screen), text is
  6891. yellow with a red box around it. Both the text and the box have an
  6892. opacity of 20%.
  6893. @example
  6894. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6895. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6896. @end example
  6897. Note that the double quotes are not necessary if spaces are not used
  6898. within the parameter list.
  6899. @item
  6900. Show the text at the center of the video frame:
  6901. @example
  6902. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6903. @end example
  6904. @item
  6905. Show the text at a random position, switching to a new position every 30 seconds:
  6906. @example
  6907. 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)"
  6908. @end example
  6909. @item
  6910. Show a text line sliding from right to left in the last row of the video
  6911. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6912. with no newlines.
  6913. @example
  6914. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6915. @end example
  6916. @item
  6917. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6918. @example
  6919. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6920. @end example
  6921. @item
  6922. Draw a single green letter "g", at the center of the input video.
  6923. The glyph baseline is placed at half screen height.
  6924. @example
  6925. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6926. @end example
  6927. @item
  6928. Show text for 1 second every 3 seconds:
  6929. @example
  6930. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6931. @end example
  6932. @item
  6933. Use fontconfig to set the font. Note that the colons need to be escaped.
  6934. @example
  6935. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6936. @end example
  6937. @item
  6938. Print the date of a real-time encoding (see strftime(3)):
  6939. @example
  6940. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6941. @end example
  6942. @item
  6943. Show text fading in and out (appearing/disappearing):
  6944. @example
  6945. #!/bin/sh
  6946. DS=1.0 # display start
  6947. DE=10.0 # display end
  6948. FID=1.5 # fade in duration
  6949. FOD=5 # fade out duration
  6950. 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 @}"
  6951. @end example
  6952. @item
  6953. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6954. and the @option{fontsize} value are included in the @option{y} offset.
  6955. @example
  6956. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6957. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6958. @end example
  6959. @end itemize
  6960. For more information about libfreetype, check:
  6961. @url{http://www.freetype.org/}.
  6962. For more information about fontconfig, check:
  6963. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6964. For more information about libfribidi, check:
  6965. @url{http://fribidi.org/}.
  6966. @section edgedetect
  6967. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6968. The filter accepts the following options:
  6969. @table @option
  6970. @item low
  6971. @item high
  6972. Set low and high threshold values used by the Canny thresholding
  6973. algorithm.
  6974. The high threshold selects the "strong" edge pixels, which are then
  6975. connected through 8-connectivity with the "weak" edge pixels selected
  6976. by the low threshold.
  6977. @var{low} and @var{high} threshold values must be chosen in the range
  6978. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6979. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6980. is @code{50/255}.
  6981. @item mode
  6982. Define the drawing mode.
  6983. @table @samp
  6984. @item wires
  6985. Draw white/gray wires on black background.
  6986. @item colormix
  6987. Mix the colors to create a paint/cartoon effect.
  6988. @item canny
  6989. Apply Canny edge detector on all selected planes.
  6990. @end table
  6991. Default value is @var{wires}.
  6992. @item planes
  6993. Select planes for filtering. By default all available planes are filtered.
  6994. @end table
  6995. @subsection Examples
  6996. @itemize
  6997. @item
  6998. Standard edge detection with custom values for the hysteresis thresholding:
  6999. @example
  7000. edgedetect=low=0.1:high=0.4
  7001. @end example
  7002. @item
  7003. Painting effect without thresholding:
  7004. @example
  7005. edgedetect=mode=colormix:high=0
  7006. @end example
  7007. @end itemize
  7008. @section eq
  7009. Set brightness, contrast, saturation and approximate gamma adjustment.
  7010. The filter accepts the following options:
  7011. @table @option
  7012. @item contrast
  7013. Set the contrast expression. The value must be a float value in range
  7014. @code{-2.0} to @code{2.0}. The default value is "1".
  7015. @item brightness
  7016. Set the brightness expression. The value must be a float value in
  7017. range @code{-1.0} to @code{1.0}. The default value is "0".
  7018. @item saturation
  7019. Set the saturation expression. The value must be a float in
  7020. range @code{0.0} to @code{3.0}. The default value is "1".
  7021. @item gamma
  7022. Set the gamma expression. The value must be a float in range
  7023. @code{0.1} to @code{10.0}. The default value is "1".
  7024. @item gamma_r
  7025. Set the gamma expression for red. The value must be a float in
  7026. range @code{0.1} to @code{10.0}. The default value is "1".
  7027. @item gamma_g
  7028. Set the gamma expression for green. The value must be a float in range
  7029. @code{0.1} to @code{10.0}. The default value is "1".
  7030. @item gamma_b
  7031. Set the gamma expression for blue. The value must be a float in range
  7032. @code{0.1} to @code{10.0}. The default value is "1".
  7033. @item gamma_weight
  7034. Set the gamma weight expression. It can be used to reduce the effect
  7035. of a high gamma value on bright image areas, e.g. keep them from
  7036. getting overamplified and just plain white. The value must be a float
  7037. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7038. gamma correction all the way down while @code{1.0} leaves it at its
  7039. full strength. Default is "1".
  7040. @item eval
  7041. Set when the expressions for brightness, contrast, saturation and
  7042. gamma expressions are evaluated.
  7043. It accepts the following values:
  7044. @table @samp
  7045. @item init
  7046. only evaluate expressions once during the filter initialization or
  7047. when a command is processed
  7048. @item frame
  7049. evaluate expressions for each incoming frame
  7050. @end table
  7051. Default value is @samp{init}.
  7052. @end table
  7053. The expressions accept the following parameters:
  7054. @table @option
  7055. @item n
  7056. frame count of the input frame starting from 0
  7057. @item pos
  7058. byte position of the corresponding packet in the input file, NAN if
  7059. unspecified
  7060. @item r
  7061. frame rate of the input video, NAN if the input frame rate is unknown
  7062. @item t
  7063. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7064. @end table
  7065. @subsection Commands
  7066. The filter supports the following commands:
  7067. @table @option
  7068. @item contrast
  7069. Set the contrast expression.
  7070. @item brightness
  7071. Set the brightness expression.
  7072. @item saturation
  7073. Set the saturation expression.
  7074. @item gamma
  7075. Set the gamma expression.
  7076. @item gamma_r
  7077. Set the gamma_r expression.
  7078. @item gamma_g
  7079. Set gamma_g expression.
  7080. @item gamma_b
  7081. Set gamma_b expression.
  7082. @item gamma_weight
  7083. Set gamma_weight expression.
  7084. The command accepts the same syntax of the corresponding option.
  7085. If the specified expression is not valid, it is kept at its current
  7086. value.
  7087. @end table
  7088. @section erosion
  7089. Apply erosion effect to the video.
  7090. This filter replaces the pixel by the local(3x3) minimum.
  7091. It accepts the following options:
  7092. @table @option
  7093. @item threshold0
  7094. @item threshold1
  7095. @item threshold2
  7096. @item threshold3
  7097. Limit the maximum change for each plane, default is 65535.
  7098. If 0, plane will remain unchanged.
  7099. @item coordinates
  7100. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7101. pixels are used.
  7102. Flags to local 3x3 coordinates maps like this:
  7103. 1 2 3
  7104. 4 5
  7105. 6 7 8
  7106. @end table
  7107. @section extractplanes
  7108. Extract color channel components from input video stream into
  7109. separate grayscale video streams.
  7110. The filter accepts the following option:
  7111. @table @option
  7112. @item planes
  7113. Set plane(s) to extract.
  7114. Available values for planes are:
  7115. @table @samp
  7116. @item y
  7117. @item u
  7118. @item v
  7119. @item a
  7120. @item r
  7121. @item g
  7122. @item b
  7123. @end table
  7124. Choosing planes not available in the input will result in an error.
  7125. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7126. with @code{y}, @code{u}, @code{v} planes at same time.
  7127. @end table
  7128. @subsection Examples
  7129. @itemize
  7130. @item
  7131. Extract luma, u and v color channel component from input video frame
  7132. into 3 grayscale outputs:
  7133. @example
  7134. 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
  7135. @end example
  7136. @end itemize
  7137. @section elbg
  7138. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7139. For each input image, the filter will compute the optimal mapping from
  7140. the input to the output given the codebook length, that is the number
  7141. of distinct output colors.
  7142. This filter accepts the following options.
  7143. @table @option
  7144. @item codebook_length, l
  7145. Set codebook length. The value must be a positive integer, and
  7146. represents the number of distinct output colors. Default value is 256.
  7147. @item nb_steps, n
  7148. Set the maximum number of iterations to apply for computing the optimal
  7149. mapping. The higher the value the better the result and the higher the
  7150. computation time. Default value is 1.
  7151. @item seed, s
  7152. Set a random seed, must be an integer included between 0 and
  7153. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7154. will try to use a good random seed on a best effort basis.
  7155. @item pal8
  7156. Set pal8 output pixel format. This option does not work with codebook
  7157. length greater than 256.
  7158. @end table
  7159. @section entropy
  7160. Measure graylevel entropy in histogram of color channels of video frames.
  7161. It accepts the following parameters:
  7162. @table @option
  7163. @item mode
  7164. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7165. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7166. between neighbour histogram values.
  7167. @end table
  7168. @section fade
  7169. Apply a fade-in/out effect to the input video.
  7170. It accepts the following parameters:
  7171. @table @option
  7172. @item type, t
  7173. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7174. effect.
  7175. Default is @code{in}.
  7176. @item start_frame, s
  7177. Specify the number of the frame to start applying the fade
  7178. effect at. Default is 0.
  7179. @item nb_frames, n
  7180. The number of frames that the fade effect lasts. At the end of the
  7181. fade-in effect, the output video will have the same intensity as the input video.
  7182. At the end of the fade-out transition, the output video will be filled with the
  7183. selected @option{color}.
  7184. Default is 25.
  7185. @item alpha
  7186. If set to 1, fade only alpha channel, if one exists on the input.
  7187. Default value is 0.
  7188. @item start_time, st
  7189. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7190. effect. If both start_frame and start_time are specified, the fade will start at
  7191. whichever comes last. Default is 0.
  7192. @item duration, d
  7193. The number of seconds for which the fade effect has to last. At the end of the
  7194. fade-in effect the output video will have the same intensity as the input video,
  7195. at the end of the fade-out transition the output video will be filled with the
  7196. selected @option{color}.
  7197. If both duration and nb_frames are specified, duration is used. Default is 0
  7198. (nb_frames is used by default).
  7199. @item color, c
  7200. Specify the color of the fade. Default is "black".
  7201. @end table
  7202. @subsection Examples
  7203. @itemize
  7204. @item
  7205. Fade in the first 30 frames of video:
  7206. @example
  7207. fade=in:0:30
  7208. @end example
  7209. The command above is equivalent to:
  7210. @example
  7211. fade=t=in:s=0:n=30
  7212. @end example
  7213. @item
  7214. Fade out the last 45 frames of a 200-frame video:
  7215. @example
  7216. fade=out:155:45
  7217. fade=type=out:start_frame=155:nb_frames=45
  7218. @end example
  7219. @item
  7220. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7221. @example
  7222. fade=in:0:25, fade=out:975:25
  7223. @end example
  7224. @item
  7225. Make the first 5 frames yellow, then fade in from frame 5-24:
  7226. @example
  7227. fade=in:5:20:color=yellow
  7228. @end example
  7229. @item
  7230. Fade in alpha over first 25 frames of video:
  7231. @example
  7232. fade=in:0:25:alpha=1
  7233. @end example
  7234. @item
  7235. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7236. @example
  7237. fade=t=in:st=5.5:d=0.5
  7238. @end example
  7239. @end itemize
  7240. @section fftfilt
  7241. Apply arbitrary expressions to samples in frequency domain
  7242. @table @option
  7243. @item dc_Y
  7244. Adjust the dc value (gain) of the luma plane of the image. The filter
  7245. accepts an integer value in range @code{0} to @code{1000}. The default
  7246. value is set to @code{0}.
  7247. @item dc_U
  7248. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7249. filter accepts an integer value in range @code{0} to @code{1000}. The
  7250. default value is set to @code{0}.
  7251. @item dc_V
  7252. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7253. filter accepts an integer value in range @code{0} to @code{1000}. The
  7254. default value is set to @code{0}.
  7255. @item weight_Y
  7256. Set the frequency domain weight expression for the luma plane.
  7257. @item weight_U
  7258. Set the frequency domain weight expression for the 1st chroma plane.
  7259. @item weight_V
  7260. Set the frequency domain weight expression for the 2nd chroma plane.
  7261. @item eval
  7262. Set when the expressions are evaluated.
  7263. It accepts the following values:
  7264. @table @samp
  7265. @item init
  7266. Only evaluate expressions once during the filter initialization.
  7267. @item frame
  7268. Evaluate expressions for each incoming frame.
  7269. @end table
  7270. Default value is @samp{init}.
  7271. The filter accepts the following variables:
  7272. @item X
  7273. @item Y
  7274. The coordinates of the current sample.
  7275. @item W
  7276. @item H
  7277. The width and height of the image.
  7278. @item N
  7279. The number of input frame, starting from 0.
  7280. @end table
  7281. @subsection Examples
  7282. @itemize
  7283. @item
  7284. High-pass:
  7285. @example
  7286. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7287. @end example
  7288. @item
  7289. Low-pass:
  7290. @example
  7291. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7292. @end example
  7293. @item
  7294. Sharpen:
  7295. @example
  7296. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7297. @end example
  7298. @item
  7299. Blur:
  7300. @example
  7301. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7302. @end example
  7303. @end itemize
  7304. @section fftdnoiz
  7305. Denoise frames using 3D FFT (frequency domain filtering).
  7306. The filter accepts the following options:
  7307. @table @option
  7308. @item sigma
  7309. Set the noise sigma constant. This sets denoising strength.
  7310. Default value is 1. Allowed range is from 0 to 30.
  7311. Using very high sigma with low overlap may give blocking artifacts.
  7312. @item amount
  7313. Set amount of denoising. By default all detected noise is reduced.
  7314. Default value is 1. Allowed range is from 0 to 1.
  7315. @item block
  7316. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7317. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7318. block size in pixels is 2^4 which is 16.
  7319. @item overlap
  7320. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7321. @item prev
  7322. Set number of previous frames to use for denoising. By default is set to 0.
  7323. @item next
  7324. Set number of next frames to to use for denoising. By default is set to 0.
  7325. @item planes
  7326. Set planes which will be filtered, by default are all available filtered
  7327. except alpha.
  7328. @end table
  7329. @section field
  7330. Extract a single field from an interlaced image using stride
  7331. arithmetic to avoid wasting CPU time. The output frames are marked as
  7332. non-interlaced.
  7333. The filter accepts the following options:
  7334. @table @option
  7335. @item type
  7336. Specify whether to extract the top (if the value is @code{0} or
  7337. @code{top}) or the bottom field (if the value is @code{1} or
  7338. @code{bottom}).
  7339. @end table
  7340. @section fieldhint
  7341. Create new frames by copying the top and bottom fields from surrounding frames
  7342. supplied as numbers by the hint file.
  7343. @table @option
  7344. @item hint
  7345. Set file containing hints: absolute/relative frame numbers.
  7346. There must be one line for each frame in a clip. Each line must contain two
  7347. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7348. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7349. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7350. for @code{relative} mode. First number tells from which frame to pick up top
  7351. field and second number tells from which frame to pick up bottom field.
  7352. If optionally followed by @code{+} output frame will be marked as interlaced,
  7353. else if followed by @code{-} output frame will be marked as progressive, else
  7354. it will be marked same as input frame.
  7355. If line starts with @code{#} or @code{;} that line is skipped.
  7356. @item mode
  7357. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7358. @end table
  7359. Example of first several lines of @code{hint} file for @code{relative} mode:
  7360. @example
  7361. 0,0 - # first frame
  7362. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7363. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7364. 1,0 -
  7365. 0,0 -
  7366. 0,0 -
  7367. 1,0 -
  7368. 1,0 -
  7369. 1,0 -
  7370. 0,0 -
  7371. 0,0 -
  7372. 1,0 -
  7373. 1,0 -
  7374. 1,0 -
  7375. 0,0 -
  7376. @end example
  7377. @section fieldmatch
  7378. Field matching filter for inverse telecine. It is meant to reconstruct the
  7379. progressive frames from a telecined stream. The filter does not drop duplicated
  7380. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7381. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7382. The separation of the field matching and the decimation is notably motivated by
  7383. the possibility of inserting a de-interlacing filter fallback between the two.
  7384. If the source has mixed telecined and real interlaced content,
  7385. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7386. But these remaining combed frames will be marked as interlaced, and thus can be
  7387. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7388. In addition to the various configuration options, @code{fieldmatch} can take an
  7389. optional second stream, activated through the @option{ppsrc} option. If
  7390. enabled, the frames reconstruction will be based on the fields and frames from
  7391. this second stream. This allows the first input to be pre-processed in order to
  7392. help the various algorithms of the filter, while keeping the output lossless
  7393. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7394. or brightness/contrast adjustments can help.
  7395. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7396. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7397. which @code{fieldmatch} is based on. While the semantic and usage are very
  7398. close, some behaviour and options names can differ.
  7399. The @ref{decimate} filter currently only works for constant frame rate input.
  7400. If your input has mixed telecined (30fps) and progressive content with a lower
  7401. framerate like 24fps use the following filterchain to produce the necessary cfr
  7402. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7403. The filter accepts the following options:
  7404. @table @option
  7405. @item order
  7406. Specify the assumed field order of the input stream. Available values are:
  7407. @table @samp
  7408. @item auto
  7409. Auto detect parity (use FFmpeg's internal parity value).
  7410. @item bff
  7411. Assume bottom field first.
  7412. @item tff
  7413. Assume top field first.
  7414. @end table
  7415. Note that it is sometimes recommended not to trust the parity announced by the
  7416. stream.
  7417. Default value is @var{auto}.
  7418. @item mode
  7419. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7420. sense that it won't risk creating jerkiness due to duplicate frames when
  7421. possible, but if there are bad edits or blended fields it will end up
  7422. outputting combed frames when a good match might actually exist. On the other
  7423. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7424. but will almost always find a good frame if there is one. The other values are
  7425. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7426. jerkiness and creating duplicate frames versus finding good matches in sections
  7427. with bad edits, orphaned fields, blended fields, etc.
  7428. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7429. Available values are:
  7430. @table @samp
  7431. @item pc
  7432. 2-way matching (p/c)
  7433. @item pc_n
  7434. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7435. @item pc_u
  7436. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7437. @item pc_n_ub
  7438. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7439. still combed (p/c + n + u/b)
  7440. @item pcn
  7441. 3-way matching (p/c/n)
  7442. @item pcn_ub
  7443. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7444. detected as combed (p/c/n + u/b)
  7445. @end table
  7446. The parenthesis at the end indicate the matches that would be used for that
  7447. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7448. @var{top}).
  7449. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7450. the slowest.
  7451. Default value is @var{pc_n}.
  7452. @item ppsrc
  7453. Mark the main input stream as a pre-processed input, and enable the secondary
  7454. input stream as the clean source to pick the fields from. See the filter
  7455. introduction for more details. It is similar to the @option{clip2} feature from
  7456. VFM/TFM.
  7457. Default value is @code{0} (disabled).
  7458. @item field
  7459. Set the field to match from. It is recommended to set this to the same value as
  7460. @option{order} unless you experience matching failures with that setting. In
  7461. certain circumstances changing the field that is used to match from can have a
  7462. large impact on matching performance. Available values are:
  7463. @table @samp
  7464. @item auto
  7465. Automatic (same value as @option{order}).
  7466. @item bottom
  7467. Match from the bottom field.
  7468. @item top
  7469. Match from the top field.
  7470. @end table
  7471. Default value is @var{auto}.
  7472. @item mchroma
  7473. Set whether or not chroma is included during the match comparisons. In most
  7474. cases it is recommended to leave this enabled. You should set this to @code{0}
  7475. only if your clip has bad chroma problems such as heavy rainbowing or other
  7476. artifacts. Setting this to @code{0} could also be used to speed things up at
  7477. the cost of some accuracy.
  7478. Default value is @code{1}.
  7479. @item y0
  7480. @item y1
  7481. These define an exclusion band which excludes the lines between @option{y0} and
  7482. @option{y1} from being included in the field matching decision. An exclusion
  7483. band can be used to ignore subtitles, a logo, or other things that may
  7484. interfere with the matching. @option{y0} sets the starting scan line and
  7485. @option{y1} sets the ending line; all lines in between @option{y0} and
  7486. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7487. @option{y0} and @option{y1} to the same value will disable the feature.
  7488. @option{y0} and @option{y1} defaults to @code{0}.
  7489. @item scthresh
  7490. Set the scene change detection threshold as a percentage of maximum change on
  7491. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7492. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7493. @option{scthresh} is @code{[0.0, 100.0]}.
  7494. Default value is @code{12.0}.
  7495. @item combmatch
  7496. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7497. account the combed scores of matches when deciding what match to use as the
  7498. final match. Available values are:
  7499. @table @samp
  7500. @item none
  7501. No final matching based on combed scores.
  7502. @item sc
  7503. Combed scores are only used when a scene change is detected.
  7504. @item full
  7505. Use combed scores all the time.
  7506. @end table
  7507. Default is @var{sc}.
  7508. @item combdbg
  7509. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7510. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7511. Available values are:
  7512. @table @samp
  7513. @item none
  7514. No forced calculation.
  7515. @item pcn
  7516. Force p/c/n calculations.
  7517. @item pcnub
  7518. Force p/c/n/u/b calculations.
  7519. @end table
  7520. Default value is @var{none}.
  7521. @item cthresh
  7522. This is the area combing threshold used for combed frame detection. This
  7523. essentially controls how "strong" or "visible" combing must be to be detected.
  7524. Larger values mean combing must be more visible and smaller values mean combing
  7525. can be less visible or strong and still be detected. Valid settings are from
  7526. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7527. be detected as combed). This is basically a pixel difference value. A good
  7528. range is @code{[8, 12]}.
  7529. Default value is @code{9}.
  7530. @item chroma
  7531. Sets whether or not chroma is considered in the combed frame decision. Only
  7532. disable this if your source has chroma problems (rainbowing, etc.) that are
  7533. causing problems for the combed frame detection with chroma enabled. Actually,
  7534. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7535. where there is chroma only combing in the source.
  7536. Default value is @code{0}.
  7537. @item blockx
  7538. @item blocky
  7539. Respectively set the x-axis and y-axis size of the window used during combed
  7540. frame detection. This has to do with the size of the area in which
  7541. @option{combpel} pixels are required to be detected as combed for a frame to be
  7542. declared combed. See the @option{combpel} parameter description for more info.
  7543. Possible values are any number that is a power of 2 starting at 4 and going up
  7544. to 512.
  7545. Default value is @code{16}.
  7546. @item combpel
  7547. The number of combed pixels inside any of the @option{blocky} by
  7548. @option{blockx} size blocks on the frame for the frame to be detected as
  7549. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7550. setting controls "how much" combing there must be in any localized area (a
  7551. window defined by the @option{blockx} and @option{blocky} settings) on the
  7552. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7553. which point no frames will ever be detected as combed). This setting is known
  7554. as @option{MI} in TFM/VFM vocabulary.
  7555. Default value is @code{80}.
  7556. @end table
  7557. @anchor{p/c/n/u/b meaning}
  7558. @subsection p/c/n/u/b meaning
  7559. @subsubsection p/c/n
  7560. We assume the following telecined stream:
  7561. @example
  7562. Top fields: 1 2 2 3 4
  7563. Bottom fields: 1 2 3 4 4
  7564. @end example
  7565. The numbers correspond to the progressive frame the fields relate to. Here, the
  7566. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7567. When @code{fieldmatch} is configured to run a matching from bottom
  7568. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7569. @example
  7570. Input stream:
  7571. T 1 2 2 3 4
  7572. B 1 2 3 4 4 <-- matching reference
  7573. Matches: c c n n c
  7574. Output stream:
  7575. T 1 2 3 4 4
  7576. B 1 2 3 4 4
  7577. @end example
  7578. As a result of the field matching, we can see that some frames get duplicated.
  7579. To perform a complete inverse telecine, you need to rely on a decimation filter
  7580. after this operation. See for instance the @ref{decimate} filter.
  7581. The same operation now matching from top fields (@option{field}=@var{top})
  7582. looks like this:
  7583. @example
  7584. Input stream:
  7585. T 1 2 2 3 4 <-- matching reference
  7586. B 1 2 3 4 4
  7587. Matches: c c p p c
  7588. Output stream:
  7589. T 1 2 2 3 4
  7590. B 1 2 2 3 4
  7591. @end example
  7592. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7593. basically, they refer to the frame and field of the opposite parity:
  7594. @itemize
  7595. @item @var{p} matches the field of the opposite parity in the previous frame
  7596. @item @var{c} matches the field of the opposite parity in the current frame
  7597. @item @var{n} matches the field of the opposite parity in the next frame
  7598. @end itemize
  7599. @subsubsection u/b
  7600. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7601. from the opposite parity flag. In the following examples, we assume that we are
  7602. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7603. 'x' is placed above and below each matched fields.
  7604. With bottom matching (@option{field}=@var{bottom}):
  7605. @example
  7606. Match: c p n b u
  7607. x x x x x
  7608. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7609. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7610. x x x x x
  7611. Output frames:
  7612. 2 1 2 2 2
  7613. 2 2 2 1 3
  7614. @end example
  7615. With top matching (@option{field}=@var{top}):
  7616. @example
  7617. Match: c p n b u
  7618. x x x x x
  7619. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7620. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7621. x x x x x
  7622. Output frames:
  7623. 2 2 2 1 2
  7624. 2 1 3 2 2
  7625. @end example
  7626. @subsection Examples
  7627. Simple IVTC of a top field first telecined stream:
  7628. @example
  7629. fieldmatch=order=tff:combmatch=none, decimate
  7630. @end example
  7631. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7632. @example
  7633. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7634. @end example
  7635. @section fieldorder
  7636. Transform the field order of the input video.
  7637. It accepts the following parameters:
  7638. @table @option
  7639. @item order
  7640. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7641. for bottom field first.
  7642. @end table
  7643. The default value is @samp{tff}.
  7644. The transformation is done by shifting the picture content up or down
  7645. by one line, and filling the remaining line with appropriate picture content.
  7646. This method is consistent with most broadcast field order converters.
  7647. If the input video is not flagged as being interlaced, or it is already
  7648. flagged as being of the required output field order, then this filter does
  7649. not alter the incoming video.
  7650. It is very useful when converting to or from PAL DV material,
  7651. which is bottom field first.
  7652. For example:
  7653. @example
  7654. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7655. @end example
  7656. @section fifo, afifo
  7657. Buffer input images and send them when they are requested.
  7658. It is mainly useful when auto-inserted by the libavfilter
  7659. framework.
  7660. It does not take parameters.
  7661. @section fillborders
  7662. Fill borders of the input video, without changing video stream dimensions.
  7663. Sometimes video can have garbage at the four edges and you may not want to
  7664. crop video input to keep size multiple of some number.
  7665. This filter accepts the following options:
  7666. @table @option
  7667. @item left
  7668. Number of pixels to fill from left border.
  7669. @item right
  7670. Number of pixels to fill from right border.
  7671. @item top
  7672. Number of pixels to fill from top border.
  7673. @item bottom
  7674. Number of pixels to fill from bottom border.
  7675. @item mode
  7676. Set fill mode.
  7677. It accepts the following values:
  7678. @table @samp
  7679. @item smear
  7680. fill pixels using outermost pixels
  7681. @item mirror
  7682. fill pixels using mirroring
  7683. @item fixed
  7684. fill pixels with constant value
  7685. @end table
  7686. Default is @var{smear}.
  7687. @item color
  7688. Set color for pixels in fixed mode. Default is @var{black}.
  7689. @end table
  7690. @section find_rect
  7691. Find a rectangular object
  7692. It accepts the following options:
  7693. @table @option
  7694. @item object
  7695. Filepath of the object image, needs to be in gray8.
  7696. @item threshold
  7697. Detection threshold, default is 0.5.
  7698. @item mipmaps
  7699. Number of mipmaps, default is 3.
  7700. @item xmin, ymin, xmax, ymax
  7701. Specifies the rectangle in which to search.
  7702. @end table
  7703. @subsection Examples
  7704. @itemize
  7705. @item
  7706. Generate a representative palette of a given video using @command{ffmpeg}:
  7707. @example
  7708. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7709. @end example
  7710. @end itemize
  7711. @section cover_rect
  7712. Cover a rectangular object
  7713. It accepts the following options:
  7714. @table @option
  7715. @item cover
  7716. Filepath of the optional cover image, needs to be in yuv420.
  7717. @item mode
  7718. Set covering mode.
  7719. It accepts the following values:
  7720. @table @samp
  7721. @item cover
  7722. cover it by the supplied image
  7723. @item blur
  7724. cover it by interpolating the surrounding pixels
  7725. @end table
  7726. Default value is @var{blur}.
  7727. @end table
  7728. @subsection Examples
  7729. @itemize
  7730. @item
  7731. Generate a representative palette of a given video using @command{ffmpeg}:
  7732. @example
  7733. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7734. @end example
  7735. @end itemize
  7736. @section floodfill
  7737. Flood area with values of same pixel components with another values.
  7738. It accepts the following options:
  7739. @table @option
  7740. @item x
  7741. Set pixel x coordinate.
  7742. @item y
  7743. Set pixel y coordinate.
  7744. @item s0
  7745. Set source #0 component value.
  7746. @item s1
  7747. Set source #1 component value.
  7748. @item s2
  7749. Set source #2 component value.
  7750. @item s3
  7751. Set source #3 component value.
  7752. @item d0
  7753. Set destination #0 component value.
  7754. @item d1
  7755. Set destination #1 component value.
  7756. @item d2
  7757. Set destination #2 component value.
  7758. @item d3
  7759. Set destination #3 component value.
  7760. @end table
  7761. @anchor{format}
  7762. @section format
  7763. Convert the input video to one of the specified pixel formats.
  7764. Libavfilter will try to pick one that is suitable as input to
  7765. the next filter.
  7766. It accepts the following parameters:
  7767. @table @option
  7768. @item pix_fmts
  7769. A '|'-separated list of pixel format names, such as
  7770. "pix_fmts=yuv420p|monow|rgb24".
  7771. @end table
  7772. @subsection Examples
  7773. @itemize
  7774. @item
  7775. Convert the input video to the @var{yuv420p} format
  7776. @example
  7777. format=pix_fmts=yuv420p
  7778. @end example
  7779. Convert the input video to any of the formats in the list
  7780. @example
  7781. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7782. @end example
  7783. @end itemize
  7784. @anchor{fps}
  7785. @section fps
  7786. Convert the video to specified constant frame rate by duplicating or dropping
  7787. frames as necessary.
  7788. It accepts the following parameters:
  7789. @table @option
  7790. @item fps
  7791. The desired output frame rate. The default is @code{25}.
  7792. @item start_time
  7793. Assume the first PTS should be the given value, in seconds. This allows for
  7794. padding/trimming at the start of stream. By default, no assumption is made
  7795. about the first frame's expected PTS, so no padding or trimming is done.
  7796. For example, this could be set to 0 to pad the beginning with duplicates of
  7797. the first frame if a video stream starts after the audio stream or to trim any
  7798. frames with a negative PTS.
  7799. @item round
  7800. Timestamp (PTS) rounding method.
  7801. Possible values are:
  7802. @table @option
  7803. @item zero
  7804. round towards 0
  7805. @item inf
  7806. round away from 0
  7807. @item down
  7808. round towards -infinity
  7809. @item up
  7810. round towards +infinity
  7811. @item near
  7812. round to nearest
  7813. @end table
  7814. The default is @code{near}.
  7815. @item eof_action
  7816. Action performed when reading the last frame.
  7817. Possible values are:
  7818. @table @option
  7819. @item round
  7820. Use same timestamp rounding method as used for other frames.
  7821. @item pass
  7822. Pass through last frame if input duration has not been reached yet.
  7823. @end table
  7824. The default is @code{round}.
  7825. @end table
  7826. Alternatively, the options can be specified as a flat string:
  7827. @var{fps}[:@var{start_time}[:@var{round}]].
  7828. See also the @ref{setpts} filter.
  7829. @subsection Examples
  7830. @itemize
  7831. @item
  7832. A typical usage in order to set the fps to 25:
  7833. @example
  7834. fps=fps=25
  7835. @end example
  7836. @item
  7837. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7838. @example
  7839. fps=fps=film:round=near
  7840. @end example
  7841. @end itemize
  7842. @section framepack
  7843. Pack two different video streams into a stereoscopic video, setting proper
  7844. metadata on supported codecs. The two views should have the same size and
  7845. framerate and processing will stop when the shorter video ends. Please note
  7846. that you may conveniently adjust view properties with the @ref{scale} and
  7847. @ref{fps} filters.
  7848. It accepts the following parameters:
  7849. @table @option
  7850. @item format
  7851. The desired packing format. Supported values are:
  7852. @table @option
  7853. @item sbs
  7854. The views are next to each other (default).
  7855. @item tab
  7856. The views are on top of each other.
  7857. @item lines
  7858. The views are packed by line.
  7859. @item columns
  7860. The views are packed by column.
  7861. @item frameseq
  7862. The views are temporally interleaved.
  7863. @end table
  7864. @end table
  7865. Some examples:
  7866. @example
  7867. # Convert left and right views into a frame-sequential video
  7868. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7869. # Convert views into a side-by-side video with the same output resolution as the input
  7870. 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
  7871. @end example
  7872. @section framerate
  7873. Change the frame rate by interpolating new video output frames from the source
  7874. frames.
  7875. This filter is not designed to function correctly with interlaced media. If
  7876. you wish to change the frame rate of interlaced media then you are required
  7877. to deinterlace before this filter and re-interlace after this filter.
  7878. A description of the accepted options follows.
  7879. @table @option
  7880. @item fps
  7881. Specify the output frames per second. This option can also be specified
  7882. as a value alone. The default is @code{50}.
  7883. @item interp_start
  7884. Specify the start of a range where the output frame will be created as a
  7885. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7886. the default is @code{15}.
  7887. @item interp_end
  7888. Specify the end of a range where the output frame will be created as a
  7889. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7890. the default is @code{240}.
  7891. @item scene
  7892. Specify the level at which a scene change is detected as a value between
  7893. 0 and 100 to indicate a new scene; a low value reflects a low
  7894. probability for the current frame to introduce a new scene, while a higher
  7895. value means the current frame is more likely to be one.
  7896. The default is @code{8.2}.
  7897. @item flags
  7898. Specify flags influencing the filter process.
  7899. Available value for @var{flags} is:
  7900. @table @option
  7901. @item scene_change_detect, scd
  7902. Enable scene change detection using the value of the option @var{scene}.
  7903. This flag is enabled by default.
  7904. @end table
  7905. @end table
  7906. @section framestep
  7907. Select one frame every N-th frame.
  7908. This filter accepts the following option:
  7909. @table @option
  7910. @item step
  7911. Select frame after every @code{step} frames.
  7912. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7913. @end table
  7914. @section freezedetect
  7915. Detect frozen video.
  7916. This filter logs a message and sets frame metadata when it detects that the
  7917. input video has no significant change in content during a specified duration.
  7918. Video freeze detection calculates the mean average absolute difference of all
  7919. the components of video frames and compares it to a noise floor.
  7920. The printed times and duration are expressed in seconds. The
  7921. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7922. whose timestamp equals or exceeds the detection duration and it contains the
  7923. timestamp of the first frame of the freeze. The
  7924. @code{lavfi.freezedetect.freeze_duration} and
  7925. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7926. after the freeze.
  7927. The filter accepts the following options:
  7928. @table @option
  7929. @item noise, n
  7930. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7931. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7932. 0.001.
  7933. @item duration, d
  7934. Set freeze duration until notification (default is 2 seconds).
  7935. @end table
  7936. @anchor{frei0r}
  7937. @section frei0r
  7938. Apply a frei0r effect to the input video.
  7939. To enable the compilation of this filter, you need to install the frei0r
  7940. header and configure FFmpeg with @code{--enable-frei0r}.
  7941. It accepts the following parameters:
  7942. @table @option
  7943. @item filter_name
  7944. The name of the frei0r effect to load. If the environment variable
  7945. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7946. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7947. Otherwise, the standard frei0r paths are searched, in this order:
  7948. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7949. @file{/usr/lib/frei0r-1/}.
  7950. @item filter_params
  7951. A '|'-separated list of parameters to pass to the frei0r effect.
  7952. @end table
  7953. A frei0r effect parameter can be a boolean (its value is either
  7954. "y" or "n"), a double, a color (specified as
  7955. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7956. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7957. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7958. a position (specified as @var{X}/@var{Y}, where
  7959. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7960. The number and types of parameters depend on the loaded effect. If an
  7961. effect parameter is not specified, the default value is set.
  7962. @subsection Examples
  7963. @itemize
  7964. @item
  7965. Apply the distort0r effect, setting the first two double parameters:
  7966. @example
  7967. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7968. @end example
  7969. @item
  7970. Apply the colordistance effect, taking a color as the first parameter:
  7971. @example
  7972. frei0r=colordistance:0.2/0.3/0.4
  7973. frei0r=colordistance:violet
  7974. frei0r=colordistance:0x112233
  7975. @end example
  7976. @item
  7977. Apply the perspective effect, specifying the top left and top right image
  7978. positions:
  7979. @example
  7980. frei0r=perspective:0.2/0.2|0.8/0.2
  7981. @end example
  7982. @end itemize
  7983. For more information, see
  7984. @url{http://frei0r.dyne.org}
  7985. @section fspp
  7986. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7987. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7988. processing filter, one of them is performed once per block, not per pixel.
  7989. This allows for much higher speed.
  7990. The filter accepts the following options:
  7991. @table @option
  7992. @item quality
  7993. Set quality. This option defines the number of levels for averaging. It accepts
  7994. an integer in the range 4-5. Default value is @code{4}.
  7995. @item qp
  7996. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7997. If not set, the filter will use the QP from the video stream (if available).
  7998. @item strength
  7999. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8000. more details but also more artifacts, while higher values make the image smoother
  8001. but also blurrier. Default value is @code{0} − PSNR optimal.
  8002. @item use_bframe_qp
  8003. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8004. option may cause flicker since the B-Frames have often larger QP. Default is
  8005. @code{0} (not enabled).
  8006. @end table
  8007. @section gblur
  8008. Apply Gaussian blur filter.
  8009. The filter accepts the following options:
  8010. @table @option
  8011. @item sigma
  8012. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8013. @item steps
  8014. Set number of steps for Gaussian approximation. Default is @code{1}.
  8015. @item planes
  8016. Set which planes to filter. By default all planes are filtered.
  8017. @item sigmaV
  8018. Set vertical sigma, if negative it will be same as @code{sigma}.
  8019. Default is @code{-1}.
  8020. @end table
  8021. @section geq
  8022. Apply generic equation to each pixel.
  8023. The filter accepts the following options:
  8024. @table @option
  8025. @item lum_expr, lum
  8026. Set the luminance expression.
  8027. @item cb_expr, cb
  8028. Set the chrominance blue expression.
  8029. @item cr_expr, cr
  8030. Set the chrominance red expression.
  8031. @item alpha_expr, a
  8032. Set the alpha expression.
  8033. @item red_expr, r
  8034. Set the red expression.
  8035. @item green_expr, g
  8036. Set the green expression.
  8037. @item blue_expr, b
  8038. Set the blue expression.
  8039. @end table
  8040. The colorspace is selected according to the specified options. If one
  8041. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8042. options is specified, the filter will automatically select a YCbCr
  8043. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8044. @option{blue_expr} options is specified, it will select an RGB
  8045. colorspace.
  8046. If one of the chrominance expression is not defined, it falls back on the other
  8047. one. If no alpha expression is specified it will evaluate to opaque value.
  8048. If none of chrominance expressions are specified, they will evaluate
  8049. to the luminance expression.
  8050. The expressions can use the following variables and functions:
  8051. @table @option
  8052. @item N
  8053. The sequential number of the filtered frame, starting from @code{0}.
  8054. @item X
  8055. @item Y
  8056. The coordinates of the current sample.
  8057. @item W
  8058. @item H
  8059. The width and height of the image.
  8060. @item SW
  8061. @item SH
  8062. Width and height scale depending on the currently filtered plane. It is the
  8063. ratio between the corresponding luma plane number of pixels and the current
  8064. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8065. @code{0.5,0.5} for chroma planes.
  8066. @item T
  8067. Time of the current frame, expressed in seconds.
  8068. @item p(x, y)
  8069. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8070. plane.
  8071. @item lum(x, y)
  8072. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8073. plane.
  8074. @item cb(x, y)
  8075. Return the value of the pixel at location (@var{x},@var{y}) of the
  8076. blue-difference chroma plane. Return 0 if there is no such plane.
  8077. @item cr(x, y)
  8078. Return the value of the pixel at location (@var{x},@var{y}) of the
  8079. red-difference chroma plane. Return 0 if there is no such plane.
  8080. @item r(x, y)
  8081. @item g(x, y)
  8082. @item b(x, y)
  8083. Return the value of the pixel at location (@var{x},@var{y}) of the
  8084. red/green/blue component. Return 0 if there is no such component.
  8085. @item alpha(x, y)
  8086. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8087. plane. Return 0 if there is no such plane.
  8088. @end table
  8089. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8090. automatically clipped to the closer edge.
  8091. @subsection Examples
  8092. @itemize
  8093. @item
  8094. Flip the image horizontally:
  8095. @example
  8096. geq=p(W-X\,Y)
  8097. @end example
  8098. @item
  8099. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8100. wavelength of 100 pixels:
  8101. @example
  8102. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8103. @end example
  8104. @item
  8105. Generate a fancy enigmatic moving light:
  8106. @example
  8107. 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
  8108. @end example
  8109. @item
  8110. Generate a quick emboss effect:
  8111. @example
  8112. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8113. @end example
  8114. @item
  8115. Modify RGB components depending on pixel position:
  8116. @example
  8117. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8118. @end example
  8119. @item
  8120. Create a radial gradient that is the same size as the input (also see
  8121. the @ref{vignette} filter):
  8122. @example
  8123. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8124. @end example
  8125. @end itemize
  8126. @section gradfun
  8127. Fix the banding artifacts that are sometimes introduced into nearly flat
  8128. regions by truncation to 8-bit color depth.
  8129. Interpolate the gradients that should go where the bands are, and
  8130. dither them.
  8131. It is designed for playback only. Do not use it prior to
  8132. lossy compression, because compression tends to lose the dither and
  8133. bring back the bands.
  8134. It accepts the following parameters:
  8135. @table @option
  8136. @item strength
  8137. The maximum amount by which the filter will change any one pixel. This is also
  8138. the threshold for detecting nearly flat regions. Acceptable values range from
  8139. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8140. valid range.
  8141. @item radius
  8142. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8143. gradients, but also prevents the filter from modifying the pixels near detailed
  8144. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8145. values will be clipped to the valid range.
  8146. @end table
  8147. Alternatively, the options can be specified as a flat string:
  8148. @var{strength}[:@var{radius}]
  8149. @subsection Examples
  8150. @itemize
  8151. @item
  8152. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8153. @example
  8154. gradfun=3.5:8
  8155. @end example
  8156. @item
  8157. Specify radius, omitting the strength (which will fall-back to the default
  8158. value):
  8159. @example
  8160. gradfun=radius=8
  8161. @end example
  8162. @end itemize
  8163. @section graphmonitor, agraphmonitor
  8164. Show various filtergraph stats.
  8165. With this filter one can debug complete filtergraph.
  8166. Especially issues with links filling with queued frames.
  8167. The filter accepts the following options:
  8168. @table @option
  8169. @item size, s
  8170. Set video output size. Default is @var{hd720}.
  8171. @item opacity, o
  8172. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8173. @item mode, m
  8174. Set output mode, can be @var{fulll} or @var{compact}.
  8175. In @var{compact} mode only filters with some queued frames have displayed stats.
  8176. @item flags, f
  8177. Set flags which enable which stats are shown in video.
  8178. Available values for flags are:
  8179. @table @samp
  8180. @item queue
  8181. Display number of queued frames in each link.
  8182. @item frame_count_in
  8183. Display number of frames taken from filter.
  8184. @item frame_count_out
  8185. Display number of frames given out from filter.
  8186. @item pts
  8187. Display current filtered frame pts.
  8188. @item time
  8189. Display current filtered frame time.
  8190. @item timebase
  8191. Display time base for filter link.
  8192. @item format
  8193. Display used format for filter link.
  8194. @item size
  8195. Display video size or number of audio channels in case of audio used by filter link.
  8196. @item rate
  8197. Display video frame rate or sample rate in case of audio used by filter link.
  8198. @end table
  8199. @item rate, r
  8200. Set upper limit for video rate of output stream, Default value is @var{25}.
  8201. This guarantee that output video frame rate will not be higher than this value.
  8202. @end table
  8203. @section greyedge
  8204. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8205. and corrects the scene colors accordingly.
  8206. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8207. The filter accepts the following options:
  8208. @table @option
  8209. @item difford
  8210. The order of differentiation to be applied on the scene. Must be chosen in the range
  8211. [0,2] and default value is 1.
  8212. @item minknorm
  8213. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8214. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8215. max value instead of calculating Minkowski distance.
  8216. @item sigma
  8217. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8218. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8219. can't be equal to 0 if @var{difford} is greater than 0.
  8220. @end table
  8221. @subsection Examples
  8222. @itemize
  8223. @item
  8224. Grey Edge:
  8225. @example
  8226. greyedge=difford=1:minknorm=5:sigma=2
  8227. @end example
  8228. @item
  8229. Max Edge:
  8230. @example
  8231. greyedge=difford=1:minknorm=0:sigma=2
  8232. @end example
  8233. @end itemize
  8234. @anchor{haldclut}
  8235. @section haldclut
  8236. Apply a Hald CLUT to a video stream.
  8237. First input is the video stream to process, and second one is the Hald CLUT.
  8238. The Hald CLUT input can be a simple picture or a complete video stream.
  8239. The filter accepts the following options:
  8240. @table @option
  8241. @item shortest
  8242. Force termination when the shortest input terminates. Default is @code{0}.
  8243. @item repeatlast
  8244. Continue applying the last CLUT after the end of the stream. A value of
  8245. @code{0} disable the filter after the last frame of the CLUT is reached.
  8246. Default is @code{1}.
  8247. @end table
  8248. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8249. filters share the same internals).
  8250. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8251. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8252. @subsection Workflow examples
  8253. @subsubsection Hald CLUT video stream
  8254. Generate an identity Hald CLUT stream altered with various effects:
  8255. @example
  8256. 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
  8257. @end example
  8258. Note: make sure you use a lossless codec.
  8259. Then use it with @code{haldclut} to apply it on some random stream:
  8260. @example
  8261. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8262. @end example
  8263. The Hald CLUT will be applied to the 10 first seconds (duration of
  8264. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8265. to the remaining frames of the @code{mandelbrot} stream.
  8266. @subsubsection Hald CLUT with preview
  8267. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8268. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8269. biggest possible square starting at the top left of the picture. The remaining
  8270. padding pixels (bottom or right) will be ignored. This area can be used to add
  8271. a preview of the Hald CLUT.
  8272. Typically, the following generated Hald CLUT will be supported by the
  8273. @code{haldclut} filter:
  8274. @example
  8275. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8276. pad=iw+320 [padded_clut];
  8277. smptebars=s=320x256, split [a][b];
  8278. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8279. [main][b] overlay=W-320" -frames:v 1 clut.png
  8280. @end example
  8281. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8282. bars are displayed on the right-top, and below the same color bars processed by
  8283. the color changes.
  8284. Then, the effect of this Hald CLUT can be visualized with:
  8285. @example
  8286. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8287. @end example
  8288. @section hflip
  8289. Flip the input video horizontally.
  8290. For example, to horizontally flip the input video with @command{ffmpeg}:
  8291. @example
  8292. ffmpeg -i in.avi -vf "hflip" out.avi
  8293. @end example
  8294. @section histeq
  8295. This filter applies a global color histogram equalization on a
  8296. per-frame basis.
  8297. It can be used to correct video that has a compressed range of pixel
  8298. intensities. The filter redistributes the pixel intensities to
  8299. equalize their distribution across the intensity range. It may be
  8300. viewed as an "automatically adjusting contrast filter". This filter is
  8301. useful only for correcting degraded or poorly captured source
  8302. video.
  8303. The filter accepts the following options:
  8304. @table @option
  8305. @item strength
  8306. Determine the amount of equalization to be applied. As the strength
  8307. is reduced, the distribution of pixel intensities more-and-more
  8308. approaches that of the input frame. The value must be a float number
  8309. in the range [0,1] and defaults to 0.200.
  8310. @item intensity
  8311. Set the maximum intensity that can generated and scale the output
  8312. values appropriately. The strength should be set as desired and then
  8313. the intensity can be limited if needed to avoid washing-out. The value
  8314. must be a float number in the range [0,1] and defaults to 0.210.
  8315. @item antibanding
  8316. Set the antibanding level. If enabled the filter will randomly vary
  8317. the luminance of output pixels by a small amount to avoid banding of
  8318. the histogram. Possible values are @code{none}, @code{weak} or
  8319. @code{strong}. It defaults to @code{none}.
  8320. @end table
  8321. @section histogram
  8322. Compute and draw a color distribution histogram for the input video.
  8323. The computed histogram is a representation of the color component
  8324. distribution in an image.
  8325. Standard histogram displays the color components distribution in an image.
  8326. Displays color graph for each color component. Shows distribution of
  8327. the Y, U, V, A or R, G, B components, depending on input format, in the
  8328. current frame. Below each graph a color component scale meter is shown.
  8329. The filter accepts the following options:
  8330. @table @option
  8331. @item level_height
  8332. Set height of level. Default value is @code{200}.
  8333. Allowed range is [50, 2048].
  8334. @item scale_height
  8335. Set height of color scale. Default value is @code{12}.
  8336. Allowed range is [0, 40].
  8337. @item display_mode
  8338. Set display mode.
  8339. It accepts the following values:
  8340. @table @samp
  8341. @item stack
  8342. Per color component graphs are placed below each other.
  8343. @item parade
  8344. Per color component graphs are placed side by side.
  8345. @item overlay
  8346. Presents information identical to that in the @code{parade}, except
  8347. that the graphs representing color components are superimposed directly
  8348. over one another.
  8349. @end table
  8350. Default is @code{stack}.
  8351. @item levels_mode
  8352. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8353. Default is @code{linear}.
  8354. @item components
  8355. Set what color components to display.
  8356. Default is @code{7}.
  8357. @item fgopacity
  8358. Set foreground opacity. Default is @code{0.7}.
  8359. @item bgopacity
  8360. Set background opacity. Default is @code{0.5}.
  8361. @end table
  8362. @subsection Examples
  8363. @itemize
  8364. @item
  8365. Calculate and draw histogram:
  8366. @example
  8367. ffplay -i input -vf histogram
  8368. @end example
  8369. @end itemize
  8370. @anchor{hqdn3d}
  8371. @section hqdn3d
  8372. This is a high precision/quality 3d denoise filter. It aims to reduce
  8373. image noise, producing smooth images and making still images really
  8374. still. It should enhance compressibility.
  8375. It accepts the following optional parameters:
  8376. @table @option
  8377. @item luma_spatial
  8378. A non-negative floating point number which specifies spatial luma strength.
  8379. It defaults to 4.0.
  8380. @item chroma_spatial
  8381. A non-negative floating point number which specifies spatial chroma strength.
  8382. It defaults to 3.0*@var{luma_spatial}/4.0.
  8383. @item luma_tmp
  8384. A floating point number which specifies luma temporal strength. It defaults to
  8385. 6.0*@var{luma_spatial}/4.0.
  8386. @item chroma_tmp
  8387. A floating point number which specifies chroma temporal strength. It defaults to
  8388. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8389. @end table
  8390. @anchor{hwdownload}
  8391. @section hwdownload
  8392. Download hardware frames to system memory.
  8393. The input must be in hardware frames, and the output a non-hardware format.
  8394. Not all formats will be supported on the output - it may be necessary to insert
  8395. an additional @option{format} filter immediately following in the graph to get
  8396. the output in a supported format.
  8397. @section hwmap
  8398. Map hardware frames to system memory or to another device.
  8399. This filter has several different modes of operation; which one is used depends
  8400. on the input and output formats:
  8401. @itemize
  8402. @item
  8403. Hardware frame input, normal frame output
  8404. Map the input frames to system memory and pass them to the output. If the
  8405. original hardware frame is later required (for example, after overlaying
  8406. something else on part of it), the @option{hwmap} filter can be used again
  8407. in the next mode to retrieve it.
  8408. @item
  8409. Normal frame input, hardware frame output
  8410. If the input is actually a software-mapped hardware frame, then unmap it -
  8411. that is, return the original hardware frame.
  8412. Otherwise, a device must be provided. Create new hardware surfaces on that
  8413. device for the output, then map them back to the software format at the input
  8414. and give those frames to the preceding filter. This will then act like the
  8415. @option{hwupload} filter, but may be able to avoid an additional copy when
  8416. the input is already in a compatible format.
  8417. @item
  8418. Hardware frame input and output
  8419. A device must be supplied for the output, either directly or with the
  8420. @option{derive_device} option. The input and output devices must be of
  8421. different types and compatible - the exact meaning of this is
  8422. system-dependent, but typically it means that they must refer to the same
  8423. underlying hardware context (for example, refer to the same graphics card).
  8424. If the input frames were originally created on the output device, then unmap
  8425. to retrieve the original frames.
  8426. Otherwise, map the frames to the output device - create new hardware frames
  8427. on the output corresponding to the frames on the input.
  8428. @end itemize
  8429. The following additional parameters are accepted:
  8430. @table @option
  8431. @item mode
  8432. Set the frame mapping mode. Some combination of:
  8433. @table @var
  8434. @item read
  8435. The mapped frame should be readable.
  8436. @item write
  8437. The mapped frame should be writeable.
  8438. @item overwrite
  8439. The mapping will always overwrite the entire frame.
  8440. This may improve performance in some cases, as the original contents of the
  8441. frame need not be loaded.
  8442. @item direct
  8443. The mapping must not involve any copying.
  8444. Indirect mappings to copies of frames are created in some cases where either
  8445. direct mapping is not possible or it would have unexpected properties.
  8446. Setting this flag ensures that the mapping is direct and will fail if that is
  8447. not possible.
  8448. @end table
  8449. Defaults to @var{read+write} if not specified.
  8450. @item derive_device @var{type}
  8451. Rather than using the device supplied at initialisation, instead derive a new
  8452. device of type @var{type} from the device the input frames exist on.
  8453. @item reverse
  8454. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8455. and map them back to the source. This may be necessary in some cases where
  8456. a mapping in one direction is required but only the opposite direction is
  8457. supported by the devices being used.
  8458. This option is dangerous - it may break the preceding filter in undefined
  8459. ways if there are any additional constraints on that filter's output.
  8460. Do not use it without fully understanding the implications of its use.
  8461. @end table
  8462. @anchor{hwupload}
  8463. @section hwupload
  8464. Upload system memory frames to hardware surfaces.
  8465. The device to upload to must be supplied when the filter is initialised. If
  8466. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8467. option.
  8468. @anchor{hwupload_cuda}
  8469. @section hwupload_cuda
  8470. Upload system memory frames to a CUDA device.
  8471. It accepts the following optional parameters:
  8472. @table @option
  8473. @item device
  8474. The number of the CUDA device to use
  8475. @end table
  8476. @section hqx
  8477. Apply a high-quality magnification filter designed for pixel art. This filter
  8478. was originally created by Maxim Stepin.
  8479. It accepts the following option:
  8480. @table @option
  8481. @item n
  8482. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8483. @code{hq3x} and @code{4} for @code{hq4x}.
  8484. Default is @code{3}.
  8485. @end table
  8486. @section hstack
  8487. Stack input videos horizontally.
  8488. All streams must be of same pixel format and of same height.
  8489. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8490. to create same output.
  8491. The filter accept the following option:
  8492. @table @option
  8493. @item inputs
  8494. Set number of input streams. Default is 2.
  8495. @item shortest
  8496. If set to 1, force the output to terminate when the shortest input
  8497. terminates. Default value is 0.
  8498. @end table
  8499. @section hue
  8500. Modify the hue and/or the saturation of the input.
  8501. It accepts the following parameters:
  8502. @table @option
  8503. @item h
  8504. Specify the hue angle as a number of degrees. It accepts an expression,
  8505. and defaults to "0".
  8506. @item s
  8507. Specify the saturation in the [-10,10] range. It accepts an expression and
  8508. defaults to "1".
  8509. @item H
  8510. Specify the hue angle as a number of radians. It accepts an
  8511. expression, and defaults to "0".
  8512. @item b
  8513. Specify the brightness in the [-10,10] range. It accepts an expression and
  8514. defaults to "0".
  8515. @end table
  8516. @option{h} and @option{H} are mutually exclusive, and can't be
  8517. specified at the same time.
  8518. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8519. expressions containing the following constants:
  8520. @table @option
  8521. @item n
  8522. frame count of the input frame starting from 0
  8523. @item pts
  8524. presentation timestamp of the input frame expressed in time base units
  8525. @item r
  8526. frame rate of the input video, NAN if the input frame rate is unknown
  8527. @item t
  8528. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8529. @item tb
  8530. time base of the input video
  8531. @end table
  8532. @subsection Examples
  8533. @itemize
  8534. @item
  8535. Set the hue to 90 degrees and the saturation to 1.0:
  8536. @example
  8537. hue=h=90:s=1
  8538. @end example
  8539. @item
  8540. Same command but expressing the hue in radians:
  8541. @example
  8542. hue=H=PI/2:s=1
  8543. @end example
  8544. @item
  8545. Rotate hue and make the saturation swing between 0
  8546. and 2 over a period of 1 second:
  8547. @example
  8548. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8549. @end example
  8550. @item
  8551. Apply a 3 seconds saturation fade-in effect starting at 0:
  8552. @example
  8553. hue="s=min(t/3\,1)"
  8554. @end example
  8555. The general fade-in expression can be written as:
  8556. @example
  8557. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8558. @end example
  8559. @item
  8560. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8561. @example
  8562. hue="s=max(0\, min(1\, (8-t)/3))"
  8563. @end example
  8564. The general fade-out expression can be written as:
  8565. @example
  8566. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8567. @end example
  8568. @end itemize
  8569. @subsection Commands
  8570. This filter supports the following commands:
  8571. @table @option
  8572. @item b
  8573. @item s
  8574. @item h
  8575. @item H
  8576. Modify the hue and/or the saturation and/or brightness of the input video.
  8577. The command accepts the same syntax of the corresponding option.
  8578. If the specified expression is not valid, it is kept at its current
  8579. value.
  8580. @end table
  8581. @section hysteresis
  8582. Grow first stream into second stream by connecting components.
  8583. This makes it possible to build more robust edge masks.
  8584. This filter accepts the following options:
  8585. @table @option
  8586. @item planes
  8587. Set which planes will be processed as bitmap, unprocessed planes will be
  8588. copied from first stream.
  8589. By default value 0xf, all planes will be processed.
  8590. @item threshold
  8591. Set threshold which is used in filtering. If pixel component value is higher than
  8592. this value filter algorithm for connecting components is activated.
  8593. By default value is 0.
  8594. @end table
  8595. @section idet
  8596. Detect video interlacing type.
  8597. This filter tries to detect if the input frames are interlaced, progressive,
  8598. top or bottom field first. It will also try to detect fields that are
  8599. repeated between adjacent frames (a sign of telecine).
  8600. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8601. Multiple frame detection incorporates the classification history of previous frames.
  8602. The filter will log these metadata values:
  8603. @table @option
  8604. @item single.current_frame
  8605. Detected type of current frame using single-frame detection. One of:
  8606. ``tff'' (top field first), ``bff'' (bottom field first),
  8607. ``progressive'', or ``undetermined''
  8608. @item single.tff
  8609. Cumulative number of frames detected as top field first using single-frame detection.
  8610. @item multiple.tff
  8611. Cumulative number of frames detected as top field first using multiple-frame detection.
  8612. @item single.bff
  8613. Cumulative number of frames detected as bottom field first using single-frame detection.
  8614. @item multiple.current_frame
  8615. Detected type of current frame using multiple-frame detection. One of:
  8616. ``tff'' (top field first), ``bff'' (bottom field first),
  8617. ``progressive'', or ``undetermined''
  8618. @item multiple.bff
  8619. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8620. @item single.progressive
  8621. Cumulative number of frames detected as progressive using single-frame detection.
  8622. @item multiple.progressive
  8623. Cumulative number of frames detected as progressive using multiple-frame detection.
  8624. @item single.undetermined
  8625. Cumulative number of frames that could not be classified using single-frame detection.
  8626. @item multiple.undetermined
  8627. Cumulative number of frames that could not be classified using multiple-frame detection.
  8628. @item repeated.current_frame
  8629. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8630. @item repeated.neither
  8631. Cumulative number of frames with no repeated field.
  8632. @item repeated.top
  8633. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8634. @item repeated.bottom
  8635. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8636. @end table
  8637. The filter accepts the following options:
  8638. @table @option
  8639. @item intl_thres
  8640. Set interlacing threshold.
  8641. @item prog_thres
  8642. Set progressive threshold.
  8643. @item rep_thres
  8644. Threshold for repeated field detection.
  8645. @item half_life
  8646. Number of frames after which a given frame's contribution to the
  8647. statistics is halved (i.e., it contributes only 0.5 to its
  8648. classification). The default of 0 means that all frames seen are given
  8649. full weight of 1.0 forever.
  8650. @item analyze_interlaced_flag
  8651. When this is not 0 then idet will use the specified number of frames to determine
  8652. if the interlaced flag is accurate, it will not count undetermined frames.
  8653. If the flag is found to be accurate it will be used without any further
  8654. computations, if it is found to be inaccurate it will be cleared without any
  8655. further computations. This allows inserting the idet filter as a low computational
  8656. method to clean up the interlaced flag
  8657. @end table
  8658. @section il
  8659. Deinterleave or interleave fields.
  8660. This filter allows one to process interlaced images fields without
  8661. deinterlacing them. Deinterleaving splits the input frame into 2
  8662. fields (so called half pictures). Odd lines are moved to the top
  8663. half of the output image, even lines to the bottom half.
  8664. You can process (filter) them independently and then re-interleave them.
  8665. The filter accepts the following options:
  8666. @table @option
  8667. @item luma_mode, l
  8668. @item chroma_mode, c
  8669. @item alpha_mode, a
  8670. Available values for @var{luma_mode}, @var{chroma_mode} and
  8671. @var{alpha_mode} are:
  8672. @table @samp
  8673. @item none
  8674. Do nothing.
  8675. @item deinterleave, d
  8676. Deinterleave fields, placing one above the other.
  8677. @item interleave, i
  8678. Interleave fields. Reverse the effect of deinterleaving.
  8679. @end table
  8680. Default value is @code{none}.
  8681. @item luma_swap, ls
  8682. @item chroma_swap, cs
  8683. @item alpha_swap, as
  8684. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8685. @end table
  8686. @section inflate
  8687. Apply inflate effect to the video.
  8688. This filter replaces the pixel by the local(3x3) average by taking into account
  8689. only values higher than the pixel.
  8690. It accepts the following options:
  8691. @table @option
  8692. @item threshold0
  8693. @item threshold1
  8694. @item threshold2
  8695. @item threshold3
  8696. Limit the maximum change for each plane, default is 65535.
  8697. If 0, plane will remain unchanged.
  8698. @end table
  8699. @section interlace
  8700. Simple interlacing filter from progressive contents. This interleaves upper (or
  8701. lower) lines from odd frames with lower (or upper) lines from even frames,
  8702. halving the frame rate and preserving image height.
  8703. @example
  8704. Original Original New Frame
  8705. Frame 'j' Frame 'j+1' (tff)
  8706. ========== =========== ==================
  8707. Line 0 --------------------> Frame 'j' Line 0
  8708. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8709. Line 2 ---------------------> Frame 'j' Line 2
  8710. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8711. ... ... ...
  8712. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8713. @end example
  8714. It accepts the following optional parameters:
  8715. @table @option
  8716. @item scan
  8717. This determines whether the interlaced frame is taken from the even
  8718. (tff - default) or odd (bff) lines of the progressive frame.
  8719. @item lowpass
  8720. Vertical lowpass filter to avoid twitter interlacing and
  8721. reduce moire patterns.
  8722. @table @samp
  8723. @item 0, off
  8724. Disable vertical lowpass filter
  8725. @item 1, linear
  8726. Enable linear filter (default)
  8727. @item 2, complex
  8728. Enable complex filter. This will slightly less reduce twitter and moire
  8729. but better retain detail and subjective sharpness impression.
  8730. @end table
  8731. @end table
  8732. @section kerndeint
  8733. Deinterlace input video by applying Donald Graft's adaptive kernel
  8734. deinterling. Work on interlaced parts of a video to produce
  8735. progressive frames.
  8736. The description of the accepted parameters follows.
  8737. @table @option
  8738. @item thresh
  8739. Set the threshold which affects the filter's tolerance when
  8740. determining if a pixel line must be processed. It must be an integer
  8741. in the range [0,255] and defaults to 10. A value of 0 will result in
  8742. applying the process on every pixels.
  8743. @item map
  8744. Paint pixels exceeding the threshold value to white if set to 1.
  8745. Default is 0.
  8746. @item order
  8747. Set the fields order. Swap fields if set to 1, leave fields alone if
  8748. 0. Default is 0.
  8749. @item sharp
  8750. Enable additional sharpening if set to 1. Default is 0.
  8751. @item twoway
  8752. Enable twoway sharpening if set to 1. Default is 0.
  8753. @end table
  8754. @subsection Examples
  8755. @itemize
  8756. @item
  8757. Apply default values:
  8758. @example
  8759. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8760. @end example
  8761. @item
  8762. Enable additional sharpening:
  8763. @example
  8764. kerndeint=sharp=1
  8765. @end example
  8766. @item
  8767. Paint processed pixels in white:
  8768. @example
  8769. kerndeint=map=1
  8770. @end example
  8771. @end itemize
  8772. @section lagfun
  8773. Slowly update darker pixels.
  8774. This filter makes short flashes of light appear longer.
  8775. This filter accepts the following options:
  8776. @table @option
  8777. @item decay
  8778. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8779. @item planes
  8780. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8781. @end table
  8782. @section lenscorrection
  8783. Correct radial lens distortion
  8784. This filter can be used to correct for radial distortion as can result from the use
  8785. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8786. one can use tools available for example as part of opencv or simply trial-and-error.
  8787. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8788. and extract the k1 and k2 coefficients from the resulting matrix.
  8789. Note that effectively the same filter is available in the open-source tools Krita and
  8790. Digikam from the KDE project.
  8791. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8792. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8793. brightness distribution, so you may want to use both filters together in certain
  8794. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8795. be applied before or after lens correction.
  8796. @subsection Options
  8797. The filter accepts the following options:
  8798. @table @option
  8799. @item cx
  8800. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8801. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8802. width. Default is 0.5.
  8803. @item cy
  8804. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8805. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8806. height. Default is 0.5.
  8807. @item k1
  8808. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8809. no correction. Default is 0.
  8810. @item k2
  8811. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8812. 0 means no correction. Default is 0.
  8813. @end table
  8814. The formula that generates the correction is:
  8815. @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)
  8816. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8817. distances from the focal point in the source and target images, respectively.
  8818. @section lensfun
  8819. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8820. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8821. to apply the lens correction. The filter will load the lensfun database and
  8822. query it to find the corresponding camera and lens entries in the database. As
  8823. long as these entries can be found with the given options, the filter can
  8824. perform corrections on frames. Note that incomplete strings will result in the
  8825. filter choosing the best match with the given options, and the filter will
  8826. output the chosen camera and lens models (logged with level "info"). You must
  8827. provide the make, camera model, and lens model as they are required.
  8828. The filter accepts the following options:
  8829. @table @option
  8830. @item make
  8831. The make of the camera (for example, "Canon"). This option is required.
  8832. @item model
  8833. The model of the camera (for example, "Canon EOS 100D"). This option is
  8834. required.
  8835. @item lens_model
  8836. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8837. option is required.
  8838. @item mode
  8839. The type of correction to apply. The following values are valid options:
  8840. @table @samp
  8841. @item vignetting
  8842. Enables fixing lens vignetting.
  8843. @item geometry
  8844. Enables fixing lens geometry. This is the default.
  8845. @item subpixel
  8846. Enables fixing chromatic aberrations.
  8847. @item vig_geo
  8848. Enables fixing lens vignetting and lens geometry.
  8849. @item vig_subpixel
  8850. Enables fixing lens vignetting and chromatic aberrations.
  8851. @item distortion
  8852. Enables fixing both lens geometry and chromatic aberrations.
  8853. @item all
  8854. Enables all possible corrections.
  8855. @end table
  8856. @item focal_length
  8857. The focal length of the image/video (zoom; expected constant for video). For
  8858. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8859. range should be chosen when using that lens. Default 18.
  8860. @item aperture
  8861. The aperture of the image/video (expected constant for video). Note that
  8862. aperture is only used for vignetting correction. Default 3.5.
  8863. @item focus_distance
  8864. The focus distance of the image/video (expected constant for video). Note that
  8865. focus distance is only used for vignetting and only slightly affects the
  8866. vignetting correction process. If unknown, leave it at the default value (which
  8867. is 1000).
  8868. @item scale
  8869. The scale factor which is applied after transformation. After correction the
  8870. video is no longer necessarily rectangular. This parameter controls how much of
  8871. the resulting image is visible. The value 0 means that a value will be chosen
  8872. automatically such that there is little or no unmapped area in the output
  8873. image. 1.0 means that no additional scaling is done. Lower values may result
  8874. in more of the corrected image being visible, while higher values may avoid
  8875. unmapped areas in the output.
  8876. @item target_geometry
  8877. The target geometry of the output image/video. The following values are valid
  8878. options:
  8879. @table @samp
  8880. @item rectilinear (default)
  8881. @item fisheye
  8882. @item panoramic
  8883. @item equirectangular
  8884. @item fisheye_orthographic
  8885. @item fisheye_stereographic
  8886. @item fisheye_equisolid
  8887. @item fisheye_thoby
  8888. @end table
  8889. @item reverse
  8890. Apply the reverse of image correction (instead of correcting distortion, apply
  8891. it).
  8892. @item interpolation
  8893. The type of interpolation used when correcting distortion. The following values
  8894. are valid options:
  8895. @table @samp
  8896. @item nearest
  8897. @item linear (default)
  8898. @item lanczos
  8899. @end table
  8900. @end table
  8901. @subsection Examples
  8902. @itemize
  8903. @item
  8904. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8905. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8906. aperture of "8.0".
  8907. @example
  8908. 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
  8909. @end example
  8910. @item
  8911. Apply the same as before, but only for the first 5 seconds of video.
  8912. @example
  8913. 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
  8914. @end example
  8915. @end itemize
  8916. @section libvmaf
  8917. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8918. score between two input videos.
  8919. The obtained VMAF score is printed through the logging system.
  8920. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8921. After installing the library it can be enabled using:
  8922. @code{./configure --enable-libvmaf --enable-version3}.
  8923. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8924. The filter has following options:
  8925. @table @option
  8926. @item model_path
  8927. Set the model path which is to be used for SVM.
  8928. Default value: @code{"vmaf_v0.6.1.pkl"}
  8929. @item log_path
  8930. Set the file path to be used to store logs.
  8931. @item log_fmt
  8932. Set the format of the log file (xml or json).
  8933. @item enable_transform
  8934. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8935. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8936. Default value: @code{false}
  8937. @item phone_model
  8938. Invokes the phone model which will generate VMAF scores higher than in the
  8939. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8940. @item psnr
  8941. Enables computing psnr along with vmaf.
  8942. @item ssim
  8943. Enables computing ssim along with vmaf.
  8944. @item ms_ssim
  8945. Enables computing ms_ssim along with vmaf.
  8946. @item pool
  8947. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8948. @item n_threads
  8949. Set number of threads to be used when computing vmaf.
  8950. @item n_subsample
  8951. Set interval for frame subsampling used when computing vmaf.
  8952. @item enable_conf_interval
  8953. Enables confidence interval.
  8954. @end table
  8955. This filter also supports the @ref{framesync} options.
  8956. On the below examples the input file @file{main.mpg} being processed is
  8957. compared with the reference file @file{ref.mpg}.
  8958. @example
  8959. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8960. @end example
  8961. Example with options:
  8962. @example
  8963. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8964. @end example
  8965. @section limiter
  8966. Limits the pixel components values to the specified range [min, max].
  8967. The filter accepts the following options:
  8968. @table @option
  8969. @item min
  8970. Lower bound. Defaults to the lowest allowed value for the input.
  8971. @item max
  8972. Upper bound. Defaults to the highest allowed value for the input.
  8973. @item planes
  8974. Specify which planes will be processed. Defaults to all available.
  8975. @end table
  8976. @section loop
  8977. Loop video frames.
  8978. The filter accepts the following options:
  8979. @table @option
  8980. @item loop
  8981. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8982. Default is 0.
  8983. @item size
  8984. Set maximal size in number of frames. Default is 0.
  8985. @item start
  8986. Set first frame of loop. Default is 0.
  8987. @end table
  8988. @subsection Examples
  8989. @itemize
  8990. @item
  8991. Loop single first frame infinitely:
  8992. @example
  8993. loop=loop=-1:size=1:start=0
  8994. @end example
  8995. @item
  8996. Loop single first frame 10 times:
  8997. @example
  8998. loop=loop=10:size=1:start=0
  8999. @end example
  9000. @item
  9001. Loop 10 first frames 5 times:
  9002. @example
  9003. loop=loop=5:size=10:start=0
  9004. @end example
  9005. @end itemize
  9006. @section lut1d
  9007. Apply a 1D LUT to an input video.
  9008. The filter accepts the following options:
  9009. @table @option
  9010. @item file
  9011. Set the 1D LUT file name.
  9012. Currently supported formats:
  9013. @table @samp
  9014. @item cube
  9015. Iridas
  9016. @item csp
  9017. cineSpace
  9018. @end table
  9019. @item interp
  9020. Select interpolation mode.
  9021. Available values are:
  9022. @table @samp
  9023. @item nearest
  9024. Use values from the nearest defined point.
  9025. @item linear
  9026. Interpolate values using the linear interpolation.
  9027. @item cosine
  9028. Interpolate values using the cosine interpolation.
  9029. @item cubic
  9030. Interpolate values using the cubic interpolation.
  9031. @item spline
  9032. Interpolate values using the spline interpolation.
  9033. @end table
  9034. @end table
  9035. @anchor{lut3d}
  9036. @section lut3d
  9037. Apply a 3D LUT to an input video.
  9038. The filter accepts the following options:
  9039. @table @option
  9040. @item file
  9041. Set the 3D LUT file name.
  9042. Currently supported formats:
  9043. @table @samp
  9044. @item 3dl
  9045. AfterEffects
  9046. @item cube
  9047. Iridas
  9048. @item dat
  9049. DaVinci
  9050. @item m3d
  9051. Pandora
  9052. @item csp
  9053. cineSpace
  9054. @end table
  9055. @item interp
  9056. Select interpolation mode.
  9057. Available values are:
  9058. @table @samp
  9059. @item nearest
  9060. Use values from the nearest defined point.
  9061. @item trilinear
  9062. Interpolate values using the 8 points defining a cube.
  9063. @item tetrahedral
  9064. Interpolate values using a tetrahedron.
  9065. @end table
  9066. @end table
  9067. This filter also supports the @ref{framesync} options.
  9068. @section lumakey
  9069. Turn certain luma values into transparency.
  9070. The filter accepts the following options:
  9071. @table @option
  9072. @item threshold
  9073. Set the luma which will be used as base for transparency.
  9074. Default value is @code{0}.
  9075. @item tolerance
  9076. Set the range of luma values to be keyed out.
  9077. Default value is @code{0}.
  9078. @item softness
  9079. Set the range of softness. Default value is @code{0}.
  9080. Use this to control gradual transition from zero to full transparency.
  9081. @end table
  9082. @section lut, lutrgb, lutyuv
  9083. Compute a look-up table for binding each pixel component input value
  9084. to an output value, and apply it to the input video.
  9085. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9086. to an RGB input video.
  9087. These filters accept the following parameters:
  9088. @table @option
  9089. @item c0
  9090. set first pixel component expression
  9091. @item c1
  9092. set second pixel component expression
  9093. @item c2
  9094. set third pixel component expression
  9095. @item c3
  9096. set fourth pixel component expression, corresponds to the alpha component
  9097. @item r
  9098. set red component expression
  9099. @item g
  9100. set green component expression
  9101. @item b
  9102. set blue component expression
  9103. @item a
  9104. alpha component expression
  9105. @item y
  9106. set Y/luminance component expression
  9107. @item u
  9108. set U/Cb component expression
  9109. @item v
  9110. set V/Cr component expression
  9111. @end table
  9112. Each of them specifies the expression to use for computing the lookup table for
  9113. the corresponding pixel component values.
  9114. The exact component associated to each of the @var{c*} options depends on the
  9115. format in input.
  9116. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9117. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9118. The expressions can contain the following constants and functions:
  9119. @table @option
  9120. @item w
  9121. @item h
  9122. The input width and height.
  9123. @item val
  9124. The input value for the pixel component.
  9125. @item clipval
  9126. The input value, clipped to the @var{minval}-@var{maxval} range.
  9127. @item maxval
  9128. The maximum value for the pixel component.
  9129. @item minval
  9130. The minimum value for the pixel component.
  9131. @item negval
  9132. The negated value for the pixel component value, clipped to the
  9133. @var{minval}-@var{maxval} range; it corresponds to the expression
  9134. "maxval-clipval+minval".
  9135. @item clip(val)
  9136. The computed value in @var{val}, clipped to the
  9137. @var{minval}-@var{maxval} range.
  9138. @item gammaval(gamma)
  9139. The computed gamma correction value of the pixel component value,
  9140. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9141. expression
  9142. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9143. @end table
  9144. All expressions default to "val".
  9145. @subsection Examples
  9146. @itemize
  9147. @item
  9148. Negate input video:
  9149. @example
  9150. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9151. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9152. @end example
  9153. The above is the same as:
  9154. @example
  9155. lutrgb="r=negval:g=negval:b=negval"
  9156. lutyuv="y=negval:u=negval:v=negval"
  9157. @end example
  9158. @item
  9159. Negate luminance:
  9160. @example
  9161. lutyuv=y=negval
  9162. @end example
  9163. @item
  9164. Remove chroma components, turning the video into a graytone image:
  9165. @example
  9166. lutyuv="u=128:v=128"
  9167. @end example
  9168. @item
  9169. Apply a luma burning effect:
  9170. @example
  9171. lutyuv="y=2*val"
  9172. @end example
  9173. @item
  9174. Remove green and blue components:
  9175. @example
  9176. lutrgb="g=0:b=0"
  9177. @end example
  9178. @item
  9179. Set a constant alpha channel value on input:
  9180. @example
  9181. format=rgba,lutrgb=a="maxval-minval/2"
  9182. @end example
  9183. @item
  9184. Correct luminance gamma by a factor of 0.5:
  9185. @example
  9186. lutyuv=y=gammaval(0.5)
  9187. @end example
  9188. @item
  9189. Discard least significant bits of luma:
  9190. @example
  9191. lutyuv=y='bitand(val, 128+64+32)'
  9192. @end example
  9193. @item
  9194. Technicolor like effect:
  9195. @example
  9196. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9197. @end example
  9198. @end itemize
  9199. @section lut2, tlut2
  9200. The @code{lut2} filter takes two input streams and outputs one
  9201. stream.
  9202. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9203. from one single stream.
  9204. This filter accepts the following parameters:
  9205. @table @option
  9206. @item c0
  9207. set first pixel component expression
  9208. @item c1
  9209. set second pixel component expression
  9210. @item c2
  9211. set third pixel component expression
  9212. @item c3
  9213. set fourth pixel component expression, corresponds to the alpha component
  9214. @item d
  9215. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9216. which means bit depth is automatically picked from first input format.
  9217. @end table
  9218. Each of them specifies the expression to use for computing the lookup table for
  9219. the corresponding pixel component values.
  9220. The exact component associated to each of the @var{c*} options depends on the
  9221. format in inputs.
  9222. The expressions can contain the following constants:
  9223. @table @option
  9224. @item w
  9225. @item h
  9226. The input width and height.
  9227. @item x
  9228. The first input value for the pixel component.
  9229. @item y
  9230. The second input value for the pixel component.
  9231. @item bdx
  9232. The first input video bit depth.
  9233. @item bdy
  9234. The second input video bit depth.
  9235. @end table
  9236. All expressions default to "x".
  9237. @subsection Examples
  9238. @itemize
  9239. @item
  9240. Highlight differences between two RGB video streams:
  9241. @example
  9242. 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)'
  9243. @end example
  9244. @item
  9245. Highlight differences between two YUV video streams:
  9246. @example
  9247. 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)'
  9248. @end example
  9249. @item
  9250. Show max difference between two video streams:
  9251. @example
  9252. 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)))'
  9253. @end example
  9254. @end itemize
  9255. @section maskedclamp
  9256. Clamp the first input stream with the second input and third input stream.
  9257. Returns the value of first stream to be between second input
  9258. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9259. This filter accepts the following options:
  9260. @table @option
  9261. @item undershoot
  9262. Default value is @code{0}.
  9263. @item overshoot
  9264. Default value is @code{0}.
  9265. @item planes
  9266. Set which planes will be processed as bitmap, unprocessed planes will be
  9267. copied from first stream.
  9268. By default value 0xf, all planes will be processed.
  9269. @end table
  9270. @section maskedmerge
  9271. Merge the first input stream with the second input stream using per pixel
  9272. weights in the third input stream.
  9273. A value of 0 in the third stream pixel component means that pixel component
  9274. from first stream is returned unchanged, while maximum value (eg. 255 for
  9275. 8-bit videos) means that pixel component from second stream is returned
  9276. unchanged. Intermediate values define the amount of merging between both
  9277. input stream's pixel components.
  9278. This filter accepts the following options:
  9279. @table @option
  9280. @item planes
  9281. Set which planes will be processed as bitmap, unprocessed planes will be
  9282. copied from first stream.
  9283. By default value 0xf, all planes will be processed.
  9284. @end table
  9285. @section maskfun
  9286. Create mask from input video.
  9287. For example it is useful to create motion masks after @code{tblend} filter.
  9288. This filter accepts the following options:
  9289. @table @option
  9290. @item low
  9291. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9292. @item high
  9293. Set high threshold. Any pixel component higher than this value will be set to max value
  9294. allowed for current pixel format.
  9295. @item planes
  9296. Set planes to filter, by default all available planes are filtered.
  9297. @item fill
  9298. Fill all frame pixels with this value.
  9299. @item sum
  9300. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9301. average, output frame will be completely filled with value set by @var{fill} option.
  9302. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9303. @end table
  9304. @section mcdeint
  9305. Apply motion-compensation deinterlacing.
  9306. It needs one field per frame as input and must thus be used together
  9307. with yadif=1/3 or equivalent.
  9308. This filter accepts the following options:
  9309. @table @option
  9310. @item mode
  9311. Set the deinterlacing mode.
  9312. It accepts one of the following values:
  9313. @table @samp
  9314. @item fast
  9315. @item medium
  9316. @item slow
  9317. use iterative motion estimation
  9318. @item extra_slow
  9319. like @samp{slow}, but use multiple reference frames.
  9320. @end table
  9321. Default value is @samp{fast}.
  9322. @item parity
  9323. Set the picture field parity assumed for the input video. It must be
  9324. one of the following values:
  9325. @table @samp
  9326. @item 0, tff
  9327. assume top field first
  9328. @item 1, bff
  9329. assume bottom field first
  9330. @end table
  9331. Default value is @samp{bff}.
  9332. @item qp
  9333. Set per-block quantization parameter (QP) used by the internal
  9334. encoder.
  9335. Higher values should result in a smoother motion vector field but less
  9336. optimal individual vectors. Default value is 1.
  9337. @end table
  9338. @section mergeplanes
  9339. Merge color channel components from several video streams.
  9340. The filter accepts up to 4 input streams, and merge selected input
  9341. planes to the output video.
  9342. This filter accepts the following options:
  9343. @table @option
  9344. @item mapping
  9345. Set input to output plane mapping. Default is @code{0}.
  9346. The mappings is specified as a bitmap. It should be specified as a
  9347. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9348. mapping for the first plane of the output stream. 'A' sets the number of
  9349. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9350. corresponding input to use (from 0 to 3). The rest of the mappings is
  9351. similar, 'Bb' describes the mapping for the output stream second
  9352. plane, 'Cc' describes the mapping for the output stream third plane and
  9353. 'Dd' describes the mapping for the output stream fourth plane.
  9354. @item format
  9355. Set output pixel format. Default is @code{yuva444p}.
  9356. @end table
  9357. @subsection Examples
  9358. @itemize
  9359. @item
  9360. Merge three gray video streams of same width and height into single video stream:
  9361. @example
  9362. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9363. @end example
  9364. @item
  9365. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9366. @example
  9367. [a0][a1]mergeplanes=0x00010210:yuva444p
  9368. @end example
  9369. @item
  9370. Swap Y and A plane in yuva444p stream:
  9371. @example
  9372. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9373. @end example
  9374. @item
  9375. Swap U and V plane in yuv420p stream:
  9376. @example
  9377. format=yuv420p,mergeplanes=0x000201:yuv420p
  9378. @end example
  9379. @item
  9380. Cast a rgb24 clip to yuv444p:
  9381. @example
  9382. format=rgb24,mergeplanes=0x000102:yuv444p
  9383. @end example
  9384. @end itemize
  9385. @section mestimate
  9386. Estimate and export motion vectors using block matching algorithms.
  9387. Motion vectors are stored in frame side data to be used by other filters.
  9388. This filter accepts the following options:
  9389. @table @option
  9390. @item method
  9391. Specify the motion estimation method. Accepts one of the following values:
  9392. @table @samp
  9393. @item esa
  9394. Exhaustive search algorithm.
  9395. @item tss
  9396. Three step search algorithm.
  9397. @item tdls
  9398. Two dimensional logarithmic search algorithm.
  9399. @item ntss
  9400. New three step search algorithm.
  9401. @item fss
  9402. Four step search algorithm.
  9403. @item ds
  9404. Diamond search algorithm.
  9405. @item hexbs
  9406. Hexagon-based search algorithm.
  9407. @item epzs
  9408. Enhanced predictive zonal search algorithm.
  9409. @item umh
  9410. Uneven multi-hexagon search algorithm.
  9411. @end table
  9412. Default value is @samp{esa}.
  9413. @item mb_size
  9414. Macroblock size. Default @code{16}.
  9415. @item search_param
  9416. Search parameter. Default @code{7}.
  9417. @end table
  9418. @section midequalizer
  9419. Apply Midway Image Equalization effect using two video streams.
  9420. Midway Image Equalization adjusts a pair of images to have the same
  9421. histogram, while maintaining their dynamics as much as possible. It's
  9422. useful for e.g. matching exposures from a pair of stereo cameras.
  9423. This filter has two inputs and one output, which must be of same pixel format, but
  9424. may be of different sizes. The output of filter is first input adjusted with
  9425. midway histogram of both inputs.
  9426. This filter accepts the following option:
  9427. @table @option
  9428. @item planes
  9429. Set which planes to process. Default is @code{15}, which is all available planes.
  9430. @end table
  9431. @section minterpolate
  9432. Convert the video to specified frame rate using motion interpolation.
  9433. This filter accepts the following options:
  9434. @table @option
  9435. @item fps
  9436. 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}.
  9437. @item mi_mode
  9438. Motion interpolation mode. Following values are accepted:
  9439. @table @samp
  9440. @item dup
  9441. Duplicate previous or next frame for interpolating new ones.
  9442. @item blend
  9443. Blend source frames. Interpolated frame is mean of previous and next frames.
  9444. @item mci
  9445. Motion compensated interpolation. Following options are effective when this mode is selected:
  9446. @table @samp
  9447. @item mc_mode
  9448. Motion compensation mode. Following values are accepted:
  9449. @table @samp
  9450. @item obmc
  9451. Overlapped block motion compensation.
  9452. @item aobmc
  9453. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9454. @end table
  9455. Default mode is @samp{obmc}.
  9456. @item me_mode
  9457. Motion estimation mode. Following values are accepted:
  9458. @table @samp
  9459. @item bidir
  9460. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9461. @item bilat
  9462. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9463. @end table
  9464. Default mode is @samp{bilat}.
  9465. @item me
  9466. The algorithm to be used for motion estimation. Following values are accepted:
  9467. @table @samp
  9468. @item esa
  9469. Exhaustive search algorithm.
  9470. @item tss
  9471. Three step search algorithm.
  9472. @item tdls
  9473. Two dimensional logarithmic search algorithm.
  9474. @item ntss
  9475. New three step search algorithm.
  9476. @item fss
  9477. Four step search algorithm.
  9478. @item ds
  9479. Diamond search algorithm.
  9480. @item hexbs
  9481. Hexagon-based search algorithm.
  9482. @item epzs
  9483. Enhanced predictive zonal search algorithm.
  9484. @item umh
  9485. Uneven multi-hexagon search algorithm.
  9486. @end table
  9487. Default algorithm is @samp{epzs}.
  9488. @item mb_size
  9489. Macroblock size. Default @code{16}.
  9490. @item search_param
  9491. Motion estimation search parameter. Default @code{32}.
  9492. @item vsbmc
  9493. 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).
  9494. @end table
  9495. @end table
  9496. @item scd
  9497. 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:
  9498. @table @samp
  9499. @item none
  9500. Disable scene change detection.
  9501. @item fdiff
  9502. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9503. @end table
  9504. Default method is @samp{fdiff}.
  9505. @item scd_threshold
  9506. Scene change detection threshold. Default is @code{5.0}.
  9507. @end table
  9508. @section mix
  9509. Mix several video input streams into one video stream.
  9510. A description of the accepted options follows.
  9511. @table @option
  9512. @item nb_inputs
  9513. The number of inputs. If unspecified, it defaults to 2.
  9514. @item weights
  9515. Specify weight of each input video stream as sequence.
  9516. Each weight is separated by space. If number of weights
  9517. is smaller than number of @var{frames} last specified
  9518. weight will be used for all remaining unset weights.
  9519. @item scale
  9520. Specify scale, if it is set it will be multiplied with sum
  9521. of each weight multiplied with pixel values to give final destination
  9522. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9523. @item duration
  9524. Specify how end of stream is determined.
  9525. @table @samp
  9526. @item longest
  9527. The duration of the longest input. (default)
  9528. @item shortest
  9529. The duration of the shortest input.
  9530. @item first
  9531. The duration of the first input.
  9532. @end table
  9533. @end table
  9534. @section mpdecimate
  9535. Drop frames that do not differ greatly from the previous frame in
  9536. order to reduce frame rate.
  9537. The main use of this filter is for very-low-bitrate encoding
  9538. (e.g. streaming over dialup modem), but it could in theory be used for
  9539. fixing movies that were inverse-telecined incorrectly.
  9540. A description of the accepted options follows.
  9541. @table @option
  9542. @item max
  9543. Set the maximum number of consecutive frames which can be dropped (if
  9544. positive), or the minimum interval between dropped frames (if
  9545. negative). If the value is 0, the frame is dropped disregarding the
  9546. number of previous sequentially dropped frames.
  9547. Default value is 0.
  9548. @item hi
  9549. @item lo
  9550. @item frac
  9551. Set the dropping threshold values.
  9552. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9553. represent actual pixel value differences, so a threshold of 64
  9554. corresponds to 1 unit of difference for each pixel, or the same spread
  9555. out differently over the block.
  9556. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9557. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9558. meaning the whole image) differ by more than a threshold of @option{lo}.
  9559. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9560. 64*5, and default value for @option{frac} is 0.33.
  9561. @end table
  9562. @section negate
  9563. Negate (invert) the input video.
  9564. It accepts the following option:
  9565. @table @option
  9566. @item negate_alpha
  9567. With value 1, it negates the alpha component, if present. Default value is 0.
  9568. @end table
  9569. @anchor{nlmeans}
  9570. @section nlmeans
  9571. Denoise frames using Non-Local Means algorithm.
  9572. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9573. context similarity is defined by comparing their surrounding patches of size
  9574. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9575. around the pixel.
  9576. Note that the research area defines centers for patches, which means some
  9577. patches will be made of pixels outside that research area.
  9578. The filter accepts the following options.
  9579. @table @option
  9580. @item s
  9581. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9582. @item p
  9583. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9584. @item pc
  9585. Same as @option{p} but for chroma planes.
  9586. The default value is @var{0} and means automatic.
  9587. @item r
  9588. Set research size. Default is 15. Must be odd number in range [0, 99].
  9589. @item rc
  9590. Same as @option{r} but for chroma planes.
  9591. The default value is @var{0} and means automatic.
  9592. @end table
  9593. @section nnedi
  9594. Deinterlace video using neural network edge directed interpolation.
  9595. This filter accepts the following options:
  9596. @table @option
  9597. @item weights
  9598. Mandatory option, without binary file filter can not work.
  9599. Currently file can be found here:
  9600. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9601. @item deint
  9602. Set which frames to deinterlace, by default it is @code{all}.
  9603. Can be @code{all} or @code{interlaced}.
  9604. @item field
  9605. Set mode of operation.
  9606. Can be one of the following:
  9607. @table @samp
  9608. @item af
  9609. Use frame flags, both fields.
  9610. @item a
  9611. Use frame flags, single field.
  9612. @item t
  9613. Use top field only.
  9614. @item b
  9615. Use bottom field only.
  9616. @item tf
  9617. Use both fields, top first.
  9618. @item bf
  9619. Use both fields, bottom first.
  9620. @end table
  9621. @item planes
  9622. Set which planes to process, by default filter process all frames.
  9623. @item nsize
  9624. Set size of local neighborhood around each pixel, used by the predictor neural
  9625. network.
  9626. Can be one of the following:
  9627. @table @samp
  9628. @item s8x6
  9629. @item s16x6
  9630. @item s32x6
  9631. @item s48x6
  9632. @item s8x4
  9633. @item s16x4
  9634. @item s32x4
  9635. @end table
  9636. @item nns
  9637. Set the number of neurons in predictor neural network.
  9638. Can be one of the following:
  9639. @table @samp
  9640. @item n16
  9641. @item n32
  9642. @item n64
  9643. @item n128
  9644. @item n256
  9645. @end table
  9646. @item qual
  9647. Controls the number of different neural network predictions that are blended
  9648. together to compute the final output value. Can be @code{fast}, default or
  9649. @code{slow}.
  9650. @item etype
  9651. Set which set of weights to use in the predictor.
  9652. Can be one of the following:
  9653. @table @samp
  9654. @item a
  9655. weights trained to minimize absolute error
  9656. @item s
  9657. weights trained to minimize squared error
  9658. @end table
  9659. @item pscrn
  9660. Controls whether or not the prescreener neural network is used to decide
  9661. which pixels should be processed by the predictor neural network and which
  9662. can be handled by simple cubic interpolation.
  9663. The prescreener is trained to know whether cubic interpolation will be
  9664. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9665. The computational complexity of the prescreener nn is much less than that of
  9666. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9667. using the prescreener generally results in much faster processing.
  9668. The prescreener is pretty accurate, so the difference between using it and not
  9669. using it is almost always unnoticeable.
  9670. Can be one of the following:
  9671. @table @samp
  9672. @item none
  9673. @item original
  9674. @item new
  9675. @end table
  9676. Default is @code{new}.
  9677. @item fapprox
  9678. Set various debugging flags.
  9679. @end table
  9680. @section noformat
  9681. Force libavfilter not to use any of the specified pixel formats for the
  9682. input to the next filter.
  9683. It accepts the following parameters:
  9684. @table @option
  9685. @item pix_fmts
  9686. A '|'-separated list of pixel format names, such as
  9687. pix_fmts=yuv420p|monow|rgb24".
  9688. @end table
  9689. @subsection Examples
  9690. @itemize
  9691. @item
  9692. Force libavfilter to use a format different from @var{yuv420p} for the
  9693. input to the vflip filter:
  9694. @example
  9695. noformat=pix_fmts=yuv420p,vflip
  9696. @end example
  9697. @item
  9698. Convert the input video to any of the formats not contained in the list:
  9699. @example
  9700. noformat=yuv420p|yuv444p|yuv410p
  9701. @end example
  9702. @end itemize
  9703. @section noise
  9704. Add noise on video input frame.
  9705. The filter accepts the following options:
  9706. @table @option
  9707. @item all_seed
  9708. @item c0_seed
  9709. @item c1_seed
  9710. @item c2_seed
  9711. @item c3_seed
  9712. Set noise seed for specific pixel component or all pixel components in case
  9713. of @var{all_seed}. Default value is @code{123457}.
  9714. @item all_strength, alls
  9715. @item c0_strength, c0s
  9716. @item c1_strength, c1s
  9717. @item c2_strength, c2s
  9718. @item c3_strength, c3s
  9719. Set noise strength for specific pixel component or all pixel components in case
  9720. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9721. @item all_flags, allf
  9722. @item c0_flags, c0f
  9723. @item c1_flags, c1f
  9724. @item c2_flags, c2f
  9725. @item c3_flags, c3f
  9726. Set pixel component flags or set flags for all components if @var{all_flags}.
  9727. Available values for component flags are:
  9728. @table @samp
  9729. @item a
  9730. averaged temporal noise (smoother)
  9731. @item p
  9732. mix random noise with a (semi)regular pattern
  9733. @item t
  9734. temporal noise (noise pattern changes between frames)
  9735. @item u
  9736. uniform noise (gaussian otherwise)
  9737. @end table
  9738. @end table
  9739. @subsection Examples
  9740. Add temporal and uniform noise to input video:
  9741. @example
  9742. noise=alls=20:allf=t+u
  9743. @end example
  9744. @section normalize
  9745. Normalize RGB video (aka histogram stretching, contrast stretching).
  9746. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9747. For each channel of each frame, the filter computes the input range and maps
  9748. it linearly to the user-specified output range. The output range defaults
  9749. to the full dynamic range from pure black to pure white.
  9750. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9751. changes in brightness) caused when small dark or bright objects enter or leave
  9752. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9753. video camera, and, like a video camera, it may cause a period of over- or
  9754. under-exposure of the video.
  9755. The R,G,B channels can be normalized independently, which may cause some
  9756. color shifting, or linked together as a single channel, which prevents
  9757. color shifting. Linked normalization preserves hue. Independent normalization
  9758. does not, so it can be used to remove some color casts. Independent and linked
  9759. normalization can be combined in any ratio.
  9760. The normalize filter accepts the following options:
  9761. @table @option
  9762. @item blackpt
  9763. @item whitept
  9764. Colors which define the output range. The minimum input value is mapped to
  9765. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9766. The defaults are black and white respectively. Specifying white for
  9767. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9768. normalized video. Shades of grey can be used to reduce the dynamic range
  9769. (contrast). Specifying saturated colors here can create some interesting
  9770. effects.
  9771. @item smoothing
  9772. The number of previous frames to use for temporal smoothing. The input range
  9773. of each channel is smoothed using a rolling average over the current frame
  9774. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9775. smoothing).
  9776. @item independence
  9777. Controls the ratio of independent (color shifting) channel normalization to
  9778. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9779. independent. Defaults to 1.0 (fully independent).
  9780. @item strength
  9781. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9782. expensive no-op. Defaults to 1.0 (full strength).
  9783. @end table
  9784. @subsection Examples
  9785. Stretch video contrast to use the full dynamic range, with no temporal
  9786. smoothing; may flicker depending on the source content:
  9787. @example
  9788. normalize=blackpt=black:whitept=white:smoothing=0
  9789. @end example
  9790. As above, but with 50 frames of temporal smoothing; flicker should be
  9791. reduced, depending on the source content:
  9792. @example
  9793. normalize=blackpt=black:whitept=white:smoothing=50
  9794. @end example
  9795. As above, but with hue-preserving linked channel normalization:
  9796. @example
  9797. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9798. @end example
  9799. As above, but with half strength:
  9800. @example
  9801. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9802. @end example
  9803. Map the darkest input color to red, the brightest input color to cyan:
  9804. @example
  9805. normalize=blackpt=red:whitept=cyan
  9806. @end example
  9807. @section null
  9808. Pass the video source unchanged to the output.
  9809. @section ocr
  9810. Optical Character Recognition
  9811. This filter uses Tesseract for optical character recognition. To enable
  9812. compilation of this filter, you need to configure FFmpeg with
  9813. @code{--enable-libtesseract}.
  9814. It accepts the following options:
  9815. @table @option
  9816. @item datapath
  9817. Set datapath to tesseract data. Default is to use whatever was
  9818. set at installation.
  9819. @item language
  9820. Set language, default is "eng".
  9821. @item whitelist
  9822. Set character whitelist.
  9823. @item blacklist
  9824. Set character blacklist.
  9825. @end table
  9826. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9827. @section ocv
  9828. Apply a video transform using libopencv.
  9829. To enable this filter, install the libopencv library and headers and
  9830. configure FFmpeg with @code{--enable-libopencv}.
  9831. It accepts the following parameters:
  9832. @table @option
  9833. @item filter_name
  9834. The name of the libopencv filter to apply.
  9835. @item filter_params
  9836. The parameters to pass to the libopencv filter. If not specified, the default
  9837. values are assumed.
  9838. @end table
  9839. Refer to the official libopencv documentation for more precise
  9840. information:
  9841. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9842. Several libopencv filters are supported; see the following subsections.
  9843. @anchor{dilate}
  9844. @subsection dilate
  9845. Dilate an image by using a specific structuring element.
  9846. It corresponds to the libopencv function @code{cvDilate}.
  9847. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9848. @var{struct_el} represents a structuring element, and has the syntax:
  9849. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9850. @var{cols} and @var{rows} represent the number of columns and rows of
  9851. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9852. point, and @var{shape} the shape for the structuring element. @var{shape}
  9853. must be "rect", "cross", "ellipse", or "custom".
  9854. If the value for @var{shape} is "custom", it must be followed by a
  9855. string of the form "=@var{filename}". The file with name
  9856. @var{filename} is assumed to represent a binary image, with each
  9857. printable character corresponding to a bright pixel. When a custom
  9858. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9859. or columns and rows of the read file are assumed instead.
  9860. The default value for @var{struct_el} is "3x3+0x0/rect".
  9861. @var{nb_iterations} specifies the number of times the transform is
  9862. applied to the image, and defaults to 1.
  9863. Some examples:
  9864. @example
  9865. # Use the default values
  9866. ocv=dilate
  9867. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9868. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9869. # Read the shape from the file diamond.shape, iterating two times.
  9870. # The file diamond.shape may contain a pattern of characters like this
  9871. # *
  9872. # ***
  9873. # *****
  9874. # ***
  9875. # *
  9876. # The specified columns and rows are ignored
  9877. # but the anchor point coordinates are not
  9878. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9879. @end example
  9880. @subsection erode
  9881. Erode an image by using a specific structuring element.
  9882. It corresponds to the libopencv function @code{cvErode}.
  9883. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9884. with the same syntax and semantics as the @ref{dilate} filter.
  9885. @subsection smooth
  9886. Smooth the input video.
  9887. The filter takes the following parameters:
  9888. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9889. @var{type} is the type of smooth filter to apply, and must be one of
  9890. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9891. or "bilateral". The default value is "gaussian".
  9892. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9893. depend on the smooth type. @var{param1} and
  9894. @var{param2} accept integer positive values or 0. @var{param3} and
  9895. @var{param4} accept floating point values.
  9896. The default value for @var{param1} is 3. The default value for the
  9897. other parameters is 0.
  9898. These parameters correspond to the parameters assigned to the
  9899. libopencv function @code{cvSmooth}.
  9900. @section oscilloscope
  9901. 2D Video Oscilloscope.
  9902. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9903. It accepts the following parameters:
  9904. @table @option
  9905. @item x
  9906. Set scope center x position.
  9907. @item y
  9908. Set scope center y position.
  9909. @item s
  9910. Set scope size, relative to frame diagonal.
  9911. @item t
  9912. Set scope tilt/rotation.
  9913. @item o
  9914. Set trace opacity.
  9915. @item tx
  9916. Set trace center x position.
  9917. @item ty
  9918. Set trace center y position.
  9919. @item tw
  9920. Set trace width, relative to width of frame.
  9921. @item th
  9922. Set trace height, relative to height of frame.
  9923. @item c
  9924. Set which components to trace. By default it traces first three components.
  9925. @item g
  9926. Draw trace grid. By default is enabled.
  9927. @item st
  9928. Draw some statistics. By default is enabled.
  9929. @item sc
  9930. Draw scope. By default is enabled.
  9931. @end table
  9932. @subsection Examples
  9933. @itemize
  9934. @item
  9935. Inspect full first row of video frame.
  9936. @example
  9937. oscilloscope=x=0.5:y=0:s=1
  9938. @end example
  9939. @item
  9940. Inspect full last row of video frame.
  9941. @example
  9942. oscilloscope=x=0.5:y=1:s=1
  9943. @end example
  9944. @item
  9945. Inspect full 5th line of video frame of height 1080.
  9946. @example
  9947. oscilloscope=x=0.5:y=5/1080:s=1
  9948. @end example
  9949. @item
  9950. Inspect full last column of video frame.
  9951. @example
  9952. oscilloscope=x=1:y=0.5:s=1:t=1
  9953. @end example
  9954. @end itemize
  9955. @anchor{overlay}
  9956. @section overlay
  9957. Overlay one video on top of another.
  9958. It takes two inputs and has one output. The first input is the "main"
  9959. video on which the second input is overlaid.
  9960. It accepts the following parameters:
  9961. A description of the accepted options follows.
  9962. @table @option
  9963. @item x
  9964. @item y
  9965. Set the expression for the x and y coordinates of the overlaid video
  9966. on the main video. Default value is "0" for both expressions. In case
  9967. the expression is invalid, it is set to a huge value (meaning that the
  9968. overlay will not be displayed within the output visible area).
  9969. @item eof_action
  9970. See @ref{framesync}.
  9971. @item eval
  9972. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9973. It accepts the following values:
  9974. @table @samp
  9975. @item init
  9976. only evaluate expressions once during the filter initialization or
  9977. when a command is processed
  9978. @item frame
  9979. evaluate expressions for each incoming frame
  9980. @end table
  9981. Default value is @samp{frame}.
  9982. @item shortest
  9983. See @ref{framesync}.
  9984. @item format
  9985. Set the format for the output video.
  9986. It accepts the following values:
  9987. @table @samp
  9988. @item yuv420
  9989. force YUV420 output
  9990. @item yuv422
  9991. force YUV422 output
  9992. @item yuv444
  9993. force YUV444 output
  9994. @item rgb
  9995. force packed RGB output
  9996. @item gbrp
  9997. force planar RGB output
  9998. @item auto
  9999. automatically pick format
  10000. @end table
  10001. Default value is @samp{yuv420}.
  10002. @item repeatlast
  10003. See @ref{framesync}.
  10004. @item alpha
  10005. Set format of alpha of the overlaid video, it can be @var{straight} or
  10006. @var{premultiplied}. Default is @var{straight}.
  10007. @end table
  10008. The @option{x}, and @option{y} expressions can contain the following
  10009. parameters.
  10010. @table @option
  10011. @item main_w, W
  10012. @item main_h, H
  10013. The main input width and height.
  10014. @item overlay_w, w
  10015. @item overlay_h, h
  10016. The overlay input width and height.
  10017. @item x
  10018. @item y
  10019. The computed values for @var{x} and @var{y}. They are evaluated for
  10020. each new frame.
  10021. @item hsub
  10022. @item vsub
  10023. horizontal and vertical chroma subsample values of the output
  10024. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10025. @var{vsub} is 1.
  10026. @item n
  10027. the number of input frame, starting from 0
  10028. @item pos
  10029. the position in the file of the input frame, NAN if unknown
  10030. @item t
  10031. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10032. @end table
  10033. This filter also supports the @ref{framesync} options.
  10034. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10035. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10036. when @option{eval} is set to @samp{init}.
  10037. Be aware that frames are taken from each input video in timestamp
  10038. order, hence, if their initial timestamps differ, it is a good idea
  10039. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10040. have them begin in the same zero timestamp, as the example for
  10041. the @var{movie} filter does.
  10042. You can chain together more overlays but you should test the
  10043. efficiency of such approach.
  10044. @subsection Commands
  10045. This filter supports the following commands:
  10046. @table @option
  10047. @item x
  10048. @item y
  10049. Modify the x and y of the overlay input.
  10050. The command accepts the same syntax of the corresponding option.
  10051. If the specified expression is not valid, it is kept at its current
  10052. value.
  10053. @end table
  10054. @subsection Examples
  10055. @itemize
  10056. @item
  10057. Draw the overlay at 10 pixels from the bottom right corner of the main
  10058. video:
  10059. @example
  10060. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10061. @end example
  10062. Using named options the example above becomes:
  10063. @example
  10064. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10065. @end example
  10066. @item
  10067. Insert a transparent PNG logo in the bottom left corner of the input,
  10068. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10069. @example
  10070. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10071. @end example
  10072. @item
  10073. Insert 2 different transparent PNG logos (second logo on bottom
  10074. right corner) using the @command{ffmpeg} tool:
  10075. @example
  10076. 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
  10077. @end example
  10078. @item
  10079. Add a transparent color layer on top of the main video; @code{WxH}
  10080. must specify the size of the main input to the overlay filter:
  10081. @example
  10082. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10083. @end example
  10084. @item
  10085. Play an original video and a filtered version (here with the deshake
  10086. filter) side by side using the @command{ffplay} tool:
  10087. @example
  10088. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10089. @end example
  10090. The above command is the same as:
  10091. @example
  10092. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10093. @end example
  10094. @item
  10095. Make a sliding overlay appearing from the left to the right top part of the
  10096. screen starting since time 2:
  10097. @example
  10098. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10099. @end example
  10100. @item
  10101. Compose output by putting two input videos side to side:
  10102. @example
  10103. ffmpeg -i left.avi -i right.avi -filter_complex "
  10104. nullsrc=size=200x100 [background];
  10105. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10106. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10107. [background][left] overlay=shortest=1 [background+left];
  10108. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10109. "
  10110. @end example
  10111. @item
  10112. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10113. @example
  10114. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10115. -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]'
  10116. masked.avi
  10117. @end example
  10118. @item
  10119. Chain several overlays in cascade:
  10120. @example
  10121. nullsrc=s=200x200 [bg];
  10122. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10123. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10124. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10125. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10126. [in3] null, [mid2] overlay=100:100 [out0]
  10127. @end example
  10128. @end itemize
  10129. @section owdenoise
  10130. Apply Overcomplete Wavelet denoiser.
  10131. The filter accepts the following options:
  10132. @table @option
  10133. @item depth
  10134. Set depth.
  10135. Larger depth values will denoise lower frequency components more, but
  10136. slow down filtering.
  10137. Must be an int in the range 8-16, default is @code{8}.
  10138. @item luma_strength, ls
  10139. Set luma strength.
  10140. Must be a double value in the range 0-1000, default is @code{1.0}.
  10141. @item chroma_strength, cs
  10142. Set chroma strength.
  10143. Must be a double value in the range 0-1000, default is @code{1.0}.
  10144. @end table
  10145. @anchor{pad}
  10146. @section pad
  10147. Add paddings to the input image, and place the original input at the
  10148. provided @var{x}, @var{y} coordinates.
  10149. It accepts the following parameters:
  10150. @table @option
  10151. @item width, w
  10152. @item height, h
  10153. Specify an expression for the size of the output image with the
  10154. paddings added. If the value for @var{width} or @var{height} is 0, the
  10155. corresponding input size is used for the output.
  10156. The @var{width} expression can reference the value set by the
  10157. @var{height} expression, and vice versa.
  10158. The default value of @var{width} and @var{height} is 0.
  10159. @item x
  10160. @item y
  10161. Specify the offsets to place the input image at within the padded area,
  10162. with respect to the top/left border of the output image.
  10163. The @var{x} expression can reference the value set by the @var{y}
  10164. expression, and vice versa.
  10165. The default value of @var{x} and @var{y} is 0.
  10166. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10167. so the input image is centered on the padded area.
  10168. @item color
  10169. Specify the color of the padded area. For the syntax of this option,
  10170. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10171. manual,ffmpeg-utils}.
  10172. The default value of @var{color} is "black".
  10173. @item eval
  10174. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10175. It accepts the following values:
  10176. @table @samp
  10177. @item init
  10178. Only evaluate expressions once during the filter initialization or when
  10179. a command is processed.
  10180. @item frame
  10181. Evaluate expressions for each incoming frame.
  10182. @end table
  10183. Default value is @samp{init}.
  10184. @item aspect
  10185. Pad to aspect instead to a resolution.
  10186. @end table
  10187. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10188. options are expressions containing the following constants:
  10189. @table @option
  10190. @item in_w
  10191. @item in_h
  10192. The input video width and height.
  10193. @item iw
  10194. @item ih
  10195. These are the same as @var{in_w} and @var{in_h}.
  10196. @item out_w
  10197. @item out_h
  10198. The output width and height (the size of the padded area), as
  10199. specified by the @var{width} and @var{height} expressions.
  10200. @item ow
  10201. @item oh
  10202. These are the same as @var{out_w} and @var{out_h}.
  10203. @item x
  10204. @item y
  10205. The x and y offsets as specified by the @var{x} and @var{y}
  10206. expressions, or NAN if not yet specified.
  10207. @item a
  10208. same as @var{iw} / @var{ih}
  10209. @item sar
  10210. input sample aspect ratio
  10211. @item dar
  10212. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10213. @item hsub
  10214. @item vsub
  10215. The horizontal and vertical chroma subsample values. For example for the
  10216. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10217. @end table
  10218. @subsection Examples
  10219. @itemize
  10220. @item
  10221. Add paddings with the color "violet" to the input video. The output video
  10222. size is 640x480, and the top-left corner of the input video is placed at
  10223. column 0, row 40
  10224. @example
  10225. pad=640:480:0:40:violet
  10226. @end example
  10227. The example above is equivalent to the following command:
  10228. @example
  10229. pad=width=640:height=480:x=0:y=40:color=violet
  10230. @end example
  10231. @item
  10232. Pad the input to get an output with dimensions increased by 3/2,
  10233. and put the input video at the center of the padded area:
  10234. @example
  10235. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10236. @end example
  10237. @item
  10238. Pad the input to get a squared output with size equal to the maximum
  10239. value between the input width and height, and put the input video at
  10240. the center of the padded area:
  10241. @example
  10242. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10243. @end example
  10244. @item
  10245. Pad the input to get a final w/h ratio of 16:9:
  10246. @example
  10247. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10248. @end example
  10249. @item
  10250. In case of anamorphic video, in order to set the output display aspect
  10251. correctly, it is necessary to use @var{sar} in the expression,
  10252. according to the relation:
  10253. @example
  10254. (ih * X / ih) * sar = output_dar
  10255. X = output_dar / sar
  10256. @end example
  10257. Thus the previous example needs to be modified to:
  10258. @example
  10259. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10260. @end example
  10261. @item
  10262. Double the output size and put the input video in the bottom-right
  10263. corner of the output padded area:
  10264. @example
  10265. pad="2*iw:2*ih:ow-iw:oh-ih"
  10266. @end example
  10267. @end itemize
  10268. @anchor{palettegen}
  10269. @section palettegen
  10270. Generate one palette for a whole video stream.
  10271. It accepts the following options:
  10272. @table @option
  10273. @item max_colors
  10274. Set the maximum number of colors to quantize in the palette.
  10275. Note: the palette will still contain 256 colors; the unused palette entries
  10276. will be black.
  10277. @item reserve_transparent
  10278. Create a palette of 255 colors maximum and reserve the last one for
  10279. transparency. Reserving the transparency color is useful for GIF optimization.
  10280. If not set, the maximum of colors in the palette will be 256. You probably want
  10281. to disable this option for a standalone image.
  10282. Set by default.
  10283. @item transparency_color
  10284. Set the color that will be used as background for transparency.
  10285. @item stats_mode
  10286. Set statistics mode.
  10287. It accepts the following values:
  10288. @table @samp
  10289. @item full
  10290. Compute full frame histograms.
  10291. @item diff
  10292. Compute histograms only for the part that differs from previous frame. This
  10293. might be relevant to give more importance to the moving part of your input if
  10294. the background is static.
  10295. @item single
  10296. Compute new histogram for each frame.
  10297. @end table
  10298. Default value is @var{full}.
  10299. @end table
  10300. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10301. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10302. color quantization of the palette. This information is also visible at
  10303. @var{info} logging level.
  10304. @subsection Examples
  10305. @itemize
  10306. @item
  10307. Generate a representative palette of a given video using @command{ffmpeg}:
  10308. @example
  10309. ffmpeg -i input.mkv -vf palettegen palette.png
  10310. @end example
  10311. @end itemize
  10312. @section paletteuse
  10313. Use a palette to downsample an input video stream.
  10314. The filter takes two inputs: one video stream and a palette. The palette must
  10315. be a 256 pixels image.
  10316. It accepts the following options:
  10317. @table @option
  10318. @item dither
  10319. Select dithering mode. Available algorithms are:
  10320. @table @samp
  10321. @item bayer
  10322. Ordered 8x8 bayer dithering (deterministic)
  10323. @item heckbert
  10324. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10325. Note: this dithering is sometimes considered "wrong" and is included as a
  10326. reference.
  10327. @item floyd_steinberg
  10328. Floyd and Steingberg dithering (error diffusion)
  10329. @item sierra2
  10330. Frankie Sierra dithering v2 (error diffusion)
  10331. @item sierra2_4a
  10332. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10333. @end table
  10334. Default is @var{sierra2_4a}.
  10335. @item bayer_scale
  10336. When @var{bayer} dithering is selected, this option defines the scale of the
  10337. pattern (how much the crosshatch pattern is visible). A low value means more
  10338. visible pattern for less banding, and higher value means less visible pattern
  10339. at the cost of more banding.
  10340. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10341. @item diff_mode
  10342. If set, define the zone to process
  10343. @table @samp
  10344. @item rectangle
  10345. Only the changing rectangle will be reprocessed. This is similar to GIF
  10346. cropping/offsetting compression mechanism. This option can be useful for speed
  10347. if only a part of the image is changing, and has use cases such as limiting the
  10348. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10349. moving scene (it leads to more deterministic output if the scene doesn't change
  10350. much, and as a result less moving noise and better GIF compression).
  10351. @end table
  10352. Default is @var{none}.
  10353. @item new
  10354. Take new palette for each output frame.
  10355. @item alpha_threshold
  10356. Sets the alpha threshold for transparency. Alpha values above this threshold
  10357. will be treated as completely opaque, and values below this threshold will be
  10358. treated as completely transparent.
  10359. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10360. @end table
  10361. @subsection Examples
  10362. @itemize
  10363. @item
  10364. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10365. using @command{ffmpeg}:
  10366. @example
  10367. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10368. @end example
  10369. @end itemize
  10370. @section perspective
  10371. Correct perspective of video not recorded perpendicular to the screen.
  10372. A description of the accepted parameters follows.
  10373. @table @option
  10374. @item x0
  10375. @item y0
  10376. @item x1
  10377. @item y1
  10378. @item x2
  10379. @item y2
  10380. @item x3
  10381. @item y3
  10382. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10383. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10384. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10385. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10386. then the corners of the source will be sent to the specified coordinates.
  10387. The expressions can use the following variables:
  10388. @table @option
  10389. @item W
  10390. @item H
  10391. the width and height of video frame.
  10392. @item in
  10393. Input frame count.
  10394. @item on
  10395. Output frame count.
  10396. @end table
  10397. @item interpolation
  10398. Set interpolation for perspective correction.
  10399. It accepts the following values:
  10400. @table @samp
  10401. @item linear
  10402. @item cubic
  10403. @end table
  10404. Default value is @samp{linear}.
  10405. @item sense
  10406. Set interpretation of coordinate options.
  10407. It accepts the following values:
  10408. @table @samp
  10409. @item 0, source
  10410. Send point in the source specified by the given coordinates to
  10411. the corners of the destination.
  10412. @item 1, destination
  10413. Send the corners of the source to the point in the destination specified
  10414. by the given coordinates.
  10415. Default value is @samp{source}.
  10416. @end table
  10417. @item eval
  10418. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10419. It accepts the following values:
  10420. @table @samp
  10421. @item init
  10422. only evaluate expressions once during the filter initialization or
  10423. when a command is processed
  10424. @item frame
  10425. evaluate expressions for each incoming frame
  10426. @end table
  10427. Default value is @samp{init}.
  10428. @end table
  10429. @section phase
  10430. Delay interlaced video by one field time so that the field order changes.
  10431. The intended use is to fix PAL movies that have been captured with the
  10432. opposite field order to the film-to-video transfer.
  10433. A description of the accepted parameters follows.
  10434. @table @option
  10435. @item mode
  10436. Set phase mode.
  10437. It accepts the following values:
  10438. @table @samp
  10439. @item t
  10440. Capture field order top-first, transfer bottom-first.
  10441. Filter will delay the bottom field.
  10442. @item b
  10443. Capture field order bottom-first, transfer top-first.
  10444. Filter will delay the top field.
  10445. @item p
  10446. Capture and transfer with the same field order. This mode only exists
  10447. for the documentation of the other options to refer to, but if you
  10448. actually select it, the filter will faithfully do nothing.
  10449. @item a
  10450. Capture field order determined automatically by field flags, transfer
  10451. opposite.
  10452. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10453. basis using field flags. If no field information is available,
  10454. then this works just like @samp{u}.
  10455. @item u
  10456. Capture unknown or varying, transfer opposite.
  10457. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10458. analyzing the images and selecting the alternative that produces best
  10459. match between the fields.
  10460. @item T
  10461. Capture top-first, transfer unknown or varying.
  10462. Filter selects among @samp{t} and @samp{p} using image analysis.
  10463. @item B
  10464. Capture bottom-first, transfer unknown or varying.
  10465. Filter selects among @samp{b} and @samp{p} using image analysis.
  10466. @item A
  10467. Capture determined by field flags, transfer unknown or varying.
  10468. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10469. image analysis. If no field information is available, then this works just
  10470. like @samp{U}. This is the default mode.
  10471. @item U
  10472. Both capture and transfer unknown or varying.
  10473. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10474. @end table
  10475. @end table
  10476. @section pixdesctest
  10477. Pixel format descriptor test filter, mainly useful for internal
  10478. testing. The output video should be equal to the input video.
  10479. For example:
  10480. @example
  10481. format=monow, pixdesctest
  10482. @end example
  10483. can be used to test the monowhite pixel format descriptor definition.
  10484. @section pixscope
  10485. Display sample values of color channels. Mainly useful for checking color
  10486. and levels. Minimum supported resolution is 640x480.
  10487. The filters accept the following options:
  10488. @table @option
  10489. @item x
  10490. Set scope X position, relative offset on X axis.
  10491. @item y
  10492. Set scope Y position, relative offset on Y axis.
  10493. @item w
  10494. Set scope width.
  10495. @item h
  10496. Set scope height.
  10497. @item o
  10498. Set window opacity. This window also holds statistics about pixel area.
  10499. @item wx
  10500. Set window X position, relative offset on X axis.
  10501. @item wy
  10502. Set window Y position, relative offset on Y axis.
  10503. @end table
  10504. @section pp
  10505. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10506. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10507. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10508. Each subfilter and some options have a short and a long name that can be used
  10509. interchangeably, i.e. dr/dering are the same.
  10510. The filters accept the following options:
  10511. @table @option
  10512. @item subfilters
  10513. Set postprocessing subfilters string.
  10514. @end table
  10515. All subfilters share common options to determine their scope:
  10516. @table @option
  10517. @item a/autoq
  10518. Honor the quality commands for this subfilter.
  10519. @item c/chrom
  10520. Do chrominance filtering, too (default).
  10521. @item y/nochrom
  10522. Do luminance filtering only (no chrominance).
  10523. @item n/noluma
  10524. Do chrominance filtering only (no luminance).
  10525. @end table
  10526. These options can be appended after the subfilter name, separated by a '|'.
  10527. Available subfilters are:
  10528. @table @option
  10529. @item hb/hdeblock[|difference[|flatness]]
  10530. Horizontal deblocking filter
  10531. @table @option
  10532. @item difference
  10533. Difference factor where higher values mean more deblocking (default: @code{32}).
  10534. @item flatness
  10535. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10536. @end table
  10537. @item vb/vdeblock[|difference[|flatness]]
  10538. Vertical deblocking filter
  10539. @table @option
  10540. @item difference
  10541. Difference factor where higher values mean more deblocking (default: @code{32}).
  10542. @item flatness
  10543. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10544. @end table
  10545. @item ha/hadeblock[|difference[|flatness]]
  10546. Accurate horizontal deblocking filter
  10547. @table @option
  10548. @item difference
  10549. Difference factor where higher values mean more deblocking (default: @code{32}).
  10550. @item flatness
  10551. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10552. @end table
  10553. @item va/vadeblock[|difference[|flatness]]
  10554. Accurate vertical deblocking filter
  10555. @table @option
  10556. @item difference
  10557. Difference factor where higher values mean more deblocking (default: @code{32}).
  10558. @item flatness
  10559. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10560. @end table
  10561. @end table
  10562. The horizontal and vertical deblocking filters share the difference and
  10563. flatness values so you cannot set different horizontal and vertical
  10564. thresholds.
  10565. @table @option
  10566. @item h1/x1hdeblock
  10567. Experimental horizontal deblocking filter
  10568. @item v1/x1vdeblock
  10569. Experimental vertical deblocking filter
  10570. @item dr/dering
  10571. Deringing filter
  10572. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10573. @table @option
  10574. @item threshold1
  10575. larger -> stronger filtering
  10576. @item threshold2
  10577. larger -> stronger filtering
  10578. @item threshold3
  10579. larger -> stronger filtering
  10580. @end table
  10581. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10582. @table @option
  10583. @item f/fullyrange
  10584. Stretch luminance to @code{0-255}.
  10585. @end table
  10586. @item lb/linblenddeint
  10587. Linear blend deinterlacing filter that deinterlaces the given block by
  10588. filtering all lines with a @code{(1 2 1)} filter.
  10589. @item li/linipoldeint
  10590. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10591. linearly interpolating every second line.
  10592. @item ci/cubicipoldeint
  10593. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10594. cubically interpolating every second line.
  10595. @item md/mediandeint
  10596. Median deinterlacing filter that deinterlaces the given block by applying a
  10597. median filter to every second line.
  10598. @item fd/ffmpegdeint
  10599. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10600. second line with a @code{(-1 4 2 4 -1)} filter.
  10601. @item l5/lowpass5
  10602. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10603. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10604. @item fq/forceQuant[|quantizer]
  10605. Overrides the quantizer table from the input with the constant quantizer you
  10606. specify.
  10607. @table @option
  10608. @item quantizer
  10609. Quantizer to use
  10610. @end table
  10611. @item de/default
  10612. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10613. @item fa/fast
  10614. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10615. @item ac
  10616. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10617. @end table
  10618. @subsection Examples
  10619. @itemize
  10620. @item
  10621. Apply horizontal and vertical deblocking, deringing and automatic
  10622. brightness/contrast:
  10623. @example
  10624. pp=hb/vb/dr/al
  10625. @end example
  10626. @item
  10627. Apply default filters without brightness/contrast correction:
  10628. @example
  10629. pp=de/-al
  10630. @end example
  10631. @item
  10632. Apply default filters and temporal denoiser:
  10633. @example
  10634. pp=default/tmpnoise|1|2|3
  10635. @end example
  10636. @item
  10637. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10638. automatically depending on available CPU time:
  10639. @example
  10640. pp=hb|y/vb|a
  10641. @end example
  10642. @end itemize
  10643. @section pp7
  10644. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10645. similar to spp = 6 with 7 point DCT, where only the center sample is
  10646. used after IDCT.
  10647. The filter accepts the following options:
  10648. @table @option
  10649. @item qp
  10650. Force a constant quantization parameter. It accepts an integer in range
  10651. 0 to 63. If not set, the filter will use the QP from the video stream
  10652. (if available).
  10653. @item mode
  10654. Set thresholding mode. Available modes are:
  10655. @table @samp
  10656. @item hard
  10657. Set hard thresholding.
  10658. @item soft
  10659. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10660. @item medium
  10661. Set medium thresholding (good results, default).
  10662. @end table
  10663. @end table
  10664. @section premultiply
  10665. Apply alpha premultiply effect to input video stream using first plane
  10666. of second stream as alpha.
  10667. Both streams must have same dimensions and same pixel format.
  10668. The filter accepts the following option:
  10669. @table @option
  10670. @item planes
  10671. Set which planes will be processed, unprocessed planes will be copied.
  10672. By default value 0xf, all planes will be processed.
  10673. @item inplace
  10674. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10675. @end table
  10676. @section prewitt
  10677. Apply prewitt operator to input video stream.
  10678. The filter accepts the following option:
  10679. @table @option
  10680. @item planes
  10681. Set which planes will be processed, unprocessed planes will be copied.
  10682. By default value 0xf, all planes will be processed.
  10683. @item scale
  10684. Set value which will be multiplied with filtered result.
  10685. @item delta
  10686. Set value which will be added to filtered result.
  10687. @end table
  10688. @anchor{program_opencl}
  10689. @section program_opencl
  10690. Filter video using an OpenCL program.
  10691. @table @option
  10692. @item source
  10693. OpenCL program source file.
  10694. @item kernel
  10695. Kernel name in program.
  10696. @item inputs
  10697. Number of inputs to the filter. Defaults to 1.
  10698. @item size, s
  10699. Size of output frames. Defaults to the same as the first input.
  10700. @end table
  10701. The program source file must contain a kernel function with the given name,
  10702. which will be run once for each plane of the output. Each run on a plane
  10703. gets enqueued as a separate 2D global NDRange with one work-item for each
  10704. pixel to be generated. The global ID offset for each work-item is therefore
  10705. the coordinates of a pixel in the destination image.
  10706. The kernel function needs to take the following arguments:
  10707. @itemize
  10708. @item
  10709. Destination image, @var{__write_only image2d_t}.
  10710. This image will become the output; the kernel should write all of it.
  10711. @item
  10712. Frame index, @var{unsigned int}.
  10713. This is a counter starting from zero and increasing by one for each frame.
  10714. @item
  10715. Source images, @var{__read_only image2d_t}.
  10716. These are the most recent images on each input. The kernel may read from
  10717. them to generate the output, but they can't be written to.
  10718. @end itemize
  10719. Example programs:
  10720. @itemize
  10721. @item
  10722. Copy the input to the output (output must be the same size as the input).
  10723. @verbatim
  10724. __kernel void copy(__write_only image2d_t destination,
  10725. unsigned int index,
  10726. __read_only image2d_t source)
  10727. {
  10728. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10729. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10730. float4 value = read_imagef(source, sampler, location);
  10731. write_imagef(destination, location, value);
  10732. }
  10733. @end verbatim
  10734. @item
  10735. Apply a simple transformation, rotating the input by an amount increasing
  10736. with the index counter. Pixel values are linearly interpolated by the
  10737. sampler, and the output need not have the same dimensions as the input.
  10738. @verbatim
  10739. __kernel void rotate_image(__write_only image2d_t dst,
  10740. unsigned int index,
  10741. __read_only image2d_t src)
  10742. {
  10743. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10744. CLK_FILTER_LINEAR);
  10745. float angle = (float)index / 100.0f;
  10746. float2 dst_dim = convert_float2(get_image_dim(dst));
  10747. float2 src_dim = convert_float2(get_image_dim(src));
  10748. float2 dst_cen = dst_dim / 2.0f;
  10749. float2 src_cen = src_dim / 2.0f;
  10750. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10751. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10752. float2 src_pos = {
  10753. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10754. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10755. };
  10756. src_pos = src_pos * src_dim / dst_dim;
  10757. float2 src_loc = src_pos + src_cen;
  10758. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10759. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10760. write_imagef(dst, dst_loc, 0.5f);
  10761. else
  10762. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10763. }
  10764. @end verbatim
  10765. @item
  10766. Blend two inputs together, with the amount of each input used varying
  10767. with the index counter.
  10768. @verbatim
  10769. __kernel void blend_images(__write_only image2d_t dst,
  10770. unsigned int index,
  10771. __read_only image2d_t src1,
  10772. __read_only image2d_t src2)
  10773. {
  10774. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10775. CLK_FILTER_LINEAR);
  10776. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10777. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10778. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10779. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10780. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10781. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10782. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10783. }
  10784. @end verbatim
  10785. @end itemize
  10786. @section pseudocolor
  10787. Alter frame colors in video with pseudocolors.
  10788. This filter accept the following options:
  10789. @table @option
  10790. @item c0
  10791. set pixel first component expression
  10792. @item c1
  10793. set pixel second component expression
  10794. @item c2
  10795. set pixel third component expression
  10796. @item c3
  10797. set pixel fourth component expression, corresponds to the alpha component
  10798. @item i
  10799. set component to use as base for altering colors
  10800. @end table
  10801. Each of them specifies the expression to use for computing the lookup table for
  10802. the corresponding pixel component values.
  10803. The expressions can contain the following constants and functions:
  10804. @table @option
  10805. @item w
  10806. @item h
  10807. The input width and height.
  10808. @item val
  10809. The input value for the pixel component.
  10810. @item ymin, umin, vmin, amin
  10811. The minimum allowed component value.
  10812. @item ymax, umax, vmax, amax
  10813. The maximum allowed component value.
  10814. @end table
  10815. All expressions default to "val".
  10816. @subsection Examples
  10817. @itemize
  10818. @item
  10819. Change too high luma values to gradient:
  10820. @example
  10821. 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'"
  10822. @end example
  10823. @end itemize
  10824. @section psnr
  10825. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10826. Ratio) between two input videos.
  10827. This filter takes in input two input videos, the first input is
  10828. considered the "main" source and is passed unchanged to the
  10829. output. The second input is used as a "reference" video for computing
  10830. the PSNR.
  10831. Both video inputs must have the same resolution and pixel format for
  10832. this filter to work correctly. Also it assumes that both inputs
  10833. have the same number of frames, which are compared one by one.
  10834. The obtained average PSNR is printed through the logging system.
  10835. The filter stores the accumulated MSE (mean squared error) of each
  10836. frame, and at the end of the processing it is averaged across all frames
  10837. equally, and the following formula is applied to obtain the PSNR:
  10838. @example
  10839. PSNR = 10*log10(MAX^2/MSE)
  10840. @end example
  10841. Where MAX is the average of the maximum values of each component of the
  10842. image.
  10843. The description of the accepted parameters follows.
  10844. @table @option
  10845. @item stats_file, f
  10846. If specified the filter will use the named file to save the PSNR of
  10847. each individual frame. When filename equals "-" the data is sent to
  10848. standard output.
  10849. @item stats_version
  10850. Specifies which version of the stats file format to use. Details of
  10851. each format are written below.
  10852. Default value is 1.
  10853. @item stats_add_max
  10854. Determines whether the max value is output to the stats log.
  10855. Default value is 0.
  10856. Requires stats_version >= 2. If this is set and stats_version < 2,
  10857. the filter will return an error.
  10858. @end table
  10859. This filter also supports the @ref{framesync} options.
  10860. The file printed if @var{stats_file} is selected, contains a sequence of
  10861. key/value pairs of the form @var{key}:@var{value} for each compared
  10862. couple of frames.
  10863. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10864. the list of per-frame-pair stats, with key value pairs following the frame
  10865. format with the following parameters:
  10866. @table @option
  10867. @item psnr_log_version
  10868. The version of the log file format. Will match @var{stats_version}.
  10869. @item fields
  10870. A comma separated list of the per-frame-pair parameters included in
  10871. the log.
  10872. @end table
  10873. A description of each shown per-frame-pair parameter follows:
  10874. @table @option
  10875. @item n
  10876. sequential number of the input frame, starting from 1
  10877. @item mse_avg
  10878. Mean Square Error pixel-by-pixel average difference of the compared
  10879. frames, averaged over all the image components.
  10880. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10881. Mean Square Error pixel-by-pixel average difference of the compared
  10882. frames for the component specified by the suffix.
  10883. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10884. Peak Signal to Noise ratio of the compared frames for the component
  10885. specified by the suffix.
  10886. @item max_avg, max_y, max_u, max_v
  10887. Maximum allowed value for each channel, and average over all
  10888. channels.
  10889. @end table
  10890. For example:
  10891. @example
  10892. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10893. [main][ref] psnr="stats_file=stats.log" [out]
  10894. @end example
  10895. On this example the input file being processed is compared with the
  10896. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10897. is stored in @file{stats.log}.
  10898. @anchor{pullup}
  10899. @section pullup
  10900. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10901. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10902. content.
  10903. The pullup filter is designed to take advantage of future context in making
  10904. its decisions. This filter is stateless in the sense that it does not lock
  10905. onto a pattern to follow, but it instead looks forward to the following
  10906. fields in order to identify matches and rebuild progressive frames.
  10907. To produce content with an even framerate, insert the fps filter after
  10908. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10909. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10910. The filter accepts the following options:
  10911. @table @option
  10912. @item jl
  10913. @item jr
  10914. @item jt
  10915. @item jb
  10916. These options set the amount of "junk" to ignore at the left, right, top, and
  10917. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10918. while top and bottom are in units of 2 lines.
  10919. The default is 8 pixels on each side.
  10920. @item sb
  10921. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10922. filter generating an occasional mismatched frame, but it may also cause an
  10923. excessive number of frames to be dropped during high motion sequences.
  10924. Conversely, setting it to -1 will make filter match fields more easily.
  10925. This may help processing of video where there is slight blurring between
  10926. the fields, but may also cause there to be interlaced frames in the output.
  10927. Default value is @code{0}.
  10928. @item mp
  10929. Set the metric plane to use. It accepts the following values:
  10930. @table @samp
  10931. @item l
  10932. Use luma plane.
  10933. @item u
  10934. Use chroma blue plane.
  10935. @item v
  10936. Use chroma red plane.
  10937. @end table
  10938. This option may be set to use chroma plane instead of the default luma plane
  10939. for doing filter's computations. This may improve accuracy on very clean
  10940. source material, but more likely will decrease accuracy, especially if there
  10941. is chroma noise (rainbow effect) or any grayscale video.
  10942. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10943. load and make pullup usable in realtime on slow machines.
  10944. @end table
  10945. For best results (without duplicated frames in the output file) it is
  10946. necessary to change the output frame rate. For example, to inverse
  10947. telecine NTSC input:
  10948. @example
  10949. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10950. @end example
  10951. @section qp
  10952. Change video quantization parameters (QP).
  10953. The filter accepts the following option:
  10954. @table @option
  10955. @item qp
  10956. Set expression for quantization parameter.
  10957. @end table
  10958. The expression is evaluated through the eval API and can contain, among others,
  10959. the following constants:
  10960. @table @var
  10961. @item known
  10962. 1 if index is not 129, 0 otherwise.
  10963. @item qp
  10964. Sequential index starting from -129 to 128.
  10965. @end table
  10966. @subsection Examples
  10967. @itemize
  10968. @item
  10969. Some equation like:
  10970. @example
  10971. qp=2+2*sin(PI*qp)
  10972. @end example
  10973. @end itemize
  10974. @section random
  10975. Flush video frames from internal cache of frames into a random order.
  10976. No frame is discarded.
  10977. Inspired by @ref{frei0r} nervous filter.
  10978. @table @option
  10979. @item frames
  10980. Set size in number of frames of internal cache, in range from @code{2} to
  10981. @code{512}. Default is @code{30}.
  10982. @item seed
  10983. Set seed for random number generator, must be an integer included between
  10984. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10985. less than @code{0}, the filter will try to use a good random seed on a
  10986. best effort basis.
  10987. @end table
  10988. @section readeia608
  10989. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10990. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10991. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10992. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10993. @table @option
  10994. @item lavfi.readeia608.X.cc
  10995. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10996. @item lavfi.readeia608.X.line
  10997. The number of the line on which the EIA-608 data was identified and read.
  10998. @end table
  10999. This filter accepts the following options:
  11000. @table @option
  11001. @item scan_min
  11002. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11003. @item scan_max
  11004. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11005. @item mac
  11006. Set minimal acceptable amplitude change for sync codes detection.
  11007. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11008. @item spw
  11009. Set the ratio of width reserved for sync code detection.
  11010. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11011. @item mhd
  11012. Set the max peaks height difference for sync code detection.
  11013. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11014. @item mpd
  11015. Set max peaks period difference for sync code detection.
  11016. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11017. @item msd
  11018. Set the first two max start code bits differences.
  11019. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11020. @item bhd
  11021. Set the minimum ratio of bits height compared to 3rd start code bit.
  11022. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11023. @item th_w
  11024. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11025. @item th_b
  11026. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11027. @item chp
  11028. Enable checking the parity bit. In the event of a parity error, the filter will output
  11029. @code{0x00} for that character. Default is false.
  11030. @end table
  11031. @subsection Examples
  11032. @itemize
  11033. @item
  11034. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11035. @example
  11036. 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
  11037. @end example
  11038. @end itemize
  11039. @section readvitc
  11040. Read vertical interval timecode (VITC) information from the top lines of a
  11041. video frame.
  11042. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11043. timecode value, if a valid timecode has been detected. Further metadata key
  11044. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11045. timecode data has been found or not.
  11046. This filter accepts the following options:
  11047. @table @option
  11048. @item scan_max
  11049. Set the maximum number of lines to scan for VITC data. If the value is set to
  11050. @code{-1} the full video frame is scanned. Default is @code{45}.
  11051. @item thr_b
  11052. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11053. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11054. @item thr_w
  11055. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11056. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11057. @end table
  11058. @subsection Examples
  11059. @itemize
  11060. @item
  11061. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11062. draw @code{--:--:--:--} as a placeholder:
  11063. @example
  11064. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11065. @end example
  11066. @end itemize
  11067. @section remap
  11068. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11069. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11070. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11071. value for pixel will be used for destination pixel.
  11072. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11073. will have Xmap/Ymap video stream dimensions.
  11074. Xmap and Ymap input video streams are 16bit depth, single channel.
  11075. @section removegrain
  11076. The removegrain filter is a spatial denoiser for progressive video.
  11077. @table @option
  11078. @item m0
  11079. Set mode for the first plane.
  11080. @item m1
  11081. Set mode for the second plane.
  11082. @item m2
  11083. Set mode for the third plane.
  11084. @item m3
  11085. Set mode for the fourth plane.
  11086. @end table
  11087. Range of mode is from 0 to 24. Description of each mode follows:
  11088. @table @var
  11089. @item 0
  11090. Leave input plane unchanged. Default.
  11091. @item 1
  11092. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11093. @item 2
  11094. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11095. @item 3
  11096. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11097. @item 4
  11098. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11099. This is equivalent to a median filter.
  11100. @item 5
  11101. Line-sensitive clipping giving the minimal change.
  11102. @item 6
  11103. Line-sensitive clipping, intermediate.
  11104. @item 7
  11105. Line-sensitive clipping, intermediate.
  11106. @item 8
  11107. Line-sensitive clipping, intermediate.
  11108. @item 9
  11109. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11110. @item 10
  11111. Replaces the target pixel with the closest neighbour.
  11112. @item 11
  11113. [1 2 1] horizontal and vertical kernel blur.
  11114. @item 12
  11115. Same as mode 11.
  11116. @item 13
  11117. Bob mode, interpolates top field from the line where the neighbours
  11118. pixels are the closest.
  11119. @item 14
  11120. Bob mode, interpolates bottom field from the line where the neighbours
  11121. pixels are the closest.
  11122. @item 15
  11123. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11124. interpolation formula.
  11125. @item 16
  11126. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11127. interpolation formula.
  11128. @item 17
  11129. Clips the pixel with the minimum and maximum of respectively the maximum and
  11130. minimum of each pair of opposite neighbour pixels.
  11131. @item 18
  11132. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11133. the current pixel is minimal.
  11134. @item 19
  11135. Replaces the pixel with the average of its 8 neighbours.
  11136. @item 20
  11137. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11138. @item 21
  11139. Clips pixels using the averages of opposite neighbour.
  11140. @item 22
  11141. Same as mode 21 but simpler and faster.
  11142. @item 23
  11143. Small edge and halo removal, but reputed useless.
  11144. @item 24
  11145. Similar as 23.
  11146. @end table
  11147. @section removelogo
  11148. Suppress a TV station logo, using an image file to determine which
  11149. pixels comprise the logo. It works by filling in the pixels that
  11150. comprise the logo with neighboring pixels.
  11151. The filter accepts the following options:
  11152. @table @option
  11153. @item filename, f
  11154. Set the filter bitmap file, which can be any image format supported by
  11155. libavformat. The width and height of the image file must match those of the
  11156. video stream being processed.
  11157. @end table
  11158. Pixels in the provided bitmap image with a value of zero are not
  11159. considered part of the logo, non-zero pixels are considered part of
  11160. the logo. If you use white (255) for the logo and black (0) for the
  11161. rest, you will be safe. For making the filter bitmap, it is
  11162. recommended to take a screen capture of a black frame with the logo
  11163. visible, and then using a threshold filter followed by the erode
  11164. filter once or twice.
  11165. If needed, little splotches can be fixed manually. Remember that if
  11166. logo pixels are not covered, the filter quality will be much
  11167. reduced. Marking too many pixels as part of the logo does not hurt as
  11168. much, but it will increase the amount of blurring needed to cover over
  11169. the image and will destroy more information than necessary, and extra
  11170. pixels will slow things down on a large logo.
  11171. @section repeatfields
  11172. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11173. fields based on its value.
  11174. @section reverse
  11175. Reverse a video clip.
  11176. Warning: This filter requires memory to buffer the entire clip, so trimming
  11177. is suggested.
  11178. @subsection Examples
  11179. @itemize
  11180. @item
  11181. Take the first 5 seconds of a clip, and reverse it.
  11182. @example
  11183. trim=end=5,reverse
  11184. @end example
  11185. @end itemize
  11186. @section rgbashift
  11187. Shift R/G/B/A pixels horizontally and/or vertically.
  11188. The filter accepts the following options:
  11189. @table @option
  11190. @item rh
  11191. Set amount to shift red horizontally.
  11192. @item rv
  11193. Set amount to shift red vertically.
  11194. @item gh
  11195. Set amount to shift green horizontally.
  11196. @item gv
  11197. Set amount to shift green vertically.
  11198. @item bh
  11199. Set amount to shift blue horizontally.
  11200. @item bv
  11201. Set amount to shift blue vertically.
  11202. @item ah
  11203. Set amount to shift alpha horizontally.
  11204. @item av
  11205. Set amount to shift alpha vertically.
  11206. @item edge
  11207. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11208. @end table
  11209. @section roberts
  11210. Apply roberts cross operator to input video stream.
  11211. The filter accepts the following option:
  11212. @table @option
  11213. @item planes
  11214. Set which planes will be processed, unprocessed planes will be copied.
  11215. By default value 0xf, all planes will be processed.
  11216. @item scale
  11217. Set value which will be multiplied with filtered result.
  11218. @item delta
  11219. Set value which will be added to filtered result.
  11220. @end table
  11221. @section rotate
  11222. Rotate video by an arbitrary angle expressed in radians.
  11223. The filter accepts the following options:
  11224. A description of the optional parameters follows.
  11225. @table @option
  11226. @item angle, a
  11227. Set an expression for the angle by which to rotate the input video
  11228. clockwise, expressed as a number of radians. A negative value will
  11229. result in a counter-clockwise rotation. By default it is set to "0".
  11230. This expression is evaluated for each frame.
  11231. @item out_w, ow
  11232. Set the output width expression, default value is "iw".
  11233. This expression is evaluated just once during configuration.
  11234. @item out_h, oh
  11235. Set the output height expression, default value is "ih".
  11236. This expression is evaluated just once during configuration.
  11237. @item bilinear
  11238. Enable bilinear interpolation if set to 1, a value of 0 disables
  11239. it. Default value is 1.
  11240. @item fillcolor, c
  11241. Set the color used to fill the output area not covered by the rotated
  11242. image. For the general syntax of this option, check the
  11243. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11244. If the special value "none" is selected then no
  11245. background is printed (useful for example if the background is never shown).
  11246. Default value is "black".
  11247. @end table
  11248. The expressions for the angle and the output size can contain the
  11249. following constants and functions:
  11250. @table @option
  11251. @item n
  11252. sequential number of the input frame, starting from 0. It is always NAN
  11253. before the first frame is filtered.
  11254. @item t
  11255. time in seconds of the input frame, it is set to 0 when the filter is
  11256. configured. It is always NAN before the first frame is filtered.
  11257. @item hsub
  11258. @item vsub
  11259. horizontal and vertical chroma subsample values. For example for the
  11260. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11261. @item in_w, iw
  11262. @item in_h, ih
  11263. the input video width and height
  11264. @item out_w, ow
  11265. @item out_h, oh
  11266. the output width and height, that is the size of the padded area as
  11267. specified by the @var{width} and @var{height} expressions
  11268. @item rotw(a)
  11269. @item roth(a)
  11270. the minimal width/height required for completely containing the input
  11271. video rotated by @var{a} radians.
  11272. These are only available when computing the @option{out_w} and
  11273. @option{out_h} expressions.
  11274. @end table
  11275. @subsection Examples
  11276. @itemize
  11277. @item
  11278. Rotate the input by PI/6 radians clockwise:
  11279. @example
  11280. rotate=PI/6
  11281. @end example
  11282. @item
  11283. Rotate the input by PI/6 radians counter-clockwise:
  11284. @example
  11285. rotate=-PI/6
  11286. @end example
  11287. @item
  11288. Rotate the input by 45 degrees clockwise:
  11289. @example
  11290. rotate=45*PI/180
  11291. @end example
  11292. @item
  11293. Apply a constant rotation with period T, starting from an angle of PI/3:
  11294. @example
  11295. rotate=PI/3+2*PI*t/T
  11296. @end example
  11297. @item
  11298. Make the input video rotation oscillating with a period of T
  11299. seconds and an amplitude of A radians:
  11300. @example
  11301. rotate=A*sin(2*PI/T*t)
  11302. @end example
  11303. @item
  11304. Rotate the video, output size is chosen so that the whole rotating
  11305. input video is always completely contained in the output:
  11306. @example
  11307. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11308. @end example
  11309. @item
  11310. Rotate the video, reduce the output size so that no background is ever
  11311. shown:
  11312. @example
  11313. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11314. @end example
  11315. @end itemize
  11316. @subsection Commands
  11317. The filter supports the following commands:
  11318. @table @option
  11319. @item a, angle
  11320. Set the angle expression.
  11321. The command accepts the same syntax of the corresponding option.
  11322. If the specified expression is not valid, it is kept at its current
  11323. value.
  11324. @end table
  11325. @section sab
  11326. Apply Shape Adaptive Blur.
  11327. The filter accepts the following options:
  11328. @table @option
  11329. @item luma_radius, lr
  11330. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11331. value is 1.0. A greater value will result in a more blurred image, and
  11332. in slower processing.
  11333. @item luma_pre_filter_radius, lpfr
  11334. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11335. value is 1.0.
  11336. @item luma_strength, ls
  11337. Set luma maximum difference between pixels to still be considered, must
  11338. be a value in the 0.1-100.0 range, default value is 1.0.
  11339. @item chroma_radius, cr
  11340. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11341. greater value will result in a more blurred image, and in slower
  11342. processing.
  11343. @item chroma_pre_filter_radius, cpfr
  11344. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11345. @item chroma_strength, cs
  11346. Set chroma maximum difference between pixels to still be considered,
  11347. must be a value in the -0.9-100.0 range.
  11348. @end table
  11349. Each chroma option value, if not explicitly specified, is set to the
  11350. corresponding luma option value.
  11351. @anchor{scale}
  11352. @section scale
  11353. Scale (resize) the input video, using the libswscale library.
  11354. The scale filter forces the output display aspect ratio to be the same
  11355. of the input, by changing the output sample aspect ratio.
  11356. If the input image format is different from the format requested by
  11357. the next filter, the scale filter will convert the input to the
  11358. requested format.
  11359. @subsection Options
  11360. The filter accepts the following options, or any of the options
  11361. supported by the libswscale scaler.
  11362. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11363. the complete list of scaler options.
  11364. @table @option
  11365. @item width, w
  11366. @item height, h
  11367. Set the output video dimension expression. Default value is the input
  11368. dimension.
  11369. If the @var{width} or @var{w} value is 0, the input width is used for
  11370. the output. If the @var{height} or @var{h} value is 0, the input height
  11371. is used for the output.
  11372. If one and only one of the values is -n with n >= 1, the scale filter
  11373. will use a value that maintains the aspect ratio of the input image,
  11374. calculated from the other specified dimension. After that it will,
  11375. however, make sure that the calculated dimension is divisible by n and
  11376. adjust the value if necessary.
  11377. If both values are -n with n >= 1, the behavior will be identical to
  11378. both values being set to 0 as previously detailed.
  11379. See below for the list of accepted constants for use in the dimension
  11380. expression.
  11381. @item eval
  11382. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11383. @table @samp
  11384. @item init
  11385. Only evaluate expressions once during the filter initialization or when a command is processed.
  11386. @item frame
  11387. Evaluate expressions for each incoming frame.
  11388. @end table
  11389. Default value is @samp{init}.
  11390. @item interl
  11391. Set the interlacing mode. It accepts the following values:
  11392. @table @samp
  11393. @item 1
  11394. Force interlaced aware scaling.
  11395. @item 0
  11396. Do not apply interlaced scaling.
  11397. @item -1
  11398. Select interlaced aware scaling depending on whether the source frames
  11399. are flagged as interlaced or not.
  11400. @end table
  11401. Default value is @samp{0}.
  11402. @item flags
  11403. Set libswscale scaling flags. See
  11404. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11405. complete list of values. If not explicitly specified the filter applies
  11406. the default flags.
  11407. @item param0, param1
  11408. Set libswscale input parameters for scaling algorithms that need them. See
  11409. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11410. complete documentation. If not explicitly specified the filter applies
  11411. empty parameters.
  11412. @item size, s
  11413. Set the video size. For the syntax of this option, check the
  11414. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11415. @item in_color_matrix
  11416. @item out_color_matrix
  11417. Set in/output YCbCr color space type.
  11418. This allows the autodetected value to be overridden as well as allows forcing
  11419. a specific value used for the output and encoder.
  11420. If not specified, the color space type depends on the pixel format.
  11421. Possible values:
  11422. @table @samp
  11423. @item auto
  11424. Choose automatically.
  11425. @item bt709
  11426. Format conforming to International Telecommunication Union (ITU)
  11427. Recommendation BT.709.
  11428. @item fcc
  11429. Set color space conforming to the United States Federal Communications
  11430. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11431. @item bt601
  11432. Set color space conforming to:
  11433. @itemize
  11434. @item
  11435. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11436. @item
  11437. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11438. @item
  11439. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11440. @end itemize
  11441. @item smpte240m
  11442. Set color space conforming to SMPTE ST 240:1999.
  11443. @end table
  11444. @item in_range
  11445. @item out_range
  11446. Set in/output YCbCr sample range.
  11447. This allows the autodetected value to be overridden as well as allows forcing
  11448. a specific value used for the output and encoder. If not specified, the
  11449. range depends on the pixel format. Possible values:
  11450. @table @samp
  11451. @item auto/unknown
  11452. Choose automatically.
  11453. @item jpeg/full/pc
  11454. Set full range (0-255 in case of 8-bit luma).
  11455. @item mpeg/limited/tv
  11456. Set "MPEG" range (16-235 in case of 8-bit luma).
  11457. @end table
  11458. @item force_original_aspect_ratio
  11459. Enable decreasing or increasing output video width or height if necessary to
  11460. keep the original aspect ratio. Possible values:
  11461. @table @samp
  11462. @item disable
  11463. Scale the video as specified and disable this feature.
  11464. @item decrease
  11465. The output video dimensions will automatically be decreased if needed.
  11466. @item increase
  11467. The output video dimensions will automatically be increased if needed.
  11468. @end table
  11469. One useful instance of this option is that when you know a specific device's
  11470. maximum allowed resolution, you can use this to limit the output video to
  11471. that, while retaining the aspect ratio. For example, device A allows
  11472. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11473. decrease) and specifying 1280x720 to the command line makes the output
  11474. 1280x533.
  11475. Please note that this is a different thing than specifying -1 for @option{w}
  11476. or @option{h}, you still need to specify the output resolution for this option
  11477. to work.
  11478. @end table
  11479. The values of the @option{w} and @option{h} options are expressions
  11480. containing the following constants:
  11481. @table @var
  11482. @item in_w
  11483. @item in_h
  11484. The input width and height
  11485. @item iw
  11486. @item ih
  11487. These are the same as @var{in_w} and @var{in_h}.
  11488. @item out_w
  11489. @item out_h
  11490. The output (scaled) width and height
  11491. @item ow
  11492. @item oh
  11493. These are the same as @var{out_w} and @var{out_h}
  11494. @item a
  11495. The same as @var{iw} / @var{ih}
  11496. @item sar
  11497. input sample aspect ratio
  11498. @item dar
  11499. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11500. @item hsub
  11501. @item vsub
  11502. horizontal and vertical input chroma subsample values. For example for the
  11503. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11504. @item ohsub
  11505. @item ovsub
  11506. horizontal and vertical output chroma subsample values. For example for the
  11507. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11508. @end table
  11509. @subsection Examples
  11510. @itemize
  11511. @item
  11512. Scale the input video to a size of 200x100
  11513. @example
  11514. scale=w=200:h=100
  11515. @end example
  11516. This is equivalent to:
  11517. @example
  11518. scale=200:100
  11519. @end example
  11520. or:
  11521. @example
  11522. scale=200x100
  11523. @end example
  11524. @item
  11525. Specify a size abbreviation for the output size:
  11526. @example
  11527. scale=qcif
  11528. @end example
  11529. which can also be written as:
  11530. @example
  11531. scale=size=qcif
  11532. @end example
  11533. @item
  11534. Scale the input to 2x:
  11535. @example
  11536. scale=w=2*iw:h=2*ih
  11537. @end example
  11538. @item
  11539. The above is the same as:
  11540. @example
  11541. scale=2*in_w:2*in_h
  11542. @end example
  11543. @item
  11544. Scale the input to 2x with forced interlaced scaling:
  11545. @example
  11546. scale=2*iw:2*ih:interl=1
  11547. @end example
  11548. @item
  11549. Scale the input to half size:
  11550. @example
  11551. scale=w=iw/2:h=ih/2
  11552. @end example
  11553. @item
  11554. Increase the width, and set the height to the same size:
  11555. @example
  11556. scale=3/2*iw:ow
  11557. @end example
  11558. @item
  11559. Seek Greek harmony:
  11560. @example
  11561. scale=iw:1/PHI*iw
  11562. scale=ih*PHI:ih
  11563. @end example
  11564. @item
  11565. Increase the height, and set the width to 3/2 of the height:
  11566. @example
  11567. scale=w=3/2*oh:h=3/5*ih
  11568. @end example
  11569. @item
  11570. Increase the size, making the size a multiple of the chroma
  11571. subsample values:
  11572. @example
  11573. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11574. @end example
  11575. @item
  11576. Increase the width to a maximum of 500 pixels,
  11577. keeping the same aspect ratio as the input:
  11578. @example
  11579. scale=w='min(500\, iw*3/2):h=-1'
  11580. @end example
  11581. @item
  11582. Make pixels square by combining scale and setsar:
  11583. @example
  11584. scale='trunc(ih*dar):ih',setsar=1/1
  11585. @end example
  11586. @item
  11587. Make pixels square by combining scale and setsar,
  11588. making sure the resulting resolution is even (required by some codecs):
  11589. @example
  11590. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11591. @end example
  11592. @end itemize
  11593. @subsection Commands
  11594. This filter supports the following commands:
  11595. @table @option
  11596. @item width, w
  11597. @item height, h
  11598. Set the output video dimension expression.
  11599. The command accepts the same syntax of the corresponding option.
  11600. If the specified expression is not valid, it is kept at its current
  11601. value.
  11602. @end table
  11603. @section scale_npp
  11604. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11605. format conversion on CUDA video frames. Setting the output width and height
  11606. works in the same way as for the @var{scale} filter.
  11607. The following additional options are accepted:
  11608. @table @option
  11609. @item format
  11610. The pixel format of the output CUDA frames. If set to the string "same" (the
  11611. default), the input format will be kept. Note that automatic format negotiation
  11612. and conversion is not yet supported for hardware frames
  11613. @item interp_algo
  11614. The interpolation algorithm used for resizing. One of the following:
  11615. @table @option
  11616. @item nn
  11617. Nearest neighbour.
  11618. @item linear
  11619. @item cubic
  11620. @item cubic2p_bspline
  11621. 2-parameter cubic (B=1, C=0)
  11622. @item cubic2p_catmullrom
  11623. 2-parameter cubic (B=0, C=1/2)
  11624. @item cubic2p_b05c03
  11625. 2-parameter cubic (B=1/2, C=3/10)
  11626. @item super
  11627. Supersampling
  11628. @item lanczos
  11629. @end table
  11630. @end table
  11631. @section scale2ref
  11632. Scale (resize) the input video, based on a reference video.
  11633. See the scale filter for available options, scale2ref supports the same but
  11634. uses the reference video instead of the main input as basis. scale2ref also
  11635. supports the following additional constants for the @option{w} and
  11636. @option{h} options:
  11637. @table @var
  11638. @item main_w
  11639. @item main_h
  11640. The main input video's width and height
  11641. @item main_a
  11642. The same as @var{main_w} / @var{main_h}
  11643. @item main_sar
  11644. The main input video's sample aspect ratio
  11645. @item main_dar, mdar
  11646. The main input video's display aspect ratio. Calculated from
  11647. @code{(main_w / main_h) * main_sar}.
  11648. @item main_hsub
  11649. @item main_vsub
  11650. The main input video's horizontal and vertical chroma subsample values.
  11651. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11652. is 1.
  11653. @end table
  11654. @subsection Examples
  11655. @itemize
  11656. @item
  11657. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11658. @example
  11659. 'scale2ref[b][a];[a][b]overlay'
  11660. @end example
  11661. @end itemize
  11662. @anchor{selectivecolor}
  11663. @section selectivecolor
  11664. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11665. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11666. by the "purity" of the color (that is, how saturated it already is).
  11667. This filter is similar to the Adobe Photoshop Selective Color tool.
  11668. The filter accepts the following options:
  11669. @table @option
  11670. @item correction_method
  11671. Select color correction method.
  11672. Available values are:
  11673. @table @samp
  11674. @item absolute
  11675. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11676. component value).
  11677. @item relative
  11678. Specified adjustments are relative to the original component value.
  11679. @end table
  11680. Default is @code{absolute}.
  11681. @item reds
  11682. Adjustments for red pixels (pixels where the red component is the maximum)
  11683. @item yellows
  11684. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11685. @item greens
  11686. Adjustments for green pixels (pixels where the green component is the maximum)
  11687. @item cyans
  11688. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11689. @item blues
  11690. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11691. @item magentas
  11692. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11693. @item whites
  11694. Adjustments for white pixels (pixels where all components are greater than 128)
  11695. @item neutrals
  11696. Adjustments for all pixels except pure black and pure white
  11697. @item blacks
  11698. Adjustments for black pixels (pixels where all components are lesser than 128)
  11699. @item psfile
  11700. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11701. @end table
  11702. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11703. 4 space separated floating point adjustment values in the [-1,1] range,
  11704. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11705. pixels of its range.
  11706. @subsection Examples
  11707. @itemize
  11708. @item
  11709. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11710. increase magenta by 27% in blue areas:
  11711. @example
  11712. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11713. @end example
  11714. @item
  11715. Use a Photoshop selective color preset:
  11716. @example
  11717. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11718. @end example
  11719. @end itemize
  11720. @anchor{separatefields}
  11721. @section separatefields
  11722. The @code{separatefields} takes a frame-based video input and splits
  11723. each frame into its components fields, producing a new half height clip
  11724. with twice the frame rate and twice the frame count.
  11725. This filter use field-dominance information in frame to decide which
  11726. of each pair of fields to place first in the output.
  11727. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11728. @section setdar, setsar
  11729. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11730. output video.
  11731. This is done by changing the specified Sample (aka Pixel) Aspect
  11732. Ratio, according to the following equation:
  11733. @example
  11734. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11735. @end example
  11736. Keep in mind that the @code{setdar} filter does not modify the pixel
  11737. dimensions of the video frame. Also, the display aspect ratio set by
  11738. this filter may be changed by later filters in the filterchain,
  11739. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11740. applied.
  11741. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11742. the filter output video.
  11743. Note that as a consequence of the application of this filter, the
  11744. output display aspect ratio will change according to the equation
  11745. above.
  11746. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11747. filter may be changed by later filters in the filterchain, e.g. if
  11748. another "setsar" or a "setdar" filter is applied.
  11749. It accepts the following parameters:
  11750. @table @option
  11751. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11752. Set the aspect ratio used by the filter.
  11753. The parameter can be a floating point number string, an expression, or
  11754. a string of the form @var{num}:@var{den}, where @var{num} and
  11755. @var{den} are the numerator and denominator of the aspect ratio. If
  11756. the parameter is not specified, it is assumed the value "0".
  11757. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11758. should be escaped.
  11759. @item max
  11760. Set the maximum integer value to use for expressing numerator and
  11761. denominator when reducing the expressed aspect ratio to a rational.
  11762. Default value is @code{100}.
  11763. @end table
  11764. The parameter @var{sar} is an expression containing
  11765. the following constants:
  11766. @table @option
  11767. @item E, PI, PHI
  11768. These are approximated values for the mathematical constants e
  11769. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11770. @item w, h
  11771. The input width and height.
  11772. @item a
  11773. These are the same as @var{w} / @var{h}.
  11774. @item sar
  11775. The input sample aspect ratio.
  11776. @item dar
  11777. The input display aspect ratio. It is the same as
  11778. (@var{w} / @var{h}) * @var{sar}.
  11779. @item hsub, vsub
  11780. Horizontal and vertical chroma subsample values. For example, for the
  11781. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11782. @end table
  11783. @subsection Examples
  11784. @itemize
  11785. @item
  11786. To change the display aspect ratio to 16:9, specify one of the following:
  11787. @example
  11788. setdar=dar=1.77777
  11789. setdar=dar=16/9
  11790. @end example
  11791. @item
  11792. To change the sample aspect ratio to 10:11, specify:
  11793. @example
  11794. setsar=sar=10/11
  11795. @end example
  11796. @item
  11797. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11798. 1000 in the aspect ratio reduction, use the command:
  11799. @example
  11800. setdar=ratio=16/9:max=1000
  11801. @end example
  11802. @end itemize
  11803. @anchor{setfield}
  11804. @section setfield
  11805. Force field for the output video frame.
  11806. The @code{setfield} filter marks the interlace type field for the
  11807. output frames. It does not change the input frame, but only sets the
  11808. corresponding property, which affects how the frame is treated by
  11809. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11810. The filter accepts the following options:
  11811. @table @option
  11812. @item mode
  11813. Available values are:
  11814. @table @samp
  11815. @item auto
  11816. Keep the same field property.
  11817. @item bff
  11818. Mark the frame as bottom-field-first.
  11819. @item tff
  11820. Mark the frame as top-field-first.
  11821. @item prog
  11822. Mark the frame as progressive.
  11823. @end table
  11824. @end table
  11825. @anchor{setparams}
  11826. @section setparams
  11827. Force frame parameter for the output video frame.
  11828. The @code{setparams} filter marks interlace and color range for the
  11829. output frames. It does not change the input frame, but only sets the
  11830. corresponding property, which affects how the frame is treated by
  11831. filters/encoders.
  11832. @table @option
  11833. @item field_mode
  11834. Available values are:
  11835. @table @samp
  11836. @item auto
  11837. Keep the same field property (default).
  11838. @item bff
  11839. Mark the frame as bottom-field-first.
  11840. @item tff
  11841. Mark the frame as top-field-first.
  11842. @item prog
  11843. Mark the frame as progressive.
  11844. @end table
  11845. @item range
  11846. Available values are:
  11847. @table @samp
  11848. @item auto
  11849. Keep the same color range property (default).
  11850. @item unspecified, unknown
  11851. Mark the frame as unspecified color range.
  11852. @item limited, tv, mpeg
  11853. Mark the frame as limited range.
  11854. @item full, pc, jpeg
  11855. Mark the frame as full range.
  11856. @end table
  11857. @item color_primaries
  11858. Set the color primaries.
  11859. Available values are:
  11860. @table @samp
  11861. @item auto
  11862. Keep the same color primaries property (default).
  11863. @item bt709
  11864. @item unknown
  11865. @item bt470m
  11866. @item bt470bg
  11867. @item smpte170m
  11868. @item smpte240m
  11869. @item film
  11870. @item bt2020
  11871. @item smpte428
  11872. @item smpte431
  11873. @item smpte432
  11874. @item jedec-p22
  11875. @end table
  11876. @item color_trc
  11877. Set the color transfer.
  11878. Available values are:
  11879. @table @samp
  11880. @item auto
  11881. Keep the same color trc property (default).
  11882. @item bt709
  11883. @item unknown
  11884. @item bt470m
  11885. @item bt470bg
  11886. @item smpte170m
  11887. @item smpte240m
  11888. @item linear
  11889. @item log100
  11890. @item log316
  11891. @item iec61966-2-4
  11892. @item bt1361e
  11893. @item iec61966-2-1
  11894. @item bt2020-10
  11895. @item bt2020-12
  11896. @item smpte2084
  11897. @item smpte428
  11898. @item arib-std-b67
  11899. @end table
  11900. @item colorspace
  11901. Set the colorspace.
  11902. Available values are:
  11903. @table @samp
  11904. @item auto
  11905. Keep the same colorspace property (default).
  11906. @item gbr
  11907. @item bt709
  11908. @item unknown
  11909. @item fcc
  11910. @item bt470bg
  11911. @item smpte170m
  11912. @item smpte240m
  11913. @item ycgco
  11914. @item bt2020nc
  11915. @item bt2020c
  11916. @item smpte2085
  11917. @item chroma-derived-nc
  11918. @item chroma-derived-c
  11919. @item ictcp
  11920. @end table
  11921. @end table
  11922. @section showinfo
  11923. Show a line containing various information for each input video frame.
  11924. The input video is not modified.
  11925. This filter supports the following options:
  11926. @table @option
  11927. @item checksum
  11928. Calculate checksums of each plane. By default enabled.
  11929. @end table
  11930. The shown line contains a sequence of key/value pairs of the form
  11931. @var{key}:@var{value}.
  11932. The following values are shown in the output:
  11933. @table @option
  11934. @item n
  11935. The (sequential) number of the input frame, starting from 0.
  11936. @item pts
  11937. The Presentation TimeStamp of the input frame, expressed as a number of
  11938. time base units. The time base unit depends on the filter input pad.
  11939. @item pts_time
  11940. The Presentation TimeStamp of the input frame, expressed as a number of
  11941. seconds.
  11942. @item pos
  11943. The position of the frame in the input stream, or -1 if this information is
  11944. unavailable and/or meaningless (for example in case of synthetic video).
  11945. @item fmt
  11946. The pixel format name.
  11947. @item sar
  11948. The sample aspect ratio of the input frame, expressed in the form
  11949. @var{num}/@var{den}.
  11950. @item s
  11951. The size of the input frame. For the syntax of this option, check the
  11952. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11953. @item i
  11954. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11955. for bottom field first).
  11956. @item iskey
  11957. This is 1 if the frame is a key frame, 0 otherwise.
  11958. @item type
  11959. The picture type of the input frame ("I" for an I-frame, "P" for a
  11960. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11961. Also refer to the documentation of the @code{AVPictureType} enum and of
  11962. the @code{av_get_picture_type_char} function defined in
  11963. @file{libavutil/avutil.h}.
  11964. @item checksum
  11965. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11966. @item plane_checksum
  11967. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11968. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11969. @end table
  11970. @section showpalette
  11971. Displays the 256 colors palette of each frame. This filter is only relevant for
  11972. @var{pal8} pixel format frames.
  11973. It accepts the following option:
  11974. @table @option
  11975. @item s
  11976. Set the size of the box used to represent one palette color entry. Default is
  11977. @code{30} (for a @code{30x30} pixel box).
  11978. @end table
  11979. @section shuffleframes
  11980. Reorder and/or duplicate and/or drop video frames.
  11981. It accepts the following parameters:
  11982. @table @option
  11983. @item mapping
  11984. Set the destination indexes of input frames.
  11985. This is space or '|' separated list of indexes that maps input frames to output
  11986. frames. Number of indexes also sets maximal value that each index may have.
  11987. '-1' index have special meaning and that is to drop frame.
  11988. @end table
  11989. The first frame has the index 0. The default is to keep the input unchanged.
  11990. @subsection Examples
  11991. @itemize
  11992. @item
  11993. Swap second and third frame of every three frames of the input:
  11994. @example
  11995. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11996. @end example
  11997. @item
  11998. Swap 10th and 1st frame of every ten frames of the input:
  11999. @example
  12000. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12001. @end example
  12002. @end itemize
  12003. @section shuffleplanes
  12004. Reorder and/or duplicate video planes.
  12005. It accepts the following parameters:
  12006. @table @option
  12007. @item map0
  12008. The index of the input plane to be used as the first output plane.
  12009. @item map1
  12010. The index of the input plane to be used as the second output plane.
  12011. @item map2
  12012. The index of the input plane to be used as the third output plane.
  12013. @item map3
  12014. The index of the input plane to be used as the fourth output plane.
  12015. @end table
  12016. The first plane has the index 0. The default is to keep the input unchanged.
  12017. @subsection Examples
  12018. @itemize
  12019. @item
  12020. Swap the second and third planes of the input:
  12021. @example
  12022. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12023. @end example
  12024. @end itemize
  12025. @anchor{signalstats}
  12026. @section signalstats
  12027. Evaluate various visual metrics that assist in determining issues associated
  12028. with the digitization of analog video media.
  12029. By default the filter will log these metadata values:
  12030. @table @option
  12031. @item YMIN
  12032. Display the minimal Y value contained within the input frame. Expressed in
  12033. range of [0-255].
  12034. @item YLOW
  12035. Display the Y value at the 10% percentile within the input frame. Expressed in
  12036. range of [0-255].
  12037. @item YAVG
  12038. Display the average Y value within the input frame. Expressed in range of
  12039. [0-255].
  12040. @item YHIGH
  12041. Display the Y value at the 90% percentile within the input frame. Expressed in
  12042. range of [0-255].
  12043. @item YMAX
  12044. Display the maximum Y value contained within the input frame. Expressed in
  12045. range of [0-255].
  12046. @item UMIN
  12047. Display the minimal U value contained within the input frame. Expressed in
  12048. range of [0-255].
  12049. @item ULOW
  12050. Display the U value at the 10% percentile within the input frame. Expressed in
  12051. range of [0-255].
  12052. @item UAVG
  12053. Display the average U value within the input frame. Expressed in range of
  12054. [0-255].
  12055. @item UHIGH
  12056. Display the U value at the 90% percentile within the input frame. Expressed in
  12057. range of [0-255].
  12058. @item UMAX
  12059. Display the maximum U value contained within the input frame. Expressed in
  12060. range of [0-255].
  12061. @item VMIN
  12062. Display the minimal V value contained within the input frame. Expressed in
  12063. range of [0-255].
  12064. @item VLOW
  12065. Display the V value at the 10% percentile within the input frame. Expressed in
  12066. range of [0-255].
  12067. @item VAVG
  12068. Display the average V value within the input frame. Expressed in range of
  12069. [0-255].
  12070. @item VHIGH
  12071. Display the V value at the 90% percentile within the input frame. Expressed in
  12072. range of [0-255].
  12073. @item VMAX
  12074. Display the maximum V value contained within the input frame. Expressed in
  12075. range of [0-255].
  12076. @item SATMIN
  12077. Display the minimal saturation value contained within the input frame.
  12078. Expressed in range of [0-~181.02].
  12079. @item SATLOW
  12080. Display the saturation value at the 10% percentile within the input frame.
  12081. Expressed in range of [0-~181.02].
  12082. @item SATAVG
  12083. Display the average saturation value within the input frame. Expressed in range
  12084. of [0-~181.02].
  12085. @item SATHIGH
  12086. Display the saturation value at the 90% percentile within the input frame.
  12087. Expressed in range of [0-~181.02].
  12088. @item SATMAX
  12089. Display the maximum saturation value contained within the input frame.
  12090. Expressed in range of [0-~181.02].
  12091. @item HUEMED
  12092. Display the median value for hue within the input frame. Expressed in range of
  12093. [0-360].
  12094. @item HUEAVG
  12095. Display the average value for hue within the input frame. Expressed in range of
  12096. [0-360].
  12097. @item YDIF
  12098. Display the average of sample value difference between all values of the Y
  12099. plane in the current frame and corresponding values of the previous input frame.
  12100. Expressed in range of [0-255].
  12101. @item UDIF
  12102. Display the average of sample value difference between all values of the U
  12103. plane in the current frame and corresponding values of the previous input frame.
  12104. Expressed in range of [0-255].
  12105. @item VDIF
  12106. Display the average of sample value difference between all values of the V
  12107. plane in the current frame and corresponding values of the previous input frame.
  12108. Expressed in range of [0-255].
  12109. @item YBITDEPTH
  12110. Display bit depth of Y plane in current frame.
  12111. Expressed in range of [0-16].
  12112. @item UBITDEPTH
  12113. Display bit depth of U plane in current frame.
  12114. Expressed in range of [0-16].
  12115. @item VBITDEPTH
  12116. Display bit depth of V plane in current frame.
  12117. Expressed in range of [0-16].
  12118. @end table
  12119. The filter accepts the following options:
  12120. @table @option
  12121. @item stat
  12122. @item out
  12123. @option{stat} specify an additional form of image analysis.
  12124. @option{out} output video with the specified type of pixel highlighted.
  12125. Both options accept the following values:
  12126. @table @samp
  12127. @item tout
  12128. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12129. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12130. include the results of video dropouts, head clogs, or tape tracking issues.
  12131. @item vrep
  12132. Identify @var{vertical line repetition}. Vertical line repetition includes
  12133. similar rows of pixels within a frame. In born-digital video vertical line
  12134. repetition is common, but this pattern is uncommon in video digitized from an
  12135. analog source. When it occurs in video that results from the digitization of an
  12136. analog source it can indicate concealment from a dropout compensator.
  12137. @item brng
  12138. Identify pixels that fall outside of legal broadcast range.
  12139. @end table
  12140. @item color, c
  12141. Set the highlight color for the @option{out} option. The default color is
  12142. yellow.
  12143. @end table
  12144. @subsection Examples
  12145. @itemize
  12146. @item
  12147. Output data of various video metrics:
  12148. @example
  12149. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12150. @end example
  12151. @item
  12152. Output specific data about the minimum and maximum values of the Y plane per frame:
  12153. @example
  12154. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12155. @end example
  12156. @item
  12157. Playback video while highlighting pixels that are outside of broadcast range in red.
  12158. @example
  12159. ffplay example.mov -vf signalstats="out=brng:color=red"
  12160. @end example
  12161. @item
  12162. Playback video with signalstats metadata drawn over the frame.
  12163. @example
  12164. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12165. @end example
  12166. The contents of signalstat_drawtext.txt used in the command are:
  12167. @example
  12168. time %@{pts:hms@}
  12169. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12170. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12171. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12172. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12173. @end example
  12174. @end itemize
  12175. @anchor{signature}
  12176. @section signature
  12177. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12178. input. In this case the matching between the inputs can be calculated additionally.
  12179. The filter always passes through the first input. The signature of each stream can
  12180. be written into a file.
  12181. It accepts the following options:
  12182. @table @option
  12183. @item detectmode
  12184. Enable or disable the matching process.
  12185. Available values are:
  12186. @table @samp
  12187. @item off
  12188. Disable the calculation of a matching (default).
  12189. @item full
  12190. Calculate the matching for the whole video and output whether the whole video
  12191. matches or only parts.
  12192. @item fast
  12193. Calculate only until a matching is found or the video ends. Should be faster in
  12194. some cases.
  12195. @end table
  12196. @item nb_inputs
  12197. Set the number of inputs. The option value must be a non negative integer.
  12198. Default value is 1.
  12199. @item filename
  12200. Set the path to which the output is written. If there is more than one input,
  12201. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12202. integer), that will be replaced with the input number. If no filename is
  12203. specified, no output will be written. This is the default.
  12204. @item format
  12205. Choose the output format.
  12206. Available values are:
  12207. @table @samp
  12208. @item binary
  12209. Use the specified binary representation (default).
  12210. @item xml
  12211. Use the specified xml representation.
  12212. @end table
  12213. @item th_d
  12214. Set threshold to detect one word as similar. The option value must be an integer
  12215. greater than zero. The default value is 9000.
  12216. @item th_dc
  12217. Set threshold to detect all words as similar. The option value must be an integer
  12218. greater than zero. The default value is 60000.
  12219. @item th_xh
  12220. Set threshold to detect frames as similar. The option value must be an integer
  12221. greater than zero. The default value is 116.
  12222. @item th_di
  12223. Set the minimum length of a sequence in frames to recognize it as matching
  12224. sequence. The option value must be a non negative integer value.
  12225. The default value is 0.
  12226. @item th_it
  12227. Set the minimum relation, that matching frames to all frames must have.
  12228. The option value must be a double value between 0 and 1. The default value is 0.5.
  12229. @end table
  12230. @subsection Examples
  12231. @itemize
  12232. @item
  12233. To calculate the signature of an input video and store it in signature.bin:
  12234. @example
  12235. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12236. @end example
  12237. @item
  12238. To detect whether two videos match and store the signatures in XML format in
  12239. signature0.xml and signature1.xml:
  12240. @example
  12241. 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 -
  12242. @end example
  12243. @end itemize
  12244. @anchor{smartblur}
  12245. @section smartblur
  12246. Blur the input video without impacting the outlines.
  12247. It accepts the following options:
  12248. @table @option
  12249. @item luma_radius, lr
  12250. Set the luma radius. The option value must be a float number in
  12251. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12252. used to blur the image (slower if larger). Default value is 1.0.
  12253. @item luma_strength, ls
  12254. Set the luma strength. The option value must be a float number
  12255. in the range [-1.0,1.0] that configures the blurring. A value included
  12256. in [0.0,1.0] will blur the image whereas a value included in
  12257. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12258. @item luma_threshold, lt
  12259. Set the luma threshold used as a coefficient to determine
  12260. whether a pixel should be blurred or not. The option value must be an
  12261. integer in the range [-30,30]. A value of 0 will filter all the image,
  12262. a value included in [0,30] will filter flat areas and a value included
  12263. in [-30,0] will filter edges. Default value is 0.
  12264. @item chroma_radius, cr
  12265. Set the chroma radius. The option value must be a float number in
  12266. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12267. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12268. @item chroma_strength, cs
  12269. Set the chroma strength. The option value must be a float number
  12270. in the range [-1.0,1.0] that configures the blurring. A value included
  12271. in [0.0,1.0] will blur the image whereas a value included in
  12272. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12273. @item chroma_threshold, ct
  12274. Set the chroma threshold used as a coefficient to determine
  12275. whether a pixel should be blurred or not. The option value must be an
  12276. integer in the range [-30,30]. A value of 0 will filter all the image,
  12277. a value included in [0,30] will filter flat areas and a value included
  12278. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12279. @end table
  12280. If a chroma option is not explicitly set, the corresponding luma value
  12281. is set.
  12282. @section ssim
  12283. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12284. This filter takes in input two input videos, the first input is
  12285. considered the "main" source and is passed unchanged to the
  12286. output. The second input is used as a "reference" video for computing
  12287. the SSIM.
  12288. Both video inputs must have the same resolution and pixel format for
  12289. this filter to work correctly. Also it assumes that both inputs
  12290. have the same number of frames, which are compared one by one.
  12291. The filter stores the calculated SSIM of each frame.
  12292. The description of the accepted parameters follows.
  12293. @table @option
  12294. @item stats_file, f
  12295. If specified the filter will use the named file to save the SSIM of
  12296. each individual frame. When filename equals "-" the data is sent to
  12297. standard output.
  12298. @end table
  12299. The file printed if @var{stats_file} is selected, contains a sequence of
  12300. key/value pairs of the form @var{key}:@var{value} for each compared
  12301. couple of frames.
  12302. A description of each shown parameter follows:
  12303. @table @option
  12304. @item n
  12305. sequential number of the input frame, starting from 1
  12306. @item Y, U, V, R, G, B
  12307. SSIM of the compared frames for the component specified by the suffix.
  12308. @item All
  12309. SSIM of the compared frames for the whole frame.
  12310. @item dB
  12311. Same as above but in dB representation.
  12312. @end table
  12313. This filter also supports the @ref{framesync} options.
  12314. For example:
  12315. @example
  12316. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12317. [main][ref] ssim="stats_file=stats.log" [out]
  12318. @end example
  12319. On this example the input file being processed is compared with the
  12320. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12321. is stored in @file{stats.log}.
  12322. Another example with both psnr and ssim at same time:
  12323. @example
  12324. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12325. @end example
  12326. @section stereo3d
  12327. Convert between different stereoscopic image formats.
  12328. The filters accept the following options:
  12329. @table @option
  12330. @item in
  12331. Set stereoscopic image format of input.
  12332. Available values for input image formats are:
  12333. @table @samp
  12334. @item sbsl
  12335. side by side parallel (left eye left, right eye right)
  12336. @item sbsr
  12337. side by side crosseye (right eye left, left eye right)
  12338. @item sbs2l
  12339. side by side parallel with half width resolution
  12340. (left eye left, right eye right)
  12341. @item sbs2r
  12342. side by side crosseye with half width resolution
  12343. (right eye left, left eye right)
  12344. @item abl
  12345. above-below (left eye above, right eye below)
  12346. @item abr
  12347. above-below (right eye above, left eye below)
  12348. @item ab2l
  12349. above-below with half height resolution
  12350. (left eye above, right eye below)
  12351. @item ab2r
  12352. above-below with half height resolution
  12353. (right eye above, left eye below)
  12354. @item al
  12355. alternating frames (left eye first, right eye second)
  12356. @item ar
  12357. alternating frames (right eye first, left eye second)
  12358. @item irl
  12359. interleaved rows (left eye has top row, right eye starts on next row)
  12360. @item irr
  12361. interleaved rows (right eye has top row, left eye starts on next row)
  12362. @item icl
  12363. interleaved columns, left eye first
  12364. @item icr
  12365. interleaved columns, right eye first
  12366. Default value is @samp{sbsl}.
  12367. @end table
  12368. @item out
  12369. Set stereoscopic image format of output.
  12370. @table @samp
  12371. @item sbsl
  12372. side by side parallel (left eye left, right eye right)
  12373. @item sbsr
  12374. side by side crosseye (right eye left, left eye right)
  12375. @item sbs2l
  12376. side by side parallel with half width resolution
  12377. (left eye left, right eye right)
  12378. @item sbs2r
  12379. side by side crosseye with half width resolution
  12380. (right eye left, left eye right)
  12381. @item abl
  12382. above-below (left eye above, right eye below)
  12383. @item abr
  12384. above-below (right eye above, left eye below)
  12385. @item ab2l
  12386. above-below with half height resolution
  12387. (left eye above, right eye below)
  12388. @item ab2r
  12389. above-below with half height resolution
  12390. (right eye above, left eye below)
  12391. @item al
  12392. alternating frames (left eye first, right eye second)
  12393. @item ar
  12394. alternating frames (right eye first, left eye second)
  12395. @item irl
  12396. interleaved rows (left eye has top row, right eye starts on next row)
  12397. @item irr
  12398. interleaved rows (right eye has top row, left eye starts on next row)
  12399. @item arbg
  12400. anaglyph red/blue gray
  12401. (red filter on left eye, blue filter on right eye)
  12402. @item argg
  12403. anaglyph red/green gray
  12404. (red filter on left eye, green filter on right eye)
  12405. @item arcg
  12406. anaglyph red/cyan gray
  12407. (red filter on left eye, cyan filter on right eye)
  12408. @item arch
  12409. anaglyph red/cyan half colored
  12410. (red filter on left eye, cyan filter on right eye)
  12411. @item arcc
  12412. anaglyph red/cyan color
  12413. (red filter on left eye, cyan filter on right eye)
  12414. @item arcd
  12415. anaglyph red/cyan color optimized with the least squares projection of dubois
  12416. (red filter on left eye, cyan filter on right eye)
  12417. @item agmg
  12418. anaglyph green/magenta gray
  12419. (green filter on left eye, magenta filter on right eye)
  12420. @item agmh
  12421. anaglyph green/magenta half colored
  12422. (green filter on left eye, magenta filter on right eye)
  12423. @item agmc
  12424. anaglyph green/magenta colored
  12425. (green filter on left eye, magenta filter on right eye)
  12426. @item agmd
  12427. anaglyph green/magenta color optimized with the least squares projection of dubois
  12428. (green filter on left eye, magenta filter on right eye)
  12429. @item aybg
  12430. anaglyph yellow/blue gray
  12431. (yellow filter on left eye, blue filter on right eye)
  12432. @item aybh
  12433. anaglyph yellow/blue half colored
  12434. (yellow filter on left eye, blue filter on right eye)
  12435. @item aybc
  12436. anaglyph yellow/blue colored
  12437. (yellow filter on left eye, blue filter on right eye)
  12438. @item aybd
  12439. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12440. (yellow filter on left eye, blue filter on right eye)
  12441. @item ml
  12442. mono output (left eye only)
  12443. @item mr
  12444. mono output (right eye only)
  12445. @item chl
  12446. checkerboard, left eye first
  12447. @item chr
  12448. checkerboard, right eye first
  12449. @item icl
  12450. interleaved columns, left eye first
  12451. @item icr
  12452. interleaved columns, right eye first
  12453. @item hdmi
  12454. HDMI frame pack
  12455. @end table
  12456. Default value is @samp{arcd}.
  12457. @end table
  12458. @subsection Examples
  12459. @itemize
  12460. @item
  12461. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12462. @example
  12463. stereo3d=sbsl:aybd
  12464. @end example
  12465. @item
  12466. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12467. @example
  12468. stereo3d=abl:sbsr
  12469. @end example
  12470. @end itemize
  12471. @section streamselect, astreamselect
  12472. Select video or audio streams.
  12473. The filter accepts the following options:
  12474. @table @option
  12475. @item inputs
  12476. Set number of inputs. Default is 2.
  12477. @item map
  12478. Set input indexes to remap to outputs.
  12479. @end table
  12480. @subsection Commands
  12481. The @code{streamselect} and @code{astreamselect} filter supports the following
  12482. commands:
  12483. @table @option
  12484. @item map
  12485. Set input indexes to remap to outputs.
  12486. @end table
  12487. @subsection Examples
  12488. @itemize
  12489. @item
  12490. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12491. @example
  12492. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12493. @end example
  12494. @item
  12495. Same as above, but for audio:
  12496. @example
  12497. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12498. @end example
  12499. @end itemize
  12500. @section sobel
  12501. Apply sobel operator to input video stream.
  12502. The filter accepts the following option:
  12503. @table @option
  12504. @item planes
  12505. Set which planes will be processed, unprocessed planes will be copied.
  12506. By default value 0xf, all planes will be processed.
  12507. @item scale
  12508. Set value which will be multiplied with filtered result.
  12509. @item delta
  12510. Set value which will be added to filtered result.
  12511. @end table
  12512. @anchor{spp}
  12513. @section spp
  12514. Apply a simple postprocessing filter that compresses and decompresses the image
  12515. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12516. and average the results.
  12517. The filter accepts the following options:
  12518. @table @option
  12519. @item quality
  12520. Set quality. This option defines the number of levels for averaging. It accepts
  12521. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12522. effect. A value of @code{6} means the higher quality. For each increment of
  12523. that value the speed drops by a factor of approximately 2. Default value is
  12524. @code{3}.
  12525. @item qp
  12526. Force a constant quantization parameter. If not set, the filter will use the QP
  12527. from the video stream (if available).
  12528. @item mode
  12529. Set thresholding mode. Available modes are:
  12530. @table @samp
  12531. @item hard
  12532. Set hard thresholding (default).
  12533. @item soft
  12534. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12535. @end table
  12536. @item use_bframe_qp
  12537. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12538. option may cause flicker since the B-Frames have often larger QP. Default is
  12539. @code{0} (not enabled).
  12540. @end table
  12541. @section sr
  12542. Scale the input by applying one of the super-resolution methods based on
  12543. convolutional neural networks. Supported models:
  12544. @itemize
  12545. @item
  12546. Super-Resolution Convolutional Neural Network model (SRCNN).
  12547. See @url{https://arxiv.org/abs/1501.00092}.
  12548. @item
  12549. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12550. See @url{https://arxiv.org/abs/1609.05158}.
  12551. @end itemize
  12552. Training scripts as well as scripts for model generation are provided in
  12553. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12554. The filter accepts the following options:
  12555. @table @option
  12556. @item dnn_backend
  12557. Specify which DNN backend to use for model loading and execution. This option accepts
  12558. the following values:
  12559. @table @samp
  12560. @item native
  12561. Native implementation of DNN loading and execution.
  12562. @item tensorflow
  12563. TensorFlow backend. To enable this backend you
  12564. need to install the TensorFlow for C library (see
  12565. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12566. @code{--enable-libtensorflow}
  12567. @end table
  12568. Default value is @samp{native}.
  12569. @item model
  12570. Set path to model file specifying network architecture and its parameters.
  12571. Note that different backends use different file formats. TensorFlow backend
  12572. can load files for both formats, while native backend can load files for only
  12573. its format.
  12574. @item scale_factor
  12575. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12576. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12577. input upscaled using bicubic upscaling with proper scale factor.
  12578. @end table
  12579. @anchor{subtitles}
  12580. @section subtitles
  12581. Draw subtitles on top of input video using the libass library.
  12582. To enable compilation of this filter you need to configure FFmpeg with
  12583. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12584. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12585. Alpha) subtitles format.
  12586. The filter accepts the following options:
  12587. @table @option
  12588. @item filename, f
  12589. Set the filename of the subtitle file to read. It must be specified.
  12590. @item original_size
  12591. Specify the size of the original video, the video for which the ASS file
  12592. was composed. For the syntax of this option, check the
  12593. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12594. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12595. correctly scale the fonts if the aspect ratio has been changed.
  12596. @item fontsdir
  12597. Set a directory path containing fonts that can be used by the filter.
  12598. These fonts will be used in addition to whatever the font provider uses.
  12599. @item alpha
  12600. Process alpha channel, by default alpha channel is untouched.
  12601. @item charenc
  12602. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12603. useful if not UTF-8.
  12604. @item stream_index, si
  12605. Set subtitles stream index. @code{subtitles} filter only.
  12606. @item force_style
  12607. Override default style or script info parameters of the subtitles. It accepts a
  12608. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12609. @end table
  12610. If the first key is not specified, it is assumed that the first value
  12611. specifies the @option{filename}.
  12612. For example, to render the file @file{sub.srt} on top of the input
  12613. video, use the command:
  12614. @example
  12615. subtitles=sub.srt
  12616. @end example
  12617. which is equivalent to:
  12618. @example
  12619. subtitles=filename=sub.srt
  12620. @end example
  12621. To render the default subtitles stream from file @file{video.mkv}, use:
  12622. @example
  12623. subtitles=video.mkv
  12624. @end example
  12625. To render the second subtitles stream from that file, use:
  12626. @example
  12627. subtitles=video.mkv:si=1
  12628. @end example
  12629. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12630. @code{DejaVu Serif}, use:
  12631. @example
  12632. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12633. @end example
  12634. @section super2xsai
  12635. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12636. Interpolate) pixel art scaling algorithm.
  12637. Useful for enlarging pixel art images without reducing sharpness.
  12638. @section swaprect
  12639. Swap two rectangular objects in video.
  12640. This filter accepts the following options:
  12641. @table @option
  12642. @item w
  12643. Set object width.
  12644. @item h
  12645. Set object height.
  12646. @item x1
  12647. Set 1st rect x coordinate.
  12648. @item y1
  12649. Set 1st rect y coordinate.
  12650. @item x2
  12651. Set 2nd rect x coordinate.
  12652. @item y2
  12653. Set 2nd rect y coordinate.
  12654. All expressions are evaluated once for each frame.
  12655. @end table
  12656. The all options are expressions containing the following constants:
  12657. @table @option
  12658. @item w
  12659. @item h
  12660. The input width and height.
  12661. @item a
  12662. same as @var{w} / @var{h}
  12663. @item sar
  12664. input sample aspect ratio
  12665. @item dar
  12666. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12667. @item n
  12668. The number of the input frame, starting from 0.
  12669. @item t
  12670. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12671. @item pos
  12672. the position in the file of the input frame, NAN if unknown
  12673. @end table
  12674. @section swapuv
  12675. Swap U & V plane.
  12676. @section telecine
  12677. Apply telecine process to the video.
  12678. This filter accepts the following options:
  12679. @table @option
  12680. @item first_field
  12681. @table @samp
  12682. @item top, t
  12683. top field first
  12684. @item bottom, b
  12685. bottom field first
  12686. The default value is @code{top}.
  12687. @end table
  12688. @item pattern
  12689. A string of numbers representing the pulldown pattern you wish to apply.
  12690. The default value is @code{23}.
  12691. @end table
  12692. @example
  12693. Some typical patterns:
  12694. NTSC output (30i):
  12695. 27.5p: 32222
  12696. 24p: 23 (classic)
  12697. 24p: 2332 (preferred)
  12698. 20p: 33
  12699. 18p: 334
  12700. 16p: 3444
  12701. PAL output (25i):
  12702. 27.5p: 12222
  12703. 24p: 222222222223 ("Euro pulldown")
  12704. 16.67p: 33
  12705. 16p: 33333334
  12706. @end example
  12707. @section threshold
  12708. Apply threshold effect to video stream.
  12709. This filter needs four video streams to perform thresholding.
  12710. First stream is stream we are filtering.
  12711. Second stream is holding threshold values, third stream is holding min values,
  12712. and last, fourth stream is holding max values.
  12713. The filter accepts the following option:
  12714. @table @option
  12715. @item planes
  12716. Set which planes will be processed, unprocessed planes will be copied.
  12717. By default value 0xf, all planes will be processed.
  12718. @end table
  12719. For example if first stream pixel's component value is less then threshold value
  12720. of pixel component from 2nd threshold stream, third stream value will picked,
  12721. otherwise fourth stream pixel component value will be picked.
  12722. Using color source filter one can perform various types of thresholding:
  12723. @subsection Examples
  12724. @itemize
  12725. @item
  12726. Binary threshold, using gray color as threshold:
  12727. @example
  12728. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12729. @end example
  12730. @item
  12731. Inverted binary threshold, using gray color as threshold:
  12732. @example
  12733. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12734. @end example
  12735. @item
  12736. Truncate binary threshold, using gray color as threshold:
  12737. @example
  12738. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12739. @end example
  12740. @item
  12741. Threshold to zero, using gray color as threshold:
  12742. @example
  12743. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12744. @end example
  12745. @item
  12746. Inverted threshold to zero, using gray color as threshold:
  12747. @example
  12748. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12749. @end example
  12750. @end itemize
  12751. @section thumbnail
  12752. Select the most representative frame in a given sequence of consecutive frames.
  12753. The filter accepts the following options:
  12754. @table @option
  12755. @item n
  12756. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12757. will pick one of them, and then handle the next batch of @var{n} frames until
  12758. the end. Default is @code{100}.
  12759. @end table
  12760. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12761. value will result in a higher memory usage, so a high value is not recommended.
  12762. @subsection Examples
  12763. @itemize
  12764. @item
  12765. Extract one picture each 50 frames:
  12766. @example
  12767. thumbnail=50
  12768. @end example
  12769. @item
  12770. Complete example of a thumbnail creation with @command{ffmpeg}:
  12771. @example
  12772. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12773. @end example
  12774. @end itemize
  12775. @section tile
  12776. Tile several successive frames together.
  12777. The filter accepts the following options:
  12778. @table @option
  12779. @item layout
  12780. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12781. this option, check the
  12782. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12783. @item nb_frames
  12784. Set the maximum number of frames to render in the given area. It must be less
  12785. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12786. the area will be used.
  12787. @item margin
  12788. Set the outer border margin in pixels.
  12789. @item padding
  12790. Set the inner border thickness (i.e. the number of pixels between frames). For
  12791. more advanced padding options (such as having different values for the edges),
  12792. refer to the pad video filter.
  12793. @item color
  12794. Specify the color of the unused area. For the syntax of this option, check the
  12795. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12796. The default value of @var{color} is "black".
  12797. @item overlap
  12798. Set the number of frames to overlap when tiling several successive frames together.
  12799. The value must be between @code{0} and @var{nb_frames - 1}.
  12800. @item init_padding
  12801. Set the number of frames to initially be empty before displaying first output frame.
  12802. This controls how soon will one get first output frame.
  12803. The value must be between @code{0} and @var{nb_frames - 1}.
  12804. @end table
  12805. @subsection Examples
  12806. @itemize
  12807. @item
  12808. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12809. @example
  12810. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12811. @end example
  12812. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12813. duplicating each output frame to accommodate the originally detected frame
  12814. rate.
  12815. @item
  12816. Display @code{5} pictures in an area of @code{3x2} frames,
  12817. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12818. mixed flat and named options:
  12819. @example
  12820. tile=3x2:nb_frames=5:padding=7:margin=2
  12821. @end example
  12822. @end itemize
  12823. @section tinterlace
  12824. Perform various types of temporal field interlacing.
  12825. Frames are counted starting from 1, so the first input frame is
  12826. considered odd.
  12827. The filter accepts the following options:
  12828. @table @option
  12829. @item mode
  12830. Specify the mode of the interlacing. This option can also be specified
  12831. as a value alone. See below for a list of values for this option.
  12832. Available values are:
  12833. @table @samp
  12834. @item merge, 0
  12835. Move odd frames into the upper field, even into the lower field,
  12836. generating a double height frame at half frame rate.
  12837. @example
  12838. ------> time
  12839. Input:
  12840. Frame 1 Frame 2 Frame 3 Frame 4
  12841. 11111 22222 33333 44444
  12842. 11111 22222 33333 44444
  12843. 11111 22222 33333 44444
  12844. 11111 22222 33333 44444
  12845. Output:
  12846. 11111 33333
  12847. 22222 44444
  12848. 11111 33333
  12849. 22222 44444
  12850. 11111 33333
  12851. 22222 44444
  12852. 11111 33333
  12853. 22222 44444
  12854. @end example
  12855. @item drop_even, 1
  12856. Only output odd frames, even frames are dropped, generating a frame with
  12857. unchanged height at half frame rate.
  12858. @example
  12859. ------> time
  12860. Input:
  12861. Frame 1 Frame 2 Frame 3 Frame 4
  12862. 11111 22222 33333 44444
  12863. 11111 22222 33333 44444
  12864. 11111 22222 33333 44444
  12865. 11111 22222 33333 44444
  12866. Output:
  12867. 11111 33333
  12868. 11111 33333
  12869. 11111 33333
  12870. 11111 33333
  12871. @end example
  12872. @item drop_odd, 2
  12873. Only output even frames, odd frames are dropped, generating a frame with
  12874. unchanged height at half frame rate.
  12875. @example
  12876. ------> time
  12877. Input:
  12878. Frame 1 Frame 2 Frame 3 Frame 4
  12879. 11111 22222 33333 44444
  12880. 11111 22222 33333 44444
  12881. 11111 22222 33333 44444
  12882. 11111 22222 33333 44444
  12883. Output:
  12884. 22222 44444
  12885. 22222 44444
  12886. 22222 44444
  12887. 22222 44444
  12888. @end example
  12889. @item pad, 3
  12890. Expand each frame to full height, but pad alternate lines with black,
  12891. generating a frame with double height at the same input frame rate.
  12892. @example
  12893. ------> time
  12894. Input:
  12895. Frame 1 Frame 2 Frame 3 Frame 4
  12896. 11111 22222 33333 44444
  12897. 11111 22222 33333 44444
  12898. 11111 22222 33333 44444
  12899. 11111 22222 33333 44444
  12900. Output:
  12901. 11111 ..... 33333 .....
  12902. ..... 22222 ..... 44444
  12903. 11111 ..... 33333 .....
  12904. ..... 22222 ..... 44444
  12905. 11111 ..... 33333 .....
  12906. ..... 22222 ..... 44444
  12907. 11111 ..... 33333 .....
  12908. ..... 22222 ..... 44444
  12909. @end example
  12910. @item interleave_top, 4
  12911. Interleave the upper field from odd frames with the lower field from
  12912. even frames, generating a frame with unchanged height at half frame rate.
  12913. @example
  12914. ------> time
  12915. Input:
  12916. Frame 1 Frame 2 Frame 3 Frame 4
  12917. 11111<- 22222 33333<- 44444
  12918. 11111 22222<- 33333 44444<-
  12919. 11111<- 22222 33333<- 44444
  12920. 11111 22222<- 33333 44444<-
  12921. Output:
  12922. 11111 33333
  12923. 22222 44444
  12924. 11111 33333
  12925. 22222 44444
  12926. @end example
  12927. @item interleave_bottom, 5
  12928. Interleave the lower field from odd frames with the upper field from
  12929. even frames, generating a frame with unchanged height at half frame rate.
  12930. @example
  12931. ------> time
  12932. Input:
  12933. Frame 1 Frame 2 Frame 3 Frame 4
  12934. 11111 22222<- 33333 44444<-
  12935. 11111<- 22222 33333<- 44444
  12936. 11111 22222<- 33333 44444<-
  12937. 11111<- 22222 33333<- 44444
  12938. Output:
  12939. 22222 44444
  12940. 11111 33333
  12941. 22222 44444
  12942. 11111 33333
  12943. @end example
  12944. @item interlacex2, 6
  12945. Double frame rate with unchanged height. Frames are inserted each
  12946. containing the second temporal field from the previous input frame and
  12947. the first temporal field from the next input frame. This mode relies on
  12948. the top_field_first flag. Useful for interlaced video displays with no
  12949. field synchronisation.
  12950. @example
  12951. ------> time
  12952. Input:
  12953. Frame 1 Frame 2 Frame 3 Frame 4
  12954. 11111 22222 33333 44444
  12955. 11111 22222 33333 44444
  12956. 11111 22222 33333 44444
  12957. 11111 22222 33333 44444
  12958. Output:
  12959. 11111 22222 22222 33333 33333 44444 44444
  12960. 11111 11111 22222 22222 33333 33333 44444
  12961. 11111 22222 22222 33333 33333 44444 44444
  12962. 11111 11111 22222 22222 33333 33333 44444
  12963. @end example
  12964. @item mergex2, 7
  12965. Move odd frames into the upper field, even into the lower field,
  12966. generating a double height frame at same frame rate.
  12967. @example
  12968. ------> time
  12969. Input:
  12970. Frame 1 Frame 2 Frame 3 Frame 4
  12971. 11111 22222 33333 44444
  12972. 11111 22222 33333 44444
  12973. 11111 22222 33333 44444
  12974. 11111 22222 33333 44444
  12975. Output:
  12976. 11111 33333 33333 55555
  12977. 22222 22222 44444 44444
  12978. 11111 33333 33333 55555
  12979. 22222 22222 44444 44444
  12980. 11111 33333 33333 55555
  12981. 22222 22222 44444 44444
  12982. 11111 33333 33333 55555
  12983. 22222 22222 44444 44444
  12984. @end example
  12985. @end table
  12986. Numeric values are deprecated but are accepted for backward
  12987. compatibility reasons.
  12988. Default mode is @code{merge}.
  12989. @item flags
  12990. Specify flags influencing the filter process.
  12991. Available value for @var{flags} is:
  12992. @table @option
  12993. @item low_pass_filter, vlfp
  12994. Enable linear vertical low-pass filtering in the filter.
  12995. Vertical low-pass filtering is required when creating an interlaced
  12996. destination from a progressive source which contains high-frequency
  12997. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12998. patterning.
  12999. @item complex_filter, cvlfp
  13000. Enable complex vertical low-pass filtering.
  13001. This will slightly less reduce interlace 'twitter' and Moire
  13002. patterning but better retain detail and subjective sharpness impression.
  13003. @end table
  13004. Vertical low-pass filtering can only be enabled for @option{mode}
  13005. @var{interleave_top} and @var{interleave_bottom}.
  13006. @end table
  13007. @section tmix
  13008. Mix successive video frames.
  13009. A description of the accepted options follows.
  13010. @table @option
  13011. @item frames
  13012. The number of successive frames to mix. If unspecified, it defaults to 3.
  13013. @item weights
  13014. Specify weight of each input video frame.
  13015. Each weight is separated by space. If number of weights is smaller than
  13016. number of @var{frames} last specified weight will be used for all remaining
  13017. unset weights.
  13018. @item scale
  13019. Specify scale, if it is set it will be multiplied with sum
  13020. of each weight multiplied with pixel values to give final destination
  13021. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13022. @end table
  13023. @subsection Examples
  13024. @itemize
  13025. @item
  13026. Average 7 successive frames:
  13027. @example
  13028. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13029. @end example
  13030. @item
  13031. Apply simple temporal convolution:
  13032. @example
  13033. tmix=frames=3:weights="-1 3 -1"
  13034. @end example
  13035. @item
  13036. Similar as above but only showing temporal differences:
  13037. @example
  13038. tmix=frames=3:weights="-1 2 -1":scale=1
  13039. @end example
  13040. @end itemize
  13041. @anchor{tonemap}
  13042. @section tonemap
  13043. Tone map colors from different dynamic ranges.
  13044. This filter expects data in single precision floating point, as it needs to
  13045. operate on (and can output) out-of-range values. Another filter, such as
  13046. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13047. The tonemapping algorithms implemented only work on linear light, so input
  13048. data should be linearized beforehand (and possibly correctly tagged).
  13049. @example
  13050. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13051. @end example
  13052. @subsection Options
  13053. The filter accepts the following options.
  13054. @table @option
  13055. @item tonemap
  13056. Set the tone map algorithm to use.
  13057. Possible values are:
  13058. @table @var
  13059. @item none
  13060. Do not apply any tone map, only desaturate overbright pixels.
  13061. @item clip
  13062. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13063. in-range values, while distorting out-of-range values.
  13064. @item linear
  13065. Stretch the entire reference gamut to a linear multiple of the display.
  13066. @item gamma
  13067. Fit a logarithmic transfer between the tone curves.
  13068. @item reinhard
  13069. Preserve overall image brightness with a simple curve, using nonlinear
  13070. contrast, which results in flattening details and degrading color accuracy.
  13071. @item hable
  13072. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13073. of slightly darkening everything. Use it when detail preservation is more
  13074. important than color and brightness accuracy.
  13075. @item mobius
  13076. Smoothly map out-of-range values, while retaining contrast and colors for
  13077. in-range material as much as possible. Use it when color accuracy is more
  13078. important than detail preservation.
  13079. @end table
  13080. Default is none.
  13081. @item param
  13082. Tune the tone mapping algorithm.
  13083. This affects the following algorithms:
  13084. @table @var
  13085. @item none
  13086. Ignored.
  13087. @item linear
  13088. Specifies the scale factor to use while stretching.
  13089. Default to 1.0.
  13090. @item gamma
  13091. Specifies the exponent of the function.
  13092. Default to 1.8.
  13093. @item clip
  13094. Specify an extra linear coefficient to multiply into the signal before clipping.
  13095. Default to 1.0.
  13096. @item reinhard
  13097. Specify the local contrast coefficient at the display peak.
  13098. Default to 0.5, which means that in-gamut values will be about half as bright
  13099. as when clipping.
  13100. @item hable
  13101. Ignored.
  13102. @item mobius
  13103. Specify the transition point from linear to mobius transform. Every value
  13104. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13105. more accurate the result will be, at the cost of losing bright details.
  13106. Default to 0.3, which due to the steep initial slope still preserves in-range
  13107. colors fairly accurately.
  13108. @end table
  13109. @item desat
  13110. Apply desaturation for highlights that exceed this level of brightness. The
  13111. higher the parameter, the more color information will be preserved. This
  13112. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13113. (smoothly) turning into white instead. This makes images feel more natural,
  13114. at the cost of reducing information about out-of-range colors.
  13115. The default of 2.0 is somewhat conservative and will mostly just apply to
  13116. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13117. This option works only if the input frame has a supported color tag.
  13118. @item peak
  13119. Override signal/nominal/reference peak with this value. Useful when the
  13120. embedded peak information in display metadata is not reliable or when tone
  13121. mapping from a lower range to a higher range.
  13122. @end table
  13123. @section tpad
  13124. Temporarily pad video frames.
  13125. The filter accepts the following options:
  13126. @table @option
  13127. @item start
  13128. Specify number of delay frames before input video stream.
  13129. @item stop
  13130. Specify number of padding frames after input video stream.
  13131. Set to -1 to pad indefinitely.
  13132. @item start_mode
  13133. Set kind of frames added to beginning of stream.
  13134. Can be either @var{add} or @var{clone}.
  13135. With @var{add} frames of solid-color are added.
  13136. With @var{clone} frames are clones of first frame.
  13137. @item stop_mode
  13138. Set kind of frames added to end of stream.
  13139. Can be either @var{add} or @var{clone}.
  13140. With @var{add} frames of solid-color are added.
  13141. With @var{clone} frames are clones of last frame.
  13142. @item start_duration, stop_duration
  13143. Specify the duration of the start/stop delay. See
  13144. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13145. for the accepted syntax.
  13146. These options override @var{start} and @var{stop}.
  13147. @item color
  13148. Specify the color of the padded area. For the syntax of this option,
  13149. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13150. manual,ffmpeg-utils}.
  13151. The default value of @var{color} is "black".
  13152. @end table
  13153. @anchor{transpose}
  13154. @section transpose
  13155. Transpose rows with columns in the input video and optionally flip it.
  13156. It accepts the following parameters:
  13157. @table @option
  13158. @item dir
  13159. Specify the transposition direction.
  13160. Can assume the following values:
  13161. @table @samp
  13162. @item 0, 4, cclock_flip
  13163. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13164. @example
  13165. L.R L.l
  13166. . . -> . .
  13167. l.r R.r
  13168. @end example
  13169. @item 1, 5, clock
  13170. Rotate by 90 degrees clockwise, that is:
  13171. @example
  13172. L.R l.L
  13173. . . -> . .
  13174. l.r r.R
  13175. @end example
  13176. @item 2, 6, cclock
  13177. Rotate by 90 degrees counterclockwise, that is:
  13178. @example
  13179. L.R R.r
  13180. . . -> . .
  13181. l.r L.l
  13182. @end example
  13183. @item 3, 7, clock_flip
  13184. Rotate by 90 degrees clockwise and vertically flip, that is:
  13185. @example
  13186. L.R r.R
  13187. . . -> . .
  13188. l.r l.L
  13189. @end example
  13190. @end table
  13191. For values between 4-7, the transposition is only done if the input
  13192. video geometry is portrait and not landscape. These values are
  13193. deprecated, the @code{passthrough} option should be used instead.
  13194. Numerical values are deprecated, and should be dropped in favor of
  13195. symbolic constants.
  13196. @item passthrough
  13197. Do not apply the transposition if the input geometry matches the one
  13198. specified by the specified value. It accepts the following values:
  13199. @table @samp
  13200. @item none
  13201. Always apply transposition.
  13202. @item portrait
  13203. Preserve portrait geometry (when @var{height} >= @var{width}).
  13204. @item landscape
  13205. Preserve landscape geometry (when @var{width} >= @var{height}).
  13206. @end table
  13207. Default value is @code{none}.
  13208. @end table
  13209. For example to rotate by 90 degrees clockwise and preserve portrait
  13210. layout:
  13211. @example
  13212. transpose=dir=1:passthrough=portrait
  13213. @end example
  13214. The command above can also be specified as:
  13215. @example
  13216. transpose=1:portrait
  13217. @end example
  13218. @section transpose_npp
  13219. Transpose rows with columns in the input video and optionally flip it.
  13220. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13221. It accepts the following parameters:
  13222. @table @option
  13223. @item dir
  13224. Specify the transposition direction.
  13225. Can assume the following values:
  13226. @table @samp
  13227. @item cclock_flip
  13228. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13229. @item clock
  13230. Rotate by 90 degrees clockwise.
  13231. @item cclock
  13232. Rotate by 90 degrees counterclockwise.
  13233. @item clock_flip
  13234. Rotate by 90 degrees clockwise and vertically flip.
  13235. @end table
  13236. @item passthrough
  13237. Do not apply the transposition if the input geometry matches the one
  13238. specified by the specified value. It accepts the following values:
  13239. @table @samp
  13240. @item none
  13241. Always apply transposition. (default)
  13242. @item portrait
  13243. Preserve portrait geometry (when @var{height} >= @var{width}).
  13244. @item landscape
  13245. Preserve landscape geometry (when @var{width} >= @var{height}).
  13246. @end table
  13247. @end table
  13248. @section trim
  13249. Trim the input so that the output contains one continuous subpart of the input.
  13250. It accepts the following parameters:
  13251. @table @option
  13252. @item start
  13253. Specify the time of the start of the kept section, i.e. the frame with the
  13254. timestamp @var{start} will be the first frame in the output.
  13255. @item end
  13256. Specify the time of the first frame that will be dropped, i.e. the frame
  13257. immediately preceding the one with the timestamp @var{end} will be the last
  13258. frame in the output.
  13259. @item start_pts
  13260. This is the same as @var{start}, except this option sets the start timestamp
  13261. in timebase units instead of seconds.
  13262. @item end_pts
  13263. This is the same as @var{end}, except this option sets the end timestamp
  13264. in timebase units instead of seconds.
  13265. @item duration
  13266. The maximum duration of the output in seconds.
  13267. @item start_frame
  13268. The number of the first frame that should be passed to the output.
  13269. @item end_frame
  13270. The number of the first frame that should be dropped.
  13271. @end table
  13272. @option{start}, @option{end}, and @option{duration} are expressed as time
  13273. duration specifications; see
  13274. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13275. for the accepted syntax.
  13276. Note that the first two sets of the start/end options and the @option{duration}
  13277. option look at the frame timestamp, while the _frame variants simply count the
  13278. frames that pass through the filter. Also note that this filter does not modify
  13279. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13280. setpts filter after the trim filter.
  13281. If multiple start or end options are set, this filter tries to be greedy and
  13282. keep all the frames that match at least one of the specified constraints. To keep
  13283. only the part that matches all the constraints at once, chain multiple trim
  13284. filters.
  13285. The defaults are such that all the input is kept. So it is possible to set e.g.
  13286. just the end values to keep everything before the specified time.
  13287. Examples:
  13288. @itemize
  13289. @item
  13290. Drop everything except the second minute of input:
  13291. @example
  13292. ffmpeg -i INPUT -vf trim=60:120
  13293. @end example
  13294. @item
  13295. Keep only the first second:
  13296. @example
  13297. ffmpeg -i INPUT -vf trim=duration=1
  13298. @end example
  13299. @end itemize
  13300. @section unpremultiply
  13301. Apply alpha unpremultiply effect to input video stream using first plane
  13302. of second stream as alpha.
  13303. Both streams must have same dimensions and same pixel format.
  13304. The filter accepts the following option:
  13305. @table @option
  13306. @item planes
  13307. Set which planes will be processed, unprocessed planes will be copied.
  13308. By default value 0xf, all planes will be processed.
  13309. If the format has 1 or 2 components, then luma is bit 0.
  13310. If the format has 3 or 4 components:
  13311. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13312. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13313. If present, the alpha channel is always the last bit.
  13314. @item inplace
  13315. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13316. @end table
  13317. @anchor{unsharp}
  13318. @section unsharp
  13319. Sharpen or blur the input video.
  13320. It accepts the following parameters:
  13321. @table @option
  13322. @item luma_msize_x, lx
  13323. Set the luma matrix horizontal size. It must be an odd integer between
  13324. 3 and 23. The default value is 5.
  13325. @item luma_msize_y, ly
  13326. Set the luma matrix vertical size. It must be an odd integer between 3
  13327. and 23. The default value is 5.
  13328. @item luma_amount, la
  13329. Set the luma effect strength. It must be a floating point number, reasonable
  13330. values lay between -1.5 and 1.5.
  13331. Negative values will blur the input video, while positive values will
  13332. sharpen it, a value of zero will disable the effect.
  13333. Default value is 1.0.
  13334. @item chroma_msize_x, cx
  13335. Set the chroma matrix horizontal size. It must be an odd integer
  13336. between 3 and 23. The default value is 5.
  13337. @item chroma_msize_y, cy
  13338. Set the chroma matrix vertical size. It must be an odd integer
  13339. between 3 and 23. The default value is 5.
  13340. @item chroma_amount, ca
  13341. Set the chroma effect strength. It must be a floating point number, reasonable
  13342. values lay between -1.5 and 1.5.
  13343. Negative values will blur the input video, while positive values will
  13344. sharpen it, a value of zero will disable the effect.
  13345. Default value is 0.0.
  13346. @end table
  13347. All parameters are optional and default to the equivalent of the
  13348. string '5:5:1.0:5:5:0.0'.
  13349. @subsection Examples
  13350. @itemize
  13351. @item
  13352. Apply strong luma sharpen effect:
  13353. @example
  13354. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13355. @end example
  13356. @item
  13357. Apply a strong blur of both luma and chroma parameters:
  13358. @example
  13359. unsharp=7:7:-2:7:7:-2
  13360. @end example
  13361. @end itemize
  13362. @section uspp
  13363. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13364. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13365. shifts and average the results.
  13366. The way this differs from the behavior of spp is that uspp actually encodes &
  13367. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13368. DCT similar to MJPEG.
  13369. The filter accepts the following options:
  13370. @table @option
  13371. @item quality
  13372. Set quality. This option defines the number of levels for averaging. It accepts
  13373. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13374. effect. A value of @code{8} means the higher quality. For each increment of
  13375. that value the speed drops by a factor of approximately 2. Default value is
  13376. @code{3}.
  13377. @item qp
  13378. Force a constant quantization parameter. If not set, the filter will use the QP
  13379. from the video stream (if available).
  13380. @end table
  13381. @section vaguedenoiser
  13382. Apply a wavelet based denoiser.
  13383. It transforms each frame from the video input into the wavelet domain,
  13384. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13385. the obtained coefficients. It does an inverse wavelet transform after.
  13386. Due to wavelet properties, it should give a nice smoothed result, and
  13387. reduced noise, without blurring picture features.
  13388. This filter accepts the following options:
  13389. @table @option
  13390. @item threshold
  13391. The filtering strength. The higher, the more filtered the video will be.
  13392. Hard thresholding can use a higher threshold than soft thresholding
  13393. before the video looks overfiltered. Default value is 2.
  13394. @item method
  13395. The filtering method the filter will use.
  13396. It accepts the following values:
  13397. @table @samp
  13398. @item hard
  13399. All values under the threshold will be zeroed.
  13400. @item soft
  13401. All values under the threshold will be zeroed. All values above will be
  13402. reduced by the threshold.
  13403. @item garrote
  13404. Scales or nullifies coefficients - intermediary between (more) soft and
  13405. (less) hard thresholding.
  13406. @end table
  13407. Default is garrote.
  13408. @item nsteps
  13409. Number of times, the wavelet will decompose the picture. Picture can't
  13410. be decomposed beyond a particular point (typically, 8 for a 640x480
  13411. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13412. @item percent
  13413. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13414. @item planes
  13415. A list of the planes to process. By default all planes are processed.
  13416. @end table
  13417. @section vectorscope
  13418. Display 2 color component values in the two dimensional graph (which is called
  13419. a vectorscope).
  13420. This filter accepts the following options:
  13421. @table @option
  13422. @item mode, m
  13423. Set vectorscope mode.
  13424. It accepts the following values:
  13425. @table @samp
  13426. @item gray
  13427. Gray values are displayed on graph, higher brightness means more pixels have
  13428. same component color value on location in graph. This is the default mode.
  13429. @item color
  13430. Gray values are displayed on graph. Surrounding pixels values which are not
  13431. present in video frame are drawn in gradient of 2 color components which are
  13432. set by option @code{x} and @code{y}. The 3rd color component is static.
  13433. @item color2
  13434. Actual color components values present in video frame are displayed on graph.
  13435. @item color3
  13436. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13437. on graph increases value of another color component, which is luminance by
  13438. default values of @code{x} and @code{y}.
  13439. @item color4
  13440. Actual colors present in video frame are displayed on graph. If two different
  13441. colors map to same position on graph then color with higher value of component
  13442. not present in graph is picked.
  13443. @item color5
  13444. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13445. component picked from radial gradient.
  13446. @end table
  13447. @item x
  13448. Set which color component will be represented on X-axis. Default is @code{1}.
  13449. @item y
  13450. Set which color component will be represented on Y-axis. Default is @code{2}.
  13451. @item intensity, i
  13452. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13453. of color component which represents frequency of (X, Y) location in graph.
  13454. @item envelope, e
  13455. @table @samp
  13456. @item none
  13457. No envelope, this is default.
  13458. @item instant
  13459. Instant envelope, even darkest single pixel will be clearly highlighted.
  13460. @item peak
  13461. Hold maximum and minimum values presented in graph over time. This way you
  13462. can still spot out of range values without constantly looking at vectorscope.
  13463. @item peak+instant
  13464. Peak and instant envelope combined together.
  13465. @end table
  13466. @item graticule, g
  13467. Set what kind of graticule to draw.
  13468. @table @samp
  13469. @item none
  13470. @item green
  13471. @item color
  13472. @end table
  13473. @item opacity, o
  13474. Set graticule opacity.
  13475. @item flags, f
  13476. Set graticule flags.
  13477. @table @samp
  13478. @item white
  13479. Draw graticule for white point.
  13480. @item black
  13481. Draw graticule for black point.
  13482. @item name
  13483. Draw color points short names.
  13484. @end table
  13485. @item bgopacity, b
  13486. Set background opacity.
  13487. @item lthreshold, l
  13488. Set low threshold for color component not represented on X or Y axis.
  13489. Values lower than this value will be ignored. Default is 0.
  13490. Note this value is multiplied with actual max possible value one pixel component
  13491. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13492. is 0.1 * 255 = 25.
  13493. @item hthreshold, h
  13494. Set high threshold for color component not represented on X or Y axis.
  13495. Values higher than this value will be ignored. Default is 1.
  13496. Note this value is multiplied with actual max possible value one pixel component
  13497. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13498. is 0.9 * 255 = 230.
  13499. @item colorspace, c
  13500. Set what kind of colorspace to use when drawing graticule.
  13501. @table @samp
  13502. @item auto
  13503. @item 601
  13504. @item 709
  13505. @end table
  13506. Default is auto.
  13507. @end table
  13508. @anchor{vidstabdetect}
  13509. @section vidstabdetect
  13510. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13511. @ref{vidstabtransform} for pass 2.
  13512. This filter generates a file with relative translation and rotation
  13513. transform information about subsequent frames, which is then used by
  13514. the @ref{vidstabtransform} filter.
  13515. To enable compilation of this filter you need to configure FFmpeg with
  13516. @code{--enable-libvidstab}.
  13517. This filter accepts the following options:
  13518. @table @option
  13519. @item result
  13520. Set the path to the file used to write the transforms information.
  13521. Default value is @file{transforms.trf}.
  13522. @item shakiness
  13523. Set how shaky the video is and how quick the camera is. It accepts an
  13524. integer in the range 1-10, a value of 1 means little shakiness, a
  13525. value of 10 means strong shakiness. Default value is 5.
  13526. @item accuracy
  13527. Set the accuracy of the detection process. It must be a value in the
  13528. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13529. accuracy. Default value is 15.
  13530. @item stepsize
  13531. Set stepsize of the search process. The region around minimum is
  13532. scanned with 1 pixel resolution. Default value is 6.
  13533. @item mincontrast
  13534. Set minimum contrast. Below this value a local measurement field is
  13535. discarded. Must be a floating point value in the range 0-1. Default
  13536. value is 0.3.
  13537. @item tripod
  13538. Set reference frame number for tripod mode.
  13539. If enabled, the motion of the frames is compared to a reference frame
  13540. in the filtered stream, identified by the specified number. The idea
  13541. is to compensate all movements in a more-or-less static scene and keep
  13542. the camera view absolutely still.
  13543. If set to 0, it is disabled. The frames are counted starting from 1.
  13544. @item show
  13545. Show fields and transforms in the resulting frames. It accepts an
  13546. integer in the range 0-2. Default value is 0, which disables any
  13547. visualization.
  13548. @end table
  13549. @subsection Examples
  13550. @itemize
  13551. @item
  13552. Use default values:
  13553. @example
  13554. vidstabdetect
  13555. @end example
  13556. @item
  13557. Analyze strongly shaky movie and put the results in file
  13558. @file{mytransforms.trf}:
  13559. @example
  13560. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13561. @end example
  13562. @item
  13563. Visualize the result of internal transformations in the resulting
  13564. video:
  13565. @example
  13566. vidstabdetect=show=1
  13567. @end example
  13568. @item
  13569. Analyze a video with medium shakiness using @command{ffmpeg}:
  13570. @example
  13571. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13572. @end example
  13573. @end itemize
  13574. @anchor{vidstabtransform}
  13575. @section vidstabtransform
  13576. Video stabilization/deshaking: pass 2 of 2,
  13577. see @ref{vidstabdetect} for pass 1.
  13578. Read a file with transform information for each frame and
  13579. apply/compensate them. Together with the @ref{vidstabdetect}
  13580. filter this can be used to deshake videos. See also
  13581. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13582. the @ref{unsharp} filter, see below.
  13583. To enable compilation of this filter you need to configure FFmpeg with
  13584. @code{--enable-libvidstab}.
  13585. @subsection Options
  13586. @table @option
  13587. @item input
  13588. Set path to the file used to read the transforms. Default value is
  13589. @file{transforms.trf}.
  13590. @item smoothing
  13591. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13592. camera movements. Default value is 10.
  13593. For example a number of 10 means that 21 frames are used (10 in the
  13594. past and 10 in the future) to smoothen the motion in the video. A
  13595. larger value leads to a smoother video, but limits the acceleration of
  13596. the camera (pan/tilt movements). 0 is a special case where a static
  13597. camera is simulated.
  13598. @item optalgo
  13599. Set the camera path optimization algorithm.
  13600. Accepted values are:
  13601. @table @samp
  13602. @item gauss
  13603. gaussian kernel low-pass filter on camera motion (default)
  13604. @item avg
  13605. averaging on transformations
  13606. @end table
  13607. @item maxshift
  13608. Set maximal number of pixels to translate frames. Default value is -1,
  13609. meaning no limit.
  13610. @item maxangle
  13611. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13612. value is -1, meaning no limit.
  13613. @item crop
  13614. Specify how to deal with borders that may be visible due to movement
  13615. compensation.
  13616. Available values are:
  13617. @table @samp
  13618. @item keep
  13619. keep image information from previous frame (default)
  13620. @item black
  13621. fill the border black
  13622. @end table
  13623. @item invert
  13624. Invert transforms if set to 1. Default value is 0.
  13625. @item relative
  13626. Consider transforms as relative to previous frame if set to 1,
  13627. absolute if set to 0. Default value is 0.
  13628. @item zoom
  13629. Set percentage to zoom. A positive value will result in a zoom-in
  13630. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13631. zoom).
  13632. @item optzoom
  13633. Set optimal zooming to avoid borders.
  13634. Accepted values are:
  13635. @table @samp
  13636. @item 0
  13637. disabled
  13638. @item 1
  13639. optimal static zoom value is determined (only very strong movements
  13640. will lead to visible borders) (default)
  13641. @item 2
  13642. optimal adaptive zoom value is determined (no borders will be
  13643. visible), see @option{zoomspeed}
  13644. @end table
  13645. Note that the value given at zoom is added to the one calculated here.
  13646. @item zoomspeed
  13647. Set percent to zoom maximally each frame (enabled when
  13648. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13649. 0.25.
  13650. @item interpol
  13651. Specify type of interpolation.
  13652. Available values are:
  13653. @table @samp
  13654. @item no
  13655. no interpolation
  13656. @item linear
  13657. linear only horizontal
  13658. @item bilinear
  13659. linear in both directions (default)
  13660. @item bicubic
  13661. cubic in both directions (slow)
  13662. @end table
  13663. @item tripod
  13664. Enable virtual tripod mode if set to 1, which is equivalent to
  13665. @code{relative=0:smoothing=0}. Default value is 0.
  13666. Use also @code{tripod} option of @ref{vidstabdetect}.
  13667. @item debug
  13668. Increase log verbosity if set to 1. Also the detected global motions
  13669. are written to the temporary file @file{global_motions.trf}. Default
  13670. value is 0.
  13671. @end table
  13672. @subsection Examples
  13673. @itemize
  13674. @item
  13675. Use @command{ffmpeg} for a typical stabilization with default values:
  13676. @example
  13677. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13678. @end example
  13679. Note the use of the @ref{unsharp} filter which is always recommended.
  13680. @item
  13681. Zoom in a bit more and load transform data from a given file:
  13682. @example
  13683. vidstabtransform=zoom=5:input="mytransforms.trf"
  13684. @end example
  13685. @item
  13686. Smoothen the video even more:
  13687. @example
  13688. vidstabtransform=smoothing=30
  13689. @end example
  13690. @end itemize
  13691. @section vflip
  13692. Flip the input video vertically.
  13693. For example, to vertically flip a video with @command{ffmpeg}:
  13694. @example
  13695. ffmpeg -i in.avi -vf "vflip" out.avi
  13696. @end example
  13697. @section vfrdet
  13698. Detect variable frame rate video.
  13699. This filter tries to detect if the input is variable or constant frame rate.
  13700. At end it will output number of frames detected as having variable delta pts,
  13701. and ones with constant delta pts.
  13702. If there was frames with variable delta, than it will also show min and max delta
  13703. encountered.
  13704. @section vibrance
  13705. Boost or alter saturation.
  13706. The filter accepts the following options:
  13707. @table @option
  13708. @item intensity
  13709. Set strength of boost if positive value or strength of alter if negative value.
  13710. Default is 0. Allowed range is from -2 to 2.
  13711. @item rbal
  13712. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13713. @item gbal
  13714. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13715. @item bbal
  13716. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13717. @item rlum
  13718. Set the red luma coefficient.
  13719. @item glum
  13720. Set the green luma coefficient.
  13721. @item blum
  13722. Set the blue luma coefficient.
  13723. @item alternate
  13724. If @code{intensity} is negative and this is set to 1, colors will change,
  13725. otherwise colors will be less saturated, more towards gray.
  13726. @end table
  13727. @anchor{vignette}
  13728. @section vignette
  13729. Make or reverse a natural vignetting effect.
  13730. The filter accepts the following options:
  13731. @table @option
  13732. @item angle, a
  13733. Set lens angle expression as a number of radians.
  13734. The value is clipped in the @code{[0,PI/2]} range.
  13735. Default value: @code{"PI/5"}
  13736. @item x0
  13737. @item y0
  13738. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13739. by default.
  13740. @item mode
  13741. Set forward/backward mode.
  13742. Available modes are:
  13743. @table @samp
  13744. @item forward
  13745. The larger the distance from the central point, the darker the image becomes.
  13746. @item backward
  13747. The larger the distance from the central point, the brighter the image becomes.
  13748. This can be used to reverse a vignette effect, though there is no automatic
  13749. detection to extract the lens @option{angle} and other settings (yet). It can
  13750. also be used to create a burning effect.
  13751. @end table
  13752. Default value is @samp{forward}.
  13753. @item eval
  13754. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13755. It accepts the following values:
  13756. @table @samp
  13757. @item init
  13758. Evaluate expressions only once during the filter initialization.
  13759. @item frame
  13760. Evaluate expressions for each incoming frame. This is way slower than the
  13761. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13762. allows advanced dynamic expressions.
  13763. @end table
  13764. Default value is @samp{init}.
  13765. @item dither
  13766. Set dithering to reduce the circular banding effects. Default is @code{1}
  13767. (enabled).
  13768. @item aspect
  13769. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13770. Setting this value to the SAR of the input will make a rectangular vignetting
  13771. following the dimensions of the video.
  13772. Default is @code{1/1}.
  13773. @end table
  13774. @subsection Expressions
  13775. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13776. following parameters.
  13777. @table @option
  13778. @item w
  13779. @item h
  13780. input width and height
  13781. @item n
  13782. the number of input frame, starting from 0
  13783. @item pts
  13784. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13785. @var{TB} units, NAN if undefined
  13786. @item r
  13787. frame rate of the input video, NAN if the input frame rate is unknown
  13788. @item t
  13789. the PTS (Presentation TimeStamp) of the filtered video frame,
  13790. expressed in seconds, NAN if undefined
  13791. @item tb
  13792. time base of the input video
  13793. @end table
  13794. @subsection Examples
  13795. @itemize
  13796. @item
  13797. Apply simple strong vignetting effect:
  13798. @example
  13799. vignette=PI/4
  13800. @end example
  13801. @item
  13802. Make a flickering vignetting:
  13803. @example
  13804. vignette='PI/4+random(1)*PI/50':eval=frame
  13805. @end example
  13806. @end itemize
  13807. @section vmafmotion
  13808. Obtain the average vmaf motion score of a video.
  13809. It is one of the component filters of VMAF.
  13810. The obtained average motion score is printed through the logging system.
  13811. In the below example the input file @file{ref.mpg} is being processed and score
  13812. is computed.
  13813. @example
  13814. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13815. @end example
  13816. @section vstack
  13817. Stack input videos vertically.
  13818. All streams must be of same pixel format and of same width.
  13819. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13820. to create same output.
  13821. The filter accept the following option:
  13822. @table @option
  13823. @item inputs
  13824. Set number of input streams. Default is 2.
  13825. @item shortest
  13826. If set to 1, force the output to terminate when the shortest input
  13827. terminates. Default value is 0.
  13828. @end table
  13829. @section w3fdif
  13830. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13831. Deinterlacing Filter").
  13832. Based on the process described by Martin Weston for BBC R&D, and
  13833. implemented based on the de-interlace algorithm written by Jim
  13834. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13835. uses filter coefficients calculated by BBC R&D.
  13836. There are two sets of filter coefficients, so called "simple":
  13837. and "complex". Which set of filter coefficients is used can
  13838. be set by passing an optional parameter:
  13839. @table @option
  13840. @item filter
  13841. Set the interlacing filter coefficients. Accepts one of the following values:
  13842. @table @samp
  13843. @item simple
  13844. Simple filter coefficient set.
  13845. @item complex
  13846. More-complex filter coefficient set.
  13847. @end table
  13848. Default value is @samp{complex}.
  13849. @item deint
  13850. Specify which frames to deinterlace. Accept one of the following values:
  13851. @table @samp
  13852. @item all
  13853. Deinterlace all frames,
  13854. @item interlaced
  13855. Only deinterlace frames marked as interlaced.
  13856. @end table
  13857. Default value is @samp{all}.
  13858. @end table
  13859. @section waveform
  13860. Video waveform monitor.
  13861. The waveform monitor plots color component intensity. By default luminance
  13862. only. Each column of the waveform corresponds to a column of pixels in the
  13863. source video.
  13864. It accepts the following options:
  13865. @table @option
  13866. @item mode, m
  13867. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13868. In row mode, the graph on the left side represents color component value 0 and
  13869. the right side represents value = 255. In column mode, the top side represents
  13870. color component value = 0 and bottom side represents value = 255.
  13871. @item intensity, i
  13872. Set intensity. Smaller values are useful to find out how many values of the same
  13873. luminance are distributed across input rows/columns.
  13874. Default value is @code{0.04}. Allowed range is [0, 1].
  13875. @item mirror, r
  13876. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13877. In mirrored mode, higher values will be represented on the left
  13878. side for @code{row} mode and at the top for @code{column} mode. Default is
  13879. @code{1} (mirrored).
  13880. @item display, d
  13881. Set display mode.
  13882. It accepts the following values:
  13883. @table @samp
  13884. @item overlay
  13885. Presents information identical to that in the @code{parade}, except
  13886. that the graphs representing color components are superimposed directly
  13887. over one another.
  13888. This display mode makes it easier to spot relative differences or similarities
  13889. in overlapping areas of the color components that are supposed to be identical,
  13890. such as neutral whites, grays, or blacks.
  13891. @item stack
  13892. Display separate graph for the color components side by side in
  13893. @code{row} mode or one below the other in @code{column} mode.
  13894. @item parade
  13895. Display separate graph for the color components side by side in
  13896. @code{column} mode or one below the other in @code{row} mode.
  13897. Using this display mode makes it easy to spot color casts in the highlights
  13898. and shadows of an image, by comparing the contours of the top and the bottom
  13899. graphs of each waveform. Since whites, grays, and blacks are characterized
  13900. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13901. should display three waveforms of roughly equal width/height. If not, the
  13902. correction is easy to perform by making level adjustments the three waveforms.
  13903. @end table
  13904. Default is @code{stack}.
  13905. @item components, c
  13906. Set which color components to display. Default is 1, which means only luminance
  13907. or red color component if input is in RGB colorspace. If is set for example to
  13908. 7 it will display all 3 (if) available color components.
  13909. @item envelope, e
  13910. @table @samp
  13911. @item none
  13912. No envelope, this is default.
  13913. @item instant
  13914. Instant envelope, minimum and maximum values presented in graph will be easily
  13915. visible even with small @code{step} value.
  13916. @item peak
  13917. Hold minimum and maximum values presented in graph across time. This way you
  13918. can still spot out of range values without constantly looking at waveforms.
  13919. @item peak+instant
  13920. Peak and instant envelope combined together.
  13921. @end table
  13922. @item filter, f
  13923. @table @samp
  13924. @item lowpass
  13925. No filtering, this is default.
  13926. @item flat
  13927. Luma and chroma combined together.
  13928. @item aflat
  13929. Similar as above, but shows difference between blue and red chroma.
  13930. @item xflat
  13931. Similar as above, but use different colors.
  13932. @item chroma
  13933. Displays only chroma.
  13934. @item color
  13935. Displays actual color value on waveform.
  13936. @item acolor
  13937. Similar as above, but with luma showing frequency of chroma values.
  13938. @end table
  13939. @item graticule, g
  13940. Set which graticule to display.
  13941. @table @samp
  13942. @item none
  13943. Do not display graticule.
  13944. @item green
  13945. Display green graticule showing legal broadcast ranges.
  13946. @item orange
  13947. Display orange graticule showing legal broadcast ranges.
  13948. @end table
  13949. @item opacity, o
  13950. Set graticule opacity.
  13951. @item flags, fl
  13952. Set graticule flags.
  13953. @table @samp
  13954. @item numbers
  13955. Draw numbers above lines. By default enabled.
  13956. @item dots
  13957. Draw dots instead of lines.
  13958. @end table
  13959. @item scale, s
  13960. Set scale used for displaying graticule.
  13961. @table @samp
  13962. @item digital
  13963. @item millivolts
  13964. @item ire
  13965. @end table
  13966. Default is digital.
  13967. @item bgopacity, b
  13968. Set background opacity.
  13969. @end table
  13970. @section weave, doubleweave
  13971. The @code{weave} takes a field-based video input and join
  13972. each two sequential fields into single frame, producing a new double
  13973. height clip with half the frame rate and half the frame count.
  13974. The @code{doubleweave} works same as @code{weave} but without
  13975. halving frame rate and frame count.
  13976. It accepts the following option:
  13977. @table @option
  13978. @item first_field
  13979. Set first field. Available values are:
  13980. @table @samp
  13981. @item top, t
  13982. Set the frame as top-field-first.
  13983. @item bottom, b
  13984. Set the frame as bottom-field-first.
  13985. @end table
  13986. @end table
  13987. @subsection Examples
  13988. @itemize
  13989. @item
  13990. Interlace video using @ref{select} and @ref{separatefields} filter:
  13991. @example
  13992. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13993. @end example
  13994. @end itemize
  13995. @section xbr
  13996. Apply the xBR high-quality magnification filter which is designed for pixel
  13997. art. It follows a set of edge-detection rules, see
  13998. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13999. It accepts the following option:
  14000. @table @option
  14001. @item n
  14002. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14003. @code{3xBR} and @code{4} for @code{4xBR}.
  14004. Default is @code{3}.
  14005. @end table
  14006. @section xstack
  14007. Stack video inputs into custom layout.
  14008. All streams must be of same pixel format.
  14009. The filter accept the following option:
  14010. @table @option
  14011. @item inputs
  14012. Set number of input streams. Default is 2.
  14013. @item layout
  14014. Specify layout of inputs.
  14015. This option requires the desired layout configuration to be explicitly set by the user.
  14016. This sets position of each video input in output. Each input
  14017. is separated by '|'.
  14018. The first number represents the column, and the second number represents the row.
  14019. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14020. where X is video input from which to take width or height.
  14021. Multiple values can be used when separated by '+'. In such
  14022. case values are summed together.
  14023. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14024. a layout must be set by the user.
  14025. @item shortest
  14026. If set to 1, force the output to terminate when the shortest input
  14027. terminates. Default value is 0.
  14028. @end table
  14029. @subsection Examples
  14030. @itemize
  14031. @item
  14032. Display 4 inputs into 2x2 grid,
  14033. note that if inputs are of different sizes unused gaps might appear,
  14034. as not all of output video is used.
  14035. @example
  14036. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14037. @end example
  14038. @item
  14039. Display 4 inputs into 1x4 grid,
  14040. note that if inputs are of different sizes unused gaps might appear,
  14041. as not all of output video is used.
  14042. @example
  14043. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14044. @end example
  14045. @item
  14046. Display 9 inputs into 3x3 grid,
  14047. note that if inputs are of different sizes unused gaps might appear,
  14048. as not all of output video is used.
  14049. @example
  14050. 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
  14051. @end example
  14052. @end itemize
  14053. @anchor{yadif}
  14054. @section yadif
  14055. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14056. filter").
  14057. It accepts the following parameters:
  14058. @table @option
  14059. @item mode
  14060. The interlacing mode to adopt. It accepts one of the following values:
  14061. @table @option
  14062. @item 0, send_frame
  14063. Output one frame for each frame.
  14064. @item 1, send_field
  14065. Output one frame for each field.
  14066. @item 2, send_frame_nospatial
  14067. Like @code{send_frame}, but it skips the spatial interlacing check.
  14068. @item 3, send_field_nospatial
  14069. Like @code{send_field}, but it skips the spatial interlacing check.
  14070. @end table
  14071. The default value is @code{send_frame}.
  14072. @item parity
  14073. The picture field parity assumed for the input interlaced video. It accepts one
  14074. of the following values:
  14075. @table @option
  14076. @item 0, tff
  14077. Assume the top field is first.
  14078. @item 1, bff
  14079. Assume the bottom field is first.
  14080. @item -1, auto
  14081. Enable automatic detection of field parity.
  14082. @end table
  14083. The default value is @code{auto}.
  14084. If the interlacing is unknown or the decoder does not export this information,
  14085. top field first will be assumed.
  14086. @item deint
  14087. Specify which frames to deinterlace. Accept one of the following
  14088. values:
  14089. @table @option
  14090. @item 0, all
  14091. Deinterlace all frames.
  14092. @item 1, interlaced
  14093. Only deinterlace frames marked as interlaced.
  14094. @end table
  14095. The default value is @code{all}.
  14096. @end table
  14097. @section yadif_cuda
  14098. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14099. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14100. and/or nvenc.
  14101. It accepts the following parameters:
  14102. @table @option
  14103. @item mode
  14104. The interlacing mode to adopt. It accepts one of the following values:
  14105. @table @option
  14106. @item 0, send_frame
  14107. Output one frame for each frame.
  14108. @item 1, send_field
  14109. Output one frame for each field.
  14110. @item 2, send_frame_nospatial
  14111. Like @code{send_frame}, but it skips the spatial interlacing check.
  14112. @item 3, send_field_nospatial
  14113. Like @code{send_field}, but it skips the spatial interlacing check.
  14114. @end table
  14115. The default value is @code{send_frame}.
  14116. @item parity
  14117. The picture field parity assumed for the input interlaced video. It accepts one
  14118. of the following values:
  14119. @table @option
  14120. @item 0, tff
  14121. Assume the top field is first.
  14122. @item 1, bff
  14123. Assume the bottom field is first.
  14124. @item -1, auto
  14125. Enable automatic detection of field parity.
  14126. @end table
  14127. The default value is @code{auto}.
  14128. If the interlacing is unknown or the decoder does not export this information,
  14129. top field first will be assumed.
  14130. @item deint
  14131. Specify which frames to deinterlace. Accept one of the following
  14132. values:
  14133. @table @option
  14134. @item 0, all
  14135. Deinterlace all frames.
  14136. @item 1, interlaced
  14137. Only deinterlace frames marked as interlaced.
  14138. @end table
  14139. The default value is @code{all}.
  14140. @end table
  14141. @section zoompan
  14142. Apply Zoom & Pan effect.
  14143. This filter accepts the following options:
  14144. @table @option
  14145. @item zoom, z
  14146. Set the zoom expression. Range is 1-10. Default is 1.
  14147. @item x
  14148. @item y
  14149. Set the x and y expression. Default is 0.
  14150. @item d
  14151. Set the duration expression in number of frames.
  14152. This sets for how many number of frames effect will last for
  14153. single input image.
  14154. @item s
  14155. Set the output image size, default is 'hd720'.
  14156. @item fps
  14157. Set the output frame rate, default is '25'.
  14158. @end table
  14159. Each expression can contain the following constants:
  14160. @table @option
  14161. @item in_w, iw
  14162. Input width.
  14163. @item in_h, ih
  14164. Input height.
  14165. @item out_w, ow
  14166. Output width.
  14167. @item out_h, oh
  14168. Output height.
  14169. @item in
  14170. Input frame count.
  14171. @item on
  14172. Output frame count.
  14173. @item x
  14174. @item y
  14175. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14176. for current input frame.
  14177. @item px
  14178. @item py
  14179. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14180. not yet such frame (first input frame).
  14181. @item zoom
  14182. Last calculated zoom from 'z' expression for current input frame.
  14183. @item pzoom
  14184. Last calculated zoom of last output frame of previous input frame.
  14185. @item duration
  14186. Number of output frames for current input frame. Calculated from 'd' expression
  14187. for each input frame.
  14188. @item pduration
  14189. number of output frames created for previous input frame
  14190. @item a
  14191. Rational number: input width / input height
  14192. @item sar
  14193. sample aspect ratio
  14194. @item dar
  14195. display aspect ratio
  14196. @end table
  14197. @subsection Examples
  14198. @itemize
  14199. @item
  14200. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14201. @example
  14202. 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
  14203. @end example
  14204. @item
  14205. Zoom-in up to 1.5 and pan always at center of picture:
  14206. @example
  14207. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14208. @end example
  14209. @item
  14210. Same as above but without pausing:
  14211. @example
  14212. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14213. @end example
  14214. @end itemize
  14215. @anchor{zscale}
  14216. @section zscale
  14217. Scale (resize) the input video, using the z.lib library:
  14218. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14219. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14220. The zscale filter forces the output display aspect ratio to be the same
  14221. as the input, by changing the output sample aspect ratio.
  14222. If the input image format is different from the format requested by
  14223. the next filter, the zscale filter will convert the input to the
  14224. requested format.
  14225. @subsection Options
  14226. The filter accepts the following options.
  14227. @table @option
  14228. @item width, w
  14229. @item height, h
  14230. Set the output video dimension expression. Default value is the input
  14231. dimension.
  14232. If the @var{width} or @var{w} value is 0, the input width is used for
  14233. the output. If the @var{height} or @var{h} value is 0, the input height
  14234. is used for the output.
  14235. If one and only one of the values is -n with n >= 1, the zscale filter
  14236. will use a value that maintains the aspect ratio of the input image,
  14237. calculated from the other specified dimension. After that it will,
  14238. however, make sure that the calculated dimension is divisible by n and
  14239. adjust the value if necessary.
  14240. If both values are -n with n >= 1, the behavior will be identical to
  14241. both values being set to 0 as previously detailed.
  14242. See below for the list of accepted constants for use in the dimension
  14243. expression.
  14244. @item size, s
  14245. Set the video size. For the syntax of this option, check the
  14246. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14247. @item dither, d
  14248. Set the dither type.
  14249. Possible values are:
  14250. @table @var
  14251. @item none
  14252. @item ordered
  14253. @item random
  14254. @item error_diffusion
  14255. @end table
  14256. Default is none.
  14257. @item filter, f
  14258. Set the resize filter type.
  14259. Possible values are:
  14260. @table @var
  14261. @item point
  14262. @item bilinear
  14263. @item bicubic
  14264. @item spline16
  14265. @item spline36
  14266. @item lanczos
  14267. @end table
  14268. Default is bilinear.
  14269. @item range, r
  14270. Set the color range.
  14271. Possible values are:
  14272. @table @var
  14273. @item input
  14274. @item limited
  14275. @item full
  14276. @end table
  14277. Default is same as input.
  14278. @item primaries, p
  14279. Set the color primaries.
  14280. Possible values are:
  14281. @table @var
  14282. @item input
  14283. @item 709
  14284. @item unspecified
  14285. @item 170m
  14286. @item 240m
  14287. @item 2020
  14288. @end table
  14289. Default is same as input.
  14290. @item transfer, t
  14291. Set the transfer characteristics.
  14292. Possible values are:
  14293. @table @var
  14294. @item input
  14295. @item 709
  14296. @item unspecified
  14297. @item 601
  14298. @item linear
  14299. @item 2020_10
  14300. @item 2020_12
  14301. @item smpte2084
  14302. @item iec61966-2-1
  14303. @item arib-std-b67
  14304. @end table
  14305. Default is same as input.
  14306. @item matrix, m
  14307. Set the colorspace matrix.
  14308. Possible value are:
  14309. @table @var
  14310. @item input
  14311. @item 709
  14312. @item unspecified
  14313. @item 470bg
  14314. @item 170m
  14315. @item 2020_ncl
  14316. @item 2020_cl
  14317. @end table
  14318. Default is same as input.
  14319. @item rangein, rin
  14320. Set the input color range.
  14321. Possible values are:
  14322. @table @var
  14323. @item input
  14324. @item limited
  14325. @item full
  14326. @end table
  14327. Default is same as input.
  14328. @item primariesin, pin
  14329. Set the input color primaries.
  14330. Possible values are:
  14331. @table @var
  14332. @item input
  14333. @item 709
  14334. @item unspecified
  14335. @item 170m
  14336. @item 240m
  14337. @item 2020
  14338. @end table
  14339. Default is same as input.
  14340. @item transferin, tin
  14341. Set the input transfer characteristics.
  14342. Possible values are:
  14343. @table @var
  14344. @item input
  14345. @item 709
  14346. @item unspecified
  14347. @item 601
  14348. @item linear
  14349. @item 2020_10
  14350. @item 2020_12
  14351. @end table
  14352. Default is same as input.
  14353. @item matrixin, min
  14354. Set the input colorspace matrix.
  14355. Possible value are:
  14356. @table @var
  14357. @item input
  14358. @item 709
  14359. @item unspecified
  14360. @item 470bg
  14361. @item 170m
  14362. @item 2020_ncl
  14363. @item 2020_cl
  14364. @end table
  14365. @item chromal, c
  14366. Set the output chroma location.
  14367. Possible values are:
  14368. @table @var
  14369. @item input
  14370. @item left
  14371. @item center
  14372. @item topleft
  14373. @item top
  14374. @item bottomleft
  14375. @item bottom
  14376. @end table
  14377. @item chromalin, cin
  14378. Set the input chroma location.
  14379. Possible values are:
  14380. @table @var
  14381. @item input
  14382. @item left
  14383. @item center
  14384. @item topleft
  14385. @item top
  14386. @item bottomleft
  14387. @item bottom
  14388. @end table
  14389. @item npl
  14390. Set the nominal peak luminance.
  14391. @end table
  14392. The values of the @option{w} and @option{h} options are expressions
  14393. containing the following constants:
  14394. @table @var
  14395. @item in_w
  14396. @item in_h
  14397. The input width and height
  14398. @item iw
  14399. @item ih
  14400. These are the same as @var{in_w} and @var{in_h}.
  14401. @item out_w
  14402. @item out_h
  14403. The output (scaled) width and height
  14404. @item ow
  14405. @item oh
  14406. These are the same as @var{out_w} and @var{out_h}
  14407. @item a
  14408. The same as @var{iw} / @var{ih}
  14409. @item sar
  14410. input sample aspect ratio
  14411. @item dar
  14412. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14413. @item hsub
  14414. @item vsub
  14415. horizontal and vertical input chroma subsample values. For example for the
  14416. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14417. @item ohsub
  14418. @item ovsub
  14419. horizontal and vertical output chroma subsample values. For example for the
  14420. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14421. @end table
  14422. @table @option
  14423. @end table
  14424. @c man end VIDEO FILTERS
  14425. @chapter OpenCL Video Filters
  14426. @c man begin OPENCL VIDEO FILTERS
  14427. Below is a description of the currently available OpenCL video filters.
  14428. To enable compilation of these filters you need to configure FFmpeg with
  14429. @code{--enable-opencl}.
  14430. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14431. @table @option
  14432. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14433. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14434. given device parameters.
  14435. @item -filter_hw_device @var{name}
  14436. Pass the hardware device called @var{name} to all filters in any filter graph.
  14437. @end table
  14438. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14439. @itemize
  14440. @item
  14441. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14442. @example
  14443. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14444. @end example
  14445. @end itemize
  14446. 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.
  14447. @section avgblur_opencl
  14448. Apply average blur filter.
  14449. The filter accepts the following options:
  14450. @table @option
  14451. @item sizeX
  14452. Set horizontal radius size.
  14453. Range is @code{[1, 1024]} and default value is @code{1}.
  14454. @item planes
  14455. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14456. @item sizeY
  14457. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14458. @end table
  14459. @subsection Example
  14460. @itemize
  14461. @item
  14462. 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.
  14463. @example
  14464. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14465. @end example
  14466. @end itemize
  14467. @section boxblur_opencl
  14468. Apply a boxblur algorithm to the input video.
  14469. It accepts the following parameters:
  14470. @table @option
  14471. @item luma_radius, lr
  14472. @item luma_power, lp
  14473. @item chroma_radius, cr
  14474. @item chroma_power, cp
  14475. @item alpha_radius, ar
  14476. @item alpha_power, ap
  14477. @end table
  14478. A description of the accepted options follows.
  14479. @table @option
  14480. @item luma_radius, lr
  14481. @item chroma_radius, cr
  14482. @item alpha_radius, ar
  14483. Set an expression for the box radius in pixels used for blurring the
  14484. corresponding input plane.
  14485. The radius value must be a non-negative number, and must not be
  14486. greater than the value of the expression @code{min(w,h)/2} for the
  14487. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14488. planes.
  14489. Default value for @option{luma_radius} is "2". If not specified,
  14490. @option{chroma_radius} and @option{alpha_radius} default to the
  14491. corresponding value set for @option{luma_radius}.
  14492. The expressions can contain the following constants:
  14493. @table @option
  14494. @item w
  14495. @item h
  14496. The input width and height in pixels.
  14497. @item cw
  14498. @item ch
  14499. The input chroma image width and height in pixels.
  14500. @item hsub
  14501. @item vsub
  14502. The horizontal and vertical chroma subsample values. For example, for the
  14503. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14504. @end table
  14505. @item luma_power, lp
  14506. @item chroma_power, cp
  14507. @item alpha_power, ap
  14508. Specify how many times the boxblur filter is applied to the
  14509. corresponding plane.
  14510. Default value for @option{luma_power} is 2. If not specified,
  14511. @option{chroma_power} and @option{alpha_power} default to the
  14512. corresponding value set for @option{luma_power}.
  14513. A value of 0 will disable the effect.
  14514. @end table
  14515. @subsection Examples
  14516. 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.
  14517. @itemize
  14518. @item
  14519. Apply a boxblur filter with the luma, chroma, and alpha radius
  14520. 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.
  14521. @example
  14522. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14523. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14524. @end example
  14525. @item
  14526. 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.
  14527. For the luma plane, a 2x2 box radius will be run once.
  14528. For the chroma plane, a 4x4 box radius will be run 5 times.
  14529. For the alpha plane, a 3x3 box radius will be run 7 times.
  14530. @example
  14531. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14532. @end example
  14533. @end itemize
  14534. @section convolution_opencl
  14535. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14536. The filter accepts the following options:
  14537. @table @option
  14538. @item 0m
  14539. @item 1m
  14540. @item 2m
  14541. @item 3m
  14542. Set matrix for each plane.
  14543. Matrix is sequence of 9, 25 or 49 signed numbers.
  14544. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14545. @item 0rdiv
  14546. @item 1rdiv
  14547. @item 2rdiv
  14548. @item 3rdiv
  14549. Set multiplier for calculated value for each plane.
  14550. If unset or 0, it will be sum of all matrix elements.
  14551. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14552. @item 0bias
  14553. @item 1bias
  14554. @item 2bias
  14555. @item 3bias
  14556. Set bias for each plane. This value is added to the result of the multiplication.
  14557. Useful for making the overall image brighter or darker.
  14558. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14559. @end table
  14560. @subsection Examples
  14561. @itemize
  14562. @item
  14563. Apply sharpen:
  14564. @example
  14565. -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
  14566. @end example
  14567. @item
  14568. Apply blur:
  14569. @example
  14570. -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
  14571. @end example
  14572. @item
  14573. Apply edge enhance:
  14574. @example
  14575. -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
  14576. @end example
  14577. @item
  14578. Apply edge detect:
  14579. @example
  14580. -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
  14581. @end example
  14582. @item
  14583. Apply laplacian edge detector which includes diagonals:
  14584. @example
  14585. -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
  14586. @end example
  14587. @item
  14588. Apply emboss:
  14589. @example
  14590. -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
  14591. @end example
  14592. @end itemize
  14593. @section dilation_opencl
  14594. Apply dilation effect to the video.
  14595. This filter replaces the pixel by the local(3x3) maximum.
  14596. It accepts the following options:
  14597. @table @option
  14598. @item threshold0
  14599. @item threshold1
  14600. @item threshold2
  14601. @item threshold3
  14602. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14603. If @code{0}, plane will remain unchanged.
  14604. @item coordinates
  14605. Flag which specifies the pixel to refer to.
  14606. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14607. Flags to local 3x3 coordinates region centered on @code{x}:
  14608. 1 2 3
  14609. 4 x 5
  14610. 6 7 8
  14611. @end table
  14612. @subsection Example
  14613. @itemize
  14614. @item
  14615. 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.
  14616. @example
  14617. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14618. @end example
  14619. @end itemize
  14620. @section erosion_opencl
  14621. Apply erosion effect to the video.
  14622. This filter replaces the pixel by the local(3x3) minimum.
  14623. It accepts the following options:
  14624. @table @option
  14625. @item threshold0
  14626. @item threshold1
  14627. @item threshold2
  14628. @item threshold3
  14629. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14630. If @code{0}, plane will remain unchanged.
  14631. @item coordinates
  14632. Flag which specifies the pixel to refer to.
  14633. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14634. Flags to local 3x3 coordinates region centered on @code{x}:
  14635. 1 2 3
  14636. 4 x 5
  14637. 6 7 8
  14638. @end table
  14639. @subsection Example
  14640. @itemize
  14641. @item
  14642. 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.
  14643. @example
  14644. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14645. @end example
  14646. @end itemize
  14647. @section colorkey_opencl
  14648. RGB colorspace color keying.
  14649. The filter accepts the following options:
  14650. @table @option
  14651. @item color
  14652. The color which will be replaced with transparency.
  14653. @item similarity
  14654. Similarity percentage with the key color.
  14655. 0.01 matches only the exact key color, while 1.0 matches everything.
  14656. @item blend
  14657. Blend percentage.
  14658. 0.0 makes pixels either fully transparent, or not transparent at all.
  14659. Higher values result in semi-transparent pixels, with a higher transparency
  14660. the more similar the pixels color is to the key color.
  14661. @end table
  14662. @subsection Examples
  14663. @itemize
  14664. @item
  14665. Make every semi-green pixel in the input transparent with some slight blending:
  14666. @example
  14667. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14668. @end example
  14669. @end itemize
  14670. @section overlay_opencl
  14671. Overlay one video on top of another.
  14672. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14673. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14674. The filter accepts the following options:
  14675. @table @option
  14676. @item x
  14677. Set the x coordinate of the overlaid video on the main video.
  14678. Default value is @code{0}.
  14679. @item y
  14680. Set the x coordinate of the overlaid video on the main video.
  14681. Default value is @code{0}.
  14682. @end table
  14683. @subsection Examples
  14684. @itemize
  14685. @item
  14686. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14687. @example
  14688. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14689. @end example
  14690. @item
  14691. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14692. @example
  14693. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14694. @end example
  14695. @end itemize
  14696. @section prewitt_opencl
  14697. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14698. The filter accepts the following option:
  14699. @table @option
  14700. @item planes
  14701. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14702. @item scale
  14703. Set value which will be multiplied with filtered result.
  14704. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14705. @item delta
  14706. Set value which will be added to filtered result.
  14707. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14708. @end table
  14709. @subsection Example
  14710. @itemize
  14711. @item
  14712. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14713. @example
  14714. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14715. @end example
  14716. @end itemize
  14717. @section roberts_opencl
  14718. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14719. The filter accepts the following option:
  14720. @table @option
  14721. @item planes
  14722. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14723. @item scale
  14724. Set value which will be multiplied with filtered result.
  14725. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14726. @item delta
  14727. Set value which will be added to filtered result.
  14728. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14729. @end table
  14730. @subsection Example
  14731. @itemize
  14732. @item
  14733. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14734. @example
  14735. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14736. @end example
  14737. @end itemize
  14738. @section sobel_opencl
  14739. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14740. The filter accepts the following option:
  14741. @table @option
  14742. @item planes
  14743. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14744. @item scale
  14745. Set value which will be multiplied with filtered result.
  14746. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14747. @item delta
  14748. Set value which will be added to filtered result.
  14749. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14750. @end table
  14751. @subsection Example
  14752. @itemize
  14753. @item
  14754. Apply sobel operator with scale set to 2 and delta set to 10
  14755. @example
  14756. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14757. @end example
  14758. @end itemize
  14759. @section tonemap_opencl
  14760. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14761. It accepts the following parameters:
  14762. @table @option
  14763. @item tonemap
  14764. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14765. @item param
  14766. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14767. @item desat
  14768. Apply desaturation for highlights that exceed this level of brightness. The
  14769. higher the parameter, the more color information will be preserved. This
  14770. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14771. (smoothly) turning into white instead. This makes images feel more natural,
  14772. at the cost of reducing information about out-of-range colors.
  14773. The default value is 0.5, and the algorithm here is a little different from
  14774. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14775. @item threshold
  14776. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14777. is used to detect whether the scene has changed or not. If the distance between
  14778. the current frame average brightness and the current running average exceeds
  14779. a threshold value, we would re-calculate scene average and peak brightness.
  14780. The default value is 0.2.
  14781. @item format
  14782. Specify the output pixel format.
  14783. Currently supported formats are:
  14784. @table @var
  14785. @item p010
  14786. @item nv12
  14787. @end table
  14788. @item range, r
  14789. Set the output color range.
  14790. Possible values are:
  14791. @table @var
  14792. @item tv/mpeg
  14793. @item pc/jpeg
  14794. @end table
  14795. Default is same as input.
  14796. @item primaries, p
  14797. Set the output color primaries.
  14798. Possible values are:
  14799. @table @var
  14800. @item bt709
  14801. @item bt2020
  14802. @end table
  14803. Default is same as input.
  14804. @item transfer, t
  14805. Set the output transfer characteristics.
  14806. Possible values are:
  14807. @table @var
  14808. @item bt709
  14809. @item bt2020
  14810. @end table
  14811. Default is bt709.
  14812. @item matrix, m
  14813. Set the output colorspace matrix.
  14814. Possible value are:
  14815. @table @var
  14816. @item bt709
  14817. @item bt2020
  14818. @end table
  14819. Default is same as input.
  14820. @end table
  14821. @subsection Example
  14822. @itemize
  14823. @item
  14824. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14825. @example
  14826. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14827. @end example
  14828. @end itemize
  14829. @section unsharp_opencl
  14830. Sharpen or blur the input video.
  14831. It accepts the following parameters:
  14832. @table @option
  14833. @item luma_msize_x, lx
  14834. Set the luma matrix horizontal size.
  14835. Range is @code{[1, 23]} and default value is @code{5}.
  14836. @item luma_msize_y, ly
  14837. Set the luma matrix vertical size.
  14838. Range is @code{[1, 23]} and default value is @code{5}.
  14839. @item luma_amount, la
  14840. Set the luma effect strength.
  14841. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14842. Negative values will blur the input video, while positive values will
  14843. sharpen it, a value of zero will disable the effect.
  14844. @item chroma_msize_x, cx
  14845. Set the chroma matrix horizontal size.
  14846. Range is @code{[1, 23]} and default value is @code{5}.
  14847. @item chroma_msize_y, cy
  14848. Set the chroma matrix vertical size.
  14849. Range is @code{[1, 23]} and default value is @code{5}.
  14850. @item chroma_amount, ca
  14851. Set the chroma effect strength.
  14852. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14853. Negative values will blur the input video, while positive values will
  14854. sharpen it, a value of zero will disable the effect.
  14855. @end table
  14856. All parameters are optional and default to the equivalent of the
  14857. string '5:5:1.0:5:5:0.0'.
  14858. @subsection Examples
  14859. @itemize
  14860. @item
  14861. Apply strong luma sharpen effect:
  14862. @example
  14863. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14864. @end example
  14865. @item
  14866. Apply a strong blur of both luma and chroma parameters:
  14867. @example
  14868. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14869. @end example
  14870. @end itemize
  14871. @c man end OPENCL VIDEO FILTERS
  14872. @chapter Video Sources
  14873. @c man begin VIDEO SOURCES
  14874. Below is a description of the currently available video sources.
  14875. @section buffer
  14876. Buffer video frames, and make them available to the filter chain.
  14877. This source is mainly intended for a programmatic use, in particular
  14878. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14879. It accepts the following parameters:
  14880. @table @option
  14881. @item video_size
  14882. Specify the size (width and height) of the buffered video frames. For the
  14883. syntax of this option, check the
  14884. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14885. @item width
  14886. The input video width.
  14887. @item height
  14888. The input video height.
  14889. @item pix_fmt
  14890. A string representing the pixel format of the buffered video frames.
  14891. It may be a number corresponding to a pixel format, or a pixel format
  14892. name.
  14893. @item time_base
  14894. Specify the timebase assumed by the timestamps of the buffered frames.
  14895. @item frame_rate
  14896. Specify the frame rate expected for the video stream.
  14897. @item pixel_aspect, sar
  14898. The sample (pixel) aspect ratio of the input video.
  14899. @item sws_param
  14900. Specify the optional parameters to be used for the scale filter which
  14901. is automatically inserted when an input change is detected in the
  14902. input size or format.
  14903. @item hw_frames_ctx
  14904. When using a hardware pixel format, this should be a reference to an
  14905. AVHWFramesContext describing input frames.
  14906. @end table
  14907. For example:
  14908. @example
  14909. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14910. @end example
  14911. will instruct the source to accept video frames with size 320x240 and
  14912. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14913. square pixels (1:1 sample aspect ratio).
  14914. Since the pixel format with name "yuv410p" corresponds to the number 6
  14915. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14916. this example corresponds to:
  14917. @example
  14918. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14919. @end example
  14920. Alternatively, the options can be specified as a flat string, but this
  14921. syntax is deprecated:
  14922. @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}]
  14923. @section cellauto
  14924. Create a pattern generated by an elementary cellular automaton.
  14925. The initial state of the cellular automaton can be defined through the
  14926. @option{filename} and @option{pattern} options. If such options are
  14927. not specified an initial state is created randomly.
  14928. At each new frame a new row in the video is filled with the result of
  14929. the cellular automaton next generation. The behavior when the whole
  14930. frame is filled is defined by the @option{scroll} option.
  14931. This source accepts the following options:
  14932. @table @option
  14933. @item filename, f
  14934. Read the initial cellular automaton state, i.e. the starting row, from
  14935. the specified file.
  14936. In the file, each non-whitespace character is considered an alive
  14937. cell, a newline will terminate the row, and further characters in the
  14938. file will be ignored.
  14939. @item pattern, p
  14940. Read the initial cellular automaton state, i.e. the starting row, from
  14941. the specified string.
  14942. Each non-whitespace character in the string is considered an alive
  14943. cell, a newline will terminate the row, and further characters in the
  14944. string will be ignored.
  14945. @item rate, r
  14946. Set the video rate, that is the number of frames generated per second.
  14947. Default is 25.
  14948. @item random_fill_ratio, ratio
  14949. Set the random fill ratio for the initial cellular automaton row. It
  14950. is a floating point number value ranging from 0 to 1, defaults to
  14951. 1/PHI.
  14952. This option is ignored when a file or a pattern is specified.
  14953. @item random_seed, seed
  14954. Set the seed for filling randomly the initial row, must be an integer
  14955. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14956. set to -1, the filter will try to use a good random seed on a best
  14957. effort basis.
  14958. @item rule
  14959. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14960. Default value is 110.
  14961. @item size, s
  14962. Set the size of the output video. For the syntax of this option, check the
  14963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14964. If @option{filename} or @option{pattern} is specified, the size is set
  14965. by default to the width of the specified initial state row, and the
  14966. height is set to @var{width} * PHI.
  14967. If @option{size} is set, it must contain the width of the specified
  14968. pattern string, and the specified pattern will be centered in the
  14969. larger row.
  14970. If a filename or a pattern string is not specified, the size value
  14971. defaults to "320x518" (used for a randomly generated initial state).
  14972. @item scroll
  14973. If set to 1, scroll the output upward when all the rows in the output
  14974. have been already filled. If set to 0, the new generated row will be
  14975. written over the top row just after the bottom row is filled.
  14976. Defaults to 1.
  14977. @item start_full, full
  14978. If set to 1, completely fill the output with generated rows before
  14979. outputting the first frame.
  14980. This is the default behavior, for disabling set the value to 0.
  14981. @item stitch
  14982. If set to 1, stitch the left and right row edges together.
  14983. This is the default behavior, for disabling set the value to 0.
  14984. @end table
  14985. @subsection Examples
  14986. @itemize
  14987. @item
  14988. Read the initial state from @file{pattern}, and specify an output of
  14989. size 200x400.
  14990. @example
  14991. cellauto=f=pattern:s=200x400
  14992. @end example
  14993. @item
  14994. Generate a random initial row with a width of 200 cells, with a fill
  14995. ratio of 2/3:
  14996. @example
  14997. cellauto=ratio=2/3:s=200x200
  14998. @end example
  14999. @item
  15000. Create a pattern generated by rule 18 starting by a single alive cell
  15001. centered on an initial row with width 100:
  15002. @example
  15003. cellauto=p=@@:s=100x400:full=0:rule=18
  15004. @end example
  15005. @item
  15006. Specify a more elaborated initial pattern:
  15007. @example
  15008. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15009. @end example
  15010. @end itemize
  15011. @anchor{coreimagesrc}
  15012. @section coreimagesrc
  15013. Video source generated on GPU using Apple's CoreImage API on OSX.
  15014. This video source is a specialized version of the @ref{coreimage} video filter.
  15015. Use a core image generator at the beginning of the applied filterchain to
  15016. generate the content.
  15017. The coreimagesrc video source accepts the following options:
  15018. @table @option
  15019. @item list_generators
  15020. List all available generators along with all their respective options as well as
  15021. possible minimum and maximum values along with the default values.
  15022. @example
  15023. list_generators=true
  15024. @end example
  15025. @item size, s
  15026. Specify the size of the sourced video. For the syntax of this option, check the
  15027. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15028. The default value is @code{320x240}.
  15029. @item rate, r
  15030. Specify the frame rate of the sourced video, as the number of frames
  15031. generated per second. It has to be a string in the format
  15032. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15033. number or a valid video frame rate abbreviation. The default value is
  15034. "25".
  15035. @item sar
  15036. Set the sample aspect ratio of the sourced video.
  15037. @item duration, d
  15038. Set the duration of the sourced video. See
  15039. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15040. for the accepted syntax.
  15041. If not specified, or the expressed duration is negative, the video is
  15042. supposed to be generated forever.
  15043. @end table
  15044. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15045. A complete filterchain can be used for further processing of the
  15046. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15047. and examples for details.
  15048. @subsection Examples
  15049. @itemize
  15050. @item
  15051. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15052. given as complete and escaped command-line for Apple's standard bash shell:
  15053. @example
  15054. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15055. @end example
  15056. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15057. need for a nullsrc video source.
  15058. @end itemize
  15059. @section mandelbrot
  15060. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15061. point specified with @var{start_x} and @var{start_y}.
  15062. This source accepts the following options:
  15063. @table @option
  15064. @item end_pts
  15065. Set the terminal pts value. Default value is 400.
  15066. @item end_scale
  15067. Set the terminal scale value.
  15068. Must be a floating point value. Default value is 0.3.
  15069. @item inner
  15070. Set the inner coloring mode, that is the algorithm used to draw the
  15071. Mandelbrot fractal internal region.
  15072. It shall assume one of the following values:
  15073. @table @option
  15074. @item black
  15075. Set black mode.
  15076. @item convergence
  15077. Show time until convergence.
  15078. @item mincol
  15079. Set color based on point closest to the origin of the iterations.
  15080. @item period
  15081. Set period mode.
  15082. @end table
  15083. Default value is @var{mincol}.
  15084. @item bailout
  15085. Set the bailout value. Default value is 10.0.
  15086. @item maxiter
  15087. Set the maximum of iterations performed by the rendering
  15088. algorithm. Default value is 7189.
  15089. @item outer
  15090. Set outer coloring mode.
  15091. It shall assume one of following values:
  15092. @table @option
  15093. @item iteration_count
  15094. Set iteration count mode.
  15095. @item normalized_iteration_count
  15096. set normalized iteration count mode.
  15097. @end table
  15098. Default value is @var{normalized_iteration_count}.
  15099. @item rate, r
  15100. Set frame rate, expressed as number of frames per second. Default
  15101. value is "25".
  15102. @item size, s
  15103. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15104. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15105. @item start_scale
  15106. Set the initial scale value. Default value is 3.0.
  15107. @item start_x
  15108. Set the initial x position. Must be a floating point value between
  15109. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15110. @item start_y
  15111. Set the initial y position. Must be a floating point value between
  15112. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15113. @end table
  15114. @section mptestsrc
  15115. Generate various test patterns, as generated by the MPlayer test filter.
  15116. The size of the generated video is fixed, and is 256x256.
  15117. This source is useful in particular for testing encoding features.
  15118. This source accepts the following options:
  15119. @table @option
  15120. @item rate, r
  15121. Specify the frame rate of the sourced video, as the number of frames
  15122. generated per second. It has to be a string in the format
  15123. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15124. number or a valid video frame rate abbreviation. The default value is
  15125. "25".
  15126. @item duration, d
  15127. Set the duration of the sourced video. See
  15128. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15129. for the accepted syntax.
  15130. If not specified, or the expressed duration is negative, the video is
  15131. supposed to be generated forever.
  15132. @item test, t
  15133. Set the number or the name of the test to perform. Supported tests are:
  15134. @table @option
  15135. @item dc_luma
  15136. @item dc_chroma
  15137. @item freq_luma
  15138. @item freq_chroma
  15139. @item amp_luma
  15140. @item amp_chroma
  15141. @item cbp
  15142. @item mv
  15143. @item ring1
  15144. @item ring2
  15145. @item all
  15146. @end table
  15147. Default value is "all", which will cycle through the list of all tests.
  15148. @end table
  15149. Some examples:
  15150. @example
  15151. mptestsrc=t=dc_luma
  15152. @end example
  15153. will generate a "dc_luma" test pattern.
  15154. @section frei0r_src
  15155. Provide a frei0r source.
  15156. To enable compilation of this filter you need to install the frei0r
  15157. header and configure FFmpeg with @code{--enable-frei0r}.
  15158. This source accepts the following parameters:
  15159. @table @option
  15160. @item size
  15161. The size of the video to generate. For the syntax of this option, check the
  15162. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15163. @item framerate
  15164. The framerate of the generated video. It may be a string of the form
  15165. @var{num}/@var{den} or a frame rate abbreviation.
  15166. @item filter_name
  15167. The name to the frei0r source to load. For more information regarding frei0r and
  15168. how to set the parameters, read the @ref{frei0r} section in the video filters
  15169. documentation.
  15170. @item filter_params
  15171. A '|'-separated list of parameters to pass to the frei0r source.
  15172. @end table
  15173. For example, to generate a frei0r partik0l source with size 200x200
  15174. and frame rate 10 which is overlaid on the overlay filter main input:
  15175. @example
  15176. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15177. @end example
  15178. @section life
  15179. Generate a life pattern.
  15180. This source is based on a generalization of John Conway's life game.
  15181. The sourced input represents a life grid, each pixel represents a cell
  15182. which can be in one of two possible states, alive or dead. Every cell
  15183. interacts with its eight neighbours, which are the cells that are
  15184. horizontally, vertically, or diagonally adjacent.
  15185. At each interaction the grid evolves according to the adopted rule,
  15186. which specifies the number of neighbor alive cells which will make a
  15187. cell stay alive or born. The @option{rule} option allows one to specify
  15188. the rule to adopt.
  15189. This source accepts the following options:
  15190. @table @option
  15191. @item filename, f
  15192. Set the file from which to read the initial grid state. In the file,
  15193. each non-whitespace character is considered an alive cell, and newline
  15194. is used to delimit the end of each row.
  15195. If this option is not specified, the initial grid is generated
  15196. randomly.
  15197. @item rate, r
  15198. Set the video rate, that is the number of frames generated per second.
  15199. Default is 25.
  15200. @item random_fill_ratio, ratio
  15201. Set the random fill ratio for the initial random grid. It is a
  15202. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15203. It is ignored when a file is specified.
  15204. @item random_seed, seed
  15205. Set the seed for filling the initial random grid, must be an integer
  15206. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15207. set to -1, the filter will try to use a good random seed on a best
  15208. effort basis.
  15209. @item rule
  15210. Set the life rule.
  15211. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15212. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15213. @var{NS} specifies the number of alive neighbor cells which make a
  15214. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15215. which make a dead cell to become alive (i.e. to "born").
  15216. "s" and "b" can be used in place of "S" and "B", respectively.
  15217. Alternatively a rule can be specified by an 18-bits integer. The 9
  15218. high order bits are used to encode the next cell state if it is alive
  15219. for each number of neighbor alive cells, the low order bits specify
  15220. the rule for "borning" new cells. Higher order bits encode for an
  15221. higher number of neighbor cells.
  15222. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15223. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15224. Default value is "S23/B3", which is the original Conway's game of life
  15225. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15226. cells, and will born a new cell if there are three alive cells around
  15227. a dead cell.
  15228. @item size, s
  15229. Set the size of the output video. For the syntax of this option, check the
  15230. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15231. If @option{filename} is specified, the size is set by default to the
  15232. same size of the input file. If @option{size} is set, it must contain
  15233. the size specified in the input file, and the initial grid defined in
  15234. that file is centered in the larger resulting area.
  15235. If a filename is not specified, the size value defaults to "320x240"
  15236. (used for a randomly generated initial grid).
  15237. @item stitch
  15238. If set to 1, stitch the left and right grid edges together, and the
  15239. top and bottom edges also. Defaults to 1.
  15240. @item mold
  15241. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15242. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15243. value from 0 to 255.
  15244. @item life_color
  15245. Set the color of living (or new born) cells.
  15246. @item death_color
  15247. Set the color of dead cells. If @option{mold} is set, this is the first color
  15248. used to represent a dead cell.
  15249. @item mold_color
  15250. Set mold color, for definitely dead and moldy cells.
  15251. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15252. ffmpeg-utils manual,ffmpeg-utils}.
  15253. @end table
  15254. @subsection Examples
  15255. @itemize
  15256. @item
  15257. Read a grid from @file{pattern}, and center it on a grid of size
  15258. 300x300 pixels:
  15259. @example
  15260. life=f=pattern:s=300x300
  15261. @end example
  15262. @item
  15263. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15264. @example
  15265. life=ratio=2/3:s=200x200
  15266. @end example
  15267. @item
  15268. Specify a custom rule for evolving a randomly generated grid:
  15269. @example
  15270. life=rule=S14/B34
  15271. @end example
  15272. @item
  15273. Full example with slow death effect (mold) using @command{ffplay}:
  15274. @example
  15275. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15276. @end example
  15277. @end itemize
  15278. @anchor{allrgb}
  15279. @anchor{allyuv}
  15280. @anchor{color}
  15281. @anchor{haldclutsrc}
  15282. @anchor{nullsrc}
  15283. @anchor{pal75bars}
  15284. @anchor{pal100bars}
  15285. @anchor{rgbtestsrc}
  15286. @anchor{smptebars}
  15287. @anchor{smptehdbars}
  15288. @anchor{testsrc}
  15289. @anchor{testsrc2}
  15290. @anchor{yuvtestsrc}
  15291. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15292. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15293. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15294. The @code{color} source provides an uniformly colored input.
  15295. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15296. @ref{haldclut} filter.
  15297. The @code{nullsrc} source returns unprocessed video frames. It is
  15298. mainly useful to be employed in analysis / debugging tools, or as the
  15299. source for filters which ignore the input data.
  15300. The @code{pal75bars} source generates a color bars pattern, based on
  15301. EBU PAL recommendations with 75% color levels.
  15302. The @code{pal100bars} source generates a color bars pattern, based on
  15303. EBU PAL recommendations with 100% color levels.
  15304. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15305. detecting RGB vs BGR issues. You should see a red, green and blue
  15306. stripe from top to bottom.
  15307. The @code{smptebars} source generates a color bars pattern, based on
  15308. the SMPTE Engineering Guideline EG 1-1990.
  15309. The @code{smptehdbars} source generates a color bars pattern, based on
  15310. the SMPTE RP 219-2002.
  15311. The @code{testsrc} source generates a test video pattern, showing a
  15312. color pattern, a scrolling gradient and a timestamp. This is mainly
  15313. intended for testing purposes.
  15314. The @code{testsrc2} source is similar to testsrc, but supports more
  15315. pixel formats instead of just @code{rgb24}. This allows using it as an
  15316. input for other tests without requiring a format conversion.
  15317. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15318. see a y, cb and cr stripe from top to bottom.
  15319. The sources accept the following parameters:
  15320. @table @option
  15321. @item level
  15322. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15323. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15324. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15325. coded on a @code{1/(N*N)} scale.
  15326. @item color, c
  15327. Specify the color of the source, only available in the @code{color}
  15328. source. For the syntax of this option, check the
  15329. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15330. @item size, s
  15331. Specify the size of the sourced video. For the syntax of this option, check the
  15332. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15333. The default value is @code{320x240}.
  15334. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15335. @code{haldclutsrc} filters.
  15336. @item rate, r
  15337. Specify the frame rate of the sourced video, as the number of frames
  15338. generated per second. It has to be a string in the format
  15339. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15340. number or a valid video frame rate abbreviation. The default value is
  15341. "25".
  15342. @item duration, d
  15343. Set the duration of the sourced video. See
  15344. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15345. for the accepted syntax.
  15346. If not specified, or the expressed duration is negative, the video is
  15347. supposed to be generated forever.
  15348. @item sar
  15349. Set the sample aspect ratio of the sourced video.
  15350. @item alpha
  15351. Specify the alpha (opacity) of the background, only available in the
  15352. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15353. 255 (fully opaque, the default).
  15354. @item decimals, n
  15355. Set the number of decimals to show in the timestamp, only available in the
  15356. @code{testsrc} source.
  15357. The displayed timestamp value will correspond to the original
  15358. timestamp value multiplied by the power of 10 of the specified
  15359. value. Default value is 0.
  15360. @end table
  15361. @subsection Examples
  15362. @itemize
  15363. @item
  15364. Generate a video with a duration of 5.3 seconds, with size
  15365. 176x144 and a frame rate of 10 frames per second:
  15366. @example
  15367. testsrc=duration=5.3:size=qcif:rate=10
  15368. @end example
  15369. @item
  15370. The following graph description will generate a red source
  15371. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15372. frames per second:
  15373. @example
  15374. color=c=red@@0.2:s=qcif:r=10
  15375. @end example
  15376. @item
  15377. If the input content is to be ignored, @code{nullsrc} can be used. The
  15378. following command generates noise in the luminance plane by employing
  15379. the @code{geq} filter:
  15380. @example
  15381. nullsrc=s=256x256, geq=random(1)*255:128:128
  15382. @end example
  15383. @end itemize
  15384. @subsection Commands
  15385. The @code{color} source supports the following commands:
  15386. @table @option
  15387. @item c, color
  15388. Set the color of the created image. Accepts the same syntax of the
  15389. corresponding @option{color} option.
  15390. @end table
  15391. @section openclsrc
  15392. Generate video using an OpenCL program.
  15393. @table @option
  15394. @item source
  15395. OpenCL program source file.
  15396. @item kernel
  15397. Kernel name in program.
  15398. @item size, s
  15399. Size of frames to generate. This must be set.
  15400. @item format
  15401. Pixel format to use for the generated frames. This must be set.
  15402. @item rate, r
  15403. Number of frames generated every second. Default value is '25'.
  15404. @end table
  15405. For details of how the program loading works, see the @ref{program_opencl}
  15406. filter.
  15407. Example programs:
  15408. @itemize
  15409. @item
  15410. Generate a colour ramp by setting pixel values from the position of the pixel
  15411. in the output image. (Note that this will work with all pixel formats, but
  15412. the generated output will not be the same.)
  15413. @verbatim
  15414. __kernel void ramp(__write_only image2d_t dst,
  15415. unsigned int index)
  15416. {
  15417. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15418. float4 val;
  15419. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15420. write_imagef(dst, loc, val);
  15421. }
  15422. @end verbatim
  15423. @item
  15424. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15425. @verbatim
  15426. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15427. unsigned int index)
  15428. {
  15429. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15430. float4 value = 0.0f;
  15431. int x = loc.x + index;
  15432. int y = loc.y + index;
  15433. while (x > 0 || y > 0) {
  15434. if (x % 3 == 1 && y % 3 == 1) {
  15435. value = 1.0f;
  15436. break;
  15437. }
  15438. x /= 3;
  15439. y /= 3;
  15440. }
  15441. write_imagef(dst, loc, value);
  15442. }
  15443. @end verbatim
  15444. @end itemize
  15445. @c man end VIDEO SOURCES
  15446. @chapter Video Sinks
  15447. @c man begin VIDEO SINKS
  15448. Below is a description of the currently available video sinks.
  15449. @section buffersink
  15450. Buffer video frames, and make them available to the end of the filter
  15451. graph.
  15452. This sink is mainly intended for programmatic use, in particular
  15453. through the interface defined in @file{libavfilter/buffersink.h}
  15454. or the options system.
  15455. It accepts a pointer to an AVBufferSinkContext structure, which
  15456. defines the incoming buffers' formats, to be passed as the opaque
  15457. parameter to @code{avfilter_init_filter} for initialization.
  15458. @section nullsink
  15459. Null video sink: do absolutely nothing with the input video. It is
  15460. mainly useful as a template and for use in analysis / debugging
  15461. tools.
  15462. @c man end VIDEO SINKS
  15463. @chapter Multimedia Filters
  15464. @c man begin MULTIMEDIA FILTERS
  15465. Below is a description of the currently available multimedia filters.
  15466. @section abitscope
  15467. Convert input audio to a video output, displaying the audio bit scope.
  15468. The filter accepts the following options:
  15469. @table @option
  15470. @item rate, r
  15471. Set frame rate, expressed as number of frames per second. Default
  15472. value is "25".
  15473. @item size, s
  15474. Specify the video size for the output. For the syntax of this option, check the
  15475. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15476. Default value is @code{1024x256}.
  15477. @item colors
  15478. Specify list of colors separated by space or by '|' which will be used to
  15479. draw channels. Unrecognized or missing colors will be replaced
  15480. by white color.
  15481. @end table
  15482. @section ahistogram
  15483. Convert input audio to a video output, displaying the volume histogram.
  15484. The filter accepts the following options:
  15485. @table @option
  15486. @item dmode
  15487. Specify how histogram is calculated.
  15488. It accepts the following values:
  15489. @table @samp
  15490. @item single
  15491. Use single histogram for all channels.
  15492. @item separate
  15493. Use separate histogram for each channel.
  15494. @end table
  15495. Default is @code{single}.
  15496. @item rate, r
  15497. Set frame rate, expressed as number of frames per second. Default
  15498. value is "25".
  15499. @item size, s
  15500. Specify the video size for the output. For the syntax of this option, check the
  15501. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15502. Default value is @code{hd720}.
  15503. @item scale
  15504. Set display scale.
  15505. It accepts the following values:
  15506. @table @samp
  15507. @item log
  15508. logarithmic
  15509. @item sqrt
  15510. square root
  15511. @item cbrt
  15512. cubic root
  15513. @item lin
  15514. linear
  15515. @item rlog
  15516. reverse logarithmic
  15517. @end table
  15518. Default is @code{log}.
  15519. @item ascale
  15520. Set amplitude scale.
  15521. It accepts the following values:
  15522. @table @samp
  15523. @item log
  15524. logarithmic
  15525. @item lin
  15526. linear
  15527. @end table
  15528. Default is @code{log}.
  15529. @item acount
  15530. Set how much frames to accumulate in histogram.
  15531. Default is 1. Setting this to -1 accumulates all frames.
  15532. @item rheight
  15533. Set histogram ratio of window height.
  15534. @item slide
  15535. Set sonogram sliding.
  15536. It accepts the following values:
  15537. @table @samp
  15538. @item replace
  15539. replace old rows with new ones.
  15540. @item scroll
  15541. scroll from top to bottom.
  15542. @end table
  15543. Default is @code{replace}.
  15544. @end table
  15545. @section aphasemeter
  15546. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15547. representing mean phase of current audio frame. A video output can also be produced and is
  15548. enabled by default. The audio is passed through as first output.
  15549. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15550. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15551. and @code{1} means channels are in phase.
  15552. The filter accepts the following options, all related to its video output:
  15553. @table @option
  15554. @item rate, r
  15555. Set the output frame rate. Default value is @code{25}.
  15556. @item size, s
  15557. Set the video size for the output. For the syntax of this option, check the
  15558. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15559. Default value is @code{800x400}.
  15560. @item rc
  15561. @item gc
  15562. @item bc
  15563. Specify the red, green, blue contrast. Default values are @code{2},
  15564. @code{7} and @code{1}.
  15565. Allowed range is @code{[0, 255]}.
  15566. @item mpc
  15567. Set color which will be used for drawing median phase. If color is
  15568. @code{none} which is default, no median phase value will be drawn.
  15569. @item video
  15570. Enable video output. Default is enabled.
  15571. @end table
  15572. @section avectorscope
  15573. Convert input audio to a video output, representing the audio vector
  15574. scope.
  15575. The filter is used to measure the difference between channels of stereo
  15576. audio stream. A monoaural signal, consisting of identical left and right
  15577. signal, results in straight vertical line. Any stereo separation is visible
  15578. as a deviation from this line, creating a Lissajous figure.
  15579. If the straight (or deviation from it) but horizontal line appears this
  15580. indicates that the left and right channels are out of phase.
  15581. The filter accepts the following options:
  15582. @table @option
  15583. @item mode, m
  15584. Set the vectorscope mode.
  15585. Available values are:
  15586. @table @samp
  15587. @item lissajous
  15588. Lissajous rotated by 45 degrees.
  15589. @item lissajous_xy
  15590. Same as above but not rotated.
  15591. @item polar
  15592. Shape resembling half of circle.
  15593. @end table
  15594. Default value is @samp{lissajous}.
  15595. @item size, s
  15596. Set the video size for the output. For the syntax of this option, check the
  15597. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15598. Default value is @code{400x400}.
  15599. @item rate, r
  15600. Set the output frame rate. Default value is @code{25}.
  15601. @item rc
  15602. @item gc
  15603. @item bc
  15604. @item ac
  15605. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15606. @code{160}, @code{80} and @code{255}.
  15607. Allowed range is @code{[0, 255]}.
  15608. @item rf
  15609. @item gf
  15610. @item bf
  15611. @item af
  15612. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15613. @code{10}, @code{5} and @code{5}.
  15614. Allowed range is @code{[0, 255]}.
  15615. @item zoom
  15616. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15617. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15618. @item draw
  15619. Set the vectorscope drawing mode.
  15620. Available values are:
  15621. @table @samp
  15622. @item dot
  15623. Draw dot for each sample.
  15624. @item line
  15625. Draw line between previous and current sample.
  15626. @end table
  15627. Default value is @samp{dot}.
  15628. @item scale
  15629. Specify amplitude scale of audio samples.
  15630. Available values are:
  15631. @table @samp
  15632. @item lin
  15633. Linear.
  15634. @item sqrt
  15635. Square root.
  15636. @item cbrt
  15637. Cubic root.
  15638. @item log
  15639. Logarithmic.
  15640. @end table
  15641. @item swap
  15642. Swap left channel axis with right channel axis.
  15643. @item mirror
  15644. Mirror axis.
  15645. @table @samp
  15646. @item none
  15647. No mirror.
  15648. @item x
  15649. Mirror only x axis.
  15650. @item y
  15651. Mirror only y axis.
  15652. @item xy
  15653. Mirror both axis.
  15654. @end table
  15655. @end table
  15656. @subsection Examples
  15657. @itemize
  15658. @item
  15659. Complete example using @command{ffplay}:
  15660. @example
  15661. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15662. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15663. @end example
  15664. @end itemize
  15665. @section bench, abench
  15666. Benchmark part of a filtergraph.
  15667. The filter accepts the following options:
  15668. @table @option
  15669. @item action
  15670. Start or stop a timer.
  15671. Available values are:
  15672. @table @samp
  15673. @item start
  15674. Get the current time, set it as frame metadata (using the key
  15675. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15676. @item stop
  15677. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15678. the input frame metadata to get the time difference. Time difference, average,
  15679. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15680. @code{min}) are then printed. The timestamps are expressed in seconds.
  15681. @end table
  15682. @end table
  15683. @subsection Examples
  15684. @itemize
  15685. @item
  15686. Benchmark @ref{selectivecolor} filter:
  15687. @example
  15688. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15689. @end example
  15690. @end itemize
  15691. @section concat
  15692. Concatenate audio and video streams, joining them together one after the
  15693. other.
  15694. The filter works on segments of synchronized video and audio streams. All
  15695. segments must have the same number of streams of each type, and that will
  15696. also be the number of streams at output.
  15697. The filter accepts the following options:
  15698. @table @option
  15699. @item n
  15700. Set the number of segments. Default is 2.
  15701. @item v
  15702. Set the number of output video streams, that is also the number of video
  15703. streams in each segment. Default is 1.
  15704. @item a
  15705. Set the number of output audio streams, that is also the number of audio
  15706. streams in each segment. Default is 0.
  15707. @item unsafe
  15708. Activate unsafe mode: do not fail if segments have a different format.
  15709. @end table
  15710. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15711. @var{a} audio outputs.
  15712. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15713. segment, in the same order as the outputs, then the inputs for the second
  15714. segment, etc.
  15715. Related streams do not always have exactly the same duration, for various
  15716. reasons including codec frame size or sloppy authoring. For that reason,
  15717. related synchronized streams (e.g. a video and its audio track) should be
  15718. concatenated at once. The concat filter will use the duration of the longest
  15719. stream in each segment (except the last one), and if necessary pad shorter
  15720. audio streams with silence.
  15721. For this filter to work correctly, all segments must start at timestamp 0.
  15722. All corresponding streams must have the same parameters in all segments; the
  15723. filtering system will automatically select a common pixel format for video
  15724. streams, and a common sample format, sample rate and channel layout for
  15725. audio streams, but other settings, such as resolution, must be converted
  15726. explicitly by the user.
  15727. Different frame rates are acceptable but will result in variable frame rate
  15728. at output; be sure to configure the output file to handle it.
  15729. @subsection Examples
  15730. @itemize
  15731. @item
  15732. Concatenate an opening, an episode and an ending, all in bilingual version
  15733. (video in stream 0, audio in streams 1 and 2):
  15734. @example
  15735. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15736. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15737. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15738. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15739. @end example
  15740. @item
  15741. Concatenate two parts, handling audio and video separately, using the
  15742. (a)movie sources, and adjusting the resolution:
  15743. @example
  15744. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15745. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15746. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15747. @end example
  15748. Note that a desync will happen at the stitch if the audio and video streams
  15749. do not have exactly the same duration in the first file.
  15750. @end itemize
  15751. @subsection Commands
  15752. This filter supports the following commands:
  15753. @table @option
  15754. @item next
  15755. Close the current segment and step to the next one
  15756. @end table
  15757. @section drawgraph, adrawgraph
  15758. Draw a graph using input video or audio metadata.
  15759. It accepts the following parameters:
  15760. @table @option
  15761. @item m1
  15762. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15763. @item fg1
  15764. Set 1st foreground color expression.
  15765. @item m2
  15766. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15767. @item fg2
  15768. Set 2nd foreground color expression.
  15769. @item m3
  15770. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15771. @item fg3
  15772. Set 3rd foreground color expression.
  15773. @item m4
  15774. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15775. @item fg4
  15776. Set 4th foreground color expression.
  15777. @item min
  15778. Set minimal value of metadata value.
  15779. @item max
  15780. Set maximal value of metadata value.
  15781. @item bg
  15782. Set graph background color. Default is white.
  15783. @item mode
  15784. Set graph mode.
  15785. Available values for mode is:
  15786. @table @samp
  15787. @item bar
  15788. @item dot
  15789. @item line
  15790. @end table
  15791. Default is @code{line}.
  15792. @item slide
  15793. Set slide mode.
  15794. Available values for slide is:
  15795. @table @samp
  15796. @item frame
  15797. Draw new frame when right border is reached.
  15798. @item replace
  15799. Replace old columns with new ones.
  15800. @item scroll
  15801. Scroll from right to left.
  15802. @item rscroll
  15803. Scroll from left to right.
  15804. @item picture
  15805. Draw single picture.
  15806. @end table
  15807. Default is @code{frame}.
  15808. @item size
  15809. Set size of graph video. For the syntax of this option, check the
  15810. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15811. The default value is @code{900x256}.
  15812. The foreground color expressions can use the following variables:
  15813. @table @option
  15814. @item MIN
  15815. Minimal value of metadata value.
  15816. @item MAX
  15817. Maximal value of metadata value.
  15818. @item VAL
  15819. Current metadata key value.
  15820. @end table
  15821. The color is defined as 0xAABBGGRR.
  15822. @end table
  15823. Example using metadata from @ref{signalstats} filter:
  15824. @example
  15825. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15826. @end example
  15827. Example using metadata from @ref{ebur128} filter:
  15828. @example
  15829. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15830. @end example
  15831. @anchor{ebur128}
  15832. @section ebur128
  15833. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15834. level. By default, it logs a message at a frequency of 10Hz with the
  15835. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15836. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15837. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15838. sample format is double-precision floating point. The input stream will be converted to
  15839. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15840. after this filter to obtain the original parameters.
  15841. The filter also has a video output (see the @var{video} option) with a real
  15842. time graph to observe the loudness evolution. The graphic contains the logged
  15843. message mentioned above, so it is not printed anymore when this option is set,
  15844. unless the verbose logging is set. The main graphing area contains the
  15845. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15846. the momentary loudness (400 milliseconds), but can optionally be configured
  15847. to instead display short-term loudness (see @var{gauge}).
  15848. The green area marks a +/- 1LU target range around the target loudness
  15849. (-23LUFS by default, unless modified through @var{target}).
  15850. More information about the Loudness Recommendation EBU R128 on
  15851. @url{http://tech.ebu.ch/loudness}.
  15852. The filter accepts the following options:
  15853. @table @option
  15854. @item video
  15855. Activate the video output. The audio stream is passed unchanged whether this
  15856. option is set or no. The video stream will be the first output stream if
  15857. activated. Default is @code{0}.
  15858. @item size
  15859. Set the video size. This option is for video only. For the syntax of this
  15860. option, check the
  15861. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15862. Default and minimum resolution is @code{640x480}.
  15863. @item meter
  15864. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15865. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15866. other integer value between this range is allowed.
  15867. @item metadata
  15868. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15869. into 100ms output frames, each of them containing various loudness information
  15870. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15871. Default is @code{0}.
  15872. @item framelog
  15873. Force the frame logging level.
  15874. Available values are:
  15875. @table @samp
  15876. @item info
  15877. information logging level
  15878. @item verbose
  15879. verbose logging level
  15880. @end table
  15881. By default, the logging level is set to @var{info}. If the @option{video} or
  15882. the @option{metadata} options are set, it switches to @var{verbose}.
  15883. @item peak
  15884. Set peak mode(s).
  15885. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15886. values are:
  15887. @table @samp
  15888. @item none
  15889. Disable any peak mode (default).
  15890. @item sample
  15891. Enable sample-peak mode.
  15892. Simple peak mode looking for the higher sample value. It logs a message
  15893. for sample-peak (identified by @code{SPK}).
  15894. @item true
  15895. Enable true-peak mode.
  15896. If enabled, the peak lookup is done on an over-sampled version of the input
  15897. stream for better peak accuracy. It logs a message for true-peak.
  15898. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15899. This mode requires a build with @code{libswresample}.
  15900. @end table
  15901. @item dualmono
  15902. Treat mono input files as "dual mono". If a mono file is intended for playback
  15903. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15904. If set to @code{true}, this option will compensate for this effect.
  15905. Multi-channel input files are not affected by this option.
  15906. @item panlaw
  15907. Set a specific pan law to be used for the measurement of dual mono files.
  15908. This parameter is optional, and has a default value of -3.01dB.
  15909. @item target
  15910. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15911. This parameter is optional and has a default value of -23LUFS as specified
  15912. by EBU R128. However, material published online may prefer a level of -16LUFS
  15913. (e.g. for use with podcasts or video platforms).
  15914. @item gauge
  15915. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15916. @code{shortterm}. By default the momentary value will be used, but in certain
  15917. scenarios it may be more useful to observe the short term value instead (e.g.
  15918. live mixing).
  15919. @item scale
  15920. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15921. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15922. video output, not the summary or continuous log output.
  15923. @end table
  15924. @subsection Examples
  15925. @itemize
  15926. @item
  15927. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15928. @example
  15929. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15930. @end example
  15931. @item
  15932. Run an analysis with @command{ffmpeg}:
  15933. @example
  15934. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15935. @end example
  15936. @end itemize
  15937. @section interleave, ainterleave
  15938. Temporally interleave frames from several inputs.
  15939. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15940. These filters read frames from several inputs and send the oldest
  15941. queued frame to the output.
  15942. Input streams must have well defined, monotonically increasing frame
  15943. timestamp values.
  15944. In order to submit one frame to output, these filters need to enqueue
  15945. at least one frame for each input, so they cannot work in case one
  15946. input is not yet terminated and will not receive incoming frames.
  15947. For example consider the case when one input is a @code{select} filter
  15948. which always drops input frames. The @code{interleave} filter will keep
  15949. reading from that input, but it will never be able to send new frames
  15950. to output until the input sends an end-of-stream signal.
  15951. Also, depending on inputs synchronization, the filters will drop
  15952. frames in case one input receives more frames than the other ones, and
  15953. the queue is already filled.
  15954. These filters accept the following options:
  15955. @table @option
  15956. @item nb_inputs, n
  15957. Set the number of different inputs, it is 2 by default.
  15958. @end table
  15959. @subsection Examples
  15960. @itemize
  15961. @item
  15962. Interleave frames belonging to different streams using @command{ffmpeg}:
  15963. @example
  15964. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15965. @end example
  15966. @item
  15967. Add flickering blur effect:
  15968. @example
  15969. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15970. @end example
  15971. @end itemize
  15972. @section metadata, ametadata
  15973. Manipulate frame metadata.
  15974. This filter accepts the following options:
  15975. @table @option
  15976. @item mode
  15977. Set mode of operation of the filter.
  15978. Can be one of the following:
  15979. @table @samp
  15980. @item select
  15981. If both @code{value} and @code{key} is set, select frames
  15982. which have such metadata. If only @code{key} is set, select
  15983. every frame that has such key in metadata.
  15984. @item add
  15985. Add new metadata @code{key} and @code{value}. If key is already available
  15986. do nothing.
  15987. @item modify
  15988. Modify value of already present key.
  15989. @item delete
  15990. If @code{value} is set, delete only keys that have such value.
  15991. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15992. the frame.
  15993. @item print
  15994. Print key and its value if metadata was found. If @code{key} is not set print all
  15995. metadata values available in frame.
  15996. @end table
  15997. @item key
  15998. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15999. @item value
  16000. Set metadata value which will be used. This option is mandatory for
  16001. @code{modify} and @code{add} mode.
  16002. @item function
  16003. Which function to use when comparing metadata value and @code{value}.
  16004. Can be one of following:
  16005. @table @samp
  16006. @item same_str
  16007. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16008. @item starts_with
  16009. Values are interpreted as strings, returns true if metadata value starts with
  16010. the @code{value} option string.
  16011. @item less
  16012. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16013. @item equal
  16014. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16015. @item greater
  16016. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16017. @item expr
  16018. Values are interpreted as floats, returns true if expression from option @code{expr}
  16019. evaluates to true.
  16020. @end table
  16021. @item expr
  16022. Set expression which is used when @code{function} is set to @code{expr}.
  16023. The expression is evaluated through the eval API and can contain the following
  16024. constants:
  16025. @table @option
  16026. @item VALUE1
  16027. Float representation of @code{value} from metadata key.
  16028. @item VALUE2
  16029. Float representation of @code{value} as supplied by user in @code{value} option.
  16030. @end table
  16031. @item file
  16032. If specified in @code{print} mode, output is written to the named file. Instead of
  16033. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16034. for standard output. If @code{file} option is not set, output is written to the log
  16035. with AV_LOG_INFO loglevel.
  16036. @end table
  16037. @subsection Examples
  16038. @itemize
  16039. @item
  16040. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16041. between 0 and 1.
  16042. @example
  16043. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16044. @end example
  16045. @item
  16046. Print silencedetect output to file @file{metadata.txt}.
  16047. @example
  16048. silencedetect,ametadata=mode=print:file=metadata.txt
  16049. @end example
  16050. @item
  16051. Direct all metadata to a pipe with file descriptor 4.
  16052. @example
  16053. metadata=mode=print:file='pipe\:4'
  16054. @end example
  16055. @end itemize
  16056. @section perms, aperms
  16057. Set read/write permissions for the output frames.
  16058. These filters are mainly aimed at developers to test direct path in the
  16059. following filter in the filtergraph.
  16060. The filters accept the following options:
  16061. @table @option
  16062. @item mode
  16063. Select the permissions mode.
  16064. It accepts the following values:
  16065. @table @samp
  16066. @item none
  16067. Do nothing. This is the default.
  16068. @item ro
  16069. Set all the output frames read-only.
  16070. @item rw
  16071. Set all the output frames directly writable.
  16072. @item toggle
  16073. Make the frame read-only if writable, and writable if read-only.
  16074. @item random
  16075. Set each output frame read-only or writable randomly.
  16076. @end table
  16077. @item seed
  16078. Set the seed for the @var{random} mode, must be an integer included between
  16079. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16080. @code{-1}, the filter will try to use a good random seed on a best effort
  16081. basis.
  16082. @end table
  16083. Note: in case of auto-inserted filter between the permission filter and the
  16084. following one, the permission might not be received as expected in that
  16085. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16086. perms/aperms filter can avoid this problem.
  16087. @section realtime, arealtime
  16088. Slow down filtering to match real time approximately.
  16089. These filters will pause the filtering for a variable amount of time to
  16090. match the output rate with the input timestamps.
  16091. They are similar to the @option{re} option to @code{ffmpeg}.
  16092. They accept the following options:
  16093. @table @option
  16094. @item limit
  16095. Time limit for the pauses. Any pause longer than that will be considered
  16096. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16097. @item speed
  16098. Speed factor for processing. The value must be a float larger than zero.
  16099. Values larger than 1.0 will result in faster than realtime processing,
  16100. smaller will slow processing down. The @var{limit} is automatically adapted
  16101. accordingly. Default is 1.0.
  16102. A processing speed faster than what is possible without these filters cannot
  16103. be achieved.
  16104. @end table
  16105. @anchor{select}
  16106. @section select, aselect
  16107. Select frames to pass in output.
  16108. This filter accepts the following options:
  16109. @table @option
  16110. @item expr, e
  16111. Set expression, which is evaluated for each input frame.
  16112. If the expression is evaluated to zero, the frame is discarded.
  16113. If the evaluation result is negative or NaN, the frame is sent to the
  16114. first output; otherwise it is sent to the output with index
  16115. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16116. For example a value of @code{1.2} corresponds to the output with index
  16117. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16118. @item outputs, n
  16119. Set the number of outputs. The output to which to send the selected
  16120. frame is based on the result of the evaluation. Default value is 1.
  16121. @end table
  16122. The expression can contain the following constants:
  16123. @table @option
  16124. @item n
  16125. The (sequential) number of the filtered frame, starting from 0.
  16126. @item selected_n
  16127. The (sequential) number of the selected frame, starting from 0.
  16128. @item prev_selected_n
  16129. The sequential number of the last selected frame. It's NAN if undefined.
  16130. @item TB
  16131. The timebase of the input timestamps.
  16132. @item pts
  16133. The PTS (Presentation TimeStamp) of the filtered video frame,
  16134. expressed in @var{TB} units. It's NAN if undefined.
  16135. @item t
  16136. The PTS of the filtered video frame,
  16137. expressed in seconds. It's NAN if undefined.
  16138. @item prev_pts
  16139. The PTS of the previously filtered video frame. It's NAN if undefined.
  16140. @item prev_selected_pts
  16141. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16142. @item prev_selected_t
  16143. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16144. @item start_pts
  16145. The PTS of the first video frame in the video. It's NAN if undefined.
  16146. @item start_t
  16147. The time of the first video frame in the video. It's NAN if undefined.
  16148. @item pict_type @emph{(video only)}
  16149. The type of the filtered frame. It can assume one of the following
  16150. values:
  16151. @table @option
  16152. @item I
  16153. @item P
  16154. @item B
  16155. @item S
  16156. @item SI
  16157. @item SP
  16158. @item BI
  16159. @end table
  16160. @item interlace_type @emph{(video only)}
  16161. The frame interlace type. It can assume one of the following values:
  16162. @table @option
  16163. @item PROGRESSIVE
  16164. The frame is progressive (not interlaced).
  16165. @item TOPFIRST
  16166. The frame is top-field-first.
  16167. @item BOTTOMFIRST
  16168. The frame is bottom-field-first.
  16169. @end table
  16170. @item consumed_sample_n @emph{(audio only)}
  16171. the number of selected samples before the current frame
  16172. @item samples_n @emph{(audio only)}
  16173. the number of samples in the current frame
  16174. @item sample_rate @emph{(audio only)}
  16175. the input sample rate
  16176. @item key
  16177. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16178. @item pos
  16179. the position in the file of the filtered frame, -1 if the information
  16180. is not available (e.g. for synthetic video)
  16181. @item scene @emph{(video only)}
  16182. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16183. probability for the current frame to introduce a new scene, while a higher
  16184. value means the current frame is more likely to be one (see the example below)
  16185. @item concatdec_select
  16186. The concat demuxer can select only part of a concat input file by setting an
  16187. inpoint and an outpoint, but the output packets may not be entirely contained
  16188. in the selected interval. By using this variable, it is possible to skip frames
  16189. generated by the concat demuxer which are not exactly contained in the selected
  16190. interval.
  16191. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16192. and the @var{lavf.concat.duration} packet metadata values which are also
  16193. present in the decoded frames.
  16194. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16195. start_time and either the duration metadata is missing or the frame pts is less
  16196. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16197. missing.
  16198. That basically means that an input frame is selected if its pts is within the
  16199. interval set by the concat demuxer.
  16200. @end table
  16201. The default value of the select expression is "1".
  16202. @subsection Examples
  16203. @itemize
  16204. @item
  16205. Select all frames in input:
  16206. @example
  16207. select
  16208. @end example
  16209. The example above is the same as:
  16210. @example
  16211. select=1
  16212. @end example
  16213. @item
  16214. Skip all frames:
  16215. @example
  16216. select=0
  16217. @end example
  16218. @item
  16219. Select only I-frames:
  16220. @example
  16221. select='eq(pict_type\,I)'
  16222. @end example
  16223. @item
  16224. Select one frame every 100:
  16225. @example
  16226. select='not(mod(n\,100))'
  16227. @end example
  16228. @item
  16229. Select only frames contained in the 10-20 time interval:
  16230. @example
  16231. select=between(t\,10\,20)
  16232. @end example
  16233. @item
  16234. Select only I-frames contained in the 10-20 time interval:
  16235. @example
  16236. select=between(t\,10\,20)*eq(pict_type\,I)
  16237. @end example
  16238. @item
  16239. Select frames with a minimum distance of 10 seconds:
  16240. @example
  16241. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16242. @end example
  16243. @item
  16244. Use aselect to select only audio frames with samples number > 100:
  16245. @example
  16246. aselect='gt(samples_n\,100)'
  16247. @end example
  16248. @item
  16249. Create a mosaic of the first scenes:
  16250. @example
  16251. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16252. @end example
  16253. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16254. choice.
  16255. @item
  16256. Send even and odd frames to separate outputs, and compose them:
  16257. @example
  16258. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16259. @end example
  16260. @item
  16261. Select useful frames from an ffconcat file which is using inpoints and
  16262. outpoints but where the source files are not intra frame only.
  16263. @example
  16264. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16265. @end example
  16266. @end itemize
  16267. @section sendcmd, asendcmd
  16268. Send commands to filters in the filtergraph.
  16269. These filters read commands to be sent to other filters in the
  16270. filtergraph.
  16271. @code{sendcmd} must be inserted between two video filters,
  16272. @code{asendcmd} must be inserted between two audio filters, but apart
  16273. from that they act the same way.
  16274. The specification of commands can be provided in the filter arguments
  16275. with the @var{commands} option, or in a file specified by the
  16276. @var{filename} option.
  16277. These filters accept the following options:
  16278. @table @option
  16279. @item commands, c
  16280. Set the commands to be read and sent to the other filters.
  16281. @item filename, f
  16282. Set the filename of the commands to be read and sent to the other
  16283. filters.
  16284. @end table
  16285. @subsection Commands syntax
  16286. A commands description consists of a sequence of interval
  16287. specifications, comprising a list of commands to be executed when a
  16288. particular event related to that interval occurs. The occurring event
  16289. is typically the current frame time entering or leaving a given time
  16290. interval.
  16291. An interval is specified by the following syntax:
  16292. @example
  16293. @var{START}[-@var{END}] @var{COMMANDS};
  16294. @end example
  16295. The time interval is specified by the @var{START} and @var{END} times.
  16296. @var{END} is optional and defaults to the maximum time.
  16297. The current frame time is considered within the specified interval if
  16298. it is included in the interval [@var{START}, @var{END}), that is when
  16299. the time is greater or equal to @var{START} and is lesser than
  16300. @var{END}.
  16301. @var{COMMANDS} consists of a sequence of one or more command
  16302. specifications, separated by ",", relating to that interval. The
  16303. syntax of a command specification is given by:
  16304. @example
  16305. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16306. @end example
  16307. @var{FLAGS} is optional and specifies the type of events relating to
  16308. the time interval which enable sending the specified command, and must
  16309. be a non-null sequence of identifier flags separated by "+" or "|" and
  16310. enclosed between "[" and "]".
  16311. The following flags are recognized:
  16312. @table @option
  16313. @item enter
  16314. The command is sent when the current frame timestamp enters the
  16315. specified interval. In other words, the command is sent when the
  16316. previous frame timestamp was not in the given interval, and the
  16317. current is.
  16318. @item leave
  16319. The command is sent when the current frame timestamp leaves the
  16320. specified interval. In other words, the command is sent when the
  16321. previous frame timestamp was in the given interval, and the
  16322. current is not.
  16323. @end table
  16324. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16325. assumed.
  16326. @var{TARGET} specifies the target of the command, usually the name of
  16327. the filter class or a specific filter instance name.
  16328. @var{COMMAND} specifies the name of the command for the target filter.
  16329. @var{ARG} is optional and specifies the optional list of argument for
  16330. the given @var{COMMAND}.
  16331. Between one interval specification and another, whitespaces, or
  16332. sequences of characters starting with @code{#} until the end of line,
  16333. are ignored and can be used to annotate comments.
  16334. A simplified BNF description of the commands specification syntax
  16335. follows:
  16336. @example
  16337. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16338. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16339. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16340. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16341. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16342. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16343. @end example
  16344. @subsection Examples
  16345. @itemize
  16346. @item
  16347. Specify audio tempo change at second 4:
  16348. @example
  16349. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16350. @end example
  16351. @item
  16352. Target a specific filter instance:
  16353. @example
  16354. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16355. @end example
  16356. @item
  16357. Specify a list of drawtext and hue commands in a file.
  16358. @example
  16359. # show text in the interval 5-10
  16360. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16361. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16362. # desaturate the image in the interval 15-20
  16363. 15.0-20.0 [enter] hue s 0,
  16364. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16365. [leave] hue s 1,
  16366. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16367. # apply an exponential saturation fade-out effect, starting from time 25
  16368. 25 [enter] hue s exp(25-t)
  16369. @end example
  16370. A filtergraph allowing to read and process the above command list
  16371. stored in a file @file{test.cmd}, can be specified with:
  16372. @example
  16373. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16374. @end example
  16375. @end itemize
  16376. @anchor{setpts}
  16377. @section setpts, asetpts
  16378. Change the PTS (presentation timestamp) of the input frames.
  16379. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16380. This filter accepts the following options:
  16381. @table @option
  16382. @item expr
  16383. The expression which is evaluated for each frame to construct its timestamp.
  16384. @end table
  16385. The expression is evaluated through the eval API and can contain the following
  16386. constants:
  16387. @table @option
  16388. @item FRAME_RATE, FR
  16389. frame rate, only defined for constant frame-rate video
  16390. @item PTS
  16391. The presentation timestamp in input
  16392. @item N
  16393. The count of the input frame for video or the number of consumed samples,
  16394. not including the current frame for audio, starting from 0.
  16395. @item NB_CONSUMED_SAMPLES
  16396. The number of consumed samples, not including the current frame (only
  16397. audio)
  16398. @item NB_SAMPLES, S
  16399. The number of samples in the current frame (only audio)
  16400. @item SAMPLE_RATE, SR
  16401. The audio sample rate.
  16402. @item STARTPTS
  16403. The PTS of the first frame.
  16404. @item STARTT
  16405. the time in seconds of the first frame
  16406. @item INTERLACED
  16407. State whether the current frame is interlaced.
  16408. @item T
  16409. the time in seconds of the current frame
  16410. @item POS
  16411. original position in the file of the frame, or undefined if undefined
  16412. for the current frame
  16413. @item PREV_INPTS
  16414. The previous input PTS.
  16415. @item PREV_INT
  16416. previous input time in seconds
  16417. @item PREV_OUTPTS
  16418. The previous output PTS.
  16419. @item PREV_OUTT
  16420. previous output time in seconds
  16421. @item RTCTIME
  16422. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16423. instead.
  16424. @item RTCSTART
  16425. The wallclock (RTC) time at the start of the movie in microseconds.
  16426. @item TB
  16427. The timebase of the input timestamps.
  16428. @end table
  16429. @subsection Examples
  16430. @itemize
  16431. @item
  16432. Start counting PTS from zero
  16433. @example
  16434. setpts=PTS-STARTPTS
  16435. @end example
  16436. @item
  16437. Apply fast motion effect:
  16438. @example
  16439. setpts=0.5*PTS
  16440. @end example
  16441. @item
  16442. Apply slow motion effect:
  16443. @example
  16444. setpts=2.0*PTS
  16445. @end example
  16446. @item
  16447. Set fixed rate of 25 frames per second:
  16448. @example
  16449. setpts=N/(25*TB)
  16450. @end example
  16451. @item
  16452. Set fixed rate 25 fps with some jitter:
  16453. @example
  16454. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16455. @end example
  16456. @item
  16457. Apply an offset of 10 seconds to the input PTS:
  16458. @example
  16459. setpts=PTS+10/TB
  16460. @end example
  16461. @item
  16462. Generate timestamps from a "live source" and rebase onto the current timebase:
  16463. @example
  16464. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16465. @end example
  16466. @item
  16467. Generate timestamps by counting samples:
  16468. @example
  16469. asetpts=N/SR/TB
  16470. @end example
  16471. @end itemize
  16472. @section setrange
  16473. Force color range for the output video frame.
  16474. The @code{setrange} filter marks the color range property for the
  16475. output frames. It does not change the input frame, but only sets the
  16476. corresponding property, which affects how the frame is treated by
  16477. following filters.
  16478. The filter accepts the following options:
  16479. @table @option
  16480. @item range
  16481. Available values are:
  16482. @table @samp
  16483. @item auto
  16484. Keep the same color range property.
  16485. @item unspecified, unknown
  16486. Set the color range as unspecified.
  16487. @item limited, tv, mpeg
  16488. Set the color range as limited.
  16489. @item full, pc, jpeg
  16490. Set the color range as full.
  16491. @end table
  16492. @end table
  16493. @section settb, asettb
  16494. Set the timebase to use for the output frames timestamps.
  16495. It is mainly useful for testing timebase configuration.
  16496. It accepts the following parameters:
  16497. @table @option
  16498. @item expr, tb
  16499. The expression which is evaluated into the output timebase.
  16500. @end table
  16501. The value for @option{tb} is an arithmetic expression representing a
  16502. rational. The expression can contain the constants "AVTB" (the default
  16503. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16504. audio only). Default value is "intb".
  16505. @subsection Examples
  16506. @itemize
  16507. @item
  16508. Set the timebase to 1/25:
  16509. @example
  16510. settb=expr=1/25
  16511. @end example
  16512. @item
  16513. Set the timebase to 1/10:
  16514. @example
  16515. settb=expr=0.1
  16516. @end example
  16517. @item
  16518. Set the timebase to 1001/1000:
  16519. @example
  16520. settb=1+0.001
  16521. @end example
  16522. @item
  16523. Set the timebase to 2*intb:
  16524. @example
  16525. settb=2*intb
  16526. @end example
  16527. @item
  16528. Set the default timebase value:
  16529. @example
  16530. settb=AVTB
  16531. @end example
  16532. @end itemize
  16533. @section showcqt
  16534. Convert input audio to a video output representing frequency spectrum
  16535. logarithmically using Brown-Puckette constant Q transform algorithm with
  16536. direct frequency domain coefficient calculation (but the transform itself
  16537. is not really constant Q, instead the Q factor is actually variable/clamped),
  16538. with musical tone scale, from E0 to D#10.
  16539. The filter accepts the following options:
  16540. @table @option
  16541. @item size, s
  16542. Specify the video size for the output. It must be even. For the syntax of this option,
  16543. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16544. Default value is @code{1920x1080}.
  16545. @item fps, rate, r
  16546. Set the output frame rate. Default value is @code{25}.
  16547. @item bar_h
  16548. Set the bargraph height. It must be even. Default value is @code{-1} which
  16549. computes the bargraph height automatically.
  16550. @item axis_h
  16551. Set the axis height. It must be even. Default value is @code{-1} which computes
  16552. the axis height automatically.
  16553. @item sono_h
  16554. Set the sonogram height. It must be even. Default value is @code{-1} which
  16555. computes the sonogram height automatically.
  16556. @item fullhd
  16557. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16558. instead. Default value is @code{1}.
  16559. @item sono_v, volume
  16560. Specify the sonogram volume expression. It can contain variables:
  16561. @table @option
  16562. @item bar_v
  16563. the @var{bar_v} evaluated expression
  16564. @item frequency, freq, f
  16565. the frequency where it is evaluated
  16566. @item timeclamp, tc
  16567. the value of @var{timeclamp} option
  16568. @end table
  16569. and functions:
  16570. @table @option
  16571. @item a_weighting(f)
  16572. A-weighting of equal loudness
  16573. @item b_weighting(f)
  16574. B-weighting of equal loudness
  16575. @item c_weighting(f)
  16576. C-weighting of equal loudness.
  16577. @end table
  16578. Default value is @code{16}.
  16579. @item bar_v, volume2
  16580. Specify the bargraph volume expression. It can contain variables:
  16581. @table @option
  16582. @item sono_v
  16583. the @var{sono_v} evaluated expression
  16584. @item frequency, freq, f
  16585. the frequency where it is evaluated
  16586. @item timeclamp, tc
  16587. the value of @var{timeclamp} option
  16588. @end table
  16589. and functions:
  16590. @table @option
  16591. @item a_weighting(f)
  16592. A-weighting of equal loudness
  16593. @item b_weighting(f)
  16594. B-weighting of equal loudness
  16595. @item c_weighting(f)
  16596. C-weighting of equal loudness.
  16597. @end table
  16598. Default value is @code{sono_v}.
  16599. @item sono_g, gamma
  16600. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16601. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16602. Acceptable range is @code{[1, 7]}.
  16603. @item bar_g, gamma2
  16604. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16605. @code{[1, 7]}.
  16606. @item bar_t
  16607. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16608. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16609. @item timeclamp, tc
  16610. Specify the transform timeclamp. At low frequency, there is trade-off between
  16611. accuracy in time domain and frequency domain. If timeclamp is lower,
  16612. event in time domain is represented more accurately (such as fast bass drum),
  16613. otherwise event in frequency domain is represented more accurately
  16614. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16615. @item attack
  16616. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16617. limits future samples by applying asymmetric windowing in time domain, useful
  16618. when low latency is required. Accepted range is @code{[0, 1]}.
  16619. @item basefreq
  16620. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16621. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16622. @item endfreq
  16623. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16624. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16625. @item coeffclamp
  16626. This option is deprecated and ignored.
  16627. @item tlength
  16628. Specify the transform length in time domain. Use this option to control accuracy
  16629. trade-off between time domain and frequency domain at every frequency sample.
  16630. It can contain variables:
  16631. @table @option
  16632. @item frequency, freq, f
  16633. the frequency where it is evaluated
  16634. @item timeclamp, tc
  16635. the value of @var{timeclamp} option.
  16636. @end table
  16637. Default value is @code{384*tc/(384+tc*f)}.
  16638. @item count
  16639. Specify the transform count for every video frame. Default value is @code{6}.
  16640. Acceptable range is @code{[1, 30]}.
  16641. @item fcount
  16642. Specify the transform count for every single pixel. Default value is @code{0},
  16643. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16644. @item fontfile
  16645. Specify font file for use with freetype to draw the axis. If not specified,
  16646. use embedded font. Note that drawing with font file or embedded font is not
  16647. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16648. option instead.
  16649. @item font
  16650. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16651. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16652. @item fontcolor
  16653. Specify font color expression. This is arithmetic expression that should return
  16654. integer value 0xRRGGBB. It can contain variables:
  16655. @table @option
  16656. @item frequency, freq, f
  16657. the frequency where it is evaluated
  16658. @item timeclamp, tc
  16659. the value of @var{timeclamp} option
  16660. @end table
  16661. and functions:
  16662. @table @option
  16663. @item midi(f)
  16664. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16665. @item r(x), g(x), b(x)
  16666. red, green, and blue value of intensity x.
  16667. @end table
  16668. Default value is @code{st(0, (midi(f)-59.5)/12);
  16669. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16670. r(1-ld(1)) + b(ld(1))}.
  16671. @item axisfile
  16672. Specify image file to draw the axis. This option override @var{fontfile} and
  16673. @var{fontcolor} option.
  16674. @item axis, text
  16675. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16676. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16677. Default value is @code{1}.
  16678. @item csp
  16679. Set colorspace. The accepted values are:
  16680. @table @samp
  16681. @item unspecified
  16682. Unspecified (default)
  16683. @item bt709
  16684. BT.709
  16685. @item fcc
  16686. FCC
  16687. @item bt470bg
  16688. BT.470BG or BT.601-6 625
  16689. @item smpte170m
  16690. SMPTE-170M or BT.601-6 525
  16691. @item smpte240m
  16692. SMPTE-240M
  16693. @item bt2020ncl
  16694. BT.2020 with non-constant luminance
  16695. @end table
  16696. @item cscheme
  16697. Set spectrogram color scheme. This is list of floating point values with format
  16698. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16699. The default is @code{1|0.5|0|0|0.5|1}.
  16700. @end table
  16701. @subsection Examples
  16702. @itemize
  16703. @item
  16704. Playing audio while showing the spectrum:
  16705. @example
  16706. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16707. @end example
  16708. @item
  16709. Same as above, but with frame rate 30 fps:
  16710. @example
  16711. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16712. @end example
  16713. @item
  16714. Playing at 1280x720:
  16715. @example
  16716. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16717. @end example
  16718. @item
  16719. Disable sonogram display:
  16720. @example
  16721. sono_h=0
  16722. @end example
  16723. @item
  16724. A1 and its harmonics: A1, A2, (near)E3, A3:
  16725. @example
  16726. 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),
  16727. asplit[a][out1]; [a] showcqt [out0]'
  16728. @end example
  16729. @item
  16730. Same as above, but with more accuracy in frequency domain:
  16731. @example
  16732. 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),
  16733. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16734. @end example
  16735. @item
  16736. Custom volume:
  16737. @example
  16738. bar_v=10:sono_v=bar_v*a_weighting(f)
  16739. @end example
  16740. @item
  16741. Custom gamma, now spectrum is linear to the amplitude.
  16742. @example
  16743. bar_g=2:sono_g=2
  16744. @end example
  16745. @item
  16746. Custom tlength equation:
  16747. @example
  16748. 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)))'
  16749. @end example
  16750. @item
  16751. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16752. @example
  16753. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16754. @end example
  16755. @item
  16756. Custom font using fontconfig:
  16757. @example
  16758. font='Courier New,Monospace,mono|bold'
  16759. @end example
  16760. @item
  16761. Custom frequency range with custom axis using image file:
  16762. @example
  16763. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16764. @end example
  16765. @end itemize
  16766. @section showfreqs
  16767. Convert input audio to video output representing the audio power spectrum.
  16768. Audio amplitude is on Y-axis while frequency is on X-axis.
  16769. The filter accepts the following options:
  16770. @table @option
  16771. @item size, s
  16772. Specify size of video. For the syntax of this option, check the
  16773. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16774. Default is @code{1024x512}.
  16775. @item mode
  16776. Set display mode.
  16777. This set how each frequency bin will be represented.
  16778. It accepts the following values:
  16779. @table @samp
  16780. @item line
  16781. @item bar
  16782. @item dot
  16783. @end table
  16784. Default is @code{bar}.
  16785. @item ascale
  16786. Set amplitude scale.
  16787. It accepts the following values:
  16788. @table @samp
  16789. @item lin
  16790. Linear scale.
  16791. @item sqrt
  16792. Square root scale.
  16793. @item cbrt
  16794. Cubic root scale.
  16795. @item log
  16796. Logarithmic scale.
  16797. @end table
  16798. Default is @code{log}.
  16799. @item fscale
  16800. Set frequency scale.
  16801. It accepts the following values:
  16802. @table @samp
  16803. @item lin
  16804. Linear scale.
  16805. @item log
  16806. Logarithmic scale.
  16807. @item rlog
  16808. Reverse logarithmic scale.
  16809. @end table
  16810. Default is @code{lin}.
  16811. @item win_size
  16812. Set window size.
  16813. It accepts the following values:
  16814. @table @samp
  16815. @item w16
  16816. @item w32
  16817. @item w64
  16818. @item w128
  16819. @item w256
  16820. @item w512
  16821. @item w1024
  16822. @item w2048
  16823. @item w4096
  16824. @item w8192
  16825. @item w16384
  16826. @item w32768
  16827. @item w65536
  16828. @end table
  16829. Default is @code{w2048}
  16830. @item win_func
  16831. Set windowing function.
  16832. It accepts the following values:
  16833. @table @samp
  16834. @item rect
  16835. @item bartlett
  16836. @item hanning
  16837. @item hamming
  16838. @item blackman
  16839. @item welch
  16840. @item flattop
  16841. @item bharris
  16842. @item bnuttall
  16843. @item bhann
  16844. @item sine
  16845. @item nuttall
  16846. @item lanczos
  16847. @item gauss
  16848. @item tukey
  16849. @item dolph
  16850. @item cauchy
  16851. @item parzen
  16852. @item poisson
  16853. @item bohman
  16854. @end table
  16855. Default is @code{hanning}.
  16856. @item overlap
  16857. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16858. which means optimal overlap for selected window function will be picked.
  16859. @item averaging
  16860. Set time averaging. Setting this to 0 will display current maximal peaks.
  16861. Default is @code{1}, which means time averaging is disabled.
  16862. @item colors
  16863. Specify list of colors separated by space or by '|' which will be used to
  16864. draw channel frequencies. Unrecognized or missing colors will be replaced
  16865. by white color.
  16866. @item cmode
  16867. Set channel display mode.
  16868. It accepts the following values:
  16869. @table @samp
  16870. @item combined
  16871. @item separate
  16872. @end table
  16873. Default is @code{combined}.
  16874. @item minamp
  16875. Set minimum amplitude used in @code{log} amplitude scaler.
  16876. @end table
  16877. @anchor{showspectrum}
  16878. @section showspectrum
  16879. Convert input audio to a video output, representing the audio frequency
  16880. spectrum.
  16881. The filter accepts the following options:
  16882. @table @option
  16883. @item size, s
  16884. Specify the video size for the output. For the syntax of this option, check the
  16885. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16886. Default value is @code{640x512}.
  16887. @item slide
  16888. Specify how the spectrum should slide along the window.
  16889. It accepts the following values:
  16890. @table @samp
  16891. @item replace
  16892. the samples start again on the left when they reach the right
  16893. @item scroll
  16894. the samples scroll from right to left
  16895. @item fullframe
  16896. frames are only produced when the samples reach the right
  16897. @item rscroll
  16898. the samples scroll from left to right
  16899. @end table
  16900. Default value is @code{replace}.
  16901. @item mode
  16902. Specify display mode.
  16903. It accepts the following values:
  16904. @table @samp
  16905. @item combined
  16906. all channels are displayed in the same row
  16907. @item separate
  16908. all channels are displayed in separate rows
  16909. @end table
  16910. Default value is @samp{combined}.
  16911. @item color
  16912. Specify display color mode.
  16913. It accepts the following values:
  16914. @table @samp
  16915. @item channel
  16916. each channel is displayed in a separate color
  16917. @item intensity
  16918. each channel is displayed using the same color scheme
  16919. @item rainbow
  16920. each channel is displayed using the rainbow color scheme
  16921. @item moreland
  16922. each channel is displayed using the moreland color scheme
  16923. @item nebulae
  16924. each channel is displayed using the nebulae color scheme
  16925. @item fire
  16926. each channel is displayed using the fire color scheme
  16927. @item fiery
  16928. each channel is displayed using the fiery color scheme
  16929. @item fruit
  16930. each channel is displayed using the fruit color scheme
  16931. @item cool
  16932. each channel is displayed using the cool color scheme
  16933. @item magma
  16934. each channel is displayed using the magma color scheme
  16935. @item green
  16936. each channel is displayed using the green color scheme
  16937. @item viridis
  16938. each channel is displayed using the viridis color scheme
  16939. @item plasma
  16940. each channel is displayed using the plasma color scheme
  16941. @item cividis
  16942. each channel is displayed using the cividis color scheme
  16943. @item terrain
  16944. each channel is displayed using the terrain color scheme
  16945. @end table
  16946. Default value is @samp{channel}.
  16947. @item scale
  16948. Specify scale used for calculating intensity color values.
  16949. It accepts the following values:
  16950. @table @samp
  16951. @item lin
  16952. linear
  16953. @item sqrt
  16954. square root, default
  16955. @item cbrt
  16956. cubic root
  16957. @item log
  16958. logarithmic
  16959. @item 4thrt
  16960. 4th root
  16961. @item 5thrt
  16962. 5th root
  16963. @end table
  16964. Default value is @samp{sqrt}.
  16965. @item fscale
  16966. Specify frequency scale.
  16967. It accepts the following values:
  16968. @table @samp
  16969. @item lin
  16970. linear
  16971. @item log
  16972. logarithmic
  16973. @end table
  16974. Default value is @samp{lin}.
  16975. @item saturation
  16976. Set saturation modifier for displayed colors. Negative values provide
  16977. alternative color scheme. @code{0} is no saturation at all.
  16978. Saturation must be in [-10.0, 10.0] range.
  16979. Default value is @code{1}.
  16980. @item win_func
  16981. Set window function.
  16982. It accepts the following values:
  16983. @table @samp
  16984. @item rect
  16985. @item bartlett
  16986. @item hann
  16987. @item hanning
  16988. @item hamming
  16989. @item blackman
  16990. @item welch
  16991. @item flattop
  16992. @item bharris
  16993. @item bnuttall
  16994. @item bhann
  16995. @item sine
  16996. @item nuttall
  16997. @item lanczos
  16998. @item gauss
  16999. @item tukey
  17000. @item dolph
  17001. @item cauchy
  17002. @item parzen
  17003. @item poisson
  17004. @item bohman
  17005. @end table
  17006. Default value is @code{hann}.
  17007. @item orientation
  17008. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17009. @code{horizontal}. Default is @code{vertical}.
  17010. @item overlap
  17011. Set ratio of overlap window. Default value is @code{0}.
  17012. When value is @code{1} overlap is set to recommended size for specific
  17013. window function currently used.
  17014. @item gain
  17015. Set scale gain for calculating intensity color values.
  17016. Default value is @code{1}.
  17017. @item data
  17018. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17019. @item rotation
  17020. Set color rotation, must be in [-1.0, 1.0] range.
  17021. Default value is @code{0}.
  17022. @item start
  17023. Set start frequency from which to display spectrogram. Default is @code{0}.
  17024. @item stop
  17025. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17026. @item fps
  17027. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17028. @item legend
  17029. Draw time and frequency axes and legends. Default is disabled.
  17030. @end table
  17031. The usage is very similar to the showwaves filter; see the examples in that
  17032. section.
  17033. @subsection Examples
  17034. @itemize
  17035. @item
  17036. Large window with logarithmic color scaling:
  17037. @example
  17038. showspectrum=s=1280x480:scale=log
  17039. @end example
  17040. @item
  17041. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17042. @example
  17043. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17044. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17045. @end example
  17046. @end itemize
  17047. @section showspectrumpic
  17048. Convert input audio to a single video frame, representing the audio frequency
  17049. spectrum.
  17050. The filter accepts the following options:
  17051. @table @option
  17052. @item size, s
  17053. Specify the video size for the output. For the syntax of this option, check the
  17054. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17055. Default value is @code{4096x2048}.
  17056. @item mode
  17057. Specify display mode.
  17058. It accepts the following values:
  17059. @table @samp
  17060. @item combined
  17061. all channels are displayed in the same row
  17062. @item separate
  17063. all channels are displayed in separate rows
  17064. @end table
  17065. Default value is @samp{combined}.
  17066. @item color
  17067. Specify display color mode.
  17068. It accepts the following values:
  17069. @table @samp
  17070. @item channel
  17071. each channel is displayed in a separate color
  17072. @item intensity
  17073. each channel is displayed using the same color scheme
  17074. @item rainbow
  17075. each channel is displayed using the rainbow color scheme
  17076. @item moreland
  17077. each channel is displayed using the moreland color scheme
  17078. @item nebulae
  17079. each channel is displayed using the nebulae color scheme
  17080. @item fire
  17081. each channel is displayed using the fire color scheme
  17082. @item fiery
  17083. each channel is displayed using the fiery color scheme
  17084. @item fruit
  17085. each channel is displayed using the fruit color scheme
  17086. @item cool
  17087. each channel is displayed using the cool color scheme
  17088. @item magma
  17089. each channel is displayed using the magma color scheme
  17090. @item green
  17091. each channel is displayed using the green color scheme
  17092. @item viridis
  17093. each channel is displayed using the viridis color scheme
  17094. @item plasma
  17095. each channel is displayed using the plasma color scheme
  17096. @item cividis
  17097. each channel is displayed using the cividis color scheme
  17098. @item terrain
  17099. each channel is displayed using the terrain color scheme
  17100. @end table
  17101. Default value is @samp{intensity}.
  17102. @item scale
  17103. Specify scale used for calculating intensity color values.
  17104. It accepts the following values:
  17105. @table @samp
  17106. @item lin
  17107. linear
  17108. @item sqrt
  17109. square root, default
  17110. @item cbrt
  17111. cubic root
  17112. @item log
  17113. logarithmic
  17114. @item 4thrt
  17115. 4th root
  17116. @item 5thrt
  17117. 5th root
  17118. @end table
  17119. Default value is @samp{log}.
  17120. @item fscale
  17121. Specify frequency scale.
  17122. It accepts the following values:
  17123. @table @samp
  17124. @item lin
  17125. linear
  17126. @item log
  17127. logarithmic
  17128. @end table
  17129. Default value is @samp{lin}.
  17130. @item saturation
  17131. Set saturation modifier for displayed colors. Negative values provide
  17132. alternative color scheme. @code{0} is no saturation at all.
  17133. Saturation must be in [-10.0, 10.0] range.
  17134. Default value is @code{1}.
  17135. @item win_func
  17136. Set window function.
  17137. It accepts the following values:
  17138. @table @samp
  17139. @item rect
  17140. @item bartlett
  17141. @item hann
  17142. @item hanning
  17143. @item hamming
  17144. @item blackman
  17145. @item welch
  17146. @item flattop
  17147. @item bharris
  17148. @item bnuttall
  17149. @item bhann
  17150. @item sine
  17151. @item nuttall
  17152. @item lanczos
  17153. @item gauss
  17154. @item tukey
  17155. @item dolph
  17156. @item cauchy
  17157. @item parzen
  17158. @item poisson
  17159. @item bohman
  17160. @end table
  17161. Default value is @code{hann}.
  17162. @item orientation
  17163. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17164. @code{horizontal}. Default is @code{vertical}.
  17165. @item gain
  17166. Set scale gain for calculating intensity color values.
  17167. Default value is @code{1}.
  17168. @item legend
  17169. Draw time and frequency axes and legends. Default is enabled.
  17170. @item rotation
  17171. Set color rotation, must be in [-1.0, 1.0] range.
  17172. Default value is @code{0}.
  17173. @item start
  17174. Set start frequency from which to display spectrogram. Default is @code{0}.
  17175. @item stop
  17176. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17177. @end table
  17178. @subsection Examples
  17179. @itemize
  17180. @item
  17181. Extract an audio spectrogram of a whole audio track
  17182. in a 1024x1024 picture using @command{ffmpeg}:
  17183. @example
  17184. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17185. @end example
  17186. @end itemize
  17187. @section showvolume
  17188. Convert input audio volume to a video output.
  17189. The filter accepts the following options:
  17190. @table @option
  17191. @item rate, r
  17192. Set video rate.
  17193. @item b
  17194. Set border width, allowed range is [0, 5]. Default is 1.
  17195. @item w
  17196. Set channel width, allowed range is [80, 8192]. Default is 400.
  17197. @item h
  17198. Set channel height, allowed range is [1, 900]. Default is 20.
  17199. @item f
  17200. Set fade, allowed range is [0, 1]. Default is 0.95.
  17201. @item c
  17202. Set volume color expression.
  17203. The expression can use the following variables:
  17204. @table @option
  17205. @item VOLUME
  17206. Current max volume of channel in dB.
  17207. @item PEAK
  17208. Current peak.
  17209. @item CHANNEL
  17210. Current channel number, starting from 0.
  17211. @end table
  17212. @item t
  17213. If set, displays channel names. Default is enabled.
  17214. @item v
  17215. If set, displays volume values. Default is enabled.
  17216. @item o
  17217. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17218. default is @code{h}.
  17219. @item s
  17220. Set step size, allowed range is [0, 5]. Default is 0, which means
  17221. step is disabled.
  17222. @item p
  17223. Set background opacity, allowed range is [0, 1]. Default is 0.
  17224. @item m
  17225. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17226. default is @code{p}.
  17227. @item ds
  17228. Set display scale, can be linear: @code{lin} or log: @code{log},
  17229. default is @code{lin}.
  17230. @item dm
  17231. In second.
  17232. If set to > 0., display a line for the max level
  17233. in the previous seconds.
  17234. default is disabled: @code{0.}
  17235. @item dmc
  17236. The color of the max line. Use when @code{dm} option is set to > 0.
  17237. default is: @code{orange}
  17238. @end table
  17239. @section showwaves
  17240. Convert input audio to a video output, representing the samples waves.
  17241. The filter accepts the following options:
  17242. @table @option
  17243. @item size, s
  17244. Specify the video size for the output. For the syntax of this option, check the
  17245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17246. Default value is @code{600x240}.
  17247. @item mode
  17248. Set display mode.
  17249. Available values are:
  17250. @table @samp
  17251. @item point
  17252. Draw a point for each sample.
  17253. @item line
  17254. Draw a vertical line for each sample.
  17255. @item p2p
  17256. Draw a point for each sample and a line between them.
  17257. @item cline
  17258. Draw a centered vertical line for each sample.
  17259. @end table
  17260. Default value is @code{point}.
  17261. @item n
  17262. Set the number of samples which are printed on the same column. A
  17263. larger value will decrease the frame rate. Must be a positive
  17264. integer. This option can be set only if the value for @var{rate}
  17265. is not explicitly specified.
  17266. @item rate, r
  17267. Set the (approximate) output frame rate. This is done by setting the
  17268. option @var{n}. Default value is "25".
  17269. @item split_channels
  17270. Set if channels should be drawn separately or overlap. Default value is 0.
  17271. @item colors
  17272. Set colors separated by '|' which are going to be used for drawing of each channel.
  17273. @item scale
  17274. Set amplitude scale.
  17275. Available values are:
  17276. @table @samp
  17277. @item lin
  17278. Linear.
  17279. @item log
  17280. Logarithmic.
  17281. @item sqrt
  17282. Square root.
  17283. @item cbrt
  17284. Cubic root.
  17285. @end table
  17286. Default is linear.
  17287. @item draw
  17288. Set the draw mode. This is mostly useful to set for high @var{n}.
  17289. Available values are:
  17290. @table @samp
  17291. @item scale
  17292. Scale pixel values for each drawn sample.
  17293. @item full
  17294. Draw every sample directly.
  17295. @end table
  17296. Default value is @code{scale}.
  17297. @end table
  17298. @subsection Examples
  17299. @itemize
  17300. @item
  17301. Output the input file audio and the corresponding video representation
  17302. at the same time:
  17303. @example
  17304. amovie=a.mp3,asplit[out0],showwaves[out1]
  17305. @end example
  17306. @item
  17307. Create a synthetic signal and show it with showwaves, forcing a
  17308. frame rate of 30 frames per second:
  17309. @example
  17310. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17311. @end example
  17312. @end itemize
  17313. @section showwavespic
  17314. Convert input audio to a single video frame, representing the samples waves.
  17315. The filter accepts the following options:
  17316. @table @option
  17317. @item size, s
  17318. Specify the video size for the output. For the syntax of this option, check the
  17319. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17320. Default value is @code{600x240}.
  17321. @item split_channels
  17322. Set if channels should be drawn separately or overlap. Default value is 0.
  17323. @item colors
  17324. Set colors separated by '|' which are going to be used for drawing of each channel.
  17325. @item scale
  17326. Set amplitude scale.
  17327. Available values are:
  17328. @table @samp
  17329. @item lin
  17330. Linear.
  17331. @item log
  17332. Logarithmic.
  17333. @item sqrt
  17334. Square root.
  17335. @item cbrt
  17336. Cubic root.
  17337. @end table
  17338. Default is linear.
  17339. @item draw
  17340. Set the draw mode.
  17341. Available values are:
  17342. @table @samp
  17343. @item scale
  17344. Scale pixel values for each drawn sample.
  17345. @item full
  17346. Draw every sample directly.
  17347. @end table
  17348. Default value is @code{scale}.
  17349. @end table
  17350. @subsection Examples
  17351. @itemize
  17352. @item
  17353. Extract a channel split representation of the wave form of a whole audio track
  17354. in a 1024x800 picture using @command{ffmpeg}:
  17355. @example
  17356. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17357. @end example
  17358. @end itemize
  17359. @section sidedata, asidedata
  17360. Delete frame side data, or select frames based on it.
  17361. This filter accepts the following options:
  17362. @table @option
  17363. @item mode
  17364. Set mode of operation of the filter.
  17365. Can be one of the following:
  17366. @table @samp
  17367. @item select
  17368. Select every frame with side data of @code{type}.
  17369. @item delete
  17370. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17371. data in the frame.
  17372. @end table
  17373. @item type
  17374. Set side data type used with all modes. Must be set for @code{select} mode. For
  17375. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17376. in @file{libavutil/frame.h}. For example, to choose
  17377. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17378. @end table
  17379. @section spectrumsynth
  17380. Sythesize audio from 2 input video spectrums, first input stream represents
  17381. magnitude across time and second represents phase across time.
  17382. The filter will transform from frequency domain as displayed in videos back
  17383. to time domain as presented in audio output.
  17384. This filter is primarily created for reversing processed @ref{showspectrum}
  17385. filter outputs, but can synthesize sound from other spectrograms too.
  17386. But in such case results are going to be poor if the phase data is not
  17387. available, because in such cases phase data need to be recreated, usually
  17388. it's just recreated from random noise.
  17389. For best results use gray only output (@code{channel} color mode in
  17390. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17391. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17392. @code{data} option. Inputs videos should generally use @code{fullframe}
  17393. slide mode as that saves resources needed for decoding video.
  17394. The filter accepts the following options:
  17395. @table @option
  17396. @item sample_rate
  17397. Specify sample rate of output audio, the sample rate of audio from which
  17398. spectrum was generated may differ.
  17399. @item channels
  17400. Set number of channels represented in input video spectrums.
  17401. @item scale
  17402. Set scale which was used when generating magnitude input spectrum.
  17403. Can be @code{lin} or @code{log}. Default is @code{log}.
  17404. @item slide
  17405. Set slide which was used when generating inputs spectrums.
  17406. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17407. Default is @code{fullframe}.
  17408. @item win_func
  17409. Set window function used for resynthesis.
  17410. @item overlap
  17411. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17412. which means optimal overlap for selected window function will be picked.
  17413. @item orientation
  17414. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17415. Default is @code{vertical}.
  17416. @end table
  17417. @subsection Examples
  17418. @itemize
  17419. @item
  17420. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17421. then resynthesize videos back to audio with spectrumsynth:
  17422. @example
  17423. 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
  17424. 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
  17425. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17426. @end example
  17427. @end itemize
  17428. @section split, asplit
  17429. Split input into several identical outputs.
  17430. @code{asplit} works with audio input, @code{split} with video.
  17431. The filter accepts a single parameter which specifies the number of outputs. If
  17432. unspecified, it defaults to 2.
  17433. @subsection Examples
  17434. @itemize
  17435. @item
  17436. Create two separate outputs from the same input:
  17437. @example
  17438. [in] split [out0][out1]
  17439. @end example
  17440. @item
  17441. To create 3 or more outputs, you need to specify the number of
  17442. outputs, like in:
  17443. @example
  17444. [in] asplit=3 [out0][out1][out2]
  17445. @end example
  17446. @item
  17447. Create two separate outputs from the same input, one cropped and
  17448. one padded:
  17449. @example
  17450. [in] split [splitout1][splitout2];
  17451. [splitout1] crop=100:100:0:0 [cropout];
  17452. [splitout2] pad=200:200:100:100 [padout];
  17453. @end example
  17454. @item
  17455. Create 5 copies of the input audio with @command{ffmpeg}:
  17456. @example
  17457. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17458. @end example
  17459. @end itemize
  17460. @section zmq, azmq
  17461. Receive commands sent through a libzmq client, and forward them to
  17462. filters in the filtergraph.
  17463. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17464. must be inserted between two video filters, @code{azmq} between two
  17465. audio filters. Both are capable to send messages to any filter type.
  17466. To enable these filters you need to install the libzmq library and
  17467. headers and configure FFmpeg with @code{--enable-libzmq}.
  17468. For more information about libzmq see:
  17469. @url{http://www.zeromq.org/}
  17470. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17471. receives messages sent through a network interface defined by the
  17472. @option{bind_address} (or the abbreviation "@option{b}") option.
  17473. Default value of this option is @file{tcp://localhost:5555}. You may
  17474. want to alter this value to your needs, but do not forget to escape any
  17475. ':' signs (see @ref{filtergraph escaping}).
  17476. The received message must be in the form:
  17477. @example
  17478. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17479. @end example
  17480. @var{TARGET} specifies the target of the command, usually the name of
  17481. the filter class or a specific filter instance name. The default
  17482. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17483. but you can override this by using the @samp{filter_name@@id} syntax
  17484. (see @ref{Filtergraph syntax}).
  17485. @var{COMMAND} specifies the name of the command for the target filter.
  17486. @var{ARG} is optional and specifies the optional argument list for the
  17487. given @var{COMMAND}.
  17488. Upon reception, the message is processed and the corresponding command
  17489. is injected into the filtergraph. Depending on the result, the filter
  17490. will send a reply to the client, adopting the format:
  17491. @example
  17492. @var{ERROR_CODE} @var{ERROR_REASON}
  17493. @var{MESSAGE}
  17494. @end example
  17495. @var{MESSAGE} is optional.
  17496. @subsection Examples
  17497. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17498. be used to send commands processed by these filters.
  17499. Consider the following filtergraph generated by @command{ffplay}.
  17500. In this example the last overlay filter has an instance name. All other
  17501. filters will have default instance names.
  17502. @example
  17503. ffplay -dumpgraph 1 -f lavfi "
  17504. color=s=100x100:c=red [l];
  17505. color=s=100x100:c=blue [r];
  17506. nullsrc=s=200x100, zmq [bg];
  17507. [bg][l] overlay [bg+l];
  17508. [bg+l][r] overlay@@my=x=100 "
  17509. @end example
  17510. To change the color of the left side of the video, the following
  17511. command can be used:
  17512. @example
  17513. echo Parsed_color_0 c yellow | tools/zmqsend
  17514. @end example
  17515. To change the right side:
  17516. @example
  17517. echo Parsed_color_1 c pink | tools/zmqsend
  17518. @end example
  17519. To change the position of the right side:
  17520. @example
  17521. echo overlay@@my x 150 | tools/zmqsend
  17522. @end example
  17523. @c man end MULTIMEDIA FILTERS
  17524. @chapter Multimedia Sources
  17525. @c man begin MULTIMEDIA SOURCES
  17526. Below is a description of the currently available multimedia sources.
  17527. @section amovie
  17528. This is the same as @ref{movie} source, except it selects an audio
  17529. stream by default.
  17530. @anchor{movie}
  17531. @section movie
  17532. Read audio and/or video stream(s) from a movie container.
  17533. It accepts the following parameters:
  17534. @table @option
  17535. @item filename
  17536. The name of the resource to read (not necessarily a file; it can also be a
  17537. device or a stream accessed through some protocol).
  17538. @item format_name, f
  17539. Specifies the format assumed for the movie to read, and can be either
  17540. the name of a container or an input device. If not specified, the
  17541. format is guessed from @var{movie_name} or by probing.
  17542. @item seek_point, sp
  17543. Specifies the seek point in seconds. The frames will be output
  17544. starting from this seek point. The parameter is evaluated with
  17545. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17546. postfix. The default value is "0".
  17547. @item streams, s
  17548. Specifies the streams to read. Several streams can be specified,
  17549. separated by "+". The source will then have as many outputs, in the
  17550. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17551. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17552. respectively the default (best suited) video and audio stream. Default
  17553. is "dv", or "da" if the filter is called as "amovie".
  17554. @item stream_index, si
  17555. Specifies the index of the video stream to read. If the value is -1,
  17556. the most suitable video stream will be automatically selected. The default
  17557. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17558. audio instead of video.
  17559. @item loop
  17560. Specifies how many times to read the stream in sequence.
  17561. If the value is 0, the stream will be looped infinitely.
  17562. Default value is "1".
  17563. Note that when the movie is looped the source timestamps are not
  17564. changed, so it will generate non monotonically increasing timestamps.
  17565. @item discontinuity
  17566. Specifies the time difference between frames above which the point is
  17567. considered a timestamp discontinuity which is removed by adjusting the later
  17568. timestamps.
  17569. @end table
  17570. It allows overlaying a second video on top of the main input of
  17571. a filtergraph, as shown in this graph:
  17572. @example
  17573. input -----------> deltapts0 --> overlay --> output
  17574. ^
  17575. |
  17576. movie --> scale--> deltapts1 -------+
  17577. @end example
  17578. @subsection Examples
  17579. @itemize
  17580. @item
  17581. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17582. on top of the input labelled "in":
  17583. @example
  17584. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17585. [in] setpts=PTS-STARTPTS [main];
  17586. [main][over] overlay=16:16 [out]
  17587. @end example
  17588. @item
  17589. Read from a video4linux2 device, and overlay it on top of the input
  17590. labelled "in":
  17591. @example
  17592. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17593. [in] setpts=PTS-STARTPTS [main];
  17594. [main][over] overlay=16:16 [out]
  17595. @end example
  17596. @item
  17597. Read the first video stream and the audio stream with id 0x81 from
  17598. dvd.vob; the video is connected to the pad named "video" and the audio is
  17599. connected to the pad named "audio":
  17600. @example
  17601. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17602. @end example
  17603. @end itemize
  17604. @subsection Commands
  17605. Both movie and amovie support the following commands:
  17606. @table @option
  17607. @item seek
  17608. Perform seek using "av_seek_frame".
  17609. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17610. @itemize
  17611. @item
  17612. @var{stream_index}: If stream_index is -1, a default
  17613. stream is selected, and @var{timestamp} is automatically converted
  17614. from AV_TIME_BASE units to the stream specific time_base.
  17615. @item
  17616. @var{timestamp}: Timestamp in AVStream.time_base units
  17617. or, if no stream is specified, in AV_TIME_BASE units.
  17618. @item
  17619. @var{flags}: Flags which select direction and seeking mode.
  17620. @end itemize
  17621. @item get_duration
  17622. Get movie duration in AV_TIME_BASE units.
  17623. @end table
  17624. @c man end MULTIMEDIA SOURCES