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.

23109 lines
615KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @end table
  1384. @section anull
  1385. Pass the audio source unchanged to the output.
  1386. @section apad
  1387. Pad the end of an audio stream with silence.
  1388. This can be used together with @command{ffmpeg} @option{-shortest} to
  1389. extend audio streams to the same length as the video stream.
  1390. A description of the accepted options follows.
  1391. @table @option
  1392. @item packet_size
  1393. Set silence packet size. Default value is 4096.
  1394. @item pad_len
  1395. Set the number of samples of silence to add to the end. After the
  1396. value is reached, the stream is terminated. This option is mutually
  1397. exclusive with @option{whole_len}.
  1398. @item whole_len
  1399. Set the minimum total number of samples in the output audio stream. If
  1400. the value is longer than the input audio length, silence is added to
  1401. the end, until the value is reached. This option is mutually exclusive
  1402. with @option{pad_len}.
  1403. @item pad_dur
  1404. Specify the duration of samples of silence to add. See
  1405. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1406. for the accepted syntax. Used only if set to non-zero value.
  1407. @item whole_dur
  1408. Specify the minimum total duration in the output audio stream. See
  1409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1410. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1411. the input audio length, silence is added to the end, until the value is reached.
  1412. This option is mutually exclusive with @option{pad_dur}
  1413. @end table
  1414. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1415. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1416. the input stream indefinitely.
  1417. @subsection Examples
  1418. @itemize
  1419. @item
  1420. Add 1024 samples of silence to the end of the input:
  1421. @example
  1422. apad=pad_len=1024
  1423. @end example
  1424. @item
  1425. Make sure the audio output will contain at least 10000 samples, pad
  1426. the input with silence if required:
  1427. @example
  1428. apad=whole_len=10000
  1429. @end example
  1430. @item
  1431. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1432. video stream will always result the shortest and will be converted
  1433. until the end in the output file when using the @option{shortest}
  1434. option:
  1435. @example
  1436. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1437. @end example
  1438. @end itemize
  1439. @section aphaser
  1440. Add a phasing effect to the input audio.
  1441. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1442. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1443. A description of the accepted parameters follows.
  1444. @table @option
  1445. @item in_gain
  1446. Set input gain. Default is 0.4.
  1447. @item out_gain
  1448. Set output gain. Default is 0.74
  1449. @item delay
  1450. Set delay in milliseconds. Default is 3.0.
  1451. @item decay
  1452. Set decay. Default is 0.4.
  1453. @item speed
  1454. Set modulation speed in Hz. Default is 0.5.
  1455. @item type
  1456. Set modulation type. Default is triangular.
  1457. It accepts the following values:
  1458. @table @samp
  1459. @item triangular, t
  1460. @item sinusoidal, s
  1461. @end table
  1462. @end table
  1463. @section apulsator
  1464. Audio pulsator is something between an autopanner and a tremolo.
  1465. But it can produce funny stereo effects as well. Pulsator changes the volume
  1466. of the left and right channel based on a LFO (low frequency oscillator) with
  1467. different waveforms and shifted phases.
  1468. This filter have the ability to define an offset between left and right
  1469. channel. An offset of 0 means that both LFO shapes match each other.
  1470. The left and right channel are altered equally - a conventional tremolo.
  1471. An offset of 50% means that the shape of the right channel is exactly shifted
  1472. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1473. an autopanner. At 1 both curves match again. Every setting in between moves the
  1474. phase shift gapless between all stages and produces some "bypassing" sounds with
  1475. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1476. the 0.5) the faster the signal passes from the left to the right speaker.
  1477. The filter accepts the following options:
  1478. @table @option
  1479. @item level_in
  1480. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1481. @item level_out
  1482. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1483. @item mode
  1484. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1485. sawup or sawdown. Default is sine.
  1486. @item amount
  1487. Set modulation. Define how much of original signal is affected by the LFO.
  1488. @item offset_l
  1489. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1490. @item offset_r
  1491. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1492. @item width
  1493. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1494. @item timing
  1495. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1496. @item bpm
  1497. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1498. is set to bpm.
  1499. @item ms
  1500. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1501. is set to ms.
  1502. @item hz
  1503. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1504. if timing is set to hz.
  1505. @end table
  1506. @anchor{aresample}
  1507. @section aresample
  1508. Resample the input audio to the specified parameters, using the
  1509. libswresample library. If none are specified then the filter will
  1510. automatically convert between its input and output.
  1511. This filter is also able to stretch/squeeze the audio data to make it match
  1512. the timestamps or to inject silence / cut out audio to make it match the
  1513. timestamps, do a combination of both or do neither.
  1514. The filter accepts the syntax
  1515. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1516. expresses a sample rate and @var{resampler_options} is a list of
  1517. @var{key}=@var{value} pairs, separated by ":". See the
  1518. @ref{Resampler Options,,"Resampler Options" section in the
  1519. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1520. for the complete list of supported options.
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Resample the input audio to 44100Hz:
  1525. @example
  1526. aresample=44100
  1527. @end example
  1528. @item
  1529. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1530. samples per second compensation:
  1531. @example
  1532. aresample=async=1000
  1533. @end example
  1534. @end itemize
  1535. @section areverse
  1536. Reverse an audio clip.
  1537. Warning: This filter requires memory to buffer the entire clip, so trimming
  1538. is suggested.
  1539. @subsection Examples
  1540. @itemize
  1541. @item
  1542. Take the first 5 seconds of a clip, and reverse it.
  1543. @example
  1544. atrim=end=5,areverse
  1545. @end example
  1546. @end itemize
  1547. @section asetnsamples
  1548. Set the number of samples per each output audio frame.
  1549. The last output packet may contain a different number of samples, as
  1550. the filter will flush all the remaining samples when the input audio
  1551. signals its end.
  1552. The filter accepts the following options:
  1553. @table @option
  1554. @item nb_out_samples, n
  1555. Set the number of frames per each output audio frame. The number is
  1556. intended as the number of samples @emph{per each channel}.
  1557. Default value is 1024.
  1558. @item pad, p
  1559. If set to 1, the filter will pad the last audio frame with zeroes, so
  1560. that the last frame will contain the same number of samples as the
  1561. previous ones. Default value is 1.
  1562. @end table
  1563. For example, to set the number of per-frame samples to 1234 and
  1564. disable padding for the last frame, use:
  1565. @example
  1566. asetnsamples=n=1234:p=0
  1567. @end example
  1568. @section asetrate
  1569. Set the sample rate without altering the PCM data.
  1570. This will result in a change of speed and pitch.
  1571. The filter accepts the following options:
  1572. @table @option
  1573. @item sample_rate, r
  1574. Set the output sample rate. Default is 44100 Hz.
  1575. @end table
  1576. @section ashowinfo
  1577. Show a line containing various information for each input audio frame.
  1578. The input audio is not modified.
  1579. The shown line contains a sequence of key/value pairs of the form
  1580. @var{key}:@var{value}.
  1581. The following values are shown in the output:
  1582. @table @option
  1583. @item n
  1584. The (sequential) number of the input frame, starting from 0.
  1585. @item pts
  1586. The presentation timestamp of the input frame, in time base units; the time base
  1587. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1588. @item pts_time
  1589. The presentation timestamp of the input frame in seconds.
  1590. @item pos
  1591. position of the frame in the input stream, -1 if this information in
  1592. unavailable and/or meaningless (for example in case of synthetic audio)
  1593. @item fmt
  1594. The sample format.
  1595. @item chlayout
  1596. The channel layout.
  1597. @item rate
  1598. The sample rate for the audio frame.
  1599. @item nb_samples
  1600. The number of samples (per channel) in the frame.
  1601. @item checksum
  1602. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1603. audio, the data is treated as if all the planes were concatenated.
  1604. @item plane_checksums
  1605. A list of Adler-32 checksums for each data plane.
  1606. @end table
  1607. @section asoftclip
  1608. Apply audio soft clipping.
  1609. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1610. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1611. This filter accepts the following options:
  1612. @table @option
  1613. @item type
  1614. Set type of soft-clipping.
  1615. It accepts the following values:
  1616. @table @option
  1617. @item tanh
  1618. @item atan
  1619. @item cubic
  1620. @item exp
  1621. @item alg
  1622. @item quintic
  1623. @item sin
  1624. @end table
  1625. @item param
  1626. Set additional parameter which controls sigmoid function.
  1627. @end table
  1628. @anchor{astats}
  1629. @section astats
  1630. Display time domain statistical information about the audio channels.
  1631. Statistics are calculated and displayed for each audio channel and,
  1632. where applicable, an overall figure is also given.
  1633. It accepts the following option:
  1634. @table @option
  1635. @item length
  1636. Short window length in seconds, used for peak and trough RMS measurement.
  1637. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1638. @item metadata
  1639. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1640. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1641. disabled.
  1642. Available keys for each channel are:
  1643. DC_offset
  1644. Min_level
  1645. Max_level
  1646. Min_difference
  1647. Max_difference
  1648. Mean_difference
  1649. RMS_difference
  1650. Peak_level
  1651. RMS_peak
  1652. RMS_trough
  1653. Crest_factor
  1654. Flat_factor
  1655. Peak_count
  1656. Bit_depth
  1657. Dynamic_range
  1658. Zero_crossings
  1659. Zero_crossings_rate
  1660. Number_of_NaNs
  1661. Number_of_Infs
  1662. Number_of_denormals
  1663. and for Overall:
  1664. DC_offset
  1665. Min_level
  1666. Max_level
  1667. Min_difference
  1668. Max_difference
  1669. Mean_difference
  1670. RMS_difference
  1671. Peak_level
  1672. RMS_level
  1673. RMS_peak
  1674. RMS_trough
  1675. Flat_factor
  1676. Peak_count
  1677. Bit_depth
  1678. Number_of_samples
  1679. Number_of_NaNs
  1680. Number_of_Infs
  1681. Number_of_denormals
  1682. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1683. this @code{lavfi.astats.Overall.Peak_count}.
  1684. For description what each key means read below.
  1685. @item reset
  1686. Set number of frame after which stats are going to be recalculated.
  1687. Default is disabled.
  1688. @item measure_perchannel
  1689. Select the entries which need to be measured per channel. The metadata keys can
  1690. be used as flags, default is @option{all} which measures everything.
  1691. @option{none} disables all per channel measurement.
  1692. @item measure_overall
  1693. Select the entries which need to be measured overall. The metadata keys can
  1694. be used as flags, default is @option{all} which measures everything.
  1695. @option{none} disables all overall measurement.
  1696. @end table
  1697. A description of each shown parameter follows:
  1698. @table @option
  1699. @item DC offset
  1700. Mean amplitude displacement from zero.
  1701. @item Min level
  1702. Minimal sample level.
  1703. @item Max level
  1704. Maximal sample level.
  1705. @item Min difference
  1706. Minimal difference between two consecutive samples.
  1707. @item Max difference
  1708. Maximal difference between two consecutive samples.
  1709. @item Mean difference
  1710. Mean difference between two consecutive samples.
  1711. The average of each difference between two consecutive samples.
  1712. @item RMS difference
  1713. Root Mean Square difference between two consecutive samples.
  1714. @item Peak level dB
  1715. @item RMS level dB
  1716. Standard peak and RMS level measured in dBFS.
  1717. @item RMS peak dB
  1718. @item RMS trough dB
  1719. Peak and trough values for RMS level measured over a short window.
  1720. @item Crest factor
  1721. Standard ratio of peak to RMS level (note: not in dB).
  1722. @item Flat factor
  1723. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1724. (i.e. either @var{Min level} or @var{Max level}).
  1725. @item Peak count
  1726. Number of occasions (not the number of samples) that the signal attained either
  1727. @var{Min level} or @var{Max level}.
  1728. @item Bit depth
  1729. Overall bit depth of audio. Number of bits used for each sample.
  1730. @item Dynamic range
  1731. Measured dynamic range of audio in dB.
  1732. @item Zero crossings
  1733. Number of points where the waveform crosses the zero level axis.
  1734. @item Zero crossings rate
  1735. Rate of Zero crossings and number of audio samples.
  1736. @end table
  1737. @section atempo
  1738. Adjust audio tempo.
  1739. The filter accepts exactly one parameter, the audio tempo. If not
  1740. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1741. be in the [0.5, 100.0] range.
  1742. Note that tempo greater than 2 will skip some samples rather than
  1743. blend them in. If for any reason this is a concern it is always
  1744. possible to daisy-chain several instances of atempo to achieve the
  1745. desired product tempo.
  1746. @subsection Examples
  1747. @itemize
  1748. @item
  1749. Slow down audio to 80% tempo:
  1750. @example
  1751. atempo=0.8
  1752. @end example
  1753. @item
  1754. To speed up audio to 300% tempo:
  1755. @example
  1756. atempo=3
  1757. @end example
  1758. @item
  1759. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1760. @example
  1761. atempo=sqrt(3),atempo=sqrt(3)
  1762. @end example
  1763. @end itemize
  1764. @section atrim
  1765. Trim the input so that the output contains one continuous subpart of the input.
  1766. It accepts the following parameters:
  1767. @table @option
  1768. @item start
  1769. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1770. sample with the timestamp @var{start} will be the first sample in the output.
  1771. @item end
  1772. Specify time of the first audio sample that will be dropped, i.e. the
  1773. audio sample immediately preceding the one with the timestamp @var{end} will be
  1774. the last sample in the output.
  1775. @item start_pts
  1776. Same as @var{start}, except this option sets the start timestamp in samples
  1777. instead of seconds.
  1778. @item end_pts
  1779. Same as @var{end}, except this option sets the end timestamp in samples instead
  1780. of seconds.
  1781. @item duration
  1782. The maximum duration of the output in seconds.
  1783. @item start_sample
  1784. The number of the first sample that should be output.
  1785. @item end_sample
  1786. The number of the first sample that should be dropped.
  1787. @end table
  1788. @option{start}, @option{end}, and @option{duration} are expressed as time
  1789. duration specifications; see
  1790. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1791. Note that the first two sets of the start/end options and the @option{duration}
  1792. option look at the frame timestamp, while the _sample options simply count the
  1793. samples that pass through the filter. So start/end_pts and start/end_sample will
  1794. give different results when the timestamps are wrong, inexact or do not start at
  1795. zero. Also note that this filter does not modify the timestamps. If you wish
  1796. to have the output timestamps start at zero, insert the asetpts filter after the
  1797. atrim filter.
  1798. If multiple start or end options are set, this filter tries to be greedy and
  1799. keep all samples that match at least one of the specified constraints. To keep
  1800. only the part that matches all the constraints at once, chain multiple atrim
  1801. filters.
  1802. The defaults are such that all the input is kept. So it is possible to set e.g.
  1803. just the end values to keep everything before the specified time.
  1804. Examples:
  1805. @itemize
  1806. @item
  1807. Drop everything except the second minute of input:
  1808. @example
  1809. ffmpeg -i INPUT -af atrim=60:120
  1810. @end example
  1811. @item
  1812. Keep only the first 1000 samples:
  1813. @example
  1814. ffmpeg -i INPUT -af atrim=end_sample=1000
  1815. @end example
  1816. @end itemize
  1817. @section bandpass
  1818. Apply a two-pole Butterworth band-pass filter with central
  1819. frequency @var{frequency}, and (3dB-point) band-width width.
  1820. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1821. instead of the default: constant 0dB peak gain.
  1822. The filter roll off at 6dB per octave (20dB per decade).
  1823. The filter accepts the following options:
  1824. @table @option
  1825. @item frequency, f
  1826. Set the filter's central frequency. Default is @code{3000}.
  1827. @item csg
  1828. Constant skirt gain if set to 1. Defaults to 0.
  1829. @item width_type, t
  1830. Set method to specify band-width of filter.
  1831. @table @option
  1832. @item h
  1833. Hz
  1834. @item q
  1835. Q-Factor
  1836. @item o
  1837. octave
  1838. @item s
  1839. slope
  1840. @item k
  1841. kHz
  1842. @end table
  1843. @item width, w
  1844. Specify the band-width of a filter in width_type units.
  1845. @item channels, c
  1846. Specify which channels to filter, by default all available are filtered.
  1847. @end table
  1848. @subsection Commands
  1849. This filter supports the following commands:
  1850. @table @option
  1851. @item frequency, f
  1852. Change bandpass frequency.
  1853. Syntax for the command is : "@var{frequency}"
  1854. @item width_type, t
  1855. Change bandpass width_type.
  1856. Syntax for the command is : "@var{width_type}"
  1857. @item width, w
  1858. Change bandpass width.
  1859. Syntax for the command is : "@var{width}"
  1860. @end table
  1861. @section bandreject
  1862. Apply a two-pole Butterworth band-reject filter with central
  1863. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1864. The filter roll off at 6dB per octave (20dB per decade).
  1865. The filter accepts the following options:
  1866. @table @option
  1867. @item frequency, f
  1868. Set the filter's central frequency. Default is @code{3000}.
  1869. @item width_type, t
  1870. Set method to specify band-width of filter.
  1871. @table @option
  1872. @item h
  1873. Hz
  1874. @item q
  1875. Q-Factor
  1876. @item o
  1877. octave
  1878. @item s
  1879. slope
  1880. @item k
  1881. kHz
  1882. @end table
  1883. @item width, w
  1884. Specify the band-width of a filter in width_type units.
  1885. @item channels, c
  1886. Specify which channels to filter, by default all available are filtered.
  1887. @end table
  1888. @subsection Commands
  1889. This filter supports the following commands:
  1890. @table @option
  1891. @item frequency, f
  1892. Change bandreject frequency.
  1893. Syntax for the command is : "@var{frequency}"
  1894. @item width_type, t
  1895. Change bandreject width_type.
  1896. Syntax for the command is : "@var{width_type}"
  1897. @item width, w
  1898. Change bandreject width.
  1899. Syntax for the command is : "@var{width}"
  1900. @end table
  1901. @section bass, lowshelf
  1902. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1903. shelving filter with a response similar to that of a standard
  1904. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1905. The filter accepts the following options:
  1906. @table @option
  1907. @item gain, g
  1908. Give the gain at 0 Hz. Its useful range is about -20
  1909. (for a large cut) to +20 (for a large boost).
  1910. Beware of clipping when using a positive gain.
  1911. @item frequency, f
  1912. Set the filter's central frequency and so can be used
  1913. to extend or reduce the frequency range to be boosted or cut.
  1914. The default value is @code{100} Hz.
  1915. @item width_type, t
  1916. Set method to specify band-width of filter.
  1917. @table @option
  1918. @item h
  1919. Hz
  1920. @item q
  1921. Q-Factor
  1922. @item o
  1923. octave
  1924. @item s
  1925. slope
  1926. @item k
  1927. kHz
  1928. @end table
  1929. @item width, w
  1930. Determine how steep is the filter's shelf transition.
  1931. @item channels, c
  1932. Specify which channels to filter, by default all available are filtered.
  1933. @end table
  1934. @subsection Commands
  1935. This filter supports the following commands:
  1936. @table @option
  1937. @item frequency, f
  1938. Change bass frequency.
  1939. Syntax for the command is : "@var{frequency}"
  1940. @item width_type, t
  1941. Change bass width_type.
  1942. Syntax for the command is : "@var{width_type}"
  1943. @item width, w
  1944. Change bass width.
  1945. Syntax for the command is : "@var{width}"
  1946. @item gain, g
  1947. Change bass gain.
  1948. Syntax for the command is : "@var{gain}"
  1949. @end table
  1950. @section biquad
  1951. Apply a biquad IIR filter with the given coefficients.
  1952. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1953. are the numerator and denominator coefficients respectively.
  1954. and @var{channels}, @var{c} specify which channels to filter, by default all
  1955. available are filtered.
  1956. @subsection Commands
  1957. This filter supports the following commands:
  1958. @table @option
  1959. @item a0
  1960. @item a1
  1961. @item a2
  1962. @item b0
  1963. @item b1
  1964. @item b2
  1965. Change biquad parameter.
  1966. Syntax for the command is : "@var{value}"
  1967. @end table
  1968. @section bs2b
  1969. Bauer stereo to binaural transformation, which improves headphone listening of
  1970. stereo audio records.
  1971. To enable compilation of this filter you need to configure FFmpeg with
  1972. @code{--enable-libbs2b}.
  1973. It accepts the following parameters:
  1974. @table @option
  1975. @item profile
  1976. Pre-defined crossfeed level.
  1977. @table @option
  1978. @item default
  1979. Default level (fcut=700, feed=50).
  1980. @item cmoy
  1981. Chu Moy circuit (fcut=700, feed=60).
  1982. @item jmeier
  1983. Jan Meier circuit (fcut=650, feed=95).
  1984. @end table
  1985. @item fcut
  1986. Cut frequency (in Hz).
  1987. @item feed
  1988. Feed level (in Hz).
  1989. @end table
  1990. @section channelmap
  1991. Remap input channels to new locations.
  1992. It accepts the following parameters:
  1993. @table @option
  1994. @item map
  1995. Map channels from input to output. The argument is a '|'-separated list of
  1996. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1997. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1998. channel (e.g. FL for front left) or its index in the input channel layout.
  1999. @var{out_channel} is the name of the output channel or its index in the output
  2000. channel layout. If @var{out_channel} is not given then it is implicitly an
  2001. index, starting with zero and increasing by one for each mapping.
  2002. @item channel_layout
  2003. The channel layout of the output stream.
  2004. @end table
  2005. If no mapping is present, the filter will implicitly map input channels to
  2006. output channels, preserving indices.
  2007. @subsection Examples
  2008. @itemize
  2009. @item
  2010. For example, assuming a 5.1+downmix input MOV file,
  2011. @example
  2012. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2013. @end example
  2014. will create an output WAV file tagged as stereo from the downmix channels of
  2015. the input.
  2016. @item
  2017. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2018. @example
  2019. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2020. @end example
  2021. @end itemize
  2022. @section channelsplit
  2023. Split each channel from an input audio stream into a separate output stream.
  2024. It accepts the following parameters:
  2025. @table @option
  2026. @item channel_layout
  2027. The channel layout of the input stream. The default is "stereo".
  2028. @item channels
  2029. A channel layout describing the channels to be extracted as separate output streams
  2030. or "all" to extract each input channel as a separate stream. The default is "all".
  2031. Choosing channels not present in channel layout in the input will result in an error.
  2032. @end table
  2033. @subsection Examples
  2034. @itemize
  2035. @item
  2036. For example, assuming a stereo input MP3 file,
  2037. @example
  2038. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2039. @end example
  2040. will create an output Matroska file with two audio streams, one containing only
  2041. the left channel and the other the right channel.
  2042. @item
  2043. Split a 5.1 WAV file into per-channel files:
  2044. @example
  2045. ffmpeg -i in.wav -filter_complex
  2046. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2047. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2048. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2049. side_right.wav
  2050. @end example
  2051. @item
  2052. Extract only LFE from a 5.1 WAV file:
  2053. @example
  2054. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2055. -map '[LFE]' lfe.wav
  2056. @end example
  2057. @end itemize
  2058. @section chorus
  2059. Add a chorus effect to the audio.
  2060. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2061. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2062. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2063. The modulation depth defines the range the modulated delay is played before or after
  2064. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2065. sound tuned around the original one, like in a chorus where some vocals are slightly
  2066. off key.
  2067. It accepts the following parameters:
  2068. @table @option
  2069. @item in_gain
  2070. Set input gain. Default is 0.4.
  2071. @item out_gain
  2072. Set output gain. Default is 0.4.
  2073. @item delays
  2074. Set delays. A typical delay is around 40ms to 60ms.
  2075. @item decays
  2076. Set decays.
  2077. @item speeds
  2078. Set speeds.
  2079. @item depths
  2080. Set depths.
  2081. @end table
  2082. @subsection Examples
  2083. @itemize
  2084. @item
  2085. A single delay:
  2086. @example
  2087. chorus=0.7:0.9:55:0.4:0.25:2
  2088. @end example
  2089. @item
  2090. Two delays:
  2091. @example
  2092. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2093. @end example
  2094. @item
  2095. Fuller sounding chorus with three delays:
  2096. @example
  2097. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  2098. @end example
  2099. @end itemize
  2100. @section compand
  2101. Compress or expand the audio's dynamic range.
  2102. It accepts the following parameters:
  2103. @table @option
  2104. @item attacks
  2105. @item decays
  2106. A list of times in seconds for each channel over which the instantaneous level
  2107. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2108. increase of volume and @var{decays} refers to decrease of volume. For most
  2109. situations, the attack time (response to the audio getting louder) should be
  2110. shorter than the decay time, because the human ear is more sensitive to sudden
  2111. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2112. a typical value for decay is 0.8 seconds.
  2113. If specified number of attacks & decays is lower than number of channels, the last
  2114. set attack/decay will be used for all remaining channels.
  2115. @item points
  2116. A list of points for the transfer function, specified in dB relative to the
  2117. maximum possible signal amplitude. Each key points list must be defined using
  2118. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2119. @code{x0/y0 x1/y1 x2/y2 ....}
  2120. The input values must be in strictly increasing order but the transfer function
  2121. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2122. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2123. function are @code{-70/-70|-60/-20|1/0}.
  2124. @item soft-knee
  2125. Set the curve radius in dB for all joints. It defaults to 0.01.
  2126. @item gain
  2127. Set the additional gain in dB to be applied at all points on the transfer
  2128. function. This allows for easy adjustment of the overall gain.
  2129. It defaults to 0.
  2130. @item volume
  2131. Set an initial volume, in dB, to be assumed for each channel when filtering
  2132. starts. This permits the user to supply a nominal level initially, so that, for
  2133. example, a very large gain is not applied to initial signal levels before the
  2134. companding has begun to operate. A typical value for audio which is initially
  2135. quiet is -90 dB. It defaults to 0.
  2136. @item delay
  2137. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2138. delayed before being fed to the volume adjuster. Specifying a delay
  2139. approximately equal to the attack/decay times allows the filter to effectively
  2140. operate in predictive rather than reactive mode. It defaults to 0.
  2141. @end table
  2142. @subsection Examples
  2143. @itemize
  2144. @item
  2145. Make music with both quiet and loud passages suitable for listening to in a
  2146. noisy environment:
  2147. @example
  2148. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2149. @end example
  2150. Another example for audio with whisper and explosion parts:
  2151. @example
  2152. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2153. @end example
  2154. @item
  2155. A noise gate for when the noise is at a lower level than the signal:
  2156. @example
  2157. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2158. @end example
  2159. @item
  2160. Here is another noise gate, this time for when the noise is at a higher level
  2161. than the signal (making it, in some ways, similar to squelch):
  2162. @example
  2163. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2164. @end example
  2165. @item
  2166. 2:1 compression starting at -6dB:
  2167. @example
  2168. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2169. @end example
  2170. @item
  2171. 2:1 compression starting at -9dB:
  2172. @example
  2173. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2174. @end example
  2175. @item
  2176. 2:1 compression starting at -12dB:
  2177. @example
  2178. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2179. @end example
  2180. @item
  2181. 2:1 compression starting at -18dB:
  2182. @example
  2183. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2184. @end example
  2185. @item
  2186. 3:1 compression starting at -15dB:
  2187. @example
  2188. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2189. @end example
  2190. @item
  2191. Compressor/Gate:
  2192. @example
  2193. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2194. @end example
  2195. @item
  2196. Expander:
  2197. @example
  2198. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  2199. @end example
  2200. @item
  2201. Hard limiter at -6dB:
  2202. @example
  2203. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2204. @end example
  2205. @item
  2206. Hard limiter at -12dB:
  2207. @example
  2208. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2209. @end example
  2210. @item
  2211. Hard noise gate at -35 dB:
  2212. @example
  2213. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2214. @end example
  2215. @item
  2216. Soft limiter:
  2217. @example
  2218. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2219. @end example
  2220. @end itemize
  2221. @section compensationdelay
  2222. Compensation Delay Line is a metric based delay to compensate differing
  2223. positions of microphones or speakers.
  2224. For example, you have recorded guitar with two microphones placed in
  2225. different location. Because the front of sound wave has fixed speed in
  2226. normal conditions, the phasing of microphones can vary and depends on
  2227. their location and interposition. The best sound mix can be achieved when
  2228. these microphones are in phase (synchronized). Note that distance of
  2229. ~30 cm between microphones makes one microphone to capture signal in
  2230. antiphase to another microphone. That makes the final mix sounding moody.
  2231. This filter helps to solve phasing problems by adding different delays
  2232. to each microphone track and make them synchronized.
  2233. The best result can be reached when you take one track as base and
  2234. synchronize other tracks one by one with it.
  2235. Remember that synchronization/delay tolerance depends on sample rate, too.
  2236. Higher sample rates will give more tolerance.
  2237. It accepts the following parameters:
  2238. @table @option
  2239. @item mm
  2240. Set millimeters distance. This is compensation distance for fine tuning.
  2241. Default is 0.
  2242. @item cm
  2243. Set cm distance. This is compensation distance for tightening distance setup.
  2244. Default is 0.
  2245. @item m
  2246. Set meters distance. This is compensation distance for hard distance setup.
  2247. Default is 0.
  2248. @item dry
  2249. Set dry amount. Amount of unprocessed (dry) signal.
  2250. Default is 0.
  2251. @item wet
  2252. Set wet amount. Amount of processed (wet) signal.
  2253. Default is 1.
  2254. @item temp
  2255. Set temperature degree in Celsius. This is the temperature of the environment.
  2256. Default is 20.
  2257. @end table
  2258. @section crossfeed
  2259. Apply headphone crossfeed filter.
  2260. Crossfeed is the process of blending the left and right channels of stereo
  2261. audio recording.
  2262. It is mainly used to reduce extreme stereo separation of low frequencies.
  2263. The intent is to produce more speaker like sound to the listener.
  2264. The filter accepts the following options:
  2265. @table @option
  2266. @item strength
  2267. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2268. This sets gain of low shelf filter for side part of stereo image.
  2269. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2270. @item range
  2271. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2272. This sets cut off frequency of low shelf filter. Default is cut off near
  2273. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2274. @item level_in
  2275. Set input gain. Default is 0.9.
  2276. @item level_out
  2277. Set output gain. Default is 1.
  2278. @end table
  2279. @section crystalizer
  2280. Simple algorithm to expand audio dynamic range.
  2281. The filter accepts the following options:
  2282. @table @option
  2283. @item i
  2284. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2285. (unchanged sound) to 10.0 (maximum effect).
  2286. @item c
  2287. Enable clipping. By default is enabled.
  2288. @end table
  2289. @section dcshift
  2290. Apply a DC shift to the audio.
  2291. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2292. in the recording chain) from the audio. The effect of a DC offset is reduced
  2293. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2294. a signal has a DC offset.
  2295. @table @option
  2296. @item shift
  2297. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2298. the audio.
  2299. @item limitergain
  2300. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2301. used to prevent clipping.
  2302. @end table
  2303. @section drmeter
  2304. Measure audio dynamic range.
  2305. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2306. is found in transition material. And anything less that 8 have very poor dynamics
  2307. and is very compressed.
  2308. The filter accepts the following options:
  2309. @table @option
  2310. @item length
  2311. Set window length in seconds used to split audio into segments of equal length.
  2312. Default is 3 seconds.
  2313. @end table
  2314. @section dynaudnorm
  2315. Dynamic Audio Normalizer.
  2316. This filter applies a certain amount of gain to the input audio in order
  2317. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2318. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2319. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2320. This allows for applying extra gain to the "quiet" sections of the audio
  2321. while avoiding distortions or clipping the "loud" sections. In other words:
  2322. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2323. sections, in the sense that the volume of each section is brought to the
  2324. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2325. this goal *without* applying "dynamic range compressing". It will retain 100%
  2326. of the dynamic range *within* each section of the audio file.
  2327. @table @option
  2328. @item f
  2329. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2330. Default is 500 milliseconds.
  2331. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2332. referred to as frames. This is required, because a peak magnitude has no
  2333. meaning for just a single sample value. Instead, we need to determine the
  2334. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2335. normalizer would simply use the peak magnitude of the complete file, the
  2336. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2337. frame. The length of a frame is specified in milliseconds. By default, the
  2338. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2339. been found to give good results with most files.
  2340. Note that the exact frame length, in number of samples, will be determined
  2341. automatically, based on the sampling rate of the individual input audio file.
  2342. @item g
  2343. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2344. number. Default is 31.
  2345. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2346. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2347. is specified in frames, centered around the current frame. For the sake of
  2348. simplicity, this must be an odd number. Consequently, the default value of 31
  2349. takes into account the current frame, as well as the 15 preceding frames and
  2350. the 15 subsequent frames. Using a larger window results in a stronger
  2351. smoothing effect and thus in less gain variation, i.e. slower gain
  2352. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2353. effect and thus in more gain variation, i.e. faster gain adaptation.
  2354. In other words, the more you increase this value, the more the Dynamic Audio
  2355. Normalizer will behave like a "traditional" normalization filter. On the
  2356. contrary, the more you decrease this value, the more the Dynamic Audio
  2357. Normalizer will behave like a dynamic range compressor.
  2358. @item p
  2359. Set the target peak value. This specifies the highest permissible magnitude
  2360. level for the normalized audio input. This filter will try to approach the
  2361. target peak magnitude as closely as possible, but at the same time it also
  2362. makes sure that the normalized signal will never exceed the peak magnitude.
  2363. A frame's maximum local gain factor is imposed directly by the target peak
  2364. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2365. It is not recommended to go above this value.
  2366. @item m
  2367. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2368. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2369. factor for each input frame, i.e. the maximum gain factor that does not
  2370. result in clipping or distortion. The maximum gain factor is determined by
  2371. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2372. additionally bounds the frame's maximum gain factor by a predetermined
  2373. (global) maximum gain factor. This is done in order to avoid excessive gain
  2374. factors in "silent" or almost silent frames. By default, the maximum gain
  2375. factor is 10.0, For most inputs the default value should be sufficient and
  2376. it usually is not recommended to increase this value. Though, for input
  2377. with an extremely low overall volume level, it may be necessary to allow even
  2378. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2379. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2380. Instead, a "sigmoid" threshold function will be applied. This way, the
  2381. gain factors will smoothly approach the threshold value, but never exceed that
  2382. value.
  2383. @item r
  2384. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2385. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2386. This means that the maximum local gain factor for each frame is defined
  2387. (only) by the frame's highest magnitude sample. This way, the samples can
  2388. be amplified as much as possible without exceeding the maximum signal
  2389. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2390. Normalizer can also take into account the frame's root mean square,
  2391. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2392. determine the power of a time-varying signal. It is therefore considered
  2393. that the RMS is a better approximation of the "perceived loudness" than
  2394. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2395. frames to a constant RMS value, a uniform "perceived loudness" can be
  2396. established. If a target RMS value has been specified, a frame's local gain
  2397. factor is defined as the factor that would result in exactly that RMS value.
  2398. Note, however, that the maximum local gain factor is still restricted by the
  2399. frame's highest magnitude sample, in order to prevent clipping.
  2400. @item n
  2401. Enable channels coupling. By default is enabled.
  2402. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2403. amount. This means the same gain factor will be applied to all channels, i.e.
  2404. the maximum possible gain factor is determined by the "loudest" channel.
  2405. However, in some recordings, it may happen that the volume of the different
  2406. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2407. In this case, this option can be used to disable the channel coupling. This way,
  2408. the gain factor will be determined independently for each channel, depending
  2409. only on the individual channel's highest magnitude sample. This allows for
  2410. harmonizing the volume of the different channels.
  2411. @item c
  2412. Enable DC bias correction. By default is disabled.
  2413. An audio signal (in the time domain) is a sequence of sample values.
  2414. In the Dynamic Audio Normalizer these sample values are represented in the
  2415. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2416. audio signal, or "waveform", should be centered around the zero point.
  2417. That means if we calculate the mean value of all samples in a file, or in a
  2418. single frame, then the result should be 0.0 or at least very close to that
  2419. value. If, however, there is a significant deviation of the mean value from
  2420. 0.0, in either positive or negative direction, this is referred to as a
  2421. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2422. Audio Normalizer provides optional DC bias correction.
  2423. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2424. the mean value, or "DC correction" offset, of each input frame and subtract
  2425. that value from all of the frame's sample values which ensures those samples
  2426. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2427. boundaries, the DC correction offset values will be interpolated smoothly
  2428. between neighbouring frames.
  2429. @item b
  2430. Enable alternative boundary mode. By default is disabled.
  2431. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2432. around each frame. This includes the preceding frames as well as the
  2433. subsequent frames. However, for the "boundary" frames, located at the very
  2434. beginning and at the very end of the audio file, not all neighbouring
  2435. frames are available. In particular, for the first few frames in the audio
  2436. file, the preceding frames are not known. And, similarly, for the last few
  2437. frames in the audio file, the subsequent frames are not known. Thus, the
  2438. question arises which gain factors should be assumed for the missing frames
  2439. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2440. to deal with this situation. The default boundary mode assumes a gain factor
  2441. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2442. "fade out" at the beginning and at the end of the input, respectively.
  2443. @item s
  2444. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2445. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2446. compression. This means that signal peaks will not be pruned and thus the
  2447. full dynamic range will be retained within each local neighbourhood. However,
  2448. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2449. normalization algorithm with a more "traditional" compression.
  2450. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2451. (thresholding) function. If (and only if) the compression feature is enabled,
  2452. all input frames will be processed by a soft knee thresholding function prior
  2453. to the actual normalization process. Put simply, the thresholding function is
  2454. going to prune all samples whose magnitude exceeds a certain threshold value.
  2455. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2456. value. Instead, the threshold value will be adjusted for each individual
  2457. frame.
  2458. In general, smaller parameters result in stronger compression, and vice versa.
  2459. Values below 3.0 are not recommended, because audible distortion may appear.
  2460. @end table
  2461. @section earwax
  2462. Make audio easier to listen to on headphones.
  2463. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2464. so that when listened to on headphones the stereo image is moved from
  2465. inside your head (standard for headphones) to outside and in front of
  2466. the listener (standard for speakers).
  2467. Ported from SoX.
  2468. @section equalizer
  2469. Apply a two-pole peaking equalisation (EQ) filter. With this
  2470. filter, the signal-level at and around a selected frequency can
  2471. be increased or decreased, whilst (unlike bandpass and bandreject
  2472. filters) that at all other frequencies is unchanged.
  2473. In order to produce complex equalisation curves, this filter can
  2474. be given several times, each with a different central frequency.
  2475. The filter accepts the following options:
  2476. @table @option
  2477. @item frequency, f
  2478. Set the filter's central frequency in Hz.
  2479. @item width_type, t
  2480. Set method to specify band-width of filter.
  2481. @table @option
  2482. @item h
  2483. Hz
  2484. @item q
  2485. Q-Factor
  2486. @item o
  2487. octave
  2488. @item s
  2489. slope
  2490. @item k
  2491. kHz
  2492. @end table
  2493. @item width, w
  2494. Specify the band-width of a filter in width_type units.
  2495. @item gain, g
  2496. Set the required gain or attenuation in dB.
  2497. Beware of clipping when using a positive gain.
  2498. @item channels, c
  2499. Specify which channels to filter, by default all available are filtered.
  2500. @end table
  2501. @subsection Examples
  2502. @itemize
  2503. @item
  2504. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2505. @example
  2506. equalizer=f=1000:t=h:width=200:g=-10
  2507. @end example
  2508. @item
  2509. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2510. @example
  2511. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2512. @end example
  2513. @end itemize
  2514. @subsection Commands
  2515. This filter supports the following commands:
  2516. @table @option
  2517. @item frequency, f
  2518. Change equalizer frequency.
  2519. Syntax for the command is : "@var{frequency}"
  2520. @item width_type, t
  2521. Change equalizer width_type.
  2522. Syntax for the command is : "@var{width_type}"
  2523. @item width, w
  2524. Change equalizer width.
  2525. Syntax for the command is : "@var{width}"
  2526. @item gain, g
  2527. Change equalizer gain.
  2528. Syntax for the command is : "@var{gain}"
  2529. @end table
  2530. @section extrastereo
  2531. Linearly increases the difference between left and right channels which
  2532. adds some sort of "live" effect to playback.
  2533. The filter accepts the following options:
  2534. @table @option
  2535. @item m
  2536. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2537. (average of both channels), with 1.0 sound will be unchanged, with
  2538. -1.0 left and right channels will be swapped.
  2539. @item c
  2540. Enable clipping. By default is enabled.
  2541. @end table
  2542. @section firequalizer
  2543. Apply FIR Equalization using arbitrary frequency response.
  2544. The filter accepts the following option:
  2545. @table @option
  2546. @item gain
  2547. Set gain curve equation (in dB). The expression can contain variables:
  2548. @table @option
  2549. @item f
  2550. the evaluated frequency
  2551. @item sr
  2552. sample rate
  2553. @item ch
  2554. channel number, set to 0 when multichannels evaluation is disabled
  2555. @item chid
  2556. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2557. multichannels evaluation is disabled
  2558. @item chs
  2559. number of channels
  2560. @item chlayout
  2561. channel_layout, see libavutil/channel_layout.h
  2562. @end table
  2563. and functions:
  2564. @table @option
  2565. @item gain_interpolate(f)
  2566. interpolate gain on frequency f based on gain_entry
  2567. @item cubic_interpolate(f)
  2568. same as gain_interpolate, but smoother
  2569. @end table
  2570. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2571. @item gain_entry
  2572. Set gain entry for gain_interpolate function. The expression can
  2573. contain functions:
  2574. @table @option
  2575. @item entry(f, g)
  2576. store gain entry at frequency f with value g
  2577. @end table
  2578. This option is also available as command.
  2579. @item delay
  2580. Set filter delay in seconds. Higher value means more accurate.
  2581. Default is @code{0.01}.
  2582. @item accuracy
  2583. Set filter accuracy in Hz. Lower value means more accurate.
  2584. Default is @code{5}.
  2585. @item wfunc
  2586. Set window function. Acceptable values are:
  2587. @table @option
  2588. @item rectangular
  2589. rectangular window, useful when gain curve is already smooth
  2590. @item hann
  2591. hann window (default)
  2592. @item hamming
  2593. hamming window
  2594. @item blackman
  2595. blackman window
  2596. @item nuttall3
  2597. 3-terms continuous 1st derivative nuttall window
  2598. @item mnuttall3
  2599. minimum 3-terms discontinuous nuttall window
  2600. @item nuttall
  2601. 4-terms continuous 1st derivative nuttall window
  2602. @item bnuttall
  2603. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2604. @item bharris
  2605. blackman-harris window
  2606. @item tukey
  2607. tukey window
  2608. @end table
  2609. @item fixed
  2610. If enabled, use fixed number of audio samples. This improves speed when
  2611. filtering with large delay. Default is disabled.
  2612. @item multi
  2613. Enable multichannels evaluation on gain. Default is disabled.
  2614. @item zero_phase
  2615. Enable zero phase mode by subtracting timestamp to compensate delay.
  2616. Default is disabled.
  2617. @item scale
  2618. Set scale used by gain. Acceptable values are:
  2619. @table @option
  2620. @item linlin
  2621. linear frequency, linear gain
  2622. @item linlog
  2623. linear frequency, logarithmic (in dB) gain (default)
  2624. @item loglin
  2625. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2626. @item loglog
  2627. logarithmic frequency, logarithmic gain
  2628. @end table
  2629. @item dumpfile
  2630. Set file for dumping, suitable for gnuplot.
  2631. @item dumpscale
  2632. Set scale for dumpfile. Acceptable values are same with scale option.
  2633. Default is linlog.
  2634. @item fft2
  2635. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2636. Default is disabled.
  2637. @item min_phase
  2638. Enable minimum phase impulse response. Default is disabled.
  2639. @end table
  2640. @subsection Examples
  2641. @itemize
  2642. @item
  2643. lowpass at 1000 Hz:
  2644. @example
  2645. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2646. @end example
  2647. @item
  2648. lowpass at 1000 Hz with gain_entry:
  2649. @example
  2650. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2651. @end example
  2652. @item
  2653. custom equalization:
  2654. @example
  2655. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2656. @end example
  2657. @item
  2658. higher delay with zero phase to compensate delay:
  2659. @example
  2660. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2661. @end example
  2662. @item
  2663. lowpass on left channel, highpass on right channel:
  2664. @example
  2665. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2666. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2667. @end example
  2668. @end itemize
  2669. @section flanger
  2670. Apply a flanging effect to the audio.
  2671. The filter accepts the following options:
  2672. @table @option
  2673. @item delay
  2674. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2675. @item depth
  2676. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2677. @item regen
  2678. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2679. Default value is 0.
  2680. @item width
  2681. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2682. Default value is 71.
  2683. @item speed
  2684. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2685. @item shape
  2686. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2687. Default value is @var{sinusoidal}.
  2688. @item phase
  2689. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2690. Default value is 25.
  2691. @item interp
  2692. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2693. Default is @var{linear}.
  2694. @end table
  2695. @section haas
  2696. Apply Haas effect to audio.
  2697. Note that this makes most sense to apply on mono signals.
  2698. With this filter applied to mono signals it give some directionality and
  2699. stretches its stereo image.
  2700. The filter accepts the following options:
  2701. @table @option
  2702. @item level_in
  2703. Set input level. By default is @var{1}, or 0dB
  2704. @item level_out
  2705. Set output level. By default is @var{1}, or 0dB.
  2706. @item side_gain
  2707. Set gain applied to side part of signal. By default is @var{1}.
  2708. @item middle_source
  2709. Set kind of middle source. Can be one of the following:
  2710. @table @samp
  2711. @item left
  2712. Pick left channel.
  2713. @item right
  2714. Pick right channel.
  2715. @item mid
  2716. Pick middle part signal of stereo image.
  2717. @item side
  2718. Pick side part signal of stereo image.
  2719. @end table
  2720. @item middle_phase
  2721. Change middle phase. By default is disabled.
  2722. @item left_delay
  2723. Set left channel delay. By default is @var{2.05} milliseconds.
  2724. @item left_balance
  2725. Set left channel balance. By default is @var{-1}.
  2726. @item left_gain
  2727. Set left channel gain. By default is @var{1}.
  2728. @item left_phase
  2729. Change left phase. By default is disabled.
  2730. @item right_delay
  2731. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2732. @item right_balance
  2733. Set right channel balance. By default is @var{1}.
  2734. @item right_gain
  2735. Set right channel gain. By default is @var{1}.
  2736. @item right_phase
  2737. Change right phase. By default is enabled.
  2738. @end table
  2739. @section hdcd
  2740. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2741. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2742. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2743. of HDCD, and detects the Transient Filter flag.
  2744. @example
  2745. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2746. @end example
  2747. When using the filter with wav, note the default encoding for wav is 16-bit,
  2748. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2749. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2750. @example
  2751. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2752. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2753. @end example
  2754. The filter accepts the following options:
  2755. @table @option
  2756. @item disable_autoconvert
  2757. Disable any automatic format conversion or resampling in the filter graph.
  2758. @item process_stereo
  2759. Process the stereo channels together. If target_gain does not match between
  2760. channels, consider it invalid and use the last valid target_gain.
  2761. @item cdt_ms
  2762. Set the code detect timer period in ms.
  2763. @item force_pe
  2764. Always extend peaks above -3dBFS even if PE isn't signaled.
  2765. @item analyze_mode
  2766. Replace audio with a solid tone and adjust the amplitude to signal some
  2767. specific aspect of the decoding process. The output file can be loaded in
  2768. an audio editor alongside the original to aid analysis.
  2769. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2770. Modes are:
  2771. @table @samp
  2772. @item 0, off
  2773. Disabled
  2774. @item 1, lle
  2775. Gain adjustment level at each sample
  2776. @item 2, pe
  2777. Samples where peak extend occurs
  2778. @item 3, cdt
  2779. Samples where the code detect timer is active
  2780. @item 4, tgm
  2781. Samples where the target gain does not match between channels
  2782. @end table
  2783. @end table
  2784. @section headphone
  2785. Apply head-related transfer functions (HRTFs) to create virtual
  2786. loudspeakers around the user for binaural listening via headphones.
  2787. The HRIRs are provided via additional streams, for each channel
  2788. one stereo input stream is needed.
  2789. The filter accepts the following options:
  2790. @table @option
  2791. @item map
  2792. Set mapping of input streams for convolution.
  2793. The argument is a '|'-separated list of channel names in order as they
  2794. are given as additional stream inputs for filter.
  2795. This also specify number of input streams. Number of input streams
  2796. must be not less than number of channels in first stream plus one.
  2797. @item gain
  2798. Set gain applied to audio. Value is in dB. Default is 0.
  2799. @item type
  2800. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2801. processing audio in time domain which is slow.
  2802. @var{freq} is processing audio in frequency domain which is fast.
  2803. Default is @var{freq}.
  2804. @item lfe
  2805. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2806. @item size
  2807. Set size of frame in number of samples which will be processed at once.
  2808. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2809. @item hrir
  2810. Set format of hrir stream.
  2811. Default value is @var{stereo}. Alternative value is @var{multich}.
  2812. If value is set to @var{stereo}, number of additional streams should
  2813. be greater or equal to number of input channels in first input stream.
  2814. Also each additional stream should have stereo number of channels.
  2815. If value is set to @var{multich}, number of additional streams should
  2816. be exactly one. Also number of input channels of additional stream
  2817. should be equal or greater than twice number of channels of first input
  2818. stream.
  2819. @end table
  2820. @subsection Examples
  2821. @itemize
  2822. @item
  2823. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2824. each amovie filter use stereo file with IR coefficients as input.
  2825. The files give coefficients for each position of virtual loudspeaker:
  2826. @example
  2827. ffmpeg -i input.wav
  2828. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2829. output.wav
  2830. @end example
  2831. @item
  2832. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2833. but now in @var{multich} @var{hrir} format.
  2834. @example
  2835. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2836. output.wav
  2837. @end example
  2838. @end itemize
  2839. @section highpass
  2840. Apply a high-pass filter with 3dB point frequency.
  2841. The filter can be either single-pole, or double-pole (the default).
  2842. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2843. The filter accepts the following options:
  2844. @table @option
  2845. @item frequency, f
  2846. Set frequency in Hz. Default is 3000.
  2847. @item poles, p
  2848. Set number of poles. Default is 2.
  2849. @item width_type, t
  2850. Set method to specify band-width of filter.
  2851. @table @option
  2852. @item h
  2853. Hz
  2854. @item q
  2855. Q-Factor
  2856. @item o
  2857. octave
  2858. @item s
  2859. slope
  2860. @item k
  2861. kHz
  2862. @end table
  2863. @item width, w
  2864. Specify the band-width of a filter in width_type units.
  2865. Applies only to double-pole filter.
  2866. The default is 0.707q and gives a Butterworth response.
  2867. @item channels, c
  2868. Specify which channels to filter, by default all available are filtered.
  2869. @end table
  2870. @subsection Commands
  2871. This filter supports the following commands:
  2872. @table @option
  2873. @item frequency, f
  2874. Change highpass frequency.
  2875. Syntax for the command is : "@var{frequency}"
  2876. @item width_type, t
  2877. Change highpass width_type.
  2878. Syntax for the command is : "@var{width_type}"
  2879. @item width, w
  2880. Change highpass width.
  2881. Syntax for the command is : "@var{width}"
  2882. @end table
  2883. @section join
  2884. Join multiple input streams into one multi-channel stream.
  2885. It accepts the following parameters:
  2886. @table @option
  2887. @item inputs
  2888. The number of input streams. It defaults to 2.
  2889. @item channel_layout
  2890. The desired output channel layout. It defaults to stereo.
  2891. @item map
  2892. Map channels from inputs to output. The argument is a '|'-separated list of
  2893. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2894. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2895. can be either the name of the input channel (e.g. FL for front left) or its
  2896. index in the specified input stream. @var{out_channel} is the name of the output
  2897. channel.
  2898. @end table
  2899. The filter will attempt to guess the mappings when they are not specified
  2900. explicitly. It does so by first trying to find an unused matching input channel
  2901. and if that fails it picks the first unused input channel.
  2902. Join 3 inputs (with properly set channel layouts):
  2903. @example
  2904. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2905. @end example
  2906. Build a 5.1 output from 6 single-channel streams:
  2907. @example
  2908. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2909. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2910. out
  2911. @end example
  2912. @section ladspa
  2913. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2914. To enable compilation of this filter you need to configure FFmpeg with
  2915. @code{--enable-ladspa}.
  2916. @table @option
  2917. @item file, f
  2918. Specifies the name of LADSPA plugin library to load. If the environment
  2919. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2920. each one of the directories specified by the colon separated list in
  2921. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2922. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2923. @file{/usr/lib/ladspa/}.
  2924. @item plugin, p
  2925. Specifies the plugin within the library. Some libraries contain only
  2926. one plugin, but others contain many of them. If this is not set filter
  2927. will list all available plugins within the specified library.
  2928. @item controls, c
  2929. Set the '|' separated list of controls which are zero or more floating point
  2930. values that determine the behavior of the loaded plugin (for example delay,
  2931. threshold or gain).
  2932. Controls need to be defined using the following syntax:
  2933. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2934. @var{valuei} is the value set on the @var{i}-th control.
  2935. Alternatively they can be also defined using the following syntax:
  2936. @var{value0}|@var{value1}|@var{value2}|..., where
  2937. @var{valuei} is the value set on the @var{i}-th control.
  2938. If @option{controls} is set to @code{help}, all available controls and
  2939. their valid ranges are printed.
  2940. @item sample_rate, s
  2941. Specify the sample rate, default to 44100. Only used if plugin have
  2942. zero inputs.
  2943. @item nb_samples, n
  2944. Set the number of samples per channel per each output frame, default
  2945. is 1024. Only used if plugin have zero inputs.
  2946. @item duration, d
  2947. Set the minimum duration of the sourced audio. See
  2948. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2949. for the accepted syntax.
  2950. Note that the resulting duration may be greater than the specified duration,
  2951. as the generated audio is always cut at the end of a complete frame.
  2952. If not specified, or the expressed duration is negative, the audio is
  2953. supposed to be generated forever.
  2954. Only used if plugin have zero inputs.
  2955. @end table
  2956. @subsection Examples
  2957. @itemize
  2958. @item
  2959. List all available plugins within amp (LADSPA example plugin) library:
  2960. @example
  2961. ladspa=file=amp
  2962. @end example
  2963. @item
  2964. List all available controls and their valid ranges for @code{vcf_notch}
  2965. plugin from @code{VCF} library:
  2966. @example
  2967. ladspa=f=vcf:p=vcf_notch:c=help
  2968. @end example
  2969. @item
  2970. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2971. plugin library:
  2972. @example
  2973. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2974. @end example
  2975. @item
  2976. Add reverberation to the audio using TAP-plugins
  2977. (Tom's Audio Processing plugins):
  2978. @example
  2979. ladspa=file=tap_reverb:tap_reverb
  2980. @end example
  2981. @item
  2982. Generate white noise, with 0.2 amplitude:
  2983. @example
  2984. ladspa=file=cmt:noise_source_white:c=c0=.2
  2985. @end example
  2986. @item
  2987. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2988. @code{C* Audio Plugin Suite} (CAPS) library:
  2989. @example
  2990. ladspa=file=caps:Click:c=c1=20'
  2991. @end example
  2992. @item
  2993. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2994. @example
  2995. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2996. @end example
  2997. @item
  2998. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2999. @code{SWH Plugins} collection:
  3000. @example
  3001. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3002. @end example
  3003. @item
  3004. Attenuate low frequencies using Multiband EQ from Steve Harris
  3005. @code{SWH Plugins} collection:
  3006. @example
  3007. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3008. @end example
  3009. @item
  3010. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3011. (CAPS) library:
  3012. @example
  3013. ladspa=caps:Narrower
  3014. @end example
  3015. @item
  3016. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3017. @example
  3018. ladspa=caps:White:.2
  3019. @end example
  3020. @item
  3021. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3022. @example
  3023. ladspa=caps:Fractal:c=c1=1
  3024. @end example
  3025. @item
  3026. Dynamic volume normalization using @code{VLevel} plugin:
  3027. @example
  3028. ladspa=vlevel-ladspa:vlevel_mono
  3029. @end example
  3030. @end itemize
  3031. @subsection Commands
  3032. This filter supports the following commands:
  3033. @table @option
  3034. @item cN
  3035. Modify the @var{N}-th control value.
  3036. If the specified value is not valid, it is ignored and prior one is kept.
  3037. @end table
  3038. @section loudnorm
  3039. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3040. Support for both single pass (livestreams, files) and double pass (files) modes.
  3041. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3042. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3043. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3044. The filter accepts the following options:
  3045. @table @option
  3046. @item I, i
  3047. Set integrated loudness target.
  3048. Range is -70.0 - -5.0. Default value is -24.0.
  3049. @item LRA, lra
  3050. Set loudness range target.
  3051. Range is 1.0 - 20.0. Default value is 7.0.
  3052. @item TP, tp
  3053. Set maximum true peak.
  3054. Range is -9.0 - +0.0. Default value is -2.0.
  3055. @item measured_I, measured_i
  3056. Measured IL of input file.
  3057. Range is -99.0 - +0.0.
  3058. @item measured_LRA, measured_lra
  3059. Measured LRA of input file.
  3060. Range is 0.0 - 99.0.
  3061. @item measured_TP, measured_tp
  3062. Measured true peak of input file.
  3063. Range is -99.0 - +99.0.
  3064. @item measured_thresh
  3065. Measured threshold of input file.
  3066. Range is -99.0 - +0.0.
  3067. @item offset
  3068. Set offset gain. Gain is applied before the true-peak limiter.
  3069. Range is -99.0 - +99.0. Default is +0.0.
  3070. @item linear
  3071. Normalize linearly if possible.
  3072. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3073. to be specified in order to use this mode.
  3074. Options are true or false. Default is true.
  3075. @item dual_mono
  3076. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3077. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3078. If set to @code{true}, this option will compensate for this effect.
  3079. Multi-channel input files are not affected by this option.
  3080. Options are true or false. Default is false.
  3081. @item print_format
  3082. Set print format for stats. Options are summary, json, or none.
  3083. Default value is none.
  3084. @end table
  3085. @section lowpass
  3086. Apply a low-pass filter with 3dB point frequency.
  3087. The filter can be either single-pole or double-pole (the default).
  3088. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3089. The filter accepts the following options:
  3090. @table @option
  3091. @item frequency, f
  3092. Set frequency in Hz. Default is 500.
  3093. @item poles, p
  3094. Set number of poles. Default is 2.
  3095. @item width_type, t
  3096. Set method to specify band-width of filter.
  3097. @table @option
  3098. @item h
  3099. Hz
  3100. @item q
  3101. Q-Factor
  3102. @item o
  3103. octave
  3104. @item s
  3105. slope
  3106. @item k
  3107. kHz
  3108. @end table
  3109. @item width, w
  3110. Specify the band-width of a filter in width_type units.
  3111. Applies only to double-pole filter.
  3112. The default is 0.707q and gives a Butterworth response.
  3113. @item channels, c
  3114. Specify which channels to filter, by default all available are filtered.
  3115. @end table
  3116. @subsection Examples
  3117. @itemize
  3118. @item
  3119. Lowpass only LFE channel, it LFE is not present it does nothing:
  3120. @example
  3121. lowpass=c=LFE
  3122. @end example
  3123. @end itemize
  3124. @subsection Commands
  3125. This filter supports the following commands:
  3126. @table @option
  3127. @item frequency, f
  3128. Change lowpass frequency.
  3129. Syntax for the command is : "@var{frequency}"
  3130. @item width_type, t
  3131. Change lowpass width_type.
  3132. Syntax for the command is : "@var{width_type}"
  3133. @item width, w
  3134. Change lowpass width.
  3135. Syntax for the command is : "@var{width}"
  3136. @end table
  3137. @section lv2
  3138. Load a LV2 (LADSPA Version 2) plugin.
  3139. To enable compilation of this filter you need to configure FFmpeg with
  3140. @code{--enable-lv2}.
  3141. @table @option
  3142. @item plugin, p
  3143. Specifies the plugin URI. You may need to escape ':'.
  3144. @item controls, c
  3145. Set the '|' separated list of controls which are zero or more floating point
  3146. values that determine the behavior of the loaded plugin (for example delay,
  3147. threshold or gain).
  3148. If @option{controls} is set to @code{help}, all available controls and
  3149. their valid ranges are printed.
  3150. @item sample_rate, s
  3151. Specify the sample rate, default to 44100. Only used if plugin have
  3152. zero inputs.
  3153. @item nb_samples, n
  3154. Set the number of samples per channel per each output frame, default
  3155. is 1024. Only used if plugin have zero inputs.
  3156. @item duration, d
  3157. Set the minimum duration of the sourced audio. See
  3158. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3159. for the accepted syntax.
  3160. Note that the resulting duration may be greater than the specified duration,
  3161. as the generated audio is always cut at the end of a complete frame.
  3162. If not specified, or the expressed duration is negative, the audio is
  3163. supposed to be generated forever.
  3164. Only used if plugin have zero inputs.
  3165. @end table
  3166. @subsection Examples
  3167. @itemize
  3168. @item
  3169. Apply bass enhancer plugin from Calf:
  3170. @example
  3171. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3172. @end example
  3173. @item
  3174. Apply vinyl plugin from Calf:
  3175. @example
  3176. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3177. @end example
  3178. @item
  3179. Apply bit crusher plugin from ArtyFX:
  3180. @example
  3181. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3182. @end example
  3183. @end itemize
  3184. @section mcompand
  3185. Multiband Compress or expand the audio's dynamic range.
  3186. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3187. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3188. response when absent compander action.
  3189. It accepts the following parameters:
  3190. @table @option
  3191. @item args
  3192. This option syntax is:
  3193. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3194. For explanation of each item refer to compand filter documentation.
  3195. @end table
  3196. @anchor{pan}
  3197. @section pan
  3198. Mix channels with specific gain levels. The filter accepts the output
  3199. channel layout followed by a set of channels definitions.
  3200. This filter is also designed to efficiently remap the channels of an audio
  3201. stream.
  3202. The filter accepts parameters of the form:
  3203. "@var{l}|@var{outdef}|@var{outdef}|..."
  3204. @table @option
  3205. @item l
  3206. output channel layout or number of channels
  3207. @item outdef
  3208. output channel specification, of the form:
  3209. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3210. @item out_name
  3211. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3212. number (c0, c1, etc.)
  3213. @item gain
  3214. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3215. @item in_name
  3216. input channel to use, see out_name for details; it is not possible to mix
  3217. named and numbered input channels
  3218. @end table
  3219. If the `=' in a channel specification is replaced by `<', then the gains for
  3220. that specification will be renormalized so that the total is 1, thus
  3221. avoiding clipping noise.
  3222. @subsection Mixing examples
  3223. For example, if you want to down-mix from stereo to mono, but with a bigger
  3224. factor for the left channel:
  3225. @example
  3226. pan=1c|c0=0.9*c0+0.1*c1
  3227. @end example
  3228. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3229. 7-channels surround:
  3230. @example
  3231. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3232. @end example
  3233. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3234. that should be preferred (see "-ac" option) unless you have very specific
  3235. needs.
  3236. @subsection Remapping examples
  3237. The channel remapping will be effective if, and only if:
  3238. @itemize
  3239. @item gain coefficients are zeroes or ones,
  3240. @item only one input per channel output,
  3241. @end itemize
  3242. If all these conditions are satisfied, the filter will notify the user ("Pure
  3243. channel mapping detected"), and use an optimized and lossless method to do the
  3244. remapping.
  3245. For example, if you have a 5.1 source and want a stereo audio stream by
  3246. dropping the extra channels:
  3247. @example
  3248. pan="stereo| c0=FL | c1=FR"
  3249. @end example
  3250. Given the same source, you can also switch front left and front right channels
  3251. and keep the input channel layout:
  3252. @example
  3253. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3254. @end example
  3255. If the input is a stereo audio stream, you can mute the front left channel (and
  3256. still keep the stereo channel layout) with:
  3257. @example
  3258. pan="stereo|c1=c1"
  3259. @end example
  3260. Still with a stereo audio stream input, you can copy the right channel in both
  3261. front left and right:
  3262. @example
  3263. pan="stereo| c0=FR | c1=FR"
  3264. @end example
  3265. @section replaygain
  3266. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3267. outputs it unchanged.
  3268. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3269. @section resample
  3270. Convert the audio sample format, sample rate and channel layout. It is
  3271. not meant to be used directly.
  3272. @section rubberband
  3273. Apply time-stretching and pitch-shifting with librubberband.
  3274. To enable compilation of this filter, you need to configure FFmpeg with
  3275. @code{--enable-librubberband}.
  3276. The filter accepts the following options:
  3277. @table @option
  3278. @item tempo
  3279. Set tempo scale factor.
  3280. @item pitch
  3281. Set pitch scale factor.
  3282. @item transients
  3283. Set transients detector.
  3284. Possible values are:
  3285. @table @var
  3286. @item crisp
  3287. @item mixed
  3288. @item smooth
  3289. @end table
  3290. @item detector
  3291. Set detector.
  3292. Possible values are:
  3293. @table @var
  3294. @item compound
  3295. @item percussive
  3296. @item soft
  3297. @end table
  3298. @item phase
  3299. Set phase.
  3300. Possible values are:
  3301. @table @var
  3302. @item laminar
  3303. @item independent
  3304. @end table
  3305. @item window
  3306. Set processing window size.
  3307. Possible values are:
  3308. @table @var
  3309. @item standard
  3310. @item short
  3311. @item long
  3312. @end table
  3313. @item smoothing
  3314. Set smoothing.
  3315. Possible values are:
  3316. @table @var
  3317. @item off
  3318. @item on
  3319. @end table
  3320. @item formant
  3321. Enable formant preservation when shift pitching.
  3322. Possible values are:
  3323. @table @var
  3324. @item shifted
  3325. @item preserved
  3326. @end table
  3327. @item pitchq
  3328. Set pitch quality.
  3329. Possible values are:
  3330. @table @var
  3331. @item quality
  3332. @item speed
  3333. @item consistency
  3334. @end table
  3335. @item channels
  3336. Set channels.
  3337. Possible values are:
  3338. @table @var
  3339. @item apart
  3340. @item together
  3341. @end table
  3342. @end table
  3343. @section sidechaincompress
  3344. This filter acts like normal compressor but has the ability to compress
  3345. detected signal using second input signal.
  3346. It needs two input streams and returns one output stream.
  3347. First input stream will be processed depending on second stream signal.
  3348. The filtered signal then can be filtered with other filters in later stages of
  3349. processing. See @ref{pan} and @ref{amerge} filter.
  3350. The filter accepts the following options:
  3351. @table @option
  3352. @item level_in
  3353. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3354. @item mode
  3355. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3356. Default is @code{downward}.
  3357. @item threshold
  3358. If a signal of second stream raises above this level it will affect the gain
  3359. reduction of first stream.
  3360. By default is 0.125. Range is between 0.00097563 and 1.
  3361. @item ratio
  3362. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3363. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3364. Default is 2. Range is between 1 and 20.
  3365. @item attack
  3366. Amount of milliseconds the signal has to rise above the threshold before gain
  3367. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3368. @item release
  3369. Amount of milliseconds the signal has to fall below the threshold before
  3370. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3371. @item makeup
  3372. Set the amount by how much signal will be amplified after processing.
  3373. Default is 1. Range is from 1 to 64.
  3374. @item knee
  3375. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3376. Default is 2.82843. Range is between 1 and 8.
  3377. @item link
  3378. Choose if the @code{average} level between all channels of side-chain stream
  3379. or the louder(@code{maximum}) channel of side-chain stream affects the
  3380. reduction. Default is @code{average}.
  3381. @item detection
  3382. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3383. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3384. @item level_sc
  3385. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3386. @item mix
  3387. How much to use compressed signal in output. Default is 1.
  3388. Range is between 0 and 1.
  3389. @end table
  3390. @subsection Examples
  3391. @itemize
  3392. @item
  3393. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3394. depending on the signal of 2nd input and later compressed signal to be
  3395. merged with 2nd input:
  3396. @example
  3397. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3398. @end example
  3399. @end itemize
  3400. @section sidechaingate
  3401. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3402. filter the detected signal before sending it to the gain reduction stage.
  3403. Normally a gate uses the full range signal to detect a level above the
  3404. threshold.
  3405. For example: If you cut all lower frequencies from your sidechain signal
  3406. the gate will decrease the volume of your track only if not enough highs
  3407. appear. With this technique you are able to reduce the resonation of a
  3408. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3409. guitar.
  3410. It needs two input streams and returns one output stream.
  3411. First input stream will be processed depending on second stream signal.
  3412. The filter accepts the following options:
  3413. @table @option
  3414. @item level_in
  3415. Set input level before filtering.
  3416. Default is 1. Allowed range is from 0.015625 to 64.
  3417. @item mode
  3418. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3419. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3420. will be amplified, expanding dynamic range in upward direction.
  3421. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3422. @item range
  3423. Set the level of gain reduction when the signal is below the threshold.
  3424. Default is 0.06125. Allowed range is from 0 to 1.
  3425. Setting this to 0 disables reduction and then filter behaves like expander.
  3426. @item threshold
  3427. If a signal rises above this level the gain reduction is released.
  3428. Default is 0.125. Allowed range is from 0 to 1.
  3429. @item ratio
  3430. Set a ratio about which the signal is reduced.
  3431. Default is 2. Allowed range is from 1 to 9000.
  3432. @item attack
  3433. Amount of milliseconds the signal has to rise above the threshold before gain
  3434. reduction stops.
  3435. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3436. @item release
  3437. Amount of milliseconds the signal has to fall below the threshold before the
  3438. reduction is increased again. Default is 250 milliseconds.
  3439. Allowed range is from 0.01 to 9000.
  3440. @item makeup
  3441. Set amount of amplification of signal after processing.
  3442. Default is 1. Allowed range is from 1 to 64.
  3443. @item knee
  3444. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3445. Default is 2.828427125. Allowed range is from 1 to 8.
  3446. @item detection
  3447. Choose if exact signal should be taken for detection or an RMS like one.
  3448. Default is rms. Can be peak or rms.
  3449. @item link
  3450. Choose if the average level between all channels or the louder channel affects
  3451. the reduction.
  3452. Default is average. Can be average or maximum.
  3453. @item level_sc
  3454. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3455. @end table
  3456. @section silencedetect
  3457. Detect silence in an audio stream.
  3458. This filter logs a message when it detects that the input audio volume is less
  3459. or equal to a noise tolerance value for a duration greater or equal to the
  3460. minimum detected noise duration.
  3461. The printed times and duration are expressed in seconds.
  3462. The filter accepts the following options:
  3463. @table @option
  3464. @item noise, n
  3465. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3466. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3467. @item duration, d
  3468. Set silence duration until notification (default is 2 seconds).
  3469. @item mono, m
  3470. Process each channel separately, instead of combined. By default is disabled.
  3471. @end table
  3472. @subsection Examples
  3473. @itemize
  3474. @item
  3475. Detect 5 seconds of silence with -50dB noise tolerance:
  3476. @example
  3477. silencedetect=n=-50dB:d=5
  3478. @end example
  3479. @item
  3480. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3481. tolerance in @file{silence.mp3}:
  3482. @example
  3483. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3484. @end example
  3485. @end itemize
  3486. @section silenceremove
  3487. Remove silence from the beginning, middle or end of the audio.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item start_periods
  3491. This value is used to indicate if audio should be trimmed at beginning of
  3492. the audio. A value of zero indicates no silence should be trimmed from the
  3493. beginning. When specifying a non-zero value, it trims audio up until it
  3494. finds non-silence. Normally, when trimming silence from beginning of audio
  3495. the @var{start_periods} will be @code{1} but it can be increased to higher
  3496. values to trim all audio up to specific count of non-silence periods.
  3497. Default value is @code{0}.
  3498. @item start_duration
  3499. Specify the amount of time that non-silence must be detected before it stops
  3500. trimming audio. By increasing the duration, bursts of noises can be treated
  3501. as silence and trimmed off. Default value is @code{0}.
  3502. @item start_threshold
  3503. This indicates what sample value should be treated as silence. For digital
  3504. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3505. you may wish to increase the value to account for background noise.
  3506. Can be specified in dB (in case "dB" is appended to the specified value)
  3507. or amplitude ratio. Default value is @code{0}.
  3508. @item start_silence
  3509. Specify max duration of silence at beginning that will be kept after
  3510. trimming. Default is 0, which is equal to trimming all samples detected
  3511. as silence.
  3512. @item start_mode
  3513. Specify mode of detection of silence end in start of multi-channel audio.
  3514. Can be @var{any} or @var{all}. Default is @var{any}.
  3515. With @var{any}, any sample that is detected as non-silence will cause
  3516. stopped trimming of silence.
  3517. With @var{all}, only if all channels are detected as non-silence will cause
  3518. stopped trimming of silence.
  3519. @item stop_periods
  3520. Set the count for trimming silence from the end of audio.
  3521. To remove silence from the middle of a file, specify a @var{stop_periods}
  3522. that is negative. This value is then treated as a positive value and is
  3523. used to indicate the effect should restart processing as specified by
  3524. @var{start_periods}, making it suitable for removing periods of silence
  3525. in the middle of the audio.
  3526. Default value is @code{0}.
  3527. @item stop_duration
  3528. Specify a duration of silence that must exist before audio is not copied any
  3529. more. By specifying a higher duration, silence that is wanted can be left in
  3530. the audio.
  3531. Default value is @code{0}.
  3532. @item stop_threshold
  3533. This is the same as @option{start_threshold} but for trimming silence from
  3534. the end of audio.
  3535. Can be specified in dB (in case "dB" is appended to the specified value)
  3536. or amplitude ratio. Default value is @code{0}.
  3537. @item stop_silence
  3538. Specify max duration of silence at end that will be kept after
  3539. trimming. Default is 0, which is equal to trimming all samples detected
  3540. as silence.
  3541. @item stop_mode
  3542. Specify mode of detection of silence start in end of multi-channel audio.
  3543. Can be @var{any} or @var{all}. Default is @var{any}.
  3544. With @var{any}, any sample that is detected as non-silence will cause
  3545. stopped trimming of silence.
  3546. With @var{all}, only if all channels are detected as non-silence will cause
  3547. stopped trimming of silence.
  3548. @item detection
  3549. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3550. and works better with digital silence which is exactly 0.
  3551. Default value is @code{rms}.
  3552. @item window
  3553. Set duration in number of seconds used to calculate size of window in number
  3554. of samples for detecting silence.
  3555. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3556. @end table
  3557. @subsection Examples
  3558. @itemize
  3559. @item
  3560. The following example shows how this filter can be used to start a recording
  3561. that does not contain the delay at the start which usually occurs between
  3562. pressing the record button and the start of the performance:
  3563. @example
  3564. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3565. @end example
  3566. @item
  3567. Trim all silence encountered from beginning to end where there is more than 1
  3568. second of silence in audio:
  3569. @example
  3570. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3571. @end example
  3572. @end itemize
  3573. @section sofalizer
  3574. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3575. loudspeakers around the user for binaural listening via headphones (audio
  3576. formats up to 9 channels supported).
  3577. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3578. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3579. Austrian Academy of Sciences.
  3580. To enable compilation of this filter you need to configure FFmpeg with
  3581. @code{--enable-libmysofa}.
  3582. The filter accepts the following options:
  3583. @table @option
  3584. @item sofa
  3585. Set the SOFA file used for rendering.
  3586. @item gain
  3587. Set gain applied to audio. Value is in dB. Default is 0.
  3588. @item rotation
  3589. Set rotation of virtual loudspeakers in deg. Default is 0.
  3590. @item elevation
  3591. Set elevation of virtual speakers in deg. Default is 0.
  3592. @item radius
  3593. Set distance in meters between loudspeakers and the listener with near-field
  3594. HRTFs. Default is 1.
  3595. @item type
  3596. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3597. processing audio in time domain which is slow.
  3598. @var{freq} is processing audio in frequency domain which is fast.
  3599. Default is @var{freq}.
  3600. @item speakers
  3601. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3602. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3603. Each virtual loudspeaker is described with short channel name following with
  3604. azimuth and elevation in degrees.
  3605. Each virtual loudspeaker description is separated by '|'.
  3606. For example to override front left and front right channel positions use:
  3607. 'speakers=FL 45 15|FR 345 15'.
  3608. Descriptions with unrecognised channel names are ignored.
  3609. @item lfegain
  3610. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3611. @item framesize
  3612. Set custom frame size in number of samples. Default is 1024.
  3613. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3614. is set to @var{freq}.
  3615. @item normalize
  3616. Should all IRs be normalized upon importing SOFA file.
  3617. By default is enabled.
  3618. @item interpolate
  3619. Should nearest IRs be interpolated with neighbor IRs if exact position
  3620. does not match. By default is disabled.
  3621. @item minphase
  3622. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3623. @item anglestep
  3624. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3625. @item radstep
  3626. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3627. @end table
  3628. @subsection Examples
  3629. @itemize
  3630. @item
  3631. Using ClubFritz6 sofa file:
  3632. @example
  3633. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3634. @end example
  3635. @item
  3636. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3637. @example
  3638. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3639. @end example
  3640. @item
  3641. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3642. and also with custom gain:
  3643. @example
  3644. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3645. @end example
  3646. @end itemize
  3647. @section stereotools
  3648. This filter has some handy utilities to manage stereo signals, for converting
  3649. M/S stereo recordings to L/R signal while having control over the parameters
  3650. or spreading the stereo image of master track.
  3651. The filter accepts the following options:
  3652. @table @option
  3653. @item level_in
  3654. Set input level before filtering for both channels. Defaults is 1.
  3655. Allowed range is from 0.015625 to 64.
  3656. @item level_out
  3657. Set output level after filtering for both channels. Defaults is 1.
  3658. Allowed range is from 0.015625 to 64.
  3659. @item balance_in
  3660. Set input balance between both channels. Default is 0.
  3661. Allowed range is from -1 to 1.
  3662. @item balance_out
  3663. Set output balance between both channels. Default is 0.
  3664. Allowed range is from -1 to 1.
  3665. @item softclip
  3666. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3667. clipping. Disabled by default.
  3668. @item mutel
  3669. Mute the left channel. Disabled by default.
  3670. @item muter
  3671. Mute the right channel. Disabled by default.
  3672. @item phasel
  3673. Change the phase of the left channel. Disabled by default.
  3674. @item phaser
  3675. Change the phase of the right channel. Disabled by default.
  3676. @item mode
  3677. Set stereo mode. Available values are:
  3678. @table @samp
  3679. @item lr>lr
  3680. Left/Right to Left/Right, this is default.
  3681. @item lr>ms
  3682. Left/Right to Mid/Side.
  3683. @item ms>lr
  3684. Mid/Side to Left/Right.
  3685. @item lr>ll
  3686. Left/Right to Left/Left.
  3687. @item lr>rr
  3688. Left/Right to Right/Right.
  3689. @item lr>l+r
  3690. Left/Right to Left + Right.
  3691. @item lr>rl
  3692. Left/Right to Right/Left.
  3693. @item ms>ll
  3694. Mid/Side to Left/Left.
  3695. @item ms>rr
  3696. Mid/Side to Right/Right.
  3697. @end table
  3698. @item slev
  3699. Set level of side signal. Default is 1.
  3700. Allowed range is from 0.015625 to 64.
  3701. @item sbal
  3702. Set balance of side signal. Default is 0.
  3703. Allowed range is from -1 to 1.
  3704. @item mlev
  3705. Set level of the middle signal. Default is 1.
  3706. Allowed range is from 0.015625 to 64.
  3707. @item mpan
  3708. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3709. @item base
  3710. Set stereo base between mono and inversed channels. Default is 0.
  3711. Allowed range is from -1 to 1.
  3712. @item delay
  3713. Set delay in milliseconds how much to delay left from right channel and
  3714. vice versa. Default is 0. Allowed range is from -20 to 20.
  3715. @item sclevel
  3716. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3717. @item phase
  3718. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3719. @item bmode_in, bmode_out
  3720. Set balance mode for balance_in/balance_out option.
  3721. Can be one of the following:
  3722. @table @samp
  3723. @item balance
  3724. Classic balance mode. Attenuate one channel at time.
  3725. Gain is raised up to 1.
  3726. @item amplitude
  3727. Similar as classic mode above but gain is raised up to 2.
  3728. @item power
  3729. Equal power distribution, from -6dB to +6dB range.
  3730. @end table
  3731. @end table
  3732. @subsection Examples
  3733. @itemize
  3734. @item
  3735. Apply karaoke like effect:
  3736. @example
  3737. stereotools=mlev=0.015625
  3738. @end example
  3739. @item
  3740. Convert M/S signal to L/R:
  3741. @example
  3742. "stereotools=mode=ms>lr"
  3743. @end example
  3744. @end itemize
  3745. @section stereowiden
  3746. This filter enhance the stereo effect by suppressing signal common to both
  3747. channels and by delaying the signal of left into right and vice versa,
  3748. thereby widening the stereo effect.
  3749. The filter accepts the following options:
  3750. @table @option
  3751. @item delay
  3752. Time in milliseconds of the delay of left signal into right and vice versa.
  3753. Default is 20 milliseconds.
  3754. @item feedback
  3755. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3756. effect of left signal in right output and vice versa which gives widening
  3757. effect. Default is 0.3.
  3758. @item crossfeed
  3759. Cross feed of left into right with inverted phase. This helps in suppressing
  3760. the mono. If the value is 1 it will cancel all the signal common to both
  3761. channels. Default is 0.3.
  3762. @item drymix
  3763. Set level of input signal of original channel. Default is 0.8.
  3764. @end table
  3765. @section superequalizer
  3766. Apply 18 band equalizer.
  3767. The filter accepts the following options:
  3768. @table @option
  3769. @item 1b
  3770. Set 65Hz band gain.
  3771. @item 2b
  3772. Set 92Hz band gain.
  3773. @item 3b
  3774. Set 131Hz band gain.
  3775. @item 4b
  3776. Set 185Hz band gain.
  3777. @item 5b
  3778. Set 262Hz band gain.
  3779. @item 6b
  3780. Set 370Hz band gain.
  3781. @item 7b
  3782. Set 523Hz band gain.
  3783. @item 8b
  3784. Set 740Hz band gain.
  3785. @item 9b
  3786. Set 1047Hz band gain.
  3787. @item 10b
  3788. Set 1480Hz band gain.
  3789. @item 11b
  3790. Set 2093Hz band gain.
  3791. @item 12b
  3792. Set 2960Hz band gain.
  3793. @item 13b
  3794. Set 4186Hz band gain.
  3795. @item 14b
  3796. Set 5920Hz band gain.
  3797. @item 15b
  3798. Set 8372Hz band gain.
  3799. @item 16b
  3800. Set 11840Hz band gain.
  3801. @item 17b
  3802. Set 16744Hz band gain.
  3803. @item 18b
  3804. Set 20000Hz band gain.
  3805. @end table
  3806. @section surround
  3807. Apply audio surround upmix filter.
  3808. This filter allows to produce multichannel output from audio stream.
  3809. The filter accepts the following options:
  3810. @table @option
  3811. @item chl_out
  3812. Set output channel layout. By default, this is @var{5.1}.
  3813. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3814. for the required syntax.
  3815. @item chl_in
  3816. Set input channel layout. By default, this is @var{stereo}.
  3817. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3818. for the required syntax.
  3819. @item level_in
  3820. Set input volume level. By default, this is @var{1}.
  3821. @item level_out
  3822. Set output volume level. By default, this is @var{1}.
  3823. @item lfe
  3824. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3825. @item lfe_low
  3826. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3827. @item lfe_high
  3828. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3829. @item lfe_mode
  3830. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3831. In @var{add} mode, LFE channel is created from input audio and added to output.
  3832. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3833. also all non-LFE output channels are subtracted with output LFE channel.
  3834. @item angle
  3835. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3836. Default is @var{90}.
  3837. @item fc_in
  3838. Set front center input volume. By default, this is @var{1}.
  3839. @item fc_out
  3840. Set front center output volume. By default, this is @var{1}.
  3841. @item fl_in
  3842. Set front left input volume. By default, this is @var{1}.
  3843. @item fl_out
  3844. Set front left output volume. By default, this is @var{1}.
  3845. @item fr_in
  3846. Set front right input volume. By default, this is @var{1}.
  3847. @item fr_out
  3848. Set front right output volume. By default, this is @var{1}.
  3849. @item sl_in
  3850. Set side left input volume. By default, this is @var{1}.
  3851. @item sl_out
  3852. Set side left output volume. By default, this is @var{1}.
  3853. @item sr_in
  3854. Set side right input volume. By default, this is @var{1}.
  3855. @item sr_out
  3856. Set side right output volume. By default, this is @var{1}.
  3857. @item bl_in
  3858. Set back left input volume. By default, this is @var{1}.
  3859. @item bl_out
  3860. Set back left output volume. By default, this is @var{1}.
  3861. @item br_in
  3862. Set back right input volume. By default, this is @var{1}.
  3863. @item br_out
  3864. Set back right output volume. By default, this is @var{1}.
  3865. @item bc_in
  3866. Set back center input volume. By default, this is @var{1}.
  3867. @item bc_out
  3868. Set back center output volume. By default, this is @var{1}.
  3869. @item lfe_in
  3870. Set LFE input volume. By default, this is @var{1}.
  3871. @item lfe_out
  3872. Set LFE output volume. By default, this is @var{1}.
  3873. @item allx
  3874. Set spread usage of stereo image across X axis for all channels.
  3875. @item ally
  3876. Set spread usage of stereo image across Y axis for all channels.
  3877. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3878. Set spread usage of stereo image across X axis for each channel.
  3879. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3880. Set spread usage of stereo image across Y axis for each channel.
  3881. @item win_size
  3882. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3883. @item win_func
  3884. Set window function.
  3885. It accepts the following values:
  3886. @table @samp
  3887. @item rect
  3888. @item bartlett
  3889. @item hann, hanning
  3890. @item hamming
  3891. @item blackman
  3892. @item welch
  3893. @item flattop
  3894. @item bharris
  3895. @item bnuttall
  3896. @item bhann
  3897. @item sine
  3898. @item nuttall
  3899. @item lanczos
  3900. @item gauss
  3901. @item tukey
  3902. @item dolph
  3903. @item cauchy
  3904. @item parzen
  3905. @item poisson
  3906. @item bohman
  3907. @end table
  3908. Default is @code{hann}.
  3909. @item overlap
  3910. Set window overlap. If set to 1, the recommended overlap for selected
  3911. window function will be picked. Default is @code{0.5}.
  3912. @end table
  3913. @section treble, highshelf
  3914. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3915. shelving filter with a response similar to that of a standard
  3916. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3917. The filter accepts the following options:
  3918. @table @option
  3919. @item gain, g
  3920. Give the gain at whichever is the lower of ~22 kHz and the
  3921. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3922. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3923. @item frequency, f
  3924. Set the filter's central frequency and so can be used
  3925. to extend or reduce the frequency range to be boosted or cut.
  3926. The default value is @code{3000} Hz.
  3927. @item width_type, t
  3928. Set method to specify band-width of filter.
  3929. @table @option
  3930. @item h
  3931. Hz
  3932. @item q
  3933. Q-Factor
  3934. @item o
  3935. octave
  3936. @item s
  3937. slope
  3938. @item k
  3939. kHz
  3940. @end table
  3941. @item width, w
  3942. Determine how steep is the filter's shelf transition.
  3943. @item channels, c
  3944. Specify which channels to filter, by default all available are filtered.
  3945. @end table
  3946. @subsection Commands
  3947. This filter supports the following commands:
  3948. @table @option
  3949. @item frequency, f
  3950. Change treble frequency.
  3951. Syntax for the command is : "@var{frequency}"
  3952. @item width_type, t
  3953. Change treble width_type.
  3954. Syntax for the command is : "@var{width_type}"
  3955. @item width, w
  3956. Change treble width.
  3957. Syntax for the command is : "@var{width}"
  3958. @item gain, g
  3959. Change treble gain.
  3960. Syntax for the command is : "@var{gain}"
  3961. @end table
  3962. @section tremolo
  3963. Sinusoidal amplitude modulation.
  3964. The filter accepts the following options:
  3965. @table @option
  3966. @item f
  3967. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3968. (20 Hz or lower) will result in a tremolo effect.
  3969. This filter may also be used as a ring modulator by specifying
  3970. a modulation frequency higher than 20 Hz.
  3971. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3972. @item d
  3973. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3974. Default value is 0.5.
  3975. @end table
  3976. @section vibrato
  3977. Sinusoidal phase modulation.
  3978. The filter accepts the following options:
  3979. @table @option
  3980. @item f
  3981. Modulation frequency in Hertz.
  3982. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3983. @item d
  3984. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3985. Default value is 0.5.
  3986. @end table
  3987. @section volume
  3988. Adjust the input audio volume.
  3989. It accepts the following parameters:
  3990. @table @option
  3991. @item volume
  3992. Set audio volume expression.
  3993. Output values are clipped to the maximum value.
  3994. The output audio volume is given by the relation:
  3995. @example
  3996. @var{output_volume} = @var{volume} * @var{input_volume}
  3997. @end example
  3998. The default value for @var{volume} is "1.0".
  3999. @item precision
  4000. This parameter represents the mathematical precision.
  4001. It determines which input sample formats will be allowed, which affects the
  4002. precision of the volume scaling.
  4003. @table @option
  4004. @item fixed
  4005. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4006. @item float
  4007. 32-bit floating-point; this limits input sample format to FLT. (default)
  4008. @item double
  4009. 64-bit floating-point; this limits input sample format to DBL.
  4010. @end table
  4011. @item replaygain
  4012. Choose the behaviour on encountering ReplayGain side data in input frames.
  4013. @table @option
  4014. @item drop
  4015. Remove ReplayGain side data, ignoring its contents (the default).
  4016. @item ignore
  4017. Ignore ReplayGain side data, but leave it in the frame.
  4018. @item track
  4019. Prefer the track gain, if present.
  4020. @item album
  4021. Prefer the album gain, if present.
  4022. @end table
  4023. @item replaygain_preamp
  4024. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4025. Default value for @var{replaygain_preamp} is 0.0.
  4026. @item eval
  4027. Set when the volume expression is evaluated.
  4028. It accepts the following values:
  4029. @table @samp
  4030. @item once
  4031. only evaluate expression once during the filter initialization, or
  4032. when the @samp{volume} command is sent
  4033. @item frame
  4034. evaluate expression for each incoming frame
  4035. @end table
  4036. Default value is @samp{once}.
  4037. @end table
  4038. The volume expression can contain the following parameters.
  4039. @table @option
  4040. @item n
  4041. frame number (starting at zero)
  4042. @item nb_channels
  4043. number of channels
  4044. @item nb_consumed_samples
  4045. number of samples consumed by the filter
  4046. @item nb_samples
  4047. number of samples in the current frame
  4048. @item pos
  4049. original frame position in the file
  4050. @item pts
  4051. frame PTS
  4052. @item sample_rate
  4053. sample rate
  4054. @item startpts
  4055. PTS at start of stream
  4056. @item startt
  4057. time at start of stream
  4058. @item t
  4059. frame time
  4060. @item tb
  4061. timestamp timebase
  4062. @item volume
  4063. last set volume value
  4064. @end table
  4065. Note that when @option{eval} is set to @samp{once} only the
  4066. @var{sample_rate} and @var{tb} variables are available, all other
  4067. variables will evaluate to NAN.
  4068. @subsection Commands
  4069. This filter supports the following commands:
  4070. @table @option
  4071. @item volume
  4072. Modify the volume expression.
  4073. The command accepts the same syntax of the corresponding option.
  4074. If the specified expression is not valid, it is kept at its current
  4075. value.
  4076. @item replaygain_noclip
  4077. Prevent clipping by limiting the gain applied.
  4078. Default value for @var{replaygain_noclip} is 1.
  4079. @end table
  4080. @subsection Examples
  4081. @itemize
  4082. @item
  4083. Halve the input audio volume:
  4084. @example
  4085. volume=volume=0.5
  4086. volume=volume=1/2
  4087. volume=volume=-6.0206dB
  4088. @end example
  4089. In all the above example the named key for @option{volume} can be
  4090. omitted, for example like in:
  4091. @example
  4092. volume=0.5
  4093. @end example
  4094. @item
  4095. Increase input audio power by 6 decibels using fixed-point precision:
  4096. @example
  4097. volume=volume=6dB:precision=fixed
  4098. @end example
  4099. @item
  4100. Fade volume after time 10 with an annihilation period of 5 seconds:
  4101. @example
  4102. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4103. @end example
  4104. @end itemize
  4105. @section volumedetect
  4106. Detect the volume of the input video.
  4107. The filter has no parameters. The input is not modified. Statistics about
  4108. the volume will be printed in the log when the input stream end is reached.
  4109. In particular it will show the mean volume (root mean square), maximum
  4110. volume (on a per-sample basis), and the beginning of a histogram of the
  4111. registered volume values (from the maximum value to a cumulated 1/1000 of
  4112. the samples).
  4113. All volumes are in decibels relative to the maximum PCM value.
  4114. @subsection Examples
  4115. Here is an excerpt of the output:
  4116. @example
  4117. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4118. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4119. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4120. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4121. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4122. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4123. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4124. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4125. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4126. @end example
  4127. It means that:
  4128. @itemize
  4129. @item
  4130. The mean square energy is approximately -27 dB, or 10^-2.7.
  4131. @item
  4132. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4133. @item
  4134. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4135. @end itemize
  4136. In other words, raising the volume by +4 dB does not cause any clipping,
  4137. raising it by +5 dB causes clipping for 6 samples, etc.
  4138. @c man end AUDIO FILTERS
  4139. @chapter Audio Sources
  4140. @c man begin AUDIO SOURCES
  4141. Below is a description of the currently available audio sources.
  4142. @section abuffer
  4143. Buffer audio frames, and make them available to the filter chain.
  4144. This source is mainly intended for a programmatic use, in particular
  4145. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4146. It accepts the following parameters:
  4147. @table @option
  4148. @item time_base
  4149. The timebase which will be used for timestamps of submitted frames. It must be
  4150. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4151. @item sample_rate
  4152. The sample rate of the incoming audio buffers.
  4153. @item sample_fmt
  4154. The sample format of the incoming audio buffers.
  4155. Either a sample format name or its corresponding integer representation from
  4156. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4157. @item channel_layout
  4158. The channel layout of the incoming audio buffers.
  4159. Either a channel layout name from channel_layout_map in
  4160. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4161. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4162. @item channels
  4163. The number of channels of the incoming audio buffers.
  4164. If both @var{channels} and @var{channel_layout} are specified, then they
  4165. must be consistent.
  4166. @end table
  4167. @subsection Examples
  4168. @example
  4169. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4170. @end example
  4171. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4172. Since the sample format with name "s16p" corresponds to the number
  4173. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4174. equivalent to:
  4175. @example
  4176. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4177. @end example
  4178. @section aevalsrc
  4179. Generate an audio signal specified by an expression.
  4180. This source accepts in input one or more expressions (one for each
  4181. channel), which are evaluated and used to generate a corresponding
  4182. audio signal.
  4183. This source accepts the following options:
  4184. @table @option
  4185. @item exprs
  4186. Set the '|'-separated expressions list for each separate channel. In case the
  4187. @option{channel_layout} option is not specified, the selected channel layout
  4188. depends on the number of provided expressions. Otherwise the last
  4189. specified expression is applied to the remaining output channels.
  4190. @item channel_layout, c
  4191. Set the channel layout. The number of channels in the specified layout
  4192. must be equal to the number of specified expressions.
  4193. @item duration, d
  4194. Set the minimum duration of the sourced audio. See
  4195. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4196. for the accepted syntax.
  4197. Note that the resulting duration may be greater than the specified
  4198. duration, as the generated audio is always cut at the end of a
  4199. complete frame.
  4200. If not specified, or the expressed duration is negative, the audio is
  4201. supposed to be generated forever.
  4202. @item nb_samples, n
  4203. Set the number of samples per channel per each output frame,
  4204. default to 1024.
  4205. @item sample_rate, s
  4206. Specify the sample rate, default to 44100.
  4207. @end table
  4208. Each expression in @var{exprs} can contain the following constants:
  4209. @table @option
  4210. @item n
  4211. number of the evaluated sample, starting from 0
  4212. @item t
  4213. time of the evaluated sample expressed in seconds, starting from 0
  4214. @item s
  4215. sample rate
  4216. @end table
  4217. @subsection Examples
  4218. @itemize
  4219. @item
  4220. Generate silence:
  4221. @example
  4222. aevalsrc=0
  4223. @end example
  4224. @item
  4225. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4226. 8000 Hz:
  4227. @example
  4228. aevalsrc="sin(440*2*PI*t):s=8000"
  4229. @end example
  4230. @item
  4231. Generate a two channels signal, specify the channel layout (Front
  4232. Center + Back Center) explicitly:
  4233. @example
  4234. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4235. @end example
  4236. @item
  4237. Generate white noise:
  4238. @example
  4239. aevalsrc="-2+random(0)"
  4240. @end example
  4241. @item
  4242. Generate an amplitude modulated signal:
  4243. @example
  4244. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4245. @end example
  4246. @item
  4247. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4248. @example
  4249. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4250. @end example
  4251. @end itemize
  4252. @section anullsrc
  4253. The null audio source, return unprocessed audio frames. It is mainly useful
  4254. as a template and to be employed in analysis / debugging tools, or as
  4255. the source for filters which ignore the input data (for example the sox
  4256. synth filter).
  4257. This source accepts the following options:
  4258. @table @option
  4259. @item channel_layout, cl
  4260. Specifies the channel layout, and can be either an integer or a string
  4261. representing a channel layout. The default value of @var{channel_layout}
  4262. is "stereo".
  4263. Check the channel_layout_map definition in
  4264. @file{libavutil/channel_layout.c} for the mapping between strings and
  4265. channel layout values.
  4266. @item sample_rate, r
  4267. Specifies the sample rate, and defaults to 44100.
  4268. @item nb_samples, n
  4269. Set the number of samples per requested frames.
  4270. @end table
  4271. @subsection Examples
  4272. @itemize
  4273. @item
  4274. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4275. @example
  4276. anullsrc=r=48000:cl=4
  4277. @end example
  4278. @item
  4279. Do the same operation with a more obvious syntax:
  4280. @example
  4281. anullsrc=r=48000:cl=mono
  4282. @end example
  4283. @end itemize
  4284. All the parameters need to be explicitly defined.
  4285. @section flite
  4286. Synthesize a voice utterance using the libflite library.
  4287. To enable compilation of this filter you need to configure FFmpeg with
  4288. @code{--enable-libflite}.
  4289. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4290. The filter accepts the following options:
  4291. @table @option
  4292. @item list_voices
  4293. If set to 1, list the names of the available voices and exit
  4294. immediately. Default value is 0.
  4295. @item nb_samples, n
  4296. Set the maximum number of samples per frame. Default value is 512.
  4297. @item textfile
  4298. Set the filename containing the text to speak.
  4299. @item text
  4300. Set the text to speak.
  4301. @item voice, v
  4302. Set the voice to use for the speech synthesis. Default value is
  4303. @code{kal}. See also the @var{list_voices} option.
  4304. @end table
  4305. @subsection Examples
  4306. @itemize
  4307. @item
  4308. Read from file @file{speech.txt}, and synthesize the text using the
  4309. standard flite voice:
  4310. @example
  4311. flite=textfile=speech.txt
  4312. @end example
  4313. @item
  4314. Read the specified text selecting the @code{slt} voice:
  4315. @example
  4316. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4317. @end example
  4318. @item
  4319. Input text to ffmpeg:
  4320. @example
  4321. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4322. @end example
  4323. @item
  4324. Make @file{ffplay} speak the specified text, using @code{flite} and
  4325. the @code{lavfi} device:
  4326. @example
  4327. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4328. @end example
  4329. @end itemize
  4330. For more information about libflite, check:
  4331. @url{http://www.festvox.org/flite/}
  4332. @section anoisesrc
  4333. Generate a noise audio signal.
  4334. The filter accepts the following options:
  4335. @table @option
  4336. @item sample_rate, r
  4337. Specify the sample rate. Default value is 48000 Hz.
  4338. @item amplitude, a
  4339. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4340. is 1.0.
  4341. @item duration, d
  4342. Specify the duration of the generated audio stream. Not specifying this option
  4343. results in noise with an infinite length.
  4344. @item color, colour, c
  4345. Specify the color of noise. Available noise colors are white, pink, brown,
  4346. blue and violet. Default color is white.
  4347. @item seed, s
  4348. Specify a value used to seed the PRNG.
  4349. @item nb_samples, n
  4350. Set the number of samples per each output frame, default is 1024.
  4351. @end table
  4352. @subsection Examples
  4353. @itemize
  4354. @item
  4355. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4356. @example
  4357. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4358. @end example
  4359. @end itemize
  4360. @section hilbert
  4361. Generate odd-tap Hilbert transform FIR coefficients.
  4362. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4363. the signal by 90 degrees.
  4364. This is used in many matrix coding schemes and for analytic signal generation.
  4365. The process is often written as a multiplication by i (or j), the imaginary unit.
  4366. The filter accepts the following options:
  4367. @table @option
  4368. @item sample_rate, s
  4369. Set sample rate, default is 44100.
  4370. @item taps, t
  4371. Set length of FIR filter, default is 22051.
  4372. @item nb_samples, n
  4373. Set number of samples per each frame.
  4374. @item win_func, w
  4375. Set window function to be used when generating FIR coefficients.
  4376. @end table
  4377. @section sinc
  4378. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4379. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4380. The filter accepts the following options:
  4381. @table @option
  4382. @item sample_rate, r
  4383. Set sample rate, default is 44100.
  4384. @item nb_samples, n
  4385. Set number of samples per each frame. Default is 1024.
  4386. @item hp
  4387. Set high-pass frequency. Default is 0.
  4388. @item lp
  4389. Set low-pass frequency. Default is 0.
  4390. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4391. is higher than 0 then filter will create band-pass filter coefficients,
  4392. otherwise band-reject filter coefficients.
  4393. @item phase
  4394. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4395. @item beta
  4396. Set Kaiser window beta.
  4397. @item att
  4398. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4399. @item round
  4400. Enable rounding, by default is disabled.
  4401. @item hptaps
  4402. Set number of taps for high-pass filter.
  4403. @item lptaps
  4404. Set number of taps for low-pass filter.
  4405. @end table
  4406. @section sine
  4407. Generate an audio signal made of a sine wave with amplitude 1/8.
  4408. The audio signal is bit-exact.
  4409. The filter accepts the following options:
  4410. @table @option
  4411. @item frequency, f
  4412. Set the carrier frequency. Default is 440 Hz.
  4413. @item beep_factor, b
  4414. Enable a periodic beep every second with frequency @var{beep_factor} times
  4415. the carrier frequency. Default is 0, meaning the beep is disabled.
  4416. @item sample_rate, r
  4417. Specify the sample rate, default is 44100.
  4418. @item duration, d
  4419. Specify the duration of the generated audio stream.
  4420. @item samples_per_frame
  4421. Set the number of samples per output frame.
  4422. The expression can contain the following constants:
  4423. @table @option
  4424. @item n
  4425. The (sequential) number of the output audio frame, starting from 0.
  4426. @item pts
  4427. The PTS (Presentation TimeStamp) of the output audio frame,
  4428. expressed in @var{TB} units.
  4429. @item t
  4430. The PTS of the output audio frame, expressed in seconds.
  4431. @item TB
  4432. The timebase of the output audio frames.
  4433. @end table
  4434. Default is @code{1024}.
  4435. @end table
  4436. @subsection Examples
  4437. @itemize
  4438. @item
  4439. Generate a simple 440 Hz sine wave:
  4440. @example
  4441. sine
  4442. @end example
  4443. @item
  4444. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4445. @example
  4446. sine=220:4:d=5
  4447. sine=f=220:b=4:d=5
  4448. sine=frequency=220:beep_factor=4:duration=5
  4449. @end example
  4450. @item
  4451. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4452. pattern:
  4453. @example
  4454. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4455. @end example
  4456. @end itemize
  4457. @c man end AUDIO SOURCES
  4458. @chapter Audio Sinks
  4459. @c man begin AUDIO SINKS
  4460. Below is a description of the currently available audio sinks.
  4461. @section abuffersink
  4462. Buffer audio frames, and make them available to the end of filter chain.
  4463. This sink is mainly intended for programmatic use, in particular
  4464. through the interface defined in @file{libavfilter/buffersink.h}
  4465. or the options system.
  4466. It accepts a pointer to an AVABufferSinkContext structure, which
  4467. defines the incoming buffers' formats, to be passed as the opaque
  4468. parameter to @code{avfilter_init_filter} for initialization.
  4469. @section anullsink
  4470. Null audio sink; do absolutely nothing with the input audio. It is
  4471. mainly useful as a template and for use in analysis / debugging
  4472. tools.
  4473. @c man end AUDIO SINKS
  4474. @chapter Video Filters
  4475. @c man begin VIDEO FILTERS
  4476. When you configure your FFmpeg build, you can disable any of the
  4477. existing filters using @code{--disable-filters}.
  4478. The configure output will show the video filters included in your
  4479. build.
  4480. Below is a description of the currently available video filters.
  4481. @section alphaextract
  4482. Extract the alpha component from the input as a grayscale video. This
  4483. is especially useful with the @var{alphamerge} filter.
  4484. @section alphamerge
  4485. Add or replace the alpha component of the primary input with the
  4486. grayscale value of a second input. This is intended for use with
  4487. @var{alphaextract} to allow the transmission or storage of frame
  4488. sequences that have alpha in a format that doesn't support an alpha
  4489. channel.
  4490. For example, to reconstruct full frames from a normal YUV-encoded video
  4491. and a separate video created with @var{alphaextract}, you might use:
  4492. @example
  4493. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4494. @end example
  4495. Since this filter is designed for reconstruction, it operates on frame
  4496. sequences without considering timestamps, and terminates when either
  4497. input reaches end of stream. This will cause problems if your encoding
  4498. pipeline drops frames. If you're trying to apply an image as an
  4499. overlay to a video stream, consider the @var{overlay} filter instead.
  4500. @section amplify
  4501. Amplify differences between current pixel and pixels of adjacent frames in
  4502. same pixel location.
  4503. This filter accepts the following options:
  4504. @table @option
  4505. @item radius
  4506. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4507. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4508. @item factor
  4509. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4510. @item threshold
  4511. Set threshold for difference amplification. Any difference greater or equal to
  4512. this value will not alter source pixel. Default is 10.
  4513. Allowed range is from 0 to 65535.
  4514. @item tolerance
  4515. Set tolerance for difference amplification. Any difference lower to
  4516. this value will not alter source pixel. Default is 0.
  4517. Allowed range is from 0 to 65535.
  4518. @item low
  4519. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4520. This option controls maximum possible value that will decrease source pixel value.
  4521. @item high
  4522. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4523. This option controls maximum possible value that will increase source pixel value.
  4524. @item planes
  4525. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4526. @end table
  4527. @section ass
  4528. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4529. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4530. Substation Alpha) subtitles files.
  4531. This filter accepts the following option in addition to the common options from
  4532. the @ref{subtitles} filter:
  4533. @table @option
  4534. @item shaping
  4535. Set the shaping engine
  4536. Available values are:
  4537. @table @samp
  4538. @item auto
  4539. The default libass shaping engine, which is the best available.
  4540. @item simple
  4541. Fast, font-agnostic shaper that can do only substitutions
  4542. @item complex
  4543. Slower shaper using OpenType for substitutions and positioning
  4544. @end table
  4545. The default is @code{auto}.
  4546. @end table
  4547. @section atadenoise
  4548. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4549. The filter accepts the following options:
  4550. @table @option
  4551. @item 0a
  4552. Set threshold A for 1st plane. Default is 0.02.
  4553. Valid range is 0 to 0.3.
  4554. @item 0b
  4555. Set threshold B for 1st plane. Default is 0.04.
  4556. Valid range is 0 to 5.
  4557. @item 1a
  4558. Set threshold A for 2nd plane. Default is 0.02.
  4559. Valid range is 0 to 0.3.
  4560. @item 1b
  4561. Set threshold B for 2nd plane. Default is 0.04.
  4562. Valid range is 0 to 5.
  4563. @item 2a
  4564. Set threshold A for 3rd plane. Default is 0.02.
  4565. Valid range is 0 to 0.3.
  4566. @item 2b
  4567. Set threshold B for 3rd plane. Default is 0.04.
  4568. Valid range is 0 to 5.
  4569. Threshold A is designed to react on abrupt changes in the input signal and
  4570. threshold B is designed to react on continuous changes in the input signal.
  4571. @item s
  4572. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4573. number in range [5, 129].
  4574. @item p
  4575. Set what planes of frame filter will use for averaging. Default is all.
  4576. @end table
  4577. @section avgblur
  4578. Apply average blur filter.
  4579. The filter accepts the following options:
  4580. @table @option
  4581. @item sizeX
  4582. Set horizontal radius size.
  4583. @item planes
  4584. Set which planes to filter. By default all planes are filtered.
  4585. @item sizeY
  4586. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4587. Default is @code{0}.
  4588. @end table
  4589. @section bbox
  4590. Compute the bounding box for the non-black pixels in the input frame
  4591. luminance plane.
  4592. This filter computes the bounding box containing all the pixels with a
  4593. luminance value greater than the minimum allowed value.
  4594. The parameters describing the bounding box are printed on the filter
  4595. log.
  4596. The filter accepts the following option:
  4597. @table @option
  4598. @item min_val
  4599. Set the minimal luminance value. Default is @code{16}.
  4600. @end table
  4601. @section bitplanenoise
  4602. Show and measure bit plane noise.
  4603. The filter accepts the following options:
  4604. @table @option
  4605. @item bitplane
  4606. Set which plane to analyze. Default is @code{1}.
  4607. @item filter
  4608. Filter out noisy pixels from @code{bitplane} set above.
  4609. Default is disabled.
  4610. @end table
  4611. @section blackdetect
  4612. Detect video intervals that are (almost) completely black. Can be
  4613. useful to detect chapter transitions, commercials, or invalid
  4614. recordings. Output lines contains the time for the start, end and
  4615. duration of the detected black interval expressed in seconds.
  4616. In order to display the output lines, you need to set the loglevel at
  4617. least to the AV_LOG_INFO value.
  4618. The filter accepts the following options:
  4619. @table @option
  4620. @item black_min_duration, d
  4621. Set the minimum detected black duration expressed in seconds. It must
  4622. be a non-negative floating point number.
  4623. Default value is 2.0.
  4624. @item picture_black_ratio_th, pic_th
  4625. Set the threshold for considering a picture "black".
  4626. Express the minimum value for the ratio:
  4627. @example
  4628. @var{nb_black_pixels} / @var{nb_pixels}
  4629. @end example
  4630. for which a picture is considered black.
  4631. Default value is 0.98.
  4632. @item pixel_black_th, pix_th
  4633. Set the threshold for considering a pixel "black".
  4634. The threshold expresses the maximum pixel luminance value for which a
  4635. pixel is considered "black". The provided value is scaled according to
  4636. the following equation:
  4637. @example
  4638. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4639. @end example
  4640. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4641. the input video format, the range is [0-255] for YUV full-range
  4642. formats and [16-235] for YUV non full-range formats.
  4643. Default value is 0.10.
  4644. @end table
  4645. The following example sets the maximum pixel threshold to the minimum
  4646. value, and detects only black intervals of 2 or more seconds:
  4647. @example
  4648. blackdetect=d=2:pix_th=0.00
  4649. @end example
  4650. @section blackframe
  4651. Detect frames that are (almost) completely black. Can be useful to
  4652. detect chapter transitions or commercials. Output lines consist of
  4653. the frame number of the detected frame, the percentage of blackness,
  4654. the position in the file if known or -1 and the timestamp in seconds.
  4655. In order to display the output lines, you need to set the loglevel at
  4656. least to the AV_LOG_INFO value.
  4657. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4658. The value represents the percentage of pixels in the picture that
  4659. are below the threshold value.
  4660. It accepts the following parameters:
  4661. @table @option
  4662. @item amount
  4663. The percentage of the pixels that have to be below the threshold; it defaults to
  4664. @code{98}.
  4665. @item threshold, thresh
  4666. The threshold below which a pixel value is considered black; it defaults to
  4667. @code{32}.
  4668. @end table
  4669. @section blend, tblend
  4670. Blend two video frames into each other.
  4671. The @code{blend} filter takes two input streams and outputs one
  4672. stream, the first input is the "top" layer and second input is
  4673. "bottom" layer. By default, the output terminates when the longest input terminates.
  4674. The @code{tblend} (time blend) filter takes two consecutive frames
  4675. from one single stream, and outputs the result obtained by blending
  4676. the new frame on top of the old frame.
  4677. A description of the accepted options follows.
  4678. @table @option
  4679. @item c0_mode
  4680. @item c1_mode
  4681. @item c2_mode
  4682. @item c3_mode
  4683. @item all_mode
  4684. Set blend mode for specific pixel component or all pixel components in case
  4685. of @var{all_mode}. Default value is @code{normal}.
  4686. Available values for component modes are:
  4687. @table @samp
  4688. @item addition
  4689. @item grainmerge
  4690. @item and
  4691. @item average
  4692. @item burn
  4693. @item darken
  4694. @item difference
  4695. @item grainextract
  4696. @item divide
  4697. @item dodge
  4698. @item freeze
  4699. @item exclusion
  4700. @item extremity
  4701. @item glow
  4702. @item hardlight
  4703. @item hardmix
  4704. @item heat
  4705. @item lighten
  4706. @item linearlight
  4707. @item multiply
  4708. @item multiply128
  4709. @item negation
  4710. @item normal
  4711. @item or
  4712. @item overlay
  4713. @item phoenix
  4714. @item pinlight
  4715. @item reflect
  4716. @item screen
  4717. @item softlight
  4718. @item subtract
  4719. @item vividlight
  4720. @item xor
  4721. @end table
  4722. @item c0_opacity
  4723. @item c1_opacity
  4724. @item c2_opacity
  4725. @item c3_opacity
  4726. @item all_opacity
  4727. Set blend opacity for specific pixel component or all pixel components in case
  4728. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4729. @item c0_expr
  4730. @item c1_expr
  4731. @item c2_expr
  4732. @item c3_expr
  4733. @item all_expr
  4734. Set blend expression for specific pixel component or all pixel components in case
  4735. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4736. The expressions can use the following variables:
  4737. @table @option
  4738. @item N
  4739. The sequential number of the filtered frame, starting from @code{0}.
  4740. @item X
  4741. @item Y
  4742. the coordinates of the current sample
  4743. @item W
  4744. @item H
  4745. the width and height of currently filtered plane
  4746. @item SW
  4747. @item SH
  4748. Width and height scale for the plane being filtered. It is the
  4749. ratio between the dimensions of the current plane to the luma plane,
  4750. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4751. the luma plane and @code{0.5,0.5} for the chroma planes.
  4752. @item T
  4753. Time of the current frame, expressed in seconds.
  4754. @item TOP, A
  4755. Value of pixel component at current location for first video frame (top layer).
  4756. @item BOTTOM, B
  4757. Value of pixel component at current location for second video frame (bottom layer).
  4758. @end table
  4759. @end table
  4760. The @code{blend} filter also supports the @ref{framesync} options.
  4761. @subsection Examples
  4762. @itemize
  4763. @item
  4764. Apply transition from bottom layer to top layer in first 10 seconds:
  4765. @example
  4766. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4767. @end example
  4768. @item
  4769. Apply linear horizontal transition from top layer to bottom layer:
  4770. @example
  4771. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4772. @end example
  4773. @item
  4774. Apply 1x1 checkerboard effect:
  4775. @example
  4776. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4777. @end example
  4778. @item
  4779. Apply uncover left effect:
  4780. @example
  4781. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4782. @end example
  4783. @item
  4784. Apply uncover down effect:
  4785. @example
  4786. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4787. @end example
  4788. @item
  4789. Apply uncover up-left effect:
  4790. @example
  4791. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4792. @end example
  4793. @item
  4794. Split diagonally video and shows top and bottom layer on each side:
  4795. @example
  4796. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4797. @end example
  4798. @item
  4799. Display differences between the current and the previous frame:
  4800. @example
  4801. tblend=all_mode=grainextract
  4802. @end example
  4803. @end itemize
  4804. @section bm3d
  4805. Denoise frames using Block-Matching 3D algorithm.
  4806. The filter accepts the following options.
  4807. @table @option
  4808. @item sigma
  4809. Set denoising strength. Default value is 1.
  4810. Allowed range is from 0 to 999.9.
  4811. The denoising algorithm is very sensitive to sigma, so adjust it
  4812. according to the source.
  4813. @item block
  4814. Set local patch size. This sets dimensions in 2D.
  4815. @item bstep
  4816. Set sliding step for processing blocks. Default value is 4.
  4817. Allowed range is from 1 to 64.
  4818. Smaller values allows processing more reference blocks and is slower.
  4819. @item group
  4820. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4821. When set to 1, no block matching is done. Larger values allows more blocks
  4822. in single group.
  4823. Allowed range is from 1 to 256.
  4824. @item range
  4825. Set radius for search block matching. Default is 9.
  4826. Allowed range is from 1 to INT32_MAX.
  4827. @item mstep
  4828. Set step between two search locations for block matching. Default is 1.
  4829. Allowed range is from 1 to 64. Smaller is slower.
  4830. @item thmse
  4831. Set threshold of mean square error for block matching. Valid range is 0 to
  4832. INT32_MAX.
  4833. @item hdthr
  4834. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4835. Larger values results in stronger hard-thresholding filtering in frequency
  4836. domain.
  4837. @item estim
  4838. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4839. Default is @code{basic}.
  4840. @item ref
  4841. If enabled, filter will use 2nd stream for block matching.
  4842. Default is disabled for @code{basic} value of @var{estim} option,
  4843. and always enabled if value of @var{estim} is @code{final}.
  4844. @item planes
  4845. Set planes to filter. Default is all available except alpha.
  4846. @end table
  4847. @subsection Examples
  4848. @itemize
  4849. @item
  4850. Basic filtering with bm3d:
  4851. @example
  4852. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4853. @end example
  4854. @item
  4855. Same as above, but filtering only luma:
  4856. @example
  4857. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4858. @end example
  4859. @item
  4860. Same as above, but with both estimation modes:
  4861. @example
  4862. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4863. @end example
  4864. @item
  4865. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4866. @example
  4867. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4868. @end example
  4869. @end itemize
  4870. @section boxblur
  4871. Apply a boxblur algorithm to the input video.
  4872. It accepts the following parameters:
  4873. @table @option
  4874. @item luma_radius, lr
  4875. @item luma_power, lp
  4876. @item chroma_radius, cr
  4877. @item chroma_power, cp
  4878. @item alpha_radius, ar
  4879. @item alpha_power, ap
  4880. @end table
  4881. A description of the accepted options follows.
  4882. @table @option
  4883. @item luma_radius, lr
  4884. @item chroma_radius, cr
  4885. @item alpha_radius, ar
  4886. Set an expression for the box radius in pixels used for blurring the
  4887. corresponding input plane.
  4888. The radius value must be a non-negative number, and must not be
  4889. greater than the value of the expression @code{min(w,h)/2} for the
  4890. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4891. planes.
  4892. Default value for @option{luma_radius} is "2". If not specified,
  4893. @option{chroma_radius} and @option{alpha_radius} default to the
  4894. corresponding value set for @option{luma_radius}.
  4895. The expressions can contain the following constants:
  4896. @table @option
  4897. @item w
  4898. @item h
  4899. The input width and height in pixels.
  4900. @item cw
  4901. @item ch
  4902. The input chroma image width and height in pixels.
  4903. @item hsub
  4904. @item vsub
  4905. The horizontal and vertical chroma subsample values. For example, for the
  4906. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4907. @end table
  4908. @item luma_power, lp
  4909. @item chroma_power, cp
  4910. @item alpha_power, ap
  4911. Specify how many times the boxblur filter is applied to the
  4912. corresponding plane.
  4913. Default value for @option{luma_power} is 2. If not specified,
  4914. @option{chroma_power} and @option{alpha_power} default to the
  4915. corresponding value set for @option{luma_power}.
  4916. A value of 0 will disable the effect.
  4917. @end table
  4918. @subsection Examples
  4919. @itemize
  4920. @item
  4921. Apply a boxblur filter with the luma, chroma, and alpha radii
  4922. set to 2:
  4923. @example
  4924. boxblur=luma_radius=2:luma_power=1
  4925. boxblur=2:1
  4926. @end example
  4927. @item
  4928. Set the luma radius to 2, and alpha and chroma radius to 0:
  4929. @example
  4930. boxblur=2:1:cr=0:ar=0
  4931. @end example
  4932. @item
  4933. Set the luma and chroma radii to a fraction of the video dimension:
  4934. @example
  4935. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4936. @end example
  4937. @end itemize
  4938. @section bwdif
  4939. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4940. Deinterlacing Filter").
  4941. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4942. interpolation algorithms.
  4943. It accepts the following parameters:
  4944. @table @option
  4945. @item mode
  4946. The interlacing mode to adopt. It accepts one of the following values:
  4947. @table @option
  4948. @item 0, send_frame
  4949. Output one frame for each frame.
  4950. @item 1, send_field
  4951. Output one frame for each field.
  4952. @end table
  4953. The default value is @code{send_field}.
  4954. @item parity
  4955. The picture field parity assumed for the input interlaced video. It accepts one
  4956. of the following values:
  4957. @table @option
  4958. @item 0, tff
  4959. Assume the top field is first.
  4960. @item 1, bff
  4961. Assume the bottom field is first.
  4962. @item -1, auto
  4963. Enable automatic detection of field parity.
  4964. @end table
  4965. The default value is @code{auto}.
  4966. If the interlacing is unknown or the decoder does not export this information,
  4967. top field first will be assumed.
  4968. @item deint
  4969. Specify which frames to deinterlace. Accept one of the following
  4970. values:
  4971. @table @option
  4972. @item 0, all
  4973. Deinterlace all frames.
  4974. @item 1, interlaced
  4975. Only deinterlace frames marked as interlaced.
  4976. @end table
  4977. The default value is @code{all}.
  4978. @end table
  4979. @section chromahold
  4980. Remove all color information for all colors except for certain one.
  4981. The filter accepts the following options:
  4982. @table @option
  4983. @item color
  4984. The color which will not be replaced with neutral chroma.
  4985. @item similarity
  4986. Similarity percentage with the above color.
  4987. 0.01 matches only the exact key color, while 1.0 matches everything.
  4988. @item yuv
  4989. Signals that the color passed is already in YUV instead of RGB.
  4990. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4991. This can be used to pass exact YUV values as hexadecimal numbers.
  4992. @end table
  4993. @section chromakey
  4994. YUV colorspace color/chroma keying.
  4995. The filter accepts the following options:
  4996. @table @option
  4997. @item color
  4998. The color which will be replaced with transparency.
  4999. @item similarity
  5000. Similarity percentage with the key color.
  5001. 0.01 matches only the exact key color, while 1.0 matches everything.
  5002. @item blend
  5003. Blend percentage.
  5004. 0.0 makes pixels either fully transparent, or not transparent at all.
  5005. Higher values result in semi-transparent pixels, with a higher transparency
  5006. the more similar the pixels color is to the key color.
  5007. @item yuv
  5008. Signals that the color passed is already in YUV instead of RGB.
  5009. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5010. This can be used to pass exact YUV values as hexadecimal numbers.
  5011. @end table
  5012. @subsection Examples
  5013. @itemize
  5014. @item
  5015. Make every green pixel in the input image transparent:
  5016. @example
  5017. ffmpeg -i input.png -vf chromakey=green out.png
  5018. @end example
  5019. @item
  5020. Overlay a greenscreen-video on top of a static black background.
  5021. @example
  5022. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  5023. @end example
  5024. @end itemize
  5025. @section chromashift
  5026. Shift chroma pixels horizontally and/or vertically.
  5027. The filter accepts the following options:
  5028. @table @option
  5029. @item cbh
  5030. Set amount to shift chroma-blue horizontally.
  5031. @item cbv
  5032. Set amount to shift chroma-blue vertically.
  5033. @item crh
  5034. Set amount to shift chroma-red horizontally.
  5035. @item crv
  5036. Set amount to shift chroma-red vertically.
  5037. @item edge
  5038. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5039. @end table
  5040. @section ciescope
  5041. Display CIE color diagram with pixels overlaid onto it.
  5042. The filter accepts the following options:
  5043. @table @option
  5044. @item system
  5045. Set color system.
  5046. @table @samp
  5047. @item ntsc, 470m
  5048. @item ebu, 470bg
  5049. @item smpte
  5050. @item 240m
  5051. @item apple
  5052. @item widergb
  5053. @item cie1931
  5054. @item rec709, hdtv
  5055. @item uhdtv, rec2020
  5056. @end table
  5057. @item cie
  5058. Set CIE system.
  5059. @table @samp
  5060. @item xyy
  5061. @item ucs
  5062. @item luv
  5063. @end table
  5064. @item gamuts
  5065. Set what gamuts to draw.
  5066. See @code{system} option for available values.
  5067. @item size, s
  5068. Set ciescope size, by default set to 512.
  5069. @item intensity, i
  5070. Set intensity used to map input pixel values to CIE diagram.
  5071. @item contrast
  5072. Set contrast used to draw tongue colors that are out of active color system gamut.
  5073. @item corrgamma
  5074. Correct gamma displayed on scope, by default enabled.
  5075. @item showwhite
  5076. Show white point on CIE diagram, by default disabled.
  5077. @item gamma
  5078. Set input gamma. Used only with XYZ input color space.
  5079. @end table
  5080. @section codecview
  5081. Visualize information exported by some codecs.
  5082. Some codecs can export information through frames using side-data or other
  5083. means. For example, some MPEG based codecs export motion vectors through the
  5084. @var{export_mvs} flag in the codec @option{flags2} option.
  5085. The filter accepts the following option:
  5086. @table @option
  5087. @item mv
  5088. Set motion vectors to visualize.
  5089. Available flags for @var{mv} are:
  5090. @table @samp
  5091. @item pf
  5092. forward predicted MVs of P-frames
  5093. @item bf
  5094. forward predicted MVs of B-frames
  5095. @item bb
  5096. backward predicted MVs of B-frames
  5097. @end table
  5098. @item qp
  5099. Display quantization parameters using the chroma planes.
  5100. @item mv_type, mvt
  5101. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5102. Available flags for @var{mv_type} are:
  5103. @table @samp
  5104. @item fp
  5105. forward predicted MVs
  5106. @item bp
  5107. backward predicted MVs
  5108. @end table
  5109. @item frame_type, ft
  5110. Set frame type to visualize motion vectors of.
  5111. Available flags for @var{frame_type} are:
  5112. @table @samp
  5113. @item if
  5114. intra-coded frames (I-frames)
  5115. @item pf
  5116. predicted frames (P-frames)
  5117. @item bf
  5118. bi-directionally predicted frames (B-frames)
  5119. @end table
  5120. @end table
  5121. @subsection Examples
  5122. @itemize
  5123. @item
  5124. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5125. @example
  5126. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5127. @end example
  5128. @item
  5129. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5130. @example
  5131. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5132. @end example
  5133. @end itemize
  5134. @section colorbalance
  5135. Modify intensity of primary colors (red, green and blue) of input frames.
  5136. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5137. regions for the red-cyan, green-magenta or blue-yellow balance.
  5138. A positive adjustment value shifts the balance towards the primary color, a negative
  5139. value towards the complementary color.
  5140. The filter accepts the following options:
  5141. @table @option
  5142. @item rs
  5143. @item gs
  5144. @item bs
  5145. Adjust red, green and blue shadows (darkest pixels).
  5146. @item rm
  5147. @item gm
  5148. @item bm
  5149. Adjust red, green and blue midtones (medium pixels).
  5150. @item rh
  5151. @item gh
  5152. @item bh
  5153. Adjust red, green and blue highlights (brightest pixels).
  5154. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5155. @end table
  5156. @subsection Examples
  5157. @itemize
  5158. @item
  5159. Add red color cast to shadows:
  5160. @example
  5161. colorbalance=rs=.3
  5162. @end example
  5163. @end itemize
  5164. @section colorkey
  5165. RGB colorspace color keying.
  5166. The filter accepts the following options:
  5167. @table @option
  5168. @item color
  5169. The color which will be replaced with transparency.
  5170. @item similarity
  5171. Similarity percentage with the key color.
  5172. 0.01 matches only the exact key color, while 1.0 matches everything.
  5173. @item blend
  5174. Blend percentage.
  5175. 0.0 makes pixels either fully transparent, or not transparent at all.
  5176. Higher values result in semi-transparent pixels, with a higher transparency
  5177. the more similar the pixels color is to the key color.
  5178. @end table
  5179. @subsection Examples
  5180. @itemize
  5181. @item
  5182. Make every green pixel in the input image transparent:
  5183. @example
  5184. ffmpeg -i input.png -vf colorkey=green out.png
  5185. @end example
  5186. @item
  5187. Overlay a greenscreen-video on top of a static background image.
  5188. @example
  5189. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  5190. @end example
  5191. @end itemize
  5192. @section colorhold
  5193. Remove all color information for all RGB colors except for certain one.
  5194. The filter accepts the following options:
  5195. @table @option
  5196. @item color
  5197. The color which will not be replaced with neutral gray.
  5198. @item similarity
  5199. Similarity percentage with the above color.
  5200. 0.01 matches only the exact key color, while 1.0 matches everything.
  5201. @item blend
  5202. Blend percentage. 0.0 makes pixels fully gray.
  5203. Higher values result in more preserved color.
  5204. @end table
  5205. @section colorlevels
  5206. Adjust video input frames using levels.
  5207. The filter accepts the following options:
  5208. @table @option
  5209. @item rimin
  5210. @item gimin
  5211. @item bimin
  5212. @item aimin
  5213. Adjust red, green, blue and alpha input black point.
  5214. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5215. @item rimax
  5216. @item gimax
  5217. @item bimax
  5218. @item aimax
  5219. Adjust red, green, blue and alpha input white point.
  5220. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5221. Input levels are used to lighten highlights (bright tones), darken shadows
  5222. (dark tones), change the balance of bright and dark tones.
  5223. @item romin
  5224. @item gomin
  5225. @item bomin
  5226. @item aomin
  5227. Adjust red, green, blue and alpha output black point.
  5228. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5229. @item romax
  5230. @item gomax
  5231. @item bomax
  5232. @item aomax
  5233. Adjust red, green, blue and alpha output white point.
  5234. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5235. Output levels allows manual selection of a constrained output level range.
  5236. @end table
  5237. @subsection Examples
  5238. @itemize
  5239. @item
  5240. Make video output darker:
  5241. @example
  5242. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5243. @end example
  5244. @item
  5245. Increase contrast:
  5246. @example
  5247. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5248. @end example
  5249. @item
  5250. Make video output lighter:
  5251. @example
  5252. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5253. @end example
  5254. @item
  5255. Increase brightness:
  5256. @example
  5257. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5258. @end example
  5259. @end itemize
  5260. @section colorchannelmixer
  5261. Adjust video input frames by re-mixing color channels.
  5262. This filter modifies a color channel by adding the values associated to
  5263. the other channels of the same pixels. For example if the value to
  5264. modify is red, the output value will be:
  5265. @example
  5266. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5267. @end example
  5268. The filter accepts the following options:
  5269. @table @option
  5270. @item rr
  5271. @item rg
  5272. @item rb
  5273. @item ra
  5274. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5275. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5276. @item gr
  5277. @item gg
  5278. @item gb
  5279. @item ga
  5280. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5281. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5282. @item br
  5283. @item bg
  5284. @item bb
  5285. @item ba
  5286. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5287. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5288. @item ar
  5289. @item ag
  5290. @item ab
  5291. @item aa
  5292. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5293. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5294. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5295. @end table
  5296. @subsection Examples
  5297. @itemize
  5298. @item
  5299. Convert source to grayscale:
  5300. @example
  5301. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5302. @end example
  5303. @item
  5304. Simulate sepia tones:
  5305. @example
  5306. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5307. @end example
  5308. @end itemize
  5309. @section colormatrix
  5310. Convert color matrix.
  5311. The filter accepts the following options:
  5312. @table @option
  5313. @item src
  5314. @item dst
  5315. Specify the source and destination color matrix. Both values must be
  5316. specified.
  5317. The accepted values are:
  5318. @table @samp
  5319. @item bt709
  5320. BT.709
  5321. @item fcc
  5322. FCC
  5323. @item bt601
  5324. BT.601
  5325. @item bt470
  5326. BT.470
  5327. @item bt470bg
  5328. BT.470BG
  5329. @item smpte170m
  5330. SMPTE-170M
  5331. @item smpte240m
  5332. SMPTE-240M
  5333. @item bt2020
  5334. BT.2020
  5335. @end table
  5336. @end table
  5337. For example to convert from BT.601 to SMPTE-240M, use the command:
  5338. @example
  5339. colormatrix=bt601:smpte240m
  5340. @end example
  5341. @section colorspace
  5342. Convert colorspace, transfer characteristics or color primaries.
  5343. Input video needs to have an even size.
  5344. The filter accepts the following options:
  5345. @table @option
  5346. @anchor{all}
  5347. @item all
  5348. Specify all color properties at once.
  5349. The accepted values are:
  5350. @table @samp
  5351. @item bt470m
  5352. BT.470M
  5353. @item bt470bg
  5354. BT.470BG
  5355. @item bt601-6-525
  5356. BT.601-6 525
  5357. @item bt601-6-625
  5358. BT.601-6 625
  5359. @item bt709
  5360. BT.709
  5361. @item smpte170m
  5362. SMPTE-170M
  5363. @item smpte240m
  5364. SMPTE-240M
  5365. @item bt2020
  5366. BT.2020
  5367. @end table
  5368. @anchor{space}
  5369. @item space
  5370. Specify output colorspace.
  5371. The accepted values are:
  5372. @table @samp
  5373. @item bt709
  5374. BT.709
  5375. @item fcc
  5376. FCC
  5377. @item bt470bg
  5378. BT.470BG or BT.601-6 625
  5379. @item smpte170m
  5380. SMPTE-170M or BT.601-6 525
  5381. @item smpte240m
  5382. SMPTE-240M
  5383. @item ycgco
  5384. YCgCo
  5385. @item bt2020ncl
  5386. BT.2020 with non-constant luminance
  5387. @end table
  5388. @anchor{trc}
  5389. @item trc
  5390. Specify output transfer characteristics.
  5391. The accepted values are:
  5392. @table @samp
  5393. @item bt709
  5394. BT.709
  5395. @item bt470m
  5396. BT.470M
  5397. @item bt470bg
  5398. BT.470BG
  5399. @item gamma22
  5400. Constant gamma of 2.2
  5401. @item gamma28
  5402. Constant gamma of 2.8
  5403. @item smpte170m
  5404. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5405. @item smpte240m
  5406. SMPTE-240M
  5407. @item srgb
  5408. SRGB
  5409. @item iec61966-2-1
  5410. iec61966-2-1
  5411. @item iec61966-2-4
  5412. iec61966-2-4
  5413. @item xvycc
  5414. xvycc
  5415. @item bt2020-10
  5416. BT.2020 for 10-bits content
  5417. @item bt2020-12
  5418. BT.2020 for 12-bits content
  5419. @end table
  5420. @anchor{primaries}
  5421. @item primaries
  5422. Specify output color primaries.
  5423. The accepted values are:
  5424. @table @samp
  5425. @item bt709
  5426. BT.709
  5427. @item bt470m
  5428. BT.470M
  5429. @item bt470bg
  5430. BT.470BG or BT.601-6 625
  5431. @item smpte170m
  5432. SMPTE-170M or BT.601-6 525
  5433. @item smpte240m
  5434. SMPTE-240M
  5435. @item film
  5436. film
  5437. @item smpte431
  5438. SMPTE-431
  5439. @item smpte432
  5440. SMPTE-432
  5441. @item bt2020
  5442. BT.2020
  5443. @item jedec-p22
  5444. JEDEC P22 phosphors
  5445. @end table
  5446. @anchor{range}
  5447. @item range
  5448. Specify output color range.
  5449. The accepted values are:
  5450. @table @samp
  5451. @item tv
  5452. TV (restricted) range
  5453. @item mpeg
  5454. MPEG (restricted) range
  5455. @item pc
  5456. PC (full) range
  5457. @item jpeg
  5458. JPEG (full) range
  5459. @end table
  5460. @item format
  5461. Specify output color format.
  5462. The accepted values are:
  5463. @table @samp
  5464. @item yuv420p
  5465. YUV 4:2:0 planar 8-bits
  5466. @item yuv420p10
  5467. YUV 4:2:0 planar 10-bits
  5468. @item yuv420p12
  5469. YUV 4:2:0 planar 12-bits
  5470. @item yuv422p
  5471. YUV 4:2:2 planar 8-bits
  5472. @item yuv422p10
  5473. YUV 4:2:2 planar 10-bits
  5474. @item yuv422p12
  5475. YUV 4:2:2 planar 12-bits
  5476. @item yuv444p
  5477. YUV 4:4:4 planar 8-bits
  5478. @item yuv444p10
  5479. YUV 4:4:4 planar 10-bits
  5480. @item yuv444p12
  5481. YUV 4:4:4 planar 12-bits
  5482. @end table
  5483. @item fast
  5484. Do a fast conversion, which skips gamma/primary correction. This will take
  5485. significantly less CPU, but will be mathematically incorrect. To get output
  5486. compatible with that produced by the colormatrix filter, use fast=1.
  5487. @item dither
  5488. Specify dithering mode.
  5489. The accepted values are:
  5490. @table @samp
  5491. @item none
  5492. No dithering
  5493. @item fsb
  5494. Floyd-Steinberg dithering
  5495. @end table
  5496. @item wpadapt
  5497. Whitepoint adaptation mode.
  5498. The accepted values are:
  5499. @table @samp
  5500. @item bradford
  5501. Bradford whitepoint adaptation
  5502. @item vonkries
  5503. von Kries whitepoint adaptation
  5504. @item identity
  5505. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5506. @end table
  5507. @item iall
  5508. Override all input properties at once. Same accepted values as @ref{all}.
  5509. @item ispace
  5510. Override input colorspace. Same accepted values as @ref{space}.
  5511. @item iprimaries
  5512. Override input color primaries. Same accepted values as @ref{primaries}.
  5513. @item itrc
  5514. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5515. @item irange
  5516. Override input color range. Same accepted values as @ref{range}.
  5517. @end table
  5518. The filter converts the transfer characteristics, color space and color
  5519. primaries to the specified user values. The output value, if not specified,
  5520. is set to a default value based on the "all" property. If that property is
  5521. also not specified, the filter will log an error. The output color range and
  5522. format default to the same value as the input color range and format. The
  5523. input transfer characteristics, color space, color primaries and color range
  5524. should be set on the input data. If any of these are missing, the filter will
  5525. log an error and no conversion will take place.
  5526. For example to convert the input to SMPTE-240M, use the command:
  5527. @example
  5528. colorspace=smpte240m
  5529. @end example
  5530. @section convolution
  5531. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5532. The filter accepts the following options:
  5533. @table @option
  5534. @item 0m
  5535. @item 1m
  5536. @item 2m
  5537. @item 3m
  5538. Set matrix for each plane.
  5539. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5540. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5541. @item 0rdiv
  5542. @item 1rdiv
  5543. @item 2rdiv
  5544. @item 3rdiv
  5545. Set multiplier for calculated value for each plane.
  5546. If unset or 0, it will be sum of all matrix elements.
  5547. @item 0bias
  5548. @item 1bias
  5549. @item 2bias
  5550. @item 3bias
  5551. Set bias for each plane. This value is added to the result of the multiplication.
  5552. Useful for making the overall image brighter or darker. Default is 0.0.
  5553. @item 0mode
  5554. @item 1mode
  5555. @item 2mode
  5556. @item 3mode
  5557. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5558. Default is @var{square}.
  5559. @end table
  5560. @subsection Examples
  5561. @itemize
  5562. @item
  5563. Apply sharpen:
  5564. @example
  5565. 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"
  5566. @end example
  5567. @item
  5568. Apply blur:
  5569. @example
  5570. 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"
  5571. @end example
  5572. @item
  5573. Apply edge enhance:
  5574. @example
  5575. 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"
  5576. @end example
  5577. @item
  5578. Apply edge detect:
  5579. @example
  5580. 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"
  5581. @end example
  5582. @item
  5583. Apply laplacian edge detector which includes diagonals:
  5584. @example
  5585. 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"
  5586. @end example
  5587. @item
  5588. Apply emboss:
  5589. @example
  5590. 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"
  5591. @end example
  5592. @end itemize
  5593. @section convolve
  5594. Apply 2D convolution of video stream in frequency domain using second stream
  5595. as impulse.
  5596. The filter accepts the following options:
  5597. @table @option
  5598. @item planes
  5599. Set which planes to process.
  5600. @item impulse
  5601. Set which impulse video frames will be processed, can be @var{first}
  5602. or @var{all}. Default is @var{all}.
  5603. @end table
  5604. The @code{convolve} filter also supports the @ref{framesync} options.
  5605. @section copy
  5606. Copy the input video source unchanged to the output. This is mainly useful for
  5607. testing purposes.
  5608. @anchor{coreimage}
  5609. @section coreimage
  5610. Video filtering on GPU using Apple's CoreImage API on OSX.
  5611. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5612. processed by video hardware. However, software-based OpenGL implementations
  5613. exist which means there is no guarantee for hardware processing. It depends on
  5614. the respective OSX.
  5615. There are many filters and image generators provided by Apple that come with a
  5616. large variety of options. The filter has to be referenced by its name along
  5617. with its options.
  5618. The coreimage filter accepts the following options:
  5619. @table @option
  5620. @item list_filters
  5621. List all available filters and generators along with all their respective
  5622. options as well as possible minimum and maximum values along with the default
  5623. values.
  5624. @example
  5625. list_filters=true
  5626. @end example
  5627. @item filter
  5628. Specify all filters by their respective name and options.
  5629. Use @var{list_filters} to determine all valid filter names and options.
  5630. Numerical options are specified by a float value and are automatically clamped
  5631. to their respective value range. Vector and color options have to be specified
  5632. by a list of space separated float values. Character escaping has to be done.
  5633. A special option name @code{default} is available to use default options for a
  5634. filter.
  5635. It is required to specify either @code{default} or at least one of the filter options.
  5636. All omitted options are used with their default values.
  5637. The syntax of the filter string is as follows:
  5638. @example
  5639. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5640. @end example
  5641. @item output_rect
  5642. Specify a rectangle where the output of the filter chain is copied into the
  5643. input image. It is given by a list of space separated float values:
  5644. @example
  5645. output_rect=x\ y\ width\ height
  5646. @end example
  5647. If not given, the output rectangle equals the dimensions of the input image.
  5648. The output rectangle is automatically cropped at the borders of the input
  5649. image. Negative values are valid for each component.
  5650. @example
  5651. output_rect=25\ 25\ 100\ 100
  5652. @end example
  5653. @end table
  5654. Several filters can be chained for successive processing without GPU-HOST
  5655. transfers allowing for fast processing of complex filter chains.
  5656. Currently, only filters with zero (generators) or exactly one (filters) input
  5657. image and one output image are supported. Also, transition filters are not yet
  5658. usable as intended.
  5659. Some filters generate output images with additional padding depending on the
  5660. respective filter kernel. The padding is automatically removed to ensure the
  5661. filter output has the same size as the input image.
  5662. For image generators, the size of the output image is determined by the
  5663. previous output image of the filter chain or the input image of the whole
  5664. filterchain, respectively. The generators do not use the pixel information of
  5665. this image to generate their output. However, the generated output is
  5666. blended onto this image, resulting in partial or complete coverage of the
  5667. output image.
  5668. The @ref{coreimagesrc} video source can be used for generating input images
  5669. which are directly fed into the filter chain. By using it, providing input
  5670. images by another video source or an input video is not required.
  5671. @subsection Examples
  5672. @itemize
  5673. @item
  5674. List all filters available:
  5675. @example
  5676. coreimage=list_filters=true
  5677. @end example
  5678. @item
  5679. Use the CIBoxBlur filter with default options to blur an image:
  5680. @example
  5681. coreimage=filter=CIBoxBlur@@default
  5682. @end example
  5683. @item
  5684. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5685. its center at 100x100 and a radius of 50 pixels:
  5686. @example
  5687. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5688. @end example
  5689. @item
  5690. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5691. given as complete and escaped command-line for Apple's standard bash shell:
  5692. @example
  5693. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5694. @end example
  5695. @end itemize
  5696. @section crop
  5697. Crop the input video to given dimensions.
  5698. It accepts the following parameters:
  5699. @table @option
  5700. @item w, out_w
  5701. The width of the output video. It defaults to @code{iw}.
  5702. This expression is evaluated only once during the filter
  5703. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5704. @item h, out_h
  5705. The height of the output video. It defaults to @code{ih}.
  5706. This expression is evaluated only once during the filter
  5707. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5708. @item x
  5709. The horizontal position, in the input video, of the left edge of the output
  5710. video. It defaults to @code{(in_w-out_w)/2}.
  5711. This expression is evaluated per-frame.
  5712. @item y
  5713. The vertical position, in the input video, of the top edge of the output video.
  5714. It defaults to @code{(in_h-out_h)/2}.
  5715. This expression is evaluated per-frame.
  5716. @item keep_aspect
  5717. If set to 1 will force the output display aspect ratio
  5718. to be the same of the input, by changing the output sample aspect
  5719. ratio. It defaults to 0.
  5720. @item exact
  5721. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5722. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5723. It defaults to 0.
  5724. @end table
  5725. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5726. expressions containing the following constants:
  5727. @table @option
  5728. @item x
  5729. @item y
  5730. The computed values for @var{x} and @var{y}. They are evaluated for
  5731. each new frame.
  5732. @item in_w
  5733. @item in_h
  5734. The input width and height.
  5735. @item iw
  5736. @item ih
  5737. These are the same as @var{in_w} and @var{in_h}.
  5738. @item out_w
  5739. @item out_h
  5740. The output (cropped) width and height.
  5741. @item ow
  5742. @item oh
  5743. These are the same as @var{out_w} and @var{out_h}.
  5744. @item a
  5745. same as @var{iw} / @var{ih}
  5746. @item sar
  5747. input sample aspect ratio
  5748. @item dar
  5749. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5750. @item hsub
  5751. @item vsub
  5752. horizontal and vertical chroma subsample values. For example for the
  5753. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5754. @item n
  5755. The number of the input frame, starting from 0.
  5756. @item pos
  5757. the position in the file of the input frame, NAN if unknown
  5758. @item t
  5759. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5760. @end table
  5761. The expression for @var{out_w} may depend on the value of @var{out_h},
  5762. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5763. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5764. evaluated after @var{out_w} and @var{out_h}.
  5765. The @var{x} and @var{y} parameters specify the expressions for the
  5766. position of the top-left corner of the output (non-cropped) area. They
  5767. are evaluated for each frame. If the evaluated value is not valid, it
  5768. is approximated to the nearest valid value.
  5769. The expression for @var{x} may depend on @var{y}, and the expression
  5770. for @var{y} may depend on @var{x}.
  5771. @subsection Examples
  5772. @itemize
  5773. @item
  5774. Crop area with size 100x100 at position (12,34).
  5775. @example
  5776. crop=100:100:12:34
  5777. @end example
  5778. Using named options, the example above becomes:
  5779. @example
  5780. crop=w=100:h=100:x=12:y=34
  5781. @end example
  5782. @item
  5783. Crop the central input area with size 100x100:
  5784. @example
  5785. crop=100:100
  5786. @end example
  5787. @item
  5788. Crop the central input area with size 2/3 of the input video:
  5789. @example
  5790. crop=2/3*in_w:2/3*in_h
  5791. @end example
  5792. @item
  5793. Crop the input video central square:
  5794. @example
  5795. crop=out_w=in_h
  5796. crop=in_h
  5797. @end example
  5798. @item
  5799. Delimit the rectangle with the top-left corner placed at position
  5800. 100:100 and the right-bottom corner corresponding to the right-bottom
  5801. corner of the input image.
  5802. @example
  5803. crop=in_w-100:in_h-100:100:100
  5804. @end example
  5805. @item
  5806. Crop 10 pixels from the left and right borders, and 20 pixels from
  5807. the top and bottom borders
  5808. @example
  5809. crop=in_w-2*10:in_h-2*20
  5810. @end example
  5811. @item
  5812. Keep only the bottom right quarter of the input image:
  5813. @example
  5814. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5815. @end example
  5816. @item
  5817. Crop height for getting Greek harmony:
  5818. @example
  5819. crop=in_w:1/PHI*in_w
  5820. @end example
  5821. @item
  5822. Apply trembling effect:
  5823. @example
  5824. 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)
  5825. @end example
  5826. @item
  5827. Apply erratic camera effect depending on timestamp:
  5828. @example
  5829. 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)"
  5830. @end example
  5831. @item
  5832. Set x depending on the value of y:
  5833. @example
  5834. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5835. @end example
  5836. @end itemize
  5837. @subsection Commands
  5838. This filter supports the following commands:
  5839. @table @option
  5840. @item w, out_w
  5841. @item h, out_h
  5842. @item x
  5843. @item y
  5844. Set width/height of the output video and the horizontal/vertical position
  5845. in the input video.
  5846. The command accepts the same syntax of the corresponding option.
  5847. If the specified expression is not valid, it is kept at its current
  5848. value.
  5849. @end table
  5850. @section cropdetect
  5851. Auto-detect the crop size.
  5852. It calculates the necessary cropping parameters and prints the
  5853. recommended parameters via the logging system. The detected dimensions
  5854. correspond to the non-black area of the input video.
  5855. It accepts the following parameters:
  5856. @table @option
  5857. @item limit
  5858. Set higher black value threshold, which can be optionally specified
  5859. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5860. value greater to the set value is considered non-black. It defaults to 24.
  5861. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5862. on the bitdepth of the pixel format.
  5863. @item round
  5864. The value which the width/height should be divisible by. It defaults to
  5865. 16. The offset is automatically adjusted to center the video. Use 2 to
  5866. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5867. encoding to most video codecs.
  5868. @item reset_count, reset
  5869. Set the counter that determines after how many frames cropdetect will
  5870. reset the previously detected largest video area and start over to
  5871. detect the current optimal crop area. Default value is 0.
  5872. This can be useful when channel logos distort the video area. 0
  5873. indicates 'never reset', and returns the largest area encountered during
  5874. playback.
  5875. @end table
  5876. @anchor{cue}
  5877. @section cue
  5878. Delay video filtering until a given wallclock timestamp. The filter first
  5879. passes on @option{preroll} amount of frames, then it buffers at most
  5880. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5881. it forwards the buffered frames and also any subsequent frames coming in its
  5882. input.
  5883. The filter can be used synchronize the output of multiple ffmpeg processes for
  5884. realtime output devices like decklink. By putting the delay in the filtering
  5885. chain and pre-buffering frames the process can pass on data to output almost
  5886. immediately after the target wallclock timestamp is reached.
  5887. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5888. some use cases.
  5889. @table @option
  5890. @item cue
  5891. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5892. @item preroll
  5893. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5894. @item buffer
  5895. The maximum duration of content to buffer before waiting for the cue expressed
  5896. in seconds. Default is 0.
  5897. @end table
  5898. @anchor{curves}
  5899. @section curves
  5900. Apply color adjustments using curves.
  5901. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5902. component (red, green and blue) has its values defined by @var{N} key points
  5903. tied from each other using a smooth curve. The x-axis represents the pixel
  5904. values from the input frame, and the y-axis the new pixel values to be set for
  5905. the output frame.
  5906. By default, a component curve is defined by the two points @var{(0;0)} and
  5907. @var{(1;1)}. This creates a straight line where each original pixel value is
  5908. "adjusted" to its own value, which means no change to the image.
  5909. The filter allows you to redefine these two points and add some more. A new
  5910. curve (using a natural cubic spline interpolation) will be define to pass
  5911. smoothly through all these new coordinates. The new defined points needs to be
  5912. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5913. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5914. the vector spaces, the values will be clipped accordingly.
  5915. The filter accepts the following options:
  5916. @table @option
  5917. @item preset
  5918. Select one of the available color presets. This option can be used in addition
  5919. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5920. options takes priority on the preset values.
  5921. Available presets are:
  5922. @table @samp
  5923. @item none
  5924. @item color_negative
  5925. @item cross_process
  5926. @item darker
  5927. @item increase_contrast
  5928. @item lighter
  5929. @item linear_contrast
  5930. @item medium_contrast
  5931. @item negative
  5932. @item strong_contrast
  5933. @item vintage
  5934. @end table
  5935. Default is @code{none}.
  5936. @item master, m
  5937. Set the master key points. These points will define a second pass mapping. It
  5938. is sometimes called a "luminance" or "value" mapping. It can be used with
  5939. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5940. post-processing LUT.
  5941. @item red, r
  5942. Set the key points for the red component.
  5943. @item green, g
  5944. Set the key points for the green component.
  5945. @item blue, b
  5946. Set the key points for the blue component.
  5947. @item all
  5948. Set the key points for all components (not including master).
  5949. Can be used in addition to the other key points component
  5950. options. In this case, the unset component(s) will fallback on this
  5951. @option{all} setting.
  5952. @item psfile
  5953. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5954. @item plot
  5955. Save Gnuplot script of the curves in specified file.
  5956. @end table
  5957. To avoid some filtergraph syntax conflicts, each key points list need to be
  5958. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5959. @subsection Examples
  5960. @itemize
  5961. @item
  5962. Increase slightly the middle level of blue:
  5963. @example
  5964. curves=blue='0/0 0.5/0.58 1/1'
  5965. @end example
  5966. @item
  5967. Vintage effect:
  5968. @example
  5969. 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'
  5970. @end example
  5971. Here we obtain the following coordinates for each components:
  5972. @table @var
  5973. @item red
  5974. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5975. @item green
  5976. @code{(0;0) (0.50;0.48) (1;1)}
  5977. @item blue
  5978. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5979. @end table
  5980. @item
  5981. The previous example can also be achieved with the associated built-in preset:
  5982. @example
  5983. curves=preset=vintage
  5984. @end example
  5985. @item
  5986. Or simply:
  5987. @example
  5988. curves=vintage
  5989. @end example
  5990. @item
  5991. Use a Photoshop preset and redefine the points of the green component:
  5992. @example
  5993. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5994. @end example
  5995. @item
  5996. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5997. and @command{gnuplot}:
  5998. @example
  5999. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6000. gnuplot -p /tmp/curves.plt
  6001. @end example
  6002. @end itemize
  6003. @section datascope
  6004. Video data analysis filter.
  6005. This filter shows hexadecimal pixel values of part of video.
  6006. The filter accepts the following options:
  6007. @table @option
  6008. @item size, s
  6009. Set output video size.
  6010. @item x
  6011. Set x offset from where to pick pixels.
  6012. @item y
  6013. Set y offset from where to pick pixels.
  6014. @item mode
  6015. Set scope mode, can be one of the following:
  6016. @table @samp
  6017. @item mono
  6018. Draw hexadecimal pixel values with white color on black background.
  6019. @item color
  6020. Draw hexadecimal pixel values with input video pixel color on black
  6021. background.
  6022. @item color2
  6023. Draw hexadecimal pixel values on color background picked from input video,
  6024. the text color is picked in such way so its always visible.
  6025. @end table
  6026. @item axis
  6027. Draw rows and columns numbers on left and top of video.
  6028. @item opacity
  6029. Set background opacity.
  6030. @end table
  6031. @section dctdnoiz
  6032. Denoise frames using 2D DCT (frequency domain filtering).
  6033. This filter is not designed for real time.
  6034. The filter accepts the following options:
  6035. @table @option
  6036. @item sigma, s
  6037. Set the noise sigma constant.
  6038. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6039. coefficient (absolute value) below this threshold with be dropped.
  6040. If you need a more advanced filtering, see @option{expr}.
  6041. Default is @code{0}.
  6042. @item overlap
  6043. Set number overlapping pixels for each block. Since the filter can be slow, you
  6044. may want to reduce this value, at the cost of a less effective filter and the
  6045. risk of various artefacts.
  6046. If the overlapping value doesn't permit processing the whole input width or
  6047. height, a warning will be displayed and according borders won't be denoised.
  6048. Default value is @var{blocksize}-1, which is the best possible setting.
  6049. @item expr, e
  6050. Set the coefficient factor expression.
  6051. For each coefficient of a DCT block, this expression will be evaluated as a
  6052. multiplier value for the coefficient.
  6053. If this is option is set, the @option{sigma} option will be ignored.
  6054. The absolute value of the coefficient can be accessed through the @var{c}
  6055. variable.
  6056. @item n
  6057. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6058. @var{blocksize}, which is the width and height of the processed blocks.
  6059. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6060. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6061. on the speed processing. Also, a larger block size does not necessarily means a
  6062. better de-noising.
  6063. @end table
  6064. @subsection Examples
  6065. Apply a denoise with a @option{sigma} of @code{4.5}:
  6066. @example
  6067. dctdnoiz=4.5
  6068. @end example
  6069. The same operation can be achieved using the expression system:
  6070. @example
  6071. dctdnoiz=e='gte(c, 4.5*3)'
  6072. @end example
  6073. Violent denoise using a block size of @code{16x16}:
  6074. @example
  6075. dctdnoiz=15:n=4
  6076. @end example
  6077. @section deband
  6078. Remove banding artifacts from input video.
  6079. It works by replacing banded pixels with average value of referenced pixels.
  6080. The filter accepts the following options:
  6081. @table @option
  6082. @item 1thr
  6083. @item 2thr
  6084. @item 3thr
  6085. @item 4thr
  6086. Set banding detection threshold for each plane. Default is 0.02.
  6087. Valid range is 0.00003 to 0.5.
  6088. If difference between current pixel and reference pixel is less than threshold,
  6089. it will be considered as banded.
  6090. @item range, r
  6091. Banding detection range in pixels. Default is 16. If positive, random number
  6092. in range 0 to set value will be used. If negative, exact absolute value
  6093. will be used.
  6094. The range defines square of four pixels around current pixel.
  6095. @item direction, d
  6096. Set direction in radians from which four pixel will be compared. If positive,
  6097. random direction from 0 to set direction will be picked. If negative, exact of
  6098. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6099. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6100. column.
  6101. @item blur, b
  6102. If enabled, current pixel is compared with average value of all four
  6103. surrounding pixels. The default is enabled. If disabled current pixel is
  6104. compared with all four surrounding pixels. The pixel is considered banded
  6105. if only all four differences with surrounding pixels are less than threshold.
  6106. @item coupling, c
  6107. If enabled, current pixel is changed if and only if all pixel components are banded,
  6108. e.g. banding detection threshold is triggered for all color components.
  6109. The default is disabled.
  6110. @end table
  6111. @section deblock
  6112. Remove blocking artifacts from input video.
  6113. The filter accepts the following options:
  6114. @table @option
  6115. @item filter
  6116. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6117. This controls what kind of deblocking is applied.
  6118. @item block
  6119. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6120. @item alpha
  6121. @item beta
  6122. @item gamma
  6123. @item delta
  6124. Set blocking detection thresholds. Allowed range is 0 to 1.
  6125. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6126. Using higher threshold gives more deblocking strength.
  6127. Setting @var{alpha} controls threshold detection at exact edge of block.
  6128. Remaining options controls threshold detection near the edge. Each one for
  6129. below/above or left/right. Setting any of those to @var{0} disables
  6130. deblocking.
  6131. @item planes
  6132. Set planes to filter. Default is to filter all available planes.
  6133. @end table
  6134. @subsection Examples
  6135. @itemize
  6136. @item
  6137. Deblock using weak filter and block size of 4 pixels.
  6138. @example
  6139. deblock=filter=weak:block=4
  6140. @end example
  6141. @item
  6142. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6143. deblocking more edges.
  6144. @example
  6145. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6146. @end example
  6147. @item
  6148. Similar as above, but filter only first plane.
  6149. @example
  6150. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6151. @end example
  6152. @item
  6153. Similar as above, but filter only second and third plane.
  6154. @example
  6155. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6156. @end example
  6157. @end itemize
  6158. @anchor{decimate}
  6159. @section decimate
  6160. Drop duplicated frames at regular intervals.
  6161. The filter accepts the following options:
  6162. @table @option
  6163. @item cycle
  6164. Set the number of frames from which one will be dropped. Setting this to
  6165. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6166. Default is @code{5}.
  6167. @item dupthresh
  6168. Set the threshold for duplicate detection. If the difference metric for a frame
  6169. is less than or equal to this value, then it is declared as duplicate. Default
  6170. is @code{1.1}
  6171. @item scthresh
  6172. Set scene change threshold. Default is @code{15}.
  6173. @item blockx
  6174. @item blocky
  6175. Set the size of the x and y-axis blocks used during metric calculations.
  6176. Larger blocks give better noise suppression, but also give worse detection of
  6177. small movements. Must be a power of two. Default is @code{32}.
  6178. @item ppsrc
  6179. Mark main input as a pre-processed input and activate clean source input
  6180. stream. This allows the input to be pre-processed with various filters to help
  6181. the metrics calculation while keeping the frame selection lossless. When set to
  6182. @code{1}, the first stream is for the pre-processed input, and the second
  6183. stream is the clean source from where the kept frames are chosen. Default is
  6184. @code{0}.
  6185. @item chroma
  6186. Set whether or not chroma is considered in the metric calculations. Default is
  6187. @code{1}.
  6188. @end table
  6189. @section deconvolve
  6190. Apply 2D deconvolution of video stream in frequency domain using second stream
  6191. as impulse.
  6192. The filter accepts the following options:
  6193. @table @option
  6194. @item planes
  6195. Set which planes to process.
  6196. @item impulse
  6197. Set which impulse video frames will be processed, can be @var{first}
  6198. or @var{all}. Default is @var{all}.
  6199. @item noise
  6200. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6201. and height are not same and not power of 2 or if stream prior to convolving
  6202. had noise.
  6203. @end table
  6204. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6205. @section dedot
  6206. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6207. It accepts the following options:
  6208. @table @option
  6209. @item m
  6210. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6211. @var{rainbows} for cross-color reduction.
  6212. @item lt
  6213. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6214. @item tl
  6215. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6216. @item tc
  6217. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6218. @item ct
  6219. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6220. @end table
  6221. @section deflate
  6222. Apply deflate effect to the video.
  6223. This filter replaces the pixel by the local(3x3) average by taking into account
  6224. only values lower than the pixel.
  6225. It accepts the following options:
  6226. @table @option
  6227. @item threshold0
  6228. @item threshold1
  6229. @item threshold2
  6230. @item threshold3
  6231. Limit the maximum change for each plane, default is 65535.
  6232. If 0, plane will remain unchanged.
  6233. @end table
  6234. @section deflicker
  6235. Remove temporal frame luminance variations.
  6236. It accepts the following options:
  6237. @table @option
  6238. @item size, s
  6239. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6240. @item mode, m
  6241. Set averaging mode to smooth temporal luminance variations.
  6242. Available values are:
  6243. @table @samp
  6244. @item am
  6245. Arithmetic mean
  6246. @item gm
  6247. Geometric mean
  6248. @item hm
  6249. Harmonic mean
  6250. @item qm
  6251. Quadratic mean
  6252. @item cm
  6253. Cubic mean
  6254. @item pm
  6255. Power mean
  6256. @item median
  6257. Median
  6258. @end table
  6259. @item bypass
  6260. Do not actually modify frame. Useful when one only wants metadata.
  6261. @end table
  6262. @section dejudder
  6263. Remove judder produced by partially interlaced telecined content.
  6264. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6265. source was partially telecined content then the output of @code{pullup,dejudder}
  6266. will have a variable frame rate. May change the recorded frame rate of the
  6267. container. Aside from that change, this filter will not affect constant frame
  6268. rate video.
  6269. The option available in this filter is:
  6270. @table @option
  6271. @item cycle
  6272. Specify the length of the window over which the judder repeats.
  6273. Accepts any integer greater than 1. Useful values are:
  6274. @table @samp
  6275. @item 4
  6276. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6277. @item 5
  6278. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6279. @item 20
  6280. If a mixture of the two.
  6281. @end table
  6282. The default is @samp{4}.
  6283. @end table
  6284. @section delogo
  6285. Suppress a TV station logo by a simple interpolation of the surrounding
  6286. pixels. Just set a rectangle covering the logo and watch it disappear
  6287. (and sometimes something even uglier appear - your mileage may vary).
  6288. It accepts the following parameters:
  6289. @table @option
  6290. @item x
  6291. @item y
  6292. Specify the top left corner coordinates of the logo. They must be
  6293. specified.
  6294. @item w
  6295. @item h
  6296. Specify the width and height of the logo to clear. They must be
  6297. specified.
  6298. @item band, t
  6299. Specify the thickness of the fuzzy edge of the rectangle (added to
  6300. @var{w} and @var{h}). The default value is 1. This option is
  6301. deprecated, setting higher values should no longer be necessary and
  6302. is not recommended.
  6303. @item show
  6304. When set to 1, a green rectangle is drawn on the screen to simplify
  6305. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6306. The default value is 0.
  6307. The rectangle is drawn on the outermost pixels which will be (partly)
  6308. replaced with interpolated values. The values of the next pixels
  6309. immediately outside this rectangle in each direction will be used to
  6310. compute the interpolated pixel values inside the rectangle.
  6311. @end table
  6312. @subsection Examples
  6313. @itemize
  6314. @item
  6315. Set a rectangle covering the area with top left corner coordinates 0,0
  6316. and size 100x77, and a band of size 10:
  6317. @example
  6318. delogo=x=0:y=0:w=100:h=77:band=10
  6319. @end example
  6320. @end itemize
  6321. @section deshake
  6322. Attempt to fix small changes in horizontal and/or vertical shift. This
  6323. filter helps remove camera shake from hand-holding a camera, bumping a
  6324. tripod, moving on a vehicle, etc.
  6325. The filter accepts the following options:
  6326. @table @option
  6327. @item x
  6328. @item y
  6329. @item w
  6330. @item h
  6331. Specify a rectangular area where to limit the search for motion
  6332. vectors.
  6333. If desired the search for motion vectors can be limited to a
  6334. rectangular area of the frame defined by its top left corner, width
  6335. and height. These parameters have the same meaning as the drawbox
  6336. filter which can be used to visualise the position of the bounding
  6337. box.
  6338. This is useful when simultaneous movement of subjects within the frame
  6339. might be confused for camera motion by the motion vector search.
  6340. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6341. then the full frame is used. This allows later options to be set
  6342. without specifying the bounding box for the motion vector search.
  6343. Default - search the whole frame.
  6344. @item rx
  6345. @item ry
  6346. Specify the maximum extent of movement in x and y directions in the
  6347. range 0-64 pixels. Default 16.
  6348. @item edge
  6349. Specify how to generate pixels to fill blanks at the edge of the
  6350. frame. Available values are:
  6351. @table @samp
  6352. @item blank, 0
  6353. Fill zeroes at blank locations
  6354. @item original, 1
  6355. Original image at blank locations
  6356. @item clamp, 2
  6357. Extruded edge value at blank locations
  6358. @item mirror, 3
  6359. Mirrored edge at blank locations
  6360. @end table
  6361. Default value is @samp{mirror}.
  6362. @item blocksize
  6363. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6364. default 8.
  6365. @item contrast
  6366. Specify the contrast threshold for blocks. Only blocks with more than
  6367. the specified contrast (difference between darkest and lightest
  6368. pixels) will be considered. Range 1-255, default 125.
  6369. @item search
  6370. Specify the search strategy. Available values are:
  6371. @table @samp
  6372. @item exhaustive, 0
  6373. Set exhaustive search
  6374. @item less, 1
  6375. Set less exhaustive search.
  6376. @end table
  6377. Default value is @samp{exhaustive}.
  6378. @item filename
  6379. If set then a detailed log of the motion search is written to the
  6380. specified file.
  6381. @end table
  6382. @section despill
  6383. Remove unwanted contamination of foreground colors, caused by reflected color of
  6384. greenscreen or bluescreen.
  6385. This filter accepts the following options:
  6386. @table @option
  6387. @item type
  6388. Set what type of despill to use.
  6389. @item mix
  6390. Set how spillmap will be generated.
  6391. @item expand
  6392. Set how much to get rid of still remaining spill.
  6393. @item red
  6394. Controls amount of red in spill area.
  6395. @item green
  6396. Controls amount of green in spill area.
  6397. Should be -1 for greenscreen.
  6398. @item blue
  6399. Controls amount of blue in spill area.
  6400. Should be -1 for bluescreen.
  6401. @item brightness
  6402. Controls brightness of spill area, preserving colors.
  6403. @item alpha
  6404. Modify alpha from generated spillmap.
  6405. @end table
  6406. @section detelecine
  6407. Apply an exact inverse of the telecine operation. It requires a predefined
  6408. pattern specified using the pattern option which must be the same as that passed
  6409. to the telecine filter.
  6410. This filter accepts the following options:
  6411. @table @option
  6412. @item first_field
  6413. @table @samp
  6414. @item top, t
  6415. top field first
  6416. @item bottom, b
  6417. bottom field first
  6418. The default value is @code{top}.
  6419. @end table
  6420. @item pattern
  6421. A string of numbers representing the pulldown pattern you wish to apply.
  6422. The default value is @code{23}.
  6423. @item start_frame
  6424. A number representing position of the first frame with respect to the telecine
  6425. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6426. @end table
  6427. @section dilation
  6428. Apply dilation effect to the video.
  6429. This filter replaces the pixel by the local(3x3) maximum.
  6430. It accepts the following options:
  6431. @table @option
  6432. @item threshold0
  6433. @item threshold1
  6434. @item threshold2
  6435. @item threshold3
  6436. Limit the maximum change for each plane, default is 65535.
  6437. If 0, plane will remain unchanged.
  6438. @item coordinates
  6439. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6440. pixels are used.
  6441. Flags to local 3x3 coordinates maps like this:
  6442. 1 2 3
  6443. 4 5
  6444. 6 7 8
  6445. @end table
  6446. @section displace
  6447. Displace pixels as indicated by second and third input stream.
  6448. It takes three input streams and outputs one stream, the first input is the
  6449. source, and second and third input are displacement maps.
  6450. The second input specifies how much to displace pixels along the
  6451. x-axis, while the third input specifies how much to displace pixels
  6452. along the y-axis.
  6453. If one of displacement map streams terminates, last frame from that
  6454. displacement map will be used.
  6455. Note that once generated, displacements maps can be reused over and over again.
  6456. A description of the accepted options follows.
  6457. @table @option
  6458. @item edge
  6459. Set displace behavior for pixels that are out of range.
  6460. Available values are:
  6461. @table @samp
  6462. @item blank
  6463. Missing pixels are replaced by black pixels.
  6464. @item smear
  6465. Adjacent pixels will spread out to replace missing pixels.
  6466. @item wrap
  6467. Out of range pixels are wrapped so they point to pixels of other side.
  6468. @item mirror
  6469. Out of range pixels will be replaced with mirrored pixels.
  6470. @end table
  6471. Default is @samp{smear}.
  6472. @end table
  6473. @subsection Examples
  6474. @itemize
  6475. @item
  6476. Add ripple effect to rgb input of video size hd720:
  6477. @example
  6478. 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
  6479. @end example
  6480. @item
  6481. Add wave effect to rgb input of video size hd720:
  6482. @example
  6483. 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
  6484. @end example
  6485. @end itemize
  6486. @section drawbox
  6487. Draw a colored box on the input image.
  6488. It accepts the following parameters:
  6489. @table @option
  6490. @item x
  6491. @item y
  6492. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6493. @item width, w
  6494. @item height, h
  6495. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6496. the input width and height. It defaults to 0.
  6497. @item color, c
  6498. Specify the color of the box to write. For the general syntax of this option,
  6499. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6500. value @code{invert} is used, the box edge color is the same as the
  6501. video with inverted luma.
  6502. @item thickness, t
  6503. The expression which sets the thickness of the box edge.
  6504. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6505. See below for the list of accepted constants.
  6506. @item replace
  6507. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6508. will overwrite the video's color and alpha pixels.
  6509. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6510. @end table
  6511. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6512. following constants:
  6513. @table @option
  6514. @item dar
  6515. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6516. @item hsub
  6517. @item vsub
  6518. horizontal and vertical chroma subsample values. For example for the
  6519. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6520. @item in_h, ih
  6521. @item in_w, iw
  6522. The input width and height.
  6523. @item sar
  6524. The input sample aspect ratio.
  6525. @item x
  6526. @item y
  6527. The x and y offset coordinates where the box is drawn.
  6528. @item w
  6529. @item h
  6530. The width and height of the drawn box.
  6531. @item t
  6532. The thickness of the drawn box.
  6533. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6534. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6535. @end table
  6536. @subsection Examples
  6537. @itemize
  6538. @item
  6539. Draw a black box around the edge of the input image:
  6540. @example
  6541. drawbox
  6542. @end example
  6543. @item
  6544. Draw a box with color red and an opacity of 50%:
  6545. @example
  6546. drawbox=10:20:200:60:red@@0.5
  6547. @end example
  6548. The previous example can be specified as:
  6549. @example
  6550. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6551. @end example
  6552. @item
  6553. Fill the box with pink color:
  6554. @example
  6555. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6556. @end example
  6557. @item
  6558. Draw a 2-pixel red 2.40:1 mask:
  6559. @example
  6560. 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
  6561. @end example
  6562. @end itemize
  6563. @section drawgrid
  6564. Draw a grid on the input image.
  6565. It accepts the following parameters:
  6566. @table @option
  6567. @item x
  6568. @item y
  6569. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6570. @item width, w
  6571. @item height, h
  6572. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6573. input width and height, respectively, minus @code{thickness}, so image gets
  6574. framed. Default to 0.
  6575. @item color, c
  6576. Specify the color of the grid. For the general syntax of this option,
  6577. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6578. value @code{invert} is used, the grid color is the same as the
  6579. video with inverted luma.
  6580. @item thickness, t
  6581. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6582. See below for the list of accepted constants.
  6583. @item replace
  6584. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6585. will overwrite the video's color and alpha pixels.
  6586. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6587. @end table
  6588. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6589. following constants:
  6590. @table @option
  6591. @item dar
  6592. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6593. @item hsub
  6594. @item vsub
  6595. horizontal and vertical chroma subsample values. For example for the
  6596. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6597. @item in_h, ih
  6598. @item in_w, iw
  6599. The input grid cell width and height.
  6600. @item sar
  6601. The input sample aspect ratio.
  6602. @item x
  6603. @item y
  6604. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6605. @item w
  6606. @item h
  6607. The width and height of the drawn cell.
  6608. @item t
  6609. The thickness of the drawn cell.
  6610. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6611. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6612. @end table
  6613. @subsection Examples
  6614. @itemize
  6615. @item
  6616. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6617. @example
  6618. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6619. @end example
  6620. @item
  6621. Draw a white 3x3 grid with an opacity of 50%:
  6622. @example
  6623. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6624. @end example
  6625. @end itemize
  6626. @anchor{drawtext}
  6627. @section drawtext
  6628. Draw a text string or text from a specified file on top of a video, using the
  6629. libfreetype library.
  6630. To enable compilation of this filter, you need to configure FFmpeg with
  6631. @code{--enable-libfreetype}.
  6632. To enable default font fallback and the @var{font} option you need to
  6633. configure FFmpeg with @code{--enable-libfontconfig}.
  6634. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6635. @code{--enable-libfribidi}.
  6636. @subsection Syntax
  6637. It accepts the following parameters:
  6638. @table @option
  6639. @item box
  6640. Used to draw a box around text using the background color.
  6641. The value must be either 1 (enable) or 0 (disable).
  6642. The default value of @var{box} is 0.
  6643. @item boxborderw
  6644. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6645. The default value of @var{boxborderw} is 0.
  6646. @item boxcolor
  6647. The color to be used for drawing box around text. For the syntax of this
  6648. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6649. The default value of @var{boxcolor} is "white".
  6650. @item line_spacing
  6651. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6652. The default value of @var{line_spacing} is 0.
  6653. @item borderw
  6654. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6655. The default value of @var{borderw} is 0.
  6656. @item bordercolor
  6657. Set the color to be used for drawing border around text. For the syntax of this
  6658. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6659. The default value of @var{bordercolor} is "black".
  6660. @item expansion
  6661. Select how the @var{text} is expanded. Can be either @code{none},
  6662. @code{strftime} (deprecated) or
  6663. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6664. below for details.
  6665. @item basetime
  6666. Set a start time for the count. Value is in microseconds. Only applied
  6667. in the deprecated strftime expansion mode. To emulate in normal expansion
  6668. mode use the @code{pts} function, supplying the start time (in seconds)
  6669. as the second argument.
  6670. @item fix_bounds
  6671. If true, check and fix text coords to avoid clipping.
  6672. @item fontcolor
  6673. The color to be used for drawing fonts. For the syntax of this option, check
  6674. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6675. The default value of @var{fontcolor} is "black".
  6676. @item fontcolor_expr
  6677. String which is expanded the same way as @var{text} to obtain dynamic
  6678. @var{fontcolor} value. By default this option has empty value and is not
  6679. processed. When this option is set, it overrides @var{fontcolor} option.
  6680. @item font
  6681. The font family to be used for drawing text. By default Sans.
  6682. @item fontfile
  6683. The font file to be used for drawing text. The path must be included.
  6684. This parameter is mandatory if the fontconfig support is disabled.
  6685. @item alpha
  6686. Draw the text applying alpha blending. The value can
  6687. be a number between 0.0 and 1.0.
  6688. The expression accepts the same variables @var{x, y} as well.
  6689. The default value is 1.
  6690. Please see @var{fontcolor_expr}.
  6691. @item fontsize
  6692. The font size to be used for drawing text.
  6693. The default value of @var{fontsize} is 16.
  6694. @item text_shaping
  6695. If set to 1, attempt to shape the text (for example, reverse the order of
  6696. right-to-left text and join Arabic characters) before drawing it.
  6697. Otherwise, just draw the text exactly as given.
  6698. By default 1 (if supported).
  6699. @item ft_load_flags
  6700. The flags to be used for loading the fonts.
  6701. The flags map the corresponding flags supported by libfreetype, and are
  6702. a combination of the following values:
  6703. @table @var
  6704. @item default
  6705. @item no_scale
  6706. @item no_hinting
  6707. @item render
  6708. @item no_bitmap
  6709. @item vertical_layout
  6710. @item force_autohint
  6711. @item crop_bitmap
  6712. @item pedantic
  6713. @item ignore_global_advance_width
  6714. @item no_recurse
  6715. @item ignore_transform
  6716. @item monochrome
  6717. @item linear_design
  6718. @item no_autohint
  6719. @end table
  6720. Default value is "default".
  6721. For more information consult the documentation for the FT_LOAD_*
  6722. libfreetype flags.
  6723. @item shadowcolor
  6724. The color to be used for drawing a shadow behind the drawn text. For the
  6725. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6726. ffmpeg-utils manual,ffmpeg-utils}.
  6727. The default value of @var{shadowcolor} is "black".
  6728. @item shadowx
  6729. @item shadowy
  6730. The x and y offsets for the text shadow position with respect to the
  6731. position of the text. They can be either positive or negative
  6732. values. The default value for both is "0".
  6733. @item start_number
  6734. The starting frame number for the n/frame_num variable. The default value
  6735. is "0".
  6736. @item tabsize
  6737. The size in number of spaces to use for rendering the tab.
  6738. Default value is 4.
  6739. @item timecode
  6740. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6741. format. It can be used with or without text parameter. @var{timecode_rate}
  6742. option must be specified.
  6743. @item timecode_rate, rate, r
  6744. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6745. integer. Minimum value is "1".
  6746. Drop-frame timecode is supported for frame rates 30 & 60.
  6747. @item tc24hmax
  6748. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6749. Default is 0 (disabled).
  6750. @item text
  6751. The text string to be drawn. The text must be a sequence of UTF-8
  6752. encoded characters.
  6753. This parameter is mandatory if no file is specified with the parameter
  6754. @var{textfile}.
  6755. @item textfile
  6756. A text file containing text to be drawn. The text must be a sequence
  6757. of UTF-8 encoded characters.
  6758. This parameter is mandatory if no text string is specified with the
  6759. parameter @var{text}.
  6760. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6761. @item reload
  6762. If set to 1, the @var{textfile} will be reloaded before each frame.
  6763. Be sure to update it atomically, or it may be read partially, or even fail.
  6764. @item x
  6765. @item y
  6766. The expressions which specify the offsets where text will be drawn
  6767. within the video frame. They are relative to the top/left border of the
  6768. output image.
  6769. The default value of @var{x} and @var{y} is "0".
  6770. See below for the list of accepted constants and functions.
  6771. @end table
  6772. The parameters for @var{x} and @var{y} are expressions containing the
  6773. following constants and functions:
  6774. @table @option
  6775. @item dar
  6776. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6777. @item hsub
  6778. @item vsub
  6779. horizontal and vertical chroma subsample values. For example for the
  6780. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6781. @item line_h, lh
  6782. the height of each text line
  6783. @item main_h, h, H
  6784. the input height
  6785. @item main_w, w, W
  6786. the input width
  6787. @item max_glyph_a, ascent
  6788. the maximum distance from the baseline to the highest/upper grid
  6789. coordinate used to place a glyph outline point, for all the rendered
  6790. glyphs.
  6791. It is a positive value, due to the grid's orientation with the Y axis
  6792. upwards.
  6793. @item max_glyph_d, descent
  6794. the maximum distance from the baseline to the lowest grid coordinate
  6795. used to place a glyph outline point, for all the rendered glyphs.
  6796. This is a negative value, due to the grid's orientation, with the Y axis
  6797. upwards.
  6798. @item max_glyph_h
  6799. maximum glyph height, that is the maximum height for all the glyphs
  6800. contained in the rendered text, it is equivalent to @var{ascent} -
  6801. @var{descent}.
  6802. @item max_glyph_w
  6803. maximum glyph width, that is the maximum width for all the glyphs
  6804. contained in the rendered text
  6805. @item n
  6806. the number of input frame, starting from 0
  6807. @item rand(min, max)
  6808. return a random number included between @var{min} and @var{max}
  6809. @item sar
  6810. The input sample aspect ratio.
  6811. @item t
  6812. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6813. @item text_h, th
  6814. the height of the rendered text
  6815. @item text_w, tw
  6816. the width of the rendered text
  6817. @item x
  6818. @item y
  6819. the x and y offset coordinates where the text is drawn.
  6820. These parameters allow the @var{x} and @var{y} expressions to refer
  6821. each other, so you can for example specify @code{y=x/dar}.
  6822. @end table
  6823. @anchor{drawtext_expansion}
  6824. @subsection Text expansion
  6825. If @option{expansion} is set to @code{strftime},
  6826. the filter recognizes strftime() sequences in the provided text and
  6827. expands them accordingly. Check the documentation of strftime(). This
  6828. feature is deprecated.
  6829. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6830. If @option{expansion} is set to @code{normal} (which is the default),
  6831. the following expansion mechanism is used.
  6832. The backslash character @samp{\}, followed by any character, always expands to
  6833. the second character.
  6834. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6835. braces is a function name, possibly followed by arguments separated by ':'.
  6836. If the arguments contain special characters or delimiters (':' or '@}'),
  6837. they should be escaped.
  6838. Note that they probably must also be escaped as the value for the
  6839. @option{text} option in the filter argument string and as the filter
  6840. argument in the filtergraph description, and possibly also for the shell,
  6841. that makes up to four levels of escaping; using a text file avoids these
  6842. problems.
  6843. The following functions are available:
  6844. @table @command
  6845. @item expr, e
  6846. The expression evaluation result.
  6847. It must take one argument specifying the expression to be evaluated,
  6848. which accepts the same constants and functions as the @var{x} and
  6849. @var{y} values. Note that not all constants should be used, for
  6850. example the text size is not known when evaluating the expression, so
  6851. the constants @var{text_w} and @var{text_h} will have an undefined
  6852. value.
  6853. @item expr_int_format, eif
  6854. Evaluate the expression's value and output as formatted integer.
  6855. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6856. The second argument specifies the output format. Allowed values are @samp{x},
  6857. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6858. @code{printf} function.
  6859. The third parameter is optional and sets the number of positions taken by the output.
  6860. It can be used to add padding with zeros from the left.
  6861. @item gmtime
  6862. The time at which the filter is running, expressed in UTC.
  6863. It can accept an argument: a strftime() format string.
  6864. @item localtime
  6865. The time at which the filter is running, expressed in the local time zone.
  6866. It can accept an argument: a strftime() format string.
  6867. @item metadata
  6868. Frame metadata. Takes one or two arguments.
  6869. The first argument is mandatory and specifies the metadata key.
  6870. The second argument is optional and specifies a default value, used when the
  6871. metadata key is not found or empty.
  6872. @item n, frame_num
  6873. The frame number, starting from 0.
  6874. @item pict_type
  6875. A 1 character description of the current picture type.
  6876. @item pts
  6877. The timestamp of the current frame.
  6878. It can take up to three arguments.
  6879. The first argument is the format of the timestamp; it defaults to @code{flt}
  6880. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6881. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6882. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6883. @code{localtime} stands for the timestamp of the frame formatted as
  6884. local time zone time.
  6885. The second argument is an offset added to the timestamp.
  6886. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6887. supplied to present the hour part of the formatted timestamp in 24h format
  6888. (00-23).
  6889. If the format is set to @code{localtime} or @code{gmtime},
  6890. a third argument may be supplied: a strftime() format string.
  6891. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6892. @end table
  6893. @subsection Examples
  6894. @itemize
  6895. @item
  6896. Draw "Test Text" with font FreeSerif, using the default values for the
  6897. optional parameters.
  6898. @example
  6899. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6900. @end example
  6901. @item
  6902. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6903. and y=50 (counting from the top-left corner of the screen), text is
  6904. yellow with a red box around it. Both the text and the box have an
  6905. opacity of 20%.
  6906. @example
  6907. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6908. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6909. @end example
  6910. Note that the double quotes are not necessary if spaces are not used
  6911. within the parameter list.
  6912. @item
  6913. Show the text at the center of the video frame:
  6914. @example
  6915. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6916. @end example
  6917. @item
  6918. Show the text at a random position, switching to a new position every 30 seconds:
  6919. @example
  6920. 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)"
  6921. @end example
  6922. @item
  6923. Show a text line sliding from right to left in the last row of the video
  6924. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6925. with no newlines.
  6926. @example
  6927. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6928. @end example
  6929. @item
  6930. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6931. @example
  6932. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6933. @end example
  6934. @item
  6935. Draw a single green letter "g", at the center of the input video.
  6936. The glyph baseline is placed at half screen height.
  6937. @example
  6938. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6939. @end example
  6940. @item
  6941. Show text for 1 second every 3 seconds:
  6942. @example
  6943. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6944. @end example
  6945. @item
  6946. Use fontconfig to set the font. Note that the colons need to be escaped.
  6947. @example
  6948. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6949. @end example
  6950. @item
  6951. Print the date of a real-time encoding (see strftime(3)):
  6952. @example
  6953. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6954. @end example
  6955. @item
  6956. Show text fading in and out (appearing/disappearing):
  6957. @example
  6958. #!/bin/sh
  6959. DS=1.0 # display start
  6960. DE=10.0 # display end
  6961. FID=1.5 # fade in duration
  6962. FOD=5 # fade out duration
  6963. 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 @}"
  6964. @end example
  6965. @item
  6966. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6967. and the @option{fontsize} value are included in the @option{y} offset.
  6968. @example
  6969. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6970. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6971. @end example
  6972. @end itemize
  6973. For more information about libfreetype, check:
  6974. @url{http://www.freetype.org/}.
  6975. For more information about fontconfig, check:
  6976. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6977. For more information about libfribidi, check:
  6978. @url{http://fribidi.org/}.
  6979. @section edgedetect
  6980. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6981. The filter accepts the following options:
  6982. @table @option
  6983. @item low
  6984. @item high
  6985. Set low and high threshold values used by the Canny thresholding
  6986. algorithm.
  6987. The high threshold selects the "strong" edge pixels, which are then
  6988. connected through 8-connectivity with the "weak" edge pixels selected
  6989. by the low threshold.
  6990. @var{low} and @var{high} threshold values must be chosen in the range
  6991. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6992. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6993. is @code{50/255}.
  6994. @item mode
  6995. Define the drawing mode.
  6996. @table @samp
  6997. @item wires
  6998. Draw white/gray wires on black background.
  6999. @item colormix
  7000. Mix the colors to create a paint/cartoon effect.
  7001. @item canny
  7002. Apply Canny edge detector on all selected planes.
  7003. @end table
  7004. Default value is @var{wires}.
  7005. @item planes
  7006. Select planes for filtering. By default all available planes are filtered.
  7007. @end table
  7008. @subsection Examples
  7009. @itemize
  7010. @item
  7011. Standard edge detection with custom values for the hysteresis thresholding:
  7012. @example
  7013. edgedetect=low=0.1:high=0.4
  7014. @end example
  7015. @item
  7016. Painting effect without thresholding:
  7017. @example
  7018. edgedetect=mode=colormix:high=0
  7019. @end example
  7020. @end itemize
  7021. @section eq
  7022. Set brightness, contrast, saturation and approximate gamma adjustment.
  7023. The filter accepts the following options:
  7024. @table @option
  7025. @item contrast
  7026. Set the contrast expression. The value must be a float value in range
  7027. @code{-2.0} to @code{2.0}. The default value is "1".
  7028. @item brightness
  7029. Set the brightness expression. The value must be a float value in
  7030. range @code{-1.0} to @code{1.0}. The default value is "0".
  7031. @item saturation
  7032. Set the saturation expression. The value must be a float in
  7033. range @code{0.0} to @code{3.0}. The default value is "1".
  7034. @item gamma
  7035. Set the gamma expression. The value must be a float in range
  7036. @code{0.1} to @code{10.0}. The default value is "1".
  7037. @item gamma_r
  7038. Set the gamma expression for red. The value must be a float in
  7039. range @code{0.1} to @code{10.0}. The default value is "1".
  7040. @item gamma_g
  7041. Set the gamma expression for green. The value must be a float in range
  7042. @code{0.1} to @code{10.0}. The default value is "1".
  7043. @item gamma_b
  7044. Set the gamma expression for blue. The value must be a float in range
  7045. @code{0.1} to @code{10.0}. The default value is "1".
  7046. @item gamma_weight
  7047. Set the gamma weight expression. It can be used to reduce the effect
  7048. of a high gamma value on bright image areas, e.g. keep them from
  7049. getting overamplified and just plain white. The value must be a float
  7050. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7051. gamma correction all the way down while @code{1.0} leaves it at its
  7052. full strength. Default is "1".
  7053. @item eval
  7054. Set when the expressions for brightness, contrast, saturation and
  7055. gamma expressions are evaluated.
  7056. It accepts the following values:
  7057. @table @samp
  7058. @item init
  7059. only evaluate expressions once during the filter initialization or
  7060. when a command is processed
  7061. @item frame
  7062. evaluate expressions for each incoming frame
  7063. @end table
  7064. Default value is @samp{init}.
  7065. @end table
  7066. The expressions accept the following parameters:
  7067. @table @option
  7068. @item n
  7069. frame count of the input frame starting from 0
  7070. @item pos
  7071. byte position of the corresponding packet in the input file, NAN if
  7072. unspecified
  7073. @item r
  7074. frame rate of the input video, NAN if the input frame rate is unknown
  7075. @item t
  7076. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7077. @end table
  7078. @subsection Commands
  7079. The filter supports the following commands:
  7080. @table @option
  7081. @item contrast
  7082. Set the contrast expression.
  7083. @item brightness
  7084. Set the brightness expression.
  7085. @item saturation
  7086. Set the saturation expression.
  7087. @item gamma
  7088. Set the gamma expression.
  7089. @item gamma_r
  7090. Set the gamma_r expression.
  7091. @item gamma_g
  7092. Set gamma_g expression.
  7093. @item gamma_b
  7094. Set gamma_b expression.
  7095. @item gamma_weight
  7096. Set gamma_weight expression.
  7097. The command accepts the same syntax of the corresponding option.
  7098. If the specified expression is not valid, it is kept at its current
  7099. value.
  7100. @end table
  7101. @section erosion
  7102. Apply erosion effect to the video.
  7103. This filter replaces the pixel by the local(3x3) minimum.
  7104. It accepts the following options:
  7105. @table @option
  7106. @item threshold0
  7107. @item threshold1
  7108. @item threshold2
  7109. @item threshold3
  7110. Limit the maximum change for each plane, default is 65535.
  7111. If 0, plane will remain unchanged.
  7112. @item coordinates
  7113. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7114. pixels are used.
  7115. Flags to local 3x3 coordinates maps like this:
  7116. 1 2 3
  7117. 4 5
  7118. 6 7 8
  7119. @end table
  7120. @section extractplanes
  7121. Extract color channel components from input video stream into
  7122. separate grayscale video streams.
  7123. The filter accepts the following option:
  7124. @table @option
  7125. @item planes
  7126. Set plane(s) to extract.
  7127. Available values for planes are:
  7128. @table @samp
  7129. @item y
  7130. @item u
  7131. @item v
  7132. @item a
  7133. @item r
  7134. @item g
  7135. @item b
  7136. @end table
  7137. Choosing planes not available in the input will result in an error.
  7138. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7139. with @code{y}, @code{u}, @code{v} planes at same time.
  7140. @end table
  7141. @subsection Examples
  7142. @itemize
  7143. @item
  7144. Extract luma, u and v color channel component from input video frame
  7145. into 3 grayscale outputs:
  7146. @example
  7147. 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
  7148. @end example
  7149. @end itemize
  7150. @section elbg
  7151. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7152. For each input image, the filter will compute the optimal mapping from
  7153. the input to the output given the codebook length, that is the number
  7154. of distinct output colors.
  7155. This filter accepts the following options.
  7156. @table @option
  7157. @item codebook_length, l
  7158. Set codebook length. The value must be a positive integer, and
  7159. represents the number of distinct output colors. Default value is 256.
  7160. @item nb_steps, n
  7161. Set the maximum number of iterations to apply for computing the optimal
  7162. mapping. The higher the value the better the result and the higher the
  7163. computation time. Default value is 1.
  7164. @item seed, s
  7165. Set a random seed, must be an integer included between 0 and
  7166. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7167. will try to use a good random seed on a best effort basis.
  7168. @item pal8
  7169. Set pal8 output pixel format. This option does not work with codebook
  7170. length greater than 256.
  7171. @end table
  7172. @section entropy
  7173. Measure graylevel entropy in histogram of color channels of video frames.
  7174. It accepts the following parameters:
  7175. @table @option
  7176. @item mode
  7177. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7178. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7179. between neighbour histogram values.
  7180. @end table
  7181. @section fade
  7182. Apply a fade-in/out effect to the input video.
  7183. It accepts the following parameters:
  7184. @table @option
  7185. @item type, t
  7186. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7187. effect.
  7188. Default is @code{in}.
  7189. @item start_frame, s
  7190. Specify the number of the frame to start applying the fade
  7191. effect at. Default is 0.
  7192. @item nb_frames, n
  7193. The number of frames that the fade effect lasts. At the end of the
  7194. fade-in effect, the output video will have the same intensity as the input video.
  7195. At the end of the fade-out transition, the output video will be filled with the
  7196. selected @option{color}.
  7197. Default is 25.
  7198. @item alpha
  7199. If set to 1, fade only alpha channel, if one exists on the input.
  7200. Default value is 0.
  7201. @item start_time, st
  7202. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7203. effect. If both start_frame and start_time are specified, the fade will start at
  7204. whichever comes last. Default is 0.
  7205. @item duration, d
  7206. The number of seconds for which the fade effect has to last. At the end of the
  7207. fade-in effect the output video will have the same intensity as the input video,
  7208. at the end of the fade-out transition the output video will be filled with the
  7209. selected @option{color}.
  7210. If both duration and nb_frames are specified, duration is used. Default is 0
  7211. (nb_frames is used by default).
  7212. @item color, c
  7213. Specify the color of the fade. Default is "black".
  7214. @end table
  7215. @subsection Examples
  7216. @itemize
  7217. @item
  7218. Fade in the first 30 frames of video:
  7219. @example
  7220. fade=in:0:30
  7221. @end example
  7222. The command above is equivalent to:
  7223. @example
  7224. fade=t=in:s=0:n=30
  7225. @end example
  7226. @item
  7227. Fade out the last 45 frames of a 200-frame video:
  7228. @example
  7229. fade=out:155:45
  7230. fade=type=out:start_frame=155:nb_frames=45
  7231. @end example
  7232. @item
  7233. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7234. @example
  7235. fade=in:0:25, fade=out:975:25
  7236. @end example
  7237. @item
  7238. Make the first 5 frames yellow, then fade in from frame 5-24:
  7239. @example
  7240. fade=in:5:20:color=yellow
  7241. @end example
  7242. @item
  7243. Fade in alpha over first 25 frames of video:
  7244. @example
  7245. fade=in:0:25:alpha=1
  7246. @end example
  7247. @item
  7248. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7249. @example
  7250. fade=t=in:st=5.5:d=0.5
  7251. @end example
  7252. @end itemize
  7253. @section fftfilt
  7254. Apply arbitrary expressions to samples in frequency domain
  7255. @table @option
  7256. @item dc_Y
  7257. Adjust the dc value (gain) of the luma plane of the image. The filter
  7258. accepts an integer value in range @code{0} to @code{1000}. The default
  7259. value is set to @code{0}.
  7260. @item dc_U
  7261. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7262. filter accepts an integer value in range @code{0} to @code{1000}. The
  7263. default value is set to @code{0}.
  7264. @item dc_V
  7265. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7266. filter accepts an integer value in range @code{0} to @code{1000}. The
  7267. default value is set to @code{0}.
  7268. @item weight_Y
  7269. Set the frequency domain weight expression for the luma plane.
  7270. @item weight_U
  7271. Set the frequency domain weight expression for the 1st chroma plane.
  7272. @item weight_V
  7273. Set the frequency domain weight expression for the 2nd chroma plane.
  7274. @item eval
  7275. Set when the expressions are evaluated.
  7276. It accepts the following values:
  7277. @table @samp
  7278. @item init
  7279. Only evaluate expressions once during the filter initialization.
  7280. @item frame
  7281. Evaluate expressions for each incoming frame.
  7282. @end table
  7283. Default value is @samp{init}.
  7284. The filter accepts the following variables:
  7285. @item X
  7286. @item Y
  7287. The coordinates of the current sample.
  7288. @item W
  7289. @item H
  7290. The width and height of the image.
  7291. @item N
  7292. The number of input frame, starting from 0.
  7293. @end table
  7294. @subsection Examples
  7295. @itemize
  7296. @item
  7297. High-pass:
  7298. @example
  7299. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7300. @end example
  7301. @item
  7302. Low-pass:
  7303. @example
  7304. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7305. @end example
  7306. @item
  7307. Sharpen:
  7308. @example
  7309. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7310. @end example
  7311. @item
  7312. Blur:
  7313. @example
  7314. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7315. @end example
  7316. @end itemize
  7317. @section fftdnoiz
  7318. Denoise frames using 3D FFT (frequency domain filtering).
  7319. The filter accepts the following options:
  7320. @table @option
  7321. @item sigma
  7322. Set the noise sigma constant. This sets denoising strength.
  7323. Default value is 1. Allowed range is from 0 to 30.
  7324. Using very high sigma with low overlap may give blocking artifacts.
  7325. @item amount
  7326. Set amount of denoising. By default all detected noise is reduced.
  7327. Default value is 1. Allowed range is from 0 to 1.
  7328. @item block
  7329. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7330. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7331. block size in pixels is 2^4 which is 16.
  7332. @item overlap
  7333. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7334. @item prev
  7335. Set number of previous frames to use for denoising. By default is set to 0.
  7336. @item next
  7337. Set number of next frames to to use for denoising. By default is set to 0.
  7338. @item planes
  7339. Set planes which will be filtered, by default are all available filtered
  7340. except alpha.
  7341. @end table
  7342. @section field
  7343. Extract a single field from an interlaced image using stride
  7344. arithmetic to avoid wasting CPU time. The output frames are marked as
  7345. non-interlaced.
  7346. The filter accepts the following options:
  7347. @table @option
  7348. @item type
  7349. Specify whether to extract the top (if the value is @code{0} or
  7350. @code{top}) or the bottom field (if the value is @code{1} or
  7351. @code{bottom}).
  7352. @end table
  7353. @section fieldhint
  7354. Create new frames by copying the top and bottom fields from surrounding frames
  7355. supplied as numbers by the hint file.
  7356. @table @option
  7357. @item hint
  7358. Set file containing hints: absolute/relative frame numbers.
  7359. There must be one line for each frame in a clip. Each line must contain two
  7360. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7361. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7362. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7363. for @code{relative} mode. First number tells from which frame to pick up top
  7364. field and second number tells from which frame to pick up bottom field.
  7365. If optionally followed by @code{+} output frame will be marked as interlaced,
  7366. else if followed by @code{-} output frame will be marked as progressive, else
  7367. it will be marked same as input frame.
  7368. If line starts with @code{#} or @code{;} that line is skipped.
  7369. @item mode
  7370. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7371. @end table
  7372. Example of first several lines of @code{hint} file for @code{relative} mode:
  7373. @example
  7374. 0,0 - # first frame
  7375. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7376. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7377. 1,0 -
  7378. 0,0 -
  7379. 0,0 -
  7380. 1,0 -
  7381. 1,0 -
  7382. 1,0 -
  7383. 0,0 -
  7384. 0,0 -
  7385. 1,0 -
  7386. 1,0 -
  7387. 1,0 -
  7388. 0,0 -
  7389. @end example
  7390. @section fieldmatch
  7391. Field matching filter for inverse telecine. It is meant to reconstruct the
  7392. progressive frames from a telecined stream. The filter does not drop duplicated
  7393. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7394. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7395. The separation of the field matching and the decimation is notably motivated by
  7396. the possibility of inserting a de-interlacing filter fallback between the two.
  7397. If the source has mixed telecined and real interlaced content,
  7398. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7399. But these remaining combed frames will be marked as interlaced, and thus can be
  7400. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7401. In addition to the various configuration options, @code{fieldmatch} can take an
  7402. optional second stream, activated through the @option{ppsrc} option. If
  7403. enabled, the frames reconstruction will be based on the fields and frames from
  7404. this second stream. This allows the first input to be pre-processed in order to
  7405. help the various algorithms of the filter, while keeping the output lossless
  7406. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7407. or brightness/contrast adjustments can help.
  7408. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7409. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7410. which @code{fieldmatch} is based on. While the semantic and usage are very
  7411. close, some behaviour and options names can differ.
  7412. The @ref{decimate} filter currently only works for constant frame rate input.
  7413. If your input has mixed telecined (30fps) and progressive content with a lower
  7414. framerate like 24fps use the following filterchain to produce the necessary cfr
  7415. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7416. The filter accepts the following options:
  7417. @table @option
  7418. @item order
  7419. Specify the assumed field order of the input stream. Available values are:
  7420. @table @samp
  7421. @item auto
  7422. Auto detect parity (use FFmpeg's internal parity value).
  7423. @item bff
  7424. Assume bottom field first.
  7425. @item tff
  7426. Assume top field first.
  7427. @end table
  7428. Note that it is sometimes recommended not to trust the parity announced by the
  7429. stream.
  7430. Default value is @var{auto}.
  7431. @item mode
  7432. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7433. sense that it won't risk creating jerkiness due to duplicate frames when
  7434. possible, but if there are bad edits or blended fields it will end up
  7435. outputting combed frames when a good match might actually exist. On the other
  7436. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7437. but will almost always find a good frame if there is one. The other values are
  7438. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7439. jerkiness and creating duplicate frames versus finding good matches in sections
  7440. with bad edits, orphaned fields, blended fields, etc.
  7441. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7442. Available values are:
  7443. @table @samp
  7444. @item pc
  7445. 2-way matching (p/c)
  7446. @item pc_n
  7447. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7448. @item pc_u
  7449. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7450. @item pc_n_ub
  7451. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7452. still combed (p/c + n + u/b)
  7453. @item pcn
  7454. 3-way matching (p/c/n)
  7455. @item pcn_ub
  7456. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7457. detected as combed (p/c/n + u/b)
  7458. @end table
  7459. The parenthesis at the end indicate the matches that would be used for that
  7460. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7461. @var{top}).
  7462. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7463. the slowest.
  7464. Default value is @var{pc_n}.
  7465. @item ppsrc
  7466. Mark the main input stream as a pre-processed input, and enable the secondary
  7467. input stream as the clean source to pick the fields from. See the filter
  7468. introduction for more details. It is similar to the @option{clip2} feature from
  7469. VFM/TFM.
  7470. Default value is @code{0} (disabled).
  7471. @item field
  7472. Set the field to match from. It is recommended to set this to the same value as
  7473. @option{order} unless you experience matching failures with that setting. In
  7474. certain circumstances changing the field that is used to match from can have a
  7475. large impact on matching performance. Available values are:
  7476. @table @samp
  7477. @item auto
  7478. Automatic (same value as @option{order}).
  7479. @item bottom
  7480. Match from the bottom field.
  7481. @item top
  7482. Match from the top field.
  7483. @end table
  7484. Default value is @var{auto}.
  7485. @item mchroma
  7486. Set whether or not chroma is included during the match comparisons. In most
  7487. cases it is recommended to leave this enabled. You should set this to @code{0}
  7488. only if your clip has bad chroma problems such as heavy rainbowing or other
  7489. artifacts. Setting this to @code{0} could also be used to speed things up at
  7490. the cost of some accuracy.
  7491. Default value is @code{1}.
  7492. @item y0
  7493. @item y1
  7494. These define an exclusion band which excludes the lines between @option{y0} and
  7495. @option{y1} from being included in the field matching decision. An exclusion
  7496. band can be used to ignore subtitles, a logo, or other things that may
  7497. interfere with the matching. @option{y0} sets the starting scan line and
  7498. @option{y1} sets the ending line; all lines in between @option{y0} and
  7499. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7500. @option{y0} and @option{y1} to the same value will disable the feature.
  7501. @option{y0} and @option{y1} defaults to @code{0}.
  7502. @item scthresh
  7503. Set the scene change detection threshold as a percentage of maximum change on
  7504. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7505. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7506. @option{scthresh} is @code{[0.0, 100.0]}.
  7507. Default value is @code{12.0}.
  7508. @item combmatch
  7509. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7510. account the combed scores of matches when deciding what match to use as the
  7511. final match. Available values are:
  7512. @table @samp
  7513. @item none
  7514. No final matching based on combed scores.
  7515. @item sc
  7516. Combed scores are only used when a scene change is detected.
  7517. @item full
  7518. Use combed scores all the time.
  7519. @end table
  7520. Default is @var{sc}.
  7521. @item combdbg
  7522. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7523. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7524. Available values are:
  7525. @table @samp
  7526. @item none
  7527. No forced calculation.
  7528. @item pcn
  7529. Force p/c/n calculations.
  7530. @item pcnub
  7531. Force p/c/n/u/b calculations.
  7532. @end table
  7533. Default value is @var{none}.
  7534. @item cthresh
  7535. This is the area combing threshold used for combed frame detection. This
  7536. essentially controls how "strong" or "visible" combing must be to be detected.
  7537. Larger values mean combing must be more visible and smaller values mean combing
  7538. can be less visible or strong and still be detected. Valid settings are from
  7539. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7540. be detected as combed). This is basically a pixel difference value. A good
  7541. range is @code{[8, 12]}.
  7542. Default value is @code{9}.
  7543. @item chroma
  7544. Sets whether or not chroma is considered in the combed frame decision. Only
  7545. disable this if your source has chroma problems (rainbowing, etc.) that are
  7546. causing problems for the combed frame detection with chroma enabled. Actually,
  7547. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7548. where there is chroma only combing in the source.
  7549. Default value is @code{0}.
  7550. @item blockx
  7551. @item blocky
  7552. Respectively set the x-axis and y-axis size of the window used during combed
  7553. frame detection. This has to do with the size of the area in which
  7554. @option{combpel} pixels are required to be detected as combed for a frame to be
  7555. declared combed. See the @option{combpel} parameter description for more info.
  7556. Possible values are any number that is a power of 2 starting at 4 and going up
  7557. to 512.
  7558. Default value is @code{16}.
  7559. @item combpel
  7560. The number of combed pixels inside any of the @option{blocky} by
  7561. @option{blockx} size blocks on the frame for the frame to be detected as
  7562. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7563. setting controls "how much" combing there must be in any localized area (a
  7564. window defined by the @option{blockx} and @option{blocky} settings) on the
  7565. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7566. which point no frames will ever be detected as combed). This setting is known
  7567. as @option{MI} in TFM/VFM vocabulary.
  7568. Default value is @code{80}.
  7569. @end table
  7570. @anchor{p/c/n/u/b meaning}
  7571. @subsection p/c/n/u/b meaning
  7572. @subsubsection p/c/n
  7573. We assume the following telecined stream:
  7574. @example
  7575. Top fields: 1 2 2 3 4
  7576. Bottom fields: 1 2 3 4 4
  7577. @end example
  7578. The numbers correspond to the progressive frame the fields relate to. Here, the
  7579. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7580. When @code{fieldmatch} is configured to run a matching from bottom
  7581. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7582. @example
  7583. Input stream:
  7584. T 1 2 2 3 4
  7585. B 1 2 3 4 4 <-- matching reference
  7586. Matches: c c n n c
  7587. Output stream:
  7588. T 1 2 3 4 4
  7589. B 1 2 3 4 4
  7590. @end example
  7591. As a result of the field matching, we can see that some frames get duplicated.
  7592. To perform a complete inverse telecine, you need to rely on a decimation filter
  7593. after this operation. See for instance the @ref{decimate} filter.
  7594. The same operation now matching from top fields (@option{field}=@var{top})
  7595. looks like this:
  7596. @example
  7597. Input stream:
  7598. T 1 2 2 3 4 <-- matching reference
  7599. B 1 2 3 4 4
  7600. Matches: c c p p c
  7601. Output stream:
  7602. T 1 2 2 3 4
  7603. B 1 2 2 3 4
  7604. @end example
  7605. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7606. basically, they refer to the frame and field of the opposite parity:
  7607. @itemize
  7608. @item @var{p} matches the field of the opposite parity in the previous frame
  7609. @item @var{c} matches the field of the opposite parity in the current frame
  7610. @item @var{n} matches the field of the opposite parity in the next frame
  7611. @end itemize
  7612. @subsubsection u/b
  7613. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7614. from the opposite parity flag. In the following examples, we assume that we are
  7615. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7616. 'x' is placed above and below each matched fields.
  7617. With bottom matching (@option{field}=@var{bottom}):
  7618. @example
  7619. Match: c p n b u
  7620. x x x x x
  7621. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7622. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7623. x x x x x
  7624. Output frames:
  7625. 2 1 2 2 2
  7626. 2 2 2 1 3
  7627. @end example
  7628. With top matching (@option{field}=@var{top}):
  7629. @example
  7630. Match: c p n b u
  7631. x x x x x
  7632. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7633. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7634. x x x x x
  7635. Output frames:
  7636. 2 2 2 1 2
  7637. 2 1 3 2 2
  7638. @end example
  7639. @subsection Examples
  7640. Simple IVTC of a top field first telecined stream:
  7641. @example
  7642. fieldmatch=order=tff:combmatch=none, decimate
  7643. @end example
  7644. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7645. @example
  7646. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7647. @end example
  7648. @section fieldorder
  7649. Transform the field order of the input video.
  7650. It accepts the following parameters:
  7651. @table @option
  7652. @item order
  7653. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7654. for bottom field first.
  7655. @end table
  7656. The default value is @samp{tff}.
  7657. The transformation is done by shifting the picture content up or down
  7658. by one line, and filling the remaining line with appropriate picture content.
  7659. This method is consistent with most broadcast field order converters.
  7660. If the input video is not flagged as being interlaced, or it is already
  7661. flagged as being of the required output field order, then this filter does
  7662. not alter the incoming video.
  7663. It is very useful when converting to or from PAL DV material,
  7664. which is bottom field first.
  7665. For example:
  7666. @example
  7667. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7668. @end example
  7669. @section fifo, afifo
  7670. Buffer input images and send them when they are requested.
  7671. It is mainly useful when auto-inserted by the libavfilter
  7672. framework.
  7673. It does not take parameters.
  7674. @section fillborders
  7675. Fill borders of the input video, without changing video stream dimensions.
  7676. Sometimes video can have garbage at the four edges and you may not want to
  7677. crop video input to keep size multiple of some number.
  7678. This filter accepts the following options:
  7679. @table @option
  7680. @item left
  7681. Number of pixels to fill from left border.
  7682. @item right
  7683. Number of pixels to fill from right border.
  7684. @item top
  7685. Number of pixels to fill from top border.
  7686. @item bottom
  7687. Number of pixels to fill from bottom border.
  7688. @item mode
  7689. Set fill mode.
  7690. It accepts the following values:
  7691. @table @samp
  7692. @item smear
  7693. fill pixels using outermost pixels
  7694. @item mirror
  7695. fill pixels using mirroring
  7696. @item fixed
  7697. fill pixels with constant value
  7698. @end table
  7699. Default is @var{smear}.
  7700. @item color
  7701. Set color for pixels in fixed mode. Default is @var{black}.
  7702. @end table
  7703. @section find_rect
  7704. Find a rectangular object
  7705. It accepts the following options:
  7706. @table @option
  7707. @item object
  7708. Filepath of the object image, needs to be in gray8.
  7709. @item threshold
  7710. Detection threshold, default is 0.5.
  7711. @item mipmaps
  7712. Number of mipmaps, default is 3.
  7713. @item xmin, ymin, xmax, ymax
  7714. Specifies the rectangle in which to search.
  7715. @end table
  7716. @subsection Examples
  7717. @itemize
  7718. @item
  7719. Generate a representative palette of a given video using @command{ffmpeg}:
  7720. @example
  7721. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7722. @end example
  7723. @end itemize
  7724. @section cover_rect
  7725. Cover a rectangular object
  7726. It accepts the following options:
  7727. @table @option
  7728. @item cover
  7729. Filepath of the optional cover image, needs to be in yuv420.
  7730. @item mode
  7731. Set covering mode.
  7732. It accepts the following values:
  7733. @table @samp
  7734. @item cover
  7735. cover it by the supplied image
  7736. @item blur
  7737. cover it by interpolating the surrounding pixels
  7738. @end table
  7739. Default value is @var{blur}.
  7740. @end table
  7741. @subsection Examples
  7742. @itemize
  7743. @item
  7744. Generate a representative palette of a given video using @command{ffmpeg}:
  7745. @example
  7746. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7747. @end example
  7748. @end itemize
  7749. @section floodfill
  7750. Flood area with values of same pixel components with another values.
  7751. It accepts the following options:
  7752. @table @option
  7753. @item x
  7754. Set pixel x coordinate.
  7755. @item y
  7756. Set pixel y coordinate.
  7757. @item s0
  7758. Set source #0 component value.
  7759. @item s1
  7760. Set source #1 component value.
  7761. @item s2
  7762. Set source #2 component value.
  7763. @item s3
  7764. Set source #3 component value.
  7765. @item d0
  7766. Set destination #0 component value.
  7767. @item d1
  7768. Set destination #1 component value.
  7769. @item d2
  7770. Set destination #2 component value.
  7771. @item d3
  7772. Set destination #3 component value.
  7773. @end table
  7774. @anchor{format}
  7775. @section format
  7776. Convert the input video to one of the specified pixel formats.
  7777. Libavfilter will try to pick one that is suitable as input to
  7778. the next filter.
  7779. It accepts the following parameters:
  7780. @table @option
  7781. @item pix_fmts
  7782. A '|'-separated list of pixel format names, such as
  7783. "pix_fmts=yuv420p|monow|rgb24".
  7784. @end table
  7785. @subsection Examples
  7786. @itemize
  7787. @item
  7788. Convert the input video to the @var{yuv420p} format
  7789. @example
  7790. format=pix_fmts=yuv420p
  7791. @end example
  7792. Convert the input video to any of the formats in the list
  7793. @example
  7794. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7795. @end example
  7796. @end itemize
  7797. @anchor{fps}
  7798. @section fps
  7799. Convert the video to specified constant frame rate by duplicating or dropping
  7800. frames as necessary.
  7801. It accepts the following parameters:
  7802. @table @option
  7803. @item fps
  7804. The desired output frame rate. The default is @code{25}.
  7805. @item start_time
  7806. Assume the first PTS should be the given value, in seconds. This allows for
  7807. padding/trimming at the start of stream. By default, no assumption is made
  7808. about the first frame's expected PTS, so no padding or trimming is done.
  7809. For example, this could be set to 0 to pad the beginning with duplicates of
  7810. the first frame if a video stream starts after the audio stream or to trim any
  7811. frames with a negative PTS.
  7812. @item round
  7813. Timestamp (PTS) rounding method.
  7814. Possible values are:
  7815. @table @option
  7816. @item zero
  7817. round towards 0
  7818. @item inf
  7819. round away from 0
  7820. @item down
  7821. round towards -infinity
  7822. @item up
  7823. round towards +infinity
  7824. @item near
  7825. round to nearest
  7826. @end table
  7827. The default is @code{near}.
  7828. @item eof_action
  7829. Action performed when reading the last frame.
  7830. Possible values are:
  7831. @table @option
  7832. @item round
  7833. Use same timestamp rounding method as used for other frames.
  7834. @item pass
  7835. Pass through last frame if input duration has not been reached yet.
  7836. @end table
  7837. The default is @code{round}.
  7838. @end table
  7839. Alternatively, the options can be specified as a flat string:
  7840. @var{fps}[:@var{start_time}[:@var{round}]].
  7841. See also the @ref{setpts} filter.
  7842. @subsection Examples
  7843. @itemize
  7844. @item
  7845. A typical usage in order to set the fps to 25:
  7846. @example
  7847. fps=fps=25
  7848. @end example
  7849. @item
  7850. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7851. @example
  7852. fps=fps=film:round=near
  7853. @end example
  7854. @end itemize
  7855. @section framepack
  7856. Pack two different video streams into a stereoscopic video, setting proper
  7857. metadata on supported codecs. The two views should have the same size and
  7858. framerate and processing will stop when the shorter video ends. Please note
  7859. that you may conveniently adjust view properties with the @ref{scale} and
  7860. @ref{fps} filters.
  7861. It accepts the following parameters:
  7862. @table @option
  7863. @item format
  7864. The desired packing format. Supported values are:
  7865. @table @option
  7866. @item sbs
  7867. The views are next to each other (default).
  7868. @item tab
  7869. The views are on top of each other.
  7870. @item lines
  7871. The views are packed by line.
  7872. @item columns
  7873. The views are packed by column.
  7874. @item frameseq
  7875. The views are temporally interleaved.
  7876. @end table
  7877. @end table
  7878. Some examples:
  7879. @example
  7880. # Convert left and right views into a frame-sequential video
  7881. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7882. # Convert views into a side-by-side video with the same output resolution as the input
  7883. 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
  7884. @end example
  7885. @section framerate
  7886. Change the frame rate by interpolating new video output frames from the source
  7887. frames.
  7888. This filter is not designed to function correctly with interlaced media. If
  7889. you wish to change the frame rate of interlaced media then you are required
  7890. to deinterlace before this filter and re-interlace after this filter.
  7891. A description of the accepted options follows.
  7892. @table @option
  7893. @item fps
  7894. Specify the output frames per second. This option can also be specified
  7895. as a value alone. The default is @code{50}.
  7896. @item interp_start
  7897. Specify the start of a range where the output frame will be created as a
  7898. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7899. the default is @code{15}.
  7900. @item interp_end
  7901. Specify the end of a range where the output frame will be created as a
  7902. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7903. the default is @code{240}.
  7904. @item scene
  7905. Specify the level at which a scene change is detected as a value between
  7906. 0 and 100 to indicate a new scene; a low value reflects a low
  7907. probability for the current frame to introduce a new scene, while a higher
  7908. value means the current frame is more likely to be one.
  7909. The default is @code{8.2}.
  7910. @item flags
  7911. Specify flags influencing the filter process.
  7912. Available value for @var{flags} is:
  7913. @table @option
  7914. @item scene_change_detect, scd
  7915. Enable scene change detection using the value of the option @var{scene}.
  7916. This flag is enabled by default.
  7917. @end table
  7918. @end table
  7919. @section framestep
  7920. Select one frame every N-th frame.
  7921. This filter accepts the following option:
  7922. @table @option
  7923. @item step
  7924. Select frame after every @code{step} frames.
  7925. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7926. @end table
  7927. @section freezedetect
  7928. Detect frozen video.
  7929. This filter logs a message and sets frame metadata when it detects that the
  7930. input video has no significant change in content during a specified duration.
  7931. Video freeze detection calculates the mean average absolute difference of all
  7932. the components of video frames and compares it to a noise floor.
  7933. The printed times and duration are expressed in seconds. The
  7934. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7935. whose timestamp equals or exceeds the detection duration and it contains the
  7936. timestamp of the first frame of the freeze. The
  7937. @code{lavfi.freezedetect.freeze_duration} and
  7938. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7939. after the freeze.
  7940. The filter accepts the following options:
  7941. @table @option
  7942. @item noise, n
  7943. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7944. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7945. 0.001.
  7946. @item duration, d
  7947. Set freeze duration until notification (default is 2 seconds).
  7948. @end table
  7949. @anchor{frei0r}
  7950. @section frei0r
  7951. Apply a frei0r effect to the input video.
  7952. To enable the compilation of this filter, you need to install the frei0r
  7953. header and configure FFmpeg with @code{--enable-frei0r}.
  7954. It accepts the following parameters:
  7955. @table @option
  7956. @item filter_name
  7957. The name of the frei0r effect to load. If the environment variable
  7958. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7959. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7960. Otherwise, the standard frei0r paths are searched, in this order:
  7961. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7962. @file{/usr/lib/frei0r-1/}.
  7963. @item filter_params
  7964. A '|'-separated list of parameters to pass to the frei0r effect.
  7965. @end table
  7966. A frei0r effect parameter can be a boolean (its value is either
  7967. "y" or "n"), a double, a color (specified as
  7968. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7969. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7970. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7971. a position (specified as @var{X}/@var{Y}, where
  7972. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7973. The number and types of parameters depend on the loaded effect. If an
  7974. effect parameter is not specified, the default value is set.
  7975. @subsection Examples
  7976. @itemize
  7977. @item
  7978. Apply the distort0r effect, setting the first two double parameters:
  7979. @example
  7980. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7981. @end example
  7982. @item
  7983. Apply the colordistance effect, taking a color as the first parameter:
  7984. @example
  7985. frei0r=colordistance:0.2/0.3/0.4
  7986. frei0r=colordistance:violet
  7987. frei0r=colordistance:0x112233
  7988. @end example
  7989. @item
  7990. Apply the perspective effect, specifying the top left and top right image
  7991. positions:
  7992. @example
  7993. frei0r=perspective:0.2/0.2|0.8/0.2
  7994. @end example
  7995. @end itemize
  7996. For more information, see
  7997. @url{http://frei0r.dyne.org}
  7998. @section fspp
  7999. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8000. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8001. processing filter, one of them is performed once per block, not per pixel.
  8002. This allows for much higher speed.
  8003. The filter accepts the following options:
  8004. @table @option
  8005. @item quality
  8006. Set quality. This option defines the number of levels for averaging. It accepts
  8007. an integer in the range 4-5. Default value is @code{4}.
  8008. @item qp
  8009. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8010. If not set, the filter will use the QP from the video stream (if available).
  8011. @item strength
  8012. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8013. more details but also more artifacts, while higher values make the image smoother
  8014. but also blurrier. Default value is @code{0} − PSNR optimal.
  8015. @item use_bframe_qp
  8016. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8017. option may cause flicker since the B-Frames have often larger QP. Default is
  8018. @code{0} (not enabled).
  8019. @end table
  8020. @section gblur
  8021. Apply Gaussian blur filter.
  8022. The filter accepts the following options:
  8023. @table @option
  8024. @item sigma
  8025. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8026. @item steps
  8027. Set number of steps for Gaussian approximation. Default is @code{1}.
  8028. @item planes
  8029. Set which planes to filter. By default all planes are filtered.
  8030. @item sigmaV
  8031. Set vertical sigma, if negative it will be same as @code{sigma}.
  8032. Default is @code{-1}.
  8033. @end table
  8034. @section geq
  8035. Apply generic equation to each pixel.
  8036. The filter accepts the following options:
  8037. @table @option
  8038. @item lum_expr, lum
  8039. Set the luminance expression.
  8040. @item cb_expr, cb
  8041. Set the chrominance blue expression.
  8042. @item cr_expr, cr
  8043. Set the chrominance red expression.
  8044. @item alpha_expr, a
  8045. Set the alpha expression.
  8046. @item red_expr, r
  8047. Set the red expression.
  8048. @item green_expr, g
  8049. Set the green expression.
  8050. @item blue_expr, b
  8051. Set the blue expression.
  8052. @end table
  8053. The colorspace is selected according to the specified options. If one
  8054. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8055. options is specified, the filter will automatically select a YCbCr
  8056. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8057. @option{blue_expr} options is specified, it will select an RGB
  8058. colorspace.
  8059. If one of the chrominance expression is not defined, it falls back on the other
  8060. one. If no alpha expression is specified it will evaluate to opaque value.
  8061. If none of chrominance expressions are specified, they will evaluate
  8062. to the luminance expression.
  8063. The expressions can use the following variables and functions:
  8064. @table @option
  8065. @item N
  8066. The sequential number of the filtered frame, starting from @code{0}.
  8067. @item X
  8068. @item Y
  8069. The coordinates of the current sample.
  8070. @item W
  8071. @item H
  8072. The width and height of the image.
  8073. @item SW
  8074. @item SH
  8075. Width and height scale depending on the currently filtered plane. It is the
  8076. ratio between the corresponding luma plane number of pixels and the current
  8077. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8078. @code{0.5,0.5} for chroma planes.
  8079. @item T
  8080. Time of the current frame, expressed in seconds.
  8081. @item p(x, y)
  8082. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8083. plane.
  8084. @item lum(x, y)
  8085. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8086. plane.
  8087. @item cb(x, y)
  8088. Return the value of the pixel at location (@var{x},@var{y}) of the
  8089. blue-difference chroma plane. Return 0 if there is no such plane.
  8090. @item cr(x, y)
  8091. Return the value of the pixel at location (@var{x},@var{y}) of the
  8092. red-difference chroma plane. Return 0 if there is no such plane.
  8093. @item r(x, y)
  8094. @item g(x, y)
  8095. @item b(x, y)
  8096. Return the value of the pixel at location (@var{x},@var{y}) of the
  8097. red/green/blue component. Return 0 if there is no such component.
  8098. @item alpha(x, y)
  8099. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8100. plane. Return 0 if there is no such plane.
  8101. @end table
  8102. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8103. automatically clipped to the closer edge.
  8104. @subsection Examples
  8105. @itemize
  8106. @item
  8107. Flip the image horizontally:
  8108. @example
  8109. geq=p(W-X\,Y)
  8110. @end example
  8111. @item
  8112. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8113. wavelength of 100 pixels:
  8114. @example
  8115. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8116. @end example
  8117. @item
  8118. Generate a fancy enigmatic moving light:
  8119. @example
  8120. 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
  8121. @end example
  8122. @item
  8123. Generate a quick emboss effect:
  8124. @example
  8125. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8126. @end example
  8127. @item
  8128. Modify RGB components depending on pixel position:
  8129. @example
  8130. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8131. @end example
  8132. @item
  8133. Create a radial gradient that is the same size as the input (also see
  8134. the @ref{vignette} filter):
  8135. @example
  8136. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8137. @end example
  8138. @end itemize
  8139. @section gradfun
  8140. Fix the banding artifacts that are sometimes introduced into nearly flat
  8141. regions by truncation to 8-bit color depth.
  8142. Interpolate the gradients that should go where the bands are, and
  8143. dither them.
  8144. It is designed for playback only. Do not use it prior to
  8145. lossy compression, because compression tends to lose the dither and
  8146. bring back the bands.
  8147. It accepts the following parameters:
  8148. @table @option
  8149. @item strength
  8150. The maximum amount by which the filter will change any one pixel. This is also
  8151. the threshold for detecting nearly flat regions. Acceptable values range from
  8152. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8153. valid range.
  8154. @item radius
  8155. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8156. gradients, but also prevents the filter from modifying the pixels near detailed
  8157. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8158. values will be clipped to the valid range.
  8159. @end table
  8160. Alternatively, the options can be specified as a flat string:
  8161. @var{strength}[:@var{radius}]
  8162. @subsection Examples
  8163. @itemize
  8164. @item
  8165. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8166. @example
  8167. gradfun=3.5:8
  8168. @end example
  8169. @item
  8170. Specify radius, omitting the strength (which will fall-back to the default
  8171. value):
  8172. @example
  8173. gradfun=radius=8
  8174. @end example
  8175. @end itemize
  8176. @section graphmonitor, agraphmonitor
  8177. Show various filtergraph stats.
  8178. With this filter one can debug complete filtergraph.
  8179. Especially issues with links filling with queued frames.
  8180. The filter accepts the following options:
  8181. @table @option
  8182. @item size, s
  8183. Set video output size. Default is @var{hd720}.
  8184. @item opacity, o
  8185. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8186. @item mode, m
  8187. Set output mode, can be @var{fulll} or @var{compact}.
  8188. In @var{compact} mode only filters with some queued frames have displayed stats.
  8189. @item flags, f
  8190. Set flags which enable which stats are shown in video.
  8191. Available values for flags are:
  8192. @table @samp
  8193. @item queue
  8194. Display number of queued frames in each link.
  8195. @item frame_count_in
  8196. Display number of frames taken from filter.
  8197. @item frame_count_out
  8198. Display number of frames given out from filter.
  8199. @item pts
  8200. Display current filtered frame pts.
  8201. @item time
  8202. Display current filtered frame time.
  8203. @item timebase
  8204. Display time base for filter link.
  8205. @item format
  8206. Display used format for filter link.
  8207. @item size
  8208. Display video size or number of audio channels in case of audio used by filter link.
  8209. @item rate
  8210. Display video frame rate or sample rate in case of audio used by filter link.
  8211. @end table
  8212. @item rate, r
  8213. Set upper limit for video rate of output stream, Default value is @var{25}.
  8214. This guarantee that output video frame rate will not be higher than this value.
  8215. @end table
  8216. @section greyedge
  8217. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8218. and corrects the scene colors accordingly.
  8219. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8220. The filter accepts the following options:
  8221. @table @option
  8222. @item difford
  8223. The order of differentiation to be applied on the scene. Must be chosen in the range
  8224. [0,2] and default value is 1.
  8225. @item minknorm
  8226. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8227. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8228. max value instead of calculating Minkowski distance.
  8229. @item sigma
  8230. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8231. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8232. can't be equal to 0 if @var{difford} is greater than 0.
  8233. @end table
  8234. @subsection Examples
  8235. @itemize
  8236. @item
  8237. Grey Edge:
  8238. @example
  8239. greyedge=difford=1:minknorm=5:sigma=2
  8240. @end example
  8241. @item
  8242. Max Edge:
  8243. @example
  8244. greyedge=difford=1:minknorm=0:sigma=2
  8245. @end example
  8246. @end itemize
  8247. @anchor{haldclut}
  8248. @section haldclut
  8249. Apply a Hald CLUT to a video stream.
  8250. First input is the video stream to process, and second one is the Hald CLUT.
  8251. The Hald CLUT input can be a simple picture or a complete video stream.
  8252. The filter accepts the following options:
  8253. @table @option
  8254. @item shortest
  8255. Force termination when the shortest input terminates. Default is @code{0}.
  8256. @item repeatlast
  8257. Continue applying the last CLUT after the end of the stream. A value of
  8258. @code{0} disable the filter after the last frame of the CLUT is reached.
  8259. Default is @code{1}.
  8260. @end table
  8261. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8262. filters share the same internals).
  8263. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8264. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8265. @subsection Workflow examples
  8266. @subsubsection Hald CLUT video stream
  8267. Generate an identity Hald CLUT stream altered with various effects:
  8268. @example
  8269. 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
  8270. @end example
  8271. Note: make sure you use a lossless codec.
  8272. Then use it with @code{haldclut} to apply it on some random stream:
  8273. @example
  8274. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8275. @end example
  8276. The Hald CLUT will be applied to the 10 first seconds (duration of
  8277. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8278. to the remaining frames of the @code{mandelbrot} stream.
  8279. @subsubsection Hald CLUT with preview
  8280. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8281. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8282. biggest possible square starting at the top left of the picture. The remaining
  8283. padding pixels (bottom or right) will be ignored. This area can be used to add
  8284. a preview of the Hald CLUT.
  8285. Typically, the following generated Hald CLUT will be supported by the
  8286. @code{haldclut} filter:
  8287. @example
  8288. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8289. pad=iw+320 [padded_clut];
  8290. smptebars=s=320x256, split [a][b];
  8291. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8292. [main][b] overlay=W-320" -frames:v 1 clut.png
  8293. @end example
  8294. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8295. bars are displayed on the right-top, and below the same color bars processed by
  8296. the color changes.
  8297. Then, the effect of this Hald CLUT can be visualized with:
  8298. @example
  8299. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8300. @end example
  8301. @section hflip
  8302. Flip the input video horizontally.
  8303. For example, to horizontally flip the input video with @command{ffmpeg}:
  8304. @example
  8305. ffmpeg -i in.avi -vf "hflip" out.avi
  8306. @end example
  8307. @section histeq
  8308. This filter applies a global color histogram equalization on a
  8309. per-frame basis.
  8310. It can be used to correct video that has a compressed range of pixel
  8311. intensities. The filter redistributes the pixel intensities to
  8312. equalize their distribution across the intensity range. It may be
  8313. viewed as an "automatically adjusting contrast filter". This filter is
  8314. useful only for correcting degraded or poorly captured source
  8315. video.
  8316. The filter accepts the following options:
  8317. @table @option
  8318. @item strength
  8319. Determine the amount of equalization to be applied. As the strength
  8320. is reduced, the distribution of pixel intensities more-and-more
  8321. approaches that of the input frame. The value must be a float number
  8322. in the range [0,1] and defaults to 0.200.
  8323. @item intensity
  8324. Set the maximum intensity that can generated and scale the output
  8325. values appropriately. The strength should be set as desired and then
  8326. the intensity can be limited if needed to avoid washing-out. The value
  8327. must be a float number in the range [0,1] and defaults to 0.210.
  8328. @item antibanding
  8329. Set the antibanding level. If enabled the filter will randomly vary
  8330. the luminance of output pixels by a small amount to avoid banding of
  8331. the histogram. Possible values are @code{none}, @code{weak} or
  8332. @code{strong}. It defaults to @code{none}.
  8333. @end table
  8334. @section histogram
  8335. Compute and draw a color distribution histogram for the input video.
  8336. The computed histogram is a representation of the color component
  8337. distribution in an image.
  8338. Standard histogram displays the color components distribution in an image.
  8339. Displays color graph for each color component. Shows distribution of
  8340. the Y, U, V, A or R, G, B components, depending on input format, in the
  8341. current frame. Below each graph a color component scale meter is shown.
  8342. The filter accepts the following options:
  8343. @table @option
  8344. @item level_height
  8345. Set height of level. Default value is @code{200}.
  8346. Allowed range is [50, 2048].
  8347. @item scale_height
  8348. Set height of color scale. Default value is @code{12}.
  8349. Allowed range is [0, 40].
  8350. @item display_mode
  8351. Set display mode.
  8352. It accepts the following values:
  8353. @table @samp
  8354. @item stack
  8355. Per color component graphs are placed below each other.
  8356. @item parade
  8357. Per color component graphs are placed side by side.
  8358. @item overlay
  8359. Presents information identical to that in the @code{parade}, except
  8360. that the graphs representing color components are superimposed directly
  8361. over one another.
  8362. @end table
  8363. Default is @code{stack}.
  8364. @item levels_mode
  8365. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8366. Default is @code{linear}.
  8367. @item components
  8368. Set what color components to display.
  8369. Default is @code{7}.
  8370. @item fgopacity
  8371. Set foreground opacity. Default is @code{0.7}.
  8372. @item bgopacity
  8373. Set background opacity. Default is @code{0.5}.
  8374. @end table
  8375. @subsection Examples
  8376. @itemize
  8377. @item
  8378. Calculate and draw histogram:
  8379. @example
  8380. ffplay -i input -vf histogram
  8381. @end example
  8382. @end itemize
  8383. @anchor{hqdn3d}
  8384. @section hqdn3d
  8385. This is a high precision/quality 3d denoise filter. It aims to reduce
  8386. image noise, producing smooth images and making still images really
  8387. still. It should enhance compressibility.
  8388. It accepts the following optional parameters:
  8389. @table @option
  8390. @item luma_spatial
  8391. A non-negative floating point number which specifies spatial luma strength.
  8392. It defaults to 4.0.
  8393. @item chroma_spatial
  8394. A non-negative floating point number which specifies spatial chroma strength.
  8395. It defaults to 3.0*@var{luma_spatial}/4.0.
  8396. @item luma_tmp
  8397. A floating point number which specifies luma temporal strength. It defaults to
  8398. 6.0*@var{luma_spatial}/4.0.
  8399. @item chroma_tmp
  8400. A floating point number which specifies chroma temporal strength. It defaults to
  8401. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8402. @end table
  8403. @anchor{hwdownload}
  8404. @section hwdownload
  8405. Download hardware frames to system memory.
  8406. The input must be in hardware frames, and the output a non-hardware format.
  8407. Not all formats will be supported on the output - it may be necessary to insert
  8408. an additional @option{format} filter immediately following in the graph to get
  8409. the output in a supported format.
  8410. @section hwmap
  8411. Map hardware frames to system memory or to another device.
  8412. This filter has several different modes of operation; which one is used depends
  8413. on the input and output formats:
  8414. @itemize
  8415. @item
  8416. Hardware frame input, normal frame output
  8417. Map the input frames to system memory and pass them to the output. If the
  8418. original hardware frame is later required (for example, after overlaying
  8419. something else on part of it), the @option{hwmap} filter can be used again
  8420. in the next mode to retrieve it.
  8421. @item
  8422. Normal frame input, hardware frame output
  8423. If the input is actually a software-mapped hardware frame, then unmap it -
  8424. that is, return the original hardware frame.
  8425. Otherwise, a device must be provided. Create new hardware surfaces on that
  8426. device for the output, then map them back to the software format at the input
  8427. and give those frames to the preceding filter. This will then act like the
  8428. @option{hwupload} filter, but may be able to avoid an additional copy when
  8429. the input is already in a compatible format.
  8430. @item
  8431. Hardware frame input and output
  8432. A device must be supplied for the output, either directly or with the
  8433. @option{derive_device} option. The input and output devices must be of
  8434. different types and compatible - the exact meaning of this is
  8435. system-dependent, but typically it means that they must refer to the same
  8436. underlying hardware context (for example, refer to the same graphics card).
  8437. If the input frames were originally created on the output device, then unmap
  8438. to retrieve the original frames.
  8439. Otherwise, map the frames to the output device - create new hardware frames
  8440. on the output corresponding to the frames on the input.
  8441. @end itemize
  8442. The following additional parameters are accepted:
  8443. @table @option
  8444. @item mode
  8445. Set the frame mapping mode. Some combination of:
  8446. @table @var
  8447. @item read
  8448. The mapped frame should be readable.
  8449. @item write
  8450. The mapped frame should be writeable.
  8451. @item overwrite
  8452. The mapping will always overwrite the entire frame.
  8453. This may improve performance in some cases, as the original contents of the
  8454. frame need not be loaded.
  8455. @item direct
  8456. The mapping must not involve any copying.
  8457. Indirect mappings to copies of frames are created in some cases where either
  8458. direct mapping is not possible or it would have unexpected properties.
  8459. Setting this flag ensures that the mapping is direct and will fail if that is
  8460. not possible.
  8461. @end table
  8462. Defaults to @var{read+write} if not specified.
  8463. @item derive_device @var{type}
  8464. Rather than using the device supplied at initialisation, instead derive a new
  8465. device of type @var{type} from the device the input frames exist on.
  8466. @item reverse
  8467. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8468. and map them back to the source. This may be necessary in some cases where
  8469. a mapping in one direction is required but only the opposite direction is
  8470. supported by the devices being used.
  8471. This option is dangerous - it may break the preceding filter in undefined
  8472. ways if there are any additional constraints on that filter's output.
  8473. Do not use it without fully understanding the implications of its use.
  8474. @end table
  8475. @anchor{hwupload}
  8476. @section hwupload
  8477. Upload system memory frames to hardware surfaces.
  8478. The device to upload to must be supplied when the filter is initialised. If
  8479. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8480. option.
  8481. @anchor{hwupload_cuda}
  8482. @section hwupload_cuda
  8483. Upload system memory frames to a CUDA device.
  8484. It accepts the following optional parameters:
  8485. @table @option
  8486. @item device
  8487. The number of the CUDA device to use
  8488. @end table
  8489. @section hqx
  8490. Apply a high-quality magnification filter designed for pixel art. This filter
  8491. was originally created by Maxim Stepin.
  8492. It accepts the following option:
  8493. @table @option
  8494. @item n
  8495. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8496. @code{hq3x} and @code{4} for @code{hq4x}.
  8497. Default is @code{3}.
  8498. @end table
  8499. @section hstack
  8500. Stack input videos horizontally.
  8501. All streams must be of same pixel format and of same height.
  8502. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8503. to create same output.
  8504. The filter accept the following option:
  8505. @table @option
  8506. @item inputs
  8507. Set number of input streams. Default is 2.
  8508. @item shortest
  8509. If set to 1, force the output to terminate when the shortest input
  8510. terminates. Default value is 0.
  8511. @end table
  8512. @section hue
  8513. Modify the hue and/or the saturation of the input.
  8514. It accepts the following parameters:
  8515. @table @option
  8516. @item h
  8517. Specify the hue angle as a number of degrees. It accepts an expression,
  8518. and defaults to "0".
  8519. @item s
  8520. Specify the saturation in the [-10,10] range. It accepts an expression and
  8521. defaults to "1".
  8522. @item H
  8523. Specify the hue angle as a number of radians. It accepts an
  8524. expression, and defaults to "0".
  8525. @item b
  8526. Specify the brightness in the [-10,10] range. It accepts an expression and
  8527. defaults to "0".
  8528. @end table
  8529. @option{h} and @option{H} are mutually exclusive, and can't be
  8530. specified at the same time.
  8531. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8532. expressions containing the following constants:
  8533. @table @option
  8534. @item n
  8535. frame count of the input frame starting from 0
  8536. @item pts
  8537. presentation timestamp of the input frame expressed in time base units
  8538. @item r
  8539. frame rate of the input video, NAN if the input frame rate is unknown
  8540. @item t
  8541. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8542. @item tb
  8543. time base of the input video
  8544. @end table
  8545. @subsection Examples
  8546. @itemize
  8547. @item
  8548. Set the hue to 90 degrees and the saturation to 1.0:
  8549. @example
  8550. hue=h=90:s=1
  8551. @end example
  8552. @item
  8553. Same command but expressing the hue in radians:
  8554. @example
  8555. hue=H=PI/2:s=1
  8556. @end example
  8557. @item
  8558. Rotate hue and make the saturation swing between 0
  8559. and 2 over a period of 1 second:
  8560. @example
  8561. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8562. @end example
  8563. @item
  8564. Apply a 3 seconds saturation fade-in effect starting at 0:
  8565. @example
  8566. hue="s=min(t/3\,1)"
  8567. @end example
  8568. The general fade-in expression can be written as:
  8569. @example
  8570. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8571. @end example
  8572. @item
  8573. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8574. @example
  8575. hue="s=max(0\, min(1\, (8-t)/3))"
  8576. @end example
  8577. The general fade-out expression can be written as:
  8578. @example
  8579. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8580. @end example
  8581. @end itemize
  8582. @subsection Commands
  8583. This filter supports the following commands:
  8584. @table @option
  8585. @item b
  8586. @item s
  8587. @item h
  8588. @item H
  8589. Modify the hue and/or the saturation and/or brightness of the input video.
  8590. The command accepts the same syntax of the corresponding option.
  8591. If the specified expression is not valid, it is kept at its current
  8592. value.
  8593. @end table
  8594. @section hysteresis
  8595. Grow first stream into second stream by connecting components.
  8596. This makes it possible to build more robust edge masks.
  8597. This filter accepts the following options:
  8598. @table @option
  8599. @item planes
  8600. Set which planes will be processed as bitmap, unprocessed planes will be
  8601. copied from first stream.
  8602. By default value 0xf, all planes will be processed.
  8603. @item threshold
  8604. Set threshold which is used in filtering. If pixel component value is higher than
  8605. this value filter algorithm for connecting components is activated.
  8606. By default value is 0.
  8607. @end table
  8608. @section idet
  8609. Detect video interlacing type.
  8610. This filter tries to detect if the input frames are interlaced, progressive,
  8611. top or bottom field first. It will also try to detect fields that are
  8612. repeated between adjacent frames (a sign of telecine).
  8613. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8614. Multiple frame detection incorporates the classification history of previous frames.
  8615. The filter will log these metadata values:
  8616. @table @option
  8617. @item single.current_frame
  8618. Detected type of current frame using single-frame detection. One of:
  8619. ``tff'' (top field first), ``bff'' (bottom field first),
  8620. ``progressive'', or ``undetermined''
  8621. @item single.tff
  8622. Cumulative number of frames detected as top field first using single-frame detection.
  8623. @item multiple.tff
  8624. Cumulative number of frames detected as top field first using multiple-frame detection.
  8625. @item single.bff
  8626. Cumulative number of frames detected as bottom field first using single-frame detection.
  8627. @item multiple.current_frame
  8628. Detected type of current frame using multiple-frame detection. One of:
  8629. ``tff'' (top field first), ``bff'' (bottom field first),
  8630. ``progressive'', or ``undetermined''
  8631. @item multiple.bff
  8632. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8633. @item single.progressive
  8634. Cumulative number of frames detected as progressive using single-frame detection.
  8635. @item multiple.progressive
  8636. Cumulative number of frames detected as progressive using multiple-frame detection.
  8637. @item single.undetermined
  8638. Cumulative number of frames that could not be classified using single-frame detection.
  8639. @item multiple.undetermined
  8640. Cumulative number of frames that could not be classified using multiple-frame detection.
  8641. @item repeated.current_frame
  8642. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8643. @item repeated.neither
  8644. Cumulative number of frames with no repeated field.
  8645. @item repeated.top
  8646. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8647. @item repeated.bottom
  8648. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8649. @end table
  8650. The filter accepts the following options:
  8651. @table @option
  8652. @item intl_thres
  8653. Set interlacing threshold.
  8654. @item prog_thres
  8655. Set progressive threshold.
  8656. @item rep_thres
  8657. Threshold for repeated field detection.
  8658. @item half_life
  8659. Number of frames after which a given frame's contribution to the
  8660. statistics is halved (i.e., it contributes only 0.5 to its
  8661. classification). The default of 0 means that all frames seen are given
  8662. full weight of 1.0 forever.
  8663. @item analyze_interlaced_flag
  8664. When this is not 0 then idet will use the specified number of frames to determine
  8665. if the interlaced flag is accurate, it will not count undetermined frames.
  8666. If the flag is found to be accurate it will be used without any further
  8667. computations, if it is found to be inaccurate it will be cleared without any
  8668. further computations. This allows inserting the idet filter as a low computational
  8669. method to clean up the interlaced flag
  8670. @end table
  8671. @section il
  8672. Deinterleave or interleave fields.
  8673. This filter allows one to process interlaced images fields without
  8674. deinterlacing them. Deinterleaving splits the input frame into 2
  8675. fields (so called half pictures). Odd lines are moved to the top
  8676. half of the output image, even lines to the bottom half.
  8677. You can process (filter) them independently and then re-interleave them.
  8678. The filter accepts the following options:
  8679. @table @option
  8680. @item luma_mode, l
  8681. @item chroma_mode, c
  8682. @item alpha_mode, a
  8683. Available values for @var{luma_mode}, @var{chroma_mode} and
  8684. @var{alpha_mode} are:
  8685. @table @samp
  8686. @item none
  8687. Do nothing.
  8688. @item deinterleave, d
  8689. Deinterleave fields, placing one above the other.
  8690. @item interleave, i
  8691. Interleave fields. Reverse the effect of deinterleaving.
  8692. @end table
  8693. Default value is @code{none}.
  8694. @item luma_swap, ls
  8695. @item chroma_swap, cs
  8696. @item alpha_swap, as
  8697. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8698. @end table
  8699. @section inflate
  8700. Apply inflate effect to the video.
  8701. This filter replaces the pixel by the local(3x3) average by taking into account
  8702. only values higher than the pixel.
  8703. It accepts the following options:
  8704. @table @option
  8705. @item threshold0
  8706. @item threshold1
  8707. @item threshold2
  8708. @item threshold3
  8709. Limit the maximum change for each plane, default is 65535.
  8710. If 0, plane will remain unchanged.
  8711. @end table
  8712. @section interlace
  8713. Simple interlacing filter from progressive contents. This interleaves upper (or
  8714. lower) lines from odd frames with lower (or upper) lines from even frames,
  8715. halving the frame rate and preserving image height.
  8716. @example
  8717. Original Original New Frame
  8718. Frame 'j' Frame 'j+1' (tff)
  8719. ========== =========== ==================
  8720. Line 0 --------------------> Frame 'j' Line 0
  8721. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8722. Line 2 ---------------------> Frame 'j' Line 2
  8723. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8724. ... ... ...
  8725. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8726. @end example
  8727. It accepts the following optional parameters:
  8728. @table @option
  8729. @item scan
  8730. This determines whether the interlaced frame is taken from the even
  8731. (tff - default) or odd (bff) lines of the progressive frame.
  8732. @item lowpass
  8733. Vertical lowpass filter to avoid twitter interlacing and
  8734. reduce moire patterns.
  8735. @table @samp
  8736. @item 0, off
  8737. Disable vertical lowpass filter
  8738. @item 1, linear
  8739. Enable linear filter (default)
  8740. @item 2, complex
  8741. Enable complex filter. This will slightly less reduce twitter and moire
  8742. but better retain detail and subjective sharpness impression.
  8743. @end table
  8744. @end table
  8745. @section kerndeint
  8746. Deinterlace input video by applying Donald Graft's adaptive kernel
  8747. deinterling. Work on interlaced parts of a video to produce
  8748. progressive frames.
  8749. The description of the accepted parameters follows.
  8750. @table @option
  8751. @item thresh
  8752. Set the threshold which affects the filter's tolerance when
  8753. determining if a pixel line must be processed. It must be an integer
  8754. in the range [0,255] and defaults to 10. A value of 0 will result in
  8755. applying the process on every pixels.
  8756. @item map
  8757. Paint pixels exceeding the threshold value to white if set to 1.
  8758. Default is 0.
  8759. @item order
  8760. Set the fields order. Swap fields if set to 1, leave fields alone if
  8761. 0. Default is 0.
  8762. @item sharp
  8763. Enable additional sharpening if set to 1. Default is 0.
  8764. @item twoway
  8765. Enable twoway sharpening if set to 1. Default is 0.
  8766. @end table
  8767. @subsection Examples
  8768. @itemize
  8769. @item
  8770. Apply default values:
  8771. @example
  8772. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8773. @end example
  8774. @item
  8775. Enable additional sharpening:
  8776. @example
  8777. kerndeint=sharp=1
  8778. @end example
  8779. @item
  8780. Paint processed pixels in white:
  8781. @example
  8782. kerndeint=map=1
  8783. @end example
  8784. @end itemize
  8785. @section lagfun
  8786. Slowly update darker pixels.
  8787. This filter makes short flashes of light appear longer.
  8788. This filter accepts the following options:
  8789. @table @option
  8790. @item decay
  8791. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8792. @item planes
  8793. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8794. @end table
  8795. @section lenscorrection
  8796. Correct radial lens distortion
  8797. This filter can be used to correct for radial distortion as can result from the use
  8798. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8799. one can use tools available for example as part of opencv or simply trial-and-error.
  8800. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8801. and extract the k1 and k2 coefficients from the resulting matrix.
  8802. Note that effectively the same filter is available in the open-source tools Krita and
  8803. Digikam from the KDE project.
  8804. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8805. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8806. brightness distribution, so you may want to use both filters together in certain
  8807. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8808. be applied before or after lens correction.
  8809. @subsection Options
  8810. The filter accepts the following options:
  8811. @table @option
  8812. @item cx
  8813. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8814. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8815. width. Default is 0.5.
  8816. @item cy
  8817. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8818. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8819. height. Default is 0.5.
  8820. @item k1
  8821. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8822. no correction. Default is 0.
  8823. @item k2
  8824. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8825. 0 means no correction. Default is 0.
  8826. @end table
  8827. The formula that generates the correction is:
  8828. @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)
  8829. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8830. distances from the focal point in the source and target images, respectively.
  8831. @section lensfun
  8832. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8833. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8834. to apply the lens correction. The filter will load the lensfun database and
  8835. query it to find the corresponding camera and lens entries in the database. As
  8836. long as these entries can be found with the given options, the filter can
  8837. perform corrections on frames. Note that incomplete strings will result in the
  8838. filter choosing the best match with the given options, and the filter will
  8839. output the chosen camera and lens models (logged with level "info"). You must
  8840. provide the make, camera model, and lens model as they are required.
  8841. The filter accepts the following options:
  8842. @table @option
  8843. @item make
  8844. The make of the camera (for example, "Canon"). This option is required.
  8845. @item model
  8846. The model of the camera (for example, "Canon EOS 100D"). This option is
  8847. required.
  8848. @item lens_model
  8849. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8850. option is required.
  8851. @item mode
  8852. The type of correction to apply. The following values are valid options:
  8853. @table @samp
  8854. @item vignetting
  8855. Enables fixing lens vignetting.
  8856. @item geometry
  8857. Enables fixing lens geometry. This is the default.
  8858. @item subpixel
  8859. Enables fixing chromatic aberrations.
  8860. @item vig_geo
  8861. Enables fixing lens vignetting and lens geometry.
  8862. @item vig_subpixel
  8863. Enables fixing lens vignetting and chromatic aberrations.
  8864. @item distortion
  8865. Enables fixing both lens geometry and chromatic aberrations.
  8866. @item all
  8867. Enables all possible corrections.
  8868. @end table
  8869. @item focal_length
  8870. The focal length of the image/video (zoom; expected constant for video). For
  8871. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8872. range should be chosen when using that lens. Default 18.
  8873. @item aperture
  8874. The aperture of the image/video (expected constant for video). Note that
  8875. aperture is only used for vignetting correction. Default 3.5.
  8876. @item focus_distance
  8877. The focus distance of the image/video (expected constant for video). Note that
  8878. focus distance is only used for vignetting and only slightly affects the
  8879. vignetting correction process. If unknown, leave it at the default value (which
  8880. is 1000).
  8881. @item scale
  8882. The scale factor which is applied after transformation. After correction the
  8883. video is no longer necessarily rectangular. This parameter controls how much of
  8884. the resulting image is visible. The value 0 means that a value will be chosen
  8885. automatically such that there is little or no unmapped area in the output
  8886. image. 1.0 means that no additional scaling is done. Lower values may result
  8887. in more of the corrected image being visible, while higher values may avoid
  8888. unmapped areas in the output.
  8889. @item target_geometry
  8890. The target geometry of the output image/video. The following values are valid
  8891. options:
  8892. @table @samp
  8893. @item rectilinear (default)
  8894. @item fisheye
  8895. @item panoramic
  8896. @item equirectangular
  8897. @item fisheye_orthographic
  8898. @item fisheye_stereographic
  8899. @item fisheye_equisolid
  8900. @item fisheye_thoby
  8901. @end table
  8902. @item reverse
  8903. Apply the reverse of image correction (instead of correcting distortion, apply
  8904. it).
  8905. @item interpolation
  8906. The type of interpolation used when correcting distortion. The following values
  8907. are valid options:
  8908. @table @samp
  8909. @item nearest
  8910. @item linear (default)
  8911. @item lanczos
  8912. @end table
  8913. @end table
  8914. @subsection Examples
  8915. @itemize
  8916. @item
  8917. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8918. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8919. aperture of "8.0".
  8920. @example
  8921. 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
  8922. @end example
  8923. @item
  8924. Apply the same as before, but only for the first 5 seconds of video.
  8925. @example
  8926. 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
  8927. @end example
  8928. @end itemize
  8929. @section libvmaf
  8930. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8931. score between two input videos.
  8932. The obtained VMAF score is printed through the logging system.
  8933. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8934. After installing the library it can be enabled using:
  8935. @code{./configure --enable-libvmaf --enable-version3}.
  8936. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8937. The filter has following options:
  8938. @table @option
  8939. @item model_path
  8940. Set the model path which is to be used for SVM.
  8941. Default value: @code{"vmaf_v0.6.1.pkl"}
  8942. @item log_path
  8943. Set the file path to be used to store logs.
  8944. @item log_fmt
  8945. Set the format of the log file (xml or json).
  8946. @item enable_transform
  8947. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8948. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8949. Default value: @code{false}
  8950. @item phone_model
  8951. Invokes the phone model which will generate VMAF scores higher than in the
  8952. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8953. @item psnr
  8954. Enables computing psnr along with vmaf.
  8955. @item ssim
  8956. Enables computing ssim along with vmaf.
  8957. @item ms_ssim
  8958. Enables computing ms_ssim along with vmaf.
  8959. @item pool
  8960. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8961. @item n_threads
  8962. Set number of threads to be used when computing vmaf.
  8963. @item n_subsample
  8964. Set interval for frame subsampling used when computing vmaf.
  8965. @item enable_conf_interval
  8966. Enables confidence interval.
  8967. @end table
  8968. This filter also supports the @ref{framesync} options.
  8969. On the below examples the input file @file{main.mpg} being processed is
  8970. compared with the reference file @file{ref.mpg}.
  8971. @example
  8972. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8973. @end example
  8974. Example with options:
  8975. @example
  8976. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8977. @end example
  8978. @section limiter
  8979. Limits the pixel components values to the specified range [min, max].
  8980. The filter accepts the following options:
  8981. @table @option
  8982. @item min
  8983. Lower bound. Defaults to the lowest allowed value for the input.
  8984. @item max
  8985. Upper bound. Defaults to the highest allowed value for the input.
  8986. @item planes
  8987. Specify which planes will be processed. Defaults to all available.
  8988. @end table
  8989. @section loop
  8990. Loop video frames.
  8991. The filter accepts the following options:
  8992. @table @option
  8993. @item loop
  8994. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8995. Default is 0.
  8996. @item size
  8997. Set maximal size in number of frames. Default is 0.
  8998. @item start
  8999. Set first frame of loop. Default is 0.
  9000. @end table
  9001. @subsection Examples
  9002. @itemize
  9003. @item
  9004. Loop single first frame infinitely:
  9005. @example
  9006. loop=loop=-1:size=1:start=0
  9007. @end example
  9008. @item
  9009. Loop single first frame 10 times:
  9010. @example
  9011. loop=loop=10:size=1:start=0
  9012. @end example
  9013. @item
  9014. Loop 10 first frames 5 times:
  9015. @example
  9016. loop=loop=5:size=10:start=0
  9017. @end example
  9018. @end itemize
  9019. @section lut1d
  9020. Apply a 1D LUT to an input video.
  9021. The filter accepts the following options:
  9022. @table @option
  9023. @item file
  9024. Set the 1D LUT file name.
  9025. Currently supported formats:
  9026. @table @samp
  9027. @item cube
  9028. Iridas
  9029. @item csp
  9030. cineSpace
  9031. @end table
  9032. @item interp
  9033. Select interpolation mode.
  9034. Available values are:
  9035. @table @samp
  9036. @item nearest
  9037. Use values from the nearest defined point.
  9038. @item linear
  9039. Interpolate values using the linear interpolation.
  9040. @item cosine
  9041. Interpolate values using the cosine interpolation.
  9042. @item cubic
  9043. Interpolate values using the cubic interpolation.
  9044. @item spline
  9045. Interpolate values using the spline interpolation.
  9046. @end table
  9047. @end table
  9048. @anchor{lut3d}
  9049. @section lut3d
  9050. Apply a 3D LUT to an input video.
  9051. The filter accepts the following options:
  9052. @table @option
  9053. @item file
  9054. Set the 3D LUT file name.
  9055. Currently supported formats:
  9056. @table @samp
  9057. @item 3dl
  9058. AfterEffects
  9059. @item cube
  9060. Iridas
  9061. @item dat
  9062. DaVinci
  9063. @item m3d
  9064. Pandora
  9065. @item csp
  9066. cineSpace
  9067. @end table
  9068. @item interp
  9069. Select interpolation mode.
  9070. Available values are:
  9071. @table @samp
  9072. @item nearest
  9073. Use values from the nearest defined point.
  9074. @item trilinear
  9075. Interpolate values using the 8 points defining a cube.
  9076. @item tetrahedral
  9077. Interpolate values using a tetrahedron.
  9078. @end table
  9079. @end table
  9080. This filter also supports the @ref{framesync} options.
  9081. @section lumakey
  9082. Turn certain luma values into transparency.
  9083. The filter accepts the following options:
  9084. @table @option
  9085. @item threshold
  9086. Set the luma which will be used as base for transparency.
  9087. Default value is @code{0}.
  9088. @item tolerance
  9089. Set the range of luma values to be keyed out.
  9090. Default value is @code{0}.
  9091. @item softness
  9092. Set the range of softness. Default value is @code{0}.
  9093. Use this to control gradual transition from zero to full transparency.
  9094. @end table
  9095. @section lut, lutrgb, lutyuv
  9096. Compute a look-up table for binding each pixel component input value
  9097. to an output value, and apply it to the input video.
  9098. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9099. to an RGB input video.
  9100. These filters accept the following parameters:
  9101. @table @option
  9102. @item c0
  9103. set first pixel component expression
  9104. @item c1
  9105. set second pixel component expression
  9106. @item c2
  9107. set third pixel component expression
  9108. @item c3
  9109. set fourth pixel component expression, corresponds to the alpha component
  9110. @item r
  9111. set red component expression
  9112. @item g
  9113. set green component expression
  9114. @item b
  9115. set blue component expression
  9116. @item a
  9117. alpha component expression
  9118. @item y
  9119. set Y/luminance component expression
  9120. @item u
  9121. set U/Cb component expression
  9122. @item v
  9123. set V/Cr component expression
  9124. @end table
  9125. Each of them specifies the expression to use for computing the lookup table for
  9126. the corresponding pixel component values.
  9127. The exact component associated to each of the @var{c*} options depends on the
  9128. format in input.
  9129. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9130. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9131. The expressions can contain the following constants and functions:
  9132. @table @option
  9133. @item w
  9134. @item h
  9135. The input width and height.
  9136. @item val
  9137. The input value for the pixel component.
  9138. @item clipval
  9139. The input value, clipped to the @var{minval}-@var{maxval} range.
  9140. @item maxval
  9141. The maximum value for the pixel component.
  9142. @item minval
  9143. The minimum value for the pixel component.
  9144. @item negval
  9145. The negated value for the pixel component value, clipped to the
  9146. @var{minval}-@var{maxval} range; it corresponds to the expression
  9147. "maxval-clipval+minval".
  9148. @item clip(val)
  9149. The computed value in @var{val}, clipped to the
  9150. @var{minval}-@var{maxval} range.
  9151. @item gammaval(gamma)
  9152. The computed gamma correction value of the pixel component value,
  9153. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9154. expression
  9155. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9156. @end table
  9157. All expressions default to "val".
  9158. @subsection Examples
  9159. @itemize
  9160. @item
  9161. Negate input video:
  9162. @example
  9163. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9164. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9165. @end example
  9166. The above is the same as:
  9167. @example
  9168. lutrgb="r=negval:g=negval:b=negval"
  9169. lutyuv="y=negval:u=negval:v=negval"
  9170. @end example
  9171. @item
  9172. Negate luminance:
  9173. @example
  9174. lutyuv=y=negval
  9175. @end example
  9176. @item
  9177. Remove chroma components, turning the video into a graytone image:
  9178. @example
  9179. lutyuv="u=128:v=128"
  9180. @end example
  9181. @item
  9182. Apply a luma burning effect:
  9183. @example
  9184. lutyuv="y=2*val"
  9185. @end example
  9186. @item
  9187. Remove green and blue components:
  9188. @example
  9189. lutrgb="g=0:b=0"
  9190. @end example
  9191. @item
  9192. Set a constant alpha channel value on input:
  9193. @example
  9194. format=rgba,lutrgb=a="maxval-minval/2"
  9195. @end example
  9196. @item
  9197. Correct luminance gamma by a factor of 0.5:
  9198. @example
  9199. lutyuv=y=gammaval(0.5)
  9200. @end example
  9201. @item
  9202. Discard least significant bits of luma:
  9203. @example
  9204. lutyuv=y='bitand(val, 128+64+32)'
  9205. @end example
  9206. @item
  9207. Technicolor like effect:
  9208. @example
  9209. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9210. @end example
  9211. @end itemize
  9212. @section lut2, tlut2
  9213. The @code{lut2} filter takes two input streams and outputs one
  9214. stream.
  9215. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9216. from one single stream.
  9217. This filter accepts the following parameters:
  9218. @table @option
  9219. @item c0
  9220. set first pixel component expression
  9221. @item c1
  9222. set second pixel component expression
  9223. @item c2
  9224. set third pixel component expression
  9225. @item c3
  9226. set fourth pixel component expression, corresponds to the alpha component
  9227. @item d
  9228. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9229. which means bit depth is automatically picked from first input format.
  9230. @end table
  9231. Each of them specifies the expression to use for computing the lookup table for
  9232. the corresponding pixel component values.
  9233. The exact component associated to each of the @var{c*} options depends on the
  9234. format in inputs.
  9235. The expressions can contain the following constants:
  9236. @table @option
  9237. @item w
  9238. @item h
  9239. The input width and height.
  9240. @item x
  9241. The first input value for the pixel component.
  9242. @item y
  9243. The second input value for the pixel component.
  9244. @item bdx
  9245. The first input video bit depth.
  9246. @item bdy
  9247. The second input video bit depth.
  9248. @end table
  9249. All expressions default to "x".
  9250. @subsection Examples
  9251. @itemize
  9252. @item
  9253. Highlight differences between two RGB video streams:
  9254. @example
  9255. 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)'
  9256. @end example
  9257. @item
  9258. Highlight differences between two YUV video streams:
  9259. @example
  9260. 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)'
  9261. @end example
  9262. @item
  9263. Show max difference between two video streams:
  9264. @example
  9265. 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)))'
  9266. @end example
  9267. @end itemize
  9268. @section maskedclamp
  9269. Clamp the first input stream with the second input and third input stream.
  9270. Returns the value of first stream to be between second input
  9271. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9272. This filter accepts the following options:
  9273. @table @option
  9274. @item undershoot
  9275. Default value is @code{0}.
  9276. @item overshoot
  9277. Default value is @code{0}.
  9278. @item planes
  9279. Set which planes will be processed as bitmap, unprocessed planes will be
  9280. copied from first stream.
  9281. By default value 0xf, all planes will be processed.
  9282. @end table
  9283. @section maskedmerge
  9284. Merge the first input stream with the second input stream using per pixel
  9285. weights in the third input stream.
  9286. A value of 0 in the third stream pixel component means that pixel component
  9287. from first stream is returned unchanged, while maximum value (eg. 255 for
  9288. 8-bit videos) means that pixel component from second stream is returned
  9289. unchanged. Intermediate values define the amount of merging between both
  9290. input stream's pixel components.
  9291. This filter accepts the following options:
  9292. @table @option
  9293. @item planes
  9294. Set which planes will be processed as bitmap, unprocessed planes will be
  9295. copied from first stream.
  9296. By default value 0xf, all planes will be processed.
  9297. @end table
  9298. @section maskfun
  9299. Create mask from input video.
  9300. For example it is useful to create motion masks after @code{tblend} filter.
  9301. This filter accepts the following options:
  9302. @table @option
  9303. @item low
  9304. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9305. @item high
  9306. Set high threshold. Any pixel component higher than this value will be set to max value
  9307. allowed for current pixel format.
  9308. @item planes
  9309. Set planes to filter, by default all available planes are filtered.
  9310. @item fill
  9311. Fill all frame pixels with this value.
  9312. @item sum
  9313. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9314. average, output frame will be completely filled with value set by @var{fill} option.
  9315. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9316. @end table
  9317. @section mcdeint
  9318. Apply motion-compensation deinterlacing.
  9319. It needs one field per frame as input and must thus be used together
  9320. with yadif=1/3 or equivalent.
  9321. This filter accepts the following options:
  9322. @table @option
  9323. @item mode
  9324. Set the deinterlacing mode.
  9325. It accepts one of the following values:
  9326. @table @samp
  9327. @item fast
  9328. @item medium
  9329. @item slow
  9330. use iterative motion estimation
  9331. @item extra_slow
  9332. like @samp{slow}, but use multiple reference frames.
  9333. @end table
  9334. Default value is @samp{fast}.
  9335. @item parity
  9336. Set the picture field parity assumed for the input video. It must be
  9337. one of the following values:
  9338. @table @samp
  9339. @item 0, tff
  9340. assume top field first
  9341. @item 1, bff
  9342. assume bottom field first
  9343. @end table
  9344. Default value is @samp{bff}.
  9345. @item qp
  9346. Set per-block quantization parameter (QP) used by the internal
  9347. encoder.
  9348. Higher values should result in a smoother motion vector field but less
  9349. optimal individual vectors. Default value is 1.
  9350. @end table
  9351. @section mergeplanes
  9352. Merge color channel components from several video streams.
  9353. The filter accepts up to 4 input streams, and merge selected input
  9354. planes to the output video.
  9355. This filter accepts the following options:
  9356. @table @option
  9357. @item mapping
  9358. Set input to output plane mapping. Default is @code{0}.
  9359. The mappings is specified as a bitmap. It should be specified as a
  9360. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9361. mapping for the first plane of the output stream. 'A' sets the number of
  9362. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9363. corresponding input to use (from 0 to 3). The rest of the mappings is
  9364. similar, 'Bb' describes the mapping for the output stream second
  9365. plane, 'Cc' describes the mapping for the output stream third plane and
  9366. 'Dd' describes the mapping for the output stream fourth plane.
  9367. @item format
  9368. Set output pixel format. Default is @code{yuva444p}.
  9369. @end table
  9370. @subsection Examples
  9371. @itemize
  9372. @item
  9373. Merge three gray video streams of same width and height into single video stream:
  9374. @example
  9375. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9376. @end example
  9377. @item
  9378. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9379. @example
  9380. [a0][a1]mergeplanes=0x00010210:yuva444p
  9381. @end example
  9382. @item
  9383. Swap Y and A plane in yuva444p stream:
  9384. @example
  9385. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9386. @end example
  9387. @item
  9388. Swap U and V plane in yuv420p stream:
  9389. @example
  9390. format=yuv420p,mergeplanes=0x000201:yuv420p
  9391. @end example
  9392. @item
  9393. Cast a rgb24 clip to yuv444p:
  9394. @example
  9395. format=rgb24,mergeplanes=0x000102:yuv444p
  9396. @end example
  9397. @end itemize
  9398. @section mestimate
  9399. Estimate and export motion vectors using block matching algorithms.
  9400. Motion vectors are stored in frame side data to be used by other filters.
  9401. This filter accepts the following options:
  9402. @table @option
  9403. @item method
  9404. Specify the motion estimation method. Accepts one of the following values:
  9405. @table @samp
  9406. @item esa
  9407. Exhaustive search algorithm.
  9408. @item tss
  9409. Three step search algorithm.
  9410. @item tdls
  9411. Two dimensional logarithmic search algorithm.
  9412. @item ntss
  9413. New three step search algorithm.
  9414. @item fss
  9415. Four step search algorithm.
  9416. @item ds
  9417. Diamond search algorithm.
  9418. @item hexbs
  9419. Hexagon-based search algorithm.
  9420. @item epzs
  9421. Enhanced predictive zonal search algorithm.
  9422. @item umh
  9423. Uneven multi-hexagon search algorithm.
  9424. @end table
  9425. Default value is @samp{esa}.
  9426. @item mb_size
  9427. Macroblock size. Default @code{16}.
  9428. @item search_param
  9429. Search parameter. Default @code{7}.
  9430. @end table
  9431. @section midequalizer
  9432. Apply Midway Image Equalization effect using two video streams.
  9433. Midway Image Equalization adjusts a pair of images to have the same
  9434. histogram, while maintaining their dynamics as much as possible. It's
  9435. useful for e.g. matching exposures from a pair of stereo cameras.
  9436. This filter has two inputs and one output, which must be of same pixel format, but
  9437. may be of different sizes. The output of filter is first input adjusted with
  9438. midway histogram of both inputs.
  9439. This filter accepts the following option:
  9440. @table @option
  9441. @item planes
  9442. Set which planes to process. Default is @code{15}, which is all available planes.
  9443. @end table
  9444. @section minterpolate
  9445. Convert the video to specified frame rate using motion interpolation.
  9446. This filter accepts the following options:
  9447. @table @option
  9448. @item fps
  9449. 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}.
  9450. @item mi_mode
  9451. Motion interpolation mode. Following values are accepted:
  9452. @table @samp
  9453. @item dup
  9454. Duplicate previous or next frame for interpolating new ones.
  9455. @item blend
  9456. Blend source frames. Interpolated frame is mean of previous and next frames.
  9457. @item mci
  9458. Motion compensated interpolation. Following options are effective when this mode is selected:
  9459. @table @samp
  9460. @item mc_mode
  9461. Motion compensation mode. Following values are accepted:
  9462. @table @samp
  9463. @item obmc
  9464. Overlapped block motion compensation.
  9465. @item aobmc
  9466. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9467. @end table
  9468. Default mode is @samp{obmc}.
  9469. @item me_mode
  9470. Motion estimation mode. Following values are accepted:
  9471. @table @samp
  9472. @item bidir
  9473. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9474. @item bilat
  9475. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9476. @end table
  9477. Default mode is @samp{bilat}.
  9478. @item me
  9479. The algorithm to be used for motion estimation. Following values are accepted:
  9480. @table @samp
  9481. @item esa
  9482. Exhaustive search algorithm.
  9483. @item tss
  9484. Three step search algorithm.
  9485. @item tdls
  9486. Two dimensional logarithmic search algorithm.
  9487. @item ntss
  9488. New three step search algorithm.
  9489. @item fss
  9490. Four step search algorithm.
  9491. @item ds
  9492. Diamond search algorithm.
  9493. @item hexbs
  9494. Hexagon-based search algorithm.
  9495. @item epzs
  9496. Enhanced predictive zonal search algorithm.
  9497. @item umh
  9498. Uneven multi-hexagon search algorithm.
  9499. @end table
  9500. Default algorithm is @samp{epzs}.
  9501. @item mb_size
  9502. Macroblock size. Default @code{16}.
  9503. @item search_param
  9504. Motion estimation search parameter. Default @code{32}.
  9505. @item vsbmc
  9506. 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).
  9507. @end table
  9508. @end table
  9509. @item scd
  9510. 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:
  9511. @table @samp
  9512. @item none
  9513. Disable scene change detection.
  9514. @item fdiff
  9515. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9516. @end table
  9517. Default method is @samp{fdiff}.
  9518. @item scd_threshold
  9519. Scene change detection threshold. Default is @code{5.0}.
  9520. @end table
  9521. @section mix
  9522. Mix several video input streams into one video stream.
  9523. A description of the accepted options follows.
  9524. @table @option
  9525. @item nb_inputs
  9526. The number of inputs. If unspecified, it defaults to 2.
  9527. @item weights
  9528. Specify weight of each input video stream as sequence.
  9529. Each weight is separated by space. If number of weights
  9530. is smaller than number of @var{frames} last specified
  9531. weight will be used for all remaining unset weights.
  9532. @item scale
  9533. Specify scale, if it is set it will be multiplied with sum
  9534. of each weight multiplied with pixel values to give final destination
  9535. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9536. @item duration
  9537. Specify how end of stream is determined.
  9538. @table @samp
  9539. @item longest
  9540. The duration of the longest input. (default)
  9541. @item shortest
  9542. The duration of the shortest input.
  9543. @item first
  9544. The duration of the first input.
  9545. @end table
  9546. @end table
  9547. @section mpdecimate
  9548. Drop frames that do not differ greatly from the previous frame in
  9549. order to reduce frame rate.
  9550. The main use of this filter is for very-low-bitrate encoding
  9551. (e.g. streaming over dialup modem), but it could in theory be used for
  9552. fixing movies that were inverse-telecined incorrectly.
  9553. A description of the accepted options follows.
  9554. @table @option
  9555. @item max
  9556. Set the maximum number of consecutive frames which can be dropped (if
  9557. positive), or the minimum interval between dropped frames (if
  9558. negative). If the value is 0, the frame is dropped disregarding the
  9559. number of previous sequentially dropped frames.
  9560. Default value is 0.
  9561. @item hi
  9562. @item lo
  9563. @item frac
  9564. Set the dropping threshold values.
  9565. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9566. represent actual pixel value differences, so a threshold of 64
  9567. corresponds to 1 unit of difference for each pixel, or the same spread
  9568. out differently over the block.
  9569. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9570. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9571. meaning the whole image) differ by more than a threshold of @option{lo}.
  9572. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9573. 64*5, and default value for @option{frac} is 0.33.
  9574. @end table
  9575. @section negate
  9576. Negate (invert) the input video.
  9577. It accepts the following option:
  9578. @table @option
  9579. @item negate_alpha
  9580. With value 1, it negates the alpha component, if present. Default value is 0.
  9581. @end table
  9582. @anchor{nlmeans}
  9583. @section nlmeans
  9584. Denoise frames using Non-Local Means algorithm.
  9585. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9586. context similarity is defined by comparing their surrounding patches of size
  9587. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9588. around the pixel.
  9589. Note that the research area defines centers for patches, which means some
  9590. patches will be made of pixels outside that research area.
  9591. The filter accepts the following options.
  9592. @table @option
  9593. @item s
  9594. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9595. @item p
  9596. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9597. @item pc
  9598. Same as @option{p} but for chroma planes.
  9599. The default value is @var{0} and means automatic.
  9600. @item r
  9601. Set research size. Default is 15. Must be odd number in range [0, 99].
  9602. @item rc
  9603. Same as @option{r} but for chroma planes.
  9604. The default value is @var{0} and means automatic.
  9605. @end table
  9606. @section nnedi
  9607. Deinterlace video using neural network edge directed interpolation.
  9608. This filter accepts the following options:
  9609. @table @option
  9610. @item weights
  9611. Mandatory option, without binary file filter can not work.
  9612. Currently file can be found here:
  9613. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9614. @item deint
  9615. Set which frames to deinterlace, by default it is @code{all}.
  9616. Can be @code{all} or @code{interlaced}.
  9617. @item field
  9618. Set mode of operation.
  9619. Can be one of the following:
  9620. @table @samp
  9621. @item af
  9622. Use frame flags, both fields.
  9623. @item a
  9624. Use frame flags, single field.
  9625. @item t
  9626. Use top field only.
  9627. @item b
  9628. Use bottom field only.
  9629. @item tf
  9630. Use both fields, top first.
  9631. @item bf
  9632. Use both fields, bottom first.
  9633. @end table
  9634. @item planes
  9635. Set which planes to process, by default filter process all frames.
  9636. @item nsize
  9637. Set size of local neighborhood around each pixel, used by the predictor neural
  9638. network.
  9639. Can be one of the following:
  9640. @table @samp
  9641. @item s8x6
  9642. @item s16x6
  9643. @item s32x6
  9644. @item s48x6
  9645. @item s8x4
  9646. @item s16x4
  9647. @item s32x4
  9648. @end table
  9649. @item nns
  9650. Set the number of neurons in predictor neural network.
  9651. Can be one of the following:
  9652. @table @samp
  9653. @item n16
  9654. @item n32
  9655. @item n64
  9656. @item n128
  9657. @item n256
  9658. @end table
  9659. @item qual
  9660. Controls the number of different neural network predictions that are blended
  9661. together to compute the final output value. Can be @code{fast}, default or
  9662. @code{slow}.
  9663. @item etype
  9664. Set which set of weights to use in the predictor.
  9665. Can be one of the following:
  9666. @table @samp
  9667. @item a
  9668. weights trained to minimize absolute error
  9669. @item s
  9670. weights trained to minimize squared error
  9671. @end table
  9672. @item pscrn
  9673. Controls whether or not the prescreener neural network is used to decide
  9674. which pixels should be processed by the predictor neural network and which
  9675. can be handled by simple cubic interpolation.
  9676. The prescreener is trained to know whether cubic interpolation will be
  9677. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9678. The computational complexity of the prescreener nn is much less than that of
  9679. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9680. using the prescreener generally results in much faster processing.
  9681. The prescreener is pretty accurate, so the difference between using it and not
  9682. using it is almost always unnoticeable.
  9683. Can be one of the following:
  9684. @table @samp
  9685. @item none
  9686. @item original
  9687. @item new
  9688. @end table
  9689. Default is @code{new}.
  9690. @item fapprox
  9691. Set various debugging flags.
  9692. @end table
  9693. @section noformat
  9694. Force libavfilter not to use any of the specified pixel formats for the
  9695. input to the next filter.
  9696. It accepts the following parameters:
  9697. @table @option
  9698. @item pix_fmts
  9699. A '|'-separated list of pixel format names, such as
  9700. pix_fmts=yuv420p|monow|rgb24".
  9701. @end table
  9702. @subsection Examples
  9703. @itemize
  9704. @item
  9705. Force libavfilter to use a format different from @var{yuv420p} for the
  9706. input to the vflip filter:
  9707. @example
  9708. noformat=pix_fmts=yuv420p,vflip
  9709. @end example
  9710. @item
  9711. Convert the input video to any of the formats not contained in the list:
  9712. @example
  9713. noformat=yuv420p|yuv444p|yuv410p
  9714. @end example
  9715. @end itemize
  9716. @section noise
  9717. Add noise on video input frame.
  9718. The filter accepts the following options:
  9719. @table @option
  9720. @item all_seed
  9721. @item c0_seed
  9722. @item c1_seed
  9723. @item c2_seed
  9724. @item c3_seed
  9725. Set noise seed for specific pixel component or all pixel components in case
  9726. of @var{all_seed}. Default value is @code{123457}.
  9727. @item all_strength, alls
  9728. @item c0_strength, c0s
  9729. @item c1_strength, c1s
  9730. @item c2_strength, c2s
  9731. @item c3_strength, c3s
  9732. Set noise strength for specific pixel component or all pixel components in case
  9733. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9734. @item all_flags, allf
  9735. @item c0_flags, c0f
  9736. @item c1_flags, c1f
  9737. @item c2_flags, c2f
  9738. @item c3_flags, c3f
  9739. Set pixel component flags or set flags for all components if @var{all_flags}.
  9740. Available values for component flags are:
  9741. @table @samp
  9742. @item a
  9743. averaged temporal noise (smoother)
  9744. @item p
  9745. mix random noise with a (semi)regular pattern
  9746. @item t
  9747. temporal noise (noise pattern changes between frames)
  9748. @item u
  9749. uniform noise (gaussian otherwise)
  9750. @end table
  9751. @end table
  9752. @subsection Examples
  9753. Add temporal and uniform noise to input video:
  9754. @example
  9755. noise=alls=20:allf=t+u
  9756. @end example
  9757. @section normalize
  9758. Normalize RGB video (aka histogram stretching, contrast stretching).
  9759. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9760. For each channel of each frame, the filter computes the input range and maps
  9761. it linearly to the user-specified output range. The output range defaults
  9762. to the full dynamic range from pure black to pure white.
  9763. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9764. changes in brightness) caused when small dark or bright objects enter or leave
  9765. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9766. video camera, and, like a video camera, it may cause a period of over- or
  9767. under-exposure of the video.
  9768. The R,G,B channels can be normalized independently, which may cause some
  9769. color shifting, or linked together as a single channel, which prevents
  9770. color shifting. Linked normalization preserves hue. Independent normalization
  9771. does not, so it can be used to remove some color casts. Independent and linked
  9772. normalization can be combined in any ratio.
  9773. The normalize filter accepts the following options:
  9774. @table @option
  9775. @item blackpt
  9776. @item whitept
  9777. Colors which define the output range. The minimum input value is mapped to
  9778. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9779. The defaults are black and white respectively. Specifying white for
  9780. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9781. normalized video. Shades of grey can be used to reduce the dynamic range
  9782. (contrast). Specifying saturated colors here can create some interesting
  9783. effects.
  9784. @item smoothing
  9785. The number of previous frames to use for temporal smoothing. The input range
  9786. of each channel is smoothed using a rolling average over the current frame
  9787. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9788. smoothing).
  9789. @item independence
  9790. Controls the ratio of independent (color shifting) channel normalization to
  9791. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9792. independent. Defaults to 1.0 (fully independent).
  9793. @item strength
  9794. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9795. expensive no-op. Defaults to 1.0 (full strength).
  9796. @end table
  9797. @subsection Examples
  9798. Stretch video contrast to use the full dynamic range, with no temporal
  9799. smoothing; may flicker depending on the source content:
  9800. @example
  9801. normalize=blackpt=black:whitept=white:smoothing=0
  9802. @end example
  9803. As above, but with 50 frames of temporal smoothing; flicker should be
  9804. reduced, depending on the source content:
  9805. @example
  9806. normalize=blackpt=black:whitept=white:smoothing=50
  9807. @end example
  9808. As above, but with hue-preserving linked channel normalization:
  9809. @example
  9810. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9811. @end example
  9812. As above, but with half strength:
  9813. @example
  9814. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9815. @end example
  9816. Map the darkest input color to red, the brightest input color to cyan:
  9817. @example
  9818. normalize=blackpt=red:whitept=cyan
  9819. @end example
  9820. @section null
  9821. Pass the video source unchanged to the output.
  9822. @section ocr
  9823. Optical Character Recognition
  9824. This filter uses Tesseract for optical character recognition. To enable
  9825. compilation of this filter, you need to configure FFmpeg with
  9826. @code{--enable-libtesseract}.
  9827. It accepts the following options:
  9828. @table @option
  9829. @item datapath
  9830. Set datapath to tesseract data. Default is to use whatever was
  9831. set at installation.
  9832. @item language
  9833. Set language, default is "eng".
  9834. @item whitelist
  9835. Set character whitelist.
  9836. @item blacklist
  9837. Set character blacklist.
  9838. @end table
  9839. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9840. @section ocv
  9841. Apply a video transform using libopencv.
  9842. To enable this filter, install the libopencv library and headers and
  9843. configure FFmpeg with @code{--enable-libopencv}.
  9844. It accepts the following parameters:
  9845. @table @option
  9846. @item filter_name
  9847. The name of the libopencv filter to apply.
  9848. @item filter_params
  9849. The parameters to pass to the libopencv filter. If not specified, the default
  9850. values are assumed.
  9851. @end table
  9852. Refer to the official libopencv documentation for more precise
  9853. information:
  9854. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9855. Several libopencv filters are supported; see the following subsections.
  9856. @anchor{dilate}
  9857. @subsection dilate
  9858. Dilate an image by using a specific structuring element.
  9859. It corresponds to the libopencv function @code{cvDilate}.
  9860. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9861. @var{struct_el} represents a structuring element, and has the syntax:
  9862. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9863. @var{cols} and @var{rows} represent the number of columns and rows of
  9864. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9865. point, and @var{shape} the shape for the structuring element. @var{shape}
  9866. must be "rect", "cross", "ellipse", or "custom".
  9867. If the value for @var{shape} is "custom", it must be followed by a
  9868. string of the form "=@var{filename}". The file with name
  9869. @var{filename} is assumed to represent a binary image, with each
  9870. printable character corresponding to a bright pixel. When a custom
  9871. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9872. or columns and rows of the read file are assumed instead.
  9873. The default value for @var{struct_el} is "3x3+0x0/rect".
  9874. @var{nb_iterations} specifies the number of times the transform is
  9875. applied to the image, and defaults to 1.
  9876. Some examples:
  9877. @example
  9878. # Use the default values
  9879. ocv=dilate
  9880. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9881. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9882. # Read the shape from the file diamond.shape, iterating two times.
  9883. # The file diamond.shape may contain a pattern of characters like this
  9884. # *
  9885. # ***
  9886. # *****
  9887. # ***
  9888. # *
  9889. # The specified columns and rows are ignored
  9890. # but the anchor point coordinates are not
  9891. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9892. @end example
  9893. @subsection erode
  9894. Erode an image by using a specific structuring element.
  9895. It corresponds to the libopencv function @code{cvErode}.
  9896. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9897. with the same syntax and semantics as the @ref{dilate} filter.
  9898. @subsection smooth
  9899. Smooth the input video.
  9900. The filter takes the following parameters:
  9901. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9902. @var{type} is the type of smooth filter to apply, and must be one of
  9903. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9904. or "bilateral". The default value is "gaussian".
  9905. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9906. depend on the smooth type. @var{param1} and
  9907. @var{param2} accept integer positive values or 0. @var{param3} and
  9908. @var{param4} accept floating point values.
  9909. The default value for @var{param1} is 3. The default value for the
  9910. other parameters is 0.
  9911. These parameters correspond to the parameters assigned to the
  9912. libopencv function @code{cvSmooth}.
  9913. @section oscilloscope
  9914. 2D Video Oscilloscope.
  9915. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9916. It accepts the following parameters:
  9917. @table @option
  9918. @item x
  9919. Set scope center x position.
  9920. @item y
  9921. Set scope center y position.
  9922. @item s
  9923. Set scope size, relative to frame diagonal.
  9924. @item t
  9925. Set scope tilt/rotation.
  9926. @item o
  9927. Set trace opacity.
  9928. @item tx
  9929. Set trace center x position.
  9930. @item ty
  9931. Set trace center y position.
  9932. @item tw
  9933. Set trace width, relative to width of frame.
  9934. @item th
  9935. Set trace height, relative to height of frame.
  9936. @item c
  9937. Set which components to trace. By default it traces first three components.
  9938. @item g
  9939. Draw trace grid. By default is enabled.
  9940. @item st
  9941. Draw some statistics. By default is enabled.
  9942. @item sc
  9943. Draw scope. By default is enabled.
  9944. @end table
  9945. @subsection Examples
  9946. @itemize
  9947. @item
  9948. Inspect full first row of video frame.
  9949. @example
  9950. oscilloscope=x=0.5:y=0:s=1
  9951. @end example
  9952. @item
  9953. Inspect full last row of video frame.
  9954. @example
  9955. oscilloscope=x=0.5:y=1:s=1
  9956. @end example
  9957. @item
  9958. Inspect full 5th line of video frame of height 1080.
  9959. @example
  9960. oscilloscope=x=0.5:y=5/1080:s=1
  9961. @end example
  9962. @item
  9963. Inspect full last column of video frame.
  9964. @example
  9965. oscilloscope=x=1:y=0.5:s=1:t=1
  9966. @end example
  9967. @end itemize
  9968. @anchor{overlay}
  9969. @section overlay
  9970. Overlay one video on top of another.
  9971. It takes two inputs and has one output. The first input is the "main"
  9972. video on which the second input is overlaid.
  9973. It accepts the following parameters:
  9974. A description of the accepted options follows.
  9975. @table @option
  9976. @item x
  9977. @item y
  9978. Set the expression for the x and y coordinates of the overlaid video
  9979. on the main video. Default value is "0" for both expressions. In case
  9980. the expression is invalid, it is set to a huge value (meaning that the
  9981. overlay will not be displayed within the output visible area).
  9982. @item eof_action
  9983. See @ref{framesync}.
  9984. @item eval
  9985. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9986. It accepts the following values:
  9987. @table @samp
  9988. @item init
  9989. only evaluate expressions once during the filter initialization or
  9990. when a command is processed
  9991. @item frame
  9992. evaluate expressions for each incoming frame
  9993. @end table
  9994. Default value is @samp{frame}.
  9995. @item shortest
  9996. See @ref{framesync}.
  9997. @item format
  9998. Set the format for the output video.
  9999. It accepts the following values:
  10000. @table @samp
  10001. @item yuv420
  10002. force YUV420 output
  10003. @item yuv422
  10004. force YUV422 output
  10005. @item yuv444
  10006. force YUV444 output
  10007. @item rgb
  10008. force packed RGB output
  10009. @item gbrp
  10010. force planar RGB output
  10011. @item auto
  10012. automatically pick format
  10013. @end table
  10014. Default value is @samp{yuv420}.
  10015. @item repeatlast
  10016. See @ref{framesync}.
  10017. @item alpha
  10018. Set format of alpha of the overlaid video, it can be @var{straight} or
  10019. @var{premultiplied}. Default is @var{straight}.
  10020. @end table
  10021. The @option{x}, and @option{y} expressions can contain the following
  10022. parameters.
  10023. @table @option
  10024. @item main_w, W
  10025. @item main_h, H
  10026. The main input width and height.
  10027. @item overlay_w, w
  10028. @item overlay_h, h
  10029. The overlay input width and height.
  10030. @item x
  10031. @item y
  10032. The computed values for @var{x} and @var{y}. They are evaluated for
  10033. each new frame.
  10034. @item hsub
  10035. @item vsub
  10036. horizontal and vertical chroma subsample values of the output
  10037. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10038. @var{vsub} is 1.
  10039. @item n
  10040. the number of input frame, starting from 0
  10041. @item pos
  10042. the position in the file of the input frame, NAN if unknown
  10043. @item t
  10044. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10045. @end table
  10046. This filter also supports the @ref{framesync} options.
  10047. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10048. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10049. when @option{eval} is set to @samp{init}.
  10050. Be aware that frames are taken from each input video in timestamp
  10051. order, hence, if their initial timestamps differ, it is a good idea
  10052. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10053. have them begin in the same zero timestamp, as the example for
  10054. the @var{movie} filter does.
  10055. You can chain together more overlays but you should test the
  10056. efficiency of such approach.
  10057. @subsection Commands
  10058. This filter supports the following commands:
  10059. @table @option
  10060. @item x
  10061. @item y
  10062. Modify the x and y of the overlay input.
  10063. The command accepts the same syntax of the corresponding option.
  10064. If the specified expression is not valid, it is kept at its current
  10065. value.
  10066. @end table
  10067. @subsection Examples
  10068. @itemize
  10069. @item
  10070. Draw the overlay at 10 pixels from the bottom right corner of the main
  10071. video:
  10072. @example
  10073. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10074. @end example
  10075. Using named options the example above becomes:
  10076. @example
  10077. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10078. @end example
  10079. @item
  10080. Insert a transparent PNG logo in the bottom left corner of the input,
  10081. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10082. @example
  10083. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10084. @end example
  10085. @item
  10086. Insert 2 different transparent PNG logos (second logo on bottom
  10087. right corner) using the @command{ffmpeg} tool:
  10088. @example
  10089. 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
  10090. @end example
  10091. @item
  10092. Add a transparent color layer on top of the main video; @code{WxH}
  10093. must specify the size of the main input to the overlay filter:
  10094. @example
  10095. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10096. @end example
  10097. @item
  10098. Play an original video and a filtered version (here with the deshake
  10099. filter) side by side using the @command{ffplay} tool:
  10100. @example
  10101. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10102. @end example
  10103. The above command is the same as:
  10104. @example
  10105. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10106. @end example
  10107. @item
  10108. Make a sliding overlay appearing from the left to the right top part of the
  10109. screen starting since time 2:
  10110. @example
  10111. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10112. @end example
  10113. @item
  10114. Compose output by putting two input videos side to side:
  10115. @example
  10116. ffmpeg -i left.avi -i right.avi -filter_complex "
  10117. nullsrc=size=200x100 [background];
  10118. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10119. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10120. [background][left] overlay=shortest=1 [background+left];
  10121. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10122. "
  10123. @end example
  10124. @item
  10125. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10126. @example
  10127. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10128. -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]'
  10129. masked.avi
  10130. @end example
  10131. @item
  10132. Chain several overlays in cascade:
  10133. @example
  10134. nullsrc=s=200x200 [bg];
  10135. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10136. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10137. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10138. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10139. [in3] null, [mid2] overlay=100:100 [out0]
  10140. @end example
  10141. @end itemize
  10142. @section owdenoise
  10143. Apply Overcomplete Wavelet denoiser.
  10144. The filter accepts the following options:
  10145. @table @option
  10146. @item depth
  10147. Set depth.
  10148. Larger depth values will denoise lower frequency components more, but
  10149. slow down filtering.
  10150. Must be an int in the range 8-16, default is @code{8}.
  10151. @item luma_strength, ls
  10152. Set luma strength.
  10153. Must be a double value in the range 0-1000, default is @code{1.0}.
  10154. @item chroma_strength, cs
  10155. Set chroma strength.
  10156. Must be a double value in the range 0-1000, default is @code{1.0}.
  10157. @end table
  10158. @anchor{pad}
  10159. @section pad
  10160. Add paddings to the input image, and place the original input at the
  10161. provided @var{x}, @var{y} coordinates.
  10162. It accepts the following parameters:
  10163. @table @option
  10164. @item width, w
  10165. @item height, h
  10166. Specify an expression for the size of the output image with the
  10167. paddings added. If the value for @var{width} or @var{height} is 0, the
  10168. corresponding input size is used for the output.
  10169. The @var{width} expression can reference the value set by the
  10170. @var{height} expression, and vice versa.
  10171. The default value of @var{width} and @var{height} is 0.
  10172. @item x
  10173. @item y
  10174. Specify the offsets to place the input image at within the padded area,
  10175. with respect to the top/left border of the output image.
  10176. The @var{x} expression can reference the value set by the @var{y}
  10177. expression, and vice versa.
  10178. The default value of @var{x} and @var{y} is 0.
  10179. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10180. so the input image is centered on the padded area.
  10181. @item color
  10182. Specify the color of the padded area. For the syntax of this option,
  10183. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10184. manual,ffmpeg-utils}.
  10185. The default value of @var{color} is "black".
  10186. @item eval
  10187. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10188. It accepts the following values:
  10189. @table @samp
  10190. @item init
  10191. Only evaluate expressions once during the filter initialization or when
  10192. a command is processed.
  10193. @item frame
  10194. Evaluate expressions for each incoming frame.
  10195. @end table
  10196. Default value is @samp{init}.
  10197. @item aspect
  10198. Pad to aspect instead to a resolution.
  10199. @end table
  10200. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10201. options are expressions containing the following constants:
  10202. @table @option
  10203. @item in_w
  10204. @item in_h
  10205. The input video width and height.
  10206. @item iw
  10207. @item ih
  10208. These are the same as @var{in_w} and @var{in_h}.
  10209. @item out_w
  10210. @item out_h
  10211. The output width and height (the size of the padded area), as
  10212. specified by the @var{width} and @var{height} expressions.
  10213. @item ow
  10214. @item oh
  10215. These are the same as @var{out_w} and @var{out_h}.
  10216. @item x
  10217. @item y
  10218. The x and y offsets as specified by the @var{x} and @var{y}
  10219. expressions, or NAN if not yet specified.
  10220. @item a
  10221. same as @var{iw} / @var{ih}
  10222. @item sar
  10223. input sample aspect ratio
  10224. @item dar
  10225. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10226. @item hsub
  10227. @item vsub
  10228. The horizontal and vertical chroma subsample values. For example for the
  10229. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10230. @end table
  10231. @subsection Examples
  10232. @itemize
  10233. @item
  10234. Add paddings with the color "violet" to the input video. The output video
  10235. size is 640x480, and the top-left corner of the input video is placed at
  10236. column 0, row 40
  10237. @example
  10238. pad=640:480:0:40:violet
  10239. @end example
  10240. The example above is equivalent to the following command:
  10241. @example
  10242. pad=width=640:height=480:x=0:y=40:color=violet
  10243. @end example
  10244. @item
  10245. Pad the input to get an output with dimensions increased by 3/2,
  10246. and put the input video at the center of the padded area:
  10247. @example
  10248. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10249. @end example
  10250. @item
  10251. Pad the input to get a squared output with size equal to the maximum
  10252. value between the input width and height, and put the input video at
  10253. the center of the padded area:
  10254. @example
  10255. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10256. @end example
  10257. @item
  10258. Pad the input to get a final w/h ratio of 16:9:
  10259. @example
  10260. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10261. @end example
  10262. @item
  10263. In case of anamorphic video, in order to set the output display aspect
  10264. correctly, it is necessary to use @var{sar} in the expression,
  10265. according to the relation:
  10266. @example
  10267. (ih * X / ih) * sar = output_dar
  10268. X = output_dar / sar
  10269. @end example
  10270. Thus the previous example needs to be modified to:
  10271. @example
  10272. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10273. @end example
  10274. @item
  10275. Double the output size and put the input video in the bottom-right
  10276. corner of the output padded area:
  10277. @example
  10278. pad="2*iw:2*ih:ow-iw:oh-ih"
  10279. @end example
  10280. @end itemize
  10281. @anchor{palettegen}
  10282. @section palettegen
  10283. Generate one palette for a whole video stream.
  10284. It accepts the following options:
  10285. @table @option
  10286. @item max_colors
  10287. Set the maximum number of colors to quantize in the palette.
  10288. Note: the palette will still contain 256 colors; the unused palette entries
  10289. will be black.
  10290. @item reserve_transparent
  10291. Create a palette of 255 colors maximum and reserve the last one for
  10292. transparency. Reserving the transparency color is useful for GIF optimization.
  10293. If not set, the maximum of colors in the palette will be 256. You probably want
  10294. to disable this option for a standalone image.
  10295. Set by default.
  10296. @item transparency_color
  10297. Set the color that will be used as background for transparency.
  10298. @item stats_mode
  10299. Set statistics mode.
  10300. It accepts the following values:
  10301. @table @samp
  10302. @item full
  10303. Compute full frame histograms.
  10304. @item diff
  10305. Compute histograms only for the part that differs from previous frame. This
  10306. might be relevant to give more importance to the moving part of your input if
  10307. the background is static.
  10308. @item single
  10309. Compute new histogram for each frame.
  10310. @end table
  10311. Default value is @var{full}.
  10312. @end table
  10313. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10314. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10315. color quantization of the palette. This information is also visible at
  10316. @var{info} logging level.
  10317. @subsection Examples
  10318. @itemize
  10319. @item
  10320. Generate a representative palette of a given video using @command{ffmpeg}:
  10321. @example
  10322. ffmpeg -i input.mkv -vf palettegen palette.png
  10323. @end example
  10324. @end itemize
  10325. @section paletteuse
  10326. Use a palette to downsample an input video stream.
  10327. The filter takes two inputs: one video stream and a palette. The palette must
  10328. be a 256 pixels image.
  10329. It accepts the following options:
  10330. @table @option
  10331. @item dither
  10332. Select dithering mode. Available algorithms are:
  10333. @table @samp
  10334. @item bayer
  10335. Ordered 8x8 bayer dithering (deterministic)
  10336. @item heckbert
  10337. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10338. Note: this dithering is sometimes considered "wrong" and is included as a
  10339. reference.
  10340. @item floyd_steinberg
  10341. Floyd and Steingberg dithering (error diffusion)
  10342. @item sierra2
  10343. Frankie Sierra dithering v2 (error diffusion)
  10344. @item sierra2_4a
  10345. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10346. @end table
  10347. Default is @var{sierra2_4a}.
  10348. @item bayer_scale
  10349. When @var{bayer} dithering is selected, this option defines the scale of the
  10350. pattern (how much the crosshatch pattern is visible). A low value means more
  10351. visible pattern for less banding, and higher value means less visible pattern
  10352. at the cost of more banding.
  10353. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10354. @item diff_mode
  10355. If set, define the zone to process
  10356. @table @samp
  10357. @item rectangle
  10358. Only the changing rectangle will be reprocessed. This is similar to GIF
  10359. cropping/offsetting compression mechanism. This option can be useful for speed
  10360. if only a part of the image is changing, and has use cases such as limiting the
  10361. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10362. moving scene (it leads to more deterministic output if the scene doesn't change
  10363. much, and as a result less moving noise and better GIF compression).
  10364. @end table
  10365. Default is @var{none}.
  10366. @item new
  10367. Take new palette for each output frame.
  10368. @item alpha_threshold
  10369. Sets the alpha threshold for transparency. Alpha values above this threshold
  10370. will be treated as completely opaque, and values below this threshold will be
  10371. treated as completely transparent.
  10372. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10373. @end table
  10374. @subsection Examples
  10375. @itemize
  10376. @item
  10377. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10378. using @command{ffmpeg}:
  10379. @example
  10380. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10381. @end example
  10382. @end itemize
  10383. @section perspective
  10384. Correct perspective of video not recorded perpendicular to the screen.
  10385. A description of the accepted parameters follows.
  10386. @table @option
  10387. @item x0
  10388. @item y0
  10389. @item x1
  10390. @item y1
  10391. @item x2
  10392. @item y2
  10393. @item x3
  10394. @item y3
  10395. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10396. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10397. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10398. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10399. then the corners of the source will be sent to the specified coordinates.
  10400. The expressions can use the following variables:
  10401. @table @option
  10402. @item W
  10403. @item H
  10404. the width and height of video frame.
  10405. @item in
  10406. Input frame count.
  10407. @item on
  10408. Output frame count.
  10409. @end table
  10410. @item interpolation
  10411. Set interpolation for perspective correction.
  10412. It accepts the following values:
  10413. @table @samp
  10414. @item linear
  10415. @item cubic
  10416. @end table
  10417. Default value is @samp{linear}.
  10418. @item sense
  10419. Set interpretation of coordinate options.
  10420. It accepts the following values:
  10421. @table @samp
  10422. @item 0, source
  10423. Send point in the source specified by the given coordinates to
  10424. the corners of the destination.
  10425. @item 1, destination
  10426. Send the corners of the source to the point in the destination specified
  10427. by the given coordinates.
  10428. Default value is @samp{source}.
  10429. @end table
  10430. @item eval
  10431. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10432. It accepts the following values:
  10433. @table @samp
  10434. @item init
  10435. only evaluate expressions once during the filter initialization or
  10436. when a command is processed
  10437. @item frame
  10438. evaluate expressions for each incoming frame
  10439. @end table
  10440. Default value is @samp{init}.
  10441. @end table
  10442. @section phase
  10443. Delay interlaced video by one field time so that the field order changes.
  10444. The intended use is to fix PAL movies that have been captured with the
  10445. opposite field order to the film-to-video transfer.
  10446. A description of the accepted parameters follows.
  10447. @table @option
  10448. @item mode
  10449. Set phase mode.
  10450. It accepts the following values:
  10451. @table @samp
  10452. @item t
  10453. Capture field order top-first, transfer bottom-first.
  10454. Filter will delay the bottom field.
  10455. @item b
  10456. Capture field order bottom-first, transfer top-first.
  10457. Filter will delay the top field.
  10458. @item p
  10459. Capture and transfer with the same field order. This mode only exists
  10460. for the documentation of the other options to refer to, but if you
  10461. actually select it, the filter will faithfully do nothing.
  10462. @item a
  10463. Capture field order determined automatically by field flags, transfer
  10464. opposite.
  10465. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10466. basis using field flags. If no field information is available,
  10467. then this works just like @samp{u}.
  10468. @item u
  10469. Capture unknown or varying, transfer opposite.
  10470. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10471. analyzing the images and selecting the alternative that produces best
  10472. match between the fields.
  10473. @item T
  10474. Capture top-first, transfer unknown or varying.
  10475. Filter selects among @samp{t} and @samp{p} using image analysis.
  10476. @item B
  10477. Capture bottom-first, transfer unknown or varying.
  10478. Filter selects among @samp{b} and @samp{p} using image analysis.
  10479. @item A
  10480. Capture determined by field flags, transfer unknown or varying.
  10481. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10482. image analysis. If no field information is available, then this works just
  10483. like @samp{U}. This is the default mode.
  10484. @item U
  10485. Both capture and transfer unknown or varying.
  10486. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10487. @end table
  10488. @end table
  10489. @section pixdesctest
  10490. Pixel format descriptor test filter, mainly useful for internal
  10491. testing. The output video should be equal to the input video.
  10492. For example:
  10493. @example
  10494. format=monow, pixdesctest
  10495. @end example
  10496. can be used to test the monowhite pixel format descriptor definition.
  10497. @section pixscope
  10498. Display sample values of color channels. Mainly useful for checking color
  10499. and levels. Minimum supported resolution is 640x480.
  10500. The filters accept the following options:
  10501. @table @option
  10502. @item x
  10503. Set scope X position, relative offset on X axis.
  10504. @item y
  10505. Set scope Y position, relative offset on Y axis.
  10506. @item w
  10507. Set scope width.
  10508. @item h
  10509. Set scope height.
  10510. @item o
  10511. Set window opacity. This window also holds statistics about pixel area.
  10512. @item wx
  10513. Set window X position, relative offset on X axis.
  10514. @item wy
  10515. Set window Y position, relative offset on Y axis.
  10516. @end table
  10517. @section pp
  10518. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10519. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10520. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10521. Each subfilter and some options have a short and a long name that can be used
  10522. interchangeably, i.e. dr/dering are the same.
  10523. The filters accept the following options:
  10524. @table @option
  10525. @item subfilters
  10526. Set postprocessing subfilters string.
  10527. @end table
  10528. All subfilters share common options to determine their scope:
  10529. @table @option
  10530. @item a/autoq
  10531. Honor the quality commands for this subfilter.
  10532. @item c/chrom
  10533. Do chrominance filtering, too (default).
  10534. @item y/nochrom
  10535. Do luminance filtering only (no chrominance).
  10536. @item n/noluma
  10537. Do chrominance filtering only (no luminance).
  10538. @end table
  10539. These options can be appended after the subfilter name, separated by a '|'.
  10540. Available subfilters are:
  10541. @table @option
  10542. @item hb/hdeblock[|difference[|flatness]]
  10543. Horizontal deblocking filter
  10544. @table @option
  10545. @item difference
  10546. Difference factor where higher values mean more deblocking (default: @code{32}).
  10547. @item flatness
  10548. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10549. @end table
  10550. @item vb/vdeblock[|difference[|flatness]]
  10551. Vertical deblocking filter
  10552. @table @option
  10553. @item difference
  10554. Difference factor where higher values mean more deblocking (default: @code{32}).
  10555. @item flatness
  10556. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10557. @end table
  10558. @item ha/hadeblock[|difference[|flatness]]
  10559. Accurate horizontal deblocking filter
  10560. @table @option
  10561. @item difference
  10562. Difference factor where higher values mean more deblocking (default: @code{32}).
  10563. @item flatness
  10564. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10565. @end table
  10566. @item va/vadeblock[|difference[|flatness]]
  10567. Accurate vertical deblocking filter
  10568. @table @option
  10569. @item difference
  10570. Difference factor where higher values mean more deblocking (default: @code{32}).
  10571. @item flatness
  10572. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10573. @end table
  10574. @end table
  10575. The horizontal and vertical deblocking filters share the difference and
  10576. flatness values so you cannot set different horizontal and vertical
  10577. thresholds.
  10578. @table @option
  10579. @item h1/x1hdeblock
  10580. Experimental horizontal deblocking filter
  10581. @item v1/x1vdeblock
  10582. Experimental vertical deblocking filter
  10583. @item dr/dering
  10584. Deringing filter
  10585. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10586. @table @option
  10587. @item threshold1
  10588. larger -> stronger filtering
  10589. @item threshold2
  10590. larger -> stronger filtering
  10591. @item threshold3
  10592. larger -> stronger filtering
  10593. @end table
  10594. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10595. @table @option
  10596. @item f/fullyrange
  10597. Stretch luminance to @code{0-255}.
  10598. @end table
  10599. @item lb/linblenddeint
  10600. Linear blend deinterlacing filter that deinterlaces the given block by
  10601. filtering all lines with a @code{(1 2 1)} filter.
  10602. @item li/linipoldeint
  10603. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10604. linearly interpolating every second line.
  10605. @item ci/cubicipoldeint
  10606. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10607. cubically interpolating every second line.
  10608. @item md/mediandeint
  10609. Median deinterlacing filter that deinterlaces the given block by applying a
  10610. median filter to every second line.
  10611. @item fd/ffmpegdeint
  10612. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10613. second line with a @code{(-1 4 2 4 -1)} filter.
  10614. @item l5/lowpass5
  10615. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10616. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10617. @item fq/forceQuant[|quantizer]
  10618. Overrides the quantizer table from the input with the constant quantizer you
  10619. specify.
  10620. @table @option
  10621. @item quantizer
  10622. Quantizer to use
  10623. @end table
  10624. @item de/default
  10625. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10626. @item fa/fast
  10627. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10628. @item ac
  10629. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10630. @end table
  10631. @subsection Examples
  10632. @itemize
  10633. @item
  10634. Apply horizontal and vertical deblocking, deringing and automatic
  10635. brightness/contrast:
  10636. @example
  10637. pp=hb/vb/dr/al
  10638. @end example
  10639. @item
  10640. Apply default filters without brightness/contrast correction:
  10641. @example
  10642. pp=de/-al
  10643. @end example
  10644. @item
  10645. Apply default filters and temporal denoiser:
  10646. @example
  10647. pp=default/tmpnoise|1|2|3
  10648. @end example
  10649. @item
  10650. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10651. automatically depending on available CPU time:
  10652. @example
  10653. pp=hb|y/vb|a
  10654. @end example
  10655. @end itemize
  10656. @section pp7
  10657. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10658. similar to spp = 6 with 7 point DCT, where only the center sample is
  10659. used after IDCT.
  10660. The filter accepts the following options:
  10661. @table @option
  10662. @item qp
  10663. Force a constant quantization parameter. It accepts an integer in range
  10664. 0 to 63. If not set, the filter will use the QP from the video stream
  10665. (if available).
  10666. @item mode
  10667. Set thresholding mode. Available modes are:
  10668. @table @samp
  10669. @item hard
  10670. Set hard thresholding.
  10671. @item soft
  10672. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10673. @item medium
  10674. Set medium thresholding (good results, default).
  10675. @end table
  10676. @end table
  10677. @section premultiply
  10678. Apply alpha premultiply effect to input video stream using first plane
  10679. of second stream as alpha.
  10680. Both streams must have same dimensions and same pixel format.
  10681. The filter accepts the following option:
  10682. @table @option
  10683. @item planes
  10684. Set which planes will be processed, unprocessed planes will be copied.
  10685. By default value 0xf, all planes will be processed.
  10686. @item inplace
  10687. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10688. @end table
  10689. @section prewitt
  10690. Apply prewitt operator to input video stream.
  10691. The filter accepts the following option:
  10692. @table @option
  10693. @item planes
  10694. Set which planes will be processed, unprocessed planes will be copied.
  10695. By default value 0xf, all planes will be processed.
  10696. @item scale
  10697. Set value which will be multiplied with filtered result.
  10698. @item delta
  10699. Set value which will be added to filtered result.
  10700. @end table
  10701. @anchor{program_opencl}
  10702. @section program_opencl
  10703. Filter video using an OpenCL program.
  10704. @table @option
  10705. @item source
  10706. OpenCL program source file.
  10707. @item kernel
  10708. Kernel name in program.
  10709. @item inputs
  10710. Number of inputs to the filter. Defaults to 1.
  10711. @item size, s
  10712. Size of output frames. Defaults to the same as the first input.
  10713. @end table
  10714. The program source file must contain a kernel function with the given name,
  10715. which will be run once for each plane of the output. Each run on a plane
  10716. gets enqueued as a separate 2D global NDRange with one work-item for each
  10717. pixel to be generated. The global ID offset for each work-item is therefore
  10718. the coordinates of a pixel in the destination image.
  10719. The kernel function needs to take the following arguments:
  10720. @itemize
  10721. @item
  10722. Destination image, @var{__write_only image2d_t}.
  10723. This image will become the output; the kernel should write all of it.
  10724. @item
  10725. Frame index, @var{unsigned int}.
  10726. This is a counter starting from zero and increasing by one for each frame.
  10727. @item
  10728. Source images, @var{__read_only image2d_t}.
  10729. These are the most recent images on each input. The kernel may read from
  10730. them to generate the output, but they can't be written to.
  10731. @end itemize
  10732. Example programs:
  10733. @itemize
  10734. @item
  10735. Copy the input to the output (output must be the same size as the input).
  10736. @verbatim
  10737. __kernel void copy(__write_only image2d_t destination,
  10738. unsigned int index,
  10739. __read_only image2d_t source)
  10740. {
  10741. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10742. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10743. float4 value = read_imagef(source, sampler, location);
  10744. write_imagef(destination, location, value);
  10745. }
  10746. @end verbatim
  10747. @item
  10748. Apply a simple transformation, rotating the input by an amount increasing
  10749. with the index counter. Pixel values are linearly interpolated by the
  10750. sampler, and the output need not have the same dimensions as the input.
  10751. @verbatim
  10752. __kernel void rotate_image(__write_only image2d_t dst,
  10753. unsigned int index,
  10754. __read_only image2d_t src)
  10755. {
  10756. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10757. CLK_FILTER_LINEAR);
  10758. float angle = (float)index / 100.0f;
  10759. float2 dst_dim = convert_float2(get_image_dim(dst));
  10760. float2 src_dim = convert_float2(get_image_dim(src));
  10761. float2 dst_cen = dst_dim / 2.0f;
  10762. float2 src_cen = src_dim / 2.0f;
  10763. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10764. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10765. float2 src_pos = {
  10766. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10767. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10768. };
  10769. src_pos = src_pos * src_dim / dst_dim;
  10770. float2 src_loc = src_pos + src_cen;
  10771. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10772. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10773. write_imagef(dst, dst_loc, 0.5f);
  10774. else
  10775. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10776. }
  10777. @end verbatim
  10778. @item
  10779. Blend two inputs together, with the amount of each input used varying
  10780. with the index counter.
  10781. @verbatim
  10782. __kernel void blend_images(__write_only image2d_t dst,
  10783. unsigned int index,
  10784. __read_only image2d_t src1,
  10785. __read_only image2d_t src2)
  10786. {
  10787. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10788. CLK_FILTER_LINEAR);
  10789. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10790. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10791. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10792. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10793. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10794. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10795. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10796. }
  10797. @end verbatim
  10798. @end itemize
  10799. @section pseudocolor
  10800. Alter frame colors in video with pseudocolors.
  10801. This filter accept the following options:
  10802. @table @option
  10803. @item c0
  10804. set pixel first component expression
  10805. @item c1
  10806. set pixel second component expression
  10807. @item c2
  10808. set pixel third component expression
  10809. @item c3
  10810. set pixel fourth component expression, corresponds to the alpha component
  10811. @item i
  10812. set component to use as base for altering colors
  10813. @end table
  10814. Each of them specifies the expression to use for computing the lookup table for
  10815. the corresponding pixel component values.
  10816. The expressions can contain the following constants and functions:
  10817. @table @option
  10818. @item w
  10819. @item h
  10820. The input width and height.
  10821. @item val
  10822. The input value for the pixel component.
  10823. @item ymin, umin, vmin, amin
  10824. The minimum allowed component value.
  10825. @item ymax, umax, vmax, amax
  10826. The maximum allowed component value.
  10827. @end table
  10828. All expressions default to "val".
  10829. @subsection Examples
  10830. @itemize
  10831. @item
  10832. Change too high luma values to gradient:
  10833. @example
  10834. 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'"
  10835. @end example
  10836. @end itemize
  10837. @section psnr
  10838. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10839. Ratio) between two input videos.
  10840. This filter takes in input two input videos, the first input is
  10841. considered the "main" source and is passed unchanged to the
  10842. output. The second input is used as a "reference" video for computing
  10843. the PSNR.
  10844. Both video inputs must have the same resolution and pixel format for
  10845. this filter to work correctly. Also it assumes that both inputs
  10846. have the same number of frames, which are compared one by one.
  10847. The obtained average PSNR is printed through the logging system.
  10848. The filter stores the accumulated MSE (mean squared error) of each
  10849. frame, and at the end of the processing it is averaged across all frames
  10850. equally, and the following formula is applied to obtain the PSNR:
  10851. @example
  10852. PSNR = 10*log10(MAX^2/MSE)
  10853. @end example
  10854. Where MAX is the average of the maximum values of each component of the
  10855. image.
  10856. The description of the accepted parameters follows.
  10857. @table @option
  10858. @item stats_file, f
  10859. If specified the filter will use the named file to save the PSNR of
  10860. each individual frame. When filename equals "-" the data is sent to
  10861. standard output.
  10862. @item stats_version
  10863. Specifies which version of the stats file format to use. Details of
  10864. each format are written below.
  10865. Default value is 1.
  10866. @item stats_add_max
  10867. Determines whether the max value is output to the stats log.
  10868. Default value is 0.
  10869. Requires stats_version >= 2. If this is set and stats_version < 2,
  10870. the filter will return an error.
  10871. @end table
  10872. This filter also supports the @ref{framesync} options.
  10873. The file printed if @var{stats_file} is selected, contains a sequence of
  10874. key/value pairs of the form @var{key}:@var{value} for each compared
  10875. couple of frames.
  10876. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10877. the list of per-frame-pair stats, with key value pairs following the frame
  10878. format with the following parameters:
  10879. @table @option
  10880. @item psnr_log_version
  10881. The version of the log file format. Will match @var{stats_version}.
  10882. @item fields
  10883. A comma separated list of the per-frame-pair parameters included in
  10884. the log.
  10885. @end table
  10886. A description of each shown per-frame-pair parameter follows:
  10887. @table @option
  10888. @item n
  10889. sequential number of the input frame, starting from 1
  10890. @item mse_avg
  10891. Mean Square Error pixel-by-pixel average difference of the compared
  10892. frames, averaged over all the image components.
  10893. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10894. Mean Square Error pixel-by-pixel average difference of the compared
  10895. frames for the component specified by the suffix.
  10896. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10897. Peak Signal to Noise ratio of the compared frames for the component
  10898. specified by the suffix.
  10899. @item max_avg, max_y, max_u, max_v
  10900. Maximum allowed value for each channel, and average over all
  10901. channels.
  10902. @end table
  10903. For example:
  10904. @example
  10905. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10906. [main][ref] psnr="stats_file=stats.log" [out]
  10907. @end example
  10908. On this example the input file being processed is compared with the
  10909. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10910. is stored in @file{stats.log}.
  10911. @anchor{pullup}
  10912. @section pullup
  10913. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10914. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10915. content.
  10916. The pullup filter is designed to take advantage of future context in making
  10917. its decisions. This filter is stateless in the sense that it does not lock
  10918. onto a pattern to follow, but it instead looks forward to the following
  10919. fields in order to identify matches and rebuild progressive frames.
  10920. To produce content with an even framerate, insert the fps filter after
  10921. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10922. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10923. The filter accepts the following options:
  10924. @table @option
  10925. @item jl
  10926. @item jr
  10927. @item jt
  10928. @item jb
  10929. These options set the amount of "junk" to ignore at the left, right, top, and
  10930. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10931. while top and bottom are in units of 2 lines.
  10932. The default is 8 pixels on each side.
  10933. @item sb
  10934. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10935. filter generating an occasional mismatched frame, but it may also cause an
  10936. excessive number of frames to be dropped during high motion sequences.
  10937. Conversely, setting it to -1 will make filter match fields more easily.
  10938. This may help processing of video where there is slight blurring between
  10939. the fields, but may also cause there to be interlaced frames in the output.
  10940. Default value is @code{0}.
  10941. @item mp
  10942. Set the metric plane to use. It accepts the following values:
  10943. @table @samp
  10944. @item l
  10945. Use luma plane.
  10946. @item u
  10947. Use chroma blue plane.
  10948. @item v
  10949. Use chroma red plane.
  10950. @end table
  10951. This option may be set to use chroma plane instead of the default luma plane
  10952. for doing filter's computations. This may improve accuracy on very clean
  10953. source material, but more likely will decrease accuracy, especially if there
  10954. is chroma noise (rainbow effect) or any grayscale video.
  10955. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10956. load and make pullup usable in realtime on slow machines.
  10957. @end table
  10958. For best results (without duplicated frames in the output file) it is
  10959. necessary to change the output frame rate. For example, to inverse
  10960. telecine NTSC input:
  10961. @example
  10962. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10963. @end example
  10964. @section qp
  10965. Change video quantization parameters (QP).
  10966. The filter accepts the following option:
  10967. @table @option
  10968. @item qp
  10969. Set expression for quantization parameter.
  10970. @end table
  10971. The expression is evaluated through the eval API and can contain, among others,
  10972. the following constants:
  10973. @table @var
  10974. @item known
  10975. 1 if index is not 129, 0 otherwise.
  10976. @item qp
  10977. Sequential index starting from -129 to 128.
  10978. @end table
  10979. @subsection Examples
  10980. @itemize
  10981. @item
  10982. Some equation like:
  10983. @example
  10984. qp=2+2*sin(PI*qp)
  10985. @end example
  10986. @end itemize
  10987. @section random
  10988. Flush video frames from internal cache of frames into a random order.
  10989. No frame is discarded.
  10990. Inspired by @ref{frei0r} nervous filter.
  10991. @table @option
  10992. @item frames
  10993. Set size in number of frames of internal cache, in range from @code{2} to
  10994. @code{512}. Default is @code{30}.
  10995. @item seed
  10996. Set seed for random number generator, must be an integer included between
  10997. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10998. less than @code{0}, the filter will try to use a good random seed on a
  10999. best effort basis.
  11000. @end table
  11001. @section readeia608
  11002. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11003. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11004. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11005. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11006. @table @option
  11007. @item lavfi.readeia608.X.cc
  11008. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11009. @item lavfi.readeia608.X.line
  11010. The number of the line on which the EIA-608 data was identified and read.
  11011. @end table
  11012. This filter accepts the following options:
  11013. @table @option
  11014. @item scan_min
  11015. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11016. @item scan_max
  11017. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11018. @item mac
  11019. Set minimal acceptable amplitude change for sync codes detection.
  11020. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11021. @item spw
  11022. Set the ratio of width reserved for sync code detection.
  11023. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11024. @item mhd
  11025. Set the max peaks height difference for sync code detection.
  11026. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11027. @item mpd
  11028. Set max peaks period difference for sync code detection.
  11029. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11030. @item msd
  11031. Set the first two max start code bits differences.
  11032. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11033. @item bhd
  11034. Set the minimum ratio of bits height compared to 3rd start code bit.
  11035. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11036. @item th_w
  11037. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11038. @item th_b
  11039. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11040. @item chp
  11041. Enable checking the parity bit. In the event of a parity error, the filter will output
  11042. @code{0x00} for that character. Default is false.
  11043. @end table
  11044. @subsection Examples
  11045. @itemize
  11046. @item
  11047. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11048. @example
  11049. 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
  11050. @end example
  11051. @end itemize
  11052. @section readvitc
  11053. Read vertical interval timecode (VITC) information from the top lines of a
  11054. video frame.
  11055. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11056. timecode value, if a valid timecode has been detected. Further metadata key
  11057. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11058. timecode data has been found or not.
  11059. This filter accepts the following options:
  11060. @table @option
  11061. @item scan_max
  11062. Set the maximum number of lines to scan for VITC data. If the value is set to
  11063. @code{-1} the full video frame is scanned. Default is @code{45}.
  11064. @item thr_b
  11065. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11066. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11067. @item thr_w
  11068. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11069. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11070. @end table
  11071. @subsection Examples
  11072. @itemize
  11073. @item
  11074. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11075. draw @code{--:--:--:--} as a placeholder:
  11076. @example
  11077. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11078. @end example
  11079. @end itemize
  11080. @section remap
  11081. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11082. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11083. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11084. value for pixel will be used for destination pixel.
  11085. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11086. will have Xmap/Ymap video stream dimensions.
  11087. Xmap and Ymap input video streams are 16bit depth, single channel.
  11088. @section removegrain
  11089. The removegrain filter is a spatial denoiser for progressive video.
  11090. @table @option
  11091. @item m0
  11092. Set mode for the first plane.
  11093. @item m1
  11094. Set mode for the second plane.
  11095. @item m2
  11096. Set mode for the third plane.
  11097. @item m3
  11098. Set mode for the fourth plane.
  11099. @end table
  11100. Range of mode is from 0 to 24. Description of each mode follows:
  11101. @table @var
  11102. @item 0
  11103. Leave input plane unchanged. Default.
  11104. @item 1
  11105. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11106. @item 2
  11107. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11108. @item 3
  11109. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11110. @item 4
  11111. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11112. This is equivalent to a median filter.
  11113. @item 5
  11114. Line-sensitive clipping giving the minimal change.
  11115. @item 6
  11116. Line-sensitive clipping, intermediate.
  11117. @item 7
  11118. Line-sensitive clipping, intermediate.
  11119. @item 8
  11120. Line-sensitive clipping, intermediate.
  11121. @item 9
  11122. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11123. @item 10
  11124. Replaces the target pixel with the closest neighbour.
  11125. @item 11
  11126. [1 2 1] horizontal and vertical kernel blur.
  11127. @item 12
  11128. Same as mode 11.
  11129. @item 13
  11130. Bob mode, interpolates top field from the line where the neighbours
  11131. pixels are the closest.
  11132. @item 14
  11133. Bob mode, interpolates bottom field from the line where the neighbours
  11134. pixels are the closest.
  11135. @item 15
  11136. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11137. interpolation formula.
  11138. @item 16
  11139. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11140. interpolation formula.
  11141. @item 17
  11142. Clips the pixel with the minimum and maximum of respectively the maximum and
  11143. minimum of each pair of opposite neighbour pixels.
  11144. @item 18
  11145. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11146. the current pixel is minimal.
  11147. @item 19
  11148. Replaces the pixel with the average of its 8 neighbours.
  11149. @item 20
  11150. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11151. @item 21
  11152. Clips pixels using the averages of opposite neighbour.
  11153. @item 22
  11154. Same as mode 21 but simpler and faster.
  11155. @item 23
  11156. Small edge and halo removal, but reputed useless.
  11157. @item 24
  11158. Similar as 23.
  11159. @end table
  11160. @section removelogo
  11161. Suppress a TV station logo, using an image file to determine which
  11162. pixels comprise the logo. It works by filling in the pixels that
  11163. comprise the logo with neighboring pixels.
  11164. The filter accepts the following options:
  11165. @table @option
  11166. @item filename, f
  11167. Set the filter bitmap file, which can be any image format supported by
  11168. libavformat. The width and height of the image file must match those of the
  11169. video stream being processed.
  11170. @end table
  11171. Pixels in the provided bitmap image with a value of zero are not
  11172. considered part of the logo, non-zero pixels are considered part of
  11173. the logo. If you use white (255) for the logo and black (0) for the
  11174. rest, you will be safe. For making the filter bitmap, it is
  11175. recommended to take a screen capture of a black frame with the logo
  11176. visible, and then using a threshold filter followed by the erode
  11177. filter once or twice.
  11178. If needed, little splotches can be fixed manually. Remember that if
  11179. logo pixels are not covered, the filter quality will be much
  11180. reduced. Marking too many pixels as part of the logo does not hurt as
  11181. much, but it will increase the amount of blurring needed to cover over
  11182. the image and will destroy more information than necessary, and extra
  11183. pixels will slow things down on a large logo.
  11184. @section repeatfields
  11185. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11186. fields based on its value.
  11187. @section reverse
  11188. Reverse a video clip.
  11189. Warning: This filter requires memory to buffer the entire clip, so trimming
  11190. is suggested.
  11191. @subsection Examples
  11192. @itemize
  11193. @item
  11194. Take the first 5 seconds of a clip, and reverse it.
  11195. @example
  11196. trim=end=5,reverse
  11197. @end example
  11198. @end itemize
  11199. @section rgbashift
  11200. Shift R/G/B/A pixels horizontally and/or vertically.
  11201. The filter accepts the following options:
  11202. @table @option
  11203. @item rh
  11204. Set amount to shift red horizontally.
  11205. @item rv
  11206. Set amount to shift red vertically.
  11207. @item gh
  11208. Set amount to shift green horizontally.
  11209. @item gv
  11210. Set amount to shift green vertically.
  11211. @item bh
  11212. Set amount to shift blue horizontally.
  11213. @item bv
  11214. Set amount to shift blue vertically.
  11215. @item ah
  11216. Set amount to shift alpha horizontally.
  11217. @item av
  11218. Set amount to shift alpha vertically.
  11219. @item edge
  11220. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11221. @end table
  11222. @section roberts
  11223. Apply roberts cross operator to input video stream.
  11224. The filter accepts the following option:
  11225. @table @option
  11226. @item planes
  11227. Set which planes will be processed, unprocessed planes will be copied.
  11228. By default value 0xf, all planes will be processed.
  11229. @item scale
  11230. Set value which will be multiplied with filtered result.
  11231. @item delta
  11232. Set value which will be added to filtered result.
  11233. @end table
  11234. @section rotate
  11235. Rotate video by an arbitrary angle expressed in radians.
  11236. The filter accepts the following options:
  11237. A description of the optional parameters follows.
  11238. @table @option
  11239. @item angle, a
  11240. Set an expression for the angle by which to rotate the input video
  11241. clockwise, expressed as a number of radians. A negative value will
  11242. result in a counter-clockwise rotation. By default it is set to "0".
  11243. This expression is evaluated for each frame.
  11244. @item out_w, ow
  11245. Set the output width expression, default value is "iw".
  11246. This expression is evaluated just once during configuration.
  11247. @item out_h, oh
  11248. Set the output height expression, default value is "ih".
  11249. This expression is evaluated just once during configuration.
  11250. @item bilinear
  11251. Enable bilinear interpolation if set to 1, a value of 0 disables
  11252. it. Default value is 1.
  11253. @item fillcolor, c
  11254. Set the color used to fill the output area not covered by the rotated
  11255. image. For the general syntax of this option, check the
  11256. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11257. If the special value "none" is selected then no
  11258. background is printed (useful for example if the background is never shown).
  11259. Default value is "black".
  11260. @end table
  11261. The expressions for the angle and the output size can contain the
  11262. following constants and functions:
  11263. @table @option
  11264. @item n
  11265. sequential number of the input frame, starting from 0. It is always NAN
  11266. before the first frame is filtered.
  11267. @item t
  11268. time in seconds of the input frame, it is set to 0 when the filter is
  11269. configured. It is always NAN before the first frame is filtered.
  11270. @item hsub
  11271. @item vsub
  11272. horizontal and vertical chroma subsample values. For example for the
  11273. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11274. @item in_w, iw
  11275. @item in_h, ih
  11276. the input video width and height
  11277. @item out_w, ow
  11278. @item out_h, oh
  11279. the output width and height, that is the size of the padded area as
  11280. specified by the @var{width} and @var{height} expressions
  11281. @item rotw(a)
  11282. @item roth(a)
  11283. the minimal width/height required for completely containing the input
  11284. video rotated by @var{a} radians.
  11285. These are only available when computing the @option{out_w} and
  11286. @option{out_h} expressions.
  11287. @end table
  11288. @subsection Examples
  11289. @itemize
  11290. @item
  11291. Rotate the input by PI/6 radians clockwise:
  11292. @example
  11293. rotate=PI/6
  11294. @end example
  11295. @item
  11296. Rotate the input by PI/6 radians counter-clockwise:
  11297. @example
  11298. rotate=-PI/6
  11299. @end example
  11300. @item
  11301. Rotate the input by 45 degrees clockwise:
  11302. @example
  11303. rotate=45*PI/180
  11304. @end example
  11305. @item
  11306. Apply a constant rotation with period T, starting from an angle of PI/3:
  11307. @example
  11308. rotate=PI/3+2*PI*t/T
  11309. @end example
  11310. @item
  11311. Make the input video rotation oscillating with a period of T
  11312. seconds and an amplitude of A radians:
  11313. @example
  11314. rotate=A*sin(2*PI/T*t)
  11315. @end example
  11316. @item
  11317. Rotate the video, output size is chosen so that the whole rotating
  11318. input video is always completely contained in the output:
  11319. @example
  11320. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11321. @end example
  11322. @item
  11323. Rotate the video, reduce the output size so that no background is ever
  11324. shown:
  11325. @example
  11326. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11327. @end example
  11328. @end itemize
  11329. @subsection Commands
  11330. The filter supports the following commands:
  11331. @table @option
  11332. @item a, angle
  11333. Set the angle expression.
  11334. The command accepts the same syntax of the corresponding option.
  11335. If the specified expression is not valid, it is kept at its current
  11336. value.
  11337. @end table
  11338. @section sab
  11339. Apply Shape Adaptive Blur.
  11340. The filter accepts the following options:
  11341. @table @option
  11342. @item luma_radius, lr
  11343. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11344. value is 1.0. A greater value will result in a more blurred image, and
  11345. in slower processing.
  11346. @item luma_pre_filter_radius, lpfr
  11347. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11348. value is 1.0.
  11349. @item luma_strength, ls
  11350. Set luma maximum difference between pixels to still be considered, must
  11351. be a value in the 0.1-100.0 range, default value is 1.0.
  11352. @item chroma_radius, cr
  11353. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11354. greater value will result in a more blurred image, and in slower
  11355. processing.
  11356. @item chroma_pre_filter_radius, cpfr
  11357. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11358. @item chroma_strength, cs
  11359. Set chroma maximum difference between pixels to still be considered,
  11360. must be a value in the -0.9-100.0 range.
  11361. @end table
  11362. Each chroma option value, if not explicitly specified, is set to the
  11363. corresponding luma option value.
  11364. @anchor{scale}
  11365. @section scale
  11366. Scale (resize) the input video, using the libswscale library.
  11367. The scale filter forces the output display aspect ratio to be the same
  11368. of the input, by changing the output sample aspect ratio.
  11369. If the input image format is different from the format requested by
  11370. the next filter, the scale filter will convert the input to the
  11371. requested format.
  11372. @subsection Options
  11373. The filter accepts the following options, or any of the options
  11374. supported by the libswscale scaler.
  11375. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11376. the complete list of scaler options.
  11377. @table @option
  11378. @item width, w
  11379. @item height, h
  11380. Set the output video dimension expression. Default value is the input
  11381. dimension.
  11382. If the @var{width} or @var{w} value is 0, the input width is used for
  11383. the output. If the @var{height} or @var{h} value is 0, the input height
  11384. is used for the output.
  11385. If one and only one of the values is -n with n >= 1, the scale filter
  11386. will use a value that maintains the aspect ratio of the input image,
  11387. calculated from the other specified dimension. After that it will,
  11388. however, make sure that the calculated dimension is divisible by n and
  11389. adjust the value if necessary.
  11390. If both values are -n with n >= 1, the behavior will be identical to
  11391. both values being set to 0 as previously detailed.
  11392. See below for the list of accepted constants for use in the dimension
  11393. expression.
  11394. @item eval
  11395. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11396. @table @samp
  11397. @item init
  11398. Only evaluate expressions once during the filter initialization or when a command is processed.
  11399. @item frame
  11400. Evaluate expressions for each incoming frame.
  11401. @end table
  11402. Default value is @samp{init}.
  11403. @item interl
  11404. Set the interlacing mode. It accepts the following values:
  11405. @table @samp
  11406. @item 1
  11407. Force interlaced aware scaling.
  11408. @item 0
  11409. Do not apply interlaced scaling.
  11410. @item -1
  11411. Select interlaced aware scaling depending on whether the source frames
  11412. are flagged as interlaced or not.
  11413. @end table
  11414. Default value is @samp{0}.
  11415. @item flags
  11416. Set libswscale scaling flags. See
  11417. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11418. complete list of values. If not explicitly specified the filter applies
  11419. the default flags.
  11420. @item param0, param1
  11421. Set libswscale input parameters for scaling algorithms that need them. See
  11422. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11423. complete documentation. If not explicitly specified the filter applies
  11424. empty parameters.
  11425. @item size, s
  11426. Set the video size. For the syntax of this option, check the
  11427. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11428. @item in_color_matrix
  11429. @item out_color_matrix
  11430. Set in/output YCbCr color space type.
  11431. This allows the autodetected value to be overridden as well as allows forcing
  11432. a specific value used for the output and encoder.
  11433. If not specified, the color space type depends on the pixel format.
  11434. Possible values:
  11435. @table @samp
  11436. @item auto
  11437. Choose automatically.
  11438. @item bt709
  11439. Format conforming to International Telecommunication Union (ITU)
  11440. Recommendation BT.709.
  11441. @item fcc
  11442. Set color space conforming to the United States Federal Communications
  11443. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11444. @item bt601
  11445. Set color space conforming to:
  11446. @itemize
  11447. @item
  11448. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11449. @item
  11450. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11451. @item
  11452. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11453. @end itemize
  11454. @item smpte240m
  11455. Set color space conforming to SMPTE ST 240:1999.
  11456. @end table
  11457. @item in_range
  11458. @item out_range
  11459. Set in/output YCbCr sample range.
  11460. This allows the autodetected value to be overridden as well as allows forcing
  11461. a specific value used for the output and encoder. If not specified, the
  11462. range depends on the pixel format. Possible values:
  11463. @table @samp
  11464. @item auto/unknown
  11465. Choose automatically.
  11466. @item jpeg/full/pc
  11467. Set full range (0-255 in case of 8-bit luma).
  11468. @item mpeg/limited/tv
  11469. Set "MPEG" range (16-235 in case of 8-bit luma).
  11470. @end table
  11471. @item force_original_aspect_ratio
  11472. Enable decreasing or increasing output video width or height if necessary to
  11473. keep the original aspect ratio. Possible values:
  11474. @table @samp
  11475. @item disable
  11476. Scale the video as specified and disable this feature.
  11477. @item decrease
  11478. The output video dimensions will automatically be decreased if needed.
  11479. @item increase
  11480. The output video dimensions will automatically be increased if needed.
  11481. @end table
  11482. One useful instance of this option is that when you know a specific device's
  11483. maximum allowed resolution, you can use this to limit the output video to
  11484. that, while retaining the aspect ratio. For example, device A allows
  11485. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11486. decrease) and specifying 1280x720 to the command line makes the output
  11487. 1280x533.
  11488. Please note that this is a different thing than specifying -1 for @option{w}
  11489. or @option{h}, you still need to specify the output resolution for this option
  11490. to work.
  11491. @end table
  11492. The values of the @option{w} and @option{h} options are expressions
  11493. containing the following constants:
  11494. @table @var
  11495. @item in_w
  11496. @item in_h
  11497. The input width and height
  11498. @item iw
  11499. @item ih
  11500. These are the same as @var{in_w} and @var{in_h}.
  11501. @item out_w
  11502. @item out_h
  11503. The output (scaled) width and height
  11504. @item ow
  11505. @item oh
  11506. These are the same as @var{out_w} and @var{out_h}
  11507. @item a
  11508. The same as @var{iw} / @var{ih}
  11509. @item sar
  11510. input sample aspect ratio
  11511. @item dar
  11512. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11513. @item hsub
  11514. @item vsub
  11515. horizontal and vertical input chroma subsample values. For example for the
  11516. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11517. @item ohsub
  11518. @item ovsub
  11519. horizontal and vertical output chroma subsample values. For example for the
  11520. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11521. @end table
  11522. @subsection Examples
  11523. @itemize
  11524. @item
  11525. Scale the input video to a size of 200x100
  11526. @example
  11527. scale=w=200:h=100
  11528. @end example
  11529. This is equivalent to:
  11530. @example
  11531. scale=200:100
  11532. @end example
  11533. or:
  11534. @example
  11535. scale=200x100
  11536. @end example
  11537. @item
  11538. Specify a size abbreviation for the output size:
  11539. @example
  11540. scale=qcif
  11541. @end example
  11542. which can also be written as:
  11543. @example
  11544. scale=size=qcif
  11545. @end example
  11546. @item
  11547. Scale the input to 2x:
  11548. @example
  11549. scale=w=2*iw:h=2*ih
  11550. @end example
  11551. @item
  11552. The above is the same as:
  11553. @example
  11554. scale=2*in_w:2*in_h
  11555. @end example
  11556. @item
  11557. Scale the input to 2x with forced interlaced scaling:
  11558. @example
  11559. scale=2*iw:2*ih:interl=1
  11560. @end example
  11561. @item
  11562. Scale the input to half size:
  11563. @example
  11564. scale=w=iw/2:h=ih/2
  11565. @end example
  11566. @item
  11567. Increase the width, and set the height to the same size:
  11568. @example
  11569. scale=3/2*iw:ow
  11570. @end example
  11571. @item
  11572. Seek Greek harmony:
  11573. @example
  11574. scale=iw:1/PHI*iw
  11575. scale=ih*PHI:ih
  11576. @end example
  11577. @item
  11578. Increase the height, and set the width to 3/2 of the height:
  11579. @example
  11580. scale=w=3/2*oh:h=3/5*ih
  11581. @end example
  11582. @item
  11583. Increase the size, making the size a multiple of the chroma
  11584. subsample values:
  11585. @example
  11586. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11587. @end example
  11588. @item
  11589. Increase the width to a maximum of 500 pixels,
  11590. keeping the same aspect ratio as the input:
  11591. @example
  11592. scale=w='min(500\, iw*3/2):h=-1'
  11593. @end example
  11594. @item
  11595. Make pixels square by combining scale and setsar:
  11596. @example
  11597. scale='trunc(ih*dar):ih',setsar=1/1
  11598. @end example
  11599. @item
  11600. Make pixels square by combining scale and setsar,
  11601. making sure the resulting resolution is even (required by some codecs):
  11602. @example
  11603. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11604. @end example
  11605. @end itemize
  11606. @subsection Commands
  11607. This filter supports the following commands:
  11608. @table @option
  11609. @item width, w
  11610. @item height, h
  11611. Set the output video dimension expression.
  11612. The command accepts the same syntax of the corresponding option.
  11613. If the specified expression is not valid, it is kept at its current
  11614. value.
  11615. @end table
  11616. @section scale_npp
  11617. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11618. format conversion on CUDA video frames. Setting the output width and height
  11619. works in the same way as for the @var{scale} filter.
  11620. The following additional options are accepted:
  11621. @table @option
  11622. @item format
  11623. The pixel format of the output CUDA frames. If set to the string "same" (the
  11624. default), the input format will be kept. Note that automatic format negotiation
  11625. and conversion is not yet supported for hardware frames
  11626. @item interp_algo
  11627. The interpolation algorithm used for resizing. One of the following:
  11628. @table @option
  11629. @item nn
  11630. Nearest neighbour.
  11631. @item linear
  11632. @item cubic
  11633. @item cubic2p_bspline
  11634. 2-parameter cubic (B=1, C=0)
  11635. @item cubic2p_catmullrom
  11636. 2-parameter cubic (B=0, C=1/2)
  11637. @item cubic2p_b05c03
  11638. 2-parameter cubic (B=1/2, C=3/10)
  11639. @item super
  11640. Supersampling
  11641. @item lanczos
  11642. @end table
  11643. @end table
  11644. @section scale2ref
  11645. Scale (resize) the input video, based on a reference video.
  11646. See the scale filter for available options, scale2ref supports the same but
  11647. uses the reference video instead of the main input as basis. scale2ref also
  11648. supports the following additional constants for the @option{w} and
  11649. @option{h} options:
  11650. @table @var
  11651. @item main_w
  11652. @item main_h
  11653. The main input video's width and height
  11654. @item main_a
  11655. The same as @var{main_w} / @var{main_h}
  11656. @item main_sar
  11657. The main input video's sample aspect ratio
  11658. @item main_dar, mdar
  11659. The main input video's display aspect ratio. Calculated from
  11660. @code{(main_w / main_h) * main_sar}.
  11661. @item main_hsub
  11662. @item main_vsub
  11663. The main input video's horizontal and vertical chroma subsample values.
  11664. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11665. is 1.
  11666. @end table
  11667. @subsection Examples
  11668. @itemize
  11669. @item
  11670. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11671. @example
  11672. 'scale2ref[b][a];[a][b]overlay'
  11673. @end example
  11674. @end itemize
  11675. @anchor{selectivecolor}
  11676. @section selectivecolor
  11677. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11678. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11679. by the "purity" of the color (that is, how saturated it already is).
  11680. This filter is similar to the Adobe Photoshop Selective Color tool.
  11681. The filter accepts the following options:
  11682. @table @option
  11683. @item correction_method
  11684. Select color correction method.
  11685. Available values are:
  11686. @table @samp
  11687. @item absolute
  11688. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11689. component value).
  11690. @item relative
  11691. Specified adjustments are relative to the original component value.
  11692. @end table
  11693. Default is @code{absolute}.
  11694. @item reds
  11695. Adjustments for red pixels (pixels where the red component is the maximum)
  11696. @item yellows
  11697. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11698. @item greens
  11699. Adjustments for green pixels (pixels where the green component is the maximum)
  11700. @item cyans
  11701. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11702. @item blues
  11703. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11704. @item magentas
  11705. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11706. @item whites
  11707. Adjustments for white pixels (pixels where all components are greater than 128)
  11708. @item neutrals
  11709. Adjustments for all pixels except pure black and pure white
  11710. @item blacks
  11711. Adjustments for black pixels (pixels where all components are lesser than 128)
  11712. @item psfile
  11713. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11714. @end table
  11715. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11716. 4 space separated floating point adjustment values in the [-1,1] range,
  11717. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11718. pixels of its range.
  11719. @subsection Examples
  11720. @itemize
  11721. @item
  11722. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11723. increase magenta by 27% in blue areas:
  11724. @example
  11725. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11726. @end example
  11727. @item
  11728. Use a Photoshop selective color preset:
  11729. @example
  11730. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11731. @end example
  11732. @end itemize
  11733. @anchor{separatefields}
  11734. @section separatefields
  11735. The @code{separatefields} takes a frame-based video input and splits
  11736. each frame into its components fields, producing a new half height clip
  11737. with twice the frame rate and twice the frame count.
  11738. This filter use field-dominance information in frame to decide which
  11739. of each pair of fields to place first in the output.
  11740. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11741. @section setdar, setsar
  11742. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11743. output video.
  11744. This is done by changing the specified Sample (aka Pixel) Aspect
  11745. Ratio, according to the following equation:
  11746. @example
  11747. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11748. @end example
  11749. Keep in mind that the @code{setdar} filter does not modify the pixel
  11750. dimensions of the video frame. Also, the display aspect ratio set by
  11751. this filter may be changed by later filters in the filterchain,
  11752. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11753. applied.
  11754. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11755. the filter output video.
  11756. Note that as a consequence of the application of this filter, the
  11757. output display aspect ratio will change according to the equation
  11758. above.
  11759. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11760. filter may be changed by later filters in the filterchain, e.g. if
  11761. another "setsar" or a "setdar" filter is applied.
  11762. It accepts the following parameters:
  11763. @table @option
  11764. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11765. Set the aspect ratio used by the filter.
  11766. The parameter can be a floating point number string, an expression, or
  11767. a string of the form @var{num}:@var{den}, where @var{num} and
  11768. @var{den} are the numerator and denominator of the aspect ratio. If
  11769. the parameter is not specified, it is assumed the value "0".
  11770. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11771. should be escaped.
  11772. @item max
  11773. Set the maximum integer value to use for expressing numerator and
  11774. denominator when reducing the expressed aspect ratio to a rational.
  11775. Default value is @code{100}.
  11776. @end table
  11777. The parameter @var{sar} is an expression containing
  11778. the following constants:
  11779. @table @option
  11780. @item E, PI, PHI
  11781. These are approximated values for the mathematical constants e
  11782. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11783. @item w, h
  11784. The input width and height.
  11785. @item a
  11786. These are the same as @var{w} / @var{h}.
  11787. @item sar
  11788. The input sample aspect ratio.
  11789. @item dar
  11790. The input display aspect ratio. It is the same as
  11791. (@var{w} / @var{h}) * @var{sar}.
  11792. @item hsub, vsub
  11793. Horizontal and vertical chroma subsample values. For example, for the
  11794. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11795. @end table
  11796. @subsection Examples
  11797. @itemize
  11798. @item
  11799. To change the display aspect ratio to 16:9, specify one of the following:
  11800. @example
  11801. setdar=dar=1.77777
  11802. setdar=dar=16/9
  11803. @end example
  11804. @item
  11805. To change the sample aspect ratio to 10:11, specify:
  11806. @example
  11807. setsar=sar=10/11
  11808. @end example
  11809. @item
  11810. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11811. 1000 in the aspect ratio reduction, use the command:
  11812. @example
  11813. setdar=ratio=16/9:max=1000
  11814. @end example
  11815. @end itemize
  11816. @anchor{setfield}
  11817. @section setfield
  11818. Force field for the output video frame.
  11819. The @code{setfield} filter marks the interlace type field for the
  11820. output frames. It does not change the input frame, but only sets the
  11821. corresponding property, which affects how the frame is treated by
  11822. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11823. The filter accepts the following options:
  11824. @table @option
  11825. @item mode
  11826. Available values are:
  11827. @table @samp
  11828. @item auto
  11829. Keep the same field property.
  11830. @item bff
  11831. Mark the frame as bottom-field-first.
  11832. @item tff
  11833. Mark the frame as top-field-first.
  11834. @item prog
  11835. Mark the frame as progressive.
  11836. @end table
  11837. @end table
  11838. @anchor{setparams}
  11839. @section setparams
  11840. Force frame parameter for the output video frame.
  11841. The @code{setparams} filter marks interlace and color range for the
  11842. output frames. It does not change the input frame, but only sets the
  11843. corresponding property, which affects how the frame is treated by
  11844. filters/encoders.
  11845. @table @option
  11846. @item field_mode
  11847. Available values are:
  11848. @table @samp
  11849. @item auto
  11850. Keep the same field property (default).
  11851. @item bff
  11852. Mark the frame as bottom-field-first.
  11853. @item tff
  11854. Mark the frame as top-field-first.
  11855. @item prog
  11856. Mark the frame as progressive.
  11857. @end table
  11858. @item range
  11859. Available values are:
  11860. @table @samp
  11861. @item auto
  11862. Keep the same color range property (default).
  11863. @item unspecified, unknown
  11864. Mark the frame as unspecified color range.
  11865. @item limited, tv, mpeg
  11866. Mark the frame as limited range.
  11867. @item full, pc, jpeg
  11868. Mark the frame as full range.
  11869. @end table
  11870. @item color_primaries
  11871. Set the color primaries.
  11872. Available values are:
  11873. @table @samp
  11874. @item auto
  11875. Keep the same color primaries property (default).
  11876. @item bt709
  11877. @item unknown
  11878. @item bt470m
  11879. @item bt470bg
  11880. @item smpte170m
  11881. @item smpte240m
  11882. @item film
  11883. @item bt2020
  11884. @item smpte428
  11885. @item smpte431
  11886. @item smpte432
  11887. @item jedec-p22
  11888. @end table
  11889. @item color_trc
  11890. Set the color transfer.
  11891. Available values are:
  11892. @table @samp
  11893. @item auto
  11894. Keep the same color trc property (default).
  11895. @item bt709
  11896. @item unknown
  11897. @item bt470m
  11898. @item bt470bg
  11899. @item smpte170m
  11900. @item smpte240m
  11901. @item linear
  11902. @item log100
  11903. @item log316
  11904. @item iec61966-2-4
  11905. @item bt1361e
  11906. @item iec61966-2-1
  11907. @item bt2020-10
  11908. @item bt2020-12
  11909. @item smpte2084
  11910. @item smpte428
  11911. @item arib-std-b67
  11912. @end table
  11913. @item colorspace
  11914. Set the colorspace.
  11915. Available values are:
  11916. @table @samp
  11917. @item auto
  11918. Keep the same colorspace property (default).
  11919. @item gbr
  11920. @item bt709
  11921. @item unknown
  11922. @item fcc
  11923. @item bt470bg
  11924. @item smpte170m
  11925. @item smpte240m
  11926. @item ycgco
  11927. @item bt2020nc
  11928. @item bt2020c
  11929. @item smpte2085
  11930. @item chroma-derived-nc
  11931. @item chroma-derived-c
  11932. @item ictcp
  11933. @end table
  11934. @end table
  11935. @section showinfo
  11936. Show a line containing various information for each input video frame.
  11937. The input video is not modified.
  11938. This filter supports the following options:
  11939. @table @option
  11940. @item checksum
  11941. Calculate checksums of each plane. By default enabled.
  11942. @end table
  11943. The shown line contains a sequence of key/value pairs of the form
  11944. @var{key}:@var{value}.
  11945. The following values are shown in the output:
  11946. @table @option
  11947. @item n
  11948. The (sequential) number of the input frame, starting from 0.
  11949. @item pts
  11950. The Presentation TimeStamp of the input frame, expressed as a number of
  11951. time base units. The time base unit depends on the filter input pad.
  11952. @item pts_time
  11953. The Presentation TimeStamp of the input frame, expressed as a number of
  11954. seconds.
  11955. @item pos
  11956. The position of the frame in the input stream, or -1 if this information is
  11957. unavailable and/or meaningless (for example in case of synthetic video).
  11958. @item fmt
  11959. The pixel format name.
  11960. @item sar
  11961. The sample aspect ratio of the input frame, expressed in the form
  11962. @var{num}/@var{den}.
  11963. @item s
  11964. The size of the input frame. For the syntax of this option, check the
  11965. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11966. @item i
  11967. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11968. for bottom field first).
  11969. @item iskey
  11970. This is 1 if the frame is a key frame, 0 otherwise.
  11971. @item type
  11972. The picture type of the input frame ("I" for an I-frame, "P" for a
  11973. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11974. Also refer to the documentation of the @code{AVPictureType} enum and of
  11975. the @code{av_get_picture_type_char} function defined in
  11976. @file{libavutil/avutil.h}.
  11977. @item checksum
  11978. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11979. @item plane_checksum
  11980. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11981. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11982. @end table
  11983. @section showpalette
  11984. Displays the 256 colors palette of each frame. This filter is only relevant for
  11985. @var{pal8} pixel format frames.
  11986. It accepts the following option:
  11987. @table @option
  11988. @item s
  11989. Set the size of the box used to represent one palette color entry. Default is
  11990. @code{30} (for a @code{30x30} pixel box).
  11991. @end table
  11992. @section shuffleframes
  11993. Reorder and/or duplicate and/or drop video frames.
  11994. It accepts the following parameters:
  11995. @table @option
  11996. @item mapping
  11997. Set the destination indexes of input frames.
  11998. This is space or '|' separated list of indexes that maps input frames to output
  11999. frames. Number of indexes also sets maximal value that each index may have.
  12000. '-1' index have special meaning and that is to drop frame.
  12001. @end table
  12002. The first frame has the index 0. The default is to keep the input unchanged.
  12003. @subsection Examples
  12004. @itemize
  12005. @item
  12006. Swap second and third frame of every three frames of the input:
  12007. @example
  12008. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12009. @end example
  12010. @item
  12011. Swap 10th and 1st frame of every ten frames of the input:
  12012. @example
  12013. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12014. @end example
  12015. @end itemize
  12016. @section shuffleplanes
  12017. Reorder and/or duplicate video planes.
  12018. It accepts the following parameters:
  12019. @table @option
  12020. @item map0
  12021. The index of the input plane to be used as the first output plane.
  12022. @item map1
  12023. The index of the input plane to be used as the second output plane.
  12024. @item map2
  12025. The index of the input plane to be used as the third output plane.
  12026. @item map3
  12027. The index of the input plane to be used as the fourth output plane.
  12028. @end table
  12029. The first plane has the index 0. The default is to keep the input unchanged.
  12030. @subsection Examples
  12031. @itemize
  12032. @item
  12033. Swap the second and third planes of the input:
  12034. @example
  12035. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12036. @end example
  12037. @end itemize
  12038. @anchor{signalstats}
  12039. @section signalstats
  12040. Evaluate various visual metrics that assist in determining issues associated
  12041. with the digitization of analog video media.
  12042. By default the filter will log these metadata values:
  12043. @table @option
  12044. @item YMIN
  12045. Display the minimal Y value contained within the input frame. Expressed in
  12046. range of [0-255].
  12047. @item YLOW
  12048. Display the Y value at the 10% percentile within the input frame. Expressed in
  12049. range of [0-255].
  12050. @item YAVG
  12051. Display the average Y value within the input frame. Expressed in range of
  12052. [0-255].
  12053. @item YHIGH
  12054. Display the Y value at the 90% percentile within the input frame. Expressed in
  12055. range of [0-255].
  12056. @item YMAX
  12057. Display the maximum Y value contained within the input frame. Expressed in
  12058. range of [0-255].
  12059. @item UMIN
  12060. Display the minimal U value contained within the input frame. Expressed in
  12061. range of [0-255].
  12062. @item ULOW
  12063. Display the U value at the 10% percentile within the input frame. Expressed in
  12064. range of [0-255].
  12065. @item UAVG
  12066. Display the average U value within the input frame. Expressed in range of
  12067. [0-255].
  12068. @item UHIGH
  12069. Display the U value at the 90% percentile within the input frame. Expressed in
  12070. range of [0-255].
  12071. @item UMAX
  12072. Display the maximum U value contained within the input frame. Expressed in
  12073. range of [0-255].
  12074. @item VMIN
  12075. Display the minimal V value contained within the input frame. Expressed in
  12076. range of [0-255].
  12077. @item VLOW
  12078. Display the V value at the 10% percentile within the input frame. Expressed in
  12079. range of [0-255].
  12080. @item VAVG
  12081. Display the average V value within the input frame. Expressed in range of
  12082. [0-255].
  12083. @item VHIGH
  12084. Display the V value at the 90% percentile within the input frame. Expressed in
  12085. range of [0-255].
  12086. @item VMAX
  12087. Display the maximum V value contained within the input frame. Expressed in
  12088. range of [0-255].
  12089. @item SATMIN
  12090. Display the minimal saturation value contained within the input frame.
  12091. Expressed in range of [0-~181.02].
  12092. @item SATLOW
  12093. Display the saturation value at the 10% percentile within the input frame.
  12094. Expressed in range of [0-~181.02].
  12095. @item SATAVG
  12096. Display the average saturation value within the input frame. Expressed in range
  12097. of [0-~181.02].
  12098. @item SATHIGH
  12099. Display the saturation value at the 90% percentile within the input frame.
  12100. Expressed in range of [0-~181.02].
  12101. @item SATMAX
  12102. Display the maximum saturation value contained within the input frame.
  12103. Expressed in range of [0-~181.02].
  12104. @item HUEMED
  12105. Display the median value for hue within the input frame. Expressed in range of
  12106. [0-360].
  12107. @item HUEAVG
  12108. Display the average value for hue within the input frame. Expressed in range of
  12109. [0-360].
  12110. @item YDIF
  12111. Display the average of sample value difference between all values of the Y
  12112. plane in the current frame and corresponding values of the previous input frame.
  12113. Expressed in range of [0-255].
  12114. @item UDIF
  12115. Display the average of sample value difference between all values of the U
  12116. plane in the current frame and corresponding values of the previous input frame.
  12117. Expressed in range of [0-255].
  12118. @item VDIF
  12119. Display the average of sample value difference between all values of the V
  12120. plane in the current frame and corresponding values of the previous input frame.
  12121. Expressed in range of [0-255].
  12122. @item YBITDEPTH
  12123. Display bit depth of Y plane in current frame.
  12124. Expressed in range of [0-16].
  12125. @item UBITDEPTH
  12126. Display bit depth of U plane in current frame.
  12127. Expressed in range of [0-16].
  12128. @item VBITDEPTH
  12129. Display bit depth of V plane in current frame.
  12130. Expressed in range of [0-16].
  12131. @end table
  12132. The filter accepts the following options:
  12133. @table @option
  12134. @item stat
  12135. @item out
  12136. @option{stat} specify an additional form of image analysis.
  12137. @option{out} output video with the specified type of pixel highlighted.
  12138. Both options accept the following values:
  12139. @table @samp
  12140. @item tout
  12141. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12142. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12143. include the results of video dropouts, head clogs, or tape tracking issues.
  12144. @item vrep
  12145. Identify @var{vertical line repetition}. Vertical line repetition includes
  12146. similar rows of pixels within a frame. In born-digital video vertical line
  12147. repetition is common, but this pattern is uncommon in video digitized from an
  12148. analog source. When it occurs in video that results from the digitization of an
  12149. analog source it can indicate concealment from a dropout compensator.
  12150. @item brng
  12151. Identify pixels that fall outside of legal broadcast range.
  12152. @end table
  12153. @item color, c
  12154. Set the highlight color for the @option{out} option. The default color is
  12155. yellow.
  12156. @end table
  12157. @subsection Examples
  12158. @itemize
  12159. @item
  12160. Output data of various video metrics:
  12161. @example
  12162. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12163. @end example
  12164. @item
  12165. Output specific data about the minimum and maximum values of the Y plane per frame:
  12166. @example
  12167. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12168. @end example
  12169. @item
  12170. Playback video while highlighting pixels that are outside of broadcast range in red.
  12171. @example
  12172. ffplay example.mov -vf signalstats="out=brng:color=red"
  12173. @end example
  12174. @item
  12175. Playback video with signalstats metadata drawn over the frame.
  12176. @example
  12177. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12178. @end example
  12179. The contents of signalstat_drawtext.txt used in the command are:
  12180. @example
  12181. time %@{pts:hms@}
  12182. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12183. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12184. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12185. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12186. @end example
  12187. @end itemize
  12188. @anchor{signature}
  12189. @section signature
  12190. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12191. input. In this case the matching between the inputs can be calculated additionally.
  12192. The filter always passes through the first input. The signature of each stream can
  12193. be written into a file.
  12194. It accepts the following options:
  12195. @table @option
  12196. @item detectmode
  12197. Enable or disable the matching process.
  12198. Available values are:
  12199. @table @samp
  12200. @item off
  12201. Disable the calculation of a matching (default).
  12202. @item full
  12203. Calculate the matching for the whole video and output whether the whole video
  12204. matches or only parts.
  12205. @item fast
  12206. Calculate only until a matching is found or the video ends. Should be faster in
  12207. some cases.
  12208. @end table
  12209. @item nb_inputs
  12210. Set the number of inputs. The option value must be a non negative integer.
  12211. Default value is 1.
  12212. @item filename
  12213. Set the path to which the output is written. If there is more than one input,
  12214. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12215. integer), that will be replaced with the input number. If no filename is
  12216. specified, no output will be written. This is the default.
  12217. @item format
  12218. Choose the output format.
  12219. Available values are:
  12220. @table @samp
  12221. @item binary
  12222. Use the specified binary representation (default).
  12223. @item xml
  12224. Use the specified xml representation.
  12225. @end table
  12226. @item th_d
  12227. Set threshold to detect one word as similar. The option value must be an integer
  12228. greater than zero. The default value is 9000.
  12229. @item th_dc
  12230. Set threshold to detect all words as similar. The option value must be an integer
  12231. greater than zero. The default value is 60000.
  12232. @item th_xh
  12233. Set threshold to detect frames as similar. The option value must be an integer
  12234. greater than zero. The default value is 116.
  12235. @item th_di
  12236. Set the minimum length of a sequence in frames to recognize it as matching
  12237. sequence. The option value must be a non negative integer value.
  12238. The default value is 0.
  12239. @item th_it
  12240. Set the minimum relation, that matching frames to all frames must have.
  12241. The option value must be a double value between 0 and 1. The default value is 0.5.
  12242. @end table
  12243. @subsection Examples
  12244. @itemize
  12245. @item
  12246. To calculate the signature of an input video and store it in signature.bin:
  12247. @example
  12248. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12249. @end example
  12250. @item
  12251. To detect whether two videos match and store the signatures in XML format in
  12252. signature0.xml and signature1.xml:
  12253. @example
  12254. 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 -
  12255. @end example
  12256. @end itemize
  12257. @anchor{smartblur}
  12258. @section smartblur
  12259. Blur the input video without impacting the outlines.
  12260. It accepts the following options:
  12261. @table @option
  12262. @item luma_radius, lr
  12263. Set the luma radius. The option value must be a float number in
  12264. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12265. used to blur the image (slower if larger). Default value is 1.0.
  12266. @item luma_strength, ls
  12267. Set the luma strength. The option value must be a float number
  12268. in the range [-1.0,1.0] that configures the blurring. A value included
  12269. in [0.0,1.0] will blur the image whereas a value included in
  12270. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12271. @item luma_threshold, lt
  12272. Set the luma threshold used as a coefficient to determine
  12273. whether a pixel should be blurred or not. The option value must be an
  12274. integer in the range [-30,30]. A value of 0 will filter all the image,
  12275. a value included in [0,30] will filter flat areas and a value included
  12276. in [-30,0] will filter edges. Default value is 0.
  12277. @item chroma_radius, cr
  12278. Set the chroma radius. The option value must be a float number in
  12279. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12280. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12281. @item chroma_strength, cs
  12282. Set the chroma strength. The option value must be a float number
  12283. in the range [-1.0,1.0] that configures the blurring. A value included
  12284. in [0.0,1.0] will blur the image whereas a value included in
  12285. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12286. @item chroma_threshold, ct
  12287. Set the chroma threshold used as a coefficient to determine
  12288. whether a pixel should be blurred or not. The option value must be an
  12289. integer in the range [-30,30]. A value of 0 will filter all the image,
  12290. a value included in [0,30] will filter flat areas and a value included
  12291. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12292. @end table
  12293. If a chroma option is not explicitly set, the corresponding luma value
  12294. is set.
  12295. @section ssim
  12296. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12297. This filter takes in input two input videos, the first input is
  12298. considered the "main" source and is passed unchanged to the
  12299. output. The second input is used as a "reference" video for computing
  12300. the SSIM.
  12301. Both video inputs must have the same resolution and pixel format for
  12302. this filter to work correctly. Also it assumes that both inputs
  12303. have the same number of frames, which are compared one by one.
  12304. The filter stores the calculated SSIM of each frame.
  12305. The description of the accepted parameters follows.
  12306. @table @option
  12307. @item stats_file, f
  12308. If specified the filter will use the named file to save the SSIM of
  12309. each individual frame. When filename equals "-" the data is sent to
  12310. standard output.
  12311. @end table
  12312. The file printed if @var{stats_file} is selected, contains a sequence of
  12313. key/value pairs of the form @var{key}:@var{value} for each compared
  12314. couple of frames.
  12315. A description of each shown parameter follows:
  12316. @table @option
  12317. @item n
  12318. sequential number of the input frame, starting from 1
  12319. @item Y, U, V, R, G, B
  12320. SSIM of the compared frames for the component specified by the suffix.
  12321. @item All
  12322. SSIM of the compared frames for the whole frame.
  12323. @item dB
  12324. Same as above but in dB representation.
  12325. @end table
  12326. This filter also supports the @ref{framesync} options.
  12327. For example:
  12328. @example
  12329. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12330. [main][ref] ssim="stats_file=stats.log" [out]
  12331. @end example
  12332. On this example the input file being processed is compared with the
  12333. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12334. is stored in @file{stats.log}.
  12335. Another example with both psnr and ssim at same time:
  12336. @example
  12337. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12338. @end example
  12339. @section stereo3d
  12340. Convert between different stereoscopic image formats.
  12341. The filters accept the following options:
  12342. @table @option
  12343. @item in
  12344. Set stereoscopic image format of input.
  12345. Available values for input image formats are:
  12346. @table @samp
  12347. @item sbsl
  12348. side by side parallel (left eye left, right eye right)
  12349. @item sbsr
  12350. side by side crosseye (right eye left, left eye right)
  12351. @item sbs2l
  12352. side by side parallel with half width resolution
  12353. (left eye left, right eye right)
  12354. @item sbs2r
  12355. side by side crosseye with half width resolution
  12356. (right eye left, left eye right)
  12357. @item abl
  12358. above-below (left eye above, right eye below)
  12359. @item abr
  12360. above-below (right eye above, left eye below)
  12361. @item ab2l
  12362. above-below with half height resolution
  12363. (left eye above, right eye below)
  12364. @item ab2r
  12365. above-below with half height resolution
  12366. (right eye above, left eye below)
  12367. @item al
  12368. alternating frames (left eye first, right eye second)
  12369. @item ar
  12370. alternating frames (right eye first, left eye second)
  12371. @item irl
  12372. interleaved rows (left eye has top row, right eye starts on next row)
  12373. @item irr
  12374. interleaved rows (right eye has top row, left eye starts on next row)
  12375. @item icl
  12376. interleaved columns, left eye first
  12377. @item icr
  12378. interleaved columns, right eye first
  12379. Default value is @samp{sbsl}.
  12380. @end table
  12381. @item out
  12382. Set stereoscopic image format of output.
  12383. @table @samp
  12384. @item sbsl
  12385. side by side parallel (left eye left, right eye right)
  12386. @item sbsr
  12387. side by side crosseye (right eye left, left eye right)
  12388. @item sbs2l
  12389. side by side parallel with half width resolution
  12390. (left eye left, right eye right)
  12391. @item sbs2r
  12392. side by side crosseye with half width resolution
  12393. (right eye left, left eye right)
  12394. @item abl
  12395. above-below (left eye above, right eye below)
  12396. @item abr
  12397. above-below (right eye above, left eye below)
  12398. @item ab2l
  12399. above-below with half height resolution
  12400. (left eye above, right eye below)
  12401. @item ab2r
  12402. above-below with half height resolution
  12403. (right eye above, left eye below)
  12404. @item al
  12405. alternating frames (left eye first, right eye second)
  12406. @item ar
  12407. alternating frames (right eye first, left eye second)
  12408. @item irl
  12409. interleaved rows (left eye has top row, right eye starts on next row)
  12410. @item irr
  12411. interleaved rows (right eye has top row, left eye starts on next row)
  12412. @item arbg
  12413. anaglyph red/blue gray
  12414. (red filter on left eye, blue filter on right eye)
  12415. @item argg
  12416. anaglyph red/green gray
  12417. (red filter on left eye, green filter on right eye)
  12418. @item arcg
  12419. anaglyph red/cyan gray
  12420. (red filter on left eye, cyan filter on right eye)
  12421. @item arch
  12422. anaglyph red/cyan half colored
  12423. (red filter on left eye, cyan filter on right eye)
  12424. @item arcc
  12425. anaglyph red/cyan color
  12426. (red filter on left eye, cyan filter on right eye)
  12427. @item arcd
  12428. anaglyph red/cyan color optimized with the least squares projection of dubois
  12429. (red filter on left eye, cyan filter on right eye)
  12430. @item agmg
  12431. anaglyph green/magenta gray
  12432. (green filter on left eye, magenta filter on right eye)
  12433. @item agmh
  12434. anaglyph green/magenta half colored
  12435. (green filter on left eye, magenta filter on right eye)
  12436. @item agmc
  12437. anaglyph green/magenta colored
  12438. (green filter on left eye, magenta filter on right eye)
  12439. @item agmd
  12440. anaglyph green/magenta color optimized with the least squares projection of dubois
  12441. (green filter on left eye, magenta filter on right eye)
  12442. @item aybg
  12443. anaglyph yellow/blue gray
  12444. (yellow filter on left eye, blue filter on right eye)
  12445. @item aybh
  12446. anaglyph yellow/blue half colored
  12447. (yellow filter on left eye, blue filter on right eye)
  12448. @item aybc
  12449. anaglyph yellow/blue colored
  12450. (yellow filter on left eye, blue filter on right eye)
  12451. @item aybd
  12452. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12453. (yellow filter on left eye, blue filter on right eye)
  12454. @item ml
  12455. mono output (left eye only)
  12456. @item mr
  12457. mono output (right eye only)
  12458. @item chl
  12459. checkerboard, left eye first
  12460. @item chr
  12461. checkerboard, right eye first
  12462. @item icl
  12463. interleaved columns, left eye first
  12464. @item icr
  12465. interleaved columns, right eye first
  12466. @item hdmi
  12467. HDMI frame pack
  12468. @end table
  12469. Default value is @samp{arcd}.
  12470. @end table
  12471. @subsection Examples
  12472. @itemize
  12473. @item
  12474. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12475. @example
  12476. stereo3d=sbsl:aybd
  12477. @end example
  12478. @item
  12479. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12480. @example
  12481. stereo3d=abl:sbsr
  12482. @end example
  12483. @end itemize
  12484. @section streamselect, astreamselect
  12485. Select video or audio streams.
  12486. The filter accepts the following options:
  12487. @table @option
  12488. @item inputs
  12489. Set number of inputs. Default is 2.
  12490. @item map
  12491. Set input indexes to remap to outputs.
  12492. @end table
  12493. @subsection Commands
  12494. The @code{streamselect} and @code{astreamselect} filter supports the following
  12495. commands:
  12496. @table @option
  12497. @item map
  12498. Set input indexes to remap to outputs.
  12499. @end table
  12500. @subsection Examples
  12501. @itemize
  12502. @item
  12503. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12504. @example
  12505. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12506. @end example
  12507. @item
  12508. Same as above, but for audio:
  12509. @example
  12510. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12511. @end example
  12512. @end itemize
  12513. @section sobel
  12514. Apply sobel operator to input video stream.
  12515. The filter accepts the following option:
  12516. @table @option
  12517. @item planes
  12518. Set which planes will be processed, unprocessed planes will be copied.
  12519. By default value 0xf, all planes will be processed.
  12520. @item scale
  12521. Set value which will be multiplied with filtered result.
  12522. @item delta
  12523. Set value which will be added to filtered result.
  12524. @end table
  12525. @anchor{spp}
  12526. @section spp
  12527. Apply a simple postprocessing filter that compresses and decompresses the image
  12528. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12529. and average the results.
  12530. The filter accepts the following options:
  12531. @table @option
  12532. @item quality
  12533. Set quality. This option defines the number of levels for averaging. It accepts
  12534. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12535. effect. A value of @code{6} means the higher quality. For each increment of
  12536. that value the speed drops by a factor of approximately 2. Default value is
  12537. @code{3}.
  12538. @item qp
  12539. Force a constant quantization parameter. If not set, the filter will use the QP
  12540. from the video stream (if available).
  12541. @item mode
  12542. Set thresholding mode. Available modes are:
  12543. @table @samp
  12544. @item hard
  12545. Set hard thresholding (default).
  12546. @item soft
  12547. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12548. @end table
  12549. @item use_bframe_qp
  12550. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12551. option may cause flicker since the B-Frames have often larger QP. Default is
  12552. @code{0} (not enabled).
  12553. @end table
  12554. @section sr
  12555. Scale the input by applying one of the super-resolution methods based on
  12556. convolutional neural networks. Supported models:
  12557. @itemize
  12558. @item
  12559. Super-Resolution Convolutional Neural Network model (SRCNN).
  12560. See @url{https://arxiv.org/abs/1501.00092}.
  12561. @item
  12562. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12563. See @url{https://arxiv.org/abs/1609.05158}.
  12564. @end itemize
  12565. Training scripts as well as scripts for model generation are provided in
  12566. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12567. The filter accepts the following options:
  12568. @table @option
  12569. @item dnn_backend
  12570. Specify which DNN backend to use for model loading and execution. This option accepts
  12571. the following values:
  12572. @table @samp
  12573. @item native
  12574. Native implementation of DNN loading and execution.
  12575. @item tensorflow
  12576. TensorFlow backend. To enable this backend you
  12577. need to install the TensorFlow for C library (see
  12578. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12579. @code{--enable-libtensorflow}
  12580. @end table
  12581. Default value is @samp{native}.
  12582. @item model
  12583. Set path to model file specifying network architecture and its parameters.
  12584. Note that different backends use different file formats. TensorFlow backend
  12585. can load files for both formats, while native backend can load files for only
  12586. its format.
  12587. @item scale_factor
  12588. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12589. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12590. input upscaled using bicubic upscaling with proper scale factor.
  12591. @end table
  12592. @anchor{subtitles}
  12593. @section subtitles
  12594. Draw subtitles on top of input video using the libass library.
  12595. To enable compilation of this filter you need to configure FFmpeg with
  12596. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12597. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12598. Alpha) subtitles format.
  12599. The filter accepts the following options:
  12600. @table @option
  12601. @item filename, f
  12602. Set the filename of the subtitle file to read. It must be specified.
  12603. @item original_size
  12604. Specify the size of the original video, the video for which the ASS file
  12605. was composed. For the syntax of this option, check the
  12606. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12607. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12608. correctly scale the fonts if the aspect ratio has been changed.
  12609. @item fontsdir
  12610. Set a directory path containing fonts that can be used by the filter.
  12611. These fonts will be used in addition to whatever the font provider uses.
  12612. @item alpha
  12613. Process alpha channel, by default alpha channel is untouched.
  12614. @item charenc
  12615. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12616. useful if not UTF-8.
  12617. @item stream_index, si
  12618. Set subtitles stream index. @code{subtitles} filter only.
  12619. @item force_style
  12620. Override default style or script info parameters of the subtitles. It accepts a
  12621. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12622. @end table
  12623. If the first key is not specified, it is assumed that the first value
  12624. specifies the @option{filename}.
  12625. For example, to render the file @file{sub.srt} on top of the input
  12626. video, use the command:
  12627. @example
  12628. subtitles=sub.srt
  12629. @end example
  12630. which is equivalent to:
  12631. @example
  12632. subtitles=filename=sub.srt
  12633. @end example
  12634. To render the default subtitles stream from file @file{video.mkv}, use:
  12635. @example
  12636. subtitles=video.mkv
  12637. @end example
  12638. To render the second subtitles stream from that file, use:
  12639. @example
  12640. subtitles=video.mkv:si=1
  12641. @end example
  12642. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12643. @code{DejaVu Serif}, use:
  12644. @example
  12645. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12646. @end example
  12647. @section super2xsai
  12648. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12649. Interpolate) pixel art scaling algorithm.
  12650. Useful for enlarging pixel art images without reducing sharpness.
  12651. @section swaprect
  12652. Swap two rectangular objects in video.
  12653. This filter accepts the following options:
  12654. @table @option
  12655. @item w
  12656. Set object width.
  12657. @item h
  12658. Set object height.
  12659. @item x1
  12660. Set 1st rect x coordinate.
  12661. @item y1
  12662. Set 1st rect y coordinate.
  12663. @item x2
  12664. Set 2nd rect x coordinate.
  12665. @item y2
  12666. Set 2nd rect y coordinate.
  12667. All expressions are evaluated once for each frame.
  12668. @end table
  12669. The all options are expressions containing the following constants:
  12670. @table @option
  12671. @item w
  12672. @item h
  12673. The input width and height.
  12674. @item a
  12675. same as @var{w} / @var{h}
  12676. @item sar
  12677. input sample aspect ratio
  12678. @item dar
  12679. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12680. @item n
  12681. The number of the input frame, starting from 0.
  12682. @item t
  12683. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12684. @item pos
  12685. the position in the file of the input frame, NAN if unknown
  12686. @end table
  12687. @section swapuv
  12688. Swap U & V plane.
  12689. @section telecine
  12690. Apply telecine process to the video.
  12691. This filter accepts the following options:
  12692. @table @option
  12693. @item first_field
  12694. @table @samp
  12695. @item top, t
  12696. top field first
  12697. @item bottom, b
  12698. bottom field first
  12699. The default value is @code{top}.
  12700. @end table
  12701. @item pattern
  12702. A string of numbers representing the pulldown pattern you wish to apply.
  12703. The default value is @code{23}.
  12704. @end table
  12705. @example
  12706. Some typical patterns:
  12707. NTSC output (30i):
  12708. 27.5p: 32222
  12709. 24p: 23 (classic)
  12710. 24p: 2332 (preferred)
  12711. 20p: 33
  12712. 18p: 334
  12713. 16p: 3444
  12714. PAL output (25i):
  12715. 27.5p: 12222
  12716. 24p: 222222222223 ("Euro pulldown")
  12717. 16.67p: 33
  12718. 16p: 33333334
  12719. @end example
  12720. @section threshold
  12721. Apply threshold effect to video stream.
  12722. This filter needs four video streams to perform thresholding.
  12723. First stream is stream we are filtering.
  12724. Second stream is holding threshold values, third stream is holding min values,
  12725. and last, fourth stream is holding max values.
  12726. The filter accepts the following option:
  12727. @table @option
  12728. @item planes
  12729. Set which planes will be processed, unprocessed planes will be copied.
  12730. By default value 0xf, all planes will be processed.
  12731. @end table
  12732. For example if first stream pixel's component value is less then threshold value
  12733. of pixel component from 2nd threshold stream, third stream value will picked,
  12734. otherwise fourth stream pixel component value will be picked.
  12735. Using color source filter one can perform various types of thresholding:
  12736. @subsection Examples
  12737. @itemize
  12738. @item
  12739. Binary threshold, using gray color as threshold:
  12740. @example
  12741. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12742. @end example
  12743. @item
  12744. Inverted binary threshold, using gray color as threshold:
  12745. @example
  12746. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12747. @end example
  12748. @item
  12749. Truncate binary threshold, using gray color as threshold:
  12750. @example
  12751. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12752. @end example
  12753. @item
  12754. Threshold to zero, using gray color as threshold:
  12755. @example
  12756. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12757. @end example
  12758. @item
  12759. Inverted threshold to zero, using gray color as threshold:
  12760. @example
  12761. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12762. @end example
  12763. @end itemize
  12764. @section thumbnail
  12765. Select the most representative frame in a given sequence of consecutive frames.
  12766. The filter accepts the following options:
  12767. @table @option
  12768. @item n
  12769. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12770. will pick one of them, and then handle the next batch of @var{n} frames until
  12771. the end. Default is @code{100}.
  12772. @end table
  12773. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12774. value will result in a higher memory usage, so a high value is not recommended.
  12775. @subsection Examples
  12776. @itemize
  12777. @item
  12778. Extract one picture each 50 frames:
  12779. @example
  12780. thumbnail=50
  12781. @end example
  12782. @item
  12783. Complete example of a thumbnail creation with @command{ffmpeg}:
  12784. @example
  12785. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12786. @end example
  12787. @end itemize
  12788. @section tile
  12789. Tile several successive frames together.
  12790. The filter accepts the following options:
  12791. @table @option
  12792. @item layout
  12793. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12794. this option, check the
  12795. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12796. @item nb_frames
  12797. Set the maximum number of frames to render in the given area. It must be less
  12798. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12799. the area will be used.
  12800. @item margin
  12801. Set the outer border margin in pixels.
  12802. @item padding
  12803. Set the inner border thickness (i.e. the number of pixels between frames). For
  12804. more advanced padding options (such as having different values for the edges),
  12805. refer to the pad video filter.
  12806. @item color
  12807. Specify the color of the unused area. For the syntax of this option, check the
  12808. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12809. The default value of @var{color} is "black".
  12810. @item overlap
  12811. Set the number of frames to overlap when tiling several successive frames together.
  12812. The value must be between @code{0} and @var{nb_frames - 1}.
  12813. @item init_padding
  12814. Set the number of frames to initially be empty before displaying first output frame.
  12815. This controls how soon will one get first output frame.
  12816. The value must be between @code{0} and @var{nb_frames - 1}.
  12817. @end table
  12818. @subsection Examples
  12819. @itemize
  12820. @item
  12821. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12822. @example
  12823. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12824. @end example
  12825. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12826. duplicating each output frame to accommodate the originally detected frame
  12827. rate.
  12828. @item
  12829. Display @code{5} pictures in an area of @code{3x2} frames,
  12830. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12831. mixed flat and named options:
  12832. @example
  12833. tile=3x2:nb_frames=5:padding=7:margin=2
  12834. @end example
  12835. @end itemize
  12836. @section tinterlace
  12837. Perform various types of temporal field interlacing.
  12838. Frames are counted starting from 1, so the first input frame is
  12839. considered odd.
  12840. The filter accepts the following options:
  12841. @table @option
  12842. @item mode
  12843. Specify the mode of the interlacing. This option can also be specified
  12844. as a value alone. See below for a list of values for this option.
  12845. Available values are:
  12846. @table @samp
  12847. @item merge, 0
  12848. Move odd frames into the upper field, even into the lower field,
  12849. generating a double height frame at half frame rate.
  12850. @example
  12851. ------> time
  12852. Input:
  12853. Frame 1 Frame 2 Frame 3 Frame 4
  12854. 11111 22222 33333 44444
  12855. 11111 22222 33333 44444
  12856. 11111 22222 33333 44444
  12857. 11111 22222 33333 44444
  12858. Output:
  12859. 11111 33333
  12860. 22222 44444
  12861. 11111 33333
  12862. 22222 44444
  12863. 11111 33333
  12864. 22222 44444
  12865. 11111 33333
  12866. 22222 44444
  12867. @end example
  12868. @item drop_even, 1
  12869. Only output odd frames, even frames are dropped, generating a frame with
  12870. unchanged height at half frame rate.
  12871. @example
  12872. ------> time
  12873. Input:
  12874. Frame 1 Frame 2 Frame 3 Frame 4
  12875. 11111 22222 33333 44444
  12876. 11111 22222 33333 44444
  12877. 11111 22222 33333 44444
  12878. 11111 22222 33333 44444
  12879. Output:
  12880. 11111 33333
  12881. 11111 33333
  12882. 11111 33333
  12883. 11111 33333
  12884. @end example
  12885. @item drop_odd, 2
  12886. Only output even frames, odd frames are dropped, generating a frame with
  12887. unchanged height at half frame rate.
  12888. @example
  12889. ------> time
  12890. Input:
  12891. Frame 1 Frame 2 Frame 3 Frame 4
  12892. 11111 22222 33333 44444
  12893. 11111 22222 33333 44444
  12894. 11111 22222 33333 44444
  12895. 11111 22222 33333 44444
  12896. Output:
  12897. 22222 44444
  12898. 22222 44444
  12899. 22222 44444
  12900. 22222 44444
  12901. @end example
  12902. @item pad, 3
  12903. Expand each frame to full height, but pad alternate lines with black,
  12904. generating a frame with double height at the same input frame rate.
  12905. @example
  12906. ------> time
  12907. Input:
  12908. Frame 1 Frame 2 Frame 3 Frame 4
  12909. 11111 22222 33333 44444
  12910. 11111 22222 33333 44444
  12911. 11111 22222 33333 44444
  12912. 11111 22222 33333 44444
  12913. Output:
  12914. 11111 ..... 33333 .....
  12915. ..... 22222 ..... 44444
  12916. 11111 ..... 33333 .....
  12917. ..... 22222 ..... 44444
  12918. 11111 ..... 33333 .....
  12919. ..... 22222 ..... 44444
  12920. 11111 ..... 33333 .....
  12921. ..... 22222 ..... 44444
  12922. @end example
  12923. @item interleave_top, 4
  12924. Interleave the upper field from odd frames with the lower field from
  12925. even frames, generating a frame with unchanged height at half frame rate.
  12926. @example
  12927. ------> time
  12928. Input:
  12929. Frame 1 Frame 2 Frame 3 Frame 4
  12930. 11111<- 22222 33333<- 44444
  12931. 11111 22222<- 33333 44444<-
  12932. 11111<- 22222 33333<- 44444
  12933. 11111 22222<- 33333 44444<-
  12934. Output:
  12935. 11111 33333
  12936. 22222 44444
  12937. 11111 33333
  12938. 22222 44444
  12939. @end example
  12940. @item interleave_bottom, 5
  12941. Interleave the lower field from odd frames with the upper field from
  12942. even frames, generating a frame with unchanged height at half frame rate.
  12943. @example
  12944. ------> time
  12945. Input:
  12946. Frame 1 Frame 2 Frame 3 Frame 4
  12947. 11111 22222<- 33333 44444<-
  12948. 11111<- 22222 33333<- 44444
  12949. 11111 22222<- 33333 44444<-
  12950. 11111<- 22222 33333<- 44444
  12951. Output:
  12952. 22222 44444
  12953. 11111 33333
  12954. 22222 44444
  12955. 11111 33333
  12956. @end example
  12957. @item interlacex2, 6
  12958. Double frame rate with unchanged height. Frames are inserted each
  12959. containing the second temporal field from the previous input frame and
  12960. the first temporal field from the next input frame. This mode relies on
  12961. the top_field_first flag. Useful for interlaced video displays with no
  12962. field synchronisation.
  12963. @example
  12964. ------> time
  12965. Input:
  12966. Frame 1 Frame 2 Frame 3 Frame 4
  12967. 11111 22222 33333 44444
  12968. 11111 22222 33333 44444
  12969. 11111 22222 33333 44444
  12970. 11111 22222 33333 44444
  12971. Output:
  12972. 11111 22222 22222 33333 33333 44444 44444
  12973. 11111 11111 22222 22222 33333 33333 44444
  12974. 11111 22222 22222 33333 33333 44444 44444
  12975. 11111 11111 22222 22222 33333 33333 44444
  12976. @end example
  12977. @item mergex2, 7
  12978. Move odd frames into the upper field, even into the lower field,
  12979. generating a double height frame at same frame rate.
  12980. @example
  12981. ------> time
  12982. Input:
  12983. Frame 1 Frame 2 Frame 3 Frame 4
  12984. 11111 22222 33333 44444
  12985. 11111 22222 33333 44444
  12986. 11111 22222 33333 44444
  12987. 11111 22222 33333 44444
  12988. Output:
  12989. 11111 33333 33333 55555
  12990. 22222 22222 44444 44444
  12991. 11111 33333 33333 55555
  12992. 22222 22222 44444 44444
  12993. 11111 33333 33333 55555
  12994. 22222 22222 44444 44444
  12995. 11111 33333 33333 55555
  12996. 22222 22222 44444 44444
  12997. @end example
  12998. @end table
  12999. Numeric values are deprecated but are accepted for backward
  13000. compatibility reasons.
  13001. Default mode is @code{merge}.
  13002. @item flags
  13003. Specify flags influencing the filter process.
  13004. Available value for @var{flags} is:
  13005. @table @option
  13006. @item low_pass_filter, vlfp
  13007. Enable linear vertical low-pass filtering in the filter.
  13008. Vertical low-pass filtering is required when creating an interlaced
  13009. destination from a progressive source which contains high-frequency
  13010. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13011. patterning.
  13012. @item complex_filter, cvlfp
  13013. Enable complex vertical low-pass filtering.
  13014. This will slightly less reduce interlace 'twitter' and Moire
  13015. patterning but better retain detail and subjective sharpness impression.
  13016. @end table
  13017. Vertical low-pass filtering can only be enabled for @option{mode}
  13018. @var{interleave_top} and @var{interleave_bottom}.
  13019. @end table
  13020. @section tmix
  13021. Mix successive video frames.
  13022. A description of the accepted options follows.
  13023. @table @option
  13024. @item frames
  13025. The number of successive frames to mix. If unspecified, it defaults to 3.
  13026. @item weights
  13027. Specify weight of each input video frame.
  13028. Each weight is separated by space. If number of weights is smaller than
  13029. number of @var{frames} last specified weight will be used for all remaining
  13030. unset weights.
  13031. @item scale
  13032. Specify scale, if it is set it will be multiplied with sum
  13033. of each weight multiplied with pixel values to give final destination
  13034. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13035. @end table
  13036. @subsection Examples
  13037. @itemize
  13038. @item
  13039. Average 7 successive frames:
  13040. @example
  13041. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13042. @end example
  13043. @item
  13044. Apply simple temporal convolution:
  13045. @example
  13046. tmix=frames=3:weights="-1 3 -1"
  13047. @end example
  13048. @item
  13049. Similar as above but only showing temporal differences:
  13050. @example
  13051. tmix=frames=3:weights="-1 2 -1":scale=1
  13052. @end example
  13053. @end itemize
  13054. @anchor{tonemap}
  13055. @section tonemap
  13056. Tone map colors from different dynamic ranges.
  13057. This filter expects data in single precision floating point, as it needs to
  13058. operate on (and can output) out-of-range values. Another filter, such as
  13059. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13060. The tonemapping algorithms implemented only work on linear light, so input
  13061. data should be linearized beforehand (and possibly correctly tagged).
  13062. @example
  13063. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13064. @end example
  13065. @subsection Options
  13066. The filter accepts the following options.
  13067. @table @option
  13068. @item tonemap
  13069. Set the tone map algorithm to use.
  13070. Possible values are:
  13071. @table @var
  13072. @item none
  13073. Do not apply any tone map, only desaturate overbright pixels.
  13074. @item clip
  13075. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13076. in-range values, while distorting out-of-range values.
  13077. @item linear
  13078. Stretch the entire reference gamut to a linear multiple of the display.
  13079. @item gamma
  13080. Fit a logarithmic transfer between the tone curves.
  13081. @item reinhard
  13082. Preserve overall image brightness with a simple curve, using nonlinear
  13083. contrast, which results in flattening details and degrading color accuracy.
  13084. @item hable
  13085. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13086. of slightly darkening everything. Use it when detail preservation is more
  13087. important than color and brightness accuracy.
  13088. @item mobius
  13089. Smoothly map out-of-range values, while retaining contrast and colors for
  13090. in-range material as much as possible. Use it when color accuracy is more
  13091. important than detail preservation.
  13092. @end table
  13093. Default is none.
  13094. @item param
  13095. Tune the tone mapping algorithm.
  13096. This affects the following algorithms:
  13097. @table @var
  13098. @item none
  13099. Ignored.
  13100. @item linear
  13101. Specifies the scale factor to use while stretching.
  13102. Default to 1.0.
  13103. @item gamma
  13104. Specifies the exponent of the function.
  13105. Default to 1.8.
  13106. @item clip
  13107. Specify an extra linear coefficient to multiply into the signal before clipping.
  13108. Default to 1.0.
  13109. @item reinhard
  13110. Specify the local contrast coefficient at the display peak.
  13111. Default to 0.5, which means that in-gamut values will be about half as bright
  13112. as when clipping.
  13113. @item hable
  13114. Ignored.
  13115. @item mobius
  13116. Specify the transition point from linear to mobius transform. Every value
  13117. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13118. more accurate the result will be, at the cost of losing bright details.
  13119. Default to 0.3, which due to the steep initial slope still preserves in-range
  13120. colors fairly accurately.
  13121. @end table
  13122. @item desat
  13123. Apply desaturation for highlights that exceed this level of brightness. The
  13124. higher the parameter, the more color information will be preserved. This
  13125. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13126. (smoothly) turning into white instead. This makes images feel more natural,
  13127. at the cost of reducing information about out-of-range colors.
  13128. The default of 2.0 is somewhat conservative and will mostly just apply to
  13129. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13130. This option works only if the input frame has a supported color tag.
  13131. @item peak
  13132. Override signal/nominal/reference peak with this value. Useful when the
  13133. embedded peak information in display metadata is not reliable or when tone
  13134. mapping from a lower range to a higher range.
  13135. @end table
  13136. @section tpad
  13137. Temporarily pad video frames.
  13138. The filter accepts the following options:
  13139. @table @option
  13140. @item start
  13141. Specify number of delay frames before input video stream.
  13142. @item stop
  13143. Specify number of padding frames after input video stream.
  13144. Set to -1 to pad indefinitely.
  13145. @item start_mode
  13146. Set kind of frames added to beginning of stream.
  13147. Can be either @var{add} or @var{clone}.
  13148. With @var{add} frames of solid-color are added.
  13149. With @var{clone} frames are clones of first frame.
  13150. @item stop_mode
  13151. Set kind of frames added to end of stream.
  13152. Can be either @var{add} or @var{clone}.
  13153. With @var{add} frames of solid-color are added.
  13154. With @var{clone} frames are clones of last frame.
  13155. @item start_duration, stop_duration
  13156. Specify the duration of the start/stop delay. See
  13157. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13158. for the accepted syntax.
  13159. These options override @var{start} and @var{stop}.
  13160. @item color
  13161. Specify the color of the padded area. For the syntax of this option,
  13162. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13163. manual,ffmpeg-utils}.
  13164. The default value of @var{color} is "black".
  13165. @end table
  13166. @anchor{transpose}
  13167. @section transpose
  13168. Transpose rows with columns in the input video and optionally flip it.
  13169. It accepts the following parameters:
  13170. @table @option
  13171. @item dir
  13172. Specify the transposition direction.
  13173. Can assume the following values:
  13174. @table @samp
  13175. @item 0, 4, cclock_flip
  13176. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13177. @example
  13178. L.R L.l
  13179. . . -> . .
  13180. l.r R.r
  13181. @end example
  13182. @item 1, 5, clock
  13183. Rotate by 90 degrees clockwise, that is:
  13184. @example
  13185. L.R l.L
  13186. . . -> . .
  13187. l.r r.R
  13188. @end example
  13189. @item 2, 6, cclock
  13190. Rotate by 90 degrees counterclockwise, that is:
  13191. @example
  13192. L.R R.r
  13193. . . -> . .
  13194. l.r L.l
  13195. @end example
  13196. @item 3, 7, clock_flip
  13197. Rotate by 90 degrees clockwise and vertically flip, that is:
  13198. @example
  13199. L.R r.R
  13200. . . -> . .
  13201. l.r l.L
  13202. @end example
  13203. @end table
  13204. For values between 4-7, the transposition is only done if the input
  13205. video geometry is portrait and not landscape. These values are
  13206. deprecated, the @code{passthrough} option should be used instead.
  13207. Numerical values are deprecated, and should be dropped in favor of
  13208. symbolic constants.
  13209. @item passthrough
  13210. Do not apply the transposition if the input geometry matches the one
  13211. specified by the specified value. It accepts the following values:
  13212. @table @samp
  13213. @item none
  13214. Always apply transposition.
  13215. @item portrait
  13216. Preserve portrait geometry (when @var{height} >= @var{width}).
  13217. @item landscape
  13218. Preserve landscape geometry (when @var{width} >= @var{height}).
  13219. @end table
  13220. Default value is @code{none}.
  13221. @end table
  13222. For example to rotate by 90 degrees clockwise and preserve portrait
  13223. layout:
  13224. @example
  13225. transpose=dir=1:passthrough=portrait
  13226. @end example
  13227. The command above can also be specified as:
  13228. @example
  13229. transpose=1:portrait
  13230. @end example
  13231. @section transpose_npp
  13232. Transpose rows with columns in the input video and optionally flip it.
  13233. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13234. It accepts the following parameters:
  13235. @table @option
  13236. @item dir
  13237. Specify the transposition direction.
  13238. Can assume the following values:
  13239. @table @samp
  13240. @item cclock_flip
  13241. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13242. @item clock
  13243. Rotate by 90 degrees clockwise.
  13244. @item cclock
  13245. Rotate by 90 degrees counterclockwise.
  13246. @item clock_flip
  13247. Rotate by 90 degrees clockwise and vertically flip.
  13248. @end table
  13249. @item passthrough
  13250. Do not apply the transposition if the input geometry matches the one
  13251. specified by the specified value. It accepts the following values:
  13252. @table @samp
  13253. @item none
  13254. Always apply transposition. (default)
  13255. @item portrait
  13256. Preserve portrait geometry (when @var{height} >= @var{width}).
  13257. @item landscape
  13258. Preserve landscape geometry (when @var{width} >= @var{height}).
  13259. @end table
  13260. @end table
  13261. @section trim
  13262. Trim the input so that the output contains one continuous subpart of the input.
  13263. It accepts the following parameters:
  13264. @table @option
  13265. @item start
  13266. Specify the time of the start of the kept section, i.e. the frame with the
  13267. timestamp @var{start} will be the first frame in the output.
  13268. @item end
  13269. Specify the time of the first frame that will be dropped, i.e. the frame
  13270. immediately preceding the one with the timestamp @var{end} will be the last
  13271. frame in the output.
  13272. @item start_pts
  13273. This is the same as @var{start}, except this option sets the start timestamp
  13274. in timebase units instead of seconds.
  13275. @item end_pts
  13276. This is the same as @var{end}, except this option sets the end timestamp
  13277. in timebase units instead of seconds.
  13278. @item duration
  13279. The maximum duration of the output in seconds.
  13280. @item start_frame
  13281. The number of the first frame that should be passed to the output.
  13282. @item end_frame
  13283. The number of the first frame that should be dropped.
  13284. @end table
  13285. @option{start}, @option{end}, and @option{duration} are expressed as time
  13286. duration specifications; see
  13287. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13288. for the accepted syntax.
  13289. Note that the first two sets of the start/end options and the @option{duration}
  13290. option look at the frame timestamp, while the _frame variants simply count the
  13291. frames that pass through the filter. Also note that this filter does not modify
  13292. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13293. setpts filter after the trim filter.
  13294. If multiple start or end options are set, this filter tries to be greedy and
  13295. keep all the frames that match at least one of the specified constraints. To keep
  13296. only the part that matches all the constraints at once, chain multiple trim
  13297. filters.
  13298. The defaults are such that all the input is kept. So it is possible to set e.g.
  13299. just the end values to keep everything before the specified time.
  13300. Examples:
  13301. @itemize
  13302. @item
  13303. Drop everything except the second minute of input:
  13304. @example
  13305. ffmpeg -i INPUT -vf trim=60:120
  13306. @end example
  13307. @item
  13308. Keep only the first second:
  13309. @example
  13310. ffmpeg -i INPUT -vf trim=duration=1
  13311. @end example
  13312. @end itemize
  13313. @section unpremultiply
  13314. Apply alpha unpremultiply effect to input video stream using first plane
  13315. of second stream as alpha.
  13316. Both streams must have same dimensions and same pixel format.
  13317. The filter accepts the following option:
  13318. @table @option
  13319. @item planes
  13320. Set which planes will be processed, unprocessed planes will be copied.
  13321. By default value 0xf, all planes will be processed.
  13322. If the format has 1 or 2 components, then luma is bit 0.
  13323. If the format has 3 or 4 components:
  13324. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13325. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13326. If present, the alpha channel is always the last bit.
  13327. @item inplace
  13328. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13329. @end table
  13330. @anchor{unsharp}
  13331. @section unsharp
  13332. Sharpen or blur the input video.
  13333. It accepts the following parameters:
  13334. @table @option
  13335. @item luma_msize_x, lx
  13336. Set the luma matrix horizontal size. It must be an odd integer between
  13337. 3 and 23. The default value is 5.
  13338. @item luma_msize_y, ly
  13339. Set the luma matrix vertical size. It must be an odd integer between 3
  13340. and 23. The default value is 5.
  13341. @item luma_amount, la
  13342. Set the luma effect strength. It must be a floating point number, reasonable
  13343. values lay between -1.5 and 1.5.
  13344. Negative values will blur the input video, while positive values will
  13345. sharpen it, a value of zero will disable the effect.
  13346. Default value is 1.0.
  13347. @item chroma_msize_x, cx
  13348. Set the chroma matrix horizontal size. It must be an odd integer
  13349. between 3 and 23. The default value is 5.
  13350. @item chroma_msize_y, cy
  13351. Set the chroma matrix vertical size. It must be an odd integer
  13352. between 3 and 23. The default value is 5.
  13353. @item chroma_amount, ca
  13354. Set the chroma effect strength. It must be a floating point number, reasonable
  13355. values lay between -1.5 and 1.5.
  13356. Negative values will blur the input video, while positive values will
  13357. sharpen it, a value of zero will disable the effect.
  13358. Default value is 0.0.
  13359. @end table
  13360. All parameters are optional and default to the equivalent of the
  13361. string '5:5:1.0:5:5:0.0'.
  13362. @subsection Examples
  13363. @itemize
  13364. @item
  13365. Apply strong luma sharpen effect:
  13366. @example
  13367. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13368. @end example
  13369. @item
  13370. Apply a strong blur of both luma and chroma parameters:
  13371. @example
  13372. unsharp=7:7:-2:7:7:-2
  13373. @end example
  13374. @end itemize
  13375. @section uspp
  13376. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13377. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13378. shifts and average the results.
  13379. The way this differs from the behavior of spp is that uspp actually encodes &
  13380. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13381. DCT similar to MJPEG.
  13382. The filter accepts the following options:
  13383. @table @option
  13384. @item quality
  13385. Set quality. This option defines the number of levels for averaging. It accepts
  13386. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13387. effect. A value of @code{8} means the higher quality. For each increment of
  13388. that value the speed drops by a factor of approximately 2. Default value is
  13389. @code{3}.
  13390. @item qp
  13391. Force a constant quantization parameter. If not set, the filter will use the QP
  13392. from the video stream (if available).
  13393. @end table
  13394. @section vaguedenoiser
  13395. Apply a wavelet based denoiser.
  13396. It transforms each frame from the video input into the wavelet domain,
  13397. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13398. the obtained coefficients. It does an inverse wavelet transform after.
  13399. Due to wavelet properties, it should give a nice smoothed result, and
  13400. reduced noise, without blurring picture features.
  13401. This filter accepts the following options:
  13402. @table @option
  13403. @item threshold
  13404. The filtering strength. The higher, the more filtered the video will be.
  13405. Hard thresholding can use a higher threshold than soft thresholding
  13406. before the video looks overfiltered. Default value is 2.
  13407. @item method
  13408. The filtering method the filter will use.
  13409. It accepts the following values:
  13410. @table @samp
  13411. @item hard
  13412. All values under the threshold will be zeroed.
  13413. @item soft
  13414. All values under the threshold will be zeroed. All values above will be
  13415. reduced by the threshold.
  13416. @item garrote
  13417. Scales or nullifies coefficients - intermediary between (more) soft and
  13418. (less) hard thresholding.
  13419. @end table
  13420. Default is garrote.
  13421. @item nsteps
  13422. Number of times, the wavelet will decompose the picture. Picture can't
  13423. be decomposed beyond a particular point (typically, 8 for a 640x480
  13424. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13425. @item percent
  13426. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13427. @item planes
  13428. A list of the planes to process. By default all planes are processed.
  13429. @end table
  13430. @section vectorscope
  13431. Display 2 color component values in the two dimensional graph (which is called
  13432. a vectorscope).
  13433. This filter accepts the following options:
  13434. @table @option
  13435. @item mode, m
  13436. Set vectorscope mode.
  13437. It accepts the following values:
  13438. @table @samp
  13439. @item gray
  13440. Gray values are displayed on graph, higher brightness means more pixels have
  13441. same component color value on location in graph. This is the default mode.
  13442. @item color
  13443. Gray values are displayed on graph. Surrounding pixels values which are not
  13444. present in video frame are drawn in gradient of 2 color components which are
  13445. set by option @code{x} and @code{y}. The 3rd color component is static.
  13446. @item color2
  13447. Actual color components values present in video frame are displayed on graph.
  13448. @item color3
  13449. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13450. on graph increases value of another color component, which is luminance by
  13451. default values of @code{x} and @code{y}.
  13452. @item color4
  13453. Actual colors present in video frame are displayed on graph. If two different
  13454. colors map to same position on graph then color with higher value of component
  13455. not present in graph is picked.
  13456. @item color5
  13457. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13458. component picked from radial gradient.
  13459. @end table
  13460. @item x
  13461. Set which color component will be represented on X-axis. Default is @code{1}.
  13462. @item y
  13463. Set which color component will be represented on Y-axis. Default is @code{2}.
  13464. @item intensity, i
  13465. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13466. of color component which represents frequency of (X, Y) location in graph.
  13467. @item envelope, e
  13468. @table @samp
  13469. @item none
  13470. No envelope, this is default.
  13471. @item instant
  13472. Instant envelope, even darkest single pixel will be clearly highlighted.
  13473. @item peak
  13474. Hold maximum and minimum values presented in graph over time. This way you
  13475. can still spot out of range values without constantly looking at vectorscope.
  13476. @item peak+instant
  13477. Peak and instant envelope combined together.
  13478. @end table
  13479. @item graticule, g
  13480. Set what kind of graticule to draw.
  13481. @table @samp
  13482. @item none
  13483. @item green
  13484. @item color
  13485. @end table
  13486. @item opacity, o
  13487. Set graticule opacity.
  13488. @item flags, f
  13489. Set graticule flags.
  13490. @table @samp
  13491. @item white
  13492. Draw graticule for white point.
  13493. @item black
  13494. Draw graticule for black point.
  13495. @item name
  13496. Draw color points short names.
  13497. @end table
  13498. @item bgopacity, b
  13499. Set background opacity.
  13500. @item lthreshold, l
  13501. Set low threshold for color component not represented on X or Y axis.
  13502. Values lower than this value will be ignored. Default is 0.
  13503. Note this value is multiplied with actual max possible value one pixel component
  13504. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13505. is 0.1 * 255 = 25.
  13506. @item hthreshold, h
  13507. Set high threshold for color component not represented on X or Y axis.
  13508. Values higher than this value will be ignored. Default is 1.
  13509. Note this value is multiplied with actual max possible value one pixel component
  13510. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13511. is 0.9 * 255 = 230.
  13512. @item colorspace, c
  13513. Set what kind of colorspace to use when drawing graticule.
  13514. @table @samp
  13515. @item auto
  13516. @item 601
  13517. @item 709
  13518. @end table
  13519. Default is auto.
  13520. @end table
  13521. @anchor{vidstabdetect}
  13522. @section vidstabdetect
  13523. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13524. @ref{vidstabtransform} for pass 2.
  13525. This filter generates a file with relative translation and rotation
  13526. transform information about subsequent frames, which is then used by
  13527. the @ref{vidstabtransform} filter.
  13528. To enable compilation of this filter you need to configure FFmpeg with
  13529. @code{--enable-libvidstab}.
  13530. This filter accepts the following options:
  13531. @table @option
  13532. @item result
  13533. Set the path to the file used to write the transforms information.
  13534. Default value is @file{transforms.trf}.
  13535. @item shakiness
  13536. Set how shaky the video is and how quick the camera is. It accepts an
  13537. integer in the range 1-10, a value of 1 means little shakiness, a
  13538. value of 10 means strong shakiness. Default value is 5.
  13539. @item accuracy
  13540. Set the accuracy of the detection process. It must be a value in the
  13541. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13542. accuracy. Default value is 15.
  13543. @item stepsize
  13544. Set stepsize of the search process. The region around minimum is
  13545. scanned with 1 pixel resolution. Default value is 6.
  13546. @item mincontrast
  13547. Set minimum contrast. Below this value a local measurement field is
  13548. discarded. Must be a floating point value in the range 0-1. Default
  13549. value is 0.3.
  13550. @item tripod
  13551. Set reference frame number for tripod mode.
  13552. If enabled, the motion of the frames is compared to a reference frame
  13553. in the filtered stream, identified by the specified number. The idea
  13554. is to compensate all movements in a more-or-less static scene and keep
  13555. the camera view absolutely still.
  13556. If set to 0, it is disabled. The frames are counted starting from 1.
  13557. @item show
  13558. Show fields and transforms in the resulting frames. It accepts an
  13559. integer in the range 0-2. Default value is 0, which disables any
  13560. visualization.
  13561. @end table
  13562. @subsection Examples
  13563. @itemize
  13564. @item
  13565. Use default values:
  13566. @example
  13567. vidstabdetect
  13568. @end example
  13569. @item
  13570. Analyze strongly shaky movie and put the results in file
  13571. @file{mytransforms.trf}:
  13572. @example
  13573. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13574. @end example
  13575. @item
  13576. Visualize the result of internal transformations in the resulting
  13577. video:
  13578. @example
  13579. vidstabdetect=show=1
  13580. @end example
  13581. @item
  13582. Analyze a video with medium shakiness using @command{ffmpeg}:
  13583. @example
  13584. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13585. @end example
  13586. @end itemize
  13587. @anchor{vidstabtransform}
  13588. @section vidstabtransform
  13589. Video stabilization/deshaking: pass 2 of 2,
  13590. see @ref{vidstabdetect} for pass 1.
  13591. Read a file with transform information for each frame and
  13592. apply/compensate them. Together with the @ref{vidstabdetect}
  13593. filter this can be used to deshake videos. See also
  13594. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13595. the @ref{unsharp} filter, see below.
  13596. To enable compilation of this filter you need to configure FFmpeg with
  13597. @code{--enable-libvidstab}.
  13598. @subsection Options
  13599. @table @option
  13600. @item input
  13601. Set path to the file used to read the transforms. Default value is
  13602. @file{transforms.trf}.
  13603. @item smoothing
  13604. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13605. camera movements. Default value is 10.
  13606. For example a number of 10 means that 21 frames are used (10 in the
  13607. past and 10 in the future) to smoothen the motion in the video. A
  13608. larger value leads to a smoother video, but limits the acceleration of
  13609. the camera (pan/tilt movements). 0 is a special case where a static
  13610. camera is simulated.
  13611. @item optalgo
  13612. Set the camera path optimization algorithm.
  13613. Accepted values are:
  13614. @table @samp
  13615. @item gauss
  13616. gaussian kernel low-pass filter on camera motion (default)
  13617. @item avg
  13618. averaging on transformations
  13619. @end table
  13620. @item maxshift
  13621. Set maximal number of pixels to translate frames. Default value is -1,
  13622. meaning no limit.
  13623. @item maxangle
  13624. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13625. value is -1, meaning no limit.
  13626. @item crop
  13627. Specify how to deal with borders that may be visible due to movement
  13628. compensation.
  13629. Available values are:
  13630. @table @samp
  13631. @item keep
  13632. keep image information from previous frame (default)
  13633. @item black
  13634. fill the border black
  13635. @end table
  13636. @item invert
  13637. Invert transforms if set to 1. Default value is 0.
  13638. @item relative
  13639. Consider transforms as relative to previous frame if set to 1,
  13640. absolute if set to 0. Default value is 0.
  13641. @item zoom
  13642. Set percentage to zoom. A positive value will result in a zoom-in
  13643. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13644. zoom).
  13645. @item optzoom
  13646. Set optimal zooming to avoid borders.
  13647. Accepted values are:
  13648. @table @samp
  13649. @item 0
  13650. disabled
  13651. @item 1
  13652. optimal static zoom value is determined (only very strong movements
  13653. will lead to visible borders) (default)
  13654. @item 2
  13655. optimal adaptive zoom value is determined (no borders will be
  13656. visible), see @option{zoomspeed}
  13657. @end table
  13658. Note that the value given at zoom is added to the one calculated here.
  13659. @item zoomspeed
  13660. Set percent to zoom maximally each frame (enabled when
  13661. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13662. 0.25.
  13663. @item interpol
  13664. Specify type of interpolation.
  13665. Available values are:
  13666. @table @samp
  13667. @item no
  13668. no interpolation
  13669. @item linear
  13670. linear only horizontal
  13671. @item bilinear
  13672. linear in both directions (default)
  13673. @item bicubic
  13674. cubic in both directions (slow)
  13675. @end table
  13676. @item tripod
  13677. Enable virtual tripod mode if set to 1, which is equivalent to
  13678. @code{relative=0:smoothing=0}. Default value is 0.
  13679. Use also @code{tripod} option of @ref{vidstabdetect}.
  13680. @item debug
  13681. Increase log verbosity if set to 1. Also the detected global motions
  13682. are written to the temporary file @file{global_motions.trf}. Default
  13683. value is 0.
  13684. @end table
  13685. @subsection Examples
  13686. @itemize
  13687. @item
  13688. Use @command{ffmpeg} for a typical stabilization with default values:
  13689. @example
  13690. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13691. @end example
  13692. Note the use of the @ref{unsharp} filter which is always recommended.
  13693. @item
  13694. Zoom in a bit more and load transform data from a given file:
  13695. @example
  13696. vidstabtransform=zoom=5:input="mytransforms.trf"
  13697. @end example
  13698. @item
  13699. Smoothen the video even more:
  13700. @example
  13701. vidstabtransform=smoothing=30
  13702. @end example
  13703. @end itemize
  13704. @section vflip
  13705. Flip the input video vertically.
  13706. For example, to vertically flip a video with @command{ffmpeg}:
  13707. @example
  13708. ffmpeg -i in.avi -vf "vflip" out.avi
  13709. @end example
  13710. @section vfrdet
  13711. Detect variable frame rate video.
  13712. This filter tries to detect if the input is variable or constant frame rate.
  13713. At end it will output number of frames detected as having variable delta pts,
  13714. and ones with constant delta pts.
  13715. If there was frames with variable delta, than it will also show min and max delta
  13716. encountered.
  13717. @section vibrance
  13718. Boost or alter saturation.
  13719. The filter accepts the following options:
  13720. @table @option
  13721. @item intensity
  13722. Set strength of boost if positive value or strength of alter if negative value.
  13723. Default is 0. Allowed range is from -2 to 2.
  13724. @item rbal
  13725. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13726. @item gbal
  13727. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13728. @item bbal
  13729. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13730. @item rlum
  13731. Set the red luma coefficient.
  13732. @item glum
  13733. Set the green luma coefficient.
  13734. @item blum
  13735. Set the blue luma coefficient.
  13736. @item alternate
  13737. If @code{intensity} is negative and this is set to 1, colors will change,
  13738. otherwise colors will be less saturated, more towards gray.
  13739. @end table
  13740. @anchor{vignette}
  13741. @section vignette
  13742. Make or reverse a natural vignetting effect.
  13743. The filter accepts the following options:
  13744. @table @option
  13745. @item angle, a
  13746. Set lens angle expression as a number of radians.
  13747. The value is clipped in the @code{[0,PI/2]} range.
  13748. Default value: @code{"PI/5"}
  13749. @item x0
  13750. @item y0
  13751. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13752. by default.
  13753. @item mode
  13754. Set forward/backward mode.
  13755. Available modes are:
  13756. @table @samp
  13757. @item forward
  13758. The larger the distance from the central point, the darker the image becomes.
  13759. @item backward
  13760. The larger the distance from the central point, the brighter the image becomes.
  13761. This can be used to reverse a vignette effect, though there is no automatic
  13762. detection to extract the lens @option{angle} and other settings (yet). It can
  13763. also be used to create a burning effect.
  13764. @end table
  13765. Default value is @samp{forward}.
  13766. @item eval
  13767. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13768. It accepts the following values:
  13769. @table @samp
  13770. @item init
  13771. Evaluate expressions only once during the filter initialization.
  13772. @item frame
  13773. Evaluate expressions for each incoming frame. This is way slower than the
  13774. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13775. allows advanced dynamic expressions.
  13776. @end table
  13777. Default value is @samp{init}.
  13778. @item dither
  13779. Set dithering to reduce the circular banding effects. Default is @code{1}
  13780. (enabled).
  13781. @item aspect
  13782. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13783. Setting this value to the SAR of the input will make a rectangular vignetting
  13784. following the dimensions of the video.
  13785. Default is @code{1/1}.
  13786. @end table
  13787. @subsection Expressions
  13788. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13789. following parameters.
  13790. @table @option
  13791. @item w
  13792. @item h
  13793. input width and height
  13794. @item n
  13795. the number of input frame, starting from 0
  13796. @item pts
  13797. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13798. @var{TB} units, NAN if undefined
  13799. @item r
  13800. frame rate of the input video, NAN if the input frame rate is unknown
  13801. @item t
  13802. the PTS (Presentation TimeStamp) of the filtered video frame,
  13803. expressed in seconds, NAN if undefined
  13804. @item tb
  13805. time base of the input video
  13806. @end table
  13807. @subsection Examples
  13808. @itemize
  13809. @item
  13810. Apply simple strong vignetting effect:
  13811. @example
  13812. vignette=PI/4
  13813. @end example
  13814. @item
  13815. Make a flickering vignetting:
  13816. @example
  13817. vignette='PI/4+random(1)*PI/50':eval=frame
  13818. @end example
  13819. @end itemize
  13820. @section vmafmotion
  13821. Obtain the average vmaf motion score of a video.
  13822. It is one of the component filters of VMAF.
  13823. The obtained average motion score is printed through the logging system.
  13824. In the below example the input file @file{ref.mpg} is being processed and score
  13825. is computed.
  13826. @example
  13827. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13828. @end example
  13829. @section vstack
  13830. Stack input videos vertically.
  13831. All streams must be of same pixel format and of same width.
  13832. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13833. to create same output.
  13834. The filter accept the following option:
  13835. @table @option
  13836. @item inputs
  13837. Set number of input streams. Default is 2.
  13838. @item shortest
  13839. If set to 1, force the output to terminate when the shortest input
  13840. terminates. Default value is 0.
  13841. @end table
  13842. @section w3fdif
  13843. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13844. Deinterlacing Filter").
  13845. Based on the process described by Martin Weston for BBC R&D, and
  13846. implemented based on the de-interlace algorithm written by Jim
  13847. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13848. uses filter coefficients calculated by BBC R&D.
  13849. There are two sets of filter coefficients, so called "simple":
  13850. and "complex". Which set of filter coefficients is used can
  13851. be set by passing an optional parameter:
  13852. @table @option
  13853. @item filter
  13854. Set the interlacing filter coefficients. Accepts one of the following values:
  13855. @table @samp
  13856. @item simple
  13857. Simple filter coefficient set.
  13858. @item complex
  13859. More-complex filter coefficient set.
  13860. @end table
  13861. Default value is @samp{complex}.
  13862. @item deint
  13863. Specify which frames to deinterlace. Accept one of the following values:
  13864. @table @samp
  13865. @item all
  13866. Deinterlace all frames,
  13867. @item interlaced
  13868. Only deinterlace frames marked as interlaced.
  13869. @end table
  13870. Default value is @samp{all}.
  13871. @end table
  13872. @section waveform
  13873. Video waveform monitor.
  13874. The waveform monitor plots color component intensity. By default luminance
  13875. only. Each column of the waveform corresponds to a column of pixels in the
  13876. source video.
  13877. It accepts the following options:
  13878. @table @option
  13879. @item mode, m
  13880. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13881. In row mode, the graph on the left side represents color component value 0 and
  13882. the right side represents value = 255. In column mode, the top side represents
  13883. color component value = 0 and bottom side represents value = 255.
  13884. @item intensity, i
  13885. Set intensity. Smaller values are useful to find out how many values of the same
  13886. luminance are distributed across input rows/columns.
  13887. Default value is @code{0.04}. Allowed range is [0, 1].
  13888. @item mirror, r
  13889. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13890. In mirrored mode, higher values will be represented on the left
  13891. side for @code{row} mode and at the top for @code{column} mode. Default is
  13892. @code{1} (mirrored).
  13893. @item display, d
  13894. Set display mode.
  13895. It accepts the following values:
  13896. @table @samp
  13897. @item overlay
  13898. Presents information identical to that in the @code{parade}, except
  13899. that the graphs representing color components are superimposed directly
  13900. over one another.
  13901. This display mode makes it easier to spot relative differences or similarities
  13902. in overlapping areas of the color components that are supposed to be identical,
  13903. such as neutral whites, grays, or blacks.
  13904. @item stack
  13905. Display separate graph for the color components side by side in
  13906. @code{row} mode or one below the other in @code{column} mode.
  13907. @item parade
  13908. Display separate graph for the color components side by side in
  13909. @code{column} mode or one below the other in @code{row} mode.
  13910. Using this display mode makes it easy to spot color casts in the highlights
  13911. and shadows of an image, by comparing the contours of the top and the bottom
  13912. graphs of each waveform. Since whites, grays, and blacks are characterized
  13913. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13914. should display three waveforms of roughly equal width/height. If not, the
  13915. correction is easy to perform by making level adjustments the three waveforms.
  13916. @end table
  13917. Default is @code{stack}.
  13918. @item components, c
  13919. Set which color components to display. Default is 1, which means only luminance
  13920. or red color component if input is in RGB colorspace. If is set for example to
  13921. 7 it will display all 3 (if) available color components.
  13922. @item envelope, e
  13923. @table @samp
  13924. @item none
  13925. No envelope, this is default.
  13926. @item instant
  13927. Instant envelope, minimum and maximum values presented in graph will be easily
  13928. visible even with small @code{step} value.
  13929. @item peak
  13930. Hold minimum and maximum values presented in graph across time. This way you
  13931. can still spot out of range values without constantly looking at waveforms.
  13932. @item peak+instant
  13933. Peak and instant envelope combined together.
  13934. @end table
  13935. @item filter, f
  13936. @table @samp
  13937. @item lowpass
  13938. No filtering, this is default.
  13939. @item flat
  13940. Luma and chroma combined together.
  13941. @item aflat
  13942. Similar as above, but shows difference between blue and red chroma.
  13943. @item xflat
  13944. Similar as above, but use different colors.
  13945. @item chroma
  13946. Displays only chroma.
  13947. @item color
  13948. Displays actual color value on waveform.
  13949. @item acolor
  13950. Similar as above, but with luma showing frequency of chroma values.
  13951. @end table
  13952. @item graticule, g
  13953. Set which graticule to display.
  13954. @table @samp
  13955. @item none
  13956. Do not display graticule.
  13957. @item green
  13958. Display green graticule showing legal broadcast ranges.
  13959. @item orange
  13960. Display orange graticule showing legal broadcast ranges.
  13961. @end table
  13962. @item opacity, o
  13963. Set graticule opacity.
  13964. @item flags, fl
  13965. Set graticule flags.
  13966. @table @samp
  13967. @item numbers
  13968. Draw numbers above lines. By default enabled.
  13969. @item dots
  13970. Draw dots instead of lines.
  13971. @end table
  13972. @item scale, s
  13973. Set scale used for displaying graticule.
  13974. @table @samp
  13975. @item digital
  13976. @item millivolts
  13977. @item ire
  13978. @end table
  13979. Default is digital.
  13980. @item bgopacity, b
  13981. Set background opacity.
  13982. @end table
  13983. @section weave, doubleweave
  13984. The @code{weave} takes a field-based video input and join
  13985. each two sequential fields into single frame, producing a new double
  13986. height clip with half the frame rate and half the frame count.
  13987. The @code{doubleweave} works same as @code{weave} but without
  13988. halving frame rate and frame count.
  13989. It accepts the following option:
  13990. @table @option
  13991. @item first_field
  13992. Set first field. Available values are:
  13993. @table @samp
  13994. @item top, t
  13995. Set the frame as top-field-first.
  13996. @item bottom, b
  13997. Set the frame as bottom-field-first.
  13998. @end table
  13999. @end table
  14000. @subsection Examples
  14001. @itemize
  14002. @item
  14003. Interlace video using @ref{select} and @ref{separatefields} filter:
  14004. @example
  14005. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14006. @end example
  14007. @end itemize
  14008. @section xbr
  14009. Apply the xBR high-quality magnification filter which is designed for pixel
  14010. art. It follows a set of edge-detection rules, see
  14011. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14012. It accepts the following option:
  14013. @table @option
  14014. @item n
  14015. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14016. @code{3xBR} and @code{4} for @code{4xBR}.
  14017. Default is @code{3}.
  14018. @end table
  14019. @section xstack
  14020. Stack video inputs into custom layout.
  14021. All streams must be of same pixel format.
  14022. The filter accept the following option:
  14023. @table @option
  14024. @item inputs
  14025. Set number of input streams. Default is 2.
  14026. @item layout
  14027. Specify layout of inputs.
  14028. This option requires the desired layout configuration to be explicitly set by the user.
  14029. This sets position of each video input in output. Each input
  14030. is separated by '|'.
  14031. The first number represents the column, and the second number represents the row.
  14032. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14033. where X is video input from which to take width or height.
  14034. Multiple values can be used when separated by '+'. In such
  14035. case values are summed together.
  14036. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14037. a layout must be set by the user.
  14038. @item shortest
  14039. If set to 1, force the output to terminate when the shortest input
  14040. terminates. Default value is 0.
  14041. @end table
  14042. @subsection Examples
  14043. @itemize
  14044. @item
  14045. Display 4 inputs into 2x2 grid,
  14046. note that if inputs are of different sizes unused gaps might appear,
  14047. as not all of output video is used.
  14048. @example
  14049. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14050. @end example
  14051. @item
  14052. Display 4 inputs into 1x4 grid,
  14053. note that if inputs are of different sizes unused gaps might appear,
  14054. as not all of output video is used.
  14055. @example
  14056. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14057. @end example
  14058. @item
  14059. Display 9 inputs into 3x3 grid,
  14060. note that if inputs are of different sizes unused gaps might appear,
  14061. as not all of output video is used.
  14062. @example
  14063. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14064. @end example
  14065. @end itemize
  14066. @anchor{yadif}
  14067. @section yadif
  14068. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14069. filter").
  14070. It accepts the following parameters:
  14071. @table @option
  14072. @item mode
  14073. The interlacing mode to adopt. It accepts one of the following values:
  14074. @table @option
  14075. @item 0, send_frame
  14076. Output one frame for each frame.
  14077. @item 1, send_field
  14078. Output one frame for each field.
  14079. @item 2, send_frame_nospatial
  14080. Like @code{send_frame}, but it skips the spatial interlacing check.
  14081. @item 3, send_field_nospatial
  14082. Like @code{send_field}, but it skips the spatial interlacing check.
  14083. @end table
  14084. The default value is @code{send_frame}.
  14085. @item parity
  14086. The picture field parity assumed for the input interlaced video. It accepts one
  14087. of the following values:
  14088. @table @option
  14089. @item 0, tff
  14090. Assume the top field is first.
  14091. @item 1, bff
  14092. Assume the bottom field is first.
  14093. @item -1, auto
  14094. Enable automatic detection of field parity.
  14095. @end table
  14096. The default value is @code{auto}.
  14097. If the interlacing is unknown or the decoder does not export this information,
  14098. top field first will be assumed.
  14099. @item deint
  14100. Specify which frames to deinterlace. Accept one of the following
  14101. values:
  14102. @table @option
  14103. @item 0, all
  14104. Deinterlace all frames.
  14105. @item 1, interlaced
  14106. Only deinterlace frames marked as interlaced.
  14107. @end table
  14108. The default value is @code{all}.
  14109. @end table
  14110. @section yadif_cuda
  14111. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14112. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14113. and/or nvenc.
  14114. It accepts the following parameters:
  14115. @table @option
  14116. @item mode
  14117. The interlacing mode to adopt. It accepts one of the following values:
  14118. @table @option
  14119. @item 0, send_frame
  14120. Output one frame for each frame.
  14121. @item 1, send_field
  14122. Output one frame for each field.
  14123. @item 2, send_frame_nospatial
  14124. Like @code{send_frame}, but it skips the spatial interlacing check.
  14125. @item 3, send_field_nospatial
  14126. Like @code{send_field}, but it skips the spatial interlacing check.
  14127. @end table
  14128. The default value is @code{send_frame}.
  14129. @item parity
  14130. The picture field parity assumed for the input interlaced video. It accepts one
  14131. of the following values:
  14132. @table @option
  14133. @item 0, tff
  14134. Assume the top field is first.
  14135. @item 1, bff
  14136. Assume the bottom field is first.
  14137. @item -1, auto
  14138. Enable automatic detection of field parity.
  14139. @end table
  14140. The default value is @code{auto}.
  14141. If the interlacing is unknown or the decoder does not export this information,
  14142. top field first will be assumed.
  14143. @item deint
  14144. Specify which frames to deinterlace. Accept one of the following
  14145. values:
  14146. @table @option
  14147. @item 0, all
  14148. Deinterlace all frames.
  14149. @item 1, interlaced
  14150. Only deinterlace frames marked as interlaced.
  14151. @end table
  14152. The default value is @code{all}.
  14153. @end table
  14154. @section zoompan
  14155. Apply Zoom & Pan effect.
  14156. This filter accepts the following options:
  14157. @table @option
  14158. @item zoom, z
  14159. Set the zoom expression. Range is 1-10. Default is 1.
  14160. @item x
  14161. @item y
  14162. Set the x and y expression. Default is 0.
  14163. @item d
  14164. Set the duration expression in number of frames.
  14165. This sets for how many number of frames effect will last for
  14166. single input image.
  14167. @item s
  14168. Set the output image size, default is 'hd720'.
  14169. @item fps
  14170. Set the output frame rate, default is '25'.
  14171. @end table
  14172. Each expression can contain the following constants:
  14173. @table @option
  14174. @item in_w, iw
  14175. Input width.
  14176. @item in_h, ih
  14177. Input height.
  14178. @item out_w, ow
  14179. Output width.
  14180. @item out_h, oh
  14181. Output height.
  14182. @item in
  14183. Input frame count.
  14184. @item on
  14185. Output frame count.
  14186. @item x
  14187. @item y
  14188. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14189. for current input frame.
  14190. @item px
  14191. @item py
  14192. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14193. not yet such frame (first input frame).
  14194. @item zoom
  14195. Last calculated zoom from 'z' expression for current input frame.
  14196. @item pzoom
  14197. Last calculated zoom of last output frame of previous input frame.
  14198. @item duration
  14199. Number of output frames for current input frame. Calculated from 'd' expression
  14200. for each input frame.
  14201. @item pduration
  14202. number of output frames created for previous input frame
  14203. @item a
  14204. Rational number: input width / input height
  14205. @item sar
  14206. sample aspect ratio
  14207. @item dar
  14208. display aspect ratio
  14209. @end table
  14210. @subsection Examples
  14211. @itemize
  14212. @item
  14213. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14214. @example
  14215. 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
  14216. @end example
  14217. @item
  14218. Zoom-in up to 1.5 and pan always at center of picture:
  14219. @example
  14220. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14221. @end example
  14222. @item
  14223. Same as above but without pausing:
  14224. @example
  14225. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14226. @end example
  14227. @end itemize
  14228. @anchor{zscale}
  14229. @section zscale
  14230. Scale (resize) the input video, using the z.lib library:
  14231. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14232. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14233. The zscale filter forces the output display aspect ratio to be the same
  14234. as the input, by changing the output sample aspect ratio.
  14235. If the input image format is different from the format requested by
  14236. the next filter, the zscale filter will convert the input to the
  14237. requested format.
  14238. @subsection Options
  14239. The filter accepts the following options.
  14240. @table @option
  14241. @item width, w
  14242. @item height, h
  14243. Set the output video dimension expression. Default value is the input
  14244. dimension.
  14245. If the @var{width} or @var{w} value is 0, the input width is used for
  14246. the output. If the @var{height} or @var{h} value is 0, the input height
  14247. is used for the output.
  14248. If one and only one of the values is -n with n >= 1, the zscale filter
  14249. will use a value that maintains the aspect ratio of the input image,
  14250. calculated from the other specified dimension. After that it will,
  14251. however, make sure that the calculated dimension is divisible by n and
  14252. adjust the value if necessary.
  14253. If both values are -n with n >= 1, the behavior will be identical to
  14254. both values being set to 0 as previously detailed.
  14255. See below for the list of accepted constants for use in the dimension
  14256. expression.
  14257. @item size, s
  14258. Set the video size. For the syntax of this option, check the
  14259. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14260. @item dither, d
  14261. Set the dither type.
  14262. Possible values are:
  14263. @table @var
  14264. @item none
  14265. @item ordered
  14266. @item random
  14267. @item error_diffusion
  14268. @end table
  14269. Default is none.
  14270. @item filter, f
  14271. Set the resize filter type.
  14272. Possible values are:
  14273. @table @var
  14274. @item point
  14275. @item bilinear
  14276. @item bicubic
  14277. @item spline16
  14278. @item spline36
  14279. @item lanczos
  14280. @end table
  14281. Default is bilinear.
  14282. @item range, r
  14283. Set the color range.
  14284. Possible values are:
  14285. @table @var
  14286. @item input
  14287. @item limited
  14288. @item full
  14289. @end table
  14290. Default is same as input.
  14291. @item primaries, p
  14292. Set the color primaries.
  14293. Possible values are:
  14294. @table @var
  14295. @item input
  14296. @item 709
  14297. @item unspecified
  14298. @item 170m
  14299. @item 240m
  14300. @item 2020
  14301. @end table
  14302. Default is same as input.
  14303. @item transfer, t
  14304. Set the transfer characteristics.
  14305. Possible values are:
  14306. @table @var
  14307. @item input
  14308. @item 709
  14309. @item unspecified
  14310. @item 601
  14311. @item linear
  14312. @item 2020_10
  14313. @item 2020_12
  14314. @item smpte2084
  14315. @item iec61966-2-1
  14316. @item arib-std-b67
  14317. @end table
  14318. Default is same as input.
  14319. @item matrix, m
  14320. Set the colorspace matrix.
  14321. Possible value are:
  14322. @table @var
  14323. @item input
  14324. @item 709
  14325. @item unspecified
  14326. @item 470bg
  14327. @item 170m
  14328. @item 2020_ncl
  14329. @item 2020_cl
  14330. @end table
  14331. Default is same as input.
  14332. @item rangein, rin
  14333. Set the input color range.
  14334. Possible values are:
  14335. @table @var
  14336. @item input
  14337. @item limited
  14338. @item full
  14339. @end table
  14340. Default is same as input.
  14341. @item primariesin, pin
  14342. Set the input color primaries.
  14343. Possible values are:
  14344. @table @var
  14345. @item input
  14346. @item 709
  14347. @item unspecified
  14348. @item 170m
  14349. @item 240m
  14350. @item 2020
  14351. @end table
  14352. Default is same as input.
  14353. @item transferin, tin
  14354. Set the input transfer characteristics.
  14355. Possible values are:
  14356. @table @var
  14357. @item input
  14358. @item 709
  14359. @item unspecified
  14360. @item 601
  14361. @item linear
  14362. @item 2020_10
  14363. @item 2020_12
  14364. @end table
  14365. Default is same as input.
  14366. @item matrixin, min
  14367. Set the input colorspace matrix.
  14368. Possible value are:
  14369. @table @var
  14370. @item input
  14371. @item 709
  14372. @item unspecified
  14373. @item 470bg
  14374. @item 170m
  14375. @item 2020_ncl
  14376. @item 2020_cl
  14377. @end table
  14378. @item chromal, c
  14379. Set the output chroma location.
  14380. Possible values are:
  14381. @table @var
  14382. @item input
  14383. @item left
  14384. @item center
  14385. @item topleft
  14386. @item top
  14387. @item bottomleft
  14388. @item bottom
  14389. @end table
  14390. @item chromalin, cin
  14391. Set the input chroma location.
  14392. Possible values are:
  14393. @table @var
  14394. @item input
  14395. @item left
  14396. @item center
  14397. @item topleft
  14398. @item top
  14399. @item bottomleft
  14400. @item bottom
  14401. @end table
  14402. @item npl
  14403. Set the nominal peak luminance.
  14404. @end table
  14405. The values of the @option{w} and @option{h} options are expressions
  14406. containing the following constants:
  14407. @table @var
  14408. @item in_w
  14409. @item in_h
  14410. The input width and height
  14411. @item iw
  14412. @item ih
  14413. These are the same as @var{in_w} and @var{in_h}.
  14414. @item out_w
  14415. @item out_h
  14416. The output (scaled) width and height
  14417. @item ow
  14418. @item oh
  14419. These are the same as @var{out_w} and @var{out_h}
  14420. @item a
  14421. The same as @var{iw} / @var{ih}
  14422. @item sar
  14423. input sample aspect ratio
  14424. @item dar
  14425. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14426. @item hsub
  14427. @item vsub
  14428. horizontal and vertical input chroma subsample values. For example for the
  14429. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14430. @item ohsub
  14431. @item ovsub
  14432. horizontal and vertical output chroma subsample values. For example for the
  14433. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14434. @end table
  14435. @table @option
  14436. @end table
  14437. @c man end VIDEO FILTERS
  14438. @chapter OpenCL Video Filters
  14439. @c man begin OPENCL VIDEO FILTERS
  14440. Below is a description of the currently available OpenCL video filters.
  14441. To enable compilation of these filters you need to configure FFmpeg with
  14442. @code{--enable-opencl}.
  14443. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14444. @table @option
  14445. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14446. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14447. given device parameters.
  14448. @item -filter_hw_device @var{name}
  14449. Pass the hardware device called @var{name} to all filters in any filter graph.
  14450. @end table
  14451. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14452. @itemize
  14453. @item
  14454. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14455. @example
  14456. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14457. @end example
  14458. @end itemize
  14459. Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  14460. @section avgblur_opencl
  14461. Apply average blur filter.
  14462. The filter accepts the following options:
  14463. @table @option
  14464. @item sizeX
  14465. Set horizontal radius size.
  14466. Range is @code{[1, 1024]} and default value is @code{1}.
  14467. @item planes
  14468. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14469. @item sizeY
  14470. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14471. @end table
  14472. @subsection Example
  14473. @itemize
  14474. @item
  14475. Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14476. @example
  14477. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14478. @end example
  14479. @end itemize
  14480. @section boxblur_opencl
  14481. Apply a boxblur algorithm to the input video.
  14482. It accepts the following parameters:
  14483. @table @option
  14484. @item luma_radius, lr
  14485. @item luma_power, lp
  14486. @item chroma_radius, cr
  14487. @item chroma_power, cp
  14488. @item alpha_radius, ar
  14489. @item alpha_power, ap
  14490. @end table
  14491. A description of the accepted options follows.
  14492. @table @option
  14493. @item luma_radius, lr
  14494. @item chroma_radius, cr
  14495. @item alpha_radius, ar
  14496. Set an expression for the box radius in pixels used for blurring the
  14497. corresponding input plane.
  14498. The radius value must be a non-negative number, and must not be
  14499. greater than the value of the expression @code{min(w,h)/2} for the
  14500. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14501. planes.
  14502. Default value for @option{luma_radius} is "2". If not specified,
  14503. @option{chroma_radius} and @option{alpha_radius} default to the
  14504. corresponding value set for @option{luma_radius}.
  14505. The expressions can contain the following constants:
  14506. @table @option
  14507. @item w
  14508. @item h
  14509. The input width and height in pixels.
  14510. @item cw
  14511. @item ch
  14512. The input chroma image width and height in pixels.
  14513. @item hsub
  14514. @item vsub
  14515. The horizontal and vertical chroma subsample values. For example, for the
  14516. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14517. @end table
  14518. @item luma_power, lp
  14519. @item chroma_power, cp
  14520. @item alpha_power, ap
  14521. Specify how many times the boxblur filter is applied to the
  14522. corresponding plane.
  14523. Default value for @option{luma_power} is 2. If not specified,
  14524. @option{chroma_power} and @option{alpha_power} default to the
  14525. corresponding value set for @option{luma_power}.
  14526. A value of 0 will disable the effect.
  14527. @end table
  14528. @subsection Examples
  14529. Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14530. @itemize
  14531. @item
  14532. Apply a boxblur filter with the luma, chroma, and alpha radius
  14533. set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
  14534. @example
  14535. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14536. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14537. @end example
  14538. @item
  14539. Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
  14540. For the luma plane, a 2x2 box radius will be run once.
  14541. For the chroma plane, a 4x4 box radius will be run 5 times.
  14542. For the alpha plane, a 3x3 box radius will be run 7 times.
  14543. @example
  14544. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14545. @end example
  14546. @end itemize
  14547. @section convolution_opencl
  14548. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14549. The filter accepts the following options:
  14550. @table @option
  14551. @item 0m
  14552. @item 1m
  14553. @item 2m
  14554. @item 3m
  14555. Set matrix for each plane.
  14556. Matrix is sequence of 9, 25 or 49 signed numbers.
  14557. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14558. @item 0rdiv
  14559. @item 1rdiv
  14560. @item 2rdiv
  14561. @item 3rdiv
  14562. Set multiplier for calculated value for each plane.
  14563. If unset or 0, it will be sum of all matrix elements.
  14564. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14565. @item 0bias
  14566. @item 1bias
  14567. @item 2bias
  14568. @item 3bias
  14569. Set bias for each plane. This value is added to the result of the multiplication.
  14570. Useful for making the overall image brighter or darker.
  14571. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14572. @end table
  14573. @subsection Examples
  14574. @itemize
  14575. @item
  14576. Apply sharpen:
  14577. @example
  14578. -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
  14579. @end example
  14580. @item
  14581. Apply blur:
  14582. @example
  14583. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
  14584. @end example
  14585. @item
  14586. Apply edge enhance:
  14587. @example
  14588. -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
  14589. @end example
  14590. @item
  14591. Apply edge detect:
  14592. @example
  14593. -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
  14594. @end example
  14595. @item
  14596. Apply laplacian edge detector which includes diagonals:
  14597. @example
  14598. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
  14599. @end example
  14600. @item
  14601. Apply emboss:
  14602. @example
  14603. -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
  14604. @end example
  14605. @end itemize
  14606. @section dilation_opencl
  14607. Apply dilation effect to the video.
  14608. This filter replaces the pixel by the local(3x3) maximum.
  14609. It accepts the following options:
  14610. @table @option
  14611. @item threshold0
  14612. @item threshold1
  14613. @item threshold2
  14614. @item threshold3
  14615. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14616. If @code{0}, plane will remain unchanged.
  14617. @item coordinates
  14618. Flag which specifies the pixel to refer to.
  14619. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14620. Flags to local 3x3 coordinates region centered on @code{x}:
  14621. 1 2 3
  14622. 4 x 5
  14623. 6 7 8
  14624. @end table
  14625. @subsection Example
  14626. @itemize
  14627. @item
  14628. Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
  14629. @example
  14630. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14631. @end example
  14632. @end itemize
  14633. @section erosion_opencl
  14634. Apply erosion effect to the video.
  14635. This filter replaces the pixel by the local(3x3) minimum.
  14636. It accepts the following options:
  14637. @table @option
  14638. @item threshold0
  14639. @item threshold1
  14640. @item threshold2
  14641. @item threshold3
  14642. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14643. If @code{0}, plane will remain unchanged.
  14644. @item coordinates
  14645. Flag which specifies the pixel to refer to.
  14646. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14647. Flags to local 3x3 coordinates region centered on @code{x}:
  14648. 1 2 3
  14649. 4 x 5
  14650. 6 7 8
  14651. @end table
  14652. @subsection Example
  14653. @itemize
  14654. @item
  14655. Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
  14656. @example
  14657. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14658. @end example
  14659. @end itemize
  14660. @section colorkey_opencl
  14661. RGB colorspace color keying.
  14662. The filter accepts the following options:
  14663. @table @option
  14664. @item color
  14665. The color which will be replaced with transparency.
  14666. @item similarity
  14667. Similarity percentage with the key color.
  14668. 0.01 matches only the exact key color, while 1.0 matches everything.
  14669. @item blend
  14670. Blend percentage.
  14671. 0.0 makes pixels either fully transparent, or not transparent at all.
  14672. Higher values result in semi-transparent pixels, with a higher transparency
  14673. the more similar the pixels color is to the key color.
  14674. @end table
  14675. @subsection Examples
  14676. @itemize
  14677. @item
  14678. Make every semi-green pixel in the input transparent with some slight blending:
  14679. @example
  14680. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14681. @end example
  14682. @end itemize
  14683. @section overlay_opencl
  14684. Overlay one video on top of another.
  14685. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14686. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14687. The filter accepts the following options:
  14688. @table @option
  14689. @item x
  14690. Set the x coordinate of the overlaid video on the main video.
  14691. Default value is @code{0}.
  14692. @item y
  14693. Set the x coordinate of the overlaid video on the main video.
  14694. Default value is @code{0}.
  14695. @end table
  14696. @subsection Examples
  14697. @itemize
  14698. @item
  14699. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14700. @example
  14701. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14702. @end example
  14703. @item
  14704. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14705. @example
  14706. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14707. @end example
  14708. @end itemize
  14709. @section prewitt_opencl
  14710. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14711. The filter accepts the following option:
  14712. @table @option
  14713. @item planes
  14714. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14715. @item scale
  14716. Set value which will be multiplied with filtered result.
  14717. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14718. @item delta
  14719. Set value which will be added to filtered result.
  14720. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14721. @end table
  14722. @subsection Example
  14723. @itemize
  14724. @item
  14725. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14726. @example
  14727. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14728. @end example
  14729. @end itemize
  14730. @section roberts_opencl
  14731. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14732. The filter accepts the following option:
  14733. @table @option
  14734. @item planes
  14735. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14736. @item scale
  14737. Set value which will be multiplied with filtered result.
  14738. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14739. @item delta
  14740. Set value which will be added to filtered result.
  14741. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14742. @end table
  14743. @subsection Example
  14744. @itemize
  14745. @item
  14746. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14747. @example
  14748. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14749. @end example
  14750. @end itemize
  14751. @section sobel_opencl
  14752. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14753. The filter accepts the following option:
  14754. @table @option
  14755. @item planes
  14756. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14757. @item scale
  14758. Set value which will be multiplied with filtered result.
  14759. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14760. @item delta
  14761. Set value which will be added to filtered result.
  14762. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14763. @end table
  14764. @subsection Example
  14765. @itemize
  14766. @item
  14767. Apply sobel operator with scale set to 2 and delta set to 10
  14768. @example
  14769. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14770. @end example
  14771. @end itemize
  14772. @section tonemap_opencl
  14773. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14774. It accepts the following parameters:
  14775. @table @option
  14776. @item tonemap
  14777. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14778. @item param
  14779. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14780. @item desat
  14781. Apply desaturation for highlights that exceed this level of brightness. The
  14782. higher the parameter, the more color information will be preserved. This
  14783. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14784. (smoothly) turning into white instead. This makes images feel more natural,
  14785. at the cost of reducing information about out-of-range colors.
  14786. The default value is 0.5, and the algorithm here is a little different from
  14787. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14788. @item threshold
  14789. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14790. is used to detect whether the scene has changed or not. If the distance between
  14791. the current frame average brightness and the current running average exceeds
  14792. a threshold value, we would re-calculate scene average and peak brightness.
  14793. The default value is 0.2.
  14794. @item format
  14795. Specify the output pixel format.
  14796. Currently supported formats are:
  14797. @table @var
  14798. @item p010
  14799. @item nv12
  14800. @end table
  14801. @item range, r
  14802. Set the output color range.
  14803. Possible values are:
  14804. @table @var
  14805. @item tv/mpeg
  14806. @item pc/jpeg
  14807. @end table
  14808. Default is same as input.
  14809. @item primaries, p
  14810. Set the output color primaries.
  14811. Possible values are:
  14812. @table @var
  14813. @item bt709
  14814. @item bt2020
  14815. @end table
  14816. Default is same as input.
  14817. @item transfer, t
  14818. Set the output transfer characteristics.
  14819. Possible values are:
  14820. @table @var
  14821. @item bt709
  14822. @item bt2020
  14823. @end table
  14824. Default is bt709.
  14825. @item matrix, m
  14826. Set the output colorspace matrix.
  14827. Possible value are:
  14828. @table @var
  14829. @item bt709
  14830. @item bt2020
  14831. @end table
  14832. Default is same as input.
  14833. @end table
  14834. @subsection Example
  14835. @itemize
  14836. @item
  14837. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14838. @example
  14839. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14840. @end example
  14841. @end itemize
  14842. @section unsharp_opencl
  14843. Sharpen or blur the input video.
  14844. It accepts the following parameters:
  14845. @table @option
  14846. @item luma_msize_x, lx
  14847. Set the luma matrix horizontal size.
  14848. Range is @code{[1, 23]} and default value is @code{5}.
  14849. @item luma_msize_y, ly
  14850. Set the luma matrix vertical size.
  14851. Range is @code{[1, 23]} and default value is @code{5}.
  14852. @item luma_amount, la
  14853. Set the luma effect strength.
  14854. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14855. Negative values will blur the input video, while positive values will
  14856. sharpen it, a value of zero will disable the effect.
  14857. @item chroma_msize_x, cx
  14858. Set the chroma matrix horizontal size.
  14859. Range is @code{[1, 23]} and default value is @code{5}.
  14860. @item chroma_msize_y, cy
  14861. Set the chroma matrix vertical size.
  14862. Range is @code{[1, 23]} and default value is @code{5}.
  14863. @item chroma_amount, ca
  14864. Set the chroma effect strength.
  14865. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14866. Negative values will blur the input video, while positive values will
  14867. sharpen it, a value of zero will disable the effect.
  14868. @end table
  14869. All parameters are optional and default to the equivalent of the
  14870. string '5:5:1.0:5:5:0.0'.
  14871. @subsection Examples
  14872. @itemize
  14873. @item
  14874. Apply strong luma sharpen effect:
  14875. @example
  14876. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14877. @end example
  14878. @item
  14879. Apply a strong blur of both luma and chroma parameters:
  14880. @example
  14881. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14882. @end example
  14883. @end itemize
  14884. @c man end OPENCL VIDEO FILTERS
  14885. @chapter Video Sources
  14886. @c man begin VIDEO SOURCES
  14887. Below is a description of the currently available video sources.
  14888. @section buffer
  14889. Buffer video frames, and make them available to the filter chain.
  14890. This source is mainly intended for a programmatic use, in particular
  14891. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14892. It accepts the following parameters:
  14893. @table @option
  14894. @item video_size
  14895. Specify the size (width and height) of the buffered video frames. For the
  14896. syntax of this option, check the
  14897. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14898. @item width
  14899. The input video width.
  14900. @item height
  14901. The input video height.
  14902. @item pix_fmt
  14903. A string representing the pixel format of the buffered video frames.
  14904. It may be a number corresponding to a pixel format, or a pixel format
  14905. name.
  14906. @item time_base
  14907. Specify the timebase assumed by the timestamps of the buffered frames.
  14908. @item frame_rate
  14909. Specify the frame rate expected for the video stream.
  14910. @item pixel_aspect, sar
  14911. The sample (pixel) aspect ratio of the input video.
  14912. @item sws_param
  14913. Specify the optional parameters to be used for the scale filter which
  14914. is automatically inserted when an input change is detected in the
  14915. input size or format.
  14916. @item hw_frames_ctx
  14917. When using a hardware pixel format, this should be a reference to an
  14918. AVHWFramesContext describing input frames.
  14919. @end table
  14920. For example:
  14921. @example
  14922. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14923. @end example
  14924. will instruct the source to accept video frames with size 320x240 and
  14925. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14926. square pixels (1:1 sample aspect ratio).
  14927. Since the pixel format with name "yuv410p" corresponds to the number 6
  14928. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14929. this example corresponds to:
  14930. @example
  14931. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14932. @end example
  14933. Alternatively, the options can be specified as a flat string, but this
  14934. syntax is deprecated:
  14935. @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}]
  14936. @section cellauto
  14937. Create a pattern generated by an elementary cellular automaton.
  14938. The initial state of the cellular automaton can be defined through the
  14939. @option{filename} and @option{pattern} options. If such options are
  14940. not specified an initial state is created randomly.
  14941. At each new frame a new row in the video is filled with the result of
  14942. the cellular automaton next generation. The behavior when the whole
  14943. frame is filled is defined by the @option{scroll} option.
  14944. This source accepts the following options:
  14945. @table @option
  14946. @item filename, f
  14947. Read the initial cellular automaton state, i.e. the starting row, from
  14948. the specified file.
  14949. In the file, each non-whitespace character is considered an alive
  14950. cell, a newline will terminate the row, and further characters in the
  14951. file will be ignored.
  14952. @item pattern, p
  14953. Read the initial cellular automaton state, i.e. the starting row, from
  14954. the specified string.
  14955. Each non-whitespace character in the string is considered an alive
  14956. cell, a newline will terminate the row, and further characters in the
  14957. string will be ignored.
  14958. @item rate, r
  14959. Set the video rate, that is the number of frames generated per second.
  14960. Default is 25.
  14961. @item random_fill_ratio, ratio
  14962. Set the random fill ratio for the initial cellular automaton row. It
  14963. is a floating point number value ranging from 0 to 1, defaults to
  14964. 1/PHI.
  14965. This option is ignored when a file or a pattern is specified.
  14966. @item random_seed, seed
  14967. Set the seed for filling randomly the initial row, must be an integer
  14968. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14969. set to -1, the filter will try to use a good random seed on a best
  14970. effort basis.
  14971. @item rule
  14972. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14973. Default value is 110.
  14974. @item size, s
  14975. Set the size of the output video. For the syntax of this option, check the
  14976. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14977. If @option{filename} or @option{pattern} is specified, the size is set
  14978. by default to the width of the specified initial state row, and the
  14979. height is set to @var{width} * PHI.
  14980. If @option{size} is set, it must contain the width of the specified
  14981. pattern string, and the specified pattern will be centered in the
  14982. larger row.
  14983. If a filename or a pattern string is not specified, the size value
  14984. defaults to "320x518" (used for a randomly generated initial state).
  14985. @item scroll
  14986. If set to 1, scroll the output upward when all the rows in the output
  14987. have been already filled. If set to 0, the new generated row will be
  14988. written over the top row just after the bottom row is filled.
  14989. Defaults to 1.
  14990. @item start_full, full
  14991. If set to 1, completely fill the output with generated rows before
  14992. outputting the first frame.
  14993. This is the default behavior, for disabling set the value to 0.
  14994. @item stitch
  14995. If set to 1, stitch the left and right row edges together.
  14996. This is the default behavior, for disabling set the value to 0.
  14997. @end table
  14998. @subsection Examples
  14999. @itemize
  15000. @item
  15001. Read the initial state from @file{pattern}, and specify an output of
  15002. size 200x400.
  15003. @example
  15004. cellauto=f=pattern:s=200x400
  15005. @end example
  15006. @item
  15007. Generate a random initial row with a width of 200 cells, with a fill
  15008. ratio of 2/3:
  15009. @example
  15010. cellauto=ratio=2/3:s=200x200
  15011. @end example
  15012. @item
  15013. Create a pattern generated by rule 18 starting by a single alive cell
  15014. centered on an initial row with width 100:
  15015. @example
  15016. cellauto=p=@@:s=100x400:full=0:rule=18
  15017. @end example
  15018. @item
  15019. Specify a more elaborated initial pattern:
  15020. @example
  15021. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15022. @end example
  15023. @end itemize
  15024. @anchor{coreimagesrc}
  15025. @section coreimagesrc
  15026. Video source generated on GPU using Apple's CoreImage API on OSX.
  15027. This video source is a specialized version of the @ref{coreimage} video filter.
  15028. Use a core image generator at the beginning of the applied filterchain to
  15029. generate the content.
  15030. The coreimagesrc video source accepts the following options:
  15031. @table @option
  15032. @item list_generators
  15033. List all available generators along with all their respective options as well as
  15034. possible minimum and maximum values along with the default values.
  15035. @example
  15036. list_generators=true
  15037. @end example
  15038. @item size, s
  15039. Specify the size of the sourced video. For the syntax of this option, check the
  15040. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15041. The default value is @code{320x240}.
  15042. @item rate, r
  15043. Specify the frame rate of the sourced video, as the number of frames
  15044. generated per second. It has to be a string in the format
  15045. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15046. number or a valid video frame rate abbreviation. The default value is
  15047. "25".
  15048. @item sar
  15049. Set the sample aspect ratio of the sourced video.
  15050. @item duration, d
  15051. Set the duration of the sourced video. See
  15052. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15053. for the accepted syntax.
  15054. If not specified, or the expressed duration is negative, the video is
  15055. supposed to be generated forever.
  15056. @end table
  15057. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15058. A complete filterchain can be used for further processing of the
  15059. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15060. and examples for details.
  15061. @subsection Examples
  15062. @itemize
  15063. @item
  15064. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15065. given as complete and escaped command-line for Apple's standard bash shell:
  15066. @example
  15067. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15068. @end example
  15069. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15070. need for a nullsrc video source.
  15071. @end itemize
  15072. @section mandelbrot
  15073. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15074. point specified with @var{start_x} and @var{start_y}.
  15075. This source accepts the following options:
  15076. @table @option
  15077. @item end_pts
  15078. Set the terminal pts value. Default value is 400.
  15079. @item end_scale
  15080. Set the terminal scale value.
  15081. Must be a floating point value. Default value is 0.3.
  15082. @item inner
  15083. Set the inner coloring mode, that is the algorithm used to draw the
  15084. Mandelbrot fractal internal region.
  15085. It shall assume one of the following values:
  15086. @table @option
  15087. @item black
  15088. Set black mode.
  15089. @item convergence
  15090. Show time until convergence.
  15091. @item mincol
  15092. Set color based on point closest to the origin of the iterations.
  15093. @item period
  15094. Set period mode.
  15095. @end table
  15096. Default value is @var{mincol}.
  15097. @item bailout
  15098. Set the bailout value. Default value is 10.0.
  15099. @item maxiter
  15100. Set the maximum of iterations performed by the rendering
  15101. algorithm. Default value is 7189.
  15102. @item outer
  15103. Set outer coloring mode.
  15104. It shall assume one of following values:
  15105. @table @option
  15106. @item iteration_count
  15107. Set iteration count mode.
  15108. @item normalized_iteration_count
  15109. set normalized iteration count mode.
  15110. @end table
  15111. Default value is @var{normalized_iteration_count}.
  15112. @item rate, r
  15113. Set frame rate, expressed as number of frames per second. Default
  15114. value is "25".
  15115. @item size, s
  15116. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15117. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15118. @item start_scale
  15119. Set the initial scale value. Default value is 3.0.
  15120. @item start_x
  15121. Set the initial x position. Must be a floating point value between
  15122. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15123. @item start_y
  15124. Set the initial y position. Must be a floating point value between
  15125. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15126. @end table
  15127. @section mptestsrc
  15128. Generate various test patterns, as generated by the MPlayer test filter.
  15129. The size of the generated video is fixed, and is 256x256.
  15130. This source is useful in particular for testing encoding features.
  15131. This source accepts the following options:
  15132. @table @option
  15133. @item rate, r
  15134. Specify the frame rate of the sourced video, as the number of frames
  15135. generated per second. It has to be a string in the format
  15136. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15137. number or a valid video frame rate abbreviation. The default value is
  15138. "25".
  15139. @item duration, d
  15140. Set the duration of the sourced video. See
  15141. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15142. for the accepted syntax.
  15143. If not specified, or the expressed duration is negative, the video is
  15144. supposed to be generated forever.
  15145. @item test, t
  15146. Set the number or the name of the test to perform. Supported tests are:
  15147. @table @option
  15148. @item dc_luma
  15149. @item dc_chroma
  15150. @item freq_luma
  15151. @item freq_chroma
  15152. @item amp_luma
  15153. @item amp_chroma
  15154. @item cbp
  15155. @item mv
  15156. @item ring1
  15157. @item ring2
  15158. @item all
  15159. @end table
  15160. Default value is "all", which will cycle through the list of all tests.
  15161. @end table
  15162. Some examples:
  15163. @example
  15164. mptestsrc=t=dc_luma
  15165. @end example
  15166. will generate a "dc_luma" test pattern.
  15167. @section frei0r_src
  15168. Provide a frei0r source.
  15169. To enable compilation of this filter you need to install the frei0r
  15170. header and configure FFmpeg with @code{--enable-frei0r}.
  15171. This source accepts the following parameters:
  15172. @table @option
  15173. @item size
  15174. The size of the video to generate. For the syntax of this option, check the
  15175. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15176. @item framerate
  15177. The framerate of the generated video. It may be a string of the form
  15178. @var{num}/@var{den} or a frame rate abbreviation.
  15179. @item filter_name
  15180. The name to the frei0r source to load. For more information regarding frei0r and
  15181. how to set the parameters, read the @ref{frei0r} section in the video filters
  15182. documentation.
  15183. @item filter_params
  15184. A '|'-separated list of parameters to pass to the frei0r source.
  15185. @end table
  15186. For example, to generate a frei0r partik0l source with size 200x200
  15187. and frame rate 10 which is overlaid on the overlay filter main input:
  15188. @example
  15189. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15190. @end example
  15191. @section life
  15192. Generate a life pattern.
  15193. This source is based on a generalization of John Conway's life game.
  15194. The sourced input represents a life grid, each pixel represents a cell
  15195. which can be in one of two possible states, alive or dead. Every cell
  15196. interacts with its eight neighbours, which are the cells that are
  15197. horizontally, vertically, or diagonally adjacent.
  15198. At each interaction the grid evolves according to the adopted rule,
  15199. which specifies the number of neighbor alive cells which will make a
  15200. cell stay alive or born. The @option{rule} option allows one to specify
  15201. the rule to adopt.
  15202. This source accepts the following options:
  15203. @table @option
  15204. @item filename, f
  15205. Set the file from which to read the initial grid state. In the file,
  15206. each non-whitespace character is considered an alive cell, and newline
  15207. is used to delimit the end of each row.
  15208. If this option is not specified, the initial grid is generated
  15209. randomly.
  15210. @item rate, r
  15211. Set the video rate, that is the number of frames generated per second.
  15212. Default is 25.
  15213. @item random_fill_ratio, ratio
  15214. Set the random fill ratio for the initial random grid. It is a
  15215. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15216. It is ignored when a file is specified.
  15217. @item random_seed, seed
  15218. Set the seed for filling the initial random grid, must be an integer
  15219. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15220. set to -1, the filter will try to use a good random seed on a best
  15221. effort basis.
  15222. @item rule
  15223. Set the life rule.
  15224. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15225. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15226. @var{NS} specifies the number of alive neighbor cells which make a
  15227. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15228. which make a dead cell to become alive (i.e. to "born").
  15229. "s" and "b" can be used in place of "S" and "B", respectively.
  15230. Alternatively a rule can be specified by an 18-bits integer. The 9
  15231. high order bits are used to encode the next cell state if it is alive
  15232. for each number of neighbor alive cells, the low order bits specify
  15233. the rule for "borning" new cells. Higher order bits encode for an
  15234. higher number of neighbor cells.
  15235. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15236. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15237. Default value is "S23/B3", which is the original Conway's game of life
  15238. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15239. cells, and will born a new cell if there are three alive cells around
  15240. a dead cell.
  15241. @item size, s
  15242. Set the size of the output video. For the syntax of this option, check the
  15243. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15244. If @option{filename} is specified, the size is set by default to the
  15245. same size of the input file. If @option{size} is set, it must contain
  15246. the size specified in the input file, and the initial grid defined in
  15247. that file is centered in the larger resulting area.
  15248. If a filename is not specified, the size value defaults to "320x240"
  15249. (used for a randomly generated initial grid).
  15250. @item stitch
  15251. If set to 1, stitch the left and right grid edges together, and the
  15252. top and bottom edges also. Defaults to 1.
  15253. @item mold
  15254. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15255. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15256. value from 0 to 255.
  15257. @item life_color
  15258. Set the color of living (or new born) cells.
  15259. @item death_color
  15260. Set the color of dead cells. If @option{mold} is set, this is the first color
  15261. used to represent a dead cell.
  15262. @item mold_color
  15263. Set mold color, for definitely dead and moldy cells.
  15264. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15265. ffmpeg-utils manual,ffmpeg-utils}.
  15266. @end table
  15267. @subsection Examples
  15268. @itemize
  15269. @item
  15270. Read a grid from @file{pattern}, and center it on a grid of size
  15271. 300x300 pixels:
  15272. @example
  15273. life=f=pattern:s=300x300
  15274. @end example
  15275. @item
  15276. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15277. @example
  15278. life=ratio=2/3:s=200x200
  15279. @end example
  15280. @item
  15281. Specify a custom rule for evolving a randomly generated grid:
  15282. @example
  15283. life=rule=S14/B34
  15284. @end example
  15285. @item
  15286. Full example with slow death effect (mold) using @command{ffplay}:
  15287. @example
  15288. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15289. @end example
  15290. @end itemize
  15291. @anchor{allrgb}
  15292. @anchor{allyuv}
  15293. @anchor{color}
  15294. @anchor{haldclutsrc}
  15295. @anchor{nullsrc}
  15296. @anchor{pal75bars}
  15297. @anchor{pal100bars}
  15298. @anchor{rgbtestsrc}
  15299. @anchor{smptebars}
  15300. @anchor{smptehdbars}
  15301. @anchor{testsrc}
  15302. @anchor{testsrc2}
  15303. @anchor{yuvtestsrc}
  15304. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15305. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15306. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15307. The @code{color} source provides an uniformly colored input.
  15308. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15309. @ref{haldclut} filter.
  15310. The @code{nullsrc} source returns unprocessed video frames. It is
  15311. mainly useful to be employed in analysis / debugging tools, or as the
  15312. source for filters which ignore the input data.
  15313. The @code{pal75bars} source generates a color bars pattern, based on
  15314. EBU PAL recommendations with 75% color levels.
  15315. The @code{pal100bars} source generates a color bars pattern, based on
  15316. EBU PAL recommendations with 100% color levels.
  15317. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15318. detecting RGB vs BGR issues. You should see a red, green and blue
  15319. stripe from top to bottom.
  15320. The @code{smptebars} source generates a color bars pattern, based on
  15321. the SMPTE Engineering Guideline EG 1-1990.
  15322. The @code{smptehdbars} source generates a color bars pattern, based on
  15323. the SMPTE RP 219-2002.
  15324. The @code{testsrc} source generates a test video pattern, showing a
  15325. color pattern, a scrolling gradient and a timestamp. This is mainly
  15326. intended for testing purposes.
  15327. The @code{testsrc2} source is similar to testsrc, but supports more
  15328. pixel formats instead of just @code{rgb24}. This allows using it as an
  15329. input for other tests without requiring a format conversion.
  15330. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15331. see a y, cb and cr stripe from top to bottom.
  15332. The sources accept the following parameters:
  15333. @table @option
  15334. @item level
  15335. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15336. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15337. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15338. coded on a @code{1/(N*N)} scale.
  15339. @item color, c
  15340. Specify the color of the source, only available in the @code{color}
  15341. source. For the syntax of this option, check the
  15342. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15343. @item size, s
  15344. Specify the size of the sourced video. For the syntax of this option, check the
  15345. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15346. The default value is @code{320x240}.
  15347. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15348. @code{haldclutsrc} filters.
  15349. @item rate, r
  15350. Specify the frame rate of the sourced video, as the number of frames
  15351. generated per second. It has to be a string in the format
  15352. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15353. number or a valid video frame rate abbreviation. The default value is
  15354. "25".
  15355. @item duration, d
  15356. Set the duration of the sourced video. See
  15357. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15358. for the accepted syntax.
  15359. If not specified, or the expressed duration is negative, the video is
  15360. supposed to be generated forever.
  15361. @item sar
  15362. Set the sample aspect ratio of the sourced video.
  15363. @item alpha
  15364. Specify the alpha (opacity) of the background, only available in the
  15365. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15366. 255 (fully opaque, the default).
  15367. @item decimals, n
  15368. Set the number of decimals to show in the timestamp, only available in the
  15369. @code{testsrc} source.
  15370. The displayed timestamp value will correspond to the original
  15371. timestamp value multiplied by the power of 10 of the specified
  15372. value. Default value is 0.
  15373. @end table
  15374. @subsection Examples
  15375. @itemize
  15376. @item
  15377. Generate a video with a duration of 5.3 seconds, with size
  15378. 176x144 and a frame rate of 10 frames per second:
  15379. @example
  15380. testsrc=duration=5.3:size=qcif:rate=10
  15381. @end example
  15382. @item
  15383. The following graph description will generate a red source
  15384. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15385. frames per second:
  15386. @example
  15387. color=c=red@@0.2:s=qcif:r=10
  15388. @end example
  15389. @item
  15390. If the input content is to be ignored, @code{nullsrc} can be used. The
  15391. following command generates noise in the luminance plane by employing
  15392. the @code{geq} filter:
  15393. @example
  15394. nullsrc=s=256x256, geq=random(1)*255:128:128
  15395. @end example
  15396. @end itemize
  15397. @subsection Commands
  15398. The @code{color} source supports the following commands:
  15399. @table @option
  15400. @item c, color
  15401. Set the color of the created image. Accepts the same syntax of the
  15402. corresponding @option{color} option.
  15403. @end table
  15404. @section openclsrc
  15405. Generate video using an OpenCL program.
  15406. @table @option
  15407. @item source
  15408. OpenCL program source file.
  15409. @item kernel
  15410. Kernel name in program.
  15411. @item size, s
  15412. Size of frames to generate. This must be set.
  15413. @item format
  15414. Pixel format to use for the generated frames. This must be set.
  15415. @item rate, r
  15416. Number of frames generated every second. Default value is '25'.
  15417. @end table
  15418. For details of how the program loading works, see the @ref{program_opencl}
  15419. filter.
  15420. Example programs:
  15421. @itemize
  15422. @item
  15423. Generate a colour ramp by setting pixel values from the position of the pixel
  15424. in the output image. (Note that this will work with all pixel formats, but
  15425. the generated output will not be the same.)
  15426. @verbatim
  15427. __kernel void ramp(__write_only image2d_t dst,
  15428. unsigned int index)
  15429. {
  15430. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15431. float4 val;
  15432. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15433. write_imagef(dst, loc, val);
  15434. }
  15435. @end verbatim
  15436. @item
  15437. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15438. @verbatim
  15439. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15440. unsigned int index)
  15441. {
  15442. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15443. float4 value = 0.0f;
  15444. int x = loc.x + index;
  15445. int y = loc.y + index;
  15446. while (x > 0 || y > 0) {
  15447. if (x % 3 == 1 && y % 3 == 1) {
  15448. value = 1.0f;
  15449. break;
  15450. }
  15451. x /= 3;
  15452. y /= 3;
  15453. }
  15454. write_imagef(dst, loc, value);
  15455. }
  15456. @end verbatim
  15457. @end itemize
  15458. @c man end VIDEO SOURCES
  15459. @chapter Video Sinks
  15460. @c man begin VIDEO SINKS
  15461. Below is a description of the currently available video sinks.
  15462. @section buffersink
  15463. Buffer video frames, and make them available to the end of the filter
  15464. graph.
  15465. This sink is mainly intended for programmatic use, in particular
  15466. through the interface defined in @file{libavfilter/buffersink.h}
  15467. or the options system.
  15468. It accepts a pointer to an AVBufferSinkContext structure, which
  15469. defines the incoming buffers' formats, to be passed as the opaque
  15470. parameter to @code{avfilter_init_filter} for initialization.
  15471. @section nullsink
  15472. Null video sink: do absolutely nothing with the input video. It is
  15473. mainly useful as a template and for use in analysis / debugging
  15474. tools.
  15475. @c man end VIDEO SINKS
  15476. @chapter Multimedia Filters
  15477. @c man begin MULTIMEDIA FILTERS
  15478. Below is a description of the currently available multimedia filters.
  15479. @section abitscope
  15480. Convert input audio to a video output, displaying the audio bit scope.
  15481. The filter accepts the following options:
  15482. @table @option
  15483. @item rate, r
  15484. Set frame rate, expressed as number of frames per second. Default
  15485. value is "25".
  15486. @item size, s
  15487. Specify the video size for the output. For the syntax of this option, check the
  15488. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15489. Default value is @code{1024x256}.
  15490. @item colors
  15491. Specify list of colors separated by space or by '|' which will be used to
  15492. draw channels. Unrecognized or missing colors will be replaced
  15493. by white color.
  15494. @end table
  15495. @section ahistogram
  15496. Convert input audio to a video output, displaying the volume histogram.
  15497. The filter accepts the following options:
  15498. @table @option
  15499. @item dmode
  15500. Specify how histogram is calculated.
  15501. It accepts the following values:
  15502. @table @samp
  15503. @item single
  15504. Use single histogram for all channels.
  15505. @item separate
  15506. Use separate histogram for each channel.
  15507. @end table
  15508. Default is @code{single}.
  15509. @item rate, r
  15510. Set frame rate, expressed as number of frames per second. Default
  15511. value is "25".
  15512. @item size, s
  15513. Specify the video size for the output. For the syntax of this option, check the
  15514. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15515. Default value is @code{hd720}.
  15516. @item scale
  15517. Set display scale.
  15518. It accepts the following values:
  15519. @table @samp
  15520. @item log
  15521. logarithmic
  15522. @item sqrt
  15523. square root
  15524. @item cbrt
  15525. cubic root
  15526. @item lin
  15527. linear
  15528. @item rlog
  15529. reverse logarithmic
  15530. @end table
  15531. Default is @code{log}.
  15532. @item ascale
  15533. Set amplitude scale.
  15534. It accepts the following values:
  15535. @table @samp
  15536. @item log
  15537. logarithmic
  15538. @item lin
  15539. linear
  15540. @end table
  15541. Default is @code{log}.
  15542. @item acount
  15543. Set how much frames to accumulate in histogram.
  15544. Default is 1. Setting this to -1 accumulates all frames.
  15545. @item rheight
  15546. Set histogram ratio of window height.
  15547. @item slide
  15548. Set sonogram sliding.
  15549. It accepts the following values:
  15550. @table @samp
  15551. @item replace
  15552. replace old rows with new ones.
  15553. @item scroll
  15554. scroll from top to bottom.
  15555. @end table
  15556. Default is @code{replace}.
  15557. @end table
  15558. @section aphasemeter
  15559. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15560. representing mean phase of current audio frame. A video output can also be produced and is
  15561. enabled by default. The audio is passed through as first output.
  15562. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15563. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15564. and @code{1} means channels are in phase.
  15565. The filter accepts the following options, all related to its video output:
  15566. @table @option
  15567. @item rate, r
  15568. Set the output frame rate. Default value is @code{25}.
  15569. @item size, s
  15570. Set the video size for the output. For the syntax of this option, check the
  15571. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15572. Default value is @code{800x400}.
  15573. @item rc
  15574. @item gc
  15575. @item bc
  15576. Specify the red, green, blue contrast. Default values are @code{2},
  15577. @code{7} and @code{1}.
  15578. Allowed range is @code{[0, 255]}.
  15579. @item mpc
  15580. Set color which will be used for drawing median phase. If color is
  15581. @code{none} which is default, no median phase value will be drawn.
  15582. @item video
  15583. Enable video output. Default is enabled.
  15584. @end table
  15585. @section avectorscope
  15586. Convert input audio to a video output, representing the audio vector
  15587. scope.
  15588. The filter is used to measure the difference between channels of stereo
  15589. audio stream. A monoaural signal, consisting of identical left and right
  15590. signal, results in straight vertical line. Any stereo separation is visible
  15591. as a deviation from this line, creating a Lissajous figure.
  15592. If the straight (or deviation from it) but horizontal line appears this
  15593. indicates that the left and right channels are out of phase.
  15594. The filter accepts the following options:
  15595. @table @option
  15596. @item mode, m
  15597. Set the vectorscope mode.
  15598. Available values are:
  15599. @table @samp
  15600. @item lissajous
  15601. Lissajous rotated by 45 degrees.
  15602. @item lissajous_xy
  15603. Same as above but not rotated.
  15604. @item polar
  15605. Shape resembling half of circle.
  15606. @end table
  15607. Default value is @samp{lissajous}.
  15608. @item size, s
  15609. Set the video size for the output. For the syntax of this option, check the
  15610. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15611. Default value is @code{400x400}.
  15612. @item rate, r
  15613. Set the output frame rate. Default value is @code{25}.
  15614. @item rc
  15615. @item gc
  15616. @item bc
  15617. @item ac
  15618. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15619. @code{160}, @code{80} and @code{255}.
  15620. Allowed range is @code{[0, 255]}.
  15621. @item rf
  15622. @item gf
  15623. @item bf
  15624. @item af
  15625. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15626. @code{10}, @code{5} and @code{5}.
  15627. Allowed range is @code{[0, 255]}.
  15628. @item zoom
  15629. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15630. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15631. @item draw
  15632. Set the vectorscope drawing mode.
  15633. Available values are:
  15634. @table @samp
  15635. @item dot
  15636. Draw dot for each sample.
  15637. @item line
  15638. Draw line between previous and current sample.
  15639. @end table
  15640. Default value is @samp{dot}.
  15641. @item scale
  15642. Specify amplitude scale of audio samples.
  15643. Available values are:
  15644. @table @samp
  15645. @item lin
  15646. Linear.
  15647. @item sqrt
  15648. Square root.
  15649. @item cbrt
  15650. Cubic root.
  15651. @item log
  15652. Logarithmic.
  15653. @end table
  15654. @item swap
  15655. Swap left channel axis with right channel axis.
  15656. @item mirror
  15657. Mirror axis.
  15658. @table @samp
  15659. @item none
  15660. No mirror.
  15661. @item x
  15662. Mirror only x axis.
  15663. @item y
  15664. Mirror only y axis.
  15665. @item xy
  15666. Mirror both axis.
  15667. @end table
  15668. @end table
  15669. @subsection Examples
  15670. @itemize
  15671. @item
  15672. Complete example using @command{ffplay}:
  15673. @example
  15674. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15675. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15676. @end example
  15677. @end itemize
  15678. @section bench, abench
  15679. Benchmark part of a filtergraph.
  15680. The filter accepts the following options:
  15681. @table @option
  15682. @item action
  15683. Start or stop a timer.
  15684. Available values are:
  15685. @table @samp
  15686. @item start
  15687. Get the current time, set it as frame metadata (using the key
  15688. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15689. @item stop
  15690. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15691. the input frame metadata to get the time difference. Time difference, average,
  15692. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15693. @code{min}) are then printed. The timestamps are expressed in seconds.
  15694. @end table
  15695. @end table
  15696. @subsection Examples
  15697. @itemize
  15698. @item
  15699. Benchmark @ref{selectivecolor} filter:
  15700. @example
  15701. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15702. @end example
  15703. @end itemize
  15704. @section concat
  15705. Concatenate audio and video streams, joining them together one after the
  15706. other.
  15707. The filter works on segments of synchronized video and audio streams. All
  15708. segments must have the same number of streams of each type, and that will
  15709. also be the number of streams at output.
  15710. The filter accepts the following options:
  15711. @table @option
  15712. @item n
  15713. Set the number of segments. Default is 2.
  15714. @item v
  15715. Set the number of output video streams, that is also the number of video
  15716. streams in each segment. Default is 1.
  15717. @item a
  15718. Set the number of output audio streams, that is also the number of audio
  15719. streams in each segment. Default is 0.
  15720. @item unsafe
  15721. Activate unsafe mode: do not fail if segments have a different format.
  15722. @end table
  15723. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15724. @var{a} audio outputs.
  15725. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15726. segment, in the same order as the outputs, then the inputs for the second
  15727. segment, etc.
  15728. Related streams do not always have exactly the same duration, for various
  15729. reasons including codec frame size or sloppy authoring. For that reason,
  15730. related synchronized streams (e.g. a video and its audio track) should be
  15731. concatenated at once. The concat filter will use the duration of the longest
  15732. stream in each segment (except the last one), and if necessary pad shorter
  15733. audio streams with silence.
  15734. For this filter to work correctly, all segments must start at timestamp 0.
  15735. All corresponding streams must have the same parameters in all segments; the
  15736. filtering system will automatically select a common pixel format for video
  15737. streams, and a common sample format, sample rate and channel layout for
  15738. audio streams, but other settings, such as resolution, must be converted
  15739. explicitly by the user.
  15740. Different frame rates are acceptable but will result in variable frame rate
  15741. at output; be sure to configure the output file to handle it.
  15742. @subsection Examples
  15743. @itemize
  15744. @item
  15745. Concatenate an opening, an episode and an ending, all in bilingual version
  15746. (video in stream 0, audio in streams 1 and 2):
  15747. @example
  15748. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15749. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15750. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15751. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15752. @end example
  15753. @item
  15754. Concatenate two parts, handling audio and video separately, using the
  15755. (a)movie sources, and adjusting the resolution:
  15756. @example
  15757. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15758. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15759. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15760. @end example
  15761. Note that a desync will happen at the stitch if the audio and video streams
  15762. do not have exactly the same duration in the first file.
  15763. @end itemize
  15764. @subsection Commands
  15765. This filter supports the following commands:
  15766. @table @option
  15767. @item next
  15768. Close the current segment and step to the next one
  15769. @end table
  15770. @section drawgraph, adrawgraph
  15771. Draw a graph using input video or audio metadata.
  15772. It accepts the following parameters:
  15773. @table @option
  15774. @item m1
  15775. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15776. @item fg1
  15777. Set 1st foreground color expression.
  15778. @item m2
  15779. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15780. @item fg2
  15781. Set 2nd foreground color expression.
  15782. @item m3
  15783. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15784. @item fg3
  15785. Set 3rd foreground color expression.
  15786. @item m4
  15787. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15788. @item fg4
  15789. Set 4th foreground color expression.
  15790. @item min
  15791. Set minimal value of metadata value.
  15792. @item max
  15793. Set maximal value of metadata value.
  15794. @item bg
  15795. Set graph background color. Default is white.
  15796. @item mode
  15797. Set graph mode.
  15798. Available values for mode is:
  15799. @table @samp
  15800. @item bar
  15801. @item dot
  15802. @item line
  15803. @end table
  15804. Default is @code{line}.
  15805. @item slide
  15806. Set slide mode.
  15807. Available values for slide is:
  15808. @table @samp
  15809. @item frame
  15810. Draw new frame when right border is reached.
  15811. @item replace
  15812. Replace old columns with new ones.
  15813. @item scroll
  15814. Scroll from right to left.
  15815. @item rscroll
  15816. Scroll from left to right.
  15817. @item picture
  15818. Draw single picture.
  15819. @end table
  15820. Default is @code{frame}.
  15821. @item size
  15822. Set size of graph video. For the syntax of this option, check the
  15823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15824. The default value is @code{900x256}.
  15825. The foreground color expressions can use the following variables:
  15826. @table @option
  15827. @item MIN
  15828. Minimal value of metadata value.
  15829. @item MAX
  15830. Maximal value of metadata value.
  15831. @item VAL
  15832. Current metadata key value.
  15833. @end table
  15834. The color is defined as 0xAABBGGRR.
  15835. @end table
  15836. Example using metadata from @ref{signalstats} filter:
  15837. @example
  15838. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15839. @end example
  15840. Example using metadata from @ref{ebur128} filter:
  15841. @example
  15842. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15843. @end example
  15844. @anchor{ebur128}
  15845. @section ebur128
  15846. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15847. level. By default, it logs a message at a frequency of 10Hz with the
  15848. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15849. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15850. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15851. sample format is double-precision floating point. The input stream will be converted to
  15852. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15853. after this filter to obtain the original parameters.
  15854. The filter also has a video output (see the @var{video} option) with a real
  15855. time graph to observe the loudness evolution. The graphic contains the logged
  15856. message mentioned above, so it is not printed anymore when this option is set,
  15857. unless the verbose logging is set. The main graphing area contains the
  15858. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15859. the momentary loudness (400 milliseconds), but can optionally be configured
  15860. to instead display short-term loudness (see @var{gauge}).
  15861. The green area marks a +/- 1LU target range around the target loudness
  15862. (-23LUFS by default, unless modified through @var{target}).
  15863. More information about the Loudness Recommendation EBU R128 on
  15864. @url{http://tech.ebu.ch/loudness}.
  15865. The filter accepts the following options:
  15866. @table @option
  15867. @item video
  15868. Activate the video output. The audio stream is passed unchanged whether this
  15869. option is set or no. The video stream will be the first output stream if
  15870. activated. Default is @code{0}.
  15871. @item size
  15872. Set the video size. This option is for video only. For the syntax of this
  15873. option, check the
  15874. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15875. Default and minimum resolution is @code{640x480}.
  15876. @item meter
  15877. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15878. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15879. other integer value between this range is allowed.
  15880. @item metadata
  15881. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15882. into 100ms output frames, each of them containing various loudness information
  15883. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15884. Default is @code{0}.
  15885. @item framelog
  15886. Force the frame logging level.
  15887. Available values are:
  15888. @table @samp
  15889. @item info
  15890. information logging level
  15891. @item verbose
  15892. verbose logging level
  15893. @end table
  15894. By default, the logging level is set to @var{info}. If the @option{video} or
  15895. the @option{metadata} options are set, it switches to @var{verbose}.
  15896. @item peak
  15897. Set peak mode(s).
  15898. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15899. values are:
  15900. @table @samp
  15901. @item none
  15902. Disable any peak mode (default).
  15903. @item sample
  15904. Enable sample-peak mode.
  15905. Simple peak mode looking for the higher sample value. It logs a message
  15906. for sample-peak (identified by @code{SPK}).
  15907. @item true
  15908. Enable true-peak mode.
  15909. If enabled, the peak lookup is done on an over-sampled version of the input
  15910. stream for better peak accuracy. It logs a message for true-peak.
  15911. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15912. This mode requires a build with @code{libswresample}.
  15913. @end table
  15914. @item dualmono
  15915. Treat mono input files as "dual mono". If a mono file is intended for playback
  15916. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15917. If set to @code{true}, this option will compensate for this effect.
  15918. Multi-channel input files are not affected by this option.
  15919. @item panlaw
  15920. Set a specific pan law to be used for the measurement of dual mono files.
  15921. This parameter is optional, and has a default value of -3.01dB.
  15922. @item target
  15923. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15924. This parameter is optional and has a default value of -23LUFS as specified
  15925. by EBU R128. However, material published online may prefer a level of -16LUFS
  15926. (e.g. for use with podcasts or video platforms).
  15927. @item gauge
  15928. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15929. @code{shortterm}. By default the momentary value will be used, but in certain
  15930. scenarios it may be more useful to observe the short term value instead (e.g.
  15931. live mixing).
  15932. @item scale
  15933. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15934. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15935. video output, not the summary or continuous log output.
  15936. @end table
  15937. @subsection Examples
  15938. @itemize
  15939. @item
  15940. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15941. @example
  15942. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15943. @end example
  15944. @item
  15945. Run an analysis with @command{ffmpeg}:
  15946. @example
  15947. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15948. @end example
  15949. @end itemize
  15950. @section interleave, ainterleave
  15951. Temporally interleave frames from several inputs.
  15952. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15953. These filters read frames from several inputs and send the oldest
  15954. queued frame to the output.
  15955. Input streams must have well defined, monotonically increasing frame
  15956. timestamp values.
  15957. In order to submit one frame to output, these filters need to enqueue
  15958. at least one frame for each input, so they cannot work in case one
  15959. input is not yet terminated and will not receive incoming frames.
  15960. For example consider the case when one input is a @code{select} filter
  15961. which always drops input frames. The @code{interleave} filter will keep
  15962. reading from that input, but it will never be able to send new frames
  15963. to output until the input sends an end-of-stream signal.
  15964. Also, depending on inputs synchronization, the filters will drop
  15965. frames in case one input receives more frames than the other ones, and
  15966. the queue is already filled.
  15967. These filters accept the following options:
  15968. @table @option
  15969. @item nb_inputs, n
  15970. Set the number of different inputs, it is 2 by default.
  15971. @end table
  15972. @subsection Examples
  15973. @itemize
  15974. @item
  15975. Interleave frames belonging to different streams using @command{ffmpeg}:
  15976. @example
  15977. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15978. @end example
  15979. @item
  15980. Add flickering blur effect:
  15981. @example
  15982. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15983. @end example
  15984. @end itemize
  15985. @section metadata, ametadata
  15986. Manipulate frame metadata.
  15987. This filter accepts the following options:
  15988. @table @option
  15989. @item mode
  15990. Set mode of operation of the filter.
  15991. Can be one of the following:
  15992. @table @samp
  15993. @item select
  15994. If both @code{value} and @code{key} is set, select frames
  15995. which have such metadata. If only @code{key} is set, select
  15996. every frame that has such key in metadata.
  15997. @item add
  15998. Add new metadata @code{key} and @code{value}. If key is already available
  15999. do nothing.
  16000. @item modify
  16001. Modify value of already present key.
  16002. @item delete
  16003. If @code{value} is set, delete only keys that have such value.
  16004. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16005. the frame.
  16006. @item print
  16007. Print key and its value if metadata was found. If @code{key} is not set print all
  16008. metadata values available in frame.
  16009. @end table
  16010. @item key
  16011. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16012. @item value
  16013. Set metadata value which will be used. This option is mandatory for
  16014. @code{modify} and @code{add} mode.
  16015. @item function
  16016. Which function to use when comparing metadata value and @code{value}.
  16017. Can be one of following:
  16018. @table @samp
  16019. @item same_str
  16020. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16021. @item starts_with
  16022. Values are interpreted as strings, returns true if metadata value starts with
  16023. the @code{value} option string.
  16024. @item less
  16025. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16026. @item equal
  16027. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16028. @item greater
  16029. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16030. @item expr
  16031. Values are interpreted as floats, returns true if expression from option @code{expr}
  16032. evaluates to true.
  16033. @end table
  16034. @item expr
  16035. Set expression which is used when @code{function} is set to @code{expr}.
  16036. The expression is evaluated through the eval API and can contain the following
  16037. constants:
  16038. @table @option
  16039. @item VALUE1
  16040. Float representation of @code{value} from metadata key.
  16041. @item VALUE2
  16042. Float representation of @code{value} as supplied by user in @code{value} option.
  16043. @end table
  16044. @item file
  16045. If specified in @code{print} mode, output is written to the named file. Instead of
  16046. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16047. for standard output. If @code{file} option is not set, output is written to the log
  16048. with AV_LOG_INFO loglevel.
  16049. @end table
  16050. @subsection Examples
  16051. @itemize
  16052. @item
  16053. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16054. between 0 and 1.
  16055. @example
  16056. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16057. @end example
  16058. @item
  16059. Print silencedetect output to file @file{metadata.txt}.
  16060. @example
  16061. silencedetect,ametadata=mode=print:file=metadata.txt
  16062. @end example
  16063. @item
  16064. Direct all metadata to a pipe with file descriptor 4.
  16065. @example
  16066. metadata=mode=print:file='pipe\:4'
  16067. @end example
  16068. @end itemize
  16069. @section perms, aperms
  16070. Set read/write permissions for the output frames.
  16071. These filters are mainly aimed at developers to test direct path in the
  16072. following filter in the filtergraph.
  16073. The filters accept the following options:
  16074. @table @option
  16075. @item mode
  16076. Select the permissions mode.
  16077. It accepts the following values:
  16078. @table @samp
  16079. @item none
  16080. Do nothing. This is the default.
  16081. @item ro
  16082. Set all the output frames read-only.
  16083. @item rw
  16084. Set all the output frames directly writable.
  16085. @item toggle
  16086. Make the frame read-only if writable, and writable if read-only.
  16087. @item random
  16088. Set each output frame read-only or writable randomly.
  16089. @end table
  16090. @item seed
  16091. Set the seed for the @var{random} mode, must be an integer included between
  16092. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16093. @code{-1}, the filter will try to use a good random seed on a best effort
  16094. basis.
  16095. @end table
  16096. Note: in case of auto-inserted filter between the permission filter and the
  16097. following one, the permission might not be received as expected in that
  16098. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16099. perms/aperms filter can avoid this problem.
  16100. @section realtime, arealtime
  16101. Slow down filtering to match real time approximately.
  16102. These filters will pause the filtering for a variable amount of time to
  16103. match the output rate with the input timestamps.
  16104. They are similar to the @option{re} option to @code{ffmpeg}.
  16105. They accept the following options:
  16106. @table @option
  16107. @item limit
  16108. Time limit for the pauses. Any pause longer than that will be considered
  16109. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16110. @item speed
  16111. Speed factor for processing. The value must be a float larger than zero.
  16112. Values larger than 1.0 will result in faster than realtime processing,
  16113. smaller will slow processing down. The @var{limit} is automatically adapted
  16114. accordingly. Default is 1.0.
  16115. A processing speed faster than what is possible without these filters cannot
  16116. be achieved.
  16117. @end table
  16118. @anchor{select}
  16119. @section select, aselect
  16120. Select frames to pass in output.
  16121. This filter accepts the following options:
  16122. @table @option
  16123. @item expr, e
  16124. Set expression, which is evaluated for each input frame.
  16125. If the expression is evaluated to zero, the frame is discarded.
  16126. If the evaluation result is negative or NaN, the frame is sent to the
  16127. first output; otherwise it is sent to the output with index
  16128. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16129. For example a value of @code{1.2} corresponds to the output with index
  16130. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16131. @item outputs, n
  16132. Set the number of outputs. The output to which to send the selected
  16133. frame is based on the result of the evaluation. Default value is 1.
  16134. @end table
  16135. The expression can contain the following constants:
  16136. @table @option
  16137. @item n
  16138. The (sequential) number of the filtered frame, starting from 0.
  16139. @item selected_n
  16140. The (sequential) number of the selected frame, starting from 0.
  16141. @item prev_selected_n
  16142. The sequential number of the last selected frame. It's NAN if undefined.
  16143. @item TB
  16144. The timebase of the input timestamps.
  16145. @item pts
  16146. The PTS (Presentation TimeStamp) of the filtered video frame,
  16147. expressed in @var{TB} units. It's NAN if undefined.
  16148. @item t
  16149. The PTS of the filtered video frame,
  16150. expressed in seconds. It's NAN if undefined.
  16151. @item prev_pts
  16152. The PTS of the previously filtered video frame. It's NAN if undefined.
  16153. @item prev_selected_pts
  16154. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16155. @item prev_selected_t
  16156. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16157. @item start_pts
  16158. The PTS of the first video frame in the video. It's NAN if undefined.
  16159. @item start_t
  16160. The time of the first video frame in the video. It's NAN if undefined.
  16161. @item pict_type @emph{(video only)}
  16162. The type of the filtered frame. It can assume one of the following
  16163. values:
  16164. @table @option
  16165. @item I
  16166. @item P
  16167. @item B
  16168. @item S
  16169. @item SI
  16170. @item SP
  16171. @item BI
  16172. @end table
  16173. @item interlace_type @emph{(video only)}
  16174. The frame interlace type. It can assume one of the following values:
  16175. @table @option
  16176. @item PROGRESSIVE
  16177. The frame is progressive (not interlaced).
  16178. @item TOPFIRST
  16179. The frame is top-field-first.
  16180. @item BOTTOMFIRST
  16181. The frame is bottom-field-first.
  16182. @end table
  16183. @item consumed_sample_n @emph{(audio only)}
  16184. the number of selected samples before the current frame
  16185. @item samples_n @emph{(audio only)}
  16186. the number of samples in the current frame
  16187. @item sample_rate @emph{(audio only)}
  16188. the input sample rate
  16189. @item key
  16190. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16191. @item pos
  16192. the position in the file of the filtered frame, -1 if the information
  16193. is not available (e.g. for synthetic video)
  16194. @item scene @emph{(video only)}
  16195. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16196. probability for the current frame to introduce a new scene, while a higher
  16197. value means the current frame is more likely to be one (see the example below)
  16198. @item concatdec_select
  16199. The concat demuxer can select only part of a concat input file by setting an
  16200. inpoint and an outpoint, but the output packets may not be entirely contained
  16201. in the selected interval. By using this variable, it is possible to skip frames
  16202. generated by the concat demuxer which are not exactly contained in the selected
  16203. interval.
  16204. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16205. and the @var{lavf.concat.duration} packet metadata values which are also
  16206. present in the decoded frames.
  16207. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16208. start_time and either the duration metadata is missing or the frame pts is less
  16209. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16210. missing.
  16211. That basically means that an input frame is selected if its pts is within the
  16212. interval set by the concat demuxer.
  16213. @end table
  16214. The default value of the select expression is "1".
  16215. @subsection Examples
  16216. @itemize
  16217. @item
  16218. Select all frames in input:
  16219. @example
  16220. select
  16221. @end example
  16222. The example above is the same as:
  16223. @example
  16224. select=1
  16225. @end example
  16226. @item
  16227. Skip all frames:
  16228. @example
  16229. select=0
  16230. @end example
  16231. @item
  16232. Select only I-frames:
  16233. @example
  16234. select='eq(pict_type\,I)'
  16235. @end example
  16236. @item
  16237. Select one frame every 100:
  16238. @example
  16239. select='not(mod(n\,100))'
  16240. @end example
  16241. @item
  16242. Select only frames contained in the 10-20 time interval:
  16243. @example
  16244. select=between(t\,10\,20)
  16245. @end example
  16246. @item
  16247. Select only I-frames contained in the 10-20 time interval:
  16248. @example
  16249. select=between(t\,10\,20)*eq(pict_type\,I)
  16250. @end example
  16251. @item
  16252. Select frames with a minimum distance of 10 seconds:
  16253. @example
  16254. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16255. @end example
  16256. @item
  16257. Use aselect to select only audio frames with samples number > 100:
  16258. @example
  16259. aselect='gt(samples_n\,100)'
  16260. @end example
  16261. @item
  16262. Create a mosaic of the first scenes:
  16263. @example
  16264. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16265. @end example
  16266. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16267. choice.
  16268. @item
  16269. Send even and odd frames to separate outputs, and compose them:
  16270. @example
  16271. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16272. @end example
  16273. @item
  16274. Select useful frames from an ffconcat file which is using inpoints and
  16275. outpoints but where the source files are not intra frame only.
  16276. @example
  16277. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16278. @end example
  16279. @end itemize
  16280. @section sendcmd, asendcmd
  16281. Send commands to filters in the filtergraph.
  16282. These filters read commands to be sent to other filters in the
  16283. filtergraph.
  16284. @code{sendcmd} must be inserted between two video filters,
  16285. @code{asendcmd} must be inserted between two audio filters, but apart
  16286. from that they act the same way.
  16287. The specification of commands can be provided in the filter arguments
  16288. with the @var{commands} option, or in a file specified by the
  16289. @var{filename} option.
  16290. These filters accept the following options:
  16291. @table @option
  16292. @item commands, c
  16293. Set the commands to be read and sent to the other filters.
  16294. @item filename, f
  16295. Set the filename of the commands to be read and sent to the other
  16296. filters.
  16297. @end table
  16298. @subsection Commands syntax
  16299. A commands description consists of a sequence of interval
  16300. specifications, comprising a list of commands to be executed when a
  16301. particular event related to that interval occurs. The occurring event
  16302. is typically the current frame time entering or leaving a given time
  16303. interval.
  16304. An interval is specified by the following syntax:
  16305. @example
  16306. @var{START}[-@var{END}] @var{COMMANDS};
  16307. @end example
  16308. The time interval is specified by the @var{START} and @var{END} times.
  16309. @var{END} is optional and defaults to the maximum time.
  16310. The current frame time is considered within the specified interval if
  16311. it is included in the interval [@var{START}, @var{END}), that is when
  16312. the time is greater or equal to @var{START} and is lesser than
  16313. @var{END}.
  16314. @var{COMMANDS} consists of a sequence of one or more command
  16315. specifications, separated by ",", relating to that interval. The
  16316. syntax of a command specification is given by:
  16317. @example
  16318. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16319. @end example
  16320. @var{FLAGS} is optional and specifies the type of events relating to
  16321. the time interval which enable sending the specified command, and must
  16322. be a non-null sequence of identifier flags separated by "+" or "|" and
  16323. enclosed between "[" and "]".
  16324. The following flags are recognized:
  16325. @table @option
  16326. @item enter
  16327. The command is sent when the current frame timestamp enters the
  16328. specified interval. In other words, the command is sent when the
  16329. previous frame timestamp was not in the given interval, and the
  16330. current is.
  16331. @item leave
  16332. The command is sent when the current frame timestamp leaves the
  16333. specified interval. In other words, the command is sent when the
  16334. previous frame timestamp was in the given interval, and the
  16335. current is not.
  16336. @end table
  16337. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16338. assumed.
  16339. @var{TARGET} specifies the target of the command, usually the name of
  16340. the filter class or a specific filter instance name.
  16341. @var{COMMAND} specifies the name of the command for the target filter.
  16342. @var{ARG} is optional and specifies the optional list of argument for
  16343. the given @var{COMMAND}.
  16344. Between one interval specification and another, whitespaces, or
  16345. sequences of characters starting with @code{#} until the end of line,
  16346. are ignored and can be used to annotate comments.
  16347. A simplified BNF description of the commands specification syntax
  16348. follows:
  16349. @example
  16350. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16351. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16352. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16353. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16354. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16355. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16356. @end example
  16357. @subsection Examples
  16358. @itemize
  16359. @item
  16360. Specify audio tempo change at second 4:
  16361. @example
  16362. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16363. @end example
  16364. @item
  16365. Target a specific filter instance:
  16366. @example
  16367. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16368. @end example
  16369. @item
  16370. Specify a list of drawtext and hue commands in a file.
  16371. @example
  16372. # show text in the interval 5-10
  16373. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16374. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16375. # desaturate the image in the interval 15-20
  16376. 15.0-20.0 [enter] hue s 0,
  16377. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16378. [leave] hue s 1,
  16379. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16380. # apply an exponential saturation fade-out effect, starting from time 25
  16381. 25 [enter] hue s exp(25-t)
  16382. @end example
  16383. A filtergraph allowing to read and process the above command list
  16384. stored in a file @file{test.cmd}, can be specified with:
  16385. @example
  16386. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16387. @end example
  16388. @end itemize
  16389. @anchor{setpts}
  16390. @section setpts, asetpts
  16391. Change the PTS (presentation timestamp) of the input frames.
  16392. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16393. This filter accepts the following options:
  16394. @table @option
  16395. @item expr
  16396. The expression which is evaluated for each frame to construct its timestamp.
  16397. @end table
  16398. The expression is evaluated through the eval API and can contain the following
  16399. constants:
  16400. @table @option
  16401. @item FRAME_RATE, FR
  16402. frame rate, only defined for constant frame-rate video
  16403. @item PTS
  16404. The presentation timestamp in input
  16405. @item N
  16406. The count of the input frame for video or the number of consumed samples,
  16407. not including the current frame for audio, starting from 0.
  16408. @item NB_CONSUMED_SAMPLES
  16409. The number of consumed samples, not including the current frame (only
  16410. audio)
  16411. @item NB_SAMPLES, S
  16412. The number of samples in the current frame (only audio)
  16413. @item SAMPLE_RATE, SR
  16414. The audio sample rate.
  16415. @item STARTPTS
  16416. The PTS of the first frame.
  16417. @item STARTT
  16418. the time in seconds of the first frame
  16419. @item INTERLACED
  16420. State whether the current frame is interlaced.
  16421. @item T
  16422. the time in seconds of the current frame
  16423. @item POS
  16424. original position in the file of the frame, or undefined if undefined
  16425. for the current frame
  16426. @item PREV_INPTS
  16427. The previous input PTS.
  16428. @item PREV_INT
  16429. previous input time in seconds
  16430. @item PREV_OUTPTS
  16431. The previous output PTS.
  16432. @item PREV_OUTT
  16433. previous output time in seconds
  16434. @item RTCTIME
  16435. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16436. instead.
  16437. @item RTCSTART
  16438. The wallclock (RTC) time at the start of the movie in microseconds.
  16439. @item TB
  16440. The timebase of the input timestamps.
  16441. @end table
  16442. @subsection Examples
  16443. @itemize
  16444. @item
  16445. Start counting PTS from zero
  16446. @example
  16447. setpts=PTS-STARTPTS
  16448. @end example
  16449. @item
  16450. Apply fast motion effect:
  16451. @example
  16452. setpts=0.5*PTS
  16453. @end example
  16454. @item
  16455. Apply slow motion effect:
  16456. @example
  16457. setpts=2.0*PTS
  16458. @end example
  16459. @item
  16460. Set fixed rate of 25 frames per second:
  16461. @example
  16462. setpts=N/(25*TB)
  16463. @end example
  16464. @item
  16465. Set fixed rate 25 fps with some jitter:
  16466. @example
  16467. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16468. @end example
  16469. @item
  16470. Apply an offset of 10 seconds to the input PTS:
  16471. @example
  16472. setpts=PTS+10/TB
  16473. @end example
  16474. @item
  16475. Generate timestamps from a "live source" and rebase onto the current timebase:
  16476. @example
  16477. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16478. @end example
  16479. @item
  16480. Generate timestamps by counting samples:
  16481. @example
  16482. asetpts=N/SR/TB
  16483. @end example
  16484. @end itemize
  16485. @section setrange
  16486. Force color range for the output video frame.
  16487. The @code{setrange} filter marks the color range property for the
  16488. output frames. It does not change the input frame, but only sets the
  16489. corresponding property, which affects how the frame is treated by
  16490. following filters.
  16491. The filter accepts the following options:
  16492. @table @option
  16493. @item range
  16494. Available values are:
  16495. @table @samp
  16496. @item auto
  16497. Keep the same color range property.
  16498. @item unspecified, unknown
  16499. Set the color range as unspecified.
  16500. @item limited, tv, mpeg
  16501. Set the color range as limited.
  16502. @item full, pc, jpeg
  16503. Set the color range as full.
  16504. @end table
  16505. @end table
  16506. @section settb, asettb
  16507. Set the timebase to use for the output frames timestamps.
  16508. It is mainly useful for testing timebase configuration.
  16509. It accepts the following parameters:
  16510. @table @option
  16511. @item expr, tb
  16512. The expression which is evaluated into the output timebase.
  16513. @end table
  16514. The value for @option{tb} is an arithmetic expression representing a
  16515. rational. The expression can contain the constants "AVTB" (the default
  16516. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16517. audio only). Default value is "intb".
  16518. @subsection Examples
  16519. @itemize
  16520. @item
  16521. Set the timebase to 1/25:
  16522. @example
  16523. settb=expr=1/25
  16524. @end example
  16525. @item
  16526. Set the timebase to 1/10:
  16527. @example
  16528. settb=expr=0.1
  16529. @end example
  16530. @item
  16531. Set the timebase to 1001/1000:
  16532. @example
  16533. settb=1+0.001
  16534. @end example
  16535. @item
  16536. Set the timebase to 2*intb:
  16537. @example
  16538. settb=2*intb
  16539. @end example
  16540. @item
  16541. Set the default timebase value:
  16542. @example
  16543. settb=AVTB
  16544. @end example
  16545. @end itemize
  16546. @section showcqt
  16547. Convert input audio to a video output representing frequency spectrum
  16548. logarithmically using Brown-Puckette constant Q transform algorithm with
  16549. direct frequency domain coefficient calculation (but the transform itself
  16550. is not really constant Q, instead the Q factor is actually variable/clamped),
  16551. with musical tone scale, from E0 to D#10.
  16552. The filter accepts the following options:
  16553. @table @option
  16554. @item size, s
  16555. Specify the video size for the output. It must be even. For the syntax of this option,
  16556. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16557. Default value is @code{1920x1080}.
  16558. @item fps, rate, r
  16559. Set the output frame rate. Default value is @code{25}.
  16560. @item bar_h
  16561. Set the bargraph height. It must be even. Default value is @code{-1} which
  16562. computes the bargraph height automatically.
  16563. @item axis_h
  16564. Set the axis height. It must be even. Default value is @code{-1} which computes
  16565. the axis height automatically.
  16566. @item sono_h
  16567. Set the sonogram height. It must be even. Default value is @code{-1} which
  16568. computes the sonogram height automatically.
  16569. @item fullhd
  16570. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16571. instead. Default value is @code{1}.
  16572. @item sono_v, volume
  16573. Specify the sonogram volume expression. It can contain variables:
  16574. @table @option
  16575. @item bar_v
  16576. the @var{bar_v} evaluated expression
  16577. @item frequency, freq, f
  16578. the frequency where it is evaluated
  16579. @item timeclamp, tc
  16580. the value of @var{timeclamp} option
  16581. @end table
  16582. and functions:
  16583. @table @option
  16584. @item a_weighting(f)
  16585. A-weighting of equal loudness
  16586. @item b_weighting(f)
  16587. B-weighting of equal loudness
  16588. @item c_weighting(f)
  16589. C-weighting of equal loudness.
  16590. @end table
  16591. Default value is @code{16}.
  16592. @item bar_v, volume2
  16593. Specify the bargraph volume expression. It can contain variables:
  16594. @table @option
  16595. @item sono_v
  16596. the @var{sono_v} evaluated expression
  16597. @item frequency, freq, f
  16598. the frequency where it is evaluated
  16599. @item timeclamp, tc
  16600. the value of @var{timeclamp} option
  16601. @end table
  16602. and functions:
  16603. @table @option
  16604. @item a_weighting(f)
  16605. A-weighting of equal loudness
  16606. @item b_weighting(f)
  16607. B-weighting of equal loudness
  16608. @item c_weighting(f)
  16609. C-weighting of equal loudness.
  16610. @end table
  16611. Default value is @code{sono_v}.
  16612. @item sono_g, gamma
  16613. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16614. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16615. Acceptable range is @code{[1, 7]}.
  16616. @item bar_g, gamma2
  16617. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16618. @code{[1, 7]}.
  16619. @item bar_t
  16620. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16621. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16622. @item timeclamp, tc
  16623. Specify the transform timeclamp. At low frequency, there is trade-off between
  16624. accuracy in time domain and frequency domain. If timeclamp is lower,
  16625. event in time domain is represented more accurately (such as fast bass drum),
  16626. otherwise event in frequency domain is represented more accurately
  16627. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16628. @item attack
  16629. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16630. limits future samples by applying asymmetric windowing in time domain, useful
  16631. when low latency is required. Accepted range is @code{[0, 1]}.
  16632. @item basefreq
  16633. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16634. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16635. @item endfreq
  16636. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16637. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16638. @item coeffclamp
  16639. This option is deprecated and ignored.
  16640. @item tlength
  16641. Specify the transform length in time domain. Use this option to control accuracy
  16642. trade-off between time domain and frequency domain at every frequency sample.
  16643. It can contain variables:
  16644. @table @option
  16645. @item frequency, freq, f
  16646. the frequency where it is evaluated
  16647. @item timeclamp, tc
  16648. the value of @var{timeclamp} option.
  16649. @end table
  16650. Default value is @code{384*tc/(384+tc*f)}.
  16651. @item count
  16652. Specify the transform count for every video frame. Default value is @code{6}.
  16653. Acceptable range is @code{[1, 30]}.
  16654. @item fcount
  16655. Specify the transform count for every single pixel. Default value is @code{0},
  16656. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16657. @item fontfile
  16658. Specify font file for use with freetype to draw the axis. If not specified,
  16659. use embedded font. Note that drawing with font file or embedded font is not
  16660. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16661. option instead.
  16662. @item font
  16663. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16664. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16665. @item fontcolor
  16666. Specify font color expression. This is arithmetic expression that should return
  16667. integer value 0xRRGGBB. It can contain variables:
  16668. @table @option
  16669. @item frequency, freq, f
  16670. the frequency where it is evaluated
  16671. @item timeclamp, tc
  16672. the value of @var{timeclamp} option
  16673. @end table
  16674. and functions:
  16675. @table @option
  16676. @item midi(f)
  16677. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16678. @item r(x), g(x), b(x)
  16679. red, green, and blue value of intensity x.
  16680. @end table
  16681. Default value is @code{st(0, (midi(f)-59.5)/12);
  16682. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16683. r(1-ld(1)) + b(ld(1))}.
  16684. @item axisfile
  16685. Specify image file to draw the axis. This option override @var{fontfile} and
  16686. @var{fontcolor} option.
  16687. @item axis, text
  16688. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16689. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16690. Default value is @code{1}.
  16691. @item csp
  16692. Set colorspace. The accepted values are:
  16693. @table @samp
  16694. @item unspecified
  16695. Unspecified (default)
  16696. @item bt709
  16697. BT.709
  16698. @item fcc
  16699. FCC
  16700. @item bt470bg
  16701. BT.470BG or BT.601-6 625
  16702. @item smpte170m
  16703. SMPTE-170M or BT.601-6 525
  16704. @item smpte240m
  16705. SMPTE-240M
  16706. @item bt2020ncl
  16707. BT.2020 with non-constant luminance
  16708. @end table
  16709. @item cscheme
  16710. Set spectrogram color scheme. This is list of floating point values with format
  16711. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16712. The default is @code{1|0.5|0|0|0.5|1}.
  16713. @end table
  16714. @subsection Examples
  16715. @itemize
  16716. @item
  16717. Playing audio while showing the spectrum:
  16718. @example
  16719. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16720. @end example
  16721. @item
  16722. Same as above, but with frame rate 30 fps:
  16723. @example
  16724. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16725. @end example
  16726. @item
  16727. Playing at 1280x720:
  16728. @example
  16729. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16730. @end example
  16731. @item
  16732. Disable sonogram display:
  16733. @example
  16734. sono_h=0
  16735. @end example
  16736. @item
  16737. A1 and its harmonics: A1, A2, (near)E3, A3:
  16738. @example
  16739. 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),
  16740. asplit[a][out1]; [a] showcqt [out0]'
  16741. @end example
  16742. @item
  16743. Same as above, but with more accuracy in frequency domain:
  16744. @example
  16745. 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),
  16746. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16747. @end example
  16748. @item
  16749. Custom volume:
  16750. @example
  16751. bar_v=10:sono_v=bar_v*a_weighting(f)
  16752. @end example
  16753. @item
  16754. Custom gamma, now spectrum is linear to the amplitude.
  16755. @example
  16756. bar_g=2:sono_g=2
  16757. @end example
  16758. @item
  16759. Custom tlength equation:
  16760. @example
  16761. 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)))'
  16762. @end example
  16763. @item
  16764. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16765. @example
  16766. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16767. @end example
  16768. @item
  16769. Custom font using fontconfig:
  16770. @example
  16771. font='Courier New,Monospace,mono|bold'
  16772. @end example
  16773. @item
  16774. Custom frequency range with custom axis using image file:
  16775. @example
  16776. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16777. @end example
  16778. @end itemize
  16779. @section showfreqs
  16780. Convert input audio to video output representing the audio power spectrum.
  16781. Audio amplitude is on Y-axis while frequency is on X-axis.
  16782. The filter accepts the following options:
  16783. @table @option
  16784. @item size, s
  16785. Specify size of video. For the syntax of this option, check the
  16786. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16787. Default is @code{1024x512}.
  16788. @item mode
  16789. Set display mode.
  16790. This set how each frequency bin will be represented.
  16791. It accepts the following values:
  16792. @table @samp
  16793. @item line
  16794. @item bar
  16795. @item dot
  16796. @end table
  16797. Default is @code{bar}.
  16798. @item ascale
  16799. Set amplitude scale.
  16800. It accepts the following values:
  16801. @table @samp
  16802. @item lin
  16803. Linear scale.
  16804. @item sqrt
  16805. Square root scale.
  16806. @item cbrt
  16807. Cubic root scale.
  16808. @item log
  16809. Logarithmic scale.
  16810. @end table
  16811. Default is @code{log}.
  16812. @item fscale
  16813. Set frequency scale.
  16814. It accepts the following values:
  16815. @table @samp
  16816. @item lin
  16817. Linear scale.
  16818. @item log
  16819. Logarithmic scale.
  16820. @item rlog
  16821. Reverse logarithmic scale.
  16822. @end table
  16823. Default is @code{lin}.
  16824. @item win_size
  16825. Set window size.
  16826. It accepts the following values:
  16827. @table @samp
  16828. @item w16
  16829. @item w32
  16830. @item w64
  16831. @item w128
  16832. @item w256
  16833. @item w512
  16834. @item w1024
  16835. @item w2048
  16836. @item w4096
  16837. @item w8192
  16838. @item w16384
  16839. @item w32768
  16840. @item w65536
  16841. @end table
  16842. Default is @code{w2048}
  16843. @item win_func
  16844. Set windowing function.
  16845. It accepts the following values:
  16846. @table @samp
  16847. @item rect
  16848. @item bartlett
  16849. @item hanning
  16850. @item hamming
  16851. @item blackman
  16852. @item welch
  16853. @item flattop
  16854. @item bharris
  16855. @item bnuttall
  16856. @item bhann
  16857. @item sine
  16858. @item nuttall
  16859. @item lanczos
  16860. @item gauss
  16861. @item tukey
  16862. @item dolph
  16863. @item cauchy
  16864. @item parzen
  16865. @item poisson
  16866. @item bohman
  16867. @end table
  16868. Default is @code{hanning}.
  16869. @item overlap
  16870. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16871. which means optimal overlap for selected window function will be picked.
  16872. @item averaging
  16873. Set time averaging. Setting this to 0 will display current maximal peaks.
  16874. Default is @code{1}, which means time averaging is disabled.
  16875. @item colors
  16876. Specify list of colors separated by space or by '|' which will be used to
  16877. draw channel frequencies. Unrecognized or missing colors will be replaced
  16878. by white color.
  16879. @item cmode
  16880. Set channel display mode.
  16881. It accepts the following values:
  16882. @table @samp
  16883. @item combined
  16884. @item separate
  16885. @end table
  16886. Default is @code{combined}.
  16887. @item minamp
  16888. Set minimum amplitude used in @code{log} amplitude scaler.
  16889. @end table
  16890. @anchor{showspectrum}
  16891. @section showspectrum
  16892. Convert input audio to a video output, representing the audio frequency
  16893. spectrum.
  16894. The filter accepts the following options:
  16895. @table @option
  16896. @item size, s
  16897. Specify the video size for the output. For the syntax of this option, check the
  16898. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16899. Default value is @code{640x512}.
  16900. @item slide
  16901. Specify how the spectrum should slide along the window.
  16902. It accepts the following values:
  16903. @table @samp
  16904. @item replace
  16905. the samples start again on the left when they reach the right
  16906. @item scroll
  16907. the samples scroll from right to left
  16908. @item fullframe
  16909. frames are only produced when the samples reach the right
  16910. @item rscroll
  16911. the samples scroll from left to right
  16912. @end table
  16913. Default value is @code{replace}.
  16914. @item mode
  16915. Specify display mode.
  16916. It accepts the following values:
  16917. @table @samp
  16918. @item combined
  16919. all channels are displayed in the same row
  16920. @item separate
  16921. all channels are displayed in separate rows
  16922. @end table
  16923. Default value is @samp{combined}.
  16924. @item color
  16925. Specify display color mode.
  16926. It accepts the following values:
  16927. @table @samp
  16928. @item channel
  16929. each channel is displayed in a separate color
  16930. @item intensity
  16931. each channel is displayed using the same color scheme
  16932. @item rainbow
  16933. each channel is displayed using the rainbow color scheme
  16934. @item moreland
  16935. each channel is displayed using the moreland color scheme
  16936. @item nebulae
  16937. each channel is displayed using the nebulae color scheme
  16938. @item fire
  16939. each channel is displayed using the fire color scheme
  16940. @item fiery
  16941. each channel is displayed using the fiery color scheme
  16942. @item fruit
  16943. each channel is displayed using the fruit color scheme
  16944. @item cool
  16945. each channel is displayed using the cool color scheme
  16946. @item magma
  16947. each channel is displayed using the magma color scheme
  16948. @item green
  16949. each channel is displayed using the green color scheme
  16950. @item viridis
  16951. each channel is displayed using the viridis color scheme
  16952. @item plasma
  16953. each channel is displayed using the plasma color scheme
  16954. @item cividis
  16955. each channel is displayed using the cividis color scheme
  16956. @item terrain
  16957. each channel is displayed using the terrain color scheme
  16958. @end table
  16959. Default value is @samp{channel}.
  16960. @item scale
  16961. Specify scale used for calculating intensity color values.
  16962. It accepts the following values:
  16963. @table @samp
  16964. @item lin
  16965. linear
  16966. @item sqrt
  16967. square root, default
  16968. @item cbrt
  16969. cubic root
  16970. @item log
  16971. logarithmic
  16972. @item 4thrt
  16973. 4th root
  16974. @item 5thrt
  16975. 5th root
  16976. @end table
  16977. Default value is @samp{sqrt}.
  16978. @item fscale
  16979. Specify frequency scale.
  16980. It accepts the following values:
  16981. @table @samp
  16982. @item lin
  16983. linear
  16984. @item log
  16985. logarithmic
  16986. @end table
  16987. Default value is @samp{lin}.
  16988. @item saturation
  16989. Set saturation modifier for displayed colors. Negative values provide
  16990. alternative color scheme. @code{0} is no saturation at all.
  16991. Saturation must be in [-10.0, 10.0] range.
  16992. Default value is @code{1}.
  16993. @item win_func
  16994. Set window function.
  16995. It accepts the following values:
  16996. @table @samp
  16997. @item rect
  16998. @item bartlett
  16999. @item hann
  17000. @item hanning
  17001. @item hamming
  17002. @item blackman
  17003. @item welch
  17004. @item flattop
  17005. @item bharris
  17006. @item bnuttall
  17007. @item bhann
  17008. @item sine
  17009. @item nuttall
  17010. @item lanczos
  17011. @item gauss
  17012. @item tukey
  17013. @item dolph
  17014. @item cauchy
  17015. @item parzen
  17016. @item poisson
  17017. @item bohman
  17018. @end table
  17019. Default value is @code{hann}.
  17020. @item orientation
  17021. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17022. @code{horizontal}. Default is @code{vertical}.
  17023. @item overlap
  17024. Set ratio of overlap window. Default value is @code{0}.
  17025. When value is @code{1} overlap is set to recommended size for specific
  17026. window function currently used.
  17027. @item gain
  17028. Set scale gain for calculating intensity color values.
  17029. Default value is @code{1}.
  17030. @item data
  17031. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17032. @item rotation
  17033. Set color rotation, must be in [-1.0, 1.0] range.
  17034. Default value is @code{0}.
  17035. @item start
  17036. Set start frequency from which to display spectrogram. Default is @code{0}.
  17037. @item stop
  17038. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17039. @item fps
  17040. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17041. @item legend
  17042. Draw time and frequency axes and legends. Default is disabled.
  17043. @end table
  17044. The usage is very similar to the showwaves filter; see the examples in that
  17045. section.
  17046. @subsection Examples
  17047. @itemize
  17048. @item
  17049. Large window with logarithmic color scaling:
  17050. @example
  17051. showspectrum=s=1280x480:scale=log
  17052. @end example
  17053. @item
  17054. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17055. @example
  17056. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17057. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17058. @end example
  17059. @end itemize
  17060. @section showspectrumpic
  17061. Convert input audio to a single video frame, representing the audio frequency
  17062. spectrum.
  17063. The filter accepts the following options:
  17064. @table @option
  17065. @item size, s
  17066. Specify the video size for the output. For the syntax of this option, check the
  17067. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17068. Default value is @code{4096x2048}.
  17069. @item mode
  17070. Specify display mode.
  17071. It accepts the following values:
  17072. @table @samp
  17073. @item combined
  17074. all channels are displayed in the same row
  17075. @item separate
  17076. all channels are displayed in separate rows
  17077. @end table
  17078. Default value is @samp{combined}.
  17079. @item color
  17080. Specify display color mode.
  17081. It accepts the following values:
  17082. @table @samp
  17083. @item channel
  17084. each channel is displayed in a separate color
  17085. @item intensity
  17086. each channel is displayed using the same color scheme
  17087. @item rainbow
  17088. each channel is displayed using the rainbow color scheme
  17089. @item moreland
  17090. each channel is displayed using the moreland color scheme
  17091. @item nebulae
  17092. each channel is displayed using the nebulae color scheme
  17093. @item fire
  17094. each channel is displayed using the fire color scheme
  17095. @item fiery
  17096. each channel is displayed using the fiery color scheme
  17097. @item fruit
  17098. each channel is displayed using the fruit color scheme
  17099. @item cool
  17100. each channel is displayed using the cool color scheme
  17101. @item magma
  17102. each channel is displayed using the magma color scheme
  17103. @item green
  17104. each channel is displayed using the green color scheme
  17105. @item viridis
  17106. each channel is displayed using the viridis color scheme
  17107. @item plasma
  17108. each channel is displayed using the plasma color scheme
  17109. @item cividis
  17110. each channel is displayed using the cividis color scheme
  17111. @item terrain
  17112. each channel is displayed using the terrain color scheme
  17113. @end table
  17114. Default value is @samp{intensity}.
  17115. @item scale
  17116. Specify scale used for calculating intensity color values.
  17117. It accepts the following values:
  17118. @table @samp
  17119. @item lin
  17120. linear
  17121. @item sqrt
  17122. square root, default
  17123. @item cbrt
  17124. cubic root
  17125. @item log
  17126. logarithmic
  17127. @item 4thrt
  17128. 4th root
  17129. @item 5thrt
  17130. 5th root
  17131. @end table
  17132. Default value is @samp{log}.
  17133. @item fscale
  17134. Specify frequency scale.
  17135. It accepts the following values:
  17136. @table @samp
  17137. @item lin
  17138. linear
  17139. @item log
  17140. logarithmic
  17141. @end table
  17142. Default value is @samp{lin}.
  17143. @item saturation
  17144. Set saturation modifier for displayed colors. Negative values provide
  17145. alternative color scheme. @code{0} is no saturation at all.
  17146. Saturation must be in [-10.0, 10.0] range.
  17147. Default value is @code{1}.
  17148. @item win_func
  17149. Set window function.
  17150. It accepts the following values:
  17151. @table @samp
  17152. @item rect
  17153. @item bartlett
  17154. @item hann
  17155. @item hanning
  17156. @item hamming
  17157. @item blackman
  17158. @item welch
  17159. @item flattop
  17160. @item bharris
  17161. @item bnuttall
  17162. @item bhann
  17163. @item sine
  17164. @item nuttall
  17165. @item lanczos
  17166. @item gauss
  17167. @item tukey
  17168. @item dolph
  17169. @item cauchy
  17170. @item parzen
  17171. @item poisson
  17172. @item bohman
  17173. @end table
  17174. Default value is @code{hann}.
  17175. @item orientation
  17176. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17177. @code{horizontal}. Default is @code{vertical}.
  17178. @item gain
  17179. Set scale gain for calculating intensity color values.
  17180. Default value is @code{1}.
  17181. @item legend
  17182. Draw time and frequency axes and legends. Default is enabled.
  17183. @item rotation
  17184. Set color rotation, must be in [-1.0, 1.0] range.
  17185. Default value is @code{0}.
  17186. @item start
  17187. Set start frequency from which to display spectrogram. Default is @code{0}.
  17188. @item stop
  17189. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17190. @end table
  17191. @subsection Examples
  17192. @itemize
  17193. @item
  17194. Extract an audio spectrogram of a whole audio track
  17195. in a 1024x1024 picture using @command{ffmpeg}:
  17196. @example
  17197. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17198. @end example
  17199. @end itemize
  17200. @section showvolume
  17201. Convert input audio volume to a video output.
  17202. The filter accepts the following options:
  17203. @table @option
  17204. @item rate, r
  17205. Set video rate.
  17206. @item b
  17207. Set border width, allowed range is [0, 5]. Default is 1.
  17208. @item w
  17209. Set channel width, allowed range is [80, 8192]. Default is 400.
  17210. @item h
  17211. Set channel height, allowed range is [1, 900]. Default is 20.
  17212. @item f
  17213. Set fade, allowed range is [0, 1]. Default is 0.95.
  17214. @item c
  17215. Set volume color expression.
  17216. The expression can use the following variables:
  17217. @table @option
  17218. @item VOLUME
  17219. Current max volume of channel in dB.
  17220. @item PEAK
  17221. Current peak.
  17222. @item CHANNEL
  17223. Current channel number, starting from 0.
  17224. @end table
  17225. @item t
  17226. If set, displays channel names. Default is enabled.
  17227. @item v
  17228. If set, displays volume values. Default is enabled.
  17229. @item o
  17230. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17231. default is @code{h}.
  17232. @item s
  17233. Set step size, allowed range is [0, 5]. Default is 0, which means
  17234. step is disabled.
  17235. @item p
  17236. Set background opacity, allowed range is [0, 1]. Default is 0.
  17237. @item m
  17238. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17239. default is @code{p}.
  17240. @item ds
  17241. Set display scale, can be linear: @code{lin} or log: @code{log},
  17242. default is @code{lin}.
  17243. @item dm
  17244. In second.
  17245. If set to > 0., display a line for the max level
  17246. in the previous seconds.
  17247. default is disabled: @code{0.}
  17248. @item dmc
  17249. The color of the max line. Use when @code{dm} option is set to > 0.
  17250. default is: @code{orange}
  17251. @end table
  17252. @section showwaves
  17253. Convert input audio to a video output, representing the samples waves.
  17254. The filter accepts the following options:
  17255. @table @option
  17256. @item size, s
  17257. Specify the video size for the output. For the syntax of this option, check the
  17258. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17259. Default value is @code{600x240}.
  17260. @item mode
  17261. Set display mode.
  17262. Available values are:
  17263. @table @samp
  17264. @item point
  17265. Draw a point for each sample.
  17266. @item line
  17267. Draw a vertical line for each sample.
  17268. @item p2p
  17269. Draw a point for each sample and a line between them.
  17270. @item cline
  17271. Draw a centered vertical line for each sample.
  17272. @end table
  17273. Default value is @code{point}.
  17274. @item n
  17275. Set the number of samples which are printed on the same column. A
  17276. larger value will decrease the frame rate. Must be a positive
  17277. integer. This option can be set only if the value for @var{rate}
  17278. is not explicitly specified.
  17279. @item rate, r
  17280. Set the (approximate) output frame rate. This is done by setting the
  17281. option @var{n}. Default value is "25".
  17282. @item split_channels
  17283. Set if channels should be drawn separately or overlap. Default value is 0.
  17284. @item colors
  17285. Set colors separated by '|' which are going to be used for drawing of each channel.
  17286. @item scale
  17287. Set amplitude scale.
  17288. Available values are:
  17289. @table @samp
  17290. @item lin
  17291. Linear.
  17292. @item log
  17293. Logarithmic.
  17294. @item sqrt
  17295. Square root.
  17296. @item cbrt
  17297. Cubic root.
  17298. @end table
  17299. Default is linear.
  17300. @item draw
  17301. Set the draw mode. This is mostly useful to set for high @var{n}.
  17302. Available values are:
  17303. @table @samp
  17304. @item scale
  17305. Scale pixel values for each drawn sample.
  17306. @item full
  17307. Draw every sample directly.
  17308. @end table
  17309. Default value is @code{scale}.
  17310. @end table
  17311. @subsection Examples
  17312. @itemize
  17313. @item
  17314. Output the input file audio and the corresponding video representation
  17315. at the same time:
  17316. @example
  17317. amovie=a.mp3,asplit[out0],showwaves[out1]
  17318. @end example
  17319. @item
  17320. Create a synthetic signal and show it with showwaves, forcing a
  17321. frame rate of 30 frames per second:
  17322. @example
  17323. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17324. @end example
  17325. @end itemize
  17326. @section showwavespic
  17327. Convert input audio to a single video frame, representing the samples waves.
  17328. The filter accepts the following options:
  17329. @table @option
  17330. @item size, s
  17331. Specify the video size for the output. For the syntax of this option, check the
  17332. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17333. Default value is @code{600x240}.
  17334. @item split_channels
  17335. Set if channels should be drawn separately or overlap. Default value is 0.
  17336. @item colors
  17337. Set colors separated by '|' which are going to be used for drawing of each channel.
  17338. @item scale
  17339. Set amplitude scale.
  17340. Available values are:
  17341. @table @samp
  17342. @item lin
  17343. Linear.
  17344. @item log
  17345. Logarithmic.
  17346. @item sqrt
  17347. Square root.
  17348. @item cbrt
  17349. Cubic root.
  17350. @end table
  17351. Default is linear.
  17352. @item draw
  17353. Set the draw mode.
  17354. Available values are:
  17355. @table @samp
  17356. @item scale
  17357. Scale pixel values for each drawn sample.
  17358. @item full
  17359. Draw every sample directly.
  17360. @end table
  17361. Default value is @code{scale}.
  17362. @end table
  17363. @subsection Examples
  17364. @itemize
  17365. @item
  17366. Extract a channel split representation of the wave form of a whole audio track
  17367. in a 1024x800 picture using @command{ffmpeg}:
  17368. @example
  17369. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17370. @end example
  17371. @end itemize
  17372. @section sidedata, asidedata
  17373. Delete frame side data, or select frames based on it.
  17374. This filter accepts the following options:
  17375. @table @option
  17376. @item mode
  17377. Set mode of operation of the filter.
  17378. Can be one of the following:
  17379. @table @samp
  17380. @item select
  17381. Select every frame with side data of @code{type}.
  17382. @item delete
  17383. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17384. data in the frame.
  17385. @end table
  17386. @item type
  17387. Set side data type used with all modes. Must be set for @code{select} mode. For
  17388. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17389. in @file{libavutil/frame.h}. For example, to choose
  17390. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17391. @end table
  17392. @section spectrumsynth
  17393. Sythesize audio from 2 input video spectrums, first input stream represents
  17394. magnitude across time and second represents phase across time.
  17395. The filter will transform from frequency domain as displayed in videos back
  17396. to time domain as presented in audio output.
  17397. This filter is primarily created for reversing processed @ref{showspectrum}
  17398. filter outputs, but can synthesize sound from other spectrograms too.
  17399. But in such case results are going to be poor if the phase data is not
  17400. available, because in such cases phase data need to be recreated, usually
  17401. it's just recreated from random noise.
  17402. For best results use gray only output (@code{channel} color mode in
  17403. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17404. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17405. @code{data} option. Inputs videos should generally use @code{fullframe}
  17406. slide mode as that saves resources needed for decoding video.
  17407. The filter accepts the following options:
  17408. @table @option
  17409. @item sample_rate
  17410. Specify sample rate of output audio, the sample rate of audio from which
  17411. spectrum was generated may differ.
  17412. @item channels
  17413. Set number of channels represented in input video spectrums.
  17414. @item scale
  17415. Set scale which was used when generating magnitude input spectrum.
  17416. Can be @code{lin} or @code{log}. Default is @code{log}.
  17417. @item slide
  17418. Set slide which was used when generating inputs spectrums.
  17419. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17420. Default is @code{fullframe}.
  17421. @item win_func
  17422. Set window function used for resynthesis.
  17423. @item overlap
  17424. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17425. which means optimal overlap for selected window function will be picked.
  17426. @item orientation
  17427. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17428. Default is @code{vertical}.
  17429. @end table
  17430. @subsection Examples
  17431. @itemize
  17432. @item
  17433. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17434. then resynthesize videos back to audio with spectrumsynth:
  17435. @example
  17436. 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
  17437. 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
  17438. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17439. @end example
  17440. @end itemize
  17441. @section split, asplit
  17442. Split input into several identical outputs.
  17443. @code{asplit} works with audio input, @code{split} with video.
  17444. The filter accepts a single parameter which specifies the number of outputs. If
  17445. unspecified, it defaults to 2.
  17446. @subsection Examples
  17447. @itemize
  17448. @item
  17449. Create two separate outputs from the same input:
  17450. @example
  17451. [in] split [out0][out1]
  17452. @end example
  17453. @item
  17454. To create 3 or more outputs, you need to specify the number of
  17455. outputs, like in:
  17456. @example
  17457. [in] asplit=3 [out0][out1][out2]
  17458. @end example
  17459. @item
  17460. Create two separate outputs from the same input, one cropped and
  17461. one padded:
  17462. @example
  17463. [in] split [splitout1][splitout2];
  17464. [splitout1] crop=100:100:0:0 [cropout];
  17465. [splitout2] pad=200:200:100:100 [padout];
  17466. @end example
  17467. @item
  17468. Create 5 copies of the input audio with @command{ffmpeg}:
  17469. @example
  17470. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17471. @end example
  17472. @end itemize
  17473. @section zmq, azmq
  17474. Receive commands sent through a libzmq client, and forward them to
  17475. filters in the filtergraph.
  17476. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17477. must be inserted between two video filters, @code{azmq} between two
  17478. audio filters. Both are capable to send messages to any filter type.
  17479. To enable these filters you need to install the libzmq library and
  17480. headers and configure FFmpeg with @code{--enable-libzmq}.
  17481. For more information about libzmq see:
  17482. @url{http://www.zeromq.org/}
  17483. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17484. receives messages sent through a network interface defined by the
  17485. @option{bind_address} (or the abbreviation "@option{b}") option.
  17486. Default value of this option is @file{tcp://localhost:5555}. You may
  17487. want to alter this value to your needs, but do not forget to escape any
  17488. ':' signs (see @ref{filtergraph escaping}).
  17489. The received message must be in the form:
  17490. @example
  17491. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17492. @end example
  17493. @var{TARGET} specifies the target of the command, usually the name of
  17494. the filter class or a specific filter instance name. The default
  17495. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17496. but you can override this by using the @samp{filter_name@@id} syntax
  17497. (see @ref{Filtergraph syntax}).
  17498. @var{COMMAND} specifies the name of the command for the target filter.
  17499. @var{ARG} is optional and specifies the optional argument list for the
  17500. given @var{COMMAND}.
  17501. Upon reception, the message is processed and the corresponding command
  17502. is injected into the filtergraph. Depending on the result, the filter
  17503. will send a reply to the client, adopting the format:
  17504. @example
  17505. @var{ERROR_CODE} @var{ERROR_REASON}
  17506. @var{MESSAGE}
  17507. @end example
  17508. @var{MESSAGE} is optional.
  17509. @subsection Examples
  17510. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17511. be used to send commands processed by these filters.
  17512. Consider the following filtergraph generated by @command{ffplay}.
  17513. In this example the last overlay filter has an instance name. All other
  17514. filters will have default instance names.
  17515. @example
  17516. ffplay -dumpgraph 1 -f lavfi "
  17517. color=s=100x100:c=red [l];
  17518. color=s=100x100:c=blue [r];
  17519. nullsrc=s=200x100, zmq [bg];
  17520. [bg][l] overlay [bg+l];
  17521. [bg+l][r] overlay@@my=x=100 "
  17522. @end example
  17523. To change the color of the left side of the video, the following
  17524. command can be used:
  17525. @example
  17526. echo Parsed_color_0 c yellow | tools/zmqsend
  17527. @end example
  17528. To change the right side:
  17529. @example
  17530. echo Parsed_color_1 c pink | tools/zmqsend
  17531. @end example
  17532. To change the position of the right side:
  17533. @example
  17534. echo overlay@@my x 150 | tools/zmqsend
  17535. @end example
  17536. @c man end MULTIMEDIA FILTERS
  17537. @chapter Multimedia Sources
  17538. @c man begin MULTIMEDIA SOURCES
  17539. Below is a description of the currently available multimedia sources.
  17540. @section amovie
  17541. This is the same as @ref{movie} source, except it selects an audio
  17542. stream by default.
  17543. @anchor{movie}
  17544. @section movie
  17545. Read audio and/or video stream(s) from a movie container.
  17546. It accepts the following parameters:
  17547. @table @option
  17548. @item filename
  17549. The name of the resource to read (not necessarily a file; it can also be a
  17550. device or a stream accessed through some protocol).
  17551. @item format_name, f
  17552. Specifies the format assumed for the movie to read, and can be either
  17553. the name of a container or an input device. If not specified, the
  17554. format is guessed from @var{movie_name} or by probing.
  17555. @item seek_point, sp
  17556. Specifies the seek point in seconds. The frames will be output
  17557. starting from this seek point. The parameter is evaluated with
  17558. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17559. postfix. The default value is "0".
  17560. @item streams, s
  17561. Specifies the streams to read. Several streams can be specified,
  17562. separated by "+". The source will then have as many outputs, in the
  17563. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17564. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17565. respectively the default (best suited) video and audio stream. Default
  17566. is "dv", or "da" if the filter is called as "amovie".
  17567. @item stream_index, si
  17568. Specifies the index of the video stream to read. If the value is -1,
  17569. the most suitable video stream will be automatically selected. The default
  17570. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17571. audio instead of video.
  17572. @item loop
  17573. Specifies how many times to read the stream in sequence.
  17574. If the value is 0, the stream will be looped infinitely.
  17575. Default value is "1".
  17576. Note that when the movie is looped the source timestamps are not
  17577. changed, so it will generate non monotonically increasing timestamps.
  17578. @item discontinuity
  17579. Specifies the time difference between frames above which the point is
  17580. considered a timestamp discontinuity which is removed by adjusting the later
  17581. timestamps.
  17582. @end table
  17583. It allows overlaying a second video on top of the main input of
  17584. a filtergraph, as shown in this graph:
  17585. @example
  17586. input -----------> deltapts0 --> overlay --> output
  17587. ^
  17588. |
  17589. movie --> scale--> deltapts1 -------+
  17590. @end example
  17591. @subsection Examples
  17592. @itemize
  17593. @item
  17594. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17595. on top of the input labelled "in":
  17596. @example
  17597. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17598. [in] setpts=PTS-STARTPTS [main];
  17599. [main][over] overlay=16:16 [out]
  17600. @end example
  17601. @item
  17602. Read from a video4linux2 device, and overlay it on top of the input
  17603. labelled "in":
  17604. @example
  17605. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17606. [in] setpts=PTS-STARTPTS [main];
  17607. [main][over] overlay=16:16 [out]
  17608. @end example
  17609. @item
  17610. Read the first video stream and the audio stream with id 0x81 from
  17611. dvd.vob; the video is connected to the pad named "video" and the audio is
  17612. connected to the pad named "audio":
  17613. @example
  17614. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17615. @end example
  17616. @end itemize
  17617. @subsection Commands
  17618. Both movie and amovie support the following commands:
  17619. @table @option
  17620. @item seek
  17621. Perform seek using "av_seek_frame".
  17622. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17623. @itemize
  17624. @item
  17625. @var{stream_index}: If stream_index is -1, a default
  17626. stream is selected, and @var{timestamp} is automatically converted
  17627. from AV_TIME_BASE units to the stream specific time_base.
  17628. @item
  17629. @var{timestamp}: Timestamp in AVStream.time_base units
  17630. or, if no stream is specified, in AV_TIME_BASE units.
  17631. @item
  17632. @var{flags}: Flags which select direction and seeking mode.
  17633. @end itemize
  17634. @item get_duration
  17635. Get movie duration in AV_TIME_BASE units.
  17636. @end table
  17637. @c man end MULTIMEDIA SOURCES