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.

21575 lines
574KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  537. the second channel (and any other channels that may be present) unchanged.
  538. @example
  539. adelay=1500|0|500
  540. @end example
  541. @item
  542. Delay second channel by 500 samples, the third channel by 700 samples and leave
  543. the first channel (and any other channels that may be present) unchanged.
  544. @example
  545. adelay=0|500S|700S
  546. @end example
  547. @end itemize
  548. @section aderivative, aintegral
  549. Compute derivative/integral of audio stream.
  550. Applying both filters one after another produces original audio.
  551. @section aecho
  552. Apply echoing to the input audio.
  553. Echoes are reflected sound and can occur naturally amongst mountains
  554. (and sometimes large buildings) when talking or shouting; digital echo
  555. effects emulate this behaviour and are often used to help fill out the
  556. sound of a single instrument or vocal. The time difference between the
  557. original signal and the reflection is the @code{delay}, and the
  558. loudness of the reflected signal is the @code{decay}.
  559. Multiple echoes can have different delays and decays.
  560. A description of the accepted parameters follows.
  561. @table @option
  562. @item in_gain
  563. Set input gain of reflected signal. Default is @code{0.6}.
  564. @item out_gain
  565. Set output gain of reflected signal. Default is @code{0.3}.
  566. @item delays
  567. Set list of time intervals in milliseconds between original signal and reflections
  568. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  569. Default is @code{1000}.
  570. @item decays
  571. Set list of loudness of reflected signals separated by '|'.
  572. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  573. Default is @code{0.5}.
  574. @end table
  575. @subsection Examples
  576. @itemize
  577. @item
  578. Make it sound as if there are twice as many instruments as are actually playing:
  579. @example
  580. aecho=0.8:0.88:60:0.4
  581. @end example
  582. @item
  583. If delay is very short, then it sound like a (metallic) robot playing music:
  584. @example
  585. aecho=0.8:0.88:6:0.4
  586. @end example
  587. @item
  588. A longer delay will sound like an open air concert in the mountains:
  589. @example
  590. aecho=0.8:0.9:1000:0.3
  591. @end example
  592. @item
  593. Same as above but with one more mountain:
  594. @example
  595. aecho=0.8:0.9:1000|1800:0.3|0.25
  596. @end example
  597. @end itemize
  598. @section aemphasis
  599. Audio emphasis filter creates or restores material directly taken from LPs or
  600. emphased CDs with different filter curves. E.g. to store music on vinyl the
  601. signal has to be altered by a filter first to even out the disadvantages of
  602. this recording medium.
  603. Once the material is played back the inverse filter has to be applied to
  604. restore the distortion of the frequency response.
  605. The filter accepts the following options:
  606. @table @option
  607. @item level_in
  608. Set input gain.
  609. @item level_out
  610. Set output gain.
  611. @item mode
  612. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  613. use @code{production} mode. Default is @code{reproduction} mode.
  614. @item type
  615. Set filter type. Selects medium. Can be one of the following:
  616. @table @option
  617. @item col
  618. select Columbia.
  619. @item emi
  620. select EMI.
  621. @item bsi
  622. select BSI (78RPM).
  623. @item riaa
  624. select RIAA.
  625. @item cd
  626. select Compact Disc (CD).
  627. @item 50fm
  628. select 50µs (FM).
  629. @item 75fm
  630. select 75µs (FM).
  631. @item 50kf
  632. select 50µs (FM-KF).
  633. @item 75kf
  634. select 75µs (FM-KF).
  635. @end table
  636. @end table
  637. @section aeval
  638. Modify an audio signal according to the specified expressions.
  639. This filter accepts one or more expressions (one for each channel),
  640. which are evaluated and used to modify a corresponding audio signal.
  641. It accepts the following parameters:
  642. @table @option
  643. @item exprs
  644. Set the '|'-separated expressions list for each separate channel. If
  645. the number of input channels is greater than the number of
  646. expressions, the last specified expression is used for the remaining
  647. output channels.
  648. @item channel_layout, c
  649. Set output channel layout. If not specified, the channel layout is
  650. specified by the number of expressions. If set to @samp{same}, it will
  651. use by default the same input channel layout.
  652. @end table
  653. Each expression in @var{exprs} can contain the following constants and functions:
  654. @table @option
  655. @item ch
  656. channel number of the current expression
  657. @item n
  658. number of the evaluated sample, starting from 0
  659. @item s
  660. sample rate
  661. @item t
  662. time of the evaluated sample expressed in seconds
  663. @item nb_in_channels
  664. @item nb_out_channels
  665. input and output number of channels
  666. @item val(CH)
  667. the value of input channel with number @var{CH}
  668. @end table
  669. Note: this filter is slow. For faster processing you should use a
  670. dedicated filter.
  671. @subsection Examples
  672. @itemize
  673. @item
  674. Half volume:
  675. @example
  676. aeval=val(ch)/2:c=same
  677. @end example
  678. @item
  679. Invert phase of the second channel:
  680. @example
  681. aeval=val(0)|-val(1)
  682. @end example
  683. @end itemize
  684. @anchor{afade}
  685. @section afade
  686. Apply fade-in/out effect to input audio.
  687. A description of the accepted parameters follows.
  688. @table @option
  689. @item type, t
  690. Specify the effect type, can be either @code{in} for fade-in, or
  691. @code{out} for a fade-out effect. Default is @code{in}.
  692. @item start_sample, ss
  693. Specify the number of the start sample for starting to apply the fade
  694. effect. Default is 0.
  695. @item nb_samples, ns
  696. Specify the number of samples for which the fade effect has to last. At
  697. the end of the fade-in effect the output audio will have the same
  698. volume as the input audio, at the end of the fade-out transition
  699. the output audio will be silence. Default is 44100.
  700. @item start_time, st
  701. Specify the start time of the fade effect. Default is 0.
  702. The value must be specified as a time duration; see
  703. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  704. for the accepted syntax.
  705. If set this option is used instead of @var{start_sample}.
  706. @item duration, d
  707. Specify the duration of the fade effect. See
  708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  709. for the accepted syntax.
  710. At the end of the fade-in effect the output audio will have the same
  711. volume as the input audio, at the end of the fade-out transition
  712. the output audio will be silence.
  713. By default the duration is determined by @var{nb_samples}.
  714. If set this option is used instead of @var{nb_samples}.
  715. @item curve
  716. Set curve for fade transition.
  717. It accepts the following values:
  718. @table @option
  719. @item tri
  720. select triangular, linear slope (default)
  721. @item qsin
  722. select quarter of sine wave
  723. @item hsin
  724. select half of sine wave
  725. @item esin
  726. select exponential sine wave
  727. @item log
  728. select logarithmic
  729. @item ipar
  730. select inverted parabola
  731. @item qua
  732. select quadratic
  733. @item cub
  734. select cubic
  735. @item squ
  736. select square root
  737. @item cbr
  738. select cubic root
  739. @item par
  740. select parabola
  741. @item exp
  742. select exponential
  743. @item iqsin
  744. select inverted quarter of sine wave
  745. @item ihsin
  746. select inverted half of sine wave
  747. @item dese
  748. select double-exponential seat
  749. @item desi
  750. select double-exponential sigmoid
  751. @item losi
  752. select logistic sigmoid
  753. @end table
  754. @end table
  755. @subsection Examples
  756. @itemize
  757. @item
  758. Fade in first 15 seconds of audio:
  759. @example
  760. afade=t=in:ss=0:d=15
  761. @end example
  762. @item
  763. Fade out last 25 seconds of a 900 seconds audio:
  764. @example
  765. afade=t=out:st=875:d=25
  766. @end example
  767. @end itemize
  768. @section afftdn
  769. Denoise audio samples with FFT.
  770. A description of the accepted parameters follows.
  771. @table @option
  772. @item nr
  773. Set the noise reduction in dB, allowed range is 0.01 to 97.
  774. Default value is 12 dB.
  775. @item nf
  776. Set the noise floor in dB, allowed range is -80 to -20.
  777. Default value is -50 dB.
  778. @item nt
  779. Set the noise type.
  780. It accepts the following values:
  781. @table @option
  782. @item w
  783. Select white noise.
  784. @item v
  785. Select vinyl noise.
  786. @item s
  787. Select shellac noise.
  788. @item c
  789. Select custom noise, defined in @code{bn} option.
  790. Default value is white noise.
  791. @end table
  792. @item bn
  793. Set custom band noise for every one of 15 bands.
  794. Bands are separated by ' ' or '|'.
  795. @item rf
  796. Set the residual floor in dB, allowed range is -80 to -20.
  797. Default value is -38 dB.
  798. @item tn
  799. Enable noise tracking. By default is disabled.
  800. With this enabled, noise floor is automatically adjusted.
  801. @item tr
  802. Enable residual tracking. By default is disabled.
  803. @item om
  804. Set the output mode.
  805. It accepts the following values:
  806. @table @option
  807. @item i
  808. Pass input unchanged.
  809. @item o
  810. Pass noise filtered out.
  811. @item n
  812. Pass only noise.
  813. Default value is @var{o}.
  814. @end table
  815. @end table
  816. @subsection Commands
  817. This filter supports the following commands:
  818. @table @option
  819. @item sample_noise, sn
  820. Start or stop measuring noise profile.
  821. Syntax for the command is : "start" or "stop" string.
  822. After measuring noise profile is stopped it will be
  823. automatically applied in filtering.
  824. @item noise_reduction, nr
  825. Change noise reduction. Argument is single float number.
  826. Syntax for the command is : "@var{noise_reduction}"
  827. @item noise_floor, nf
  828. Change noise floor. Argument is single float number.
  829. Syntax for the command is : "@var{noise_floor}"
  830. @item output_mode, om
  831. Change output mode operation.
  832. Syntax for the command is : "i", "o" or "n" string.
  833. @end table
  834. @section afftfilt
  835. Apply arbitrary expressions to samples in frequency domain.
  836. @table @option
  837. @item real
  838. Set frequency domain real expression for each separate channel separated
  839. by '|'. Default is "1".
  840. If the number of input channels is greater than the number of
  841. expressions, the last specified expression is used for the remaining
  842. output channels.
  843. @item imag
  844. Set frequency domain imaginary expression for each separate channel
  845. separated by '|'. If not set, @var{real} option is used.
  846. Each expression in @var{real} and @var{imag} can contain the following
  847. constants:
  848. @table @option
  849. @item sr
  850. sample rate
  851. @item b
  852. current frequency bin number
  853. @item nb
  854. number of available bins
  855. @item ch
  856. channel number of the current expression
  857. @item chs
  858. number of channels
  859. @item pts
  860. current frame pts
  861. @end table
  862. @item win_size
  863. Set window size.
  864. It accepts the following values:
  865. @table @samp
  866. @item w16
  867. @item w32
  868. @item w64
  869. @item w128
  870. @item w256
  871. @item w512
  872. @item w1024
  873. @item w2048
  874. @item w4096
  875. @item w8192
  876. @item w16384
  877. @item w32768
  878. @item w65536
  879. @end table
  880. Default is @code{w4096}
  881. @item win_func
  882. Set window function. Default is @code{hann}.
  883. @item overlap
  884. Set window overlap. If set to 1, the recommended overlap for selected
  885. window function will be picked. Default is @code{0.75}.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Leave almost only low frequencies in audio:
  891. @example
  892. afftfilt="1-clip((b/nb)*b,0,1)"
  893. @end example
  894. @end itemize
  895. @anchor{afir}
  896. @section afir
  897. Apply an arbitrary Frequency Impulse Response filter.
  898. This filter is designed for applying long FIR filters,
  899. up to 60 seconds long.
  900. It can be used as component for digital crossover filters,
  901. room equalization, cross talk cancellation, wavefield synthesis,
  902. auralization, ambiophonics and ambisonics.
  903. This filter uses second stream as FIR coefficients.
  904. If second stream holds single channel, it will be used
  905. for all input channels in first stream, otherwise
  906. number of channels in second stream must be same as
  907. number of channels in first stream.
  908. It accepts the following parameters:
  909. @table @option
  910. @item dry
  911. Set dry gain. This sets input gain.
  912. @item wet
  913. Set wet gain. This sets final output gain.
  914. @item length
  915. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  916. @item gtype
  917. Enable applying gain measured from power of IR.
  918. Set which approach to use for auto gain measurement.
  919. @table @option
  920. @item none
  921. Do not apply any gain.
  922. @item peak
  923. select peak gain, very conservative approach. This is default value.
  924. @item dc
  925. select DC gain, limited application.
  926. @item gn
  927. select gain to noise approach, this is most popular one.
  928. @end table
  929. @item irgain
  930. Set gain to be applied to IR coefficients before filtering.
  931. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  932. @item irfmt
  933. Set format of IR stream. Can be @code{mono} or @code{input}.
  934. Default is @code{input}.
  935. @item maxir
  936. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  937. Allowed range is 0.1 to 60 seconds.
  938. @item response
  939. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  940. By default it is disabled.
  941. @item channel
  942. Set for which IR channel to display frequency response. By default is first channel
  943. displayed. This option is used only when @var{response} is enabled.
  944. @item size
  945. Set video stream size. This option is used only when @var{response} is enabled.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  951. @example
  952. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  953. @end example
  954. @end itemize
  955. @anchor{aformat}
  956. @section aformat
  957. Set output format constraints for the input audio. The framework will
  958. negotiate the most appropriate format to minimize conversions.
  959. It accepts the following parameters:
  960. @table @option
  961. @item sample_fmts
  962. A '|'-separated list of requested sample formats.
  963. @item sample_rates
  964. A '|'-separated list of requested sample rates.
  965. @item channel_layouts
  966. A '|'-separated list of requested channel layouts.
  967. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  968. for the required syntax.
  969. @end table
  970. If a parameter is omitted, all values are allowed.
  971. Force the output to either unsigned 8-bit or signed 16-bit stereo
  972. @example
  973. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  974. @end example
  975. @section agate
  976. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  977. processing reduces disturbing noise between useful signals.
  978. Gating is done by detecting the volume below a chosen level @var{threshold}
  979. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  980. floor is set via @var{range}. Because an exact manipulation of the signal
  981. would cause distortion of the waveform the reduction can be levelled over
  982. time. This is done by setting @var{attack} and @var{release}.
  983. @var{attack} determines how long the signal has to fall below the threshold
  984. before any reduction will occur and @var{release} sets the time the signal
  985. has to rise above the threshold to reduce the reduction again.
  986. Shorter signals than the chosen attack time will be left untouched.
  987. @table @option
  988. @item level_in
  989. Set input level before filtering.
  990. Default is 1. Allowed range is from 0.015625 to 64.
  991. @item range
  992. Set the level of gain reduction when the signal is below the threshold.
  993. Default is 0.06125. Allowed range is from 0 to 1.
  994. @item threshold
  995. If a signal rises above this level the gain reduction is released.
  996. Default is 0.125. Allowed range is from 0 to 1.
  997. @item ratio
  998. Set a ratio by which the signal is reduced.
  999. Default is 2. Allowed range is from 1 to 9000.
  1000. @item attack
  1001. Amount of milliseconds the signal has to rise above the threshold before gain
  1002. reduction stops.
  1003. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1004. @item release
  1005. Amount of milliseconds the signal has to fall below the threshold before the
  1006. reduction is increased again. Default is 250 milliseconds.
  1007. Allowed range is from 0.01 to 9000.
  1008. @item makeup
  1009. Set amount of amplification of signal after processing.
  1010. Default is 1. Allowed range is from 1 to 64.
  1011. @item knee
  1012. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1013. Default is 2.828427125. Allowed range is from 1 to 8.
  1014. @item detection
  1015. Choose if exact signal should be taken for detection or an RMS like one.
  1016. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1017. @item link
  1018. Choose if the average level between all channels or the louder channel affects
  1019. the reduction.
  1020. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1021. @end table
  1022. @section aiir
  1023. Apply an arbitrary Infinite Impulse Response filter.
  1024. It accepts the following parameters:
  1025. @table @option
  1026. @item z
  1027. Set numerator/zeros coefficients.
  1028. @item p
  1029. Set denominator/poles coefficients.
  1030. @item k
  1031. Set channels gains.
  1032. @item dry_gain
  1033. Set input gain.
  1034. @item wet_gain
  1035. Set output gain.
  1036. @item f
  1037. Set coefficients format.
  1038. @table @samp
  1039. @item tf
  1040. transfer function
  1041. @item zp
  1042. Z-plane zeros/poles, cartesian (default)
  1043. @item pr
  1044. Z-plane zeros/poles, polar radians
  1045. @item pd
  1046. Z-plane zeros/poles, polar degrees
  1047. @end table
  1048. @item r
  1049. Set kind of processing.
  1050. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1051. @item e
  1052. Set filtering precision.
  1053. @table @samp
  1054. @item dbl
  1055. double-precision floating-point (default)
  1056. @item flt
  1057. single-precision floating-point
  1058. @item i32
  1059. 32-bit integers
  1060. @item i16
  1061. 16-bit integers
  1062. @end table
  1063. @item response
  1064. Show IR frequency reponse, magnitude and phase in additional video stream.
  1065. By default it is disabled.
  1066. @item channel
  1067. Set for which IR channel to display frequency response. By default is first channel
  1068. displayed. This option is used only when @var{response} is enabled.
  1069. @item size
  1070. Set video stream size. This option is used only when @var{response} is enabled.
  1071. @end table
  1072. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1073. order.
  1074. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1075. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1076. imaginary unit.
  1077. Different coefficients and gains can be provided for every channel, in such case
  1078. use '|' to separate coefficients or gains. Last provided coefficients will be
  1079. used for all remaining channels.
  1080. @subsection Examples
  1081. @itemize
  1082. @item
  1083. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1084. @example
  1085. 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
  1086. @end example
  1087. @item
  1088. Same as above but in @code{zp} format:
  1089. @example
  1090. 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
  1091. @end example
  1092. @end itemize
  1093. @section alimiter
  1094. The limiter prevents an input signal from rising over a desired threshold.
  1095. This limiter uses lookahead technology to prevent your signal from distorting.
  1096. It means that there is a small delay after the signal is processed. Keep in mind
  1097. that the delay it produces is the attack time you set.
  1098. The filter accepts the following options:
  1099. @table @option
  1100. @item level_in
  1101. Set input gain. Default is 1.
  1102. @item level_out
  1103. Set output gain. Default is 1.
  1104. @item limit
  1105. Don't let signals above this level pass the limiter. Default is 1.
  1106. @item attack
  1107. The limiter will reach its attenuation level in this amount of time in
  1108. milliseconds. Default is 5 milliseconds.
  1109. @item release
  1110. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1111. Default is 50 milliseconds.
  1112. @item asc
  1113. When gain reduction is always needed ASC takes care of releasing to an
  1114. average reduction level rather than reaching a reduction of 0 in the release
  1115. time.
  1116. @item asc_level
  1117. Select how much the release time is affected by ASC, 0 means nearly no changes
  1118. in release time while 1 produces higher release times.
  1119. @item level
  1120. Auto level output signal. Default is enabled.
  1121. This normalizes audio back to 0dB if enabled.
  1122. @end table
  1123. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1124. with @ref{aresample} before applying this filter.
  1125. @section allpass
  1126. Apply a two-pole all-pass filter with central frequency (in Hz)
  1127. @var{frequency}, and filter-width @var{width}.
  1128. An all-pass filter changes the audio's frequency to phase relationship
  1129. without changing its frequency to amplitude relationship.
  1130. The filter accepts the following options:
  1131. @table @option
  1132. @item frequency, f
  1133. Set frequency in Hz.
  1134. @item width_type, t
  1135. Set method to specify band-width of filter.
  1136. @table @option
  1137. @item h
  1138. Hz
  1139. @item q
  1140. Q-Factor
  1141. @item o
  1142. octave
  1143. @item s
  1144. slope
  1145. @item k
  1146. kHz
  1147. @end table
  1148. @item width, w
  1149. Specify the band-width of a filter in width_type units.
  1150. @item channels, c
  1151. Specify which channels to filter, by default all available are filtered.
  1152. @end table
  1153. @subsection Commands
  1154. This filter supports the following commands:
  1155. @table @option
  1156. @item frequency, f
  1157. Change allpass frequency.
  1158. Syntax for the command is : "@var{frequency}"
  1159. @item width_type, t
  1160. Change allpass width_type.
  1161. Syntax for the command is : "@var{width_type}"
  1162. @item width, w
  1163. Change allpass width.
  1164. Syntax for the command is : "@var{width}"
  1165. @end table
  1166. @section aloop
  1167. Loop audio samples.
  1168. The filter accepts the following options:
  1169. @table @option
  1170. @item loop
  1171. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1172. Default is 0.
  1173. @item size
  1174. Set maximal number of samples. Default is 0.
  1175. @item start
  1176. Set first sample of loop. Default is 0.
  1177. @end table
  1178. @anchor{amerge}
  1179. @section amerge
  1180. Merge two or more audio streams into a single multi-channel stream.
  1181. The filter accepts the following options:
  1182. @table @option
  1183. @item inputs
  1184. Set the number of inputs. Default is 2.
  1185. @end table
  1186. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1187. the channel layout of the output will be set accordingly and the channels
  1188. will be reordered as necessary. If the channel layouts of the inputs are not
  1189. disjoint, the output will have all the channels of the first input then all
  1190. the channels of the second input, in that order, and the channel layout of
  1191. the output will be the default value corresponding to the total number of
  1192. channels.
  1193. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1194. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1195. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1196. first input, b1 is the first channel of the second input).
  1197. On the other hand, if both input are in stereo, the output channels will be
  1198. in the default order: a1, a2, b1, b2, and the channel layout will be
  1199. arbitrarily set to 4.0, which may or may not be the expected value.
  1200. All inputs must have the same sample rate, and format.
  1201. If inputs do not have the same duration, the output will stop with the
  1202. shortest.
  1203. @subsection Examples
  1204. @itemize
  1205. @item
  1206. Merge two mono files into a stereo stream:
  1207. @example
  1208. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1209. @end example
  1210. @item
  1211. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1212. @example
  1213. 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
  1214. @end example
  1215. @end itemize
  1216. @section amix
  1217. Mixes multiple audio inputs into a single output.
  1218. Note that this filter only supports float samples (the @var{amerge}
  1219. and @var{pan} audio filters support many formats). If the @var{amix}
  1220. input has integer samples then @ref{aresample} will be automatically
  1221. inserted to perform the conversion to float samples.
  1222. For example
  1223. @example
  1224. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1225. @end example
  1226. will mix 3 input audio streams to a single output with the same duration as the
  1227. first input and a dropout transition time of 3 seconds.
  1228. It accepts the following parameters:
  1229. @table @option
  1230. @item inputs
  1231. The number of inputs. If unspecified, it defaults to 2.
  1232. @item duration
  1233. How to determine the end-of-stream.
  1234. @table @option
  1235. @item longest
  1236. The duration of the longest input. (default)
  1237. @item shortest
  1238. The duration of the shortest input.
  1239. @item first
  1240. The duration of the first input.
  1241. @end table
  1242. @item dropout_transition
  1243. The transition time, in seconds, for volume renormalization when an input
  1244. stream ends. The default value is 2 seconds.
  1245. @item weights
  1246. Specify weight of each input audio stream as sequence.
  1247. Each weight is separated by space. By default all inputs have same weight.
  1248. @end table
  1249. @section amultiply
  1250. Multiply first audio stream with second audio stream and store result
  1251. in output audio stream. Multiplication is done by multiplying each
  1252. sample from first stream with sample at same position from second stream.
  1253. With this element-wise multiplication one can create amplitude fades and
  1254. amplitude modulations.
  1255. @section anequalizer
  1256. High-order parametric multiband equalizer for each channel.
  1257. It accepts the following parameters:
  1258. @table @option
  1259. @item params
  1260. This option string is in format:
  1261. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1262. Each equalizer band is separated by '|'.
  1263. @table @option
  1264. @item chn
  1265. Set channel number to which equalization will be applied.
  1266. If input doesn't have that channel the entry is ignored.
  1267. @item f
  1268. Set central frequency for band.
  1269. If input doesn't have that frequency the entry is ignored.
  1270. @item w
  1271. Set band width in hertz.
  1272. @item g
  1273. Set band gain in dB.
  1274. @item t
  1275. Set filter type for band, optional, can be:
  1276. @table @samp
  1277. @item 0
  1278. Butterworth, this is default.
  1279. @item 1
  1280. Chebyshev type 1.
  1281. @item 2
  1282. Chebyshev type 2.
  1283. @end table
  1284. @end table
  1285. @item curves
  1286. With this option activated frequency response of anequalizer is displayed
  1287. in video stream.
  1288. @item size
  1289. Set video stream size. Only useful if curves option is activated.
  1290. @item mgain
  1291. Set max gain that will be displayed. Only useful if curves option is activated.
  1292. Setting this to a reasonable value makes it possible to display gain which is derived from
  1293. neighbour bands which are too close to each other and thus produce higher gain
  1294. when both are activated.
  1295. @item fscale
  1296. Set frequency scale used to draw frequency response in video output.
  1297. Can be linear or logarithmic. Default is logarithmic.
  1298. @item colors
  1299. Set color for each channel curve which is going to be displayed in video stream.
  1300. This is list of color names separated by space or by '|'.
  1301. Unrecognised or missing colors will be replaced by white color.
  1302. @end table
  1303. @subsection Examples
  1304. @itemize
  1305. @item
  1306. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1307. for first 2 channels using Chebyshev type 1 filter:
  1308. @example
  1309. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1310. @end example
  1311. @end itemize
  1312. @subsection Commands
  1313. This filter supports the following commands:
  1314. @table @option
  1315. @item change
  1316. Alter existing filter parameters.
  1317. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1318. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1319. error is returned.
  1320. @var{freq} set new frequency parameter.
  1321. @var{width} set new width parameter in herz.
  1322. @var{gain} set new gain parameter in dB.
  1323. Full filter invocation with asendcmd may look like this:
  1324. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1325. @end table
  1326. @section anull
  1327. Pass the audio source unchanged to the output.
  1328. @section apad
  1329. Pad the end of an audio stream with silence.
  1330. This can be used together with @command{ffmpeg} @option{-shortest} to
  1331. extend audio streams to the same length as the video stream.
  1332. A description of the accepted options follows.
  1333. @table @option
  1334. @item packet_size
  1335. Set silence packet size. Default value is 4096.
  1336. @item pad_len
  1337. Set the number of samples of silence to add to the end. After the
  1338. value is reached, the stream is terminated. This option is mutually
  1339. exclusive with @option{whole_len}.
  1340. @item whole_len
  1341. Set the minimum total number of samples in the output audio stream. If
  1342. the value is longer than the input audio length, silence is added to
  1343. the end, until the value is reached. This option is mutually exclusive
  1344. with @option{pad_len}.
  1345. @end table
  1346. If neither the @option{pad_len} nor the @option{whole_len} option is
  1347. set, the filter will add silence to the end of the input stream
  1348. indefinitely.
  1349. @subsection Examples
  1350. @itemize
  1351. @item
  1352. Add 1024 samples of silence to the end of the input:
  1353. @example
  1354. apad=pad_len=1024
  1355. @end example
  1356. @item
  1357. Make sure the audio output will contain at least 10000 samples, pad
  1358. the input with silence if required:
  1359. @example
  1360. apad=whole_len=10000
  1361. @end example
  1362. @item
  1363. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1364. video stream will always result the shortest and will be converted
  1365. until the end in the output file when using the @option{shortest}
  1366. option:
  1367. @example
  1368. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1369. @end example
  1370. @end itemize
  1371. @section aphaser
  1372. Add a phasing effect to the input audio.
  1373. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1374. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1375. A description of the accepted parameters follows.
  1376. @table @option
  1377. @item in_gain
  1378. Set input gain. Default is 0.4.
  1379. @item out_gain
  1380. Set output gain. Default is 0.74
  1381. @item delay
  1382. Set delay in milliseconds. Default is 3.0.
  1383. @item decay
  1384. Set decay. Default is 0.4.
  1385. @item speed
  1386. Set modulation speed in Hz. Default is 0.5.
  1387. @item type
  1388. Set modulation type. Default is triangular.
  1389. It accepts the following values:
  1390. @table @samp
  1391. @item triangular, t
  1392. @item sinusoidal, s
  1393. @end table
  1394. @end table
  1395. @section apulsator
  1396. Audio pulsator is something between an autopanner and a tremolo.
  1397. But it can produce funny stereo effects as well. Pulsator changes the volume
  1398. of the left and right channel based on a LFO (low frequency oscillator) with
  1399. different waveforms and shifted phases.
  1400. This filter have the ability to define an offset between left and right
  1401. channel. An offset of 0 means that both LFO shapes match each other.
  1402. The left and right channel are altered equally - a conventional tremolo.
  1403. An offset of 50% means that the shape of the right channel is exactly shifted
  1404. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1405. an autopanner. At 1 both curves match again. Every setting in between moves the
  1406. phase shift gapless between all stages and produces some "bypassing" sounds with
  1407. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1408. the 0.5) the faster the signal passes from the left to the right speaker.
  1409. The filter accepts the following options:
  1410. @table @option
  1411. @item level_in
  1412. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1413. @item level_out
  1414. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1415. @item mode
  1416. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1417. sawup or sawdown. Default is sine.
  1418. @item amount
  1419. Set modulation. Define how much of original signal is affected by the LFO.
  1420. @item offset_l
  1421. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1422. @item offset_r
  1423. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1424. @item width
  1425. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1426. @item timing
  1427. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1428. @item bpm
  1429. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1430. is set to bpm.
  1431. @item ms
  1432. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1433. is set to ms.
  1434. @item hz
  1435. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1436. if timing is set to hz.
  1437. @end table
  1438. @anchor{aresample}
  1439. @section aresample
  1440. Resample the input audio to the specified parameters, using the
  1441. libswresample library. If none are specified then the filter will
  1442. automatically convert between its input and output.
  1443. This filter is also able to stretch/squeeze the audio data to make it match
  1444. the timestamps or to inject silence / cut out audio to make it match the
  1445. timestamps, do a combination of both or do neither.
  1446. The filter accepts the syntax
  1447. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1448. expresses a sample rate and @var{resampler_options} is a list of
  1449. @var{key}=@var{value} pairs, separated by ":". See the
  1450. @ref{Resampler Options,,"Resampler Options" section in the
  1451. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1452. for the complete list of supported options.
  1453. @subsection Examples
  1454. @itemize
  1455. @item
  1456. Resample the input audio to 44100Hz:
  1457. @example
  1458. aresample=44100
  1459. @end example
  1460. @item
  1461. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1462. samples per second compensation:
  1463. @example
  1464. aresample=async=1000
  1465. @end example
  1466. @end itemize
  1467. @section areverse
  1468. Reverse an audio clip.
  1469. Warning: This filter requires memory to buffer the entire clip, so trimming
  1470. is suggested.
  1471. @subsection Examples
  1472. @itemize
  1473. @item
  1474. Take the first 5 seconds of a clip, and reverse it.
  1475. @example
  1476. atrim=end=5,areverse
  1477. @end example
  1478. @end itemize
  1479. @section asetnsamples
  1480. Set the number of samples per each output audio frame.
  1481. The last output packet may contain a different number of samples, as
  1482. the filter will flush all the remaining samples when the input audio
  1483. signals its end.
  1484. The filter accepts the following options:
  1485. @table @option
  1486. @item nb_out_samples, n
  1487. Set the number of frames per each output audio frame. The number is
  1488. intended as the number of samples @emph{per each channel}.
  1489. Default value is 1024.
  1490. @item pad, p
  1491. If set to 1, the filter will pad the last audio frame with zeroes, so
  1492. that the last frame will contain the same number of samples as the
  1493. previous ones. Default value is 1.
  1494. @end table
  1495. For example, to set the number of per-frame samples to 1234 and
  1496. disable padding for the last frame, use:
  1497. @example
  1498. asetnsamples=n=1234:p=0
  1499. @end example
  1500. @section asetrate
  1501. Set the sample rate without altering the PCM data.
  1502. This will result in a change of speed and pitch.
  1503. The filter accepts the following options:
  1504. @table @option
  1505. @item sample_rate, r
  1506. Set the output sample rate. Default is 44100 Hz.
  1507. @end table
  1508. @section ashowinfo
  1509. Show a line containing various information for each input audio frame.
  1510. The input audio is not modified.
  1511. The shown line contains a sequence of key/value pairs of the form
  1512. @var{key}:@var{value}.
  1513. The following values are shown in the output:
  1514. @table @option
  1515. @item n
  1516. The (sequential) number of the input frame, starting from 0.
  1517. @item pts
  1518. The presentation timestamp of the input frame, in time base units; the time base
  1519. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1520. @item pts_time
  1521. The presentation timestamp of the input frame in seconds.
  1522. @item pos
  1523. position of the frame in the input stream, -1 if this information in
  1524. unavailable and/or meaningless (for example in case of synthetic audio)
  1525. @item fmt
  1526. The sample format.
  1527. @item chlayout
  1528. The channel layout.
  1529. @item rate
  1530. The sample rate for the audio frame.
  1531. @item nb_samples
  1532. The number of samples (per channel) in the frame.
  1533. @item checksum
  1534. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1535. audio, the data is treated as if all the planes were concatenated.
  1536. @item plane_checksums
  1537. A list of Adler-32 checksums for each data plane.
  1538. @end table
  1539. @anchor{astats}
  1540. @section astats
  1541. Display time domain statistical information about the audio channels.
  1542. Statistics are calculated and displayed for each audio channel and,
  1543. where applicable, an overall figure is also given.
  1544. It accepts the following option:
  1545. @table @option
  1546. @item length
  1547. Short window length in seconds, used for peak and trough RMS measurement.
  1548. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1549. @item metadata
  1550. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1551. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1552. disabled.
  1553. Available keys for each channel are:
  1554. DC_offset
  1555. Min_level
  1556. Max_level
  1557. Min_difference
  1558. Max_difference
  1559. Mean_difference
  1560. RMS_difference
  1561. Peak_level
  1562. RMS_peak
  1563. RMS_trough
  1564. Crest_factor
  1565. Flat_factor
  1566. Peak_count
  1567. Bit_depth
  1568. Dynamic_range
  1569. Zero_crossings
  1570. Zero_crossings_rate
  1571. and for Overall:
  1572. DC_offset
  1573. Min_level
  1574. Max_level
  1575. Min_difference
  1576. Max_difference
  1577. Mean_difference
  1578. RMS_difference
  1579. Peak_level
  1580. RMS_level
  1581. RMS_peak
  1582. RMS_trough
  1583. Flat_factor
  1584. Peak_count
  1585. Bit_depth
  1586. Number_of_samples
  1587. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1588. this @code{lavfi.astats.Overall.Peak_count}.
  1589. For description what each key means read below.
  1590. @item reset
  1591. Set number of frame after which stats are going to be recalculated.
  1592. Default is disabled.
  1593. @end table
  1594. A description of each shown parameter follows:
  1595. @table @option
  1596. @item DC offset
  1597. Mean amplitude displacement from zero.
  1598. @item Min level
  1599. Minimal sample level.
  1600. @item Max level
  1601. Maximal sample level.
  1602. @item Min difference
  1603. Minimal difference between two consecutive samples.
  1604. @item Max difference
  1605. Maximal difference between two consecutive samples.
  1606. @item Mean difference
  1607. Mean difference between two consecutive samples.
  1608. The average of each difference between two consecutive samples.
  1609. @item RMS difference
  1610. Root Mean Square difference between two consecutive samples.
  1611. @item Peak level dB
  1612. @item RMS level dB
  1613. Standard peak and RMS level measured in dBFS.
  1614. @item RMS peak dB
  1615. @item RMS trough dB
  1616. Peak and trough values for RMS level measured over a short window.
  1617. @item Crest factor
  1618. Standard ratio of peak to RMS level (note: not in dB).
  1619. @item Flat factor
  1620. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1621. (i.e. either @var{Min level} or @var{Max level}).
  1622. @item Peak count
  1623. Number of occasions (not the number of samples) that the signal attained either
  1624. @var{Min level} or @var{Max level}.
  1625. @item Bit depth
  1626. Overall bit depth of audio. Number of bits used for each sample.
  1627. @item Dynamic range
  1628. Measured dynamic range of audio in dB.
  1629. @item Zero crossings
  1630. Number of points where the waveform crosses the zero level axis.
  1631. @item Zero crossings rate
  1632. Rate of Zero crossings and number of audio samples.
  1633. @end table
  1634. @section atempo
  1635. Adjust audio tempo.
  1636. The filter accepts exactly one parameter, the audio tempo. If not
  1637. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1638. be in the [0.5, 100.0] range.
  1639. Note that tempo greater than 2 will skip some samples rather than
  1640. blend them in. If for any reason this is a concern it is always
  1641. possible to daisy-chain several instances of atempo to achieve the
  1642. desired product tempo.
  1643. @subsection Examples
  1644. @itemize
  1645. @item
  1646. Slow down audio to 80% tempo:
  1647. @example
  1648. atempo=0.8
  1649. @end example
  1650. @item
  1651. To speed up audio to 300% tempo:
  1652. @example
  1653. atempo=3
  1654. @end example
  1655. @item
  1656. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1657. @example
  1658. atempo=sqrt(3),atempo=sqrt(3)
  1659. @end example
  1660. @end itemize
  1661. @section atrim
  1662. Trim the input so that the output contains one continuous subpart of the input.
  1663. It accepts the following parameters:
  1664. @table @option
  1665. @item start
  1666. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1667. sample with the timestamp @var{start} will be the first sample in the output.
  1668. @item end
  1669. Specify time of the first audio sample that will be dropped, i.e. the
  1670. audio sample immediately preceding the one with the timestamp @var{end} will be
  1671. the last sample in the output.
  1672. @item start_pts
  1673. Same as @var{start}, except this option sets the start timestamp in samples
  1674. instead of seconds.
  1675. @item end_pts
  1676. Same as @var{end}, except this option sets the end timestamp in samples instead
  1677. of seconds.
  1678. @item duration
  1679. The maximum duration of the output in seconds.
  1680. @item start_sample
  1681. The number of the first sample that should be output.
  1682. @item end_sample
  1683. The number of the first sample that should be dropped.
  1684. @end table
  1685. @option{start}, @option{end}, and @option{duration} are expressed as time
  1686. duration specifications; see
  1687. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1688. Note that the first two sets of the start/end options and the @option{duration}
  1689. option look at the frame timestamp, while the _sample options simply count the
  1690. samples that pass through the filter. So start/end_pts and start/end_sample will
  1691. give different results when the timestamps are wrong, inexact or do not start at
  1692. zero. Also note that this filter does not modify the timestamps. If you wish
  1693. to have the output timestamps start at zero, insert the asetpts filter after the
  1694. atrim filter.
  1695. If multiple start or end options are set, this filter tries to be greedy and
  1696. keep all samples that match at least one of the specified constraints. To keep
  1697. only the part that matches all the constraints at once, chain multiple atrim
  1698. filters.
  1699. The defaults are such that all the input is kept. So it is possible to set e.g.
  1700. just the end values to keep everything before the specified time.
  1701. Examples:
  1702. @itemize
  1703. @item
  1704. Drop everything except the second minute of input:
  1705. @example
  1706. ffmpeg -i INPUT -af atrim=60:120
  1707. @end example
  1708. @item
  1709. Keep only the first 1000 samples:
  1710. @example
  1711. ffmpeg -i INPUT -af atrim=end_sample=1000
  1712. @end example
  1713. @end itemize
  1714. @section bandpass
  1715. Apply a two-pole Butterworth band-pass filter with central
  1716. frequency @var{frequency}, and (3dB-point) band-width width.
  1717. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1718. instead of the default: constant 0dB peak gain.
  1719. The filter roll off at 6dB per octave (20dB per decade).
  1720. The filter accepts the following options:
  1721. @table @option
  1722. @item frequency, f
  1723. Set the filter's central frequency. Default is @code{3000}.
  1724. @item csg
  1725. Constant skirt gain if set to 1. Defaults to 0.
  1726. @item width_type, t
  1727. Set method to specify band-width of filter.
  1728. @table @option
  1729. @item h
  1730. Hz
  1731. @item q
  1732. Q-Factor
  1733. @item o
  1734. octave
  1735. @item s
  1736. slope
  1737. @item k
  1738. kHz
  1739. @end table
  1740. @item width, w
  1741. Specify the band-width of a filter in width_type units.
  1742. @item channels, c
  1743. Specify which channels to filter, by default all available are filtered.
  1744. @end table
  1745. @subsection Commands
  1746. This filter supports the following commands:
  1747. @table @option
  1748. @item frequency, f
  1749. Change bandpass frequency.
  1750. Syntax for the command is : "@var{frequency}"
  1751. @item width_type, t
  1752. Change bandpass width_type.
  1753. Syntax for the command is : "@var{width_type}"
  1754. @item width, w
  1755. Change bandpass width.
  1756. Syntax for the command is : "@var{width}"
  1757. @end table
  1758. @section bandreject
  1759. Apply a two-pole Butterworth band-reject filter with central
  1760. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1761. The filter roll off at 6dB per octave (20dB per decade).
  1762. The filter accepts the following options:
  1763. @table @option
  1764. @item frequency, f
  1765. Set the filter's central frequency. Default is @code{3000}.
  1766. @item width_type, t
  1767. Set method to specify band-width of filter.
  1768. @table @option
  1769. @item h
  1770. Hz
  1771. @item q
  1772. Q-Factor
  1773. @item o
  1774. octave
  1775. @item s
  1776. slope
  1777. @item k
  1778. kHz
  1779. @end table
  1780. @item width, w
  1781. Specify the band-width of a filter in width_type units.
  1782. @item channels, c
  1783. Specify which channels to filter, by default all available are filtered.
  1784. @end table
  1785. @subsection Commands
  1786. This filter supports the following commands:
  1787. @table @option
  1788. @item frequency, f
  1789. Change bandreject frequency.
  1790. Syntax for the command is : "@var{frequency}"
  1791. @item width_type, t
  1792. Change bandreject width_type.
  1793. Syntax for the command is : "@var{width_type}"
  1794. @item width, w
  1795. Change bandreject width.
  1796. Syntax for the command is : "@var{width}"
  1797. @end table
  1798. @section bass, lowshelf
  1799. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1800. shelving filter with a response similar to that of a standard
  1801. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1802. The filter accepts the following options:
  1803. @table @option
  1804. @item gain, g
  1805. Give the gain at 0 Hz. Its useful range is about -20
  1806. (for a large cut) to +20 (for a large boost).
  1807. Beware of clipping when using a positive gain.
  1808. @item frequency, f
  1809. Set the filter's central frequency and so can be used
  1810. to extend or reduce the frequency range to be boosted or cut.
  1811. The default value is @code{100} Hz.
  1812. @item width_type, t
  1813. Set method to specify band-width of filter.
  1814. @table @option
  1815. @item h
  1816. Hz
  1817. @item q
  1818. Q-Factor
  1819. @item o
  1820. octave
  1821. @item s
  1822. slope
  1823. @item k
  1824. kHz
  1825. @end table
  1826. @item width, w
  1827. Determine how steep is the filter's shelf transition.
  1828. @item channels, c
  1829. Specify which channels to filter, by default all available are filtered.
  1830. @end table
  1831. @subsection Commands
  1832. This filter supports the following commands:
  1833. @table @option
  1834. @item frequency, f
  1835. Change bass frequency.
  1836. Syntax for the command is : "@var{frequency}"
  1837. @item width_type, t
  1838. Change bass width_type.
  1839. Syntax for the command is : "@var{width_type}"
  1840. @item width, w
  1841. Change bass width.
  1842. Syntax for the command is : "@var{width}"
  1843. @item gain, g
  1844. Change bass gain.
  1845. Syntax for the command is : "@var{gain}"
  1846. @end table
  1847. @section biquad
  1848. Apply a biquad IIR filter with the given coefficients.
  1849. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1850. are the numerator and denominator coefficients respectively.
  1851. and @var{channels}, @var{c} specify which channels to filter, by default all
  1852. available are filtered.
  1853. @subsection Commands
  1854. This filter supports the following commands:
  1855. @table @option
  1856. @item a0
  1857. @item a1
  1858. @item a2
  1859. @item b0
  1860. @item b1
  1861. @item b2
  1862. Change biquad parameter.
  1863. Syntax for the command is : "@var{value}"
  1864. @end table
  1865. @section bs2b
  1866. Bauer stereo to binaural transformation, which improves headphone listening of
  1867. stereo audio records.
  1868. To enable compilation of this filter you need to configure FFmpeg with
  1869. @code{--enable-libbs2b}.
  1870. It accepts the following parameters:
  1871. @table @option
  1872. @item profile
  1873. Pre-defined crossfeed level.
  1874. @table @option
  1875. @item default
  1876. Default level (fcut=700, feed=50).
  1877. @item cmoy
  1878. Chu Moy circuit (fcut=700, feed=60).
  1879. @item jmeier
  1880. Jan Meier circuit (fcut=650, feed=95).
  1881. @end table
  1882. @item fcut
  1883. Cut frequency (in Hz).
  1884. @item feed
  1885. Feed level (in Hz).
  1886. @end table
  1887. @section channelmap
  1888. Remap input channels to new locations.
  1889. It accepts the following parameters:
  1890. @table @option
  1891. @item map
  1892. Map channels from input to output. The argument is a '|'-separated list of
  1893. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1894. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1895. channel (e.g. FL for front left) or its index in the input channel layout.
  1896. @var{out_channel} is the name of the output channel or its index in the output
  1897. channel layout. If @var{out_channel} is not given then it is implicitly an
  1898. index, starting with zero and increasing by one for each mapping.
  1899. @item channel_layout
  1900. The channel layout of the output stream.
  1901. @end table
  1902. If no mapping is present, the filter will implicitly map input channels to
  1903. output channels, preserving indices.
  1904. @subsection Examples
  1905. @itemize
  1906. @item
  1907. For example, assuming a 5.1+downmix input MOV file,
  1908. @example
  1909. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1910. @end example
  1911. will create an output WAV file tagged as stereo from the downmix channels of
  1912. the input.
  1913. @item
  1914. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1915. @example
  1916. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1917. @end example
  1918. @end itemize
  1919. @section channelsplit
  1920. Split each channel from an input audio stream into a separate output stream.
  1921. It accepts the following parameters:
  1922. @table @option
  1923. @item channel_layout
  1924. The channel layout of the input stream. The default is "stereo".
  1925. @item channels
  1926. A channel layout describing the channels to be extracted as separate output streams
  1927. or "all" to extract each input channel as a separate stream. The default is "all".
  1928. Choosing channels not present in channel layout in the input will result in an error.
  1929. @end table
  1930. @subsection Examples
  1931. @itemize
  1932. @item
  1933. For example, assuming a stereo input MP3 file,
  1934. @example
  1935. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1936. @end example
  1937. will create an output Matroska file with two audio streams, one containing only
  1938. the left channel and the other the right channel.
  1939. @item
  1940. Split a 5.1 WAV file into per-channel files:
  1941. @example
  1942. ffmpeg -i in.wav -filter_complex
  1943. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1944. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1945. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1946. side_right.wav
  1947. @end example
  1948. @item
  1949. Extract only LFE from a 5.1 WAV file:
  1950. @example
  1951. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1952. -map '[LFE]' lfe.wav
  1953. @end example
  1954. @end itemize
  1955. @section chorus
  1956. Add a chorus effect to the audio.
  1957. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1958. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1959. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1960. The modulation depth defines the range the modulated delay is played before or after
  1961. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1962. sound tuned around the original one, like in a chorus where some vocals are slightly
  1963. off key.
  1964. It accepts the following parameters:
  1965. @table @option
  1966. @item in_gain
  1967. Set input gain. Default is 0.4.
  1968. @item out_gain
  1969. Set output gain. Default is 0.4.
  1970. @item delays
  1971. Set delays. A typical delay is around 40ms to 60ms.
  1972. @item decays
  1973. Set decays.
  1974. @item speeds
  1975. Set speeds.
  1976. @item depths
  1977. Set depths.
  1978. @end table
  1979. @subsection Examples
  1980. @itemize
  1981. @item
  1982. A single delay:
  1983. @example
  1984. chorus=0.7:0.9:55:0.4:0.25:2
  1985. @end example
  1986. @item
  1987. Two delays:
  1988. @example
  1989. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1990. @end example
  1991. @item
  1992. Fuller sounding chorus with three delays:
  1993. @example
  1994. 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
  1995. @end example
  1996. @end itemize
  1997. @section compand
  1998. Compress or expand the audio's dynamic range.
  1999. It accepts the following parameters:
  2000. @table @option
  2001. @item attacks
  2002. @item decays
  2003. A list of times in seconds for each channel over which the instantaneous level
  2004. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2005. increase of volume and @var{decays} refers to decrease of volume. For most
  2006. situations, the attack time (response to the audio getting louder) should be
  2007. shorter than the decay time, because the human ear is more sensitive to sudden
  2008. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2009. a typical value for decay is 0.8 seconds.
  2010. If specified number of attacks & decays is lower than number of channels, the last
  2011. set attack/decay will be used for all remaining channels.
  2012. @item points
  2013. A list of points for the transfer function, specified in dB relative to the
  2014. maximum possible signal amplitude. Each key points list must be defined using
  2015. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2016. @code{x0/y0 x1/y1 x2/y2 ....}
  2017. The input values must be in strictly increasing order but the transfer function
  2018. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2019. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2020. function are @code{-70/-70|-60/-20|1/0}.
  2021. @item soft-knee
  2022. Set the curve radius in dB for all joints. It defaults to 0.01.
  2023. @item gain
  2024. Set the additional gain in dB to be applied at all points on the transfer
  2025. function. This allows for easy adjustment of the overall gain.
  2026. It defaults to 0.
  2027. @item volume
  2028. Set an initial volume, in dB, to be assumed for each channel when filtering
  2029. starts. This permits the user to supply a nominal level initially, so that, for
  2030. example, a very large gain is not applied to initial signal levels before the
  2031. companding has begun to operate. A typical value for audio which is initially
  2032. quiet is -90 dB. It defaults to 0.
  2033. @item delay
  2034. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2035. delayed before being fed to the volume adjuster. Specifying a delay
  2036. approximately equal to the attack/decay times allows the filter to effectively
  2037. operate in predictive rather than reactive mode. It defaults to 0.
  2038. @end table
  2039. @subsection Examples
  2040. @itemize
  2041. @item
  2042. Make music with both quiet and loud passages suitable for listening to in a
  2043. noisy environment:
  2044. @example
  2045. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2046. @end example
  2047. Another example for audio with whisper and explosion parts:
  2048. @example
  2049. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2050. @end example
  2051. @item
  2052. A noise gate for when the noise is at a lower level than the signal:
  2053. @example
  2054. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2055. @end example
  2056. @item
  2057. Here is another noise gate, this time for when the noise is at a higher level
  2058. than the signal (making it, in some ways, similar to squelch):
  2059. @example
  2060. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2061. @end example
  2062. @item
  2063. 2:1 compression starting at -6dB:
  2064. @example
  2065. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2066. @end example
  2067. @item
  2068. 2:1 compression starting at -9dB:
  2069. @example
  2070. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2071. @end example
  2072. @item
  2073. 2:1 compression starting at -12dB:
  2074. @example
  2075. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2076. @end example
  2077. @item
  2078. 2:1 compression starting at -18dB:
  2079. @example
  2080. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2081. @end example
  2082. @item
  2083. 3:1 compression starting at -15dB:
  2084. @example
  2085. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2086. @end example
  2087. @item
  2088. Compressor/Gate:
  2089. @example
  2090. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2091. @end example
  2092. @item
  2093. Expander:
  2094. @example
  2095. 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
  2096. @end example
  2097. @item
  2098. Hard limiter at -6dB:
  2099. @example
  2100. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2101. @end example
  2102. @item
  2103. Hard limiter at -12dB:
  2104. @example
  2105. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2106. @end example
  2107. @item
  2108. Hard noise gate at -35 dB:
  2109. @example
  2110. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2111. @end example
  2112. @item
  2113. Soft limiter:
  2114. @example
  2115. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2116. @end example
  2117. @end itemize
  2118. @section compensationdelay
  2119. Compensation Delay Line is a metric based delay to compensate differing
  2120. positions of microphones or speakers.
  2121. For example, you have recorded guitar with two microphones placed in
  2122. different location. Because the front of sound wave has fixed speed in
  2123. normal conditions, the phasing of microphones can vary and depends on
  2124. their location and interposition. The best sound mix can be achieved when
  2125. these microphones are in phase (synchronized). Note that distance of
  2126. ~30 cm between microphones makes one microphone to capture signal in
  2127. antiphase to another microphone. That makes the final mix sounding moody.
  2128. This filter helps to solve phasing problems by adding different delays
  2129. to each microphone track and make them synchronized.
  2130. The best result can be reached when you take one track as base and
  2131. synchronize other tracks one by one with it.
  2132. Remember that synchronization/delay tolerance depends on sample rate, too.
  2133. Higher sample rates will give more tolerance.
  2134. It accepts the following parameters:
  2135. @table @option
  2136. @item mm
  2137. Set millimeters distance. This is compensation distance for fine tuning.
  2138. Default is 0.
  2139. @item cm
  2140. Set cm distance. This is compensation distance for tightening distance setup.
  2141. Default is 0.
  2142. @item m
  2143. Set meters distance. This is compensation distance for hard distance setup.
  2144. Default is 0.
  2145. @item dry
  2146. Set dry amount. Amount of unprocessed (dry) signal.
  2147. Default is 0.
  2148. @item wet
  2149. Set wet amount. Amount of processed (wet) signal.
  2150. Default is 1.
  2151. @item temp
  2152. Set temperature degree in Celsius. This is the temperature of the environment.
  2153. Default is 20.
  2154. @end table
  2155. @section crossfeed
  2156. Apply headphone crossfeed filter.
  2157. Crossfeed is the process of blending the left and right channels of stereo
  2158. audio recording.
  2159. It is mainly used to reduce extreme stereo separation of low frequencies.
  2160. The intent is to produce more speaker like sound to the listener.
  2161. The filter accepts the following options:
  2162. @table @option
  2163. @item strength
  2164. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2165. This sets gain of low shelf filter for side part of stereo image.
  2166. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2167. @item range
  2168. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2169. This sets cut off frequency of low shelf filter. Default is cut off near
  2170. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2171. @item level_in
  2172. Set input gain. Default is 0.9.
  2173. @item level_out
  2174. Set output gain. Default is 1.
  2175. @end table
  2176. @section crystalizer
  2177. Simple algorithm to expand audio dynamic range.
  2178. The filter accepts the following options:
  2179. @table @option
  2180. @item i
  2181. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2182. (unchanged sound) to 10.0 (maximum effect).
  2183. @item c
  2184. Enable clipping. By default is enabled.
  2185. @end table
  2186. @section dcshift
  2187. Apply a DC shift to the audio.
  2188. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2189. in the recording chain) from the audio. The effect of a DC offset is reduced
  2190. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2191. a signal has a DC offset.
  2192. @table @option
  2193. @item shift
  2194. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2195. the audio.
  2196. @item limitergain
  2197. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2198. used to prevent clipping.
  2199. @end table
  2200. @section drmeter
  2201. Measure audio dynamic range.
  2202. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2203. is found in transition material. And anything less that 8 have very poor dynamics
  2204. and is very compressed.
  2205. The filter accepts the following options:
  2206. @table @option
  2207. @item length
  2208. Set window length in seconds used to split audio into segments of equal length.
  2209. Default is 3 seconds.
  2210. @end table
  2211. @section dynaudnorm
  2212. Dynamic Audio Normalizer.
  2213. This filter applies a certain amount of gain to the input audio in order
  2214. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2215. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2216. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2217. This allows for applying extra gain to the "quiet" sections of the audio
  2218. while avoiding distortions or clipping the "loud" sections. In other words:
  2219. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2220. sections, in the sense that the volume of each section is brought to the
  2221. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2222. this goal *without* applying "dynamic range compressing". It will retain 100%
  2223. of the dynamic range *within* each section of the audio file.
  2224. @table @option
  2225. @item f
  2226. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2227. Default is 500 milliseconds.
  2228. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2229. referred to as frames. This is required, because a peak magnitude has no
  2230. meaning for just a single sample value. Instead, we need to determine the
  2231. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2232. normalizer would simply use the peak magnitude of the complete file, the
  2233. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2234. frame. The length of a frame is specified in milliseconds. By default, the
  2235. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2236. been found to give good results with most files.
  2237. Note that the exact frame length, in number of samples, will be determined
  2238. automatically, based on the sampling rate of the individual input audio file.
  2239. @item g
  2240. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2241. number. Default is 31.
  2242. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2243. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2244. is specified in frames, centered around the current frame. For the sake of
  2245. simplicity, this must be an odd number. Consequently, the default value of 31
  2246. takes into account the current frame, as well as the 15 preceding frames and
  2247. the 15 subsequent frames. Using a larger window results in a stronger
  2248. smoothing effect and thus in less gain variation, i.e. slower gain
  2249. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2250. effect and thus in more gain variation, i.e. faster gain adaptation.
  2251. In other words, the more you increase this value, the more the Dynamic Audio
  2252. Normalizer will behave like a "traditional" normalization filter. On the
  2253. contrary, the more you decrease this value, the more the Dynamic Audio
  2254. Normalizer will behave like a dynamic range compressor.
  2255. @item p
  2256. Set the target peak value. This specifies the highest permissible magnitude
  2257. level for the normalized audio input. This filter will try to approach the
  2258. target peak magnitude as closely as possible, but at the same time it also
  2259. makes sure that the normalized signal will never exceed the peak magnitude.
  2260. A frame's maximum local gain factor is imposed directly by the target peak
  2261. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2262. It is not recommended to go above this value.
  2263. @item m
  2264. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2265. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2266. factor for each input frame, i.e. the maximum gain factor that does not
  2267. result in clipping or distortion. The maximum gain factor is determined by
  2268. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2269. additionally bounds the frame's maximum gain factor by a predetermined
  2270. (global) maximum gain factor. This is done in order to avoid excessive gain
  2271. factors in "silent" or almost silent frames. By default, the maximum gain
  2272. factor is 10.0, For most inputs the default value should be sufficient and
  2273. it usually is not recommended to increase this value. Though, for input
  2274. with an extremely low overall volume level, it may be necessary to allow even
  2275. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2276. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2277. Instead, a "sigmoid" threshold function will be applied. This way, the
  2278. gain factors will smoothly approach the threshold value, but never exceed that
  2279. value.
  2280. @item r
  2281. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2282. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2283. This means that the maximum local gain factor for each frame is defined
  2284. (only) by the frame's highest magnitude sample. This way, the samples can
  2285. be amplified as much as possible without exceeding the maximum signal
  2286. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2287. Normalizer can also take into account the frame's root mean square,
  2288. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2289. determine the power of a time-varying signal. It is therefore considered
  2290. that the RMS is a better approximation of the "perceived loudness" than
  2291. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2292. frames to a constant RMS value, a uniform "perceived loudness" can be
  2293. established. If a target RMS value has been specified, a frame's local gain
  2294. factor is defined as the factor that would result in exactly that RMS value.
  2295. Note, however, that the maximum local gain factor is still restricted by the
  2296. frame's highest magnitude sample, in order to prevent clipping.
  2297. @item n
  2298. Enable channels coupling. By default is enabled.
  2299. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2300. amount. This means the same gain factor will be applied to all channels, i.e.
  2301. the maximum possible gain factor is determined by the "loudest" channel.
  2302. However, in some recordings, it may happen that the volume of the different
  2303. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2304. In this case, this option can be used to disable the channel coupling. This way,
  2305. the gain factor will be determined independently for each channel, depending
  2306. only on the individual channel's highest magnitude sample. This allows for
  2307. harmonizing the volume of the different channels.
  2308. @item c
  2309. Enable DC bias correction. By default is disabled.
  2310. An audio signal (in the time domain) is a sequence of sample values.
  2311. In the Dynamic Audio Normalizer these sample values are represented in the
  2312. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2313. audio signal, or "waveform", should be centered around the zero point.
  2314. That means if we calculate the mean value of all samples in a file, or in a
  2315. single frame, then the result should be 0.0 or at least very close to that
  2316. value. If, however, there is a significant deviation of the mean value from
  2317. 0.0, in either positive or negative direction, this is referred to as a
  2318. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2319. Audio Normalizer provides optional DC bias correction.
  2320. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2321. the mean value, or "DC correction" offset, of each input frame and subtract
  2322. that value from all of the frame's sample values which ensures those samples
  2323. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2324. boundaries, the DC correction offset values will be interpolated smoothly
  2325. between neighbouring frames.
  2326. @item b
  2327. Enable alternative boundary mode. By default is disabled.
  2328. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2329. around each frame. This includes the preceding frames as well as the
  2330. subsequent frames. However, for the "boundary" frames, located at the very
  2331. beginning and at the very end of the audio file, not all neighbouring
  2332. frames are available. In particular, for the first few frames in the audio
  2333. file, the preceding frames are not known. And, similarly, for the last few
  2334. frames in the audio file, the subsequent frames are not known. Thus, the
  2335. question arises which gain factors should be assumed for the missing frames
  2336. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2337. to deal with this situation. The default boundary mode assumes a gain factor
  2338. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2339. "fade out" at the beginning and at the end of the input, respectively.
  2340. @item s
  2341. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2342. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2343. compression. This means that signal peaks will not be pruned and thus the
  2344. full dynamic range will be retained within each local neighbourhood. However,
  2345. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2346. normalization algorithm with a more "traditional" compression.
  2347. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2348. (thresholding) function. If (and only if) the compression feature is enabled,
  2349. all input frames will be processed by a soft knee thresholding function prior
  2350. to the actual normalization process. Put simply, the thresholding function is
  2351. going to prune all samples whose magnitude exceeds a certain threshold value.
  2352. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2353. value. Instead, the threshold value will be adjusted for each individual
  2354. frame.
  2355. In general, smaller parameters result in stronger compression, and vice versa.
  2356. Values below 3.0 are not recommended, because audible distortion may appear.
  2357. @end table
  2358. @section earwax
  2359. Make audio easier to listen to on headphones.
  2360. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2361. so that when listened to on headphones the stereo image is moved from
  2362. inside your head (standard for headphones) to outside and in front of
  2363. the listener (standard for speakers).
  2364. Ported from SoX.
  2365. @section equalizer
  2366. Apply a two-pole peaking equalisation (EQ) filter. With this
  2367. filter, the signal-level at and around a selected frequency can
  2368. be increased or decreased, whilst (unlike bandpass and bandreject
  2369. filters) that at all other frequencies is unchanged.
  2370. In order to produce complex equalisation curves, this filter can
  2371. be given several times, each with a different central frequency.
  2372. The filter accepts the following options:
  2373. @table @option
  2374. @item frequency, f
  2375. Set the filter's central frequency in Hz.
  2376. @item width_type, t
  2377. Set method to specify band-width of filter.
  2378. @table @option
  2379. @item h
  2380. Hz
  2381. @item q
  2382. Q-Factor
  2383. @item o
  2384. octave
  2385. @item s
  2386. slope
  2387. @item k
  2388. kHz
  2389. @end table
  2390. @item width, w
  2391. Specify the band-width of a filter in width_type units.
  2392. @item gain, g
  2393. Set the required gain or attenuation in dB.
  2394. Beware of clipping when using a positive gain.
  2395. @item channels, c
  2396. Specify which channels to filter, by default all available are filtered.
  2397. @end table
  2398. @subsection Examples
  2399. @itemize
  2400. @item
  2401. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2402. @example
  2403. equalizer=f=1000:t=h:width=200:g=-10
  2404. @end example
  2405. @item
  2406. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2407. @example
  2408. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2409. @end example
  2410. @end itemize
  2411. @subsection Commands
  2412. This filter supports the following commands:
  2413. @table @option
  2414. @item frequency, f
  2415. Change equalizer frequency.
  2416. Syntax for the command is : "@var{frequency}"
  2417. @item width_type, t
  2418. Change equalizer width_type.
  2419. Syntax for the command is : "@var{width_type}"
  2420. @item width, w
  2421. Change equalizer width.
  2422. Syntax for the command is : "@var{width}"
  2423. @item gain, g
  2424. Change equalizer gain.
  2425. Syntax for the command is : "@var{gain}"
  2426. @end table
  2427. @section extrastereo
  2428. Linearly increases the difference between left and right channels which
  2429. adds some sort of "live" effect to playback.
  2430. The filter accepts the following options:
  2431. @table @option
  2432. @item m
  2433. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2434. (average of both channels), with 1.0 sound will be unchanged, with
  2435. -1.0 left and right channels will be swapped.
  2436. @item c
  2437. Enable clipping. By default is enabled.
  2438. @end table
  2439. @section firequalizer
  2440. Apply FIR Equalization using arbitrary frequency response.
  2441. The filter accepts the following option:
  2442. @table @option
  2443. @item gain
  2444. Set gain curve equation (in dB). The expression can contain variables:
  2445. @table @option
  2446. @item f
  2447. the evaluated frequency
  2448. @item sr
  2449. sample rate
  2450. @item ch
  2451. channel number, set to 0 when multichannels evaluation is disabled
  2452. @item chid
  2453. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2454. multichannels evaluation is disabled
  2455. @item chs
  2456. number of channels
  2457. @item chlayout
  2458. channel_layout, see libavutil/channel_layout.h
  2459. @end table
  2460. and functions:
  2461. @table @option
  2462. @item gain_interpolate(f)
  2463. interpolate gain on frequency f based on gain_entry
  2464. @item cubic_interpolate(f)
  2465. same as gain_interpolate, but smoother
  2466. @end table
  2467. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2468. @item gain_entry
  2469. Set gain entry for gain_interpolate function. The expression can
  2470. contain functions:
  2471. @table @option
  2472. @item entry(f, g)
  2473. store gain entry at frequency f with value g
  2474. @end table
  2475. This option is also available as command.
  2476. @item delay
  2477. Set filter delay in seconds. Higher value means more accurate.
  2478. Default is @code{0.01}.
  2479. @item accuracy
  2480. Set filter accuracy in Hz. Lower value means more accurate.
  2481. Default is @code{5}.
  2482. @item wfunc
  2483. Set window function. Acceptable values are:
  2484. @table @option
  2485. @item rectangular
  2486. rectangular window, useful when gain curve is already smooth
  2487. @item hann
  2488. hann window (default)
  2489. @item hamming
  2490. hamming window
  2491. @item blackman
  2492. blackman window
  2493. @item nuttall3
  2494. 3-terms continuous 1st derivative nuttall window
  2495. @item mnuttall3
  2496. minimum 3-terms discontinuous nuttall window
  2497. @item nuttall
  2498. 4-terms continuous 1st derivative nuttall window
  2499. @item bnuttall
  2500. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2501. @item bharris
  2502. blackman-harris window
  2503. @item tukey
  2504. tukey window
  2505. @end table
  2506. @item fixed
  2507. If enabled, use fixed number of audio samples. This improves speed when
  2508. filtering with large delay. Default is disabled.
  2509. @item multi
  2510. Enable multichannels evaluation on gain. Default is disabled.
  2511. @item zero_phase
  2512. Enable zero phase mode by subtracting timestamp to compensate delay.
  2513. Default is disabled.
  2514. @item scale
  2515. Set scale used by gain. Acceptable values are:
  2516. @table @option
  2517. @item linlin
  2518. linear frequency, linear gain
  2519. @item linlog
  2520. linear frequency, logarithmic (in dB) gain (default)
  2521. @item loglin
  2522. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2523. @item loglog
  2524. logarithmic frequency, logarithmic gain
  2525. @end table
  2526. @item dumpfile
  2527. Set file for dumping, suitable for gnuplot.
  2528. @item dumpscale
  2529. Set scale for dumpfile. Acceptable values are same with scale option.
  2530. Default is linlog.
  2531. @item fft2
  2532. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2533. Default is disabled.
  2534. @item min_phase
  2535. Enable minimum phase impulse response. Default is disabled.
  2536. @end table
  2537. @subsection Examples
  2538. @itemize
  2539. @item
  2540. lowpass at 1000 Hz:
  2541. @example
  2542. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2543. @end example
  2544. @item
  2545. lowpass at 1000 Hz with gain_entry:
  2546. @example
  2547. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2548. @end example
  2549. @item
  2550. custom equalization:
  2551. @example
  2552. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2553. @end example
  2554. @item
  2555. higher delay with zero phase to compensate delay:
  2556. @example
  2557. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2558. @end example
  2559. @item
  2560. lowpass on left channel, highpass on right channel:
  2561. @example
  2562. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2563. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2564. @end example
  2565. @end itemize
  2566. @section flanger
  2567. Apply a flanging effect to the audio.
  2568. The filter accepts the following options:
  2569. @table @option
  2570. @item delay
  2571. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2572. @item depth
  2573. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2574. @item regen
  2575. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2576. Default value is 0.
  2577. @item width
  2578. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2579. Default value is 71.
  2580. @item speed
  2581. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2582. @item shape
  2583. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2584. Default value is @var{sinusoidal}.
  2585. @item phase
  2586. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2587. Default value is 25.
  2588. @item interp
  2589. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2590. Default is @var{linear}.
  2591. @end table
  2592. @section haas
  2593. Apply Haas effect to audio.
  2594. Note that this makes most sense to apply on mono signals.
  2595. With this filter applied to mono signals it give some directionality and
  2596. stretches its stereo image.
  2597. The filter accepts the following options:
  2598. @table @option
  2599. @item level_in
  2600. Set input level. By default is @var{1}, or 0dB
  2601. @item level_out
  2602. Set output level. By default is @var{1}, or 0dB.
  2603. @item side_gain
  2604. Set gain applied to side part of signal. By default is @var{1}.
  2605. @item middle_source
  2606. Set kind of middle source. Can be one of the following:
  2607. @table @samp
  2608. @item left
  2609. Pick left channel.
  2610. @item right
  2611. Pick right channel.
  2612. @item mid
  2613. Pick middle part signal of stereo image.
  2614. @item side
  2615. Pick side part signal of stereo image.
  2616. @end table
  2617. @item middle_phase
  2618. Change middle phase. By default is disabled.
  2619. @item left_delay
  2620. Set left channel delay. By default is @var{2.05} milliseconds.
  2621. @item left_balance
  2622. Set left channel balance. By default is @var{-1}.
  2623. @item left_gain
  2624. Set left channel gain. By default is @var{1}.
  2625. @item left_phase
  2626. Change left phase. By default is disabled.
  2627. @item right_delay
  2628. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2629. @item right_balance
  2630. Set right channel balance. By default is @var{1}.
  2631. @item right_gain
  2632. Set right channel gain. By default is @var{1}.
  2633. @item right_phase
  2634. Change right phase. By default is enabled.
  2635. @end table
  2636. @section hdcd
  2637. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2638. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2639. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2640. of HDCD, and detects the Transient Filter flag.
  2641. @example
  2642. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2643. @end example
  2644. When using the filter with wav, note the default encoding for wav is 16-bit,
  2645. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2646. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2647. @example
  2648. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2649. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2650. @end example
  2651. The filter accepts the following options:
  2652. @table @option
  2653. @item disable_autoconvert
  2654. Disable any automatic format conversion or resampling in the filter graph.
  2655. @item process_stereo
  2656. Process the stereo channels together. If target_gain does not match between
  2657. channels, consider it invalid and use the last valid target_gain.
  2658. @item cdt_ms
  2659. Set the code detect timer period in ms.
  2660. @item force_pe
  2661. Always extend peaks above -3dBFS even if PE isn't signaled.
  2662. @item analyze_mode
  2663. Replace audio with a solid tone and adjust the amplitude to signal some
  2664. specific aspect of the decoding process. The output file can be loaded in
  2665. an audio editor alongside the original to aid analysis.
  2666. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2667. Modes are:
  2668. @table @samp
  2669. @item 0, off
  2670. Disabled
  2671. @item 1, lle
  2672. Gain adjustment level at each sample
  2673. @item 2, pe
  2674. Samples where peak extend occurs
  2675. @item 3, cdt
  2676. Samples where the code detect timer is active
  2677. @item 4, tgm
  2678. Samples where the target gain does not match between channels
  2679. @end table
  2680. @end table
  2681. @section headphone
  2682. Apply head-related transfer functions (HRTFs) to create virtual
  2683. loudspeakers around the user for binaural listening via headphones.
  2684. The HRIRs are provided via additional streams, for each channel
  2685. one stereo input stream is needed.
  2686. The filter accepts the following options:
  2687. @table @option
  2688. @item map
  2689. Set mapping of input streams for convolution.
  2690. The argument is a '|'-separated list of channel names in order as they
  2691. are given as additional stream inputs for filter.
  2692. This also specify number of input streams. Number of input streams
  2693. must be not less than number of channels in first stream plus one.
  2694. @item gain
  2695. Set gain applied to audio. Value is in dB. Default is 0.
  2696. @item type
  2697. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2698. processing audio in time domain which is slow.
  2699. @var{freq} is processing audio in frequency domain which is fast.
  2700. Default is @var{freq}.
  2701. @item lfe
  2702. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2703. @item size
  2704. Set size of frame in number of samples which will be processed at once.
  2705. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2706. @item hrir
  2707. Set format of hrir stream.
  2708. Default value is @var{stereo}. Alternative value is @var{multich}.
  2709. If value is set to @var{stereo}, number of additional streams should
  2710. be greater or equal to number of input channels in first input stream.
  2711. Also each additional stream should have stereo number of channels.
  2712. If value is set to @var{multich}, number of additional streams should
  2713. be exactly one. Also number of input channels of additional stream
  2714. should be equal or greater than twice number of channels of first input
  2715. stream.
  2716. @end table
  2717. @subsection Examples
  2718. @itemize
  2719. @item
  2720. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2721. each amovie filter use stereo file with IR coefficients as input.
  2722. The files give coefficients for each position of virtual loudspeaker:
  2723. @example
  2724. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2725. output.wav
  2726. @end example
  2727. @item
  2728. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2729. but now in @var{multich} @var{hrir} format.
  2730. @example
  2731. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2732. output.wav
  2733. @end example
  2734. @end itemize
  2735. @section highpass
  2736. Apply a high-pass filter with 3dB point frequency.
  2737. The filter can be either single-pole, or double-pole (the default).
  2738. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2739. The filter accepts the following options:
  2740. @table @option
  2741. @item frequency, f
  2742. Set frequency in Hz. Default is 3000.
  2743. @item poles, p
  2744. Set number of poles. Default is 2.
  2745. @item width_type, t
  2746. Set method to specify band-width of filter.
  2747. @table @option
  2748. @item h
  2749. Hz
  2750. @item q
  2751. Q-Factor
  2752. @item o
  2753. octave
  2754. @item s
  2755. slope
  2756. @item k
  2757. kHz
  2758. @end table
  2759. @item width, w
  2760. Specify the band-width of a filter in width_type units.
  2761. Applies only to double-pole filter.
  2762. The default is 0.707q and gives a Butterworth response.
  2763. @item channels, c
  2764. Specify which channels to filter, by default all available are filtered.
  2765. @end table
  2766. @subsection Commands
  2767. This filter supports the following commands:
  2768. @table @option
  2769. @item frequency, f
  2770. Change highpass frequency.
  2771. Syntax for the command is : "@var{frequency}"
  2772. @item width_type, t
  2773. Change highpass width_type.
  2774. Syntax for the command is : "@var{width_type}"
  2775. @item width, w
  2776. Change highpass width.
  2777. Syntax for the command is : "@var{width}"
  2778. @end table
  2779. @section join
  2780. Join multiple input streams into one multi-channel stream.
  2781. It accepts the following parameters:
  2782. @table @option
  2783. @item inputs
  2784. The number of input streams. It defaults to 2.
  2785. @item channel_layout
  2786. The desired output channel layout. It defaults to stereo.
  2787. @item map
  2788. Map channels from inputs to output. The argument is a '|'-separated list of
  2789. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2790. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2791. can be either the name of the input channel (e.g. FL for front left) or its
  2792. index in the specified input stream. @var{out_channel} is the name of the output
  2793. channel.
  2794. @end table
  2795. The filter will attempt to guess the mappings when they are not specified
  2796. explicitly. It does so by first trying to find an unused matching input channel
  2797. and if that fails it picks the first unused input channel.
  2798. Join 3 inputs (with properly set channel layouts):
  2799. @example
  2800. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2801. @end example
  2802. Build a 5.1 output from 6 single-channel streams:
  2803. @example
  2804. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2805. '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'
  2806. out
  2807. @end example
  2808. @section ladspa
  2809. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2810. To enable compilation of this filter you need to configure FFmpeg with
  2811. @code{--enable-ladspa}.
  2812. @table @option
  2813. @item file, f
  2814. Specifies the name of LADSPA plugin library to load. If the environment
  2815. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2816. each one of the directories specified by the colon separated list in
  2817. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2818. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2819. @file{/usr/lib/ladspa/}.
  2820. @item plugin, p
  2821. Specifies the plugin within the library. Some libraries contain only
  2822. one plugin, but others contain many of them. If this is not set filter
  2823. will list all available plugins within the specified library.
  2824. @item controls, c
  2825. Set the '|' separated list of controls which are zero or more floating point
  2826. values that determine the behavior of the loaded plugin (for example delay,
  2827. threshold or gain).
  2828. Controls need to be defined using the following syntax:
  2829. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2830. @var{valuei} is the value set on the @var{i}-th control.
  2831. Alternatively they can be also defined using the following syntax:
  2832. @var{value0}|@var{value1}|@var{value2}|..., where
  2833. @var{valuei} is the value set on the @var{i}-th control.
  2834. If @option{controls} is set to @code{help}, all available controls and
  2835. their valid ranges are printed.
  2836. @item sample_rate, s
  2837. Specify the sample rate, default to 44100. Only used if plugin have
  2838. zero inputs.
  2839. @item nb_samples, n
  2840. Set the number of samples per channel per each output frame, default
  2841. is 1024. Only used if plugin have zero inputs.
  2842. @item duration, d
  2843. Set the minimum duration of the sourced audio. See
  2844. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2845. for the accepted syntax.
  2846. Note that the resulting duration may be greater than the specified duration,
  2847. as the generated audio is always cut at the end of a complete frame.
  2848. If not specified, or the expressed duration is negative, the audio is
  2849. supposed to be generated forever.
  2850. Only used if plugin have zero inputs.
  2851. @end table
  2852. @subsection Examples
  2853. @itemize
  2854. @item
  2855. List all available plugins within amp (LADSPA example plugin) library:
  2856. @example
  2857. ladspa=file=amp
  2858. @end example
  2859. @item
  2860. List all available controls and their valid ranges for @code{vcf_notch}
  2861. plugin from @code{VCF} library:
  2862. @example
  2863. ladspa=f=vcf:p=vcf_notch:c=help
  2864. @end example
  2865. @item
  2866. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2867. plugin library:
  2868. @example
  2869. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2870. @end example
  2871. @item
  2872. Add reverberation to the audio using TAP-plugins
  2873. (Tom's Audio Processing plugins):
  2874. @example
  2875. ladspa=file=tap_reverb:tap_reverb
  2876. @end example
  2877. @item
  2878. Generate white noise, with 0.2 amplitude:
  2879. @example
  2880. ladspa=file=cmt:noise_source_white:c=c0=.2
  2881. @end example
  2882. @item
  2883. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2884. @code{C* Audio Plugin Suite} (CAPS) library:
  2885. @example
  2886. ladspa=file=caps:Click:c=c1=20'
  2887. @end example
  2888. @item
  2889. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2890. @example
  2891. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2892. @end example
  2893. @item
  2894. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2895. @code{SWH Plugins} collection:
  2896. @example
  2897. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2898. @end example
  2899. @item
  2900. Attenuate low frequencies using Multiband EQ from Steve Harris
  2901. @code{SWH Plugins} collection:
  2902. @example
  2903. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2904. @end example
  2905. @item
  2906. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2907. (CAPS) library:
  2908. @example
  2909. ladspa=caps:Narrower
  2910. @end example
  2911. @item
  2912. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2913. @example
  2914. ladspa=caps:White:.2
  2915. @end example
  2916. @item
  2917. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2918. @example
  2919. ladspa=caps:Fractal:c=c1=1
  2920. @end example
  2921. @item
  2922. Dynamic volume normalization using @code{VLevel} plugin:
  2923. @example
  2924. ladspa=vlevel-ladspa:vlevel_mono
  2925. @end example
  2926. @end itemize
  2927. @subsection Commands
  2928. This filter supports the following commands:
  2929. @table @option
  2930. @item cN
  2931. Modify the @var{N}-th control value.
  2932. If the specified value is not valid, it is ignored and prior one is kept.
  2933. @end table
  2934. @section loudnorm
  2935. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2936. Support for both single pass (livestreams, files) and double pass (files) modes.
  2937. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2938. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2939. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item I, i
  2943. Set integrated loudness target.
  2944. Range is -70.0 - -5.0. Default value is -24.0.
  2945. @item LRA, lra
  2946. Set loudness range target.
  2947. Range is 1.0 - 20.0. Default value is 7.0.
  2948. @item TP, tp
  2949. Set maximum true peak.
  2950. Range is -9.0 - +0.0. Default value is -2.0.
  2951. @item measured_I, measured_i
  2952. Measured IL of input file.
  2953. Range is -99.0 - +0.0.
  2954. @item measured_LRA, measured_lra
  2955. Measured LRA of input file.
  2956. Range is 0.0 - 99.0.
  2957. @item measured_TP, measured_tp
  2958. Measured true peak of input file.
  2959. Range is -99.0 - +99.0.
  2960. @item measured_thresh
  2961. Measured threshold of input file.
  2962. Range is -99.0 - +0.0.
  2963. @item offset
  2964. Set offset gain. Gain is applied before the true-peak limiter.
  2965. Range is -99.0 - +99.0. Default is +0.0.
  2966. @item linear
  2967. Normalize linearly if possible.
  2968. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2969. to be specified in order to use this mode.
  2970. Options are true or false. Default is true.
  2971. @item dual_mono
  2972. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2973. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2974. If set to @code{true}, this option will compensate for this effect.
  2975. Multi-channel input files are not affected by this option.
  2976. Options are true or false. Default is false.
  2977. @item print_format
  2978. Set print format for stats. Options are summary, json, or none.
  2979. Default value is none.
  2980. @end table
  2981. @section lowpass
  2982. Apply a low-pass filter with 3dB point frequency.
  2983. The filter can be either single-pole or double-pole (the default).
  2984. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2985. The filter accepts the following options:
  2986. @table @option
  2987. @item frequency, f
  2988. Set frequency in Hz. Default is 500.
  2989. @item poles, p
  2990. Set number of poles. Default is 2.
  2991. @item width_type, t
  2992. Set method to specify band-width of filter.
  2993. @table @option
  2994. @item h
  2995. Hz
  2996. @item q
  2997. Q-Factor
  2998. @item o
  2999. octave
  3000. @item s
  3001. slope
  3002. @item k
  3003. kHz
  3004. @end table
  3005. @item width, w
  3006. Specify the band-width of a filter in width_type units.
  3007. Applies only to double-pole filter.
  3008. The default is 0.707q and gives a Butterworth response.
  3009. @item channels, c
  3010. Specify which channels to filter, by default all available are filtered.
  3011. @end table
  3012. @subsection Examples
  3013. @itemize
  3014. @item
  3015. Lowpass only LFE channel, it LFE is not present it does nothing:
  3016. @example
  3017. lowpass=c=LFE
  3018. @end example
  3019. @end itemize
  3020. @subsection Commands
  3021. This filter supports the following commands:
  3022. @table @option
  3023. @item frequency, f
  3024. Change lowpass frequency.
  3025. Syntax for the command is : "@var{frequency}"
  3026. @item width_type, t
  3027. Change lowpass width_type.
  3028. Syntax for the command is : "@var{width_type}"
  3029. @item width, w
  3030. Change lowpass width.
  3031. Syntax for the command is : "@var{width}"
  3032. @end table
  3033. @section lv2
  3034. Load a LV2 (LADSPA Version 2) plugin.
  3035. To enable compilation of this filter you need to configure FFmpeg with
  3036. @code{--enable-lv2}.
  3037. @table @option
  3038. @item plugin, p
  3039. Specifies the plugin URI. You may need to escape ':'.
  3040. @item controls, c
  3041. Set the '|' separated list of controls which are zero or more floating point
  3042. values that determine the behavior of the loaded plugin (for example delay,
  3043. threshold or gain).
  3044. If @option{controls} is set to @code{help}, all available controls and
  3045. their valid ranges are printed.
  3046. @item sample_rate, s
  3047. Specify the sample rate, default to 44100. Only used if plugin have
  3048. zero inputs.
  3049. @item nb_samples, n
  3050. Set the number of samples per channel per each output frame, default
  3051. is 1024. Only used if plugin have zero inputs.
  3052. @item duration, d
  3053. Set the minimum duration of the sourced audio. See
  3054. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3055. for the accepted syntax.
  3056. Note that the resulting duration may be greater than the specified duration,
  3057. as the generated audio is always cut at the end of a complete frame.
  3058. If not specified, or the expressed duration is negative, the audio is
  3059. supposed to be generated forever.
  3060. Only used if plugin have zero inputs.
  3061. @end table
  3062. @subsection Examples
  3063. @itemize
  3064. @item
  3065. Apply bass enhancer plugin from Calf:
  3066. @example
  3067. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3068. @end example
  3069. @item
  3070. Apply vinyl plugin from Calf:
  3071. @example
  3072. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3073. @end example
  3074. @item
  3075. Apply bit crusher plugin from ArtyFX:
  3076. @example
  3077. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3078. @end example
  3079. @end itemize
  3080. @section mcompand
  3081. Multiband Compress or expand the audio's dynamic range.
  3082. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3083. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3084. response when absent compander action.
  3085. It accepts the following parameters:
  3086. @table @option
  3087. @item args
  3088. This option syntax is:
  3089. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3090. For explanation of each item refer to compand filter documentation.
  3091. @end table
  3092. @anchor{pan}
  3093. @section pan
  3094. Mix channels with specific gain levels. The filter accepts the output
  3095. channel layout followed by a set of channels definitions.
  3096. This filter is also designed to efficiently remap the channels of an audio
  3097. stream.
  3098. The filter accepts parameters of the form:
  3099. "@var{l}|@var{outdef}|@var{outdef}|..."
  3100. @table @option
  3101. @item l
  3102. output channel layout or number of channels
  3103. @item outdef
  3104. output channel specification, of the form:
  3105. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3106. @item out_name
  3107. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3108. number (c0, c1, etc.)
  3109. @item gain
  3110. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3111. @item in_name
  3112. input channel to use, see out_name for details; it is not possible to mix
  3113. named and numbered input channels
  3114. @end table
  3115. If the `=' in a channel specification is replaced by `<', then the gains for
  3116. that specification will be renormalized so that the total is 1, thus
  3117. avoiding clipping noise.
  3118. @subsection Mixing examples
  3119. For example, if you want to down-mix from stereo to mono, but with a bigger
  3120. factor for the left channel:
  3121. @example
  3122. pan=1c|c0=0.9*c0+0.1*c1
  3123. @end example
  3124. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3125. 7-channels surround:
  3126. @example
  3127. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3128. @end example
  3129. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3130. that should be preferred (see "-ac" option) unless you have very specific
  3131. needs.
  3132. @subsection Remapping examples
  3133. The channel remapping will be effective if, and only if:
  3134. @itemize
  3135. @item gain coefficients are zeroes or ones,
  3136. @item only one input per channel output,
  3137. @end itemize
  3138. If all these conditions are satisfied, the filter will notify the user ("Pure
  3139. channel mapping detected"), and use an optimized and lossless method to do the
  3140. remapping.
  3141. For example, if you have a 5.1 source and want a stereo audio stream by
  3142. dropping the extra channels:
  3143. @example
  3144. pan="stereo| c0=FL | c1=FR"
  3145. @end example
  3146. Given the same source, you can also switch front left and front right channels
  3147. and keep the input channel layout:
  3148. @example
  3149. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3150. @end example
  3151. If the input is a stereo audio stream, you can mute the front left channel (and
  3152. still keep the stereo channel layout) with:
  3153. @example
  3154. pan="stereo|c1=c1"
  3155. @end example
  3156. Still with a stereo audio stream input, you can copy the right channel in both
  3157. front left and right:
  3158. @example
  3159. pan="stereo| c0=FR | c1=FR"
  3160. @end example
  3161. @section replaygain
  3162. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3163. outputs it unchanged.
  3164. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3165. @section resample
  3166. Convert the audio sample format, sample rate and channel layout. It is
  3167. not meant to be used directly.
  3168. @section rubberband
  3169. Apply time-stretching and pitch-shifting with librubberband.
  3170. To enable compilation of this filter, you need to configure FFmpeg with
  3171. @code{--enable-librubberband}.
  3172. The filter accepts the following options:
  3173. @table @option
  3174. @item tempo
  3175. Set tempo scale factor.
  3176. @item pitch
  3177. Set pitch scale factor.
  3178. @item transients
  3179. Set transients detector.
  3180. Possible values are:
  3181. @table @var
  3182. @item crisp
  3183. @item mixed
  3184. @item smooth
  3185. @end table
  3186. @item detector
  3187. Set detector.
  3188. Possible values are:
  3189. @table @var
  3190. @item compound
  3191. @item percussive
  3192. @item soft
  3193. @end table
  3194. @item phase
  3195. Set phase.
  3196. Possible values are:
  3197. @table @var
  3198. @item laminar
  3199. @item independent
  3200. @end table
  3201. @item window
  3202. Set processing window size.
  3203. Possible values are:
  3204. @table @var
  3205. @item standard
  3206. @item short
  3207. @item long
  3208. @end table
  3209. @item smoothing
  3210. Set smoothing.
  3211. Possible values are:
  3212. @table @var
  3213. @item off
  3214. @item on
  3215. @end table
  3216. @item formant
  3217. Enable formant preservation when shift pitching.
  3218. Possible values are:
  3219. @table @var
  3220. @item shifted
  3221. @item preserved
  3222. @end table
  3223. @item pitchq
  3224. Set pitch quality.
  3225. Possible values are:
  3226. @table @var
  3227. @item quality
  3228. @item speed
  3229. @item consistency
  3230. @end table
  3231. @item channels
  3232. Set channels.
  3233. Possible values are:
  3234. @table @var
  3235. @item apart
  3236. @item together
  3237. @end table
  3238. @end table
  3239. @section sidechaincompress
  3240. This filter acts like normal compressor but has the ability to compress
  3241. detected signal using second input signal.
  3242. It needs two input streams and returns one output stream.
  3243. First input stream will be processed depending on second stream signal.
  3244. The filtered signal then can be filtered with other filters in later stages of
  3245. processing. See @ref{pan} and @ref{amerge} filter.
  3246. The filter accepts the following options:
  3247. @table @option
  3248. @item level_in
  3249. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3250. @item threshold
  3251. If a signal of second stream raises above this level it will affect the gain
  3252. reduction of first stream.
  3253. By default is 0.125. Range is between 0.00097563 and 1.
  3254. @item ratio
  3255. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3256. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3257. Default is 2. Range is between 1 and 20.
  3258. @item attack
  3259. Amount of milliseconds the signal has to rise above the threshold before gain
  3260. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3261. @item release
  3262. Amount of milliseconds the signal has to fall below the threshold before
  3263. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3264. @item makeup
  3265. Set the amount by how much signal will be amplified after processing.
  3266. Default is 1. Range is from 1 to 64.
  3267. @item knee
  3268. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3269. Default is 2.82843. Range is between 1 and 8.
  3270. @item link
  3271. Choose if the @code{average} level between all channels of side-chain stream
  3272. or the louder(@code{maximum}) channel of side-chain stream affects the
  3273. reduction. Default is @code{average}.
  3274. @item detection
  3275. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3276. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3277. @item level_sc
  3278. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3279. @item mix
  3280. How much to use compressed signal in output. Default is 1.
  3281. Range is between 0 and 1.
  3282. @end table
  3283. @subsection Examples
  3284. @itemize
  3285. @item
  3286. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3287. depending on the signal of 2nd input and later compressed signal to be
  3288. merged with 2nd input:
  3289. @example
  3290. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3291. @end example
  3292. @end itemize
  3293. @section sidechaingate
  3294. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3295. filter the detected signal before sending it to the gain reduction stage.
  3296. Normally a gate uses the full range signal to detect a level above the
  3297. threshold.
  3298. For example: If you cut all lower frequencies from your sidechain signal
  3299. the gate will decrease the volume of your track only if not enough highs
  3300. appear. With this technique you are able to reduce the resonation of a
  3301. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3302. guitar.
  3303. It needs two input streams and returns one output stream.
  3304. First input stream will be processed depending on second stream signal.
  3305. The filter accepts the following options:
  3306. @table @option
  3307. @item level_in
  3308. Set input level before filtering.
  3309. Default is 1. Allowed range is from 0.015625 to 64.
  3310. @item range
  3311. Set the level of gain reduction when the signal is below the threshold.
  3312. Default is 0.06125. Allowed range is from 0 to 1.
  3313. @item threshold
  3314. If a signal rises above this level the gain reduction is released.
  3315. Default is 0.125. Allowed range is from 0 to 1.
  3316. @item ratio
  3317. Set a ratio about which the signal is reduced.
  3318. Default is 2. Allowed range is from 1 to 9000.
  3319. @item attack
  3320. Amount of milliseconds the signal has to rise above the threshold before gain
  3321. reduction stops.
  3322. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3323. @item release
  3324. Amount of milliseconds the signal has to fall below the threshold before the
  3325. reduction is increased again. Default is 250 milliseconds.
  3326. Allowed range is from 0.01 to 9000.
  3327. @item makeup
  3328. Set amount of amplification of signal after processing.
  3329. Default is 1. Allowed range is from 1 to 64.
  3330. @item knee
  3331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3332. Default is 2.828427125. Allowed range is from 1 to 8.
  3333. @item detection
  3334. Choose if exact signal should be taken for detection or an RMS like one.
  3335. Default is rms. Can be peak or rms.
  3336. @item link
  3337. Choose if the average level between all channels or the louder channel affects
  3338. the reduction.
  3339. Default is average. Can be average or maximum.
  3340. @item level_sc
  3341. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3342. @end table
  3343. @section silencedetect
  3344. Detect silence in an audio stream.
  3345. This filter logs a message when it detects that the input audio volume is less
  3346. or equal to a noise tolerance value for a duration greater or equal to the
  3347. minimum detected noise duration.
  3348. The printed times and duration are expressed in seconds.
  3349. The filter accepts the following options:
  3350. @table @option
  3351. @item noise, n
  3352. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3353. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3354. @item duration, d
  3355. Set silence duration until notification (default is 2 seconds).
  3356. @item mono, m
  3357. Process each channel separately, instead of combined. By default is disabled.
  3358. @end table
  3359. @subsection Examples
  3360. @itemize
  3361. @item
  3362. Detect 5 seconds of silence with -50dB noise tolerance:
  3363. @example
  3364. silencedetect=n=-50dB:d=5
  3365. @end example
  3366. @item
  3367. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3368. tolerance in @file{silence.mp3}:
  3369. @example
  3370. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3371. @end example
  3372. @end itemize
  3373. @section silenceremove
  3374. Remove silence from the beginning, middle or end of the audio.
  3375. The filter accepts the following options:
  3376. @table @option
  3377. @item start_periods
  3378. This value is used to indicate if audio should be trimmed at beginning of
  3379. the audio. A value of zero indicates no silence should be trimmed from the
  3380. beginning. When specifying a non-zero value, it trims audio up until it
  3381. finds non-silence. Normally, when trimming silence from beginning of audio
  3382. the @var{start_periods} will be @code{1} but it can be increased to higher
  3383. values to trim all audio up to specific count of non-silence periods.
  3384. Default value is @code{0}.
  3385. @item start_duration
  3386. Specify the amount of time that non-silence must be detected before it stops
  3387. trimming audio. By increasing the duration, bursts of noises can be treated
  3388. as silence and trimmed off. Default value is @code{0}.
  3389. @item start_threshold
  3390. This indicates what sample value should be treated as silence. For digital
  3391. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3392. you may wish to increase the value to account for background noise.
  3393. Can be specified in dB (in case "dB" is appended to the specified value)
  3394. or amplitude ratio. Default value is @code{0}.
  3395. @item start_silence
  3396. Specify max duration of silence at beginning that will be kept after
  3397. trimming. Default is 0, which is equal to trimming all samples detected
  3398. as silence.
  3399. @item start_mode
  3400. Specify mode of detection of silence end in start of multi-channel audio.
  3401. Can be @var{any} or @var{all}. Default is @var{any}.
  3402. With @var{any}, any sample that is detected as non-silence will cause
  3403. stopped trimming of silence.
  3404. With @var{all}, only if all channels are detected as non-silence will cause
  3405. stopped trimming of silence.
  3406. @item stop_periods
  3407. Set the count for trimming silence from the end of audio.
  3408. To remove silence from the middle of a file, specify a @var{stop_periods}
  3409. that is negative. This value is then treated as a positive value and is
  3410. used to indicate the effect should restart processing as specified by
  3411. @var{start_periods}, making it suitable for removing periods of silence
  3412. in the middle of the audio.
  3413. Default value is @code{0}.
  3414. @item stop_duration
  3415. Specify a duration of silence that must exist before audio is not copied any
  3416. more. By specifying a higher duration, silence that is wanted can be left in
  3417. the audio.
  3418. Default value is @code{0}.
  3419. @item stop_threshold
  3420. This is the same as @option{start_threshold} but for trimming silence from
  3421. the end of audio.
  3422. Can be specified in dB (in case "dB" is appended to the specified value)
  3423. or amplitude ratio. Default value is @code{0}.
  3424. @item stop_silence
  3425. Specify max duration of silence at end that will be kept after
  3426. trimming. Default is 0, which is equal to trimming all samples detected
  3427. as silence.
  3428. @item stop_mode
  3429. Specify mode of detection of silence start in end of multi-channel audio.
  3430. Can be @var{any} or @var{all}. Default is @var{any}.
  3431. With @var{any}, any sample that is detected as non-silence will cause
  3432. stopped trimming of silence.
  3433. With @var{all}, only if all channels are detected as non-silence will cause
  3434. stopped trimming of silence.
  3435. @item detection
  3436. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3437. and works better with digital silence which is exactly 0.
  3438. Default value is @code{rms}.
  3439. @item window
  3440. Set duration in number of seconds used to calculate size of window in number
  3441. of samples for detecting silence.
  3442. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3443. @end table
  3444. @subsection Examples
  3445. @itemize
  3446. @item
  3447. The following example shows how this filter can be used to start a recording
  3448. that does not contain the delay at the start which usually occurs between
  3449. pressing the record button and the start of the performance:
  3450. @example
  3451. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3452. @end example
  3453. @item
  3454. Trim all silence encountered from beginning to end where there is more than 1
  3455. second of silence in audio:
  3456. @example
  3457. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3458. @end example
  3459. @end itemize
  3460. @section sofalizer
  3461. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3462. loudspeakers around the user for binaural listening via headphones (audio
  3463. formats up to 9 channels supported).
  3464. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3465. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3466. Austrian Academy of Sciences.
  3467. To enable compilation of this filter you need to configure FFmpeg with
  3468. @code{--enable-libmysofa}.
  3469. The filter accepts the following options:
  3470. @table @option
  3471. @item sofa
  3472. Set the SOFA file used for rendering.
  3473. @item gain
  3474. Set gain applied to audio. Value is in dB. Default is 0.
  3475. @item rotation
  3476. Set rotation of virtual loudspeakers in deg. Default is 0.
  3477. @item elevation
  3478. Set elevation of virtual speakers in deg. Default is 0.
  3479. @item radius
  3480. Set distance in meters between loudspeakers and the listener with near-field
  3481. HRTFs. Default is 1.
  3482. @item type
  3483. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3484. processing audio in time domain which is slow.
  3485. @var{freq} is processing audio in frequency domain which is fast.
  3486. Default is @var{freq}.
  3487. @item speakers
  3488. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3489. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3490. Each virtual loudspeaker is described with short channel name following with
  3491. azimuth and elevation in degrees.
  3492. Each virtual loudspeaker description is separated by '|'.
  3493. For example to override front left and front right channel positions use:
  3494. 'speakers=FL 45 15|FR 345 15'.
  3495. Descriptions with unrecognised channel names are ignored.
  3496. @item lfegain
  3497. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3498. @end table
  3499. @subsection Examples
  3500. @itemize
  3501. @item
  3502. Using ClubFritz6 sofa file:
  3503. @example
  3504. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3505. @end example
  3506. @item
  3507. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3508. @example
  3509. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3510. @end example
  3511. @item
  3512. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3513. and also with custom gain:
  3514. @example
  3515. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3516. @end example
  3517. @end itemize
  3518. @section stereotools
  3519. This filter has some handy utilities to manage stereo signals, for converting
  3520. M/S stereo recordings to L/R signal while having control over the parameters
  3521. or spreading the stereo image of master track.
  3522. The filter accepts the following options:
  3523. @table @option
  3524. @item level_in
  3525. Set input level before filtering for both channels. Defaults is 1.
  3526. Allowed range is from 0.015625 to 64.
  3527. @item level_out
  3528. Set output level after filtering for both channels. Defaults is 1.
  3529. Allowed range is from 0.015625 to 64.
  3530. @item balance_in
  3531. Set input balance between both channels. Default is 0.
  3532. Allowed range is from -1 to 1.
  3533. @item balance_out
  3534. Set output balance between both channels. Default is 0.
  3535. Allowed range is from -1 to 1.
  3536. @item softclip
  3537. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3538. clipping. Disabled by default.
  3539. @item mutel
  3540. Mute the left channel. Disabled by default.
  3541. @item muter
  3542. Mute the right channel. Disabled by default.
  3543. @item phasel
  3544. Change the phase of the left channel. Disabled by default.
  3545. @item phaser
  3546. Change the phase of the right channel. Disabled by default.
  3547. @item mode
  3548. Set stereo mode. Available values are:
  3549. @table @samp
  3550. @item lr>lr
  3551. Left/Right to Left/Right, this is default.
  3552. @item lr>ms
  3553. Left/Right to Mid/Side.
  3554. @item ms>lr
  3555. Mid/Side to Left/Right.
  3556. @item lr>ll
  3557. Left/Right to Left/Left.
  3558. @item lr>rr
  3559. Left/Right to Right/Right.
  3560. @item lr>l+r
  3561. Left/Right to Left + Right.
  3562. @item lr>rl
  3563. Left/Right to Right/Left.
  3564. @item ms>ll
  3565. Mid/Side to Left/Left.
  3566. @item ms>rr
  3567. Mid/Side to Right/Right.
  3568. @end table
  3569. @item slev
  3570. Set level of side signal. Default is 1.
  3571. Allowed range is from 0.015625 to 64.
  3572. @item sbal
  3573. Set balance of side signal. Default is 0.
  3574. Allowed range is from -1 to 1.
  3575. @item mlev
  3576. Set level of the middle signal. Default is 1.
  3577. Allowed range is from 0.015625 to 64.
  3578. @item mpan
  3579. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3580. @item base
  3581. Set stereo base between mono and inversed channels. Default is 0.
  3582. Allowed range is from -1 to 1.
  3583. @item delay
  3584. Set delay in milliseconds how much to delay left from right channel and
  3585. vice versa. Default is 0. Allowed range is from -20 to 20.
  3586. @item sclevel
  3587. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3588. @item phase
  3589. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3590. @item bmode_in, bmode_out
  3591. Set balance mode for balance_in/balance_out option.
  3592. Can be one of the following:
  3593. @table @samp
  3594. @item balance
  3595. Classic balance mode. Attenuate one channel at time.
  3596. Gain is raised up to 1.
  3597. @item amplitude
  3598. Similar as classic mode above but gain is raised up to 2.
  3599. @item power
  3600. Equal power distribution, from -6dB to +6dB range.
  3601. @end table
  3602. @end table
  3603. @subsection Examples
  3604. @itemize
  3605. @item
  3606. Apply karaoke like effect:
  3607. @example
  3608. stereotools=mlev=0.015625
  3609. @end example
  3610. @item
  3611. Convert M/S signal to L/R:
  3612. @example
  3613. "stereotools=mode=ms>lr"
  3614. @end example
  3615. @end itemize
  3616. @section stereowiden
  3617. This filter enhance the stereo effect by suppressing signal common to both
  3618. channels and by delaying the signal of left into right and vice versa,
  3619. thereby widening the stereo effect.
  3620. The filter accepts the following options:
  3621. @table @option
  3622. @item delay
  3623. Time in milliseconds of the delay of left signal into right and vice versa.
  3624. Default is 20 milliseconds.
  3625. @item feedback
  3626. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3627. effect of left signal in right output and vice versa which gives widening
  3628. effect. Default is 0.3.
  3629. @item crossfeed
  3630. Cross feed of left into right with inverted phase. This helps in suppressing
  3631. the mono. If the value is 1 it will cancel all the signal common to both
  3632. channels. Default is 0.3.
  3633. @item drymix
  3634. Set level of input signal of original channel. Default is 0.8.
  3635. @end table
  3636. @section superequalizer
  3637. Apply 18 band equalizer.
  3638. The filter accepts the following options:
  3639. @table @option
  3640. @item 1b
  3641. Set 65Hz band gain.
  3642. @item 2b
  3643. Set 92Hz band gain.
  3644. @item 3b
  3645. Set 131Hz band gain.
  3646. @item 4b
  3647. Set 185Hz band gain.
  3648. @item 5b
  3649. Set 262Hz band gain.
  3650. @item 6b
  3651. Set 370Hz band gain.
  3652. @item 7b
  3653. Set 523Hz band gain.
  3654. @item 8b
  3655. Set 740Hz band gain.
  3656. @item 9b
  3657. Set 1047Hz band gain.
  3658. @item 10b
  3659. Set 1480Hz band gain.
  3660. @item 11b
  3661. Set 2093Hz band gain.
  3662. @item 12b
  3663. Set 2960Hz band gain.
  3664. @item 13b
  3665. Set 4186Hz band gain.
  3666. @item 14b
  3667. Set 5920Hz band gain.
  3668. @item 15b
  3669. Set 8372Hz band gain.
  3670. @item 16b
  3671. Set 11840Hz band gain.
  3672. @item 17b
  3673. Set 16744Hz band gain.
  3674. @item 18b
  3675. Set 20000Hz band gain.
  3676. @end table
  3677. @section surround
  3678. Apply audio surround upmix filter.
  3679. This filter allows to produce multichannel output from audio stream.
  3680. The filter accepts the following options:
  3681. @table @option
  3682. @item chl_out
  3683. Set output channel layout. By default, this is @var{5.1}.
  3684. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3685. for the required syntax.
  3686. @item chl_in
  3687. Set input channel layout. By default, this is @var{stereo}.
  3688. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3689. for the required syntax.
  3690. @item level_in
  3691. Set input volume level. By default, this is @var{1}.
  3692. @item level_out
  3693. Set output volume level. By default, this is @var{1}.
  3694. @item lfe
  3695. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3696. @item lfe_low
  3697. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3698. @item lfe_high
  3699. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3700. @item fc_in
  3701. Set front center input volume. By default, this is @var{1}.
  3702. @item fc_out
  3703. Set front center output volume. By default, this is @var{1}.
  3704. @item lfe_in
  3705. Set LFE input volume. By default, this is @var{1}.
  3706. @item lfe_out
  3707. Set LFE output volume. By default, this is @var{1}.
  3708. @end table
  3709. @section treble, highshelf
  3710. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3711. shelving filter with a response similar to that of a standard
  3712. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3713. The filter accepts the following options:
  3714. @table @option
  3715. @item gain, g
  3716. Give the gain at whichever is the lower of ~22 kHz and the
  3717. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3718. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3719. @item frequency, f
  3720. Set the filter's central frequency and so can be used
  3721. to extend or reduce the frequency range to be boosted or cut.
  3722. The default value is @code{3000} Hz.
  3723. @item width_type, t
  3724. Set method to specify band-width of filter.
  3725. @table @option
  3726. @item h
  3727. Hz
  3728. @item q
  3729. Q-Factor
  3730. @item o
  3731. octave
  3732. @item s
  3733. slope
  3734. @item k
  3735. kHz
  3736. @end table
  3737. @item width, w
  3738. Determine how steep is the filter's shelf transition.
  3739. @item channels, c
  3740. Specify which channels to filter, by default all available are filtered.
  3741. @end table
  3742. @subsection Commands
  3743. This filter supports the following commands:
  3744. @table @option
  3745. @item frequency, f
  3746. Change treble frequency.
  3747. Syntax for the command is : "@var{frequency}"
  3748. @item width_type, t
  3749. Change treble width_type.
  3750. Syntax for the command is : "@var{width_type}"
  3751. @item width, w
  3752. Change treble width.
  3753. Syntax for the command is : "@var{width}"
  3754. @item gain, g
  3755. Change treble gain.
  3756. Syntax for the command is : "@var{gain}"
  3757. @end table
  3758. @section tremolo
  3759. Sinusoidal amplitude modulation.
  3760. The filter accepts the following options:
  3761. @table @option
  3762. @item f
  3763. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3764. (20 Hz or lower) will result in a tremolo effect.
  3765. This filter may also be used as a ring modulator by specifying
  3766. a modulation frequency higher than 20 Hz.
  3767. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3768. @item d
  3769. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3770. Default value is 0.5.
  3771. @end table
  3772. @section vibrato
  3773. Sinusoidal phase modulation.
  3774. The filter accepts the following options:
  3775. @table @option
  3776. @item f
  3777. Modulation frequency in Hertz.
  3778. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3779. @item d
  3780. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3781. Default value is 0.5.
  3782. @end table
  3783. @section volume
  3784. Adjust the input audio volume.
  3785. It accepts the following parameters:
  3786. @table @option
  3787. @item volume
  3788. Set audio volume expression.
  3789. Output values are clipped to the maximum value.
  3790. The output audio volume is given by the relation:
  3791. @example
  3792. @var{output_volume} = @var{volume} * @var{input_volume}
  3793. @end example
  3794. The default value for @var{volume} is "1.0".
  3795. @item precision
  3796. This parameter represents the mathematical precision.
  3797. It determines which input sample formats will be allowed, which affects the
  3798. precision of the volume scaling.
  3799. @table @option
  3800. @item fixed
  3801. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3802. @item float
  3803. 32-bit floating-point; this limits input sample format to FLT. (default)
  3804. @item double
  3805. 64-bit floating-point; this limits input sample format to DBL.
  3806. @end table
  3807. @item replaygain
  3808. Choose the behaviour on encountering ReplayGain side data in input frames.
  3809. @table @option
  3810. @item drop
  3811. Remove ReplayGain side data, ignoring its contents (the default).
  3812. @item ignore
  3813. Ignore ReplayGain side data, but leave it in the frame.
  3814. @item track
  3815. Prefer the track gain, if present.
  3816. @item album
  3817. Prefer the album gain, if present.
  3818. @end table
  3819. @item replaygain_preamp
  3820. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3821. Default value for @var{replaygain_preamp} is 0.0.
  3822. @item eval
  3823. Set when the volume expression is evaluated.
  3824. It accepts the following values:
  3825. @table @samp
  3826. @item once
  3827. only evaluate expression once during the filter initialization, or
  3828. when the @samp{volume} command is sent
  3829. @item frame
  3830. evaluate expression for each incoming frame
  3831. @end table
  3832. Default value is @samp{once}.
  3833. @end table
  3834. The volume expression can contain the following parameters.
  3835. @table @option
  3836. @item n
  3837. frame number (starting at zero)
  3838. @item nb_channels
  3839. number of channels
  3840. @item nb_consumed_samples
  3841. number of samples consumed by the filter
  3842. @item nb_samples
  3843. number of samples in the current frame
  3844. @item pos
  3845. original frame position in the file
  3846. @item pts
  3847. frame PTS
  3848. @item sample_rate
  3849. sample rate
  3850. @item startpts
  3851. PTS at start of stream
  3852. @item startt
  3853. time at start of stream
  3854. @item t
  3855. frame time
  3856. @item tb
  3857. timestamp timebase
  3858. @item volume
  3859. last set volume value
  3860. @end table
  3861. Note that when @option{eval} is set to @samp{once} only the
  3862. @var{sample_rate} and @var{tb} variables are available, all other
  3863. variables will evaluate to NAN.
  3864. @subsection Commands
  3865. This filter supports the following commands:
  3866. @table @option
  3867. @item volume
  3868. Modify the volume expression.
  3869. The command accepts the same syntax of the corresponding option.
  3870. If the specified expression is not valid, it is kept at its current
  3871. value.
  3872. @item replaygain_noclip
  3873. Prevent clipping by limiting the gain applied.
  3874. Default value for @var{replaygain_noclip} is 1.
  3875. @end table
  3876. @subsection Examples
  3877. @itemize
  3878. @item
  3879. Halve the input audio volume:
  3880. @example
  3881. volume=volume=0.5
  3882. volume=volume=1/2
  3883. volume=volume=-6.0206dB
  3884. @end example
  3885. In all the above example the named key for @option{volume} can be
  3886. omitted, for example like in:
  3887. @example
  3888. volume=0.5
  3889. @end example
  3890. @item
  3891. Increase input audio power by 6 decibels using fixed-point precision:
  3892. @example
  3893. volume=volume=6dB:precision=fixed
  3894. @end example
  3895. @item
  3896. Fade volume after time 10 with an annihilation period of 5 seconds:
  3897. @example
  3898. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3899. @end example
  3900. @end itemize
  3901. @section volumedetect
  3902. Detect the volume of the input video.
  3903. The filter has no parameters. The input is not modified. Statistics about
  3904. the volume will be printed in the log when the input stream end is reached.
  3905. In particular it will show the mean volume (root mean square), maximum
  3906. volume (on a per-sample basis), and the beginning of a histogram of the
  3907. registered volume values (from the maximum value to a cumulated 1/1000 of
  3908. the samples).
  3909. All volumes are in decibels relative to the maximum PCM value.
  3910. @subsection Examples
  3911. Here is an excerpt of the output:
  3912. @example
  3913. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3914. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3915. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3916. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3917. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3918. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3919. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3920. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3921. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3922. @end example
  3923. It means that:
  3924. @itemize
  3925. @item
  3926. The mean square energy is approximately -27 dB, or 10^-2.7.
  3927. @item
  3928. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3929. @item
  3930. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3931. @end itemize
  3932. In other words, raising the volume by +4 dB does not cause any clipping,
  3933. raising it by +5 dB causes clipping for 6 samples, etc.
  3934. @c man end AUDIO FILTERS
  3935. @chapter Audio Sources
  3936. @c man begin AUDIO SOURCES
  3937. Below is a description of the currently available audio sources.
  3938. @section abuffer
  3939. Buffer audio frames, and make them available to the filter chain.
  3940. This source is mainly intended for a programmatic use, in particular
  3941. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3942. It accepts the following parameters:
  3943. @table @option
  3944. @item time_base
  3945. The timebase which will be used for timestamps of submitted frames. It must be
  3946. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3947. @item sample_rate
  3948. The sample rate of the incoming audio buffers.
  3949. @item sample_fmt
  3950. The sample format of the incoming audio buffers.
  3951. Either a sample format name or its corresponding integer representation from
  3952. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3953. @item channel_layout
  3954. The channel layout of the incoming audio buffers.
  3955. Either a channel layout name from channel_layout_map in
  3956. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3957. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3958. @item channels
  3959. The number of channels of the incoming audio buffers.
  3960. If both @var{channels} and @var{channel_layout} are specified, then they
  3961. must be consistent.
  3962. @end table
  3963. @subsection Examples
  3964. @example
  3965. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3966. @end example
  3967. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3968. Since the sample format with name "s16p" corresponds to the number
  3969. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3970. equivalent to:
  3971. @example
  3972. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3973. @end example
  3974. @section aevalsrc
  3975. Generate an audio signal specified by an expression.
  3976. This source accepts in input one or more expressions (one for each
  3977. channel), which are evaluated and used to generate a corresponding
  3978. audio signal.
  3979. This source accepts the following options:
  3980. @table @option
  3981. @item exprs
  3982. Set the '|'-separated expressions list for each separate channel. In case the
  3983. @option{channel_layout} option is not specified, the selected channel layout
  3984. depends on the number of provided expressions. Otherwise the last
  3985. specified expression is applied to the remaining output channels.
  3986. @item channel_layout, c
  3987. Set the channel layout. The number of channels in the specified layout
  3988. must be equal to the number of specified expressions.
  3989. @item duration, d
  3990. Set the minimum duration of the sourced audio. See
  3991. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3992. for the accepted syntax.
  3993. Note that the resulting duration may be greater than the specified
  3994. duration, as the generated audio is always cut at the end of a
  3995. complete frame.
  3996. If not specified, or the expressed duration is negative, the audio is
  3997. supposed to be generated forever.
  3998. @item nb_samples, n
  3999. Set the number of samples per channel per each output frame,
  4000. default to 1024.
  4001. @item sample_rate, s
  4002. Specify the sample rate, default to 44100.
  4003. @end table
  4004. Each expression in @var{exprs} can contain the following constants:
  4005. @table @option
  4006. @item n
  4007. number of the evaluated sample, starting from 0
  4008. @item t
  4009. time of the evaluated sample expressed in seconds, starting from 0
  4010. @item s
  4011. sample rate
  4012. @end table
  4013. @subsection Examples
  4014. @itemize
  4015. @item
  4016. Generate silence:
  4017. @example
  4018. aevalsrc=0
  4019. @end example
  4020. @item
  4021. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4022. 8000 Hz:
  4023. @example
  4024. aevalsrc="sin(440*2*PI*t):s=8000"
  4025. @end example
  4026. @item
  4027. Generate a two channels signal, specify the channel layout (Front
  4028. Center + Back Center) explicitly:
  4029. @example
  4030. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4031. @end example
  4032. @item
  4033. Generate white noise:
  4034. @example
  4035. aevalsrc="-2+random(0)"
  4036. @end example
  4037. @item
  4038. Generate an amplitude modulated signal:
  4039. @example
  4040. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4041. @end example
  4042. @item
  4043. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4044. @example
  4045. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4046. @end example
  4047. @end itemize
  4048. @section anullsrc
  4049. The null audio source, return unprocessed audio frames. It is mainly useful
  4050. as a template and to be employed in analysis / debugging tools, or as
  4051. the source for filters which ignore the input data (for example the sox
  4052. synth filter).
  4053. This source accepts the following options:
  4054. @table @option
  4055. @item channel_layout, cl
  4056. Specifies the channel layout, and can be either an integer or a string
  4057. representing a channel layout. The default value of @var{channel_layout}
  4058. is "stereo".
  4059. Check the channel_layout_map definition in
  4060. @file{libavutil/channel_layout.c} for the mapping between strings and
  4061. channel layout values.
  4062. @item sample_rate, r
  4063. Specifies the sample rate, and defaults to 44100.
  4064. @item nb_samples, n
  4065. Set the number of samples per requested frames.
  4066. @end table
  4067. @subsection Examples
  4068. @itemize
  4069. @item
  4070. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4071. @example
  4072. anullsrc=r=48000:cl=4
  4073. @end example
  4074. @item
  4075. Do the same operation with a more obvious syntax:
  4076. @example
  4077. anullsrc=r=48000:cl=mono
  4078. @end example
  4079. @end itemize
  4080. All the parameters need to be explicitly defined.
  4081. @section flite
  4082. Synthesize a voice utterance using the libflite library.
  4083. To enable compilation of this filter you need to configure FFmpeg with
  4084. @code{--enable-libflite}.
  4085. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4086. The filter accepts the following options:
  4087. @table @option
  4088. @item list_voices
  4089. If set to 1, list the names of the available voices and exit
  4090. immediately. Default value is 0.
  4091. @item nb_samples, n
  4092. Set the maximum number of samples per frame. Default value is 512.
  4093. @item textfile
  4094. Set the filename containing the text to speak.
  4095. @item text
  4096. Set the text to speak.
  4097. @item voice, v
  4098. Set the voice to use for the speech synthesis. Default value is
  4099. @code{kal}. See also the @var{list_voices} option.
  4100. @end table
  4101. @subsection Examples
  4102. @itemize
  4103. @item
  4104. Read from file @file{speech.txt}, and synthesize the text using the
  4105. standard flite voice:
  4106. @example
  4107. flite=textfile=speech.txt
  4108. @end example
  4109. @item
  4110. Read the specified text selecting the @code{slt} voice:
  4111. @example
  4112. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4113. @end example
  4114. @item
  4115. Input text to ffmpeg:
  4116. @example
  4117. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4118. @end example
  4119. @item
  4120. Make @file{ffplay} speak the specified text, using @code{flite} and
  4121. the @code{lavfi} device:
  4122. @example
  4123. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4124. @end example
  4125. @end itemize
  4126. For more information about libflite, check:
  4127. @url{http://www.festvox.org/flite/}
  4128. @section anoisesrc
  4129. Generate a noise audio signal.
  4130. The filter accepts the following options:
  4131. @table @option
  4132. @item sample_rate, r
  4133. Specify the sample rate. Default value is 48000 Hz.
  4134. @item amplitude, a
  4135. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4136. is 1.0.
  4137. @item duration, d
  4138. Specify the duration of the generated audio stream. Not specifying this option
  4139. results in noise with an infinite length.
  4140. @item color, colour, c
  4141. Specify the color of noise. Available noise colors are white, pink, brown,
  4142. blue and violet. Default color is white.
  4143. @item seed, s
  4144. Specify a value used to seed the PRNG.
  4145. @item nb_samples, n
  4146. Set the number of samples per each output frame, default is 1024.
  4147. @end table
  4148. @subsection Examples
  4149. @itemize
  4150. @item
  4151. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4152. @example
  4153. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4154. @end example
  4155. @end itemize
  4156. @section hilbert
  4157. Generate odd-tap Hilbert transform FIR coefficients.
  4158. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4159. the signal by 90 degrees.
  4160. This is used in many matrix coding schemes and for analytic signal generation.
  4161. The process is often written as a multiplication by i (or j), the imaginary unit.
  4162. The filter accepts the following options:
  4163. @table @option
  4164. @item sample_rate, s
  4165. Set sample rate, default is 44100.
  4166. @item taps, t
  4167. Set length of FIR filter, default is 22051.
  4168. @item nb_samples, n
  4169. Set number of samples per each frame.
  4170. @item win_func, w
  4171. Set window function to be used when generating FIR coefficients.
  4172. @end table
  4173. @section sinc
  4174. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4175. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4176. The filter accepts the following options:
  4177. @table @option
  4178. @item sample_rate, r
  4179. Set sample rate, default is 44100.
  4180. @item nb_samples, n
  4181. Set number of samples per each frame. Default is 1024.
  4182. @item hp
  4183. Set high-pass frequency. Default is 0.
  4184. @item lp
  4185. Set low-pass frequency. Default is 0.
  4186. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4187. is higher than 0 then filter will create band-pass filter coefficients,
  4188. otherwise band-reject filter coefficients.
  4189. @item phase
  4190. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4191. @item beta
  4192. Set Kaiser window beta.
  4193. @item att
  4194. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4195. @item round
  4196. Enable rounding, by default is disabled.
  4197. @item hptaps
  4198. Set number of taps for high-pass filter.
  4199. @item lptaps
  4200. Set number of taps for low-pass filter.
  4201. @end table
  4202. @section sine
  4203. Generate an audio signal made of a sine wave with amplitude 1/8.
  4204. The audio signal is bit-exact.
  4205. The filter accepts the following options:
  4206. @table @option
  4207. @item frequency, f
  4208. Set the carrier frequency. Default is 440 Hz.
  4209. @item beep_factor, b
  4210. Enable a periodic beep every second with frequency @var{beep_factor} times
  4211. the carrier frequency. Default is 0, meaning the beep is disabled.
  4212. @item sample_rate, r
  4213. Specify the sample rate, default is 44100.
  4214. @item duration, d
  4215. Specify the duration of the generated audio stream.
  4216. @item samples_per_frame
  4217. Set the number of samples per output frame.
  4218. The expression can contain the following constants:
  4219. @table @option
  4220. @item n
  4221. The (sequential) number of the output audio frame, starting from 0.
  4222. @item pts
  4223. The PTS (Presentation TimeStamp) of the output audio frame,
  4224. expressed in @var{TB} units.
  4225. @item t
  4226. The PTS of the output audio frame, expressed in seconds.
  4227. @item TB
  4228. The timebase of the output audio frames.
  4229. @end table
  4230. Default is @code{1024}.
  4231. @end table
  4232. @subsection Examples
  4233. @itemize
  4234. @item
  4235. Generate a simple 440 Hz sine wave:
  4236. @example
  4237. sine
  4238. @end example
  4239. @item
  4240. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4241. @example
  4242. sine=220:4:d=5
  4243. sine=f=220:b=4:d=5
  4244. sine=frequency=220:beep_factor=4:duration=5
  4245. @end example
  4246. @item
  4247. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4248. pattern:
  4249. @example
  4250. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4251. @end example
  4252. @end itemize
  4253. @c man end AUDIO SOURCES
  4254. @chapter Audio Sinks
  4255. @c man begin AUDIO SINKS
  4256. Below is a description of the currently available audio sinks.
  4257. @section abuffersink
  4258. Buffer audio frames, and make them available to the end of filter chain.
  4259. This sink is mainly intended for programmatic use, in particular
  4260. through the interface defined in @file{libavfilter/buffersink.h}
  4261. or the options system.
  4262. It accepts a pointer to an AVABufferSinkContext structure, which
  4263. defines the incoming buffers' formats, to be passed as the opaque
  4264. parameter to @code{avfilter_init_filter} for initialization.
  4265. @section anullsink
  4266. Null audio sink; do absolutely nothing with the input audio. It is
  4267. mainly useful as a template and for use in analysis / debugging
  4268. tools.
  4269. @c man end AUDIO SINKS
  4270. @chapter Video Filters
  4271. @c man begin VIDEO FILTERS
  4272. When you configure your FFmpeg build, you can disable any of the
  4273. existing filters using @code{--disable-filters}.
  4274. The configure output will show the video filters included in your
  4275. build.
  4276. Below is a description of the currently available video filters.
  4277. @section alphaextract
  4278. Extract the alpha component from the input as a grayscale video. This
  4279. is especially useful with the @var{alphamerge} filter.
  4280. @section alphamerge
  4281. Add or replace the alpha component of the primary input with the
  4282. grayscale value of a second input. This is intended for use with
  4283. @var{alphaextract} to allow the transmission or storage of frame
  4284. sequences that have alpha in a format that doesn't support an alpha
  4285. channel.
  4286. For example, to reconstruct full frames from a normal YUV-encoded video
  4287. and a separate video created with @var{alphaextract}, you might use:
  4288. @example
  4289. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4290. @end example
  4291. Since this filter is designed for reconstruction, it operates on frame
  4292. sequences without considering timestamps, and terminates when either
  4293. input reaches end of stream. This will cause problems if your encoding
  4294. pipeline drops frames. If you're trying to apply an image as an
  4295. overlay to a video stream, consider the @var{overlay} filter instead.
  4296. @section amplify
  4297. Amplify differences between current pixel and pixels of adjacent frames in
  4298. same pixel location.
  4299. This filter accepts the following options:
  4300. @table @option
  4301. @item radius
  4302. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4303. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4304. @item factor
  4305. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4306. @item threshold
  4307. Set threshold for difference amplification. Any differrence greater or equal to
  4308. this value will not alter source pixel. Default is 10.
  4309. Allowed range is from 0 to 65535.
  4310. @item low
  4311. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4312. This option controls maximum possible value that will decrease source pixel value.
  4313. @item high
  4314. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4315. This option controls maximum possible value that will increase source pixel value.
  4316. @item planes
  4317. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4318. @end table
  4319. @section ass
  4320. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4321. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4322. Substation Alpha) subtitles files.
  4323. This filter accepts the following option in addition to the common options from
  4324. the @ref{subtitles} filter:
  4325. @table @option
  4326. @item shaping
  4327. Set the shaping engine
  4328. Available values are:
  4329. @table @samp
  4330. @item auto
  4331. The default libass shaping engine, which is the best available.
  4332. @item simple
  4333. Fast, font-agnostic shaper that can do only substitutions
  4334. @item complex
  4335. Slower shaper using OpenType for substitutions and positioning
  4336. @end table
  4337. The default is @code{auto}.
  4338. @end table
  4339. @section atadenoise
  4340. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4341. The filter accepts the following options:
  4342. @table @option
  4343. @item 0a
  4344. Set threshold A for 1st plane. Default is 0.02.
  4345. Valid range is 0 to 0.3.
  4346. @item 0b
  4347. Set threshold B for 1st plane. Default is 0.04.
  4348. Valid range is 0 to 5.
  4349. @item 1a
  4350. Set threshold A for 2nd plane. Default is 0.02.
  4351. Valid range is 0 to 0.3.
  4352. @item 1b
  4353. Set threshold B for 2nd plane. Default is 0.04.
  4354. Valid range is 0 to 5.
  4355. @item 2a
  4356. Set threshold A for 3rd plane. Default is 0.02.
  4357. Valid range is 0 to 0.3.
  4358. @item 2b
  4359. Set threshold B for 3rd plane. Default is 0.04.
  4360. Valid range is 0 to 5.
  4361. Threshold A is designed to react on abrupt changes in the input signal and
  4362. threshold B is designed to react on continuous changes in the input signal.
  4363. @item s
  4364. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4365. number in range [5, 129].
  4366. @item p
  4367. Set what planes of frame filter will use for averaging. Default is all.
  4368. @end table
  4369. @section avgblur
  4370. Apply average blur filter.
  4371. The filter accepts the following options:
  4372. @table @option
  4373. @item sizeX
  4374. Set horizontal radius size.
  4375. @item planes
  4376. Set which planes to filter. By default all planes are filtered.
  4377. @item sizeY
  4378. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4379. Default is @code{0}.
  4380. @end table
  4381. @section bbox
  4382. Compute the bounding box for the non-black pixels in the input frame
  4383. luminance plane.
  4384. This filter computes the bounding box containing all the pixels with a
  4385. luminance value greater than the minimum allowed value.
  4386. The parameters describing the bounding box are printed on the filter
  4387. log.
  4388. The filter accepts the following option:
  4389. @table @option
  4390. @item min_val
  4391. Set the minimal luminance value. Default is @code{16}.
  4392. @end table
  4393. @section bitplanenoise
  4394. Show and measure bit plane noise.
  4395. The filter accepts the following options:
  4396. @table @option
  4397. @item bitplane
  4398. Set which plane to analyze. Default is @code{1}.
  4399. @item filter
  4400. Filter out noisy pixels from @code{bitplane} set above.
  4401. Default is disabled.
  4402. @end table
  4403. @section blackdetect
  4404. Detect video intervals that are (almost) completely black. Can be
  4405. useful to detect chapter transitions, commercials, or invalid
  4406. recordings. Output lines contains the time for the start, end and
  4407. duration of the detected black interval expressed in seconds.
  4408. In order to display the output lines, you need to set the loglevel at
  4409. least to the AV_LOG_INFO value.
  4410. The filter accepts the following options:
  4411. @table @option
  4412. @item black_min_duration, d
  4413. Set the minimum detected black duration expressed in seconds. It must
  4414. be a non-negative floating point number.
  4415. Default value is 2.0.
  4416. @item picture_black_ratio_th, pic_th
  4417. Set the threshold for considering a picture "black".
  4418. Express the minimum value for the ratio:
  4419. @example
  4420. @var{nb_black_pixels} / @var{nb_pixels}
  4421. @end example
  4422. for which a picture is considered black.
  4423. Default value is 0.98.
  4424. @item pixel_black_th, pix_th
  4425. Set the threshold for considering a pixel "black".
  4426. The threshold expresses the maximum pixel luminance value for which a
  4427. pixel is considered "black". The provided value is scaled according to
  4428. the following equation:
  4429. @example
  4430. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4431. @end example
  4432. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4433. the input video format, the range is [0-255] for YUV full-range
  4434. formats and [16-235] for YUV non full-range formats.
  4435. Default value is 0.10.
  4436. @end table
  4437. The following example sets the maximum pixel threshold to the minimum
  4438. value, and detects only black intervals of 2 or more seconds:
  4439. @example
  4440. blackdetect=d=2:pix_th=0.00
  4441. @end example
  4442. @section blackframe
  4443. Detect frames that are (almost) completely black. Can be useful to
  4444. detect chapter transitions or commercials. Output lines consist of
  4445. the frame number of the detected frame, the percentage of blackness,
  4446. the position in the file if known or -1 and the timestamp in seconds.
  4447. In order to display the output lines, you need to set the loglevel at
  4448. least to the AV_LOG_INFO value.
  4449. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4450. The value represents the percentage of pixels in the picture that
  4451. are below the threshold value.
  4452. It accepts the following parameters:
  4453. @table @option
  4454. @item amount
  4455. The percentage of the pixels that have to be below the threshold; it defaults to
  4456. @code{98}.
  4457. @item threshold, thresh
  4458. The threshold below which a pixel value is considered black; it defaults to
  4459. @code{32}.
  4460. @end table
  4461. @section blend, tblend
  4462. Blend two video frames into each other.
  4463. The @code{blend} filter takes two input streams and outputs one
  4464. stream, the first input is the "top" layer and second input is
  4465. "bottom" layer. By default, the output terminates when the longest input terminates.
  4466. The @code{tblend} (time blend) filter takes two consecutive frames
  4467. from one single stream, and outputs the result obtained by blending
  4468. the new frame on top of the old frame.
  4469. A description of the accepted options follows.
  4470. @table @option
  4471. @item c0_mode
  4472. @item c1_mode
  4473. @item c2_mode
  4474. @item c3_mode
  4475. @item all_mode
  4476. Set blend mode for specific pixel component or all pixel components in case
  4477. of @var{all_mode}. Default value is @code{normal}.
  4478. Available values for component modes are:
  4479. @table @samp
  4480. @item addition
  4481. @item grainmerge
  4482. @item and
  4483. @item average
  4484. @item burn
  4485. @item darken
  4486. @item difference
  4487. @item grainextract
  4488. @item divide
  4489. @item dodge
  4490. @item freeze
  4491. @item exclusion
  4492. @item extremity
  4493. @item glow
  4494. @item hardlight
  4495. @item hardmix
  4496. @item heat
  4497. @item lighten
  4498. @item linearlight
  4499. @item multiply
  4500. @item multiply128
  4501. @item negation
  4502. @item normal
  4503. @item or
  4504. @item overlay
  4505. @item phoenix
  4506. @item pinlight
  4507. @item reflect
  4508. @item screen
  4509. @item softlight
  4510. @item subtract
  4511. @item vividlight
  4512. @item xor
  4513. @end table
  4514. @item c0_opacity
  4515. @item c1_opacity
  4516. @item c2_opacity
  4517. @item c3_opacity
  4518. @item all_opacity
  4519. Set blend opacity for specific pixel component or all pixel components in case
  4520. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4521. @item c0_expr
  4522. @item c1_expr
  4523. @item c2_expr
  4524. @item c3_expr
  4525. @item all_expr
  4526. Set blend expression for specific pixel component or all pixel components in case
  4527. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4528. The expressions can use the following variables:
  4529. @table @option
  4530. @item N
  4531. The sequential number of the filtered frame, starting from @code{0}.
  4532. @item X
  4533. @item Y
  4534. the coordinates of the current sample
  4535. @item W
  4536. @item H
  4537. the width and height of currently filtered plane
  4538. @item SW
  4539. @item SH
  4540. Width and height scale for the plane being filtered. It is the
  4541. ratio between the dimensions of the current plane to the luma plane,
  4542. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4543. the luma plane and @code{0.5,0.5} for the chroma planes.
  4544. @item T
  4545. Time of the current frame, expressed in seconds.
  4546. @item TOP, A
  4547. Value of pixel component at current location for first video frame (top layer).
  4548. @item BOTTOM, B
  4549. Value of pixel component at current location for second video frame (bottom layer).
  4550. @end table
  4551. @end table
  4552. The @code{blend} filter also supports the @ref{framesync} options.
  4553. @subsection Examples
  4554. @itemize
  4555. @item
  4556. Apply transition from bottom layer to top layer in first 10 seconds:
  4557. @example
  4558. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4559. @end example
  4560. @item
  4561. Apply linear horizontal transition from top layer to bottom layer:
  4562. @example
  4563. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4564. @end example
  4565. @item
  4566. Apply 1x1 checkerboard effect:
  4567. @example
  4568. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4569. @end example
  4570. @item
  4571. Apply uncover left effect:
  4572. @example
  4573. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4574. @end example
  4575. @item
  4576. Apply uncover down effect:
  4577. @example
  4578. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4579. @end example
  4580. @item
  4581. Apply uncover up-left effect:
  4582. @example
  4583. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4584. @end example
  4585. @item
  4586. Split diagonally video and shows top and bottom layer on each side:
  4587. @example
  4588. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4589. @end example
  4590. @item
  4591. Display differences between the current and the previous frame:
  4592. @example
  4593. tblend=all_mode=grainextract
  4594. @end example
  4595. @end itemize
  4596. @section bm3d
  4597. Denoise frames using Block-Matching 3D algorithm.
  4598. The filter accepts the following options.
  4599. @table @option
  4600. @item sigma
  4601. Set denoising strength. Default value is 1.
  4602. Allowed range is from 0 to 999.9.
  4603. The denoising algorith is very sensitive to sigma, so adjust it
  4604. according to the source.
  4605. @item block
  4606. Set local patch size. This sets dimensions in 2D.
  4607. @item bstep
  4608. Set sliding step for processing blocks. Default value is 4.
  4609. Allowed range is from 1 to 64.
  4610. Smaller values allows processing more reference blocks and is slower.
  4611. @item group
  4612. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4613. When set to 1, no block matching is done. Larger values allows more blocks
  4614. in single group.
  4615. Allowed range is from 1 to 256.
  4616. @item range
  4617. Set radius for search block matching. Default is 9.
  4618. Allowed range is from 1 to INT32_MAX.
  4619. @item mstep
  4620. Set step between two search locations for block matching. Default is 1.
  4621. Allowed range is from 1 to 64. Smaller is slower.
  4622. @item thmse
  4623. Set threshold of mean square error for block matching. Valid range is 0 to
  4624. INT32_MAX.
  4625. @item hdthr
  4626. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4627. Larger values results in stronger hard-thresholding filtering in frequency
  4628. domain.
  4629. @item estim
  4630. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4631. Default is @code{basic}.
  4632. @item ref
  4633. If enabled, filter will use 2nd stream for block matching.
  4634. Default is disabled for @code{basic} value of @var{estim} option,
  4635. and always enabled if value of @var{estim} is @code{final}.
  4636. @item planes
  4637. Set planes to filter. Default is all available except alpha.
  4638. @end table
  4639. @subsection Examples
  4640. @itemize
  4641. @item
  4642. Basic filtering with bm3d:
  4643. @example
  4644. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4645. @end example
  4646. @item
  4647. Same as above, but filtering only luma:
  4648. @example
  4649. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4650. @end example
  4651. @item
  4652. Same as above, but with both estimation modes:
  4653. @example
  4654. 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
  4655. @end example
  4656. @item
  4657. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4658. @example
  4659. 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
  4660. @end example
  4661. @end itemize
  4662. @section boxblur
  4663. Apply a boxblur algorithm to the input video.
  4664. It accepts the following parameters:
  4665. @table @option
  4666. @item luma_radius, lr
  4667. @item luma_power, lp
  4668. @item chroma_radius, cr
  4669. @item chroma_power, cp
  4670. @item alpha_radius, ar
  4671. @item alpha_power, ap
  4672. @end table
  4673. A description of the accepted options follows.
  4674. @table @option
  4675. @item luma_radius, lr
  4676. @item chroma_radius, cr
  4677. @item alpha_radius, ar
  4678. Set an expression for the box radius in pixels used for blurring the
  4679. corresponding input plane.
  4680. The radius value must be a non-negative number, and must not be
  4681. greater than the value of the expression @code{min(w,h)/2} for the
  4682. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4683. planes.
  4684. Default value for @option{luma_radius} is "2". If not specified,
  4685. @option{chroma_radius} and @option{alpha_radius} default to the
  4686. corresponding value set for @option{luma_radius}.
  4687. The expressions can contain the following constants:
  4688. @table @option
  4689. @item w
  4690. @item h
  4691. The input width and height in pixels.
  4692. @item cw
  4693. @item ch
  4694. The input chroma image width and height in pixels.
  4695. @item hsub
  4696. @item vsub
  4697. The horizontal and vertical chroma subsample values. For example, for the
  4698. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4699. @end table
  4700. @item luma_power, lp
  4701. @item chroma_power, cp
  4702. @item alpha_power, ap
  4703. Specify how many times the boxblur filter is applied to the
  4704. corresponding plane.
  4705. Default value for @option{luma_power} is 2. If not specified,
  4706. @option{chroma_power} and @option{alpha_power} default to the
  4707. corresponding value set for @option{luma_power}.
  4708. A value of 0 will disable the effect.
  4709. @end table
  4710. @subsection Examples
  4711. @itemize
  4712. @item
  4713. Apply a boxblur filter with the luma, chroma, and alpha radii
  4714. set to 2:
  4715. @example
  4716. boxblur=luma_radius=2:luma_power=1
  4717. boxblur=2:1
  4718. @end example
  4719. @item
  4720. Set the luma radius to 2, and alpha and chroma radius to 0:
  4721. @example
  4722. boxblur=2:1:cr=0:ar=0
  4723. @end example
  4724. @item
  4725. Set the luma and chroma radii to a fraction of the video dimension:
  4726. @example
  4727. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4728. @end example
  4729. @end itemize
  4730. @section bwdif
  4731. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4732. Deinterlacing Filter").
  4733. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4734. interpolation algorithms.
  4735. It accepts the following parameters:
  4736. @table @option
  4737. @item mode
  4738. The interlacing mode to adopt. It accepts one of the following values:
  4739. @table @option
  4740. @item 0, send_frame
  4741. Output one frame for each frame.
  4742. @item 1, send_field
  4743. Output one frame for each field.
  4744. @end table
  4745. The default value is @code{send_field}.
  4746. @item parity
  4747. The picture field parity assumed for the input interlaced video. It accepts one
  4748. of the following values:
  4749. @table @option
  4750. @item 0, tff
  4751. Assume the top field is first.
  4752. @item 1, bff
  4753. Assume the bottom field is first.
  4754. @item -1, auto
  4755. Enable automatic detection of field parity.
  4756. @end table
  4757. The default value is @code{auto}.
  4758. If the interlacing is unknown or the decoder does not export this information,
  4759. top field first will be assumed.
  4760. @item deint
  4761. Specify which frames to deinterlace. Accept one of the following
  4762. values:
  4763. @table @option
  4764. @item 0, all
  4765. Deinterlace all frames.
  4766. @item 1, interlaced
  4767. Only deinterlace frames marked as interlaced.
  4768. @end table
  4769. The default value is @code{all}.
  4770. @end table
  4771. @section chromahold
  4772. Remove all color information for all colors except for certain one.
  4773. The filter accepts the following options:
  4774. @table @option
  4775. @item color
  4776. The color which will not be replaced with neutral chroma.
  4777. @item similarity
  4778. Similarity percentage with the above color.
  4779. 0.01 matches only the exact key color, while 1.0 matches everything.
  4780. @item yuv
  4781. Signals that the color passed is already in YUV instead of RGB.
  4782. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4783. This can be used to pass exact YUV values as hexadecimal numbers.
  4784. @end table
  4785. @section chromakey
  4786. YUV colorspace color/chroma keying.
  4787. The filter accepts the following options:
  4788. @table @option
  4789. @item color
  4790. The color which will be replaced with transparency.
  4791. @item similarity
  4792. Similarity percentage with the key color.
  4793. 0.01 matches only the exact key color, while 1.0 matches everything.
  4794. @item blend
  4795. Blend percentage.
  4796. 0.0 makes pixels either fully transparent, or not transparent at all.
  4797. Higher values result in semi-transparent pixels, with a higher transparency
  4798. the more similar the pixels color is to the key color.
  4799. @item yuv
  4800. Signals that the color passed is already in YUV instead of RGB.
  4801. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4802. This can be used to pass exact YUV values as hexadecimal numbers.
  4803. @end table
  4804. @subsection Examples
  4805. @itemize
  4806. @item
  4807. Make every green pixel in the input image transparent:
  4808. @example
  4809. ffmpeg -i input.png -vf chromakey=green out.png
  4810. @end example
  4811. @item
  4812. Overlay a greenscreen-video on top of a static black background.
  4813. @example
  4814. 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
  4815. @end example
  4816. @end itemize
  4817. @section ciescope
  4818. Display CIE color diagram with pixels overlaid onto it.
  4819. The filter accepts the following options:
  4820. @table @option
  4821. @item system
  4822. Set color system.
  4823. @table @samp
  4824. @item ntsc, 470m
  4825. @item ebu, 470bg
  4826. @item smpte
  4827. @item 240m
  4828. @item apple
  4829. @item widergb
  4830. @item cie1931
  4831. @item rec709, hdtv
  4832. @item uhdtv, rec2020
  4833. @end table
  4834. @item cie
  4835. Set CIE system.
  4836. @table @samp
  4837. @item xyy
  4838. @item ucs
  4839. @item luv
  4840. @end table
  4841. @item gamuts
  4842. Set what gamuts to draw.
  4843. See @code{system} option for available values.
  4844. @item size, s
  4845. Set ciescope size, by default set to 512.
  4846. @item intensity, i
  4847. Set intensity used to map input pixel values to CIE diagram.
  4848. @item contrast
  4849. Set contrast used to draw tongue colors that are out of active color system gamut.
  4850. @item corrgamma
  4851. Correct gamma displayed on scope, by default enabled.
  4852. @item showwhite
  4853. Show white point on CIE diagram, by default disabled.
  4854. @item gamma
  4855. Set input gamma. Used only with XYZ input color space.
  4856. @end table
  4857. @section codecview
  4858. Visualize information exported by some codecs.
  4859. Some codecs can export information through frames using side-data or other
  4860. means. For example, some MPEG based codecs export motion vectors through the
  4861. @var{export_mvs} flag in the codec @option{flags2} option.
  4862. The filter accepts the following option:
  4863. @table @option
  4864. @item mv
  4865. Set motion vectors to visualize.
  4866. Available flags for @var{mv} are:
  4867. @table @samp
  4868. @item pf
  4869. forward predicted MVs of P-frames
  4870. @item bf
  4871. forward predicted MVs of B-frames
  4872. @item bb
  4873. backward predicted MVs of B-frames
  4874. @end table
  4875. @item qp
  4876. Display quantization parameters using the chroma planes.
  4877. @item mv_type, mvt
  4878. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4879. Available flags for @var{mv_type} are:
  4880. @table @samp
  4881. @item fp
  4882. forward predicted MVs
  4883. @item bp
  4884. backward predicted MVs
  4885. @end table
  4886. @item frame_type, ft
  4887. Set frame type to visualize motion vectors of.
  4888. Available flags for @var{frame_type} are:
  4889. @table @samp
  4890. @item if
  4891. intra-coded frames (I-frames)
  4892. @item pf
  4893. predicted frames (P-frames)
  4894. @item bf
  4895. bi-directionally predicted frames (B-frames)
  4896. @end table
  4897. @end table
  4898. @subsection Examples
  4899. @itemize
  4900. @item
  4901. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4902. @example
  4903. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4904. @end example
  4905. @item
  4906. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4907. @example
  4908. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4909. @end example
  4910. @end itemize
  4911. @section colorbalance
  4912. Modify intensity of primary colors (red, green and blue) of input frames.
  4913. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4914. regions for the red-cyan, green-magenta or blue-yellow balance.
  4915. A positive adjustment value shifts the balance towards the primary color, a negative
  4916. value towards the complementary color.
  4917. The filter accepts the following options:
  4918. @table @option
  4919. @item rs
  4920. @item gs
  4921. @item bs
  4922. Adjust red, green and blue shadows (darkest pixels).
  4923. @item rm
  4924. @item gm
  4925. @item bm
  4926. Adjust red, green and blue midtones (medium pixels).
  4927. @item rh
  4928. @item gh
  4929. @item bh
  4930. Adjust red, green and blue highlights (brightest pixels).
  4931. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4932. @end table
  4933. @subsection Examples
  4934. @itemize
  4935. @item
  4936. Add red color cast to shadows:
  4937. @example
  4938. colorbalance=rs=.3
  4939. @end example
  4940. @end itemize
  4941. @section colorkey
  4942. RGB colorspace color keying.
  4943. The filter accepts the following options:
  4944. @table @option
  4945. @item color
  4946. The color which will be replaced with transparency.
  4947. @item similarity
  4948. Similarity percentage with the key color.
  4949. 0.01 matches only the exact key color, while 1.0 matches everything.
  4950. @item blend
  4951. Blend percentage.
  4952. 0.0 makes pixels either fully transparent, or not transparent at all.
  4953. Higher values result in semi-transparent pixels, with a higher transparency
  4954. the more similar the pixels color is to the key color.
  4955. @end table
  4956. @subsection Examples
  4957. @itemize
  4958. @item
  4959. Make every green pixel in the input image transparent:
  4960. @example
  4961. ffmpeg -i input.png -vf colorkey=green out.png
  4962. @end example
  4963. @item
  4964. Overlay a greenscreen-video on top of a static background image.
  4965. @example
  4966. 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
  4967. @end example
  4968. @end itemize
  4969. @section colorlevels
  4970. Adjust video input frames using levels.
  4971. The filter accepts the following options:
  4972. @table @option
  4973. @item rimin
  4974. @item gimin
  4975. @item bimin
  4976. @item aimin
  4977. Adjust red, green, blue and alpha input black point.
  4978. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4979. @item rimax
  4980. @item gimax
  4981. @item bimax
  4982. @item aimax
  4983. Adjust red, green, blue and alpha input white point.
  4984. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4985. Input levels are used to lighten highlights (bright tones), darken shadows
  4986. (dark tones), change the balance of bright and dark tones.
  4987. @item romin
  4988. @item gomin
  4989. @item bomin
  4990. @item aomin
  4991. Adjust red, green, blue and alpha output black point.
  4992. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4993. @item romax
  4994. @item gomax
  4995. @item bomax
  4996. @item aomax
  4997. Adjust red, green, blue and alpha output white point.
  4998. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4999. Output levels allows manual selection of a constrained output level range.
  5000. @end table
  5001. @subsection Examples
  5002. @itemize
  5003. @item
  5004. Make video output darker:
  5005. @example
  5006. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5007. @end example
  5008. @item
  5009. Increase contrast:
  5010. @example
  5011. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5012. @end example
  5013. @item
  5014. Make video output lighter:
  5015. @example
  5016. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5017. @end example
  5018. @item
  5019. Increase brightness:
  5020. @example
  5021. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5022. @end example
  5023. @end itemize
  5024. @section colorchannelmixer
  5025. Adjust video input frames by re-mixing color channels.
  5026. This filter modifies a color channel by adding the values associated to
  5027. the other channels of the same pixels. For example if the value to
  5028. modify is red, the output value will be:
  5029. @example
  5030. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5031. @end example
  5032. The filter accepts the following options:
  5033. @table @option
  5034. @item rr
  5035. @item rg
  5036. @item rb
  5037. @item ra
  5038. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5039. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5040. @item gr
  5041. @item gg
  5042. @item gb
  5043. @item ga
  5044. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5045. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5046. @item br
  5047. @item bg
  5048. @item bb
  5049. @item ba
  5050. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5051. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5052. @item ar
  5053. @item ag
  5054. @item ab
  5055. @item aa
  5056. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5057. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5058. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5059. @end table
  5060. @subsection Examples
  5061. @itemize
  5062. @item
  5063. Convert source to grayscale:
  5064. @example
  5065. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5066. @end example
  5067. @item
  5068. Simulate sepia tones:
  5069. @example
  5070. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5071. @end example
  5072. @end itemize
  5073. @section colormatrix
  5074. Convert color matrix.
  5075. The filter accepts the following options:
  5076. @table @option
  5077. @item src
  5078. @item dst
  5079. Specify the source and destination color matrix. Both values must be
  5080. specified.
  5081. The accepted values are:
  5082. @table @samp
  5083. @item bt709
  5084. BT.709
  5085. @item fcc
  5086. FCC
  5087. @item bt601
  5088. BT.601
  5089. @item bt470
  5090. BT.470
  5091. @item bt470bg
  5092. BT.470BG
  5093. @item smpte170m
  5094. SMPTE-170M
  5095. @item smpte240m
  5096. SMPTE-240M
  5097. @item bt2020
  5098. BT.2020
  5099. @end table
  5100. @end table
  5101. For example to convert from BT.601 to SMPTE-240M, use the command:
  5102. @example
  5103. colormatrix=bt601:smpte240m
  5104. @end example
  5105. @section colorspace
  5106. Convert colorspace, transfer characteristics or color primaries.
  5107. Input video needs to have an even size.
  5108. The filter accepts the following options:
  5109. @table @option
  5110. @anchor{all}
  5111. @item all
  5112. Specify all color properties at once.
  5113. The accepted values are:
  5114. @table @samp
  5115. @item bt470m
  5116. BT.470M
  5117. @item bt470bg
  5118. BT.470BG
  5119. @item bt601-6-525
  5120. BT.601-6 525
  5121. @item bt601-6-625
  5122. BT.601-6 625
  5123. @item bt709
  5124. BT.709
  5125. @item smpte170m
  5126. SMPTE-170M
  5127. @item smpte240m
  5128. SMPTE-240M
  5129. @item bt2020
  5130. BT.2020
  5131. @end table
  5132. @anchor{space}
  5133. @item space
  5134. Specify output colorspace.
  5135. The accepted values are:
  5136. @table @samp
  5137. @item bt709
  5138. BT.709
  5139. @item fcc
  5140. FCC
  5141. @item bt470bg
  5142. BT.470BG or BT.601-6 625
  5143. @item smpte170m
  5144. SMPTE-170M or BT.601-6 525
  5145. @item smpte240m
  5146. SMPTE-240M
  5147. @item ycgco
  5148. YCgCo
  5149. @item bt2020ncl
  5150. BT.2020 with non-constant luminance
  5151. @end table
  5152. @anchor{trc}
  5153. @item trc
  5154. Specify output transfer characteristics.
  5155. The accepted values are:
  5156. @table @samp
  5157. @item bt709
  5158. BT.709
  5159. @item bt470m
  5160. BT.470M
  5161. @item bt470bg
  5162. BT.470BG
  5163. @item gamma22
  5164. Constant gamma of 2.2
  5165. @item gamma28
  5166. Constant gamma of 2.8
  5167. @item smpte170m
  5168. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5169. @item smpte240m
  5170. SMPTE-240M
  5171. @item srgb
  5172. SRGB
  5173. @item iec61966-2-1
  5174. iec61966-2-1
  5175. @item iec61966-2-4
  5176. iec61966-2-4
  5177. @item xvycc
  5178. xvycc
  5179. @item bt2020-10
  5180. BT.2020 for 10-bits content
  5181. @item bt2020-12
  5182. BT.2020 for 12-bits content
  5183. @end table
  5184. @anchor{primaries}
  5185. @item primaries
  5186. Specify output color primaries.
  5187. The accepted values are:
  5188. @table @samp
  5189. @item bt709
  5190. BT.709
  5191. @item bt470m
  5192. BT.470M
  5193. @item bt470bg
  5194. BT.470BG or BT.601-6 625
  5195. @item smpte170m
  5196. SMPTE-170M or BT.601-6 525
  5197. @item smpte240m
  5198. SMPTE-240M
  5199. @item film
  5200. film
  5201. @item smpte431
  5202. SMPTE-431
  5203. @item smpte432
  5204. SMPTE-432
  5205. @item bt2020
  5206. BT.2020
  5207. @item jedec-p22
  5208. JEDEC P22 phosphors
  5209. @end table
  5210. @anchor{range}
  5211. @item range
  5212. Specify output color range.
  5213. The accepted values are:
  5214. @table @samp
  5215. @item tv
  5216. TV (restricted) range
  5217. @item mpeg
  5218. MPEG (restricted) range
  5219. @item pc
  5220. PC (full) range
  5221. @item jpeg
  5222. JPEG (full) range
  5223. @end table
  5224. @item format
  5225. Specify output color format.
  5226. The accepted values are:
  5227. @table @samp
  5228. @item yuv420p
  5229. YUV 4:2:0 planar 8-bits
  5230. @item yuv420p10
  5231. YUV 4:2:0 planar 10-bits
  5232. @item yuv420p12
  5233. YUV 4:2:0 planar 12-bits
  5234. @item yuv422p
  5235. YUV 4:2:2 planar 8-bits
  5236. @item yuv422p10
  5237. YUV 4:2:2 planar 10-bits
  5238. @item yuv422p12
  5239. YUV 4:2:2 planar 12-bits
  5240. @item yuv444p
  5241. YUV 4:4:4 planar 8-bits
  5242. @item yuv444p10
  5243. YUV 4:4:4 planar 10-bits
  5244. @item yuv444p12
  5245. YUV 4:4:4 planar 12-bits
  5246. @end table
  5247. @item fast
  5248. Do a fast conversion, which skips gamma/primary correction. This will take
  5249. significantly less CPU, but will be mathematically incorrect. To get output
  5250. compatible with that produced by the colormatrix filter, use fast=1.
  5251. @item dither
  5252. Specify dithering mode.
  5253. The accepted values are:
  5254. @table @samp
  5255. @item none
  5256. No dithering
  5257. @item fsb
  5258. Floyd-Steinberg dithering
  5259. @end table
  5260. @item wpadapt
  5261. Whitepoint adaptation mode.
  5262. The accepted values are:
  5263. @table @samp
  5264. @item bradford
  5265. Bradford whitepoint adaptation
  5266. @item vonkries
  5267. von Kries whitepoint adaptation
  5268. @item identity
  5269. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5270. @end table
  5271. @item iall
  5272. Override all input properties at once. Same accepted values as @ref{all}.
  5273. @item ispace
  5274. Override input colorspace. Same accepted values as @ref{space}.
  5275. @item iprimaries
  5276. Override input color primaries. Same accepted values as @ref{primaries}.
  5277. @item itrc
  5278. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5279. @item irange
  5280. Override input color range. Same accepted values as @ref{range}.
  5281. @end table
  5282. The filter converts the transfer characteristics, color space and color
  5283. primaries to the specified user values. The output value, if not specified,
  5284. is set to a default value based on the "all" property. If that property is
  5285. also not specified, the filter will log an error. The output color range and
  5286. format default to the same value as the input color range and format. The
  5287. input transfer characteristics, color space, color primaries and color range
  5288. should be set on the input data. If any of these are missing, the filter will
  5289. log an error and no conversion will take place.
  5290. For example to convert the input to SMPTE-240M, use the command:
  5291. @example
  5292. colorspace=smpte240m
  5293. @end example
  5294. @section convolution
  5295. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5296. The filter accepts the following options:
  5297. @table @option
  5298. @item 0m
  5299. @item 1m
  5300. @item 2m
  5301. @item 3m
  5302. Set matrix for each plane.
  5303. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5304. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5305. @item 0rdiv
  5306. @item 1rdiv
  5307. @item 2rdiv
  5308. @item 3rdiv
  5309. Set multiplier for calculated value for each plane.
  5310. If unset or 0, it will be sum of all matrix elements.
  5311. @item 0bias
  5312. @item 1bias
  5313. @item 2bias
  5314. @item 3bias
  5315. Set bias for each plane. This value is added to the result of the multiplication.
  5316. Useful for making the overall image brighter or darker. Default is 0.0.
  5317. @item 0mode
  5318. @item 1mode
  5319. @item 2mode
  5320. @item 3mode
  5321. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5322. Default is @var{square}.
  5323. @end table
  5324. @subsection Examples
  5325. @itemize
  5326. @item
  5327. Apply sharpen:
  5328. @example
  5329. 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"
  5330. @end example
  5331. @item
  5332. Apply blur:
  5333. @example
  5334. 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"
  5335. @end example
  5336. @item
  5337. Apply edge enhance:
  5338. @example
  5339. 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"
  5340. @end example
  5341. @item
  5342. Apply edge detect:
  5343. @example
  5344. 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"
  5345. @end example
  5346. @item
  5347. Apply laplacian edge detector which includes diagonals:
  5348. @example
  5349. 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"
  5350. @end example
  5351. @item
  5352. Apply emboss:
  5353. @example
  5354. 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"
  5355. @end example
  5356. @end itemize
  5357. @section convolve
  5358. Apply 2D convolution of video stream in frequency domain using second stream
  5359. as impulse.
  5360. The filter accepts the following options:
  5361. @table @option
  5362. @item planes
  5363. Set which planes to process.
  5364. @item impulse
  5365. Set which impulse video frames will be processed, can be @var{first}
  5366. or @var{all}. Default is @var{all}.
  5367. @end table
  5368. The @code{convolve} filter also supports the @ref{framesync} options.
  5369. @section copy
  5370. Copy the input video source unchanged to the output. This is mainly useful for
  5371. testing purposes.
  5372. @anchor{coreimage}
  5373. @section coreimage
  5374. Video filtering on GPU using Apple's CoreImage API on OSX.
  5375. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5376. processed by video hardware. However, software-based OpenGL implementations
  5377. exist which means there is no guarantee for hardware processing. It depends on
  5378. the respective OSX.
  5379. There are many filters and image generators provided by Apple that come with a
  5380. large variety of options. The filter has to be referenced by its name along
  5381. with its options.
  5382. The coreimage filter accepts the following options:
  5383. @table @option
  5384. @item list_filters
  5385. List all available filters and generators along with all their respective
  5386. options as well as possible minimum and maximum values along with the default
  5387. values.
  5388. @example
  5389. list_filters=true
  5390. @end example
  5391. @item filter
  5392. Specify all filters by their respective name and options.
  5393. Use @var{list_filters} to determine all valid filter names and options.
  5394. Numerical options are specified by a float value and are automatically clamped
  5395. to their respective value range. Vector and color options have to be specified
  5396. by a list of space separated float values. Character escaping has to be done.
  5397. A special option name @code{default} is available to use default options for a
  5398. filter.
  5399. It is required to specify either @code{default} or at least one of the filter options.
  5400. All omitted options are used with their default values.
  5401. The syntax of the filter string is as follows:
  5402. @example
  5403. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5404. @end example
  5405. @item output_rect
  5406. Specify a rectangle where the output of the filter chain is copied into the
  5407. input image. It is given by a list of space separated float values:
  5408. @example
  5409. output_rect=x\ y\ width\ height
  5410. @end example
  5411. If not given, the output rectangle equals the dimensions of the input image.
  5412. The output rectangle is automatically cropped at the borders of the input
  5413. image. Negative values are valid for each component.
  5414. @example
  5415. output_rect=25\ 25\ 100\ 100
  5416. @end example
  5417. @end table
  5418. Several filters can be chained for successive processing without GPU-HOST
  5419. transfers allowing for fast processing of complex filter chains.
  5420. Currently, only filters with zero (generators) or exactly one (filters) input
  5421. image and one output image are supported. Also, transition filters are not yet
  5422. usable as intended.
  5423. Some filters generate output images with additional padding depending on the
  5424. respective filter kernel. The padding is automatically removed to ensure the
  5425. filter output has the same size as the input image.
  5426. For image generators, the size of the output image is determined by the
  5427. previous output image of the filter chain or the input image of the whole
  5428. filterchain, respectively. The generators do not use the pixel information of
  5429. this image to generate their output. However, the generated output is
  5430. blended onto this image, resulting in partial or complete coverage of the
  5431. output image.
  5432. The @ref{coreimagesrc} video source can be used for generating input images
  5433. which are directly fed into the filter chain. By using it, providing input
  5434. images by another video source or an input video is not required.
  5435. @subsection Examples
  5436. @itemize
  5437. @item
  5438. List all filters available:
  5439. @example
  5440. coreimage=list_filters=true
  5441. @end example
  5442. @item
  5443. Use the CIBoxBlur filter with default options to blur an image:
  5444. @example
  5445. coreimage=filter=CIBoxBlur@@default
  5446. @end example
  5447. @item
  5448. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5449. its center at 100x100 and a radius of 50 pixels:
  5450. @example
  5451. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5452. @end example
  5453. @item
  5454. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5455. given as complete and escaped command-line for Apple's standard bash shell:
  5456. @example
  5457. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5458. @end example
  5459. @end itemize
  5460. @section crop
  5461. Crop the input video to given dimensions.
  5462. It accepts the following parameters:
  5463. @table @option
  5464. @item w, out_w
  5465. The width of the output video. It defaults to @code{iw}.
  5466. This expression is evaluated only once during the filter
  5467. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5468. @item h, out_h
  5469. The height of the output video. It defaults to @code{ih}.
  5470. This expression is evaluated only once during the filter
  5471. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5472. @item x
  5473. The horizontal position, in the input video, of the left edge of the output
  5474. video. It defaults to @code{(in_w-out_w)/2}.
  5475. This expression is evaluated per-frame.
  5476. @item y
  5477. The vertical position, in the input video, of the top edge of the output video.
  5478. It defaults to @code{(in_h-out_h)/2}.
  5479. This expression is evaluated per-frame.
  5480. @item keep_aspect
  5481. If set to 1 will force the output display aspect ratio
  5482. to be the same of the input, by changing the output sample aspect
  5483. ratio. It defaults to 0.
  5484. @item exact
  5485. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5486. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5487. It defaults to 0.
  5488. @end table
  5489. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5490. expressions containing the following constants:
  5491. @table @option
  5492. @item x
  5493. @item y
  5494. The computed values for @var{x} and @var{y}. They are evaluated for
  5495. each new frame.
  5496. @item in_w
  5497. @item in_h
  5498. The input width and height.
  5499. @item iw
  5500. @item ih
  5501. These are the same as @var{in_w} and @var{in_h}.
  5502. @item out_w
  5503. @item out_h
  5504. The output (cropped) width and height.
  5505. @item ow
  5506. @item oh
  5507. These are the same as @var{out_w} and @var{out_h}.
  5508. @item a
  5509. same as @var{iw} / @var{ih}
  5510. @item sar
  5511. input sample aspect ratio
  5512. @item dar
  5513. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5514. @item hsub
  5515. @item vsub
  5516. horizontal and vertical chroma subsample values. For example for the
  5517. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5518. @item n
  5519. The number of the input frame, starting from 0.
  5520. @item pos
  5521. the position in the file of the input frame, NAN if unknown
  5522. @item t
  5523. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5524. @end table
  5525. The expression for @var{out_w} may depend on the value of @var{out_h},
  5526. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5527. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5528. evaluated after @var{out_w} and @var{out_h}.
  5529. The @var{x} and @var{y} parameters specify the expressions for the
  5530. position of the top-left corner of the output (non-cropped) area. They
  5531. are evaluated for each frame. If the evaluated value is not valid, it
  5532. is approximated to the nearest valid value.
  5533. The expression for @var{x} may depend on @var{y}, and the expression
  5534. for @var{y} may depend on @var{x}.
  5535. @subsection Examples
  5536. @itemize
  5537. @item
  5538. Crop area with size 100x100 at position (12,34).
  5539. @example
  5540. crop=100:100:12:34
  5541. @end example
  5542. Using named options, the example above becomes:
  5543. @example
  5544. crop=w=100:h=100:x=12:y=34
  5545. @end example
  5546. @item
  5547. Crop the central input area with size 100x100:
  5548. @example
  5549. crop=100:100
  5550. @end example
  5551. @item
  5552. Crop the central input area with size 2/3 of the input video:
  5553. @example
  5554. crop=2/3*in_w:2/3*in_h
  5555. @end example
  5556. @item
  5557. Crop the input video central square:
  5558. @example
  5559. crop=out_w=in_h
  5560. crop=in_h
  5561. @end example
  5562. @item
  5563. Delimit the rectangle with the top-left corner placed at position
  5564. 100:100 and the right-bottom corner corresponding to the right-bottom
  5565. corner of the input image.
  5566. @example
  5567. crop=in_w-100:in_h-100:100:100
  5568. @end example
  5569. @item
  5570. Crop 10 pixels from the left and right borders, and 20 pixels from
  5571. the top and bottom borders
  5572. @example
  5573. crop=in_w-2*10:in_h-2*20
  5574. @end example
  5575. @item
  5576. Keep only the bottom right quarter of the input image:
  5577. @example
  5578. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5579. @end example
  5580. @item
  5581. Crop height for getting Greek harmony:
  5582. @example
  5583. crop=in_w:1/PHI*in_w
  5584. @end example
  5585. @item
  5586. Apply trembling effect:
  5587. @example
  5588. 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)
  5589. @end example
  5590. @item
  5591. Apply erratic camera effect depending on timestamp:
  5592. @example
  5593. 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)"
  5594. @end example
  5595. @item
  5596. Set x depending on the value of y:
  5597. @example
  5598. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5599. @end example
  5600. @end itemize
  5601. @subsection Commands
  5602. This filter supports the following commands:
  5603. @table @option
  5604. @item w, out_w
  5605. @item h, out_h
  5606. @item x
  5607. @item y
  5608. Set width/height of the output video and the horizontal/vertical position
  5609. in the input video.
  5610. The command accepts the same syntax of the corresponding option.
  5611. If the specified expression is not valid, it is kept at its current
  5612. value.
  5613. @end table
  5614. @section cropdetect
  5615. Auto-detect the crop size.
  5616. It calculates the necessary cropping parameters and prints the
  5617. recommended parameters via the logging system. The detected dimensions
  5618. correspond to the non-black area of the input video.
  5619. It accepts the following parameters:
  5620. @table @option
  5621. @item limit
  5622. Set higher black value threshold, which can be optionally specified
  5623. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5624. value greater to the set value is considered non-black. It defaults to 24.
  5625. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5626. on the bitdepth of the pixel format.
  5627. @item round
  5628. The value which the width/height should be divisible by. It defaults to
  5629. 16. The offset is automatically adjusted to center the video. Use 2 to
  5630. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5631. encoding to most video codecs.
  5632. @item reset_count, reset
  5633. Set the counter that determines after how many frames cropdetect will
  5634. reset the previously detected largest video area and start over to
  5635. detect the current optimal crop area. Default value is 0.
  5636. This can be useful when channel logos distort the video area. 0
  5637. indicates 'never reset', and returns the largest area encountered during
  5638. playback.
  5639. @end table
  5640. @anchor{cue}
  5641. @section cue
  5642. Delay video filtering until a given wallclock timestamp. The filter first
  5643. passes on @option{preroll} amount of frames, then it buffers at most
  5644. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5645. it forwards the buffered frames and also any subsequent frames coming in its
  5646. input.
  5647. The filter can be used synchronize the output of multiple ffmpeg processes for
  5648. realtime output devices like decklink. By putting the delay in the filtering
  5649. chain and pre-buffering frames the process can pass on data to output almost
  5650. immediately after the target wallclock timestamp is reached.
  5651. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5652. some use cases.
  5653. @table @option
  5654. @item cue
  5655. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5656. @item preroll
  5657. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5658. @item buffer
  5659. The maximum duration of content to buffer before waiting for the cue expressed
  5660. in seconds. Default is 0.
  5661. @end table
  5662. @anchor{curves}
  5663. @section curves
  5664. Apply color adjustments using curves.
  5665. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5666. component (red, green and blue) has its values defined by @var{N} key points
  5667. tied from each other using a smooth curve. The x-axis represents the pixel
  5668. values from the input frame, and the y-axis the new pixel values to be set for
  5669. the output frame.
  5670. By default, a component curve is defined by the two points @var{(0;0)} and
  5671. @var{(1;1)}. This creates a straight line where each original pixel value is
  5672. "adjusted" to its own value, which means no change to the image.
  5673. The filter allows you to redefine these two points and add some more. A new
  5674. curve (using a natural cubic spline interpolation) will be define to pass
  5675. smoothly through all these new coordinates. The new defined points needs to be
  5676. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5677. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5678. the vector spaces, the values will be clipped accordingly.
  5679. The filter accepts the following options:
  5680. @table @option
  5681. @item preset
  5682. Select one of the available color presets. This option can be used in addition
  5683. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5684. options takes priority on the preset values.
  5685. Available presets are:
  5686. @table @samp
  5687. @item none
  5688. @item color_negative
  5689. @item cross_process
  5690. @item darker
  5691. @item increase_contrast
  5692. @item lighter
  5693. @item linear_contrast
  5694. @item medium_contrast
  5695. @item negative
  5696. @item strong_contrast
  5697. @item vintage
  5698. @end table
  5699. Default is @code{none}.
  5700. @item master, m
  5701. Set the master key points. These points will define a second pass mapping. It
  5702. is sometimes called a "luminance" or "value" mapping. It can be used with
  5703. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5704. post-processing LUT.
  5705. @item red, r
  5706. Set the key points for the red component.
  5707. @item green, g
  5708. Set the key points for the green component.
  5709. @item blue, b
  5710. Set the key points for the blue component.
  5711. @item all
  5712. Set the key points for all components (not including master).
  5713. Can be used in addition to the other key points component
  5714. options. In this case, the unset component(s) will fallback on this
  5715. @option{all} setting.
  5716. @item psfile
  5717. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5718. @item plot
  5719. Save Gnuplot script of the curves in specified file.
  5720. @end table
  5721. To avoid some filtergraph syntax conflicts, each key points list need to be
  5722. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5723. @subsection Examples
  5724. @itemize
  5725. @item
  5726. Increase slightly the middle level of blue:
  5727. @example
  5728. curves=blue='0/0 0.5/0.58 1/1'
  5729. @end example
  5730. @item
  5731. Vintage effect:
  5732. @example
  5733. 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'
  5734. @end example
  5735. Here we obtain the following coordinates for each components:
  5736. @table @var
  5737. @item red
  5738. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5739. @item green
  5740. @code{(0;0) (0.50;0.48) (1;1)}
  5741. @item blue
  5742. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5743. @end table
  5744. @item
  5745. The previous example can also be achieved with the associated built-in preset:
  5746. @example
  5747. curves=preset=vintage
  5748. @end example
  5749. @item
  5750. Or simply:
  5751. @example
  5752. curves=vintage
  5753. @end example
  5754. @item
  5755. Use a Photoshop preset and redefine the points of the green component:
  5756. @example
  5757. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5758. @end example
  5759. @item
  5760. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5761. and @command{gnuplot}:
  5762. @example
  5763. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5764. gnuplot -p /tmp/curves.plt
  5765. @end example
  5766. @end itemize
  5767. @section datascope
  5768. Video data analysis filter.
  5769. This filter shows hexadecimal pixel values of part of video.
  5770. The filter accepts the following options:
  5771. @table @option
  5772. @item size, s
  5773. Set output video size.
  5774. @item x
  5775. Set x offset from where to pick pixels.
  5776. @item y
  5777. Set y offset from where to pick pixels.
  5778. @item mode
  5779. Set scope mode, can be one of the following:
  5780. @table @samp
  5781. @item mono
  5782. Draw hexadecimal pixel values with white color on black background.
  5783. @item color
  5784. Draw hexadecimal pixel values with input video pixel color on black
  5785. background.
  5786. @item color2
  5787. Draw hexadecimal pixel values on color background picked from input video,
  5788. the text color is picked in such way so its always visible.
  5789. @end table
  5790. @item axis
  5791. Draw rows and columns numbers on left and top of video.
  5792. @item opacity
  5793. Set background opacity.
  5794. @end table
  5795. @section dctdnoiz
  5796. Denoise frames using 2D DCT (frequency domain filtering).
  5797. This filter is not designed for real time.
  5798. The filter accepts the following options:
  5799. @table @option
  5800. @item sigma, s
  5801. Set the noise sigma constant.
  5802. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5803. coefficient (absolute value) below this threshold with be dropped.
  5804. If you need a more advanced filtering, see @option{expr}.
  5805. Default is @code{0}.
  5806. @item overlap
  5807. Set number overlapping pixels for each block. Since the filter can be slow, you
  5808. may want to reduce this value, at the cost of a less effective filter and the
  5809. risk of various artefacts.
  5810. If the overlapping value doesn't permit processing the whole input width or
  5811. height, a warning will be displayed and according borders won't be denoised.
  5812. Default value is @var{blocksize}-1, which is the best possible setting.
  5813. @item expr, e
  5814. Set the coefficient factor expression.
  5815. For each coefficient of a DCT block, this expression will be evaluated as a
  5816. multiplier value for the coefficient.
  5817. If this is option is set, the @option{sigma} option will be ignored.
  5818. The absolute value of the coefficient can be accessed through the @var{c}
  5819. variable.
  5820. @item n
  5821. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5822. @var{blocksize}, which is the width and height of the processed blocks.
  5823. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5824. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5825. on the speed processing. Also, a larger block size does not necessarily means a
  5826. better de-noising.
  5827. @end table
  5828. @subsection Examples
  5829. Apply a denoise with a @option{sigma} of @code{4.5}:
  5830. @example
  5831. dctdnoiz=4.5
  5832. @end example
  5833. The same operation can be achieved using the expression system:
  5834. @example
  5835. dctdnoiz=e='gte(c, 4.5*3)'
  5836. @end example
  5837. Violent denoise using a block size of @code{16x16}:
  5838. @example
  5839. dctdnoiz=15:n=4
  5840. @end example
  5841. @section deband
  5842. Remove banding artifacts from input video.
  5843. It works by replacing banded pixels with average value of referenced pixels.
  5844. The filter accepts the following options:
  5845. @table @option
  5846. @item 1thr
  5847. @item 2thr
  5848. @item 3thr
  5849. @item 4thr
  5850. Set banding detection threshold for each plane. Default is 0.02.
  5851. Valid range is 0.00003 to 0.5.
  5852. If difference between current pixel and reference pixel is less than threshold,
  5853. it will be considered as banded.
  5854. @item range, r
  5855. Banding detection range in pixels. Default is 16. If positive, random number
  5856. in range 0 to set value will be used. If negative, exact absolute value
  5857. will be used.
  5858. The range defines square of four pixels around current pixel.
  5859. @item direction, d
  5860. Set direction in radians from which four pixel will be compared. If positive,
  5861. random direction from 0 to set direction will be picked. If negative, exact of
  5862. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5863. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5864. column.
  5865. @item blur, b
  5866. If enabled, current pixel is compared with average value of all four
  5867. surrounding pixels. The default is enabled. If disabled current pixel is
  5868. compared with all four surrounding pixels. The pixel is considered banded
  5869. if only all four differences with surrounding pixels are less than threshold.
  5870. @item coupling, c
  5871. If enabled, current pixel is changed if and only if all pixel components are banded,
  5872. e.g. banding detection threshold is triggered for all color components.
  5873. The default is disabled.
  5874. @end table
  5875. @section deblock
  5876. Remove blocking artifacts from input video.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item filter
  5880. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5881. This controls what kind of deblocking is applied.
  5882. @item block
  5883. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5884. @item alpha
  5885. @item beta
  5886. @item gamma
  5887. @item delta
  5888. Set blocking detection thresholds. Allowed range is 0 to 1.
  5889. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5890. Using higher threshold gives more deblocking strength.
  5891. Setting @var{alpha} controls threshold detection at exact edge of block.
  5892. Remaining options controls threshold detection near the edge. Each one for
  5893. below/above or left/right. Setting any of those to @var{0} disables
  5894. deblocking.
  5895. @item planes
  5896. Set planes to filter. Default is to filter all available planes.
  5897. @end table
  5898. @subsection Examples
  5899. @itemize
  5900. @item
  5901. Deblock using weak filter and block size of 4 pixels.
  5902. @example
  5903. deblock=filter=weak:block=4
  5904. @end example
  5905. @item
  5906. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5907. deblocking more edges.
  5908. @example
  5909. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5910. @end example
  5911. @item
  5912. Similar as above, but filter only first plane.
  5913. @example
  5914. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5915. @end example
  5916. @item
  5917. Similar as above, but filter only second and third plane.
  5918. @example
  5919. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5920. @end example
  5921. @end itemize
  5922. @anchor{decimate}
  5923. @section decimate
  5924. Drop duplicated frames at regular intervals.
  5925. The filter accepts the following options:
  5926. @table @option
  5927. @item cycle
  5928. Set the number of frames from which one will be dropped. Setting this to
  5929. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5930. Default is @code{5}.
  5931. @item dupthresh
  5932. Set the threshold for duplicate detection. If the difference metric for a frame
  5933. is less than or equal to this value, then it is declared as duplicate. Default
  5934. is @code{1.1}
  5935. @item scthresh
  5936. Set scene change threshold. Default is @code{15}.
  5937. @item blockx
  5938. @item blocky
  5939. Set the size of the x and y-axis blocks used during metric calculations.
  5940. Larger blocks give better noise suppression, but also give worse detection of
  5941. small movements. Must be a power of two. Default is @code{32}.
  5942. @item ppsrc
  5943. Mark main input as a pre-processed input and activate clean source input
  5944. stream. This allows the input to be pre-processed with various filters to help
  5945. the metrics calculation while keeping the frame selection lossless. When set to
  5946. @code{1}, the first stream is for the pre-processed input, and the second
  5947. stream is the clean source from where the kept frames are chosen. Default is
  5948. @code{0}.
  5949. @item chroma
  5950. Set whether or not chroma is considered in the metric calculations. Default is
  5951. @code{1}.
  5952. @end table
  5953. @section deconvolve
  5954. Apply 2D deconvolution of video stream in frequency domain using second stream
  5955. as impulse.
  5956. The filter accepts the following options:
  5957. @table @option
  5958. @item planes
  5959. Set which planes to process.
  5960. @item impulse
  5961. Set which impulse video frames will be processed, can be @var{first}
  5962. or @var{all}. Default is @var{all}.
  5963. @item noise
  5964. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5965. and height are not same and not power of 2 or if stream prior to convolving
  5966. had noise.
  5967. @end table
  5968. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5969. @section deflate
  5970. Apply deflate effect to the video.
  5971. This filter replaces the pixel by the local(3x3) average by taking into account
  5972. only values lower than the pixel.
  5973. It accepts the following options:
  5974. @table @option
  5975. @item threshold0
  5976. @item threshold1
  5977. @item threshold2
  5978. @item threshold3
  5979. Limit the maximum change for each plane, default is 65535.
  5980. If 0, plane will remain unchanged.
  5981. @end table
  5982. @section deflicker
  5983. Remove temporal frame luminance variations.
  5984. It accepts the following options:
  5985. @table @option
  5986. @item size, s
  5987. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5988. @item mode, m
  5989. Set averaging mode to smooth temporal luminance variations.
  5990. Available values are:
  5991. @table @samp
  5992. @item am
  5993. Arithmetic mean
  5994. @item gm
  5995. Geometric mean
  5996. @item hm
  5997. Harmonic mean
  5998. @item qm
  5999. Quadratic mean
  6000. @item cm
  6001. Cubic mean
  6002. @item pm
  6003. Power mean
  6004. @item median
  6005. Median
  6006. @end table
  6007. @item bypass
  6008. Do not actually modify frame. Useful when one only wants metadata.
  6009. @end table
  6010. @section dejudder
  6011. Remove judder produced by partially interlaced telecined content.
  6012. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6013. source was partially telecined content then the output of @code{pullup,dejudder}
  6014. will have a variable frame rate. May change the recorded frame rate of the
  6015. container. Aside from that change, this filter will not affect constant frame
  6016. rate video.
  6017. The option available in this filter is:
  6018. @table @option
  6019. @item cycle
  6020. Specify the length of the window over which the judder repeats.
  6021. Accepts any integer greater than 1. Useful values are:
  6022. @table @samp
  6023. @item 4
  6024. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6025. @item 5
  6026. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6027. @item 20
  6028. If a mixture of the two.
  6029. @end table
  6030. The default is @samp{4}.
  6031. @end table
  6032. @section delogo
  6033. Suppress a TV station logo by a simple interpolation of the surrounding
  6034. pixels. Just set a rectangle covering the logo and watch it disappear
  6035. (and sometimes something even uglier appear - your mileage may vary).
  6036. It accepts the following parameters:
  6037. @table @option
  6038. @item x
  6039. @item y
  6040. Specify the top left corner coordinates of the logo. They must be
  6041. specified.
  6042. @item w
  6043. @item h
  6044. Specify the width and height of the logo to clear. They must be
  6045. specified.
  6046. @item band, t
  6047. Specify the thickness of the fuzzy edge of the rectangle (added to
  6048. @var{w} and @var{h}). The default value is 1. This option is
  6049. deprecated, setting higher values should no longer be necessary and
  6050. is not recommended.
  6051. @item show
  6052. When set to 1, a green rectangle is drawn on the screen to simplify
  6053. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6054. The default value is 0.
  6055. The rectangle is drawn on the outermost pixels which will be (partly)
  6056. replaced with interpolated values. The values of the next pixels
  6057. immediately outside this rectangle in each direction will be used to
  6058. compute the interpolated pixel values inside the rectangle.
  6059. @end table
  6060. @subsection Examples
  6061. @itemize
  6062. @item
  6063. Set a rectangle covering the area with top left corner coordinates 0,0
  6064. and size 100x77, and a band of size 10:
  6065. @example
  6066. delogo=x=0:y=0:w=100:h=77:band=10
  6067. @end example
  6068. @end itemize
  6069. @section deshake
  6070. Attempt to fix small changes in horizontal and/or vertical shift. This
  6071. filter helps remove camera shake from hand-holding a camera, bumping a
  6072. tripod, moving on a vehicle, etc.
  6073. The filter accepts the following options:
  6074. @table @option
  6075. @item x
  6076. @item y
  6077. @item w
  6078. @item h
  6079. Specify a rectangular area where to limit the search for motion
  6080. vectors.
  6081. If desired the search for motion vectors can be limited to a
  6082. rectangular area of the frame defined by its top left corner, width
  6083. and height. These parameters have the same meaning as the drawbox
  6084. filter which can be used to visualise the position of the bounding
  6085. box.
  6086. This is useful when simultaneous movement of subjects within the frame
  6087. might be confused for camera motion by the motion vector search.
  6088. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6089. then the full frame is used. This allows later options to be set
  6090. without specifying the bounding box for the motion vector search.
  6091. Default - search the whole frame.
  6092. @item rx
  6093. @item ry
  6094. Specify the maximum extent of movement in x and y directions in the
  6095. range 0-64 pixels. Default 16.
  6096. @item edge
  6097. Specify how to generate pixels to fill blanks at the edge of the
  6098. frame. Available values are:
  6099. @table @samp
  6100. @item blank, 0
  6101. Fill zeroes at blank locations
  6102. @item original, 1
  6103. Original image at blank locations
  6104. @item clamp, 2
  6105. Extruded edge value at blank locations
  6106. @item mirror, 3
  6107. Mirrored edge at blank locations
  6108. @end table
  6109. Default value is @samp{mirror}.
  6110. @item blocksize
  6111. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6112. default 8.
  6113. @item contrast
  6114. Specify the contrast threshold for blocks. Only blocks with more than
  6115. the specified contrast (difference between darkest and lightest
  6116. pixels) will be considered. Range 1-255, default 125.
  6117. @item search
  6118. Specify the search strategy. Available values are:
  6119. @table @samp
  6120. @item exhaustive, 0
  6121. Set exhaustive search
  6122. @item less, 1
  6123. Set less exhaustive search.
  6124. @end table
  6125. Default value is @samp{exhaustive}.
  6126. @item filename
  6127. If set then a detailed log of the motion search is written to the
  6128. specified file.
  6129. @end table
  6130. @section despill
  6131. Remove unwanted contamination of foreground colors, caused by reflected color of
  6132. greenscreen or bluescreen.
  6133. This filter accepts the following options:
  6134. @table @option
  6135. @item type
  6136. Set what type of despill to use.
  6137. @item mix
  6138. Set how spillmap will be generated.
  6139. @item expand
  6140. Set how much to get rid of still remaining spill.
  6141. @item red
  6142. Controls amount of red in spill area.
  6143. @item green
  6144. Controls amount of green in spill area.
  6145. Should be -1 for greenscreen.
  6146. @item blue
  6147. Controls amount of blue in spill area.
  6148. Should be -1 for bluescreen.
  6149. @item brightness
  6150. Controls brightness of spill area, preserving colors.
  6151. @item alpha
  6152. Modify alpha from generated spillmap.
  6153. @end table
  6154. @section detelecine
  6155. Apply an exact inverse of the telecine operation. It requires a predefined
  6156. pattern specified using the pattern option which must be the same as that passed
  6157. to the telecine filter.
  6158. This filter accepts the following options:
  6159. @table @option
  6160. @item first_field
  6161. @table @samp
  6162. @item top, t
  6163. top field first
  6164. @item bottom, b
  6165. bottom field first
  6166. The default value is @code{top}.
  6167. @end table
  6168. @item pattern
  6169. A string of numbers representing the pulldown pattern you wish to apply.
  6170. The default value is @code{23}.
  6171. @item start_frame
  6172. A number representing position of the first frame with respect to the telecine
  6173. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6174. @end table
  6175. @section dilation
  6176. Apply dilation effect to the video.
  6177. This filter replaces the pixel by the local(3x3) maximum.
  6178. It accepts the following options:
  6179. @table @option
  6180. @item threshold0
  6181. @item threshold1
  6182. @item threshold2
  6183. @item threshold3
  6184. Limit the maximum change for each plane, default is 65535.
  6185. If 0, plane will remain unchanged.
  6186. @item coordinates
  6187. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6188. pixels are used.
  6189. Flags to local 3x3 coordinates maps like this:
  6190. 1 2 3
  6191. 4 5
  6192. 6 7 8
  6193. @end table
  6194. @section displace
  6195. Displace pixels as indicated by second and third input stream.
  6196. It takes three input streams and outputs one stream, the first input is the
  6197. source, and second and third input are displacement maps.
  6198. The second input specifies how much to displace pixels along the
  6199. x-axis, while the third input specifies how much to displace pixels
  6200. along the y-axis.
  6201. If one of displacement map streams terminates, last frame from that
  6202. displacement map will be used.
  6203. Note that once generated, displacements maps can be reused over and over again.
  6204. A description of the accepted options follows.
  6205. @table @option
  6206. @item edge
  6207. Set displace behavior for pixels that are out of range.
  6208. Available values are:
  6209. @table @samp
  6210. @item blank
  6211. Missing pixels are replaced by black pixels.
  6212. @item smear
  6213. Adjacent pixels will spread out to replace missing pixels.
  6214. @item wrap
  6215. Out of range pixels are wrapped so they point to pixels of other side.
  6216. @item mirror
  6217. Out of range pixels will be replaced with mirrored pixels.
  6218. @end table
  6219. Default is @samp{smear}.
  6220. @end table
  6221. @subsection Examples
  6222. @itemize
  6223. @item
  6224. Add ripple effect to rgb input of video size hd720:
  6225. @example
  6226. 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
  6227. @end example
  6228. @item
  6229. Add wave effect to rgb input of video size hd720:
  6230. @example
  6231. 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
  6232. @end example
  6233. @end itemize
  6234. @section drawbox
  6235. Draw a colored box on the input image.
  6236. It accepts the following parameters:
  6237. @table @option
  6238. @item x
  6239. @item y
  6240. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6241. @item width, w
  6242. @item height, h
  6243. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6244. the input width and height. It defaults to 0.
  6245. @item color, c
  6246. Specify the color of the box to write. For the general syntax of this option,
  6247. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6248. value @code{invert} is used, the box edge color is the same as the
  6249. video with inverted luma.
  6250. @item thickness, t
  6251. The expression which sets the thickness of the box edge.
  6252. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6253. See below for the list of accepted constants.
  6254. @item replace
  6255. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6256. will overwrite the video's color and alpha pixels.
  6257. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6258. @end table
  6259. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6260. following constants:
  6261. @table @option
  6262. @item dar
  6263. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6264. @item hsub
  6265. @item vsub
  6266. horizontal and vertical chroma subsample values. For example for the
  6267. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6268. @item in_h, ih
  6269. @item in_w, iw
  6270. The input width and height.
  6271. @item sar
  6272. The input sample aspect ratio.
  6273. @item x
  6274. @item y
  6275. The x and y offset coordinates where the box is drawn.
  6276. @item w
  6277. @item h
  6278. The width and height of the drawn box.
  6279. @item t
  6280. The thickness of the drawn box.
  6281. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6282. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6283. @end table
  6284. @subsection Examples
  6285. @itemize
  6286. @item
  6287. Draw a black box around the edge of the input image:
  6288. @example
  6289. drawbox
  6290. @end example
  6291. @item
  6292. Draw a box with color red and an opacity of 50%:
  6293. @example
  6294. drawbox=10:20:200:60:red@@0.5
  6295. @end example
  6296. The previous example can be specified as:
  6297. @example
  6298. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6299. @end example
  6300. @item
  6301. Fill the box with pink color:
  6302. @example
  6303. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6304. @end example
  6305. @item
  6306. Draw a 2-pixel red 2.40:1 mask:
  6307. @example
  6308. 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
  6309. @end example
  6310. @end itemize
  6311. @section drawgrid
  6312. Draw a grid on the input image.
  6313. It accepts the following parameters:
  6314. @table @option
  6315. @item x
  6316. @item y
  6317. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6318. @item width, w
  6319. @item height, h
  6320. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6321. input width and height, respectively, minus @code{thickness}, so image gets
  6322. framed. Default to 0.
  6323. @item color, c
  6324. Specify the color of the grid. For the general syntax of this option,
  6325. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6326. value @code{invert} is used, the grid color is the same as the
  6327. video with inverted luma.
  6328. @item thickness, t
  6329. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6330. See below for the list of accepted constants.
  6331. @item replace
  6332. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6333. will overwrite the video's color and alpha pixels.
  6334. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6335. @end table
  6336. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6337. following constants:
  6338. @table @option
  6339. @item dar
  6340. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6341. @item hsub
  6342. @item vsub
  6343. horizontal and vertical chroma subsample values. For example for the
  6344. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6345. @item in_h, ih
  6346. @item in_w, iw
  6347. The input grid cell width and height.
  6348. @item sar
  6349. The input sample aspect ratio.
  6350. @item x
  6351. @item y
  6352. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6353. @item w
  6354. @item h
  6355. The width and height of the drawn cell.
  6356. @item t
  6357. The thickness of the drawn cell.
  6358. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6359. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6360. @end table
  6361. @subsection Examples
  6362. @itemize
  6363. @item
  6364. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6365. @example
  6366. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6367. @end example
  6368. @item
  6369. Draw a white 3x3 grid with an opacity of 50%:
  6370. @example
  6371. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6372. @end example
  6373. @end itemize
  6374. @anchor{drawtext}
  6375. @section drawtext
  6376. Draw a text string or text from a specified file on top of a video, using the
  6377. libfreetype library.
  6378. To enable compilation of this filter, you need to configure FFmpeg with
  6379. @code{--enable-libfreetype}.
  6380. To enable default font fallback and the @var{font} option you need to
  6381. configure FFmpeg with @code{--enable-libfontconfig}.
  6382. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6383. @code{--enable-libfribidi}.
  6384. @subsection Syntax
  6385. It accepts the following parameters:
  6386. @table @option
  6387. @item box
  6388. Used to draw a box around text using the background color.
  6389. The value must be either 1 (enable) or 0 (disable).
  6390. The default value of @var{box} is 0.
  6391. @item boxborderw
  6392. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6393. The default value of @var{boxborderw} is 0.
  6394. @item boxcolor
  6395. The color to be used for drawing box around text. For the syntax of this
  6396. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6397. The default value of @var{boxcolor} is "white".
  6398. @item line_spacing
  6399. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6400. The default value of @var{line_spacing} is 0.
  6401. @item borderw
  6402. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6403. The default value of @var{borderw} is 0.
  6404. @item bordercolor
  6405. Set the color to be used for drawing border around text. For the syntax of this
  6406. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6407. The default value of @var{bordercolor} is "black".
  6408. @item expansion
  6409. Select how the @var{text} is expanded. Can be either @code{none},
  6410. @code{strftime} (deprecated) or
  6411. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6412. below for details.
  6413. @item basetime
  6414. Set a start time for the count. Value is in microseconds. Only applied
  6415. in the deprecated strftime expansion mode. To emulate in normal expansion
  6416. mode use the @code{pts} function, supplying the start time (in seconds)
  6417. as the second argument.
  6418. @item fix_bounds
  6419. If true, check and fix text coords to avoid clipping.
  6420. @item fontcolor
  6421. The color to be used for drawing fonts. For the syntax of this option, check
  6422. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6423. The default value of @var{fontcolor} is "black".
  6424. @item fontcolor_expr
  6425. String which is expanded the same way as @var{text} to obtain dynamic
  6426. @var{fontcolor} value. By default this option has empty value and is not
  6427. processed. When this option is set, it overrides @var{fontcolor} option.
  6428. @item font
  6429. The font family to be used for drawing text. By default Sans.
  6430. @item fontfile
  6431. The font file to be used for drawing text. The path must be included.
  6432. This parameter is mandatory if the fontconfig support is disabled.
  6433. @item alpha
  6434. Draw the text applying alpha blending. The value can
  6435. be a number between 0.0 and 1.0.
  6436. The expression accepts the same variables @var{x, y} as well.
  6437. The default value is 1.
  6438. Please see @var{fontcolor_expr}.
  6439. @item fontsize
  6440. The font size to be used for drawing text.
  6441. The default value of @var{fontsize} is 16.
  6442. @item text_shaping
  6443. If set to 1, attempt to shape the text (for example, reverse the order of
  6444. right-to-left text and join Arabic characters) before drawing it.
  6445. Otherwise, just draw the text exactly as given.
  6446. By default 1 (if supported).
  6447. @item ft_load_flags
  6448. The flags to be used for loading the fonts.
  6449. The flags map the corresponding flags supported by libfreetype, and are
  6450. a combination of the following values:
  6451. @table @var
  6452. @item default
  6453. @item no_scale
  6454. @item no_hinting
  6455. @item render
  6456. @item no_bitmap
  6457. @item vertical_layout
  6458. @item force_autohint
  6459. @item crop_bitmap
  6460. @item pedantic
  6461. @item ignore_global_advance_width
  6462. @item no_recurse
  6463. @item ignore_transform
  6464. @item monochrome
  6465. @item linear_design
  6466. @item no_autohint
  6467. @end table
  6468. Default value is "default".
  6469. For more information consult the documentation for the FT_LOAD_*
  6470. libfreetype flags.
  6471. @item shadowcolor
  6472. The color to be used for drawing a shadow behind the drawn text. For the
  6473. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6474. ffmpeg-utils manual,ffmpeg-utils}.
  6475. The default value of @var{shadowcolor} is "black".
  6476. @item shadowx
  6477. @item shadowy
  6478. The x and y offsets for the text shadow position with respect to the
  6479. position of the text. They can be either positive or negative
  6480. values. The default value for both is "0".
  6481. @item start_number
  6482. The starting frame number for the n/frame_num variable. The default value
  6483. is "0".
  6484. @item tabsize
  6485. The size in number of spaces to use for rendering the tab.
  6486. Default value is 4.
  6487. @item timecode
  6488. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6489. format. It can be used with or without text parameter. @var{timecode_rate}
  6490. option must be specified.
  6491. @item timecode_rate, rate, r
  6492. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6493. integer. Minimum value is "1".
  6494. Drop-frame timecode is supported for frame rates 30 & 60.
  6495. @item tc24hmax
  6496. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6497. Default is 0 (disabled).
  6498. @item text
  6499. The text string to be drawn. The text must be a sequence of UTF-8
  6500. encoded characters.
  6501. This parameter is mandatory if no file is specified with the parameter
  6502. @var{textfile}.
  6503. @item textfile
  6504. A text file containing text to be drawn. The text must be a sequence
  6505. of UTF-8 encoded characters.
  6506. This parameter is mandatory if no text string is specified with the
  6507. parameter @var{text}.
  6508. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6509. @item reload
  6510. If set to 1, the @var{textfile} will be reloaded before each frame.
  6511. Be sure to update it atomically, or it may be read partially, or even fail.
  6512. @item x
  6513. @item y
  6514. The expressions which specify the offsets where text will be drawn
  6515. within the video frame. They are relative to the top/left border of the
  6516. output image.
  6517. The default value of @var{x} and @var{y} is "0".
  6518. See below for the list of accepted constants and functions.
  6519. @end table
  6520. The parameters for @var{x} and @var{y} are expressions containing the
  6521. following constants and functions:
  6522. @table @option
  6523. @item dar
  6524. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6525. @item hsub
  6526. @item vsub
  6527. horizontal and vertical chroma subsample values. For example for the
  6528. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6529. @item line_h, lh
  6530. the height of each text line
  6531. @item main_h, h, H
  6532. the input height
  6533. @item main_w, w, W
  6534. the input width
  6535. @item max_glyph_a, ascent
  6536. the maximum distance from the baseline to the highest/upper grid
  6537. coordinate used to place a glyph outline point, for all the rendered
  6538. glyphs.
  6539. It is a positive value, due to the grid's orientation with the Y axis
  6540. upwards.
  6541. @item max_glyph_d, descent
  6542. the maximum distance from the baseline to the lowest grid coordinate
  6543. used to place a glyph outline point, for all the rendered glyphs.
  6544. This is a negative value, due to the grid's orientation, with the Y axis
  6545. upwards.
  6546. @item max_glyph_h
  6547. maximum glyph height, that is the maximum height for all the glyphs
  6548. contained in the rendered text, it is equivalent to @var{ascent} -
  6549. @var{descent}.
  6550. @item max_glyph_w
  6551. maximum glyph width, that is the maximum width for all the glyphs
  6552. contained in the rendered text
  6553. @item n
  6554. the number of input frame, starting from 0
  6555. @item rand(min, max)
  6556. return a random number included between @var{min} and @var{max}
  6557. @item sar
  6558. The input sample aspect ratio.
  6559. @item t
  6560. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6561. @item text_h, th
  6562. the height of the rendered text
  6563. @item text_w, tw
  6564. the width of the rendered text
  6565. @item x
  6566. @item y
  6567. the x and y offset coordinates where the text is drawn.
  6568. These parameters allow the @var{x} and @var{y} expressions to refer
  6569. each other, so you can for example specify @code{y=x/dar}.
  6570. @end table
  6571. @anchor{drawtext_expansion}
  6572. @subsection Text expansion
  6573. If @option{expansion} is set to @code{strftime},
  6574. the filter recognizes strftime() sequences in the provided text and
  6575. expands them accordingly. Check the documentation of strftime(). This
  6576. feature is deprecated.
  6577. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6578. If @option{expansion} is set to @code{normal} (which is the default),
  6579. the following expansion mechanism is used.
  6580. The backslash character @samp{\}, followed by any character, always expands to
  6581. the second character.
  6582. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6583. braces is a function name, possibly followed by arguments separated by ':'.
  6584. If the arguments contain special characters or delimiters (':' or '@}'),
  6585. they should be escaped.
  6586. Note that they probably must also be escaped as the value for the
  6587. @option{text} option in the filter argument string and as the filter
  6588. argument in the filtergraph description, and possibly also for the shell,
  6589. that makes up to four levels of escaping; using a text file avoids these
  6590. problems.
  6591. The following functions are available:
  6592. @table @command
  6593. @item expr, e
  6594. The expression evaluation result.
  6595. It must take one argument specifying the expression to be evaluated,
  6596. which accepts the same constants and functions as the @var{x} and
  6597. @var{y} values. Note that not all constants should be used, for
  6598. example the text size is not known when evaluating the expression, so
  6599. the constants @var{text_w} and @var{text_h} will have an undefined
  6600. value.
  6601. @item expr_int_format, eif
  6602. Evaluate the expression's value and output as formatted integer.
  6603. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6604. The second argument specifies the output format. Allowed values are @samp{x},
  6605. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6606. @code{printf} function.
  6607. The third parameter is optional and sets the number of positions taken by the output.
  6608. It can be used to add padding with zeros from the left.
  6609. @item gmtime
  6610. The time at which the filter is running, expressed in UTC.
  6611. It can accept an argument: a strftime() format string.
  6612. @item localtime
  6613. The time at which the filter is running, expressed in the local time zone.
  6614. It can accept an argument: a strftime() format string.
  6615. @item metadata
  6616. Frame metadata. Takes one or two arguments.
  6617. The first argument is mandatory and specifies the metadata key.
  6618. The second argument is optional and specifies a default value, used when the
  6619. metadata key is not found or empty.
  6620. @item n, frame_num
  6621. The frame number, starting from 0.
  6622. @item pict_type
  6623. A 1 character description of the current picture type.
  6624. @item pts
  6625. The timestamp of the current frame.
  6626. It can take up to three arguments.
  6627. The first argument is the format of the timestamp; it defaults to @code{flt}
  6628. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6629. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6630. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6631. @code{localtime} stands for the timestamp of the frame formatted as
  6632. local time zone time.
  6633. The second argument is an offset added to the timestamp.
  6634. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6635. supplied to present the hour part of the formatted timestamp in 24h format
  6636. (00-23).
  6637. If the format is set to @code{localtime} or @code{gmtime},
  6638. a third argument may be supplied: a strftime() format string.
  6639. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6640. @end table
  6641. @subsection Examples
  6642. @itemize
  6643. @item
  6644. Draw "Test Text" with font FreeSerif, using the default values for the
  6645. optional parameters.
  6646. @example
  6647. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6648. @end example
  6649. @item
  6650. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6651. and y=50 (counting from the top-left corner of the screen), text is
  6652. yellow with a red box around it. Both the text and the box have an
  6653. opacity of 20%.
  6654. @example
  6655. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6656. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6657. @end example
  6658. Note that the double quotes are not necessary if spaces are not used
  6659. within the parameter list.
  6660. @item
  6661. Show the text at the center of the video frame:
  6662. @example
  6663. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6664. @end example
  6665. @item
  6666. Show the text at a random position, switching to a new position every 30 seconds:
  6667. @example
  6668. 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)"
  6669. @end example
  6670. @item
  6671. Show a text line sliding from right to left in the last row of the video
  6672. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6673. with no newlines.
  6674. @example
  6675. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6676. @end example
  6677. @item
  6678. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6679. @example
  6680. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6681. @end example
  6682. @item
  6683. Draw a single green letter "g", at the center of the input video.
  6684. The glyph baseline is placed at half screen height.
  6685. @example
  6686. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6687. @end example
  6688. @item
  6689. Show text for 1 second every 3 seconds:
  6690. @example
  6691. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6692. @end example
  6693. @item
  6694. Use fontconfig to set the font. Note that the colons need to be escaped.
  6695. @example
  6696. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6697. @end example
  6698. @item
  6699. Print the date of a real-time encoding (see strftime(3)):
  6700. @example
  6701. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6702. @end example
  6703. @item
  6704. Show text fading in and out (appearing/disappearing):
  6705. @example
  6706. #!/bin/sh
  6707. DS=1.0 # display start
  6708. DE=10.0 # display end
  6709. FID=1.5 # fade in duration
  6710. FOD=5 # fade out duration
  6711. 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 @}"
  6712. @end example
  6713. @item
  6714. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6715. and the @option{fontsize} value are included in the @option{y} offset.
  6716. @example
  6717. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6718. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6719. @end example
  6720. @end itemize
  6721. For more information about libfreetype, check:
  6722. @url{http://www.freetype.org/}.
  6723. For more information about fontconfig, check:
  6724. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6725. For more information about libfribidi, check:
  6726. @url{http://fribidi.org/}.
  6727. @section edgedetect
  6728. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6729. The filter accepts the following options:
  6730. @table @option
  6731. @item low
  6732. @item high
  6733. Set low and high threshold values used by the Canny thresholding
  6734. algorithm.
  6735. The high threshold selects the "strong" edge pixels, which are then
  6736. connected through 8-connectivity with the "weak" edge pixels selected
  6737. by the low threshold.
  6738. @var{low} and @var{high} threshold values must be chosen in the range
  6739. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6740. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6741. is @code{50/255}.
  6742. @item mode
  6743. Define the drawing mode.
  6744. @table @samp
  6745. @item wires
  6746. Draw white/gray wires on black background.
  6747. @item colormix
  6748. Mix the colors to create a paint/cartoon effect.
  6749. @item canny
  6750. Apply Canny edge detector on all selected planes.
  6751. @end table
  6752. Default value is @var{wires}.
  6753. @item planes
  6754. Select planes for filtering. By default all available planes are filtered.
  6755. @end table
  6756. @subsection Examples
  6757. @itemize
  6758. @item
  6759. Standard edge detection with custom values for the hysteresis thresholding:
  6760. @example
  6761. edgedetect=low=0.1:high=0.4
  6762. @end example
  6763. @item
  6764. Painting effect without thresholding:
  6765. @example
  6766. edgedetect=mode=colormix:high=0
  6767. @end example
  6768. @end itemize
  6769. @section eq
  6770. Set brightness, contrast, saturation and approximate gamma adjustment.
  6771. The filter accepts the following options:
  6772. @table @option
  6773. @item contrast
  6774. Set the contrast expression. The value must be a float value in range
  6775. @code{-2.0} to @code{2.0}. The default value is "1".
  6776. @item brightness
  6777. Set the brightness expression. The value must be a float value in
  6778. range @code{-1.0} to @code{1.0}. The default value is "0".
  6779. @item saturation
  6780. Set the saturation expression. The value must be a float in
  6781. range @code{0.0} to @code{3.0}. The default value is "1".
  6782. @item gamma
  6783. Set the gamma expression. The value must be a float in range
  6784. @code{0.1} to @code{10.0}. The default value is "1".
  6785. @item gamma_r
  6786. Set the gamma expression for red. The value must be a float in
  6787. range @code{0.1} to @code{10.0}. The default value is "1".
  6788. @item gamma_g
  6789. Set the gamma expression for green. The value must be a float in range
  6790. @code{0.1} to @code{10.0}. The default value is "1".
  6791. @item gamma_b
  6792. Set the gamma expression for blue. The value must be a float in range
  6793. @code{0.1} to @code{10.0}. The default value is "1".
  6794. @item gamma_weight
  6795. Set the gamma weight expression. It can be used to reduce the effect
  6796. of a high gamma value on bright image areas, e.g. keep them from
  6797. getting overamplified and just plain white. The value must be a float
  6798. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6799. gamma correction all the way down while @code{1.0} leaves it at its
  6800. full strength. Default is "1".
  6801. @item eval
  6802. Set when the expressions for brightness, contrast, saturation and
  6803. gamma expressions are evaluated.
  6804. It accepts the following values:
  6805. @table @samp
  6806. @item init
  6807. only evaluate expressions once during the filter initialization or
  6808. when a command is processed
  6809. @item frame
  6810. evaluate expressions for each incoming frame
  6811. @end table
  6812. Default value is @samp{init}.
  6813. @end table
  6814. The expressions accept the following parameters:
  6815. @table @option
  6816. @item n
  6817. frame count of the input frame starting from 0
  6818. @item pos
  6819. byte position of the corresponding packet in the input file, NAN if
  6820. unspecified
  6821. @item r
  6822. frame rate of the input video, NAN if the input frame rate is unknown
  6823. @item t
  6824. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6825. @end table
  6826. @subsection Commands
  6827. The filter supports the following commands:
  6828. @table @option
  6829. @item contrast
  6830. Set the contrast expression.
  6831. @item brightness
  6832. Set the brightness expression.
  6833. @item saturation
  6834. Set the saturation expression.
  6835. @item gamma
  6836. Set the gamma expression.
  6837. @item gamma_r
  6838. Set the gamma_r expression.
  6839. @item gamma_g
  6840. Set gamma_g expression.
  6841. @item gamma_b
  6842. Set gamma_b expression.
  6843. @item gamma_weight
  6844. Set gamma_weight expression.
  6845. The command accepts the same syntax of the corresponding option.
  6846. If the specified expression is not valid, it is kept at its current
  6847. value.
  6848. @end table
  6849. @section erosion
  6850. Apply erosion effect to the video.
  6851. This filter replaces the pixel by the local(3x3) minimum.
  6852. It accepts the following options:
  6853. @table @option
  6854. @item threshold0
  6855. @item threshold1
  6856. @item threshold2
  6857. @item threshold3
  6858. Limit the maximum change for each plane, default is 65535.
  6859. If 0, plane will remain unchanged.
  6860. @item coordinates
  6861. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6862. pixels are used.
  6863. Flags to local 3x3 coordinates maps like this:
  6864. 1 2 3
  6865. 4 5
  6866. 6 7 8
  6867. @end table
  6868. @section extractplanes
  6869. Extract color channel components from input video stream into
  6870. separate grayscale video streams.
  6871. The filter accepts the following option:
  6872. @table @option
  6873. @item planes
  6874. Set plane(s) to extract.
  6875. Available values for planes are:
  6876. @table @samp
  6877. @item y
  6878. @item u
  6879. @item v
  6880. @item a
  6881. @item r
  6882. @item g
  6883. @item b
  6884. @end table
  6885. Choosing planes not available in the input will result in an error.
  6886. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6887. with @code{y}, @code{u}, @code{v} planes at same time.
  6888. @end table
  6889. @subsection Examples
  6890. @itemize
  6891. @item
  6892. Extract luma, u and v color channel component from input video frame
  6893. into 3 grayscale outputs:
  6894. @example
  6895. 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
  6896. @end example
  6897. @end itemize
  6898. @section elbg
  6899. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6900. For each input image, the filter will compute the optimal mapping from
  6901. the input to the output given the codebook length, that is the number
  6902. of distinct output colors.
  6903. This filter accepts the following options.
  6904. @table @option
  6905. @item codebook_length, l
  6906. Set codebook length. The value must be a positive integer, and
  6907. represents the number of distinct output colors. Default value is 256.
  6908. @item nb_steps, n
  6909. Set the maximum number of iterations to apply for computing the optimal
  6910. mapping. The higher the value the better the result and the higher the
  6911. computation time. Default value is 1.
  6912. @item seed, s
  6913. Set a random seed, must be an integer included between 0 and
  6914. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6915. will try to use a good random seed on a best effort basis.
  6916. @item pal8
  6917. Set pal8 output pixel format. This option does not work with codebook
  6918. length greater than 256.
  6919. @end table
  6920. @section entropy
  6921. Measure graylevel entropy in histogram of color channels of video frames.
  6922. It accepts the following parameters:
  6923. @table @option
  6924. @item mode
  6925. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6926. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6927. between neighbour histogram values.
  6928. @end table
  6929. @section fade
  6930. Apply a fade-in/out effect to the input video.
  6931. It accepts the following parameters:
  6932. @table @option
  6933. @item type, t
  6934. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6935. effect.
  6936. Default is @code{in}.
  6937. @item start_frame, s
  6938. Specify the number of the frame to start applying the fade
  6939. effect at. Default is 0.
  6940. @item nb_frames, n
  6941. The number of frames that the fade effect lasts. At the end of the
  6942. fade-in effect, the output video will have the same intensity as the input video.
  6943. At the end of the fade-out transition, the output video will be filled with the
  6944. selected @option{color}.
  6945. Default is 25.
  6946. @item alpha
  6947. If set to 1, fade only alpha channel, if one exists on the input.
  6948. Default value is 0.
  6949. @item start_time, st
  6950. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6951. effect. If both start_frame and start_time are specified, the fade will start at
  6952. whichever comes last. Default is 0.
  6953. @item duration, d
  6954. The number of seconds for which the fade effect has to last. At the end of the
  6955. fade-in effect the output video will have the same intensity as the input video,
  6956. at the end of the fade-out transition the output video will be filled with the
  6957. selected @option{color}.
  6958. If both duration and nb_frames are specified, duration is used. Default is 0
  6959. (nb_frames is used by default).
  6960. @item color, c
  6961. Specify the color of the fade. Default is "black".
  6962. @end table
  6963. @subsection Examples
  6964. @itemize
  6965. @item
  6966. Fade in the first 30 frames of video:
  6967. @example
  6968. fade=in:0:30
  6969. @end example
  6970. The command above is equivalent to:
  6971. @example
  6972. fade=t=in:s=0:n=30
  6973. @end example
  6974. @item
  6975. Fade out the last 45 frames of a 200-frame video:
  6976. @example
  6977. fade=out:155:45
  6978. fade=type=out:start_frame=155:nb_frames=45
  6979. @end example
  6980. @item
  6981. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6982. @example
  6983. fade=in:0:25, fade=out:975:25
  6984. @end example
  6985. @item
  6986. Make the first 5 frames yellow, then fade in from frame 5-24:
  6987. @example
  6988. fade=in:5:20:color=yellow
  6989. @end example
  6990. @item
  6991. Fade in alpha over first 25 frames of video:
  6992. @example
  6993. fade=in:0:25:alpha=1
  6994. @end example
  6995. @item
  6996. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6997. @example
  6998. fade=t=in:st=5.5:d=0.5
  6999. @end example
  7000. @end itemize
  7001. @section fftfilt
  7002. Apply arbitrary expressions to samples in frequency domain
  7003. @table @option
  7004. @item dc_Y
  7005. Adjust the dc value (gain) of the luma plane of the image. The filter
  7006. accepts an integer value in range @code{0} to @code{1000}. The default
  7007. value is set to @code{0}.
  7008. @item dc_U
  7009. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7010. filter accepts an integer value in range @code{0} to @code{1000}. The
  7011. default value is set to @code{0}.
  7012. @item dc_V
  7013. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7014. filter accepts an integer value in range @code{0} to @code{1000}. The
  7015. default value is set to @code{0}.
  7016. @item weight_Y
  7017. Set the frequency domain weight expression for the luma plane.
  7018. @item weight_U
  7019. Set the frequency domain weight expression for the 1st chroma plane.
  7020. @item weight_V
  7021. Set the frequency domain weight expression for the 2nd chroma plane.
  7022. @item eval
  7023. Set when the expressions are evaluated.
  7024. It accepts the following values:
  7025. @table @samp
  7026. @item init
  7027. Only evaluate expressions once during the filter initialization.
  7028. @item frame
  7029. Evaluate expressions for each incoming frame.
  7030. @end table
  7031. Default value is @samp{init}.
  7032. The filter accepts the following variables:
  7033. @item X
  7034. @item Y
  7035. The coordinates of the current sample.
  7036. @item W
  7037. @item H
  7038. The width and height of the image.
  7039. @item N
  7040. The number of input frame, starting from 0.
  7041. @end table
  7042. @subsection Examples
  7043. @itemize
  7044. @item
  7045. High-pass:
  7046. @example
  7047. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7048. @end example
  7049. @item
  7050. Low-pass:
  7051. @example
  7052. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7053. @end example
  7054. @item
  7055. Sharpen:
  7056. @example
  7057. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7058. @end example
  7059. @item
  7060. Blur:
  7061. @example
  7062. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7063. @end example
  7064. @end itemize
  7065. @section fftdnoiz
  7066. Denoise frames using 3D FFT (frequency domain filtering).
  7067. The filter accepts the following options:
  7068. @table @option
  7069. @item sigma
  7070. Set the noise sigma constant. This sets denoising strength.
  7071. Default value is 1. Allowed range is from 0 to 30.
  7072. Using very high sigma with low overlap may give blocking artifacts.
  7073. @item amount
  7074. Set amount of denoising. By default all detected noise is reduced.
  7075. Default value is 1. Allowed range is from 0 to 1.
  7076. @item block
  7077. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7078. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7079. block size in pixels is 2^4 which is 16.
  7080. @item overlap
  7081. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7082. @item prev
  7083. Set number of previous frames to use for denoising. By default is set to 0.
  7084. @item next
  7085. Set number of next frames to to use for denoising. By default is set to 0.
  7086. @item planes
  7087. Set planes which will be filtered, by default are all available filtered
  7088. except alpha.
  7089. @end table
  7090. @section field
  7091. Extract a single field from an interlaced image using stride
  7092. arithmetic to avoid wasting CPU time. The output frames are marked as
  7093. non-interlaced.
  7094. The filter accepts the following options:
  7095. @table @option
  7096. @item type
  7097. Specify whether to extract the top (if the value is @code{0} or
  7098. @code{top}) or the bottom field (if the value is @code{1} or
  7099. @code{bottom}).
  7100. @end table
  7101. @section fieldhint
  7102. Create new frames by copying the top and bottom fields from surrounding frames
  7103. supplied as numbers by the hint file.
  7104. @table @option
  7105. @item hint
  7106. Set file containing hints: absolute/relative frame numbers.
  7107. There must be one line for each frame in a clip. Each line must contain two
  7108. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7109. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7110. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7111. for @code{relative} mode. First number tells from which frame to pick up top
  7112. field and second number tells from which frame to pick up bottom field.
  7113. If optionally followed by @code{+} output frame will be marked as interlaced,
  7114. else if followed by @code{-} output frame will be marked as progressive, else
  7115. it will be marked same as input frame.
  7116. If line starts with @code{#} or @code{;} that line is skipped.
  7117. @item mode
  7118. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7119. @end table
  7120. Example of first several lines of @code{hint} file for @code{relative} mode:
  7121. @example
  7122. 0,0 - # first frame
  7123. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7124. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7125. 1,0 -
  7126. 0,0 -
  7127. 0,0 -
  7128. 1,0 -
  7129. 1,0 -
  7130. 1,0 -
  7131. 0,0 -
  7132. 0,0 -
  7133. 1,0 -
  7134. 1,0 -
  7135. 1,0 -
  7136. 0,0 -
  7137. @end example
  7138. @section fieldmatch
  7139. Field matching filter for inverse telecine. It is meant to reconstruct the
  7140. progressive frames from a telecined stream. The filter does not drop duplicated
  7141. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7142. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7143. The separation of the field matching and the decimation is notably motivated by
  7144. the possibility of inserting a de-interlacing filter fallback between the two.
  7145. If the source has mixed telecined and real interlaced content,
  7146. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7147. But these remaining combed frames will be marked as interlaced, and thus can be
  7148. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7149. In addition to the various configuration options, @code{fieldmatch} can take an
  7150. optional second stream, activated through the @option{ppsrc} option. If
  7151. enabled, the frames reconstruction will be based on the fields and frames from
  7152. this second stream. This allows the first input to be pre-processed in order to
  7153. help the various algorithms of the filter, while keeping the output lossless
  7154. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7155. or brightness/contrast adjustments can help.
  7156. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7157. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7158. which @code{fieldmatch} is based on. While the semantic and usage are very
  7159. close, some behaviour and options names can differ.
  7160. The @ref{decimate} filter currently only works for constant frame rate input.
  7161. If your input has mixed telecined (30fps) and progressive content with a lower
  7162. framerate like 24fps use the following filterchain to produce the necessary cfr
  7163. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7164. The filter accepts the following options:
  7165. @table @option
  7166. @item order
  7167. Specify the assumed field order of the input stream. Available values are:
  7168. @table @samp
  7169. @item auto
  7170. Auto detect parity (use FFmpeg's internal parity value).
  7171. @item bff
  7172. Assume bottom field first.
  7173. @item tff
  7174. Assume top field first.
  7175. @end table
  7176. Note that it is sometimes recommended not to trust the parity announced by the
  7177. stream.
  7178. Default value is @var{auto}.
  7179. @item mode
  7180. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7181. sense that it won't risk creating jerkiness due to duplicate frames when
  7182. possible, but if there are bad edits or blended fields it will end up
  7183. outputting combed frames when a good match might actually exist. On the other
  7184. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7185. but will almost always find a good frame if there is one. The other values are
  7186. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7187. jerkiness and creating duplicate frames versus finding good matches in sections
  7188. with bad edits, orphaned fields, blended fields, etc.
  7189. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7190. Available values are:
  7191. @table @samp
  7192. @item pc
  7193. 2-way matching (p/c)
  7194. @item pc_n
  7195. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7196. @item pc_u
  7197. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7198. @item pc_n_ub
  7199. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7200. still combed (p/c + n + u/b)
  7201. @item pcn
  7202. 3-way matching (p/c/n)
  7203. @item pcn_ub
  7204. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7205. detected as combed (p/c/n + u/b)
  7206. @end table
  7207. The parenthesis at the end indicate the matches that would be used for that
  7208. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7209. @var{top}).
  7210. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7211. the slowest.
  7212. Default value is @var{pc_n}.
  7213. @item ppsrc
  7214. Mark the main input stream as a pre-processed input, and enable the secondary
  7215. input stream as the clean source to pick the fields from. See the filter
  7216. introduction for more details. It is similar to the @option{clip2} feature from
  7217. VFM/TFM.
  7218. Default value is @code{0} (disabled).
  7219. @item field
  7220. Set the field to match from. It is recommended to set this to the same value as
  7221. @option{order} unless you experience matching failures with that setting. In
  7222. certain circumstances changing the field that is used to match from can have a
  7223. large impact on matching performance. Available values are:
  7224. @table @samp
  7225. @item auto
  7226. Automatic (same value as @option{order}).
  7227. @item bottom
  7228. Match from the bottom field.
  7229. @item top
  7230. Match from the top field.
  7231. @end table
  7232. Default value is @var{auto}.
  7233. @item mchroma
  7234. Set whether or not chroma is included during the match comparisons. In most
  7235. cases it is recommended to leave this enabled. You should set this to @code{0}
  7236. only if your clip has bad chroma problems such as heavy rainbowing or other
  7237. artifacts. Setting this to @code{0} could also be used to speed things up at
  7238. the cost of some accuracy.
  7239. Default value is @code{1}.
  7240. @item y0
  7241. @item y1
  7242. These define an exclusion band which excludes the lines between @option{y0} and
  7243. @option{y1} from being included in the field matching decision. An exclusion
  7244. band can be used to ignore subtitles, a logo, or other things that may
  7245. interfere with the matching. @option{y0} sets the starting scan line and
  7246. @option{y1} sets the ending line; all lines in between @option{y0} and
  7247. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7248. @option{y0} and @option{y1} to the same value will disable the feature.
  7249. @option{y0} and @option{y1} defaults to @code{0}.
  7250. @item scthresh
  7251. Set the scene change detection threshold as a percentage of maximum change on
  7252. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7253. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7254. @option{scthresh} is @code{[0.0, 100.0]}.
  7255. Default value is @code{12.0}.
  7256. @item combmatch
  7257. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7258. account the combed scores of matches when deciding what match to use as the
  7259. final match. Available values are:
  7260. @table @samp
  7261. @item none
  7262. No final matching based on combed scores.
  7263. @item sc
  7264. Combed scores are only used when a scene change is detected.
  7265. @item full
  7266. Use combed scores all the time.
  7267. @end table
  7268. Default is @var{sc}.
  7269. @item combdbg
  7270. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7271. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7272. Available values are:
  7273. @table @samp
  7274. @item none
  7275. No forced calculation.
  7276. @item pcn
  7277. Force p/c/n calculations.
  7278. @item pcnub
  7279. Force p/c/n/u/b calculations.
  7280. @end table
  7281. Default value is @var{none}.
  7282. @item cthresh
  7283. This is the area combing threshold used for combed frame detection. This
  7284. essentially controls how "strong" or "visible" combing must be to be detected.
  7285. Larger values mean combing must be more visible and smaller values mean combing
  7286. can be less visible or strong and still be detected. Valid settings are from
  7287. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7288. be detected as combed). This is basically a pixel difference value. A good
  7289. range is @code{[8, 12]}.
  7290. Default value is @code{9}.
  7291. @item chroma
  7292. Sets whether or not chroma is considered in the combed frame decision. Only
  7293. disable this if your source has chroma problems (rainbowing, etc.) that are
  7294. causing problems for the combed frame detection with chroma enabled. Actually,
  7295. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7296. where there is chroma only combing in the source.
  7297. Default value is @code{0}.
  7298. @item blockx
  7299. @item blocky
  7300. Respectively set the x-axis and y-axis size of the window used during combed
  7301. frame detection. This has to do with the size of the area in which
  7302. @option{combpel} pixels are required to be detected as combed for a frame to be
  7303. declared combed. See the @option{combpel} parameter description for more info.
  7304. Possible values are any number that is a power of 2 starting at 4 and going up
  7305. to 512.
  7306. Default value is @code{16}.
  7307. @item combpel
  7308. The number of combed pixels inside any of the @option{blocky} by
  7309. @option{blockx} size blocks on the frame for the frame to be detected as
  7310. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7311. setting controls "how much" combing there must be in any localized area (a
  7312. window defined by the @option{blockx} and @option{blocky} settings) on the
  7313. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7314. which point no frames will ever be detected as combed). This setting is known
  7315. as @option{MI} in TFM/VFM vocabulary.
  7316. Default value is @code{80}.
  7317. @end table
  7318. @anchor{p/c/n/u/b meaning}
  7319. @subsection p/c/n/u/b meaning
  7320. @subsubsection p/c/n
  7321. We assume the following telecined stream:
  7322. @example
  7323. Top fields: 1 2 2 3 4
  7324. Bottom fields: 1 2 3 4 4
  7325. @end example
  7326. The numbers correspond to the progressive frame the fields relate to. Here, the
  7327. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7328. When @code{fieldmatch} is configured to run a matching from bottom
  7329. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7330. @example
  7331. Input stream:
  7332. T 1 2 2 3 4
  7333. B 1 2 3 4 4 <-- matching reference
  7334. Matches: c c n n c
  7335. Output stream:
  7336. T 1 2 3 4 4
  7337. B 1 2 3 4 4
  7338. @end example
  7339. As a result of the field matching, we can see that some frames get duplicated.
  7340. To perform a complete inverse telecine, you need to rely on a decimation filter
  7341. after this operation. See for instance the @ref{decimate} filter.
  7342. The same operation now matching from top fields (@option{field}=@var{top})
  7343. looks like this:
  7344. @example
  7345. Input stream:
  7346. T 1 2 2 3 4 <-- matching reference
  7347. B 1 2 3 4 4
  7348. Matches: c c p p c
  7349. Output stream:
  7350. T 1 2 2 3 4
  7351. B 1 2 2 3 4
  7352. @end example
  7353. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7354. basically, they refer to the frame and field of the opposite parity:
  7355. @itemize
  7356. @item @var{p} matches the field of the opposite parity in the previous frame
  7357. @item @var{c} matches the field of the opposite parity in the current frame
  7358. @item @var{n} matches the field of the opposite parity in the next frame
  7359. @end itemize
  7360. @subsubsection u/b
  7361. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7362. from the opposite parity flag. In the following examples, we assume that we are
  7363. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7364. 'x' is placed above and below each matched fields.
  7365. With bottom matching (@option{field}=@var{bottom}):
  7366. @example
  7367. Match: c p n b u
  7368. x x x x x
  7369. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7370. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7371. x x x x x
  7372. Output frames:
  7373. 2 1 2 2 2
  7374. 2 2 2 1 3
  7375. @end example
  7376. With top matching (@option{field}=@var{top}):
  7377. @example
  7378. Match: c p n b u
  7379. x x x x x
  7380. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7381. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7382. x x x x x
  7383. Output frames:
  7384. 2 2 2 1 2
  7385. 2 1 3 2 2
  7386. @end example
  7387. @subsection Examples
  7388. Simple IVTC of a top field first telecined stream:
  7389. @example
  7390. fieldmatch=order=tff:combmatch=none, decimate
  7391. @end example
  7392. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7393. @example
  7394. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7395. @end example
  7396. @section fieldorder
  7397. Transform the field order of the input video.
  7398. It accepts the following parameters:
  7399. @table @option
  7400. @item order
  7401. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7402. for bottom field first.
  7403. @end table
  7404. The default value is @samp{tff}.
  7405. The transformation is done by shifting the picture content up or down
  7406. by one line, and filling the remaining line with appropriate picture content.
  7407. This method is consistent with most broadcast field order converters.
  7408. If the input video is not flagged as being interlaced, or it is already
  7409. flagged as being of the required output field order, then this filter does
  7410. not alter the incoming video.
  7411. It is very useful when converting to or from PAL DV material,
  7412. which is bottom field first.
  7413. For example:
  7414. @example
  7415. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7416. @end example
  7417. @section fifo, afifo
  7418. Buffer input images and send them when they are requested.
  7419. It is mainly useful when auto-inserted by the libavfilter
  7420. framework.
  7421. It does not take parameters.
  7422. @section fillborders
  7423. Fill borders of the input video, without changing video stream dimensions.
  7424. Sometimes video can have garbage at the four edges and you may not want to
  7425. crop video input to keep size multiple of some number.
  7426. This filter accepts the following options:
  7427. @table @option
  7428. @item left
  7429. Number of pixels to fill from left border.
  7430. @item right
  7431. Number of pixels to fill from right border.
  7432. @item top
  7433. Number of pixels to fill from top border.
  7434. @item bottom
  7435. Number of pixels to fill from bottom border.
  7436. @item mode
  7437. Set fill mode.
  7438. It accepts the following values:
  7439. @table @samp
  7440. @item smear
  7441. fill pixels using outermost pixels
  7442. @item mirror
  7443. fill pixels using mirroring
  7444. @item fixed
  7445. fill pixels with constant value
  7446. @end table
  7447. Default is @var{smear}.
  7448. @item color
  7449. Set color for pixels in fixed mode. Default is @var{black}.
  7450. @end table
  7451. @section find_rect
  7452. Find a rectangular object
  7453. It accepts the following options:
  7454. @table @option
  7455. @item object
  7456. Filepath of the object image, needs to be in gray8.
  7457. @item threshold
  7458. Detection threshold, default is 0.5.
  7459. @item mipmaps
  7460. Number of mipmaps, default is 3.
  7461. @item xmin, ymin, xmax, ymax
  7462. Specifies the rectangle in which to search.
  7463. @end table
  7464. @subsection Examples
  7465. @itemize
  7466. @item
  7467. Generate a representative palette of a given video using @command{ffmpeg}:
  7468. @example
  7469. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7470. @end example
  7471. @end itemize
  7472. @section cover_rect
  7473. Cover a rectangular object
  7474. It accepts the following options:
  7475. @table @option
  7476. @item cover
  7477. Filepath of the optional cover image, needs to be in yuv420.
  7478. @item mode
  7479. Set covering mode.
  7480. It accepts the following values:
  7481. @table @samp
  7482. @item cover
  7483. cover it by the supplied image
  7484. @item blur
  7485. cover it by interpolating the surrounding pixels
  7486. @end table
  7487. Default value is @var{blur}.
  7488. @end table
  7489. @subsection Examples
  7490. @itemize
  7491. @item
  7492. Generate a representative palette of a given video using @command{ffmpeg}:
  7493. @example
  7494. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7495. @end example
  7496. @end itemize
  7497. @section floodfill
  7498. Flood area with values of same pixel components with another values.
  7499. It accepts the following options:
  7500. @table @option
  7501. @item x
  7502. Set pixel x coordinate.
  7503. @item y
  7504. Set pixel y coordinate.
  7505. @item s0
  7506. Set source #0 component value.
  7507. @item s1
  7508. Set source #1 component value.
  7509. @item s2
  7510. Set source #2 component value.
  7511. @item s3
  7512. Set source #3 component value.
  7513. @item d0
  7514. Set destination #0 component value.
  7515. @item d1
  7516. Set destination #1 component value.
  7517. @item d2
  7518. Set destination #2 component value.
  7519. @item d3
  7520. Set destination #3 component value.
  7521. @end table
  7522. @anchor{format}
  7523. @section format
  7524. Convert the input video to one of the specified pixel formats.
  7525. Libavfilter will try to pick one that is suitable as input to
  7526. the next filter.
  7527. It accepts the following parameters:
  7528. @table @option
  7529. @item pix_fmts
  7530. A '|'-separated list of pixel format names, such as
  7531. "pix_fmts=yuv420p|monow|rgb24".
  7532. @end table
  7533. @subsection Examples
  7534. @itemize
  7535. @item
  7536. Convert the input video to the @var{yuv420p} format
  7537. @example
  7538. format=pix_fmts=yuv420p
  7539. @end example
  7540. Convert the input video to any of the formats in the list
  7541. @example
  7542. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7543. @end example
  7544. @end itemize
  7545. @anchor{fps}
  7546. @section fps
  7547. Convert the video to specified constant frame rate by duplicating or dropping
  7548. frames as necessary.
  7549. It accepts the following parameters:
  7550. @table @option
  7551. @item fps
  7552. The desired output frame rate. The default is @code{25}.
  7553. @item start_time
  7554. Assume the first PTS should be the given value, in seconds. This allows for
  7555. padding/trimming at the start of stream. By default, no assumption is made
  7556. about the first frame's expected PTS, so no padding or trimming is done.
  7557. For example, this could be set to 0 to pad the beginning with duplicates of
  7558. the first frame if a video stream starts after the audio stream or to trim any
  7559. frames with a negative PTS.
  7560. @item round
  7561. Timestamp (PTS) rounding method.
  7562. Possible values are:
  7563. @table @option
  7564. @item zero
  7565. round towards 0
  7566. @item inf
  7567. round away from 0
  7568. @item down
  7569. round towards -infinity
  7570. @item up
  7571. round towards +infinity
  7572. @item near
  7573. round to nearest
  7574. @end table
  7575. The default is @code{near}.
  7576. @item eof_action
  7577. Action performed when reading the last frame.
  7578. Possible values are:
  7579. @table @option
  7580. @item round
  7581. Use same timestamp rounding method as used for other frames.
  7582. @item pass
  7583. Pass through last frame if input duration has not been reached yet.
  7584. @end table
  7585. The default is @code{round}.
  7586. @end table
  7587. Alternatively, the options can be specified as a flat string:
  7588. @var{fps}[:@var{start_time}[:@var{round}]].
  7589. See also the @ref{setpts} filter.
  7590. @subsection Examples
  7591. @itemize
  7592. @item
  7593. A typical usage in order to set the fps to 25:
  7594. @example
  7595. fps=fps=25
  7596. @end example
  7597. @item
  7598. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7599. @example
  7600. fps=fps=film:round=near
  7601. @end example
  7602. @end itemize
  7603. @section framepack
  7604. Pack two different video streams into a stereoscopic video, setting proper
  7605. metadata on supported codecs. The two views should have the same size and
  7606. framerate and processing will stop when the shorter video ends. Please note
  7607. that you may conveniently adjust view properties with the @ref{scale} and
  7608. @ref{fps} filters.
  7609. It accepts the following parameters:
  7610. @table @option
  7611. @item format
  7612. The desired packing format. Supported values are:
  7613. @table @option
  7614. @item sbs
  7615. The views are next to each other (default).
  7616. @item tab
  7617. The views are on top of each other.
  7618. @item lines
  7619. The views are packed by line.
  7620. @item columns
  7621. The views are packed by column.
  7622. @item frameseq
  7623. The views are temporally interleaved.
  7624. @end table
  7625. @end table
  7626. Some examples:
  7627. @example
  7628. # Convert left and right views into a frame-sequential video
  7629. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7630. # Convert views into a side-by-side video with the same output resolution as the input
  7631. 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
  7632. @end example
  7633. @section framerate
  7634. Change the frame rate by interpolating new video output frames from the source
  7635. frames.
  7636. This filter is not designed to function correctly with interlaced media. If
  7637. you wish to change the frame rate of interlaced media then you are required
  7638. to deinterlace before this filter and re-interlace after this filter.
  7639. A description of the accepted options follows.
  7640. @table @option
  7641. @item fps
  7642. Specify the output frames per second. This option can also be specified
  7643. as a value alone. The default is @code{50}.
  7644. @item interp_start
  7645. Specify the start of a range where the output frame will be created as a
  7646. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7647. the default is @code{15}.
  7648. @item interp_end
  7649. Specify the end of a range where the output frame will be created as a
  7650. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7651. the default is @code{240}.
  7652. @item scene
  7653. Specify the level at which a scene change is detected as a value between
  7654. 0 and 100 to indicate a new scene; a low value reflects a low
  7655. probability for the current frame to introduce a new scene, while a higher
  7656. value means the current frame is more likely to be one.
  7657. The default is @code{8.2}.
  7658. @item flags
  7659. Specify flags influencing the filter process.
  7660. Available value for @var{flags} is:
  7661. @table @option
  7662. @item scene_change_detect, scd
  7663. Enable scene change detection using the value of the option @var{scene}.
  7664. This flag is enabled by default.
  7665. @end table
  7666. @end table
  7667. @section framestep
  7668. Select one frame every N-th frame.
  7669. This filter accepts the following option:
  7670. @table @option
  7671. @item step
  7672. Select frame after every @code{step} frames.
  7673. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7674. @end table
  7675. @anchor{frei0r}
  7676. @section frei0r
  7677. Apply a frei0r effect to the input video.
  7678. To enable the compilation of this filter, you need to install the frei0r
  7679. header and configure FFmpeg with @code{--enable-frei0r}.
  7680. It accepts the following parameters:
  7681. @table @option
  7682. @item filter_name
  7683. The name of the frei0r effect to load. If the environment variable
  7684. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7685. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7686. Otherwise, the standard frei0r paths are searched, in this order:
  7687. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7688. @file{/usr/lib/frei0r-1/}.
  7689. @item filter_params
  7690. A '|'-separated list of parameters to pass to the frei0r effect.
  7691. @end table
  7692. A frei0r effect parameter can be a boolean (its value is either
  7693. "y" or "n"), a double, a color (specified as
  7694. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7695. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7696. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7697. a position (specified as @var{X}/@var{Y}, where
  7698. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7699. The number and types of parameters depend on the loaded effect. If an
  7700. effect parameter is not specified, the default value is set.
  7701. @subsection Examples
  7702. @itemize
  7703. @item
  7704. Apply the distort0r effect, setting the first two double parameters:
  7705. @example
  7706. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7707. @end example
  7708. @item
  7709. Apply the colordistance effect, taking a color as the first parameter:
  7710. @example
  7711. frei0r=colordistance:0.2/0.3/0.4
  7712. frei0r=colordistance:violet
  7713. frei0r=colordistance:0x112233
  7714. @end example
  7715. @item
  7716. Apply the perspective effect, specifying the top left and top right image
  7717. positions:
  7718. @example
  7719. frei0r=perspective:0.2/0.2|0.8/0.2
  7720. @end example
  7721. @end itemize
  7722. For more information, see
  7723. @url{http://frei0r.dyne.org}
  7724. @section fspp
  7725. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7726. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7727. processing filter, one of them is performed once per block, not per pixel.
  7728. This allows for much higher speed.
  7729. The filter accepts the following options:
  7730. @table @option
  7731. @item quality
  7732. Set quality. This option defines the number of levels for averaging. It accepts
  7733. an integer in the range 4-5. Default value is @code{4}.
  7734. @item qp
  7735. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7736. If not set, the filter will use the QP from the video stream (if available).
  7737. @item strength
  7738. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7739. more details but also more artifacts, while higher values make the image smoother
  7740. but also blurrier. Default value is @code{0} − PSNR optimal.
  7741. @item use_bframe_qp
  7742. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7743. option may cause flicker since the B-Frames have often larger QP. Default is
  7744. @code{0} (not enabled).
  7745. @end table
  7746. @section gblur
  7747. Apply Gaussian blur filter.
  7748. The filter accepts the following options:
  7749. @table @option
  7750. @item sigma
  7751. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7752. @item steps
  7753. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7754. @item planes
  7755. Set which planes to filter. By default all planes are filtered.
  7756. @item sigmaV
  7757. Set vertical sigma, if negative it will be same as @code{sigma}.
  7758. Default is @code{-1}.
  7759. @end table
  7760. @section geq
  7761. The filter accepts the following options:
  7762. @table @option
  7763. @item lum_expr, lum
  7764. Set the luminance expression.
  7765. @item cb_expr, cb
  7766. Set the chrominance blue expression.
  7767. @item cr_expr, cr
  7768. Set the chrominance red expression.
  7769. @item alpha_expr, a
  7770. Set the alpha expression.
  7771. @item red_expr, r
  7772. Set the red expression.
  7773. @item green_expr, g
  7774. Set the green expression.
  7775. @item blue_expr, b
  7776. Set the blue expression.
  7777. @end table
  7778. The colorspace is selected according to the specified options. If one
  7779. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7780. options is specified, the filter will automatically select a YCbCr
  7781. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7782. @option{blue_expr} options is specified, it will select an RGB
  7783. colorspace.
  7784. If one of the chrominance expression is not defined, it falls back on the other
  7785. one. If no alpha expression is specified it will evaluate to opaque value.
  7786. If none of chrominance expressions are specified, they will evaluate
  7787. to the luminance expression.
  7788. The expressions can use the following variables and functions:
  7789. @table @option
  7790. @item N
  7791. The sequential number of the filtered frame, starting from @code{0}.
  7792. @item X
  7793. @item Y
  7794. The coordinates of the current sample.
  7795. @item W
  7796. @item H
  7797. The width and height of the image.
  7798. @item SW
  7799. @item SH
  7800. Width and height scale depending on the currently filtered plane. It is the
  7801. ratio between the corresponding luma plane number of pixels and the current
  7802. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7803. @code{0.5,0.5} for chroma planes.
  7804. @item T
  7805. Time of the current frame, expressed in seconds.
  7806. @item p(x, y)
  7807. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7808. plane.
  7809. @item lum(x, y)
  7810. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7811. plane.
  7812. @item cb(x, y)
  7813. Return the value of the pixel at location (@var{x},@var{y}) of the
  7814. blue-difference chroma plane. Return 0 if there is no such plane.
  7815. @item cr(x, y)
  7816. Return the value of the pixel at location (@var{x},@var{y}) of the
  7817. red-difference chroma plane. Return 0 if there is no such plane.
  7818. @item r(x, y)
  7819. @item g(x, y)
  7820. @item b(x, y)
  7821. Return the value of the pixel at location (@var{x},@var{y}) of the
  7822. red/green/blue component. Return 0 if there is no such component.
  7823. @item alpha(x, y)
  7824. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7825. plane. Return 0 if there is no such plane.
  7826. @end table
  7827. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7828. automatically clipped to the closer edge.
  7829. @subsection Examples
  7830. @itemize
  7831. @item
  7832. Flip the image horizontally:
  7833. @example
  7834. geq=p(W-X\,Y)
  7835. @end example
  7836. @item
  7837. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7838. wavelength of 100 pixels:
  7839. @example
  7840. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7841. @end example
  7842. @item
  7843. Generate a fancy enigmatic moving light:
  7844. @example
  7845. 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
  7846. @end example
  7847. @item
  7848. Generate a quick emboss effect:
  7849. @example
  7850. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7851. @end example
  7852. @item
  7853. Modify RGB components depending on pixel position:
  7854. @example
  7855. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7856. @end example
  7857. @item
  7858. Create a radial gradient that is the same size as the input (also see
  7859. the @ref{vignette} filter):
  7860. @example
  7861. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7862. @end example
  7863. @end itemize
  7864. @section gradfun
  7865. Fix the banding artifacts that are sometimes introduced into nearly flat
  7866. regions by truncation to 8-bit color depth.
  7867. Interpolate the gradients that should go where the bands are, and
  7868. dither them.
  7869. It is designed for playback only. Do not use it prior to
  7870. lossy compression, because compression tends to lose the dither and
  7871. bring back the bands.
  7872. It accepts the following parameters:
  7873. @table @option
  7874. @item strength
  7875. The maximum amount by which the filter will change any one pixel. This is also
  7876. the threshold for detecting nearly flat regions. Acceptable values range from
  7877. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7878. valid range.
  7879. @item radius
  7880. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7881. gradients, but also prevents the filter from modifying the pixels near detailed
  7882. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7883. values will be clipped to the valid range.
  7884. @end table
  7885. Alternatively, the options can be specified as a flat string:
  7886. @var{strength}[:@var{radius}]
  7887. @subsection Examples
  7888. @itemize
  7889. @item
  7890. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7891. @example
  7892. gradfun=3.5:8
  7893. @end example
  7894. @item
  7895. Specify radius, omitting the strength (which will fall-back to the default
  7896. value):
  7897. @example
  7898. gradfun=radius=8
  7899. @end example
  7900. @end itemize
  7901. @section greyedge
  7902. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7903. and corrects the scene colors accordingly.
  7904. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7905. The filter accepts the following options:
  7906. @table @option
  7907. @item difford
  7908. The order of differentiation to be applied on the scene. Must be chosen in the range
  7909. [0,2] and default value is 1.
  7910. @item minknorm
  7911. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7912. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  7913. max value instead of calculating Minkowski distance.
  7914. @item sigma
  7915. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7916. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  7917. can't be euqal to 0 if @var{difford} is greater than 0.
  7918. @end table
  7919. @subsection Examples
  7920. @itemize
  7921. @item
  7922. Grey Edge:
  7923. @example
  7924. greyedge=difford=1:minknorm=5:sigma=2
  7925. @end example
  7926. @item
  7927. Max Edge:
  7928. @example
  7929. greyedge=difford=1:minknorm=0:sigma=2
  7930. @end example
  7931. @end itemize
  7932. @anchor{haldclut}
  7933. @section haldclut
  7934. Apply a Hald CLUT to a video stream.
  7935. First input is the video stream to process, and second one is the Hald CLUT.
  7936. The Hald CLUT input can be a simple picture or a complete video stream.
  7937. The filter accepts the following options:
  7938. @table @option
  7939. @item shortest
  7940. Force termination when the shortest input terminates. Default is @code{0}.
  7941. @item repeatlast
  7942. Continue applying the last CLUT after the end of the stream. A value of
  7943. @code{0} disable the filter after the last frame of the CLUT is reached.
  7944. Default is @code{1}.
  7945. @end table
  7946. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7947. filters share the same internals).
  7948. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7949. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7950. @subsection Workflow examples
  7951. @subsubsection Hald CLUT video stream
  7952. Generate an identity Hald CLUT stream altered with various effects:
  7953. @example
  7954. 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
  7955. @end example
  7956. Note: make sure you use a lossless codec.
  7957. Then use it with @code{haldclut} to apply it on some random stream:
  7958. @example
  7959. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7960. @end example
  7961. The Hald CLUT will be applied to the 10 first seconds (duration of
  7962. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7963. to the remaining frames of the @code{mandelbrot} stream.
  7964. @subsubsection Hald CLUT with preview
  7965. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7966. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7967. biggest possible square starting at the top left of the picture. The remaining
  7968. padding pixels (bottom or right) will be ignored. This area can be used to add
  7969. a preview of the Hald CLUT.
  7970. Typically, the following generated Hald CLUT will be supported by the
  7971. @code{haldclut} filter:
  7972. @example
  7973. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7974. pad=iw+320 [padded_clut];
  7975. smptebars=s=320x256, split [a][b];
  7976. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7977. [main][b] overlay=W-320" -frames:v 1 clut.png
  7978. @end example
  7979. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7980. bars are displayed on the right-top, and below the same color bars processed by
  7981. the color changes.
  7982. Then, the effect of this Hald CLUT can be visualized with:
  7983. @example
  7984. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7985. @end example
  7986. @section hflip
  7987. Flip the input video horizontally.
  7988. For example, to horizontally flip the input video with @command{ffmpeg}:
  7989. @example
  7990. ffmpeg -i in.avi -vf "hflip" out.avi
  7991. @end example
  7992. @section histeq
  7993. This filter applies a global color histogram equalization on a
  7994. per-frame basis.
  7995. It can be used to correct video that has a compressed range of pixel
  7996. intensities. The filter redistributes the pixel intensities to
  7997. equalize their distribution across the intensity range. It may be
  7998. viewed as an "automatically adjusting contrast filter". This filter is
  7999. useful only for correcting degraded or poorly captured source
  8000. video.
  8001. The filter accepts the following options:
  8002. @table @option
  8003. @item strength
  8004. Determine the amount of equalization to be applied. As the strength
  8005. is reduced, the distribution of pixel intensities more-and-more
  8006. approaches that of the input frame. The value must be a float number
  8007. in the range [0,1] and defaults to 0.200.
  8008. @item intensity
  8009. Set the maximum intensity that can generated and scale the output
  8010. values appropriately. The strength should be set as desired and then
  8011. the intensity can be limited if needed to avoid washing-out. The value
  8012. must be a float number in the range [0,1] and defaults to 0.210.
  8013. @item antibanding
  8014. Set the antibanding level. If enabled the filter will randomly vary
  8015. the luminance of output pixels by a small amount to avoid banding of
  8016. the histogram. Possible values are @code{none}, @code{weak} or
  8017. @code{strong}. It defaults to @code{none}.
  8018. @end table
  8019. @section histogram
  8020. Compute and draw a color distribution histogram for the input video.
  8021. The computed histogram is a representation of the color component
  8022. distribution in an image.
  8023. Standard histogram displays the color components distribution in an image.
  8024. Displays color graph for each color component. Shows distribution of
  8025. the Y, U, V, A or R, G, B components, depending on input format, in the
  8026. current frame. Below each graph a color component scale meter is shown.
  8027. The filter accepts the following options:
  8028. @table @option
  8029. @item level_height
  8030. Set height of level. Default value is @code{200}.
  8031. Allowed range is [50, 2048].
  8032. @item scale_height
  8033. Set height of color scale. Default value is @code{12}.
  8034. Allowed range is [0, 40].
  8035. @item display_mode
  8036. Set display mode.
  8037. It accepts the following values:
  8038. @table @samp
  8039. @item stack
  8040. Per color component graphs are placed below each other.
  8041. @item parade
  8042. Per color component graphs are placed side by side.
  8043. @item overlay
  8044. Presents information identical to that in the @code{parade}, except
  8045. that the graphs representing color components are superimposed directly
  8046. over one another.
  8047. @end table
  8048. Default is @code{stack}.
  8049. @item levels_mode
  8050. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8051. Default is @code{linear}.
  8052. @item components
  8053. Set what color components to display.
  8054. Default is @code{7}.
  8055. @item fgopacity
  8056. Set foreground opacity. Default is @code{0.7}.
  8057. @item bgopacity
  8058. Set background opacity. Default is @code{0.5}.
  8059. @end table
  8060. @subsection Examples
  8061. @itemize
  8062. @item
  8063. Calculate and draw histogram:
  8064. @example
  8065. ffplay -i input -vf histogram
  8066. @end example
  8067. @end itemize
  8068. @anchor{hqdn3d}
  8069. @section hqdn3d
  8070. This is a high precision/quality 3d denoise filter. It aims to reduce
  8071. image noise, producing smooth images and making still images really
  8072. still. It should enhance compressibility.
  8073. It accepts the following optional parameters:
  8074. @table @option
  8075. @item luma_spatial
  8076. A non-negative floating point number which specifies spatial luma strength.
  8077. It defaults to 4.0.
  8078. @item chroma_spatial
  8079. A non-negative floating point number which specifies spatial chroma strength.
  8080. It defaults to 3.0*@var{luma_spatial}/4.0.
  8081. @item luma_tmp
  8082. A floating point number which specifies luma temporal strength. It defaults to
  8083. 6.0*@var{luma_spatial}/4.0.
  8084. @item chroma_tmp
  8085. A floating point number which specifies chroma temporal strength. It defaults to
  8086. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8087. @end table
  8088. @section hwdownload
  8089. Download hardware frames to system memory.
  8090. The input must be in hardware frames, and the output a non-hardware format.
  8091. Not all formats will be supported on the output - it may be necessary to insert
  8092. an additional @option{format} filter immediately following in the graph to get
  8093. the output in a supported format.
  8094. @section hwmap
  8095. Map hardware frames to system memory or to another device.
  8096. This filter has several different modes of operation; which one is used depends
  8097. on the input and output formats:
  8098. @itemize
  8099. @item
  8100. Hardware frame input, normal frame output
  8101. Map the input frames to system memory and pass them to the output. If the
  8102. original hardware frame is later required (for example, after overlaying
  8103. something else on part of it), the @option{hwmap} filter can be used again
  8104. in the next mode to retrieve it.
  8105. @item
  8106. Normal frame input, hardware frame output
  8107. If the input is actually a software-mapped hardware frame, then unmap it -
  8108. that is, return the original hardware frame.
  8109. Otherwise, a device must be provided. Create new hardware surfaces on that
  8110. device for the output, then map them back to the software format at the input
  8111. and give those frames to the preceding filter. This will then act like the
  8112. @option{hwupload} filter, but may be able to avoid an additional copy when
  8113. the input is already in a compatible format.
  8114. @item
  8115. Hardware frame input and output
  8116. A device must be supplied for the output, either directly or with the
  8117. @option{derive_device} option. The input and output devices must be of
  8118. different types and compatible - the exact meaning of this is
  8119. system-dependent, but typically it means that they must refer to the same
  8120. underlying hardware context (for example, refer to the same graphics card).
  8121. If the input frames were originally created on the output device, then unmap
  8122. to retrieve the original frames.
  8123. Otherwise, map the frames to the output device - create new hardware frames
  8124. on the output corresponding to the frames on the input.
  8125. @end itemize
  8126. The following additional parameters are accepted:
  8127. @table @option
  8128. @item mode
  8129. Set the frame mapping mode. Some combination of:
  8130. @table @var
  8131. @item read
  8132. The mapped frame should be readable.
  8133. @item write
  8134. The mapped frame should be writeable.
  8135. @item overwrite
  8136. The mapping will always overwrite the entire frame.
  8137. This may improve performance in some cases, as the original contents of the
  8138. frame need not be loaded.
  8139. @item direct
  8140. The mapping must not involve any copying.
  8141. Indirect mappings to copies of frames are created in some cases where either
  8142. direct mapping is not possible or it would have unexpected properties.
  8143. Setting this flag ensures that the mapping is direct and will fail if that is
  8144. not possible.
  8145. @end table
  8146. Defaults to @var{read+write} if not specified.
  8147. @item derive_device @var{type}
  8148. Rather than using the device supplied at initialisation, instead derive a new
  8149. device of type @var{type} from the device the input frames exist on.
  8150. @item reverse
  8151. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8152. and map them back to the source. This may be necessary in some cases where
  8153. a mapping in one direction is required but only the opposite direction is
  8154. supported by the devices being used.
  8155. This option is dangerous - it may break the preceding filter in undefined
  8156. ways if there are any additional constraints on that filter's output.
  8157. Do not use it without fully understanding the implications of its use.
  8158. @end table
  8159. @section hwupload
  8160. Upload system memory frames to hardware surfaces.
  8161. The device to upload to must be supplied when the filter is initialised. If
  8162. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8163. option.
  8164. @anchor{hwupload_cuda}
  8165. @section hwupload_cuda
  8166. Upload system memory frames to a CUDA device.
  8167. It accepts the following optional parameters:
  8168. @table @option
  8169. @item device
  8170. The number of the CUDA device to use
  8171. @end table
  8172. @section hqx
  8173. Apply a high-quality magnification filter designed for pixel art. This filter
  8174. was originally created by Maxim Stepin.
  8175. It accepts the following option:
  8176. @table @option
  8177. @item n
  8178. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8179. @code{hq3x} and @code{4} for @code{hq4x}.
  8180. Default is @code{3}.
  8181. @end table
  8182. @section hstack
  8183. Stack input videos horizontally.
  8184. All streams must be of same pixel format and of same height.
  8185. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8186. to create same output.
  8187. The filter accept the following option:
  8188. @table @option
  8189. @item inputs
  8190. Set number of input streams. Default is 2.
  8191. @item shortest
  8192. If set to 1, force the output to terminate when the shortest input
  8193. terminates. Default value is 0.
  8194. @end table
  8195. @section hue
  8196. Modify the hue and/or the saturation of the input.
  8197. It accepts the following parameters:
  8198. @table @option
  8199. @item h
  8200. Specify the hue angle as a number of degrees. It accepts an expression,
  8201. and defaults to "0".
  8202. @item s
  8203. Specify the saturation in the [-10,10] range. It accepts an expression and
  8204. defaults to "1".
  8205. @item H
  8206. Specify the hue angle as a number of radians. It accepts an
  8207. expression, and defaults to "0".
  8208. @item b
  8209. Specify the brightness in the [-10,10] range. It accepts an expression and
  8210. defaults to "0".
  8211. @end table
  8212. @option{h} and @option{H} are mutually exclusive, and can't be
  8213. specified at the same time.
  8214. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8215. expressions containing the following constants:
  8216. @table @option
  8217. @item n
  8218. frame count of the input frame starting from 0
  8219. @item pts
  8220. presentation timestamp of the input frame expressed in time base units
  8221. @item r
  8222. frame rate of the input video, NAN if the input frame rate is unknown
  8223. @item t
  8224. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8225. @item tb
  8226. time base of the input video
  8227. @end table
  8228. @subsection Examples
  8229. @itemize
  8230. @item
  8231. Set the hue to 90 degrees and the saturation to 1.0:
  8232. @example
  8233. hue=h=90:s=1
  8234. @end example
  8235. @item
  8236. Same command but expressing the hue in radians:
  8237. @example
  8238. hue=H=PI/2:s=1
  8239. @end example
  8240. @item
  8241. Rotate hue and make the saturation swing between 0
  8242. and 2 over a period of 1 second:
  8243. @example
  8244. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8245. @end example
  8246. @item
  8247. Apply a 3 seconds saturation fade-in effect starting at 0:
  8248. @example
  8249. hue="s=min(t/3\,1)"
  8250. @end example
  8251. The general fade-in expression can be written as:
  8252. @example
  8253. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8254. @end example
  8255. @item
  8256. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8257. @example
  8258. hue="s=max(0\, min(1\, (8-t)/3))"
  8259. @end example
  8260. The general fade-out expression can be written as:
  8261. @example
  8262. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8263. @end example
  8264. @end itemize
  8265. @subsection Commands
  8266. This filter supports the following commands:
  8267. @table @option
  8268. @item b
  8269. @item s
  8270. @item h
  8271. @item H
  8272. Modify the hue and/or the saturation and/or brightness of the input video.
  8273. The command accepts the same syntax of the corresponding option.
  8274. If the specified expression is not valid, it is kept at its current
  8275. value.
  8276. @end table
  8277. @section hysteresis
  8278. Grow first stream into second stream by connecting components.
  8279. This makes it possible to build more robust edge masks.
  8280. This filter accepts the following options:
  8281. @table @option
  8282. @item planes
  8283. Set which planes will be processed as bitmap, unprocessed planes will be
  8284. copied from first stream.
  8285. By default value 0xf, all planes will be processed.
  8286. @item threshold
  8287. Set threshold which is used in filtering. If pixel component value is higher than
  8288. this value filter algorithm for connecting components is activated.
  8289. By default value is 0.
  8290. @end table
  8291. @section idet
  8292. Detect video interlacing type.
  8293. This filter tries to detect if the input frames are interlaced, progressive,
  8294. top or bottom field first. It will also try to detect fields that are
  8295. repeated between adjacent frames (a sign of telecine).
  8296. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8297. Multiple frame detection incorporates the classification history of previous frames.
  8298. The filter will log these metadata values:
  8299. @table @option
  8300. @item single.current_frame
  8301. Detected type of current frame using single-frame detection. One of:
  8302. ``tff'' (top field first), ``bff'' (bottom field first),
  8303. ``progressive'', or ``undetermined''
  8304. @item single.tff
  8305. Cumulative number of frames detected as top field first using single-frame detection.
  8306. @item multiple.tff
  8307. Cumulative number of frames detected as top field first using multiple-frame detection.
  8308. @item single.bff
  8309. Cumulative number of frames detected as bottom field first using single-frame detection.
  8310. @item multiple.current_frame
  8311. Detected type of current frame using multiple-frame detection. One of:
  8312. ``tff'' (top field first), ``bff'' (bottom field first),
  8313. ``progressive'', or ``undetermined''
  8314. @item multiple.bff
  8315. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8316. @item single.progressive
  8317. Cumulative number of frames detected as progressive using single-frame detection.
  8318. @item multiple.progressive
  8319. Cumulative number of frames detected as progressive using multiple-frame detection.
  8320. @item single.undetermined
  8321. Cumulative number of frames that could not be classified using single-frame detection.
  8322. @item multiple.undetermined
  8323. Cumulative number of frames that could not be classified using multiple-frame detection.
  8324. @item repeated.current_frame
  8325. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8326. @item repeated.neither
  8327. Cumulative number of frames with no repeated field.
  8328. @item repeated.top
  8329. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8330. @item repeated.bottom
  8331. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8332. @end table
  8333. The filter accepts the following options:
  8334. @table @option
  8335. @item intl_thres
  8336. Set interlacing threshold.
  8337. @item prog_thres
  8338. Set progressive threshold.
  8339. @item rep_thres
  8340. Threshold for repeated field detection.
  8341. @item half_life
  8342. Number of frames after which a given frame's contribution to the
  8343. statistics is halved (i.e., it contributes only 0.5 to its
  8344. classification). The default of 0 means that all frames seen are given
  8345. full weight of 1.0 forever.
  8346. @item analyze_interlaced_flag
  8347. When this is not 0 then idet will use the specified number of frames to determine
  8348. if the interlaced flag is accurate, it will not count undetermined frames.
  8349. If the flag is found to be accurate it will be used without any further
  8350. computations, if it is found to be inaccurate it will be cleared without any
  8351. further computations. This allows inserting the idet filter as a low computational
  8352. method to clean up the interlaced flag
  8353. @end table
  8354. @section il
  8355. Deinterleave or interleave fields.
  8356. This filter allows one to process interlaced images fields without
  8357. deinterlacing them. Deinterleaving splits the input frame into 2
  8358. fields (so called half pictures). Odd lines are moved to the top
  8359. half of the output image, even lines to the bottom half.
  8360. You can process (filter) them independently and then re-interleave them.
  8361. The filter accepts the following options:
  8362. @table @option
  8363. @item luma_mode, l
  8364. @item chroma_mode, c
  8365. @item alpha_mode, a
  8366. Available values for @var{luma_mode}, @var{chroma_mode} and
  8367. @var{alpha_mode} are:
  8368. @table @samp
  8369. @item none
  8370. Do nothing.
  8371. @item deinterleave, d
  8372. Deinterleave fields, placing one above the other.
  8373. @item interleave, i
  8374. Interleave fields. Reverse the effect of deinterleaving.
  8375. @end table
  8376. Default value is @code{none}.
  8377. @item luma_swap, ls
  8378. @item chroma_swap, cs
  8379. @item alpha_swap, as
  8380. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8381. @end table
  8382. @section inflate
  8383. Apply inflate effect to the video.
  8384. This filter replaces the pixel by the local(3x3) average by taking into account
  8385. only values higher than the pixel.
  8386. It accepts the following options:
  8387. @table @option
  8388. @item threshold0
  8389. @item threshold1
  8390. @item threshold2
  8391. @item threshold3
  8392. Limit the maximum change for each plane, default is 65535.
  8393. If 0, plane will remain unchanged.
  8394. @end table
  8395. @section interlace
  8396. Simple interlacing filter from progressive contents. This interleaves upper (or
  8397. lower) lines from odd frames with lower (or upper) lines from even frames,
  8398. halving the frame rate and preserving image height.
  8399. @example
  8400. Original Original New Frame
  8401. Frame 'j' Frame 'j+1' (tff)
  8402. ========== =========== ==================
  8403. Line 0 --------------------> Frame 'j' Line 0
  8404. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8405. Line 2 ---------------------> Frame 'j' Line 2
  8406. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8407. ... ... ...
  8408. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8409. @end example
  8410. It accepts the following optional parameters:
  8411. @table @option
  8412. @item scan
  8413. This determines whether the interlaced frame is taken from the even
  8414. (tff - default) or odd (bff) lines of the progressive frame.
  8415. @item lowpass
  8416. Vertical lowpass filter to avoid twitter interlacing and
  8417. reduce moire patterns.
  8418. @table @samp
  8419. @item 0, off
  8420. Disable vertical lowpass filter
  8421. @item 1, linear
  8422. Enable linear filter (default)
  8423. @item 2, complex
  8424. Enable complex filter. This will slightly less reduce twitter and moire
  8425. but better retain detail and subjective sharpness impression.
  8426. @end table
  8427. @end table
  8428. @section kerndeint
  8429. Deinterlace input video by applying Donald Graft's adaptive kernel
  8430. deinterling. Work on interlaced parts of a video to produce
  8431. progressive frames.
  8432. The description of the accepted parameters follows.
  8433. @table @option
  8434. @item thresh
  8435. Set the threshold which affects the filter's tolerance when
  8436. determining if a pixel line must be processed. It must be an integer
  8437. in the range [0,255] and defaults to 10. A value of 0 will result in
  8438. applying the process on every pixels.
  8439. @item map
  8440. Paint pixels exceeding the threshold value to white if set to 1.
  8441. Default is 0.
  8442. @item order
  8443. Set the fields order. Swap fields if set to 1, leave fields alone if
  8444. 0. Default is 0.
  8445. @item sharp
  8446. Enable additional sharpening if set to 1. Default is 0.
  8447. @item twoway
  8448. Enable twoway sharpening if set to 1. Default is 0.
  8449. @end table
  8450. @subsection Examples
  8451. @itemize
  8452. @item
  8453. Apply default values:
  8454. @example
  8455. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8456. @end example
  8457. @item
  8458. Enable additional sharpening:
  8459. @example
  8460. kerndeint=sharp=1
  8461. @end example
  8462. @item
  8463. Paint processed pixels in white:
  8464. @example
  8465. kerndeint=map=1
  8466. @end example
  8467. @end itemize
  8468. @section lenscorrection
  8469. Correct radial lens distortion
  8470. This filter can be used to correct for radial distortion as can result from the use
  8471. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8472. one can use tools available for example as part of opencv or simply trial-and-error.
  8473. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8474. and extract the k1 and k2 coefficients from the resulting matrix.
  8475. Note that effectively the same filter is available in the open-source tools Krita and
  8476. Digikam from the KDE project.
  8477. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8478. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8479. brightness distribution, so you may want to use both filters together in certain
  8480. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8481. be applied before or after lens correction.
  8482. @subsection Options
  8483. The filter accepts the following options:
  8484. @table @option
  8485. @item cx
  8486. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8487. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8488. width. Default is 0.5.
  8489. @item cy
  8490. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8491. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8492. height. Default is 0.5.
  8493. @item k1
  8494. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8495. no correction. Default is 0.
  8496. @item k2
  8497. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8498. 0 means no correction. Default is 0.
  8499. @end table
  8500. The formula that generates the correction is:
  8501. @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)
  8502. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8503. distances from the focal point in the source and target images, respectively.
  8504. @section lensfun
  8505. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8506. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8507. to apply the lens correction. The filter will load the lensfun database and
  8508. query it to find the corresponding camera and lens entries in the database. As
  8509. long as these entries can be found with the given options, the filter can
  8510. perform corrections on frames. Note that incomplete strings will result in the
  8511. filter choosing the best match with the given options, and the filter will
  8512. output the chosen camera and lens models (logged with level "info"). You must
  8513. provide the make, camera model, and lens model as they are required.
  8514. The filter accepts the following options:
  8515. @table @option
  8516. @item make
  8517. The make of the camera (for example, "Canon"). This option is required.
  8518. @item model
  8519. The model of the camera (for example, "Canon EOS 100D"). This option is
  8520. required.
  8521. @item lens_model
  8522. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8523. option is required.
  8524. @item mode
  8525. The type of correction to apply. The following values are valid options:
  8526. @table @samp
  8527. @item vignetting
  8528. Enables fixing lens vignetting.
  8529. @item geometry
  8530. Enables fixing lens geometry. This is the default.
  8531. @item subpixel
  8532. Enables fixing chromatic aberrations.
  8533. @item vig_geo
  8534. Enables fixing lens vignetting and lens geometry.
  8535. @item vig_subpixel
  8536. Enables fixing lens vignetting and chromatic aberrations.
  8537. @item distortion
  8538. Enables fixing both lens geometry and chromatic aberrations.
  8539. @item all
  8540. Enables all possible corrections.
  8541. @end table
  8542. @item focal_length
  8543. The focal length of the image/video (zoom; expected constant for video). For
  8544. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8545. range should be chosen when using that lens. Default 18.
  8546. @item aperture
  8547. The aperture of the image/video (expected constant for video). Note that
  8548. aperture is only used for vignetting correction. Default 3.5.
  8549. @item focus_distance
  8550. The focus distance of the image/video (expected constant for video). Note that
  8551. focus distance is only used for vignetting and only slightly affects the
  8552. vignetting correction process. If unknown, leave it at the default value (which
  8553. is 1000).
  8554. @item target_geometry
  8555. The target geometry of the output image/video. The following values are valid
  8556. options:
  8557. @table @samp
  8558. @item rectilinear (default)
  8559. @item fisheye
  8560. @item panoramic
  8561. @item equirectangular
  8562. @item fisheye_orthographic
  8563. @item fisheye_stereographic
  8564. @item fisheye_equisolid
  8565. @item fisheye_thoby
  8566. @end table
  8567. @item reverse
  8568. Apply the reverse of image correction (instead of correcting distortion, apply
  8569. it).
  8570. @item interpolation
  8571. The type of interpolation used when correcting distortion. The following values
  8572. are valid options:
  8573. @table @samp
  8574. @item nearest
  8575. @item linear (default)
  8576. @item lanczos
  8577. @end table
  8578. @end table
  8579. @subsection Examples
  8580. @itemize
  8581. @item
  8582. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8583. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8584. aperture of "8.0".
  8585. @example
  8586. 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
  8587. @end example
  8588. @item
  8589. Apply the same as before, but only for the first 5 seconds of video.
  8590. @example
  8591. 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
  8592. @end example
  8593. @end itemize
  8594. @section libvmaf
  8595. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8596. score between two input videos.
  8597. The obtained VMAF score is printed through the logging system.
  8598. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8599. After installing the library it can be enabled using:
  8600. @code{./configure --enable-libvmaf --enable-version3}.
  8601. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8602. The filter has following options:
  8603. @table @option
  8604. @item model_path
  8605. Set the model path which is to be used for SVM.
  8606. Default value: @code{"vmaf_v0.6.1.pkl"}
  8607. @item log_path
  8608. Set the file path to be used to store logs.
  8609. @item log_fmt
  8610. Set the format of the log file (xml or json).
  8611. @item enable_transform
  8612. Enables transform for computing vmaf.
  8613. @item phone_model
  8614. Invokes the phone model which will generate VMAF scores higher than in the
  8615. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8616. @item psnr
  8617. Enables computing psnr along with vmaf.
  8618. @item ssim
  8619. Enables computing ssim along with vmaf.
  8620. @item ms_ssim
  8621. Enables computing ms_ssim along with vmaf.
  8622. @item pool
  8623. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8624. @item n_threads
  8625. Set number of threads to be used when computing vmaf.
  8626. @item n_subsample
  8627. Set interval for frame subsampling used when computing vmaf.
  8628. @item enable_conf_interval
  8629. Enables confidence interval.
  8630. @end table
  8631. This filter also supports the @ref{framesync} options.
  8632. On the below examples the input file @file{main.mpg} being processed is
  8633. compared with the reference file @file{ref.mpg}.
  8634. @example
  8635. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8636. @end example
  8637. Example with options:
  8638. @example
  8639. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8640. @end example
  8641. @section limiter
  8642. Limits the pixel components values to the specified range [min, max].
  8643. The filter accepts the following options:
  8644. @table @option
  8645. @item min
  8646. Lower bound. Defaults to the lowest allowed value for the input.
  8647. @item max
  8648. Upper bound. Defaults to the highest allowed value for the input.
  8649. @item planes
  8650. Specify which planes will be processed. Defaults to all available.
  8651. @end table
  8652. @section loop
  8653. Loop video frames.
  8654. The filter accepts the following options:
  8655. @table @option
  8656. @item loop
  8657. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8658. Default is 0.
  8659. @item size
  8660. Set maximal size in number of frames. Default is 0.
  8661. @item start
  8662. Set first frame of loop. Default is 0.
  8663. @end table
  8664. @section lut1d
  8665. Apply a 1D LUT to an input video.
  8666. The filter accepts the following options:
  8667. @table @option
  8668. @item file
  8669. Set the 1D LUT file name.
  8670. Currently supported formats:
  8671. @table @samp
  8672. @item cube
  8673. Iridas
  8674. @end table
  8675. @item interp
  8676. Select interpolation mode.
  8677. Available values are:
  8678. @table @samp
  8679. @item nearest
  8680. Use values from the nearest defined point.
  8681. @item linear
  8682. Interpolate values using the linear interpolation.
  8683. @item cubic
  8684. Interpolate values using the cubic interpolation.
  8685. @end table
  8686. @end table
  8687. @anchor{lut3d}
  8688. @section lut3d
  8689. Apply a 3D LUT to an input video.
  8690. The filter accepts the following options:
  8691. @table @option
  8692. @item file
  8693. Set the 3D LUT file name.
  8694. Currently supported formats:
  8695. @table @samp
  8696. @item 3dl
  8697. AfterEffects
  8698. @item cube
  8699. Iridas
  8700. @item dat
  8701. DaVinci
  8702. @item m3d
  8703. Pandora
  8704. @end table
  8705. @item interp
  8706. Select interpolation mode.
  8707. Available values are:
  8708. @table @samp
  8709. @item nearest
  8710. Use values from the nearest defined point.
  8711. @item trilinear
  8712. Interpolate values using the 8 points defining a cube.
  8713. @item tetrahedral
  8714. Interpolate values using a tetrahedron.
  8715. @end table
  8716. @end table
  8717. This filter also supports the @ref{framesync} options.
  8718. @section lumakey
  8719. Turn certain luma values into transparency.
  8720. The filter accepts the following options:
  8721. @table @option
  8722. @item threshold
  8723. Set the luma which will be used as base for transparency.
  8724. Default value is @code{0}.
  8725. @item tolerance
  8726. Set the range of luma values to be keyed out.
  8727. Default value is @code{0}.
  8728. @item softness
  8729. Set the range of softness. Default value is @code{0}.
  8730. Use this to control gradual transition from zero to full transparency.
  8731. @end table
  8732. @section lut, lutrgb, lutyuv
  8733. Compute a look-up table for binding each pixel component input value
  8734. to an output value, and apply it to the input video.
  8735. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8736. to an RGB input video.
  8737. These filters accept the following parameters:
  8738. @table @option
  8739. @item c0
  8740. set first pixel component expression
  8741. @item c1
  8742. set second pixel component expression
  8743. @item c2
  8744. set third pixel component expression
  8745. @item c3
  8746. set fourth pixel component expression, corresponds to the alpha component
  8747. @item r
  8748. set red component expression
  8749. @item g
  8750. set green component expression
  8751. @item b
  8752. set blue component expression
  8753. @item a
  8754. alpha component expression
  8755. @item y
  8756. set Y/luminance component expression
  8757. @item u
  8758. set U/Cb component expression
  8759. @item v
  8760. set V/Cr component expression
  8761. @end table
  8762. Each of them specifies the expression to use for computing the lookup table for
  8763. the corresponding pixel component values.
  8764. The exact component associated to each of the @var{c*} options depends on the
  8765. format in input.
  8766. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8767. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8768. The expressions can contain the following constants and functions:
  8769. @table @option
  8770. @item w
  8771. @item h
  8772. The input width and height.
  8773. @item val
  8774. The input value for the pixel component.
  8775. @item clipval
  8776. The input value, clipped to the @var{minval}-@var{maxval} range.
  8777. @item maxval
  8778. The maximum value for the pixel component.
  8779. @item minval
  8780. The minimum value for the pixel component.
  8781. @item negval
  8782. The negated value for the pixel component value, clipped to the
  8783. @var{minval}-@var{maxval} range; it corresponds to the expression
  8784. "maxval-clipval+minval".
  8785. @item clip(val)
  8786. The computed value in @var{val}, clipped to the
  8787. @var{minval}-@var{maxval} range.
  8788. @item gammaval(gamma)
  8789. The computed gamma correction value of the pixel component value,
  8790. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8791. expression
  8792. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8793. @end table
  8794. All expressions default to "val".
  8795. @subsection Examples
  8796. @itemize
  8797. @item
  8798. Negate input video:
  8799. @example
  8800. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8801. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8802. @end example
  8803. The above is the same as:
  8804. @example
  8805. lutrgb="r=negval:g=negval:b=negval"
  8806. lutyuv="y=negval:u=negval:v=negval"
  8807. @end example
  8808. @item
  8809. Negate luminance:
  8810. @example
  8811. lutyuv=y=negval
  8812. @end example
  8813. @item
  8814. Remove chroma components, turning the video into a graytone image:
  8815. @example
  8816. lutyuv="u=128:v=128"
  8817. @end example
  8818. @item
  8819. Apply a luma burning effect:
  8820. @example
  8821. lutyuv="y=2*val"
  8822. @end example
  8823. @item
  8824. Remove green and blue components:
  8825. @example
  8826. lutrgb="g=0:b=0"
  8827. @end example
  8828. @item
  8829. Set a constant alpha channel value on input:
  8830. @example
  8831. format=rgba,lutrgb=a="maxval-minval/2"
  8832. @end example
  8833. @item
  8834. Correct luminance gamma by a factor of 0.5:
  8835. @example
  8836. lutyuv=y=gammaval(0.5)
  8837. @end example
  8838. @item
  8839. Discard least significant bits of luma:
  8840. @example
  8841. lutyuv=y='bitand(val, 128+64+32)'
  8842. @end example
  8843. @item
  8844. Technicolor like effect:
  8845. @example
  8846. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8847. @end example
  8848. @end itemize
  8849. @section lut2, tlut2
  8850. The @code{lut2} filter takes two input streams and outputs one
  8851. stream.
  8852. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8853. from one single stream.
  8854. This filter accepts the following parameters:
  8855. @table @option
  8856. @item c0
  8857. set first pixel component expression
  8858. @item c1
  8859. set second pixel component expression
  8860. @item c2
  8861. set third pixel component expression
  8862. @item c3
  8863. set fourth pixel component expression, corresponds to the alpha component
  8864. @end table
  8865. Each of them specifies the expression to use for computing the lookup table for
  8866. the corresponding pixel component values.
  8867. The exact component associated to each of the @var{c*} options depends on the
  8868. format in inputs.
  8869. The expressions can contain the following constants:
  8870. @table @option
  8871. @item w
  8872. @item h
  8873. The input width and height.
  8874. @item x
  8875. The first input value for the pixel component.
  8876. @item y
  8877. The second input value for the pixel component.
  8878. @item bdx
  8879. The first input video bit depth.
  8880. @item bdy
  8881. The second input video bit depth.
  8882. @end table
  8883. All expressions default to "x".
  8884. @subsection Examples
  8885. @itemize
  8886. @item
  8887. Highlight differences between two RGB video streams:
  8888. @example
  8889. 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)'
  8890. @end example
  8891. @item
  8892. Highlight differences between two YUV video streams:
  8893. @example
  8894. 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)'
  8895. @end example
  8896. @item
  8897. Show max difference between two video streams:
  8898. @example
  8899. 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)))'
  8900. @end example
  8901. @end itemize
  8902. @section maskedclamp
  8903. Clamp the first input stream with the second input and third input stream.
  8904. Returns the value of first stream to be between second input
  8905. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8906. This filter accepts the following options:
  8907. @table @option
  8908. @item undershoot
  8909. Default value is @code{0}.
  8910. @item overshoot
  8911. Default value is @code{0}.
  8912. @item planes
  8913. Set which planes will be processed as bitmap, unprocessed planes will be
  8914. copied from first stream.
  8915. By default value 0xf, all planes will be processed.
  8916. @end table
  8917. @section maskedmerge
  8918. Merge the first input stream with the second input stream using per pixel
  8919. weights in the third input stream.
  8920. A value of 0 in the third stream pixel component means that pixel component
  8921. from first stream is returned unchanged, while maximum value (eg. 255 for
  8922. 8-bit videos) means that pixel component from second stream is returned
  8923. unchanged. Intermediate values define the amount of merging between both
  8924. input stream's pixel components.
  8925. This filter accepts the following options:
  8926. @table @option
  8927. @item planes
  8928. Set which planes will be processed as bitmap, unprocessed planes will be
  8929. copied from first stream.
  8930. By default value 0xf, all planes will be processed.
  8931. @end table
  8932. @section mcdeint
  8933. Apply motion-compensation deinterlacing.
  8934. It needs one field per frame as input and must thus be used together
  8935. with yadif=1/3 or equivalent.
  8936. This filter accepts the following options:
  8937. @table @option
  8938. @item mode
  8939. Set the deinterlacing mode.
  8940. It accepts one of the following values:
  8941. @table @samp
  8942. @item fast
  8943. @item medium
  8944. @item slow
  8945. use iterative motion estimation
  8946. @item extra_slow
  8947. like @samp{slow}, but use multiple reference frames.
  8948. @end table
  8949. Default value is @samp{fast}.
  8950. @item parity
  8951. Set the picture field parity assumed for the input video. It must be
  8952. one of the following values:
  8953. @table @samp
  8954. @item 0, tff
  8955. assume top field first
  8956. @item 1, bff
  8957. assume bottom field first
  8958. @end table
  8959. Default value is @samp{bff}.
  8960. @item qp
  8961. Set per-block quantization parameter (QP) used by the internal
  8962. encoder.
  8963. Higher values should result in a smoother motion vector field but less
  8964. optimal individual vectors. Default value is 1.
  8965. @end table
  8966. @section mergeplanes
  8967. Merge color channel components from several video streams.
  8968. The filter accepts up to 4 input streams, and merge selected input
  8969. planes to the output video.
  8970. This filter accepts the following options:
  8971. @table @option
  8972. @item mapping
  8973. Set input to output plane mapping. Default is @code{0}.
  8974. The mappings is specified as a bitmap. It should be specified as a
  8975. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8976. mapping for the first plane of the output stream. 'A' sets the number of
  8977. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8978. corresponding input to use (from 0 to 3). The rest of the mappings is
  8979. similar, 'Bb' describes the mapping for the output stream second
  8980. plane, 'Cc' describes the mapping for the output stream third plane and
  8981. 'Dd' describes the mapping for the output stream fourth plane.
  8982. @item format
  8983. Set output pixel format. Default is @code{yuva444p}.
  8984. @end table
  8985. @subsection Examples
  8986. @itemize
  8987. @item
  8988. Merge three gray video streams of same width and height into single video stream:
  8989. @example
  8990. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8991. @end example
  8992. @item
  8993. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8994. @example
  8995. [a0][a1]mergeplanes=0x00010210:yuva444p
  8996. @end example
  8997. @item
  8998. Swap Y and A plane in yuva444p stream:
  8999. @example
  9000. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9001. @end example
  9002. @item
  9003. Swap U and V plane in yuv420p stream:
  9004. @example
  9005. format=yuv420p,mergeplanes=0x000201:yuv420p
  9006. @end example
  9007. @item
  9008. Cast a rgb24 clip to yuv444p:
  9009. @example
  9010. format=rgb24,mergeplanes=0x000102:yuv444p
  9011. @end example
  9012. @end itemize
  9013. @section mestimate
  9014. Estimate and export motion vectors using block matching algorithms.
  9015. Motion vectors are stored in frame side data to be used by other filters.
  9016. This filter accepts the following options:
  9017. @table @option
  9018. @item method
  9019. Specify the motion estimation method. Accepts one of the following values:
  9020. @table @samp
  9021. @item esa
  9022. Exhaustive search algorithm.
  9023. @item tss
  9024. Three step search algorithm.
  9025. @item tdls
  9026. Two dimensional logarithmic search algorithm.
  9027. @item ntss
  9028. New three step search algorithm.
  9029. @item fss
  9030. Four step search algorithm.
  9031. @item ds
  9032. Diamond search algorithm.
  9033. @item hexbs
  9034. Hexagon-based search algorithm.
  9035. @item epzs
  9036. Enhanced predictive zonal search algorithm.
  9037. @item umh
  9038. Uneven multi-hexagon search algorithm.
  9039. @end table
  9040. Default value is @samp{esa}.
  9041. @item mb_size
  9042. Macroblock size. Default @code{16}.
  9043. @item search_param
  9044. Search parameter. Default @code{7}.
  9045. @end table
  9046. @section midequalizer
  9047. Apply Midway Image Equalization effect using two video streams.
  9048. Midway Image Equalization adjusts a pair of images to have the same
  9049. histogram, while maintaining their dynamics as much as possible. It's
  9050. useful for e.g. matching exposures from a pair of stereo cameras.
  9051. This filter has two inputs and one output, which must be of same pixel format, but
  9052. may be of different sizes. The output of filter is first input adjusted with
  9053. midway histogram of both inputs.
  9054. This filter accepts the following option:
  9055. @table @option
  9056. @item planes
  9057. Set which planes to process. Default is @code{15}, which is all available planes.
  9058. @end table
  9059. @section minterpolate
  9060. Convert the video to specified frame rate using motion interpolation.
  9061. This filter accepts the following options:
  9062. @table @option
  9063. @item fps
  9064. 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}.
  9065. @item mi_mode
  9066. Motion interpolation mode. Following values are accepted:
  9067. @table @samp
  9068. @item dup
  9069. Duplicate previous or next frame for interpolating new ones.
  9070. @item blend
  9071. Blend source frames. Interpolated frame is mean of previous and next frames.
  9072. @item mci
  9073. Motion compensated interpolation. Following options are effective when this mode is selected:
  9074. @table @samp
  9075. @item mc_mode
  9076. Motion compensation mode. Following values are accepted:
  9077. @table @samp
  9078. @item obmc
  9079. Overlapped block motion compensation.
  9080. @item aobmc
  9081. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9082. @end table
  9083. Default mode is @samp{obmc}.
  9084. @item me_mode
  9085. Motion estimation mode. Following values are accepted:
  9086. @table @samp
  9087. @item bidir
  9088. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9089. @item bilat
  9090. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9091. @end table
  9092. Default mode is @samp{bilat}.
  9093. @item me
  9094. The algorithm to be used for motion estimation. Following values are accepted:
  9095. @table @samp
  9096. @item esa
  9097. Exhaustive search algorithm.
  9098. @item tss
  9099. Three step search algorithm.
  9100. @item tdls
  9101. Two dimensional logarithmic search algorithm.
  9102. @item ntss
  9103. New three step search algorithm.
  9104. @item fss
  9105. Four step search algorithm.
  9106. @item ds
  9107. Diamond search algorithm.
  9108. @item hexbs
  9109. Hexagon-based search algorithm.
  9110. @item epzs
  9111. Enhanced predictive zonal search algorithm.
  9112. @item umh
  9113. Uneven multi-hexagon search algorithm.
  9114. @end table
  9115. Default algorithm is @samp{epzs}.
  9116. @item mb_size
  9117. Macroblock size. Default @code{16}.
  9118. @item search_param
  9119. Motion estimation search parameter. Default @code{32}.
  9120. @item vsbmc
  9121. 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).
  9122. @end table
  9123. @end table
  9124. @item scd
  9125. 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:
  9126. @table @samp
  9127. @item none
  9128. Disable scene change detection.
  9129. @item fdiff
  9130. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9131. @end table
  9132. Default method is @samp{fdiff}.
  9133. @item scd_threshold
  9134. Scene change detection threshold. Default is @code{5.0}.
  9135. @end table
  9136. @section mix
  9137. Mix several video input streams into one video stream.
  9138. A description of the accepted options follows.
  9139. @table @option
  9140. @item nb_inputs
  9141. The number of inputs. If unspecified, it defaults to 2.
  9142. @item weights
  9143. Specify weight of each input video stream as sequence.
  9144. Each weight is separated by space. If number of weights
  9145. is smaller than number of @var{frames} last specified
  9146. weight will be used for all remaining unset weights.
  9147. @item scale
  9148. Specify scale, if it is set it will be multiplied with sum
  9149. of each weight multiplied with pixel values to give final destination
  9150. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9151. @item duration
  9152. Specify how end of stream is determined.
  9153. @table @samp
  9154. @item longest
  9155. The duration of the longest input. (default)
  9156. @item shortest
  9157. The duration of the shortest input.
  9158. @item first
  9159. The duration of the first input.
  9160. @end table
  9161. @end table
  9162. @section mpdecimate
  9163. Drop frames that do not differ greatly from the previous frame in
  9164. order to reduce frame rate.
  9165. The main use of this filter is for very-low-bitrate encoding
  9166. (e.g. streaming over dialup modem), but it could in theory be used for
  9167. fixing movies that were inverse-telecined incorrectly.
  9168. A description of the accepted options follows.
  9169. @table @option
  9170. @item max
  9171. Set the maximum number of consecutive frames which can be dropped (if
  9172. positive), or the minimum interval between dropped frames (if
  9173. negative). If the value is 0, the frame is dropped disregarding the
  9174. number of previous sequentially dropped frames.
  9175. Default value is 0.
  9176. @item hi
  9177. @item lo
  9178. @item frac
  9179. Set the dropping threshold values.
  9180. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9181. represent actual pixel value differences, so a threshold of 64
  9182. corresponds to 1 unit of difference for each pixel, or the same spread
  9183. out differently over the block.
  9184. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9185. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9186. meaning the whole image) differ by more than a threshold of @option{lo}.
  9187. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9188. 64*5, and default value for @option{frac} is 0.33.
  9189. @end table
  9190. @section negate
  9191. Negate (invert) the input video.
  9192. It accepts the following option:
  9193. @table @option
  9194. @item negate_alpha
  9195. With value 1, it negates the alpha component, if present. Default value is 0.
  9196. @end table
  9197. @anchor{nlmeans}
  9198. @section nlmeans
  9199. Denoise frames using Non-Local Means algorithm.
  9200. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9201. context similarity is defined by comparing their surrounding patches of size
  9202. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9203. around the pixel.
  9204. Note that the research area defines centers for patches, which means some
  9205. patches will be made of pixels outside that research area.
  9206. The filter accepts the following options.
  9207. @table @option
  9208. @item s
  9209. Set denoising strength.
  9210. @item p
  9211. Set patch size.
  9212. @item pc
  9213. Same as @option{p} but for chroma planes.
  9214. The default value is @var{0} and means automatic.
  9215. @item r
  9216. Set research size.
  9217. @item rc
  9218. Same as @option{r} but for chroma planes.
  9219. The default value is @var{0} and means automatic.
  9220. @end table
  9221. @section nnedi
  9222. Deinterlace video using neural network edge directed interpolation.
  9223. This filter accepts the following options:
  9224. @table @option
  9225. @item weights
  9226. Mandatory option, without binary file filter can not work.
  9227. Currently file can be found here:
  9228. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9229. @item deint
  9230. Set which frames to deinterlace, by default it is @code{all}.
  9231. Can be @code{all} or @code{interlaced}.
  9232. @item field
  9233. Set mode of operation.
  9234. Can be one of the following:
  9235. @table @samp
  9236. @item af
  9237. Use frame flags, both fields.
  9238. @item a
  9239. Use frame flags, single field.
  9240. @item t
  9241. Use top field only.
  9242. @item b
  9243. Use bottom field only.
  9244. @item tf
  9245. Use both fields, top first.
  9246. @item bf
  9247. Use both fields, bottom first.
  9248. @end table
  9249. @item planes
  9250. Set which planes to process, by default filter process all frames.
  9251. @item nsize
  9252. Set size of local neighborhood around each pixel, used by the predictor neural
  9253. network.
  9254. Can be one of the following:
  9255. @table @samp
  9256. @item s8x6
  9257. @item s16x6
  9258. @item s32x6
  9259. @item s48x6
  9260. @item s8x4
  9261. @item s16x4
  9262. @item s32x4
  9263. @end table
  9264. @item nns
  9265. Set the number of neurons in predictor neural network.
  9266. Can be one of the following:
  9267. @table @samp
  9268. @item n16
  9269. @item n32
  9270. @item n64
  9271. @item n128
  9272. @item n256
  9273. @end table
  9274. @item qual
  9275. Controls the number of different neural network predictions that are blended
  9276. together to compute the final output value. Can be @code{fast}, default or
  9277. @code{slow}.
  9278. @item etype
  9279. Set which set of weights to use in the predictor.
  9280. Can be one of the following:
  9281. @table @samp
  9282. @item a
  9283. weights trained to minimize absolute error
  9284. @item s
  9285. weights trained to minimize squared error
  9286. @end table
  9287. @item pscrn
  9288. Controls whether or not the prescreener neural network is used to decide
  9289. which pixels should be processed by the predictor neural network and which
  9290. can be handled by simple cubic interpolation.
  9291. The prescreener is trained to know whether cubic interpolation will be
  9292. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9293. The computational complexity of the prescreener nn is much less than that of
  9294. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9295. using the prescreener generally results in much faster processing.
  9296. The prescreener is pretty accurate, so the difference between using it and not
  9297. using it is almost always unnoticeable.
  9298. Can be one of the following:
  9299. @table @samp
  9300. @item none
  9301. @item original
  9302. @item new
  9303. @end table
  9304. Default is @code{new}.
  9305. @item fapprox
  9306. Set various debugging flags.
  9307. @end table
  9308. @section noformat
  9309. Force libavfilter not to use any of the specified pixel formats for the
  9310. input to the next filter.
  9311. It accepts the following parameters:
  9312. @table @option
  9313. @item pix_fmts
  9314. A '|'-separated list of pixel format names, such as
  9315. pix_fmts=yuv420p|monow|rgb24".
  9316. @end table
  9317. @subsection Examples
  9318. @itemize
  9319. @item
  9320. Force libavfilter to use a format different from @var{yuv420p} for the
  9321. input to the vflip filter:
  9322. @example
  9323. noformat=pix_fmts=yuv420p,vflip
  9324. @end example
  9325. @item
  9326. Convert the input video to any of the formats not contained in the list:
  9327. @example
  9328. noformat=yuv420p|yuv444p|yuv410p
  9329. @end example
  9330. @end itemize
  9331. @section noise
  9332. Add noise on video input frame.
  9333. The filter accepts the following options:
  9334. @table @option
  9335. @item all_seed
  9336. @item c0_seed
  9337. @item c1_seed
  9338. @item c2_seed
  9339. @item c3_seed
  9340. Set noise seed for specific pixel component or all pixel components in case
  9341. of @var{all_seed}. Default value is @code{123457}.
  9342. @item all_strength, alls
  9343. @item c0_strength, c0s
  9344. @item c1_strength, c1s
  9345. @item c2_strength, c2s
  9346. @item c3_strength, c3s
  9347. Set noise strength for specific pixel component or all pixel components in case
  9348. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9349. @item all_flags, allf
  9350. @item c0_flags, c0f
  9351. @item c1_flags, c1f
  9352. @item c2_flags, c2f
  9353. @item c3_flags, c3f
  9354. Set pixel component flags or set flags for all components if @var{all_flags}.
  9355. Available values for component flags are:
  9356. @table @samp
  9357. @item a
  9358. averaged temporal noise (smoother)
  9359. @item p
  9360. mix random noise with a (semi)regular pattern
  9361. @item t
  9362. temporal noise (noise pattern changes between frames)
  9363. @item u
  9364. uniform noise (gaussian otherwise)
  9365. @end table
  9366. @end table
  9367. @subsection Examples
  9368. Add temporal and uniform noise to input video:
  9369. @example
  9370. noise=alls=20:allf=t+u
  9371. @end example
  9372. @section normalize
  9373. Normalize RGB video (aka histogram stretching, contrast stretching).
  9374. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9375. For each channel of each frame, the filter computes the input range and maps
  9376. it linearly to the user-specified output range. The output range defaults
  9377. to the full dynamic range from pure black to pure white.
  9378. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9379. changes in brightness) caused when small dark or bright objects enter or leave
  9380. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9381. video camera, and, like a video camera, it may cause a period of over- or
  9382. under-exposure of the video.
  9383. The R,G,B channels can be normalized independently, which may cause some
  9384. color shifting, or linked together as a single channel, which prevents
  9385. color shifting. Linked normalization preserves hue. Independent normalization
  9386. does not, so it can be used to remove some color casts. Independent and linked
  9387. normalization can be combined in any ratio.
  9388. The normalize filter accepts the following options:
  9389. @table @option
  9390. @item blackpt
  9391. @item whitept
  9392. Colors which define the output range. The minimum input value is mapped to
  9393. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9394. The defaults are black and white respectively. Specifying white for
  9395. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9396. normalized video. Shades of grey can be used to reduce the dynamic range
  9397. (contrast). Specifying saturated colors here can create some interesting
  9398. effects.
  9399. @item smoothing
  9400. The number of previous frames to use for temporal smoothing. The input range
  9401. of each channel is smoothed using a rolling average over the current frame
  9402. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9403. smoothing).
  9404. @item independence
  9405. Controls the ratio of independent (color shifting) channel normalization to
  9406. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9407. independent. Defaults to 1.0 (fully independent).
  9408. @item strength
  9409. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9410. expensive no-op. Defaults to 1.0 (full strength).
  9411. @end table
  9412. @subsection Examples
  9413. Stretch video contrast to use the full dynamic range, with no temporal
  9414. smoothing; may flicker depending on the source content:
  9415. @example
  9416. normalize=blackpt=black:whitept=white:smoothing=0
  9417. @end example
  9418. As above, but with 50 frames of temporal smoothing; flicker should be
  9419. reduced, depending on the source content:
  9420. @example
  9421. normalize=blackpt=black:whitept=white:smoothing=50
  9422. @end example
  9423. As above, but with hue-preserving linked channel normalization:
  9424. @example
  9425. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9426. @end example
  9427. As above, but with half strength:
  9428. @example
  9429. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9430. @end example
  9431. Map the darkest input color to red, the brightest input color to cyan:
  9432. @example
  9433. normalize=blackpt=red:whitept=cyan
  9434. @end example
  9435. @section null
  9436. Pass the video source unchanged to the output.
  9437. @section ocr
  9438. Optical Character Recognition
  9439. This filter uses Tesseract for optical character recognition. To enable
  9440. compilation of this filter, you need to configure FFmpeg with
  9441. @code{--enable-libtesseract}.
  9442. It accepts the following options:
  9443. @table @option
  9444. @item datapath
  9445. Set datapath to tesseract data. Default is to use whatever was
  9446. set at installation.
  9447. @item language
  9448. Set language, default is "eng".
  9449. @item whitelist
  9450. Set character whitelist.
  9451. @item blacklist
  9452. Set character blacklist.
  9453. @end table
  9454. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9455. @section ocv
  9456. Apply a video transform using libopencv.
  9457. To enable this filter, install the libopencv library and headers and
  9458. configure FFmpeg with @code{--enable-libopencv}.
  9459. It accepts the following parameters:
  9460. @table @option
  9461. @item filter_name
  9462. The name of the libopencv filter to apply.
  9463. @item filter_params
  9464. The parameters to pass to the libopencv filter. If not specified, the default
  9465. values are assumed.
  9466. @end table
  9467. Refer to the official libopencv documentation for more precise
  9468. information:
  9469. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9470. Several libopencv filters are supported; see the following subsections.
  9471. @anchor{dilate}
  9472. @subsection dilate
  9473. Dilate an image by using a specific structuring element.
  9474. It corresponds to the libopencv function @code{cvDilate}.
  9475. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9476. @var{struct_el} represents a structuring element, and has the syntax:
  9477. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9478. @var{cols} and @var{rows} represent the number of columns and rows of
  9479. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9480. point, and @var{shape} the shape for the structuring element. @var{shape}
  9481. must be "rect", "cross", "ellipse", or "custom".
  9482. If the value for @var{shape} is "custom", it must be followed by a
  9483. string of the form "=@var{filename}". The file with name
  9484. @var{filename} is assumed to represent a binary image, with each
  9485. printable character corresponding to a bright pixel. When a custom
  9486. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9487. or columns and rows of the read file are assumed instead.
  9488. The default value for @var{struct_el} is "3x3+0x0/rect".
  9489. @var{nb_iterations} specifies the number of times the transform is
  9490. applied to the image, and defaults to 1.
  9491. Some examples:
  9492. @example
  9493. # Use the default values
  9494. ocv=dilate
  9495. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9496. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9497. # Read the shape from the file diamond.shape, iterating two times.
  9498. # The file diamond.shape may contain a pattern of characters like this
  9499. # *
  9500. # ***
  9501. # *****
  9502. # ***
  9503. # *
  9504. # The specified columns and rows are ignored
  9505. # but the anchor point coordinates are not
  9506. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9507. @end example
  9508. @subsection erode
  9509. Erode an image by using a specific structuring element.
  9510. It corresponds to the libopencv function @code{cvErode}.
  9511. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9512. with the same syntax and semantics as the @ref{dilate} filter.
  9513. @subsection smooth
  9514. Smooth the input video.
  9515. The filter takes the following parameters:
  9516. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9517. @var{type} is the type of smooth filter to apply, and must be one of
  9518. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9519. or "bilateral". The default value is "gaussian".
  9520. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9521. depend on the smooth type. @var{param1} and
  9522. @var{param2} accept integer positive values or 0. @var{param3} and
  9523. @var{param4} accept floating point values.
  9524. The default value for @var{param1} is 3. The default value for the
  9525. other parameters is 0.
  9526. These parameters correspond to the parameters assigned to the
  9527. libopencv function @code{cvSmooth}.
  9528. @section oscilloscope
  9529. 2D Video Oscilloscope.
  9530. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9531. It accepts the following parameters:
  9532. @table @option
  9533. @item x
  9534. Set scope center x position.
  9535. @item y
  9536. Set scope center y position.
  9537. @item s
  9538. Set scope size, relative to frame diagonal.
  9539. @item t
  9540. Set scope tilt/rotation.
  9541. @item o
  9542. Set trace opacity.
  9543. @item tx
  9544. Set trace center x position.
  9545. @item ty
  9546. Set trace center y position.
  9547. @item tw
  9548. Set trace width, relative to width of frame.
  9549. @item th
  9550. Set trace height, relative to height of frame.
  9551. @item c
  9552. Set which components to trace. By default it traces first three components.
  9553. @item g
  9554. Draw trace grid. By default is enabled.
  9555. @item st
  9556. Draw some statistics. By default is enabled.
  9557. @item sc
  9558. Draw scope. By default is enabled.
  9559. @end table
  9560. @subsection Examples
  9561. @itemize
  9562. @item
  9563. Inspect full first row of video frame.
  9564. @example
  9565. oscilloscope=x=0.5:y=0:s=1
  9566. @end example
  9567. @item
  9568. Inspect full last row of video frame.
  9569. @example
  9570. oscilloscope=x=0.5:y=1:s=1
  9571. @end example
  9572. @item
  9573. Inspect full 5th line of video frame of height 1080.
  9574. @example
  9575. oscilloscope=x=0.5:y=5/1080:s=1
  9576. @end example
  9577. @item
  9578. Inspect full last column of video frame.
  9579. @example
  9580. oscilloscope=x=1:y=0.5:s=1:t=1
  9581. @end example
  9582. @end itemize
  9583. @anchor{overlay}
  9584. @section overlay
  9585. Overlay one video on top of another.
  9586. It takes two inputs and has one output. The first input is the "main"
  9587. video on which the second input is overlaid.
  9588. It accepts the following parameters:
  9589. A description of the accepted options follows.
  9590. @table @option
  9591. @item x
  9592. @item y
  9593. Set the expression for the x and y coordinates of the overlaid video
  9594. on the main video. Default value is "0" for both expressions. In case
  9595. the expression is invalid, it is set to a huge value (meaning that the
  9596. overlay will not be displayed within the output visible area).
  9597. @item eof_action
  9598. See @ref{framesync}.
  9599. @item eval
  9600. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9601. It accepts the following values:
  9602. @table @samp
  9603. @item init
  9604. only evaluate expressions once during the filter initialization or
  9605. when a command is processed
  9606. @item frame
  9607. evaluate expressions for each incoming frame
  9608. @end table
  9609. Default value is @samp{frame}.
  9610. @item shortest
  9611. See @ref{framesync}.
  9612. @item format
  9613. Set the format for the output video.
  9614. It accepts the following values:
  9615. @table @samp
  9616. @item yuv420
  9617. force YUV420 output
  9618. @item yuv422
  9619. force YUV422 output
  9620. @item yuv444
  9621. force YUV444 output
  9622. @item rgb
  9623. force packed RGB output
  9624. @item gbrp
  9625. force planar RGB output
  9626. @item auto
  9627. automatically pick format
  9628. @end table
  9629. Default value is @samp{yuv420}.
  9630. @item repeatlast
  9631. See @ref{framesync}.
  9632. @item alpha
  9633. Set format of alpha of the overlaid video, it can be @var{straight} or
  9634. @var{premultiplied}. Default is @var{straight}.
  9635. @end table
  9636. The @option{x}, and @option{y} expressions can contain the following
  9637. parameters.
  9638. @table @option
  9639. @item main_w, W
  9640. @item main_h, H
  9641. The main input width and height.
  9642. @item overlay_w, w
  9643. @item overlay_h, h
  9644. The overlay input width and height.
  9645. @item x
  9646. @item y
  9647. The computed values for @var{x} and @var{y}. They are evaluated for
  9648. each new frame.
  9649. @item hsub
  9650. @item vsub
  9651. horizontal and vertical chroma subsample values of the output
  9652. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9653. @var{vsub} is 1.
  9654. @item n
  9655. the number of input frame, starting from 0
  9656. @item pos
  9657. the position in the file of the input frame, NAN if unknown
  9658. @item t
  9659. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9660. @end table
  9661. This filter also supports the @ref{framesync} options.
  9662. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9663. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9664. when @option{eval} is set to @samp{init}.
  9665. Be aware that frames are taken from each input video in timestamp
  9666. order, hence, if their initial timestamps differ, it is a good idea
  9667. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9668. have them begin in the same zero timestamp, as the example for
  9669. the @var{movie} filter does.
  9670. You can chain together more overlays but you should test the
  9671. efficiency of such approach.
  9672. @subsection Commands
  9673. This filter supports the following commands:
  9674. @table @option
  9675. @item x
  9676. @item y
  9677. Modify the x and y of the overlay input.
  9678. The command accepts the same syntax of the corresponding option.
  9679. If the specified expression is not valid, it is kept at its current
  9680. value.
  9681. @end table
  9682. @subsection Examples
  9683. @itemize
  9684. @item
  9685. Draw the overlay at 10 pixels from the bottom right corner of the main
  9686. video:
  9687. @example
  9688. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9689. @end example
  9690. Using named options the example above becomes:
  9691. @example
  9692. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9693. @end example
  9694. @item
  9695. Insert a transparent PNG logo in the bottom left corner of the input,
  9696. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9697. @example
  9698. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9699. @end example
  9700. @item
  9701. Insert 2 different transparent PNG logos (second logo on bottom
  9702. right corner) using the @command{ffmpeg} tool:
  9703. @example
  9704. 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
  9705. @end example
  9706. @item
  9707. Add a transparent color layer on top of the main video; @code{WxH}
  9708. must specify the size of the main input to the overlay filter:
  9709. @example
  9710. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9711. @end example
  9712. @item
  9713. Play an original video and a filtered version (here with the deshake
  9714. filter) side by side using the @command{ffplay} tool:
  9715. @example
  9716. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9717. @end example
  9718. The above command is the same as:
  9719. @example
  9720. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9721. @end example
  9722. @item
  9723. Make a sliding overlay appearing from the left to the right top part of the
  9724. screen starting since time 2:
  9725. @example
  9726. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9727. @end example
  9728. @item
  9729. Compose output by putting two input videos side to side:
  9730. @example
  9731. ffmpeg -i left.avi -i right.avi -filter_complex "
  9732. nullsrc=size=200x100 [background];
  9733. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9734. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9735. [background][left] overlay=shortest=1 [background+left];
  9736. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9737. "
  9738. @end example
  9739. @item
  9740. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9741. @example
  9742. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9743. -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]'
  9744. masked.avi
  9745. @end example
  9746. @item
  9747. Chain several overlays in cascade:
  9748. @example
  9749. nullsrc=s=200x200 [bg];
  9750. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9751. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9752. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9753. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9754. [in3] null, [mid2] overlay=100:100 [out0]
  9755. @end example
  9756. @end itemize
  9757. @section owdenoise
  9758. Apply Overcomplete Wavelet denoiser.
  9759. The filter accepts the following options:
  9760. @table @option
  9761. @item depth
  9762. Set depth.
  9763. Larger depth values will denoise lower frequency components more, but
  9764. slow down filtering.
  9765. Must be an int in the range 8-16, default is @code{8}.
  9766. @item luma_strength, ls
  9767. Set luma strength.
  9768. Must be a double value in the range 0-1000, default is @code{1.0}.
  9769. @item chroma_strength, cs
  9770. Set chroma strength.
  9771. Must be a double value in the range 0-1000, default is @code{1.0}.
  9772. @end table
  9773. @anchor{pad}
  9774. @section pad
  9775. Add paddings to the input image, and place the original input at the
  9776. provided @var{x}, @var{y} coordinates.
  9777. It accepts the following parameters:
  9778. @table @option
  9779. @item width, w
  9780. @item height, h
  9781. Specify an expression for the size of the output image with the
  9782. paddings added. If the value for @var{width} or @var{height} is 0, the
  9783. corresponding input size is used for the output.
  9784. The @var{width} expression can reference the value set by the
  9785. @var{height} expression, and vice versa.
  9786. The default value of @var{width} and @var{height} is 0.
  9787. @item x
  9788. @item y
  9789. Specify the offsets to place the input image at within the padded area,
  9790. with respect to the top/left border of the output image.
  9791. The @var{x} expression can reference the value set by the @var{y}
  9792. expression, and vice versa.
  9793. The default value of @var{x} and @var{y} is 0.
  9794. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9795. so the input image is centered on the padded area.
  9796. @item color
  9797. Specify the color of the padded area. For the syntax of this option,
  9798. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9799. manual,ffmpeg-utils}.
  9800. The default value of @var{color} is "black".
  9801. @item eval
  9802. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9803. It accepts the following values:
  9804. @table @samp
  9805. @item init
  9806. Only evaluate expressions once during the filter initialization or when
  9807. a command is processed.
  9808. @item frame
  9809. Evaluate expressions for each incoming frame.
  9810. @end table
  9811. Default value is @samp{init}.
  9812. @item aspect
  9813. Pad to aspect instead to a resolution.
  9814. @end table
  9815. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9816. options are expressions containing the following constants:
  9817. @table @option
  9818. @item in_w
  9819. @item in_h
  9820. The input video width and height.
  9821. @item iw
  9822. @item ih
  9823. These are the same as @var{in_w} and @var{in_h}.
  9824. @item out_w
  9825. @item out_h
  9826. The output width and height (the size of the padded area), as
  9827. specified by the @var{width} and @var{height} expressions.
  9828. @item ow
  9829. @item oh
  9830. These are the same as @var{out_w} and @var{out_h}.
  9831. @item x
  9832. @item y
  9833. The x and y offsets as specified by the @var{x} and @var{y}
  9834. expressions, or NAN if not yet specified.
  9835. @item a
  9836. same as @var{iw} / @var{ih}
  9837. @item sar
  9838. input sample aspect ratio
  9839. @item dar
  9840. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9841. @item hsub
  9842. @item vsub
  9843. The horizontal and vertical chroma subsample values. For example for the
  9844. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9845. @end table
  9846. @subsection Examples
  9847. @itemize
  9848. @item
  9849. Add paddings with the color "violet" to the input video. The output video
  9850. size is 640x480, and the top-left corner of the input video is placed at
  9851. column 0, row 40
  9852. @example
  9853. pad=640:480:0:40:violet
  9854. @end example
  9855. The example above is equivalent to the following command:
  9856. @example
  9857. pad=width=640:height=480:x=0:y=40:color=violet
  9858. @end example
  9859. @item
  9860. Pad the input to get an output with dimensions increased by 3/2,
  9861. and put the input video at the center of the padded area:
  9862. @example
  9863. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9864. @end example
  9865. @item
  9866. Pad the input to get a squared output with size equal to the maximum
  9867. value between the input width and height, and put the input video at
  9868. the center of the padded area:
  9869. @example
  9870. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9871. @end example
  9872. @item
  9873. Pad the input to get a final w/h ratio of 16:9:
  9874. @example
  9875. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9876. @end example
  9877. @item
  9878. In case of anamorphic video, in order to set the output display aspect
  9879. correctly, it is necessary to use @var{sar} in the expression,
  9880. according to the relation:
  9881. @example
  9882. (ih * X / ih) * sar = output_dar
  9883. X = output_dar / sar
  9884. @end example
  9885. Thus the previous example needs to be modified to:
  9886. @example
  9887. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9888. @end example
  9889. @item
  9890. Double the output size and put the input video in the bottom-right
  9891. corner of the output padded area:
  9892. @example
  9893. pad="2*iw:2*ih:ow-iw:oh-ih"
  9894. @end example
  9895. @end itemize
  9896. @anchor{palettegen}
  9897. @section palettegen
  9898. Generate one palette for a whole video stream.
  9899. It accepts the following options:
  9900. @table @option
  9901. @item max_colors
  9902. Set the maximum number of colors to quantize in the palette.
  9903. Note: the palette will still contain 256 colors; the unused palette entries
  9904. will be black.
  9905. @item reserve_transparent
  9906. Create a palette of 255 colors maximum and reserve the last one for
  9907. transparency. Reserving the transparency color is useful for GIF optimization.
  9908. If not set, the maximum of colors in the palette will be 256. You probably want
  9909. to disable this option for a standalone image.
  9910. Set by default.
  9911. @item transparency_color
  9912. Set the color that will be used as background for transparency.
  9913. @item stats_mode
  9914. Set statistics mode.
  9915. It accepts the following values:
  9916. @table @samp
  9917. @item full
  9918. Compute full frame histograms.
  9919. @item diff
  9920. Compute histograms only for the part that differs from previous frame. This
  9921. might be relevant to give more importance to the moving part of your input if
  9922. the background is static.
  9923. @item single
  9924. Compute new histogram for each frame.
  9925. @end table
  9926. Default value is @var{full}.
  9927. @end table
  9928. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9929. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9930. color quantization of the palette. This information is also visible at
  9931. @var{info} logging level.
  9932. @subsection Examples
  9933. @itemize
  9934. @item
  9935. Generate a representative palette of a given video using @command{ffmpeg}:
  9936. @example
  9937. ffmpeg -i input.mkv -vf palettegen palette.png
  9938. @end example
  9939. @end itemize
  9940. @section paletteuse
  9941. Use a palette to downsample an input video stream.
  9942. The filter takes two inputs: one video stream and a palette. The palette must
  9943. be a 256 pixels image.
  9944. It accepts the following options:
  9945. @table @option
  9946. @item dither
  9947. Select dithering mode. Available algorithms are:
  9948. @table @samp
  9949. @item bayer
  9950. Ordered 8x8 bayer dithering (deterministic)
  9951. @item heckbert
  9952. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9953. Note: this dithering is sometimes considered "wrong" and is included as a
  9954. reference.
  9955. @item floyd_steinberg
  9956. Floyd and Steingberg dithering (error diffusion)
  9957. @item sierra2
  9958. Frankie Sierra dithering v2 (error diffusion)
  9959. @item sierra2_4a
  9960. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9961. @end table
  9962. Default is @var{sierra2_4a}.
  9963. @item bayer_scale
  9964. When @var{bayer} dithering is selected, this option defines the scale of the
  9965. pattern (how much the crosshatch pattern is visible). A low value means more
  9966. visible pattern for less banding, and higher value means less visible pattern
  9967. at the cost of more banding.
  9968. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9969. @item diff_mode
  9970. If set, define the zone to process
  9971. @table @samp
  9972. @item rectangle
  9973. Only the changing rectangle will be reprocessed. This is similar to GIF
  9974. cropping/offsetting compression mechanism. This option can be useful for speed
  9975. if only a part of the image is changing, and has use cases such as limiting the
  9976. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9977. moving scene (it leads to more deterministic output if the scene doesn't change
  9978. much, and as a result less moving noise and better GIF compression).
  9979. @end table
  9980. Default is @var{none}.
  9981. @item new
  9982. Take new palette for each output frame.
  9983. @item alpha_threshold
  9984. Sets the alpha threshold for transparency. Alpha values above this threshold
  9985. will be treated as completely opaque, and values below this threshold will be
  9986. treated as completely transparent.
  9987. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9988. @end table
  9989. @subsection Examples
  9990. @itemize
  9991. @item
  9992. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9993. using @command{ffmpeg}:
  9994. @example
  9995. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9996. @end example
  9997. @end itemize
  9998. @section perspective
  9999. Correct perspective of video not recorded perpendicular to the screen.
  10000. A description of the accepted parameters follows.
  10001. @table @option
  10002. @item x0
  10003. @item y0
  10004. @item x1
  10005. @item y1
  10006. @item x2
  10007. @item y2
  10008. @item x3
  10009. @item y3
  10010. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10011. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10012. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10013. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10014. then the corners of the source will be sent to the specified coordinates.
  10015. The expressions can use the following variables:
  10016. @table @option
  10017. @item W
  10018. @item H
  10019. the width and height of video frame.
  10020. @item in
  10021. Input frame count.
  10022. @item on
  10023. Output frame count.
  10024. @end table
  10025. @item interpolation
  10026. Set interpolation for perspective correction.
  10027. It accepts the following values:
  10028. @table @samp
  10029. @item linear
  10030. @item cubic
  10031. @end table
  10032. Default value is @samp{linear}.
  10033. @item sense
  10034. Set interpretation of coordinate options.
  10035. It accepts the following values:
  10036. @table @samp
  10037. @item 0, source
  10038. Send point in the source specified by the given coordinates to
  10039. the corners of the destination.
  10040. @item 1, destination
  10041. Send the corners of the source to the point in the destination specified
  10042. by the given coordinates.
  10043. Default value is @samp{source}.
  10044. @end table
  10045. @item eval
  10046. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10047. It accepts the following values:
  10048. @table @samp
  10049. @item init
  10050. only evaluate expressions once during the filter initialization or
  10051. when a command is processed
  10052. @item frame
  10053. evaluate expressions for each incoming frame
  10054. @end table
  10055. Default value is @samp{init}.
  10056. @end table
  10057. @section phase
  10058. Delay interlaced video by one field time so that the field order changes.
  10059. The intended use is to fix PAL movies that have been captured with the
  10060. opposite field order to the film-to-video transfer.
  10061. A description of the accepted parameters follows.
  10062. @table @option
  10063. @item mode
  10064. Set phase mode.
  10065. It accepts the following values:
  10066. @table @samp
  10067. @item t
  10068. Capture field order top-first, transfer bottom-first.
  10069. Filter will delay the bottom field.
  10070. @item b
  10071. Capture field order bottom-first, transfer top-first.
  10072. Filter will delay the top field.
  10073. @item p
  10074. Capture and transfer with the same field order. This mode only exists
  10075. for the documentation of the other options to refer to, but if you
  10076. actually select it, the filter will faithfully do nothing.
  10077. @item a
  10078. Capture field order determined automatically by field flags, transfer
  10079. opposite.
  10080. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10081. basis using field flags. If no field information is available,
  10082. then this works just like @samp{u}.
  10083. @item u
  10084. Capture unknown or varying, transfer opposite.
  10085. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10086. analyzing the images and selecting the alternative that produces best
  10087. match between the fields.
  10088. @item T
  10089. Capture top-first, transfer unknown or varying.
  10090. Filter selects among @samp{t} and @samp{p} using image analysis.
  10091. @item B
  10092. Capture bottom-first, transfer unknown or varying.
  10093. Filter selects among @samp{b} and @samp{p} using image analysis.
  10094. @item A
  10095. Capture determined by field flags, transfer unknown or varying.
  10096. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10097. image analysis. If no field information is available, then this works just
  10098. like @samp{U}. This is the default mode.
  10099. @item U
  10100. Both capture and transfer unknown or varying.
  10101. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10102. @end table
  10103. @end table
  10104. @section pixdesctest
  10105. Pixel format descriptor test filter, mainly useful for internal
  10106. testing. The output video should be equal to the input video.
  10107. For example:
  10108. @example
  10109. format=monow, pixdesctest
  10110. @end example
  10111. can be used to test the monowhite pixel format descriptor definition.
  10112. @section pixscope
  10113. Display sample values of color channels. Mainly useful for checking color
  10114. and levels. Minimum supported resolution is 640x480.
  10115. The filters accept the following options:
  10116. @table @option
  10117. @item x
  10118. Set scope X position, relative offset on X axis.
  10119. @item y
  10120. Set scope Y position, relative offset on Y axis.
  10121. @item w
  10122. Set scope width.
  10123. @item h
  10124. Set scope height.
  10125. @item o
  10126. Set window opacity. This window also holds statistics about pixel area.
  10127. @item wx
  10128. Set window X position, relative offset on X axis.
  10129. @item wy
  10130. Set window Y position, relative offset on Y axis.
  10131. @end table
  10132. @section pp
  10133. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10134. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10135. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10136. Each subfilter and some options have a short and a long name that can be used
  10137. interchangeably, i.e. dr/dering are the same.
  10138. The filters accept the following options:
  10139. @table @option
  10140. @item subfilters
  10141. Set postprocessing subfilters string.
  10142. @end table
  10143. All subfilters share common options to determine their scope:
  10144. @table @option
  10145. @item a/autoq
  10146. Honor the quality commands for this subfilter.
  10147. @item c/chrom
  10148. Do chrominance filtering, too (default).
  10149. @item y/nochrom
  10150. Do luminance filtering only (no chrominance).
  10151. @item n/noluma
  10152. Do chrominance filtering only (no luminance).
  10153. @end table
  10154. These options can be appended after the subfilter name, separated by a '|'.
  10155. Available subfilters are:
  10156. @table @option
  10157. @item hb/hdeblock[|difference[|flatness]]
  10158. Horizontal deblocking filter
  10159. @table @option
  10160. @item difference
  10161. Difference factor where higher values mean more deblocking (default: @code{32}).
  10162. @item flatness
  10163. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10164. @end table
  10165. @item vb/vdeblock[|difference[|flatness]]
  10166. Vertical deblocking filter
  10167. @table @option
  10168. @item difference
  10169. Difference factor where higher values mean more deblocking (default: @code{32}).
  10170. @item flatness
  10171. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10172. @end table
  10173. @item ha/hadeblock[|difference[|flatness]]
  10174. Accurate horizontal deblocking filter
  10175. @table @option
  10176. @item difference
  10177. Difference factor where higher values mean more deblocking (default: @code{32}).
  10178. @item flatness
  10179. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10180. @end table
  10181. @item va/vadeblock[|difference[|flatness]]
  10182. Accurate vertical deblocking filter
  10183. @table @option
  10184. @item difference
  10185. Difference factor where higher values mean more deblocking (default: @code{32}).
  10186. @item flatness
  10187. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10188. @end table
  10189. @end table
  10190. The horizontal and vertical deblocking filters share the difference and
  10191. flatness values so you cannot set different horizontal and vertical
  10192. thresholds.
  10193. @table @option
  10194. @item h1/x1hdeblock
  10195. Experimental horizontal deblocking filter
  10196. @item v1/x1vdeblock
  10197. Experimental vertical deblocking filter
  10198. @item dr/dering
  10199. Deringing filter
  10200. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10201. @table @option
  10202. @item threshold1
  10203. larger -> stronger filtering
  10204. @item threshold2
  10205. larger -> stronger filtering
  10206. @item threshold3
  10207. larger -> stronger filtering
  10208. @end table
  10209. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10210. @table @option
  10211. @item f/fullyrange
  10212. Stretch luminance to @code{0-255}.
  10213. @end table
  10214. @item lb/linblenddeint
  10215. Linear blend deinterlacing filter that deinterlaces the given block by
  10216. filtering all lines with a @code{(1 2 1)} filter.
  10217. @item li/linipoldeint
  10218. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10219. linearly interpolating every second line.
  10220. @item ci/cubicipoldeint
  10221. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10222. cubically interpolating every second line.
  10223. @item md/mediandeint
  10224. Median deinterlacing filter that deinterlaces the given block by applying a
  10225. median filter to every second line.
  10226. @item fd/ffmpegdeint
  10227. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10228. second line with a @code{(-1 4 2 4 -1)} filter.
  10229. @item l5/lowpass5
  10230. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10231. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10232. @item fq/forceQuant[|quantizer]
  10233. Overrides the quantizer table from the input with the constant quantizer you
  10234. specify.
  10235. @table @option
  10236. @item quantizer
  10237. Quantizer to use
  10238. @end table
  10239. @item de/default
  10240. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10241. @item fa/fast
  10242. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10243. @item ac
  10244. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10245. @end table
  10246. @subsection Examples
  10247. @itemize
  10248. @item
  10249. Apply horizontal and vertical deblocking, deringing and automatic
  10250. brightness/contrast:
  10251. @example
  10252. pp=hb/vb/dr/al
  10253. @end example
  10254. @item
  10255. Apply default filters without brightness/contrast correction:
  10256. @example
  10257. pp=de/-al
  10258. @end example
  10259. @item
  10260. Apply default filters and temporal denoiser:
  10261. @example
  10262. pp=default/tmpnoise|1|2|3
  10263. @end example
  10264. @item
  10265. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10266. automatically depending on available CPU time:
  10267. @example
  10268. pp=hb|y/vb|a
  10269. @end example
  10270. @end itemize
  10271. @section pp7
  10272. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10273. similar to spp = 6 with 7 point DCT, where only the center sample is
  10274. used after IDCT.
  10275. The filter accepts the following options:
  10276. @table @option
  10277. @item qp
  10278. Force a constant quantization parameter. It accepts an integer in range
  10279. 0 to 63. If not set, the filter will use the QP from the video stream
  10280. (if available).
  10281. @item mode
  10282. Set thresholding mode. Available modes are:
  10283. @table @samp
  10284. @item hard
  10285. Set hard thresholding.
  10286. @item soft
  10287. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10288. @item medium
  10289. Set medium thresholding (good results, default).
  10290. @end table
  10291. @end table
  10292. @section premultiply
  10293. Apply alpha premultiply effect to input video stream using first plane
  10294. of second stream as alpha.
  10295. Both streams must have same dimensions and same pixel format.
  10296. The filter accepts the following option:
  10297. @table @option
  10298. @item planes
  10299. Set which planes will be processed, unprocessed planes will be copied.
  10300. By default value 0xf, all planes will be processed.
  10301. @item inplace
  10302. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10303. @end table
  10304. @section prewitt
  10305. Apply prewitt operator to input video stream.
  10306. The filter accepts the following option:
  10307. @table @option
  10308. @item planes
  10309. Set which planes will be processed, unprocessed planes will be copied.
  10310. By default value 0xf, all planes will be processed.
  10311. @item scale
  10312. Set value which will be multiplied with filtered result.
  10313. @item delta
  10314. Set value which will be added to filtered result.
  10315. @end table
  10316. @anchor{program_opencl}
  10317. @section program_opencl
  10318. Filter video using an OpenCL program.
  10319. @table @option
  10320. @item source
  10321. OpenCL program source file.
  10322. @item kernel
  10323. Kernel name in program.
  10324. @item inputs
  10325. Number of inputs to the filter. Defaults to 1.
  10326. @item size, s
  10327. Size of output frames. Defaults to the same as the first input.
  10328. @end table
  10329. The program source file must contain a kernel function with the given name,
  10330. which will be run once for each plane of the output. Each run on a plane
  10331. gets enqueued as a separate 2D global NDRange with one work-item for each
  10332. pixel to be generated. The global ID offset for each work-item is therefore
  10333. the coordinates of a pixel in the destination image.
  10334. The kernel function needs to take the following arguments:
  10335. @itemize
  10336. @item
  10337. Destination image, @var{__write_only image2d_t}.
  10338. This image will become the output; the kernel should write all of it.
  10339. @item
  10340. Frame index, @var{unsigned int}.
  10341. This is a counter starting from zero and increasing by one for each frame.
  10342. @item
  10343. Source images, @var{__read_only image2d_t}.
  10344. These are the most recent images on each input. The kernel may read from
  10345. them to generate the output, but they can't be written to.
  10346. @end itemize
  10347. Example programs:
  10348. @itemize
  10349. @item
  10350. Copy the input to the output (output must be the same size as the input).
  10351. @verbatim
  10352. __kernel void copy(__write_only image2d_t destination,
  10353. unsigned int index,
  10354. __read_only image2d_t source)
  10355. {
  10356. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10357. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10358. float4 value = read_imagef(source, sampler, location);
  10359. write_imagef(destination, location, value);
  10360. }
  10361. @end verbatim
  10362. @item
  10363. Apply a simple transformation, rotating the input by an amount increasing
  10364. with the index counter. Pixel values are linearly interpolated by the
  10365. sampler, and the output need not have the same dimensions as the input.
  10366. @verbatim
  10367. __kernel void rotate_image(__write_only image2d_t dst,
  10368. unsigned int index,
  10369. __read_only image2d_t src)
  10370. {
  10371. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10372. CLK_FILTER_LINEAR);
  10373. float angle = (float)index / 100.0f;
  10374. float2 dst_dim = convert_float2(get_image_dim(dst));
  10375. float2 src_dim = convert_float2(get_image_dim(src));
  10376. float2 dst_cen = dst_dim / 2.0f;
  10377. float2 src_cen = src_dim / 2.0f;
  10378. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10379. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10380. float2 src_pos = {
  10381. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10382. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10383. };
  10384. src_pos = src_pos * src_dim / dst_dim;
  10385. float2 src_loc = src_pos + src_cen;
  10386. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10387. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10388. write_imagef(dst, dst_loc, 0.5f);
  10389. else
  10390. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10391. }
  10392. @end verbatim
  10393. @item
  10394. Blend two inputs together, with the amount of each input used varying
  10395. with the index counter.
  10396. @verbatim
  10397. __kernel void blend_images(__write_only image2d_t dst,
  10398. unsigned int index,
  10399. __read_only image2d_t src1,
  10400. __read_only image2d_t src2)
  10401. {
  10402. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10403. CLK_FILTER_LINEAR);
  10404. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10405. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10406. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10407. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10408. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10409. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10410. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10411. }
  10412. @end verbatim
  10413. @end itemize
  10414. @section pseudocolor
  10415. Alter frame colors in video with pseudocolors.
  10416. This filter accept the following options:
  10417. @table @option
  10418. @item c0
  10419. set pixel first component expression
  10420. @item c1
  10421. set pixel second component expression
  10422. @item c2
  10423. set pixel third component expression
  10424. @item c3
  10425. set pixel fourth component expression, corresponds to the alpha component
  10426. @item i
  10427. set component to use as base for altering colors
  10428. @end table
  10429. Each of them specifies the expression to use for computing the lookup table for
  10430. the corresponding pixel component values.
  10431. The expressions can contain the following constants and functions:
  10432. @table @option
  10433. @item w
  10434. @item h
  10435. The input width and height.
  10436. @item val
  10437. The input value for the pixel component.
  10438. @item ymin, umin, vmin, amin
  10439. The minimum allowed component value.
  10440. @item ymax, umax, vmax, amax
  10441. The maximum allowed component value.
  10442. @end table
  10443. All expressions default to "val".
  10444. @subsection Examples
  10445. @itemize
  10446. @item
  10447. Change too high luma values to gradient:
  10448. @example
  10449. 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'"
  10450. @end example
  10451. @end itemize
  10452. @section psnr
  10453. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10454. Ratio) between two input videos.
  10455. This filter takes in input two input videos, the first input is
  10456. considered the "main" source and is passed unchanged to the
  10457. output. The second input is used as a "reference" video for computing
  10458. the PSNR.
  10459. Both video inputs must have the same resolution and pixel format for
  10460. this filter to work correctly. Also it assumes that both inputs
  10461. have the same number of frames, which are compared one by one.
  10462. The obtained average PSNR is printed through the logging system.
  10463. The filter stores the accumulated MSE (mean squared error) of each
  10464. frame, and at the end of the processing it is averaged across all frames
  10465. equally, and the following formula is applied to obtain the PSNR:
  10466. @example
  10467. PSNR = 10*log10(MAX^2/MSE)
  10468. @end example
  10469. Where MAX is the average of the maximum values of each component of the
  10470. image.
  10471. The description of the accepted parameters follows.
  10472. @table @option
  10473. @item stats_file, f
  10474. If specified the filter will use the named file to save the PSNR of
  10475. each individual frame. When filename equals "-" the data is sent to
  10476. standard output.
  10477. @item stats_version
  10478. Specifies which version of the stats file format to use. Details of
  10479. each format are written below.
  10480. Default value is 1.
  10481. @item stats_add_max
  10482. Determines whether the max value is output to the stats log.
  10483. Default value is 0.
  10484. Requires stats_version >= 2. If this is set and stats_version < 2,
  10485. the filter will return an error.
  10486. @end table
  10487. This filter also supports the @ref{framesync} options.
  10488. The file printed if @var{stats_file} is selected, contains a sequence of
  10489. key/value pairs of the form @var{key}:@var{value} for each compared
  10490. couple of frames.
  10491. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10492. the list of per-frame-pair stats, with key value pairs following the frame
  10493. format with the following parameters:
  10494. @table @option
  10495. @item psnr_log_version
  10496. The version of the log file format. Will match @var{stats_version}.
  10497. @item fields
  10498. A comma separated list of the per-frame-pair parameters included in
  10499. the log.
  10500. @end table
  10501. A description of each shown per-frame-pair parameter follows:
  10502. @table @option
  10503. @item n
  10504. sequential number of the input frame, starting from 1
  10505. @item mse_avg
  10506. Mean Square Error pixel-by-pixel average difference of the compared
  10507. frames, averaged over all the image components.
  10508. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10509. Mean Square Error pixel-by-pixel average difference of the compared
  10510. frames for the component specified by the suffix.
  10511. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10512. Peak Signal to Noise ratio of the compared frames for the component
  10513. specified by the suffix.
  10514. @item max_avg, max_y, max_u, max_v
  10515. Maximum allowed value for each channel, and average over all
  10516. channels.
  10517. @end table
  10518. For example:
  10519. @example
  10520. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10521. [main][ref] psnr="stats_file=stats.log" [out]
  10522. @end example
  10523. On this example the input file being processed is compared with the
  10524. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10525. is stored in @file{stats.log}.
  10526. @anchor{pullup}
  10527. @section pullup
  10528. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10529. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10530. content.
  10531. The pullup filter is designed to take advantage of future context in making
  10532. its decisions. This filter is stateless in the sense that it does not lock
  10533. onto a pattern to follow, but it instead looks forward to the following
  10534. fields in order to identify matches and rebuild progressive frames.
  10535. To produce content with an even framerate, insert the fps filter after
  10536. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10537. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10538. The filter accepts the following options:
  10539. @table @option
  10540. @item jl
  10541. @item jr
  10542. @item jt
  10543. @item jb
  10544. These options set the amount of "junk" to ignore at the left, right, top, and
  10545. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10546. while top and bottom are in units of 2 lines.
  10547. The default is 8 pixels on each side.
  10548. @item sb
  10549. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10550. filter generating an occasional mismatched frame, but it may also cause an
  10551. excessive number of frames to be dropped during high motion sequences.
  10552. Conversely, setting it to -1 will make filter match fields more easily.
  10553. This may help processing of video where there is slight blurring between
  10554. the fields, but may also cause there to be interlaced frames in the output.
  10555. Default value is @code{0}.
  10556. @item mp
  10557. Set the metric plane to use. It accepts the following values:
  10558. @table @samp
  10559. @item l
  10560. Use luma plane.
  10561. @item u
  10562. Use chroma blue plane.
  10563. @item v
  10564. Use chroma red plane.
  10565. @end table
  10566. This option may be set to use chroma plane instead of the default luma plane
  10567. for doing filter's computations. This may improve accuracy on very clean
  10568. source material, but more likely will decrease accuracy, especially if there
  10569. is chroma noise (rainbow effect) or any grayscale video.
  10570. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10571. load and make pullup usable in realtime on slow machines.
  10572. @end table
  10573. For best results (without duplicated frames in the output file) it is
  10574. necessary to change the output frame rate. For example, to inverse
  10575. telecine NTSC input:
  10576. @example
  10577. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10578. @end example
  10579. @section qp
  10580. Change video quantization parameters (QP).
  10581. The filter accepts the following option:
  10582. @table @option
  10583. @item qp
  10584. Set expression for quantization parameter.
  10585. @end table
  10586. The expression is evaluated through the eval API and can contain, among others,
  10587. the following constants:
  10588. @table @var
  10589. @item known
  10590. 1 if index is not 129, 0 otherwise.
  10591. @item qp
  10592. Sequential index starting from -129 to 128.
  10593. @end table
  10594. @subsection Examples
  10595. @itemize
  10596. @item
  10597. Some equation like:
  10598. @example
  10599. qp=2+2*sin(PI*qp)
  10600. @end example
  10601. @end itemize
  10602. @section random
  10603. Flush video frames from internal cache of frames into a random order.
  10604. No frame is discarded.
  10605. Inspired by @ref{frei0r} nervous filter.
  10606. @table @option
  10607. @item frames
  10608. Set size in number of frames of internal cache, in range from @code{2} to
  10609. @code{512}. Default is @code{30}.
  10610. @item seed
  10611. Set seed for random number generator, must be an integer included between
  10612. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10613. less than @code{0}, the filter will try to use a good random seed on a
  10614. best effort basis.
  10615. @end table
  10616. @section readeia608
  10617. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10618. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10619. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10620. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10621. @table @option
  10622. @item lavfi.readeia608.X.cc
  10623. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10624. @item lavfi.readeia608.X.line
  10625. The number of the line on which the EIA-608 data was identified and read.
  10626. @end table
  10627. This filter accepts the following options:
  10628. @table @option
  10629. @item scan_min
  10630. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10631. @item scan_max
  10632. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10633. @item mac
  10634. Set minimal acceptable amplitude change for sync codes detection.
  10635. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10636. @item spw
  10637. Set the ratio of width reserved for sync code detection.
  10638. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10639. @item mhd
  10640. Set the max peaks height difference for sync code detection.
  10641. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10642. @item mpd
  10643. Set max peaks period difference for sync code detection.
  10644. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10645. @item msd
  10646. Set the first two max start code bits differences.
  10647. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10648. @item bhd
  10649. Set the minimum ratio of bits height compared to 3rd start code bit.
  10650. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10651. @item th_w
  10652. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10653. @item th_b
  10654. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10655. @item chp
  10656. Enable checking the parity bit. In the event of a parity error, the filter will output
  10657. @code{0x00} for that character. Default is false.
  10658. @end table
  10659. @subsection Examples
  10660. @itemize
  10661. @item
  10662. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10663. @example
  10664. 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
  10665. @end example
  10666. @end itemize
  10667. @section readvitc
  10668. Read vertical interval timecode (VITC) information from the top lines of a
  10669. video frame.
  10670. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10671. timecode value, if a valid timecode has been detected. Further metadata key
  10672. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10673. timecode data has been found or not.
  10674. This filter accepts the following options:
  10675. @table @option
  10676. @item scan_max
  10677. Set the maximum number of lines to scan for VITC data. If the value is set to
  10678. @code{-1} the full video frame is scanned. Default is @code{45}.
  10679. @item thr_b
  10680. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10681. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10682. @item thr_w
  10683. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10684. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10685. @end table
  10686. @subsection Examples
  10687. @itemize
  10688. @item
  10689. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10690. draw @code{--:--:--:--} as a placeholder:
  10691. @example
  10692. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10693. @end example
  10694. @end itemize
  10695. @section remap
  10696. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10697. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10698. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10699. value for pixel will be used for destination pixel.
  10700. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10701. will have Xmap/Ymap video stream dimensions.
  10702. Xmap and Ymap input video streams are 16bit depth, single channel.
  10703. @section removegrain
  10704. The removegrain filter is a spatial denoiser for progressive video.
  10705. @table @option
  10706. @item m0
  10707. Set mode for the first plane.
  10708. @item m1
  10709. Set mode for the second plane.
  10710. @item m2
  10711. Set mode for the third plane.
  10712. @item m3
  10713. Set mode for the fourth plane.
  10714. @end table
  10715. Range of mode is from 0 to 24. Description of each mode follows:
  10716. @table @var
  10717. @item 0
  10718. Leave input plane unchanged. Default.
  10719. @item 1
  10720. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10721. @item 2
  10722. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10723. @item 3
  10724. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10725. @item 4
  10726. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10727. This is equivalent to a median filter.
  10728. @item 5
  10729. Line-sensitive clipping giving the minimal change.
  10730. @item 6
  10731. Line-sensitive clipping, intermediate.
  10732. @item 7
  10733. Line-sensitive clipping, intermediate.
  10734. @item 8
  10735. Line-sensitive clipping, intermediate.
  10736. @item 9
  10737. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10738. @item 10
  10739. Replaces the target pixel with the closest neighbour.
  10740. @item 11
  10741. [1 2 1] horizontal and vertical kernel blur.
  10742. @item 12
  10743. Same as mode 11.
  10744. @item 13
  10745. Bob mode, interpolates top field from the line where the neighbours
  10746. pixels are the closest.
  10747. @item 14
  10748. Bob mode, interpolates bottom field from the line where the neighbours
  10749. pixels are the closest.
  10750. @item 15
  10751. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10752. interpolation formula.
  10753. @item 16
  10754. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10755. interpolation formula.
  10756. @item 17
  10757. Clips the pixel with the minimum and maximum of respectively the maximum and
  10758. minimum of each pair of opposite neighbour pixels.
  10759. @item 18
  10760. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10761. the current pixel is minimal.
  10762. @item 19
  10763. Replaces the pixel with the average of its 8 neighbours.
  10764. @item 20
  10765. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10766. @item 21
  10767. Clips pixels using the averages of opposite neighbour.
  10768. @item 22
  10769. Same as mode 21 but simpler and faster.
  10770. @item 23
  10771. Small edge and halo removal, but reputed useless.
  10772. @item 24
  10773. Similar as 23.
  10774. @end table
  10775. @section removelogo
  10776. Suppress a TV station logo, using an image file to determine which
  10777. pixels comprise the logo. It works by filling in the pixels that
  10778. comprise the logo with neighboring pixels.
  10779. The filter accepts the following options:
  10780. @table @option
  10781. @item filename, f
  10782. Set the filter bitmap file, which can be any image format supported by
  10783. libavformat. The width and height of the image file must match those of the
  10784. video stream being processed.
  10785. @end table
  10786. Pixels in the provided bitmap image with a value of zero are not
  10787. considered part of the logo, non-zero pixels are considered part of
  10788. the logo. If you use white (255) for the logo and black (0) for the
  10789. rest, you will be safe. For making the filter bitmap, it is
  10790. recommended to take a screen capture of a black frame with the logo
  10791. visible, and then using a threshold filter followed by the erode
  10792. filter once or twice.
  10793. If needed, little splotches can be fixed manually. Remember that if
  10794. logo pixels are not covered, the filter quality will be much
  10795. reduced. Marking too many pixels as part of the logo does not hurt as
  10796. much, but it will increase the amount of blurring needed to cover over
  10797. the image and will destroy more information than necessary, and extra
  10798. pixels will slow things down on a large logo.
  10799. @section repeatfields
  10800. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10801. fields based on its value.
  10802. @section reverse
  10803. Reverse a video clip.
  10804. Warning: This filter requires memory to buffer the entire clip, so trimming
  10805. is suggested.
  10806. @subsection Examples
  10807. @itemize
  10808. @item
  10809. Take the first 5 seconds of a clip, and reverse it.
  10810. @example
  10811. trim=end=5,reverse
  10812. @end example
  10813. @end itemize
  10814. @section roberts
  10815. Apply roberts cross operator to input video stream.
  10816. The filter accepts the following option:
  10817. @table @option
  10818. @item planes
  10819. Set which planes will be processed, unprocessed planes will be copied.
  10820. By default value 0xf, all planes will be processed.
  10821. @item scale
  10822. Set value which will be multiplied with filtered result.
  10823. @item delta
  10824. Set value which will be added to filtered result.
  10825. @end table
  10826. @section rotate
  10827. Rotate video by an arbitrary angle expressed in radians.
  10828. The filter accepts the following options:
  10829. A description of the optional parameters follows.
  10830. @table @option
  10831. @item angle, a
  10832. Set an expression for the angle by which to rotate the input video
  10833. clockwise, expressed as a number of radians. A negative value will
  10834. result in a counter-clockwise rotation. By default it is set to "0".
  10835. This expression is evaluated for each frame.
  10836. @item out_w, ow
  10837. Set the output width expression, default value is "iw".
  10838. This expression is evaluated just once during configuration.
  10839. @item out_h, oh
  10840. Set the output height expression, default value is "ih".
  10841. This expression is evaluated just once during configuration.
  10842. @item bilinear
  10843. Enable bilinear interpolation if set to 1, a value of 0 disables
  10844. it. Default value is 1.
  10845. @item fillcolor, c
  10846. Set the color used to fill the output area not covered by the rotated
  10847. image. For the general syntax of this option, check the
  10848. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10849. If the special value "none" is selected then no
  10850. background is printed (useful for example if the background is never shown).
  10851. Default value is "black".
  10852. @end table
  10853. The expressions for the angle and the output size can contain the
  10854. following constants and functions:
  10855. @table @option
  10856. @item n
  10857. sequential number of the input frame, starting from 0. It is always NAN
  10858. before the first frame is filtered.
  10859. @item t
  10860. time in seconds of the input frame, it is set to 0 when the filter is
  10861. configured. It is always NAN before the first frame is filtered.
  10862. @item hsub
  10863. @item vsub
  10864. horizontal and vertical chroma subsample values. For example for the
  10865. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10866. @item in_w, iw
  10867. @item in_h, ih
  10868. the input video width and height
  10869. @item out_w, ow
  10870. @item out_h, oh
  10871. the output width and height, that is the size of the padded area as
  10872. specified by the @var{width} and @var{height} expressions
  10873. @item rotw(a)
  10874. @item roth(a)
  10875. the minimal width/height required for completely containing the input
  10876. video rotated by @var{a} radians.
  10877. These are only available when computing the @option{out_w} and
  10878. @option{out_h} expressions.
  10879. @end table
  10880. @subsection Examples
  10881. @itemize
  10882. @item
  10883. Rotate the input by PI/6 radians clockwise:
  10884. @example
  10885. rotate=PI/6
  10886. @end example
  10887. @item
  10888. Rotate the input by PI/6 radians counter-clockwise:
  10889. @example
  10890. rotate=-PI/6
  10891. @end example
  10892. @item
  10893. Rotate the input by 45 degrees clockwise:
  10894. @example
  10895. rotate=45*PI/180
  10896. @end example
  10897. @item
  10898. Apply a constant rotation with period T, starting from an angle of PI/3:
  10899. @example
  10900. rotate=PI/3+2*PI*t/T
  10901. @end example
  10902. @item
  10903. Make the input video rotation oscillating with a period of T
  10904. seconds and an amplitude of A radians:
  10905. @example
  10906. rotate=A*sin(2*PI/T*t)
  10907. @end example
  10908. @item
  10909. Rotate the video, output size is chosen so that the whole rotating
  10910. input video is always completely contained in the output:
  10911. @example
  10912. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10913. @end example
  10914. @item
  10915. Rotate the video, reduce the output size so that no background is ever
  10916. shown:
  10917. @example
  10918. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10919. @end example
  10920. @end itemize
  10921. @subsection Commands
  10922. The filter supports the following commands:
  10923. @table @option
  10924. @item a, angle
  10925. Set the angle expression.
  10926. The command accepts the same syntax of the corresponding option.
  10927. If the specified expression is not valid, it is kept at its current
  10928. value.
  10929. @end table
  10930. @section sab
  10931. Apply Shape Adaptive Blur.
  10932. The filter accepts the following options:
  10933. @table @option
  10934. @item luma_radius, lr
  10935. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10936. value is 1.0. A greater value will result in a more blurred image, and
  10937. in slower processing.
  10938. @item luma_pre_filter_radius, lpfr
  10939. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10940. value is 1.0.
  10941. @item luma_strength, ls
  10942. Set luma maximum difference between pixels to still be considered, must
  10943. be a value in the 0.1-100.0 range, default value is 1.0.
  10944. @item chroma_radius, cr
  10945. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10946. greater value will result in a more blurred image, and in slower
  10947. processing.
  10948. @item chroma_pre_filter_radius, cpfr
  10949. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10950. @item chroma_strength, cs
  10951. Set chroma maximum difference between pixels to still be considered,
  10952. must be a value in the -0.9-100.0 range.
  10953. @end table
  10954. Each chroma option value, if not explicitly specified, is set to the
  10955. corresponding luma option value.
  10956. @anchor{scale}
  10957. @section scale
  10958. Scale (resize) the input video, using the libswscale library.
  10959. The scale filter forces the output display aspect ratio to be the same
  10960. of the input, by changing the output sample aspect ratio.
  10961. If the input image format is different from the format requested by
  10962. the next filter, the scale filter will convert the input to the
  10963. requested format.
  10964. @subsection Options
  10965. The filter accepts the following options, or any of the options
  10966. supported by the libswscale scaler.
  10967. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10968. the complete list of scaler options.
  10969. @table @option
  10970. @item width, w
  10971. @item height, h
  10972. Set the output video dimension expression. Default value is the input
  10973. dimension.
  10974. If the @var{width} or @var{w} value is 0, the input width is used for
  10975. the output. If the @var{height} or @var{h} value is 0, the input height
  10976. is used for the output.
  10977. If one and only one of the values is -n with n >= 1, the scale filter
  10978. will use a value that maintains the aspect ratio of the input image,
  10979. calculated from the other specified dimension. After that it will,
  10980. however, make sure that the calculated dimension is divisible by n and
  10981. adjust the value if necessary.
  10982. If both values are -n with n >= 1, the behavior will be identical to
  10983. both values being set to 0 as previously detailed.
  10984. See below for the list of accepted constants for use in the dimension
  10985. expression.
  10986. @item eval
  10987. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10988. @table @samp
  10989. @item init
  10990. Only evaluate expressions once during the filter initialization or when a command is processed.
  10991. @item frame
  10992. Evaluate expressions for each incoming frame.
  10993. @end table
  10994. Default value is @samp{init}.
  10995. @item interl
  10996. Set the interlacing mode. It accepts the following values:
  10997. @table @samp
  10998. @item 1
  10999. Force interlaced aware scaling.
  11000. @item 0
  11001. Do not apply interlaced scaling.
  11002. @item -1
  11003. Select interlaced aware scaling depending on whether the source frames
  11004. are flagged as interlaced or not.
  11005. @end table
  11006. Default value is @samp{0}.
  11007. @item flags
  11008. Set libswscale scaling flags. See
  11009. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11010. complete list of values. If not explicitly specified the filter applies
  11011. the default flags.
  11012. @item param0, param1
  11013. Set libswscale input parameters for scaling algorithms that need them. See
  11014. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11015. complete documentation. If not explicitly specified the filter applies
  11016. empty parameters.
  11017. @item size, s
  11018. Set the video size. For the syntax of this option, check the
  11019. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11020. @item in_color_matrix
  11021. @item out_color_matrix
  11022. Set in/output YCbCr color space type.
  11023. This allows the autodetected value to be overridden as well as allows forcing
  11024. a specific value used for the output and encoder.
  11025. If not specified, the color space type depends on the pixel format.
  11026. Possible values:
  11027. @table @samp
  11028. @item auto
  11029. Choose automatically.
  11030. @item bt709
  11031. Format conforming to International Telecommunication Union (ITU)
  11032. Recommendation BT.709.
  11033. @item fcc
  11034. Set color space conforming to the United States Federal Communications
  11035. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11036. @item bt601
  11037. Set color space conforming to:
  11038. @itemize
  11039. @item
  11040. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11041. @item
  11042. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11043. @item
  11044. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11045. @end itemize
  11046. @item smpte240m
  11047. Set color space conforming to SMPTE ST 240:1999.
  11048. @end table
  11049. @item in_range
  11050. @item out_range
  11051. Set in/output YCbCr sample range.
  11052. This allows the autodetected value to be overridden as well as allows forcing
  11053. a specific value used for the output and encoder. If not specified, the
  11054. range depends on the pixel format. Possible values:
  11055. @table @samp
  11056. @item auto/unknown
  11057. Choose automatically.
  11058. @item jpeg/full/pc
  11059. Set full range (0-255 in case of 8-bit luma).
  11060. @item mpeg/limited/tv
  11061. Set "MPEG" range (16-235 in case of 8-bit luma).
  11062. @end table
  11063. @item force_original_aspect_ratio
  11064. Enable decreasing or increasing output video width or height if necessary to
  11065. keep the original aspect ratio. Possible values:
  11066. @table @samp
  11067. @item disable
  11068. Scale the video as specified and disable this feature.
  11069. @item decrease
  11070. The output video dimensions will automatically be decreased if needed.
  11071. @item increase
  11072. The output video dimensions will automatically be increased if needed.
  11073. @end table
  11074. One useful instance of this option is that when you know a specific device's
  11075. maximum allowed resolution, you can use this to limit the output video to
  11076. that, while retaining the aspect ratio. For example, device A allows
  11077. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11078. decrease) and specifying 1280x720 to the command line makes the output
  11079. 1280x533.
  11080. Please note that this is a different thing than specifying -1 for @option{w}
  11081. or @option{h}, you still need to specify the output resolution for this option
  11082. to work.
  11083. @end table
  11084. The values of the @option{w} and @option{h} options are expressions
  11085. containing the following constants:
  11086. @table @var
  11087. @item in_w
  11088. @item in_h
  11089. The input width and height
  11090. @item iw
  11091. @item ih
  11092. These are the same as @var{in_w} and @var{in_h}.
  11093. @item out_w
  11094. @item out_h
  11095. The output (scaled) width and height
  11096. @item ow
  11097. @item oh
  11098. These are the same as @var{out_w} and @var{out_h}
  11099. @item a
  11100. The same as @var{iw} / @var{ih}
  11101. @item sar
  11102. input sample aspect ratio
  11103. @item dar
  11104. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11105. @item hsub
  11106. @item vsub
  11107. horizontal and vertical input chroma subsample values. For example for the
  11108. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11109. @item ohsub
  11110. @item ovsub
  11111. horizontal and vertical output chroma subsample values. For example for the
  11112. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11113. @end table
  11114. @subsection Examples
  11115. @itemize
  11116. @item
  11117. Scale the input video to a size of 200x100
  11118. @example
  11119. scale=w=200:h=100
  11120. @end example
  11121. This is equivalent to:
  11122. @example
  11123. scale=200:100
  11124. @end example
  11125. or:
  11126. @example
  11127. scale=200x100
  11128. @end example
  11129. @item
  11130. Specify a size abbreviation for the output size:
  11131. @example
  11132. scale=qcif
  11133. @end example
  11134. which can also be written as:
  11135. @example
  11136. scale=size=qcif
  11137. @end example
  11138. @item
  11139. Scale the input to 2x:
  11140. @example
  11141. scale=w=2*iw:h=2*ih
  11142. @end example
  11143. @item
  11144. The above is the same as:
  11145. @example
  11146. scale=2*in_w:2*in_h
  11147. @end example
  11148. @item
  11149. Scale the input to 2x with forced interlaced scaling:
  11150. @example
  11151. scale=2*iw:2*ih:interl=1
  11152. @end example
  11153. @item
  11154. Scale the input to half size:
  11155. @example
  11156. scale=w=iw/2:h=ih/2
  11157. @end example
  11158. @item
  11159. Increase the width, and set the height to the same size:
  11160. @example
  11161. scale=3/2*iw:ow
  11162. @end example
  11163. @item
  11164. Seek Greek harmony:
  11165. @example
  11166. scale=iw:1/PHI*iw
  11167. scale=ih*PHI:ih
  11168. @end example
  11169. @item
  11170. Increase the height, and set the width to 3/2 of the height:
  11171. @example
  11172. scale=w=3/2*oh:h=3/5*ih
  11173. @end example
  11174. @item
  11175. Increase the size, making the size a multiple of the chroma
  11176. subsample values:
  11177. @example
  11178. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11179. @end example
  11180. @item
  11181. Increase the width to a maximum of 500 pixels,
  11182. keeping the same aspect ratio as the input:
  11183. @example
  11184. scale=w='min(500\, iw*3/2):h=-1'
  11185. @end example
  11186. @item
  11187. Make pixels square by combining scale and setsar:
  11188. @example
  11189. scale='trunc(ih*dar):ih',setsar=1/1
  11190. @end example
  11191. @item
  11192. Make pixels square by combining scale and setsar,
  11193. making sure the resulting resolution is even (required by some codecs):
  11194. @example
  11195. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11196. @end example
  11197. @end itemize
  11198. @subsection Commands
  11199. This filter supports the following commands:
  11200. @table @option
  11201. @item width, w
  11202. @item height, h
  11203. Set the output video dimension expression.
  11204. The command accepts the same syntax of the corresponding option.
  11205. If the specified expression is not valid, it is kept at its current
  11206. value.
  11207. @end table
  11208. @section scale_npp
  11209. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11210. format conversion on CUDA video frames. Setting the output width and height
  11211. works in the same way as for the @var{scale} filter.
  11212. The following additional options are accepted:
  11213. @table @option
  11214. @item format
  11215. The pixel format of the output CUDA frames. If set to the string "same" (the
  11216. default), the input format will be kept. Note that automatic format negotiation
  11217. and conversion is not yet supported for hardware frames
  11218. @item interp_algo
  11219. The interpolation algorithm used for resizing. One of the following:
  11220. @table @option
  11221. @item nn
  11222. Nearest neighbour.
  11223. @item linear
  11224. @item cubic
  11225. @item cubic2p_bspline
  11226. 2-parameter cubic (B=1, C=0)
  11227. @item cubic2p_catmullrom
  11228. 2-parameter cubic (B=0, C=1/2)
  11229. @item cubic2p_b05c03
  11230. 2-parameter cubic (B=1/2, C=3/10)
  11231. @item super
  11232. Supersampling
  11233. @item lanczos
  11234. @end table
  11235. @end table
  11236. @section scale2ref
  11237. Scale (resize) the input video, based on a reference video.
  11238. See the scale filter for available options, scale2ref supports the same but
  11239. uses the reference video instead of the main input as basis. scale2ref also
  11240. supports the following additional constants for the @option{w} and
  11241. @option{h} options:
  11242. @table @var
  11243. @item main_w
  11244. @item main_h
  11245. The main input video's width and height
  11246. @item main_a
  11247. The same as @var{main_w} / @var{main_h}
  11248. @item main_sar
  11249. The main input video's sample aspect ratio
  11250. @item main_dar, mdar
  11251. The main input video's display aspect ratio. Calculated from
  11252. @code{(main_w / main_h) * main_sar}.
  11253. @item main_hsub
  11254. @item main_vsub
  11255. The main input video's horizontal and vertical chroma subsample values.
  11256. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11257. is 1.
  11258. @end table
  11259. @subsection Examples
  11260. @itemize
  11261. @item
  11262. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11263. @example
  11264. 'scale2ref[b][a];[a][b]overlay'
  11265. @end example
  11266. @end itemize
  11267. @anchor{selectivecolor}
  11268. @section selectivecolor
  11269. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11270. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11271. by the "purity" of the color (that is, how saturated it already is).
  11272. This filter is similar to the Adobe Photoshop Selective Color tool.
  11273. The filter accepts the following options:
  11274. @table @option
  11275. @item correction_method
  11276. Select color correction method.
  11277. Available values are:
  11278. @table @samp
  11279. @item absolute
  11280. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11281. component value).
  11282. @item relative
  11283. Specified adjustments are relative to the original component value.
  11284. @end table
  11285. Default is @code{absolute}.
  11286. @item reds
  11287. Adjustments for red pixels (pixels where the red component is the maximum)
  11288. @item yellows
  11289. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11290. @item greens
  11291. Adjustments for green pixels (pixels where the green component is the maximum)
  11292. @item cyans
  11293. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11294. @item blues
  11295. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11296. @item magentas
  11297. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11298. @item whites
  11299. Adjustments for white pixels (pixels where all components are greater than 128)
  11300. @item neutrals
  11301. Adjustments for all pixels except pure black and pure white
  11302. @item blacks
  11303. Adjustments for black pixels (pixels where all components are lesser than 128)
  11304. @item psfile
  11305. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11306. @end table
  11307. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11308. 4 space separated floating point adjustment values in the [-1,1] range,
  11309. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11310. pixels of its range.
  11311. @subsection Examples
  11312. @itemize
  11313. @item
  11314. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11315. increase magenta by 27% in blue areas:
  11316. @example
  11317. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11318. @end example
  11319. @item
  11320. Use a Photoshop selective color preset:
  11321. @example
  11322. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11323. @end example
  11324. @end itemize
  11325. @anchor{separatefields}
  11326. @section separatefields
  11327. The @code{separatefields} takes a frame-based video input and splits
  11328. each frame into its components fields, producing a new half height clip
  11329. with twice the frame rate and twice the frame count.
  11330. This filter use field-dominance information in frame to decide which
  11331. of each pair of fields to place first in the output.
  11332. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11333. @section setdar, setsar
  11334. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11335. output video.
  11336. This is done by changing the specified Sample (aka Pixel) Aspect
  11337. Ratio, according to the following equation:
  11338. @example
  11339. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11340. @end example
  11341. Keep in mind that the @code{setdar} filter does not modify the pixel
  11342. dimensions of the video frame. Also, the display aspect ratio set by
  11343. this filter may be changed by later filters in the filterchain,
  11344. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11345. applied.
  11346. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11347. the filter output video.
  11348. Note that as a consequence of the application of this filter, the
  11349. output display aspect ratio will change according to the equation
  11350. above.
  11351. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11352. filter may be changed by later filters in the filterchain, e.g. if
  11353. another "setsar" or a "setdar" filter is applied.
  11354. It accepts the following parameters:
  11355. @table @option
  11356. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11357. Set the aspect ratio used by the filter.
  11358. The parameter can be a floating point number string, an expression, or
  11359. a string of the form @var{num}:@var{den}, where @var{num} and
  11360. @var{den} are the numerator and denominator of the aspect ratio. If
  11361. the parameter is not specified, it is assumed the value "0".
  11362. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11363. should be escaped.
  11364. @item max
  11365. Set the maximum integer value to use for expressing numerator and
  11366. denominator when reducing the expressed aspect ratio to a rational.
  11367. Default value is @code{100}.
  11368. @end table
  11369. The parameter @var{sar} is an expression containing
  11370. the following constants:
  11371. @table @option
  11372. @item E, PI, PHI
  11373. These are approximated values for the mathematical constants e
  11374. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11375. @item w, h
  11376. The input width and height.
  11377. @item a
  11378. These are the same as @var{w} / @var{h}.
  11379. @item sar
  11380. The input sample aspect ratio.
  11381. @item dar
  11382. The input display aspect ratio. It is the same as
  11383. (@var{w} / @var{h}) * @var{sar}.
  11384. @item hsub, vsub
  11385. Horizontal and vertical chroma subsample values. For example, for the
  11386. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11387. @end table
  11388. @subsection Examples
  11389. @itemize
  11390. @item
  11391. To change the display aspect ratio to 16:9, specify one of the following:
  11392. @example
  11393. setdar=dar=1.77777
  11394. setdar=dar=16/9
  11395. @end example
  11396. @item
  11397. To change the sample aspect ratio to 10:11, specify:
  11398. @example
  11399. setsar=sar=10/11
  11400. @end example
  11401. @item
  11402. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11403. 1000 in the aspect ratio reduction, use the command:
  11404. @example
  11405. setdar=ratio=16/9:max=1000
  11406. @end example
  11407. @end itemize
  11408. @anchor{setfield}
  11409. @section setfield
  11410. Force field for the output video frame.
  11411. The @code{setfield} filter marks the interlace type field for the
  11412. output frames. It does not change the input frame, but only sets the
  11413. corresponding property, which affects how the frame is treated by
  11414. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11415. The filter accepts the following options:
  11416. @table @option
  11417. @item mode
  11418. Available values are:
  11419. @table @samp
  11420. @item auto
  11421. Keep the same field property.
  11422. @item bff
  11423. Mark the frame as bottom-field-first.
  11424. @item tff
  11425. Mark the frame as top-field-first.
  11426. @item prog
  11427. Mark the frame as progressive.
  11428. @end table
  11429. @end table
  11430. @section showinfo
  11431. Show a line containing various information for each input video frame.
  11432. The input video is not modified.
  11433. The shown line contains a sequence of key/value pairs of the form
  11434. @var{key}:@var{value}.
  11435. The following values are shown in the output:
  11436. @table @option
  11437. @item n
  11438. The (sequential) number of the input frame, starting from 0.
  11439. @item pts
  11440. The Presentation TimeStamp of the input frame, expressed as a number of
  11441. time base units. The time base unit depends on the filter input pad.
  11442. @item pts_time
  11443. The Presentation TimeStamp of the input frame, expressed as a number of
  11444. seconds.
  11445. @item pos
  11446. The position of the frame in the input stream, or -1 if this information is
  11447. unavailable and/or meaningless (for example in case of synthetic video).
  11448. @item fmt
  11449. The pixel format name.
  11450. @item sar
  11451. The sample aspect ratio of the input frame, expressed in the form
  11452. @var{num}/@var{den}.
  11453. @item s
  11454. The size of the input frame. For the syntax of this option, check the
  11455. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11456. @item i
  11457. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11458. for bottom field first).
  11459. @item iskey
  11460. This is 1 if the frame is a key frame, 0 otherwise.
  11461. @item type
  11462. The picture type of the input frame ("I" for an I-frame, "P" for a
  11463. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11464. Also refer to the documentation of the @code{AVPictureType} enum and of
  11465. the @code{av_get_picture_type_char} function defined in
  11466. @file{libavutil/avutil.h}.
  11467. @item checksum
  11468. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11469. @item plane_checksum
  11470. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11471. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11472. @end table
  11473. @section showpalette
  11474. Displays the 256 colors palette of each frame. This filter is only relevant for
  11475. @var{pal8} pixel format frames.
  11476. It accepts the following option:
  11477. @table @option
  11478. @item s
  11479. Set the size of the box used to represent one palette color entry. Default is
  11480. @code{30} (for a @code{30x30} pixel box).
  11481. @end table
  11482. @section shuffleframes
  11483. Reorder and/or duplicate and/or drop video frames.
  11484. It accepts the following parameters:
  11485. @table @option
  11486. @item mapping
  11487. Set the destination indexes of input frames.
  11488. This is space or '|' separated list of indexes that maps input frames to output
  11489. frames. Number of indexes also sets maximal value that each index may have.
  11490. '-1' index have special meaning and that is to drop frame.
  11491. @end table
  11492. The first frame has the index 0. The default is to keep the input unchanged.
  11493. @subsection Examples
  11494. @itemize
  11495. @item
  11496. Swap second and third frame of every three frames of the input:
  11497. @example
  11498. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11499. @end example
  11500. @item
  11501. Swap 10th and 1st frame of every ten frames of the input:
  11502. @example
  11503. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11504. @end example
  11505. @end itemize
  11506. @section shuffleplanes
  11507. Reorder and/or duplicate video planes.
  11508. It accepts the following parameters:
  11509. @table @option
  11510. @item map0
  11511. The index of the input plane to be used as the first output plane.
  11512. @item map1
  11513. The index of the input plane to be used as the second output plane.
  11514. @item map2
  11515. The index of the input plane to be used as the third output plane.
  11516. @item map3
  11517. The index of the input plane to be used as the fourth output plane.
  11518. @end table
  11519. The first plane has the index 0. The default is to keep the input unchanged.
  11520. @subsection Examples
  11521. @itemize
  11522. @item
  11523. Swap the second and third planes of the input:
  11524. @example
  11525. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11526. @end example
  11527. @end itemize
  11528. @anchor{signalstats}
  11529. @section signalstats
  11530. Evaluate various visual metrics that assist in determining issues associated
  11531. with the digitization of analog video media.
  11532. By default the filter will log these metadata values:
  11533. @table @option
  11534. @item YMIN
  11535. Display the minimal Y value contained within the input frame. Expressed in
  11536. range of [0-255].
  11537. @item YLOW
  11538. Display the Y value at the 10% percentile within the input frame. Expressed in
  11539. range of [0-255].
  11540. @item YAVG
  11541. Display the average Y value within the input frame. Expressed in range of
  11542. [0-255].
  11543. @item YHIGH
  11544. Display the Y value at the 90% percentile within the input frame. Expressed in
  11545. range of [0-255].
  11546. @item YMAX
  11547. Display the maximum Y value contained within the input frame. Expressed in
  11548. range of [0-255].
  11549. @item UMIN
  11550. Display the minimal U value contained within the input frame. Expressed in
  11551. range of [0-255].
  11552. @item ULOW
  11553. Display the U value at the 10% percentile within the input frame. Expressed in
  11554. range of [0-255].
  11555. @item UAVG
  11556. Display the average U value within the input frame. Expressed in range of
  11557. [0-255].
  11558. @item UHIGH
  11559. Display the U value at the 90% percentile within the input frame. Expressed in
  11560. range of [0-255].
  11561. @item UMAX
  11562. Display the maximum U value contained within the input frame. Expressed in
  11563. range of [0-255].
  11564. @item VMIN
  11565. Display the minimal V value contained within the input frame. Expressed in
  11566. range of [0-255].
  11567. @item VLOW
  11568. Display the V value at the 10% percentile within the input frame. Expressed in
  11569. range of [0-255].
  11570. @item VAVG
  11571. Display the average V value within the input frame. Expressed in range of
  11572. [0-255].
  11573. @item VHIGH
  11574. Display the V value at the 90% percentile within the input frame. Expressed in
  11575. range of [0-255].
  11576. @item VMAX
  11577. Display the maximum V value contained within the input frame. Expressed in
  11578. range of [0-255].
  11579. @item SATMIN
  11580. Display the minimal saturation value contained within the input frame.
  11581. Expressed in range of [0-~181.02].
  11582. @item SATLOW
  11583. Display the saturation value at the 10% percentile within the input frame.
  11584. Expressed in range of [0-~181.02].
  11585. @item SATAVG
  11586. Display the average saturation value within the input frame. Expressed in range
  11587. of [0-~181.02].
  11588. @item SATHIGH
  11589. Display the saturation value at the 90% percentile within the input frame.
  11590. Expressed in range of [0-~181.02].
  11591. @item SATMAX
  11592. Display the maximum saturation value contained within the input frame.
  11593. Expressed in range of [0-~181.02].
  11594. @item HUEMED
  11595. Display the median value for hue within the input frame. Expressed in range of
  11596. [0-360].
  11597. @item HUEAVG
  11598. Display the average value for hue within the input frame. Expressed in range of
  11599. [0-360].
  11600. @item YDIF
  11601. Display the average of sample value difference between all values of the Y
  11602. plane in the current frame and corresponding values of the previous input frame.
  11603. Expressed in range of [0-255].
  11604. @item UDIF
  11605. Display the average of sample value difference between all values of the U
  11606. plane in the current frame and corresponding values of the previous input frame.
  11607. Expressed in range of [0-255].
  11608. @item VDIF
  11609. Display the average of sample value difference between all values of the V
  11610. plane in the current frame and corresponding values of the previous input frame.
  11611. Expressed in range of [0-255].
  11612. @item YBITDEPTH
  11613. Display bit depth of Y plane in current frame.
  11614. Expressed in range of [0-16].
  11615. @item UBITDEPTH
  11616. Display bit depth of U plane in current frame.
  11617. Expressed in range of [0-16].
  11618. @item VBITDEPTH
  11619. Display bit depth of V plane in current frame.
  11620. Expressed in range of [0-16].
  11621. @end table
  11622. The filter accepts the following options:
  11623. @table @option
  11624. @item stat
  11625. @item out
  11626. @option{stat} specify an additional form of image analysis.
  11627. @option{out} output video with the specified type of pixel highlighted.
  11628. Both options accept the following values:
  11629. @table @samp
  11630. @item tout
  11631. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11632. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11633. include the results of video dropouts, head clogs, or tape tracking issues.
  11634. @item vrep
  11635. Identify @var{vertical line repetition}. Vertical line repetition includes
  11636. similar rows of pixels within a frame. In born-digital video vertical line
  11637. repetition is common, but this pattern is uncommon in video digitized from an
  11638. analog source. When it occurs in video that results from the digitization of an
  11639. analog source it can indicate concealment from a dropout compensator.
  11640. @item brng
  11641. Identify pixels that fall outside of legal broadcast range.
  11642. @end table
  11643. @item color, c
  11644. Set the highlight color for the @option{out} option. The default color is
  11645. yellow.
  11646. @end table
  11647. @subsection Examples
  11648. @itemize
  11649. @item
  11650. Output data of various video metrics:
  11651. @example
  11652. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11653. @end example
  11654. @item
  11655. Output specific data about the minimum and maximum values of the Y plane per frame:
  11656. @example
  11657. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11658. @end example
  11659. @item
  11660. Playback video while highlighting pixels that are outside of broadcast range in red.
  11661. @example
  11662. ffplay example.mov -vf signalstats="out=brng:color=red"
  11663. @end example
  11664. @item
  11665. Playback video with signalstats metadata drawn over the frame.
  11666. @example
  11667. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11668. @end example
  11669. The contents of signalstat_drawtext.txt used in the command are:
  11670. @example
  11671. time %@{pts:hms@}
  11672. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11673. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11674. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11675. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11676. @end example
  11677. @end itemize
  11678. @anchor{signature}
  11679. @section signature
  11680. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11681. input. In this case the matching between the inputs can be calculated additionally.
  11682. The filter always passes through the first input. The signature of each stream can
  11683. be written into a file.
  11684. It accepts the following options:
  11685. @table @option
  11686. @item detectmode
  11687. Enable or disable the matching process.
  11688. Available values are:
  11689. @table @samp
  11690. @item off
  11691. Disable the calculation of a matching (default).
  11692. @item full
  11693. Calculate the matching for the whole video and output whether the whole video
  11694. matches or only parts.
  11695. @item fast
  11696. Calculate only until a matching is found or the video ends. Should be faster in
  11697. some cases.
  11698. @end table
  11699. @item nb_inputs
  11700. Set the number of inputs. The option value must be a non negative integer.
  11701. Default value is 1.
  11702. @item filename
  11703. Set the path to which the output is written. If there is more than one input,
  11704. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11705. integer), that will be replaced with the input number. If no filename is
  11706. specified, no output will be written. This is the default.
  11707. @item format
  11708. Choose the output format.
  11709. Available values are:
  11710. @table @samp
  11711. @item binary
  11712. Use the specified binary representation (default).
  11713. @item xml
  11714. Use the specified xml representation.
  11715. @end table
  11716. @item th_d
  11717. Set threshold to detect one word as similar. The option value must be an integer
  11718. greater than zero. The default value is 9000.
  11719. @item th_dc
  11720. Set threshold to detect all words as similar. The option value must be an integer
  11721. greater than zero. The default value is 60000.
  11722. @item th_xh
  11723. Set threshold to detect frames as similar. The option value must be an integer
  11724. greater than zero. The default value is 116.
  11725. @item th_di
  11726. Set the minimum length of a sequence in frames to recognize it as matching
  11727. sequence. The option value must be a non negative integer value.
  11728. The default value is 0.
  11729. @item th_it
  11730. Set the minimum relation, that matching frames to all frames must have.
  11731. The option value must be a double value between 0 and 1. The default value is 0.5.
  11732. @end table
  11733. @subsection Examples
  11734. @itemize
  11735. @item
  11736. To calculate the signature of an input video and store it in signature.bin:
  11737. @example
  11738. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11739. @end example
  11740. @item
  11741. To detect whether two videos match and store the signatures in XML format in
  11742. signature0.xml and signature1.xml:
  11743. @example
  11744. 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 -
  11745. @end example
  11746. @end itemize
  11747. @anchor{smartblur}
  11748. @section smartblur
  11749. Blur the input video without impacting the outlines.
  11750. It accepts the following options:
  11751. @table @option
  11752. @item luma_radius, lr
  11753. Set the luma radius. The option value must be a float number in
  11754. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11755. used to blur the image (slower if larger). Default value is 1.0.
  11756. @item luma_strength, ls
  11757. Set the luma strength. The option value must be a float number
  11758. in the range [-1.0,1.0] that configures the blurring. A value included
  11759. in [0.0,1.0] will blur the image whereas a value included in
  11760. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11761. @item luma_threshold, lt
  11762. Set the luma threshold used as a coefficient to determine
  11763. whether a pixel should be blurred or not. The option value must be an
  11764. integer in the range [-30,30]. A value of 0 will filter all the image,
  11765. a value included in [0,30] will filter flat areas and a value included
  11766. in [-30,0] will filter edges. Default value is 0.
  11767. @item chroma_radius, cr
  11768. Set the chroma radius. The option value must be a float number in
  11769. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11770. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11771. @item chroma_strength, cs
  11772. Set the chroma strength. The option value must be a float number
  11773. in the range [-1.0,1.0] that configures the blurring. A value included
  11774. in [0.0,1.0] will blur the image whereas a value included in
  11775. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11776. @item chroma_threshold, ct
  11777. Set the chroma threshold used as a coefficient to determine
  11778. whether a pixel should be blurred or not. The option value must be an
  11779. integer in the range [-30,30]. A value of 0 will filter all the image,
  11780. a value included in [0,30] will filter flat areas and a value included
  11781. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11782. @end table
  11783. If a chroma option is not explicitly set, the corresponding luma value
  11784. is set.
  11785. @section ssim
  11786. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11787. This filter takes in input two input videos, the first input is
  11788. considered the "main" source and is passed unchanged to the
  11789. output. The second input is used as a "reference" video for computing
  11790. the SSIM.
  11791. Both video inputs must have the same resolution and pixel format for
  11792. this filter to work correctly. Also it assumes that both inputs
  11793. have the same number of frames, which are compared one by one.
  11794. The filter stores the calculated SSIM of each frame.
  11795. The description of the accepted parameters follows.
  11796. @table @option
  11797. @item stats_file, f
  11798. If specified the filter will use the named file to save the SSIM of
  11799. each individual frame. When filename equals "-" the data is sent to
  11800. standard output.
  11801. @end table
  11802. The file printed if @var{stats_file} is selected, contains a sequence of
  11803. key/value pairs of the form @var{key}:@var{value} for each compared
  11804. couple of frames.
  11805. A description of each shown parameter follows:
  11806. @table @option
  11807. @item n
  11808. sequential number of the input frame, starting from 1
  11809. @item Y, U, V, R, G, B
  11810. SSIM of the compared frames for the component specified by the suffix.
  11811. @item All
  11812. SSIM of the compared frames for the whole frame.
  11813. @item dB
  11814. Same as above but in dB representation.
  11815. @end table
  11816. This filter also supports the @ref{framesync} options.
  11817. For example:
  11818. @example
  11819. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11820. [main][ref] ssim="stats_file=stats.log" [out]
  11821. @end example
  11822. On this example the input file being processed is compared with the
  11823. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11824. is stored in @file{stats.log}.
  11825. Another example with both psnr and ssim at same time:
  11826. @example
  11827. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11828. @end example
  11829. @section stereo3d
  11830. Convert between different stereoscopic image formats.
  11831. The filters accept the following options:
  11832. @table @option
  11833. @item in
  11834. Set stereoscopic image format of input.
  11835. Available values for input image formats are:
  11836. @table @samp
  11837. @item sbsl
  11838. side by side parallel (left eye left, right eye right)
  11839. @item sbsr
  11840. side by side crosseye (right eye left, left eye right)
  11841. @item sbs2l
  11842. side by side parallel with half width resolution
  11843. (left eye left, right eye right)
  11844. @item sbs2r
  11845. side by side crosseye with half width resolution
  11846. (right eye left, left eye right)
  11847. @item abl
  11848. above-below (left eye above, right eye below)
  11849. @item abr
  11850. above-below (right eye above, left eye below)
  11851. @item ab2l
  11852. above-below with half height resolution
  11853. (left eye above, right eye below)
  11854. @item ab2r
  11855. above-below with half height resolution
  11856. (right eye above, left eye below)
  11857. @item al
  11858. alternating frames (left eye first, right eye second)
  11859. @item ar
  11860. alternating frames (right eye first, left eye second)
  11861. @item irl
  11862. interleaved rows (left eye has top row, right eye starts on next row)
  11863. @item irr
  11864. interleaved rows (right eye has top row, left eye starts on next row)
  11865. @item icl
  11866. interleaved columns, left eye first
  11867. @item icr
  11868. interleaved columns, right eye first
  11869. Default value is @samp{sbsl}.
  11870. @end table
  11871. @item out
  11872. Set stereoscopic image format of output.
  11873. @table @samp
  11874. @item sbsl
  11875. side by side parallel (left eye left, right eye right)
  11876. @item sbsr
  11877. side by side crosseye (right eye left, left eye right)
  11878. @item sbs2l
  11879. side by side parallel with half width resolution
  11880. (left eye left, right eye right)
  11881. @item sbs2r
  11882. side by side crosseye with half width resolution
  11883. (right eye left, left eye right)
  11884. @item abl
  11885. above-below (left eye above, right eye below)
  11886. @item abr
  11887. above-below (right eye above, left eye below)
  11888. @item ab2l
  11889. above-below with half height resolution
  11890. (left eye above, right eye below)
  11891. @item ab2r
  11892. above-below with half height resolution
  11893. (right eye above, left eye below)
  11894. @item al
  11895. alternating frames (left eye first, right eye second)
  11896. @item ar
  11897. alternating frames (right eye first, left eye second)
  11898. @item irl
  11899. interleaved rows (left eye has top row, right eye starts on next row)
  11900. @item irr
  11901. interleaved rows (right eye has top row, left eye starts on next row)
  11902. @item arbg
  11903. anaglyph red/blue gray
  11904. (red filter on left eye, blue filter on right eye)
  11905. @item argg
  11906. anaglyph red/green gray
  11907. (red filter on left eye, green filter on right eye)
  11908. @item arcg
  11909. anaglyph red/cyan gray
  11910. (red filter on left eye, cyan filter on right eye)
  11911. @item arch
  11912. anaglyph red/cyan half colored
  11913. (red filter on left eye, cyan filter on right eye)
  11914. @item arcc
  11915. anaglyph red/cyan color
  11916. (red filter on left eye, cyan filter on right eye)
  11917. @item arcd
  11918. anaglyph red/cyan color optimized with the least squares projection of dubois
  11919. (red filter on left eye, cyan filter on right eye)
  11920. @item agmg
  11921. anaglyph green/magenta gray
  11922. (green filter on left eye, magenta filter on right eye)
  11923. @item agmh
  11924. anaglyph green/magenta half colored
  11925. (green filter on left eye, magenta filter on right eye)
  11926. @item agmc
  11927. anaglyph green/magenta colored
  11928. (green filter on left eye, magenta filter on right eye)
  11929. @item agmd
  11930. anaglyph green/magenta color optimized with the least squares projection of dubois
  11931. (green filter on left eye, magenta filter on right eye)
  11932. @item aybg
  11933. anaglyph yellow/blue gray
  11934. (yellow filter on left eye, blue filter on right eye)
  11935. @item aybh
  11936. anaglyph yellow/blue half colored
  11937. (yellow filter on left eye, blue filter on right eye)
  11938. @item aybc
  11939. anaglyph yellow/blue colored
  11940. (yellow filter on left eye, blue filter on right eye)
  11941. @item aybd
  11942. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11943. (yellow filter on left eye, blue filter on right eye)
  11944. @item ml
  11945. mono output (left eye only)
  11946. @item mr
  11947. mono output (right eye only)
  11948. @item chl
  11949. checkerboard, left eye first
  11950. @item chr
  11951. checkerboard, right eye first
  11952. @item icl
  11953. interleaved columns, left eye first
  11954. @item icr
  11955. interleaved columns, right eye first
  11956. @item hdmi
  11957. HDMI frame pack
  11958. @end table
  11959. Default value is @samp{arcd}.
  11960. @end table
  11961. @subsection Examples
  11962. @itemize
  11963. @item
  11964. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11965. @example
  11966. stereo3d=sbsl:aybd
  11967. @end example
  11968. @item
  11969. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11970. @example
  11971. stereo3d=abl:sbsr
  11972. @end example
  11973. @end itemize
  11974. @section streamselect, astreamselect
  11975. Select video or audio streams.
  11976. The filter accepts the following options:
  11977. @table @option
  11978. @item inputs
  11979. Set number of inputs. Default is 2.
  11980. @item map
  11981. Set input indexes to remap to outputs.
  11982. @end table
  11983. @subsection Commands
  11984. The @code{streamselect} and @code{astreamselect} filter supports the following
  11985. commands:
  11986. @table @option
  11987. @item map
  11988. Set input indexes to remap to outputs.
  11989. @end table
  11990. @subsection Examples
  11991. @itemize
  11992. @item
  11993. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11994. @example
  11995. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11996. @end example
  11997. @item
  11998. Same as above, but for audio:
  11999. @example
  12000. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12001. @end example
  12002. @end itemize
  12003. @section sobel
  12004. Apply sobel operator to input video stream.
  12005. The filter accepts the following option:
  12006. @table @option
  12007. @item planes
  12008. Set which planes will be processed, unprocessed planes will be copied.
  12009. By default value 0xf, all planes will be processed.
  12010. @item scale
  12011. Set value which will be multiplied with filtered result.
  12012. @item delta
  12013. Set value which will be added to filtered result.
  12014. @end table
  12015. @anchor{spp}
  12016. @section spp
  12017. Apply a simple postprocessing filter that compresses and decompresses the image
  12018. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12019. and average the results.
  12020. The filter accepts the following options:
  12021. @table @option
  12022. @item quality
  12023. Set quality. This option defines the number of levels for averaging. It accepts
  12024. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12025. effect. A value of @code{6} means the higher quality. For each increment of
  12026. that value the speed drops by a factor of approximately 2. Default value is
  12027. @code{3}.
  12028. @item qp
  12029. Force a constant quantization parameter. If not set, the filter will use the QP
  12030. from the video stream (if available).
  12031. @item mode
  12032. Set thresholding mode. Available modes are:
  12033. @table @samp
  12034. @item hard
  12035. Set hard thresholding (default).
  12036. @item soft
  12037. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12038. @end table
  12039. @item use_bframe_qp
  12040. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12041. option may cause flicker since the B-Frames have often larger QP. Default is
  12042. @code{0} (not enabled).
  12043. @end table
  12044. @section sr
  12045. Scale the input by applying one of the super-resolution methods based on
  12046. convolutional neural networks. Supported models:
  12047. @itemize
  12048. @item
  12049. Super-Resolution Convolutional Neural Network model (SRCNN).
  12050. See @url{https://arxiv.org/abs/1501.00092}.
  12051. @item
  12052. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12053. See @url{https://arxiv.org/abs/1609.05158}.
  12054. @end itemize
  12055. Training scripts as well as scripts for model generation are provided in
  12056. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12057. The filter accepts the following options:
  12058. @table @option
  12059. @item dnn_backend
  12060. Specify which DNN backend to use for model loading and execution. This option accepts
  12061. the following values:
  12062. @table @samp
  12063. @item native
  12064. Native implementation of DNN loading and execution.
  12065. @item tensorflow
  12066. TensorFlow backend. To enable this backend you
  12067. need to install the TensorFlow for C library (see
  12068. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12069. @code{--enable-libtensorflow}
  12070. @end table
  12071. Default value is @samp{native}.
  12072. @item model
  12073. Set path to model file specifying network architecture and its parameters.
  12074. Note that different backends use different file formats. TensorFlow backend
  12075. can load files for both formats, while native backend can load files for only
  12076. its format.
  12077. @item scale_factor
  12078. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12079. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12080. input upscaled using bicubic upscaling with proper scale factor.
  12081. @end table
  12082. @anchor{subtitles}
  12083. @section subtitles
  12084. Draw subtitles on top of input video using the libass library.
  12085. To enable compilation of this filter you need to configure FFmpeg with
  12086. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12087. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12088. Alpha) subtitles format.
  12089. The filter accepts the following options:
  12090. @table @option
  12091. @item filename, f
  12092. Set the filename of the subtitle file to read. It must be specified.
  12093. @item original_size
  12094. Specify the size of the original video, the video for which the ASS file
  12095. was composed. For the syntax of this option, check the
  12096. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12097. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12098. correctly scale the fonts if the aspect ratio has been changed.
  12099. @item fontsdir
  12100. Set a directory path containing fonts that can be used by the filter.
  12101. These fonts will be used in addition to whatever the font provider uses.
  12102. @item alpha
  12103. Process alpha channel, by default alpha channel is untouched.
  12104. @item charenc
  12105. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12106. useful if not UTF-8.
  12107. @item stream_index, si
  12108. Set subtitles stream index. @code{subtitles} filter only.
  12109. @item force_style
  12110. Override default style or script info parameters of the subtitles. It accepts a
  12111. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12112. @end table
  12113. If the first key is not specified, it is assumed that the first value
  12114. specifies the @option{filename}.
  12115. For example, to render the file @file{sub.srt} on top of the input
  12116. video, use the command:
  12117. @example
  12118. subtitles=sub.srt
  12119. @end example
  12120. which is equivalent to:
  12121. @example
  12122. subtitles=filename=sub.srt
  12123. @end example
  12124. To render the default subtitles stream from file @file{video.mkv}, use:
  12125. @example
  12126. subtitles=video.mkv
  12127. @end example
  12128. To render the second subtitles stream from that file, use:
  12129. @example
  12130. subtitles=video.mkv:si=1
  12131. @end example
  12132. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12133. @code{DejaVu Serif}, use:
  12134. @example
  12135. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12136. @end example
  12137. @section super2xsai
  12138. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12139. Interpolate) pixel art scaling algorithm.
  12140. Useful for enlarging pixel art images without reducing sharpness.
  12141. @section swaprect
  12142. Swap two rectangular objects in video.
  12143. This filter accepts the following options:
  12144. @table @option
  12145. @item w
  12146. Set object width.
  12147. @item h
  12148. Set object height.
  12149. @item x1
  12150. Set 1st rect x coordinate.
  12151. @item y1
  12152. Set 1st rect y coordinate.
  12153. @item x2
  12154. Set 2nd rect x coordinate.
  12155. @item y2
  12156. Set 2nd rect y coordinate.
  12157. All expressions are evaluated once for each frame.
  12158. @end table
  12159. The all options are expressions containing the following constants:
  12160. @table @option
  12161. @item w
  12162. @item h
  12163. The input width and height.
  12164. @item a
  12165. same as @var{w} / @var{h}
  12166. @item sar
  12167. input sample aspect ratio
  12168. @item dar
  12169. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12170. @item n
  12171. The number of the input frame, starting from 0.
  12172. @item t
  12173. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12174. @item pos
  12175. the position in the file of the input frame, NAN if unknown
  12176. @end table
  12177. @section swapuv
  12178. Swap U & V plane.
  12179. @section telecine
  12180. Apply telecine process to the video.
  12181. This filter accepts the following options:
  12182. @table @option
  12183. @item first_field
  12184. @table @samp
  12185. @item top, t
  12186. top field first
  12187. @item bottom, b
  12188. bottom field first
  12189. The default value is @code{top}.
  12190. @end table
  12191. @item pattern
  12192. A string of numbers representing the pulldown pattern you wish to apply.
  12193. The default value is @code{23}.
  12194. @end table
  12195. @example
  12196. Some typical patterns:
  12197. NTSC output (30i):
  12198. 27.5p: 32222
  12199. 24p: 23 (classic)
  12200. 24p: 2332 (preferred)
  12201. 20p: 33
  12202. 18p: 334
  12203. 16p: 3444
  12204. PAL output (25i):
  12205. 27.5p: 12222
  12206. 24p: 222222222223 ("Euro pulldown")
  12207. 16.67p: 33
  12208. 16p: 33333334
  12209. @end example
  12210. @section threshold
  12211. Apply threshold effect to video stream.
  12212. This filter needs four video streams to perform thresholding.
  12213. First stream is stream we are filtering.
  12214. Second stream is holding threshold values, third stream is holding min values,
  12215. and last, fourth stream is holding max values.
  12216. The filter accepts the following option:
  12217. @table @option
  12218. @item planes
  12219. Set which planes will be processed, unprocessed planes will be copied.
  12220. By default value 0xf, all planes will be processed.
  12221. @end table
  12222. For example if first stream pixel's component value is less then threshold value
  12223. of pixel component from 2nd threshold stream, third stream value will picked,
  12224. otherwise fourth stream pixel component value will be picked.
  12225. Using color source filter one can perform various types of thresholding:
  12226. @subsection Examples
  12227. @itemize
  12228. @item
  12229. Binary threshold, using gray color as threshold:
  12230. @example
  12231. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12232. @end example
  12233. @item
  12234. Inverted binary threshold, using gray color as threshold:
  12235. @example
  12236. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12237. @end example
  12238. @item
  12239. Truncate binary threshold, using gray color as threshold:
  12240. @example
  12241. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12242. @end example
  12243. @item
  12244. Threshold to zero, using gray color as threshold:
  12245. @example
  12246. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12247. @end example
  12248. @item
  12249. Inverted threshold to zero, using gray color as threshold:
  12250. @example
  12251. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12252. @end example
  12253. @end itemize
  12254. @section thumbnail
  12255. Select the most representative frame in a given sequence of consecutive frames.
  12256. The filter accepts the following options:
  12257. @table @option
  12258. @item n
  12259. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12260. will pick one of them, and then handle the next batch of @var{n} frames until
  12261. the end. Default is @code{100}.
  12262. @end table
  12263. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12264. value will result in a higher memory usage, so a high value is not recommended.
  12265. @subsection Examples
  12266. @itemize
  12267. @item
  12268. Extract one picture each 50 frames:
  12269. @example
  12270. thumbnail=50
  12271. @end example
  12272. @item
  12273. Complete example of a thumbnail creation with @command{ffmpeg}:
  12274. @example
  12275. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12276. @end example
  12277. @end itemize
  12278. @section tile
  12279. Tile several successive frames together.
  12280. The filter accepts the following options:
  12281. @table @option
  12282. @item layout
  12283. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12284. this option, check the
  12285. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12286. @item nb_frames
  12287. Set the maximum number of frames to render in the given area. It must be less
  12288. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12289. the area will be used.
  12290. @item margin
  12291. Set the outer border margin in pixels.
  12292. @item padding
  12293. Set the inner border thickness (i.e. the number of pixels between frames). For
  12294. more advanced padding options (such as having different values for the edges),
  12295. refer to the pad video filter.
  12296. @item color
  12297. Specify the color of the unused area. For the syntax of this option, check the
  12298. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12299. The default value of @var{color} is "black".
  12300. @item overlap
  12301. Set the number of frames to overlap when tiling several successive frames together.
  12302. The value must be between @code{0} and @var{nb_frames - 1}.
  12303. @item init_padding
  12304. Set the number of frames to initially be empty before displaying first output frame.
  12305. This controls how soon will one get first output frame.
  12306. The value must be between @code{0} and @var{nb_frames - 1}.
  12307. @end table
  12308. @subsection Examples
  12309. @itemize
  12310. @item
  12311. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12312. @example
  12313. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12314. @end example
  12315. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12316. duplicating each output frame to accommodate the originally detected frame
  12317. rate.
  12318. @item
  12319. Display @code{5} pictures in an area of @code{3x2} frames,
  12320. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12321. mixed flat and named options:
  12322. @example
  12323. tile=3x2:nb_frames=5:padding=7:margin=2
  12324. @end example
  12325. @end itemize
  12326. @section tinterlace
  12327. Perform various types of temporal field interlacing.
  12328. Frames are counted starting from 1, so the first input frame is
  12329. considered odd.
  12330. The filter accepts the following options:
  12331. @table @option
  12332. @item mode
  12333. Specify the mode of the interlacing. This option can also be specified
  12334. as a value alone. See below for a list of values for this option.
  12335. Available values are:
  12336. @table @samp
  12337. @item merge, 0
  12338. Move odd frames into the upper field, even into the lower field,
  12339. generating a double height frame at half frame rate.
  12340. @example
  12341. ------> time
  12342. Input:
  12343. Frame 1 Frame 2 Frame 3 Frame 4
  12344. 11111 22222 33333 44444
  12345. 11111 22222 33333 44444
  12346. 11111 22222 33333 44444
  12347. 11111 22222 33333 44444
  12348. Output:
  12349. 11111 33333
  12350. 22222 44444
  12351. 11111 33333
  12352. 22222 44444
  12353. 11111 33333
  12354. 22222 44444
  12355. 11111 33333
  12356. 22222 44444
  12357. @end example
  12358. @item drop_even, 1
  12359. Only output odd frames, even frames are dropped, generating a frame with
  12360. unchanged height at half frame rate.
  12361. @example
  12362. ------> time
  12363. Input:
  12364. Frame 1 Frame 2 Frame 3 Frame 4
  12365. 11111 22222 33333 44444
  12366. 11111 22222 33333 44444
  12367. 11111 22222 33333 44444
  12368. 11111 22222 33333 44444
  12369. Output:
  12370. 11111 33333
  12371. 11111 33333
  12372. 11111 33333
  12373. 11111 33333
  12374. @end example
  12375. @item drop_odd, 2
  12376. Only output even frames, odd frames are dropped, generating a frame with
  12377. unchanged height at half frame rate.
  12378. @example
  12379. ------> time
  12380. Input:
  12381. Frame 1 Frame 2 Frame 3 Frame 4
  12382. 11111 22222 33333 44444
  12383. 11111 22222 33333 44444
  12384. 11111 22222 33333 44444
  12385. 11111 22222 33333 44444
  12386. Output:
  12387. 22222 44444
  12388. 22222 44444
  12389. 22222 44444
  12390. 22222 44444
  12391. @end example
  12392. @item pad, 3
  12393. Expand each frame to full height, but pad alternate lines with black,
  12394. generating a frame with double height at the same input frame rate.
  12395. @example
  12396. ------> time
  12397. Input:
  12398. Frame 1 Frame 2 Frame 3 Frame 4
  12399. 11111 22222 33333 44444
  12400. 11111 22222 33333 44444
  12401. 11111 22222 33333 44444
  12402. 11111 22222 33333 44444
  12403. Output:
  12404. 11111 ..... 33333 .....
  12405. ..... 22222 ..... 44444
  12406. 11111 ..... 33333 .....
  12407. ..... 22222 ..... 44444
  12408. 11111 ..... 33333 .....
  12409. ..... 22222 ..... 44444
  12410. 11111 ..... 33333 .....
  12411. ..... 22222 ..... 44444
  12412. @end example
  12413. @item interleave_top, 4
  12414. Interleave the upper field from odd frames with the lower field from
  12415. even frames, generating a frame with unchanged height at half frame rate.
  12416. @example
  12417. ------> time
  12418. Input:
  12419. Frame 1 Frame 2 Frame 3 Frame 4
  12420. 11111<- 22222 33333<- 44444
  12421. 11111 22222<- 33333 44444<-
  12422. 11111<- 22222 33333<- 44444
  12423. 11111 22222<- 33333 44444<-
  12424. Output:
  12425. 11111 33333
  12426. 22222 44444
  12427. 11111 33333
  12428. 22222 44444
  12429. @end example
  12430. @item interleave_bottom, 5
  12431. Interleave the lower field from odd frames with the upper field from
  12432. even frames, generating a frame with unchanged height at half frame rate.
  12433. @example
  12434. ------> time
  12435. Input:
  12436. Frame 1 Frame 2 Frame 3 Frame 4
  12437. 11111 22222<- 33333 44444<-
  12438. 11111<- 22222 33333<- 44444
  12439. 11111 22222<- 33333 44444<-
  12440. 11111<- 22222 33333<- 44444
  12441. Output:
  12442. 22222 44444
  12443. 11111 33333
  12444. 22222 44444
  12445. 11111 33333
  12446. @end example
  12447. @item interlacex2, 6
  12448. Double frame rate with unchanged height. Frames are inserted each
  12449. containing the second temporal field from the previous input frame and
  12450. the first temporal field from the next input frame. This mode relies on
  12451. the top_field_first flag. Useful for interlaced video displays with no
  12452. field synchronisation.
  12453. @example
  12454. ------> time
  12455. Input:
  12456. Frame 1 Frame 2 Frame 3 Frame 4
  12457. 11111 22222 33333 44444
  12458. 11111 22222 33333 44444
  12459. 11111 22222 33333 44444
  12460. 11111 22222 33333 44444
  12461. Output:
  12462. 11111 22222 22222 33333 33333 44444 44444
  12463. 11111 11111 22222 22222 33333 33333 44444
  12464. 11111 22222 22222 33333 33333 44444 44444
  12465. 11111 11111 22222 22222 33333 33333 44444
  12466. @end example
  12467. @item mergex2, 7
  12468. Move odd frames into the upper field, even into the lower field,
  12469. generating a double height frame at same frame rate.
  12470. @example
  12471. ------> time
  12472. Input:
  12473. Frame 1 Frame 2 Frame 3 Frame 4
  12474. 11111 22222 33333 44444
  12475. 11111 22222 33333 44444
  12476. 11111 22222 33333 44444
  12477. 11111 22222 33333 44444
  12478. Output:
  12479. 11111 33333 33333 55555
  12480. 22222 22222 44444 44444
  12481. 11111 33333 33333 55555
  12482. 22222 22222 44444 44444
  12483. 11111 33333 33333 55555
  12484. 22222 22222 44444 44444
  12485. 11111 33333 33333 55555
  12486. 22222 22222 44444 44444
  12487. @end example
  12488. @end table
  12489. Numeric values are deprecated but are accepted for backward
  12490. compatibility reasons.
  12491. Default mode is @code{merge}.
  12492. @item flags
  12493. Specify flags influencing the filter process.
  12494. Available value for @var{flags} is:
  12495. @table @option
  12496. @item low_pass_filter, vlfp
  12497. Enable linear vertical low-pass filtering in the filter.
  12498. Vertical low-pass filtering is required when creating an interlaced
  12499. destination from a progressive source which contains high-frequency
  12500. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12501. patterning.
  12502. @item complex_filter, cvlfp
  12503. Enable complex vertical low-pass filtering.
  12504. This will slightly less reduce interlace 'twitter' and Moire
  12505. patterning but better retain detail and subjective sharpness impression.
  12506. @end table
  12507. Vertical low-pass filtering can only be enabled for @option{mode}
  12508. @var{interleave_top} and @var{interleave_bottom}.
  12509. @end table
  12510. @section tmix
  12511. Mix successive video frames.
  12512. A description of the accepted options follows.
  12513. @table @option
  12514. @item frames
  12515. The number of successive frames to mix. If unspecified, it defaults to 3.
  12516. @item weights
  12517. Specify weight of each input video frame.
  12518. Each weight is separated by space. If number of weights is smaller than
  12519. number of @var{frames} last specified weight will be used for all remaining
  12520. unset weights.
  12521. @item scale
  12522. Specify scale, if it is set it will be multiplied with sum
  12523. of each weight multiplied with pixel values to give final destination
  12524. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12525. @end table
  12526. @subsection Examples
  12527. @itemize
  12528. @item
  12529. Average 7 successive frames:
  12530. @example
  12531. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12532. @end example
  12533. @item
  12534. Apply simple temporal convolution:
  12535. @example
  12536. tmix=frames=3:weights="-1 3 -1"
  12537. @end example
  12538. @item
  12539. Similar as above but only showing temporal differences:
  12540. @example
  12541. tmix=frames=3:weights="-1 2 -1":scale=1
  12542. @end example
  12543. @end itemize
  12544. @section tonemap
  12545. Tone map colors from different dynamic ranges.
  12546. This filter expects data in single precision floating point, as it needs to
  12547. operate on (and can output) out-of-range values. Another filter, such as
  12548. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12549. The tonemapping algorithms implemented only work on linear light, so input
  12550. data should be linearized beforehand (and possibly correctly tagged).
  12551. @example
  12552. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12553. @end example
  12554. @subsection Options
  12555. The filter accepts the following options.
  12556. @table @option
  12557. @item tonemap
  12558. Set the tone map algorithm to use.
  12559. Possible values are:
  12560. @table @var
  12561. @item none
  12562. Do not apply any tone map, only desaturate overbright pixels.
  12563. @item clip
  12564. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12565. in-range values, while distorting out-of-range values.
  12566. @item linear
  12567. Stretch the entire reference gamut to a linear multiple of the display.
  12568. @item gamma
  12569. Fit a logarithmic transfer between the tone curves.
  12570. @item reinhard
  12571. Preserve overall image brightness with a simple curve, using nonlinear
  12572. contrast, which results in flattening details and degrading color accuracy.
  12573. @item hable
  12574. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12575. of slightly darkening everything. Use it when detail preservation is more
  12576. important than color and brightness accuracy.
  12577. @item mobius
  12578. Smoothly map out-of-range values, while retaining contrast and colors for
  12579. in-range material as much as possible. Use it when color accuracy is more
  12580. important than detail preservation.
  12581. @end table
  12582. Default is none.
  12583. @item param
  12584. Tune the tone mapping algorithm.
  12585. This affects the following algorithms:
  12586. @table @var
  12587. @item none
  12588. Ignored.
  12589. @item linear
  12590. Specifies the scale factor to use while stretching.
  12591. Default to 1.0.
  12592. @item gamma
  12593. Specifies the exponent of the function.
  12594. Default to 1.8.
  12595. @item clip
  12596. Specify an extra linear coefficient to multiply into the signal before clipping.
  12597. Default to 1.0.
  12598. @item reinhard
  12599. Specify the local contrast coefficient at the display peak.
  12600. Default to 0.5, which means that in-gamut values will be about half as bright
  12601. as when clipping.
  12602. @item hable
  12603. Ignored.
  12604. @item mobius
  12605. Specify the transition point from linear to mobius transform. Every value
  12606. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12607. more accurate the result will be, at the cost of losing bright details.
  12608. Default to 0.3, which due to the steep initial slope still preserves in-range
  12609. colors fairly accurately.
  12610. @end table
  12611. @item desat
  12612. Apply desaturation for highlights that exceed this level of brightness. The
  12613. higher the parameter, the more color information will be preserved. This
  12614. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12615. (smoothly) turning into white instead. This makes images feel more natural,
  12616. at the cost of reducing information about out-of-range colors.
  12617. The default of 2.0 is somewhat conservative and will mostly just apply to
  12618. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12619. This option works only if the input frame has a supported color tag.
  12620. @item peak
  12621. Override signal/nominal/reference peak with this value. Useful when the
  12622. embedded peak information in display metadata is not reliable or when tone
  12623. mapping from a lower range to a higher range.
  12624. @end table
  12625. @anchor{transpose}
  12626. @section transpose
  12627. Transpose rows with columns in the input video and optionally flip it.
  12628. It accepts the following parameters:
  12629. @table @option
  12630. @item dir
  12631. Specify the transposition direction.
  12632. Can assume the following values:
  12633. @table @samp
  12634. @item 0, 4, cclock_flip
  12635. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12636. @example
  12637. L.R L.l
  12638. . . -> . .
  12639. l.r R.r
  12640. @end example
  12641. @item 1, 5, clock
  12642. Rotate by 90 degrees clockwise, that is:
  12643. @example
  12644. L.R l.L
  12645. . . -> . .
  12646. l.r r.R
  12647. @end example
  12648. @item 2, 6, cclock
  12649. Rotate by 90 degrees counterclockwise, that is:
  12650. @example
  12651. L.R R.r
  12652. . . -> . .
  12653. l.r L.l
  12654. @end example
  12655. @item 3, 7, clock_flip
  12656. Rotate by 90 degrees clockwise and vertically flip, that is:
  12657. @example
  12658. L.R r.R
  12659. . . -> . .
  12660. l.r l.L
  12661. @end example
  12662. @end table
  12663. For values between 4-7, the transposition is only done if the input
  12664. video geometry is portrait and not landscape. These values are
  12665. deprecated, the @code{passthrough} option should be used instead.
  12666. Numerical values are deprecated, and should be dropped in favor of
  12667. symbolic constants.
  12668. @item passthrough
  12669. Do not apply the transposition if the input geometry matches the one
  12670. specified by the specified value. It accepts the following values:
  12671. @table @samp
  12672. @item none
  12673. Always apply transposition.
  12674. @item portrait
  12675. Preserve portrait geometry (when @var{height} >= @var{width}).
  12676. @item landscape
  12677. Preserve landscape geometry (when @var{width} >= @var{height}).
  12678. @end table
  12679. Default value is @code{none}.
  12680. @end table
  12681. For example to rotate by 90 degrees clockwise and preserve portrait
  12682. layout:
  12683. @example
  12684. transpose=dir=1:passthrough=portrait
  12685. @end example
  12686. The command above can also be specified as:
  12687. @example
  12688. transpose=1:portrait
  12689. @end example
  12690. @section transpose_npp
  12691. Transpose rows with columns in the input video and optionally flip it.
  12692. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  12693. It accepts the following parameters:
  12694. @table @option
  12695. @item dir
  12696. Specify the transposition direction.
  12697. Can assume the following values:
  12698. @table @samp
  12699. @item cclock_flip
  12700. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  12701. @item clock
  12702. Rotate by 90 degrees clockwise.
  12703. @item cclock
  12704. Rotate by 90 degrees counterclockwise.
  12705. @item clock_flip
  12706. Rotate by 90 degrees clockwise and vertically flip.
  12707. @end table
  12708. @item passthrough
  12709. Do not apply the transposition if the input geometry matches the one
  12710. specified by the specified value. It accepts the following values:
  12711. @table @samp
  12712. @item none
  12713. Always apply transposition. (default)
  12714. @item portrait
  12715. Preserve portrait geometry (when @var{height} >= @var{width}).
  12716. @item landscape
  12717. Preserve landscape geometry (when @var{width} >= @var{height}).
  12718. @end table
  12719. @end table
  12720. @section trim
  12721. Trim the input so that the output contains one continuous subpart of the input.
  12722. It accepts the following parameters:
  12723. @table @option
  12724. @item start
  12725. Specify the time of the start of the kept section, i.e. the frame with the
  12726. timestamp @var{start} will be the first frame in the output.
  12727. @item end
  12728. Specify the time of the first frame that will be dropped, i.e. the frame
  12729. immediately preceding the one with the timestamp @var{end} will be the last
  12730. frame in the output.
  12731. @item start_pts
  12732. This is the same as @var{start}, except this option sets the start timestamp
  12733. in timebase units instead of seconds.
  12734. @item end_pts
  12735. This is the same as @var{end}, except this option sets the end timestamp
  12736. in timebase units instead of seconds.
  12737. @item duration
  12738. The maximum duration of the output in seconds.
  12739. @item start_frame
  12740. The number of the first frame that should be passed to the output.
  12741. @item end_frame
  12742. The number of the first frame that should be dropped.
  12743. @end table
  12744. @option{start}, @option{end}, and @option{duration} are expressed as time
  12745. duration specifications; see
  12746. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12747. for the accepted syntax.
  12748. Note that the first two sets of the start/end options and the @option{duration}
  12749. option look at the frame timestamp, while the _frame variants simply count the
  12750. frames that pass through the filter. Also note that this filter does not modify
  12751. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12752. setpts filter after the trim filter.
  12753. If multiple start or end options are set, this filter tries to be greedy and
  12754. keep all the frames that match at least one of the specified constraints. To keep
  12755. only the part that matches all the constraints at once, chain multiple trim
  12756. filters.
  12757. The defaults are such that all the input is kept. So it is possible to set e.g.
  12758. just the end values to keep everything before the specified time.
  12759. Examples:
  12760. @itemize
  12761. @item
  12762. Drop everything except the second minute of input:
  12763. @example
  12764. ffmpeg -i INPUT -vf trim=60:120
  12765. @end example
  12766. @item
  12767. Keep only the first second:
  12768. @example
  12769. ffmpeg -i INPUT -vf trim=duration=1
  12770. @end example
  12771. @end itemize
  12772. @section unpremultiply
  12773. Apply alpha unpremultiply effect to input video stream using first plane
  12774. of second stream as alpha.
  12775. Both streams must have same dimensions and same pixel format.
  12776. The filter accepts the following option:
  12777. @table @option
  12778. @item planes
  12779. Set which planes will be processed, unprocessed planes will be copied.
  12780. By default value 0xf, all planes will be processed.
  12781. If the format has 1 or 2 components, then luma is bit 0.
  12782. If the format has 3 or 4 components:
  12783. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12784. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12785. If present, the alpha channel is always the last bit.
  12786. @item inplace
  12787. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12788. @end table
  12789. @anchor{unsharp}
  12790. @section unsharp
  12791. Sharpen or blur the input video.
  12792. It accepts the following parameters:
  12793. @table @option
  12794. @item luma_msize_x, lx
  12795. Set the luma matrix horizontal size. It must be an odd integer between
  12796. 3 and 23. The default value is 5.
  12797. @item luma_msize_y, ly
  12798. Set the luma matrix vertical size. It must be an odd integer between 3
  12799. and 23. The default value is 5.
  12800. @item luma_amount, la
  12801. Set the luma effect strength. It must be a floating point number, reasonable
  12802. values lay between -1.5 and 1.5.
  12803. Negative values will blur the input video, while positive values will
  12804. sharpen it, a value of zero will disable the effect.
  12805. Default value is 1.0.
  12806. @item chroma_msize_x, cx
  12807. Set the chroma matrix horizontal size. It must be an odd integer
  12808. between 3 and 23. The default value is 5.
  12809. @item chroma_msize_y, cy
  12810. Set the chroma matrix vertical size. It must be an odd integer
  12811. between 3 and 23. The default value is 5.
  12812. @item chroma_amount, ca
  12813. Set the chroma effect strength. It must be a floating point number, reasonable
  12814. values lay between -1.5 and 1.5.
  12815. Negative values will blur the input video, while positive values will
  12816. sharpen it, a value of zero will disable the effect.
  12817. Default value is 0.0.
  12818. @end table
  12819. All parameters are optional and default to the equivalent of the
  12820. string '5:5:1.0:5:5:0.0'.
  12821. @subsection Examples
  12822. @itemize
  12823. @item
  12824. Apply strong luma sharpen effect:
  12825. @example
  12826. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12827. @end example
  12828. @item
  12829. Apply a strong blur of both luma and chroma parameters:
  12830. @example
  12831. unsharp=7:7:-2:7:7:-2
  12832. @end example
  12833. @end itemize
  12834. @section uspp
  12835. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12836. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12837. shifts and average the results.
  12838. The way this differs from the behavior of spp is that uspp actually encodes &
  12839. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12840. DCT similar to MJPEG.
  12841. The filter accepts the following options:
  12842. @table @option
  12843. @item quality
  12844. Set quality. This option defines the number of levels for averaging. It accepts
  12845. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12846. effect. A value of @code{8} means the higher quality. For each increment of
  12847. that value the speed drops by a factor of approximately 2. Default value is
  12848. @code{3}.
  12849. @item qp
  12850. Force a constant quantization parameter. If not set, the filter will use the QP
  12851. from the video stream (if available).
  12852. @end table
  12853. @section vaguedenoiser
  12854. Apply a wavelet based denoiser.
  12855. It transforms each frame from the video input into the wavelet domain,
  12856. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12857. the obtained coefficients. It does an inverse wavelet transform after.
  12858. Due to wavelet properties, it should give a nice smoothed result, and
  12859. reduced noise, without blurring picture features.
  12860. This filter accepts the following options:
  12861. @table @option
  12862. @item threshold
  12863. The filtering strength. The higher, the more filtered the video will be.
  12864. Hard thresholding can use a higher threshold than soft thresholding
  12865. before the video looks overfiltered. Default value is 2.
  12866. @item method
  12867. The filtering method the filter will use.
  12868. It accepts the following values:
  12869. @table @samp
  12870. @item hard
  12871. All values under the threshold will be zeroed.
  12872. @item soft
  12873. All values under the threshold will be zeroed. All values above will be
  12874. reduced by the threshold.
  12875. @item garrote
  12876. Scales or nullifies coefficients - intermediary between (more) soft and
  12877. (less) hard thresholding.
  12878. @end table
  12879. Default is garrote.
  12880. @item nsteps
  12881. Number of times, the wavelet will decompose the picture. Picture can't
  12882. be decomposed beyond a particular point (typically, 8 for a 640x480
  12883. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12884. @item percent
  12885. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12886. @item planes
  12887. A list of the planes to process. By default all planes are processed.
  12888. @end table
  12889. @section vectorscope
  12890. Display 2 color component values in the two dimensional graph (which is called
  12891. a vectorscope).
  12892. This filter accepts the following options:
  12893. @table @option
  12894. @item mode, m
  12895. Set vectorscope mode.
  12896. It accepts the following values:
  12897. @table @samp
  12898. @item gray
  12899. Gray values are displayed on graph, higher brightness means more pixels have
  12900. same component color value on location in graph. This is the default mode.
  12901. @item color
  12902. Gray values are displayed on graph. Surrounding pixels values which are not
  12903. present in video frame are drawn in gradient of 2 color components which are
  12904. set by option @code{x} and @code{y}. The 3rd color component is static.
  12905. @item color2
  12906. Actual color components values present in video frame are displayed on graph.
  12907. @item color3
  12908. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12909. on graph increases value of another color component, which is luminance by
  12910. default values of @code{x} and @code{y}.
  12911. @item color4
  12912. Actual colors present in video frame are displayed on graph. If two different
  12913. colors map to same position on graph then color with higher value of component
  12914. not present in graph is picked.
  12915. @item color5
  12916. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12917. component picked from radial gradient.
  12918. @end table
  12919. @item x
  12920. Set which color component will be represented on X-axis. Default is @code{1}.
  12921. @item y
  12922. Set which color component will be represented on Y-axis. Default is @code{2}.
  12923. @item intensity, i
  12924. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12925. of color component which represents frequency of (X, Y) location in graph.
  12926. @item envelope, e
  12927. @table @samp
  12928. @item none
  12929. No envelope, this is default.
  12930. @item instant
  12931. Instant envelope, even darkest single pixel will be clearly highlighted.
  12932. @item peak
  12933. Hold maximum and minimum values presented in graph over time. This way you
  12934. can still spot out of range values without constantly looking at vectorscope.
  12935. @item peak+instant
  12936. Peak and instant envelope combined together.
  12937. @end table
  12938. @item graticule, g
  12939. Set what kind of graticule to draw.
  12940. @table @samp
  12941. @item none
  12942. @item green
  12943. @item color
  12944. @end table
  12945. @item opacity, o
  12946. Set graticule opacity.
  12947. @item flags, f
  12948. Set graticule flags.
  12949. @table @samp
  12950. @item white
  12951. Draw graticule for white point.
  12952. @item black
  12953. Draw graticule for black point.
  12954. @item name
  12955. Draw color points short names.
  12956. @end table
  12957. @item bgopacity, b
  12958. Set background opacity.
  12959. @item lthreshold, l
  12960. Set low threshold for color component not represented on X or Y axis.
  12961. Values lower than this value will be ignored. Default is 0.
  12962. Note this value is multiplied with actual max possible value one pixel component
  12963. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12964. is 0.1 * 255 = 25.
  12965. @item hthreshold, h
  12966. Set high threshold for color component not represented on X or Y axis.
  12967. Values higher than this value will be ignored. Default is 1.
  12968. Note this value is multiplied with actual max possible value one pixel component
  12969. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12970. is 0.9 * 255 = 230.
  12971. @item colorspace, c
  12972. Set what kind of colorspace to use when drawing graticule.
  12973. @table @samp
  12974. @item auto
  12975. @item 601
  12976. @item 709
  12977. @end table
  12978. Default is auto.
  12979. @end table
  12980. @anchor{vidstabdetect}
  12981. @section vidstabdetect
  12982. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12983. @ref{vidstabtransform} for pass 2.
  12984. This filter generates a file with relative translation and rotation
  12985. transform information about subsequent frames, which is then used by
  12986. the @ref{vidstabtransform} filter.
  12987. To enable compilation of this filter you need to configure FFmpeg with
  12988. @code{--enable-libvidstab}.
  12989. This filter accepts the following options:
  12990. @table @option
  12991. @item result
  12992. Set the path to the file used to write the transforms information.
  12993. Default value is @file{transforms.trf}.
  12994. @item shakiness
  12995. Set how shaky the video is and how quick the camera is. It accepts an
  12996. integer in the range 1-10, a value of 1 means little shakiness, a
  12997. value of 10 means strong shakiness. Default value is 5.
  12998. @item accuracy
  12999. Set the accuracy of the detection process. It must be a value in the
  13000. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13001. accuracy. Default value is 15.
  13002. @item stepsize
  13003. Set stepsize of the search process. The region around minimum is
  13004. scanned with 1 pixel resolution. Default value is 6.
  13005. @item mincontrast
  13006. Set minimum contrast. Below this value a local measurement field is
  13007. discarded. Must be a floating point value in the range 0-1. Default
  13008. value is 0.3.
  13009. @item tripod
  13010. Set reference frame number for tripod mode.
  13011. If enabled, the motion of the frames is compared to a reference frame
  13012. in the filtered stream, identified by the specified number. The idea
  13013. is to compensate all movements in a more-or-less static scene and keep
  13014. the camera view absolutely still.
  13015. If set to 0, it is disabled. The frames are counted starting from 1.
  13016. @item show
  13017. Show fields and transforms in the resulting frames. It accepts an
  13018. integer in the range 0-2. Default value is 0, which disables any
  13019. visualization.
  13020. @end table
  13021. @subsection Examples
  13022. @itemize
  13023. @item
  13024. Use default values:
  13025. @example
  13026. vidstabdetect
  13027. @end example
  13028. @item
  13029. Analyze strongly shaky movie and put the results in file
  13030. @file{mytransforms.trf}:
  13031. @example
  13032. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13033. @end example
  13034. @item
  13035. Visualize the result of internal transformations in the resulting
  13036. video:
  13037. @example
  13038. vidstabdetect=show=1
  13039. @end example
  13040. @item
  13041. Analyze a video with medium shakiness using @command{ffmpeg}:
  13042. @example
  13043. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13044. @end example
  13045. @end itemize
  13046. @anchor{vidstabtransform}
  13047. @section vidstabtransform
  13048. Video stabilization/deshaking: pass 2 of 2,
  13049. see @ref{vidstabdetect} for pass 1.
  13050. Read a file with transform information for each frame and
  13051. apply/compensate them. Together with the @ref{vidstabdetect}
  13052. filter this can be used to deshake videos. See also
  13053. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13054. the @ref{unsharp} filter, see below.
  13055. To enable compilation of this filter you need to configure FFmpeg with
  13056. @code{--enable-libvidstab}.
  13057. @subsection Options
  13058. @table @option
  13059. @item input
  13060. Set path to the file used to read the transforms. Default value is
  13061. @file{transforms.trf}.
  13062. @item smoothing
  13063. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13064. camera movements. Default value is 10.
  13065. For example a number of 10 means that 21 frames are used (10 in the
  13066. past and 10 in the future) to smoothen the motion in the video. A
  13067. larger value leads to a smoother video, but limits the acceleration of
  13068. the camera (pan/tilt movements). 0 is a special case where a static
  13069. camera is simulated.
  13070. @item optalgo
  13071. Set the camera path optimization algorithm.
  13072. Accepted values are:
  13073. @table @samp
  13074. @item gauss
  13075. gaussian kernel low-pass filter on camera motion (default)
  13076. @item avg
  13077. averaging on transformations
  13078. @end table
  13079. @item maxshift
  13080. Set maximal number of pixels to translate frames. Default value is -1,
  13081. meaning no limit.
  13082. @item maxangle
  13083. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13084. value is -1, meaning no limit.
  13085. @item crop
  13086. Specify how to deal with borders that may be visible due to movement
  13087. compensation.
  13088. Available values are:
  13089. @table @samp
  13090. @item keep
  13091. keep image information from previous frame (default)
  13092. @item black
  13093. fill the border black
  13094. @end table
  13095. @item invert
  13096. Invert transforms if set to 1. Default value is 0.
  13097. @item relative
  13098. Consider transforms as relative to previous frame if set to 1,
  13099. absolute if set to 0. Default value is 0.
  13100. @item zoom
  13101. Set percentage to zoom. A positive value will result in a zoom-in
  13102. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13103. zoom).
  13104. @item optzoom
  13105. Set optimal zooming to avoid borders.
  13106. Accepted values are:
  13107. @table @samp
  13108. @item 0
  13109. disabled
  13110. @item 1
  13111. optimal static zoom value is determined (only very strong movements
  13112. will lead to visible borders) (default)
  13113. @item 2
  13114. optimal adaptive zoom value is determined (no borders will be
  13115. visible), see @option{zoomspeed}
  13116. @end table
  13117. Note that the value given at zoom is added to the one calculated here.
  13118. @item zoomspeed
  13119. Set percent to zoom maximally each frame (enabled when
  13120. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13121. 0.25.
  13122. @item interpol
  13123. Specify type of interpolation.
  13124. Available values are:
  13125. @table @samp
  13126. @item no
  13127. no interpolation
  13128. @item linear
  13129. linear only horizontal
  13130. @item bilinear
  13131. linear in both directions (default)
  13132. @item bicubic
  13133. cubic in both directions (slow)
  13134. @end table
  13135. @item tripod
  13136. Enable virtual tripod mode if set to 1, which is equivalent to
  13137. @code{relative=0:smoothing=0}. Default value is 0.
  13138. Use also @code{tripod} option of @ref{vidstabdetect}.
  13139. @item debug
  13140. Increase log verbosity if set to 1. Also the detected global motions
  13141. are written to the temporary file @file{global_motions.trf}. Default
  13142. value is 0.
  13143. @end table
  13144. @subsection Examples
  13145. @itemize
  13146. @item
  13147. Use @command{ffmpeg} for a typical stabilization with default values:
  13148. @example
  13149. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13150. @end example
  13151. Note the use of the @ref{unsharp} filter which is always recommended.
  13152. @item
  13153. Zoom in a bit more and load transform data from a given file:
  13154. @example
  13155. vidstabtransform=zoom=5:input="mytransforms.trf"
  13156. @end example
  13157. @item
  13158. Smoothen the video even more:
  13159. @example
  13160. vidstabtransform=smoothing=30
  13161. @end example
  13162. @end itemize
  13163. @section vflip
  13164. Flip the input video vertically.
  13165. For example, to vertically flip a video with @command{ffmpeg}:
  13166. @example
  13167. ffmpeg -i in.avi -vf "vflip" out.avi
  13168. @end example
  13169. @section vfrdet
  13170. Detect variable frame rate video.
  13171. This filter tries to detect if the input is variable or constant frame rate.
  13172. At end it will output number of frames detected as having variable delta pts,
  13173. and ones with constant delta pts.
  13174. If there was frames with variable delta, than it will also show min and max delta
  13175. encountered.
  13176. @anchor{vignette}
  13177. @section vignette
  13178. Make or reverse a natural vignetting effect.
  13179. The filter accepts the following options:
  13180. @table @option
  13181. @item angle, a
  13182. Set lens angle expression as a number of radians.
  13183. The value is clipped in the @code{[0,PI/2]} range.
  13184. Default value: @code{"PI/5"}
  13185. @item x0
  13186. @item y0
  13187. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13188. by default.
  13189. @item mode
  13190. Set forward/backward mode.
  13191. Available modes are:
  13192. @table @samp
  13193. @item forward
  13194. The larger the distance from the central point, the darker the image becomes.
  13195. @item backward
  13196. The larger the distance from the central point, the brighter the image becomes.
  13197. This can be used to reverse a vignette effect, though there is no automatic
  13198. detection to extract the lens @option{angle} and other settings (yet). It can
  13199. also be used to create a burning effect.
  13200. @end table
  13201. Default value is @samp{forward}.
  13202. @item eval
  13203. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13204. It accepts the following values:
  13205. @table @samp
  13206. @item init
  13207. Evaluate expressions only once during the filter initialization.
  13208. @item frame
  13209. Evaluate expressions for each incoming frame. This is way slower than the
  13210. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13211. allows advanced dynamic expressions.
  13212. @end table
  13213. Default value is @samp{init}.
  13214. @item dither
  13215. Set dithering to reduce the circular banding effects. Default is @code{1}
  13216. (enabled).
  13217. @item aspect
  13218. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13219. Setting this value to the SAR of the input will make a rectangular vignetting
  13220. following the dimensions of the video.
  13221. Default is @code{1/1}.
  13222. @end table
  13223. @subsection Expressions
  13224. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13225. following parameters.
  13226. @table @option
  13227. @item w
  13228. @item h
  13229. input width and height
  13230. @item n
  13231. the number of input frame, starting from 0
  13232. @item pts
  13233. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13234. @var{TB} units, NAN if undefined
  13235. @item r
  13236. frame rate of the input video, NAN if the input frame rate is unknown
  13237. @item t
  13238. the PTS (Presentation TimeStamp) of the filtered video frame,
  13239. expressed in seconds, NAN if undefined
  13240. @item tb
  13241. time base of the input video
  13242. @end table
  13243. @subsection Examples
  13244. @itemize
  13245. @item
  13246. Apply simple strong vignetting effect:
  13247. @example
  13248. vignette=PI/4
  13249. @end example
  13250. @item
  13251. Make a flickering vignetting:
  13252. @example
  13253. vignette='PI/4+random(1)*PI/50':eval=frame
  13254. @end example
  13255. @end itemize
  13256. @section vmafmotion
  13257. Obtain the average vmaf motion score of a video.
  13258. It is one of the component filters of VMAF.
  13259. The obtained average motion score is printed through the logging system.
  13260. In the below example the input file @file{ref.mpg} is being processed and score
  13261. is computed.
  13262. @example
  13263. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13264. @end example
  13265. @section vstack
  13266. Stack input videos vertically.
  13267. All streams must be of same pixel format and of same width.
  13268. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13269. to create same output.
  13270. The filter accept the following option:
  13271. @table @option
  13272. @item inputs
  13273. Set number of input streams. Default is 2.
  13274. @item shortest
  13275. If set to 1, force the output to terminate when the shortest input
  13276. terminates. Default value is 0.
  13277. @end table
  13278. @section w3fdif
  13279. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13280. Deinterlacing Filter").
  13281. Based on the process described by Martin Weston for BBC R&D, and
  13282. implemented based on the de-interlace algorithm written by Jim
  13283. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13284. uses filter coefficients calculated by BBC R&D.
  13285. There are two sets of filter coefficients, so called "simple":
  13286. and "complex". Which set of filter coefficients is used can
  13287. be set by passing an optional parameter:
  13288. @table @option
  13289. @item filter
  13290. Set the interlacing filter coefficients. Accepts one of the following values:
  13291. @table @samp
  13292. @item simple
  13293. Simple filter coefficient set.
  13294. @item complex
  13295. More-complex filter coefficient set.
  13296. @end table
  13297. Default value is @samp{complex}.
  13298. @item deint
  13299. Specify which frames to deinterlace. Accept one of the following values:
  13300. @table @samp
  13301. @item all
  13302. Deinterlace all frames,
  13303. @item interlaced
  13304. Only deinterlace frames marked as interlaced.
  13305. @end table
  13306. Default value is @samp{all}.
  13307. @end table
  13308. @section waveform
  13309. Video waveform monitor.
  13310. The waveform monitor plots color component intensity. By default luminance
  13311. only. Each column of the waveform corresponds to a column of pixels in the
  13312. source video.
  13313. It accepts the following options:
  13314. @table @option
  13315. @item mode, m
  13316. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13317. In row mode, the graph on the left side represents color component value 0 and
  13318. the right side represents value = 255. In column mode, the top side represents
  13319. color component value = 0 and bottom side represents value = 255.
  13320. @item intensity, i
  13321. Set intensity. Smaller values are useful to find out how many values of the same
  13322. luminance are distributed across input rows/columns.
  13323. Default value is @code{0.04}. Allowed range is [0, 1].
  13324. @item mirror, r
  13325. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13326. In mirrored mode, higher values will be represented on the left
  13327. side for @code{row} mode and at the top for @code{column} mode. Default is
  13328. @code{1} (mirrored).
  13329. @item display, d
  13330. Set display mode.
  13331. It accepts the following values:
  13332. @table @samp
  13333. @item overlay
  13334. Presents information identical to that in the @code{parade}, except
  13335. that the graphs representing color components are superimposed directly
  13336. over one another.
  13337. This display mode makes it easier to spot relative differences or similarities
  13338. in overlapping areas of the color components that are supposed to be identical,
  13339. such as neutral whites, grays, or blacks.
  13340. @item stack
  13341. Display separate graph for the color components side by side in
  13342. @code{row} mode or one below the other in @code{column} mode.
  13343. @item parade
  13344. Display separate graph for the color components side by side in
  13345. @code{column} mode or one below the other in @code{row} mode.
  13346. Using this display mode makes it easy to spot color casts in the highlights
  13347. and shadows of an image, by comparing the contours of the top and the bottom
  13348. graphs of each waveform. Since whites, grays, and blacks are characterized
  13349. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13350. should display three waveforms of roughly equal width/height. If not, the
  13351. correction is easy to perform by making level adjustments the three waveforms.
  13352. @end table
  13353. Default is @code{stack}.
  13354. @item components, c
  13355. Set which color components to display. Default is 1, which means only luminance
  13356. or red color component if input is in RGB colorspace. If is set for example to
  13357. 7 it will display all 3 (if) available color components.
  13358. @item envelope, e
  13359. @table @samp
  13360. @item none
  13361. No envelope, this is default.
  13362. @item instant
  13363. Instant envelope, minimum and maximum values presented in graph will be easily
  13364. visible even with small @code{step} value.
  13365. @item peak
  13366. Hold minimum and maximum values presented in graph across time. This way you
  13367. can still spot out of range values without constantly looking at waveforms.
  13368. @item peak+instant
  13369. Peak and instant envelope combined together.
  13370. @end table
  13371. @item filter, f
  13372. @table @samp
  13373. @item lowpass
  13374. No filtering, this is default.
  13375. @item flat
  13376. Luma and chroma combined together.
  13377. @item aflat
  13378. Similar as above, but shows difference between blue and red chroma.
  13379. @item xflat
  13380. Similar as above, but use different colors.
  13381. @item chroma
  13382. Displays only chroma.
  13383. @item color
  13384. Displays actual color value on waveform.
  13385. @item acolor
  13386. Similar as above, but with luma showing frequency of chroma values.
  13387. @end table
  13388. @item graticule, g
  13389. Set which graticule to display.
  13390. @table @samp
  13391. @item none
  13392. Do not display graticule.
  13393. @item green
  13394. Display green graticule showing legal broadcast ranges.
  13395. @item orange
  13396. Display orange graticule showing legal broadcast ranges.
  13397. @end table
  13398. @item opacity, o
  13399. Set graticule opacity.
  13400. @item flags, fl
  13401. Set graticule flags.
  13402. @table @samp
  13403. @item numbers
  13404. Draw numbers above lines. By default enabled.
  13405. @item dots
  13406. Draw dots instead of lines.
  13407. @end table
  13408. @item scale, s
  13409. Set scale used for displaying graticule.
  13410. @table @samp
  13411. @item digital
  13412. @item millivolts
  13413. @item ire
  13414. @end table
  13415. Default is digital.
  13416. @item bgopacity, b
  13417. Set background opacity.
  13418. @end table
  13419. @section weave, doubleweave
  13420. The @code{weave} takes a field-based video input and join
  13421. each two sequential fields into single frame, producing a new double
  13422. height clip with half the frame rate and half the frame count.
  13423. The @code{doubleweave} works same as @code{weave} but without
  13424. halving frame rate and frame count.
  13425. It accepts the following option:
  13426. @table @option
  13427. @item first_field
  13428. Set first field. Available values are:
  13429. @table @samp
  13430. @item top, t
  13431. Set the frame as top-field-first.
  13432. @item bottom, b
  13433. Set the frame as bottom-field-first.
  13434. @end table
  13435. @end table
  13436. @subsection Examples
  13437. @itemize
  13438. @item
  13439. Interlace video using @ref{select} and @ref{separatefields} filter:
  13440. @example
  13441. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13442. @end example
  13443. @end itemize
  13444. @section xbr
  13445. Apply the xBR high-quality magnification filter which is designed for pixel
  13446. art. It follows a set of edge-detection rules, see
  13447. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13448. It accepts the following option:
  13449. @table @option
  13450. @item n
  13451. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13452. @code{3xBR} and @code{4} for @code{4xBR}.
  13453. Default is @code{3}.
  13454. @end table
  13455. @anchor{yadif}
  13456. @section yadif
  13457. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13458. filter").
  13459. It accepts the following parameters:
  13460. @table @option
  13461. @item mode
  13462. The interlacing mode to adopt. It accepts one of the following values:
  13463. @table @option
  13464. @item 0, send_frame
  13465. Output one frame for each frame.
  13466. @item 1, send_field
  13467. Output one frame for each field.
  13468. @item 2, send_frame_nospatial
  13469. Like @code{send_frame}, but it skips the spatial interlacing check.
  13470. @item 3, send_field_nospatial
  13471. Like @code{send_field}, but it skips the spatial interlacing check.
  13472. @end table
  13473. The default value is @code{send_frame}.
  13474. @item parity
  13475. The picture field parity assumed for the input interlaced video. It accepts one
  13476. of the following values:
  13477. @table @option
  13478. @item 0, tff
  13479. Assume the top field is first.
  13480. @item 1, bff
  13481. Assume the bottom field is first.
  13482. @item -1, auto
  13483. Enable automatic detection of field parity.
  13484. @end table
  13485. The default value is @code{auto}.
  13486. If the interlacing is unknown or the decoder does not export this information,
  13487. top field first will be assumed.
  13488. @item deint
  13489. Specify which frames to deinterlace. Accept one of the following
  13490. values:
  13491. @table @option
  13492. @item 0, all
  13493. Deinterlace all frames.
  13494. @item 1, interlaced
  13495. Only deinterlace frames marked as interlaced.
  13496. @end table
  13497. The default value is @code{all}.
  13498. @end table
  13499. @section zoompan
  13500. Apply Zoom & Pan effect.
  13501. This filter accepts the following options:
  13502. @table @option
  13503. @item zoom, z
  13504. Set the zoom expression. Default is 1.
  13505. @item x
  13506. @item y
  13507. Set the x and y expression. Default is 0.
  13508. @item d
  13509. Set the duration expression in number of frames.
  13510. This sets for how many number of frames effect will last for
  13511. single input image.
  13512. @item s
  13513. Set the output image size, default is 'hd720'.
  13514. @item fps
  13515. Set the output frame rate, default is '25'.
  13516. @end table
  13517. Each expression can contain the following constants:
  13518. @table @option
  13519. @item in_w, iw
  13520. Input width.
  13521. @item in_h, ih
  13522. Input height.
  13523. @item out_w, ow
  13524. Output width.
  13525. @item out_h, oh
  13526. Output height.
  13527. @item in
  13528. Input frame count.
  13529. @item on
  13530. Output frame count.
  13531. @item x
  13532. @item y
  13533. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13534. for current input frame.
  13535. @item px
  13536. @item py
  13537. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13538. not yet such frame (first input frame).
  13539. @item zoom
  13540. Last calculated zoom from 'z' expression for current input frame.
  13541. @item pzoom
  13542. Last calculated zoom of last output frame of previous input frame.
  13543. @item duration
  13544. Number of output frames for current input frame. Calculated from 'd' expression
  13545. for each input frame.
  13546. @item pduration
  13547. number of output frames created for previous input frame
  13548. @item a
  13549. Rational number: input width / input height
  13550. @item sar
  13551. sample aspect ratio
  13552. @item dar
  13553. display aspect ratio
  13554. @end table
  13555. @subsection Examples
  13556. @itemize
  13557. @item
  13558. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13559. @example
  13560. 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
  13561. @end example
  13562. @item
  13563. Zoom-in up to 1.5 and pan always at center of picture:
  13564. @example
  13565. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13566. @end example
  13567. @item
  13568. Same as above but without pausing:
  13569. @example
  13570. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13571. @end example
  13572. @end itemize
  13573. @anchor{zscale}
  13574. @section zscale
  13575. Scale (resize) the input video, using the z.lib library:
  13576. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13577. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13578. The zscale filter forces the output display aspect ratio to be the same
  13579. as the input, by changing the output sample aspect ratio.
  13580. If the input image format is different from the format requested by
  13581. the next filter, the zscale filter will convert the input to the
  13582. requested format.
  13583. @subsection Options
  13584. The filter accepts the following options.
  13585. @table @option
  13586. @item width, w
  13587. @item height, h
  13588. Set the output video dimension expression. Default value is the input
  13589. dimension.
  13590. If the @var{width} or @var{w} value is 0, the input width is used for
  13591. the output. If the @var{height} or @var{h} value is 0, the input height
  13592. is used for the output.
  13593. If one and only one of the values is -n with n >= 1, the zscale filter
  13594. will use a value that maintains the aspect ratio of the input image,
  13595. calculated from the other specified dimension. After that it will,
  13596. however, make sure that the calculated dimension is divisible by n and
  13597. adjust the value if necessary.
  13598. If both values are -n with n >= 1, the behavior will be identical to
  13599. both values being set to 0 as previously detailed.
  13600. See below for the list of accepted constants for use in the dimension
  13601. expression.
  13602. @item size, s
  13603. Set the video size. For the syntax of this option, check the
  13604. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13605. @item dither, d
  13606. Set the dither type.
  13607. Possible values are:
  13608. @table @var
  13609. @item none
  13610. @item ordered
  13611. @item random
  13612. @item error_diffusion
  13613. @end table
  13614. Default is none.
  13615. @item filter, f
  13616. Set the resize filter type.
  13617. Possible values are:
  13618. @table @var
  13619. @item point
  13620. @item bilinear
  13621. @item bicubic
  13622. @item spline16
  13623. @item spline36
  13624. @item lanczos
  13625. @end table
  13626. Default is bilinear.
  13627. @item range, r
  13628. Set the color range.
  13629. Possible values are:
  13630. @table @var
  13631. @item input
  13632. @item limited
  13633. @item full
  13634. @end table
  13635. Default is same as input.
  13636. @item primaries, p
  13637. Set the color primaries.
  13638. Possible values are:
  13639. @table @var
  13640. @item input
  13641. @item 709
  13642. @item unspecified
  13643. @item 170m
  13644. @item 240m
  13645. @item 2020
  13646. @end table
  13647. Default is same as input.
  13648. @item transfer, t
  13649. Set the transfer characteristics.
  13650. Possible values are:
  13651. @table @var
  13652. @item input
  13653. @item 709
  13654. @item unspecified
  13655. @item 601
  13656. @item linear
  13657. @item 2020_10
  13658. @item 2020_12
  13659. @item smpte2084
  13660. @item iec61966-2-1
  13661. @item arib-std-b67
  13662. @end table
  13663. Default is same as input.
  13664. @item matrix, m
  13665. Set the colorspace matrix.
  13666. Possible value are:
  13667. @table @var
  13668. @item input
  13669. @item 709
  13670. @item unspecified
  13671. @item 470bg
  13672. @item 170m
  13673. @item 2020_ncl
  13674. @item 2020_cl
  13675. @end table
  13676. Default is same as input.
  13677. @item rangein, rin
  13678. Set the input color range.
  13679. Possible values are:
  13680. @table @var
  13681. @item input
  13682. @item limited
  13683. @item full
  13684. @end table
  13685. Default is same as input.
  13686. @item primariesin, pin
  13687. Set the input color primaries.
  13688. Possible values are:
  13689. @table @var
  13690. @item input
  13691. @item 709
  13692. @item unspecified
  13693. @item 170m
  13694. @item 240m
  13695. @item 2020
  13696. @end table
  13697. Default is same as input.
  13698. @item transferin, tin
  13699. Set the input transfer characteristics.
  13700. Possible values are:
  13701. @table @var
  13702. @item input
  13703. @item 709
  13704. @item unspecified
  13705. @item 601
  13706. @item linear
  13707. @item 2020_10
  13708. @item 2020_12
  13709. @end table
  13710. Default is same as input.
  13711. @item matrixin, min
  13712. Set the input colorspace matrix.
  13713. Possible value are:
  13714. @table @var
  13715. @item input
  13716. @item 709
  13717. @item unspecified
  13718. @item 470bg
  13719. @item 170m
  13720. @item 2020_ncl
  13721. @item 2020_cl
  13722. @end table
  13723. @item chromal, c
  13724. Set the output chroma location.
  13725. Possible values are:
  13726. @table @var
  13727. @item input
  13728. @item left
  13729. @item center
  13730. @item topleft
  13731. @item top
  13732. @item bottomleft
  13733. @item bottom
  13734. @end table
  13735. @item chromalin, cin
  13736. Set the input chroma location.
  13737. Possible values are:
  13738. @table @var
  13739. @item input
  13740. @item left
  13741. @item center
  13742. @item topleft
  13743. @item top
  13744. @item bottomleft
  13745. @item bottom
  13746. @end table
  13747. @item npl
  13748. Set the nominal peak luminance.
  13749. @end table
  13750. The values of the @option{w} and @option{h} options are expressions
  13751. containing the following constants:
  13752. @table @var
  13753. @item in_w
  13754. @item in_h
  13755. The input width and height
  13756. @item iw
  13757. @item ih
  13758. These are the same as @var{in_w} and @var{in_h}.
  13759. @item out_w
  13760. @item out_h
  13761. The output (scaled) width and height
  13762. @item ow
  13763. @item oh
  13764. These are the same as @var{out_w} and @var{out_h}
  13765. @item a
  13766. The same as @var{iw} / @var{ih}
  13767. @item sar
  13768. input sample aspect ratio
  13769. @item dar
  13770. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13771. @item hsub
  13772. @item vsub
  13773. horizontal and vertical input chroma subsample values. For example for the
  13774. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13775. @item ohsub
  13776. @item ovsub
  13777. horizontal and vertical output chroma subsample values. For example for the
  13778. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13779. @end table
  13780. @table @option
  13781. @end table
  13782. @c man end VIDEO FILTERS
  13783. @chapter Video Sources
  13784. @c man begin VIDEO SOURCES
  13785. Below is a description of the currently available video sources.
  13786. @section buffer
  13787. Buffer video frames, and make them available to the filter chain.
  13788. This source is mainly intended for a programmatic use, in particular
  13789. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13790. It accepts the following parameters:
  13791. @table @option
  13792. @item video_size
  13793. Specify the size (width and height) of the buffered video frames. For the
  13794. syntax of this option, check the
  13795. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13796. @item width
  13797. The input video width.
  13798. @item height
  13799. The input video height.
  13800. @item pix_fmt
  13801. A string representing the pixel format of the buffered video frames.
  13802. It may be a number corresponding to a pixel format, or a pixel format
  13803. name.
  13804. @item time_base
  13805. Specify the timebase assumed by the timestamps of the buffered frames.
  13806. @item frame_rate
  13807. Specify the frame rate expected for the video stream.
  13808. @item pixel_aspect, sar
  13809. The sample (pixel) aspect ratio of the input video.
  13810. @item sws_param
  13811. Specify the optional parameters to be used for the scale filter which
  13812. is automatically inserted when an input change is detected in the
  13813. input size or format.
  13814. @item hw_frames_ctx
  13815. When using a hardware pixel format, this should be a reference to an
  13816. AVHWFramesContext describing input frames.
  13817. @end table
  13818. For example:
  13819. @example
  13820. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13821. @end example
  13822. will instruct the source to accept video frames with size 320x240 and
  13823. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13824. square pixels (1:1 sample aspect ratio).
  13825. Since the pixel format with name "yuv410p" corresponds to the number 6
  13826. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13827. this example corresponds to:
  13828. @example
  13829. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13830. @end example
  13831. Alternatively, the options can be specified as a flat string, but this
  13832. syntax is deprecated:
  13833. @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}]
  13834. @section cellauto
  13835. Create a pattern generated by an elementary cellular automaton.
  13836. The initial state of the cellular automaton can be defined through the
  13837. @option{filename} and @option{pattern} options. If such options are
  13838. not specified an initial state is created randomly.
  13839. At each new frame a new row in the video is filled with the result of
  13840. the cellular automaton next generation. The behavior when the whole
  13841. frame is filled is defined by the @option{scroll} option.
  13842. This source accepts the following options:
  13843. @table @option
  13844. @item filename, f
  13845. Read the initial cellular automaton state, i.e. the starting row, from
  13846. the specified file.
  13847. In the file, each non-whitespace character is considered an alive
  13848. cell, a newline will terminate the row, and further characters in the
  13849. file will be ignored.
  13850. @item pattern, p
  13851. Read the initial cellular automaton state, i.e. the starting row, from
  13852. the specified string.
  13853. Each non-whitespace character in the string is considered an alive
  13854. cell, a newline will terminate the row, and further characters in the
  13855. string will be ignored.
  13856. @item rate, r
  13857. Set the video rate, that is the number of frames generated per second.
  13858. Default is 25.
  13859. @item random_fill_ratio, ratio
  13860. Set the random fill ratio for the initial cellular automaton row. It
  13861. is a floating point number value ranging from 0 to 1, defaults to
  13862. 1/PHI.
  13863. This option is ignored when a file or a pattern is specified.
  13864. @item random_seed, seed
  13865. Set the seed for filling randomly the initial row, must be an integer
  13866. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13867. set to -1, the filter will try to use a good random seed on a best
  13868. effort basis.
  13869. @item rule
  13870. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13871. Default value is 110.
  13872. @item size, s
  13873. Set the size of the output video. For the syntax of this option, check the
  13874. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13875. If @option{filename} or @option{pattern} is specified, the size is set
  13876. by default to the width of the specified initial state row, and the
  13877. height is set to @var{width} * PHI.
  13878. If @option{size} is set, it must contain the width of the specified
  13879. pattern string, and the specified pattern will be centered in the
  13880. larger row.
  13881. If a filename or a pattern string is not specified, the size value
  13882. defaults to "320x518" (used for a randomly generated initial state).
  13883. @item scroll
  13884. If set to 1, scroll the output upward when all the rows in the output
  13885. have been already filled. If set to 0, the new generated row will be
  13886. written over the top row just after the bottom row is filled.
  13887. Defaults to 1.
  13888. @item start_full, full
  13889. If set to 1, completely fill the output with generated rows before
  13890. outputting the first frame.
  13891. This is the default behavior, for disabling set the value to 0.
  13892. @item stitch
  13893. If set to 1, stitch the left and right row edges together.
  13894. This is the default behavior, for disabling set the value to 0.
  13895. @end table
  13896. @subsection Examples
  13897. @itemize
  13898. @item
  13899. Read the initial state from @file{pattern}, and specify an output of
  13900. size 200x400.
  13901. @example
  13902. cellauto=f=pattern:s=200x400
  13903. @end example
  13904. @item
  13905. Generate a random initial row with a width of 200 cells, with a fill
  13906. ratio of 2/3:
  13907. @example
  13908. cellauto=ratio=2/3:s=200x200
  13909. @end example
  13910. @item
  13911. Create a pattern generated by rule 18 starting by a single alive cell
  13912. centered on an initial row with width 100:
  13913. @example
  13914. cellauto=p=@@:s=100x400:full=0:rule=18
  13915. @end example
  13916. @item
  13917. Specify a more elaborated initial pattern:
  13918. @example
  13919. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13920. @end example
  13921. @end itemize
  13922. @anchor{coreimagesrc}
  13923. @section coreimagesrc
  13924. Video source generated on GPU using Apple's CoreImage API on OSX.
  13925. This video source is a specialized version of the @ref{coreimage} video filter.
  13926. Use a core image generator at the beginning of the applied filterchain to
  13927. generate the content.
  13928. The coreimagesrc video source accepts the following options:
  13929. @table @option
  13930. @item list_generators
  13931. List all available generators along with all their respective options as well as
  13932. possible minimum and maximum values along with the default values.
  13933. @example
  13934. list_generators=true
  13935. @end example
  13936. @item size, s
  13937. Specify the size of the sourced video. For the syntax of this option, check the
  13938. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13939. The default value is @code{320x240}.
  13940. @item rate, r
  13941. Specify the frame rate of the sourced video, as the number of frames
  13942. generated per second. It has to be a string in the format
  13943. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13944. number or a valid video frame rate abbreviation. The default value is
  13945. "25".
  13946. @item sar
  13947. Set the sample aspect ratio of the sourced video.
  13948. @item duration, d
  13949. Set the duration of the sourced video. See
  13950. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13951. for the accepted syntax.
  13952. If not specified, or the expressed duration is negative, the video is
  13953. supposed to be generated forever.
  13954. @end table
  13955. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13956. A complete filterchain can be used for further processing of the
  13957. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13958. and examples for details.
  13959. @subsection Examples
  13960. @itemize
  13961. @item
  13962. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13963. given as complete and escaped command-line for Apple's standard bash shell:
  13964. @example
  13965. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13966. @end example
  13967. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13968. need for a nullsrc video source.
  13969. @end itemize
  13970. @section mandelbrot
  13971. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13972. point specified with @var{start_x} and @var{start_y}.
  13973. This source accepts the following options:
  13974. @table @option
  13975. @item end_pts
  13976. Set the terminal pts value. Default value is 400.
  13977. @item end_scale
  13978. Set the terminal scale value.
  13979. Must be a floating point value. Default value is 0.3.
  13980. @item inner
  13981. Set the inner coloring mode, that is the algorithm used to draw the
  13982. Mandelbrot fractal internal region.
  13983. It shall assume one of the following values:
  13984. @table @option
  13985. @item black
  13986. Set black mode.
  13987. @item convergence
  13988. Show time until convergence.
  13989. @item mincol
  13990. Set color based on point closest to the origin of the iterations.
  13991. @item period
  13992. Set period mode.
  13993. @end table
  13994. Default value is @var{mincol}.
  13995. @item bailout
  13996. Set the bailout value. Default value is 10.0.
  13997. @item maxiter
  13998. Set the maximum of iterations performed by the rendering
  13999. algorithm. Default value is 7189.
  14000. @item outer
  14001. Set outer coloring mode.
  14002. It shall assume one of following values:
  14003. @table @option
  14004. @item iteration_count
  14005. Set iteration cound mode.
  14006. @item normalized_iteration_count
  14007. set normalized iteration count mode.
  14008. @end table
  14009. Default value is @var{normalized_iteration_count}.
  14010. @item rate, r
  14011. Set frame rate, expressed as number of frames per second. Default
  14012. value is "25".
  14013. @item size, s
  14014. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14015. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14016. @item start_scale
  14017. Set the initial scale value. Default value is 3.0.
  14018. @item start_x
  14019. Set the initial x position. Must be a floating point value between
  14020. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14021. @item start_y
  14022. Set the initial y position. Must be a floating point value between
  14023. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14024. @end table
  14025. @section mptestsrc
  14026. Generate various test patterns, as generated by the MPlayer test filter.
  14027. The size of the generated video is fixed, and is 256x256.
  14028. This source is useful in particular for testing encoding features.
  14029. This source accepts the following options:
  14030. @table @option
  14031. @item rate, r
  14032. Specify the frame rate of the sourced video, as the number of frames
  14033. generated per second. It has to be a string in the format
  14034. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14035. number or a valid video frame rate abbreviation. The default value is
  14036. "25".
  14037. @item duration, d
  14038. Set the duration of the sourced video. See
  14039. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14040. for the accepted syntax.
  14041. If not specified, or the expressed duration is negative, the video is
  14042. supposed to be generated forever.
  14043. @item test, t
  14044. Set the number or the name of the test to perform. Supported tests are:
  14045. @table @option
  14046. @item dc_luma
  14047. @item dc_chroma
  14048. @item freq_luma
  14049. @item freq_chroma
  14050. @item amp_luma
  14051. @item amp_chroma
  14052. @item cbp
  14053. @item mv
  14054. @item ring1
  14055. @item ring2
  14056. @item all
  14057. @end table
  14058. Default value is "all", which will cycle through the list of all tests.
  14059. @end table
  14060. Some examples:
  14061. @example
  14062. mptestsrc=t=dc_luma
  14063. @end example
  14064. will generate a "dc_luma" test pattern.
  14065. @section frei0r_src
  14066. Provide a frei0r source.
  14067. To enable compilation of this filter you need to install the frei0r
  14068. header and configure FFmpeg with @code{--enable-frei0r}.
  14069. This source accepts the following parameters:
  14070. @table @option
  14071. @item size
  14072. The size of the video to generate. For the syntax of this option, check the
  14073. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14074. @item framerate
  14075. The framerate of the generated video. It may be a string of the form
  14076. @var{num}/@var{den} or a frame rate abbreviation.
  14077. @item filter_name
  14078. The name to the frei0r source to load. For more information regarding frei0r and
  14079. how to set the parameters, read the @ref{frei0r} section in the video filters
  14080. documentation.
  14081. @item filter_params
  14082. A '|'-separated list of parameters to pass to the frei0r source.
  14083. @end table
  14084. For example, to generate a frei0r partik0l source with size 200x200
  14085. and frame rate 10 which is overlaid on the overlay filter main input:
  14086. @example
  14087. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14088. @end example
  14089. @section life
  14090. Generate a life pattern.
  14091. This source is based on a generalization of John Conway's life game.
  14092. The sourced input represents a life grid, each pixel represents a cell
  14093. which can be in one of two possible states, alive or dead. Every cell
  14094. interacts with its eight neighbours, which are the cells that are
  14095. horizontally, vertically, or diagonally adjacent.
  14096. At each interaction the grid evolves according to the adopted rule,
  14097. which specifies the number of neighbor alive cells which will make a
  14098. cell stay alive or born. The @option{rule} option allows one to specify
  14099. the rule to adopt.
  14100. This source accepts the following options:
  14101. @table @option
  14102. @item filename, f
  14103. Set the file from which to read the initial grid state. In the file,
  14104. each non-whitespace character is considered an alive cell, and newline
  14105. is used to delimit the end of each row.
  14106. If this option is not specified, the initial grid is generated
  14107. randomly.
  14108. @item rate, r
  14109. Set the video rate, that is the number of frames generated per second.
  14110. Default is 25.
  14111. @item random_fill_ratio, ratio
  14112. Set the random fill ratio for the initial random grid. It is a
  14113. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  14114. It is ignored when a file is specified.
  14115. @item random_seed, seed
  14116. Set the seed for filling the initial random grid, must be an integer
  14117. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14118. set to -1, the filter will try to use a good random seed on a best
  14119. effort basis.
  14120. @item rule
  14121. Set the life rule.
  14122. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  14123. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  14124. @var{NS} specifies the number of alive neighbor cells which make a
  14125. live cell stay alive, and @var{NB} the number of alive neighbor cells
  14126. which make a dead cell to become alive (i.e. to "born").
  14127. "s" and "b" can be used in place of "S" and "B", respectively.
  14128. Alternatively a rule can be specified by an 18-bits integer. The 9
  14129. high order bits are used to encode the next cell state if it is alive
  14130. for each number of neighbor alive cells, the low order bits specify
  14131. the rule for "borning" new cells. Higher order bits encode for an
  14132. higher number of neighbor cells.
  14133. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  14134. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  14135. Default value is "S23/B3", which is the original Conway's game of life
  14136. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  14137. cells, and will born a new cell if there are three alive cells around
  14138. a dead cell.
  14139. @item size, s
  14140. Set the size of the output video. For the syntax of this option, check the
  14141. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14142. If @option{filename} is specified, the size is set by default to the
  14143. same size of the input file. If @option{size} is set, it must contain
  14144. the size specified in the input file, and the initial grid defined in
  14145. that file is centered in the larger resulting area.
  14146. If a filename is not specified, the size value defaults to "320x240"
  14147. (used for a randomly generated initial grid).
  14148. @item stitch
  14149. If set to 1, stitch the left and right grid edges together, and the
  14150. top and bottom edges also. Defaults to 1.
  14151. @item mold
  14152. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  14153. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  14154. value from 0 to 255.
  14155. @item life_color
  14156. Set the color of living (or new born) cells.
  14157. @item death_color
  14158. Set the color of dead cells. If @option{mold} is set, this is the first color
  14159. used to represent a dead cell.
  14160. @item mold_color
  14161. Set mold color, for definitely dead and moldy cells.
  14162. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  14163. ffmpeg-utils manual,ffmpeg-utils}.
  14164. @end table
  14165. @subsection Examples
  14166. @itemize
  14167. @item
  14168. Read a grid from @file{pattern}, and center it on a grid of size
  14169. 300x300 pixels:
  14170. @example
  14171. life=f=pattern:s=300x300
  14172. @end example
  14173. @item
  14174. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  14175. @example
  14176. life=ratio=2/3:s=200x200
  14177. @end example
  14178. @item
  14179. Specify a custom rule for evolving a randomly generated grid:
  14180. @example
  14181. life=rule=S14/B34
  14182. @end example
  14183. @item
  14184. Full example with slow death effect (mold) using @command{ffplay}:
  14185. @example
  14186. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  14187. @end example
  14188. @end itemize
  14189. @anchor{allrgb}
  14190. @anchor{allyuv}
  14191. @anchor{color}
  14192. @anchor{haldclutsrc}
  14193. @anchor{nullsrc}
  14194. @anchor{pal75bars}
  14195. @anchor{pal100bars}
  14196. @anchor{rgbtestsrc}
  14197. @anchor{smptebars}
  14198. @anchor{smptehdbars}
  14199. @anchor{testsrc}
  14200. @anchor{testsrc2}
  14201. @anchor{yuvtestsrc}
  14202. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  14203. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  14204. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  14205. The @code{color} source provides an uniformly colored input.
  14206. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  14207. @ref{haldclut} filter.
  14208. The @code{nullsrc} source returns unprocessed video frames. It is
  14209. mainly useful to be employed in analysis / debugging tools, or as the
  14210. source for filters which ignore the input data.
  14211. The @code{pal75bars} source generates a color bars pattern, based on
  14212. EBU PAL recommendations with 75% color levels.
  14213. The @code{pal100bars} source generates a color bars pattern, based on
  14214. EBU PAL recommendations with 100% color levels.
  14215. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  14216. detecting RGB vs BGR issues. You should see a red, green and blue
  14217. stripe from top to bottom.
  14218. The @code{smptebars} source generates a color bars pattern, based on
  14219. the SMPTE Engineering Guideline EG 1-1990.
  14220. The @code{smptehdbars} source generates a color bars pattern, based on
  14221. the SMPTE RP 219-2002.
  14222. The @code{testsrc} source generates a test video pattern, showing a
  14223. color pattern, a scrolling gradient and a timestamp. This is mainly
  14224. intended for testing purposes.
  14225. The @code{testsrc2} source is similar to testsrc, but supports more
  14226. pixel formats instead of just @code{rgb24}. This allows using it as an
  14227. input for other tests without requiring a format conversion.
  14228. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  14229. see a y, cb and cr stripe from top to bottom.
  14230. The sources accept the following parameters:
  14231. @table @option
  14232. @item level
  14233. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  14234. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  14235. pixels to be used as identity matrix for 3D lookup tables. Each component is
  14236. coded on a @code{1/(N*N)} scale.
  14237. @item color, c
  14238. Specify the color of the source, only available in the @code{color}
  14239. source. For the syntax of this option, check the
  14240. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14241. @item size, s
  14242. Specify the size of the sourced video. For the syntax of this option, check the
  14243. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14244. The default value is @code{320x240}.
  14245. This option is not available with the @code{allrgb}, @code{allyuv}, and
  14246. @code{haldclutsrc} filters.
  14247. @item rate, r
  14248. Specify the frame rate of the sourced video, as the number of frames
  14249. generated per second. It has to be a string in the format
  14250. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14251. number or a valid video frame rate abbreviation. The default value is
  14252. "25".
  14253. @item duration, d
  14254. Set the duration of the sourced video. See
  14255. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14256. for the accepted syntax.
  14257. If not specified, or the expressed duration is negative, the video is
  14258. supposed to be generated forever.
  14259. @item sar
  14260. Set the sample aspect ratio of the sourced video.
  14261. @item alpha
  14262. Specify the alpha (opacity) of the background, only available in the
  14263. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  14264. 255 (fully opaque, the default).
  14265. @item decimals, n
  14266. Set the number of decimals to show in the timestamp, only available in the
  14267. @code{testsrc} source.
  14268. The displayed timestamp value will correspond to the original
  14269. timestamp value multiplied by the power of 10 of the specified
  14270. value. Default value is 0.
  14271. @end table
  14272. @subsection Examples
  14273. @itemize
  14274. @item
  14275. Generate a video with a duration of 5.3 seconds, with size
  14276. 176x144 and a frame rate of 10 frames per second:
  14277. @example
  14278. testsrc=duration=5.3:size=qcif:rate=10
  14279. @end example
  14280. @item
  14281. The following graph description will generate a red source
  14282. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  14283. frames per second:
  14284. @example
  14285. color=c=red@@0.2:s=qcif:r=10
  14286. @end example
  14287. @item
  14288. If the input content is to be ignored, @code{nullsrc} can be used. The
  14289. following command generates noise in the luminance plane by employing
  14290. the @code{geq} filter:
  14291. @example
  14292. nullsrc=s=256x256, geq=random(1)*255:128:128
  14293. @end example
  14294. @end itemize
  14295. @subsection Commands
  14296. The @code{color} source supports the following commands:
  14297. @table @option
  14298. @item c, color
  14299. Set the color of the created image. Accepts the same syntax of the
  14300. corresponding @option{color} option.
  14301. @end table
  14302. @section openclsrc
  14303. Generate video using an OpenCL program.
  14304. @table @option
  14305. @item source
  14306. OpenCL program source file.
  14307. @item kernel
  14308. Kernel name in program.
  14309. @item size, s
  14310. Size of frames to generate. This must be set.
  14311. @item format
  14312. Pixel format to use for the generated frames. This must be set.
  14313. @item rate, r
  14314. Number of frames generated every second. Default value is '25'.
  14315. @end table
  14316. For details of how the program loading works, see the @ref{program_opencl}
  14317. filter.
  14318. Example programs:
  14319. @itemize
  14320. @item
  14321. Generate a colour ramp by setting pixel values from the position of the pixel
  14322. in the output image. (Note that this will work with all pixel formats, but
  14323. the generated output will not be the same.)
  14324. @verbatim
  14325. __kernel void ramp(__write_only image2d_t dst,
  14326. unsigned int index)
  14327. {
  14328. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14329. float4 val;
  14330. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  14331. write_imagef(dst, loc, val);
  14332. }
  14333. @end verbatim
  14334. @item
  14335. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  14336. @verbatim
  14337. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  14338. unsigned int index)
  14339. {
  14340. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14341. float4 value = 0.0f;
  14342. int x = loc.x + index;
  14343. int y = loc.y + index;
  14344. while (x > 0 || y > 0) {
  14345. if (x % 3 == 1 && y % 3 == 1) {
  14346. value = 1.0f;
  14347. break;
  14348. }
  14349. x /= 3;
  14350. y /= 3;
  14351. }
  14352. write_imagef(dst, loc, value);
  14353. }
  14354. @end verbatim
  14355. @end itemize
  14356. @c man end VIDEO SOURCES
  14357. @chapter Video Sinks
  14358. @c man begin VIDEO SINKS
  14359. Below is a description of the currently available video sinks.
  14360. @section buffersink
  14361. Buffer video frames, and make them available to the end of the filter
  14362. graph.
  14363. This sink is mainly intended for programmatic use, in particular
  14364. through the interface defined in @file{libavfilter/buffersink.h}
  14365. or the options system.
  14366. It accepts a pointer to an AVBufferSinkContext structure, which
  14367. defines the incoming buffers' formats, to be passed as the opaque
  14368. parameter to @code{avfilter_init_filter} for initialization.
  14369. @section nullsink
  14370. Null video sink: do absolutely nothing with the input video. It is
  14371. mainly useful as a template and for use in analysis / debugging
  14372. tools.
  14373. @c man end VIDEO SINKS
  14374. @chapter Multimedia Filters
  14375. @c man begin MULTIMEDIA FILTERS
  14376. Below is a description of the currently available multimedia filters.
  14377. @section abitscope
  14378. Convert input audio to a video output, displaying the audio bit scope.
  14379. The filter accepts the following options:
  14380. @table @option
  14381. @item rate, r
  14382. Set frame rate, expressed as number of frames per second. Default
  14383. value is "25".
  14384. @item size, s
  14385. Specify the video size for the output. For the syntax of this option, check the
  14386. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14387. Default value is @code{1024x256}.
  14388. @item colors
  14389. Specify list of colors separated by space or by '|' which will be used to
  14390. draw channels. Unrecognized or missing colors will be replaced
  14391. by white color.
  14392. @end table
  14393. @section ahistogram
  14394. Convert input audio to a video output, displaying the volume histogram.
  14395. The filter accepts the following options:
  14396. @table @option
  14397. @item dmode
  14398. Specify how histogram is calculated.
  14399. It accepts the following values:
  14400. @table @samp
  14401. @item single
  14402. Use single histogram for all channels.
  14403. @item separate
  14404. Use separate histogram for each channel.
  14405. @end table
  14406. Default is @code{single}.
  14407. @item rate, r
  14408. Set frame rate, expressed as number of frames per second. Default
  14409. value is "25".
  14410. @item size, s
  14411. Specify the video size for the output. For the syntax of this option, check the
  14412. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14413. Default value is @code{hd720}.
  14414. @item scale
  14415. Set display scale.
  14416. It accepts the following values:
  14417. @table @samp
  14418. @item log
  14419. logarithmic
  14420. @item sqrt
  14421. square root
  14422. @item cbrt
  14423. cubic root
  14424. @item lin
  14425. linear
  14426. @item rlog
  14427. reverse logarithmic
  14428. @end table
  14429. Default is @code{log}.
  14430. @item ascale
  14431. Set amplitude scale.
  14432. It accepts the following values:
  14433. @table @samp
  14434. @item log
  14435. logarithmic
  14436. @item lin
  14437. linear
  14438. @end table
  14439. Default is @code{log}.
  14440. @item acount
  14441. Set how much frames to accumulate in histogram.
  14442. Defauls is 1. Setting this to -1 accumulates all frames.
  14443. @item rheight
  14444. Set histogram ratio of window height.
  14445. @item slide
  14446. Set sonogram sliding.
  14447. It accepts the following values:
  14448. @table @samp
  14449. @item replace
  14450. replace old rows with new ones.
  14451. @item scroll
  14452. scroll from top to bottom.
  14453. @end table
  14454. Default is @code{replace}.
  14455. @end table
  14456. @section aphasemeter
  14457. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  14458. representing mean phase of current audio frame. A video output can also be produced and is
  14459. enabled by default. The audio is passed through as first output.
  14460. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  14461. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  14462. and @code{1} means channels are in phase.
  14463. The filter accepts the following options, all related to its video output:
  14464. @table @option
  14465. @item rate, r
  14466. Set the output frame rate. Default value is @code{25}.
  14467. @item size, s
  14468. Set the video size for the output. For the syntax of this option, check the
  14469. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14470. Default value is @code{800x400}.
  14471. @item rc
  14472. @item gc
  14473. @item bc
  14474. Specify the red, green, blue contrast. Default values are @code{2},
  14475. @code{7} and @code{1}.
  14476. Allowed range is @code{[0, 255]}.
  14477. @item mpc
  14478. Set color which will be used for drawing median phase. If color is
  14479. @code{none} which is default, no median phase value will be drawn.
  14480. @item video
  14481. Enable video output. Default is enabled.
  14482. @end table
  14483. @section avectorscope
  14484. Convert input audio to a video output, representing the audio vector
  14485. scope.
  14486. The filter is used to measure the difference between channels of stereo
  14487. audio stream. A monoaural signal, consisting of identical left and right
  14488. signal, results in straight vertical line. Any stereo separation is visible
  14489. as a deviation from this line, creating a Lissajous figure.
  14490. If the straight (or deviation from it) but horizontal line appears this
  14491. indicates that the left and right channels are out of phase.
  14492. The filter accepts the following options:
  14493. @table @option
  14494. @item mode, m
  14495. Set the vectorscope mode.
  14496. Available values are:
  14497. @table @samp
  14498. @item lissajous
  14499. Lissajous rotated by 45 degrees.
  14500. @item lissajous_xy
  14501. Same as above but not rotated.
  14502. @item polar
  14503. Shape resembling half of circle.
  14504. @end table
  14505. Default value is @samp{lissajous}.
  14506. @item size, s
  14507. Set the video size for the output. For the syntax of this option, check the
  14508. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14509. Default value is @code{400x400}.
  14510. @item rate, r
  14511. Set the output frame rate. Default value is @code{25}.
  14512. @item rc
  14513. @item gc
  14514. @item bc
  14515. @item ac
  14516. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14517. @code{160}, @code{80} and @code{255}.
  14518. Allowed range is @code{[0, 255]}.
  14519. @item rf
  14520. @item gf
  14521. @item bf
  14522. @item af
  14523. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14524. @code{10}, @code{5} and @code{5}.
  14525. Allowed range is @code{[0, 255]}.
  14526. @item zoom
  14527. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14528. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14529. @item draw
  14530. Set the vectorscope drawing mode.
  14531. Available values are:
  14532. @table @samp
  14533. @item dot
  14534. Draw dot for each sample.
  14535. @item line
  14536. Draw line between previous and current sample.
  14537. @end table
  14538. Default value is @samp{dot}.
  14539. @item scale
  14540. Specify amplitude scale of audio samples.
  14541. Available values are:
  14542. @table @samp
  14543. @item lin
  14544. Linear.
  14545. @item sqrt
  14546. Square root.
  14547. @item cbrt
  14548. Cubic root.
  14549. @item log
  14550. Logarithmic.
  14551. @end table
  14552. @item swap
  14553. Swap left channel axis with right channel axis.
  14554. @item mirror
  14555. Mirror axis.
  14556. @table @samp
  14557. @item none
  14558. No mirror.
  14559. @item x
  14560. Mirror only x axis.
  14561. @item y
  14562. Mirror only y axis.
  14563. @item xy
  14564. Mirror both axis.
  14565. @end table
  14566. @end table
  14567. @subsection Examples
  14568. @itemize
  14569. @item
  14570. Complete example using @command{ffplay}:
  14571. @example
  14572. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14573. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14574. @end example
  14575. @end itemize
  14576. @section bench, abench
  14577. Benchmark part of a filtergraph.
  14578. The filter accepts the following options:
  14579. @table @option
  14580. @item action
  14581. Start or stop a timer.
  14582. Available values are:
  14583. @table @samp
  14584. @item start
  14585. Get the current time, set it as frame metadata (using the key
  14586. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14587. @item stop
  14588. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14589. the input frame metadata to get the time difference. Time difference, average,
  14590. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14591. @code{min}) are then printed. The timestamps are expressed in seconds.
  14592. @end table
  14593. @end table
  14594. @subsection Examples
  14595. @itemize
  14596. @item
  14597. Benchmark @ref{selectivecolor} filter:
  14598. @example
  14599. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14600. @end example
  14601. @end itemize
  14602. @section concat
  14603. Concatenate audio and video streams, joining them together one after the
  14604. other.
  14605. The filter works on segments of synchronized video and audio streams. All
  14606. segments must have the same number of streams of each type, and that will
  14607. also be the number of streams at output.
  14608. The filter accepts the following options:
  14609. @table @option
  14610. @item n
  14611. Set the number of segments. Default is 2.
  14612. @item v
  14613. Set the number of output video streams, that is also the number of video
  14614. streams in each segment. Default is 1.
  14615. @item a
  14616. Set the number of output audio streams, that is also the number of audio
  14617. streams in each segment. Default is 0.
  14618. @item unsafe
  14619. Activate unsafe mode: do not fail if segments have a different format.
  14620. @end table
  14621. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14622. @var{a} audio outputs.
  14623. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14624. segment, in the same order as the outputs, then the inputs for the second
  14625. segment, etc.
  14626. Related streams do not always have exactly the same duration, for various
  14627. reasons including codec frame size or sloppy authoring. For that reason,
  14628. related synchronized streams (e.g. a video and its audio track) should be
  14629. concatenated at once. The concat filter will use the duration of the longest
  14630. stream in each segment (except the last one), and if necessary pad shorter
  14631. audio streams with silence.
  14632. For this filter to work correctly, all segments must start at timestamp 0.
  14633. All corresponding streams must have the same parameters in all segments; the
  14634. filtering system will automatically select a common pixel format for video
  14635. streams, and a common sample format, sample rate and channel layout for
  14636. audio streams, but other settings, such as resolution, must be converted
  14637. explicitly by the user.
  14638. Different frame rates are acceptable but will result in variable frame rate
  14639. at output; be sure to configure the output file to handle it.
  14640. @subsection Examples
  14641. @itemize
  14642. @item
  14643. Concatenate an opening, an episode and an ending, all in bilingual version
  14644. (video in stream 0, audio in streams 1 and 2):
  14645. @example
  14646. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14647. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14648. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14649. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14650. @end example
  14651. @item
  14652. Concatenate two parts, handling audio and video separately, using the
  14653. (a)movie sources, and adjusting the resolution:
  14654. @example
  14655. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14656. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14657. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14658. @end example
  14659. Note that a desync will happen at the stitch if the audio and video streams
  14660. do not have exactly the same duration in the first file.
  14661. @end itemize
  14662. @subsection Commands
  14663. This filter supports the following commands:
  14664. @table @option
  14665. @item next
  14666. Close the current segment and step to the next one
  14667. @end table
  14668. @section drawgraph, adrawgraph
  14669. Draw a graph using input video or audio metadata.
  14670. It accepts the following parameters:
  14671. @table @option
  14672. @item m1
  14673. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14674. @item fg1
  14675. Set 1st foreground color expression.
  14676. @item m2
  14677. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14678. @item fg2
  14679. Set 2nd foreground color expression.
  14680. @item m3
  14681. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14682. @item fg3
  14683. Set 3rd foreground color expression.
  14684. @item m4
  14685. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14686. @item fg4
  14687. Set 4th foreground color expression.
  14688. @item min
  14689. Set minimal value of metadata value.
  14690. @item max
  14691. Set maximal value of metadata value.
  14692. @item bg
  14693. Set graph background color. Default is white.
  14694. @item mode
  14695. Set graph mode.
  14696. Available values for mode is:
  14697. @table @samp
  14698. @item bar
  14699. @item dot
  14700. @item line
  14701. @end table
  14702. Default is @code{line}.
  14703. @item slide
  14704. Set slide mode.
  14705. Available values for slide is:
  14706. @table @samp
  14707. @item frame
  14708. Draw new frame when right border is reached.
  14709. @item replace
  14710. Replace old columns with new ones.
  14711. @item scroll
  14712. Scroll from right to left.
  14713. @item rscroll
  14714. Scroll from left to right.
  14715. @item picture
  14716. Draw single picture.
  14717. @end table
  14718. Default is @code{frame}.
  14719. @item size
  14720. Set size of graph video. For the syntax of this option, check the
  14721. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14722. The default value is @code{900x256}.
  14723. The foreground color expressions can use the following variables:
  14724. @table @option
  14725. @item MIN
  14726. Minimal value of metadata value.
  14727. @item MAX
  14728. Maximal value of metadata value.
  14729. @item VAL
  14730. Current metadata key value.
  14731. @end table
  14732. The color is defined as 0xAABBGGRR.
  14733. @end table
  14734. Example using metadata from @ref{signalstats} filter:
  14735. @example
  14736. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14737. @end example
  14738. Example using metadata from @ref{ebur128} filter:
  14739. @example
  14740. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14741. @end example
  14742. @anchor{ebur128}
  14743. @section ebur128
  14744. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14745. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14746. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14747. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14748. The filter also has a video output (see the @var{video} option) with a real
  14749. time graph to observe the loudness evolution. The graphic contains the logged
  14750. message mentioned above, so it is not printed anymore when this option is set,
  14751. unless the verbose logging is set. The main graphing area contains the
  14752. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14753. the momentary loudness (400 milliseconds), but can optionally be configured
  14754. to instead display short-term loudness (see @var{gauge}).
  14755. The green area marks a +/- 1LU target range around the target loudness
  14756. (-23LUFS by default, unless modified through @var{target}).
  14757. More information about the Loudness Recommendation EBU R128 on
  14758. @url{http://tech.ebu.ch/loudness}.
  14759. The filter accepts the following options:
  14760. @table @option
  14761. @item video
  14762. Activate the video output. The audio stream is passed unchanged whether this
  14763. option is set or no. The video stream will be the first output stream if
  14764. activated. Default is @code{0}.
  14765. @item size
  14766. Set the video size. This option is for video only. For the syntax of this
  14767. option, check the
  14768. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14769. Default and minimum resolution is @code{640x480}.
  14770. @item meter
  14771. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14772. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14773. other integer value between this range is allowed.
  14774. @item metadata
  14775. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14776. into 100ms output frames, each of them containing various loudness information
  14777. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14778. Default is @code{0}.
  14779. @item framelog
  14780. Force the frame logging level.
  14781. Available values are:
  14782. @table @samp
  14783. @item info
  14784. information logging level
  14785. @item verbose
  14786. verbose logging level
  14787. @end table
  14788. By default, the logging level is set to @var{info}. If the @option{video} or
  14789. the @option{metadata} options are set, it switches to @var{verbose}.
  14790. @item peak
  14791. Set peak mode(s).
  14792. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14793. values are:
  14794. @table @samp
  14795. @item none
  14796. Disable any peak mode (default).
  14797. @item sample
  14798. Enable sample-peak mode.
  14799. Simple peak mode looking for the higher sample value. It logs a message
  14800. for sample-peak (identified by @code{SPK}).
  14801. @item true
  14802. Enable true-peak mode.
  14803. If enabled, the peak lookup is done on an over-sampled version of the input
  14804. stream for better peak accuracy. It logs a message for true-peak.
  14805. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14806. This mode requires a build with @code{libswresample}.
  14807. @end table
  14808. @item dualmono
  14809. Treat mono input files as "dual mono". If a mono file is intended for playback
  14810. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14811. If set to @code{true}, this option will compensate for this effect.
  14812. Multi-channel input files are not affected by this option.
  14813. @item panlaw
  14814. Set a specific pan law to be used for the measurement of dual mono files.
  14815. This parameter is optional, and has a default value of -3.01dB.
  14816. @item target
  14817. Set a specific target level (in LUFS) used as relative zero in the visualization.
  14818. This parameter is optional and has a default value of -23LUFS as specified
  14819. by EBU R128. However, material published online may prefer a level of -16LUFS
  14820. (e.g. for use with podcasts or video platforms).
  14821. @item gauge
  14822. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  14823. @code{shortterm}. By default the momentary value will be used, but in certain
  14824. scenarios it may be more useful to observe the short term value instead (e.g.
  14825. live mixing).
  14826. @item scale
  14827. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  14828. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  14829. video output, not the summary or continuous log output.
  14830. @end table
  14831. @subsection Examples
  14832. @itemize
  14833. @item
  14834. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14835. @example
  14836. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14837. @end example
  14838. @item
  14839. Run an analysis with @command{ffmpeg}:
  14840. @example
  14841. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14842. @end example
  14843. @end itemize
  14844. @section interleave, ainterleave
  14845. Temporally interleave frames from several inputs.
  14846. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14847. These filters read frames from several inputs and send the oldest
  14848. queued frame to the output.
  14849. Input streams must have well defined, monotonically increasing frame
  14850. timestamp values.
  14851. In order to submit one frame to output, these filters need to enqueue
  14852. at least one frame for each input, so they cannot work in case one
  14853. input is not yet terminated and will not receive incoming frames.
  14854. For example consider the case when one input is a @code{select} filter
  14855. which always drops input frames. The @code{interleave} filter will keep
  14856. reading from that input, but it will never be able to send new frames
  14857. to output until the input sends an end-of-stream signal.
  14858. Also, depending on inputs synchronization, the filters will drop
  14859. frames in case one input receives more frames than the other ones, and
  14860. the queue is already filled.
  14861. These filters accept the following options:
  14862. @table @option
  14863. @item nb_inputs, n
  14864. Set the number of different inputs, it is 2 by default.
  14865. @end table
  14866. @subsection Examples
  14867. @itemize
  14868. @item
  14869. Interleave frames belonging to different streams using @command{ffmpeg}:
  14870. @example
  14871. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14872. @end example
  14873. @item
  14874. Add flickering blur effect:
  14875. @example
  14876. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14877. @end example
  14878. @end itemize
  14879. @section metadata, ametadata
  14880. Manipulate frame metadata.
  14881. This filter accepts the following options:
  14882. @table @option
  14883. @item mode
  14884. Set mode of operation of the filter.
  14885. Can be one of the following:
  14886. @table @samp
  14887. @item select
  14888. If both @code{value} and @code{key} is set, select frames
  14889. which have such metadata. If only @code{key} is set, select
  14890. every frame that has such key in metadata.
  14891. @item add
  14892. Add new metadata @code{key} and @code{value}. If key is already available
  14893. do nothing.
  14894. @item modify
  14895. Modify value of already present key.
  14896. @item delete
  14897. If @code{value} is set, delete only keys that have such value.
  14898. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14899. the frame.
  14900. @item print
  14901. Print key and its value if metadata was found. If @code{key} is not set print all
  14902. metadata values available in frame.
  14903. @end table
  14904. @item key
  14905. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14906. @item value
  14907. Set metadata value which will be used. This option is mandatory for
  14908. @code{modify} and @code{add} mode.
  14909. @item function
  14910. Which function to use when comparing metadata value and @code{value}.
  14911. Can be one of following:
  14912. @table @samp
  14913. @item same_str
  14914. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14915. @item starts_with
  14916. Values are interpreted as strings, returns true if metadata value starts with
  14917. the @code{value} option string.
  14918. @item less
  14919. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14920. @item equal
  14921. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14922. @item greater
  14923. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14924. @item expr
  14925. Values are interpreted as floats, returns true if expression from option @code{expr}
  14926. evaluates to true.
  14927. @end table
  14928. @item expr
  14929. Set expression which is used when @code{function} is set to @code{expr}.
  14930. The expression is evaluated through the eval API and can contain the following
  14931. constants:
  14932. @table @option
  14933. @item VALUE1
  14934. Float representation of @code{value} from metadata key.
  14935. @item VALUE2
  14936. Float representation of @code{value} as supplied by user in @code{value} option.
  14937. @end table
  14938. @item file
  14939. If specified in @code{print} mode, output is written to the named file. Instead of
  14940. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14941. for standard output. If @code{file} option is not set, output is written to the log
  14942. with AV_LOG_INFO loglevel.
  14943. @end table
  14944. @subsection Examples
  14945. @itemize
  14946. @item
  14947. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14948. between 0 and 1.
  14949. @example
  14950. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14951. @end example
  14952. @item
  14953. Print silencedetect output to file @file{metadata.txt}.
  14954. @example
  14955. silencedetect,ametadata=mode=print:file=metadata.txt
  14956. @end example
  14957. @item
  14958. Direct all metadata to a pipe with file descriptor 4.
  14959. @example
  14960. metadata=mode=print:file='pipe\:4'
  14961. @end example
  14962. @end itemize
  14963. @section perms, aperms
  14964. Set read/write permissions for the output frames.
  14965. These filters are mainly aimed at developers to test direct path in the
  14966. following filter in the filtergraph.
  14967. The filters accept the following options:
  14968. @table @option
  14969. @item mode
  14970. Select the permissions mode.
  14971. It accepts the following values:
  14972. @table @samp
  14973. @item none
  14974. Do nothing. This is the default.
  14975. @item ro
  14976. Set all the output frames read-only.
  14977. @item rw
  14978. Set all the output frames directly writable.
  14979. @item toggle
  14980. Make the frame read-only if writable, and writable if read-only.
  14981. @item random
  14982. Set each output frame read-only or writable randomly.
  14983. @end table
  14984. @item seed
  14985. Set the seed for the @var{random} mode, must be an integer included between
  14986. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14987. @code{-1}, the filter will try to use a good random seed on a best effort
  14988. basis.
  14989. @end table
  14990. Note: in case of auto-inserted filter between the permission filter and the
  14991. following one, the permission might not be received as expected in that
  14992. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14993. perms/aperms filter can avoid this problem.
  14994. @section realtime, arealtime
  14995. Slow down filtering to match real time approximately.
  14996. These filters will pause the filtering for a variable amount of time to
  14997. match the output rate with the input timestamps.
  14998. They are similar to the @option{re} option to @code{ffmpeg}.
  14999. They accept the following options:
  15000. @table @option
  15001. @item limit
  15002. Time limit for the pauses. Any pause longer than that will be considered
  15003. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15004. @end table
  15005. @anchor{select}
  15006. @section select, aselect
  15007. Select frames to pass in output.
  15008. This filter accepts the following options:
  15009. @table @option
  15010. @item expr, e
  15011. Set expression, which is evaluated for each input frame.
  15012. If the expression is evaluated to zero, the frame is discarded.
  15013. If the evaluation result is negative or NaN, the frame is sent to the
  15014. first output; otherwise it is sent to the output with index
  15015. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15016. For example a value of @code{1.2} corresponds to the output with index
  15017. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15018. @item outputs, n
  15019. Set the number of outputs. The output to which to send the selected
  15020. frame is based on the result of the evaluation. Default value is 1.
  15021. @end table
  15022. The expression can contain the following constants:
  15023. @table @option
  15024. @item n
  15025. The (sequential) number of the filtered frame, starting from 0.
  15026. @item selected_n
  15027. The (sequential) number of the selected frame, starting from 0.
  15028. @item prev_selected_n
  15029. The sequential number of the last selected frame. It's NAN if undefined.
  15030. @item TB
  15031. The timebase of the input timestamps.
  15032. @item pts
  15033. The PTS (Presentation TimeStamp) of the filtered video frame,
  15034. expressed in @var{TB} units. It's NAN if undefined.
  15035. @item t
  15036. The PTS of the filtered video frame,
  15037. expressed in seconds. It's NAN if undefined.
  15038. @item prev_pts
  15039. The PTS of the previously filtered video frame. It's NAN if undefined.
  15040. @item prev_selected_pts
  15041. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15042. @item prev_selected_t
  15043. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15044. @item start_pts
  15045. The PTS of the first video frame in the video. It's NAN if undefined.
  15046. @item start_t
  15047. The time of the first video frame in the video. It's NAN if undefined.
  15048. @item pict_type @emph{(video only)}
  15049. The type of the filtered frame. It can assume one of the following
  15050. values:
  15051. @table @option
  15052. @item I
  15053. @item P
  15054. @item B
  15055. @item S
  15056. @item SI
  15057. @item SP
  15058. @item BI
  15059. @end table
  15060. @item interlace_type @emph{(video only)}
  15061. The frame interlace type. It can assume one of the following values:
  15062. @table @option
  15063. @item PROGRESSIVE
  15064. The frame is progressive (not interlaced).
  15065. @item TOPFIRST
  15066. The frame is top-field-first.
  15067. @item BOTTOMFIRST
  15068. The frame is bottom-field-first.
  15069. @end table
  15070. @item consumed_sample_n @emph{(audio only)}
  15071. the number of selected samples before the current frame
  15072. @item samples_n @emph{(audio only)}
  15073. the number of samples in the current frame
  15074. @item sample_rate @emph{(audio only)}
  15075. the input sample rate
  15076. @item key
  15077. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15078. @item pos
  15079. the position in the file of the filtered frame, -1 if the information
  15080. is not available (e.g. for synthetic video)
  15081. @item scene @emph{(video only)}
  15082. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15083. probability for the current frame to introduce a new scene, while a higher
  15084. value means the current frame is more likely to be one (see the example below)
  15085. @item concatdec_select
  15086. The concat demuxer can select only part of a concat input file by setting an
  15087. inpoint and an outpoint, but the output packets may not be entirely contained
  15088. in the selected interval. By using this variable, it is possible to skip frames
  15089. generated by the concat demuxer which are not exactly contained in the selected
  15090. interval.
  15091. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15092. and the @var{lavf.concat.duration} packet metadata values which are also
  15093. present in the decoded frames.
  15094. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15095. start_time and either the duration metadata is missing or the frame pts is less
  15096. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15097. missing.
  15098. That basically means that an input frame is selected if its pts is within the
  15099. interval set by the concat demuxer.
  15100. @end table
  15101. The default value of the select expression is "1".
  15102. @subsection Examples
  15103. @itemize
  15104. @item
  15105. Select all frames in input:
  15106. @example
  15107. select
  15108. @end example
  15109. The example above is the same as:
  15110. @example
  15111. select=1
  15112. @end example
  15113. @item
  15114. Skip all frames:
  15115. @example
  15116. select=0
  15117. @end example
  15118. @item
  15119. Select only I-frames:
  15120. @example
  15121. select='eq(pict_type\,I)'
  15122. @end example
  15123. @item
  15124. Select one frame every 100:
  15125. @example
  15126. select='not(mod(n\,100))'
  15127. @end example
  15128. @item
  15129. Select only frames contained in the 10-20 time interval:
  15130. @example
  15131. select=between(t\,10\,20)
  15132. @end example
  15133. @item
  15134. Select only I-frames contained in the 10-20 time interval:
  15135. @example
  15136. select=between(t\,10\,20)*eq(pict_type\,I)
  15137. @end example
  15138. @item
  15139. Select frames with a minimum distance of 10 seconds:
  15140. @example
  15141. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  15142. @end example
  15143. @item
  15144. Use aselect to select only audio frames with samples number > 100:
  15145. @example
  15146. aselect='gt(samples_n\,100)'
  15147. @end example
  15148. @item
  15149. Create a mosaic of the first scenes:
  15150. @example
  15151. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  15152. @end example
  15153. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  15154. choice.
  15155. @item
  15156. Send even and odd frames to separate outputs, and compose them:
  15157. @example
  15158. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  15159. @end example
  15160. @item
  15161. Select useful frames from an ffconcat file which is using inpoints and
  15162. outpoints but where the source files are not intra frame only.
  15163. @example
  15164. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  15165. @end example
  15166. @end itemize
  15167. @section sendcmd, asendcmd
  15168. Send commands to filters in the filtergraph.
  15169. These filters read commands to be sent to other filters in the
  15170. filtergraph.
  15171. @code{sendcmd} must be inserted between two video filters,
  15172. @code{asendcmd} must be inserted between two audio filters, but apart
  15173. from that they act the same way.
  15174. The specification of commands can be provided in the filter arguments
  15175. with the @var{commands} option, or in a file specified by the
  15176. @var{filename} option.
  15177. These filters accept the following options:
  15178. @table @option
  15179. @item commands, c
  15180. Set the commands to be read and sent to the other filters.
  15181. @item filename, f
  15182. Set the filename of the commands to be read and sent to the other
  15183. filters.
  15184. @end table
  15185. @subsection Commands syntax
  15186. A commands description consists of a sequence of interval
  15187. specifications, comprising a list of commands to be executed when a
  15188. particular event related to that interval occurs. The occurring event
  15189. is typically the current frame time entering or leaving a given time
  15190. interval.
  15191. An interval is specified by the following syntax:
  15192. @example
  15193. @var{START}[-@var{END}] @var{COMMANDS};
  15194. @end example
  15195. The time interval is specified by the @var{START} and @var{END} times.
  15196. @var{END} is optional and defaults to the maximum time.
  15197. The current frame time is considered within the specified interval if
  15198. it is included in the interval [@var{START}, @var{END}), that is when
  15199. the time is greater or equal to @var{START} and is lesser than
  15200. @var{END}.
  15201. @var{COMMANDS} consists of a sequence of one or more command
  15202. specifications, separated by ",", relating to that interval. The
  15203. syntax of a command specification is given by:
  15204. @example
  15205. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  15206. @end example
  15207. @var{FLAGS} is optional and specifies the type of events relating to
  15208. the time interval which enable sending the specified command, and must
  15209. be a non-null sequence of identifier flags separated by "+" or "|" and
  15210. enclosed between "[" and "]".
  15211. The following flags are recognized:
  15212. @table @option
  15213. @item enter
  15214. The command is sent when the current frame timestamp enters the
  15215. specified interval. In other words, the command is sent when the
  15216. previous frame timestamp was not in the given interval, and the
  15217. current is.
  15218. @item leave
  15219. The command is sent when the current frame timestamp leaves the
  15220. specified interval. In other words, the command is sent when the
  15221. previous frame timestamp was in the given interval, and the
  15222. current is not.
  15223. @end table
  15224. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  15225. assumed.
  15226. @var{TARGET} specifies the target of the command, usually the name of
  15227. the filter class or a specific filter instance name.
  15228. @var{COMMAND} specifies the name of the command for the target filter.
  15229. @var{ARG} is optional and specifies the optional list of argument for
  15230. the given @var{COMMAND}.
  15231. Between one interval specification and another, whitespaces, or
  15232. sequences of characters starting with @code{#} until the end of line,
  15233. are ignored and can be used to annotate comments.
  15234. A simplified BNF description of the commands specification syntax
  15235. follows:
  15236. @example
  15237. @var{COMMAND_FLAG} ::= "enter" | "leave"
  15238. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  15239. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  15240. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  15241. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  15242. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  15243. @end example
  15244. @subsection Examples
  15245. @itemize
  15246. @item
  15247. Specify audio tempo change at second 4:
  15248. @example
  15249. asendcmd=c='4.0 atempo tempo 1.5',atempo
  15250. @end example
  15251. @item
  15252. Target a specific filter instance:
  15253. @example
  15254. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  15255. @end example
  15256. @item
  15257. Specify a list of drawtext and hue commands in a file.
  15258. @example
  15259. # show text in the interval 5-10
  15260. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  15261. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  15262. # desaturate the image in the interval 15-20
  15263. 15.0-20.0 [enter] hue s 0,
  15264. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  15265. [leave] hue s 1,
  15266. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  15267. # apply an exponential saturation fade-out effect, starting from time 25
  15268. 25 [enter] hue s exp(25-t)
  15269. @end example
  15270. A filtergraph allowing to read and process the above command list
  15271. stored in a file @file{test.cmd}, can be specified with:
  15272. @example
  15273. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  15274. @end example
  15275. @end itemize
  15276. @anchor{setpts}
  15277. @section setpts, asetpts
  15278. Change the PTS (presentation timestamp) of the input frames.
  15279. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  15280. This filter accepts the following options:
  15281. @table @option
  15282. @item expr
  15283. The expression which is evaluated for each frame to construct its timestamp.
  15284. @end table
  15285. The expression is evaluated through the eval API and can contain the following
  15286. constants:
  15287. @table @option
  15288. @item FRAME_RATE, FR
  15289. frame rate, only defined for constant frame-rate video
  15290. @item PTS
  15291. The presentation timestamp in input
  15292. @item N
  15293. The count of the input frame for video or the number of consumed samples,
  15294. not including the current frame for audio, starting from 0.
  15295. @item NB_CONSUMED_SAMPLES
  15296. The number of consumed samples, not including the current frame (only
  15297. audio)
  15298. @item NB_SAMPLES, S
  15299. The number of samples in the current frame (only audio)
  15300. @item SAMPLE_RATE, SR
  15301. The audio sample rate.
  15302. @item STARTPTS
  15303. The PTS of the first frame.
  15304. @item STARTT
  15305. the time in seconds of the first frame
  15306. @item INTERLACED
  15307. State whether the current frame is interlaced.
  15308. @item T
  15309. the time in seconds of the current frame
  15310. @item POS
  15311. original position in the file of the frame, or undefined if undefined
  15312. for the current frame
  15313. @item PREV_INPTS
  15314. The previous input PTS.
  15315. @item PREV_INT
  15316. previous input time in seconds
  15317. @item PREV_OUTPTS
  15318. The previous output PTS.
  15319. @item PREV_OUTT
  15320. previous output time in seconds
  15321. @item RTCTIME
  15322. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  15323. instead.
  15324. @item RTCSTART
  15325. The wallclock (RTC) time at the start of the movie in microseconds.
  15326. @item TB
  15327. The timebase of the input timestamps.
  15328. @end table
  15329. @subsection Examples
  15330. @itemize
  15331. @item
  15332. Start counting PTS from zero
  15333. @example
  15334. setpts=PTS-STARTPTS
  15335. @end example
  15336. @item
  15337. Apply fast motion effect:
  15338. @example
  15339. setpts=0.5*PTS
  15340. @end example
  15341. @item
  15342. Apply slow motion effect:
  15343. @example
  15344. setpts=2.0*PTS
  15345. @end example
  15346. @item
  15347. Set fixed rate of 25 frames per second:
  15348. @example
  15349. setpts=N/(25*TB)
  15350. @end example
  15351. @item
  15352. Set fixed rate 25 fps with some jitter:
  15353. @example
  15354. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  15355. @end example
  15356. @item
  15357. Apply an offset of 10 seconds to the input PTS:
  15358. @example
  15359. setpts=PTS+10/TB
  15360. @end example
  15361. @item
  15362. Generate timestamps from a "live source" and rebase onto the current timebase:
  15363. @example
  15364. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  15365. @end example
  15366. @item
  15367. Generate timestamps by counting samples:
  15368. @example
  15369. asetpts=N/SR/TB
  15370. @end example
  15371. @end itemize
  15372. @section setrange
  15373. Force color range for the output video frame.
  15374. The @code{setrange} filter marks the color range property for the
  15375. output frames. It does not change the input frame, but only sets the
  15376. corresponding property, which affects how the frame is treated by
  15377. following filters.
  15378. The filter accepts the following options:
  15379. @table @option
  15380. @item range
  15381. Available values are:
  15382. @table @samp
  15383. @item auto
  15384. Keep the same color range property.
  15385. @item unspecified, unknown
  15386. Set the color range as unspecified.
  15387. @item limited, tv, mpeg
  15388. Set the color range as limited.
  15389. @item full, pc, jpeg
  15390. Set the color range as full.
  15391. @end table
  15392. @end table
  15393. @section settb, asettb
  15394. Set the timebase to use for the output frames timestamps.
  15395. It is mainly useful for testing timebase configuration.
  15396. It accepts the following parameters:
  15397. @table @option
  15398. @item expr, tb
  15399. The expression which is evaluated into the output timebase.
  15400. @end table
  15401. The value for @option{tb} is an arithmetic expression representing a
  15402. rational. The expression can contain the constants "AVTB" (the default
  15403. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  15404. audio only). Default value is "intb".
  15405. @subsection Examples
  15406. @itemize
  15407. @item
  15408. Set the timebase to 1/25:
  15409. @example
  15410. settb=expr=1/25
  15411. @end example
  15412. @item
  15413. Set the timebase to 1/10:
  15414. @example
  15415. settb=expr=0.1
  15416. @end example
  15417. @item
  15418. Set the timebase to 1001/1000:
  15419. @example
  15420. settb=1+0.001
  15421. @end example
  15422. @item
  15423. Set the timebase to 2*intb:
  15424. @example
  15425. settb=2*intb
  15426. @end example
  15427. @item
  15428. Set the default timebase value:
  15429. @example
  15430. settb=AVTB
  15431. @end example
  15432. @end itemize
  15433. @section showcqt
  15434. Convert input audio to a video output representing frequency spectrum
  15435. logarithmically using Brown-Puckette constant Q transform algorithm with
  15436. direct frequency domain coefficient calculation (but the transform itself
  15437. is not really constant Q, instead the Q factor is actually variable/clamped),
  15438. with musical tone scale, from E0 to D#10.
  15439. The filter accepts the following options:
  15440. @table @option
  15441. @item size, s
  15442. Specify the video size for the output. It must be even. For the syntax of this option,
  15443. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15444. Default value is @code{1920x1080}.
  15445. @item fps, rate, r
  15446. Set the output frame rate. Default value is @code{25}.
  15447. @item bar_h
  15448. Set the bargraph height. It must be even. Default value is @code{-1} which
  15449. computes the bargraph height automatically.
  15450. @item axis_h
  15451. Set the axis height. It must be even. Default value is @code{-1} which computes
  15452. the axis height automatically.
  15453. @item sono_h
  15454. Set the sonogram height. It must be even. Default value is @code{-1} which
  15455. computes the sonogram height automatically.
  15456. @item fullhd
  15457. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  15458. instead. Default value is @code{1}.
  15459. @item sono_v, volume
  15460. Specify the sonogram volume expression. It can contain variables:
  15461. @table @option
  15462. @item bar_v
  15463. the @var{bar_v} evaluated expression
  15464. @item frequency, freq, f
  15465. the frequency where it is evaluated
  15466. @item timeclamp, tc
  15467. the value of @var{timeclamp} option
  15468. @end table
  15469. and functions:
  15470. @table @option
  15471. @item a_weighting(f)
  15472. A-weighting of equal loudness
  15473. @item b_weighting(f)
  15474. B-weighting of equal loudness
  15475. @item c_weighting(f)
  15476. C-weighting of equal loudness.
  15477. @end table
  15478. Default value is @code{16}.
  15479. @item bar_v, volume2
  15480. Specify the bargraph volume expression. It can contain variables:
  15481. @table @option
  15482. @item sono_v
  15483. the @var{sono_v} evaluated expression
  15484. @item frequency, freq, f
  15485. the frequency where it is evaluated
  15486. @item timeclamp, tc
  15487. the value of @var{timeclamp} option
  15488. @end table
  15489. and functions:
  15490. @table @option
  15491. @item a_weighting(f)
  15492. A-weighting of equal loudness
  15493. @item b_weighting(f)
  15494. B-weighting of equal loudness
  15495. @item c_weighting(f)
  15496. C-weighting of equal loudness.
  15497. @end table
  15498. Default value is @code{sono_v}.
  15499. @item sono_g, gamma
  15500. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  15501. higher gamma makes the spectrum having more range. Default value is @code{3}.
  15502. Acceptable range is @code{[1, 7]}.
  15503. @item bar_g, gamma2
  15504. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15505. @code{[1, 7]}.
  15506. @item bar_t
  15507. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15508. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15509. @item timeclamp, tc
  15510. Specify the transform timeclamp. At low frequency, there is trade-off between
  15511. accuracy in time domain and frequency domain. If timeclamp is lower,
  15512. event in time domain is represented more accurately (such as fast bass drum),
  15513. otherwise event in frequency domain is represented more accurately
  15514. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15515. @item attack
  15516. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15517. limits future samples by applying asymmetric windowing in time domain, useful
  15518. when low latency is required. Accepted range is @code{[0, 1]}.
  15519. @item basefreq
  15520. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15521. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15522. @item endfreq
  15523. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15524. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15525. @item coeffclamp
  15526. This option is deprecated and ignored.
  15527. @item tlength
  15528. Specify the transform length in time domain. Use this option to control accuracy
  15529. trade-off between time domain and frequency domain at every frequency sample.
  15530. It can contain variables:
  15531. @table @option
  15532. @item frequency, freq, f
  15533. the frequency where it is evaluated
  15534. @item timeclamp, tc
  15535. the value of @var{timeclamp} option.
  15536. @end table
  15537. Default value is @code{384*tc/(384+tc*f)}.
  15538. @item count
  15539. Specify the transform count for every video frame. Default value is @code{6}.
  15540. Acceptable range is @code{[1, 30]}.
  15541. @item fcount
  15542. Specify the transform count for every single pixel. Default value is @code{0},
  15543. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15544. @item fontfile
  15545. Specify font file for use with freetype to draw the axis. If not specified,
  15546. use embedded font. Note that drawing with font file or embedded font is not
  15547. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15548. option instead.
  15549. @item font
  15550. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15551. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15552. @item fontcolor
  15553. Specify font color expression. This is arithmetic expression that should return
  15554. integer value 0xRRGGBB. It can contain variables:
  15555. @table @option
  15556. @item frequency, freq, f
  15557. the frequency where it is evaluated
  15558. @item timeclamp, tc
  15559. the value of @var{timeclamp} option
  15560. @end table
  15561. and functions:
  15562. @table @option
  15563. @item midi(f)
  15564. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15565. @item r(x), g(x), b(x)
  15566. red, green, and blue value of intensity x.
  15567. @end table
  15568. Default value is @code{st(0, (midi(f)-59.5)/12);
  15569. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15570. r(1-ld(1)) + b(ld(1))}.
  15571. @item axisfile
  15572. Specify image file to draw the axis. This option override @var{fontfile} and
  15573. @var{fontcolor} option.
  15574. @item axis, text
  15575. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15576. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15577. Default value is @code{1}.
  15578. @item csp
  15579. Set colorspace. The accepted values are:
  15580. @table @samp
  15581. @item unspecified
  15582. Unspecified (default)
  15583. @item bt709
  15584. BT.709
  15585. @item fcc
  15586. FCC
  15587. @item bt470bg
  15588. BT.470BG or BT.601-6 625
  15589. @item smpte170m
  15590. SMPTE-170M or BT.601-6 525
  15591. @item smpte240m
  15592. SMPTE-240M
  15593. @item bt2020ncl
  15594. BT.2020 with non-constant luminance
  15595. @end table
  15596. @item cscheme
  15597. Set spectrogram color scheme. This is list of floating point values with format
  15598. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15599. The default is @code{1|0.5|0|0|0.5|1}.
  15600. @end table
  15601. @subsection Examples
  15602. @itemize
  15603. @item
  15604. Playing audio while showing the spectrum:
  15605. @example
  15606. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15607. @end example
  15608. @item
  15609. Same as above, but with frame rate 30 fps:
  15610. @example
  15611. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15612. @end example
  15613. @item
  15614. Playing at 1280x720:
  15615. @example
  15616. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15617. @end example
  15618. @item
  15619. Disable sonogram display:
  15620. @example
  15621. sono_h=0
  15622. @end example
  15623. @item
  15624. A1 and its harmonics: A1, A2, (near)E3, A3:
  15625. @example
  15626. 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),
  15627. asplit[a][out1]; [a] showcqt [out0]'
  15628. @end example
  15629. @item
  15630. Same as above, but with more accuracy in frequency domain:
  15631. @example
  15632. 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),
  15633. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15634. @end example
  15635. @item
  15636. Custom volume:
  15637. @example
  15638. bar_v=10:sono_v=bar_v*a_weighting(f)
  15639. @end example
  15640. @item
  15641. Custom gamma, now spectrum is linear to the amplitude.
  15642. @example
  15643. bar_g=2:sono_g=2
  15644. @end example
  15645. @item
  15646. Custom tlength equation:
  15647. @example
  15648. 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)))'
  15649. @end example
  15650. @item
  15651. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15652. @example
  15653. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15654. @end example
  15655. @item
  15656. Custom font using fontconfig:
  15657. @example
  15658. font='Courier New,Monospace,mono|bold'
  15659. @end example
  15660. @item
  15661. Custom frequency range with custom axis using image file:
  15662. @example
  15663. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15664. @end example
  15665. @end itemize
  15666. @section showfreqs
  15667. Convert input audio to video output representing the audio power spectrum.
  15668. Audio amplitude is on Y-axis while frequency is on X-axis.
  15669. The filter accepts the following options:
  15670. @table @option
  15671. @item size, s
  15672. Specify size of video. For the syntax of this option, check the
  15673. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15674. Default is @code{1024x512}.
  15675. @item mode
  15676. Set display mode.
  15677. This set how each frequency bin will be represented.
  15678. It accepts the following values:
  15679. @table @samp
  15680. @item line
  15681. @item bar
  15682. @item dot
  15683. @end table
  15684. Default is @code{bar}.
  15685. @item ascale
  15686. Set amplitude scale.
  15687. It accepts the following values:
  15688. @table @samp
  15689. @item lin
  15690. Linear scale.
  15691. @item sqrt
  15692. Square root scale.
  15693. @item cbrt
  15694. Cubic root scale.
  15695. @item log
  15696. Logarithmic scale.
  15697. @end table
  15698. Default is @code{log}.
  15699. @item fscale
  15700. Set frequency scale.
  15701. It accepts the following values:
  15702. @table @samp
  15703. @item lin
  15704. Linear scale.
  15705. @item log
  15706. Logarithmic scale.
  15707. @item rlog
  15708. Reverse logarithmic scale.
  15709. @end table
  15710. Default is @code{lin}.
  15711. @item win_size
  15712. Set window size.
  15713. It accepts the following values:
  15714. @table @samp
  15715. @item w16
  15716. @item w32
  15717. @item w64
  15718. @item w128
  15719. @item w256
  15720. @item w512
  15721. @item w1024
  15722. @item w2048
  15723. @item w4096
  15724. @item w8192
  15725. @item w16384
  15726. @item w32768
  15727. @item w65536
  15728. @end table
  15729. Default is @code{w2048}
  15730. @item win_func
  15731. Set windowing function.
  15732. It accepts the following values:
  15733. @table @samp
  15734. @item rect
  15735. @item bartlett
  15736. @item hanning
  15737. @item hamming
  15738. @item blackman
  15739. @item welch
  15740. @item flattop
  15741. @item bharris
  15742. @item bnuttall
  15743. @item bhann
  15744. @item sine
  15745. @item nuttall
  15746. @item lanczos
  15747. @item gauss
  15748. @item tukey
  15749. @item dolph
  15750. @item cauchy
  15751. @item parzen
  15752. @item poisson
  15753. @end table
  15754. Default is @code{hanning}.
  15755. @item overlap
  15756. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15757. which means optimal overlap for selected window function will be picked.
  15758. @item averaging
  15759. Set time averaging. Setting this to 0 will display current maximal peaks.
  15760. Default is @code{1}, which means time averaging is disabled.
  15761. @item colors
  15762. Specify list of colors separated by space or by '|' which will be used to
  15763. draw channel frequencies. Unrecognized or missing colors will be replaced
  15764. by white color.
  15765. @item cmode
  15766. Set channel display mode.
  15767. It accepts the following values:
  15768. @table @samp
  15769. @item combined
  15770. @item separate
  15771. @end table
  15772. Default is @code{combined}.
  15773. @item minamp
  15774. Set minimum amplitude used in @code{log} amplitude scaler.
  15775. @end table
  15776. @anchor{showspectrum}
  15777. @section showspectrum
  15778. Convert input audio to a video output, representing the audio frequency
  15779. spectrum.
  15780. The filter accepts the following options:
  15781. @table @option
  15782. @item size, s
  15783. Specify the video size for the output. For the syntax of this option, check the
  15784. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15785. Default value is @code{640x512}.
  15786. @item slide
  15787. Specify how the spectrum should slide along the window.
  15788. It accepts the following values:
  15789. @table @samp
  15790. @item replace
  15791. the samples start again on the left when they reach the right
  15792. @item scroll
  15793. the samples scroll from right to left
  15794. @item fullframe
  15795. frames are only produced when the samples reach the right
  15796. @item rscroll
  15797. the samples scroll from left to right
  15798. @end table
  15799. Default value is @code{replace}.
  15800. @item mode
  15801. Specify display mode.
  15802. It accepts the following values:
  15803. @table @samp
  15804. @item combined
  15805. all channels are displayed in the same row
  15806. @item separate
  15807. all channels are displayed in separate rows
  15808. @end table
  15809. Default value is @samp{combined}.
  15810. @item color
  15811. Specify display color mode.
  15812. It accepts the following values:
  15813. @table @samp
  15814. @item channel
  15815. each channel is displayed in a separate color
  15816. @item intensity
  15817. each channel is displayed using the same color scheme
  15818. @item rainbow
  15819. each channel is displayed using the rainbow color scheme
  15820. @item moreland
  15821. each channel is displayed using the moreland color scheme
  15822. @item nebulae
  15823. each channel is displayed using the nebulae color scheme
  15824. @item fire
  15825. each channel is displayed using the fire color scheme
  15826. @item fiery
  15827. each channel is displayed using the fiery color scheme
  15828. @item fruit
  15829. each channel is displayed using the fruit color scheme
  15830. @item cool
  15831. each channel is displayed using the cool color scheme
  15832. @item magma
  15833. each channel is displayed using the magma color scheme
  15834. @item green
  15835. each channel is displayed using the green color scheme
  15836. @end table
  15837. Default value is @samp{channel}.
  15838. @item scale
  15839. Specify scale used for calculating intensity color values.
  15840. It accepts the following values:
  15841. @table @samp
  15842. @item lin
  15843. linear
  15844. @item sqrt
  15845. square root, default
  15846. @item cbrt
  15847. cubic root
  15848. @item log
  15849. logarithmic
  15850. @item 4thrt
  15851. 4th root
  15852. @item 5thrt
  15853. 5th root
  15854. @end table
  15855. Default value is @samp{sqrt}.
  15856. @item saturation
  15857. Set saturation modifier for displayed colors. Negative values provide
  15858. alternative color scheme. @code{0} is no saturation at all.
  15859. Saturation must be in [-10.0, 10.0] range.
  15860. Default value is @code{1}.
  15861. @item win_func
  15862. Set window function.
  15863. It accepts the following values:
  15864. @table @samp
  15865. @item rect
  15866. @item bartlett
  15867. @item hann
  15868. @item hanning
  15869. @item hamming
  15870. @item blackman
  15871. @item welch
  15872. @item flattop
  15873. @item bharris
  15874. @item bnuttall
  15875. @item bhann
  15876. @item sine
  15877. @item nuttall
  15878. @item lanczos
  15879. @item gauss
  15880. @item tukey
  15881. @item dolph
  15882. @item cauchy
  15883. @item parzen
  15884. @item poisson
  15885. @end table
  15886. Default value is @code{hann}.
  15887. @item orientation
  15888. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15889. @code{horizontal}. Default is @code{vertical}.
  15890. @item overlap
  15891. Set ratio of overlap window. Default value is @code{0}.
  15892. When value is @code{1} overlap is set to recommended size for specific
  15893. window function currently used.
  15894. @item gain
  15895. Set scale gain for calculating intensity color values.
  15896. Default value is @code{1}.
  15897. @item data
  15898. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15899. @item rotation
  15900. Set color rotation, must be in [-1.0, 1.0] range.
  15901. Default value is @code{0}.
  15902. @item start
  15903. Set start frequency from which to display spectrogram. Default is @code{0}.
  15904. @item stop
  15905. Set stop frequency to which to display spectrogram. Default is @code{0}.
  15906. @item fps
  15907. Set upper frame rate limit. Default is @code{auto}, unlimited.
  15908. @item legend
  15909. Draw time and frequency axes and legends. Default is disabled.
  15910. @end table
  15911. The usage is very similar to the showwaves filter; see the examples in that
  15912. section.
  15913. @subsection Examples
  15914. @itemize
  15915. @item
  15916. Large window with logarithmic color scaling:
  15917. @example
  15918. showspectrum=s=1280x480:scale=log
  15919. @end example
  15920. @item
  15921. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15922. @example
  15923. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15924. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15925. @end example
  15926. @end itemize
  15927. @section showspectrumpic
  15928. Convert input audio to a single video frame, representing the audio frequency
  15929. spectrum.
  15930. The filter accepts the following options:
  15931. @table @option
  15932. @item size, s
  15933. Specify the video size for the output. For the syntax of this option, check the
  15934. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15935. Default value is @code{4096x2048}.
  15936. @item mode
  15937. Specify display mode.
  15938. It accepts the following values:
  15939. @table @samp
  15940. @item combined
  15941. all channels are displayed in the same row
  15942. @item separate
  15943. all channels are displayed in separate rows
  15944. @end table
  15945. Default value is @samp{combined}.
  15946. @item color
  15947. Specify display color mode.
  15948. It accepts the following values:
  15949. @table @samp
  15950. @item channel
  15951. each channel is displayed in a separate color
  15952. @item intensity
  15953. each channel is displayed using the same color scheme
  15954. @item rainbow
  15955. each channel is displayed using the rainbow color scheme
  15956. @item moreland
  15957. each channel is displayed using the moreland color scheme
  15958. @item nebulae
  15959. each channel is displayed using the nebulae color scheme
  15960. @item fire
  15961. each channel is displayed using the fire color scheme
  15962. @item fiery
  15963. each channel is displayed using the fiery color scheme
  15964. @item fruit
  15965. each channel is displayed using the fruit color scheme
  15966. @item cool
  15967. each channel is displayed using the cool color scheme
  15968. @item magma
  15969. each channel is displayed using the magma color scheme
  15970. @item green
  15971. each channel is displayed using the green color scheme
  15972. @end table
  15973. Default value is @samp{intensity}.
  15974. @item scale
  15975. Specify scale used for calculating intensity color values.
  15976. It accepts the following values:
  15977. @table @samp
  15978. @item lin
  15979. linear
  15980. @item sqrt
  15981. square root, default
  15982. @item cbrt
  15983. cubic root
  15984. @item log
  15985. logarithmic
  15986. @item 4thrt
  15987. 4th root
  15988. @item 5thrt
  15989. 5th root
  15990. @end table
  15991. Default value is @samp{log}.
  15992. @item saturation
  15993. Set saturation modifier for displayed colors. Negative values provide
  15994. alternative color scheme. @code{0} is no saturation at all.
  15995. Saturation must be in [-10.0, 10.0] range.
  15996. Default value is @code{1}.
  15997. @item win_func
  15998. Set window function.
  15999. It accepts the following values:
  16000. @table @samp
  16001. @item rect
  16002. @item bartlett
  16003. @item hann
  16004. @item hanning
  16005. @item hamming
  16006. @item blackman
  16007. @item welch
  16008. @item flattop
  16009. @item bharris
  16010. @item bnuttall
  16011. @item bhann
  16012. @item sine
  16013. @item nuttall
  16014. @item lanczos
  16015. @item gauss
  16016. @item tukey
  16017. @item dolph
  16018. @item cauchy
  16019. @item parzen
  16020. @item poisson
  16021. @end table
  16022. Default value is @code{hann}.
  16023. @item orientation
  16024. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16025. @code{horizontal}. Default is @code{vertical}.
  16026. @item gain
  16027. Set scale gain for calculating intensity color values.
  16028. Default value is @code{1}.
  16029. @item legend
  16030. Draw time and frequency axes and legends. Default is enabled.
  16031. @item rotation
  16032. Set color rotation, must be in [-1.0, 1.0] range.
  16033. Default value is @code{0}.
  16034. @item start
  16035. Set start frequency from which to display spectrogram. Default is @code{0}.
  16036. @item stop
  16037. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16038. @end table
  16039. @subsection Examples
  16040. @itemize
  16041. @item
  16042. Extract an audio spectrogram of a whole audio track
  16043. in a 1024x1024 picture using @command{ffmpeg}:
  16044. @example
  16045. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16046. @end example
  16047. @end itemize
  16048. @section showvolume
  16049. Convert input audio volume to a video output.
  16050. The filter accepts the following options:
  16051. @table @option
  16052. @item rate, r
  16053. Set video rate.
  16054. @item b
  16055. Set border width, allowed range is [0, 5]. Default is 1.
  16056. @item w
  16057. Set channel width, allowed range is [80, 8192]. Default is 400.
  16058. @item h
  16059. Set channel height, allowed range is [1, 900]. Default is 20.
  16060. @item f
  16061. Set fade, allowed range is [0, 1]. Default is 0.95.
  16062. @item c
  16063. Set volume color expression.
  16064. The expression can use the following variables:
  16065. @table @option
  16066. @item VOLUME
  16067. Current max volume of channel in dB.
  16068. @item PEAK
  16069. Current peak.
  16070. @item CHANNEL
  16071. Current channel number, starting from 0.
  16072. @end table
  16073. @item t
  16074. If set, displays channel names. Default is enabled.
  16075. @item v
  16076. If set, displays volume values. Default is enabled.
  16077. @item o
  16078. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16079. default is @code{h}.
  16080. @item s
  16081. Set step size, allowed range is [0, 5]. Default is 0, which means
  16082. step is disabled.
  16083. @item p
  16084. Set background opacity, allowed range is [0, 1]. Default is 0.
  16085. @item m
  16086. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16087. default is @code{p}.
  16088. @item ds
  16089. Set display scale, can be linear: @code{lin} or log: @code{log},
  16090. default is @code{lin}.
  16091. @item dm
  16092. In second.
  16093. If set to > 0., display a line for the max level
  16094. in the previous seconds.
  16095. default is disabled: @code{0.}
  16096. @item dmc
  16097. The color of the max line. Use when @code{dm} option is set to > 0.
  16098. default is: @code{orange}
  16099. @end table
  16100. @section showwaves
  16101. Convert input audio to a video output, representing the samples waves.
  16102. The filter accepts the following options:
  16103. @table @option
  16104. @item size, s
  16105. Specify the video size for the output. For the syntax of this option, check the
  16106. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16107. Default value is @code{600x240}.
  16108. @item mode
  16109. Set display mode.
  16110. Available values are:
  16111. @table @samp
  16112. @item point
  16113. Draw a point for each sample.
  16114. @item line
  16115. Draw a vertical line for each sample.
  16116. @item p2p
  16117. Draw a point for each sample and a line between them.
  16118. @item cline
  16119. Draw a centered vertical line for each sample.
  16120. @end table
  16121. Default value is @code{point}.
  16122. @item n
  16123. Set the number of samples which are printed on the same column. A
  16124. larger value will decrease the frame rate. Must be a positive
  16125. integer. This option can be set only if the value for @var{rate}
  16126. is not explicitly specified.
  16127. @item rate, r
  16128. Set the (approximate) output frame rate. This is done by setting the
  16129. option @var{n}. Default value is "25".
  16130. @item split_channels
  16131. Set if channels should be drawn separately or overlap. Default value is 0.
  16132. @item colors
  16133. Set colors separated by '|' which are going to be used for drawing of each channel.
  16134. @item scale
  16135. Set amplitude scale.
  16136. Available values are:
  16137. @table @samp
  16138. @item lin
  16139. Linear.
  16140. @item log
  16141. Logarithmic.
  16142. @item sqrt
  16143. Square root.
  16144. @item cbrt
  16145. Cubic root.
  16146. @end table
  16147. Default is linear.
  16148. @item draw
  16149. Set the draw mode. This is mostly useful to set for high @var{n}.
  16150. Available values are:
  16151. @table @samp
  16152. @item scale
  16153. Scale pixel values for each drawn sample.
  16154. @item full
  16155. Draw every sample directly.
  16156. @end table
  16157. Default value is @code{scale}.
  16158. @end table
  16159. @subsection Examples
  16160. @itemize
  16161. @item
  16162. Output the input file audio and the corresponding video representation
  16163. at the same time:
  16164. @example
  16165. amovie=a.mp3,asplit[out0],showwaves[out1]
  16166. @end example
  16167. @item
  16168. Create a synthetic signal and show it with showwaves, forcing a
  16169. frame rate of 30 frames per second:
  16170. @example
  16171. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  16172. @end example
  16173. @end itemize
  16174. @section showwavespic
  16175. Convert input audio to a single video frame, representing the samples waves.
  16176. The filter accepts the following options:
  16177. @table @option
  16178. @item size, s
  16179. Specify the video size for the output. For the syntax of this option, check the
  16180. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16181. Default value is @code{600x240}.
  16182. @item split_channels
  16183. Set if channels should be drawn separately or overlap. Default value is 0.
  16184. @item colors
  16185. Set colors separated by '|' which are going to be used for drawing of each channel.
  16186. @item scale
  16187. Set amplitude scale.
  16188. Available values are:
  16189. @table @samp
  16190. @item lin
  16191. Linear.
  16192. @item log
  16193. Logarithmic.
  16194. @item sqrt
  16195. Square root.
  16196. @item cbrt
  16197. Cubic root.
  16198. @end table
  16199. Default is linear.
  16200. @end table
  16201. @subsection Examples
  16202. @itemize
  16203. @item
  16204. Extract a channel split representation of the wave form of a whole audio track
  16205. in a 1024x800 picture using @command{ffmpeg}:
  16206. @example
  16207. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  16208. @end example
  16209. @end itemize
  16210. @section sidedata, asidedata
  16211. Delete frame side data, or select frames based on it.
  16212. This filter accepts the following options:
  16213. @table @option
  16214. @item mode
  16215. Set mode of operation of the filter.
  16216. Can be one of the following:
  16217. @table @samp
  16218. @item select
  16219. Select every frame with side data of @code{type}.
  16220. @item delete
  16221. Delete side data of @code{type}. If @code{type} is not set, delete all side
  16222. data in the frame.
  16223. @end table
  16224. @item type
  16225. Set side data type used with all modes. Must be set for @code{select} mode. For
  16226. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  16227. in @file{libavutil/frame.h}. For example, to choose
  16228. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  16229. @end table
  16230. @section spectrumsynth
  16231. Sythesize audio from 2 input video spectrums, first input stream represents
  16232. magnitude across time and second represents phase across time.
  16233. The filter will transform from frequency domain as displayed in videos back
  16234. to time domain as presented in audio output.
  16235. This filter is primarily created for reversing processed @ref{showspectrum}
  16236. filter outputs, but can synthesize sound from other spectrograms too.
  16237. But in such case results are going to be poor if the phase data is not
  16238. available, because in such cases phase data need to be recreated, usually
  16239. its just recreated from random noise.
  16240. For best results use gray only output (@code{channel} color mode in
  16241. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  16242. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  16243. @code{data} option. Inputs videos should generally use @code{fullframe}
  16244. slide mode as that saves resources needed for decoding video.
  16245. The filter accepts the following options:
  16246. @table @option
  16247. @item sample_rate
  16248. Specify sample rate of output audio, the sample rate of audio from which
  16249. spectrum was generated may differ.
  16250. @item channels
  16251. Set number of channels represented in input video spectrums.
  16252. @item scale
  16253. Set scale which was used when generating magnitude input spectrum.
  16254. Can be @code{lin} or @code{log}. Default is @code{log}.
  16255. @item slide
  16256. Set slide which was used when generating inputs spectrums.
  16257. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  16258. Default is @code{fullframe}.
  16259. @item win_func
  16260. Set window function used for resynthesis.
  16261. @item overlap
  16262. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16263. which means optimal overlap for selected window function will be picked.
  16264. @item orientation
  16265. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  16266. Default is @code{vertical}.
  16267. @end table
  16268. @subsection Examples
  16269. @itemize
  16270. @item
  16271. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  16272. then resynthesize videos back to audio with spectrumsynth:
  16273. @example
  16274. 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
  16275. 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
  16276. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  16277. @end example
  16278. @end itemize
  16279. @section split, asplit
  16280. Split input into several identical outputs.
  16281. @code{asplit} works with audio input, @code{split} with video.
  16282. The filter accepts a single parameter which specifies the number of outputs. If
  16283. unspecified, it defaults to 2.
  16284. @subsection Examples
  16285. @itemize
  16286. @item
  16287. Create two separate outputs from the same input:
  16288. @example
  16289. [in] split [out0][out1]
  16290. @end example
  16291. @item
  16292. To create 3 or more outputs, you need to specify the number of
  16293. outputs, like in:
  16294. @example
  16295. [in] asplit=3 [out0][out1][out2]
  16296. @end example
  16297. @item
  16298. Create two separate outputs from the same input, one cropped and
  16299. one padded:
  16300. @example
  16301. [in] split [splitout1][splitout2];
  16302. [splitout1] crop=100:100:0:0 [cropout];
  16303. [splitout2] pad=200:200:100:100 [padout];
  16304. @end example
  16305. @item
  16306. Create 5 copies of the input audio with @command{ffmpeg}:
  16307. @example
  16308. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  16309. @end example
  16310. @end itemize
  16311. @section zmq, azmq
  16312. Receive commands sent through a libzmq client, and forward them to
  16313. filters in the filtergraph.
  16314. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  16315. must be inserted between two video filters, @code{azmq} between two
  16316. audio filters. Both are capable to send messages to any filter type.
  16317. To enable these filters you need to install the libzmq library and
  16318. headers and configure FFmpeg with @code{--enable-libzmq}.
  16319. For more information about libzmq see:
  16320. @url{http://www.zeromq.org/}
  16321. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  16322. receives messages sent through a network interface defined by the
  16323. @option{bind_address} (or the abbreviation "@option{b}") option.
  16324. Default value of this option is @file{tcp://localhost:5555}. You may
  16325. want to alter this value to your needs, but do not forget to escape any
  16326. ':' signs (see @ref{filtergraph escaping}).
  16327. The received message must be in the form:
  16328. @example
  16329. @var{TARGET} @var{COMMAND} [@var{ARG}]
  16330. @end example
  16331. @var{TARGET} specifies the target of the command, usually the name of
  16332. the filter class or a specific filter instance name. The default
  16333. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  16334. but you can override this by using the @samp{filter_name@@id} syntax
  16335. (see @ref{Filtergraph syntax}).
  16336. @var{COMMAND} specifies the name of the command for the target filter.
  16337. @var{ARG} is optional and specifies the optional argument list for the
  16338. given @var{COMMAND}.
  16339. Upon reception, the message is processed and the corresponding command
  16340. is injected into the filtergraph. Depending on the result, the filter
  16341. will send a reply to the client, adopting the format:
  16342. @example
  16343. @var{ERROR_CODE} @var{ERROR_REASON}
  16344. @var{MESSAGE}
  16345. @end example
  16346. @var{MESSAGE} is optional.
  16347. @subsection Examples
  16348. Look at @file{tools/zmqsend} for an example of a zmq client which can
  16349. be used to send commands processed by these filters.
  16350. Consider the following filtergraph generated by @command{ffplay}.
  16351. In this example the last overlay filter has an instance name. All other
  16352. filters will have default instance names.
  16353. @example
  16354. ffplay -dumpgraph 1 -f lavfi "
  16355. color=s=100x100:c=red [l];
  16356. color=s=100x100:c=blue [r];
  16357. nullsrc=s=200x100, zmq [bg];
  16358. [bg][l] overlay [bg+l];
  16359. [bg+l][r] overlay@@my=x=100 "
  16360. @end example
  16361. To change the color of the left side of the video, the following
  16362. command can be used:
  16363. @example
  16364. echo Parsed_color_0 c yellow | tools/zmqsend
  16365. @end example
  16366. To change the right side:
  16367. @example
  16368. echo Parsed_color_1 c pink | tools/zmqsend
  16369. @end example
  16370. To change the position of the right side:
  16371. @example
  16372. echo overlay@@my x 150 | tools/zmqsend
  16373. @end example
  16374. @c man end MULTIMEDIA FILTERS
  16375. @chapter Multimedia Sources
  16376. @c man begin MULTIMEDIA SOURCES
  16377. Below is a description of the currently available multimedia sources.
  16378. @section amovie
  16379. This is the same as @ref{movie} source, except it selects an audio
  16380. stream by default.
  16381. @anchor{movie}
  16382. @section movie
  16383. Read audio and/or video stream(s) from a movie container.
  16384. It accepts the following parameters:
  16385. @table @option
  16386. @item filename
  16387. The name of the resource to read (not necessarily a file; it can also be a
  16388. device or a stream accessed through some protocol).
  16389. @item format_name, f
  16390. Specifies the format assumed for the movie to read, and can be either
  16391. the name of a container or an input device. If not specified, the
  16392. format is guessed from @var{movie_name} or by probing.
  16393. @item seek_point, sp
  16394. Specifies the seek point in seconds. The frames will be output
  16395. starting from this seek point. The parameter is evaluated with
  16396. @code{av_strtod}, so the numerical value may be suffixed by an IS
  16397. postfix. The default value is "0".
  16398. @item streams, s
  16399. Specifies the streams to read. Several streams can be specified,
  16400. separated by "+". The source will then have as many outputs, in the
  16401. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  16402. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  16403. respectively the default (best suited) video and audio stream. Default
  16404. is "dv", or "da" if the filter is called as "amovie".
  16405. @item stream_index, si
  16406. Specifies the index of the video stream to read. If the value is -1,
  16407. the most suitable video stream will be automatically selected. The default
  16408. value is "-1". Deprecated. If the filter is called "amovie", it will select
  16409. audio instead of video.
  16410. @item loop
  16411. Specifies how many times to read the stream in sequence.
  16412. If the value is 0, the stream will be looped infinitely.
  16413. Default value is "1".
  16414. Note that when the movie is looped the source timestamps are not
  16415. changed, so it will generate non monotonically increasing timestamps.
  16416. @item discontinuity
  16417. Specifies the time difference between frames above which the point is
  16418. considered a timestamp discontinuity which is removed by adjusting the later
  16419. timestamps.
  16420. @end table
  16421. It allows overlaying a second video on top of the main input of
  16422. a filtergraph, as shown in this graph:
  16423. @example
  16424. input -----------> deltapts0 --> overlay --> output
  16425. ^
  16426. |
  16427. movie --> scale--> deltapts1 -------+
  16428. @end example
  16429. @subsection Examples
  16430. @itemize
  16431. @item
  16432. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  16433. on top of the input labelled "in":
  16434. @example
  16435. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16436. [in] setpts=PTS-STARTPTS [main];
  16437. [main][over] overlay=16:16 [out]
  16438. @end example
  16439. @item
  16440. Read from a video4linux2 device, and overlay it on top of the input
  16441. labelled "in":
  16442. @example
  16443. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16444. [in] setpts=PTS-STARTPTS [main];
  16445. [main][over] overlay=16:16 [out]
  16446. @end example
  16447. @item
  16448. Read the first video stream and the audio stream with id 0x81 from
  16449. dvd.vob; the video is connected to the pad named "video" and the audio is
  16450. connected to the pad named "audio":
  16451. @example
  16452. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  16453. @end example
  16454. @end itemize
  16455. @subsection Commands
  16456. Both movie and amovie support the following commands:
  16457. @table @option
  16458. @item seek
  16459. Perform seek using "av_seek_frame".
  16460. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  16461. @itemize
  16462. @item
  16463. @var{stream_index}: If stream_index is -1, a default
  16464. stream is selected, and @var{timestamp} is automatically converted
  16465. from AV_TIME_BASE units to the stream specific time_base.
  16466. @item
  16467. @var{timestamp}: Timestamp in AVStream.time_base units
  16468. or, if no stream is specified, in AV_TIME_BASE units.
  16469. @item
  16470. @var{flags}: Flags which select direction and seeking mode.
  16471. @end itemize
  16472. @item get_duration
  16473. Get movie duration in AV_TIME_BASE units.
  16474. @end table
  16475. @c man end MULTIMEDIA SOURCES