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.

24615 lines
655KB

  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{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @section acontrast
  356. Simple audio dynamic range compression/expansion filter.
  357. The filter accepts the following options:
  358. @table @option
  359. @item contrast
  360. Set contrast. Default is 33. Allowed range is between 0 and 100.
  361. @end table
  362. @section acopy
  363. Copy the input audio source unchanged to the output. This is mainly useful for
  364. testing purposes.
  365. @section acrossfade
  366. Apply cross fade from one input audio stream to another input audio stream.
  367. The cross fade is applied for specified duration near the end of first stream.
  368. The filter accepts the following options:
  369. @table @option
  370. @item nb_samples, ns
  371. Specify the number of samples for which the cross fade effect has to last.
  372. At the end of the cross fade effect the first input audio will be completely
  373. silent. Default is 44100.
  374. @item duration, d
  375. Specify the duration of the cross fade effect. See
  376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  377. for the accepted syntax.
  378. By default the duration is determined by @var{nb_samples}.
  379. If set this option is used instead of @var{nb_samples}.
  380. @item overlap, o
  381. Should first stream end overlap with second stream start. Default is enabled.
  382. @item curve1
  383. Set curve for cross fade transition for first stream.
  384. @item curve2
  385. Set curve for cross fade transition for second stream.
  386. For description of available curve types see @ref{afade} filter description.
  387. @end table
  388. @subsection Examples
  389. @itemize
  390. @item
  391. Cross fade from one input to another:
  392. @example
  393. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  394. @end example
  395. @item
  396. Cross fade from one input to another but without overlapping:
  397. @example
  398. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  399. @end example
  400. @end itemize
  401. @section acrossover
  402. Split audio stream into several bands.
  403. This filter splits audio stream into two or more frequency ranges.
  404. Summing all streams back will give flat output.
  405. The filter accepts the following options:
  406. @table @option
  407. @item split
  408. Set split frequencies. Those must be positive and increasing.
  409. @item order
  410. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  411. Default is @var{4th}.
  412. @end table
  413. @section acrusher
  414. Reduce audio bit resolution.
  415. This filter is bit crusher with enhanced functionality. A bit crusher
  416. is used to audibly reduce number of bits an audio signal is sampled
  417. with. This doesn't change the bit depth at all, it just produces the
  418. effect. Material reduced in bit depth sounds more harsh and "digital".
  419. This filter is able to even round to continuous values instead of discrete
  420. bit depths.
  421. Additionally it has a D/C offset which results in different crushing of
  422. the lower and the upper half of the signal.
  423. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  424. Another feature of this filter is the logarithmic mode.
  425. This setting switches from linear distances between bits to logarithmic ones.
  426. The result is a much more "natural" sounding crusher which doesn't gate low
  427. signals for example. The human ear has a logarithmic perception,
  428. so this kind of crushing is much more pleasant.
  429. Logarithmic crushing is also able to get anti-aliased.
  430. The filter accepts the following options:
  431. @table @option
  432. @item level_in
  433. Set level in.
  434. @item level_out
  435. Set level out.
  436. @item bits
  437. Set bit reduction.
  438. @item mix
  439. Set mixing amount.
  440. @item mode
  441. Can be linear: @code{lin} or logarithmic: @code{log}.
  442. @item dc
  443. Set DC.
  444. @item aa
  445. Set anti-aliasing.
  446. @item samples
  447. Set sample reduction.
  448. @item lfo
  449. Enable LFO. By default disabled.
  450. @item lforange
  451. Set LFO range.
  452. @item lforate
  453. Set LFO rate.
  454. @end table
  455. @section acue
  456. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  457. filter.
  458. @section adeclick
  459. Remove impulsive noise from input audio.
  460. Samples detected as impulsive noise are replaced by interpolated samples using
  461. autoregressive modelling.
  462. @table @option
  463. @item w
  464. Set window size, in milliseconds. Allowed range is from @code{10} to
  465. @code{100}. Default value is @code{55} milliseconds.
  466. This sets size of window which will be processed at once.
  467. @item o
  468. Set window overlap, in percentage of window size. Allowed range is from
  469. @code{50} to @code{95}. Default value is @code{75} percent.
  470. Setting this to a very high value increases impulsive noise removal but makes
  471. whole process much slower.
  472. @item a
  473. Set autoregression order, in percentage of window size. Allowed range is from
  474. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  475. controls quality of interpolated samples using neighbour good samples.
  476. @item t
  477. Set threshold value. Allowed range is from @code{1} to @code{100}.
  478. Default value is @code{2}.
  479. This controls the strength of impulsive noise which is going to be removed.
  480. The lower value, the more samples will be detected as impulsive noise.
  481. @item b
  482. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  483. @code{10}. Default value is @code{2}.
  484. If any two samples detected as noise are spaced less than this value then any
  485. sample between those two samples will be also detected as noise.
  486. @item m
  487. Set overlap method.
  488. It accepts the following values:
  489. @table @option
  490. @item a
  491. Select overlap-add method. Even not interpolated samples are slightly
  492. changed with this method.
  493. @item s
  494. Select overlap-save method. Not interpolated samples remain unchanged.
  495. @end table
  496. Default value is @code{a}.
  497. @end table
  498. @section adeclip
  499. Remove clipped samples from input audio.
  500. Samples detected as clipped are replaced by interpolated samples using
  501. autoregressive modelling.
  502. @table @option
  503. @item w
  504. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  505. Default value is @code{55} milliseconds.
  506. This sets size of window which will be processed at once.
  507. @item o
  508. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  509. to @code{95}. Default value is @code{75} percent.
  510. @item a
  511. Set autoregression order, in percentage of window size. Allowed range is from
  512. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  513. quality of interpolated samples using neighbour good samples.
  514. @item t
  515. Set threshold value. Allowed range is from @code{1} to @code{100}.
  516. Default value is @code{10}. Higher values make clip detection less aggressive.
  517. @item n
  518. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  519. Default value is @code{1000}. Higher values make clip detection less aggressive.
  520. @item m
  521. Set overlap method.
  522. It accepts the following values:
  523. @table @option
  524. @item a
  525. Select overlap-add method. Even not interpolated samples are slightly changed
  526. with this method.
  527. @item s
  528. Select overlap-save method. Not interpolated samples remain unchanged.
  529. @end table
  530. Default value is @code{a}.
  531. @end table
  532. @section adelay
  533. Delay one or more audio channels.
  534. Samples in delayed channel are filled with silence.
  535. The filter accepts the following option:
  536. @table @option
  537. @item delays
  538. Set list of delays in milliseconds for each channel separated by '|'.
  539. Unused delays will be silently ignored. If number of given delays is
  540. smaller than number of channels all remaining channels will not be delayed.
  541. If you want to delay exact number of samples, append 'S' to number.
  542. If you want instead to delay in seconds, append 's' to number.
  543. @item all
  544. Use last set delay for all remaining channels. By default is disabled.
  545. This option if enabled changes how option @code{delays} is interpreted.
  546. @end table
  547. @subsection Examples
  548. @itemize
  549. @item
  550. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  551. the second channel (and any other channels that may be present) unchanged.
  552. @example
  553. adelay=1500|0|500
  554. @end example
  555. @item
  556. Delay second channel by 500 samples, the third channel by 700 samples and leave
  557. the first channel (and any other channels that may be present) unchanged.
  558. @example
  559. adelay=0|500S|700S
  560. @end example
  561. @item
  562. Delay all channels by same number of samples:
  563. @example
  564. adelay=delays=64S:all=1
  565. @end example
  566. @end itemize
  567. @section aderivative, aintegral
  568. Compute derivative/integral of audio stream.
  569. Applying both filters one after another produces original audio.
  570. @section aecho
  571. Apply echoing to the input audio.
  572. Echoes are reflected sound and can occur naturally amongst mountains
  573. (and sometimes large buildings) when talking or shouting; digital echo
  574. effects emulate this behaviour and are often used to help fill out the
  575. sound of a single instrument or vocal. The time difference between the
  576. original signal and the reflection is the @code{delay}, and the
  577. loudness of the reflected signal is the @code{decay}.
  578. Multiple echoes can have different delays and decays.
  579. A description of the accepted parameters follows.
  580. @table @option
  581. @item in_gain
  582. Set input gain of reflected signal. Default is @code{0.6}.
  583. @item out_gain
  584. Set output gain of reflected signal. Default is @code{0.3}.
  585. @item delays
  586. Set list of time intervals in milliseconds between original signal and reflections
  587. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  588. Default is @code{1000}.
  589. @item decays
  590. Set list of loudness of reflected signals separated by '|'.
  591. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  592. Default is @code{0.5}.
  593. @end table
  594. @subsection Examples
  595. @itemize
  596. @item
  597. Make it sound as if there are twice as many instruments as are actually playing:
  598. @example
  599. aecho=0.8:0.88:60:0.4
  600. @end example
  601. @item
  602. If delay is very short, then it sounds like a (metallic) robot playing music:
  603. @example
  604. aecho=0.8:0.88:6:0.4
  605. @end example
  606. @item
  607. A longer delay will sound like an open air concert in the mountains:
  608. @example
  609. aecho=0.8:0.9:1000:0.3
  610. @end example
  611. @item
  612. Same as above but with one more mountain:
  613. @example
  614. aecho=0.8:0.9:1000|1800:0.3|0.25
  615. @end example
  616. @end itemize
  617. @section aemphasis
  618. Audio emphasis filter creates or restores material directly taken from LPs or
  619. emphased CDs with different filter curves. E.g. to store music on vinyl the
  620. signal has to be altered by a filter first to even out the disadvantages of
  621. this recording medium.
  622. Once the material is played back the inverse filter has to be applied to
  623. restore the distortion of the frequency response.
  624. The filter accepts the following options:
  625. @table @option
  626. @item level_in
  627. Set input gain.
  628. @item level_out
  629. Set output gain.
  630. @item mode
  631. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  632. use @code{production} mode. Default is @code{reproduction} mode.
  633. @item type
  634. Set filter type. Selects medium. Can be one of the following:
  635. @table @option
  636. @item col
  637. select Columbia.
  638. @item emi
  639. select EMI.
  640. @item bsi
  641. select BSI (78RPM).
  642. @item riaa
  643. select RIAA.
  644. @item cd
  645. select Compact Disc (CD).
  646. @item 50fm
  647. select 50µs (FM).
  648. @item 75fm
  649. select 75µs (FM).
  650. @item 50kf
  651. select 50µs (FM-KF).
  652. @item 75kf
  653. select 75µs (FM-KF).
  654. @end table
  655. @end table
  656. @section aeval
  657. Modify an audio signal according to the specified expressions.
  658. This filter accepts one or more expressions (one for each channel),
  659. which are evaluated and used to modify a corresponding audio signal.
  660. It accepts the following parameters:
  661. @table @option
  662. @item exprs
  663. Set the '|'-separated expressions list for each separate channel. If
  664. the number of input channels is greater than the number of
  665. expressions, the last specified expression is used for the remaining
  666. output channels.
  667. @item channel_layout, c
  668. Set output channel layout. If not specified, the channel layout is
  669. specified by the number of expressions. If set to @samp{same}, it will
  670. use by default the same input channel layout.
  671. @end table
  672. Each expression in @var{exprs} can contain the following constants and functions:
  673. @table @option
  674. @item ch
  675. channel number of the current expression
  676. @item n
  677. number of the evaluated sample, starting from 0
  678. @item s
  679. sample rate
  680. @item t
  681. time of the evaluated sample expressed in seconds
  682. @item nb_in_channels
  683. @item nb_out_channels
  684. input and output number of channels
  685. @item val(CH)
  686. the value of input channel with number @var{CH}
  687. @end table
  688. Note: this filter is slow. For faster processing you should use a
  689. dedicated filter.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Half volume:
  694. @example
  695. aeval=val(ch)/2:c=same
  696. @end example
  697. @item
  698. Invert phase of the second channel:
  699. @example
  700. aeval=val(0)|-val(1)
  701. @end example
  702. @end itemize
  703. @anchor{afade}
  704. @section afade
  705. Apply fade-in/out effect to input audio.
  706. A description of the accepted parameters follows.
  707. @table @option
  708. @item type, t
  709. Specify the effect type, can be either @code{in} for fade-in, or
  710. @code{out} for a fade-out effect. Default is @code{in}.
  711. @item start_sample, ss
  712. Specify the number of the start sample for starting to apply the fade
  713. effect. Default is 0.
  714. @item nb_samples, ns
  715. Specify the number of samples for which the fade effect has to last. At
  716. the end of the fade-in effect the output audio will have the same
  717. volume as the input audio, at the end of the fade-out transition
  718. the output audio will be silence. Default is 44100.
  719. @item start_time, st
  720. Specify the start time of the fade effect. Default is 0.
  721. The value must be specified as a time duration; see
  722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  723. for the accepted syntax.
  724. If set this option is used instead of @var{start_sample}.
  725. @item duration, d
  726. Specify the duration of the fade effect. See
  727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  728. for the accepted syntax.
  729. At the end of the fade-in effect the output audio will have the same
  730. volume as the input audio, at the end of the fade-out transition
  731. the output audio will be silence.
  732. By default the duration is determined by @var{nb_samples}.
  733. If set this option is used instead of @var{nb_samples}.
  734. @item curve
  735. Set curve for fade transition.
  736. It accepts the following values:
  737. @table @option
  738. @item tri
  739. select triangular, linear slope (default)
  740. @item qsin
  741. select quarter of sine wave
  742. @item hsin
  743. select half of sine wave
  744. @item esin
  745. select exponential sine wave
  746. @item log
  747. select logarithmic
  748. @item ipar
  749. select inverted parabola
  750. @item qua
  751. select quadratic
  752. @item cub
  753. select cubic
  754. @item squ
  755. select square root
  756. @item cbr
  757. select cubic root
  758. @item par
  759. select parabola
  760. @item exp
  761. select exponential
  762. @item iqsin
  763. select inverted quarter of sine wave
  764. @item ihsin
  765. select inverted half of sine wave
  766. @item dese
  767. select double-exponential seat
  768. @item desi
  769. select double-exponential sigmoid
  770. @item losi
  771. select logistic sigmoid
  772. @item nofade
  773. no fade applied
  774. @end table
  775. @end table
  776. @subsection Examples
  777. @itemize
  778. @item
  779. Fade in first 15 seconds of audio:
  780. @example
  781. afade=t=in:ss=0:d=15
  782. @end example
  783. @item
  784. Fade out last 25 seconds of a 900 seconds audio:
  785. @example
  786. afade=t=out:st=875:d=25
  787. @end example
  788. @end itemize
  789. @section afftdn
  790. Denoise audio samples with FFT.
  791. A description of the accepted parameters follows.
  792. @table @option
  793. @item nr
  794. Set the noise reduction in dB, allowed range is 0.01 to 97.
  795. Default value is 12 dB.
  796. @item nf
  797. Set the noise floor in dB, allowed range is -80 to -20.
  798. Default value is -50 dB.
  799. @item nt
  800. Set the noise type.
  801. It accepts the following values:
  802. @table @option
  803. @item w
  804. Select white noise.
  805. @item v
  806. Select vinyl noise.
  807. @item s
  808. Select shellac noise.
  809. @item c
  810. Select custom noise, defined in @code{bn} option.
  811. Default value is white noise.
  812. @end table
  813. @item bn
  814. Set custom band noise for every one of 15 bands.
  815. Bands are separated by ' ' or '|'.
  816. @item rf
  817. Set the residual floor in dB, allowed range is -80 to -20.
  818. Default value is -38 dB.
  819. @item tn
  820. Enable noise tracking. By default is disabled.
  821. With this enabled, noise floor is automatically adjusted.
  822. @item tr
  823. Enable residual tracking. By default is disabled.
  824. @item om
  825. Set the output mode.
  826. It accepts the following values:
  827. @table @option
  828. @item i
  829. Pass input unchanged.
  830. @item o
  831. Pass noise filtered out.
  832. @item n
  833. Pass only noise.
  834. Default value is @var{o}.
  835. @end table
  836. @end table
  837. @subsection Commands
  838. This filter supports the following commands:
  839. @table @option
  840. @item sample_noise, sn
  841. Start or stop measuring noise profile.
  842. Syntax for the command is : "start" or "stop" string.
  843. After measuring noise profile is stopped it will be
  844. automatically applied in filtering.
  845. @item noise_reduction, nr
  846. Change noise reduction. Argument is single float number.
  847. Syntax for the command is : "@var{noise_reduction}"
  848. @item noise_floor, nf
  849. Change noise floor. Argument is single float number.
  850. Syntax for the command is : "@var{noise_floor}"
  851. @item output_mode, om
  852. Change output mode operation.
  853. Syntax for the command is : "i", "o" or "n" string.
  854. @end table
  855. @section afftfilt
  856. Apply arbitrary expressions to samples in frequency domain.
  857. @table @option
  858. @item real
  859. Set frequency domain real expression for each separate channel separated
  860. by '|'. Default is "re".
  861. If the number of input channels is greater than the number of
  862. expressions, the last specified expression is used for the remaining
  863. output channels.
  864. @item imag
  865. Set frequency domain imaginary expression for each separate channel
  866. separated by '|'. Default is "im".
  867. Each expression in @var{real} and @var{imag} can contain the following
  868. constants and functions:
  869. @table @option
  870. @item sr
  871. sample rate
  872. @item b
  873. current frequency bin number
  874. @item nb
  875. number of available bins
  876. @item ch
  877. channel number of the current expression
  878. @item chs
  879. number of channels
  880. @item pts
  881. current frame pts
  882. @item re
  883. current real part of frequency bin of current channel
  884. @item im
  885. current imaginary part of frequency bin of current channel
  886. @item real(b, ch)
  887. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  888. @item imag(b, ch)
  889. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  890. @end table
  891. @item win_size
  892. Set window size. Allowed range is from 16 to 131072.
  893. Default is @code{4096}
  894. @item win_func
  895. Set window function. Default is @code{hann}.
  896. @item overlap
  897. Set window overlap. If set to 1, the recommended overlap for selected
  898. window function will be picked. Default is @code{0.75}.
  899. @end table
  900. @subsection Examples
  901. @itemize
  902. @item
  903. Leave almost only low frequencies in audio:
  904. @example
  905. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  906. @end example
  907. @item
  908. Apply robotize effect:
  909. @example
  910. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  911. @end example
  912. @item
  913. Apply whisper effect:
  914. @example
  915. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  916. @end example
  917. @end itemize
  918. @anchor{afir}
  919. @section afir
  920. Apply an arbitrary Frequency Impulse Response filter.
  921. This filter is designed for applying long FIR filters,
  922. up to 60 seconds long.
  923. It can be used as component for digital crossover filters,
  924. room equalization, cross talk cancellation, wavefield synthesis,
  925. auralization, ambiophonics, ambisonics and spatialization.
  926. This filter uses the second stream as FIR coefficients.
  927. If the second stream holds a single channel, it will be used
  928. for all input channels in the first stream, otherwise
  929. the number of channels in the second stream must be same as
  930. the number of channels in the first stream.
  931. It accepts the following parameters:
  932. @table @option
  933. @item dry
  934. Set dry gain. This sets input gain.
  935. @item wet
  936. Set wet gain. This sets final output gain.
  937. @item length
  938. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  939. @item gtype
  940. Enable applying gain measured from power of IR.
  941. Set which approach to use for auto gain measurement.
  942. @table @option
  943. @item none
  944. Do not apply any gain.
  945. @item peak
  946. select peak gain, very conservative approach. This is default value.
  947. @item dc
  948. select DC gain, limited application.
  949. @item gn
  950. select gain to noise approach, this is most popular one.
  951. @end table
  952. @item irgain
  953. Set gain to be applied to IR coefficients before filtering.
  954. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  955. @item irfmt
  956. Set format of IR stream. Can be @code{mono} or @code{input}.
  957. Default is @code{input}.
  958. @item maxir
  959. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  960. Allowed range is 0.1 to 60 seconds.
  961. @item response
  962. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  963. By default it is disabled.
  964. @item channel
  965. Set for which IR channel to display frequency response. By default is first channel
  966. displayed. This option is used only when @var{response} is enabled.
  967. @item size
  968. Set video stream size. This option is used only when @var{response} is enabled.
  969. @item rate
  970. Set video stream frame rate. This option is used only when @var{response} is enabled.
  971. @item minp
  972. Set minimal partition size used for convolution. Default is @var{8192}.
  973. Allowed range is from @var{8} to @var{32768}.
  974. Lower values decreases latency at cost of higher CPU usage.
  975. @item maxp
  976. Set maximal partition size used for convolution. Default is @var{8192}.
  977. Allowed range is from @var{8} to @var{32768}.
  978. Lower values may increase CPU usage.
  979. @end table
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  984. @example
  985. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  986. @end example
  987. @end itemize
  988. @anchor{aformat}
  989. @section aformat
  990. Set output format constraints for the input audio. The framework will
  991. negotiate the most appropriate format to minimize conversions.
  992. It accepts the following parameters:
  993. @table @option
  994. @item sample_fmts
  995. A '|'-separated list of requested sample formats.
  996. @item sample_rates
  997. A '|'-separated list of requested sample rates.
  998. @item channel_layouts
  999. A '|'-separated list of requested channel layouts.
  1000. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1001. for the required syntax.
  1002. @end table
  1003. If a parameter is omitted, all values are allowed.
  1004. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1005. @example
  1006. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1007. @end example
  1008. @section agate
  1009. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1010. processing reduces disturbing noise between useful signals.
  1011. Gating is done by detecting the volume below a chosen level @var{threshold}
  1012. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1013. floor is set via @var{range}. Because an exact manipulation of the signal
  1014. would cause distortion of the waveform the reduction can be levelled over
  1015. time. This is done by setting @var{attack} and @var{release}.
  1016. @var{attack} determines how long the signal has to fall below the threshold
  1017. before any reduction will occur and @var{release} sets the time the signal
  1018. has to rise above the threshold to reduce the reduction again.
  1019. Shorter signals than the chosen attack time will be left untouched.
  1020. @table @option
  1021. @item level_in
  1022. Set input level before filtering.
  1023. Default is 1. Allowed range is from 0.015625 to 64.
  1024. @item mode
  1025. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1026. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1027. will be amplified, expanding dynamic range in upward direction.
  1028. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1029. @item range
  1030. Set the level of gain reduction when the signal is below the threshold.
  1031. Default is 0.06125. Allowed range is from 0 to 1.
  1032. Setting this to 0 disables reduction and then filter behaves like expander.
  1033. @item threshold
  1034. If a signal rises above this level the gain reduction is released.
  1035. Default is 0.125. Allowed range is from 0 to 1.
  1036. @item ratio
  1037. Set a ratio by which the signal is reduced.
  1038. Default is 2. Allowed range is from 1 to 9000.
  1039. @item attack
  1040. Amount of milliseconds the signal has to rise above the threshold before gain
  1041. reduction stops.
  1042. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1043. @item release
  1044. Amount of milliseconds the signal has to fall below the threshold before the
  1045. reduction is increased again. Default is 250 milliseconds.
  1046. Allowed range is from 0.01 to 9000.
  1047. @item makeup
  1048. Set amount of amplification of signal after processing.
  1049. Default is 1. Allowed range is from 1 to 64.
  1050. @item knee
  1051. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1052. Default is 2.828427125. Allowed range is from 1 to 8.
  1053. @item detection
  1054. Choose if exact signal should be taken for detection or an RMS like one.
  1055. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1056. @item link
  1057. Choose if the average level between all channels or the louder channel affects
  1058. the reduction.
  1059. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1060. @end table
  1061. @section aiir
  1062. Apply an arbitrary Infinite Impulse Response filter.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item z
  1066. Set numerator/zeros coefficients.
  1067. @item p
  1068. Set denominator/poles coefficients.
  1069. @item k
  1070. Set channels gains.
  1071. @item dry_gain
  1072. Set input gain.
  1073. @item wet_gain
  1074. Set output gain.
  1075. @item f
  1076. Set coefficients format.
  1077. @table @samp
  1078. @item tf
  1079. transfer function
  1080. @item zp
  1081. Z-plane zeros/poles, cartesian (default)
  1082. @item pr
  1083. Z-plane zeros/poles, polar radians
  1084. @item pd
  1085. Z-plane zeros/poles, polar degrees
  1086. @end table
  1087. @item r
  1088. Set kind of processing.
  1089. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1090. @item e
  1091. Set filtering precision.
  1092. @table @samp
  1093. @item dbl
  1094. double-precision floating-point (default)
  1095. @item flt
  1096. single-precision floating-point
  1097. @item i32
  1098. 32-bit integers
  1099. @item i16
  1100. 16-bit integers
  1101. @end table
  1102. @item mix
  1103. How much to use filtered signal in output. Default is 1.
  1104. Range is between 0 and 1.
  1105. @item response
  1106. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1107. By default it is disabled.
  1108. @item channel
  1109. Set for which IR channel to display frequency response. By default is first channel
  1110. displayed. This option is used only when @var{response} is enabled.
  1111. @item size
  1112. Set video stream size. This option is used only when @var{response} is enabled.
  1113. @end table
  1114. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1115. order.
  1116. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1117. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1118. imaginary unit.
  1119. Different coefficients and gains can be provided for every channel, in such case
  1120. use '|' to separate coefficients or gains. Last provided coefficients will be
  1121. used for all remaining channels.
  1122. @subsection Examples
  1123. @itemize
  1124. @item
  1125. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1126. @example
  1127. 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
  1128. @end example
  1129. @item
  1130. Same as above but in @code{zp} format:
  1131. @example
  1132. 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
  1133. @end example
  1134. @end itemize
  1135. @section alimiter
  1136. The limiter prevents an input signal from rising over a desired threshold.
  1137. This limiter uses lookahead technology to prevent your signal from distorting.
  1138. It means that there is a small delay after the signal is processed. Keep in mind
  1139. that the delay it produces is the attack time you set.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item level_in
  1143. Set input gain. Default is 1.
  1144. @item level_out
  1145. Set output gain. Default is 1.
  1146. @item limit
  1147. Don't let signals above this level pass the limiter. Default is 1.
  1148. @item attack
  1149. The limiter will reach its attenuation level in this amount of time in
  1150. milliseconds. Default is 5 milliseconds.
  1151. @item release
  1152. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1153. Default is 50 milliseconds.
  1154. @item asc
  1155. When gain reduction is always needed ASC takes care of releasing to an
  1156. average reduction level rather than reaching a reduction of 0 in the release
  1157. time.
  1158. @item asc_level
  1159. Select how much the release time is affected by ASC, 0 means nearly no changes
  1160. in release time while 1 produces higher release times.
  1161. @item level
  1162. Auto level output signal. Default is enabled.
  1163. This normalizes audio back to 0dB if enabled.
  1164. @end table
  1165. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1166. with @ref{aresample} before applying this filter.
  1167. @section allpass
  1168. Apply a two-pole all-pass filter with central frequency (in Hz)
  1169. @var{frequency}, and filter-width @var{width}.
  1170. An all-pass filter changes the audio's frequency to phase relationship
  1171. without changing its frequency to amplitude relationship.
  1172. The filter accepts the following options:
  1173. @table @option
  1174. @item frequency, f
  1175. Set frequency in Hz.
  1176. @item width_type, t
  1177. Set method to specify band-width of filter.
  1178. @table @option
  1179. @item h
  1180. Hz
  1181. @item q
  1182. Q-Factor
  1183. @item o
  1184. octave
  1185. @item s
  1186. slope
  1187. @item k
  1188. kHz
  1189. @end table
  1190. @item width, w
  1191. Specify the band-width of a filter in width_type units.
  1192. @item mix, m
  1193. How much to use filtered signal in output. Default is 1.
  1194. Range is between 0 and 1.
  1195. @item channels, c
  1196. Specify which channels to filter, by default all available are filtered.
  1197. @item normalize, n
  1198. Normalize biquad coefficients, by default is disabled.
  1199. Enabling it will normalize magnitude response at DC to 0dB.
  1200. @end table
  1201. @subsection Commands
  1202. This filter supports the following commands:
  1203. @table @option
  1204. @item frequency, f
  1205. Change allpass frequency.
  1206. Syntax for the command is : "@var{frequency}"
  1207. @item width_type, t
  1208. Change allpass width_type.
  1209. Syntax for the command is : "@var{width_type}"
  1210. @item width, w
  1211. Change allpass width.
  1212. Syntax for the command is : "@var{width}"
  1213. @item mix, m
  1214. Change allpass mix.
  1215. Syntax for the command is : "@var{mix}"
  1216. @end table
  1217. @section aloop
  1218. Loop audio samples.
  1219. The filter accepts the following options:
  1220. @table @option
  1221. @item loop
  1222. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1223. Default is 0.
  1224. @item size
  1225. Set maximal number of samples. Default is 0.
  1226. @item start
  1227. Set first sample of loop. Default is 0.
  1228. @end table
  1229. @anchor{amerge}
  1230. @section amerge
  1231. Merge two or more audio streams into a single multi-channel stream.
  1232. The filter accepts the following options:
  1233. @table @option
  1234. @item inputs
  1235. Set the number of inputs. Default is 2.
  1236. @end table
  1237. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1238. the channel layout of the output will be set accordingly and the channels
  1239. will be reordered as necessary. If the channel layouts of the inputs are not
  1240. disjoint, the output will have all the channels of the first input then all
  1241. the channels of the second input, in that order, and the channel layout of
  1242. the output will be the default value corresponding to the total number of
  1243. channels.
  1244. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1245. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1246. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1247. first input, b1 is the first channel of the second input).
  1248. On the other hand, if both input are in stereo, the output channels will be
  1249. in the default order: a1, a2, b1, b2, and the channel layout will be
  1250. arbitrarily set to 4.0, which may or may not be the expected value.
  1251. All inputs must have the same sample rate, and format.
  1252. If inputs do not have the same duration, the output will stop with the
  1253. shortest.
  1254. @subsection Examples
  1255. @itemize
  1256. @item
  1257. Merge two mono files into a stereo stream:
  1258. @example
  1259. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1260. @end example
  1261. @item
  1262. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1263. @example
  1264. 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
  1265. @end example
  1266. @end itemize
  1267. @section amix
  1268. Mixes multiple audio inputs into a single output.
  1269. Note that this filter only supports float samples (the @var{amerge}
  1270. and @var{pan} audio filters support many formats). If the @var{amix}
  1271. input has integer samples then @ref{aresample} will be automatically
  1272. inserted to perform the conversion to float samples.
  1273. For example
  1274. @example
  1275. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1276. @end example
  1277. will mix 3 input audio streams to a single output with the same duration as the
  1278. first input and a dropout transition time of 3 seconds.
  1279. It accepts the following parameters:
  1280. @table @option
  1281. @item inputs
  1282. The number of inputs. If unspecified, it defaults to 2.
  1283. @item duration
  1284. How to determine the end-of-stream.
  1285. @table @option
  1286. @item longest
  1287. The duration of the longest input. (default)
  1288. @item shortest
  1289. The duration of the shortest input.
  1290. @item first
  1291. The duration of the first input.
  1292. @end table
  1293. @item dropout_transition
  1294. The transition time, in seconds, for volume renormalization when an input
  1295. stream ends. The default value is 2 seconds.
  1296. @item weights
  1297. Specify weight of each input audio stream as sequence.
  1298. Each weight is separated by space. By default all inputs have same weight.
  1299. @end table
  1300. @section amultiply
  1301. Multiply first audio stream with second audio stream and store result
  1302. in output audio stream. Multiplication is done by multiplying each
  1303. sample from first stream with sample at same position from second stream.
  1304. With this element-wise multiplication one can create amplitude fades and
  1305. amplitude modulations.
  1306. @section anequalizer
  1307. High-order parametric multiband equalizer for each channel.
  1308. It accepts the following parameters:
  1309. @table @option
  1310. @item params
  1311. This option string is in format:
  1312. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1313. Each equalizer band is separated by '|'.
  1314. @table @option
  1315. @item chn
  1316. Set channel number to which equalization will be applied.
  1317. If input doesn't have that channel the entry is ignored.
  1318. @item f
  1319. Set central frequency for band.
  1320. If input doesn't have that frequency the entry is ignored.
  1321. @item w
  1322. Set band width in hertz.
  1323. @item g
  1324. Set band gain in dB.
  1325. @item t
  1326. Set filter type for band, optional, can be:
  1327. @table @samp
  1328. @item 0
  1329. Butterworth, this is default.
  1330. @item 1
  1331. Chebyshev type 1.
  1332. @item 2
  1333. Chebyshev type 2.
  1334. @end table
  1335. @end table
  1336. @item curves
  1337. With this option activated frequency response of anequalizer is displayed
  1338. in video stream.
  1339. @item size
  1340. Set video stream size. Only useful if curves option is activated.
  1341. @item mgain
  1342. Set max gain that will be displayed. Only useful if curves option is activated.
  1343. Setting this to a reasonable value makes it possible to display gain which is derived from
  1344. neighbour bands which are too close to each other and thus produce higher gain
  1345. when both are activated.
  1346. @item fscale
  1347. Set frequency scale used to draw frequency response in video output.
  1348. Can be linear or logarithmic. Default is logarithmic.
  1349. @item colors
  1350. Set color for each channel curve which is going to be displayed in video stream.
  1351. This is list of color names separated by space or by '|'.
  1352. Unrecognised or missing colors will be replaced by white color.
  1353. @end table
  1354. @subsection Examples
  1355. @itemize
  1356. @item
  1357. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1358. for first 2 channels using Chebyshev type 1 filter:
  1359. @example
  1360. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1361. @end example
  1362. @end itemize
  1363. @subsection Commands
  1364. This filter supports the following commands:
  1365. @table @option
  1366. @item change
  1367. Alter existing filter parameters.
  1368. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1369. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1370. error is returned.
  1371. @var{freq} set new frequency parameter.
  1372. @var{width} set new width parameter in herz.
  1373. @var{gain} set new gain parameter in dB.
  1374. Full filter invocation with asendcmd may look like this:
  1375. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1376. @end table
  1377. @section anlmdn
  1378. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1379. Each sample is adjusted by looking for other samples with similar contexts. This
  1380. context similarity is defined by comparing their surrounding patches of size
  1381. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1382. The filter accepts the following options:
  1383. @table @option
  1384. @item s
  1385. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1386. @item p
  1387. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1388. Default value is 2 milliseconds.
  1389. @item r
  1390. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1391. Default value is 6 milliseconds.
  1392. @item o
  1393. Set the output mode.
  1394. It accepts the following values:
  1395. @table @option
  1396. @item i
  1397. Pass input unchanged.
  1398. @item o
  1399. Pass noise filtered out.
  1400. @item n
  1401. Pass only noise.
  1402. Default value is @var{o}.
  1403. @end table
  1404. @item m
  1405. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1406. @end table
  1407. @subsection Commands
  1408. This filter supports the following commands:
  1409. @table @option
  1410. @item s
  1411. Change denoise strength. Argument is single float number.
  1412. Syntax for the command is : "@var{s}"
  1413. @item o
  1414. Change output mode.
  1415. Syntax for the command is : "i", "o" or "n" string.
  1416. @end table
  1417. @section anlms
  1418. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1419. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1420. relate to producing the least mean square of the error signal (difference between the desired,
  1421. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1422. A description of the accepted options follows.
  1423. @table @option
  1424. @item order
  1425. Set filter order.
  1426. @item mu
  1427. Set filter mu.
  1428. @item eps
  1429. Set the filter eps.
  1430. @item leakage
  1431. Set the filter leakage.
  1432. @item out_mode
  1433. It accepts the following values:
  1434. @table @option
  1435. @item i
  1436. Pass the 1st input.
  1437. @item d
  1438. Pass the 2nd input.
  1439. @item o
  1440. Pass filtered samples.
  1441. @item n
  1442. Pass difference between desired and filtered samples.
  1443. Default value is @var{o}.
  1444. @end table
  1445. @end table
  1446. @subsection Examples
  1447. @itemize
  1448. @item
  1449. One of many usages of this filter is noise reduction, input audio is filtered
  1450. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1451. @example
  1452. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1453. @end example
  1454. @end itemize
  1455. @subsection Commands
  1456. This filter supports the same commands as options, excluding option @code{order}.
  1457. @section anull
  1458. Pass the audio source unchanged to the output.
  1459. @section apad
  1460. Pad the end of an audio stream with silence.
  1461. This can be used together with @command{ffmpeg} @option{-shortest} to
  1462. extend audio streams to the same length as the video stream.
  1463. A description of the accepted options follows.
  1464. @table @option
  1465. @item packet_size
  1466. Set silence packet size. Default value is 4096.
  1467. @item pad_len
  1468. Set the number of samples of silence to add to the end. After the
  1469. value is reached, the stream is terminated. This option is mutually
  1470. exclusive with @option{whole_len}.
  1471. @item whole_len
  1472. Set the minimum total number of samples in the output audio stream. If
  1473. the value is longer than the input audio length, silence is added to
  1474. the end, until the value is reached. This option is mutually exclusive
  1475. with @option{pad_len}.
  1476. @item pad_dur
  1477. Specify the duration of samples of silence to add. See
  1478. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1479. for the accepted syntax. Used only if set to non-zero value.
  1480. @item whole_dur
  1481. Specify the minimum total duration in the output audio stream. See
  1482. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1483. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1484. the input audio length, silence is added to the end, until the value is reached.
  1485. This option is mutually exclusive with @option{pad_dur}
  1486. @end table
  1487. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1488. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1489. the input stream indefinitely.
  1490. @subsection Examples
  1491. @itemize
  1492. @item
  1493. Add 1024 samples of silence to the end of the input:
  1494. @example
  1495. apad=pad_len=1024
  1496. @end example
  1497. @item
  1498. Make sure the audio output will contain at least 10000 samples, pad
  1499. the input with silence if required:
  1500. @example
  1501. apad=whole_len=10000
  1502. @end example
  1503. @item
  1504. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1505. video stream will always result the shortest and will be converted
  1506. until the end in the output file when using the @option{shortest}
  1507. option:
  1508. @example
  1509. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1510. @end example
  1511. @end itemize
  1512. @section aphaser
  1513. Add a phasing effect to the input audio.
  1514. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1515. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1516. A description of the accepted parameters follows.
  1517. @table @option
  1518. @item in_gain
  1519. Set input gain. Default is 0.4.
  1520. @item out_gain
  1521. Set output gain. Default is 0.74
  1522. @item delay
  1523. Set delay in milliseconds. Default is 3.0.
  1524. @item decay
  1525. Set decay. Default is 0.4.
  1526. @item speed
  1527. Set modulation speed in Hz. Default is 0.5.
  1528. @item type
  1529. Set modulation type. Default is triangular.
  1530. It accepts the following values:
  1531. @table @samp
  1532. @item triangular, t
  1533. @item sinusoidal, s
  1534. @end table
  1535. @end table
  1536. @section apulsator
  1537. Audio pulsator is something between an autopanner and a tremolo.
  1538. But it can produce funny stereo effects as well. Pulsator changes the volume
  1539. of the left and right channel based on a LFO (low frequency oscillator) with
  1540. different waveforms and shifted phases.
  1541. This filter have the ability to define an offset between left and right
  1542. channel. An offset of 0 means that both LFO shapes match each other.
  1543. The left and right channel are altered equally - a conventional tremolo.
  1544. An offset of 50% means that the shape of the right channel is exactly shifted
  1545. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1546. an autopanner. At 1 both curves match again. Every setting in between moves the
  1547. phase shift gapless between all stages and produces some "bypassing" sounds with
  1548. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1549. the 0.5) the faster the signal passes from the left to the right speaker.
  1550. The filter accepts the following options:
  1551. @table @option
  1552. @item level_in
  1553. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1554. @item level_out
  1555. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1556. @item mode
  1557. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1558. sawup or sawdown. Default is sine.
  1559. @item amount
  1560. Set modulation. Define how much of original signal is affected by the LFO.
  1561. @item offset_l
  1562. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1563. @item offset_r
  1564. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1565. @item width
  1566. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1567. @item timing
  1568. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1569. @item bpm
  1570. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1571. is set to bpm.
  1572. @item ms
  1573. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1574. is set to ms.
  1575. @item hz
  1576. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1577. if timing is set to hz.
  1578. @end table
  1579. @anchor{aresample}
  1580. @section aresample
  1581. Resample the input audio to the specified parameters, using the
  1582. libswresample library. If none are specified then the filter will
  1583. automatically convert between its input and output.
  1584. This filter is also able to stretch/squeeze the audio data to make it match
  1585. the timestamps or to inject silence / cut out audio to make it match the
  1586. timestamps, do a combination of both or do neither.
  1587. The filter accepts the syntax
  1588. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1589. expresses a sample rate and @var{resampler_options} is a list of
  1590. @var{key}=@var{value} pairs, separated by ":". See the
  1591. @ref{Resampler Options,,"Resampler Options" section in the
  1592. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1593. for the complete list of supported options.
  1594. @subsection Examples
  1595. @itemize
  1596. @item
  1597. Resample the input audio to 44100Hz:
  1598. @example
  1599. aresample=44100
  1600. @end example
  1601. @item
  1602. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1603. samples per second compensation:
  1604. @example
  1605. aresample=async=1000
  1606. @end example
  1607. @end itemize
  1608. @section areverse
  1609. Reverse an audio clip.
  1610. Warning: This filter requires memory to buffer the entire clip, so trimming
  1611. is suggested.
  1612. @subsection Examples
  1613. @itemize
  1614. @item
  1615. Take the first 5 seconds of a clip, and reverse it.
  1616. @example
  1617. atrim=end=5,areverse
  1618. @end example
  1619. @end itemize
  1620. @section arnndn
  1621. Reduce noise from speech using Recurrent Neural Networks.
  1622. This filter accepts the following options:
  1623. @table @option
  1624. @item model, m
  1625. Set train model file to load. This option is always required.
  1626. @end table
  1627. @section asetnsamples
  1628. Set the number of samples per each output audio frame.
  1629. The last output packet may contain a different number of samples, as
  1630. the filter will flush all the remaining samples when the input audio
  1631. signals its end.
  1632. The filter accepts the following options:
  1633. @table @option
  1634. @item nb_out_samples, n
  1635. Set the number of frames per each output audio frame. The number is
  1636. intended as the number of samples @emph{per each channel}.
  1637. Default value is 1024.
  1638. @item pad, p
  1639. If set to 1, the filter will pad the last audio frame with zeroes, so
  1640. that the last frame will contain the same number of samples as the
  1641. previous ones. Default value is 1.
  1642. @end table
  1643. For example, to set the number of per-frame samples to 1234 and
  1644. disable padding for the last frame, use:
  1645. @example
  1646. asetnsamples=n=1234:p=0
  1647. @end example
  1648. @section asetrate
  1649. Set the sample rate without altering the PCM data.
  1650. This will result in a change of speed and pitch.
  1651. The filter accepts the following options:
  1652. @table @option
  1653. @item sample_rate, r
  1654. Set the output sample rate. Default is 44100 Hz.
  1655. @end table
  1656. @section ashowinfo
  1657. Show a line containing various information for each input audio frame.
  1658. The input audio is not modified.
  1659. The shown line contains a sequence of key/value pairs of the form
  1660. @var{key}:@var{value}.
  1661. The following values are shown in the output:
  1662. @table @option
  1663. @item n
  1664. The (sequential) number of the input frame, starting from 0.
  1665. @item pts
  1666. The presentation timestamp of the input frame, in time base units; the time base
  1667. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1668. @item pts_time
  1669. The presentation timestamp of the input frame in seconds.
  1670. @item pos
  1671. position of the frame in the input stream, -1 if this information in
  1672. unavailable and/or meaningless (for example in case of synthetic audio)
  1673. @item fmt
  1674. The sample format.
  1675. @item chlayout
  1676. The channel layout.
  1677. @item rate
  1678. The sample rate for the audio frame.
  1679. @item nb_samples
  1680. The number of samples (per channel) in the frame.
  1681. @item checksum
  1682. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1683. audio, the data is treated as if all the planes were concatenated.
  1684. @item plane_checksums
  1685. A list of Adler-32 checksums for each data plane.
  1686. @end table
  1687. @section asoftclip
  1688. Apply audio soft clipping.
  1689. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1690. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1691. This filter accepts the following options:
  1692. @table @option
  1693. @item type
  1694. Set type of soft-clipping.
  1695. It accepts the following values:
  1696. @table @option
  1697. @item tanh
  1698. @item atan
  1699. @item cubic
  1700. @item exp
  1701. @item alg
  1702. @item quintic
  1703. @item sin
  1704. @end table
  1705. @item param
  1706. Set additional parameter which controls sigmoid function.
  1707. @end table
  1708. @section asr
  1709. Automatic Speech Recognition
  1710. This filter uses PocketSphinx for speech recognition. To enable
  1711. compilation of this filter, you need to configure FFmpeg with
  1712. @code{--enable-pocketsphinx}.
  1713. It accepts the following options:
  1714. @table @option
  1715. @item rate
  1716. Set sampling rate of input audio. Defaults is @code{16000}.
  1717. This need to match speech models, otherwise one will get poor results.
  1718. @item hmm
  1719. Set dictionary containing acoustic model files.
  1720. @item dict
  1721. Set pronunciation dictionary.
  1722. @item lm
  1723. Set language model file.
  1724. @item lmctl
  1725. Set language model set.
  1726. @item lmname
  1727. Set which language model to use.
  1728. @item logfn
  1729. Set output for log messages.
  1730. @end table
  1731. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1732. @anchor{astats}
  1733. @section astats
  1734. Display time domain statistical information about the audio channels.
  1735. Statistics are calculated and displayed for each audio channel and,
  1736. where applicable, an overall figure is also given.
  1737. It accepts the following option:
  1738. @table @option
  1739. @item length
  1740. Short window length in seconds, used for peak and trough RMS measurement.
  1741. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1742. @item metadata
  1743. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1744. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1745. disabled.
  1746. Available keys for each channel are:
  1747. DC_offset
  1748. Min_level
  1749. Max_level
  1750. Min_difference
  1751. Max_difference
  1752. Mean_difference
  1753. RMS_difference
  1754. Peak_level
  1755. RMS_peak
  1756. RMS_trough
  1757. Crest_factor
  1758. Flat_factor
  1759. Peak_count
  1760. Bit_depth
  1761. Dynamic_range
  1762. Zero_crossings
  1763. Zero_crossings_rate
  1764. Number_of_NaNs
  1765. Number_of_Infs
  1766. Number_of_denormals
  1767. and for Overall:
  1768. DC_offset
  1769. Min_level
  1770. Max_level
  1771. Min_difference
  1772. Max_difference
  1773. Mean_difference
  1774. RMS_difference
  1775. Peak_level
  1776. RMS_level
  1777. RMS_peak
  1778. RMS_trough
  1779. Flat_factor
  1780. Peak_count
  1781. Bit_depth
  1782. Number_of_samples
  1783. Number_of_NaNs
  1784. Number_of_Infs
  1785. Number_of_denormals
  1786. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1787. this @code{lavfi.astats.Overall.Peak_count}.
  1788. For description what each key means read below.
  1789. @item reset
  1790. Set number of frame after which stats are going to be recalculated.
  1791. Default is disabled.
  1792. @item measure_perchannel
  1793. Select the entries which need to be measured per channel. The metadata keys can
  1794. be used as flags, default is @option{all} which measures everything.
  1795. @option{none} disables all per channel measurement.
  1796. @item measure_overall
  1797. Select the entries which need to be measured overall. The metadata keys can
  1798. be used as flags, default is @option{all} which measures everything.
  1799. @option{none} disables all overall measurement.
  1800. @end table
  1801. A description of each shown parameter follows:
  1802. @table @option
  1803. @item DC offset
  1804. Mean amplitude displacement from zero.
  1805. @item Min level
  1806. Minimal sample level.
  1807. @item Max level
  1808. Maximal sample level.
  1809. @item Min difference
  1810. Minimal difference between two consecutive samples.
  1811. @item Max difference
  1812. Maximal difference between two consecutive samples.
  1813. @item Mean difference
  1814. Mean difference between two consecutive samples.
  1815. The average of each difference between two consecutive samples.
  1816. @item RMS difference
  1817. Root Mean Square difference between two consecutive samples.
  1818. @item Peak level dB
  1819. @item RMS level dB
  1820. Standard peak and RMS level measured in dBFS.
  1821. @item RMS peak dB
  1822. @item RMS trough dB
  1823. Peak and trough values for RMS level measured over a short window.
  1824. @item Crest factor
  1825. Standard ratio of peak to RMS level (note: not in dB).
  1826. @item Flat factor
  1827. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1828. (i.e. either @var{Min level} or @var{Max level}).
  1829. @item Peak count
  1830. Number of occasions (not the number of samples) that the signal attained either
  1831. @var{Min level} or @var{Max level}.
  1832. @item Bit depth
  1833. Overall bit depth of audio. Number of bits used for each sample.
  1834. @item Dynamic range
  1835. Measured dynamic range of audio in dB.
  1836. @item Zero crossings
  1837. Number of points where the waveform crosses the zero level axis.
  1838. @item Zero crossings rate
  1839. Rate of Zero crossings and number of audio samples.
  1840. @end table
  1841. @section atempo
  1842. Adjust audio tempo.
  1843. The filter accepts exactly one parameter, the audio tempo. If not
  1844. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1845. be in the [0.5, 100.0] range.
  1846. Note that tempo greater than 2 will skip some samples rather than
  1847. blend them in. If for any reason this is a concern it is always
  1848. possible to daisy-chain several instances of atempo to achieve the
  1849. desired product tempo.
  1850. @subsection Examples
  1851. @itemize
  1852. @item
  1853. Slow down audio to 80% tempo:
  1854. @example
  1855. atempo=0.8
  1856. @end example
  1857. @item
  1858. To speed up audio to 300% tempo:
  1859. @example
  1860. atempo=3
  1861. @end example
  1862. @item
  1863. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1864. @example
  1865. atempo=sqrt(3),atempo=sqrt(3)
  1866. @end example
  1867. @end itemize
  1868. @subsection Commands
  1869. This filter supports the following commands:
  1870. @table @option
  1871. @item tempo
  1872. Change filter tempo scale factor.
  1873. Syntax for the command is : "@var{tempo}"
  1874. @end table
  1875. @section atrim
  1876. Trim the input so that the output contains one continuous subpart of the input.
  1877. It accepts the following parameters:
  1878. @table @option
  1879. @item start
  1880. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1881. sample with the timestamp @var{start} will be the first sample in the output.
  1882. @item end
  1883. Specify time of the first audio sample that will be dropped, i.e. the
  1884. audio sample immediately preceding the one with the timestamp @var{end} will be
  1885. the last sample in the output.
  1886. @item start_pts
  1887. Same as @var{start}, except this option sets the start timestamp in samples
  1888. instead of seconds.
  1889. @item end_pts
  1890. Same as @var{end}, except this option sets the end timestamp in samples instead
  1891. of seconds.
  1892. @item duration
  1893. The maximum duration of the output in seconds.
  1894. @item start_sample
  1895. The number of the first sample that should be output.
  1896. @item end_sample
  1897. The number of the first sample that should be dropped.
  1898. @end table
  1899. @option{start}, @option{end}, and @option{duration} are expressed as time
  1900. duration specifications; see
  1901. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1902. Note that the first two sets of the start/end options and the @option{duration}
  1903. option look at the frame timestamp, while the _sample options simply count the
  1904. samples that pass through the filter. So start/end_pts and start/end_sample will
  1905. give different results when the timestamps are wrong, inexact or do not start at
  1906. zero. Also note that this filter does not modify the timestamps. If you wish
  1907. to have the output timestamps start at zero, insert the asetpts filter after the
  1908. atrim filter.
  1909. If multiple start or end options are set, this filter tries to be greedy and
  1910. keep all samples that match at least one of the specified constraints. To keep
  1911. only the part that matches all the constraints at once, chain multiple atrim
  1912. filters.
  1913. The defaults are such that all the input is kept. So it is possible to set e.g.
  1914. just the end values to keep everything before the specified time.
  1915. Examples:
  1916. @itemize
  1917. @item
  1918. Drop everything except the second minute of input:
  1919. @example
  1920. ffmpeg -i INPUT -af atrim=60:120
  1921. @end example
  1922. @item
  1923. Keep only the first 1000 samples:
  1924. @example
  1925. ffmpeg -i INPUT -af atrim=end_sample=1000
  1926. @end example
  1927. @end itemize
  1928. @section axcorrelate
  1929. Calculate normalized cross-correlation between two input audio streams.
  1930. Resulted samples are always between -1 and 1 inclusive.
  1931. If result is 1 it means two input samples are highly correlated in that selected segment.
  1932. Result 0 means they are not correlated at all.
  1933. If result is -1 it means two input samples are out of phase, which means they cancel each
  1934. other.
  1935. The filter accepts the following options:
  1936. @table @option
  1937. @item size
  1938. Set size of segment over which cross-correlation is calculated.
  1939. Default is 256. Allowed range is from 2 to 131072.
  1940. @item algo
  1941. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1942. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1943. are always zero and thus need much less calculations to make.
  1944. This is generally not true, but is valid for typical audio streams.
  1945. @end table
  1946. @subsection Examples
  1947. @itemize
  1948. @item
  1949. Calculate correlation between channels in stereo audio stream:
  1950. @example
  1951. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  1952. @end example
  1953. @end itemize
  1954. @section bandpass
  1955. Apply a two-pole Butterworth band-pass filter with central
  1956. frequency @var{frequency}, and (3dB-point) band-width width.
  1957. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1958. instead of the default: constant 0dB peak gain.
  1959. The filter roll off at 6dB per octave (20dB per decade).
  1960. The filter accepts the following options:
  1961. @table @option
  1962. @item frequency, f
  1963. Set the filter's central frequency. Default is @code{3000}.
  1964. @item csg
  1965. Constant skirt gain if set to 1. Defaults to 0.
  1966. @item width_type, t
  1967. Set method to specify band-width of filter.
  1968. @table @option
  1969. @item h
  1970. Hz
  1971. @item q
  1972. Q-Factor
  1973. @item o
  1974. octave
  1975. @item s
  1976. slope
  1977. @item k
  1978. kHz
  1979. @end table
  1980. @item width, w
  1981. Specify the band-width of a filter in width_type units.
  1982. @item mix, m
  1983. How much to use filtered signal in output. Default is 1.
  1984. Range is between 0 and 1.
  1985. @item channels, c
  1986. Specify which channels to filter, by default all available are filtered.
  1987. @item normalize, n
  1988. Normalize biquad coefficients, by default is disabled.
  1989. Enabling it will normalize magnitude response at DC to 0dB.
  1990. @end table
  1991. @subsection Commands
  1992. This filter supports the following commands:
  1993. @table @option
  1994. @item frequency, f
  1995. Change bandpass frequency.
  1996. Syntax for the command is : "@var{frequency}"
  1997. @item width_type, t
  1998. Change bandpass width_type.
  1999. Syntax for the command is : "@var{width_type}"
  2000. @item width, w
  2001. Change bandpass width.
  2002. Syntax for the command is : "@var{width}"
  2003. @item mix, m
  2004. Change bandpass mix.
  2005. Syntax for the command is : "@var{mix}"
  2006. @end table
  2007. @section bandreject
  2008. Apply a two-pole Butterworth band-reject filter with central
  2009. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2010. The filter roll off at 6dB per octave (20dB per decade).
  2011. The filter accepts the following options:
  2012. @table @option
  2013. @item frequency, f
  2014. Set the filter's central frequency. Default is @code{3000}.
  2015. @item width_type, t
  2016. Set method to specify band-width of filter.
  2017. @table @option
  2018. @item h
  2019. Hz
  2020. @item q
  2021. Q-Factor
  2022. @item o
  2023. octave
  2024. @item s
  2025. slope
  2026. @item k
  2027. kHz
  2028. @end table
  2029. @item width, w
  2030. Specify the band-width of a filter in width_type units.
  2031. @item mix, m
  2032. How much to use filtered signal in output. Default is 1.
  2033. Range is between 0 and 1.
  2034. @item channels, c
  2035. Specify which channels to filter, by default all available are filtered.
  2036. @item normalize, n
  2037. Normalize biquad coefficients, by default is disabled.
  2038. Enabling it will normalize magnitude response at DC to 0dB.
  2039. @end table
  2040. @subsection Commands
  2041. This filter supports the following commands:
  2042. @table @option
  2043. @item frequency, f
  2044. Change bandreject frequency.
  2045. Syntax for the command is : "@var{frequency}"
  2046. @item width_type, t
  2047. Change bandreject width_type.
  2048. Syntax for the command is : "@var{width_type}"
  2049. @item width, w
  2050. Change bandreject width.
  2051. Syntax for the command is : "@var{width}"
  2052. @item mix, m
  2053. Change bandreject mix.
  2054. Syntax for the command is : "@var{mix}"
  2055. @end table
  2056. @section bass, lowshelf
  2057. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2058. shelving filter with a response similar to that of a standard
  2059. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2060. The filter accepts the following options:
  2061. @table @option
  2062. @item gain, g
  2063. Give the gain at 0 Hz. Its useful range is about -20
  2064. (for a large cut) to +20 (for a large boost).
  2065. Beware of clipping when using a positive gain.
  2066. @item frequency, f
  2067. Set the filter's central frequency and so can be used
  2068. to extend or reduce the frequency range to be boosted or cut.
  2069. The default value is @code{100} Hz.
  2070. @item width_type, t
  2071. Set method to specify band-width of filter.
  2072. @table @option
  2073. @item h
  2074. Hz
  2075. @item q
  2076. Q-Factor
  2077. @item o
  2078. octave
  2079. @item s
  2080. slope
  2081. @item k
  2082. kHz
  2083. @end table
  2084. @item width, w
  2085. Determine how steep is the filter's shelf transition.
  2086. @item mix, m
  2087. How much to use filtered signal in output. Default is 1.
  2088. Range is between 0 and 1.
  2089. @item channels, c
  2090. Specify which channels to filter, by default all available are filtered.
  2091. @item normalize, n
  2092. Normalize biquad coefficients, by default is disabled.
  2093. Enabling it will normalize magnitude response at DC to 0dB.
  2094. @end table
  2095. @subsection Commands
  2096. This filter supports the following commands:
  2097. @table @option
  2098. @item frequency, f
  2099. Change bass frequency.
  2100. Syntax for the command is : "@var{frequency}"
  2101. @item width_type, t
  2102. Change bass width_type.
  2103. Syntax for the command is : "@var{width_type}"
  2104. @item width, w
  2105. Change bass width.
  2106. Syntax for the command is : "@var{width}"
  2107. @item gain, g
  2108. Change bass gain.
  2109. Syntax for the command is : "@var{gain}"
  2110. @item mix, m
  2111. Change bass mix.
  2112. Syntax for the command is : "@var{mix}"
  2113. @end table
  2114. @section biquad
  2115. Apply a biquad IIR filter with the given coefficients.
  2116. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2117. are the numerator and denominator coefficients respectively.
  2118. and @var{channels}, @var{c} specify which channels to filter, by default all
  2119. available are filtered.
  2120. @subsection Commands
  2121. This filter supports the following commands:
  2122. @table @option
  2123. @item a0
  2124. @item a1
  2125. @item a2
  2126. @item b0
  2127. @item b1
  2128. @item b2
  2129. Change biquad parameter.
  2130. Syntax for the command is : "@var{value}"
  2131. @item mix, m
  2132. How much to use filtered signal in output. Default is 1.
  2133. Range is between 0 and 1.
  2134. @item channels, c
  2135. Specify which channels to filter, by default all available are filtered.
  2136. @item normalize, n
  2137. Normalize biquad coefficients, by default is disabled.
  2138. Enabling it will normalize magnitude response at DC to 0dB.
  2139. @end table
  2140. @section bs2b
  2141. Bauer stereo to binaural transformation, which improves headphone listening of
  2142. stereo audio records.
  2143. To enable compilation of this filter you need to configure FFmpeg with
  2144. @code{--enable-libbs2b}.
  2145. It accepts the following parameters:
  2146. @table @option
  2147. @item profile
  2148. Pre-defined crossfeed level.
  2149. @table @option
  2150. @item default
  2151. Default level (fcut=700, feed=50).
  2152. @item cmoy
  2153. Chu Moy circuit (fcut=700, feed=60).
  2154. @item jmeier
  2155. Jan Meier circuit (fcut=650, feed=95).
  2156. @end table
  2157. @item fcut
  2158. Cut frequency (in Hz).
  2159. @item feed
  2160. Feed level (in Hz).
  2161. @end table
  2162. @section channelmap
  2163. Remap input channels to new locations.
  2164. It accepts the following parameters:
  2165. @table @option
  2166. @item map
  2167. Map channels from input to output. The argument is a '|'-separated list of
  2168. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2169. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2170. channel (e.g. FL for front left) or its index in the input channel layout.
  2171. @var{out_channel} is the name of the output channel or its index in the output
  2172. channel layout. If @var{out_channel} is not given then it is implicitly an
  2173. index, starting with zero and increasing by one for each mapping.
  2174. @item channel_layout
  2175. The channel layout of the output stream.
  2176. @end table
  2177. If no mapping is present, the filter will implicitly map input channels to
  2178. output channels, preserving indices.
  2179. @subsection Examples
  2180. @itemize
  2181. @item
  2182. For example, assuming a 5.1+downmix input MOV file,
  2183. @example
  2184. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2185. @end example
  2186. will create an output WAV file tagged as stereo from the downmix channels of
  2187. the input.
  2188. @item
  2189. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2190. @example
  2191. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2192. @end example
  2193. @end itemize
  2194. @section channelsplit
  2195. Split each channel from an input audio stream into a separate output stream.
  2196. It accepts the following parameters:
  2197. @table @option
  2198. @item channel_layout
  2199. The channel layout of the input stream. The default is "stereo".
  2200. @item channels
  2201. A channel layout describing the channels to be extracted as separate output streams
  2202. or "all" to extract each input channel as a separate stream. The default is "all".
  2203. Choosing channels not present in channel layout in the input will result in an error.
  2204. @end table
  2205. @subsection Examples
  2206. @itemize
  2207. @item
  2208. For example, assuming a stereo input MP3 file,
  2209. @example
  2210. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2211. @end example
  2212. will create an output Matroska file with two audio streams, one containing only
  2213. the left channel and the other the right channel.
  2214. @item
  2215. Split a 5.1 WAV file into per-channel files:
  2216. @example
  2217. ffmpeg -i in.wav -filter_complex
  2218. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2219. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2220. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2221. side_right.wav
  2222. @end example
  2223. @item
  2224. Extract only LFE from a 5.1 WAV file:
  2225. @example
  2226. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2227. -map '[LFE]' lfe.wav
  2228. @end example
  2229. @end itemize
  2230. @section chorus
  2231. Add a chorus effect to the audio.
  2232. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2233. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2234. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2235. The modulation depth defines the range the modulated delay is played before or after
  2236. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2237. sound tuned around the original one, like in a chorus where some vocals are slightly
  2238. off key.
  2239. It accepts the following parameters:
  2240. @table @option
  2241. @item in_gain
  2242. Set input gain. Default is 0.4.
  2243. @item out_gain
  2244. Set output gain. Default is 0.4.
  2245. @item delays
  2246. Set delays. A typical delay is around 40ms to 60ms.
  2247. @item decays
  2248. Set decays.
  2249. @item speeds
  2250. Set speeds.
  2251. @item depths
  2252. Set depths.
  2253. @end table
  2254. @subsection Examples
  2255. @itemize
  2256. @item
  2257. A single delay:
  2258. @example
  2259. chorus=0.7:0.9:55:0.4:0.25:2
  2260. @end example
  2261. @item
  2262. Two delays:
  2263. @example
  2264. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2265. @end example
  2266. @item
  2267. Fuller sounding chorus with three delays:
  2268. @example
  2269. 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
  2270. @end example
  2271. @end itemize
  2272. @section compand
  2273. Compress or expand the audio's dynamic range.
  2274. It accepts the following parameters:
  2275. @table @option
  2276. @item attacks
  2277. @item decays
  2278. A list of times in seconds for each channel over which the instantaneous level
  2279. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2280. increase of volume and @var{decays} refers to decrease of volume. For most
  2281. situations, the attack time (response to the audio getting louder) should be
  2282. shorter than the decay time, because the human ear is more sensitive to sudden
  2283. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2284. a typical value for decay is 0.8 seconds.
  2285. If specified number of attacks & decays is lower than number of channels, the last
  2286. set attack/decay will be used for all remaining channels.
  2287. @item points
  2288. A list of points for the transfer function, specified in dB relative to the
  2289. maximum possible signal amplitude. Each key points list must be defined using
  2290. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2291. @code{x0/y0 x1/y1 x2/y2 ....}
  2292. The input values must be in strictly increasing order but the transfer function
  2293. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2294. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2295. function are @code{-70/-70|-60/-20|1/0}.
  2296. @item soft-knee
  2297. Set the curve radius in dB for all joints. It defaults to 0.01.
  2298. @item gain
  2299. Set the additional gain in dB to be applied at all points on the transfer
  2300. function. This allows for easy adjustment of the overall gain.
  2301. It defaults to 0.
  2302. @item volume
  2303. Set an initial volume, in dB, to be assumed for each channel when filtering
  2304. starts. This permits the user to supply a nominal level initially, so that, for
  2305. example, a very large gain is not applied to initial signal levels before the
  2306. companding has begun to operate. A typical value for audio which is initially
  2307. quiet is -90 dB. It defaults to 0.
  2308. @item delay
  2309. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2310. delayed before being fed to the volume adjuster. Specifying a delay
  2311. approximately equal to the attack/decay times allows the filter to effectively
  2312. operate in predictive rather than reactive mode. It defaults to 0.
  2313. @end table
  2314. @subsection Examples
  2315. @itemize
  2316. @item
  2317. Make music with both quiet and loud passages suitable for listening to in a
  2318. noisy environment:
  2319. @example
  2320. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2321. @end example
  2322. Another example for audio with whisper and explosion parts:
  2323. @example
  2324. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2325. @end example
  2326. @item
  2327. A noise gate for when the noise is at a lower level than the signal:
  2328. @example
  2329. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2330. @end example
  2331. @item
  2332. Here is another noise gate, this time for when the noise is at a higher level
  2333. than the signal (making it, in some ways, similar to squelch):
  2334. @example
  2335. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2336. @end example
  2337. @item
  2338. 2:1 compression starting at -6dB:
  2339. @example
  2340. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2341. @end example
  2342. @item
  2343. 2:1 compression starting at -9dB:
  2344. @example
  2345. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2346. @end example
  2347. @item
  2348. 2:1 compression starting at -12dB:
  2349. @example
  2350. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2351. @end example
  2352. @item
  2353. 2:1 compression starting at -18dB:
  2354. @example
  2355. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2356. @end example
  2357. @item
  2358. 3:1 compression starting at -15dB:
  2359. @example
  2360. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2361. @end example
  2362. @item
  2363. Compressor/Gate:
  2364. @example
  2365. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2366. @end example
  2367. @item
  2368. Expander:
  2369. @example
  2370. 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
  2371. @end example
  2372. @item
  2373. Hard limiter at -6dB:
  2374. @example
  2375. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2376. @end example
  2377. @item
  2378. Hard limiter at -12dB:
  2379. @example
  2380. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2381. @end example
  2382. @item
  2383. Hard noise gate at -35 dB:
  2384. @example
  2385. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2386. @end example
  2387. @item
  2388. Soft limiter:
  2389. @example
  2390. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2391. @end example
  2392. @end itemize
  2393. @section compensationdelay
  2394. Compensation Delay Line is a metric based delay to compensate differing
  2395. positions of microphones or speakers.
  2396. For example, you have recorded guitar with two microphones placed in
  2397. different locations. Because the front of sound wave has fixed speed in
  2398. normal conditions, the phasing of microphones can vary and depends on
  2399. their location and interposition. The best sound mix can be achieved when
  2400. these microphones are in phase (synchronized). Note that a distance of
  2401. ~30 cm between microphones makes one microphone capture the signal in
  2402. antiphase to the other microphone. That makes the final mix sound moody.
  2403. This filter helps to solve phasing problems by adding different delays
  2404. to each microphone track and make them synchronized.
  2405. The best result can be reached when you take one track as base and
  2406. synchronize other tracks one by one with it.
  2407. Remember that synchronization/delay tolerance depends on sample rate, too.
  2408. Higher sample rates will give more tolerance.
  2409. The filter accepts the following parameters:
  2410. @table @option
  2411. @item mm
  2412. Set millimeters distance. This is compensation distance for fine tuning.
  2413. Default is 0.
  2414. @item cm
  2415. Set cm distance. This is compensation distance for tightening distance setup.
  2416. Default is 0.
  2417. @item m
  2418. Set meters distance. This is compensation distance for hard distance setup.
  2419. Default is 0.
  2420. @item dry
  2421. Set dry amount. Amount of unprocessed (dry) signal.
  2422. Default is 0.
  2423. @item wet
  2424. Set wet amount. Amount of processed (wet) signal.
  2425. Default is 1.
  2426. @item temp
  2427. Set temperature in degrees Celsius. This is the temperature of the environment.
  2428. Default is 20.
  2429. @end table
  2430. @section crossfeed
  2431. Apply headphone crossfeed filter.
  2432. Crossfeed is the process of blending the left and right channels of stereo
  2433. audio recording.
  2434. It is mainly used to reduce extreme stereo separation of low frequencies.
  2435. The intent is to produce more speaker like sound to the listener.
  2436. The filter accepts the following options:
  2437. @table @option
  2438. @item strength
  2439. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2440. This sets gain of low shelf filter for side part of stereo image.
  2441. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2442. @item range
  2443. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2444. This sets cut off frequency of low shelf filter. Default is cut off near
  2445. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2446. @item level_in
  2447. Set input gain. Default is 0.9.
  2448. @item level_out
  2449. Set output gain. Default is 1.
  2450. @end table
  2451. @section crystalizer
  2452. Simple algorithm to expand audio dynamic range.
  2453. The filter accepts the following options:
  2454. @table @option
  2455. @item i
  2456. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2457. (unchanged sound) to 10.0 (maximum effect).
  2458. @item c
  2459. Enable clipping. By default is enabled.
  2460. @end table
  2461. @section dcshift
  2462. Apply a DC shift to the audio.
  2463. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2464. in the recording chain) from the audio. The effect of a DC offset is reduced
  2465. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2466. a signal has a DC offset.
  2467. @table @option
  2468. @item shift
  2469. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2470. the audio.
  2471. @item limitergain
  2472. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2473. used to prevent clipping.
  2474. @end table
  2475. @section deesser
  2476. Apply de-essing to the audio samples.
  2477. @table @option
  2478. @item i
  2479. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2480. Default is 0.
  2481. @item m
  2482. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2483. Default is 0.5.
  2484. @item f
  2485. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2486. Default is 0.5.
  2487. @item s
  2488. Set the output mode.
  2489. It accepts the following values:
  2490. @table @option
  2491. @item i
  2492. Pass input unchanged.
  2493. @item o
  2494. Pass ess filtered out.
  2495. @item e
  2496. Pass only ess.
  2497. Default value is @var{o}.
  2498. @end table
  2499. @end table
  2500. @section drmeter
  2501. Measure audio dynamic range.
  2502. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2503. is found in transition material. And anything less that 8 have very poor dynamics
  2504. and is very compressed.
  2505. The filter accepts the following options:
  2506. @table @option
  2507. @item length
  2508. Set window length in seconds used to split audio into segments of equal length.
  2509. Default is 3 seconds.
  2510. @end table
  2511. @section dynaudnorm
  2512. Dynamic Audio Normalizer.
  2513. This filter applies a certain amount of gain to the input audio in order
  2514. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2515. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2516. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2517. This allows for applying extra gain to the "quiet" sections of the audio
  2518. while avoiding distortions or clipping the "loud" sections. In other words:
  2519. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2520. sections, in the sense that the volume of each section is brought to the
  2521. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2522. this goal *without* applying "dynamic range compressing". It will retain 100%
  2523. of the dynamic range *within* each section of the audio file.
  2524. @table @option
  2525. @item framelen, f
  2526. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2527. Default is 500 milliseconds.
  2528. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2529. referred to as frames. This is required, because a peak magnitude has no
  2530. meaning for just a single sample value. Instead, we need to determine the
  2531. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2532. normalizer would simply use the peak magnitude of the complete file, the
  2533. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2534. frame. The length of a frame is specified in milliseconds. By default, the
  2535. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2536. been found to give good results with most files.
  2537. Note that the exact frame length, in number of samples, will be determined
  2538. automatically, based on the sampling rate of the individual input audio file.
  2539. @item gausssize, g
  2540. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2541. number. Default is 31.
  2542. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2543. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2544. is specified in frames, centered around the current frame. For the sake of
  2545. simplicity, this must be an odd number. Consequently, the default value of 31
  2546. takes into account the current frame, as well as the 15 preceding frames and
  2547. the 15 subsequent frames. Using a larger window results in a stronger
  2548. smoothing effect and thus in less gain variation, i.e. slower gain
  2549. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2550. effect and thus in more gain variation, i.e. faster gain adaptation.
  2551. In other words, the more you increase this value, the more the Dynamic Audio
  2552. Normalizer will behave like a "traditional" normalization filter. On the
  2553. contrary, the more you decrease this value, the more the Dynamic Audio
  2554. Normalizer will behave like a dynamic range compressor.
  2555. @item peak, p
  2556. Set the target peak value. This specifies the highest permissible magnitude
  2557. level for the normalized audio input. This filter will try to approach the
  2558. target peak magnitude as closely as possible, but at the same time it also
  2559. makes sure that the normalized signal will never exceed the peak magnitude.
  2560. A frame's maximum local gain factor is imposed directly by the target peak
  2561. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2562. It is not recommended to go above this value.
  2563. @item maxgain, m
  2564. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2565. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2566. factor for each input frame, i.e. the maximum gain factor that does not
  2567. result in clipping or distortion. The maximum gain factor is determined by
  2568. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2569. additionally bounds the frame's maximum gain factor by a predetermined
  2570. (global) maximum gain factor. This is done in order to avoid excessive gain
  2571. factors in "silent" or almost silent frames. By default, the maximum gain
  2572. factor is 10.0, For most inputs the default value should be sufficient and
  2573. it usually is not recommended to increase this value. Though, for input
  2574. with an extremely low overall volume level, it may be necessary to allow even
  2575. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2576. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2577. Instead, a "sigmoid" threshold function will be applied. This way, the
  2578. gain factors will smoothly approach the threshold value, but never exceed that
  2579. value.
  2580. @item targetrms, r
  2581. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2582. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2583. This means that the maximum local gain factor for each frame is defined
  2584. (only) by the frame's highest magnitude sample. This way, the samples can
  2585. be amplified as much as possible without exceeding the maximum signal
  2586. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2587. Normalizer can also take into account the frame's root mean square,
  2588. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2589. determine the power of a time-varying signal. It is therefore considered
  2590. that the RMS is a better approximation of the "perceived loudness" than
  2591. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2592. frames to a constant RMS value, a uniform "perceived loudness" can be
  2593. established. If a target RMS value has been specified, a frame's local gain
  2594. factor is defined as the factor that would result in exactly that RMS value.
  2595. Note, however, that the maximum local gain factor is still restricted by the
  2596. frame's highest magnitude sample, in order to prevent clipping.
  2597. @item coupling, n
  2598. Enable channels coupling. By default is enabled.
  2599. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2600. amount. This means the same gain factor will be applied to all channels, i.e.
  2601. the maximum possible gain factor is determined by the "loudest" channel.
  2602. However, in some recordings, it may happen that the volume of the different
  2603. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2604. In this case, this option can be used to disable the channel coupling. This way,
  2605. the gain factor will be determined independently for each channel, depending
  2606. only on the individual channel's highest magnitude sample. This allows for
  2607. harmonizing the volume of the different channels.
  2608. @item correctdc, c
  2609. Enable DC bias correction. By default is disabled.
  2610. An audio signal (in the time domain) is a sequence of sample values.
  2611. In the Dynamic Audio Normalizer these sample values are represented in the
  2612. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2613. audio signal, or "waveform", should be centered around the zero point.
  2614. That means if we calculate the mean value of all samples in a file, or in a
  2615. single frame, then the result should be 0.0 or at least very close to that
  2616. value. If, however, there is a significant deviation of the mean value from
  2617. 0.0, in either positive or negative direction, this is referred to as a
  2618. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2619. Audio Normalizer provides optional DC bias correction.
  2620. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2621. the mean value, or "DC correction" offset, of each input frame and subtract
  2622. that value from all of the frame's sample values which ensures those samples
  2623. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2624. boundaries, the DC correction offset values will be interpolated smoothly
  2625. between neighbouring frames.
  2626. @item altboundary, b
  2627. Enable alternative boundary mode. By default is disabled.
  2628. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2629. around each frame. This includes the preceding frames as well as the
  2630. subsequent frames. However, for the "boundary" frames, located at the very
  2631. beginning and at the very end of the audio file, not all neighbouring
  2632. frames are available. In particular, for the first few frames in the audio
  2633. file, the preceding frames are not known. And, similarly, for the last few
  2634. frames in the audio file, the subsequent frames are not known. Thus, the
  2635. question arises which gain factors should be assumed for the missing frames
  2636. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2637. to deal with this situation. The default boundary mode assumes a gain factor
  2638. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2639. "fade out" at the beginning and at the end of the input, respectively.
  2640. @item compress, s
  2641. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2642. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2643. compression. This means that signal peaks will not be pruned and thus the
  2644. full dynamic range will be retained within each local neighbourhood. However,
  2645. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2646. normalization algorithm with a more "traditional" compression.
  2647. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2648. (thresholding) function. If (and only if) the compression feature is enabled,
  2649. all input frames will be processed by a soft knee thresholding function prior
  2650. to the actual normalization process. Put simply, the thresholding function is
  2651. going to prune all samples whose magnitude exceeds a certain threshold value.
  2652. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2653. value. Instead, the threshold value will be adjusted for each individual
  2654. frame.
  2655. In general, smaller parameters result in stronger compression, and vice versa.
  2656. Values below 3.0 are not recommended, because audible distortion may appear.
  2657. @end table
  2658. @section earwax
  2659. Make audio easier to listen to on headphones.
  2660. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2661. so that when listened to on headphones the stereo image is moved from
  2662. inside your head (standard for headphones) to outside and in front of
  2663. the listener (standard for speakers).
  2664. Ported from SoX.
  2665. @section equalizer
  2666. Apply a two-pole peaking equalisation (EQ) filter. With this
  2667. filter, the signal-level at and around a selected frequency can
  2668. be increased or decreased, whilst (unlike bandpass and bandreject
  2669. filters) that at all other frequencies is unchanged.
  2670. In order to produce complex equalisation curves, this filter can
  2671. be given several times, each with a different central frequency.
  2672. The filter accepts the following options:
  2673. @table @option
  2674. @item frequency, f
  2675. Set the filter's central frequency in Hz.
  2676. @item width_type, t
  2677. Set method to specify band-width of filter.
  2678. @table @option
  2679. @item h
  2680. Hz
  2681. @item q
  2682. Q-Factor
  2683. @item o
  2684. octave
  2685. @item s
  2686. slope
  2687. @item k
  2688. kHz
  2689. @end table
  2690. @item width, w
  2691. Specify the band-width of a filter in width_type units.
  2692. @item gain, g
  2693. Set the required gain or attenuation in dB.
  2694. Beware of clipping when using a positive gain.
  2695. @item mix, m
  2696. How much to use filtered signal in output. Default is 1.
  2697. Range is between 0 and 1.
  2698. @item channels, c
  2699. Specify which channels to filter, by default all available are filtered.
  2700. @item normalize, n
  2701. Normalize biquad coefficients, by default is disabled.
  2702. Enabling it will normalize magnitude response at DC to 0dB.
  2703. @end table
  2704. @subsection Examples
  2705. @itemize
  2706. @item
  2707. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2708. @example
  2709. equalizer=f=1000:t=h:width=200:g=-10
  2710. @end example
  2711. @item
  2712. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2713. @example
  2714. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2715. @end example
  2716. @end itemize
  2717. @subsection Commands
  2718. This filter supports the following commands:
  2719. @table @option
  2720. @item frequency, f
  2721. Change equalizer frequency.
  2722. Syntax for the command is : "@var{frequency}"
  2723. @item width_type, t
  2724. Change equalizer width_type.
  2725. Syntax for the command is : "@var{width_type}"
  2726. @item width, w
  2727. Change equalizer width.
  2728. Syntax for the command is : "@var{width}"
  2729. @item gain, g
  2730. Change equalizer gain.
  2731. Syntax for the command is : "@var{gain}"
  2732. @item mix, m
  2733. Change equalizer mix.
  2734. Syntax for the command is : "@var{mix}"
  2735. @end table
  2736. @section extrastereo
  2737. Linearly increases the difference between left and right channels which
  2738. adds some sort of "live" effect to playback.
  2739. The filter accepts the following options:
  2740. @table @option
  2741. @item m
  2742. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2743. (average of both channels), with 1.0 sound will be unchanged, with
  2744. -1.0 left and right channels will be swapped.
  2745. @item c
  2746. Enable clipping. By default is enabled.
  2747. @end table
  2748. @section firequalizer
  2749. Apply FIR Equalization using arbitrary frequency response.
  2750. The filter accepts the following option:
  2751. @table @option
  2752. @item gain
  2753. Set gain curve equation (in dB). The expression can contain variables:
  2754. @table @option
  2755. @item f
  2756. the evaluated frequency
  2757. @item sr
  2758. sample rate
  2759. @item ch
  2760. channel number, set to 0 when multichannels evaluation is disabled
  2761. @item chid
  2762. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2763. multichannels evaluation is disabled
  2764. @item chs
  2765. number of channels
  2766. @item chlayout
  2767. channel_layout, see libavutil/channel_layout.h
  2768. @end table
  2769. and functions:
  2770. @table @option
  2771. @item gain_interpolate(f)
  2772. interpolate gain on frequency f based on gain_entry
  2773. @item cubic_interpolate(f)
  2774. same as gain_interpolate, but smoother
  2775. @end table
  2776. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2777. @item gain_entry
  2778. Set gain entry for gain_interpolate function. The expression can
  2779. contain functions:
  2780. @table @option
  2781. @item entry(f, g)
  2782. store gain entry at frequency f with value g
  2783. @end table
  2784. This option is also available as command.
  2785. @item delay
  2786. Set filter delay in seconds. Higher value means more accurate.
  2787. Default is @code{0.01}.
  2788. @item accuracy
  2789. Set filter accuracy in Hz. Lower value means more accurate.
  2790. Default is @code{5}.
  2791. @item wfunc
  2792. Set window function. Acceptable values are:
  2793. @table @option
  2794. @item rectangular
  2795. rectangular window, useful when gain curve is already smooth
  2796. @item hann
  2797. hann window (default)
  2798. @item hamming
  2799. hamming window
  2800. @item blackman
  2801. blackman window
  2802. @item nuttall3
  2803. 3-terms continuous 1st derivative nuttall window
  2804. @item mnuttall3
  2805. minimum 3-terms discontinuous nuttall window
  2806. @item nuttall
  2807. 4-terms continuous 1st derivative nuttall window
  2808. @item bnuttall
  2809. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2810. @item bharris
  2811. blackman-harris window
  2812. @item tukey
  2813. tukey window
  2814. @end table
  2815. @item fixed
  2816. If enabled, use fixed number of audio samples. This improves speed when
  2817. filtering with large delay. Default is disabled.
  2818. @item multi
  2819. Enable multichannels evaluation on gain. Default is disabled.
  2820. @item zero_phase
  2821. Enable zero phase mode by subtracting timestamp to compensate delay.
  2822. Default is disabled.
  2823. @item scale
  2824. Set scale used by gain. Acceptable values are:
  2825. @table @option
  2826. @item linlin
  2827. linear frequency, linear gain
  2828. @item linlog
  2829. linear frequency, logarithmic (in dB) gain (default)
  2830. @item loglin
  2831. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2832. @item loglog
  2833. logarithmic frequency, logarithmic gain
  2834. @end table
  2835. @item dumpfile
  2836. Set file for dumping, suitable for gnuplot.
  2837. @item dumpscale
  2838. Set scale for dumpfile. Acceptable values are same with scale option.
  2839. Default is linlog.
  2840. @item fft2
  2841. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2842. Default is disabled.
  2843. @item min_phase
  2844. Enable minimum phase impulse response. Default is disabled.
  2845. @end table
  2846. @subsection Examples
  2847. @itemize
  2848. @item
  2849. lowpass at 1000 Hz:
  2850. @example
  2851. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2852. @end example
  2853. @item
  2854. lowpass at 1000 Hz with gain_entry:
  2855. @example
  2856. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2857. @end example
  2858. @item
  2859. custom equalization:
  2860. @example
  2861. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2862. @end example
  2863. @item
  2864. higher delay with zero phase to compensate delay:
  2865. @example
  2866. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2867. @end example
  2868. @item
  2869. lowpass on left channel, highpass on right channel:
  2870. @example
  2871. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2872. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2873. @end example
  2874. @end itemize
  2875. @section flanger
  2876. Apply a flanging effect to the audio.
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item delay
  2880. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2881. @item depth
  2882. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2883. @item regen
  2884. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2885. Default value is 0.
  2886. @item width
  2887. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2888. Default value is 71.
  2889. @item speed
  2890. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2891. @item shape
  2892. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2893. Default value is @var{sinusoidal}.
  2894. @item phase
  2895. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2896. Default value is 25.
  2897. @item interp
  2898. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2899. Default is @var{linear}.
  2900. @end table
  2901. @section haas
  2902. Apply Haas effect to audio.
  2903. Note that this makes most sense to apply on mono signals.
  2904. With this filter applied to mono signals it give some directionality and
  2905. stretches its stereo image.
  2906. The filter accepts the following options:
  2907. @table @option
  2908. @item level_in
  2909. Set input level. By default is @var{1}, or 0dB
  2910. @item level_out
  2911. Set output level. By default is @var{1}, or 0dB.
  2912. @item side_gain
  2913. Set gain applied to side part of signal. By default is @var{1}.
  2914. @item middle_source
  2915. Set kind of middle source. Can be one of the following:
  2916. @table @samp
  2917. @item left
  2918. Pick left channel.
  2919. @item right
  2920. Pick right channel.
  2921. @item mid
  2922. Pick middle part signal of stereo image.
  2923. @item side
  2924. Pick side part signal of stereo image.
  2925. @end table
  2926. @item middle_phase
  2927. Change middle phase. By default is disabled.
  2928. @item left_delay
  2929. Set left channel delay. By default is @var{2.05} milliseconds.
  2930. @item left_balance
  2931. Set left channel balance. By default is @var{-1}.
  2932. @item left_gain
  2933. Set left channel gain. By default is @var{1}.
  2934. @item left_phase
  2935. Change left phase. By default is disabled.
  2936. @item right_delay
  2937. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2938. @item right_balance
  2939. Set right channel balance. By default is @var{1}.
  2940. @item right_gain
  2941. Set right channel gain. By default is @var{1}.
  2942. @item right_phase
  2943. Change right phase. By default is enabled.
  2944. @end table
  2945. @section hdcd
  2946. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2947. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2948. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2949. of HDCD, and detects the Transient Filter flag.
  2950. @example
  2951. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2952. @end example
  2953. When using the filter with wav, note the default encoding for wav is 16-bit,
  2954. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2955. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2956. @example
  2957. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2958. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2959. @end example
  2960. The filter accepts the following options:
  2961. @table @option
  2962. @item disable_autoconvert
  2963. Disable any automatic format conversion or resampling in the filter graph.
  2964. @item process_stereo
  2965. Process the stereo channels together. If target_gain does not match between
  2966. channels, consider it invalid and use the last valid target_gain.
  2967. @item cdt_ms
  2968. Set the code detect timer period in ms.
  2969. @item force_pe
  2970. Always extend peaks above -3dBFS even if PE isn't signaled.
  2971. @item analyze_mode
  2972. Replace audio with a solid tone and adjust the amplitude to signal some
  2973. specific aspect of the decoding process. The output file can be loaded in
  2974. an audio editor alongside the original to aid analysis.
  2975. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2976. Modes are:
  2977. @table @samp
  2978. @item 0, off
  2979. Disabled
  2980. @item 1, lle
  2981. Gain adjustment level at each sample
  2982. @item 2, pe
  2983. Samples where peak extend occurs
  2984. @item 3, cdt
  2985. Samples where the code detect timer is active
  2986. @item 4, tgm
  2987. Samples where the target gain does not match between channels
  2988. @end table
  2989. @end table
  2990. @section headphone
  2991. Apply head-related transfer functions (HRTFs) to create virtual
  2992. loudspeakers around the user for binaural listening via headphones.
  2993. The HRIRs are provided via additional streams, for each channel
  2994. one stereo input stream is needed.
  2995. The filter accepts the following options:
  2996. @table @option
  2997. @item map
  2998. Set mapping of input streams for convolution.
  2999. The argument is a '|'-separated list of channel names in order as they
  3000. are given as additional stream inputs for filter.
  3001. This also specify number of input streams. Number of input streams
  3002. must be not less than number of channels in first stream plus one.
  3003. @item gain
  3004. Set gain applied to audio. Value is in dB. Default is 0.
  3005. @item type
  3006. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3007. processing audio in time domain which is slow.
  3008. @var{freq} is processing audio in frequency domain which is fast.
  3009. Default is @var{freq}.
  3010. @item lfe
  3011. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3012. @item size
  3013. Set size of frame in number of samples which will be processed at once.
  3014. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3015. @item hrir
  3016. Set format of hrir stream.
  3017. Default value is @var{stereo}. Alternative value is @var{multich}.
  3018. If value is set to @var{stereo}, number of additional streams should
  3019. be greater or equal to number of input channels in first input stream.
  3020. Also each additional stream should have stereo number of channels.
  3021. If value is set to @var{multich}, number of additional streams should
  3022. be exactly one. Also number of input channels of additional stream
  3023. should be equal or greater than twice number of channels of first input
  3024. stream.
  3025. @end table
  3026. @subsection Examples
  3027. @itemize
  3028. @item
  3029. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3030. each amovie filter use stereo file with IR coefficients as input.
  3031. The files give coefficients for each position of virtual loudspeaker:
  3032. @example
  3033. ffmpeg -i input.wav
  3034. -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"
  3035. output.wav
  3036. @end example
  3037. @item
  3038. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3039. but now in @var{multich} @var{hrir} format.
  3040. @example
  3041. 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"
  3042. output.wav
  3043. @end example
  3044. @end itemize
  3045. @section highpass
  3046. Apply a high-pass filter with 3dB point frequency.
  3047. The filter can be either single-pole, or double-pole (the default).
  3048. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3049. The filter accepts the following options:
  3050. @table @option
  3051. @item frequency, f
  3052. Set frequency in Hz. Default is 3000.
  3053. @item poles, p
  3054. Set number of poles. Default is 2.
  3055. @item width_type, t
  3056. Set method to specify band-width of filter.
  3057. @table @option
  3058. @item h
  3059. Hz
  3060. @item q
  3061. Q-Factor
  3062. @item o
  3063. octave
  3064. @item s
  3065. slope
  3066. @item k
  3067. kHz
  3068. @end table
  3069. @item width, w
  3070. Specify the band-width of a filter in width_type units.
  3071. Applies only to double-pole filter.
  3072. The default is 0.707q and gives a Butterworth response.
  3073. @item mix, m
  3074. How much to use filtered signal in output. Default is 1.
  3075. Range is between 0 and 1.
  3076. @item channels, c
  3077. Specify which channels to filter, by default all available are filtered.
  3078. @item normalize, n
  3079. Normalize biquad coefficients, by default is disabled.
  3080. Enabling it will normalize magnitude response at DC to 0dB.
  3081. @end table
  3082. @subsection Commands
  3083. This filter supports the following commands:
  3084. @table @option
  3085. @item frequency, f
  3086. Change highpass frequency.
  3087. Syntax for the command is : "@var{frequency}"
  3088. @item width_type, t
  3089. Change highpass width_type.
  3090. Syntax for the command is : "@var{width_type}"
  3091. @item width, w
  3092. Change highpass width.
  3093. Syntax for the command is : "@var{width}"
  3094. @item mix, m
  3095. Change highpass mix.
  3096. Syntax for the command is : "@var{mix}"
  3097. @end table
  3098. @section join
  3099. Join multiple input streams into one multi-channel stream.
  3100. It accepts the following parameters:
  3101. @table @option
  3102. @item inputs
  3103. The number of input streams. It defaults to 2.
  3104. @item channel_layout
  3105. The desired output channel layout. It defaults to stereo.
  3106. @item map
  3107. Map channels from inputs to output. The argument is a '|'-separated list of
  3108. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3109. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3110. can be either the name of the input channel (e.g. FL for front left) or its
  3111. index in the specified input stream. @var{out_channel} is the name of the output
  3112. channel.
  3113. @end table
  3114. The filter will attempt to guess the mappings when they are not specified
  3115. explicitly. It does so by first trying to find an unused matching input channel
  3116. and if that fails it picks the first unused input channel.
  3117. Join 3 inputs (with properly set channel layouts):
  3118. @example
  3119. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3120. @end example
  3121. Build a 5.1 output from 6 single-channel streams:
  3122. @example
  3123. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3124. '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'
  3125. out
  3126. @end example
  3127. @section ladspa
  3128. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3129. To enable compilation of this filter you need to configure FFmpeg with
  3130. @code{--enable-ladspa}.
  3131. @table @option
  3132. @item file, f
  3133. Specifies the name of LADSPA plugin library to load. If the environment
  3134. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3135. each one of the directories specified by the colon separated list in
  3136. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3137. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3138. @file{/usr/lib/ladspa/}.
  3139. @item plugin, p
  3140. Specifies the plugin within the library. Some libraries contain only
  3141. one plugin, but others contain many of them. If this is not set filter
  3142. will list all available plugins within the specified library.
  3143. @item controls, c
  3144. Set the '|' separated list of controls which are zero or more floating point
  3145. values that determine the behavior of the loaded plugin (for example delay,
  3146. threshold or gain).
  3147. Controls need to be defined using the following syntax:
  3148. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3149. @var{valuei} is the value set on the @var{i}-th control.
  3150. Alternatively they can be also defined using the following syntax:
  3151. @var{value0}|@var{value1}|@var{value2}|..., where
  3152. @var{valuei} is the value set on the @var{i}-th control.
  3153. If @option{controls} is set to @code{help}, all available controls and
  3154. their valid ranges are printed.
  3155. @item sample_rate, s
  3156. Specify the sample rate, default to 44100. Only used if plugin have
  3157. zero inputs.
  3158. @item nb_samples, n
  3159. Set the number of samples per channel per each output frame, default
  3160. is 1024. Only used if plugin have zero inputs.
  3161. @item duration, d
  3162. Set the minimum duration of the sourced audio. See
  3163. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3164. for the accepted syntax.
  3165. Note that the resulting duration may be greater than the specified duration,
  3166. as the generated audio is always cut at the end of a complete frame.
  3167. If not specified, or the expressed duration is negative, the audio is
  3168. supposed to be generated forever.
  3169. Only used if plugin have zero inputs.
  3170. @end table
  3171. @subsection Examples
  3172. @itemize
  3173. @item
  3174. List all available plugins within amp (LADSPA example plugin) library:
  3175. @example
  3176. ladspa=file=amp
  3177. @end example
  3178. @item
  3179. List all available controls and their valid ranges for @code{vcf_notch}
  3180. plugin from @code{VCF} library:
  3181. @example
  3182. ladspa=f=vcf:p=vcf_notch:c=help
  3183. @end example
  3184. @item
  3185. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3186. plugin library:
  3187. @example
  3188. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3189. @end example
  3190. @item
  3191. Add reverberation to the audio using TAP-plugins
  3192. (Tom's Audio Processing plugins):
  3193. @example
  3194. ladspa=file=tap_reverb:tap_reverb
  3195. @end example
  3196. @item
  3197. Generate white noise, with 0.2 amplitude:
  3198. @example
  3199. ladspa=file=cmt:noise_source_white:c=c0=.2
  3200. @end example
  3201. @item
  3202. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3203. @code{C* Audio Plugin Suite} (CAPS) library:
  3204. @example
  3205. ladspa=file=caps:Click:c=c1=20'
  3206. @end example
  3207. @item
  3208. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3209. @example
  3210. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3211. @end example
  3212. @item
  3213. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3214. @code{SWH Plugins} collection:
  3215. @example
  3216. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3217. @end example
  3218. @item
  3219. Attenuate low frequencies using Multiband EQ from Steve Harris
  3220. @code{SWH Plugins} collection:
  3221. @example
  3222. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3223. @end example
  3224. @item
  3225. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3226. (CAPS) library:
  3227. @example
  3228. ladspa=caps:Narrower
  3229. @end example
  3230. @item
  3231. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3232. @example
  3233. ladspa=caps:White:.2
  3234. @end example
  3235. @item
  3236. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3237. @example
  3238. ladspa=caps:Fractal:c=c1=1
  3239. @end example
  3240. @item
  3241. Dynamic volume normalization using @code{VLevel} plugin:
  3242. @example
  3243. ladspa=vlevel-ladspa:vlevel_mono
  3244. @end example
  3245. @end itemize
  3246. @subsection Commands
  3247. This filter supports the following commands:
  3248. @table @option
  3249. @item cN
  3250. Modify the @var{N}-th control value.
  3251. If the specified value is not valid, it is ignored and prior one is kept.
  3252. @end table
  3253. @section loudnorm
  3254. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3255. Support for both single pass (livestreams, files) and double pass (files) modes.
  3256. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3257. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3258. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3259. The filter accepts the following options:
  3260. @table @option
  3261. @item I, i
  3262. Set integrated loudness target.
  3263. Range is -70.0 - -5.0. Default value is -24.0.
  3264. @item LRA, lra
  3265. Set loudness range target.
  3266. Range is 1.0 - 20.0. Default value is 7.0.
  3267. @item TP, tp
  3268. Set maximum true peak.
  3269. Range is -9.0 - +0.0. Default value is -2.0.
  3270. @item measured_I, measured_i
  3271. Measured IL of input file.
  3272. Range is -99.0 - +0.0.
  3273. @item measured_LRA, measured_lra
  3274. Measured LRA of input file.
  3275. Range is 0.0 - 99.0.
  3276. @item measured_TP, measured_tp
  3277. Measured true peak of input file.
  3278. Range is -99.0 - +99.0.
  3279. @item measured_thresh
  3280. Measured threshold of input file.
  3281. Range is -99.0 - +0.0.
  3282. @item offset
  3283. Set offset gain. Gain is applied before the true-peak limiter.
  3284. Range is -99.0 - +99.0. Default is +0.0.
  3285. @item linear
  3286. Normalize linearly if possible.
  3287. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3288. to be specified in order to use this mode.
  3289. Options are true or false. Default is true.
  3290. @item dual_mono
  3291. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3292. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3293. If set to @code{true}, this option will compensate for this effect.
  3294. Multi-channel input files are not affected by this option.
  3295. Options are true or false. Default is false.
  3296. @item print_format
  3297. Set print format for stats. Options are summary, json, or none.
  3298. Default value is none.
  3299. @end table
  3300. @section lowpass
  3301. Apply a low-pass filter with 3dB point frequency.
  3302. The filter can be either single-pole or double-pole (the default).
  3303. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3304. The filter accepts the following options:
  3305. @table @option
  3306. @item frequency, f
  3307. Set frequency in Hz. Default is 500.
  3308. @item poles, p
  3309. Set number of poles. Default is 2.
  3310. @item width_type, t
  3311. Set method to specify band-width of filter.
  3312. @table @option
  3313. @item h
  3314. Hz
  3315. @item q
  3316. Q-Factor
  3317. @item o
  3318. octave
  3319. @item s
  3320. slope
  3321. @item k
  3322. kHz
  3323. @end table
  3324. @item width, w
  3325. Specify the band-width of a filter in width_type units.
  3326. Applies only to double-pole filter.
  3327. The default is 0.707q and gives a Butterworth response.
  3328. @item mix, m
  3329. How much to use filtered signal in output. Default is 1.
  3330. Range is between 0 and 1.
  3331. @item channels, c
  3332. Specify which channels to filter, by default all available are filtered.
  3333. @item normalize, n
  3334. Normalize biquad coefficients, by default is disabled.
  3335. Enabling it will normalize magnitude response at DC to 0dB.
  3336. @end table
  3337. @subsection Examples
  3338. @itemize
  3339. @item
  3340. Lowpass only LFE channel, it LFE is not present it does nothing:
  3341. @example
  3342. lowpass=c=LFE
  3343. @end example
  3344. @end itemize
  3345. @subsection Commands
  3346. This filter supports the following commands:
  3347. @table @option
  3348. @item frequency, f
  3349. Change lowpass frequency.
  3350. Syntax for the command is : "@var{frequency}"
  3351. @item width_type, t
  3352. Change lowpass width_type.
  3353. Syntax for the command is : "@var{width_type}"
  3354. @item width, w
  3355. Change lowpass width.
  3356. Syntax for the command is : "@var{width}"
  3357. @item mix, m
  3358. Change lowpass mix.
  3359. Syntax for the command is : "@var{mix}"
  3360. @end table
  3361. @section lv2
  3362. Load a LV2 (LADSPA Version 2) plugin.
  3363. To enable compilation of this filter you need to configure FFmpeg with
  3364. @code{--enable-lv2}.
  3365. @table @option
  3366. @item plugin, p
  3367. Specifies the plugin URI. You may need to escape ':'.
  3368. @item controls, c
  3369. Set the '|' separated list of controls which are zero or more floating point
  3370. values that determine the behavior of the loaded plugin (for example delay,
  3371. threshold or gain).
  3372. If @option{controls} is set to @code{help}, all available controls and
  3373. their valid ranges are printed.
  3374. @item sample_rate, s
  3375. Specify the sample rate, default to 44100. Only used if plugin have
  3376. zero inputs.
  3377. @item nb_samples, n
  3378. Set the number of samples per channel per each output frame, default
  3379. is 1024. Only used if plugin have zero inputs.
  3380. @item duration, d
  3381. Set the minimum duration of the sourced audio. See
  3382. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3383. for the accepted syntax.
  3384. Note that the resulting duration may be greater than the specified duration,
  3385. as the generated audio is always cut at the end of a complete frame.
  3386. If not specified, or the expressed duration is negative, the audio is
  3387. supposed to be generated forever.
  3388. Only used if plugin have zero inputs.
  3389. @end table
  3390. @subsection Examples
  3391. @itemize
  3392. @item
  3393. Apply bass enhancer plugin from Calf:
  3394. @example
  3395. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3396. @end example
  3397. @item
  3398. Apply vinyl plugin from Calf:
  3399. @example
  3400. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3401. @end example
  3402. @item
  3403. Apply bit crusher plugin from ArtyFX:
  3404. @example
  3405. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3406. @end example
  3407. @end itemize
  3408. @section mcompand
  3409. Multiband Compress or expand the audio's dynamic range.
  3410. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3411. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3412. response when absent compander action.
  3413. It accepts the following parameters:
  3414. @table @option
  3415. @item args
  3416. This option syntax is:
  3417. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3418. For explanation of each item refer to compand filter documentation.
  3419. @end table
  3420. @anchor{pan}
  3421. @section pan
  3422. Mix channels with specific gain levels. The filter accepts the output
  3423. channel layout followed by a set of channels definitions.
  3424. This filter is also designed to efficiently remap the channels of an audio
  3425. stream.
  3426. The filter accepts parameters of the form:
  3427. "@var{l}|@var{outdef}|@var{outdef}|..."
  3428. @table @option
  3429. @item l
  3430. output channel layout or number of channels
  3431. @item outdef
  3432. output channel specification, of the form:
  3433. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3434. @item out_name
  3435. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3436. number (c0, c1, etc.)
  3437. @item gain
  3438. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3439. @item in_name
  3440. input channel to use, see out_name for details; it is not possible to mix
  3441. named and numbered input channels
  3442. @end table
  3443. If the `=' in a channel specification is replaced by `<', then the gains for
  3444. that specification will be renormalized so that the total is 1, thus
  3445. avoiding clipping noise.
  3446. @subsection Mixing examples
  3447. For example, if you want to down-mix from stereo to mono, but with a bigger
  3448. factor for the left channel:
  3449. @example
  3450. pan=1c|c0=0.9*c0+0.1*c1
  3451. @end example
  3452. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3453. 7-channels surround:
  3454. @example
  3455. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3456. @end example
  3457. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3458. that should be preferred (see "-ac" option) unless you have very specific
  3459. needs.
  3460. @subsection Remapping examples
  3461. The channel remapping will be effective if, and only if:
  3462. @itemize
  3463. @item gain coefficients are zeroes or ones,
  3464. @item only one input per channel output,
  3465. @end itemize
  3466. If all these conditions are satisfied, the filter will notify the user ("Pure
  3467. channel mapping detected"), and use an optimized and lossless method to do the
  3468. remapping.
  3469. For example, if you have a 5.1 source and want a stereo audio stream by
  3470. dropping the extra channels:
  3471. @example
  3472. pan="stereo| c0=FL | c1=FR"
  3473. @end example
  3474. Given the same source, you can also switch front left and front right channels
  3475. and keep the input channel layout:
  3476. @example
  3477. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3478. @end example
  3479. If the input is a stereo audio stream, you can mute the front left channel (and
  3480. still keep the stereo channel layout) with:
  3481. @example
  3482. pan="stereo|c1=c1"
  3483. @end example
  3484. Still with a stereo audio stream input, you can copy the right channel in both
  3485. front left and right:
  3486. @example
  3487. pan="stereo| c0=FR | c1=FR"
  3488. @end example
  3489. @section replaygain
  3490. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3491. outputs it unchanged.
  3492. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3493. @section resample
  3494. Convert the audio sample format, sample rate and channel layout. It is
  3495. not meant to be used directly.
  3496. @section rubberband
  3497. Apply time-stretching and pitch-shifting with librubberband.
  3498. To enable compilation of this filter, you need to configure FFmpeg with
  3499. @code{--enable-librubberband}.
  3500. The filter accepts the following options:
  3501. @table @option
  3502. @item tempo
  3503. Set tempo scale factor.
  3504. @item pitch
  3505. Set pitch scale factor.
  3506. @item transients
  3507. Set transients detector.
  3508. Possible values are:
  3509. @table @var
  3510. @item crisp
  3511. @item mixed
  3512. @item smooth
  3513. @end table
  3514. @item detector
  3515. Set detector.
  3516. Possible values are:
  3517. @table @var
  3518. @item compound
  3519. @item percussive
  3520. @item soft
  3521. @end table
  3522. @item phase
  3523. Set phase.
  3524. Possible values are:
  3525. @table @var
  3526. @item laminar
  3527. @item independent
  3528. @end table
  3529. @item window
  3530. Set processing window size.
  3531. Possible values are:
  3532. @table @var
  3533. @item standard
  3534. @item short
  3535. @item long
  3536. @end table
  3537. @item smoothing
  3538. Set smoothing.
  3539. Possible values are:
  3540. @table @var
  3541. @item off
  3542. @item on
  3543. @end table
  3544. @item formant
  3545. Enable formant preservation when shift pitching.
  3546. Possible values are:
  3547. @table @var
  3548. @item shifted
  3549. @item preserved
  3550. @end table
  3551. @item pitchq
  3552. Set pitch quality.
  3553. Possible values are:
  3554. @table @var
  3555. @item quality
  3556. @item speed
  3557. @item consistency
  3558. @end table
  3559. @item channels
  3560. Set channels.
  3561. Possible values are:
  3562. @table @var
  3563. @item apart
  3564. @item together
  3565. @end table
  3566. @end table
  3567. @subsection Commands
  3568. This filter supports the following commands:
  3569. @table @option
  3570. @item tempo
  3571. Change filter tempo scale factor.
  3572. Syntax for the command is : "@var{tempo}"
  3573. @item pitch
  3574. Change filter pitch scale factor.
  3575. Syntax for the command is : "@var{pitch}"
  3576. @end table
  3577. @section sidechaincompress
  3578. This filter acts like normal compressor but has the ability to compress
  3579. detected signal using second input signal.
  3580. It needs two input streams and returns one output stream.
  3581. First input stream will be processed depending on second stream signal.
  3582. The filtered signal then can be filtered with other filters in later stages of
  3583. processing. See @ref{pan} and @ref{amerge} filter.
  3584. The filter accepts the following options:
  3585. @table @option
  3586. @item level_in
  3587. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3588. @item mode
  3589. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3590. Default is @code{downward}.
  3591. @item threshold
  3592. If a signal of second stream raises above this level it will affect the gain
  3593. reduction of first stream.
  3594. By default is 0.125. Range is between 0.00097563 and 1.
  3595. @item ratio
  3596. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3597. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3598. Default is 2. Range is between 1 and 20.
  3599. @item attack
  3600. Amount of milliseconds the signal has to rise above the threshold before gain
  3601. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3602. @item release
  3603. Amount of milliseconds the signal has to fall below the threshold before
  3604. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3605. @item makeup
  3606. Set the amount by how much signal will be amplified after processing.
  3607. Default is 1. Range is from 1 to 64.
  3608. @item knee
  3609. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3610. Default is 2.82843. Range is between 1 and 8.
  3611. @item link
  3612. Choose if the @code{average} level between all channels of side-chain stream
  3613. or the louder(@code{maximum}) channel of side-chain stream affects the
  3614. reduction. Default is @code{average}.
  3615. @item detection
  3616. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3617. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3618. @item level_sc
  3619. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3620. @item mix
  3621. How much to use compressed signal in output. Default is 1.
  3622. Range is between 0 and 1.
  3623. @end table
  3624. @subsection Examples
  3625. @itemize
  3626. @item
  3627. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3628. depending on the signal of 2nd input and later compressed signal to be
  3629. merged with 2nd input:
  3630. @example
  3631. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3632. @end example
  3633. @end itemize
  3634. @section sidechaingate
  3635. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3636. filter the detected signal before sending it to the gain reduction stage.
  3637. Normally a gate uses the full range signal to detect a level above the
  3638. threshold.
  3639. For example: If you cut all lower frequencies from your sidechain signal
  3640. the gate will decrease the volume of your track only if not enough highs
  3641. appear. With this technique you are able to reduce the resonation of a
  3642. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3643. guitar.
  3644. It needs two input streams and returns one output stream.
  3645. First input stream will be processed depending on second stream signal.
  3646. The filter accepts the following options:
  3647. @table @option
  3648. @item level_in
  3649. Set input level before filtering.
  3650. Default is 1. Allowed range is from 0.015625 to 64.
  3651. @item mode
  3652. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3653. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3654. will be amplified, expanding dynamic range in upward direction.
  3655. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3656. @item range
  3657. Set the level of gain reduction when the signal is below the threshold.
  3658. Default is 0.06125. Allowed range is from 0 to 1.
  3659. Setting this to 0 disables reduction and then filter behaves like expander.
  3660. @item threshold
  3661. If a signal rises above this level the gain reduction is released.
  3662. Default is 0.125. Allowed range is from 0 to 1.
  3663. @item ratio
  3664. Set a ratio about which the signal is reduced.
  3665. Default is 2. Allowed range is from 1 to 9000.
  3666. @item attack
  3667. Amount of milliseconds the signal has to rise above the threshold before gain
  3668. reduction stops.
  3669. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3670. @item release
  3671. Amount of milliseconds the signal has to fall below the threshold before the
  3672. reduction is increased again. Default is 250 milliseconds.
  3673. Allowed range is from 0.01 to 9000.
  3674. @item makeup
  3675. Set amount of amplification of signal after processing.
  3676. Default is 1. Allowed range is from 1 to 64.
  3677. @item knee
  3678. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3679. Default is 2.828427125. Allowed range is from 1 to 8.
  3680. @item detection
  3681. Choose if exact signal should be taken for detection or an RMS like one.
  3682. Default is rms. Can be peak or rms.
  3683. @item link
  3684. Choose if the average level between all channels or the louder channel affects
  3685. the reduction.
  3686. Default is average. Can be average or maximum.
  3687. @item level_sc
  3688. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3689. @end table
  3690. @section silencedetect
  3691. Detect silence in an audio stream.
  3692. This filter logs a message when it detects that the input audio volume is less
  3693. or equal to a noise tolerance value for a duration greater or equal to the
  3694. minimum detected noise duration.
  3695. The printed times and duration are expressed in seconds. The
  3696. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3697. is set on the first frame whose timestamp equals or exceeds the detection
  3698. duration and it contains the timestamp of the first frame of the silence.
  3699. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3700. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3701. keys are set on the first frame after the silence. If @option{mono} is
  3702. enabled, and each channel is evaluated separately, the @code{.X}
  3703. suffixed keys are used, and @code{X} corresponds to the channel number.
  3704. The filter accepts the following options:
  3705. @table @option
  3706. @item noise, n
  3707. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3708. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3709. @item duration, d
  3710. Set silence duration until notification (default is 2 seconds). See
  3711. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3712. for the accepted syntax.
  3713. @item mono, m
  3714. Process each channel separately, instead of combined. By default is disabled.
  3715. @end table
  3716. @subsection Examples
  3717. @itemize
  3718. @item
  3719. Detect 5 seconds of silence with -50dB noise tolerance:
  3720. @example
  3721. silencedetect=n=-50dB:d=5
  3722. @end example
  3723. @item
  3724. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3725. tolerance in @file{silence.mp3}:
  3726. @example
  3727. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3728. @end example
  3729. @end itemize
  3730. @section silenceremove
  3731. Remove silence from the beginning, middle or end of the audio.
  3732. The filter accepts the following options:
  3733. @table @option
  3734. @item start_periods
  3735. This value is used to indicate if audio should be trimmed at beginning of
  3736. the audio. A value of zero indicates no silence should be trimmed from the
  3737. beginning. When specifying a non-zero value, it trims audio up until it
  3738. finds non-silence. Normally, when trimming silence from beginning of audio
  3739. the @var{start_periods} will be @code{1} but it can be increased to higher
  3740. values to trim all audio up to specific count of non-silence periods.
  3741. Default value is @code{0}.
  3742. @item start_duration
  3743. Specify the amount of time that non-silence must be detected before it stops
  3744. trimming audio. By increasing the duration, bursts of noises can be treated
  3745. as silence and trimmed off. Default value is @code{0}.
  3746. @item start_threshold
  3747. This indicates what sample value should be treated as silence. For digital
  3748. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3749. you may wish to increase the value to account for background noise.
  3750. Can be specified in dB (in case "dB" is appended to the specified value)
  3751. or amplitude ratio. Default value is @code{0}.
  3752. @item start_silence
  3753. Specify max duration of silence at beginning that will be kept after
  3754. trimming. Default is 0, which is equal to trimming all samples detected
  3755. as silence.
  3756. @item start_mode
  3757. Specify mode of detection of silence end in start of multi-channel audio.
  3758. Can be @var{any} or @var{all}. Default is @var{any}.
  3759. With @var{any}, any sample that is detected as non-silence will cause
  3760. stopped trimming of silence.
  3761. With @var{all}, only if all channels are detected as non-silence will cause
  3762. stopped trimming of silence.
  3763. @item stop_periods
  3764. Set the count for trimming silence from the end of audio.
  3765. To remove silence from the middle of a file, specify a @var{stop_periods}
  3766. that is negative. This value is then treated as a positive value and is
  3767. used to indicate the effect should restart processing as specified by
  3768. @var{start_periods}, making it suitable for removing periods of silence
  3769. in the middle of the audio.
  3770. Default value is @code{0}.
  3771. @item stop_duration
  3772. Specify a duration of silence that must exist before audio is not copied any
  3773. more. By specifying a higher duration, silence that is wanted can be left in
  3774. the audio.
  3775. Default value is @code{0}.
  3776. @item stop_threshold
  3777. This is the same as @option{start_threshold} but for trimming silence from
  3778. the end of audio.
  3779. Can be specified in dB (in case "dB" is appended to the specified value)
  3780. or amplitude ratio. Default value is @code{0}.
  3781. @item stop_silence
  3782. Specify max duration of silence at end that will be kept after
  3783. trimming. Default is 0, which is equal to trimming all samples detected
  3784. as silence.
  3785. @item stop_mode
  3786. Specify mode of detection of silence start in end of multi-channel audio.
  3787. Can be @var{any} or @var{all}. Default is @var{any}.
  3788. With @var{any}, any sample that is detected as non-silence will cause
  3789. stopped trimming of silence.
  3790. With @var{all}, only if all channels are detected as non-silence will cause
  3791. stopped trimming of silence.
  3792. @item detection
  3793. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3794. and works better with digital silence which is exactly 0.
  3795. Default value is @code{rms}.
  3796. @item window
  3797. Set duration in number of seconds used to calculate size of window in number
  3798. of samples for detecting silence.
  3799. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3800. @end table
  3801. @subsection Examples
  3802. @itemize
  3803. @item
  3804. The following example shows how this filter can be used to start a recording
  3805. that does not contain the delay at the start which usually occurs between
  3806. pressing the record button and the start of the performance:
  3807. @example
  3808. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3809. @end example
  3810. @item
  3811. Trim all silence encountered from beginning to end where there is more than 1
  3812. second of silence in audio:
  3813. @example
  3814. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3815. @end example
  3816. @item
  3817. Trim all digital silence samples, using peak detection, from beginning to end
  3818. where there is more than 0 samples of digital silence in audio and digital
  3819. silence is detected in all channels at same positions in stream:
  3820. @example
  3821. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3822. @end example
  3823. @end itemize
  3824. @section sofalizer
  3825. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3826. loudspeakers around the user for binaural listening via headphones (audio
  3827. formats up to 9 channels supported).
  3828. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3829. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3830. Austrian Academy of Sciences.
  3831. To enable compilation of this filter you need to configure FFmpeg with
  3832. @code{--enable-libmysofa}.
  3833. The filter accepts the following options:
  3834. @table @option
  3835. @item sofa
  3836. Set the SOFA file used for rendering.
  3837. @item gain
  3838. Set gain applied to audio. Value is in dB. Default is 0.
  3839. @item rotation
  3840. Set rotation of virtual loudspeakers in deg. Default is 0.
  3841. @item elevation
  3842. Set elevation of virtual speakers in deg. Default is 0.
  3843. @item radius
  3844. Set distance in meters between loudspeakers and the listener with near-field
  3845. HRTFs. Default is 1.
  3846. @item type
  3847. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3848. processing audio in time domain which is slow.
  3849. @var{freq} is processing audio in frequency domain which is fast.
  3850. Default is @var{freq}.
  3851. @item speakers
  3852. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3853. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3854. Each virtual loudspeaker is described with short channel name following with
  3855. azimuth and elevation in degrees.
  3856. Each virtual loudspeaker description is separated by '|'.
  3857. For example to override front left and front right channel positions use:
  3858. 'speakers=FL 45 15|FR 345 15'.
  3859. Descriptions with unrecognised channel names are ignored.
  3860. @item lfegain
  3861. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3862. @item framesize
  3863. Set custom frame size in number of samples. Default is 1024.
  3864. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3865. is set to @var{freq}.
  3866. @item normalize
  3867. Should all IRs be normalized upon importing SOFA file.
  3868. By default is enabled.
  3869. @item interpolate
  3870. Should nearest IRs be interpolated with neighbor IRs if exact position
  3871. does not match. By default is disabled.
  3872. @item minphase
  3873. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3874. @item anglestep
  3875. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3876. @item radstep
  3877. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3878. @end table
  3879. @subsection Examples
  3880. @itemize
  3881. @item
  3882. Using ClubFritz6 sofa file:
  3883. @example
  3884. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3885. @end example
  3886. @item
  3887. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3888. @example
  3889. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3890. @end example
  3891. @item
  3892. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3893. and also with custom gain:
  3894. @example
  3895. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3896. @end example
  3897. @end itemize
  3898. @section stereotools
  3899. This filter has some handy utilities to manage stereo signals, for converting
  3900. M/S stereo recordings to L/R signal while having control over the parameters
  3901. or spreading the stereo image of master track.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item level_in
  3905. Set input level before filtering for both channels. Defaults is 1.
  3906. Allowed range is from 0.015625 to 64.
  3907. @item level_out
  3908. Set output level after filtering for both channels. Defaults is 1.
  3909. Allowed range is from 0.015625 to 64.
  3910. @item balance_in
  3911. Set input balance between both channels. Default is 0.
  3912. Allowed range is from -1 to 1.
  3913. @item balance_out
  3914. Set output balance between both channels. Default is 0.
  3915. Allowed range is from -1 to 1.
  3916. @item softclip
  3917. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3918. clipping. Disabled by default.
  3919. @item mutel
  3920. Mute the left channel. Disabled by default.
  3921. @item muter
  3922. Mute the right channel. Disabled by default.
  3923. @item phasel
  3924. Change the phase of the left channel. Disabled by default.
  3925. @item phaser
  3926. Change the phase of the right channel. Disabled by default.
  3927. @item mode
  3928. Set stereo mode. Available values are:
  3929. @table @samp
  3930. @item lr>lr
  3931. Left/Right to Left/Right, this is default.
  3932. @item lr>ms
  3933. Left/Right to Mid/Side.
  3934. @item ms>lr
  3935. Mid/Side to Left/Right.
  3936. @item lr>ll
  3937. Left/Right to Left/Left.
  3938. @item lr>rr
  3939. Left/Right to Right/Right.
  3940. @item lr>l+r
  3941. Left/Right to Left + Right.
  3942. @item lr>rl
  3943. Left/Right to Right/Left.
  3944. @item ms>ll
  3945. Mid/Side to Left/Left.
  3946. @item ms>rr
  3947. Mid/Side to Right/Right.
  3948. @end table
  3949. @item slev
  3950. Set level of side signal. Default is 1.
  3951. Allowed range is from 0.015625 to 64.
  3952. @item sbal
  3953. Set balance of side signal. Default is 0.
  3954. Allowed range is from -1 to 1.
  3955. @item mlev
  3956. Set level of the middle signal. Default is 1.
  3957. Allowed range is from 0.015625 to 64.
  3958. @item mpan
  3959. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3960. @item base
  3961. Set stereo base between mono and inversed channels. Default is 0.
  3962. Allowed range is from -1 to 1.
  3963. @item delay
  3964. Set delay in milliseconds how much to delay left from right channel and
  3965. vice versa. Default is 0. Allowed range is from -20 to 20.
  3966. @item sclevel
  3967. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3968. @item phase
  3969. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3970. @item bmode_in, bmode_out
  3971. Set balance mode for balance_in/balance_out option.
  3972. Can be one of the following:
  3973. @table @samp
  3974. @item balance
  3975. Classic balance mode. Attenuate one channel at time.
  3976. Gain is raised up to 1.
  3977. @item amplitude
  3978. Similar as classic mode above but gain is raised up to 2.
  3979. @item power
  3980. Equal power distribution, from -6dB to +6dB range.
  3981. @end table
  3982. @end table
  3983. @subsection Examples
  3984. @itemize
  3985. @item
  3986. Apply karaoke like effect:
  3987. @example
  3988. stereotools=mlev=0.015625
  3989. @end example
  3990. @item
  3991. Convert M/S signal to L/R:
  3992. @example
  3993. "stereotools=mode=ms>lr"
  3994. @end example
  3995. @end itemize
  3996. @section stereowiden
  3997. This filter enhance the stereo effect by suppressing signal common to both
  3998. channels and by delaying the signal of left into right and vice versa,
  3999. thereby widening the stereo effect.
  4000. The filter accepts the following options:
  4001. @table @option
  4002. @item delay
  4003. Time in milliseconds of the delay of left signal into right and vice versa.
  4004. Default is 20 milliseconds.
  4005. @item feedback
  4006. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4007. effect of left signal in right output and vice versa which gives widening
  4008. effect. Default is 0.3.
  4009. @item crossfeed
  4010. Cross feed of left into right with inverted phase. This helps in suppressing
  4011. the mono. If the value is 1 it will cancel all the signal common to both
  4012. channels. Default is 0.3.
  4013. @item drymix
  4014. Set level of input signal of original channel. Default is 0.8.
  4015. @end table
  4016. @section superequalizer
  4017. Apply 18 band equalizer.
  4018. The filter accepts the following options:
  4019. @table @option
  4020. @item 1b
  4021. Set 65Hz band gain.
  4022. @item 2b
  4023. Set 92Hz band gain.
  4024. @item 3b
  4025. Set 131Hz band gain.
  4026. @item 4b
  4027. Set 185Hz band gain.
  4028. @item 5b
  4029. Set 262Hz band gain.
  4030. @item 6b
  4031. Set 370Hz band gain.
  4032. @item 7b
  4033. Set 523Hz band gain.
  4034. @item 8b
  4035. Set 740Hz band gain.
  4036. @item 9b
  4037. Set 1047Hz band gain.
  4038. @item 10b
  4039. Set 1480Hz band gain.
  4040. @item 11b
  4041. Set 2093Hz band gain.
  4042. @item 12b
  4043. Set 2960Hz band gain.
  4044. @item 13b
  4045. Set 4186Hz band gain.
  4046. @item 14b
  4047. Set 5920Hz band gain.
  4048. @item 15b
  4049. Set 8372Hz band gain.
  4050. @item 16b
  4051. Set 11840Hz band gain.
  4052. @item 17b
  4053. Set 16744Hz band gain.
  4054. @item 18b
  4055. Set 20000Hz band gain.
  4056. @end table
  4057. @section surround
  4058. Apply audio surround upmix filter.
  4059. This filter allows to produce multichannel output from audio stream.
  4060. The filter accepts the following options:
  4061. @table @option
  4062. @item chl_out
  4063. Set output channel layout. By default, this is @var{5.1}.
  4064. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4065. for the required syntax.
  4066. @item chl_in
  4067. Set input channel layout. By default, this is @var{stereo}.
  4068. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4069. for the required syntax.
  4070. @item level_in
  4071. Set input volume level. By default, this is @var{1}.
  4072. @item level_out
  4073. Set output volume level. By default, this is @var{1}.
  4074. @item lfe
  4075. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4076. @item lfe_low
  4077. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4078. @item lfe_high
  4079. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4080. @item lfe_mode
  4081. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4082. In @var{add} mode, LFE channel is created from input audio and added to output.
  4083. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4084. also all non-LFE output channels are subtracted with output LFE channel.
  4085. @item angle
  4086. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4087. Default is @var{90}.
  4088. @item fc_in
  4089. Set front center input volume. By default, this is @var{1}.
  4090. @item fc_out
  4091. Set front center output volume. By default, this is @var{1}.
  4092. @item fl_in
  4093. Set front left input volume. By default, this is @var{1}.
  4094. @item fl_out
  4095. Set front left output volume. By default, this is @var{1}.
  4096. @item fr_in
  4097. Set front right input volume. By default, this is @var{1}.
  4098. @item fr_out
  4099. Set front right output volume. By default, this is @var{1}.
  4100. @item sl_in
  4101. Set side left input volume. By default, this is @var{1}.
  4102. @item sl_out
  4103. Set side left output volume. By default, this is @var{1}.
  4104. @item sr_in
  4105. Set side right input volume. By default, this is @var{1}.
  4106. @item sr_out
  4107. Set side right output volume. By default, this is @var{1}.
  4108. @item bl_in
  4109. Set back left input volume. By default, this is @var{1}.
  4110. @item bl_out
  4111. Set back left output volume. By default, this is @var{1}.
  4112. @item br_in
  4113. Set back right input volume. By default, this is @var{1}.
  4114. @item br_out
  4115. Set back right output volume. By default, this is @var{1}.
  4116. @item bc_in
  4117. Set back center input volume. By default, this is @var{1}.
  4118. @item bc_out
  4119. Set back center output volume. By default, this is @var{1}.
  4120. @item lfe_in
  4121. Set LFE input volume. By default, this is @var{1}.
  4122. @item lfe_out
  4123. Set LFE output volume. By default, this is @var{1}.
  4124. @item allx
  4125. Set spread usage of stereo image across X axis for all channels.
  4126. @item ally
  4127. Set spread usage of stereo image across Y axis for all channels.
  4128. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4129. Set spread usage of stereo image across X axis for each channel.
  4130. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4131. Set spread usage of stereo image across Y axis for each channel.
  4132. @item win_size
  4133. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4134. @item win_func
  4135. Set window function.
  4136. It accepts the following values:
  4137. @table @samp
  4138. @item rect
  4139. @item bartlett
  4140. @item hann, hanning
  4141. @item hamming
  4142. @item blackman
  4143. @item welch
  4144. @item flattop
  4145. @item bharris
  4146. @item bnuttall
  4147. @item bhann
  4148. @item sine
  4149. @item nuttall
  4150. @item lanczos
  4151. @item gauss
  4152. @item tukey
  4153. @item dolph
  4154. @item cauchy
  4155. @item parzen
  4156. @item poisson
  4157. @item bohman
  4158. @end table
  4159. Default is @code{hann}.
  4160. @item overlap
  4161. Set window overlap. If set to 1, the recommended overlap for selected
  4162. window function will be picked. Default is @code{0.5}.
  4163. @end table
  4164. @section treble, highshelf
  4165. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4166. shelving filter with a response similar to that of a standard
  4167. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4168. The filter accepts the following options:
  4169. @table @option
  4170. @item gain, g
  4171. Give the gain at whichever is the lower of ~22 kHz and the
  4172. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4173. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4174. @item frequency, f
  4175. Set the filter's central frequency and so can be used
  4176. to extend or reduce the frequency range to be boosted or cut.
  4177. The default value is @code{3000} Hz.
  4178. @item width_type, t
  4179. Set method to specify band-width of filter.
  4180. @table @option
  4181. @item h
  4182. Hz
  4183. @item q
  4184. Q-Factor
  4185. @item o
  4186. octave
  4187. @item s
  4188. slope
  4189. @item k
  4190. kHz
  4191. @end table
  4192. @item width, w
  4193. Determine how steep is the filter's shelf transition.
  4194. @item mix, m
  4195. How much to use filtered signal in output. Default is 1.
  4196. Range is between 0 and 1.
  4197. @item channels, c
  4198. Specify which channels to filter, by default all available are filtered.
  4199. @item normalize, n
  4200. Normalize biquad coefficients, by default is disabled.
  4201. Enabling it will normalize magnitude response at DC to 0dB.
  4202. @end table
  4203. @subsection Commands
  4204. This filter supports the following commands:
  4205. @table @option
  4206. @item frequency, f
  4207. Change treble frequency.
  4208. Syntax for the command is : "@var{frequency}"
  4209. @item width_type, t
  4210. Change treble width_type.
  4211. Syntax for the command is : "@var{width_type}"
  4212. @item width, w
  4213. Change treble width.
  4214. Syntax for the command is : "@var{width}"
  4215. @item gain, g
  4216. Change treble gain.
  4217. Syntax for the command is : "@var{gain}"
  4218. @item mix, m
  4219. Change treble mix.
  4220. Syntax for the command is : "@var{mix}"
  4221. @end table
  4222. @section tremolo
  4223. Sinusoidal amplitude modulation.
  4224. The filter accepts the following options:
  4225. @table @option
  4226. @item f
  4227. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4228. (20 Hz or lower) will result in a tremolo effect.
  4229. This filter may also be used as a ring modulator by specifying
  4230. a modulation frequency higher than 20 Hz.
  4231. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4232. @item d
  4233. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4234. Default value is 0.5.
  4235. @end table
  4236. @section vibrato
  4237. Sinusoidal phase modulation.
  4238. The filter accepts the following options:
  4239. @table @option
  4240. @item f
  4241. Modulation frequency in Hertz.
  4242. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4243. @item d
  4244. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4245. Default value is 0.5.
  4246. @end table
  4247. @section volume
  4248. Adjust the input audio volume.
  4249. It accepts the following parameters:
  4250. @table @option
  4251. @item volume
  4252. Set audio volume expression.
  4253. Output values are clipped to the maximum value.
  4254. The output audio volume is given by the relation:
  4255. @example
  4256. @var{output_volume} = @var{volume} * @var{input_volume}
  4257. @end example
  4258. The default value for @var{volume} is "1.0".
  4259. @item precision
  4260. This parameter represents the mathematical precision.
  4261. It determines which input sample formats will be allowed, which affects the
  4262. precision of the volume scaling.
  4263. @table @option
  4264. @item fixed
  4265. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4266. @item float
  4267. 32-bit floating-point; this limits input sample format to FLT. (default)
  4268. @item double
  4269. 64-bit floating-point; this limits input sample format to DBL.
  4270. @end table
  4271. @item replaygain
  4272. Choose the behaviour on encountering ReplayGain side data in input frames.
  4273. @table @option
  4274. @item drop
  4275. Remove ReplayGain side data, ignoring its contents (the default).
  4276. @item ignore
  4277. Ignore ReplayGain side data, but leave it in the frame.
  4278. @item track
  4279. Prefer the track gain, if present.
  4280. @item album
  4281. Prefer the album gain, if present.
  4282. @end table
  4283. @item replaygain_preamp
  4284. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4285. Default value for @var{replaygain_preamp} is 0.0.
  4286. @item eval
  4287. Set when the volume expression is evaluated.
  4288. It accepts the following values:
  4289. @table @samp
  4290. @item once
  4291. only evaluate expression once during the filter initialization, or
  4292. when the @samp{volume} command is sent
  4293. @item frame
  4294. evaluate expression for each incoming frame
  4295. @end table
  4296. Default value is @samp{once}.
  4297. @end table
  4298. The volume expression can contain the following parameters.
  4299. @table @option
  4300. @item n
  4301. frame number (starting at zero)
  4302. @item nb_channels
  4303. number of channels
  4304. @item nb_consumed_samples
  4305. number of samples consumed by the filter
  4306. @item nb_samples
  4307. number of samples in the current frame
  4308. @item pos
  4309. original frame position in the file
  4310. @item pts
  4311. frame PTS
  4312. @item sample_rate
  4313. sample rate
  4314. @item startpts
  4315. PTS at start of stream
  4316. @item startt
  4317. time at start of stream
  4318. @item t
  4319. frame time
  4320. @item tb
  4321. timestamp timebase
  4322. @item volume
  4323. last set volume value
  4324. @end table
  4325. Note that when @option{eval} is set to @samp{once} only the
  4326. @var{sample_rate} and @var{tb} variables are available, all other
  4327. variables will evaluate to NAN.
  4328. @subsection Commands
  4329. This filter supports the following commands:
  4330. @table @option
  4331. @item volume
  4332. Modify the volume expression.
  4333. The command accepts the same syntax of the corresponding option.
  4334. If the specified expression is not valid, it is kept at its current
  4335. value.
  4336. @item replaygain_noclip
  4337. Prevent clipping by limiting the gain applied.
  4338. Default value for @var{replaygain_noclip} is 1.
  4339. @end table
  4340. @subsection Examples
  4341. @itemize
  4342. @item
  4343. Halve the input audio volume:
  4344. @example
  4345. volume=volume=0.5
  4346. volume=volume=1/2
  4347. volume=volume=-6.0206dB
  4348. @end example
  4349. In all the above example the named key for @option{volume} can be
  4350. omitted, for example like in:
  4351. @example
  4352. volume=0.5
  4353. @end example
  4354. @item
  4355. Increase input audio power by 6 decibels using fixed-point precision:
  4356. @example
  4357. volume=volume=6dB:precision=fixed
  4358. @end example
  4359. @item
  4360. Fade volume after time 10 with an annihilation period of 5 seconds:
  4361. @example
  4362. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4363. @end example
  4364. @end itemize
  4365. @section volumedetect
  4366. Detect the volume of the input video.
  4367. The filter has no parameters. The input is not modified. Statistics about
  4368. the volume will be printed in the log when the input stream end is reached.
  4369. In particular it will show the mean volume (root mean square), maximum
  4370. volume (on a per-sample basis), and the beginning of a histogram of the
  4371. registered volume values (from the maximum value to a cumulated 1/1000 of
  4372. the samples).
  4373. All volumes are in decibels relative to the maximum PCM value.
  4374. @subsection Examples
  4375. Here is an excerpt of the output:
  4376. @example
  4377. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4378. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4379. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4380. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4381. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4382. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4383. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4384. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4385. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4386. @end example
  4387. It means that:
  4388. @itemize
  4389. @item
  4390. The mean square energy is approximately -27 dB, or 10^-2.7.
  4391. @item
  4392. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4393. @item
  4394. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4395. @end itemize
  4396. In other words, raising the volume by +4 dB does not cause any clipping,
  4397. raising it by +5 dB causes clipping for 6 samples, etc.
  4398. @c man end AUDIO FILTERS
  4399. @chapter Audio Sources
  4400. @c man begin AUDIO SOURCES
  4401. Below is a description of the currently available audio sources.
  4402. @section abuffer
  4403. Buffer audio frames, and make them available to the filter chain.
  4404. This source is mainly intended for a programmatic use, in particular
  4405. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4406. It accepts the following parameters:
  4407. @table @option
  4408. @item time_base
  4409. The timebase which will be used for timestamps of submitted frames. It must be
  4410. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4411. @item sample_rate
  4412. The sample rate of the incoming audio buffers.
  4413. @item sample_fmt
  4414. The sample format of the incoming audio buffers.
  4415. Either a sample format name or its corresponding integer representation from
  4416. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4417. @item channel_layout
  4418. The channel layout of the incoming audio buffers.
  4419. Either a channel layout name from channel_layout_map in
  4420. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4421. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4422. @item channels
  4423. The number of channels of the incoming audio buffers.
  4424. If both @var{channels} and @var{channel_layout} are specified, then they
  4425. must be consistent.
  4426. @end table
  4427. @subsection Examples
  4428. @example
  4429. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4430. @end example
  4431. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4432. Since the sample format with name "s16p" corresponds to the number
  4433. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4434. equivalent to:
  4435. @example
  4436. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4437. @end example
  4438. @section aevalsrc
  4439. Generate an audio signal specified by an expression.
  4440. This source accepts in input one or more expressions (one for each
  4441. channel), which are evaluated and used to generate a corresponding
  4442. audio signal.
  4443. This source accepts the following options:
  4444. @table @option
  4445. @item exprs
  4446. Set the '|'-separated expressions list for each separate channel. In case the
  4447. @option{channel_layout} option is not specified, the selected channel layout
  4448. depends on the number of provided expressions. Otherwise the last
  4449. specified expression is applied to the remaining output channels.
  4450. @item channel_layout, c
  4451. Set the channel layout. The number of channels in the specified layout
  4452. must be equal to the number of specified expressions.
  4453. @item duration, d
  4454. Set the minimum duration of the sourced audio. See
  4455. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4456. for the accepted syntax.
  4457. Note that the resulting duration may be greater than the specified
  4458. duration, as the generated audio is always cut at the end of a
  4459. complete frame.
  4460. If not specified, or the expressed duration is negative, the audio is
  4461. supposed to be generated forever.
  4462. @item nb_samples, n
  4463. Set the number of samples per channel per each output frame,
  4464. default to 1024.
  4465. @item sample_rate, s
  4466. Specify the sample rate, default to 44100.
  4467. @end table
  4468. Each expression in @var{exprs} can contain the following constants:
  4469. @table @option
  4470. @item n
  4471. number of the evaluated sample, starting from 0
  4472. @item t
  4473. time of the evaluated sample expressed in seconds, starting from 0
  4474. @item s
  4475. sample rate
  4476. @end table
  4477. @subsection Examples
  4478. @itemize
  4479. @item
  4480. Generate silence:
  4481. @example
  4482. aevalsrc=0
  4483. @end example
  4484. @item
  4485. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4486. 8000 Hz:
  4487. @example
  4488. aevalsrc="sin(440*2*PI*t):s=8000"
  4489. @end example
  4490. @item
  4491. Generate a two channels signal, specify the channel layout (Front
  4492. Center + Back Center) explicitly:
  4493. @example
  4494. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4495. @end example
  4496. @item
  4497. Generate white noise:
  4498. @example
  4499. aevalsrc="-2+random(0)"
  4500. @end example
  4501. @item
  4502. Generate an amplitude modulated signal:
  4503. @example
  4504. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4505. @end example
  4506. @item
  4507. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4508. @example
  4509. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4510. @end example
  4511. @end itemize
  4512. @section anullsrc
  4513. The null audio source, return unprocessed audio frames. It is mainly useful
  4514. as a template and to be employed in analysis / debugging tools, or as
  4515. the source for filters which ignore the input data (for example the sox
  4516. synth filter).
  4517. This source accepts the following options:
  4518. @table @option
  4519. @item channel_layout, cl
  4520. Specifies the channel layout, and can be either an integer or a string
  4521. representing a channel layout. The default value of @var{channel_layout}
  4522. is "stereo".
  4523. Check the channel_layout_map definition in
  4524. @file{libavutil/channel_layout.c} for the mapping between strings and
  4525. channel layout values.
  4526. @item sample_rate, r
  4527. Specifies the sample rate, and defaults to 44100.
  4528. @item nb_samples, n
  4529. Set the number of samples per requested frames.
  4530. @end table
  4531. @subsection Examples
  4532. @itemize
  4533. @item
  4534. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4535. @example
  4536. anullsrc=r=48000:cl=4
  4537. @end example
  4538. @item
  4539. Do the same operation with a more obvious syntax:
  4540. @example
  4541. anullsrc=r=48000:cl=mono
  4542. @end example
  4543. @end itemize
  4544. All the parameters need to be explicitly defined.
  4545. @section flite
  4546. Synthesize a voice utterance using the libflite library.
  4547. To enable compilation of this filter you need to configure FFmpeg with
  4548. @code{--enable-libflite}.
  4549. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4550. The filter accepts the following options:
  4551. @table @option
  4552. @item list_voices
  4553. If set to 1, list the names of the available voices and exit
  4554. immediately. Default value is 0.
  4555. @item nb_samples, n
  4556. Set the maximum number of samples per frame. Default value is 512.
  4557. @item textfile
  4558. Set the filename containing the text to speak.
  4559. @item text
  4560. Set the text to speak.
  4561. @item voice, v
  4562. Set the voice to use for the speech synthesis. Default value is
  4563. @code{kal}. See also the @var{list_voices} option.
  4564. @end table
  4565. @subsection Examples
  4566. @itemize
  4567. @item
  4568. Read from file @file{speech.txt}, and synthesize the text using the
  4569. standard flite voice:
  4570. @example
  4571. flite=textfile=speech.txt
  4572. @end example
  4573. @item
  4574. Read the specified text selecting the @code{slt} voice:
  4575. @example
  4576. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4577. @end example
  4578. @item
  4579. Input text to ffmpeg:
  4580. @example
  4581. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4582. @end example
  4583. @item
  4584. Make @file{ffplay} speak the specified text, using @code{flite} and
  4585. the @code{lavfi} device:
  4586. @example
  4587. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4588. @end example
  4589. @end itemize
  4590. For more information about libflite, check:
  4591. @url{http://www.festvox.org/flite/}
  4592. @section anoisesrc
  4593. Generate a noise audio signal.
  4594. The filter accepts the following options:
  4595. @table @option
  4596. @item sample_rate, r
  4597. Specify the sample rate. Default value is 48000 Hz.
  4598. @item amplitude, a
  4599. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4600. is 1.0.
  4601. @item duration, d
  4602. Specify the duration of the generated audio stream. Not specifying this option
  4603. results in noise with an infinite length.
  4604. @item color, colour, c
  4605. Specify the color of noise. Available noise colors are white, pink, brown,
  4606. blue and violet. Default color is white.
  4607. @item seed, s
  4608. Specify a value used to seed the PRNG.
  4609. @item nb_samples, n
  4610. Set the number of samples per each output frame, default is 1024.
  4611. @end table
  4612. @subsection Examples
  4613. @itemize
  4614. @item
  4615. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4616. @example
  4617. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4618. @end example
  4619. @end itemize
  4620. @section hilbert
  4621. Generate odd-tap Hilbert transform FIR coefficients.
  4622. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4623. the signal by 90 degrees.
  4624. This is used in many matrix coding schemes and for analytic signal generation.
  4625. The process is often written as a multiplication by i (or j), the imaginary unit.
  4626. The filter accepts the following options:
  4627. @table @option
  4628. @item sample_rate, s
  4629. Set sample rate, default is 44100.
  4630. @item taps, t
  4631. Set length of FIR filter, default is 22051.
  4632. @item nb_samples, n
  4633. Set number of samples per each frame.
  4634. @item win_func, w
  4635. Set window function to be used when generating FIR coefficients.
  4636. @end table
  4637. @section sinc
  4638. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4639. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4640. The filter accepts the following options:
  4641. @table @option
  4642. @item sample_rate, r
  4643. Set sample rate, default is 44100.
  4644. @item nb_samples, n
  4645. Set number of samples per each frame. Default is 1024.
  4646. @item hp
  4647. Set high-pass frequency. Default is 0.
  4648. @item lp
  4649. Set low-pass frequency. Default is 0.
  4650. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4651. is higher than 0 then filter will create band-pass filter coefficients,
  4652. otherwise band-reject filter coefficients.
  4653. @item phase
  4654. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4655. @item beta
  4656. Set Kaiser window beta.
  4657. @item att
  4658. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4659. @item round
  4660. Enable rounding, by default is disabled.
  4661. @item hptaps
  4662. Set number of taps for high-pass filter.
  4663. @item lptaps
  4664. Set number of taps for low-pass filter.
  4665. @end table
  4666. @section sine
  4667. Generate an audio signal made of a sine wave with amplitude 1/8.
  4668. The audio signal is bit-exact.
  4669. The filter accepts the following options:
  4670. @table @option
  4671. @item frequency, f
  4672. Set the carrier frequency. Default is 440 Hz.
  4673. @item beep_factor, b
  4674. Enable a periodic beep every second with frequency @var{beep_factor} times
  4675. the carrier frequency. Default is 0, meaning the beep is disabled.
  4676. @item sample_rate, r
  4677. Specify the sample rate, default is 44100.
  4678. @item duration, d
  4679. Specify the duration of the generated audio stream.
  4680. @item samples_per_frame
  4681. Set the number of samples per output frame.
  4682. The expression can contain the following constants:
  4683. @table @option
  4684. @item n
  4685. The (sequential) number of the output audio frame, starting from 0.
  4686. @item pts
  4687. The PTS (Presentation TimeStamp) of the output audio frame,
  4688. expressed in @var{TB} units.
  4689. @item t
  4690. The PTS of the output audio frame, expressed in seconds.
  4691. @item TB
  4692. The timebase of the output audio frames.
  4693. @end table
  4694. Default is @code{1024}.
  4695. @end table
  4696. @subsection Examples
  4697. @itemize
  4698. @item
  4699. Generate a simple 440 Hz sine wave:
  4700. @example
  4701. sine
  4702. @end example
  4703. @item
  4704. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4705. @example
  4706. sine=220:4:d=5
  4707. sine=f=220:b=4:d=5
  4708. sine=frequency=220:beep_factor=4:duration=5
  4709. @end example
  4710. @item
  4711. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4712. pattern:
  4713. @example
  4714. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4715. @end example
  4716. @end itemize
  4717. @c man end AUDIO SOURCES
  4718. @chapter Audio Sinks
  4719. @c man begin AUDIO SINKS
  4720. Below is a description of the currently available audio sinks.
  4721. @section abuffersink
  4722. Buffer audio frames, and make them available to the end of filter chain.
  4723. This sink is mainly intended for programmatic use, in particular
  4724. through the interface defined in @file{libavfilter/buffersink.h}
  4725. or the options system.
  4726. It accepts a pointer to an AVABufferSinkContext structure, which
  4727. defines the incoming buffers' formats, to be passed as the opaque
  4728. parameter to @code{avfilter_init_filter} for initialization.
  4729. @section anullsink
  4730. Null audio sink; do absolutely nothing with the input audio. It is
  4731. mainly useful as a template and for use in analysis / debugging
  4732. tools.
  4733. @c man end AUDIO SINKS
  4734. @chapter Video Filters
  4735. @c man begin VIDEO FILTERS
  4736. When you configure your FFmpeg build, you can disable any of the
  4737. existing filters using @code{--disable-filters}.
  4738. The configure output will show the video filters included in your
  4739. build.
  4740. Below is a description of the currently available video filters.
  4741. @section addroi
  4742. Mark a region of interest in a video frame.
  4743. The frame data is passed through unchanged, but metadata is attached
  4744. to the frame indicating regions of interest which can affect the
  4745. behaviour of later encoding. Multiple regions can be marked by
  4746. applying the filter multiple times.
  4747. @table @option
  4748. @item x
  4749. Region distance in pixels from the left edge of the frame.
  4750. @item y
  4751. Region distance in pixels from the top edge of the frame.
  4752. @item w
  4753. Region width in pixels.
  4754. @item h
  4755. Region height in pixels.
  4756. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4757. and may contain the following variables:
  4758. @table @option
  4759. @item iw
  4760. Width of the input frame.
  4761. @item ih
  4762. Height of the input frame.
  4763. @end table
  4764. @item qoffset
  4765. Quantisation offset to apply within the region.
  4766. This must be a real value in the range -1 to +1. A value of zero
  4767. indicates no quality change. A negative value asks for better quality
  4768. (less quantisation), while a positive value asks for worse quality
  4769. (greater quantisation).
  4770. The range is calibrated so that the extreme values indicate the
  4771. largest possible offset - if the rest of the frame is encoded with the
  4772. worst possible quality, an offset of -1 indicates that this region
  4773. should be encoded with the best possible quality anyway. Intermediate
  4774. values are then interpolated in some codec-dependent way.
  4775. For example, in 10-bit H.264 the quantisation parameter varies between
  4776. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4777. this region should be encoded with a QP around one-tenth of the full
  4778. range better than the rest of the frame. So, if most of the frame
  4779. were to be encoded with a QP of around 30, this region would get a QP
  4780. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4781. An extreme value of -1 would indicate that this region should be
  4782. encoded with the best possible quality regardless of the treatment of
  4783. the rest of the frame - that is, should be encoded at a QP of -12.
  4784. @item clear
  4785. If set to true, remove any existing regions of interest marked on the
  4786. frame before adding the new one.
  4787. @end table
  4788. @subsection Examples
  4789. @itemize
  4790. @item
  4791. Mark the centre quarter of the frame as interesting.
  4792. @example
  4793. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4794. @end example
  4795. @item
  4796. Mark the 100-pixel-wide region on the left edge of the frame as very
  4797. uninteresting (to be encoded at much lower quality than the rest of
  4798. the frame).
  4799. @example
  4800. addroi=0:0:100:ih:+1/5
  4801. @end example
  4802. @end itemize
  4803. @section alphaextract
  4804. Extract the alpha component from the input as a grayscale video. This
  4805. is especially useful with the @var{alphamerge} filter.
  4806. @section alphamerge
  4807. Add or replace the alpha component of the primary input with the
  4808. grayscale value of a second input. This is intended for use with
  4809. @var{alphaextract} to allow the transmission or storage of frame
  4810. sequences that have alpha in a format that doesn't support an alpha
  4811. channel.
  4812. For example, to reconstruct full frames from a normal YUV-encoded video
  4813. and a separate video created with @var{alphaextract}, you might use:
  4814. @example
  4815. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4816. @end example
  4817. Since this filter is designed for reconstruction, it operates on frame
  4818. sequences without considering timestamps, and terminates when either
  4819. input reaches end of stream. This will cause problems if your encoding
  4820. pipeline drops frames. If you're trying to apply an image as an
  4821. overlay to a video stream, consider the @var{overlay} filter instead.
  4822. @section amplify
  4823. Amplify differences between current pixel and pixels of adjacent frames in
  4824. same pixel location.
  4825. This filter accepts the following options:
  4826. @table @option
  4827. @item radius
  4828. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4829. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4830. @item factor
  4831. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4832. @item threshold
  4833. Set threshold for difference amplification. Any difference greater or equal to
  4834. this value will not alter source pixel. Default is 10.
  4835. Allowed range is from 0 to 65535.
  4836. @item tolerance
  4837. Set tolerance for difference amplification. Any difference lower to
  4838. this value will not alter source pixel. Default is 0.
  4839. Allowed range is from 0 to 65535.
  4840. @item low
  4841. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4842. This option controls maximum possible value that will decrease source pixel value.
  4843. @item high
  4844. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4845. This option controls maximum possible value that will increase source pixel value.
  4846. @item planes
  4847. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4848. @end table
  4849. @subsection Commands
  4850. This filter supports the following @ref{commands} that corresponds to option of same name:
  4851. @table @option
  4852. @item factor
  4853. @item threshold
  4854. @item tolerance
  4855. @item low
  4856. @item high
  4857. @item planes
  4858. @end table
  4859. @section ass
  4860. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4861. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4862. Substation Alpha) subtitles files.
  4863. This filter accepts the following option in addition to the common options from
  4864. the @ref{subtitles} filter:
  4865. @table @option
  4866. @item shaping
  4867. Set the shaping engine
  4868. Available values are:
  4869. @table @samp
  4870. @item auto
  4871. The default libass shaping engine, which is the best available.
  4872. @item simple
  4873. Fast, font-agnostic shaper that can do only substitutions
  4874. @item complex
  4875. Slower shaper using OpenType for substitutions and positioning
  4876. @end table
  4877. The default is @code{auto}.
  4878. @end table
  4879. @section atadenoise
  4880. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4881. The filter accepts the following options:
  4882. @table @option
  4883. @item 0a
  4884. Set threshold A for 1st plane. Default is 0.02.
  4885. Valid range is 0 to 0.3.
  4886. @item 0b
  4887. Set threshold B for 1st plane. Default is 0.04.
  4888. Valid range is 0 to 5.
  4889. @item 1a
  4890. Set threshold A for 2nd plane. Default is 0.02.
  4891. Valid range is 0 to 0.3.
  4892. @item 1b
  4893. Set threshold B for 2nd plane. Default is 0.04.
  4894. Valid range is 0 to 5.
  4895. @item 2a
  4896. Set threshold A for 3rd plane. Default is 0.02.
  4897. Valid range is 0 to 0.3.
  4898. @item 2b
  4899. Set threshold B for 3rd plane. Default is 0.04.
  4900. Valid range is 0 to 5.
  4901. Threshold A is designed to react on abrupt changes in the input signal and
  4902. threshold B is designed to react on continuous changes in the input signal.
  4903. @item s
  4904. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4905. number in range [5, 129].
  4906. @item p
  4907. Set what planes of frame filter will use for averaging. Default is all.
  4908. @item a
  4909. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4910. Alternatively can be set to @code{s} serial.
  4911. Parallel can be faster then serial, while other way around is never true.
  4912. Parallel will abort early on first change being greater then thresholds, while serial
  4913. will continue processing other side of frames if they are equal or bellow thresholds.
  4914. @end table
  4915. @subsection Commands
  4916. This filter supports same @ref{commands} as options except option @code{s}.
  4917. The command accepts the same syntax of the corresponding option.
  4918. @section avgblur
  4919. Apply average blur filter.
  4920. The filter accepts the following options:
  4921. @table @option
  4922. @item sizeX
  4923. Set horizontal radius size.
  4924. @item planes
  4925. Set which planes to filter. By default all planes are filtered.
  4926. @item sizeY
  4927. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4928. Default is @code{0}.
  4929. @end table
  4930. @subsection Commands
  4931. This filter supports same commands as options.
  4932. The command accepts the same syntax of the corresponding option.
  4933. If the specified expression is not valid, it is kept at its current
  4934. value.
  4935. @section bbox
  4936. Compute the bounding box for the non-black pixels in the input frame
  4937. luminance plane.
  4938. This filter computes the bounding box containing all the pixels with a
  4939. luminance value greater than the minimum allowed value.
  4940. The parameters describing the bounding box are printed on the filter
  4941. log.
  4942. The filter accepts the following option:
  4943. @table @option
  4944. @item min_val
  4945. Set the minimal luminance value. Default is @code{16}.
  4946. @end table
  4947. @section bilateral
  4948. Apply bilateral filter, spatial smoothing while preserving edges.
  4949. The filter accepts the following options:
  4950. @table @option
  4951. @item sigmaS
  4952. Set sigma of gaussian function to calculate spatial weight.
  4953. Allowed range is 0 to 10. Default is 0.1.
  4954. @item sigmaR
  4955. Set sigma of gaussian function to calculate range weight.
  4956. Allowed range is 0 to 1. Default is 0.1.
  4957. @item planes
  4958. Set planes to filter. Default is first only.
  4959. @end table
  4960. @section bitplanenoise
  4961. Show and measure bit plane noise.
  4962. The filter accepts the following options:
  4963. @table @option
  4964. @item bitplane
  4965. Set which plane to analyze. Default is @code{1}.
  4966. @item filter
  4967. Filter out noisy pixels from @code{bitplane} set above.
  4968. Default is disabled.
  4969. @end table
  4970. @section blackdetect
  4971. Detect video intervals that are (almost) completely black. Can be
  4972. useful to detect chapter transitions, commercials, or invalid
  4973. recordings. Output lines contains the time for the start, end and
  4974. duration of the detected black interval expressed in seconds.
  4975. In order to display the output lines, you need to set the loglevel at
  4976. least to the AV_LOG_INFO value.
  4977. The filter accepts the following options:
  4978. @table @option
  4979. @item black_min_duration, d
  4980. Set the minimum detected black duration expressed in seconds. It must
  4981. be a non-negative floating point number.
  4982. Default value is 2.0.
  4983. @item picture_black_ratio_th, pic_th
  4984. Set the threshold for considering a picture "black".
  4985. Express the minimum value for the ratio:
  4986. @example
  4987. @var{nb_black_pixels} / @var{nb_pixels}
  4988. @end example
  4989. for which a picture is considered black.
  4990. Default value is 0.98.
  4991. @item pixel_black_th, pix_th
  4992. Set the threshold for considering a pixel "black".
  4993. The threshold expresses the maximum pixel luminance value for which a
  4994. pixel is considered "black". The provided value is scaled according to
  4995. the following equation:
  4996. @example
  4997. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4998. @end example
  4999. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5000. the input video format, the range is [0-255] for YUV full-range
  5001. formats and [16-235] for YUV non full-range formats.
  5002. Default value is 0.10.
  5003. @end table
  5004. The following example sets the maximum pixel threshold to the minimum
  5005. value, and detects only black intervals of 2 or more seconds:
  5006. @example
  5007. blackdetect=d=2:pix_th=0.00
  5008. @end example
  5009. @section blackframe
  5010. Detect frames that are (almost) completely black. Can be useful to
  5011. detect chapter transitions or commercials. Output lines consist of
  5012. the frame number of the detected frame, the percentage of blackness,
  5013. the position in the file if known or -1 and the timestamp in seconds.
  5014. In order to display the output lines, you need to set the loglevel at
  5015. least to the AV_LOG_INFO value.
  5016. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5017. The value represents the percentage of pixels in the picture that
  5018. are below the threshold value.
  5019. It accepts the following parameters:
  5020. @table @option
  5021. @item amount
  5022. The percentage of the pixels that have to be below the threshold; it defaults to
  5023. @code{98}.
  5024. @item threshold, thresh
  5025. The threshold below which a pixel value is considered black; it defaults to
  5026. @code{32}.
  5027. @end table
  5028. @section blend, tblend
  5029. Blend two video frames into each other.
  5030. The @code{blend} filter takes two input streams and outputs one
  5031. stream, the first input is the "top" layer and second input is
  5032. "bottom" layer. By default, the output terminates when the longest input terminates.
  5033. The @code{tblend} (time blend) filter takes two consecutive frames
  5034. from one single stream, and outputs the result obtained by blending
  5035. the new frame on top of the old frame.
  5036. A description of the accepted options follows.
  5037. @table @option
  5038. @item c0_mode
  5039. @item c1_mode
  5040. @item c2_mode
  5041. @item c3_mode
  5042. @item all_mode
  5043. Set blend mode for specific pixel component or all pixel components in case
  5044. of @var{all_mode}. Default value is @code{normal}.
  5045. Available values for component modes are:
  5046. @table @samp
  5047. @item addition
  5048. @item grainmerge
  5049. @item and
  5050. @item average
  5051. @item burn
  5052. @item darken
  5053. @item difference
  5054. @item grainextract
  5055. @item divide
  5056. @item dodge
  5057. @item freeze
  5058. @item exclusion
  5059. @item extremity
  5060. @item glow
  5061. @item hardlight
  5062. @item hardmix
  5063. @item heat
  5064. @item lighten
  5065. @item linearlight
  5066. @item multiply
  5067. @item multiply128
  5068. @item negation
  5069. @item normal
  5070. @item or
  5071. @item overlay
  5072. @item phoenix
  5073. @item pinlight
  5074. @item reflect
  5075. @item screen
  5076. @item softlight
  5077. @item subtract
  5078. @item vividlight
  5079. @item xor
  5080. @end table
  5081. @item c0_opacity
  5082. @item c1_opacity
  5083. @item c2_opacity
  5084. @item c3_opacity
  5085. @item all_opacity
  5086. Set blend opacity for specific pixel component or all pixel components in case
  5087. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5088. @item c0_expr
  5089. @item c1_expr
  5090. @item c2_expr
  5091. @item c3_expr
  5092. @item all_expr
  5093. Set blend expression for specific pixel component or all pixel components in case
  5094. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5095. The expressions can use the following variables:
  5096. @table @option
  5097. @item N
  5098. The sequential number of the filtered frame, starting from @code{0}.
  5099. @item X
  5100. @item Y
  5101. the coordinates of the current sample
  5102. @item W
  5103. @item H
  5104. the width and height of currently filtered plane
  5105. @item SW
  5106. @item SH
  5107. Width and height scale for the plane being filtered. It is the
  5108. ratio between the dimensions of the current plane to the luma plane,
  5109. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5110. the luma plane and @code{0.5,0.5} for the chroma planes.
  5111. @item T
  5112. Time of the current frame, expressed in seconds.
  5113. @item TOP, A
  5114. Value of pixel component at current location for first video frame (top layer).
  5115. @item BOTTOM, B
  5116. Value of pixel component at current location for second video frame (bottom layer).
  5117. @end table
  5118. @end table
  5119. The @code{blend} filter also supports the @ref{framesync} options.
  5120. @subsection Examples
  5121. @itemize
  5122. @item
  5123. Apply transition from bottom layer to top layer in first 10 seconds:
  5124. @example
  5125. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5126. @end example
  5127. @item
  5128. Apply linear horizontal transition from top layer to bottom layer:
  5129. @example
  5130. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5131. @end example
  5132. @item
  5133. Apply 1x1 checkerboard effect:
  5134. @example
  5135. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5136. @end example
  5137. @item
  5138. Apply uncover left effect:
  5139. @example
  5140. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5141. @end example
  5142. @item
  5143. Apply uncover down effect:
  5144. @example
  5145. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5146. @end example
  5147. @item
  5148. Apply uncover up-left effect:
  5149. @example
  5150. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5151. @end example
  5152. @item
  5153. Split diagonally video and shows top and bottom layer on each side:
  5154. @example
  5155. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5156. @end example
  5157. @item
  5158. Display differences between the current and the previous frame:
  5159. @example
  5160. tblend=all_mode=grainextract
  5161. @end example
  5162. @end itemize
  5163. @section bm3d
  5164. Denoise frames using Block-Matching 3D algorithm.
  5165. The filter accepts the following options.
  5166. @table @option
  5167. @item sigma
  5168. Set denoising strength. Default value is 1.
  5169. Allowed range is from 0 to 999.9.
  5170. The denoising algorithm is very sensitive to sigma, so adjust it
  5171. according to the source.
  5172. @item block
  5173. Set local patch size. This sets dimensions in 2D.
  5174. @item bstep
  5175. Set sliding step for processing blocks. Default value is 4.
  5176. Allowed range is from 1 to 64.
  5177. Smaller values allows processing more reference blocks and is slower.
  5178. @item group
  5179. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5180. When set to 1, no block matching is done. Larger values allows more blocks
  5181. in single group.
  5182. Allowed range is from 1 to 256.
  5183. @item range
  5184. Set radius for search block matching. Default is 9.
  5185. Allowed range is from 1 to INT32_MAX.
  5186. @item mstep
  5187. Set step between two search locations for block matching. Default is 1.
  5188. Allowed range is from 1 to 64. Smaller is slower.
  5189. @item thmse
  5190. Set threshold of mean square error for block matching. Valid range is 0 to
  5191. INT32_MAX.
  5192. @item hdthr
  5193. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5194. Larger values results in stronger hard-thresholding filtering in frequency
  5195. domain.
  5196. @item estim
  5197. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5198. Default is @code{basic}.
  5199. @item ref
  5200. If enabled, filter will use 2nd stream for block matching.
  5201. Default is disabled for @code{basic} value of @var{estim} option,
  5202. and always enabled if value of @var{estim} is @code{final}.
  5203. @item planes
  5204. Set planes to filter. Default is all available except alpha.
  5205. @end table
  5206. @subsection Examples
  5207. @itemize
  5208. @item
  5209. Basic filtering with bm3d:
  5210. @example
  5211. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5212. @end example
  5213. @item
  5214. Same as above, but filtering only luma:
  5215. @example
  5216. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5217. @end example
  5218. @item
  5219. Same as above, but with both estimation modes:
  5220. @example
  5221. 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
  5222. @end example
  5223. @item
  5224. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5225. @example
  5226. 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
  5227. @end example
  5228. @end itemize
  5229. @section boxblur
  5230. Apply a boxblur algorithm to the input video.
  5231. It accepts the following parameters:
  5232. @table @option
  5233. @item luma_radius, lr
  5234. @item luma_power, lp
  5235. @item chroma_radius, cr
  5236. @item chroma_power, cp
  5237. @item alpha_radius, ar
  5238. @item alpha_power, ap
  5239. @end table
  5240. A description of the accepted options follows.
  5241. @table @option
  5242. @item luma_radius, lr
  5243. @item chroma_radius, cr
  5244. @item alpha_radius, ar
  5245. Set an expression for the box radius in pixels used for blurring the
  5246. corresponding input plane.
  5247. The radius value must be a non-negative number, and must not be
  5248. greater than the value of the expression @code{min(w,h)/2} for the
  5249. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5250. planes.
  5251. Default value for @option{luma_radius} is "2". If not specified,
  5252. @option{chroma_radius} and @option{alpha_radius} default to the
  5253. corresponding value set for @option{luma_radius}.
  5254. The expressions can contain the following constants:
  5255. @table @option
  5256. @item w
  5257. @item h
  5258. The input width and height in pixels.
  5259. @item cw
  5260. @item ch
  5261. The input chroma image width and height in pixels.
  5262. @item hsub
  5263. @item vsub
  5264. The horizontal and vertical chroma subsample values. For example, for the
  5265. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5266. @end table
  5267. @item luma_power, lp
  5268. @item chroma_power, cp
  5269. @item alpha_power, ap
  5270. Specify how many times the boxblur filter is applied to the
  5271. corresponding plane.
  5272. Default value for @option{luma_power} is 2. If not specified,
  5273. @option{chroma_power} and @option{alpha_power} default to the
  5274. corresponding value set for @option{luma_power}.
  5275. A value of 0 will disable the effect.
  5276. @end table
  5277. @subsection Examples
  5278. @itemize
  5279. @item
  5280. Apply a boxblur filter with the luma, chroma, and alpha radii
  5281. set to 2:
  5282. @example
  5283. boxblur=luma_radius=2:luma_power=1
  5284. boxblur=2:1
  5285. @end example
  5286. @item
  5287. Set the luma radius to 2, and alpha and chroma radius to 0:
  5288. @example
  5289. boxblur=2:1:cr=0:ar=0
  5290. @end example
  5291. @item
  5292. Set the luma and chroma radii to a fraction of the video dimension:
  5293. @example
  5294. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5295. @end example
  5296. @end itemize
  5297. @section bwdif
  5298. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5299. Deinterlacing Filter").
  5300. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5301. interpolation algorithms.
  5302. It accepts the following parameters:
  5303. @table @option
  5304. @item mode
  5305. The interlacing mode to adopt. It accepts one of the following values:
  5306. @table @option
  5307. @item 0, send_frame
  5308. Output one frame for each frame.
  5309. @item 1, send_field
  5310. Output one frame for each field.
  5311. @end table
  5312. The default value is @code{send_field}.
  5313. @item parity
  5314. The picture field parity assumed for the input interlaced video. It accepts one
  5315. of the following values:
  5316. @table @option
  5317. @item 0, tff
  5318. Assume the top field is first.
  5319. @item 1, bff
  5320. Assume the bottom field is first.
  5321. @item -1, auto
  5322. Enable automatic detection of field parity.
  5323. @end table
  5324. The default value is @code{auto}.
  5325. If the interlacing is unknown or the decoder does not export this information,
  5326. top field first will be assumed.
  5327. @item deint
  5328. Specify which frames to deinterlace. Accepts one of the following
  5329. values:
  5330. @table @option
  5331. @item 0, all
  5332. Deinterlace all frames.
  5333. @item 1, interlaced
  5334. Only deinterlace frames marked as interlaced.
  5335. @end table
  5336. The default value is @code{all}.
  5337. @end table
  5338. @section chromahold
  5339. Remove all color information for all colors except for certain one.
  5340. The filter accepts the following options:
  5341. @table @option
  5342. @item color
  5343. The color which will not be replaced with neutral chroma.
  5344. @item similarity
  5345. Similarity percentage with the above color.
  5346. 0.01 matches only the exact key color, while 1.0 matches everything.
  5347. @item blend
  5348. Blend percentage.
  5349. 0.0 makes pixels either fully gray, or not gray at all.
  5350. Higher values result in more preserved color.
  5351. @item yuv
  5352. Signals that the color passed is already in YUV instead of RGB.
  5353. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5354. This can be used to pass exact YUV values as hexadecimal numbers.
  5355. @end table
  5356. @subsection Commands
  5357. This filter supports same @ref{commands} as options.
  5358. The command accepts the same syntax of the corresponding option.
  5359. If the specified expression is not valid, it is kept at its current
  5360. value.
  5361. @section chromakey
  5362. YUV colorspace color/chroma keying.
  5363. The filter accepts the following options:
  5364. @table @option
  5365. @item color
  5366. The color which will be replaced with transparency.
  5367. @item similarity
  5368. Similarity percentage with the key color.
  5369. 0.01 matches only the exact key color, while 1.0 matches everything.
  5370. @item blend
  5371. Blend percentage.
  5372. 0.0 makes pixels either fully transparent, or not transparent at all.
  5373. Higher values result in semi-transparent pixels, with a higher transparency
  5374. the more similar the pixels color is to the key color.
  5375. @item yuv
  5376. Signals that the color passed is already in YUV instead of RGB.
  5377. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5378. This can be used to pass exact YUV values as hexadecimal numbers.
  5379. @end table
  5380. @subsection Commands
  5381. This filter supports same @ref{commands} as options.
  5382. The command accepts the same syntax of the corresponding option.
  5383. If the specified expression is not valid, it is kept at its current
  5384. value.
  5385. @subsection Examples
  5386. @itemize
  5387. @item
  5388. Make every green pixel in the input image transparent:
  5389. @example
  5390. ffmpeg -i input.png -vf chromakey=green out.png
  5391. @end example
  5392. @item
  5393. Overlay a greenscreen-video on top of a static black background.
  5394. @example
  5395. 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
  5396. @end example
  5397. @end itemize
  5398. @section chromashift
  5399. Shift chroma pixels horizontally and/or vertically.
  5400. The filter accepts the following options:
  5401. @table @option
  5402. @item cbh
  5403. Set amount to shift chroma-blue horizontally.
  5404. @item cbv
  5405. Set amount to shift chroma-blue vertically.
  5406. @item crh
  5407. Set amount to shift chroma-red horizontally.
  5408. @item crv
  5409. Set amount to shift chroma-red vertically.
  5410. @item edge
  5411. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5412. @end table
  5413. @subsection Commands
  5414. This filter supports the all above options as @ref{commands}.
  5415. @section ciescope
  5416. Display CIE color diagram with pixels overlaid onto it.
  5417. The filter accepts the following options:
  5418. @table @option
  5419. @item system
  5420. Set color system.
  5421. @table @samp
  5422. @item ntsc, 470m
  5423. @item ebu, 470bg
  5424. @item smpte
  5425. @item 240m
  5426. @item apple
  5427. @item widergb
  5428. @item cie1931
  5429. @item rec709, hdtv
  5430. @item uhdtv, rec2020
  5431. @item dcip3
  5432. @end table
  5433. @item cie
  5434. Set CIE system.
  5435. @table @samp
  5436. @item xyy
  5437. @item ucs
  5438. @item luv
  5439. @end table
  5440. @item gamuts
  5441. Set what gamuts to draw.
  5442. See @code{system} option for available values.
  5443. @item size, s
  5444. Set ciescope size, by default set to 512.
  5445. @item intensity, i
  5446. Set intensity used to map input pixel values to CIE diagram.
  5447. @item contrast
  5448. Set contrast used to draw tongue colors that are out of active color system gamut.
  5449. @item corrgamma
  5450. Correct gamma displayed on scope, by default enabled.
  5451. @item showwhite
  5452. Show white point on CIE diagram, by default disabled.
  5453. @item gamma
  5454. Set input gamma. Used only with XYZ input color space.
  5455. @end table
  5456. @section codecview
  5457. Visualize information exported by some codecs.
  5458. Some codecs can export information through frames using side-data or other
  5459. means. For example, some MPEG based codecs export motion vectors through the
  5460. @var{export_mvs} flag in the codec @option{flags2} option.
  5461. The filter accepts the following option:
  5462. @table @option
  5463. @item mv
  5464. Set motion vectors to visualize.
  5465. Available flags for @var{mv} are:
  5466. @table @samp
  5467. @item pf
  5468. forward predicted MVs of P-frames
  5469. @item bf
  5470. forward predicted MVs of B-frames
  5471. @item bb
  5472. backward predicted MVs of B-frames
  5473. @end table
  5474. @item qp
  5475. Display quantization parameters using the chroma planes.
  5476. @item mv_type, mvt
  5477. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5478. Available flags for @var{mv_type} are:
  5479. @table @samp
  5480. @item fp
  5481. forward predicted MVs
  5482. @item bp
  5483. backward predicted MVs
  5484. @end table
  5485. @item frame_type, ft
  5486. Set frame type to visualize motion vectors of.
  5487. Available flags for @var{frame_type} are:
  5488. @table @samp
  5489. @item if
  5490. intra-coded frames (I-frames)
  5491. @item pf
  5492. predicted frames (P-frames)
  5493. @item bf
  5494. bi-directionally predicted frames (B-frames)
  5495. @end table
  5496. @end table
  5497. @subsection Examples
  5498. @itemize
  5499. @item
  5500. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5501. @example
  5502. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5503. @end example
  5504. @item
  5505. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5506. @example
  5507. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5508. @end example
  5509. @end itemize
  5510. @section colorbalance
  5511. Modify intensity of primary colors (red, green and blue) of input frames.
  5512. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5513. regions for the red-cyan, green-magenta or blue-yellow balance.
  5514. A positive adjustment value shifts the balance towards the primary color, a negative
  5515. value towards the complementary color.
  5516. The filter accepts the following options:
  5517. @table @option
  5518. @item rs
  5519. @item gs
  5520. @item bs
  5521. Adjust red, green and blue shadows (darkest pixels).
  5522. @item rm
  5523. @item gm
  5524. @item bm
  5525. Adjust red, green and blue midtones (medium pixels).
  5526. @item rh
  5527. @item gh
  5528. @item bh
  5529. Adjust red, green and blue highlights (brightest pixels).
  5530. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5531. @item pl
  5532. Preserve lightness when changing color balance. Default is disabled.
  5533. @end table
  5534. @subsection Examples
  5535. @itemize
  5536. @item
  5537. Add red color cast to shadows:
  5538. @example
  5539. colorbalance=rs=.3
  5540. @end example
  5541. @end itemize
  5542. @subsection Commands
  5543. This filter supports the all above options as @ref{commands}.
  5544. @section colorchannelmixer
  5545. Adjust video input frames by re-mixing color channels.
  5546. This filter modifies a color channel by adding the values associated to
  5547. the other channels of the same pixels. For example if the value to
  5548. modify is red, the output value will be:
  5549. @example
  5550. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5551. @end example
  5552. The filter accepts the following options:
  5553. @table @option
  5554. @item rr
  5555. @item rg
  5556. @item rb
  5557. @item ra
  5558. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5559. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5560. @item gr
  5561. @item gg
  5562. @item gb
  5563. @item ga
  5564. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5565. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5566. @item br
  5567. @item bg
  5568. @item bb
  5569. @item ba
  5570. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5571. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5572. @item ar
  5573. @item ag
  5574. @item ab
  5575. @item aa
  5576. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5577. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5578. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5579. @end table
  5580. @subsection Examples
  5581. @itemize
  5582. @item
  5583. Convert source to grayscale:
  5584. @example
  5585. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5586. @end example
  5587. @item
  5588. Simulate sepia tones:
  5589. @example
  5590. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5591. @end example
  5592. @end itemize
  5593. @subsection Commands
  5594. This filter supports the all above options as @ref{commands}.
  5595. @section colorkey
  5596. RGB colorspace color keying.
  5597. The filter accepts the following options:
  5598. @table @option
  5599. @item color
  5600. The color which will be replaced with transparency.
  5601. @item similarity
  5602. Similarity percentage with the key color.
  5603. 0.01 matches only the exact key color, while 1.0 matches everything.
  5604. @item blend
  5605. Blend percentage.
  5606. 0.0 makes pixels either fully transparent, or not transparent at all.
  5607. Higher values result in semi-transparent pixels, with a higher transparency
  5608. the more similar the pixels color is to the key color.
  5609. @end table
  5610. @subsection Examples
  5611. @itemize
  5612. @item
  5613. Make every green pixel in the input image transparent:
  5614. @example
  5615. ffmpeg -i input.png -vf colorkey=green out.png
  5616. @end example
  5617. @item
  5618. Overlay a greenscreen-video on top of a static background image.
  5619. @example
  5620. 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
  5621. @end example
  5622. @end itemize
  5623. @section colorhold
  5624. Remove all color information for all RGB colors except for certain one.
  5625. The filter accepts the following options:
  5626. @table @option
  5627. @item color
  5628. The color which will not be replaced with neutral gray.
  5629. @item similarity
  5630. Similarity percentage with the above color.
  5631. 0.01 matches only the exact key color, while 1.0 matches everything.
  5632. @item blend
  5633. Blend percentage. 0.0 makes pixels fully gray.
  5634. Higher values result in more preserved color.
  5635. @end table
  5636. @section colorlevels
  5637. Adjust video input frames using levels.
  5638. The filter accepts the following options:
  5639. @table @option
  5640. @item rimin
  5641. @item gimin
  5642. @item bimin
  5643. @item aimin
  5644. Adjust red, green, blue and alpha input black point.
  5645. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5646. @item rimax
  5647. @item gimax
  5648. @item bimax
  5649. @item aimax
  5650. Adjust red, green, blue and alpha input white point.
  5651. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5652. Input levels are used to lighten highlights (bright tones), darken shadows
  5653. (dark tones), change the balance of bright and dark tones.
  5654. @item romin
  5655. @item gomin
  5656. @item bomin
  5657. @item aomin
  5658. Adjust red, green, blue and alpha output black point.
  5659. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5660. @item romax
  5661. @item gomax
  5662. @item bomax
  5663. @item aomax
  5664. Adjust red, green, blue and alpha output white point.
  5665. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5666. Output levels allows manual selection of a constrained output level range.
  5667. @end table
  5668. @subsection Examples
  5669. @itemize
  5670. @item
  5671. Make video output darker:
  5672. @example
  5673. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5674. @end example
  5675. @item
  5676. Increase contrast:
  5677. @example
  5678. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5679. @end example
  5680. @item
  5681. Make video output lighter:
  5682. @example
  5683. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5684. @end example
  5685. @item
  5686. Increase brightness:
  5687. @example
  5688. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5689. @end example
  5690. @end itemize
  5691. @section colormatrix
  5692. Convert color matrix.
  5693. The filter accepts the following options:
  5694. @table @option
  5695. @item src
  5696. @item dst
  5697. Specify the source and destination color matrix. Both values must be
  5698. specified.
  5699. The accepted values are:
  5700. @table @samp
  5701. @item bt709
  5702. BT.709
  5703. @item fcc
  5704. FCC
  5705. @item bt601
  5706. BT.601
  5707. @item bt470
  5708. BT.470
  5709. @item bt470bg
  5710. BT.470BG
  5711. @item smpte170m
  5712. SMPTE-170M
  5713. @item smpte240m
  5714. SMPTE-240M
  5715. @item bt2020
  5716. BT.2020
  5717. @end table
  5718. @end table
  5719. For example to convert from BT.601 to SMPTE-240M, use the command:
  5720. @example
  5721. colormatrix=bt601:smpte240m
  5722. @end example
  5723. @section colorspace
  5724. Convert colorspace, transfer characteristics or color primaries.
  5725. Input video needs to have an even size.
  5726. The filter accepts the following options:
  5727. @table @option
  5728. @anchor{all}
  5729. @item all
  5730. Specify all color properties at once.
  5731. The accepted values are:
  5732. @table @samp
  5733. @item bt470m
  5734. BT.470M
  5735. @item bt470bg
  5736. BT.470BG
  5737. @item bt601-6-525
  5738. BT.601-6 525
  5739. @item bt601-6-625
  5740. BT.601-6 625
  5741. @item bt709
  5742. BT.709
  5743. @item smpte170m
  5744. SMPTE-170M
  5745. @item smpte240m
  5746. SMPTE-240M
  5747. @item bt2020
  5748. BT.2020
  5749. @end table
  5750. @anchor{space}
  5751. @item space
  5752. Specify output colorspace.
  5753. The accepted values are:
  5754. @table @samp
  5755. @item bt709
  5756. BT.709
  5757. @item fcc
  5758. FCC
  5759. @item bt470bg
  5760. BT.470BG or BT.601-6 625
  5761. @item smpte170m
  5762. SMPTE-170M or BT.601-6 525
  5763. @item smpte240m
  5764. SMPTE-240M
  5765. @item ycgco
  5766. YCgCo
  5767. @item bt2020ncl
  5768. BT.2020 with non-constant luminance
  5769. @end table
  5770. @anchor{trc}
  5771. @item trc
  5772. Specify output transfer characteristics.
  5773. The accepted values are:
  5774. @table @samp
  5775. @item bt709
  5776. BT.709
  5777. @item bt470m
  5778. BT.470M
  5779. @item bt470bg
  5780. BT.470BG
  5781. @item gamma22
  5782. Constant gamma of 2.2
  5783. @item gamma28
  5784. Constant gamma of 2.8
  5785. @item smpte170m
  5786. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5787. @item smpte240m
  5788. SMPTE-240M
  5789. @item srgb
  5790. SRGB
  5791. @item iec61966-2-1
  5792. iec61966-2-1
  5793. @item iec61966-2-4
  5794. iec61966-2-4
  5795. @item xvycc
  5796. xvycc
  5797. @item bt2020-10
  5798. BT.2020 for 10-bits content
  5799. @item bt2020-12
  5800. BT.2020 for 12-bits content
  5801. @end table
  5802. @anchor{primaries}
  5803. @item primaries
  5804. Specify output color primaries.
  5805. The accepted values are:
  5806. @table @samp
  5807. @item bt709
  5808. BT.709
  5809. @item bt470m
  5810. BT.470M
  5811. @item bt470bg
  5812. BT.470BG or BT.601-6 625
  5813. @item smpte170m
  5814. SMPTE-170M or BT.601-6 525
  5815. @item smpte240m
  5816. SMPTE-240M
  5817. @item film
  5818. film
  5819. @item smpte431
  5820. SMPTE-431
  5821. @item smpte432
  5822. SMPTE-432
  5823. @item bt2020
  5824. BT.2020
  5825. @item jedec-p22
  5826. JEDEC P22 phosphors
  5827. @end table
  5828. @anchor{range}
  5829. @item range
  5830. Specify output color range.
  5831. The accepted values are:
  5832. @table @samp
  5833. @item tv
  5834. TV (restricted) range
  5835. @item mpeg
  5836. MPEG (restricted) range
  5837. @item pc
  5838. PC (full) range
  5839. @item jpeg
  5840. JPEG (full) range
  5841. @end table
  5842. @item format
  5843. Specify output color format.
  5844. The accepted values are:
  5845. @table @samp
  5846. @item yuv420p
  5847. YUV 4:2:0 planar 8-bits
  5848. @item yuv420p10
  5849. YUV 4:2:0 planar 10-bits
  5850. @item yuv420p12
  5851. YUV 4:2:0 planar 12-bits
  5852. @item yuv422p
  5853. YUV 4:2:2 planar 8-bits
  5854. @item yuv422p10
  5855. YUV 4:2:2 planar 10-bits
  5856. @item yuv422p12
  5857. YUV 4:2:2 planar 12-bits
  5858. @item yuv444p
  5859. YUV 4:4:4 planar 8-bits
  5860. @item yuv444p10
  5861. YUV 4:4:4 planar 10-bits
  5862. @item yuv444p12
  5863. YUV 4:4:4 planar 12-bits
  5864. @end table
  5865. @item fast
  5866. Do a fast conversion, which skips gamma/primary correction. This will take
  5867. significantly less CPU, but will be mathematically incorrect. To get output
  5868. compatible with that produced by the colormatrix filter, use fast=1.
  5869. @item dither
  5870. Specify dithering mode.
  5871. The accepted values are:
  5872. @table @samp
  5873. @item none
  5874. No dithering
  5875. @item fsb
  5876. Floyd-Steinberg dithering
  5877. @end table
  5878. @item wpadapt
  5879. Whitepoint adaptation mode.
  5880. The accepted values are:
  5881. @table @samp
  5882. @item bradford
  5883. Bradford whitepoint adaptation
  5884. @item vonkries
  5885. von Kries whitepoint adaptation
  5886. @item identity
  5887. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5888. @end table
  5889. @item iall
  5890. Override all input properties at once. Same accepted values as @ref{all}.
  5891. @item ispace
  5892. Override input colorspace. Same accepted values as @ref{space}.
  5893. @item iprimaries
  5894. Override input color primaries. Same accepted values as @ref{primaries}.
  5895. @item itrc
  5896. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5897. @item irange
  5898. Override input color range. Same accepted values as @ref{range}.
  5899. @end table
  5900. The filter converts the transfer characteristics, color space and color
  5901. primaries to the specified user values. The output value, if not specified,
  5902. is set to a default value based on the "all" property. If that property is
  5903. also not specified, the filter will log an error. The output color range and
  5904. format default to the same value as the input color range and format. The
  5905. input transfer characteristics, color space, color primaries and color range
  5906. should be set on the input data. If any of these are missing, the filter will
  5907. log an error and no conversion will take place.
  5908. For example to convert the input to SMPTE-240M, use the command:
  5909. @example
  5910. colorspace=smpte240m
  5911. @end example
  5912. @section convolution
  5913. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5914. The filter accepts the following options:
  5915. @table @option
  5916. @item 0m
  5917. @item 1m
  5918. @item 2m
  5919. @item 3m
  5920. Set matrix for each plane.
  5921. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5922. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5923. @item 0rdiv
  5924. @item 1rdiv
  5925. @item 2rdiv
  5926. @item 3rdiv
  5927. Set multiplier for calculated value for each plane.
  5928. If unset or 0, it will be sum of all matrix elements.
  5929. @item 0bias
  5930. @item 1bias
  5931. @item 2bias
  5932. @item 3bias
  5933. Set bias for each plane. This value is added to the result of the multiplication.
  5934. Useful for making the overall image brighter or darker. Default is 0.0.
  5935. @item 0mode
  5936. @item 1mode
  5937. @item 2mode
  5938. @item 3mode
  5939. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5940. Default is @var{square}.
  5941. @end table
  5942. @subsection Examples
  5943. @itemize
  5944. @item
  5945. Apply sharpen:
  5946. @example
  5947. 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"
  5948. @end example
  5949. @item
  5950. Apply blur:
  5951. @example
  5952. 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"
  5953. @end example
  5954. @item
  5955. Apply edge enhance:
  5956. @example
  5957. 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"
  5958. @end example
  5959. @item
  5960. Apply edge detect:
  5961. @example
  5962. 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"
  5963. @end example
  5964. @item
  5965. Apply laplacian edge detector which includes diagonals:
  5966. @example
  5967. 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"
  5968. @end example
  5969. @item
  5970. Apply emboss:
  5971. @example
  5972. 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"
  5973. @end example
  5974. @end itemize
  5975. @section convolve
  5976. Apply 2D convolution of video stream in frequency domain using second stream
  5977. as impulse.
  5978. The filter accepts the following options:
  5979. @table @option
  5980. @item planes
  5981. Set which planes to process.
  5982. @item impulse
  5983. Set which impulse video frames will be processed, can be @var{first}
  5984. or @var{all}. Default is @var{all}.
  5985. @end table
  5986. The @code{convolve} filter also supports the @ref{framesync} options.
  5987. @section copy
  5988. Copy the input video source unchanged to the output. This is mainly useful for
  5989. testing purposes.
  5990. @anchor{coreimage}
  5991. @section coreimage
  5992. Video filtering on GPU using Apple's CoreImage API on OSX.
  5993. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5994. processed by video hardware. However, software-based OpenGL implementations
  5995. exist which means there is no guarantee for hardware processing. It depends on
  5996. the respective OSX.
  5997. There are many filters and image generators provided by Apple that come with a
  5998. large variety of options. The filter has to be referenced by its name along
  5999. with its options.
  6000. The coreimage filter accepts the following options:
  6001. @table @option
  6002. @item list_filters
  6003. List all available filters and generators along with all their respective
  6004. options as well as possible minimum and maximum values along with the default
  6005. values.
  6006. @example
  6007. list_filters=true
  6008. @end example
  6009. @item filter
  6010. Specify all filters by their respective name and options.
  6011. Use @var{list_filters} to determine all valid filter names and options.
  6012. Numerical options are specified by a float value and are automatically clamped
  6013. to their respective value range. Vector and color options have to be specified
  6014. by a list of space separated float values. Character escaping has to be done.
  6015. A special option name @code{default} is available to use default options for a
  6016. filter.
  6017. It is required to specify either @code{default} or at least one of the filter options.
  6018. All omitted options are used with their default values.
  6019. The syntax of the filter string is as follows:
  6020. @example
  6021. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6022. @end example
  6023. @item output_rect
  6024. Specify a rectangle where the output of the filter chain is copied into the
  6025. input image. It is given by a list of space separated float values:
  6026. @example
  6027. output_rect=x\ y\ width\ height
  6028. @end example
  6029. If not given, the output rectangle equals the dimensions of the input image.
  6030. The output rectangle is automatically cropped at the borders of the input
  6031. image. Negative values are valid for each component.
  6032. @example
  6033. output_rect=25\ 25\ 100\ 100
  6034. @end example
  6035. @end table
  6036. Several filters can be chained for successive processing without GPU-HOST
  6037. transfers allowing for fast processing of complex filter chains.
  6038. Currently, only filters with zero (generators) or exactly one (filters) input
  6039. image and one output image are supported. Also, transition filters are not yet
  6040. usable as intended.
  6041. Some filters generate output images with additional padding depending on the
  6042. respective filter kernel. The padding is automatically removed to ensure the
  6043. filter output has the same size as the input image.
  6044. For image generators, the size of the output image is determined by the
  6045. previous output image of the filter chain or the input image of the whole
  6046. filterchain, respectively. The generators do not use the pixel information of
  6047. this image to generate their output. However, the generated output is
  6048. blended onto this image, resulting in partial or complete coverage of the
  6049. output image.
  6050. The @ref{coreimagesrc} video source can be used for generating input images
  6051. which are directly fed into the filter chain. By using it, providing input
  6052. images by another video source or an input video is not required.
  6053. @subsection Examples
  6054. @itemize
  6055. @item
  6056. List all filters available:
  6057. @example
  6058. coreimage=list_filters=true
  6059. @end example
  6060. @item
  6061. Use the CIBoxBlur filter with default options to blur an image:
  6062. @example
  6063. coreimage=filter=CIBoxBlur@@default
  6064. @end example
  6065. @item
  6066. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6067. its center at 100x100 and a radius of 50 pixels:
  6068. @example
  6069. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6070. @end example
  6071. @item
  6072. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6073. given as complete and escaped command-line for Apple's standard bash shell:
  6074. @example
  6075. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6076. @end example
  6077. @end itemize
  6078. @section cover_rect
  6079. Cover a rectangular object
  6080. It accepts the following options:
  6081. @table @option
  6082. @item cover
  6083. Filepath of the optional cover image, needs to be in yuv420.
  6084. @item mode
  6085. Set covering mode.
  6086. It accepts the following values:
  6087. @table @samp
  6088. @item cover
  6089. cover it by the supplied image
  6090. @item blur
  6091. cover it by interpolating the surrounding pixels
  6092. @end table
  6093. Default value is @var{blur}.
  6094. @end table
  6095. @subsection Examples
  6096. @itemize
  6097. @item
  6098. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6099. @example
  6100. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6101. @end example
  6102. @end itemize
  6103. @section crop
  6104. Crop the input video to given dimensions.
  6105. It accepts the following parameters:
  6106. @table @option
  6107. @item w, out_w
  6108. The width of the output video. It defaults to @code{iw}.
  6109. This expression is evaluated only once during the filter
  6110. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6111. @item h, out_h
  6112. The height of the output video. It defaults to @code{ih}.
  6113. This expression is evaluated only once during the filter
  6114. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6115. @item x
  6116. The horizontal position, in the input video, of the left edge of the output
  6117. video. It defaults to @code{(in_w-out_w)/2}.
  6118. This expression is evaluated per-frame.
  6119. @item y
  6120. The vertical position, in the input video, of the top edge of the output video.
  6121. It defaults to @code{(in_h-out_h)/2}.
  6122. This expression is evaluated per-frame.
  6123. @item keep_aspect
  6124. If set to 1 will force the output display aspect ratio
  6125. to be the same of the input, by changing the output sample aspect
  6126. ratio. It defaults to 0.
  6127. @item exact
  6128. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6129. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6130. It defaults to 0.
  6131. @end table
  6132. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6133. expressions containing the following constants:
  6134. @table @option
  6135. @item x
  6136. @item y
  6137. The computed values for @var{x} and @var{y}. They are evaluated for
  6138. each new frame.
  6139. @item in_w
  6140. @item in_h
  6141. The input width and height.
  6142. @item iw
  6143. @item ih
  6144. These are the same as @var{in_w} and @var{in_h}.
  6145. @item out_w
  6146. @item out_h
  6147. The output (cropped) width and height.
  6148. @item ow
  6149. @item oh
  6150. These are the same as @var{out_w} and @var{out_h}.
  6151. @item a
  6152. same as @var{iw} / @var{ih}
  6153. @item sar
  6154. input sample aspect ratio
  6155. @item dar
  6156. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6157. @item hsub
  6158. @item vsub
  6159. horizontal and vertical chroma subsample values. For example for the
  6160. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6161. @item n
  6162. The number of the input frame, starting from 0.
  6163. @item pos
  6164. the position in the file of the input frame, NAN if unknown
  6165. @item t
  6166. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6167. @end table
  6168. The expression for @var{out_w} may depend on the value of @var{out_h},
  6169. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6170. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6171. evaluated after @var{out_w} and @var{out_h}.
  6172. The @var{x} and @var{y} parameters specify the expressions for the
  6173. position of the top-left corner of the output (non-cropped) area. They
  6174. are evaluated for each frame. If the evaluated value is not valid, it
  6175. is approximated to the nearest valid value.
  6176. The expression for @var{x} may depend on @var{y}, and the expression
  6177. for @var{y} may depend on @var{x}.
  6178. @subsection Examples
  6179. @itemize
  6180. @item
  6181. Crop area with size 100x100 at position (12,34).
  6182. @example
  6183. crop=100:100:12:34
  6184. @end example
  6185. Using named options, the example above becomes:
  6186. @example
  6187. crop=w=100:h=100:x=12:y=34
  6188. @end example
  6189. @item
  6190. Crop the central input area with size 100x100:
  6191. @example
  6192. crop=100:100
  6193. @end example
  6194. @item
  6195. Crop the central input area with size 2/3 of the input video:
  6196. @example
  6197. crop=2/3*in_w:2/3*in_h
  6198. @end example
  6199. @item
  6200. Crop the input video central square:
  6201. @example
  6202. crop=out_w=in_h
  6203. crop=in_h
  6204. @end example
  6205. @item
  6206. Delimit the rectangle with the top-left corner placed at position
  6207. 100:100 and the right-bottom corner corresponding to the right-bottom
  6208. corner of the input image.
  6209. @example
  6210. crop=in_w-100:in_h-100:100:100
  6211. @end example
  6212. @item
  6213. Crop 10 pixels from the left and right borders, and 20 pixels from
  6214. the top and bottom borders
  6215. @example
  6216. crop=in_w-2*10:in_h-2*20
  6217. @end example
  6218. @item
  6219. Keep only the bottom right quarter of the input image:
  6220. @example
  6221. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6222. @end example
  6223. @item
  6224. Crop height for getting Greek harmony:
  6225. @example
  6226. crop=in_w:1/PHI*in_w
  6227. @end example
  6228. @item
  6229. Apply trembling effect:
  6230. @example
  6231. 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)
  6232. @end example
  6233. @item
  6234. Apply erratic camera effect depending on timestamp:
  6235. @example
  6236. 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)"
  6237. @end example
  6238. @item
  6239. Set x depending on the value of y:
  6240. @example
  6241. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6242. @end example
  6243. @end itemize
  6244. @subsection Commands
  6245. This filter supports the following commands:
  6246. @table @option
  6247. @item w, out_w
  6248. @item h, out_h
  6249. @item x
  6250. @item y
  6251. Set width/height of the output video and the horizontal/vertical position
  6252. in the input video.
  6253. The command accepts the same syntax of the corresponding option.
  6254. If the specified expression is not valid, it is kept at its current
  6255. value.
  6256. @end table
  6257. @section cropdetect
  6258. Auto-detect the crop size.
  6259. It calculates the necessary cropping parameters and prints the
  6260. recommended parameters via the logging system. The detected dimensions
  6261. correspond to the non-black area of the input video.
  6262. It accepts the following parameters:
  6263. @table @option
  6264. @item limit
  6265. Set higher black value threshold, which can be optionally specified
  6266. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6267. value greater to the set value is considered non-black. It defaults to 24.
  6268. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6269. on the bitdepth of the pixel format.
  6270. @item round
  6271. The value which the width/height should be divisible by. It defaults to
  6272. 16. The offset is automatically adjusted to center the video. Use 2 to
  6273. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6274. encoding to most video codecs.
  6275. @item reset_count, reset
  6276. Set the counter that determines after how many frames cropdetect will
  6277. reset the previously detected largest video area and start over to
  6278. detect the current optimal crop area. Default value is 0.
  6279. This can be useful when channel logos distort the video area. 0
  6280. indicates 'never reset', and returns the largest area encountered during
  6281. playback.
  6282. @end table
  6283. @anchor{cue}
  6284. @section cue
  6285. Delay video filtering until a given wallclock timestamp. The filter first
  6286. passes on @option{preroll} amount of frames, then it buffers at most
  6287. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6288. it forwards the buffered frames and also any subsequent frames coming in its
  6289. input.
  6290. The filter can be used synchronize the output of multiple ffmpeg processes for
  6291. realtime output devices like decklink. By putting the delay in the filtering
  6292. chain and pre-buffering frames the process can pass on data to output almost
  6293. immediately after the target wallclock timestamp is reached.
  6294. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6295. some use cases.
  6296. @table @option
  6297. @item cue
  6298. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6299. @item preroll
  6300. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6301. @item buffer
  6302. The maximum duration of content to buffer before waiting for the cue expressed
  6303. in seconds. Default is 0.
  6304. @end table
  6305. @anchor{curves}
  6306. @section curves
  6307. Apply color adjustments using curves.
  6308. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6309. component (red, green and blue) has its values defined by @var{N} key points
  6310. tied from each other using a smooth curve. The x-axis represents the pixel
  6311. values from the input frame, and the y-axis the new pixel values to be set for
  6312. the output frame.
  6313. By default, a component curve is defined by the two points @var{(0;0)} and
  6314. @var{(1;1)}. This creates a straight line where each original pixel value is
  6315. "adjusted" to its own value, which means no change to the image.
  6316. The filter allows you to redefine these two points and add some more. A new
  6317. curve (using a natural cubic spline interpolation) will be define to pass
  6318. smoothly through all these new coordinates. The new defined points needs to be
  6319. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6320. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6321. the vector spaces, the values will be clipped accordingly.
  6322. The filter accepts the following options:
  6323. @table @option
  6324. @item preset
  6325. Select one of the available color presets. This option can be used in addition
  6326. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6327. options takes priority on the preset values.
  6328. Available presets are:
  6329. @table @samp
  6330. @item none
  6331. @item color_negative
  6332. @item cross_process
  6333. @item darker
  6334. @item increase_contrast
  6335. @item lighter
  6336. @item linear_contrast
  6337. @item medium_contrast
  6338. @item negative
  6339. @item strong_contrast
  6340. @item vintage
  6341. @end table
  6342. Default is @code{none}.
  6343. @item master, m
  6344. Set the master key points. These points will define a second pass mapping. It
  6345. is sometimes called a "luminance" or "value" mapping. It can be used with
  6346. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6347. post-processing LUT.
  6348. @item red, r
  6349. Set the key points for the red component.
  6350. @item green, g
  6351. Set the key points for the green component.
  6352. @item blue, b
  6353. Set the key points for the blue component.
  6354. @item all
  6355. Set the key points for all components (not including master).
  6356. Can be used in addition to the other key points component
  6357. options. In this case, the unset component(s) will fallback on this
  6358. @option{all} setting.
  6359. @item psfile
  6360. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6361. @item plot
  6362. Save Gnuplot script of the curves in specified file.
  6363. @end table
  6364. To avoid some filtergraph syntax conflicts, each key points list need to be
  6365. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6366. @subsection Examples
  6367. @itemize
  6368. @item
  6369. Increase slightly the middle level of blue:
  6370. @example
  6371. curves=blue='0/0 0.5/0.58 1/1'
  6372. @end example
  6373. @item
  6374. Vintage effect:
  6375. @example
  6376. 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'
  6377. @end example
  6378. Here we obtain the following coordinates for each components:
  6379. @table @var
  6380. @item red
  6381. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6382. @item green
  6383. @code{(0;0) (0.50;0.48) (1;1)}
  6384. @item blue
  6385. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6386. @end table
  6387. @item
  6388. The previous example can also be achieved with the associated built-in preset:
  6389. @example
  6390. curves=preset=vintage
  6391. @end example
  6392. @item
  6393. Or simply:
  6394. @example
  6395. curves=vintage
  6396. @end example
  6397. @item
  6398. Use a Photoshop preset and redefine the points of the green component:
  6399. @example
  6400. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6401. @end example
  6402. @item
  6403. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6404. and @command{gnuplot}:
  6405. @example
  6406. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6407. gnuplot -p /tmp/curves.plt
  6408. @end example
  6409. @end itemize
  6410. @section datascope
  6411. Video data analysis filter.
  6412. This filter shows hexadecimal pixel values of part of video.
  6413. The filter accepts the following options:
  6414. @table @option
  6415. @item size, s
  6416. Set output video size.
  6417. @item x
  6418. Set x offset from where to pick pixels.
  6419. @item y
  6420. Set y offset from where to pick pixels.
  6421. @item mode
  6422. Set scope mode, can be one of the following:
  6423. @table @samp
  6424. @item mono
  6425. Draw hexadecimal pixel values with white color on black background.
  6426. @item color
  6427. Draw hexadecimal pixel values with input video pixel color on black
  6428. background.
  6429. @item color2
  6430. Draw hexadecimal pixel values on color background picked from input video,
  6431. the text color is picked in such way so its always visible.
  6432. @end table
  6433. @item axis
  6434. Draw rows and columns numbers on left and top of video.
  6435. @item opacity
  6436. Set background opacity.
  6437. @item format
  6438. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6439. @end table
  6440. @section dctdnoiz
  6441. Denoise frames using 2D DCT (frequency domain filtering).
  6442. This filter is not designed for real time.
  6443. The filter accepts the following options:
  6444. @table @option
  6445. @item sigma, s
  6446. Set the noise sigma constant.
  6447. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6448. coefficient (absolute value) below this threshold with be dropped.
  6449. If you need a more advanced filtering, see @option{expr}.
  6450. Default is @code{0}.
  6451. @item overlap
  6452. Set number overlapping pixels for each block. Since the filter can be slow, you
  6453. may want to reduce this value, at the cost of a less effective filter and the
  6454. risk of various artefacts.
  6455. If the overlapping value doesn't permit processing the whole input width or
  6456. height, a warning will be displayed and according borders won't be denoised.
  6457. Default value is @var{blocksize}-1, which is the best possible setting.
  6458. @item expr, e
  6459. Set the coefficient factor expression.
  6460. For each coefficient of a DCT block, this expression will be evaluated as a
  6461. multiplier value for the coefficient.
  6462. If this is option is set, the @option{sigma} option will be ignored.
  6463. The absolute value of the coefficient can be accessed through the @var{c}
  6464. variable.
  6465. @item n
  6466. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6467. @var{blocksize}, which is the width and height of the processed blocks.
  6468. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6469. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6470. on the speed processing. Also, a larger block size does not necessarily means a
  6471. better de-noising.
  6472. @end table
  6473. @subsection Examples
  6474. Apply a denoise with a @option{sigma} of @code{4.5}:
  6475. @example
  6476. dctdnoiz=4.5
  6477. @end example
  6478. The same operation can be achieved using the expression system:
  6479. @example
  6480. dctdnoiz=e='gte(c, 4.5*3)'
  6481. @end example
  6482. Violent denoise using a block size of @code{16x16}:
  6483. @example
  6484. dctdnoiz=15:n=4
  6485. @end example
  6486. @section deband
  6487. Remove banding artifacts from input video.
  6488. It works by replacing banded pixels with average value of referenced pixels.
  6489. The filter accepts the following options:
  6490. @table @option
  6491. @item 1thr
  6492. @item 2thr
  6493. @item 3thr
  6494. @item 4thr
  6495. Set banding detection threshold for each plane. Default is 0.02.
  6496. Valid range is 0.00003 to 0.5.
  6497. If difference between current pixel and reference pixel is less than threshold,
  6498. it will be considered as banded.
  6499. @item range, r
  6500. Banding detection range in pixels. Default is 16. If positive, random number
  6501. in range 0 to set value will be used. If negative, exact absolute value
  6502. will be used.
  6503. The range defines square of four pixels around current pixel.
  6504. @item direction, d
  6505. Set direction in radians from which four pixel will be compared. If positive,
  6506. random direction from 0 to set direction will be picked. If negative, exact of
  6507. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6508. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6509. column.
  6510. @item blur, b
  6511. If enabled, current pixel is compared with average value of all four
  6512. surrounding pixels. The default is enabled. If disabled current pixel is
  6513. compared with all four surrounding pixels. The pixel is considered banded
  6514. if only all four differences with surrounding pixels are less than threshold.
  6515. @item coupling, c
  6516. If enabled, current pixel is changed if and only if all pixel components are banded,
  6517. e.g. banding detection threshold is triggered for all color components.
  6518. The default is disabled.
  6519. @end table
  6520. @section deblock
  6521. Remove blocking artifacts from input video.
  6522. The filter accepts the following options:
  6523. @table @option
  6524. @item filter
  6525. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6526. This controls what kind of deblocking is applied.
  6527. @item block
  6528. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6529. @item alpha
  6530. @item beta
  6531. @item gamma
  6532. @item delta
  6533. Set blocking detection thresholds. Allowed range is 0 to 1.
  6534. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6535. Using higher threshold gives more deblocking strength.
  6536. Setting @var{alpha} controls threshold detection at exact edge of block.
  6537. Remaining options controls threshold detection near the edge. Each one for
  6538. below/above or left/right. Setting any of those to @var{0} disables
  6539. deblocking.
  6540. @item planes
  6541. Set planes to filter. Default is to filter all available planes.
  6542. @end table
  6543. @subsection Examples
  6544. @itemize
  6545. @item
  6546. Deblock using weak filter and block size of 4 pixels.
  6547. @example
  6548. deblock=filter=weak:block=4
  6549. @end example
  6550. @item
  6551. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6552. deblocking more edges.
  6553. @example
  6554. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6555. @end example
  6556. @item
  6557. Similar as above, but filter only first plane.
  6558. @example
  6559. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6560. @end example
  6561. @item
  6562. Similar as above, but filter only second and third plane.
  6563. @example
  6564. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6565. @end example
  6566. @end itemize
  6567. @anchor{decimate}
  6568. @section decimate
  6569. Drop duplicated frames at regular intervals.
  6570. The filter accepts the following options:
  6571. @table @option
  6572. @item cycle
  6573. Set the number of frames from which one will be dropped. Setting this to
  6574. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6575. Default is @code{5}.
  6576. @item dupthresh
  6577. Set the threshold for duplicate detection. If the difference metric for a frame
  6578. is less than or equal to this value, then it is declared as duplicate. Default
  6579. is @code{1.1}
  6580. @item scthresh
  6581. Set scene change threshold. Default is @code{15}.
  6582. @item blockx
  6583. @item blocky
  6584. Set the size of the x and y-axis blocks used during metric calculations.
  6585. Larger blocks give better noise suppression, but also give worse detection of
  6586. small movements. Must be a power of two. Default is @code{32}.
  6587. @item ppsrc
  6588. Mark main input as a pre-processed input and activate clean source input
  6589. stream. This allows the input to be pre-processed with various filters to help
  6590. the metrics calculation while keeping the frame selection lossless. When set to
  6591. @code{1}, the first stream is for the pre-processed input, and the second
  6592. stream is the clean source from where the kept frames are chosen. Default is
  6593. @code{0}.
  6594. @item chroma
  6595. Set whether or not chroma is considered in the metric calculations. Default is
  6596. @code{1}.
  6597. @end table
  6598. @section deconvolve
  6599. Apply 2D deconvolution of video stream in frequency domain using second stream
  6600. as impulse.
  6601. The filter accepts the following options:
  6602. @table @option
  6603. @item planes
  6604. Set which planes to process.
  6605. @item impulse
  6606. Set which impulse video frames will be processed, can be @var{first}
  6607. or @var{all}. Default is @var{all}.
  6608. @item noise
  6609. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6610. and height are not same and not power of 2 or if stream prior to convolving
  6611. had noise.
  6612. @end table
  6613. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6614. @section dedot
  6615. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6616. It accepts the following options:
  6617. @table @option
  6618. @item m
  6619. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6620. @var{rainbows} for cross-color reduction.
  6621. @item lt
  6622. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6623. @item tl
  6624. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6625. @item tc
  6626. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6627. @item ct
  6628. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6629. @end table
  6630. @section deflate
  6631. Apply deflate effect to the video.
  6632. This filter replaces the pixel by the local(3x3) average by taking into account
  6633. only values lower than the pixel.
  6634. It accepts the following options:
  6635. @table @option
  6636. @item threshold0
  6637. @item threshold1
  6638. @item threshold2
  6639. @item threshold3
  6640. Limit the maximum change for each plane, default is 65535.
  6641. If 0, plane will remain unchanged.
  6642. @end table
  6643. @section deflicker
  6644. Remove temporal frame luminance variations.
  6645. It accepts the following options:
  6646. @table @option
  6647. @item size, s
  6648. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6649. @item mode, m
  6650. Set averaging mode to smooth temporal luminance variations.
  6651. Available values are:
  6652. @table @samp
  6653. @item am
  6654. Arithmetic mean
  6655. @item gm
  6656. Geometric mean
  6657. @item hm
  6658. Harmonic mean
  6659. @item qm
  6660. Quadratic mean
  6661. @item cm
  6662. Cubic mean
  6663. @item pm
  6664. Power mean
  6665. @item median
  6666. Median
  6667. @end table
  6668. @item bypass
  6669. Do not actually modify frame. Useful when one only wants metadata.
  6670. @end table
  6671. @section dejudder
  6672. Remove judder produced by partially interlaced telecined content.
  6673. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6674. source was partially telecined content then the output of @code{pullup,dejudder}
  6675. will have a variable frame rate. May change the recorded frame rate of the
  6676. container. Aside from that change, this filter will not affect constant frame
  6677. rate video.
  6678. The option available in this filter is:
  6679. @table @option
  6680. @item cycle
  6681. Specify the length of the window over which the judder repeats.
  6682. Accepts any integer greater than 1. Useful values are:
  6683. @table @samp
  6684. @item 4
  6685. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6686. @item 5
  6687. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6688. @item 20
  6689. If a mixture of the two.
  6690. @end table
  6691. The default is @samp{4}.
  6692. @end table
  6693. @section delogo
  6694. Suppress a TV station logo by a simple interpolation of the surrounding
  6695. pixels. Just set a rectangle covering the logo and watch it disappear
  6696. (and sometimes something even uglier appear - your mileage may vary).
  6697. It accepts the following parameters:
  6698. @table @option
  6699. @item x
  6700. @item y
  6701. Specify the top left corner coordinates of the logo. They must be
  6702. specified.
  6703. @item w
  6704. @item h
  6705. Specify the width and height of the logo to clear. They must be
  6706. specified.
  6707. @item band, t
  6708. Specify the thickness of the fuzzy edge of the rectangle (added to
  6709. @var{w} and @var{h}). The default value is 1. This option is
  6710. deprecated, setting higher values should no longer be necessary and
  6711. is not recommended.
  6712. @item show
  6713. When set to 1, a green rectangle is drawn on the screen to simplify
  6714. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6715. The default value is 0.
  6716. The rectangle is drawn on the outermost pixels which will be (partly)
  6717. replaced with interpolated values. The values of the next pixels
  6718. immediately outside this rectangle in each direction will be used to
  6719. compute the interpolated pixel values inside the rectangle.
  6720. @end table
  6721. @subsection Examples
  6722. @itemize
  6723. @item
  6724. Set a rectangle covering the area with top left corner coordinates 0,0
  6725. and size 100x77, and a band of size 10:
  6726. @example
  6727. delogo=x=0:y=0:w=100:h=77:band=10
  6728. @end example
  6729. @end itemize
  6730. @section derain
  6731. Remove the rain in the input image/video by applying the derain methods based on
  6732. convolutional neural networks. Supported models:
  6733. @itemize
  6734. @item
  6735. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6736. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6737. @end itemize
  6738. Training as well as model generation scripts are provided in
  6739. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6740. Native model files (.model) can be generated from TensorFlow model
  6741. files (.pb) by using tools/python/convert.py
  6742. The filter accepts the following options:
  6743. @table @option
  6744. @item filter_type
  6745. Specify which filter to use. This option accepts the following values:
  6746. @table @samp
  6747. @item derain
  6748. Derain filter. To conduct derain filter, you need to use a derain model.
  6749. @item dehaze
  6750. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6751. @end table
  6752. Default value is @samp{derain}.
  6753. @item dnn_backend
  6754. Specify which DNN backend to use for model loading and execution. This option accepts
  6755. the following values:
  6756. @table @samp
  6757. @item native
  6758. Native implementation of DNN loading and execution.
  6759. @item tensorflow
  6760. TensorFlow backend. To enable this backend you
  6761. need to install the TensorFlow for C library (see
  6762. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6763. @code{--enable-libtensorflow}
  6764. @end table
  6765. Default value is @samp{native}.
  6766. @item model
  6767. Set path to model file specifying network architecture and its parameters.
  6768. Note that different backends use different file formats. TensorFlow and native
  6769. backend can load files for only its format.
  6770. @end table
  6771. @section deshake
  6772. Attempt to fix small changes in horizontal and/or vertical shift. This
  6773. filter helps remove camera shake from hand-holding a camera, bumping a
  6774. tripod, moving on a vehicle, etc.
  6775. The filter accepts the following options:
  6776. @table @option
  6777. @item x
  6778. @item y
  6779. @item w
  6780. @item h
  6781. Specify a rectangular area where to limit the search for motion
  6782. vectors.
  6783. If desired the search for motion vectors can be limited to a
  6784. rectangular area of the frame defined by its top left corner, width
  6785. and height. These parameters have the same meaning as the drawbox
  6786. filter which can be used to visualise the position of the bounding
  6787. box.
  6788. This is useful when simultaneous movement of subjects within the frame
  6789. might be confused for camera motion by the motion vector search.
  6790. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6791. then the full frame is used. This allows later options to be set
  6792. without specifying the bounding box for the motion vector search.
  6793. Default - search the whole frame.
  6794. @item rx
  6795. @item ry
  6796. Specify the maximum extent of movement in x and y directions in the
  6797. range 0-64 pixels. Default 16.
  6798. @item edge
  6799. Specify how to generate pixels to fill blanks at the edge of the
  6800. frame. Available values are:
  6801. @table @samp
  6802. @item blank, 0
  6803. Fill zeroes at blank locations
  6804. @item original, 1
  6805. Original image at blank locations
  6806. @item clamp, 2
  6807. Extruded edge value at blank locations
  6808. @item mirror, 3
  6809. Mirrored edge at blank locations
  6810. @end table
  6811. Default value is @samp{mirror}.
  6812. @item blocksize
  6813. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6814. default 8.
  6815. @item contrast
  6816. Specify the contrast threshold for blocks. Only blocks with more than
  6817. the specified contrast (difference between darkest and lightest
  6818. pixels) will be considered. Range 1-255, default 125.
  6819. @item search
  6820. Specify the search strategy. Available values are:
  6821. @table @samp
  6822. @item exhaustive, 0
  6823. Set exhaustive search
  6824. @item less, 1
  6825. Set less exhaustive search.
  6826. @end table
  6827. Default value is @samp{exhaustive}.
  6828. @item filename
  6829. If set then a detailed log of the motion search is written to the
  6830. specified file.
  6831. @end table
  6832. @section despill
  6833. Remove unwanted contamination of foreground colors, caused by reflected color of
  6834. greenscreen or bluescreen.
  6835. This filter accepts the following options:
  6836. @table @option
  6837. @item type
  6838. Set what type of despill to use.
  6839. @item mix
  6840. Set how spillmap will be generated.
  6841. @item expand
  6842. Set how much to get rid of still remaining spill.
  6843. @item red
  6844. Controls amount of red in spill area.
  6845. @item green
  6846. Controls amount of green in spill area.
  6847. Should be -1 for greenscreen.
  6848. @item blue
  6849. Controls amount of blue in spill area.
  6850. Should be -1 for bluescreen.
  6851. @item brightness
  6852. Controls brightness of spill area, preserving colors.
  6853. @item alpha
  6854. Modify alpha from generated spillmap.
  6855. @end table
  6856. @section detelecine
  6857. Apply an exact inverse of the telecine operation. It requires a predefined
  6858. pattern specified using the pattern option which must be the same as that passed
  6859. to the telecine filter.
  6860. This filter accepts the following options:
  6861. @table @option
  6862. @item first_field
  6863. @table @samp
  6864. @item top, t
  6865. top field first
  6866. @item bottom, b
  6867. bottom field first
  6868. The default value is @code{top}.
  6869. @end table
  6870. @item pattern
  6871. A string of numbers representing the pulldown pattern you wish to apply.
  6872. The default value is @code{23}.
  6873. @item start_frame
  6874. A number representing position of the first frame with respect to the telecine
  6875. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6876. @end table
  6877. @section dilation
  6878. Apply dilation effect to the video.
  6879. This filter replaces the pixel by the local(3x3) maximum.
  6880. It accepts the following options:
  6881. @table @option
  6882. @item threshold0
  6883. @item threshold1
  6884. @item threshold2
  6885. @item threshold3
  6886. Limit the maximum change for each plane, default is 65535.
  6887. If 0, plane will remain unchanged.
  6888. @item coordinates
  6889. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6890. pixels are used.
  6891. Flags to local 3x3 coordinates maps like this:
  6892. 1 2 3
  6893. 4 5
  6894. 6 7 8
  6895. @end table
  6896. @section displace
  6897. Displace pixels as indicated by second and third input stream.
  6898. It takes three input streams and outputs one stream, the first input is the
  6899. source, and second and third input are displacement maps.
  6900. The second input specifies how much to displace pixels along the
  6901. x-axis, while the third input specifies how much to displace pixels
  6902. along the y-axis.
  6903. If one of displacement map streams terminates, last frame from that
  6904. displacement map will be used.
  6905. Note that once generated, displacements maps can be reused over and over again.
  6906. A description of the accepted options follows.
  6907. @table @option
  6908. @item edge
  6909. Set displace behavior for pixels that are out of range.
  6910. Available values are:
  6911. @table @samp
  6912. @item blank
  6913. Missing pixels are replaced by black pixels.
  6914. @item smear
  6915. Adjacent pixels will spread out to replace missing pixels.
  6916. @item wrap
  6917. Out of range pixels are wrapped so they point to pixels of other side.
  6918. @item mirror
  6919. Out of range pixels will be replaced with mirrored pixels.
  6920. @end table
  6921. Default is @samp{smear}.
  6922. @end table
  6923. @subsection Examples
  6924. @itemize
  6925. @item
  6926. Add ripple effect to rgb input of video size hd720:
  6927. @example
  6928. 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
  6929. @end example
  6930. @item
  6931. Add wave effect to rgb input of video size hd720:
  6932. @example
  6933. 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
  6934. @end example
  6935. @end itemize
  6936. @section dnn_processing
  6937. Do image processing with deep neural networks. Currently only AVFrame with RGB24
  6938. and BGR24 are supported, more formats will be added later.
  6939. The filter accepts the following options:
  6940. @table @option
  6941. @item dnn_backend
  6942. Specify which DNN backend to use for model loading and execution. This option accepts
  6943. the following values:
  6944. @table @samp
  6945. @item native
  6946. Native implementation of DNN loading and execution.
  6947. @item tensorflow
  6948. TensorFlow backend. To enable this backend you
  6949. need to install the TensorFlow for C library (see
  6950. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6951. @code{--enable-libtensorflow}
  6952. @end table
  6953. Default value is @samp{native}.
  6954. @item model
  6955. Set path to model file specifying network architecture and its parameters.
  6956. Note that different backends use different file formats. TensorFlow and native
  6957. backend can load files for only its format.
  6958. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  6959. @item input
  6960. Set the input name of the dnn network.
  6961. @item output
  6962. Set the output name of the dnn network.
  6963. @item fmt
  6964. Set the pixel format for the Frame. Allowed values are @code{AV_PIX_FMT_RGB24}, and @code{AV_PIX_FMT_BGR24}.
  6965. Default value is @code{AV_PIX_FMT_RGB24}.
  6966. @end table
  6967. @section drawbox
  6968. Draw a colored box on the input image.
  6969. It accepts the following parameters:
  6970. @table @option
  6971. @item x
  6972. @item y
  6973. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6974. @item width, w
  6975. @item height, h
  6976. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6977. the input width and height. It defaults to 0.
  6978. @item color, c
  6979. Specify the color of the box to write. For the general syntax of this option,
  6980. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6981. value @code{invert} is used, the box edge color is the same as the
  6982. video with inverted luma.
  6983. @item thickness, t
  6984. The expression which sets the thickness of the box edge.
  6985. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6986. See below for the list of accepted constants.
  6987. @item replace
  6988. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6989. will overwrite the video's color and alpha pixels.
  6990. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6991. @end table
  6992. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6993. following constants:
  6994. @table @option
  6995. @item dar
  6996. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6997. @item hsub
  6998. @item vsub
  6999. horizontal and vertical chroma subsample values. For example for the
  7000. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7001. @item in_h, ih
  7002. @item in_w, iw
  7003. The input width and height.
  7004. @item sar
  7005. The input sample aspect ratio.
  7006. @item x
  7007. @item y
  7008. The x and y offset coordinates where the box is drawn.
  7009. @item w
  7010. @item h
  7011. The width and height of the drawn box.
  7012. @item t
  7013. The thickness of the drawn box.
  7014. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7015. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7016. @end table
  7017. @subsection Examples
  7018. @itemize
  7019. @item
  7020. Draw a black box around the edge of the input image:
  7021. @example
  7022. drawbox
  7023. @end example
  7024. @item
  7025. Draw a box with color red and an opacity of 50%:
  7026. @example
  7027. drawbox=10:20:200:60:red@@0.5
  7028. @end example
  7029. The previous example can be specified as:
  7030. @example
  7031. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7032. @end example
  7033. @item
  7034. Fill the box with pink color:
  7035. @example
  7036. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7037. @end example
  7038. @item
  7039. Draw a 2-pixel red 2.40:1 mask:
  7040. @example
  7041. 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
  7042. @end example
  7043. @end itemize
  7044. @subsection Commands
  7045. This filter supports same commands as options.
  7046. The command accepts the same syntax of the corresponding option.
  7047. If the specified expression is not valid, it is kept at its current
  7048. value.
  7049. @anchor{drawgraph}
  7050. @section drawgraph
  7051. Draw a graph using input video metadata.
  7052. It accepts the following parameters:
  7053. @table @option
  7054. @item m1
  7055. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7056. @item fg1
  7057. Set 1st foreground color expression.
  7058. @item m2
  7059. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7060. @item fg2
  7061. Set 2nd foreground color expression.
  7062. @item m3
  7063. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7064. @item fg3
  7065. Set 3rd foreground color expression.
  7066. @item m4
  7067. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7068. @item fg4
  7069. Set 4th foreground color expression.
  7070. @item min
  7071. Set minimal value of metadata value.
  7072. @item max
  7073. Set maximal value of metadata value.
  7074. @item bg
  7075. Set graph background color. Default is white.
  7076. @item mode
  7077. Set graph mode.
  7078. Available values for mode is:
  7079. @table @samp
  7080. @item bar
  7081. @item dot
  7082. @item line
  7083. @end table
  7084. Default is @code{line}.
  7085. @item slide
  7086. Set slide mode.
  7087. Available values for slide is:
  7088. @table @samp
  7089. @item frame
  7090. Draw new frame when right border is reached.
  7091. @item replace
  7092. Replace old columns with new ones.
  7093. @item scroll
  7094. Scroll from right to left.
  7095. @item rscroll
  7096. Scroll from left to right.
  7097. @item picture
  7098. Draw single picture.
  7099. @end table
  7100. Default is @code{frame}.
  7101. @item size
  7102. Set size of graph video. For the syntax of this option, check the
  7103. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7104. The default value is @code{900x256}.
  7105. The foreground color expressions can use the following variables:
  7106. @table @option
  7107. @item MIN
  7108. Minimal value of metadata value.
  7109. @item MAX
  7110. Maximal value of metadata value.
  7111. @item VAL
  7112. Current metadata key value.
  7113. @end table
  7114. The color is defined as 0xAABBGGRR.
  7115. @end table
  7116. Example using metadata from @ref{signalstats} filter:
  7117. @example
  7118. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7119. @end example
  7120. Example using metadata from @ref{ebur128} filter:
  7121. @example
  7122. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7123. @end example
  7124. @section drawgrid
  7125. Draw a grid on the input image.
  7126. It accepts the following parameters:
  7127. @table @option
  7128. @item x
  7129. @item y
  7130. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7131. @item width, w
  7132. @item height, h
  7133. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7134. input width and height, respectively, minus @code{thickness}, so image gets
  7135. framed. Default to 0.
  7136. @item color, c
  7137. Specify the color of the grid. For the general syntax of this option,
  7138. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7139. value @code{invert} is used, the grid color is the same as the
  7140. video with inverted luma.
  7141. @item thickness, t
  7142. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7143. See below for the list of accepted constants.
  7144. @item replace
  7145. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7146. will overwrite the video's color and alpha pixels.
  7147. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7148. @end table
  7149. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7150. following constants:
  7151. @table @option
  7152. @item dar
  7153. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7154. @item hsub
  7155. @item vsub
  7156. horizontal and vertical chroma subsample values. For example for the
  7157. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7158. @item in_h, ih
  7159. @item in_w, iw
  7160. The input grid cell width and height.
  7161. @item sar
  7162. The input sample aspect ratio.
  7163. @item x
  7164. @item y
  7165. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7166. @item w
  7167. @item h
  7168. The width and height of the drawn cell.
  7169. @item t
  7170. The thickness of the drawn cell.
  7171. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7172. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7173. @end table
  7174. @subsection Examples
  7175. @itemize
  7176. @item
  7177. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7178. @example
  7179. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7180. @end example
  7181. @item
  7182. Draw a white 3x3 grid with an opacity of 50%:
  7183. @example
  7184. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7185. @end example
  7186. @end itemize
  7187. @subsection Commands
  7188. This filter supports same commands as options.
  7189. The command accepts the same syntax of the corresponding option.
  7190. If the specified expression is not valid, it is kept at its current
  7191. value.
  7192. @anchor{drawtext}
  7193. @section drawtext
  7194. Draw a text string or text from a specified file on top of a video, using the
  7195. libfreetype library.
  7196. To enable compilation of this filter, you need to configure FFmpeg with
  7197. @code{--enable-libfreetype}.
  7198. To enable default font fallback and the @var{font} option you need to
  7199. configure FFmpeg with @code{--enable-libfontconfig}.
  7200. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7201. @code{--enable-libfribidi}.
  7202. @subsection Syntax
  7203. It accepts the following parameters:
  7204. @table @option
  7205. @item box
  7206. Used to draw a box around text using the background color.
  7207. The value must be either 1 (enable) or 0 (disable).
  7208. The default value of @var{box} is 0.
  7209. @item boxborderw
  7210. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7211. The default value of @var{boxborderw} is 0.
  7212. @item boxcolor
  7213. The color to be used for drawing box around text. For the syntax of this
  7214. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7215. The default value of @var{boxcolor} is "white".
  7216. @item line_spacing
  7217. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7218. The default value of @var{line_spacing} is 0.
  7219. @item borderw
  7220. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7221. The default value of @var{borderw} is 0.
  7222. @item bordercolor
  7223. Set the color to be used for drawing border around text. For the syntax of this
  7224. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7225. The default value of @var{bordercolor} is "black".
  7226. @item expansion
  7227. Select how the @var{text} is expanded. Can be either @code{none},
  7228. @code{strftime} (deprecated) or
  7229. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7230. below for details.
  7231. @item basetime
  7232. Set a start time for the count. Value is in microseconds. Only applied
  7233. in the deprecated strftime expansion mode. To emulate in normal expansion
  7234. mode use the @code{pts} function, supplying the start time (in seconds)
  7235. as the second argument.
  7236. @item fix_bounds
  7237. If true, check and fix text coords to avoid clipping.
  7238. @item fontcolor
  7239. The color to be used for drawing fonts. For the syntax of this option, check
  7240. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7241. The default value of @var{fontcolor} is "black".
  7242. @item fontcolor_expr
  7243. String which is expanded the same way as @var{text} to obtain dynamic
  7244. @var{fontcolor} value. By default this option has empty value and is not
  7245. processed. When this option is set, it overrides @var{fontcolor} option.
  7246. @item font
  7247. The font family to be used for drawing text. By default Sans.
  7248. @item fontfile
  7249. The font file to be used for drawing text. The path must be included.
  7250. This parameter is mandatory if the fontconfig support is disabled.
  7251. @item alpha
  7252. Draw the text applying alpha blending. The value can
  7253. be a number between 0.0 and 1.0.
  7254. The expression accepts the same variables @var{x, y} as well.
  7255. The default value is 1.
  7256. Please see @var{fontcolor_expr}.
  7257. @item fontsize
  7258. The font size to be used for drawing text.
  7259. The default value of @var{fontsize} is 16.
  7260. @item text_shaping
  7261. If set to 1, attempt to shape the text (for example, reverse the order of
  7262. right-to-left text and join Arabic characters) before drawing it.
  7263. Otherwise, just draw the text exactly as given.
  7264. By default 1 (if supported).
  7265. @item ft_load_flags
  7266. The flags to be used for loading the fonts.
  7267. The flags map the corresponding flags supported by libfreetype, and are
  7268. a combination of the following values:
  7269. @table @var
  7270. @item default
  7271. @item no_scale
  7272. @item no_hinting
  7273. @item render
  7274. @item no_bitmap
  7275. @item vertical_layout
  7276. @item force_autohint
  7277. @item crop_bitmap
  7278. @item pedantic
  7279. @item ignore_global_advance_width
  7280. @item no_recurse
  7281. @item ignore_transform
  7282. @item monochrome
  7283. @item linear_design
  7284. @item no_autohint
  7285. @end table
  7286. Default value is "default".
  7287. For more information consult the documentation for the FT_LOAD_*
  7288. libfreetype flags.
  7289. @item shadowcolor
  7290. The color to be used for drawing a shadow behind the drawn text. For the
  7291. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7292. ffmpeg-utils manual,ffmpeg-utils}.
  7293. The default value of @var{shadowcolor} is "black".
  7294. @item shadowx
  7295. @item shadowy
  7296. The x and y offsets for the text shadow position with respect to the
  7297. position of the text. They can be either positive or negative
  7298. values. The default value for both is "0".
  7299. @item start_number
  7300. The starting frame number for the n/frame_num variable. The default value
  7301. is "0".
  7302. @item tabsize
  7303. The size in number of spaces to use for rendering the tab.
  7304. Default value is 4.
  7305. @item timecode
  7306. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7307. format. It can be used with or without text parameter. @var{timecode_rate}
  7308. option must be specified.
  7309. @item timecode_rate, rate, r
  7310. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7311. integer. Minimum value is "1".
  7312. Drop-frame timecode is supported for frame rates 30 & 60.
  7313. @item tc24hmax
  7314. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7315. Default is 0 (disabled).
  7316. @item text
  7317. The text string to be drawn. The text must be a sequence of UTF-8
  7318. encoded characters.
  7319. This parameter is mandatory if no file is specified with the parameter
  7320. @var{textfile}.
  7321. @item textfile
  7322. A text file containing text to be drawn. The text must be a sequence
  7323. of UTF-8 encoded characters.
  7324. This parameter is mandatory if no text string is specified with the
  7325. parameter @var{text}.
  7326. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7327. @item reload
  7328. If set to 1, the @var{textfile} will be reloaded before each frame.
  7329. Be sure to update it atomically, or it may be read partially, or even fail.
  7330. @item x
  7331. @item y
  7332. The expressions which specify the offsets where text will be drawn
  7333. within the video frame. They are relative to the top/left border of the
  7334. output image.
  7335. The default value of @var{x} and @var{y} is "0".
  7336. See below for the list of accepted constants and functions.
  7337. @end table
  7338. The parameters for @var{x} and @var{y} are expressions containing the
  7339. following constants and functions:
  7340. @table @option
  7341. @item dar
  7342. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7343. @item hsub
  7344. @item vsub
  7345. horizontal and vertical chroma subsample values. For example for the
  7346. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7347. @item line_h, lh
  7348. the height of each text line
  7349. @item main_h, h, H
  7350. the input height
  7351. @item main_w, w, W
  7352. the input width
  7353. @item max_glyph_a, ascent
  7354. the maximum distance from the baseline to the highest/upper grid
  7355. coordinate used to place a glyph outline point, for all the rendered
  7356. glyphs.
  7357. It is a positive value, due to the grid's orientation with the Y axis
  7358. upwards.
  7359. @item max_glyph_d, descent
  7360. the maximum distance from the baseline to the lowest grid coordinate
  7361. used to place a glyph outline point, for all the rendered glyphs.
  7362. This is a negative value, due to the grid's orientation, with the Y axis
  7363. upwards.
  7364. @item max_glyph_h
  7365. maximum glyph height, that is the maximum height for all the glyphs
  7366. contained in the rendered text, it is equivalent to @var{ascent} -
  7367. @var{descent}.
  7368. @item max_glyph_w
  7369. maximum glyph width, that is the maximum width for all the glyphs
  7370. contained in the rendered text
  7371. @item n
  7372. the number of input frame, starting from 0
  7373. @item rand(min, max)
  7374. return a random number included between @var{min} and @var{max}
  7375. @item sar
  7376. The input sample aspect ratio.
  7377. @item t
  7378. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7379. @item text_h, th
  7380. the height of the rendered text
  7381. @item text_w, tw
  7382. the width of the rendered text
  7383. @item x
  7384. @item y
  7385. the x and y offset coordinates where the text is drawn.
  7386. These parameters allow the @var{x} and @var{y} expressions to refer
  7387. to each other, so you can for example specify @code{y=x/dar}.
  7388. @item pict_type
  7389. A one character description of the current frame's picture type.
  7390. @item pkt_pos
  7391. The current packet's position in the input file or stream
  7392. (in bytes, from the start of the input). A value of -1 indicates
  7393. this info is not available.
  7394. @item pkt_duration
  7395. The current packet's duration, in seconds.
  7396. @item pkt_size
  7397. The current packet's size (in bytes).
  7398. @end table
  7399. @anchor{drawtext_expansion}
  7400. @subsection Text expansion
  7401. If @option{expansion} is set to @code{strftime},
  7402. the filter recognizes strftime() sequences in the provided text and
  7403. expands them accordingly. Check the documentation of strftime(). This
  7404. feature is deprecated.
  7405. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7406. If @option{expansion} is set to @code{normal} (which is the default),
  7407. the following expansion mechanism is used.
  7408. The backslash character @samp{\}, followed by any character, always expands to
  7409. the second character.
  7410. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7411. braces is a function name, possibly followed by arguments separated by ':'.
  7412. If the arguments contain special characters or delimiters (':' or '@}'),
  7413. they should be escaped.
  7414. Note that they probably must also be escaped as the value for the
  7415. @option{text} option in the filter argument string and as the filter
  7416. argument in the filtergraph description, and possibly also for the shell,
  7417. that makes up to four levels of escaping; using a text file avoids these
  7418. problems.
  7419. The following functions are available:
  7420. @table @command
  7421. @item expr, e
  7422. The expression evaluation result.
  7423. It must take one argument specifying the expression to be evaluated,
  7424. which accepts the same constants and functions as the @var{x} and
  7425. @var{y} values. Note that not all constants should be used, for
  7426. example the text size is not known when evaluating the expression, so
  7427. the constants @var{text_w} and @var{text_h} will have an undefined
  7428. value.
  7429. @item expr_int_format, eif
  7430. Evaluate the expression's value and output as formatted integer.
  7431. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7432. The second argument specifies the output format. Allowed values are @samp{x},
  7433. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7434. @code{printf} function.
  7435. The third parameter is optional and sets the number of positions taken by the output.
  7436. It can be used to add padding with zeros from the left.
  7437. @item gmtime
  7438. The time at which the filter is running, expressed in UTC.
  7439. It can accept an argument: a strftime() format string.
  7440. @item localtime
  7441. The time at which the filter is running, expressed in the local time zone.
  7442. It can accept an argument: a strftime() format string.
  7443. @item metadata
  7444. Frame metadata. Takes one or two arguments.
  7445. The first argument is mandatory and specifies the metadata key.
  7446. The second argument is optional and specifies a default value, used when the
  7447. metadata key is not found or empty.
  7448. Available metadata can be identified by inspecting entries
  7449. starting with TAG included within each frame section
  7450. printed by running @code{ffprobe -show_frames}.
  7451. String metadata generated in filters leading to
  7452. the drawtext filter are also available.
  7453. @item n, frame_num
  7454. The frame number, starting from 0.
  7455. @item pict_type
  7456. A one character description of the current picture type.
  7457. @item pts
  7458. The timestamp of the current frame.
  7459. It can take up to three arguments.
  7460. The first argument is the format of the timestamp; it defaults to @code{flt}
  7461. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7462. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7463. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7464. @code{localtime} stands for the timestamp of the frame formatted as
  7465. local time zone time.
  7466. The second argument is an offset added to the timestamp.
  7467. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7468. supplied to present the hour part of the formatted timestamp in 24h format
  7469. (00-23).
  7470. If the format is set to @code{localtime} or @code{gmtime},
  7471. a third argument may be supplied: a strftime() format string.
  7472. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7473. @end table
  7474. @subsection Commands
  7475. This filter supports altering parameters via commands:
  7476. @table @option
  7477. @item reinit
  7478. Alter existing filter parameters.
  7479. Syntax for the argument is the same as for filter invocation, e.g.
  7480. @example
  7481. fontsize=56:fontcolor=green:text='Hello World'
  7482. @end example
  7483. Full filter invocation with sendcmd would look like this:
  7484. @example
  7485. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7486. @end example
  7487. @end table
  7488. If the entire argument can't be parsed or applied as valid values then the filter will
  7489. continue with its existing parameters.
  7490. @subsection Examples
  7491. @itemize
  7492. @item
  7493. Draw "Test Text" with font FreeSerif, using the default values for the
  7494. optional parameters.
  7495. @example
  7496. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7497. @end example
  7498. @item
  7499. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7500. and y=50 (counting from the top-left corner of the screen), text is
  7501. yellow with a red box around it. Both the text and the box have an
  7502. opacity of 20%.
  7503. @example
  7504. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7505. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7506. @end example
  7507. Note that the double quotes are not necessary if spaces are not used
  7508. within the parameter list.
  7509. @item
  7510. Show the text at the center of the video frame:
  7511. @example
  7512. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7513. @end example
  7514. @item
  7515. Show the text at a random position, switching to a new position every 30 seconds:
  7516. @example
  7517. 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)"
  7518. @end example
  7519. @item
  7520. Show a text line sliding from right to left in the last row of the video
  7521. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7522. with no newlines.
  7523. @example
  7524. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7525. @end example
  7526. @item
  7527. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7528. @example
  7529. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7530. @end example
  7531. @item
  7532. Draw a single green letter "g", at the center of the input video.
  7533. The glyph baseline is placed at half screen height.
  7534. @example
  7535. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7536. @end example
  7537. @item
  7538. Show text for 1 second every 3 seconds:
  7539. @example
  7540. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7541. @end example
  7542. @item
  7543. Use fontconfig to set the font. Note that the colons need to be escaped.
  7544. @example
  7545. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7546. @end example
  7547. @item
  7548. Print the date of a real-time encoding (see strftime(3)):
  7549. @example
  7550. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7551. @end example
  7552. @item
  7553. Show text fading in and out (appearing/disappearing):
  7554. @example
  7555. #!/bin/sh
  7556. DS=1.0 # display start
  7557. DE=10.0 # display end
  7558. FID=1.5 # fade in duration
  7559. FOD=5 # fade out duration
  7560. 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 @}"
  7561. @end example
  7562. @item
  7563. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7564. and the @option{fontsize} value are included in the @option{y} offset.
  7565. @example
  7566. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7567. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7568. @end example
  7569. @end itemize
  7570. For more information about libfreetype, check:
  7571. @url{http://www.freetype.org/}.
  7572. For more information about fontconfig, check:
  7573. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7574. For more information about libfribidi, check:
  7575. @url{http://fribidi.org/}.
  7576. @section edgedetect
  7577. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7578. The filter accepts the following options:
  7579. @table @option
  7580. @item low
  7581. @item high
  7582. Set low and high threshold values used by the Canny thresholding
  7583. algorithm.
  7584. The high threshold selects the "strong" edge pixels, which are then
  7585. connected through 8-connectivity with the "weak" edge pixels selected
  7586. by the low threshold.
  7587. @var{low} and @var{high} threshold values must be chosen in the range
  7588. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7589. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7590. is @code{50/255}.
  7591. @item mode
  7592. Define the drawing mode.
  7593. @table @samp
  7594. @item wires
  7595. Draw white/gray wires on black background.
  7596. @item colormix
  7597. Mix the colors to create a paint/cartoon effect.
  7598. @item canny
  7599. Apply Canny edge detector on all selected planes.
  7600. @end table
  7601. Default value is @var{wires}.
  7602. @item planes
  7603. Select planes for filtering. By default all available planes are filtered.
  7604. @end table
  7605. @subsection Examples
  7606. @itemize
  7607. @item
  7608. Standard edge detection with custom values for the hysteresis thresholding:
  7609. @example
  7610. edgedetect=low=0.1:high=0.4
  7611. @end example
  7612. @item
  7613. Painting effect without thresholding:
  7614. @example
  7615. edgedetect=mode=colormix:high=0
  7616. @end example
  7617. @end itemize
  7618. @section elbg
  7619. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7620. For each input image, the filter will compute the optimal mapping from
  7621. the input to the output given the codebook length, that is the number
  7622. of distinct output colors.
  7623. This filter accepts the following options.
  7624. @table @option
  7625. @item codebook_length, l
  7626. Set codebook length. The value must be a positive integer, and
  7627. represents the number of distinct output colors. Default value is 256.
  7628. @item nb_steps, n
  7629. Set the maximum number of iterations to apply for computing the optimal
  7630. mapping. The higher the value the better the result and the higher the
  7631. computation time. Default value is 1.
  7632. @item seed, s
  7633. Set a random seed, must be an integer included between 0 and
  7634. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7635. will try to use a good random seed on a best effort basis.
  7636. @item pal8
  7637. Set pal8 output pixel format. This option does not work with codebook
  7638. length greater than 256.
  7639. @end table
  7640. @section entropy
  7641. Measure graylevel entropy in histogram of color channels of video frames.
  7642. It accepts the following parameters:
  7643. @table @option
  7644. @item mode
  7645. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7646. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7647. between neighbour histogram values.
  7648. @end table
  7649. @section eq
  7650. Set brightness, contrast, saturation and approximate gamma adjustment.
  7651. The filter accepts the following options:
  7652. @table @option
  7653. @item contrast
  7654. Set the contrast expression. The value must be a float value in range
  7655. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7656. @item brightness
  7657. Set the brightness expression. The value must be a float value in
  7658. range @code{-1.0} to @code{1.0}. The default value is "0".
  7659. @item saturation
  7660. Set the saturation expression. The value must be a float in
  7661. range @code{0.0} to @code{3.0}. The default value is "1".
  7662. @item gamma
  7663. Set the gamma expression. The value must be a float in range
  7664. @code{0.1} to @code{10.0}. The default value is "1".
  7665. @item gamma_r
  7666. Set the gamma expression for red. The value must be a float in
  7667. range @code{0.1} to @code{10.0}. The default value is "1".
  7668. @item gamma_g
  7669. Set the gamma expression for green. The value must be a float in range
  7670. @code{0.1} to @code{10.0}. The default value is "1".
  7671. @item gamma_b
  7672. Set the gamma expression for blue. The value must be a float in range
  7673. @code{0.1} to @code{10.0}. The default value is "1".
  7674. @item gamma_weight
  7675. Set the gamma weight expression. It can be used to reduce the effect
  7676. of a high gamma value on bright image areas, e.g. keep them from
  7677. getting overamplified and just plain white. The value must be a float
  7678. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7679. gamma correction all the way down while @code{1.0} leaves it at its
  7680. full strength. Default is "1".
  7681. @item eval
  7682. Set when the expressions for brightness, contrast, saturation and
  7683. gamma expressions are evaluated.
  7684. It accepts the following values:
  7685. @table @samp
  7686. @item init
  7687. only evaluate expressions once during the filter initialization or
  7688. when a command is processed
  7689. @item frame
  7690. evaluate expressions for each incoming frame
  7691. @end table
  7692. Default value is @samp{init}.
  7693. @end table
  7694. The expressions accept the following parameters:
  7695. @table @option
  7696. @item n
  7697. frame count of the input frame starting from 0
  7698. @item pos
  7699. byte position of the corresponding packet in the input file, NAN if
  7700. unspecified
  7701. @item r
  7702. frame rate of the input video, NAN if the input frame rate is unknown
  7703. @item t
  7704. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7705. @end table
  7706. @subsection Commands
  7707. The filter supports the following commands:
  7708. @table @option
  7709. @item contrast
  7710. Set the contrast expression.
  7711. @item brightness
  7712. Set the brightness expression.
  7713. @item saturation
  7714. Set the saturation expression.
  7715. @item gamma
  7716. Set the gamma expression.
  7717. @item gamma_r
  7718. Set the gamma_r expression.
  7719. @item gamma_g
  7720. Set gamma_g expression.
  7721. @item gamma_b
  7722. Set gamma_b expression.
  7723. @item gamma_weight
  7724. Set gamma_weight expression.
  7725. The command accepts the same syntax of the corresponding option.
  7726. If the specified expression is not valid, it is kept at its current
  7727. value.
  7728. @end table
  7729. @section erosion
  7730. Apply erosion effect to the video.
  7731. This filter replaces the pixel by the local(3x3) minimum.
  7732. It accepts the following options:
  7733. @table @option
  7734. @item threshold0
  7735. @item threshold1
  7736. @item threshold2
  7737. @item threshold3
  7738. Limit the maximum change for each plane, default is 65535.
  7739. If 0, plane will remain unchanged.
  7740. @item coordinates
  7741. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7742. pixels are used.
  7743. Flags to local 3x3 coordinates maps like this:
  7744. 1 2 3
  7745. 4 5
  7746. 6 7 8
  7747. @end table
  7748. @section extractplanes
  7749. Extract color channel components from input video stream into
  7750. separate grayscale video streams.
  7751. The filter accepts the following option:
  7752. @table @option
  7753. @item planes
  7754. Set plane(s) to extract.
  7755. Available values for planes are:
  7756. @table @samp
  7757. @item y
  7758. @item u
  7759. @item v
  7760. @item a
  7761. @item r
  7762. @item g
  7763. @item b
  7764. @end table
  7765. Choosing planes not available in the input will result in an error.
  7766. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7767. with @code{y}, @code{u}, @code{v} planes at same time.
  7768. @end table
  7769. @subsection Examples
  7770. @itemize
  7771. @item
  7772. Extract luma, u and v color channel component from input video frame
  7773. into 3 grayscale outputs:
  7774. @example
  7775. 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
  7776. @end example
  7777. @end itemize
  7778. @section fade
  7779. Apply a fade-in/out effect to the input video.
  7780. It accepts the following parameters:
  7781. @table @option
  7782. @item type, t
  7783. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7784. effect.
  7785. Default is @code{in}.
  7786. @item start_frame, s
  7787. Specify the number of the frame to start applying the fade
  7788. effect at. Default is 0.
  7789. @item nb_frames, n
  7790. The number of frames that the fade effect lasts. At the end of the
  7791. fade-in effect, the output video will have the same intensity as the input video.
  7792. At the end of the fade-out transition, the output video will be filled with the
  7793. selected @option{color}.
  7794. Default is 25.
  7795. @item alpha
  7796. If set to 1, fade only alpha channel, if one exists on the input.
  7797. Default value is 0.
  7798. @item start_time, st
  7799. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7800. effect. If both start_frame and start_time are specified, the fade will start at
  7801. whichever comes last. Default is 0.
  7802. @item duration, d
  7803. The number of seconds for which the fade effect has to last. At the end of the
  7804. fade-in effect the output video will have the same intensity as the input video,
  7805. at the end of the fade-out transition the output video will be filled with the
  7806. selected @option{color}.
  7807. If both duration and nb_frames are specified, duration is used. Default is 0
  7808. (nb_frames is used by default).
  7809. @item color, c
  7810. Specify the color of the fade. Default is "black".
  7811. @end table
  7812. @subsection Examples
  7813. @itemize
  7814. @item
  7815. Fade in the first 30 frames of video:
  7816. @example
  7817. fade=in:0:30
  7818. @end example
  7819. The command above is equivalent to:
  7820. @example
  7821. fade=t=in:s=0:n=30
  7822. @end example
  7823. @item
  7824. Fade out the last 45 frames of a 200-frame video:
  7825. @example
  7826. fade=out:155:45
  7827. fade=type=out:start_frame=155:nb_frames=45
  7828. @end example
  7829. @item
  7830. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7831. @example
  7832. fade=in:0:25, fade=out:975:25
  7833. @end example
  7834. @item
  7835. Make the first 5 frames yellow, then fade in from frame 5-24:
  7836. @example
  7837. fade=in:5:20:color=yellow
  7838. @end example
  7839. @item
  7840. Fade in alpha over first 25 frames of video:
  7841. @example
  7842. fade=in:0:25:alpha=1
  7843. @end example
  7844. @item
  7845. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7846. @example
  7847. fade=t=in:st=5.5:d=0.5
  7848. @end example
  7849. @end itemize
  7850. @section fftdnoiz
  7851. Denoise frames using 3D FFT (frequency domain filtering).
  7852. The filter accepts the following options:
  7853. @table @option
  7854. @item sigma
  7855. Set the noise sigma constant. This sets denoising strength.
  7856. Default value is 1. Allowed range is from 0 to 30.
  7857. Using very high sigma with low overlap may give blocking artifacts.
  7858. @item amount
  7859. Set amount of denoising. By default all detected noise is reduced.
  7860. Default value is 1. Allowed range is from 0 to 1.
  7861. @item block
  7862. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7863. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7864. block size in pixels is 2^4 which is 16.
  7865. @item overlap
  7866. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7867. @item prev
  7868. Set number of previous frames to use for denoising. By default is set to 0.
  7869. @item next
  7870. Set number of next frames to to use for denoising. By default is set to 0.
  7871. @item planes
  7872. Set planes which will be filtered, by default are all available filtered
  7873. except alpha.
  7874. @end table
  7875. @section fftfilt
  7876. Apply arbitrary expressions to samples in frequency domain
  7877. @table @option
  7878. @item dc_Y
  7879. Adjust the dc value (gain) of the luma plane of the image. The filter
  7880. accepts an integer value in range @code{0} to @code{1000}. The default
  7881. value is set to @code{0}.
  7882. @item dc_U
  7883. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7884. filter accepts an integer value in range @code{0} to @code{1000}. The
  7885. default value is set to @code{0}.
  7886. @item dc_V
  7887. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7888. filter accepts an integer value in range @code{0} to @code{1000}. The
  7889. default value is set to @code{0}.
  7890. @item weight_Y
  7891. Set the frequency domain weight expression for the luma plane.
  7892. @item weight_U
  7893. Set the frequency domain weight expression for the 1st chroma plane.
  7894. @item weight_V
  7895. Set the frequency domain weight expression for the 2nd chroma plane.
  7896. @item eval
  7897. Set when the expressions are evaluated.
  7898. It accepts the following values:
  7899. @table @samp
  7900. @item init
  7901. Only evaluate expressions once during the filter initialization.
  7902. @item frame
  7903. Evaluate expressions for each incoming frame.
  7904. @end table
  7905. Default value is @samp{init}.
  7906. The filter accepts the following variables:
  7907. @item X
  7908. @item Y
  7909. The coordinates of the current sample.
  7910. @item W
  7911. @item H
  7912. The width and height of the image.
  7913. @item N
  7914. The number of input frame, starting from 0.
  7915. @end table
  7916. @subsection Examples
  7917. @itemize
  7918. @item
  7919. High-pass:
  7920. @example
  7921. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7922. @end example
  7923. @item
  7924. Low-pass:
  7925. @example
  7926. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7927. @end example
  7928. @item
  7929. Sharpen:
  7930. @example
  7931. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7932. @end example
  7933. @item
  7934. Blur:
  7935. @example
  7936. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7937. @end example
  7938. @end itemize
  7939. @section field
  7940. Extract a single field from an interlaced image using stride
  7941. arithmetic to avoid wasting CPU time. The output frames are marked as
  7942. non-interlaced.
  7943. The filter accepts the following options:
  7944. @table @option
  7945. @item type
  7946. Specify whether to extract the top (if the value is @code{0} or
  7947. @code{top}) or the bottom field (if the value is @code{1} or
  7948. @code{bottom}).
  7949. @end table
  7950. @section fieldhint
  7951. Create new frames by copying the top and bottom fields from surrounding frames
  7952. supplied as numbers by the hint file.
  7953. @table @option
  7954. @item hint
  7955. Set file containing hints: absolute/relative frame numbers.
  7956. There must be one line for each frame in a clip. Each line must contain two
  7957. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7958. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7959. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7960. for @code{relative} mode. First number tells from which frame to pick up top
  7961. field and second number tells from which frame to pick up bottom field.
  7962. If optionally followed by @code{+} output frame will be marked as interlaced,
  7963. else if followed by @code{-} output frame will be marked as progressive, else
  7964. it will be marked same as input frame.
  7965. If optionally followed by @code{t} output frame will use only top field, or in
  7966. case of @code{b} it will use only bottom field.
  7967. If line starts with @code{#} or @code{;} that line is skipped.
  7968. @item mode
  7969. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7970. @end table
  7971. Example of first several lines of @code{hint} file for @code{relative} mode:
  7972. @example
  7973. 0,0 - # first frame
  7974. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7975. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7976. 1,0 -
  7977. 0,0 -
  7978. 0,0 -
  7979. 1,0 -
  7980. 1,0 -
  7981. 1,0 -
  7982. 0,0 -
  7983. 0,0 -
  7984. 1,0 -
  7985. 1,0 -
  7986. 1,0 -
  7987. 0,0 -
  7988. @end example
  7989. @section fieldmatch
  7990. Field matching filter for inverse telecine. It is meant to reconstruct the
  7991. progressive frames from a telecined stream. The filter does not drop duplicated
  7992. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7993. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7994. The separation of the field matching and the decimation is notably motivated by
  7995. the possibility of inserting a de-interlacing filter fallback between the two.
  7996. If the source has mixed telecined and real interlaced content,
  7997. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7998. But these remaining combed frames will be marked as interlaced, and thus can be
  7999. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8000. In addition to the various configuration options, @code{fieldmatch} can take an
  8001. optional second stream, activated through the @option{ppsrc} option. If
  8002. enabled, the frames reconstruction will be based on the fields and frames from
  8003. this second stream. This allows the first input to be pre-processed in order to
  8004. help the various algorithms of the filter, while keeping the output lossless
  8005. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8006. or brightness/contrast adjustments can help.
  8007. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8008. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8009. which @code{fieldmatch} is based on. While the semantic and usage are very
  8010. close, some behaviour and options names can differ.
  8011. The @ref{decimate} filter currently only works for constant frame rate input.
  8012. If your input has mixed telecined (30fps) and progressive content with a lower
  8013. framerate like 24fps use the following filterchain to produce the necessary cfr
  8014. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8015. The filter accepts the following options:
  8016. @table @option
  8017. @item order
  8018. Specify the assumed field order of the input stream. Available values are:
  8019. @table @samp
  8020. @item auto
  8021. Auto detect parity (use FFmpeg's internal parity value).
  8022. @item bff
  8023. Assume bottom field first.
  8024. @item tff
  8025. Assume top field first.
  8026. @end table
  8027. Note that it is sometimes recommended not to trust the parity announced by the
  8028. stream.
  8029. Default value is @var{auto}.
  8030. @item mode
  8031. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8032. sense that it won't risk creating jerkiness due to duplicate frames when
  8033. possible, but if there are bad edits or blended fields it will end up
  8034. outputting combed frames when a good match might actually exist. On the other
  8035. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8036. but will almost always find a good frame if there is one. The other values are
  8037. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8038. jerkiness and creating duplicate frames versus finding good matches in sections
  8039. with bad edits, orphaned fields, blended fields, etc.
  8040. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8041. Available values are:
  8042. @table @samp
  8043. @item pc
  8044. 2-way matching (p/c)
  8045. @item pc_n
  8046. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8047. @item pc_u
  8048. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8049. @item pc_n_ub
  8050. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8051. still combed (p/c + n + u/b)
  8052. @item pcn
  8053. 3-way matching (p/c/n)
  8054. @item pcn_ub
  8055. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8056. detected as combed (p/c/n + u/b)
  8057. @end table
  8058. The parenthesis at the end indicate the matches that would be used for that
  8059. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8060. @var{top}).
  8061. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8062. the slowest.
  8063. Default value is @var{pc_n}.
  8064. @item ppsrc
  8065. Mark the main input stream as a pre-processed input, and enable the secondary
  8066. input stream as the clean source to pick the fields from. See the filter
  8067. introduction for more details. It is similar to the @option{clip2} feature from
  8068. VFM/TFM.
  8069. Default value is @code{0} (disabled).
  8070. @item field
  8071. Set the field to match from. It is recommended to set this to the same value as
  8072. @option{order} unless you experience matching failures with that setting. In
  8073. certain circumstances changing the field that is used to match from can have a
  8074. large impact on matching performance. Available values are:
  8075. @table @samp
  8076. @item auto
  8077. Automatic (same value as @option{order}).
  8078. @item bottom
  8079. Match from the bottom field.
  8080. @item top
  8081. Match from the top field.
  8082. @end table
  8083. Default value is @var{auto}.
  8084. @item mchroma
  8085. Set whether or not chroma is included during the match comparisons. In most
  8086. cases it is recommended to leave this enabled. You should set this to @code{0}
  8087. only if your clip has bad chroma problems such as heavy rainbowing or other
  8088. artifacts. Setting this to @code{0} could also be used to speed things up at
  8089. the cost of some accuracy.
  8090. Default value is @code{1}.
  8091. @item y0
  8092. @item y1
  8093. These define an exclusion band which excludes the lines between @option{y0} and
  8094. @option{y1} from being included in the field matching decision. An exclusion
  8095. band can be used to ignore subtitles, a logo, or other things that may
  8096. interfere with the matching. @option{y0} sets the starting scan line and
  8097. @option{y1} sets the ending line; all lines in between @option{y0} and
  8098. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8099. @option{y0} and @option{y1} to the same value will disable the feature.
  8100. @option{y0} and @option{y1} defaults to @code{0}.
  8101. @item scthresh
  8102. Set the scene change detection threshold as a percentage of maximum change on
  8103. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8104. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8105. @option{scthresh} is @code{[0.0, 100.0]}.
  8106. Default value is @code{12.0}.
  8107. @item combmatch
  8108. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8109. account the combed scores of matches when deciding what match to use as the
  8110. final match. Available values are:
  8111. @table @samp
  8112. @item none
  8113. No final matching based on combed scores.
  8114. @item sc
  8115. Combed scores are only used when a scene change is detected.
  8116. @item full
  8117. Use combed scores all the time.
  8118. @end table
  8119. Default is @var{sc}.
  8120. @item combdbg
  8121. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8122. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8123. Available values are:
  8124. @table @samp
  8125. @item none
  8126. No forced calculation.
  8127. @item pcn
  8128. Force p/c/n calculations.
  8129. @item pcnub
  8130. Force p/c/n/u/b calculations.
  8131. @end table
  8132. Default value is @var{none}.
  8133. @item cthresh
  8134. This is the area combing threshold used for combed frame detection. This
  8135. essentially controls how "strong" or "visible" combing must be to be detected.
  8136. Larger values mean combing must be more visible and smaller values mean combing
  8137. can be less visible or strong and still be detected. Valid settings are from
  8138. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8139. be detected as combed). This is basically a pixel difference value. A good
  8140. range is @code{[8, 12]}.
  8141. Default value is @code{9}.
  8142. @item chroma
  8143. Sets whether or not chroma is considered in the combed frame decision. Only
  8144. disable this if your source has chroma problems (rainbowing, etc.) that are
  8145. causing problems for the combed frame detection with chroma enabled. Actually,
  8146. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8147. where there is chroma only combing in the source.
  8148. Default value is @code{0}.
  8149. @item blockx
  8150. @item blocky
  8151. Respectively set the x-axis and y-axis size of the window used during combed
  8152. frame detection. This has to do with the size of the area in which
  8153. @option{combpel} pixels are required to be detected as combed for a frame to be
  8154. declared combed. See the @option{combpel} parameter description for more info.
  8155. Possible values are any number that is a power of 2 starting at 4 and going up
  8156. to 512.
  8157. Default value is @code{16}.
  8158. @item combpel
  8159. The number of combed pixels inside any of the @option{blocky} by
  8160. @option{blockx} size blocks on the frame for the frame to be detected as
  8161. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8162. setting controls "how much" combing there must be in any localized area (a
  8163. window defined by the @option{blockx} and @option{blocky} settings) on the
  8164. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8165. which point no frames will ever be detected as combed). This setting is known
  8166. as @option{MI} in TFM/VFM vocabulary.
  8167. Default value is @code{80}.
  8168. @end table
  8169. @anchor{p/c/n/u/b meaning}
  8170. @subsection p/c/n/u/b meaning
  8171. @subsubsection p/c/n
  8172. We assume the following telecined stream:
  8173. @example
  8174. Top fields: 1 2 2 3 4
  8175. Bottom fields: 1 2 3 4 4
  8176. @end example
  8177. The numbers correspond to the progressive frame the fields relate to. Here, the
  8178. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8179. When @code{fieldmatch} is configured to run a matching from bottom
  8180. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8181. @example
  8182. Input stream:
  8183. T 1 2 2 3 4
  8184. B 1 2 3 4 4 <-- matching reference
  8185. Matches: c c n n c
  8186. Output stream:
  8187. T 1 2 3 4 4
  8188. B 1 2 3 4 4
  8189. @end example
  8190. As a result of the field matching, we can see that some frames get duplicated.
  8191. To perform a complete inverse telecine, you need to rely on a decimation filter
  8192. after this operation. See for instance the @ref{decimate} filter.
  8193. The same operation now matching from top fields (@option{field}=@var{top})
  8194. looks like this:
  8195. @example
  8196. Input stream:
  8197. T 1 2 2 3 4 <-- matching reference
  8198. B 1 2 3 4 4
  8199. Matches: c c p p c
  8200. Output stream:
  8201. T 1 2 2 3 4
  8202. B 1 2 2 3 4
  8203. @end example
  8204. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8205. basically, they refer to the frame and field of the opposite parity:
  8206. @itemize
  8207. @item @var{p} matches the field of the opposite parity in the previous frame
  8208. @item @var{c} matches the field of the opposite parity in the current frame
  8209. @item @var{n} matches the field of the opposite parity in the next frame
  8210. @end itemize
  8211. @subsubsection u/b
  8212. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8213. from the opposite parity flag. In the following examples, we assume that we are
  8214. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8215. 'x' is placed above and below each matched fields.
  8216. With bottom matching (@option{field}=@var{bottom}):
  8217. @example
  8218. Match: c p n b u
  8219. x x x x x
  8220. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8221. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8222. x x x x x
  8223. Output frames:
  8224. 2 1 2 2 2
  8225. 2 2 2 1 3
  8226. @end example
  8227. With top matching (@option{field}=@var{top}):
  8228. @example
  8229. Match: c p n b u
  8230. x x x x x
  8231. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8232. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8233. x x x x x
  8234. Output frames:
  8235. 2 2 2 1 2
  8236. 2 1 3 2 2
  8237. @end example
  8238. @subsection Examples
  8239. Simple IVTC of a top field first telecined stream:
  8240. @example
  8241. fieldmatch=order=tff:combmatch=none, decimate
  8242. @end example
  8243. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8244. @example
  8245. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8246. @end example
  8247. @section fieldorder
  8248. Transform the field order of the input video.
  8249. It accepts the following parameters:
  8250. @table @option
  8251. @item order
  8252. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8253. for bottom field first.
  8254. @end table
  8255. The default value is @samp{tff}.
  8256. The transformation is done by shifting the picture content up or down
  8257. by one line, and filling the remaining line with appropriate picture content.
  8258. This method is consistent with most broadcast field order converters.
  8259. If the input video is not flagged as being interlaced, or it is already
  8260. flagged as being of the required output field order, then this filter does
  8261. not alter the incoming video.
  8262. It is very useful when converting to or from PAL DV material,
  8263. which is bottom field first.
  8264. For example:
  8265. @example
  8266. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8267. @end example
  8268. @section fifo, afifo
  8269. Buffer input images and send them when they are requested.
  8270. It is mainly useful when auto-inserted by the libavfilter
  8271. framework.
  8272. It does not take parameters.
  8273. @section fillborders
  8274. Fill borders of the input video, without changing video stream dimensions.
  8275. Sometimes video can have garbage at the four edges and you may not want to
  8276. crop video input to keep size multiple of some number.
  8277. This filter accepts the following options:
  8278. @table @option
  8279. @item left
  8280. Number of pixels to fill from left border.
  8281. @item right
  8282. Number of pixels to fill from right border.
  8283. @item top
  8284. Number of pixels to fill from top border.
  8285. @item bottom
  8286. Number of pixels to fill from bottom border.
  8287. @item mode
  8288. Set fill mode.
  8289. It accepts the following values:
  8290. @table @samp
  8291. @item smear
  8292. fill pixels using outermost pixels
  8293. @item mirror
  8294. fill pixels using mirroring
  8295. @item fixed
  8296. fill pixels with constant value
  8297. @end table
  8298. Default is @var{smear}.
  8299. @item color
  8300. Set color for pixels in fixed mode. Default is @var{black}.
  8301. @end table
  8302. @subsection Commands
  8303. This filter supports same @ref{commands} as options.
  8304. The command accepts the same syntax of the corresponding option.
  8305. If the specified expression is not valid, it is kept at its current
  8306. value.
  8307. @section find_rect
  8308. Find a rectangular object
  8309. It accepts the following options:
  8310. @table @option
  8311. @item object
  8312. Filepath of the object image, needs to be in gray8.
  8313. @item threshold
  8314. Detection threshold, default is 0.5.
  8315. @item mipmaps
  8316. Number of mipmaps, default is 3.
  8317. @item xmin, ymin, xmax, ymax
  8318. Specifies the rectangle in which to search.
  8319. @end table
  8320. @subsection Examples
  8321. @itemize
  8322. @item
  8323. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8324. @example
  8325. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8326. @end example
  8327. @end itemize
  8328. @section floodfill
  8329. Flood area with values of same pixel components with another values.
  8330. It accepts the following options:
  8331. @table @option
  8332. @item x
  8333. Set pixel x coordinate.
  8334. @item y
  8335. Set pixel y coordinate.
  8336. @item s0
  8337. Set source #0 component value.
  8338. @item s1
  8339. Set source #1 component value.
  8340. @item s2
  8341. Set source #2 component value.
  8342. @item s3
  8343. Set source #3 component value.
  8344. @item d0
  8345. Set destination #0 component value.
  8346. @item d1
  8347. Set destination #1 component value.
  8348. @item d2
  8349. Set destination #2 component value.
  8350. @item d3
  8351. Set destination #3 component value.
  8352. @end table
  8353. @anchor{format}
  8354. @section format
  8355. Convert the input video to one of the specified pixel formats.
  8356. Libavfilter will try to pick one that is suitable as input to
  8357. the next filter.
  8358. It accepts the following parameters:
  8359. @table @option
  8360. @item pix_fmts
  8361. A '|'-separated list of pixel format names, such as
  8362. "pix_fmts=yuv420p|monow|rgb24".
  8363. @end table
  8364. @subsection Examples
  8365. @itemize
  8366. @item
  8367. Convert the input video to the @var{yuv420p} format
  8368. @example
  8369. format=pix_fmts=yuv420p
  8370. @end example
  8371. Convert the input video to any of the formats in the list
  8372. @example
  8373. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8374. @end example
  8375. @end itemize
  8376. @anchor{fps}
  8377. @section fps
  8378. Convert the video to specified constant frame rate by duplicating or dropping
  8379. frames as necessary.
  8380. It accepts the following parameters:
  8381. @table @option
  8382. @item fps
  8383. The desired output frame rate. The default is @code{25}.
  8384. @item start_time
  8385. Assume the first PTS should be the given value, in seconds. This allows for
  8386. padding/trimming at the start of stream. By default, no assumption is made
  8387. about the first frame's expected PTS, so no padding or trimming is done.
  8388. For example, this could be set to 0 to pad the beginning with duplicates of
  8389. the first frame if a video stream starts after the audio stream or to trim any
  8390. frames with a negative PTS.
  8391. @item round
  8392. Timestamp (PTS) rounding method.
  8393. Possible values are:
  8394. @table @option
  8395. @item zero
  8396. round towards 0
  8397. @item inf
  8398. round away from 0
  8399. @item down
  8400. round towards -infinity
  8401. @item up
  8402. round towards +infinity
  8403. @item near
  8404. round to nearest
  8405. @end table
  8406. The default is @code{near}.
  8407. @item eof_action
  8408. Action performed when reading the last frame.
  8409. Possible values are:
  8410. @table @option
  8411. @item round
  8412. Use same timestamp rounding method as used for other frames.
  8413. @item pass
  8414. Pass through last frame if input duration has not been reached yet.
  8415. @end table
  8416. The default is @code{round}.
  8417. @end table
  8418. Alternatively, the options can be specified as a flat string:
  8419. @var{fps}[:@var{start_time}[:@var{round}]].
  8420. See also the @ref{setpts} filter.
  8421. @subsection Examples
  8422. @itemize
  8423. @item
  8424. A typical usage in order to set the fps to 25:
  8425. @example
  8426. fps=fps=25
  8427. @end example
  8428. @item
  8429. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8430. @example
  8431. fps=fps=film:round=near
  8432. @end example
  8433. @end itemize
  8434. @section framepack
  8435. Pack two different video streams into a stereoscopic video, setting proper
  8436. metadata on supported codecs. The two views should have the same size and
  8437. framerate and processing will stop when the shorter video ends. Please note
  8438. that you may conveniently adjust view properties with the @ref{scale} and
  8439. @ref{fps} filters.
  8440. It accepts the following parameters:
  8441. @table @option
  8442. @item format
  8443. The desired packing format. Supported values are:
  8444. @table @option
  8445. @item sbs
  8446. The views are next to each other (default).
  8447. @item tab
  8448. The views are on top of each other.
  8449. @item lines
  8450. The views are packed by line.
  8451. @item columns
  8452. The views are packed by column.
  8453. @item frameseq
  8454. The views are temporally interleaved.
  8455. @end table
  8456. @end table
  8457. Some examples:
  8458. @example
  8459. # Convert left and right views into a frame-sequential video
  8460. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8461. # Convert views into a side-by-side video with the same output resolution as the input
  8462. 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
  8463. @end example
  8464. @section framerate
  8465. Change the frame rate by interpolating new video output frames from the source
  8466. frames.
  8467. This filter is not designed to function correctly with interlaced media. If
  8468. you wish to change the frame rate of interlaced media then you are required
  8469. to deinterlace before this filter and re-interlace after this filter.
  8470. A description of the accepted options follows.
  8471. @table @option
  8472. @item fps
  8473. Specify the output frames per second. This option can also be specified
  8474. as a value alone. The default is @code{50}.
  8475. @item interp_start
  8476. Specify the start of a range where the output frame will be created as a
  8477. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8478. the default is @code{15}.
  8479. @item interp_end
  8480. Specify the end of a range where the output frame will be created as a
  8481. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8482. the default is @code{240}.
  8483. @item scene
  8484. Specify the level at which a scene change is detected as a value between
  8485. 0 and 100 to indicate a new scene; a low value reflects a low
  8486. probability for the current frame to introduce a new scene, while a higher
  8487. value means the current frame is more likely to be one.
  8488. The default is @code{8.2}.
  8489. @item flags
  8490. Specify flags influencing the filter process.
  8491. Available value for @var{flags} is:
  8492. @table @option
  8493. @item scene_change_detect, scd
  8494. Enable scene change detection using the value of the option @var{scene}.
  8495. This flag is enabled by default.
  8496. @end table
  8497. @end table
  8498. @section framestep
  8499. Select one frame every N-th frame.
  8500. This filter accepts the following option:
  8501. @table @option
  8502. @item step
  8503. Select frame after every @code{step} frames.
  8504. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8505. @end table
  8506. @section freezedetect
  8507. Detect frozen video.
  8508. This filter logs a message and sets frame metadata when it detects that the
  8509. input video has no significant change in content during a specified duration.
  8510. Video freeze detection calculates the mean average absolute difference of all
  8511. the components of video frames and compares it to a noise floor.
  8512. The printed times and duration are expressed in seconds. The
  8513. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8514. whose timestamp equals or exceeds the detection duration and it contains the
  8515. timestamp of the first frame of the freeze. The
  8516. @code{lavfi.freezedetect.freeze_duration} and
  8517. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8518. after the freeze.
  8519. The filter accepts the following options:
  8520. @table @option
  8521. @item noise, n
  8522. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8523. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8524. 0.001.
  8525. @item duration, d
  8526. Set freeze duration until notification (default is 2 seconds).
  8527. @end table
  8528. @anchor{frei0r}
  8529. @section frei0r
  8530. Apply a frei0r effect to the input video.
  8531. To enable the compilation of this filter, you need to install the frei0r
  8532. header and configure FFmpeg with @code{--enable-frei0r}.
  8533. It accepts the following parameters:
  8534. @table @option
  8535. @item filter_name
  8536. The name of the frei0r effect to load. If the environment variable
  8537. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8538. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8539. Otherwise, the standard frei0r paths are searched, in this order:
  8540. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8541. @file{/usr/lib/frei0r-1/}.
  8542. @item filter_params
  8543. A '|'-separated list of parameters to pass to the frei0r effect.
  8544. @end table
  8545. A frei0r effect parameter can be a boolean (its value is either
  8546. "y" or "n"), a double, a color (specified as
  8547. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8548. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8549. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8550. a position (specified as @var{X}/@var{Y}, where
  8551. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8552. The number and types of parameters depend on the loaded effect. If an
  8553. effect parameter is not specified, the default value is set.
  8554. @subsection Examples
  8555. @itemize
  8556. @item
  8557. Apply the distort0r effect, setting the first two double parameters:
  8558. @example
  8559. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8560. @end example
  8561. @item
  8562. Apply the colordistance effect, taking a color as the first parameter:
  8563. @example
  8564. frei0r=colordistance:0.2/0.3/0.4
  8565. frei0r=colordistance:violet
  8566. frei0r=colordistance:0x112233
  8567. @end example
  8568. @item
  8569. Apply the perspective effect, specifying the top left and top right image
  8570. positions:
  8571. @example
  8572. frei0r=perspective:0.2/0.2|0.8/0.2
  8573. @end example
  8574. @end itemize
  8575. For more information, see
  8576. @url{http://frei0r.dyne.org}
  8577. @section fspp
  8578. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8579. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8580. processing filter, one of them is performed once per block, not per pixel.
  8581. This allows for much higher speed.
  8582. The filter accepts the following options:
  8583. @table @option
  8584. @item quality
  8585. Set quality. This option defines the number of levels for averaging. It accepts
  8586. an integer in the range 4-5. Default value is @code{4}.
  8587. @item qp
  8588. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8589. If not set, the filter will use the QP from the video stream (if available).
  8590. @item strength
  8591. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8592. more details but also more artifacts, while higher values make the image smoother
  8593. but also blurrier. Default value is @code{0} − PSNR optimal.
  8594. @item use_bframe_qp
  8595. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8596. option may cause flicker since the B-Frames have often larger QP. Default is
  8597. @code{0} (not enabled).
  8598. @end table
  8599. @section gblur
  8600. Apply Gaussian blur filter.
  8601. The filter accepts the following options:
  8602. @table @option
  8603. @item sigma
  8604. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8605. @item steps
  8606. Set number of steps for Gaussian approximation. Default is @code{1}.
  8607. @item planes
  8608. Set which planes to filter. By default all planes are filtered.
  8609. @item sigmaV
  8610. Set vertical sigma, if negative it will be same as @code{sigma}.
  8611. Default is @code{-1}.
  8612. @end table
  8613. @subsection Commands
  8614. This filter supports same commands as options.
  8615. The command accepts the same syntax of the corresponding option.
  8616. If the specified expression is not valid, it is kept at its current
  8617. value.
  8618. @section geq
  8619. Apply generic equation to each pixel.
  8620. The filter accepts the following options:
  8621. @table @option
  8622. @item lum_expr, lum
  8623. Set the luminance expression.
  8624. @item cb_expr, cb
  8625. Set the chrominance blue expression.
  8626. @item cr_expr, cr
  8627. Set the chrominance red expression.
  8628. @item alpha_expr, a
  8629. Set the alpha expression.
  8630. @item red_expr, r
  8631. Set the red expression.
  8632. @item green_expr, g
  8633. Set the green expression.
  8634. @item blue_expr, b
  8635. Set the blue expression.
  8636. @end table
  8637. The colorspace is selected according to the specified options. If one
  8638. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8639. options is specified, the filter will automatically select a YCbCr
  8640. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8641. @option{blue_expr} options is specified, it will select an RGB
  8642. colorspace.
  8643. If one of the chrominance expression is not defined, it falls back on the other
  8644. one. If no alpha expression is specified it will evaluate to opaque value.
  8645. If none of chrominance expressions are specified, they will evaluate
  8646. to the luminance expression.
  8647. The expressions can use the following variables and functions:
  8648. @table @option
  8649. @item N
  8650. The sequential number of the filtered frame, starting from @code{0}.
  8651. @item X
  8652. @item Y
  8653. The coordinates of the current sample.
  8654. @item W
  8655. @item H
  8656. The width and height of the image.
  8657. @item SW
  8658. @item SH
  8659. Width and height scale depending on the currently filtered plane. It is the
  8660. ratio between the corresponding luma plane number of pixels and the current
  8661. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8662. @code{0.5,0.5} for chroma planes.
  8663. @item T
  8664. Time of the current frame, expressed in seconds.
  8665. @item p(x, y)
  8666. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8667. plane.
  8668. @item lum(x, y)
  8669. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8670. plane.
  8671. @item cb(x, y)
  8672. Return the value of the pixel at location (@var{x},@var{y}) of the
  8673. blue-difference chroma plane. Return 0 if there is no such plane.
  8674. @item cr(x, y)
  8675. Return the value of the pixel at location (@var{x},@var{y}) of the
  8676. red-difference chroma plane. Return 0 if there is no such plane.
  8677. @item r(x, y)
  8678. @item g(x, y)
  8679. @item b(x, y)
  8680. Return the value of the pixel at location (@var{x},@var{y}) of the
  8681. red/green/blue component. Return 0 if there is no such component.
  8682. @item alpha(x, y)
  8683. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8684. plane. Return 0 if there is no such plane.
  8685. @item interpolation
  8686. Set one of interpolation methods:
  8687. @table @option
  8688. @item nearest, n
  8689. @item bilinear, b
  8690. @end table
  8691. Default is bilinear.
  8692. @end table
  8693. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8694. automatically clipped to the closer edge.
  8695. @subsection Examples
  8696. @itemize
  8697. @item
  8698. Flip the image horizontally:
  8699. @example
  8700. geq=p(W-X\,Y)
  8701. @end example
  8702. @item
  8703. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8704. wavelength of 100 pixels:
  8705. @example
  8706. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8707. @end example
  8708. @item
  8709. Generate a fancy enigmatic moving light:
  8710. @example
  8711. 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
  8712. @end example
  8713. @item
  8714. Generate a quick emboss effect:
  8715. @example
  8716. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8717. @end example
  8718. @item
  8719. Modify RGB components depending on pixel position:
  8720. @example
  8721. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8722. @end example
  8723. @item
  8724. Create a radial gradient that is the same size as the input (also see
  8725. the @ref{vignette} filter):
  8726. @example
  8727. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8728. @end example
  8729. @end itemize
  8730. @section gradfun
  8731. Fix the banding artifacts that are sometimes introduced into nearly flat
  8732. regions by truncation to 8-bit color depth.
  8733. Interpolate the gradients that should go where the bands are, and
  8734. dither them.
  8735. It is designed for playback only. Do not use it prior to
  8736. lossy compression, because compression tends to lose the dither and
  8737. bring back the bands.
  8738. It accepts the following parameters:
  8739. @table @option
  8740. @item strength
  8741. The maximum amount by which the filter will change any one pixel. This is also
  8742. the threshold for detecting nearly flat regions. Acceptable values range from
  8743. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8744. valid range.
  8745. @item radius
  8746. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8747. gradients, but also prevents the filter from modifying the pixels near detailed
  8748. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8749. values will be clipped to the valid range.
  8750. @end table
  8751. Alternatively, the options can be specified as a flat string:
  8752. @var{strength}[:@var{radius}]
  8753. @subsection Examples
  8754. @itemize
  8755. @item
  8756. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8757. @example
  8758. gradfun=3.5:8
  8759. @end example
  8760. @item
  8761. Specify radius, omitting the strength (which will fall-back to the default
  8762. value):
  8763. @example
  8764. gradfun=radius=8
  8765. @end example
  8766. @end itemize
  8767. @anchor{graphmonitor}
  8768. @section graphmonitor
  8769. Show various filtergraph stats.
  8770. With this filter one can debug complete filtergraph.
  8771. Especially issues with links filling with queued frames.
  8772. The filter accepts the following options:
  8773. @table @option
  8774. @item size, s
  8775. Set video output size. Default is @var{hd720}.
  8776. @item opacity, o
  8777. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8778. @item mode, m
  8779. Set output mode, can be @var{fulll} or @var{compact}.
  8780. In @var{compact} mode only filters with some queued frames have displayed stats.
  8781. @item flags, f
  8782. Set flags which enable which stats are shown in video.
  8783. Available values for flags are:
  8784. @table @samp
  8785. @item queue
  8786. Display number of queued frames in each link.
  8787. @item frame_count_in
  8788. Display number of frames taken from filter.
  8789. @item frame_count_out
  8790. Display number of frames given out from filter.
  8791. @item pts
  8792. Display current filtered frame pts.
  8793. @item time
  8794. Display current filtered frame time.
  8795. @item timebase
  8796. Display time base for filter link.
  8797. @item format
  8798. Display used format for filter link.
  8799. @item size
  8800. Display video size or number of audio channels in case of audio used by filter link.
  8801. @item rate
  8802. Display video frame rate or sample rate in case of audio used by filter link.
  8803. @end table
  8804. @item rate, r
  8805. Set upper limit for video rate of output stream, Default value is @var{25}.
  8806. This guarantee that output video frame rate will not be higher than this value.
  8807. @end table
  8808. @section greyedge
  8809. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8810. and corrects the scene colors accordingly.
  8811. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8812. The filter accepts the following options:
  8813. @table @option
  8814. @item difford
  8815. The order of differentiation to be applied on the scene. Must be chosen in the range
  8816. [0,2] and default value is 1.
  8817. @item minknorm
  8818. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8819. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8820. max value instead of calculating Minkowski distance.
  8821. @item sigma
  8822. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8823. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8824. can't be equal to 0 if @var{difford} is greater than 0.
  8825. @end table
  8826. @subsection Examples
  8827. @itemize
  8828. @item
  8829. Grey Edge:
  8830. @example
  8831. greyedge=difford=1:minknorm=5:sigma=2
  8832. @end example
  8833. @item
  8834. Max Edge:
  8835. @example
  8836. greyedge=difford=1:minknorm=0:sigma=2
  8837. @end example
  8838. @end itemize
  8839. @anchor{haldclut}
  8840. @section haldclut
  8841. Apply a Hald CLUT to a video stream.
  8842. First input is the video stream to process, and second one is the Hald CLUT.
  8843. The Hald CLUT input can be a simple picture or a complete video stream.
  8844. The filter accepts the following options:
  8845. @table @option
  8846. @item shortest
  8847. Force termination when the shortest input terminates. Default is @code{0}.
  8848. @item repeatlast
  8849. Continue applying the last CLUT after the end of the stream. A value of
  8850. @code{0} disable the filter after the last frame of the CLUT is reached.
  8851. Default is @code{1}.
  8852. @end table
  8853. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8854. filters share the same internals).
  8855. This filter also supports the @ref{framesync} options.
  8856. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8857. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8858. @subsection Workflow examples
  8859. @subsubsection Hald CLUT video stream
  8860. Generate an identity Hald CLUT stream altered with various effects:
  8861. @example
  8862. 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
  8863. @end example
  8864. Note: make sure you use a lossless codec.
  8865. Then use it with @code{haldclut} to apply it on some random stream:
  8866. @example
  8867. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8868. @end example
  8869. The Hald CLUT will be applied to the 10 first seconds (duration of
  8870. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8871. to the remaining frames of the @code{mandelbrot} stream.
  8872. @subsubsection Hald CLUT with preview
  8873. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8874. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8875. biggest possible square starting at the top left of the picture. The remaining
  8876. padding pixels (bottom or right) will be ignored. This area can be used to add
  8877. a preview of the Hald CLUT.
  8878. Typically, the following generated Hald CLUT will be supported by the
  8879. @code{haldclut} filter:
  8880. @example
  8881. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8882. pad=iw+320 [padded_clut];
  8883. smptebars=s=320x256, split [a][b];
  8884. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8885. [main][b] overlay=W-320" -frames:v 1 clut.png
  8886. @end example
  8887. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8888. bars are displayed on the right-top, and below the same color bars processed by
  8889. the color changes.
  8890. Then, the effect of this Hald CLUT can be visualized with:
  8891. @example
  8892. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8893. @end example
  8894. @section hflip
  8895. Flip the input video horizontally.
  8896. For example, to horizontally flip the input video with @command{ffmpeg}:
  8897. @example
  8898. ffmpeg -i in.avi -vf "hflip" out.avi
  8899. @end example
  8900. @section histeq
  8901. This filter applies a global color histogram equalization on a
  8902. per-frame basis.
  8903. It can be used to correct video that has a compressed range of pixel
  8904. intensities. The filter redistributes the pixel intensities to
  8905. equalize their distribution across the intensity range. It may be
  8906. viewed as an "automatically adjusting contrast filter". This filter is
  8907. useful only for correcting degraded or poorly captured source
  8908. video.
  8909. The filter accepts the following options:
  8910. @table @option
  8911. @item strength
  8912. Determine the amount of equalization to be applied. As the strength
  8913. is reduced, the distribution of pixel intensities more-and-more
  8914. approaches that of the input frame. The value must be a float number
  8915. in the range [0,1] and defaults to 0.200.
  8916. @item intensity
  8917. Set the maximum intensity that can generated and scale the output
  8918. values appropriately. The strength should be set as desired and then
  8919. the intensity can be limited if needed to avoid washing-out. The value
  8920. must be a float number in the range [0,1] and defaults to 0.210.
  8921. @item antibanding
  8922. Set the antibanding level. If enabled the filter will randomly vary
  8923. the luminance of output pixels by a small amount to avoid banding of
  8924. the histogram. Possible values are @code{none}, @code{weak} or
  8925. @code{strong}. It defaults to @code{none}.
  8926. @end table
  8927. @section histogram
  8928. Compute and draw a color distribution histogram for the input video.
  8929. The computed histogram is a representation of the color component
  8930. distribution in an image.
  8931. Standard histogram displays the color components distribution in an image.
  8932. Displays color graph for each color component. Shows distribution of
  8933. the Y, U, V, A or R, G, B components, depending on input format, in the
  8934. current frame. Below each graph a color component scale meter is shown.
  8935. The filter accepts the following options:
  8936. @table @option
  8937. @item level_height
  8938. Set height of level. Default value is @code{200}.
  8939. Allowed range is [50, 2048].
  8940. @item scale_height
  8941. Set height of color scale. Default value is @code{12}.
  8942. Allowed range is [0, 40].
  8943. @item display_mode
  8944. Set display mode.
  8945. It accepts the following values:
  8946. @table @samp
  8947. @item stack
  8948. Per color component graphs are placed below each other.
  8949. @item parade
  8950. Per color component graphs are placed side by side.
  8951. @item overlay
  8952. Presents information identical to that in the @code{parade}, except
  8953. that the graphs representing color components are superimposed directly
  8954. over one another.
  8955. @end table
  8956. Default is @code{stack}.
  8957. @item levels_mode
  8958. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8959. Default is @code{linear}.
  8960. @item components
  8961. Set what color components to display.
  8962. Default is @code{7}.
  8963. @item fgopacity
  8964. Set foreground opacity. Default is @code{0.7}.
  8965. @item bgopacity
  8966. Set background opacity. Default is @code{0.5}.
  8967. @end table
  8968. @subsection Examples
  8969. @itemize
  8970. @item
  8971. Calculate and draw histogram:
  8972. @example
  8973. ffplay -i input -vf histogram
  8974. @end example
  8975. @end itemize
  8976. @anchor{hqdn3d}
  8977. @section hqdn3d
  8978. This is a high precision/quality 3d denoise filter. It aims to reduce
  8979. image noise, producing smooth images and making still images really
  8980. still. It should enhance compressibility.
  8981. It accepts the following optional parameters:
  8982. @table @option
  8983. @item luma_spatial
  8984. A non-negative floating point number which specifies spatial luma strength.
  8985. It defaults to 4.0.
  8986. @item chroma_spatial
  8987. A non-negative floating point number which specifies spatial chroma strength.
  8988. It defaults to 3.0*@var{luma_spatial}/4.0.
  8989. @item luma_tmp
  8990. A floating point number which specifies luma temporal strength. It defaults to
  8991. 6.0*@var{luma_spatial}/4.0.
  8992. @item chroma_tmp
  8993. A floating point number which specifies chroma temporal strength. It defaults to
  8994. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8995. @end table
  8996. @subsection Commands
  8997. This filter supports same @ref{commands} as options.
  8998. The command accepts the same syntax of the corresponding option.
  8999. If the specified expression is not valid, it is kept at its current
  9000. value.
  9001. @anchor{hwdownload}
  9002. @section hwdownload
  9003. Download hardware frames to system memory.
  9004. The input must be in hardware frames, and the output a non-hardware format.
  9005. Not all formats will be supported on the output - it may be necessary to insert
  9006. an additional @option{format} filter immediately following in the graph to get
  9007. the output in a supported format.
  9008. @section hwmap
  9009. Map hardware frames to system memory or to another device.
  9010. This filter has several different modes of operation; which one is used depends
  9011. on the input and output formats:
  9012. @itemize
  9013. @item
  9014. Hardware frame input, normal frame output
  9015. Map the input frames to system memory and pass them to the output. If the
  9016. original hardware frame is later required (for example, after overlaying
  9017. something else on part of it), the @option{hwmap} filter can be used again
  9018. in the next mode to retrieve it.
  9019. @item
  9020. Normal frame input, hardware frame output
  9021. If the input is actually a software-mapped hardware frame, then unmap it -
  9022. that is, return the original hardware frame.
  9023. Otherwise, a device must be provided. Create new hardware surfaces on that
  9024. device for the output, then map them back to the software format at the input
  9025. and give those frames to the preceding filter. This will then act like the
  9026. @option{hwupload} filter, but may be able to avoid an additional copy when
  9027. the input is already in a compatible format.
  9028. @item
  9029. Hardware frame input and output
  9030. A device must be supplied for the output, either directly or with the
  9031. @option{derive_device} option. The input and output devices must be of
  9032. different types and compatible - the exact meaning of this is
  9033. system-dependent, but typically it means that they must refer to the same
  9034. underlying hardware context (for example, refer to the same graphics card).
  9035. If the input frames were originally created on the output device, then unmap
  9036. to retrieve the original frames.
  9037. Otherwise, map the frames to the output device - create new hardware frames
  9038. on the output corresponding to the frames on the input.
  9039. @end itemize
  9040. The following additional parameters are accepted:
  9041. @table @option
  9042. @item mode
  9043. Set the frame mapping mode. Some combination of:
  9044. @table @var
  9045. @item read
  9046. The mapped frame should be readable.
  9047. @item write
  9048. The mapped frame should be writeable.
  9049. @item overwrite
  9050. The mapping will always overwrite the entire frame.
  9051. This may improve performance in some cases, as the original contents of the
  9052. frame need not be loaded.
  9053. @item direct
  9054. The mapping must not involve any copying.
  9055. Indirect mappings to copies of frames are created in some cases where either
  9056. direct mapping is not possible or it would have unexpected properties.
  9057. Setting this flag ensures that the mapping is direct and will fail if that is
  9058. not possible.
  9059. @end table
  9060. Defaults to @var{read+write} if not specified.
  9061. @item derive_device @var{type}
  9062. Rather than using the device supplied at initialisation, instead derive a new
  9063. device of type @var{type} from the device the input frames exist on.
  9064. @item reverse
  9065. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9066. and map them back to the source. This may be necessary in some cases where
  9067. a mapping in one direction is required but only the opposite direction is
  9068. supported by the devices being used.
  9069. This option is dangerous - it may break the preceding filter in undefined
  9070. ways if there are any additional constraints on that filter's output.
  9071. Do not use it without fully understanding the implications of its use.
  9072. @end table
  9073. @anchor{hwupload}
  9074. @section hwupload
  9075. Upload system memory frames to hardware surfaces.
  9076. The device to upload to must be supplied when the filter is initialised. If
  9077. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9078. option.
  9079. @anchor{hwupload_cuda}
  9080. @section hwupload_cuda
  9081. Upload system memory frames to a CUDA device.
  9082. It accepts the following optional parameters:
  9083. @table @option
  9084. @item device
  9085. The number of the CUDA device to use
  9086. @end table
  9087. @section hqx
  9088. Apply a high-quality magnification filter designed for pixel art. This filter
  9089. was originally created by Maxim Stepin.
  9090. It accepts the following option:
  9091. @table @option
  9092. @item n
  9093. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9094. @code{hq3x} and @code{4} for @code{hq4x}.
  9095. Default is @code{3}.
  9096. @end table
  9097. @section hstack
  9098. Stack input videos horizontally.
  9099. All streams must be of same pixel format and of same height.
  9100. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9101. to create same output.
  9102. The filter accepts the following option:
  9103. @table @option
  9104. @item inputs
  9105. Set number of input streams. Default is 2.
  9106. @item shortest
  9107. If set to 1, force the output to terminate when the shortest input
  9108. terminates. Default value is 0.
  9109. @end table
  9110. @section hue
  9111. Modify the hue and/or the saturation of the input.
  9112. It accepts the following parameters:
  9113. @table @option
  9114. @item h
  9115. Specify the hue angle as a number of degrees. It accepts an expression,
  9116. and defaults to "0".
  9117. @item s
  9118. Specify the saturation in the [-10,10] range. It accepts an expression and
  9119. defaults to "1".
  9120. @item H
  9121. Specify the hue angle as a number of radians. It accepts an
  9122. expression, and defaults to "0".
  9123. @item b
  9124. Specify the brightness in the [-10,10] range. It accepts an expression and
  9125. defaults to "0".
  9126. @end table
  9127. @option{h} and @option{H} are mutually exclusive, and can't be
  9128. specified at the same time.
  9129. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9130. expressions containing the following constants:
  9131. @table @option
  9132. @item n
  9133. frame count of the input frame starting from 0
  9134. @item pts
  9135. presentation timestamp of the input frame expressed in time base units
  9136. @item r
  9137. frame rate of the input video, NAN if the input frame rate is unknown
  9138. @item t
  9139. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9140. @item tb
  9141. time base of the input video
  9142. @end table
  9143. @subsection Examples
  9144. @itemize
  9145. @item
  9146. Set the hue to 90 degrees and the saturation to 1.0:
  9147. @example
  9148. hue=h=90:s=1
  9149. @end example
  9150. @item
  9151. Same command but expressing the hue in radians:
  9152. @example
  9153. hue=H=PI/2:s=1
  9154. @end example
  9155. @item
  9156. Rotate hue and make the saturation swing between 0
  9157. and 2 over a period of 1 second:
  9158. @example
  9159. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9160. @end example
  9161. @item
  9162. Apply a 3 seconds saturation fade-in effect starting at 0:
  9163. @example
  9164. hue="s=min(t/3\,1)"
  9165. @end example
  9166. The general fade-in expression can be written as:
  9167. @example
  9168. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9169. @end example
  9170. @item
  9171. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9172. @example
  9173. hue="s=max(0\, min(1\, (8-t)/3))"
  9174. @end example
  9175. The general fade-out expression can be written as:
  9176. @example
  9177. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9178. @end example
  9179. @end itemize
  9180. @subsection Commands
  9181. This filter supports the following commands:
  9182. @table @option
  9183. @item b
  9184. @item s
  9185. @item h
  9186. @item H
  9187. Modify the hue and/or the saturation and/or brightness of the input video.
  9188. The command accepts the same syntax of the corresponding option.
  9189. If the specified expression is not valid, it is kept at its current
  9190. value.
  9191. @end table
  9192. @section hysteresis
  9193. Grow first stream into second stream by connecting components.
  9194. This makes it possible to build more robust edge masks.
  9195. This filter accepts the following options:
  9196. @table @option
  9197. @item planes
  9198. Set which planes will be processed as bitmap, unprocessed planes will be
  9199. copied from first stream.
  9200. By default value 0xf, all planes will be processed.
  9201. @item threshold
  9202. Set threshold which is used in filtering. If pixel component value is higher than
  9203. this value filter algorithm for connecting components is activated.
  9204. By default value is 0.
  9205. @end table
  9206. @section idet
  9207. Detect video interlacing type.
  9208. This filter tries to detect if the input frames are interlaced, progressive,
  9209. top or bottom field first. It will also try to detect fields that are
  9210. repeated between adjacent frames (a sign of telecine).
  9211. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9212. Multiple frame detection incorporates the classification history of previous frames.
  9213. The filter will log these metadata values:
  9214. @table @option
  9215. @item single.current_frame
  9216. Detected type of current frame using single-frame detection. One of:
  9217. ``tff'' (top field first), ``bff'' (bottom field first),
  9218. ``progressive'', or ``undetermined''
  9219. @item single.tff
  9220. Cumulative number of frames detected as top field first using single-frame detection.
  9221. @item multiple.tff
  9222. Cumulative number of frames detected as top field first using multiple-frame detection.
  9223. @item single.bff
  9224. Cumulative number of frames detected as bottom field first using single-frame detection.
  9225. @item multiple.current_frame
  9226. Detected type of current frame using multiple-frame detection. One of:
  9227. ``tff'' (top field first), ``bff'' (bottom field first),
  9228. ``progressive'', or ``undetermined''
  9229. @item multiple.bff
  9230. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9231. @item single.progressive
  9232. Cumulative number of frames detected as progressive using single-frame detection.
  9233. @item multiple.progressive
  9234. Cumulative number of frames detected as progressive using multiple-frame detection.
  9235. @item single.undetermined
  9236. Cumulative number of frames that could not be classified using single-frame detection.
  9237. @item multiple.undetermined
  9238. Cumulative number of frames that could not be classified using multiple-frame detection.
  9239. @item repeated.current_frame
  9240. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9241. @item repeated.neither
  9242. Cumulative number of frames with no repeated field.
  9243. @item repeated.top
  9244. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9245. @item repeated.bottom
  9246. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9247. @end table
  9248. The filter accepts the following options:
  9249. @table @option
  9250. @item intl_thres
  9251. Set interlacing threshold.
  9252. @item prog_thres
  9253. Set progressive threshold.
  9254. @item rep_thres
  9255. Threshold for repeated field detection.
  9256. @item half_life
  9257. Number of frames after which a given frame's contribution to the
  9258. statistics is halved (i.e., it contributes only 0.5 to its
  9259. classification). The default of 0 means that all frames seen are given
  9260. full weight of 1.0 forever.
  9261. @item analyze_interlaced_flag
  9262. When this is not 0 then idet will use the specified number of frames to determine
  9263. if the interlaced flag is accurate, it will not count undetermined frames.
  9264. If the flag is found to be accurate it will be used without any further
  9265. computations, if it is found to be inaccurate it will be cleared without any
  9266. further computations. This allows inserting the idet filter as a low computational
  9267. method to clean up the interlaced flag
  9268. @end table
  9269. @section il
  9270. Deinterleave or interleave fields.
  9271. This filter allows one to process interlaced images fields without
  9272. deinterlacing them. Deinterleaving splits the input frame into 2
  9273. fields (so called half pictures). Odd lines are moved to the top
  9274. half of the output image, even lines to the bottom half.
  9275. You can process (filter) them independently and then re-interleave them.
  9276. The filter accepts the following options:
  9277. @table @option
  9278. @item luma_mode, l
  9279. @item chroma_mode, c
  9280. @item alpha_mode, a
  9281. Available values for @var{luma_mode}, @var{chroma_mode} and
  9282. @var{alpha_mode} are:
  9283. @table @samp
  9284. @item none
  9285. Do nothing.
  9286. @item deinterleave, d
  9287. Deinterleave fields, placing one above the other.
  9288. @item interleave, i
  9289. Interleave fields. Reverse the effect of deinterleaving.
  9290. @end table
  9291. Default value is @code{none}.
  9292. @item luma_swap, ls
  9293. @item chroma_swap, cs
  9294. @item alpha_swap, as
  9295. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9296. @end table
  9297. @section inflate
  9298. Apply inflate effect to the video.
  9299. This filter replaces the pixel by the local(3x3) average by taking into account
  9300. only values higher than the pixel.
  9301. It accepts the following options:
  9302. @table @option
  9303. @item threshold0
  9304. @item threshold1
  9305. @item threshold2
  9306. @item threshold3
  9307. Limit the maximum change for each plane, default is 65535.
  9308. If 0, plane will remain unchanged.
  9309. @end table
  9310. @section interlace
  9311. Simple interlacing filter from progressive contents. This interleaves upper (or
  9312. lower) lines from odd frames with lower (or upper) lines from even frames,
  9313. halving the frame rate and preserving image height.
  9314. @example
  9315. Original Original New Frame
  9316. Frame 'j' Frame 'j+1' (tff)
  9317. ========== =========== ==================
  9318. Line 0 --------------------> Frame 'j' Line 0
  9319. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9320. Line 2 ---------------------> Frame 'j' Line 2
  9321. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9322. ... ... ...
  9323. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9324. @end example
  9325. It accepts the following optional parameters:
  9326. @table @option
  9327. @item scan
  9328. This determines whether the interlaced frame is taken from the even
  9329. (tff - default) or odd (bff) lines of the progressive frame.
  9330. @item lowpass
  9331. Vertical lowpass filter to avoid twitter interlacing and
  9332. reduce moire patterns.
  9333. @table @samp
  9334. @item 0, off
  9335. Disable vertical lowpass filter
  9336. @item 1, linear
  9337. Enable linear filter (default)
  9338. @item 2, complex
  9339. Enable complex filter. This will slightly less reduce twitter and moire
  9340. but better retain detail and subjective sharpness impression.
  9341. @end table
  9342. @end table
  9343. @section kerndeint
  9344. Deinterlace input video by applying Donald Graft's adaptive kernel
  9345. deinterling. Work on interlaced parts of a video to produce
  9346. progressive frames.
  9347. The description of the accepted parameters follows.
  9348. @table @option
  9349. @item thresh
  9350. Set the threshold which affects the filter's tolerance when
  9351. determining if a pixel line must be processed. It must be an integer
  9352. in the range [0,255] and defaults to 10. A value of 0 will result in
  9353. applying the process on every pixels.
  9354. @item map
  9355. Paint pixels exceeding the threshold value to white if set to 1.
  9356. Default is 0.
  9357. @item order
  9358. Set the fields order. Swap fields if set to 1, leave fields alone if
  9359. 0. Default is 0.
  9360. @item sharp
  9361. Enable additional sharpening if set to 1. Default is 0.
  9362. @item twoway
  9363. Enable twoway sharpening if set to 1. Default is 0.
  9364. @end table
  9365. @subsection Examples
  9366. @itemize
  9367. @item
  9368. Apply default values:
  9369. @example
  9370. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9371. @end example
  9372. @item
  9373. Enable additional sharpening:
  9374. @example
  9375. kerndeint=sharp=1
  9376. @end example
  9377. @item
  9378. Paint processed pixels in white:
  9379. @example
  9380. kerndeint=map=1
  9381. @end example
  9382. @end itemize
  9383. @section lagfun
  9384. Slowly update darker pixels.
  9385. This filter makes short flashes of light appear longer.
  9386. This filter accepts the following options:
  9387. @table @option
  9388. @item decay
  9389. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9390. @item planes
  9391. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9392. @end table
  9393. @section lenscorrection
  9394. Correct radial lens distortion
  9395. This filter can be used to correct for radial distortion as can result from the use
  9396. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9397. one can use tools available for example as part of opencv or simply trial-and-error.
  9398. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9399. and extract the k1 and k2 coefficients from the resulting matrix.
  9400. Note that effectively the same filter is available in the open-source tools Krita and
  9401. Digikam from the KDE project.
  9402. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9403. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9404. brightness distribution, so you may want to use both filters together in certain
  9405. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9406. be applied before or after lens correction.
  9407. @subsection Options
  9408. The filter accepts the following options:
  9409. @table @option
  9410. @item cx
  9411. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9412. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9413. width. Default is 0.5.
  9414. @item cy
  9415. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9416. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9417. height. Default is 0.5.
  9418. @item k1
  9419. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9420. no correction. Default is 0.
  9421. @item k2
  9422. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9423. 0 means no correction. Default is 0.
  9424. @end table
  9425. The formula that generates the correction is:
  9426. @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)
  9427. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9428. distances from the focal point in the source and target images, respectively.
  9429. @section lensfun
  9430. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9431. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9432. to apply the lens correction. The filter will load the lensfun database and
  9433. query it to find the corresponding camera and lens entries in the database. As
  9434. long as these entries can be found with the given options, the filter can
  9435. perform corrections on frames. Note that incomplete strings will result in the
  9436. filter choosing the best match with the given options, and the filter will
  9437. output the chosen camera and lens models (logged with level "info"). You must
  9438. provide the make, camera model, and lens model as they are required.
  9439. The filter accepts the following options:
  9440. @table @option
  9441. @item make
  9442. The make of the camera (for example, "Canon"). This option is required.
  9443. @item model
  9444. The model of the camera (for example, "Canon EOS 100D"). This option is
  9445. required.
  9446. @item lens_model
  9447. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9448. option is required.
  9449. @item mode
  9450. The type of correction to apply. The following values are valid options:
  9451. @table @samp
  9452. @item vignetting
  9453. Enables fixing lens vignetting.
  9454. @item geometry
  9455. Enables fixing lens geometry. This is the default.
  9456. @item subpixel
  9457. Enables fixing chromatic aberrations.
  9458. @item vig_geo
  9459. Enables fixing lens vignetting and lens geometry.
  9460. @item vig_subpixel
  9461. Enables fixing lens vignetting and chromatic aberrations.
  9462. @item distortion
  9463. Enables fixing both lens geometry and chromatic aberrations.
  9464. @item all
  9465. Enables all possible corrections.
  9466. @end table
  9467. @item focal_length
  9468. The focal length of the image/video (zoom; expected constant for video). For
  9469. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9470. range should be chosen when using that lens. Default 18.
  9471. @item aperture
  9472. The aperture of the image/video (expected constant for video). Note that
  9473. aperture is only used for vignetting correction. Default 3.5.
  9474. @item focus_distance
  9475. The focus distance of the image/video (expected constant for video). Note that
  9476. focus distance is only used for vignetting and only slightly affects the
  9477. vignetting correction process. If unknown, leave it at the default value (which
  9478. is 1000).
  9479. @item scale
  9480. The scale factor which is applied after transformation. After correction the
  9481. video is no longer necessarily rectangular. This parameter controls how much of
  9482. the resulting image is visible. The value 0 means that a value will be chosen
  9483. automatically such that there is little or no unmapped area in the output
  9484. image. 1.0 means that no additional scaling is done. Lower values may result
  9485. in more of the corrected image being visible, while higher values may avoid
  9486. unmapped areas in the output.
  9487. @item target_geometry
  9488. The target geometry of the output image/video. The following values are valid
  9489. options:
  9490. @table @samp
  9491. @item rectilinear (default)
  9492. @item fisheye
  9493. @item panoramic
  9494. @item equirectangular
  9495. @item fisheye_orthographic
  9496. @item fisheye_stereographic
  9497. @item fisheye_equisolid
  9498. @item fisheye_thoby
  9499. @end table
  9500. @item reverse
  9501. Apply the reverse of image correction (instead of correcting distortion, apply
  9502. it).
  9503. @item interpolation
  9504. The type of interpolation used when correcting distortion. The following values
  9505. are valid options:
  9506. @table @samp
  9507. @item nearest
  9508. @item linear (default)
  9509. @item lanczos
  9510. @end table
  9511. @end table
  9512. @subsection Examples
  9513. @itemize
  9514. @item
  9515. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9516. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9517. aperture of "8.0".
  9518. @example
  9519. 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
  9520. @end example
  9521. @item
  9522. Apply the same as before, but only for the first 5 seconds of video.
  9523. @example
  9524. 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
  9525. @end example
  9526. @end itemize
  9527. @section libvmaf
  9528. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9529. score between two input videos.
  9530. The obtained VMAF score is printed through the logging system.
  9531. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9532. After installing the library it can be enabled using:
  9533. @code{./configure --enable-libvmaf --enable-version3}.
  9534. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9535. The filter has following options:
  9536. @table @option
  9537. @item model_path
  9538. Set the model path which is to be used for SVM.
  9539. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9540. @item log_path
  9541. Set the file path to be used to store logs.
  9542. @item log_fmt
  9543. Set the format of the log file (xml or json).
  9544. @item enable_transform
  9545. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9546. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9547. Default value: @code{false}
  9548. @item phone_model
  9549. Invokes the phone model which will generate VMAF scores higher than in the
  9550. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9551. Default value: @code{false}
  9552. @item psnr
  9553. Enables computing psnr along with vmaf.
  9554. Default value: @code{false}
  9555. @item ssim
  9556. Enables computing ssim along with vmaf.
  9557. Default value: @code{false}
  9558. @item ms_ssim
  9559. Enables computing ms_ssim along with vmaf.
  9560. Default value: @code{false}
  9561. @item pool
  9562. Set the pool method to be used for computing vmaf.
  9563. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9564. @item n_threads
  9565. Set number of threads to be used when computing vmaf.
  9566. Default value: @code{0}, which makes use of all available logical processors.
  9567. @item n_subsample
  9568. Set interval for frame subsampling used when computing vmaf.
  9569. Default value: @code{1}
  9570. @item enable_conf_interval
  9571. Enables confidence interval.
  9572. Default value: @code{false}
  9573. @end table
  9574. This filter also supports the @ref{framesync} options.
  9575. @subsection Examples
  9576. @itemize
  9577. @item
  9578. On the below examples the input file @file{main.mpg} being processed is
  9579. compared with the reference file @file{ref.mpg}.
  9580. @example
  9581. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9582. @end example
  9583. @item
  9584. Example with options:
  9585. @example
  9586. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9587. @end example
  9588. @item
  9589. Example with options and different containers:
  9590. @example
  9591. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  9592. @end example
  9593. @end itemize
  9594. @section limiter
  9595. Limits the pixel components values to the specified range [min, max].
  9596. The filter accepts the following options:
  9597. @table @option
  9598. @item min
  9599. Lower bound. Defaults to the lowest allowed value for the input.
  9600. @item max
  9601. Upper bound. Defaults to the highest allowed value for the input.
  9602. @item planes
  9603. Specify which planes will be processed. Defaults to all available.
  9604. @end table
  9605. @section loop
  9606. Loop video frames.
  9607. The filter accepts the following options:
  9608. @table @option
  9609. @item loop
  9610. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9611. Default is 0.
  9612. @item size
  9613. Set maximal size in number of frames. Default is 0.
  9614. @item start
  9615. Set first frame of loop. Default is 0.
  9616. @end table
  9617. @subsection Examples
  9618. @itemize
  9619. @item
  9620. Loop single first frame infinitely:
  9621. @example
  9622. loop=loop=-1:size=1:start=0
  9623. @end example
  9624. @item
  9625. Loop single first frame 10 times:
  9626. @example
  9627. loop=loop=10:size=1:start=0
  9628. @end example
  9629. @item
  9630. Loop 10 first frames 5 times:
  9631. @example
  9632. loop=loop=5:size=10:start=0
  9633. @end example
  9634. @end itemize
  9635. @section lut1d
  9636. Apply a 1D LUT to an input video.
  9637. The filter accepts the following options:
  9638. @table @option
  9639. @item file
  9640. Set the 1D LUT file name.
  9641. Currently supported formats:
  9642. @table @samp
  9643. @item cube
  9644. Iridas
  9645. @item csp
  9646. cineSpace
  9647. @end table
  9648. @item interp
  9649. Select interpolation mode.
  9650. Available values are:
  9651. @table @samp
  9652. @item nearest
  9653. Use values from the nearest defined point.
  9654. @item linear
  9655. Interpolate values using the linear interpolation.
  9656. @item cosine
  9657. Interpolate values using the cosine interpolation.
  9658. @item cubic
  9659. Interpolate values using the cubic interpolation.
  9660. @item spline
  9661. Interpolate values using the spline interpolation.
  9662. @end table
  9663. @end table
  9664. @anchor{lut3d}
  9665. @section lut3d
  9666. Apply a 3D LUT to an input video.
  9667. The filter accepts the following options:
  9668. @table @option
  9669. @item file
  9670. Set the 3D LUT file name.
  9671. Currently supported formats:
  9672. @table @samp
  9673. @item 3dl
  9674. AfterEffects
  9675. @item cube
  9676. Iridas
  9677. @item dat
  9678. DaVinci
  9679. @item m3d
  9680. Pandora
  9681. @item csp
  9682. cineSpace
  9683. @end table
  9684. @item interp
  9685. Select interpolation mode.
  9686. Available values are:
  9687. @table @samp
  9688. @item nearest
  9689. Use values from the nearest defined point.
  9690. @item trilinear
  9691. Interpolate values using the 8 points defining a cube.
  9692. @item tetrahedral
  9693. Interpolate values using a tetrahedron.
  9694. @end table
  9695. @end table
  9696. @section lumakey
  9697. Turn certain luma values into transparency.
  9698. The filter accepts the following options:
  9699. @table @option
  9700. @item threshold
  9701. Set the luma which will be used as base for transparency.
  9702. Default value is @code{0}.
  9703. @item tolerance
  9704. Set the range of luma values to be keyed out.
  9705. Default value is @code{0.01}.
  9706. @item softness
  9707. Set the range of softness. Default value is @code{0}.
  9708. Use this to control gradual transition from zero to full transparency.
  9709. @end table
  9710. @subsection Commands
  9711. This filter supports same @ref{commands} as options.
  9712. The command accepts the same syntax of the corresponding option.
  9713. If the specified expression is not valid, it is kept at its current
  9714. value.
  9715. @section lut, lutrgb, lutyuv
  9716. Compute a look-up table for binding each pixel component input value
  9717. to an output value, and apply it to the input video.
  9718. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9719. to an RGB input video.
  9720. These filters accept the following parameters:
  9721. @table @option
  9722. @item c0
  9723. set first pixel component expression
  9724. @item c1
  9725. set second pixel component expression
  9726. @item c2
  9727. set third pixel component expression
  9728. @item c3
  9729. set fourth pixel component expression, corresponds to the alpha component
  9730. @item r
  9731. set red component expression
  9732. @item g
  9733. set green component expression
  9734. @item b
  9735. set blue component expression
  9736. @item a
  9737. alpha component expression
  9738. @item y
  9739. set Y/luminance component expression
  9740. @item u
  9741. set U/Cb component expression
  9742. @item v
  9743. set V/Cr component expression
  9744. @end table
  9745. Each of them specifies the expression to use for computing the lookup table for
  9746. the corresponding pixel component values.
  9747. The exact component associated to each of the @var{c*} options depends on the
  9748. format in input.
  9749. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9750. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9751. The expressions can contain the following constants and functions:
  9752. @table @option
  9753. @item w
  9754. @item h
  9755. The input width and height.
  9756. @item val
  9757. The input value for the pixel component.
  9758. @item clipval
  9759. The input value, clipped to the @var{minval}-@var{maxval} range.
  9760. @item maxval
  9761. The maximum value for the pixel component.
  9762. @item minval
  9763. The minimum value for the pixel component.
  9764. @item negval
  9765. The negated value for the pixel component value, clipped to the
  9766. @var{minval}-@var{maxval} range; it corresponds to the expression
  9767. "maxval-clipval+minval".
  9768. @item clip(val)
  9769. The computed value in @var{val}, clipped to the
  9770. @var{minval}-@var{maxval} range.
  9771. @item gammaval(gamma)
  9772. The computed gamma correction value of the pixel component value,
  9773. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9774. expression
  9775. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9776. @end table
  9777. All expressions default to "val".
  9778. @subsection Examples
  9779. @itemize
  9780. @item
  9781. Negate input video:
  9782. @example
  9783. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9784. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9785. @end example
  9786. The above is the same as:
  9787. @example
  9788. lutrgb="r=negval:g=negval:b=negval"
  9789. lutyuv="y=negval:u=negval:v=negval"
  9790. @end example
  9791. @item
  9792. Negate luminance:
  9793. @example
  9794. lutyuv=y=negval
  9795. @end example
  9796. @item
  9797. Remove chroma components, turning the video into a graytone image:
  9798. @example
  9799. lutyuv="u=128:v=128"
  9800. @end example
  9801. @item
  9802. Apply a luma burning effect:
  9803. @example
  9804. lutyuv="y=2*val"
  9805. @end example
  9806. @item
  9807. Remove green and blue components:
  9808. @example
  9809. lutrgb="g=0:b=0"
  9810. @end example
  9811. @item
  9812. Set a constant alpha channel value on input:
  9813. @example
  9814. format=rgba,lutrgb=a="maxval-minval/2"
  9815. @end example
  9816. @item
  9817. Correct luminance gamma by a factor of 0.5:
  9818. @example
  9819. lutyuv=y=gammaval(0.5)
  9820. @end example
  9821. @item
  9822. Discard least significant bits of luma:
  9823. @example
  9824. lutyuv=y='bitand(val, 128+64+32)'
  9825. @end example
  9826. @item
  9827. Technicolor like effect:
  9828. @example
  9829. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9830. @end example
  9831. @end itemize
  9832. @section lut2, tlut2
  9833. The @code{lut2} filter takes two input streams and outputs one
  9834. stream.
  9835. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9836. from one single stream.
  9837. This filter accepts the following parameters:
  9838. @table @option
  9839. @item c0
  9840. set first pixel component expression
  9841. @item c1
  9842. set second pixel component expression
  9843. @item c2
  9844. set third pixel component expression
  9845. @item c3
  9846. set fourth pixel component expression, corresponds to the alpha component
  9847. @item d
  9848. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9849. which means bit depth is automatically picked from first input format.
  9850. @end table
  9851. Each of them specifies the expression to use for computing the lookup table for
  9852. the corresponding pixel component values.
  9853. The exact component associated to each of the @var{c*} options depends on the
  9854. format in inputs.
  9855. The expressions can contain the following constants:
  9856. @table @option
  9857. @item w
  9858. @item h
  9859. The input width and height.
  9860. @item x
  9861. The first input value for the pixel component.
  9862. @item y
  9863. The second input value for the pixel component.
  9864. @item bdx
  9865. The first input video bit depth.
  9866. @item bdy
  9867. The second input video bit depth.
  9868. @end table
  9869. All expressions default to "x".
  9870. @subsection Examples
  9871. @itemize
  9872. @item
  9873. Highlight differences between two RGB video streams:
  9874. @example
  9875. 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)'
  9876. @end example
  9877. @item
  9878. Highlight differences between two YUV video streams:
  9879. @example
  9880. 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)'
  9881. @end example
  9882. @item
  9883. Show max difference between two video streams:
  9884. @example
  9885. 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)))'
  9886. @end example
  9887. @end itemize
  9888. @section maskedclamp
  9889. Clamp the first input stream with the second input and third input stream.
  9890. Returns the value of first stream to be between second input
  9891. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9892. This filter accepts the following options:
  9893. @table @option
  9894. @item undershoot
  9895. Default value is @code{0}.
  9896. @item overshoot
  9897. Default value is @code{0}.
  9898. @item planes
  9899. Set which planes will be processed as bitmap, unprocessed planes will be
  9900. copied from first stream.
  9901. By default value 0xf, all planes will be processed.
  9902. @end table
  9903. @section maskedmax
  9904. Merge the second and third input stream into output stream using absolute differences
  9905. between second input stream and first input stream and absolute difference between
  9906. third input stream and first input stream. The picked value will be from second input
  9907. stream if second absolute difference is greater than first one or from third input stream
  9908. otherwise.
  9909. This filter accepts the following options:
  9910. @table @option
  9911. @item planes
  9912. Set which planes will be processed as bitmap, unprocessed planes will be
  9913. copied from first stream.
  9914. By default value 0xf, all planes will be processed.
  9915. @end table
  9916. @section maskedmerge
  9917. Merge the first input stream with the second input stream using per pixel
  9918. weights in the third input stream.
  9919. A value of 0 in the third stream pixel component means that pixel component
  9920. from first stream is returned unchanged, while maximum value (eg. 255 for
  9921. 8-bit videos) means that pixel component from second stream is returned
  9922. unchanged. Intermediate values define the amount of merging between both
  9923. input stream's pixel components.
  9924. This filter accepts the following options:
  9925. @table @option
  9926. @item planes
  9927. Set which planes will be processed as bitmap, unprocessed planes will be
  9928. copied from first stream.
  9929. By default value 0xf, all planes will be processed.
  9930. @end table
  9931. @section maskedmin
  9932. Merge the second and third input stream into output stream using absolute differences
  9933. between second input stream and first input stream and absolute difference between
  9934. third input stream and first input stream. The picked value will be from second input
  9935. stream if second absolute difference is less than first one or from third input stream
  9936. otherwise.
  9937. This filter accepts the following options:
  9938. @table @option
  9939. @item planes
  9940. Set which planes will be processed as bitmap, unprocessed planes will be
  9941. copied from first stream.
  9942. By default value 0xf, all planes will be processed.
  9943. @end table
  9944. @section maskfun
  9945. Create mask from input video.
  9946. For example it is useful to create motion masks after @code{tblend} filter.
  9947. This filter accepts the following options:
  9948. @table @option
  9949. @item low
  9950. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9951. @item high
  9952. Set high threshold. Any pixel component higher than this value will be set to max value
  9953. allowed for current pixel format.
  9954. @item planes
  9955. Set planes to filter, by default all available planes are filtered.
  9956. @item fill
  9957. Fill all frame pixels with this value.
  9958. @item sum
  9959. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9960. average, output frame will be completely filled with value set by @var{fill} option.
  9961. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9962. @end table
  9963. @section mcdeint
  9964. Apply motion-compensation deinterlacing.
  9965. It needs one field per frame as input and must thus be used together
  9966. with yadif=1/3 or equivalent.
  9967. This filter accepts the following options:
  9968. @table @option
  9969. @item mode
  9970. Set the deinterlacing mode.
  9971. It accepts one of the following values:
  9972. @table @samp
  9973. @item fast
  9974. @item medium
  9975. @item slow
  9976. use iterative motion estimation
  9977. @item extra_slow
  9978. like @samp{slow}, but use multiple reference frames.
  9979. @end table
  9980. Default value is @samp{fast}.
  9981. @item parity
  9982. Set the picture field parity assumed for the input video. It must be
  9983. one of the following values:
  9984. @table @samp
  9985. @item 0, tff
  9986. assume top field first
  9987. @item 1, bff
  9988. assume bottom field first
  9989. @end table
  9990. Default value is @samp{bff}.
  9991. @item qp
  9992. Set per-block quantization parameter (QP) used by the internal
  9993. encoder.
  9994. Higher values should result in a smoother motion vector field but less
  9995. optimal individual vectors. Default value is 1.
  9996. @end table
  9997. @section median
  9998. Pick median pixel from certain rectangle defined by radius.
  9999. This filter accepts the following options:
  10000. @table @option
  10001. @item radius
  10002. Set horizontal radius size. Default value is @code{1}.
  10003. Allowed range is integer from 1 to 127.
  10004. @item planes
  10005. Set which planes to process. Default is @code{15}, which is all available planes.
  10006. @item radiusV
  10007. Set vertical radius size. Default value is @code{0}.
  10008. Allowed range is integer from 0 to 127.
  10009. If it is 0, value will be picked from horizontal @code{radius} option.
  10010. @end table
  10011. @subsection Commands
  10012. This filter supports same @ref{commands} as options.
  10013. The command accepts the same syntax of the corresponding option.
  10014. If the specified expression is not valid, it is kept at its current
  10015. value.
  10016. @section mergeplanes
  10017. Merge color channel components from several video streams.
  10018. The filter accepts up to 4 input streams, and merge selected input
  10019. planes to the output video.
  10020. This filter accepts the following options:
  10021. @table @option
  10022. @item mapping
  10023. Set input to output plane mapping. Default is @code{0}.
  10024. The mappings is specified as a bitmap. It should be specified as a
  10025. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10026. mapping for the first plane of the output stream. 'A' sets the number of
  10027. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10028. corresponding input to use (from 0 to 3). The rest of the mappings is
  10029. similar, 'Bb' describes the mapping for the output stream second
  10030. plane, 'Cc' describes the mapping for the output stream third plane and
  10031. 'Dd' describes the mapping for the output stream fourth plane.
  10032. @item format
  10033. Set output pixel format. Default is @code{yuva444p}.
  10034. @end table
  10035. @subsection Examples
  10036. @itemize
  10037. @item
  10038. Merge three gray video streams of same width and height into single video stream:
  10039. @example
  10040. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10041. @end example
  10042. @item
  10043. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10044. @example
  10045. [a0][a1]mergeplanes=0x00010210:yuva444p
  10046. @end example
  10047. @item
  10048. Swap Y and A plane in yuva444p stream:
  10049. @example
  10050. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10051. @end example
  10052. @item
  10053. Swap U and V plane in yuv420p stream:
  10054. @example
  10055. format=yuv420p,mergeplanes=0x000201:yuv420p
  10056. @end example
  10057. @item
  10058. Cast a rgb24 clip to yuv444p:
  10059. @example
  10060. format=rgb24,mergeplanes=0x000102:yuv444p
  10061. @end example
  10062. @end itemize
  10063. @section mestimate
  10064. Estimate and export motion vectors using block matching algorithms.
  10065. Motion vectors are stored in frame side data to be used by other filters.
  10066. This filter accepts the following options:
  10067. @table @option
  10068. @item method
  10069. Specify the motion estimation method. Accepts one of the following values:
  10070. @table @samp
  10071. @item esa
  10072. Exhaustive search algorithm.
  10073. @item tss
  10074. Three step search algorithm.
  10075. @item tdls
  10076. Two dimensional logarithmic search algorithm.
  10077. @item ntss
  10078. New three step search algorithm.
  10079. @item fss
  10080. Four step search algorithm.
  10081. @item ds
  10082. Diamond search algorithm.
  10083. @item hexbs
  10084. Hexagon-based search algorithm.
  10085. @item epzs
  10086. Enhanced predictive zonal search algorithm.
  10087. @item umh
  10088. Uneven multi-hexagon search algorithm.
  10089. @end table
  10090. Default value is @samp{esa}.
  10091. @item mb_size
  10092. Macroblock size. Default @code{16}.
  10093. @item search_param
  10094. Search parameter. Default @code{7}.
  10095. @end table
  10096. @section midequalizer
  10097. Apply Midway Image Equalization effect using two video streams.
  10098. Midway Image Equalization adjusts a pair of images to have the same
  10099. histogram, while maintaining their dynamics as much as possible. It's
  10100. useful for e.g. matching exposures from a pair of stereo cameras.
  10101. This filter has two inputs and one output, which must be of same pixel format, but
  10102. may be of different sizes. The output of filter is first input adjusted with
  10103. midway histogram of both inputs.
  10104. This filter accepts the following option:
  10105. @table @option
  10106. @item planes
  10107. Set which planes to process. Default is @code{15}, which is all available planes.
  10108. @end table
  10109. @section minterpolate
  10110. Convert the video to specified frame rate using motion interpolation.
  10111. This filter accepts the following options:
  10112. @table @option
  10113. @item fps
  10114. 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}.
  10115. @item mi_mode
  10116. Motion interpolation mode. Following values are accepted:
  10117. @table @samp
  10118. @item dup
  10119. Duplicate previous or next frame for interpolating new ones.
  10120. @item blend
  10121. Blend source frames. Interpolated frame is mean of previous and next frames.
  10122. @item mci
  10123. Motion compensated interpolation. Following options are effective when this mode is selected:
  10124. @table @samp
  10125. @item mc_mode
  10126. Motion compensation mode. Following values are accepted:
  10127. @table @samp
  10128. @item obmc
  10129. Overlapped block motion compensation.
  10130. @item aobmc
  10131. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10132. @end table
  10133. Default mode is @samp{obmc}.
  10134. @item me_mode
  10135. Motion estimation mode. Following values are accepted:
  10136. @table @samp
  10137. @item bidir
  10138. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10139. @item bilat
  10140. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10141. @end table
  10142. Default mode is @samp{bilat}.
  10143. @item me
  10144. The algorithm to be used for motion estimation. Following values are accepted:
  10145. @table @samp
  10146. @item esa
  10147. Exhaustive search algorithm.
  10148. @item tss
  10149. Three step search algorithm.
  10150. @item tdls
  10151. Two dimensional logarithmic search algorithm.
  10152. @item ntss
  10153. New three step search algorithm.
  10154. @item fss
  10155. Four step search algorithm.
  10156. @item ds
  10157. Diamond search algorithm.
  10158. @item hexbs
  10159. Hexagon-based search algorithm.
  10160. @item epzs
  10161. Enhanced predictive zonal search algorithm.
  10162. @item umh
  10163. Uneven multi-hexagon search algorithm.
  10164. @end table
  10165. Default algorithm is @samp{epzs}.
  10166. @item mb_size
  10167. Macroblock size. Default @code{16}.
  10168. @item search_param
  10169. Motion estimation search parameter. Default @code{32}.
  10170. @item vsbmc
  10171. 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).
  10172. @end table
  10173. @end table
  10174. @item scd
  10175. 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:
  10176. @table @samp
  10177. @item none
  10178. Disable scene change detection.
  10179. @item fdiff
  10180. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10181. @end table
  10182. Default method is @samp{fdiff}.
  10183. @item scd_threshold
  10184. Scene change detection threshold. Default is @code{5.0}.
  10185. @end table
  10186. @section mix
  10187. Mix several video input streams into one video stream.
  10188. A description of the accepted options follows.
  10189. @table @option
  10190. @item nb_inputs
  10191. The number of inputs. If unspecified, it defaults to 2.
  10192. @item weights
  10193. Specify weight of each input video stream as sequence.
  10194. Each weight is separated by space. If number of weights
  10195. is smaller than number of @var{frames} last specified
  10196. weight will be used for all remaining unset weights.
  10197. @item scale
  10198. Specify scale, if it is set it will be multiplied with sum
  10199. of each weight multiplied with pixel values to give final destination
  10200. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10201. @item duration
  10202. Specify how end of stream is determined.
  10203. @table @samp
  10204. @item longest
  10205. The duration of the longest input. (default)
  10206. @item shortest
  10207. The duration of the shortest input.
  10208. @item first
  10209. The duration of the first input.
  10210. @end table
  10211. @end table
  10212. @section mpdecimate
  10213. Drop frames that do not differ greatly from the previous frame in
  10214. order to reduce frame rate.
  10215. The main use of this filter is for very-low-bitrate encoding
  10216. (e.g. streaming over dialup modem), but it could in theory be used for
  10217. fixing movies that were inverse-telecined incorrectly.
  10218. A description of the accepted options follows.
  10219. @table @option
  10220. @item max
  10221. Set the maximum number of consecutive frames which can be dropped (if
  10222. positive), or the minimum interval between dropped frames (if
  10223. negative). If the value is 0, the frame is dropped disregarding the
  10224. number of previous sequentially dropped frames.
  10225. Default value is 0.
  10226. @item hi
  10227. @item lo
  10228. @item frac
  10229. Set the dropping threshold values.
  10230. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10231. represent actual pixel value differences, so a threshold of 64
  10232. corresponds to 1 unit of difference for each pixel, or the same spread
  10233. out differently over the block.
  10234. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10235. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10236. meaning the whole image) differ by more than a threshold of @option{lo}.
  10237. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10238. 64*5, and default value for @option{frac} is 0.33.
  10239. @end table
  10240. @section negate
  10241. Negate (invert) the input video.
  10242. It accepts the following option:
  10243. @table @option
  10244. @item negate_alpha
  10245. With value 1, it negates the alpha component, if present. Default value is 0.
  10246. @end table
  10247. @anchor{nlmeans}
  10248. @section nlmeans
  10249. Denoise frames using Non-Local Means algorithm.
  10250. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10251. context similarity is defined by comparing their surrounding patches of size
  10252. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10253. around the pixel.
  10254. Note that the research area defines centers for patches, which means some
  10255. patches will be made of pixels outside that research area.
  10256. The filter accepts the following options.
  10257. @table @option
  10258. @item s
  10259. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10260. @item p
  10261. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10262. @item pc
  10263. Same as @option{p} but for chroma planes.
  10264. The default value is @var{0} and means automatic.
  10265. @item r
  10266. Set research size. Default is 15. Must be odd number in range [0, 99].
  10267. @item rc
  10268. Same as @option{r} but for chroma planes.
  10269. The default value is @var{0} and means automatic.
  10270. @end table
  10271. @section nnedi
  10272. Deinterlace video using neural network edge directed interpolation.
  10273. This filter accepts the following options:
  10274. @table @option
  10275. @item weights
  10276. Mandatory option, without binary file filter can not work.
  10277. Currently file can be found here:
  10278. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10279. @item deint
  10280. Set which frames to deinterlace, by default it is @code{all}.
  10281. Can be @code{all} or @code{interlaced}.
  10282. @item field
  10283. Set mode of operation.
  10284. Can be one of the following:
  10285. @table @samp
  10286. @item af
  10287. Use frame flags, both fields.
  10288. @item a
  10289. Use frame flags, single field.
  10290. @item t
  10291. Use top field only.
  10292. @item b
  10293. Use bottom field only.
  10294. @item tf
  10295. Use both fields, top first.
  10296. @item bf
  10297. Use both fields, bottom first.
  10298. @end table
  10299. @item planes
  10300. Set which planes to process, by default filter process all frames.
  10301. @item nsize
  10302. Set size of local neighborhood around each pixel, used by the predictor neural
  10303. network.
  10304. Can be one of the following:
  10305. @table @samp
  10306. @item s8x6
  10307. @item s16x6
  10308. @item s32x6
  10309. @item s48x6
  10310. @item s8x4
  10311. @item s16x4
  10312. @item s32x4
  10313. @end table
  10314. @item nns
  10315. Set the number of neurons in predictor neural network.
  10316. Can be one of the following:
  10317. @table @samp
  10318. @item n16
  10319. @item n32
  10320. @item n64
  10321. @item n128
  10322. @item n256
  10323. @end table
  10324. @item qual
  10325. Controls the number of different neural network predictions that are blended
  10326. together to compute the final output value. Can be @code{fast}, default or
  10327. @code{slow}.
  10328. @item etype
  10329. Set which set of weights to use in the predictor.
  10330. Can be one of the following:
  10331. @table @samp
  10332. @item a
  10333. weights trained to minimize absolute error
  10334. @item s
  10335. weights trained to minimize squared error
  10336. @end table
  10337. @item pscrn
  10338. Controls whether or not the prescreener neural network is used to decide
  10339. which pixels should be processed by the predictor neural network and which
  10340. can be handled by simple cubic interpolation.
  10341. The prescreener is trained to know whether cubic interpolation will be
  10342. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10343. The computational complexity of the prescreener nn is much less than that of
  10344. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10345. using the prescreener generally results in much faster processing.
  10346. The prescreener is pretty accurate, so the difference between using it and not
  10347. using it is almost always unnoticeable.
  10348. Can be one of the following:
  10349. @table @samp
  10350. @item none
  10351. @item original
  10352. @item new
  10353. @end table
  10354. Default is @code{new}.
  10355. @item fapprox
  10356. Set various debugging flags.
  10357. @end table
  10358. @section noformat
  10359. Force libavfilter not to use any of the specified pixel formats for the
  10360. input to the next filter.
  10361. It accepts the following parameters:
  10362. @table @option
  10363. @item pix_fmts
  10364. A '|'-separated list of pixel format names, such as
  10365. pix_fmts=yuv420p|monow|rgb24".
  10366. @end table
  10367. @subsection Examples
  10368. @itemize
  10369. @item
  10370. Force libavfilter to use a format different from @var{yuv420p} for the
  10371. input to the vflip filter:
  10372. @example
  10373. noformat=pix_fmts=yuv420p,vflip
  10374. @end example
  10375. @item
  10376. Convert the input video to any of the formats not contained in the list:
  10377. @example
  10378. noformat=yuv420p|yuv444p|yuv410p
  10379. @end example
  10380. @end itemize
  10381. @section noise
  10382. Add noise on video input frame.
  10383. The filter accepts the following options:
  10384. @table @option
  10385. @item all_seed
  10386. @item c0_seed
  10387. @item c1_seed
  10388. @item c2_seed
  10389. @item c3_seed
  10390. Set noise seed for specific pixel component or all pixel components in case
  10391. of @var{all_seed}. Default value is @code{123457}.
  10392. @item all_strength, alls
  10393. @item c0_strength, c0s
  10394. @item c1_strength, c1s
  10395. @item c2_strength, c2s
  10396. @item c3_strength, c3s
  10397. Set noise strength for specific pixel component or all pixel components in case
  10398. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10399. @item all_flags, allf
  10400. @item c0_flags, c0f
  10401. @item c1_flags, c1f
  10402. @item c2_flags, c2f
  10403. @item c3_flags, c3f
  10404. Set pixel component flags or set flags for all components if @var{all_flags}.
  10405. Available values for component flags are:
  10406. @table @samp
  10407. @item a
  10408. averaged temporal noise (smoother)
  10409. @item p
  10410. mix random noise with a (semi)regular pattern
  10411. @item t
  10412. temporal noise (noise pattern changes between frames)
  10413. @item u
  10414. uniform noise (gaussian otherwise)
  10415. @end table
  10416. @end table
  10417. @subsection Examples
  10418. Add temporal and uniform noise to input video:
  10419. @example
  10420. noise=alls=20:allf=t+u
  10421. @end example
  10422. @section normalize
  10423. Normalize RGB video (aka histogram stretching, contrast stretching).
  10424. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10425. For each channel of each frame, the filter computes the input range and maps
  10426. it linearly to the user-specified output range. The output range defaults
  10427. to the full dynamic range from pure black to pure white.
  10428. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10429. changes in brightness) caused when small dark or bright objects enter or leave
  10430. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10431. video camera, and, like a video camera, it may cause a period of over- or
  10432. under-exposure of the video.
  10433. The R,G,B channels can be normalized independently, which may cause some
  10434. color shifting, or linked together as a single channel, which prevents
  10435. color shifting. Linked normalization preserves hue. Independent normalization
  10436. does not, so it can be used to remove some color casts. Independent and linked
  10437. normalization can be combined in any ratio.
  10438. The normalize filter accepts the following options:
  10439. @table @option
  10440. @item blackpt
  10441. @item whitept
  10442. Colors which define the output range. The minimum input value is mapped to
  10443. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10444. The defaults are black and white respectively. Specifying white for
  10445. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10446. normalized video. Shades of grey can be used to reduce the dynamic range
  10447. (contrast). Specifying saturated colors here can create some interesting
  10448. effects.
  10449. @item smoothing
  10450. The number of previous frames to use for temporal smoothing. The input range
  10451. of each channel is smoothed using a rolling average over the current frame
  10452. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10453. smoothing).
  10454. @item independence
  10455. Controls the ratio of independent (color shifting) channel normalization to
  10456. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10457. independent. Defaults to 1.0 (fully independent).
  10458. @item strength
  10459. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10460. expensive no-op. Defaults to 1.0 (full strength).
  10461. @end table
  10462. @subsection Commands
  10463. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10464. The command accepts the same syntax of the corresponding option.
  10465. If the specified expression is not valid, it is kept at its current
  10466. value.
  10467. @subsection Examples
  10468. Stretch video contrast to use the full dynamic range, with no temporal
  10469. smoothing; may flicker depending on the source content:
  10470. @example
  10471. normalize=blackpt=black:whitept=white:smoothing=0
  10472. @end example
  10473. As above, but with 50 frames of temporal smoothing; flicker should be
  10474. reduced, depending on the source content:
  10475. @example
  10476. normalize=blackpt=black:whitept=white:smoothing=50
  10477. @end example
  10478. As above, but with hue-preserving linked channel normalization:
  10479. @example
  10480. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10481. @end example
  10482. As above, but with half strength:
  10483. @example
  10484. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10485. @end example
  10486. Map the darkest input color to red, the brightest input color to cyan:
  10487. @example
  10488. normalize=blackpt=red:whitept=cyan
  10489. @end example
  10490. @section null
  10491. Pass the video source unchanged to the output.
  10492. @section ocr
  10493. Optical Character Recognition
  10494. This filter uses Tesseract for optical character recognition. To enable
  10495. compilation of this filter, you need to configure FFmpeg with
  10496. @code{--enable-libtesseract}.
  10497. It accepts the following options:
  10498. @table @option
  10499. @item datapath
  10500. Set datapath to tesseract data. Default is to use whatever was
  10501. set at installation.
  10502. @item language
  10503. Set language, default is "eng".
  10504. @item whitelist
  10505. Set character whitelist.
  10506. @item blacklist
  10507. Set character blacklist.
  10508. @end table
  10509. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10510. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10511. @section ocv
  10512. Apply a video transform using libopencv.
  10513. To enable this filter, install the libopencv library and headers and
  10514. configure FFmpeg with @code{--enable-libopencv}.
  10515. It accepts the following parameters:
  10516. @table @option
  10517. @item filter_name
  10518. The name of the libopencv filter to apply.
  10519. @item filter_params
  10520. The parameters to pass to the libopencv filter. If not specified, the default
  10521. values are assumed.
  10522. @end table
  10523. Refer to the official libopencv documentation for more precise
  10524. information:
  10525. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10526. Several libopencv filters are supported; see the following subsections.
  10527. @anchor{dilate}
  10528. @subsection dilate
  10529. Dilate an image by using a specific structuring element.
  10530. It corresponds to the libopencv function @code{cvDilate}.
  10531. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10532. @var{struct_el} represents a structuring element, and has the syntax:
  10533. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10534. @var{cols} and @var{rows} represent the number of columns and rows of
  10535. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10536. point, and @var{shape} the shape for the structuring element. @var{shape}
  10537. must be "rect", "cross", "ellipse", or "custom".
  10538. If the value for @var{shape} is "custom", it must be followed by a
  10539. string of the form "=@var{filename}". The file with name
  10540. @var{filename} is assumed to represent a binary image, with each
  10541. printable character corresponding to a bright pixel. When a custom
  10542. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10543. or columns and rows of the read file are assumed instead.
  10544. The default value for @var{struct_el} is "3x3+0x0/rect".
  10545. @var{nb_iterations} specifies the number of times the transform is
  10546. applied to the image, and defaults to 1.
  10547. Some examples:
  10548. @example
  10549. # Use the default values
  10550. ocv=dilate
  10551. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10552. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10553. # Read the shape from the file diamond.shape, iterating two times.
  10554. # The file diamond.shape may contain a pattern of characters like this
  10555. # *
  10556. # ***
  10557. # *****
  10558. # ***
  10559. # *
  10560. # The specified columns and rows are ignored
  10561. # but the anchor point coordinates are not
  10562. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10563. @end example
  10564. @subsection erode
  10565. Erode an image by using a specific structuring element.
  10566. It corresponds to the libopencv function @code{cvErode}.
  10567. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10568. with the same syntax and semantics as the @ref{dilate} filter.
  10569. @subsection smooth
  10570. Smooth the input video.
  10571. The filter takes the following parameters:
  10572. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10573. @var{type} is the type of smooth filter to apply, and must be one of
  10574. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10575. or "bilateral". The default value is "gaussian".
  10576. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10577. depends on the smooth type. @var{param1} and
  10578. @var{param2} accept integer positive values or 0. @var{param3} and
  10579. @var{param4} accept floating point values.
  10580. The default value for @var{param1} is 3. The default value for the
  10581. other parameters is 0.
  10582. These parameters correspond to the parameters assigned to the
  10583. libopencv function @code{cvSmooth}.
  10584. @section oscilloscope
  10585. 2D Video Oscilloscope.
  10586. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10587. It accepts the following parameters:
  10588. @table @option
  10589. @item x
  10590. Set scope center x position.
  10591. @item y
  10592. Set scope center y position.
  10593. @item s
  10594. Set scope size, relative to frame diagonal.
  10595. @item t
  10596. Set scope tilt/rotation.
  10597. @item o
  10598. Set trace opacity.
  10599. @item tx
  10600. Set trace center x position.
  10601. @item ty
  10602. Set trace center y position.
  10603. @item tw
  10604. Set trace width, relative to width of frame.
  10605. @item th
  10606. Set trace height, relative to height of frame.
  10607. @item c
  10608. Set which components to trace. By default it traces first three components.
  10609. @item g
  10610. Draw trace grid. By default is enabled.
  10611. @item st
  10612. Draw some statistics. By default is enabled.
  10613. @item sc
  10614. Draw scope. By default is enabled.
  10615. @end table
  10616. @subsection Commands
  10617. This filter supports same @ref{commands} as options.
  10618. The command accepts the same syntax of the corresponding option.
  10619. If the specified expression is not valid, it is kept at its current
  10620. value.
  10621. @subsection Examples
  10622. @itemize
  10623. @item
  10624. Inspect full first row of video frame.
  10625. @example
  10626. oscilloscope=x=0.5:y=0:s=1
  10627. @end example
  10628. @item
  10629. Inspect full last row of video frame.
  10630. @example
  10631. oscilloscope=x=0.5:y=1:s=1
  10632. @end example
  10633. @item
  10634. Inspect full 5th line of video frame of height 1080.
  10635. @example
  10636. oscilloscope=x=0.5:y=5/1080:s=1
  10637. @end example
  10638. @item
  10639. Inspect full last column of video frame.
  10640. @example
  10641. oscilloscope=x=1:y=0.5:s=1:t=1
  10642. @end example
  10643. @end itemize
  10644. @anchor{overlay}
  10645. @section overlay
  10646. Overlay one video on top of another.
  10647. It takes two inputs and has one output. The first input is the "main"
  10648. video on which the second input is overlaid.
  10649. It accepts the following parameters:
  10650. A description of the accepted options follows.
  10651. @table @option
  10652. @item x
  10653. @item y
  10654. Set the expression for the x and y coordinates of the overlaid video
  10655. on the main video. Default value is "0" for both expressions. In case
  10656. the expression is invalid, it is set to a huge value (meaning that the
  10657. overlay will not be displayed within the output visible area).
  10658. @item eof_action
  10659. See @ref{framesync}.
  10660. @item eval
  10661. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10662. It accepts the following values:
  10663. @table @samp
  10664. @item init
  10665. only evaluate expressions once during the filter initialization or
  10666. when a command is processed
  10667. @item frame
  10668. evaluate expressions for each incoming frame
  10669. @end table
  10670. Default value is @samp{frame}.
  10671. @item shortest
  10672. See @ref{framesync}.
  10673. @item format
  10674. Set the format for the output video.
  10675. It accepts the following values:
  10676. @table @samp
  10677. @item yuv420
  10678. force YUV420 output
  10679. @item yuv422
  10680. force YUV422 output
  10681. @item yuv444
  10682. force YUV444 output
  10683. @item rgb
  10684. force packed RGB output
  10685. @item gbrp
  10686. force planar RGB output
  10687. @item auto
  10688. automatically pick format
  10689. @end table
  10690. Default value is @samp{yuv420}.
  10691. @item repeatlast
  10692. See @ref{framesync}.
  10693. @item alpha
  10694. Set format of alpha of the overlaid video, it can be @var{straight} or
  10695. @var{premultiplied}. Default is @var{straight}.
  10696. @end table
  10697. The @option{x}, and @option{y} expressions can contain the following
  10698. parameters.
  10699. @table @option
  10700. @item main_w, W
  10701. @item main_h, H
  10702. The main input width and height.
  10703. @item overlay_w, w
  10704. @item overlay_h, h
  10705. The overlay input width and height.
  10706. @item x
  10707. @item y
  10708. The computed values for @var{x} and @var{y}. They are evaluated for
  10709. each new frame.
  10710. @item hsub
  10711. @item vsub
  10712. horizontal and vertical chroma subsample values of the output
  10713. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10714. @var{vsub} is 1.
  10715. @item n
  10716. the number of input frame, starting from 0
  10717. @item pos
  10718. the position in the file of the input frame, NAN if unknown
  10719. @item t
  10720. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10721. @end table
  10722. This filter also supports the @ref{framesync} options.
  10723. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10724. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10725. when @option{eval} is set to @samp{init}.
  10726. Be aware that frames are taken from each input video in timestamp
  10727. order, hence, if their initial timestamps differ, it is a good idea
  10728. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10729. have them begin in the same zero timestamp, as the example for
  10730. the @var{movie} filter does.
  10731. You can chain together more overlays but you should test the
  10732. efficiency of such approach.
  10733. @subsection Commands
  10734. This filter supports the following commands:
  10735. @table @option
  10736. @item x
  10737. @item y
  10738. Modify the x and y of the overlay input.
  10739. The command accepts the same syntax of the corresponding option.
  10740. If the specified expression is not valid, it is kept at its current
  10741. value.
  10742. @end table
  10743. @subsection Examples
  10744. @itemize
  10745. @item
  10746. Draw the overlay at 10 pixels from the bottom right corner of the main
  10747. video:
  10748. @example
  10749. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10750. @end example
  10751. Using named options the example above becomes:
  10752. @example
  10753. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10754. @end example
  10755. @item
  10756. Insert a transparent PNG logo in the bottom left corner of the input,
  10757. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10758. @example
  10759. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10760. @end example
  10761. @item
  10762. Insert 2 different transparent PNG logos (second logo on bottom
  10763. right corner) using the @command{ffmpeg} tool:
  10764. @example
  10765. 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
  10766. @end example
  10767. @item
  10768. Add a transparent color layer on top of the main video; @code{WxH}
  10769. must specify the size of the main input to the overlay filter:
  10770. @example
  10771. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10772. @end example
  10773. @item
  10774. Play an original video and a filtered version (here with the deshake
  10775. filter) side by side using the @command{ffplay} tool:
  10776. @example
  10777. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10778. @end example
  10779. The above command is the same as:
  10780. @example
  10781. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10782. @end example
  10783. @item
  10784. Make a sliding overlay appearing from the left to the right top part of the
  10785. screen starting since time 2:
  10786. @example
  10787. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10788. @end example
  10789. @item
  10790. Compose output by putting two input videos side to side:
  10791. @example
  10792. ffmpeg -i left.avi -i right.avi -filter_complex "
  10793. nullsrc=size=200x100 [background];
  10794. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10795. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10796. [background][left] overlay=shortest=1 [background+left];
  10797. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10798. "
  10799. @end example
  10800. @item
  10801. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10802. @example
  10803. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10804. -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]'
  10805. masked.avi
  10806. @end example
  10807. @item
  10808. Chain several overlays in cascade:
  10809. @example
  10810. nullsrc=s=200x200 [bg];
  10811. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10812. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10813. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10814. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10815. [in3] null, [mid2] overlay=100:100 [out0]
  10816. @end example
  10817. @end itemize
  10818. @section owdenoise
  10819. Apply Overcomplete Wavelet denoiser.
  10820. The filter accepts the following options:
  10821. @table @option
  10822. @item depth
  10823. Set depth.
  10824. Larger depth values will denoise lower frequency components more, but
  10825. slow down filtering.
  10826. Must be an int in the range 8-16, default is @code{8}.
  10827. @item luma_strength, ls
  10828. Set luma strength.
  10829. Must be a double value in the range 0-1000, default is @code{1.0}.
  10830. @item chroma_strength, cs
  10831. Set chroma strength.
  10832. Must be a double value in the range 0-1000, default is @code{1.0}.
  10833. @end table
  10834. @anchor{pad}
  10835. @section pad
  10836. Add paddings to the input image, and place the original input at the
  10837. provided @var{x}, @var{y} coordinates.
  10838. It accepts the following parameters:
  10839. @table @option
  10840. @item width, w
  10841. @item height, h
  10842. Specify an expression for the size of the output image with the
  10843. paddings added. If the value for @var{width} or @var{height} is 0, the
  10844. corresponding input size is used for the output.
  10845. The @var{width} expression can reference the value set by the
  10846. @var{height} expression, and vice versa.
  10847. The default value of @var{width} and @var{height} is 0.
  10848. @item x
  10849. @item y
  10850. Specify the offsets to place the input image at within the padded area,
  10851. with respect to the top/left border of the output image.
  10852. The @var{x} expression can reference the value set by the @var{y}
  10853. expression, and vice versa.
  10854. The default value of @var{x} and @var{y} is 0.
  10855. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10856. so the input image is centered on the padded area.
  10857. @item color
  10858. Specify the color of the padded area. For the syntax of this option,
  10859. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10860. manual,ffmpeg-utils}.
  10861. The default value of @var{color} is "black".
  10862. @item eval
  10863. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10864. It accepts the following values:
  10865. @table @samp
  10866. @item init
  10867. Only evaluate expressions once during the filter initialization or when
  10868. a command is processed.
  10869. @item frame
  10870. Evaluate expressions for each incoming frame.
  10871. @end table
  10872. Default value is @samp{init}.
  10873. @item aspect
  10874. Pad to aspect instead to a resolution.
  10875. @end table
  10876. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10877. options are expressions containing the following constants:
  10878. @table @option
  10879. @item in_w
  10880. @item in_h
  10881. The input video width and height.
  10882. @item iw
  10883. @item ih
  10884. These are the same as @var{in_w} and @var{in_h}.
  10885. @item out_w
  10886. @item out_h
  10887. The output width and height (the size of the padded area), as
  10888. specified by the @var{width} and @var{height} expressions.
  10889. @item ow
  10890. @item oh
  10891. These are the same as @var{out_w} and @var{out_h}.
  10892. @item x
  10893. @item y
  10894. The x and y offsets as specified by the @var{x} and @var{y}
  10895. expressions, or NAN if not yet specified.
  10896. @item a
  10897. same as @var{iw} / @var{ih}
  10898. @item sar
  10899. input sample aspect ratio
  10900. @item dar
  10901. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10902. @item hsub
  10903. @item vsub
  10904. The horizontal and vertical chroma subsample values. For example for the
  10905. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10906. @end table
  10907. @subsection Examples
  10908. @itemize
  10909. @item
  10910. Add paddings with the color "violet" to the input video. The output video
  10911. size is 640x480, and the top-left corner of the input video is placed at
  10912. column 0, row 40
  10913. @example
  10914. pad=640:480:0:40:violet
  10915. @end example
  10916. The example above is equivalent to the following command:
  10917. @example
  10918. pad=width=640:height=480:x=0:y=40:color=violet
  10919. @end example
  10920. @item
  10921. Pad the input to get an output with dimensions increased by 3/2,
  10922. and put the input video at the center of the padded area:
  10923. @example
  10924. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10925. @end example
  10926. @item
  10927. Pad the input to get a squared output with size equal to the maximum
  10928. value between the input width and height, and put the input video at
  10929. the center of the padded area:
  10930. @example
  10931. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10932. @end example
  10933. @item
  10934. Pad the input to get a final w/h ratio of 16:9:
  10935. @example
  10936. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10937. @end example
  10938. @item
  10939. In case of anamorphic video, in order to set the output display aspect
  10940. correctly, it is necessary to use @var{sar} in the expression,
  10941. according to the relation:
  10942. @example
  10943. (ih * X / ih) * sar = output_dar
  10944. X = output_dar / sar
  10945. @end example
  10946. Thus the previous example needs to be modified to:
  10947. @example
  10948. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10949. @end example
  10950. @item
  10951. Double the output size and put the input video in the bottom-right
  10952. corner of the output padded area:
  10953. @example
  10954. pad="2*iw:2*ih:ow-iw:oh-ih"
  10955. @end example
  10956. @end itemize
  10957. @anchor{palettegen}
  10958. @section palettegen
  10959. Generate one palette for a whole video stream.
  10960. It accepts the following options:
  10961. @table @option
  10962. @item max_colors
  10963. Set the maximum number of colors to quantize in the palette.
  10964. Note: the palette will still contain 256 colors; the unused palette entries
  10965. will be black.
  10966. @item reserve_transparent
  10967. Create a palette of 255 colors maximum and reserve the last one for
  10968. transparency. Reserving the transparency color is useful for GIF optimization.
  10969. If not set, the maximum of colors in the palette will be 256. You probably want
  10970. to disable this option for a standalone image.
  10971. Set by default.
  10972. @item transparency_color
  10973. Set the color that will be used as background for transparency.
  10974. @item stats_mode
  10975. Set statistics mode.
  10976. It accepts the following values:
  10977. @table @samp
  10978. @item full
  10979. Compute full frame histograms.
  10980. @item diff
  10981. Compute histograms only for the part that differs from previous frame. This
  10982. might be relevant to give more importance to the moving part of your input if
  10983. the background is static.
  10984. @item single
  10985. Compute new histogram for each frame.
  10986. @end table
  10987. Default value is @var{full}.
  10988. @end table
  10989. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10990. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10991. color quantization of the palette. This information is also visible at
  10992. @var{info} logging level.
  10993. @subsection Examples
  10994. @itemize
  10995. @item
  10996. Generate a representative palette of a given video using @command{ffmpeg}:
  10997. @example
  10998. ffmpeg -i input.mkv -vf palettegen palette.png
  10999. @end example
  11000. @end itemize
  11001. @section paletteuse
  11002. Use a palette to downsample an input video stream.
  11003. The filter takes two inputs: one video stream and a palette. The palette must
  11004. be a 256 pixels image.
  11005. It accepts the following options:
  11006. @table @option
  11007. @item dither
  11008. Select dithering mode. Available algorithms are:
  11009. @table @samp
  11010. @item bayer
  11011. Ordered 8x8 bayer dithering (deterministic)
  11012. @item heckbert
  11013. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11014. Note: this dithering is sometimes considered "wrong" and is included as a
  11015. reference.
  11016. @item floyd_steinberg
  11017. Floyd and Steingberg dithering (error diffusion)
  11018. @item sierra2
  11019. Frankie Sierra dithering v2 (error diffusion)
  11020. @item sierra2_4a
  11021. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11022. @end table
  11023. Default is @var{sierra2_4a}.
  11024. @item bayer_scale
  11025. When @var{bayer} dithering is selected, this option defines the scale of the
  11026. pattern (how much the crosshatch pattern is visible). A low value means more
  11027. visible pattern for less banding, and higher value means less visible pattern
  11028. at the cost of more banding.
  11029. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11030. @item diff_mode
  11031. If set, define the zone to process
  11032. @table @samp
  11033. @item rectangle
  11034. Only the changing rectangle will be reprocessed. This is similar to GIF
  11035. cropping/offsetting compression mechanism. This option can be useful for speed
  11036. if only a part of the image is changing, and has use cases such as limiting the
  11037. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11038. moving scene (it leads to more deterministic output if the scene doesn't change
  11039. much, and as a result less moving noise and better GIF compression).
  11040. @end table
  11041. Default is @var{none}.
  11042. @item new
  11043. Take new palette for each output frame.
  11044. @item alpha_threshold
  11045. Sets the alpha threshold for transparency. Alpha values above this threshold
  11046. will be treated as completely opaque, and values below this threshold will be
  11047. treated as completely transparent.
  11048. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11049. @end table
  11050. @subsection Examples
  11051. @itemize
  11052. @item
  11053. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11054. using @command{ffmpeg}:
  11055. @example
  11056. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11057. @end example
  11058. @end itemize
  11059. @section perspective
  11060. Correct perspective of video not recorded perpendicular to the screen.
  11061. A description of the accepted parameters follows.
  11062. @table @option
  11063. @item x0
  11064. @item y0
  11065. @item x1
  11066. @item y1
  11067. @item x2
  11068. @item y2
  11069. @item x3
  11070. @item y3
  11071. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11072. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11073. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11074. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11075. then the corners of the source will be sent to the specified coordinates.
  11076. The expressions can use the following variables:
  11077. @table @option
  11078. @item W
  11079. @item H
  11080. the width and height of video frame.
  11081. @item in
  11082. Input frame count.
  11083. @item on
  11084. Output frame count.
  11085. @end table
  11086. @item interpolation
  11087. Set interpolation for perspective correction.
  11088. It accepts the following values:
  11089. @table @samp
  11090. @item linear
  11091. @item cubic
  11092. @end table
  11093. Default value is @samp{linear}.
  11094. @item sense
  11095. Set interpretation of coordinate options.
  11096. It accepts the following values:
  11097. @table @samp
  11098. @item 0, source
  11099. Send point in the source specified by the given coordinates to
  11100. the corners of the destination.
  11101. @item 1, destination
  11102. Send the corners of the source to the point in the destination specified
  11103. by the given coordinates.
  11104. Default value is @samp{source}.
  11105. @end table
  11106. @item eval
  11107. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11108. It accepts the following values:
  11109. @table @samp
  11110. @item init
  11111. only evaluate expressions once during the filter initialization or
  11112. when a command is processed
  11113. @item frame
  11114. evaluate expressions for each incoming frame
  11115. @end table
  11116. Default value is @samp{init}.
  11117. @end table
  11118. @section phase
  11119. Delay interlaced video by one field time so that the field order changes.
  11120. The intended use is to fix PAL movies that have been captured with the
  11121. opposite field order to the film-to-video transfer.
  11122. A description of the accepted parameters follows.
  11123. @table @option
  11124. @item mode
  11125. Set phase mode.
  11126. It accepts the following values:
  11127. @table @samp
  11128. @item t
  11129. Capture field order top-first, transfer bottom-first.
  11130. Filter will delay the bottom field.
  11131. @item b
  11132. Capture field order bottom-first, transfer top-first.
  11133. Filter will delay the top field.
  11134. @item p
  11135. Capture and transfer with the same field order. This mode only exists
  11136. for the documentation of the other options to refer to, but if you
  11137. actually select it, the filter will faithfully do nothing.
  11138. @item a
  11139. Capture field order determined automatically by field flags, transfer
  11140. opposite.
  11141. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11142. basis using field flags. If no field information is available,
  11143. then this works just like @samp{u}.
  11144. @item u
  11145. Capture unknown or varying, transfer opposite.
  11146. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11147. analyzing the images and selecting the alternative that produces best
  11148. match between the fields.
  11149. @item T
  11150. Capture top-first, transfer unknown or varying.
  11151. Filter selects among @samp{t} and @samp{p} using image analysis.
  11152. @item B
  11153. Capture bottom-first, transfer unknown or varying.
  11154. Filter selects among @samp{b} and @samp{p} using image analysis.
  11155. @item A
  11156. Capture determined by field flags, transfer unknown or varying.
  11157. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11158. image analysis. If no field information is available, then this works just
  11159. like @samp{U}. This is the default mode.
  11160. @item U
  11161. Both capture and transfer unknown or varying.
  11162. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11163. @end table
  11164. @end table
  11165. @section photosensitivity
  11166. Reduce various flashes in video, so to help users with epilepsy.
  11167. It accepts the following options:
  11168. @table @option
  11169. @item frames, f
  11170. Set how many frames to use when filtering. Default is 30.
  11171. @item threshold, t
  11172. Set detection threshold factor. Default is 1.
  11173. Lower is stricter.
  11174. @item skip
  11175. Set how many pixels to skip when sampling frames. Default is 1.
  11176. Allowed range is from 1 to 1024.
  11177. @item bypass
  11178. Leave frames unchanged. Default is disabled.
  11179. @end table
  11180. @section pixdesctest
  11181. Pixel format descriptor test filter, mainly useful for internal
  11182. testing. The output video should be equal to the input video.
  11183. For example:
  11184. @example
  11185. format=monow, pixdesctest
  11186. @end example
  11187. can be used to test the monowhite pixel format descriptor definition.
  11188. @section pixscope
  11189. Display sample values of color channels. Mainly useful for checking color
  11190. and levels. Minimum supported resolution is 640x480.
  11191. The filters accept the following options:
  11192. @table @option
  11193. @item x
  11194. Set scope X position, relative offset on X axis.
  11195. @item y
  11196. Set scope Y position, relative offset on Y axis.
  11197. @item w
  11198. Set scope width.
  11199. @item h
  11200. Set scope height.
  11201. @item o
  11202. Set window opacity. This window also holds statistics about pixel area.
  11203. @item wx
  11204. Set window X position, relative offset on X axis.
  11205. @item wy
  11206. Set window Y position, relative offset on Y axis.
  11207. @end table
  11208. @section pp
  11209. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11210. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11211. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11212. Each subfilter and some options have a short and a long name that can be used
  11213. interchangeably, i.e. dr/dering are the same.
  11214. The filters accept the following options:
  11215. @table @option
  11216. @item subfilters
  11217. Set postprocessing subfilters string.
  11218. @end table
  11219. All subfilters share common options to determine their scope:
  11220. @table @option
  11221. @item a/autoq
  11222. Honor the quality commands for this subfilter.
  11223. @item c/chrom
  11224. Do chrominance filtering, too (default).
  11225. @item y/nochrom
  11226. Do luminance filtering only (no chrominance).
  11227. @item n/noluma
  11228. Do chrominance filtering only (no luminance).
  11229. @end table
  11230. These options can be appended after the subfilter name, separated by a '|'.
  11231. Available subfilters are:
  11232. @table @option
  11233. @item hb/hdeblock[|difference[|flatness]]
  11234. Horizontal deblocking filter
  11235. @table @option
  11236. @item difference
  11237. Difference factor where higher values mean more deblocking (default: @code{32}).
  11238. @item flatness
  11239. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11240. @end table
  11241. @item vb/vdeblock[|difference[|flatness]]
  11242. Vertical deblocking filter
  11243. @table @option
  11244. @item difference
  11245. Difference factor where higher values mean more deblocking (default: @code{32}).
  11246. @item flatness
  11247. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11248. @end table
  11249. @item ha/hadeblock[|difference[|flatness]]
  11250. Accurate horizontal deblocking filter
  11251. @table @option
  11252. @item difference
  11253. Difference factor where higher values mean more deblocking (default: @code{32}).
  11254. @item flatness
  11255. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11256. @end table
  11257. @item va/vadeblock[|difference[|flatness]]
  11258. Accurate vertical deblocking filter
  11259. @table @option
  11260. @item difference
  11261. Difference factor where higher values mean more deblocking (default: @code{32}).
  11262. @item flatness
  11263. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11264. @end table
  11265. @end table
  11266. The horizontal and vertical deblocking filters share the difference and
  11267. flatness values so you cannot set different horizontal and vertical
  11268. thresholds.
  11269. @table @option
  11270. @item h1/x1hdeblock
  11271. Experimental horizontal deblocking filter
  11272. @item v1/x1vdeblock
  11273. Experimental vertical deblocking filter
  11274. @item dr/dering
  11275. Deringing filter
  11276. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11277. @table @option
  11278. @item threshold1
  11279. larger -> stronger filtering
  11280. @item threshold2
  11281. larger -> stronger filtering
  11282. @item threshold3
  11283. larger -> stronger filtering
  11284. @end table
  11285. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11286. @table @option
  11287. @item f/fullyrange
  11288. Stretch luminance to @code{0-255}.
  11289. @end table
  11290. @item lb/linblenddeint
  11291. Linear blend deinterlacing filter that deinterlaces the given block by
  11292. filtering all lines with a @code{(1 2 1)} filter.
  11293. @item li/linipoldeint
  11294. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11295. linearly interpolating every second line.
  11296. @item ci/cubicipoldeint
  11297. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11298. cubically interpolating every second line.
  11299. @item md/mediandeint
  11300. Median deinterlacing filter that deinterlaces the given block by applying a
  11301. median filter to every second line.
  11302. @item fd/ffmpegdeint
  11303. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11304. second line with a @code{(-1 4 2 4 -1)} filter.
  11305. @item l5/lowpass5
  11306. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11307. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11308. @item fq/forceQuant[|quantizer]
  11309. Overrides the quantizer table from the input with the constant quantizer you
  11310. specify.
  11311. @table @option
  11312. @item quantizer
  11313. Quantizer to use
  11314. @end table
  11315. @item de/default
  11316. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11317. @item fa/fast
  11318. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11319. @item ac
  11320. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11321. @end table
  11322. @subsection Examples
  11323. @itemize
  11324. @item
  11325. Apply horizontal and vertical deblocking, deringing and automatic
  11326. brightness/contrast:
  11327. @example
  11328. pp=hb/vb/dr/al
  11329. @end example
  11330. @item
  11331. Apply default filters without brightness/contrast correction:
  11332. @example
  11333. pp=de/-al
  11334. @end example
  11335. @item
  11336. Apply default filters and temporal denoiser:
  11337. @example
  11338. pp=default/tmpnoise|1|2|3
  11339. @end example
  11340. @item
  11341. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11342. automatically depending on available CPU time:
  11343. @example
  11344. pp=hb|y/vb|a
  11345. @end example
  11346. @end itemize
  11347. @section pp7
  11348. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11349. similar to spp = 6 with 7 point DCT, where only the center sample is
  11350. used after IDCT.
  11351. The filter accepts the following options:
  11352. @table @option
  11353. @item qp
  11354. Force a constant quantization parameter. It accepts an integer in range
  11355. 0 to 63. If not set, the filter will use the QP from the video stream
  11356. (if available).
  11357. @item mode
  11358. Set thresholding mode. Available modes are:
  11359. @table @samp
  11360. @item hard
  11361. Set hard thresholding.
  11362. @item soft
  11363. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11364. @item medium
  11365. Set medium thresholding (good results, default).
  11366. @end table
  11367. @end table
  11368. @section premultiply
  11369. Apply alpha premultiply effect to input video stream using first plane
  11370. of second stream as alpha.
  11371. Both streams must have same dimensions and same pixel format.
  11372. The filter accepts the following option:
  11373. @table @option
  11374. @item planes
  11375. Set which planes will be processed, unprocessed planes will be copied.
  11376. By default value 0xf, all planes will be processed.
  11377. @item inplace
  11378. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11379. @end table
  11380. @section prewitt
  11381. Apply prewitt operator to input video stream.
  11382. The filter accepts the following option:
  11383. @table @option
  11384. @item planes
  11385. Set which planes will be processed, unprocessed planes will be copied.
  11386. By default value 0xf, all planes will be processed.
  11387. @item scale
  11388. Set value which will be multiplied with filtered result.
  11389. @item delta
  11390. Set value which will be added to filtered result.
  11391. @end table
  11392. @anchor{program_opencl}
  11393. @section program_opencl
  11394. Filter video using an OpenCL program.
  11395. @table @option
  11396. @item source
  11397. OpenCL program source file.
  11398. @item kernel
  11399. Kernel name in program.
  11400. @item inputs
  11401. Number of inputs to the filter. Defaults to 1.
  11402. @item size, s
  11403. Size of output frames. Defaults to the same as the first input.
  11404. @end table
  11405. The program source file must contain a kernel function with the given name,
  11406. which will be run once for each plane of the output. Each run on a plane
  11407. gets enqueued as a separate 2D global NDRange with one work-item for each
  11408. pixel to be generated. The global ID offset for each work-item is therefore
  11409. the coordinates of a pixel in the destination image.
  11410. The kernel function needs to take the following arguments:
  11411. @itemize
  11412. @item
  11413. Destination image, @var{__write_only image2d_t}.
  11414. This image will become the output; the kernel should write all of it.
  11415. @item
  11416. Frame index, @var{unsigned int}.
  11417. This is a counter starting from zero and increasing by one for each frame.
  11418. @item
  11419. Source images, @var{__read_only image2d_t}.
  11420. These are the most recent images on each input. The kernel may read from
  11421. them to generate the output, but they can't be written to.
  11422. @end itemize
  11423. Example programs:
  11424. @itemize
  11425. @item
  11426. Copy the input to the output (output must be the same size as the input).
  11427. @verbatim
  11428. __kernel void copy(__write_only image2d_t destination,
  11429. unsigned int index,
  11430. __read_only image2d_t source)
  11431. {
  11432. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11433. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11434. float4 value = read_imagef(source, sampler, location);
  11435. write_imagef(destination, location, value);
  11436. }
  11437. @end verbatim
  11438. @item
  11439. Apply a simple transformation, rotating the input by an amount increasing
  11440. with the index counter. Pixel values are linearly interpolated by the
  11441. sampler, and the output need not have the same dimensions as the input.
  11442. @verbatim
  11443. __kernel void rotate_image(__write_only image2d_t dst,
  11444. unsigned int index,
  11445. __read_only image2d_t src)
  11446. {
  11447. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11448. CLK_FILTER_LINEAR);
  11449. float angle = (float)index / 100.0f;
  11450. float2 dst_dim = convert_float2(get_image_dim(dst));
  11451. float2 src_dim = convert_float2(get_image_dim(src));
  11452. float2 dst_cen = dst_dim / 2.0f;
  11453. float2 src_cen = src_dim / 2.0f;
  11454. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11455. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11456. float2 src_pos = {
  11457. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11458. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11459. };
  11460. src_pos = src_pos * src_dim / dst_dim;
  11461. float2 src_loc = src_pos + src_cen;
  11462. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11463. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11464. write_imagef(dst, dst_loc, 0.5f);
  11465. else
  11466. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11467. }
  11468. @end verbatim
  11469. @item
  11470. Blend two inputs together, with the amount of each input used varying
  11471. with the index counter.
  11472. @verbatim
  11473. __kernel void blend_images(__write_only image2d_t dst,
  11474. unsigned int index,
  11475. __read_only image2d_t src1,
  11476. __read_only image2d_t src2)
  11477. {
  11478. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11479. CLK_FILTER_LINEAR);
  11480. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11481. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11482. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11483. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11484. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11485. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11486. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11487. }
  11488. @end verbatim
  11489. @end itemize
  11490. @section pseudocolor
  11491. Alter frame colors in video with pseudocolors.
  11492. This filter accepts the following options:
  11493. @table @option
  11494. @item c0
  11495. set pixel first component expression
  11496. @item c1
  11497. set pixel second component expression
  11498. @item c2
  11499. set pixel third component expression
  11500. @item c3
  11501. set pixel fourth component expression, corresponds to the alpha component
  11502. @item i
  11503. set component to use as base for altering colors
  11504. @end table
  11505. Each of them specifies the expression to use for computing the lookup table for
  11506. the corresponding pixel component values.
  11507. The expressions can contain the following constants and functions:
  11508. @table @option
  11509. @item w
  11510. @item h
  11511. The input width and height.
  11512. @item val
  11513. The input value for the pixel component.
  11514. @item ymin, umin, vmin, amin
  11515. The minimum allowed component value.
  11516. @item ymax, umax, vmax, amax
  11517. The maximum allowed component value.
  11518. @end table
  11519. All expressions default to "val".
  11520. @subsection Examples
  11521. @itemize
  11522. @item
  11523. Change too high luma values to gradient:
  11524. @example
  11525. 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'"
  11526. @end example
  11527. @end itemize
  11528. @section psnr
  11529. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11530. Ratio) between two input videos.
  11531. This filter takes in input two input videos, the first input is
  11532. considered the "main" source and is passed unchanged to the
  11533. output. The second input is used as a "reference" video for computing
  11534. the PSNR.
  11535. Both video inputs must have the same resolution and pixel format for
  11536. this filter to work correctly. Also it assumes that both inputs
  11537. have the same number of frames, which are compared one by one.
  11538. The obtained average PSNR is printed through the logging system.
  11539. The filter stores the accumulated MSE (mean squared error) of each
  11540. frame, and at the end of the processing it is averaged across all frames
  11541. equally, and the following formula is applied to obtain the PSNR:
  11542. @example
  11543. PSNR = 10*log10(MAX^2/MSE)
  11544. @end example
  11545. Where MAX is the average of the maximum values of each component of the
  11546. image.
  11547. The description of the accepted parameters follows.
  11548. @table @option
  11549. @item stats_file, f
  11550. If specified the filter will use the named file to save the PSNR of
  11551. each individual frame. When filename equals "-" the data is sent to
  11552. standard output.
  11553. @item stats_version
  11554. Specifies which version of the stats file format to use. Details of
  11555. each format are written below.
  11556. Default value is 1.
  11557. @item stats_add_max
  11558. Determines whether the max value is output to the stats log.
  11559. Default value is 0.
  11560. Requires stats_version >= 2. If this is set and stats_version < 2,
  11561. the filter will return an error.
  11562. @end table
  11563. This filter also supports the @ref{framesync} options.
  11564. The file printed if @var{stats_file} is selected, contains a sequence of
  11565. key/value pairs of the form @var{key}:@var{value} for each compared
  11566. couple of frames.
  11567. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11568. the list of per-frame-pair stats, with key value pairs following the frame
  11569. format with the following parameters:
  11570. @table @option
  11571. @item psnr_log_version
  11572. The version of the log file format. Will match @var{stats_version}.
  11573. @item fields
  11574. A comma separated list of the per-frame-pair parameters included in
  11575. the log.
  11576. @end table
  11577. A description of each shown per-frame-pair parameter follows:
  11578. @table @option
  11579. @item n
  11580. sequential number of the input frame, starting from 1
  11581. @item mse_avg
  11582. Mean Square Error pixel-by-pixel average difference of the compared
  11583. frames, averaged over all the image components.
  11584. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11585. Mean Square Error pixel-by-pixel average difference of the compared
  11586. frames for the component specified by the suffix.
  11587. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11588. Peak Signal to Noise ratio of the compared frames for the component
  11589. specified by the suffix.
  11590. @item max_avg, max_y, max_u, max_v
  11591. Maximum allowed value for each channel, and average over all
  11592. channels.
  11593. @end table
  11594. @subsection Examples
  11595. @itemize
  11596. @item
  11597. For example:
  11598. @example
  11599. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11600. [main][ref] psnr="stats_file=stats.log" [out]
  11601. @end example
  11602. On this example the input file being processed is compared with the
  11603. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11604. is stored in @file{stats.log}.
  11605. @item
  11606. Another example with different containers:
  11607. @example
  11608. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  11609. @end example
  11610. @end itemize
  11611. @anchor{pullup}
  11612. @section pullup
  11613. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11614. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11615. content.
  11616. The pullup filter is designed to take advantage of future context in making
  11617. its decisions. This filter is stateless in the sense that it does not lock
  11618. onto a pattern to follow, but it instead looks forward to the following
  11619. fields in order to identify matches and rebuild progressive frames.
  11620. To produce content with an even framerate, insert the fps filter after
  11621. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11622. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11623. The filter accepts the following options:
  11624. @table @option
  11625. @item jl
  11626. @item jr
  11627. @item jt
  11628. @item jb
  11629. These options set the amount of "junk" to ignore at the left, right, top, and
  11630. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11631. while top and bottom are in units of 2 lines.
  11632. The default is 8 pixels on each side.
  11633. @item sb
  11634. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11635. filter generating an occasional mismatched frame, but it may also cause an
  11636. excessive number of frames to be dropped during high motion sequences.
  11637. Conversely, setting it to -1 will make filter match fields more easily.
  11638. This may help processing of video where there is slight blurring between
  11639. the fields, but may also cause there to be interlaced frames in the output.
  11640. Default value is @code{0}.
  11641. @item mp
  11642. Set the metric plane to use. It accepts the following values:
  11643. @table @samp
  11644. @item l
  11645. Use luma plane.
  11646. @item u
  11647. Use chroma blue plane.
  11648. @item v
  11649. Use chroma red plane.
  11650. @end table
  11651. This option may be set to use chroma plane instead of the default luma plane
  11652. for doing filter's computations. This may improve accuracy on very clean
  11653. source material, but more likely will decrease accuracy, especially if there
  11654. is chroma noise (rainbow effect) or any grayscale video.
  11655. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11656. load and make pullup usable in realtime on slow machines.
  11657. @end table
  11658. For best results (without duplicated frames in the output file) it is
  11659. necessary to change the output frame rate. For example, to inverse
  11660. telecine NTSC input:
  11661. @example
  11662. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11663. @end example
  11664. @section qp
  11665. Change video quantization parameters (QP).
  11666. The filter accepts the following option:
  11667. @table @option
  11668. @item qp
  11669. Set expression for quantization parameter.
  11670. @end table
  11671. The expression is evaluated through the eval API and can contain, among others,
  11672. the following constants:
  11673. @table @var
  11674. @item known
  11675. 1 if index is not 129, 0 otherwise.
  11676. @item qp
  11677. Sequential index starting from -129 to 128.
  11678. @end table
  11679. @subsection Examples
  11680. @itemize
  11681. @item
  11682. Some equation like:
  11683. @example
  11684. qp=2+2*sin(PI*qp)
  11685. @end example
  11686. @end itemize
  11687. @section random
  11688. Flush video frames from internal cache of frames into a random order.
  11689. No frame is discarded.
  11690. Inspired by @ref{frei0r} nervous filter.
  11691. @table @option
  11692. @item frames
  11693. Set size in number of frames of internal cache, in range from @code{2} to
  11694. @code{512}. Default is @code{30}.
  11695. @item seed
  11696. Set seed for random number generator, must be an integer included between
  11697. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11698. less than @code{0}, the filter will try to use a good random seed on a
  11699. best effort basis.
  11700. @end table
  11701. @section readeia608
  11702. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11703. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11704. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11705. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11706. @table @option
  11707. @item lavfi.readeia608.X.cc
  11708. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11709. @item lavfi.readeia608.X.line
  11710. The number of the line on which the EIA-608 data was identified and read.
  11711. @end table
  11712. This filter accepts the following options:
  11713. @table @option
  11714. @item scan_min
  11715. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11716. @item scan_max
  11717. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11718. @item spw
  11719. Set the ratio of width reserved for sync code detection.
  11720. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11721. @item chp
  11722. Enable checking the parity bit. In the event of a parity error, the filter will output
  11723. @code{0x00} for that character. Default is false.
  11724. @item lp
  11725. Lowpass lines prior to further processing. Default is enabled.
  11726. @end table
  11727. @subsection Examples
  11728. @itemize
  11729. @item
  11730. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11731. @example
  11732. 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
  11733. @end example
  11734. @end itemize
  11735. @section readvitc
  11736. Read vertical interval timecode (VITC) information from the top lines of a
  11737. video frame.
  11738. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11739. timecode value, if a valid timecode has been detected. Further metadata key
  11740. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11741. timecode data has been found or not.
  11742. This filter accepts the following options:
  11743. @table @option
  11744. @item scan_max
  11745. Set the maximum number of lines to scan for VITC data. If the value is set to
  11746. @code{-1} the full video frame is scanned. Default is @code{45}.
  11747. @item thr_b
  11748. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11749. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11750. @item thr_w
  11751. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11752. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11753. @end table
  11754. @subsection Examples
  11755. @itemize
  11756. @item
  11757. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11758. draw @code{--:--:--:--} as a placeholder:
  11759. @example
  11760. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11761. @end example
  11762. @end itemize
  11763. @section remap
  11764. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11765. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11766. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11767. value for pixel will be used for destination pixel.
  11768. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11769. will have Xmap/Ymap video stream dimensions.
  11770. Xmap and Ymap input video streams are 16bit depth, single channel.
  11771. @table @option
  11772. @item format
  11773. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11774. Default is @code{color}.
  11775. @end table
  11776. @section removegrain
  11777. The removegrain filter is a spatial denoiser for progressive video.
  11778. @table @option
  11779. @item m0
  11780. Set mode for the first plane.
  11781. @item m1
  11782. Set mode for the second plane.
  11783. @item m2
  11784. Set mode for the third plane.
  11785. @item m3
  11786. Set mode for the fourth plane.
  11787. @end table
  11788. Range of mode is from 0 to 24. Description of each mode follows:
  11789. @table @var
  11790. @item 0
  11791. Leave input plane unchanged. Default.
  11792. @item 1
  11793. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11794. @item 2
  11795. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11796. @item 3
  11797. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11798. @item 4
  11799. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11800. This is equivalent to a median filter.
  11801. @item 5
  11802. Line-sensitive clipping giving the minimal change.
  11803. @item 6
  11804. Line-sensitive clipping, intermediate.
  11805. @item 7
  11806. Line-sensitive clipping, intermediate.
  11807. @item 8
  11808. Line-sensitive clipping, intermediate.
  11809. @item 9
  11810. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11811. @item 10
  11812. Replaces the target pixel with the closest neighbour.
  11813. @item 11
  11814. [1 2 1] horizontal and vertical kernel blur.
  11815. @item 12
  11816. Same as mode 11.
  11817. @item 13
  11818. Bob mode, interpolates top field from the line where the neighbours
  11819. pixels are the closest.
  11820. @item 14
  11821. Bob mode, interpolates bottom field from the line where the neighbours
  11822. pixels are the closest.
  11823. @item 15
  11824. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11825. interpolation formula.
  11826. @item 16
  11827. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11828. interpolation formula.
  11829. @item 17
  11830. Clips the pixel with the minimum and maximum of respectively the maximum and
  11831. minimum of each pair of opposite neighbour pixels.
  11832. @item 18
  11833. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11834. the current pixel is minimal.
  11835. @item 19
  11836. Replaces the pixel with the average of its 8 neighbours.
  11837. @item 20
  11838. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11839. @item 21
  11840. Clips pixels using the averages of opposite neighbour.
  11841. @item 22
  11842. Same as mode 21 but simpler and faster.
  11843. @item 23
  11844. Small edge and halo removal, but reputed useless.
  11845. @item 24
  11846. Similar as 23.
  11847. @end table
  11848. @section removelogo
  11849. Suppress a TV station logo, using an image file to determine which
  11850. pixels comprise the logo. It works by filling in the pixels that
  11851. comprise the logo with neighboring pixels.
  11852. The filter accepts the following options:
  11853. @table @option
  11854. @item filename, f
  11855. Set the filter bitmap file, which can be any image format supported by
  11856. libavformat. The width and height of the image file must match those of the
  11857. video stream being processed.
  11858. @end table
  11859. Pixels in the provided bitmap image with a value of zero are not
  11860. considered part of the logo, non-zero pixels are considered part of
  11861. the logo. If you use white (255) for the logo and black (0) for the
  11862. rest, you will be safe. For making the filter bitmap, it is
  11863. recommended to take a screen capture of a black frame with the logo
  11864. visible, and then using a threshold filter followed by the erode
  11865. filter once or twice.
  11866. If needed, little splotches can be fixed manually. Remember that if
  11867. logo pixels are not covered, the filter quality will be much
  11868. reduced. Marking too many pixels as part of the logo does not hurt as
  11869. much, but it will increase the amount of blurring needed to cover over
  11870. the image and will destroy more information than necessary, and extra
  11871. pixels will slow things down on a large logo.
  11872. @section repeatfields
  11873. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11874. fields based on its value.
  11875. @section reverse
  11876. Reverse a video clip.
  11877. Warning: This filter requires memory to buffer the entire clip, so trimming
  11878. is suggested.
  11879. @subsection Examples
  11880. @itemize
  11881. @item
  11882. Take the first 5 seconds of a clip, and reverse it.
  11883. @example
  11884. trim=end=5,reverse
  11885. @end example
  11886. @end itemize
  11887. @section rgbashift
  11888. Shift R/G/B/A pixels horizontally and/or vertically.
  11889. The filter accepts the following options:
  11890. @table @option
  11891. @item rh
  11892. Set amount to shift red horizontally.
  11893. @item rv
  11894. Set amount to shift red vertically.
  11895. @item gh
  11896. Set amount to shift green horizontally.
  11897. @item gv
  11898. Set amount to shift green vertically.
  11899. @item bh
  11900. Set amount to shift blue horizontally.
  11901. @item bv
  11902. Set amount to shift blue vertically.
  11903. @item ah
  11904. Set amount to shift alpha horizontally.
  11905. @item av
  11906. Set amount to shift alpha vertically.
  11907. @item edge
  11908. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11909. @end table
  11910. @subsection Commands
  11911. This filter supports the all above options as @ref{commands}.
  11912. @section roberts
  11913. Apply roberts cross operator to input video stream.
  11914. The filter accepts the following option:
  11915. @table @option
  11916. @item planes
  11917. Set which planes will be processed, unprocessed planes will be copied.
  11918. By default value 0xf, all planes will be processed.
  11919. @item scale
  11920. Set value which will be multiplied with filtered result.
  11921. @item delta
  11922. Set value which will be added to filtered result.
  11923. @end table
  11924. @section rotate
  11925. Rotate video by an arbitrary angle expressed in radians.
  11926. The filter accepts the following options:
  11927. A description of the optional parameters follows.
  11928. @table @option
  11929. @item angle, a
  11930. Set an expression for the angle by which to rotate the input video
  11931. clockwise, expressed as a number of radians. A negative value will
  11932. result in a counter-clockwise rotation. By default it is set to "0".
  11933. This expression is evaluated for each frame.
  11934. @item out_w, ow
  11935. Set the output width expression, default value is "iw".
  11936. This expression is evaluated just once during configuration.
  11937. @item out_h, oh
  11938. Set the output height expression, default value is "ih".
  11939. This expression is evaluated just once during configuration.
  11940. @item bilinear
  11941. Enable bilinear interpolation if set to 1, a value of 0 disables
  11942. it. Default value is 1.
  11943. @item fillcolor, c
  11944. Set the color used to fill the output area not covered by the rotated
  11945. image. For the general syntax of this option, check the
  11946. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11947. If the special value "none" is selected then no
  11948. background is printed (useful for example if the background is never shown).
  11949. Default value is "black".
  11950. @end table
  11951. The expressions for the angle and the output size can contain the
  11952. following constants and functions:
  11953. @table @option
  11954. @item n
  11955. sequential number of the input frame, starting from 0. It is always NAN
  11956. before the first frame is filtered.
  11957. @item t
  11958. time in seconds of the input frame, it is set to 0 when the filter is
  11959. configured. It is always NAN before the first frame is filtered.
  11960. @item hsub
  11961. @item vsub
  11962. horizontal and vertical chroma subsample values. For example for the
  11963. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11964. @item in_w, iw
  11965. @item in_h, ih
  11966. the input video width and height
  11967. @item out_w, ow
  11968. @item out_h, oh
  11969. the output width and height, that is the size of the padded area as
  11970. specified by the @var{width} and @var{height} expressions
  11971. @item rotw(a)
  11972. @item roth(a)
  11973. the minimal width/height required for completely containing the input
  11974. video rotated by @var{a} radians.
  11975. These are only available when computing the @option{out_w} and
  11976. @option{out_h} expressions.
  11977. @end table
  11978. @subsection Examples
  11979. @itemize
  11980. @item
  11981. Rotate the input by PI/6 radians clockwise:
  11982. @example
  11983. rotate=PI/6
  11984. @end example
  11985. @item
  11986. Rotate the input by PI/6 radians counter-clockwise:
  11987. @example
  11988. rotate=-PI/6
  11989. @end example
  11990. @item
  11991. Rotate the input by 45 degrees clockwise:
  11992. @example
  11993. rotate=45*PI/180
  11994. @end example
  11995. @item
  11996. Apply a constant rotation with period T, starting from an angle of PI/3:
  11997. @example
  11998. rotate=PI/3+2*PI*t/T
  11999. @end example
  12000. @item
  12001. Make the input video rotation oscillating with a period of T
  12002. seconds and an amplitude of A radians:
  12003. @example
  12004. rotate=A*sin(2*PI/T*t)
  12005. @end example
  12006. @item
  12007. Rotate the video, output size is chosen so that the whole rotating
  12008. input video is always completely contained in the output:
  12009. @example
  12010. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12011. @end example
  12012. @item
  12013. Rotate the video, reduce the output size so that no background is ever
  12014. shown:
  12015. @example
  12016. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12017. @end example
  12018. @end itemize
  12019. @subsection Commands
  12020. The filter supports the following commands:
  12021. @table @option
  12022. @item a, angle
  12023. Set the angle expression.
  12024. The command accepts the same syntax of the corresponding option.
  12025. If the specified expression is not valid, it is kept at its current
  12026. value.
  12027. @end table
  12028. @section sab
  12029. Apply Shape Adaptive Blur.
  12030. The filter accepts the following options:
  12031. @table @option
  12032. @item luma_radius, lr
  12033. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12034. value is 1.0. A greater value will result in a more blurred image, and
  12035. in slower processing.
  12036. @item luma_pre_filter_radius, lpfr
  12037. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12038. value is 1.0.
  12039. @item luma_strength, ls
  12040. Set luma maximum difference between pixels to still be considered, must
  12041. be a value in the 0.1-100.0 range, default value is 1.0.
  12042. @item chroma_radius, cr
  12043. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12044. greater value will result in a more blurred image, and in slower
  12045. processing.
  12046. @item chroma_pre_filter_radius, cpfr
  12047. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12048. @item chroma_strength, cs
  12049. Set chroma maximum difference between pixels to still be considered,
  12050. must be a value in the -0.9-100.0 range.
  12051. @end table
  12052. Each chroma option value, if not explicitly specified, is set to the
  12053. corresponding luma option value.
  12054. @anchor{scale}
  12055. @section scale
  12056. Scale (resize) the input video, using the libswscale library.
  12057. The scale filter forces the output display aspect ratio to be the same
  12058. of the input, by changing the output sample aspect ratio.
  12059. If the input image format is different from the format requested by
  12060. the next filter, the scale filter will convert the input to the
  12061. requested format.
  12062. @subsection Options
  12063. The filter accepts the following options, or any of the options
  12064. supported by the libswscale scaler.
  12065. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12066. the complete list of scaler options.
  12067. @table @option
  12068. @item width, w
  12069. @item height, h
  12070. Set the output video dimension expression. Default value is the input
  12071. dimension.
  12072. If the @var{width} or @var{w} value is 0, the input width is used for
  12073. the output. If the @var{height} or @var{h} value is 0, the input height
  12074. is used for the output.
  12075. If one and only one of the values is -n with n >= 1, the scale filter
  12076. will use a value that maintains the aspect ratio of the input image,
  12077. calculated from the other specified dimension. After that it will,
  12078. however, make sure that the calculated dimension is divisible by n and
  12079. adjust the value if necessary.
  12080. If both values are -n with n >= 1, the behavior will be identical to
  12081. both values being set to 0 as previously detailed.
  12082. See below for the list of accepted constants for use in the dimension
  12083. expression.
  12084. @item eval
  12085. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12086. @table @samp
  12087. @item init
  12088. Only evaluate expressions once during the filter initialization or when a command is processed.
  12089. @item frame
  12090. Evaluate expressions for each incoming frame.
  12091. @end table
  12092. Default value is @samp{init}.
  12093. @item interl
  12094. Set the interlacing mode. It accepts the following values:
  12095. @table @samp
  12096. @item 1
  12097. Force interlaced aware scaling.
  12098. @item 0
  12099. Do not apply interlaced scaling.
  12100. @item -1
  12101. Select interlaced aware scaling depending on whether the source frames
  12102. are flagged as interlaced or not.
  12103. @end table
  12104. Default value is @samp{0}.
  12105. @item flags
  12106. Set libswscale scaling flags. See
  12107. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12108. complete list of values. If not explicitly specified the filter applies
  12109. the default flags.
  12110. @item param0, param1
  12111. Set libswscale input parameters for scaling algorithms that need them. See
  12112. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12113. complete documentation. If not explicitly specified the filter applies
  12114. empty parameters.
  12115. @item size, s
  12116. Set the video size. For the syntax of this option, check the
  12117. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12118. @item in_color_matrix
  12119. @item out_color_matrix
  12120. Set in/output YCbCr color space type.
  12121. This allows the autodetected value to be overridden as well as allows forcing
  12122. a specific value used for the output and encoder.
  12123. If not specified, the color space type depends on the pixel format.
  12124. Possible values:
  12125. @table @samp
  12126. @item auto
  12127. Choose automatically.
  12128. @item bt709
  12129. Format conforming to International Telecommunication Union (ITU)
  12130. Recommendation BT.709.
  12131. @item fcc
  12132. Set color space conforming to the United States Federal Communications
  12133. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12134. @item bt601
  12135. @item bt470
  12136. @item smpte170m
  12137. Set color space conforming to:
  12138. @itemize
  12139. @item
  12140. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12141. @item
  12142. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12143. @item
  12144. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12145. @end itemize
  12146. @item smpte240m
  12147. Set color space conforming to SMPTE ST 240:1999.
  12148. @item bt2020
  12149. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12150. @end table
  12151. @item in_range
  12152. @item out_range
  12153. Set in/output YCbCr sample range.
  12154. This allows the autodetected value to be overridden as well as allows forcing
  12155. a specific value used for the output and encoder. If not specified, the
  12156. range depends on the pixel format. Possible values:
  12157. @table @samp
  12158. @item auto/unknown
  12159. Choose automatically.
  12160. @item jpeg/full/pc
  12161. Set full range (0-255 in case of 8-bit luma).
  12162. @item mpeg/limited/tv
  12163. Set "MPEG" range (16-235 in case of 8-bit luma).
  12164. @end table
  12165. @item force_original_aspect_ratio
  12166. Enable decreasing or increasing output video width or height if necessary to
  12167. keep the original aspect ratio. Possible values:
  12168. @table @samp
  12169. @item disable
  12170. Scale the video as specified and disable this feature.
  12171. @item decrease
  12172. The output video dimensions will automatically be decreased if needed.
  12173. @item increase
  12174. The output video dimensions will automatically be increased if needed.
  12175. @end table
  12176. One useful instance of this option is that when you know a specific device's
  12177. maximum allowed resolution, you can use this to limit the output video to
  12178. that, while retaining the aspect ratio. For example, device A allows
  12179. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12180. decrease) and specifying 1280x720 to the command line makes the output
  12181. 1280x533.
  12182. Please note that this is a different thing than specifying -1 for @option{w}
  12183. or @option{h}, you still need to specify the output resolution for this option
  12184. to work.
  12185. @item force_divisible_by
  12186. Ensures that both the output dimensions, width and height, are divisible by the
  12187. given integer when used together with @option{force_original_aspect_ratio}. This
  12188. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12189. This option respects the value set for @option{force_original_aspect_ratio},
  12190. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12191. may be slightly modified.
  12192. This option can be handy if you need to have a video fit within or exceed
  12193. a defined resolution using @option{force_original_aspect_ratio} but also have
  12194. encoder restrictions on width or height divisibility.
  12195. @end table
  12196. The values of the @option{w} and @option{h} options are expressions
  12197. containing the following constants:
  12198. @table @var
  12199. @item in_w
  12200. @item in_h
  12201. The input width and height
  12202. @item iw
  12203. @item ih
  12204. These are the same as @var{in_w} and @var{in_h}.
  12205. @item out_w
  12206. @item out_h
  12207. The output (scaled) width and height
  12208. @item ow
  12209. @item oh
  12210. These are the same as @var{out_w} and @var{out_h}
  12211. @item a
  12212. The same as @var{iw} / @var{ih}
  12213. @item sar
  12214. input sample aspect ratio
  12215. @item dar
  12216. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12217. @item hsub
  12218. @item vsub
  12219. horizontal and vertical input chroma subsample values. For example for the
  12220. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12221. @item ohsub
  12222. @item ovsub
  12223. horizontal and vertical output chroma subsample values. For example for the
  12224. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12225. @end table
  12226. @subsection Examples
  12227. @itemize
  12228. @item
  12229. Scale the input video to a size of 200x100
  12230. @example
  12231. scale=w=200:h=100
  12232. @end example
  12233. This is equivalent to:
  12234. @example
  12235. scale=200:100
  12236. @end example
  12237. or:
  12238. @example
  12239. scale=200x100
  12240. @end example
  12241. @item
  12242. Specify a size abbreviation for the output size:
  12243. @example
  12244. scale=qcif
  12245. @end example
  12246. which can also be written as:
  12247. @example
  12248. scale=size=qcif
  12249. @end example
  12250. @item
  12251. Scale the input to 2x:
  12252. @example
  12253. scale=w=2*iw:h=2*ih
  12254. @end example
  12255. @item
  12256. The above is the same as:
  12257. @example
  12258. scale=2*in_w:2*in_h
  12259. @end example
  12260. @item
  12261. Scale the input to 2x with forced interlaced scaling:
  12262. @example
  12263. scale=2*iw:2*ih:interl=1
  12264. @end example
  12265. @item
  12266. Scale the input to half size:
  12267. @example
  12268. scale=w=iw/2:h=ih/2
  12269. @end example
  12270. @item
  12271. Increase the width, and set the height to the same size:
  12272. @example
  12273. scale=3/2*iw:ow
  12274. @end example
  12275. @item
  12276. Seek Greek harmony:
  12277. @example
  12278. scale=iw:1/PHI*iw
  12279. scale=ih*PHI:ih
  12280. @end example
  12281. @item
  12282. Increase the height, and set the width to 3/2 of the height:
  12283. @example
  12284. scale=w=3/2*oh:h=3/5*ih
  12285. @end example
  12286. @item
  12287. Increase the size, making the size a multiple of the chroma
  12288. subsample values:
  12289. @example
  12290. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12291. @end example
  12292. @item
  12293. Increase the width to a maximum of 500 pixels,
  12294. keeping the same aspect ratio as the input:
  12295. @example
  12296. scale=w='min(500\, iw*3/2):h=-1'
  12297. @end example
  12298. @item
  12299. Make pixels square by combining scale and setsar:
  12300. @example
  12301. scale='trunc(ih*dar):ih',setsar=1/1
  12302. @end example
  12303. @item
  12304. Make pixels square by combining scale and setsar,
  12305. making sure the resulting resolution is even (required by some codecs):
  12306. @example
  12307. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12308. @end example
  12309. @end itemize
  12310. @subsection Commands
  12311. This filter supports the following commands:
  12312. @table @option
  12313. @item width, w
  12314. @item height, h
  12315. Set the output video dimension expression.
  12316. The command accepts the same syntax of the corresponding option.
  12317. If the specified expression is not valid, it is kept at its current
  12318. value.
  12319. @end table
  12320. @section scale_npp
  12321. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12322. format conversion on CUDA video frames. Setting the output width and height
  12323. works in the same way as for the @var{scale} filter.
  12324. The following additional options are accepted:
  12325. @table @option
  12326. @item format
  12327. The pixel format of the output CUDA frames. If set to the string "same" (the
  12328. default), the input format will be kept. Note that automatic format negotiation
  12329. and conversion is not yet supported for hardware frames
  12330. @item interp_algo
  12331. The interpolation algorithm used for resizing. One of the following:
  12332. @table @option
  12333. @item nn
  12334. Nearest neighbour.
  12335. @item linear
  12336. @item cubic
  12337. @item cubic2p_bspline
  12338. 2-parameter cubic (B=1, C=0)
  12339. @item cubic2p_catmullrom
  12340. 2-parameter cubic (B=0, C=1/2)
  12341. @item cubic2p_b05c03
  12342. 2-parameter cubic (B=1/2, C=3/10)
  12343. @item super
  12344. Supersampling
  12345. @item lanczos
  12346. @end table
  12347. @item force_original_aspect_ratio
  12348. Enable decreasing or increasing output video width or height if necessary to
  12349. keep the original aspect ratio. Possible values:
  12350. @table @samp
  12351. @item disable
  12352. Scale the video as specified and disable this feature.
  12353. @item decrease
  12354. The output video dimensions will automatically be decreased if needed.
  12355. @item increase
  12356. The output video dimensions will automatically be increased if needed.
  12357. @end table
  12358. One useful instance of this option is that when you know a specific device's
  12359. maximum allowed resolution, you can use this to limit the output video to
  12360. that, while retaining the aspect ratio. For example, device A allows
  12361. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12362. decrease) and specifying 1280x720 to the command line makes the output
  12363. 1280x533.
  12364. Please note that this is a different thing than specifying -1 for @option{w}
  12365. or @option{h}, you still need to specify the output resolution for this option
  12366. to work.
  12367. @item force_divisible_by
  12368. Ensures that both the output dimensions, width and height, are divisible by the
  12369. given integer when used together with @option{force_original_aspect_ratio}. This
  12370. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12371. This option respects the value set for @option{force_original_aspect_ratio},
  12372. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12373. may be slightly modified.
  12374. This option can be handy if you need to have a video fit within or exceed
  12375. a defined resolution using @option{force_original_aspect_ratio} but also have
  12376. encoder restrictions on width or height divisibility.
  12377. @end table
  12378. @section scale2ref
  12379. Scale (resize) the input video, based on a reference video.
  12380. See the scale filter for available options, scale2ref supports the same but
  12381. uses the reference video instead of the main input as basis. scale2ref also
  12382. supports the following additional constants for the @option{w} and
  12383. @option{h} options:
  12384. @table @var
  12385. @item main_w
  12386. @item main_h
  12387. The main input video's width and height
  12388. @item main_a
  12389. The same as @var{main_w} / @var{main_h}
  12390. @item main_sar
  12391. The main input video's sample aspect ratio
  12392. @item main_dar, mdar
  12393. The main input video's display aspect ratio. Calculated from
  12394. @code{(main_w / main_h) * main_sar}.
  12395. @item main_hsub
  12396. @item main_vsub
  12397. The main input video's horizontal and vertical chroma subsample values.
  12398. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12399. is 1.
  12400. @end table
  12401. @subsection Examples
  12402. @itemize
  12403. @item
  12404. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12405. @example
  12406. 'scale2ref[b][a];[a][b]overlay'
  12407. @end example
  12408. @item
  12409. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12410. @example
  12411. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12412. @end example
  12413. @end itemize
  12414. @section scroll
  12415. Scroll input video horizontally and/or vertically by constant speed.
  12416. The filter accepts the following options:
  12417. @table @option
  12418. @item horizontal, h
  12419. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12420. Negative values changes scrolling direction.
  12421. @item vertical, v
  12422. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12423. Negative values changes scrolling direction.
  12424. @item hpos
  12425. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12426. @item vpos
  12427. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12428. @end table
  12429. @subsection Commands
  12430. This filter supports the following @ref{commands}:
  12431. @table @option
  12432. @item horizontal, h
  12433. Set the horizontal scrolling speed.
  12434. @item vertical, v
  12435. Set the vertical scrolling speed.
  12436. @end table
  12437. @anchor{selectivecolor}
  12438. @section selectivecolor
  12439. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12440. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12441. by the "purity" of the color (that is, how saturated it already is).
  12442. This filter is similar to the Adobe Photoshop Selective Color tool.
  12443. The filter accepts the following options:
  12444. @table @option
  12445. @item correction_method
  12446. Select color correction method.
  12447. Available values are:
  12448. @table @samp
  12449. @item absolute
  12450. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12451. component value).
  12452. @item relative
  12453. Specified adjustments are relative to the original component value.
  12454. @end table
  12455. Default is @code{absolute}.
  12456. @item reds
  12457. Adjustments for red pixels (pixels where the red component is the maximum)
  12458. @item yellows
  12459. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12460. @item greens
  12461. Adjustments for green pixels (pixels where the green component is the maximum)
  12462. @item cyans
  12463. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12464. @item blues
  12465. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12466. @item magentas
  12467. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12468. @item whites
  12469. Adjustments for white pixels (pixels where all components are greater than 128)
  12470. @item neutrals
  12471. Adjustments for all pixels except pure black and pure white
  12472. @item blacks
  12473. Adjustments for black pixels (pixels where all components are lesser than 128)
  12474. @item psfile
  12475. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12476. @end table
  12477. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12478. 4 space separated floating point adjustment values in the [-1,1] range,
  12479. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12480. pixels of its range.
  12481. @subsection Examples
  12482. @itemize
  12483. @item
  12484. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12485. increase magenta by 27% in blue areas:
  12486. @example
  12487. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12488. @end example
  12489. @item
  12490. Use a Photoshop selective color preset:
  12491. @example
  12492. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12493. @end example
  12494. @end itemize
  12495. @anchor{separatefields}
  12496. @section separatefields
  12497. The @code{separatefields} takes a frame-based video input and splits
  12498. each frame into its components fields, producing a new half height clip
  12499. with twice the frame rate and twice the frame count.
  12500. This filter use field-dominance information in frame to decide which
  12501. of each pair of fields to place first in the output.
  12502. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12503. @section setdar, setsar
  12504. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12505. output video.
  12506. This is done by changing the specified Sample (aka Pixel) Aspect
  12507. Ratio, according to the following equation:
  12508. @example
  12509. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12510. @end example
  12511. Keep in mind that the @code{setdar} filter does not modify the pixel
  12512. dimensions of the video frame. Also, the display aspect ratio set by
  12513. this filter may be changed by later filters in the filterchain,
  12514. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12515. applied.
  12516. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12517. the filter output video.
  12518. Note that as a consequence of the application of this filter, the
  12519. output display aspect ratio will change according to the equation
  12520. above.
  12521. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12522. filter may be changed by later filters in the filterchain, e.g. if
  12523. another "setsar" or a "setdar" filter is applied.
  12524. It accepts the following parameters:
  12525. @table @option
  12526. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12527. Set the aspect ratio used by the filter.
  12528. The parameter can be a floating point number string, an expression, or
  12529. a string of the form @var{num}:@var{den}, where @var{num} and
  12530. @var{den} are the numerator and denominator of the aspect ratio. If
  12531. the parameter is not specified, it is assumed the value "0".
  12532. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12533. should be escaped.
  12534. @item max
  12535. Set the maximum integer value to use for expressing numerator and
  12536. denominator when reducing the expressed aspect ratio to a rational.
  12537. Default value is @code{100}.
  12538. @end table
  12539. The parameter @var{sar} is an expression containing
  12540. the following constants:
  12541. @table @option
  12542. @item E, PI, PHI
  12543. These are approximated values for the mathematical constants e
  12544. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12545. @item w, h
  12546. The input width and height.
  12547. @item a
  12548. These are the same as @var{w} / @var{h}.
  12549. @item sar
  12550. The input sample aspect ratio.
  12551. @item dar
  12552. The input display aspect ratio. It is the same as
  12553. (@var{w} / @var{h}) * @var{sar}.
  12554. @item hsub, vsub
  12555. Horizontal and vertical chroma subsample values. For example, for the
  12556. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12557. @end table
  12558. @subsection Examples
  12559. @itemize
  12560. @item
  12561. To change the display aspect ratio to 16:9, specify one of the following:
  12562. @example
  12563. setdar=dar=1.77777
  12564. setdar=dar=16/9
  12565. @end example
  12566. @item
  12567. To change the sample aspect ratio to 10:11, specify:
  12568. @example
  12569. setsar=sar=10/11
  12570. @end example
  12571. @item
  12572. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12573. 1000 in the aspect ratio reduction, use the command:
  12574. @example
  12575. setdar=ratio=16/9:max=1000
  12576. @end example
  12577. @end itemize
  12578. @anchor{setfield}
  12579. @section setfield
  12580. Force field for the output video frame.
  12581. The @code{setfield} filter marks the interlace type field for the
  12582. output frames. It does not change the input frame, but only sets the
  12583. corresponding property, which affects how the frame is treated by
  12584. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12585. The filter accepts the following options:
  12586. @table @option
  12587. @item mode
  12588. Available values are:
  12589. @table @samp
  12590. @item auto
  12591. Keep the same field property.
  12592. @item bff
  12593. Mark the frame as bottom-field-first.
  12594. @item tff
  12595. Mark the frame as top-field-first.
  12596. @item prog
  12597. Mark the frame as progressive.
  12598. @end table
  12599. @end table
  12600. @anchor{setparams}
  12601. @section setparams
  12602. Force frame parameter for the output video frame.
  12603. The @code{setparams} filter marks interlace and color range for the
  12604. output frames. It does not change the input frame, but only sets the
  12605. corresponding property, which affects how the frame is treated by
  12606. filters/encoders.
  12607. @table @option
  12608. @item field_mode
  12609. Available values are:
  12610. @table @samp
  12611. @item auto
  12612. Keep the same field property (default).
  12613. @item bff
  12614. Mark the frame as bottom-field-first.
  12615. @item tff
  12616. Mark the frame as top-field-first.
  12617. @item prog
  12618. Mark the frame as progressive.
  12619. @end table
  12620. @item range
  12621. Available values are:
  12622. @table @samp
  12623. @item auto
  12624. Keep the same color range property (default).
  12625. @item unspecified, unknown
  12626. Mark the frame as unspecified color range.
  12627. @item limited, tv, mpeg
  12628. Mark the frame as limited range.
  12629. @item full, pc, jpeg
  12630. Mark the frame as full range.
  12631. @end table
  12632. @item color_primaries
  12633. Set the color primaries.
  12634. Available values are:
  12635. @table @samp
  12636. @item auto
  12637. Keep the same color primaries property (default).
  12638. @item bt709
  12639. @item unknown
  12640. @item bt470m
  12641. @item bt470bg
  12642. @item smpte170m
  12643. @item smpte240m
  12644. @item film
  12645. @item bt2020
  12646. @item smpte428
  12647. @item smpte431
  12648. @item smpte432
  12649. @item jedec-p22
  12650. @end table
  12651. @item color_trc
  12652. Set the color transfer.
  12653. Available values are:
  12654. @table @samp
  12655. @item auto
  12656. Keep the same color trc property (default).
  12657. @item bt709
  12658. @item unknown
  12659. @item bt470m
  12660. @item bt470bg
  12661. @item smpte170m
  12662. @item smpte240m
  12663. @item linear
  12664. @item log100
  12665. @item log316
  12666. @item iec61966-2-4
  12667. @item bt1361e
  12668. @item iec61966-2-1
  12669. @item bt2020-10
  12670. @item bt2020-12
  12671. @item smpte2084
  12672. @item smpte428
  12673. @item arib-std-b67
  12674. @end table
  12675. @item colorspace
  12676. Set the colorspace.
  12677. Available values are:
  12678. @table @samp
  12679. @item auto
  12680. Keep the same colorspace property (default).
  12681. @item gbr
  12682. @item bt709
  12683. @item unknown
  12684. @item fcc
  12685. @item bt470bg
  12686. @item smpte170m
  12687. @item smpte240m
  12688. @item ycgco
  12689. @item bt2020nc
  12690. @item bt2020c
  12691. @item smpte2085
  12692. @item chroma-derived-nc
  12693. @item chroma-derived-c
  12694. @item ictcp
  12695. @end table
  12696. @end table
  12697. @section showinfo
  12698. Show a line containing various information for each input video frame.
  12699. The input video is not modified.
  12700. This filter supports the following options:
  12701. @table @option
  12702. @item checksum
  12703. Calculate checksums of each plane. By default enabled.
  12704. @end table
  12705. The shown line contains a sequence of key/value pairs of the form
  12706. @var{key}:@var{value}.
  12707. The following values are shown in the output:
  12708. @table @option
  12709. @item n
  12710. The (sequential) number of the input frame, starting from 0.
  12711. @item pts
  12712. The Presentation TimeStamp of the input frame, expressed as a number of
  12713. time base units. The time base unit depends on the filter input pad.
  12714. @item pts_time
  12715. The Presentation TimeStamp of the input frame, expressed as a number of
  12716. seconds.
  12717. @item pos
  12718. The position of the frame in the input stream, or -1 if this information is
  12719. unavailable and/or meaningless (for example in case of synthetic video).
  12720. @item fmt
  12721. The pixel format name.
  12722. @item sar
  12723. The sample aspect ratio of the input frame, expressed in the form
  12724. @var{num}/@var{den}.
  12725. @item s
  12726. The size of the input frame. For the syntax of this option, check the
  12727. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12728. @item i
  12729. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12730. for bottom field first).
  12731. @item iskey
  12732. This is 1 if the frame is a key frame, 0 otherwise.
  12733. @item type
  12734. The picture type of the input frame ("I" for an I-frame, "P" for a
  12735. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12736. Also refer to the documentation of the @code{AVPictureType} enum and of
  12737. the @code{av_get_picture_type_char} function defined in
  12738. @file{libavutil/avutil.h}.
  12739. @item checksum
  12740. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12741. @item plane_checksum
  12742. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12743. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12744. @end table
  12745. @section showpalette
  12746. Displays the 256 colors palette of each frame. This filter is only relevant for
  12747. @var{pal8} pixel format frames.
  12748. It accepts the following option:
  12749. @table @option
  12750. @item s
  12751. Set the size of the box used to represent one palette color entry. Default is
  12752. @code{30} (for a @code{30x30} pixel box).
  12753. @end table
  12754. @section shuffleframes
  12755. Reorder and/or duplicate and/or drop video frames.
  12756. It accepts the following parameters:
  12757. @table @option
  12758. @item mapping
  12759. Set the destination indexes of input frames.
  12760. This is space or '|' separated list of indexes that maps input frames to output
  12761. frames. Number of indexes also sets maximal value that each index may have.
  12762. '-1' index have special meaning and that is to drop frame.
  12763. @end table
  12764. The first frame has the index 0. The default is to keep the input unchanged.
  12765. @subsection Examples
  12766. @itemize
  12767. @item
  12768. Swap second and third frame of every three frames of the input:
  12769. @example
  12770. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12771. @end example
  12772. @item
  12773. Swap 10th and 1st frame of every ten frames of the input:
  12774. @example
  12775. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12776. @end example
  12777. @end itemize
  12778. @section shuffleplanes
  12779. Reorder and/or duplicate video planes.
  12780. It accepts the following parameters:
  12781. @table @option
  12782. @item map0
  12783. The index of the input plane to be used as the first output plane.
  12784. @item map1
  12785. The index of the input plane to be used as the second output plane.
  12786. @item map2
  12787. The index of the input plane to be used as the third output plane.
  12788. @item map3
  12789. The index of the input plane to be used as the fourth output plane.
  12790. @end table
  12791. The first plane has the index 0. The default is to keep the input unchanged.
  12792. @subsection Examples
  12793. @itemize
  12794. @item
  12795. Swap the second and third planes of the input:
  12796. @example
  12797. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12798. @end example
  12799. @end itemize
  12800. @anchor{signalstats}
  12801. @section signalstats
  12802. Evaluate various visual metrics that assist in determining issues associated
  12803. with the digitization of analog video media.
  12804. By default the filter will log these metadata values:
  12805. @table @option
  12806. @item YMIN
  12807. Display the minimal Y value contained within the input frame. Expressed in
  12808. range of [0-255].
  12809. @item YLOW
  12810. Display the Y value at the 10% percentile within the input frame. Expressed in
  12811. range of [0-255].
  12812. @item YAVG
  12813. Display the average Y value within the input frame. Expressed in range of
  12814. [0-255].
  12815. @item YHIGH
  12816. Display the Y value at the 90% percentile within the input frame. Expressed in
  12817. range of [0-255].
  12818. @item YMAX
  12819. Display the maximum Y value contained within the input frame. Expressed in
  12820. range of [0-255].
  12821. @item UMIN
  12822. Display the minimal U value contained within the input frame. Expressed in
  12823. range of [0-255].
  12824. @item ULOW
  12825. Display the U value at the 10% percentile within the input frame. Expressed in
  12826. range of [0-255].
  12827. @item UAVG
  12828. Display the average U value within the input frame. Expressed in range of
  12829. [0-255].
  12830. @item UHIGH
  12831. Display the U value at the 90% percentile within the input frame. Expressed in
  12832. range of [0-255].
  12833. @item UMAX
  12834. Display the maximum U value contained within the input frame. Expressed in
  12835. range of [0-255].
  12836. @item VMIN
  12837. Display the minimal V value contained within the input frame. Expressed in
  12838. range of [0-255].
  12839. @item VLOW
  12840. Display the V value at the 10% percentile within the input frame. Expressed in
  12841. range of [0-255].
  12842. @item VAVG
  12843. Display the average V value within the input frame. Expressed in range of
  12844. [0-255].
  12845. @item VHIGH
  12846. Display the V value at the 90% percentile within the input frame. Expressed in
  12847. range of [0-255].
  12848. @item VMAX
  12849. Display the maximum V value contained within the input frame. Expressed in
  12850. range of [0-255].
  12851. @item SATMIN
  12852. Display the minimal saturation value contained within the input frame.
  12853. Expressed in range of [0-~181.02].
  12854. @item SATLOW
  12855. Display the saturation value at the 10% percentile within the input frame.
  12856. Expressed in range of [0-~181.02].
  12857. @item SATAVG
  12858. Display the average saturation value within the input frame. Expressed in range
  12859. of [0-~181.02].
  12860. @item SATHIGH
  12861. Display the saturation value at the 90% percentile within the input frame.
  12862. Expressed in range of [0-~181.02].
  12863. @item SATMAX
  12864. Display the maximum saturation value contained within the input frame.
  12865. Expressed in range of [0-~181.02].
  12866. @item HUEMED
  12867. Display the median value for hue within the input frame. Expressed in range of
  12868. [0-360].
  12869. @item HUEAVG
  12870. Display the average value for hue within the input frame. Expressed in range of
  12871. [0-360].
  12872. @item YDIF
  12873. Display the average of sample value difference between all values of the Y
  12874. plane in the current frame and corresponding values of the previous input frame.
  12875. Expressed in range of [0-255].
  12876. @item UDIF
  12877. Display the average of sample value difference between all values of the U
  12878. plane in the current frame and corresponding values of the previous input frame.
  12879. Expressed in range of [0-255].
  12880. @item VDIF
  12881. Display the average of sample value difference between all values of the V
  12882. plane in the current frame and corresponding values of the previous input frame.
  12883. Expressed in range of [0-255].
  12884. @item YBITDEPTH
  12885. Display bit depth of Y plane in current frame.
  12886. Expressed in range of [0-16].
  12887. @item UBITDEPTH
  12888. Display bit depth of U plane in current frame.
  12889. Expressed in range of [0-16].
  12890. @item VBITDEPTH
  12891. Display bit depth of V plane in current frame.
  12892. Expressed in range of [0-16].
  12893. @end table
  12894. The filter accepts the following options:
  12895. @table @option
  12896. @item stat
  12897. @item out
  12898. @option{stat} specify an additional form of image analysis.
  12899. @option{out} output video with the specified type of pixel highlighted.
  12900. Both options accept the following values:
  12901. @table @samp
  12902. @item tout
  12903. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12904. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12905. include the results of video dropouts, head clogs, or tape tracking issues.
  12906. @item vrep
  12907. Identify @var{vertical line repetition}. Vertical line repetition includes
  12908. similar rows of pixels within a frame. In born-digital video vertical line
  12909. repetition is common, but this pattern is uncommon in video digitized from an
  12910. analog source. When it occurs in video that results from the digitization of an
  12911. analog source it can indicate concealment from a dropout compensator.
  12912. @item brng
  12913. Identify pixels that fall outside of legal broadcast range.
  12914. @end table
  12915. @item color, c
  12916. Set the highlight color for the @option{out} option. The default color is
  12917. yellow.
  12918. @end table
  12919. @subsection Examples
  12920. @itemize
  12921. @item
  12922. Output data of various video metrics:
  12923. @example
  12924. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12925. @end example
  12926. @item
  12927. Output specific data about the minimum and maximum values of the Y plane per frame:
  12928. @example
  12929. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12930. @end example
  12931. @item
  12932. Playback video while highlighting pixels that are outside of broadcast range in red.
  12933. @example
  12934. ffplay example.mov -vf signalstats="out=brng:color=red"
  12935. @end example
  12936. @item
  12937. Playback video with signalstats metadata drawn over the frame.
  12938. @example
  12939. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12940. @end example
  12941. The contents of signalstat_drawtext.txt used in the command are:
  12942. @example
  12943. time %@{pts:hms@}
  12944. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12945. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12946. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12947. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12948. @end example
  12949. @end itemize
  12950. @anchor{signature}
  12951. @section signature
  12952. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12953. input. In this case the matching between the inputs can be calculated additionally.
  12954. The filter always passes through the first input. The signature of each stream can
  12955. be written into a file.
  12956. It accepts the following options:
  12957. @table @option
  12958. @item detectmode
  12959. Enable or disable the matching process.
  12960. Available values are:
  12961. @table @samp
  12962. @item off
  12963. Disable the calculation of a matching (default).
  12964. @item full
  12965. Calculate the matching for the whole video and output whether the whole video
  12966. matches or only parts.
  12967. @item fast
  12968. Calculate only until a matching is found or the video ends. Should be faster in
  12969. some cases.
  12970. @end table
  12971. @item nb_inputs
  12972. Set the number of inputs. The option value must be a non negative integer.
  12973. Default value is 1.
  12974. @item filename
  12975. Set the path to which the output is written. If there is more than one input,
  12976. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12977. integer), that will be replaced with the input number. If no filename is
  12978. specified, no output will be written. This is the default.
  12979. @item format
  12980. Choose the output format.
  12981. Available values are:
  12982. @table @samp
  12983. @item binary
  12984. Use the specified binary representation (default).
  12985. @item xml
  12986. Use the specified xml representation.
  12987. @end table
  12988. @item th_d
  12989. Set threshold to detect one word as similar. The option value must be an integer
  12990. greater than zero. The default value is 9000.
  12991. @item th_dc
  12992. Set threshold to detect all words as similar. The option value must be an integer
  12993. greater than zero. The default value is 60000.
  12994. @item th_xh
  12995. Set threshold to detect frames as similar. The option value must be an integer
  12996. greater than zero. The default value is 116.
  12997. @item th_di
  12998. Set the minimum length of a sequence in frames to recognize it as matching
  12999. sequence. The option value must be a non negative integer value.
  13000. The default value is 0.
  13001. @item th_it
  13002. Set the minimum relation, that matching frames to all frames must have.
  13003. The option value must be a double value between 0 and 1. The default value is 0.5.
  13004. @end table
  13005. @subsection Examples
  13006. @itemize
  13007. @item
  13008. To calculate the signature of an input video and store it in signature.bin:
  13009. @example
  13010. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13011. @end example
  13012. @item
  13013. To detect whether two videos match and store the signatures in XML format in
  13014. signature0.xml and signature1.xml:
  13015. @example
  13016. 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 -
  13017. @end example
  13018. @end itemize
  13019. @anchor{smartblur}
  13020. @section smartblur
  13021. Blur the input video without impacting the outlines.
  13022. It accepts the following options:
  13023. @table @option
  13024. @item luma_radius, lr
  13025. Set the luma radius. The option value must be a float number in
  13026. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13027. used to blur the image (slower if larger). Default value is 1.0.
  13028. @item luma_strength, ls
  13029. Set the luma strength. The option value must be a float number
  13030. in the range [-1.0,1.0] that configures the blurring. A value included
  13031. in [0.0,1.0] will blur the image whereas a value included in
  13032. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13033. @item luma_threshold, lt
  13034. Set the luma threshold used as a coefficient to determine
  13035. whether a pixel should be blurred or not. The option value must be an
  13036. integer in the range [-30,30]. A value of 0 will filter all the image,
  13037. a value included in [0,30] will filter flat areas and a value included
  13038. in [-30,0] will filter edges. Default value is 0.
  13039. @item chroma_radius, cr
  13040. Set the chroma radius. The option value must be a float number in
  13041. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13042. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13043. @item chroma_strength, cs
  13044. Set the chroma strength. The option value must be a float number
  13045. in the range [-1.0,1.0] that configures the blurring. A value included
  13046. in [0.0,1.0] will blur the image whereas a value included in
  13047. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13048. @item chroma_threshold, ct
  13049. Set the chroma threshold used as a coefficient to determine
  13050. whether a pixel should be blurred or not. The option value must be an
  13051. integer in the range [-30,30]. A value of 0 will filter all the image,
  13052. a value included in [0,30] will filter flat areas and a value included
  13053. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13054. @end table
  13055. If a chroma option is not explicitly set, the corresponding luma value
  13056. is set.
  13057. @section sobel
  13058. Apply sobel operator to input video stream.
  13059. The filter accepts the following option:
  13060. @table @option
  13061. @item planes
  13062. Set which planes will be processed, unprocessed planes will be copied.
  13063. By default value 0xf, all planes will be processed.
  13064. @item scale
  13065. Set value which will be multiplied with filtered result.
  13066. @item delta
  13067. Set value which will be added to filtered result.
  13068. @end table
  13069. @anchor{spp}
  13070. @section spp
  13071. Apply a simple postprocessing filter that compresses and decompresses the image
  13072. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13073. and average the results.
  13074. The filter accepts the following options:
  13075. @table @option
  13076. @item quality
  13077. Set quality. This option defines the number of levels for averaging. It accepts
  13078. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13079. effect. A value of @code{6} means the higher quality. For each increment of
  13080. that value the speed drops by a factor of approximately 2. Default value is
  13081. @code{3}.
  13082. @item qp
  13083. Force a constant quantization parameter. If not set, the filter will use the QP
  13084. from the video stream (if available).
  13085. @item mode
  13086. Set thresholding mode. Available modes are:
  13087. @table @samp
  13088. @item hard
  13089. Set hard thresholding (default).
  13090. @item soft
  13091. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13092. @end table
  13093. @item use_bframe_qp
  13094. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13095. option may cause flicker since the B-Frames have often larger QP. Default is
  13096. @code{0} (not enabled).
  13097. @end table
  13098. @section sr
  13099. Scale the input by applying one of the super-resolution methods based on
  13100. convolutional neural networks. Supported models:
  13101. @itemize
  13102. @item
  13103. Super-Resolution Convolutional Neural Network model (SRCNN).
  13104. See @url{https://arxiv.org/abs/1501.00092}.
  13105. @item
  13106. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13107. See @url{https://arxiv.org/abs/1609.05158}.
  13108. @end itemize
  13109. Training scripts as well as scripts for model file (.pb) saving can be found at
  13110. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13111. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13112. Native model files (.model) can be generated from TensorFlow model
  13113. files (.pb) by using tools/python/convert.py
  13114. The filter accepts the following options:
  13115. @table @option
  13116. @item dnn_backend
  13117. Specify which DNN backend to use for model loading and execution. This option accepts
  13118. the following values:
  13119. @table @samp
  13120. @item native
  13121. Native implementation of DNN loading and execution.
  13122. @item tensorflow
  13123. TensorFlow backend. To enable this backend you
  13124. need to install the TensorFlow for C library (see
  13125. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13126. @code{--enable-libtensorflow}
  13127. @end table
  13128. Default value is @samp{native}.
  13129. @item model
  13130. Set path to model file specifying network architecture and its parameters.
  13131. Note that different backends use different file formats. TensorFlow backend
  13132. can load files for both formats, while native backend can load files for only
  13133. its format.
  13134. @item scale_factor
  13135. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13136. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13137. input upscaled using bicubic upscaling with proper scale factor.
  13138. @end table
  13139. @section ssim
  13140. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13141. This filter takes in input two input videos, the first input is
  13142. considered the "main" source and is passed unchanged to the
  13143. output. The second input is used as a "reference" video for computing
  13144. the SSIM.
  13145. Both video inputs must have the same resolution and pixel format for
  13146. this filter to work correctly. Also it assumes that both inputs
  13147. have the same number of frames, which are compared one by one.
  13148. The filter stores the calculated SSIM of each frame.
  13149. The description of the accepted parameters follows.
  13150. @table @option
  13151. @item stats_file, f
  13152. If specified the filter will use the named file to save the SSIM of
  13153. each individual frame. When filename equals "-" the data is sent to
  13154. standard output.
  13155. @end table
  13156. The file printed if @var{stats_file} is selected, contains a sequence of
  13157. key/value pairs of the form @var{key}:@var{value} for each compared
  13158. couple of frames.
  13159. A description of each shown parameter follows:
  13160. @table @option
  13161. @item n
  13162. sequential number of the input frame, starting from 1
  13163. @item Y, U, V, R, G, B
  13164. SSIM of the compared frames for the component specified by the suffix.
  13165. @item All
  13166. SSIM of the compared frames for the whole frame.
  13167. @item dB
  13168. Same as above but in dB representation.
  13169. @end table
  13170. This filter also supports the @ref{framesync} options.
  13171. @subsection Examples
  13172. @itemize
  13173. @item
  13174. For example:
  13175. @example
  13176. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13177. [main][ref] ssim="stats_file=stats.log" [out]
  13178. @end example
  13179. On this example the input file being processed is compared with the
  13180. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13181. is stored in @file{stats.log}.
  13182. @item
  13183. Another example with both psnr and ssim at same time:
  13184. @example
  13185. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13186. @end example
  13187. @item
  13188. Another example with different containers:
  13189. @example
  13190. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  13191. @end example
  13192. @end itemize
  13193. @section stereo3d
  13194. Convert between different stereoscopic image formats.
  13195. The filters accept the following options:
  13196. @table @option
  13197. @item in
  13198. Set stereoscopic image format of input.
  13199. Available values for input image formats are:
  13200. @table @samp
  13201. @item sbsl
  13202. side by side parallel (left eye left, right eye right)
  13203. @item sbsr
  13204. side by side crosseye (right eye left, left eye right)
  13205. @item sbs2l
  13206. side by side parallel with half width resolution
  13207. (left eye left, right eye right)
  13208. @item sbs2r
  13209. side by side crosseye with half width resolution
  13210. (right eye left, left eye right)
  13211. @item abl
  13212. @item tbl
  13213. above-below (left eye above, right eye below)
  13214. @item abr
  13215. @item tbr
  13216. above-below (right eye above, left eye below)
  13217. @item ab2l
  13218. @item tb2l
  13219. above-below with half height resolution
  13220. (left eye above, right eye below)
  13221. @item ab2r
  13222. @item tb2r
  13223. above-below with half height resolution
  13224. (right eye above, left eye below)
  13225. @item al
  13226. alternating frames (left eye first, right eye second)
  13227. @item ar
  13228. alternating frames (right eye first, left eye second)
  13229. @item irl
  13230. interleaved rows (left eye has top row, right eye starts on next row)
  13231. @item irr
  13232. interleaved rows (right eye has top row, left eye starts on next row)
  13233. @item icl
  13234. interleaved columns, left eye first
  13235. @item icr
  13236. interleaved columns, right eye first
  13237. Default value is @samp{sbsl}.
  13238. @end table
  13239. @item out
  13240. Set stereoscopic image format of output.
  13241. @table @samp
  13242. @item sbsl
  13243. side by side parallel (left eye left, right eye right)
  13244. @item sbsr
  13245. side by side crosseye (right eye left, left eye right)
  13246. @item sbs2l
  13247. side by side parallel with half width resolution
  13248. (left eye left, right eye right)
  13249. @item sbs2r
  13250. side by side crosseye with half width resolution
  13251. (right eye left, left eye right)
  13252. @item abl
  13253. @item tbl
  13254. above-below (left eye above, right eye below)
  13255. @item abr
  13256. @item tbr
  13257. above-below (right eye above, left eye below)
  13258. @item ab2l
  13259. @item tb2l
  13260. above-below with half height resolution
  13261. (left eye above, right eye below)
  13262. @item ab2r
  13263. @item tb2r
  13264. above-below with half height resolution
  13265. (right eye above, left eye below)
  13266. @item al
  13267. alternating frames (left eye first, right eye second)
  13268. @item ar
  13269. alternating frames (right eye first, left eye second)
  13270. @item irl
  13271. interleaved rows (left eye has top row, right eye starts on next row)
  13272. @item irr
  13273. interleaved rows (right eye has top row, left eye starts on next row)
  13274. @item arbg
  13275. anaglyph red/blue gray
  13276. (red filter on left eye, blue filter on right eye)
  13277. @item argg
  13278. anaglyph red/green gray
  13279. (red filter on left eye, green filter on right eye)
  13280. @item arcg
  13281. anaglyph red/cyan gray
  13282. (red filter on left eye, cyan filter on right eye)
  13283. @item arch
  13284. anaglyph red/cyan half colored
  13285. (red filter on left eye, cyan filter on right eye)
  13286. @item arcc
  13287. anaglyph red/cyan color
  13288. (red filter on left eye, cyan filter on right eye)
  13289. @item arcd
  13290. anaglyph red/cyan color optimized with the least squares projection of dubois
  13291. (red filter on left eye, cyan filter on right eye)
  13292. @item agmg
  13293. anaglyph green/magenta gray
  13294. (green filter on left eye, magenta filter on right eye)
  13295. @item agmh
  13296. anaglyph green/magenta half colored
  13297. (green filter on left eye, magenta filter on right eye)
  13298. @item agmc
  13299. anaglyph green/magenta colored
  13300. (green filter on left eye, magenta filter on right eye)
  13301. @item agmd
  13302. anaglyph green/magenta color optimized with the least squares projection of dubois
  13303. (green filter on left eye, magenta filter on right eye)
  13304. @item aybg
  13305. anaglyph yellow/blue gray
  13306. (yellow filter on left eye, blue filter on right eye)
  13307. @item aybh
  13308. anaglyph yellow/blue half colored
  13309. (yellow filter on left eye, blue filter on right eye)
  13310. @item aybc
  13311. anaglyph yellow/blue colored
  13312. (yellow filter on left eye, blue filter on right eye)
  13313. @item aybd
  13314. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13315. (yellow filter on left eye, blue filter on right eye)
  13316. @item ml
  13317. mono output (left eye only)
  13318. @item mr
  13319. mono output (right eye only)
  13320. @item chl
  13321. checkerboard, left eye first
  13322. @item chr
  13323. checkerboard, right eye first
  13324. @item icl
  13325. interleaved columns, left eye first
  13326. @item icr
  13327. interleaved columns, right eye first
  13328. @item hdmi
  13329. HDMI frame pack
  13330. @end table
  13331. Default value is @samp{arcd}.
  13332. @end table
  13333. @subsection Examples
  13334. @itemize
  13335. @item
  13336. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13337. @example
  13338. stereo3d=sbsl:aybd
  13339. @end example
  13340. @item
  13341. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13342. @example
  13343. stereo3d=abl:sbsr
  13344. @end example
  13345. @end itemize
  13346. @section streamselect, astreamselect
  13347. Select video or audio streams.
  13348. The filter accepts the following options:
  13349. @table @option
  13350. @item inputs
  13351. Set number of inputs. Default is 2.
  13352. @item map
  13353. Set input indexes to remap to outputs.
  13354. @end table
  13355. @subsection Commands
  13356. The @code{streamselect} and @code{astreamselect} filter supports the following
  13357. commands:
  13358. @table @option
  13359. @item map
  13360. Set input indexes to remap to outputs.
  13361. @end table
  13362. @subsection Examples
  13363. @itemize
  13364. @item
  13365. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13366. @example
  13367. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13368. @end example
  13369. @item
  13370. Same as above, but for audio:
  13371. @example
  13372. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13373. @end example
  13374. @end itemize
  13375. @anchor{subtitles}
  13376. @section subtitles
  13377. Draw subtitles on top of input video using the libass library.
  13378. To enable compilation of this filter you need to configure FFmpeg with
  13379. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13380. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13381. Alpha) subtitles format.
  13382. The filter accepts the following options:
  13383. @table @option
  13384. @item filename, f
  13385. Set the filename of the subtitle file to read. It must be specified.
  13386. @item original_size
  13387. Specify the size of the original video, the video for which the ASS file
  13388. was composed. For the syntax of this option, check the
  13389. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13390. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13391. correctly scale the fonts if the aspect ratio has been changed.
  13392. @item fontsdir
  13393. Set a directory path containing fonts that can be used by the filter.
  13394. These fonts will be used in addition to whatever the font provider uses.
  13395. @item alpha
  13396. Process alpha channel, by default alpha channel is untouched.
  13397. @item charenc
  13398. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13399. useful if not UTF-8.
  13400. @item stream_index, si
  13401. Set subtitles stream index. @code{subtitles} filter only.
  13402. @item force_style
  13403. Override default style or script info parameters of the subtitles. It accepts a
  13404. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13405. @end table
  13406. If the first key is not specified, it is assumed that the first value
  13407. specifies the @option{filename}.
  13408. For example, to render the file @file{sub.srt} on top of the input
  13409. video, use the command:
  13410. @example
  13411. subtitles=sub.srt
  13412. @end example
  13413. which is equivalent to:
  13414. @example
  13415. subtitles=filename=sub.srt
  13416. @end example
  13417. To render the default subtitles stream from file @file{video.mkv}, use:
  13418. @example
  13419. subtitles=video.mkv
  13420. @end example
  13421. To render the second subtitles stream from that file, use:
  13422. @example
  13423. subtitles=video.mkv:si=1
  13424. @end example
  13425. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13426. @code{DejaVu Serif}, use:
  13427. @example
  13428. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13429. @end example
  13430. @section super2xsai
  13431. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13432. Interpolate) pixel art scaling algorithm.
  13433. Useful for enlarging pixel art images without reducing sharpness.
  13434. @section swaprect
  13435. Swap two rectangular objects in video.
  13436. This filter accepts the following options:
  13437. @table @option
  13438. @item w
  13439. Set object width.
  13440. @item h
  13441. Set object height.
  13442. @item x1
  13443. Set 1st rect x coordinate.
  13444. @item y1
  13445. Set 1st rect y coordinate.
  13446. @item x2
  13447. Set 2nd rect x coordinate.
  13448. @item y2
  13449. Set 2nd rect y coordinate.
  13450. All expressions are evaluated once for each frame.
  13451. @end table
  13452. The all options are expressions containing the following constants:
  13453. @table @option
  13454. @item w
  13455. @item h
  13456. The input width and height.
  13457. @item a
  13458. same as @var{w} / @var{h}
  13459. @item sar
  13460. input sample aspect ratio
  13461. @item dar
  13462. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13463. @item n
  13464. The number of the input frame, starting from 0.
  13465. @item t
  13466. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13467. @item pos
  13468. the position in the file of the input frame, NAN if unknown
  13469. @end table
  13470. @section swapuv
  13471. Swap U & V plane.
  13472. @section telecine
  13473. Apply telecine process to the video.
  13474. This filter accepts the following options:
  13475. @table @option
  13476. @item first_field
  13477. @table @samp
  13478. @item top, t
  13479. top field first
  13480. @item bottom, b
  13481. bottom field first
  13482. The default value is @code{top}.
  13483. @end table
  13484. @item pattern
  13485. A string of numbers representing the pulldown pattern you wish to apply.
  13486. The default value is @code{23}.
  13487. @end table
  13488. @example
  13489. Some typical patterns:
  13490. NTSC output (30i):
  13491. 27.5p: 32222
  13492. 24p: 23 (classic)
  13493. 24p: 2332 (preferred)
  13494. 20p: 33
  13495. 18p: 334
  13496. 16p: 3444
  13497. PAL output (25i):
  13498. 27.5p: 12222
  13499. 24p: 222222222223 ("Euro pulldown")
  13500. 16.67p: 33
  13501. 16p: 33333334
  13502. @end example
  13503. @section threshold
  13504. Apply threshold effect to video stream.
  13505. This filter needs four video streams to perform thresholding.
  13506. First stream is stream we are filtering.
  13507. Second stream is holding threshold values, third stream is holding min values,
  13508. and last, fourth stream is holding max values.
  13509. The filter accepts the following option:
  13510. @table @option
  13511. @item planes
  13512. Set which planes will be processed, unprocessed planes will be copied.
  13513. By default value 0xf, all planes will be processed.
  13514. @end table
  13515. For example if first stream pixel's component value is less then threshold value
  13516. of pixel component from 2nd threshold stream, third stream value will picked,
  13517. otherwise fourth stream pixel component value will be picked.
  13518. Using color source filter one can perform various types of thresholding:
  13519. @subsection Examples
  13520. @itemize
  13521. @item
  13522. Binary threshold, using gray color as threshold:
  13523. @example
  13524. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13525. @end example
  13526. @item
  13527. Inverted binary threshold, using gray color as threshold:
  13528. @example
  13529. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13530. @end example
  13531. @item
  13532. Truncate binary threshold, using gray color as threshold:
  13533. @example
  13534. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13535. @end example
  13536. @item
  13537. Threshold to zero, using gray color as threshold:
  13538. @example
  13539. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13540. @end example
  13541. @item
  13542. Inverted threshold to zero, using gray color as threshold:
  13543. @example
  13544. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13545. @end example
  13546. @end itemize
  13547. @section thumbnail
  13548. Select the most representative frame in a given sequence of consecutive frames.
  13549. The filter accepts the following options:
  13550. @table @option
  13551. @item n
  13552. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13553. will pick one of them, and then handle the next batch of @var{n} frames until
  13554. the end. Default is @code{100}.
  13555. @end table
  13556. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13557. value will result in a higher memory usage, so a high value is not recommended.
  13558. @subsection Examples
  13559. @itemize
  13560. @item
  13561. Extract one picture each 50 frames:
  13562. @example
  13563. thumbnail=50
  13564. @end example
  13565. @item
  13566. Complete example of a thumbnail creation with @command{ffmpeg}:
  13567. @example
  13568. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13569. @end example
  13570. @end itemize
  13571. @section tile
  13572. Tile several successive frames together.
  13573. The filter accepts the following options:
  13574. @table @option
  13575. @item layout
  13576. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13577. this option, check the
  13578. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13579. @item nb_frames
  13580. Set the maximum number of frames to render in the given area. It must be less
  13581. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13582. the area will be used.
  13583. @item margin
  13584. Set the outer border margin in pixels.
  13585. @item padding
  13586. Set the inner border thickness (i.e. the number of pixels between frames). For
  13587. more advanced padding options (such as having different values for the edges),
  13588. refer to the pad video filter.
  13589. @item color
  13590. Specify the color of the unused area. For the syntax of this option, check the
  13591. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13592. The default value of @var{color} is "black".
  13593. @item overlap
  13594. Set the number of frames to overlap when tiling several successive frames together.
  13595. The value must be between @code{0} and @var{nb_frames - 1}.
  13596. @item init_padding
  13597. Set the number of frames to initially be empty before displaying first output frame.
  13598. This controls how soon will one get first output frame.
  13599. The value must be between @code{0} and @var{nb_frames - 1}.
  13600. @end table
  13601. @subsection Examples
  13602. @itemize
  13603. @item
  13604. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13605. @example
  13606. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13607. @end example
  13608. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13609. duplicating each output frame to accommodate the originally detected frame
  13610. rate.
  13611. @item
  13612. Display @code{5} pictures in an area of @code{3x2} frames,
  13613. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13614. mixed flat and named options:
  13615. @example
  13616. tile=3x2:nb_frames=5:padding=7:margin=2
  13617. @end example
  13618. @end itemize
  13619. @section tinterlace
  13620. Perform various types of temporal field interlacing.
  13621. Frames are counted starting from 1, so the first input frame is
  13622. considered odd.
  13623. The filter accepts the following options:
  13624. @table @option
  13625. @item mode
  13626. Specify the mode of the interlacing. This option can also be specified
  13627. as a value alone. See below for a list of values for this option.
  13628. Available values are:
  13629. @table @samp
  13630. @item merge, 0
  13631. Move odd frames into the upper field, even into the lower field,
  13632. generating a double height frame at half frame rate.
  13633. @example
  13634. ------> time
  13635. Input:
  13636. Frame 1 Frame 2 Frame 3 Frame 4
  13637. 11111 22222 33333 44444
  13638. 11111 22222 33333 44444
  13639. 11111 22222 33333 44444
  13640. 11111 22222 33333 44444
  13641. Output:
  13642. 11111 33333
  13643. 22222 44444
  13644. 11111 33333
  13645. 22222 44444
  13646. 11111 33333
  13647. 22222 44444
  13648. 11111 33333
  13649. 22222 44444
  13650. @end example
  13651. @item drop_even, 1
  13652. Only output odd frames, even frames are dropped, generating a frame with
  13653. unchanged height at half frame rate.
  13654. @example
  13655. ------> time
  13656. Input:
  13657. Frame 1 Frame 2 Frame 3 Frame 4
  13658. 11111 22222 33333 44444
  13659. 11111 22222 33333 44444
  13660. 11111 22222 33333 44444
  13661. 11111 22222 33333 44444
  13662. Output:
  13663. 11111 33333
  13664. 11111 33333
  13665. 11111 33333
  13666. 11111 33333
  13667. @end example
  13668. @item drop_odd, 2
  13669. Only output even frames, odd frames are dropped, generating a frame with
  13670. unchanged height at half frame rate.
  13671. @example
  13672. ------> time
  13673. Input:
  13674. Frame 1 Frame 2 Frame 3 Frame 4
  13675. 11111 22222 33333 44444
  13676. 11111 22222 33333 44444
  13677. 11111 22222 33333 44444
  13678. 11111 22222 33333 44444
  13679. Output:
  13680. 22222 44444
  13681. 22222 44444
  13682. 22222 44444
  13683. 22222 44444
  13684. @end example
  13685. @item pad, 3
  13686. Expand each frame to full height, but pad alternate lines with black,
  13687. generating a frame with double height at the same input frame rate.
  13688. @example
  13689. ------> time
  13690. Input:
  13691. Frame 1 Frame 2 Frame 3 Frame 4
  13692. 11111 22222 33333 44444
  13693. 11111 22222 33333 44444
  13694. 11111 22222 33333 44444
  13695. 11111 22222 33333 44444
  13696. Output:
  13697. 11111 ..... 33333 .....
  13698. ..... 22222 ..... 44444
  13699. 11111 ..... 33333 .....
  13700. ..... 22222 ..... 44444
  13701. 11111 ..... 33333 .....
  13702. ..... 22222 ..... 44444
  13703. 11111 ..... 33333 .....
  13704. ..... 22222 ..... 44444
  13705. @end example
  13706. @item interleave_top, 4
  13707. Interleave the upper field from odd frames with the lower field from
  13708. even frames, generating a frame with unchanged height at half frame rate.
  13709. @example
  13710. ------> time
  13711. Input:
  13712. Frame 1 Frame 2 Frame 3 Frame 4
  13713. 11111<- 22222 33333<- 44444
  13714. 11111 22222<- 33333 44444<-
  13715. 11111<- 22222 33333<- 44444
  13716. 11111 22222<- 33333 44444<-
  13717. Output:
  13718. 11111 33333
  13719. 22222 44444
  13720. 11111 33333
  13721. 22222 44444
  13722. @end example
  13723. @item interleave_bottom, 5
  13724. Interleave the lower field from odd frames with the upper field from
  13725. even frames, generating a frame with unchanged height at half frame rate.
  13726. @example
  13727. ------> time
  13728. Input:
  13729. Frame 1 Frame 2 Frame 3 Frame 4
  13730. 11111 22222<- 33333 44444<-
  13731. 11111<- 22222 33333<- 44444
  13732. 11111 22222<- 33333 44444<-
  13733. 11111<- 22222 33333<- 44444
  13734. Output:
  13735. 22222 44444
  13736. 11111 33333
  13737. 22222 44444
  13738. 11111 33333
  13739. @end example
  13740. @item interlacex2, 6
  13741. Double frame rate with unchanged height. Frames are inserted each
  13742. containing the second temporal field from the previous input frame and
  13743. the first temporal field from the next input frame. This mode relies on
  13744. the top_field_first flag. Useful for interlaced video displays with no
  13745. field synchronisation.
  13746. @example
  13747. ------> time
  13748. Input:
  13749. Frame 1 Frame 2 Frame 3 Frame 4
  13750. 11111 22222 33333 44444
  13751. 11111 22222 33333 44444
  13752. 11111 22222 33333 44444
  13753. 11111 22222 33333 44444
  13754. Output:
  13755. 11111 22222 22222 33333 33333 44444 44444
  13756. 11111 11111 22222 22222 33333 33333 44444
  13757. 11111 22222 22222 33333 33333 44444 44444
  13758. 11111 11111 22222 22222 33333 33333 44444
  13759. @end example
  13760. @item mergex2, 7
  13761. Move odd frames into the upper field, even into the lower field,
  13762. generating a double height frame at same frame rate.
  13763. @example
  13764. ------> time
  13765. Input:
  13766. Frame 1 Frame 2 Frame 3 Frame 4
  13767. 11111 22222 33333 44444
  13768. 11111 22222 33333 44444
  13769. 11111 22222 33333 44444
  13770. 11111 22222 33333 44444
  13771. Output:
  13772. 11111 33333 33333 55555
  13773. 22222 22222 44444 44444
  13774. 11111 33333 33333 55555
  13775. 22222 22222 44444 44444
  13776. 11111 33333 33333 55555
  13777. 22222 22222 44444 44444
  13778. 11111 33333 33333 55555
  13779. 22222 22222 44444 44444
  13780. @end example
  13781. @end table
  13782. Numeric values are deprecated but are accepted for backward
  13783. compatibility reasons.
  13784. Default mode is @code{merge}.
  13785. @item flags
  13786. Specify flags influencing the filter process.
  13787. Available value for @var{flags} is:
  13788. @table @option
  13789. @item low_pass_filter, vlpf
  13790. Enable linear vertical low-pass filtering in the filter.
  13791. Vertical low-pass filtering is required when creating an interlaced
  13792. destination from a progressive source which contains high-frequency
  13793. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13794. patterning.
  13795. @item complex_filter, cvlpf
  13796. Enable complex vertical low-pass filtering.
  13797. This will slightly less reduce interlace 'twitter' and Moire
  13798. patterning but better retain detail and subjective sharpness impression.
  13799. @item bypass_il
  13800. Bypass already interlaced frames, only adjust the frame rate.
  13801. @end table
  13802. Vertical low-pass filtering and bypassing already interlaced frames can only be
  13803. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  13804. @end table
  13805. @section tmix
  13806. Mix successive video frames.
  13807. A description of the accepted options follows.
  13808. @table @option
  13809. @item frames
  13810. The number of successive frames to mix. If unspecified, it defaults to 3.
  13811. @item weights
  13812. Specify weight of each input video frame.
  13813. Each weight is separated by space. If number of weights is smaller than
  13814. number of @var{frames} last specified weight will be used for all remaining
  13815. unset weights.
  13816. @item scale
  13817. Specify scale, if it is set it will be multiplied with sum
  13818. of each weight multiplied with pixel values to give final destination
  13819. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13820. @end table
  13821. @subsection Examples
  13822. @itemize
  13823. @item
  13824. Average 7 successive frames:
  13825. @example
  13826. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13827. @end example
  13828. @item
  13829. Apply simple temporal convolution:
  13830. @example
  13831. tmix=frames=3:weights="-1 3 -1"
  13832. @end example
  13833. @item
  13834. Similar as above but only showing temporal differences:
  13835. @example
  13836. tmix=frames=3:weights="-1 2 -1":scale=1
  13837. @end example
  13838. @end itemize
  13839. @anchor{tonemap}
  13840. @section tonemap
  13841. Tone map colors from different dynamic ranges.
  13842. This filter expects data in single precision floating point, as it needs to
  13843. operate on (and can output) out-of-range values. Another filter, such as
  13844. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13845. The tonemapping algorithms implemented only work on linear light, so input
  13846. data should be linearized beforehand (and possibly correctly tagged).
  13847. @example
  13848. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13849. @end example
  13850. @subsection Options
  13851. The filter accepts the following options.
  13852. @table @option
  13853. @item tonemap
  13854. Set the tone map algorithm to use.
  13855. Possible values are:
  13856. @table @var
  13857. @item none
  13858. Do not apply any tone map, only desaturate overbright pixels.
  13859. @item clip
  13860. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13861. in-range values, while distorting out-of-range values.
  13862. @item linear
  13863. Stretch the entire reference gamut to a linear multiple of the display.
  13864. @item gamma
  13865. Fit a logarithmic transfer between the tone curves.
  13866. @item reinhard
  13867. Preserve overall image brightness with a simple curve, using nonlinear
  13868. contrast, which results in flattening details and degrading color accuracy.
  13869. @item hable
  13870. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13871. of slightly darkening everything. Use it when detail preservation is more
  13872. important than color and brightness accuracy.
  13873. @item mobius
  13874. Smoothly map out-of-range values, while retaining contrast and colors for
  13875. in-range material as much as possible. Use it when color accuracy is more
  13876. important than detail preservation.
  13877. @end table
  13878. Default is none.
  13879. @item param
  13880. Tune the tone mapping algorithm.
  13881. This affects the following algorithms:
  13882. @table @var
  13883. @item none
  13884. Ignored.
  13885. @item linear
  13886. Specifies the scale factor to use while stretching.
  13887. Default to 1.0.
  13888. @item gamma
  13889. Specifies the exponent of the function.
  13890. Default to 1.8.
  13891. @item clip
  13892. Specify an extra linear coefficient to multiply into the signal before clipping.
  13893. Default to 1.0.
  13894. @item reinhard
  13895. Specify the local contrast coefficient at the display peak.
  13896. Default to 0.5, which means that in-gamut values will be about half as bright
  13897. as when clipping.
  13898. @item hable
  13899. Ignored.
  13900. @item mobius
  13901. Specify the transition point from linear to mobius transform. Every value
  13902. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13903. more accurate the result will be, at the cost of losing bright details.
  13904. Default to 0.3, which due to the steep initial slope still preserves in-range
  13905. colors fairly accurately.
  13906. @end table
  13907. @item desat
  13908. Apply desaturation for highlights that exceed this level of brightness. The
  13909. higher the parameter, the more color information will be preserved. This
  13910. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13911. (smoothly) turning into white instead. This makes images feel more natural,
  13912. at the cost of reducing information about out-of-range colors.
  13913. The default of 2.0 is somewhat conservative and will mostly just apply to
  13914. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13915. This option works only if the input frame has a supported color tag.
  13916. @item peak
  13917. Override signal/nominal/reference peak with this value. Useful when the
  13918. embedded peak information in display metadata is not reliable or when tone
  13919. mapping from a lower range to a higher range.
  13920. @end table
  13921. @section tpad
  13922. Temporarily pad video frames.
  13923. The filter accepts the following options:
  13924. @table @option
  13925. @item start
  13926. Specify number of delay frames before input video stream.
  13927. @item stop
  13928. Specify number of padding frames after input video stream.
  13929. Set to -1 to pad indefinitely.
  13930. @item start_mode
  13931. Set kind of frames added to beginning of stream.
  13932. Can be either @var{add} or @var{clone}.
  13933. With @var{add} frames of solid-color are added.
  13934. With @var{clone} frames are clones of first frame.
  13935. @item stop_mode
  13936. Set kind of frames added to end of stream.
  13937. Can be either @var{add} or @var{clone}.
  13938. With @var{add} frames of solid-color are added.
  13939. With @var{clone} frames are clones of last frame.
  13940. @item start_duration, stop_duration
  13941. Specify the duration of the start/stop delay. See
  13942. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13943. for the accepted syntax.
  13944. These options override @var{start} and @var{stop}.
  13945. @item color
  13946. Specify the color of the padded area. For the syntax of this option,
  13947. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13948. manual,ffmpeg-utils}.
  13949. The default value of @var{color} is "black".
  13950. @end table
  13951. @anchor{transpose}
  13952. @section transpose
  13953. Transpose rows with columns in the input video and optionally flip it.
  13954. It accepts the following parameters:
  13955. @table @option
  13956. @item dir
  13957. Specify the transposition direction.
  13958. Can assume the following values:
  13959. @table @samp
  13960. @item 0, 4, cclock_flip
  13961. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13962. @example
  13963. L.R L.l
  13964. . . -> . .
  13965. l.r R.r
  13966. @end example
  13967. @item 1, 5, clock
  13968. Rotate by 90 degrees clockwise, that is:
  13969. @example
  13970. L.R l.L
  13971. . . -> . .
  13972. l.r r.R
  13973. @end example
  13974. @item 2, 6, cclock
  13975. Rotate by 90 degrees counterclockwise, that is:
  13976. @example
  13977. L.R R.r
  13978. . . -> . .
  13979. l.r L.l
  13980. @end example
  13981. @item 3, 7, clock_flip
  13982. Rotate by 90 degrees clockwise and vertically flip, that is:
  13983. @example
  13984. L.R r.R
  13985. . . -> . .
  13986. l.r l.L
  13987. @end example
  13988. @end table
  13989. For values between 4-7, the transposition is only done if the input
  13990. video geometry is portrait and not landscape. These values are
  13991. deprecated, the @code{passthrough} option should be used instead.
  13992. Numerical values are deprecated, and should be dropped in favor of
  13993. symbolic constants.
  13994. @item passthrough
  13995. Do not apply the transposition if the input geometry matches the one
  13996. specified by the specified value. It accepts the following values:
  13997. @table @samp
  13998. @item none
  13999. Always apply transposition.
  14000. @item portrait
  14001. Preserve portrait geometry (when @var{height} >= @var{width}).
  14002. @item landscape
  14003. Preserve landscape geometry (when @var{width} >= @var{height}).
  14004. @end table
  14005. Default value is @code{none}.
  14006. @end table
  14007. For example to rotate by 90 degrees clockwise and preserve portrait
  14008. layout:
  14009. @example
  14010. transpose=dir=1:passthrough=portrait
  14011. @end example
  14012. The command above can also be specified as:
  14013. @example
  14014. transpose=1:portrait
  14015. @end example
  14016. @section transpose_npp
  14017. Transpose rows with columns in the input video and optionally flip it.
  14018. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14019. It accepts the following parameters:
  14020. @table @option
  14021. @item dir
  14022. Specify the transposition direction.
  14023. Can assume the following values:
  14024. @table @samp
  14025. @item cclock_flip
  14026. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14027. @item clock
  14028. Rotate by 90 degrees clockwise.
  14029. @item cclock
  14030. Rotate by 90 degrees counterclockwise.
  14031. @item clock_flip
  14032. Rotate by 90 degrees clockwise and vertically flip.
  14033. @end table
  14034. @item passthrough
  14035. Do not apply the transposition if the input geometry matches the one
  14036. specified by the specified value. It accepts the following values:
  14037. @table @samp
  14038. @item none
  14039. Always apply transposition. (default)
  14040. @item portrait
  14041. Preserve portrait geometry (when @var{height} >= @var{width}).
  14042. @item landscape
  14043. Preserve landscape geometry (when @var{width} >= @var{height}).
  14044. @end table
  14045. @end table
  14046. @section trim
  14047. Trim the input so that the output contains one continuous subpart of the input.
  14048. It accepts the following parameters:
  14049. @table @option
  14050. @item start
  14051. Specify the time of the start of the kept section, i.e. the frame with the
  14052. timestamp @var{start} will be the first frame in the output.
  14053. @item end
  14054. Specify the time of the first frame that will be dropped, i.e. the frame
  14055. immediately preceding the one with the timestamp @var{end} will be the last
  14056. frame in the output.
  14057. @item start_pts
  14058. This is the same as @var{start}, except this option sets the start timestamp
  14059. in timebase units instead of seconds.
  14060. @item end_pts
  14061. This is the same as @var{end}, except this option sets the end timestamp
  14062. in timebase units instead of seconds.
  14063. @item duration
  14064. The maximum duration of the output in seconds.
  14065. @item start_frame
  14066. The number of the first frame that should be passed to the output.
  14067. @item end_frame
  14068. The number of the first frame that should be dropped.
  14069. @end table
  14070. @option{start}, @option{end}, and @option{duration} are expressed as time
  14071. duration specifications; see
  14072. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14073. for the accepted syntax.
  14074. Note that the first two sets of the start/end options and the @option{duration}
  14075. option look at the frame timestamp, while the _frame variants simply count the
  14076. frames that pass through the filter. Also note that this filter does not modify
  14077. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14078. setpts filter after the trim filter.
  14079. If multiple start or end options are set, this filter tries to be greedy and
  14080. keep all the frames that match at least one of the specified constraints. To keep
  14081. only the part that matches all the constraints at once, chain multiple trim
  14082. filters.
  14083. The defaults are such that all the input is kept. So it is possible to set e.g.
  14084. just the end values to keep everything before the specified time.
  14085. Examples:
  14086. @itemize
  14087. @item
  14088. Drop everything except the second minute of input:
  14089. @example
  14090. ffmpeg -i INPUT -vf trim=60:120
  14091. @end example
  14092. @item
  14093. Keep only the first second:
  14094. @example
  14095. ffmpeg -i INPUT -vf trim=duration=1
  14096. @end example
  14097. @end itemize
  14098. @section unpremultiply
  14099. Apply alpha unpremultiply effect to input video stream using first plane
  14100. of second stream as alpha.
  14101. Both streams must have same dimensions and same pixel format.
  14102. The filter accepts the following option:
  14103. @table @option
  14104. @item planes
  14105. Set which planes will be processed, unprocessed planes will be copied.
  14106. By default value 0xf, all planes will be processed.
  14107. If the format has 1 or 2 components, then luma is bit 0.
  14108. If the format has 3 or 4 components:
  14109. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14110. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14111. If present, the alpha channel is always the last bit.
  14112. @item inplace
  14113. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14114. @end table
  14115. @anchor{unsharp}
  14116. @section unsharp
  14117. Sharpen or blur the input video.
  14118. It accepts the following parameters:
  14119. @table @option
  14120. @item luma_msize_x, lx
  14121. Set the luma matrix horizontal size. It must be an odd integer between
  14122. 3 and 23. The default value is 5.
  14123. @item luma_msize_y, ly
  14124. Set the luma matrix vertical size. It must be an odd integer between 3
  14125. and 23. The default value is 5.
  14126. @item luma_amount, la
  14127. Set the luma effect strength. It must be a floating point number, reasonable
  14128. values lay between -1.5 and 1.5.
  14129. Negative values will blur the input video, while positive values will
  14130. sharpen it, a value of zero will disable the effect.
  14131. Default value is 1.0.
  14132. @item chroma_msize_x, cx
  14133. Set the chroma matrix horizontal size. It must be an odd integer
  14134. between 3 and 23. The default value is 5.
  14135. @item chroma_msize_y, cy
  14136. Set the chroma matrix vertical size. It must be an odd integer
  14137. between 3 and 23. The default value is 5.
  14138. @item chroma_amount, ca
  14139. Set the chroma effect strength. It must be a floating point number, reasonable
  14140. values lay between -1.5 and 1.5.
  14141. Negative values will blur the input video, while positive values will
  14142. sharpen it, a value of zero will disable the effect.
  14143. Default value is 0.0.
  14144. @end table
  14145. All parameters are optional and default to the equivalent of the
  14146. string '5:5:1.0:5:5:0.0'.
  14147. @subsection Examples
  14148. @itemize
  14149. @item
  14150. Apply strong luma sharpen effect:
  14151. @example
  14152. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14153. @end example
  14154. @item
  14155. Apply a strong blur of both luma and chroma parameters:
  14156. @example
  14157. unsharp=7:7:-2:7:7:-2
  14158. @end example
  14159. @end itemize
  14160. @section uspp
  14161. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14162. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14163. shifts and average the results.
  14164. The way this differs from the behavior of spp is that uspp actually encodes &
  14165. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14166. DCT similar to MJPEG.
  14167. The filter accepts the following options:
  14168. @table @option
  14169. @item quality
  14170. Set quality. This option defines the number of levels for averaging. It accepts
  14171. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14172. effect. A value of @code{8} means the higher quality. For each increment of
  14173. that value the speed drops by a factor of approximately 2. Default value is
  14174. @code{3}.
  14175. @item qp
  14176. Force a constant quantization parameter. If not set, the filter will use the QP
  14177. from the video stream (if available).
  14178. @end table
  14179. @section v360
  14180. Convert 360 videos between various formats.
  14181. The filter accepts the following options:
  14182. @table @option
  14183. @item input
  14184. @item output
  14185. Set format of the input/output video.
  14186. Available formats:
  14187. @table @samp
  14188. @item e
  14189. @item equirect
  14190. Equirectangular projection.
  14191. @item c3x2
  14192. @item c6x1
  14193. @item c1x6
  14194. Cubemap with 3x2/6x1/1x6 layout.
  14195. Format specific options:
  14196. @table @option
  14197. @item in_pad
  14198. @item out_pad
  14199. Set padding proportion for the input/output cubemap. Values in decimals.
  14200. Example values:
  14201. @table @samp
  14202. @item 0
  14203. No padding.
  14204. @item 0.01
  14205. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  14206. @end table
  14207. Default value is @b{@samp{0}}.
  14208. @item fin_pad
  14209. @item fout_pad
  14210. Set fixed padding for the input/output cubemap. Values in pixels.
  14211. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14212. @item in_forder
  14213. @item out_forder
  14214. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14215. Designation of directions:
  14216. @table @samp
  14217. @item r
  14218. right
  14219. @item l
  14220. left
  14221. @item u
  14222. up
  14223. @item d
  14224. down
  14225. @item f
  14226. forward
  14227. @item b
  14228. back
  14229. @end table
  14230. Default value is @b{@samp{rludfb}}.
  14231. @item in_frot
  14232. @item out_frot
  14233. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14234. Designation of angles:
  14235. @table @samp
  14236. @item 0
  14237. 0 degrees clockwise
  14238. @item 1
  14239. 90 degrees clockwise
  14240. @item 2
  14241. 180 degrees clockwise
  14242. @item 3
  14243. 270 degrees clockwise
  14244. @end table
  14245. Default value is @b{@samp{000000}}.
  14246. @end table
  14247. @item eac
  14248. Equi-Angular Cubemap.
  14249. @item flat
  14250. @item gnomonic
  14251. @item rectilinear
  14252. Regular video. @i{(output only)}
  14253. Format specific options:
  14254. @table @option
  14255. @item h_fov
  14256. @item v_fov
  14257. @item d_fov
  14258. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14259. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14260. @end table
  14261. @item dfisheye
  14262. Dual fisheye.
  14263. Format specific options:
  14264. @table @option
  14265. @item in_pad
  14266. @item out_pad
  14267. Set padding proportion. Values in decimals.
  14268. Example values:
  14269. @table @samp
  14270. @item 0
  14271. No padding.
  14272. @item 0.01
  14273. 1% padding.
  14274. @end table
  14275. Default value is @b{@samp{0}}.
  14276. @end table
  14277. @item barrel
  14278. @item fb
  14279. Facebook's 360 format.
  14280. @item sg
  14281. Stereographic format.
  14282. Format specific options:
  14283. @table @option
  14284. @item h_fov
  14285. @item v_fov
  14286. @item d_fov
  14287. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14288. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14289. @end table
  14290. @item mercator
  14291. Mercator format.
  14292. @item ball
  14293. Ball format, gives significant distortion toward the back.
  14294. @item hammer
  14295. Hammer-Aitoff map projection format.
  14296. @item sinusoidal
  14297. Sinusoidal map projection format.
  14298. @end table
  14299. @item interp
  14300. Set interpolation method.@*
  14301. @i{Note: more complex interpolation methods require much more memory to run.}
  14302. Available methods:
  14303. @table @samp
  14304. @item near
  14305. @item nearest
  14306. Nearest neighbour.
  14307. @item line
  14308. @item linear
  14309. Bilinear interpolation.
  14310. @item cube
  14311. @item cubic
  14312. Bicubic interpolation.
  14313. @item lanc
  14314. @item lanczos
  14315. Lanczos interpolation.
  14316. @end table
  14317. Default value is @b{@samp{line}}.
  14318. @item w
  14319. @item h
  14320. Set the output video resolution.
  14321. Default resolution depends on formats.
  14322. @item in_stereo
  14323. @item out_stereo
  14324. Set the input/output stereo format.
  14325. @table @samp
  14326. @item 2d
  14327. 2D mono
  14328. @item sbs
  14329. Side by side
  14330. @item tb
  14331. Top bottom
  14332. @end table
  14333. Default value is @b{@samp{2d}} for input and output format.
  14334. @item yaw
  14335. @item pitch
  14336. @item roll
  14337. Set rotation for the output video. Values in degrees.
  14338. @item rorder
  14339. Set rotation order for the output video. Choose one item for each position.
  14340. @table @samp
  14341. @item y, Y
  14342. yaw
  14343. @item p, P
  14344. pitch
  14345. @item r, R
  14346. roll
  14347. @end table
  14348. Default value is @b{@samp{ypr}}.
  14349. @item h_flip
  14350. @item v_flip
  14351. @item d_flip
  14352. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14353. @item ih_flip
  14354. @item iv_flip
  14355. Set if input video is flipped horizontally/vertically. Boolean values.
  14356. @item in_trans
  14357. Set if input video is transposed. Boolean value, by default disabled.
  14358. @item out_trans
  14359. Set if output video needs to be transposed. Boolean value, by default disabled.
  14360. @end table
  14361. @subsection Examples
  14362. @itemize
  14363. @item
  14364. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14365. @example
  14366. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14367. @end example
  14368. @item
  14369. Extract back view of Equi-Angular Cubemap:
  14370. @example
  14371. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14372. @end example
  14373. @item
  14374. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14375. @example
  14376. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14377. @end example
  14378. @end itemize
  14379. @section vaguedenoiser
  14380. Apply a wavelet based denoiser.
  14381. It transforms each frame from the video input into the wavelet domain,
  14382. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14383. the obtained coefficients. It does an inverse wavelet transform after.
  14384. Due to wavelet properties, it should give a nice smoothed result, and
  14385. reduced noise, without blurring picture features.
  14386. This filter accepts the following options:
  14387. @table @option
  14388. @item threshold
  14389. The filtering strength. The higher, the more filtered the video will be.
  14390. Hard thresholding can use a higher threshold than soft thresholding
  14391. before the video looks overfiltered. Default value is 2.
  14392. @item method
  14393. The filtering method the filter will use.
  14394. It accepts the following values:
  14395. @table @samp
  14396. @item hard
  14397. All values under the threshold will be zeroed.
  14398. @item soft
  14399. All values under the threshold will be zeroed. All values above will be
  14400. reduced by the threshold.
  14401. @item garrote
  14402. Scales or nullifies coefficients - intermediary between (more) soft and
  14403. (less) hard thresholding.
  14404. @end table
  14405. Default is garrote.
  14406. @item nsteps
  14407. Number of times, the wavelet will decompose the picture. Picture can't
  14408. be decomposed beyond a particular point (typically, 8 for a 640x480
  14409. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14410. @item percent
  14411. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14412. @item planes
  14413. A list of the planes to process. By default all planes are processed.
  14414. @end table
  14415. @section vectorscope
  14416. Display 2 color component values in the two dimensional graph (which is called
  14417. a vectorscope).
  14418. This filter accepts the following options:
  14419. @table @option
  14420. @item mode, m
  14421. Set vectorscope mode.
  14422. It accepts the following values:
  14423. @table @samp
  14424. @item gray
  14425. Gray values are displayed on graph, higher brightness means more pixels have
  14426. same component color value on location in graph. This is the default mode.
  14427. @item color
  14428. Gray values are displayed on graph. Surrounding pixels values which are not
  14429. present in video frame are drawn in gradient of 2 color components which are
  14430. set by option @code{x} and @code{y}. The 3rd color component is static.
  14431. @item color2
  14432. Actual color components values present in video frame are displayed on graph.
  14433. @item color3
  14434. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14435. on graph increases value of another color component, which is luminance by
  14436. default values of @code{x} and @code{y}.
  14437. @item color4
  14438. Actual colors present in video frame are displayed on graph. If two different
  14439. colors map to same position on graph then color with higher value of component
  14440. not present in graph is picked.
  14441. @item color5
  14442. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14443. component picked from radial gradient.
  14444. @end table
  14445. @item x
  14446. Set which color component will be represented on X-axis. Default is @code{1}.
  14447. @item y
  14448. Set which color component will be represented on Y-axis. Default is @code{2}.
  14449. @item intensity, i
  14450. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14451. of color component which represents frequency of (X, Y) location in graph.
  14452. @item envelope, e
  14453. @table @samp
  14454. @item none
  14455. No envelope, this is default.
  14456. @item instant
  14457. Instant envelope, even darkest single pixel will be clearly highlighted.
  14458. @item peak
  14459. Hold maximum and minimum values presented in graph over time. This way you
  14460. can still spot out of range values without constantly looking at vectorscope.
  14461. @item peak+instant
  14462. Peak and instant envelope combined together.
  14463. @end table
  14464. @item graticule, g
  14465. Set what kind of graticule to draw.
  14466. @table @samp
  14467. @item none
  14468. @item green
  14469. @item color
  14470. @end table
  14471. @item opacity, o
  14472. Set graticule opacity.
  14473. @item flags, f
  14474. Set graticule flags.
  14475. @table @samp
  14476. @item white
  14477. Draw graticule for white point.
  14478. @item black
  14479. Draw graticule for black point.
  14480. @item name
  14481. Draw color points short names.
  14482. @end table
  14483. @item bgopacity, b
  14484. Set background opacity.
  14485. @item lthreshold, l
  14486. Set low threshold for color component not represented on X or Y axis.
  14487. Values lower than this value will be ignored. Default is 0.
  14488. Note this value is multiplied with actual max possible value one pixel component
  14489. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14490. is 0.1 * 255 = 25.
  14491. @item hthreshold, h
  14492. Set high threshold for color component not represented on X or Y axis.
  14493. Values higher than this value will be ignored. Default is 1.
  14494. Note this value is multiplied with actual max possible value one pixel component
  14495. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14496. is 0.9 * 255 = 230.
  14497. @item colorspace, c
  14498. Set what kind of colorspace to use when drawing graticule.
  14499. @table @samp
  14500. @item auto
  14501. @item 601
  14502. @item 709
  14503. @end table
  14504. Default is auto.
  14505. @end table
  14506. @anchor{vidstabdetect}
  14507. @section vidstabdetect
  14508. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14509. @ref{vidstabtransform} for pass 2.
  14510. This filter generates a file with relative translation and rotation
  14511. transform information about subsequent frames, which is then used by
  14512. the @ref{vidstabtransform} filter.
  14513. To enable compilation of this filter you need to configure FFmpeg with
  14514. @code{--enable-libvidstab}.
  14515. This filter accepts the following options:
  14516. @table @option
  14517. @item result
  14518. Set the path to the file used to write the transforms information.
  14519. Default value is @file{transforms.trf}.
  14520. @item shakiness
  14521. Set how shaky the video is and how quick the camera is. It accepts an
  14522. integer in the range 1-10, a value of 1 means little shakiness, a
  14523. value of 10 means strong shakiness. Default value is 5.
  14524. @item accuracy
  14525. Set the accuracy of the detection process. It must be a value in the
  14526. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14527. accuracy. Default value is 15.
  14528. @item stepsize
  14529. Set stepsize of the search process. The region around minimum is
  14530. scanned with 1 pixel resolution. Default value is 6.
  14531. @item mincontrast
  14532. Set minimum contrast. Below this value a local measurement field is
  14533. discarded. Must be a floating point value in the range 0-1. Default
  14534. value is 0.3.
  14535. @item tripod
  14536. Set reference frame number for tripod mode.
  14537. If enabled, the motion of the frames is compared to a reference frame
  14538. in the filtered stream, identified by the specified number. The idea
  14539. is to compensate all movements in a more-or-less static scene and keep
  14540. the camera view absolutely still.
  14541. If set to 0, it is disabled. The frames are counted starting from 1.
  14542. @item show
  14543. Show fields and transforms in the resulting frames. It accepts an
  14544. integer in the range 0-2. Default value is 0, which disables any
  14545. visualization.
  14546. @end table
  14547. @subsection Examples
  14548. @itemize
  14549. @item
  14550. Use default values:
  14551. @example
  14552. vidstabdetect
  14553. @end example
  14554. @item
  14555. Analyze strongly shaky movie and put the results in file
  14556. @file{mytransforms.trf}:
  14557. @example
  14558. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14559. @end example
  14560. @item
  14561. Visualize the result of internal transformations in the resulting
  14562. video:
  14563. @example
  14564. vidstabdetect=show=1
  14565. @end example
  14566. @item
  14567. Analyze a video with medium shakiness using @command{ffmpeg}:
  14568. @example
  14569. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14570. @end example
  14571. @end itemize
  14572. @anchor{vidstabtransform}
  14573. @section vidstabtransform
  14574. Video stabilization/deshaking: pass 2 of 2,
  14575. see @ref{vidstabdetect} for pass 1.
  14576. Read a file with transform information for each frame and
  14577. apply/compensate them. Together with the @ref{vidstabdetect}
  14578. filter this can be used to deshake videos. See also
  14579. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14580. the @ref{unsharp} filter, see below.
  14581. To enable compilation of this filter you need to configure FFmpeg with
  14582. @code{--enable-libvidstab}.
  14583. @subsection Options
  14584. @table @option
  14585. @item input
  14586. Set path to the file used to read the transforms. Default value is
  14587. @file{transforms.trf}.
  14588. @item smoothing
  14589. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14590. camera movements. Default value is 10.
  14591. For example a number of 10 means that 21 frames are used (10 in the
  14592. past and 10 in the future) to smoothen the motion in the video. A
  14593. larger value leads to a smoother video, but limits the acceleration of
  14594. the camera (pan/tilt movements). 0 is a special case where a static
  14595. camera is simulated.
  14596. @item optalgo
  14597. Set the camera path optimization algorithm.
  14598. Accepted values are:
  14599. @table @samp
  14600. @item gauss
  14601. gaussian kernel low-pass filter on camera motion (default)
  14602. @item avg
  14603. averaging on transformations
  14604. @end table
  14605. @item maxshift
  14606. Set maximal number of pixels to translate frames. Default value is -1,
  14607. meaning no limit.
  14608. @item maxangle
  14609. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14610. value is -1, meaning no limit.
  14611. @item crop
  14612. Specify how to deal with borders that may be visible due to movement
  14613. compensation.
  14614. Available values are:
  14615. @table @samp
  14616. @item keep
  14617. keep image information from previous frame (default)
  14618. @item black
  14619. fill the border black
  14620. @end table
  14621. @item invert
  14622. Invert transforms if set to 1. Default value is 0.
  14623. @item relative
  14624. Consider transforms as relative to previous frame if set to 1,
  14625. absolute if set to 0. Default value is 0.
  14626. @item zoom
  14627. Set percentage to zoom. A positive value will result in a zoom-in
  14628. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14629. zoom).
  14630. @item optzoom
  14631. Set optimal zooming to avoid borders.
  14632. Accepted values are:
  14633. @table @samp
  14634. @item 0
  14635. disabled
  14636. @item 1
  14637. optimal static zoom value is determined (only very strong movements
  14638. will lead to visible borders) (default)
  14639. @item 2
  14640. optimal adaptive zoom value is determined (no borders will be
  14641. visible), see @option{zoomspeed}
  14642. @end table
  14643. Note that the value given at zoom is added to the one calculated here.
  14644. @item zoomspeed
  14645. Set percent to zoom maximally each frame (enabled when
  14646. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14647. 0.25.
  14648. @item interpol
  14649. Specify type of interpolation.
  14650. Available values are:
  14651. @table @samp
  14652. @item no
  14653. no interpolation
  14654. @item linear
  14655. linear only horizontal
  14656. @item bilinear
  14657. linear in both directions (default)
  14658. @item bicubic
  14659. cubic in both directions (slow)
  14660. @end table
  14661. @item tripod
  14662. Enable virtual tripod mode if set to 1, which is equivalent to
  14663. @code{relative=0:smoothing=0}. Default value is 0.
  14664. Use also @code{tripod} option of @ref{vidstabdetect}.
  14665. @item debug
  14666. Increase log verbosity if set to 1. Also the detected global motions
  14667. are written to the temporary file @file{global_motions.trf}. Default
  14668. value is 0.
  14669. @end table
  14670. @subsection Examples
  14671. @itemize
  14672. @item
  14673. Use @command{ffmpeg} for a typical stabilization with default values:
  14674. @example
  14675. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14676. @end example
  14677. Note the use of the @ref{unsharp} filter which is always recommended.
  14678. @item
  14679. Zoom in a bit more and load transform data from a given file:
  14680. @example
  14681. vidstabtransform=zoom=5:input="mytransforms.trf"
  14682. @end example
  14683. @item
  14684. Smoothen the video even more:
  14685. @example
  14686. vidstabtransform=smoothing=30
  14687. @end example
  14688. @end itemize
  14689. @section vflip
  14690. Flip the input video vertically.
  14691. For example, to vertically flip a video with @command{ffmpeg}:
  14692. @example
  14693. ffmpeg -i in.avi -vf "vflip" out.avi
  14694. @end example
  14695. @section vfrdet
  14696. Detect variable frame rate video.
  14697. This filter tries to detect if the input is variable or constant frame rate.
  14698. At end it will output number of frames detected as having variable delta pts,
  14699. and ones with constant delta pts.
  14700. If there was frames with variable delta, than it will also show min, max and
  14701. average delta encountered.
  14702. @section vibrance
  14703. Boost or alter saturation.
  14704. The filter accepts the following options:
  14705. @table @option
  14706. @item intensity
  14707. Set strength of boost if positive value or strength of alter if negative value.
  14708. Default is 0. Allowed range is from -2 to 2.
  14709. @item rbal
  14710. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14711. @item gbal
  14712. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14713. @item bbal
  14714. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14715. @item rlum
  14716. Set the red luma coefficient.
  14717. @item glum
  14718. Set the green luma coefficient.
  14719. @item blum
  14720. Set the blue luma coefficient.
  14721. @item alternate
  14722. If @code{intensity} is negative and this is set to 1, colors will change,
  14723. otherwise colors will be less saturated, more towards gray.
  14724. @end table
  14725. @anchor{vignette}
  14726. @section vignette
  14727. Make or reverse a natural vignetting effect.
  14728. The filter accepts the following options:
  14729. @table @option
  14730. @item angle, a
  14731. Set lens angle expression as a number of radians.
  14732. The value is clipped in the @code{[0,PI/2]} range.
  14733. Default value: @code{"PI/5"}
  14734. @item x0
  14735. @item y0
  14736. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14737. by default.
  14738. @item mode
  14739. Set forward/backward mode.
  14740. Available modes are:
  14741. @table @samp
  14742. @item forward
  14743. The larger the distance from the central point, the darker the image becomes.
  14744. @item backward
  14745. The larger the distance from the central point, the brighter the image becomes.
  14746. This can be used to reverse a vignette effect, though there is no automatic
  14747. detection to extract the lens @option{angle} and other settings (yet). It can
  14748. also be used to create a burning effect.
  14749. @end table
  14750. Default value is @samp{forward}.
  14751. @item eval
  14752. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14753. It accepts the following values:
  14754. @table @samp
  14755. @item init
  14756. Evaluate expressions only once during the filter initialization.
  14757. @item frame
  14758. Evaluate expressions for each incoming frame. This is way slower than the
  14759. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14760. allows advanced dynamic expressions.
  14761. @end table
  14762. Default value is @samp{init}.
  14763. @item dither
  14764. Set dithering to reduce the circular banding effects. Default is @code{1}
  14765. (enabled).
  14766. @item aspect
  14767. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14768. Setting this value to the SAR of the input will make a rectangular vignetting
  14769. following the dimensions of the video.
  14770. Default is @code{1/1}.
  14771. @end table
  14772. @subsection Expressions
  14773. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14774. following parameters.
  14775. @table @option
  14776. @item w
  14777. @item h
  14778. input width and height
  14779. @item n
  14780. the number of input frame, starting from 0
  14781. @item pts
  14782. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14783. @var{TB} units, NAN if undefined
  14784. @item r
  14785. frame rate of the input video, NAN if the input frame rate is unknown
  14786. @item t
  14787. the PTS (Presentation TimeStamp) of the filtered video frame,
  14788. expressed in seconds, NAN if undefined
  14789. @item tb
  14790. time base of the input video
  14791. @end table
  14792. @subsection Examples
  14793. @itemize
  14794. @item
  14795. Apply simple strong vignetting effect:
  14796. @example
  14797. vignette=PI/4
  14798. @end example
  14799. @item
  14800. Make a flickering vignetting:
  14801. @example
  14802. vignette='PI/4+random(1)*PI/50':eval=frame
  14803. @end example
  14804. @end itemize
  14805. @section vmafmotion
  14806. Obtain the average VMAF motion score of a video.
  14807. It is one of the component metrics of VMAF.
  14808. The obtained average motion score is printed through the logging system.
  14809. The filter accepts the following options:
  14810. @table @option
  14811. @item stats_file
  14812. If specified, the filter will use the named file to save the motion score of
  14813. each frame with respect to the previous frame.
  14814. When filename equals "-" the data is sent to standard output.
  14815. @end table
  14816. Example:
  14817. @example
  14818. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  14819. @end example
  14820. @section vstack
  14821. Stack input videos vertically.
  14822. All streams must be of same pixel format and of same width.
  14823. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14824. to create same output.
  14825. The filter accepts the following options:
  14826. @table @option
  14827. @item inputs
  14828. Set number of input streams. Default is 2.
  14829. @item shortest
  14830. If set to 1, force the output to terminate when the shortest input
  14831. terminates. Default value is 0.
  14832. @end table
  14833. @section w3fdif
  14834. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14835. Deinterlacing Filter").
  14836. Based on the process described by Martin Weston for BBC R&D, and
  14837. implemented based on the de-interlace algorithm written by Jim
  14838. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14839. uses filter coefficients calculated by BBC R&D.
  14840. This filter uses field-dominance information in frame to decide which
  14841. of each pair of fields to place first in the output.
  14842. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14843. There are two sets of filter coefficients, so called "simple"
  14844. and "complex". Which set of filter coefficients is used can
  14845. be set by passing an optional parameter:
  14846. @table @option
  14847. @item filter
  14848. Set the interlacing filter coefficients. Accepts one of the following values:
  14849. @table @samp
  14850. @item simple
  14851. Simple filter coefficient set.
  14852. @item complex
  14853. More-complex filter coefficient set.
  14854. @end table
  14855. Default value is @samp{complex}.
  14856. @item deint
  14857. Specify which frames to deinterlace. Accepts one of the following values:
  14858. @table @samp
  14859. @item all
  14860. Deinterlace all frames,
  14861. @item interlaced
  14862. Only deinterlace frames marked as interlaced.
  14863. @end table
  14864. Default value is @samp{all}.
  14865. @end table
  14866. @section waveform
  14867. Video waveform monitor.
  14868. The waveform monitor plots color component intensity. By default luminance
  14869. only. Each column of the waveform corresponds to a column of pixels in the
  14870. source video.
  14871. It accepts the following options:
  14872. @table @option
  14873. @item mode, m
  14874. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14875. In row mode, the graph on the left side represents color component value 0 and
  14876. the right side represents value = 255. In column mode, the top side represents
  14877. color component value = 0 and bottom side represents value = 255.
  14878. @item intensity, i
  14879. Set intensity. Smaller values are useful to find out how many values of the same
  14880. luminance are distributed across input rows/columns.
  14881. Default value is @code{0.04}. Allowed range is [0, 1].
  14882. @item mirror, r
  14883. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14884. In mirrored mode, higher values will be represented on the left
  14885. side for @code{row} mode and at the top for @code{column} mode. Default is
  14886. @code{1} (mirrored).
  14887. @item display, d
  14888. Set display mode.
  14889. It accepts the following values:
  14890. @table @samp
  14891. @item overlay
  14892. Presents information identical to that in the @code{parade}, except
  14893. that the graphs representing color components are superimposed directly
  14894. over one another.
  14895. This display mode makes it easier to spot relative differences or similarities
  14896. in overlapping areas of the color components that are supposed to be identical,
  14897. such as neutral whites, grays, or blacks.
  14898. @item stack
  14899. Display separate graph for the color components side by side in
  14900. @code{row} mode or one below the other in @code{column} mode.
  14901. @item parade
  14902. Display separate graph for the color components side by side in
  14903. @code{column} mode or one below the other in @code{row} mode.
  14904. Using this display mode makes it easy to spot color casts in the highlights
  14905. and shadows of an image, by comparing the contours of the top and the bottom
  14906. graphs of each waveform. Since whites, grays, and blacks are characterized
  14907. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14908. should display three waveforms of roughly equal width/height. If not, the
  14909. correction is easy to perform by making level adjustments the three waveforms.
  14910. @end table
  14911. Default is @code{stack}.
  14912. @item components, c
  14913. Set which color components to display. Default is 1, which means only luminance
  14914. or red color component if input is in RGB colorspace. If is set for example to
  14915. 7 it will display all 3 (if) available color components.
  14916. @item envelope, e
  14917. @table @samp
  14918. @item none
  14919. No envelope, this is default.
  14920. @item instant
  14921. Instant envelope, minimum and maximum values presented in graph will be easily
  14922. visible even with small @code{step} value.
  14923. @item peak
  14924. Hold minimum and maximum values presented in graph across time. This way you
  14925. can still spot out of range values without constantly looking at waveforms.
  14926. @item peak+instant
  14927. Peak and instant envelope combined together.
  14928. @end table
  14929. @item filter, f
  14930. @table @samp
  14931. @item lowpass
  14932. No filtering, this is default.
  14933. @item flat
  14934. Luma and chroma combined together.
  14935. @item aflat
  14936. Similar as above, but shows difference between blue and red chroma.
  14937. @item xflat
  14938. Similar as above, but use different colors.
  14939. @item yflat
  14940. Similar as above, but again with different colors.
  14941. @item chroma
  14942. Displays only chroma.
  14943. @item color
  14944. Displays actual color value on waveform.
  14945. @item acolor
  14946. Similar as above, but with luma showing frequency of chroma values.
  14947. @end table
  14948. @item graticule, g
  14949. Set which graticule to display.
  14950. @table @samp
  14951. @item none
  14952. Do not display graticule.
  14953. @item green
  14954. Display green graticule showing legal broadcast ranges.
  14955. @item orange
  14956. Display orange graticule showing legal broadcast ranges.
  14957. @item invert
  14958. Display invert graticule showing legal broadcast ranges.
  14959. @end table
  14960. @item opacity, o
  14961. Set graticule opacity.
  14962. @item flags, fl
  14963. Set graticule flags.
  14964. @table @samp
  14965. @item numbers
  14966. Draw numbers above lines. By default enabled.
  14967. @item dots
  14968. Draw dots instead of lines.
  14969. @end table
  14970. @item scale, s
  14971. Set scale used for displaying graticule.
  14972. @table @samp
  14973. @item digital
  14974. @item millivolts
  14975. @item ire
  14976. @end table
  14977. Default is digital.
  14978. @item bgopacity, b
  14979. Set background opacity.
  14980. @end table
  14981. @section weave, doubleweave
  14982. The @code{weave} takes a field-based video input and join
  14983. each two sequential fields into single frame, producing a new double
  14984. height clip with half the frame rate and half the frame count.
  14985. The @code{doubleweave} works same as @code{weave} but without
  14986. halving frame rate and frame count.
  14987. It accepts the following option:
  14988. @table @option
  14989. @item first_field
  14990. Set first field. Available values are:
  14991. @table @samp
  14992. @item top, t
  14993. Set the frame as top-field-first.
  14994. @item bottom, b
  14995. Set the frame as bottom-field-first.
  14996. @end table
  14997. @end table
  14998. @subsection Examples
  14999. @itemize
  15000. @item
  15001. Interlace video using @ref{select} and @ref{separatefields} filter:
  15002. @example
  15003. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15004. @end example
  15005. @end itemize
  15006. @section xbr
  15007. Apply the xBR high-quality magnification filter which is designed for pixel
  15008. art. It follows a set of edge-detection rules, see
  15009. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15010. It accepts the following option:
  15011. @table @option
  15012. @item n
  15013. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15014. @code{3xBR} and @code{4} for @code{4xBR}.
  15015. Default is @code{3}.
  15016. @end table
  15017. @section xmedian
  15018. Pick median pixels from several input videos.
  15019. The filter accepts the following options:
  15020. @table @option
  15021. @item inputs
  15022. Set number of inputs.
  15023. Default is 3. Allowed range is from 3 to 255.
  15024. If number of inputs is even number, than result will be mean value between two median values.
  15025. @item planes
  15026. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15027. @end table
  15028. @section xstack
  15029. Stack video inputs into custom layout.
  15030. All streams must be of same pixel format.
  15031. The filter accepts the following options:
  15032. @table @option
  15033. @item inputs
  15034. Set number of input streams. Default is 2.
  15035. @item layout
  15036. Specify layout of inputs.
  15037. This option requires the desired layout configuration to be explicitly set by the user.
  15038. This sets position of each video input in output. Each input
  15039. is separated by '|'.
  15040. The first number represents the column, and the second number represents the row.
  15041. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15042. where X is video input from which to take width or height.
  15043. Multiple values can be used when separated by '+'. In such
  15044. case values are summed together.
  15045. Note that if inputs are of different sizes gaps may appear, as not all of
  15046. the output video frame will be filled. Similarly, videos can overlap each
  15047. other if their position doesn't leave enough space for the full frame of
  15048. adjoining videos.
  15049. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15050. a layout must be set by the user.
  15051. @item shortest
  15052. If set to 1, force the output to terminate when the shortest input
  15053. terminates. Default value is 0.
  15054. @end table
  15055. @subsection Examples
  15056. @itemize
  15057. @item
  15058. Display 4 inputs into 2x2 grid.
  15059. Layout:
  15060. @example
  15061. input1(0, 0) | input3(w0, 0)
  15062. input2(0, h0) | input4(w0, h0)
  15063. @end example
  15064. @example
  15065. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15066. @end example
  15067. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15068. @item
  15069. Display 4 inputs into 1x4 grid.
  15070. Layout:
  15071. @example
  15072. input1(0, 0)
  15073. input2(0, h0)
  15074. input3(0, h0+h1)
  15075. input4(0, h0+h1+h2)
  15076. @end example
  15077. @example
  15078. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15079. @end example
  15080. Note that if inputs are of different widths, unused space will appear.
  15081. @item
  15082. Display 9 inputs into 3x3 grid.
  15083. Layout:
  15084. @example
  15085. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15086. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15087. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15088. @end example
  15089. @example
  15090. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  15091. @end example
  15092. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15093. @item
  15094. Display 16 inputs into 4x4 grid.
  15095. Layout:
  15096. @example
  15097. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15098. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15099. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15100. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15101. @end example
  15102. @example
  15103. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  15104. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  15105. @end example
  15106. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15107. @end itemize
  15108. @anchor{yadif}
  15109. @section yadif
  15110. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15111. filter").
  15112. It accepts the following parameters:
  15113. @table @option
  15114. @item mode
  15115. The interlacing mode to adopt. It accepts one of the following values:
  15116. @table @option
  15117. @item 0, send_frame
  15118. Output one frame for each frame.
  15119. @item 1, send_field
  15120. Output one frame for each field.
  15121. @item 2, send_frame_nospatial
  15122. Like @code{send_frame}, but it skips the spatial interlacing check.
  15123. @item 3, send_field_nospatial
  15124. Like @code{send_field}, but it skips the spatial interlacing check.
  15125. @end table
  15126. The default value is @code{send_frame}.
  15127. @item parity
  15128. The picture field parity assumed for the input interlaced video. It accepts one
  15129. of the following values:
  15130. @table @option
  15131. @item 0, tff
  15132. Assume the top field is first.
  15133. @item 1, bff
  15134. Assume the bottom field is first.
  15135. @item -1, auto
  15136. Enable automatic detection of field parity.
  15137. @end table
  15138. The default value is @code{auto}.
  15139. If the interlacing is unknown or the decoder does not export this information,
  15140. top field first will be assumed.
  15141. @item deint
  15142. Specify which frames to deinterlace. Accepts one of the following
  15143. values:
  15144. @table @option
  15145. @item 0, all
  15146. Deinterlace all frames.
  15147. @item 1, interlaced
  15148. Only deinterlace frames marked as interlaced.
  15149. @end table
  15150. The default value is @code{all}.
  15151. @end table
  15152. @section yadif_cuda
  15153. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15154. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15155. and/or nvenc.
  15156. It accepts the following parameters:
  15157. @table @option
  15158. @item mode
  15159. The interlacing mode to adopt. It accepts one of the following values:
  15160. @table @option
  15161. @item 0, send_frame
  15162. Output one frame for each frame.
  15163. @item 1, send_field
  15164. Output one frame for each field.
  15165. @item 2, send_frame_nospatial
  15166. Like @code{send_frame}, but it skips the spatial interlacing check.
  15167. @item 3, send_field_nospatial
  15168. Like @code{send_field}, but it skips the spatial interlacing check.
  15169. @end table
  15170. The default value is @code{send_frame}.
  15171. @item parity
  15172. The picture field parity assumed for the input interlaced video. It accepts one
  15173. of the following values:
  15174. @table @option
  15175. @item 0, tff
  15176. Assume the top field is first.
  15177. @item 1, bff
  15178. Assume the bottom field is first.
  15179. @item -1, auto
  15180. Enable automatic detection of field parity.
  15181. @end table
  15182. The default value is @code{auto}.
  15183. If the interlacing is unknown or the decoder does not export this information,
  15184. top field first will be assumed.
  15185. @item deint
  15186. Specify which frames to deinterlace. Accepts one of the following
  15187. values:
  15188. @table @option
  15189. @item 0, all
  15190. Deinterlace all frames.
  15191. @item 1, interlaced
  15192. Only deinterlace frames marked as interlaced.
  15193. @end table
  15194. The default value is @code{all}.
  15195. @end table
  15196. @section yaepblur
  15197. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15198. The algorithm is described in
  15199. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15200. It accepts the following parameters:
  15201. @table @option
  15202. @item radius, r
  15203. Set the window radius. Default value is 3.
  15204. @item planes, p
  15205. Set which planes to filter. Default is only the first plane.
  15206. @item sigma, s
  15207. Set blur strength. Default value is 128.
  15208. @end table
  15209. @subsection Commands
  15210. This filter supports same @ref{commands} as options.
  15211. @section zoompan
  15212. Apply Zoom & Pan effect.
  15213. This filter accepts the following options:
  15214. @table @option
  15215. @item zoom, z
  15216. Set the zoom expression. Range is 1-10. Default is 1.
  15217. @item x
  15218. @item y
  15219. Set the x and y expression. Default is 0.
  15220. @item d
  15221. Set the duration expression in number of frames.
  15222. This sets for how many number of frames effect will last for
  15223. single input image.
  15224. @item s
  15225. Set the output image size, default is 'hd720'.
  15226. @item fps
  15227. Set the output frame rate, default is '25'.
  15228. @end table
  15229. Each expression can contain the following constants:
  15230. @table @option
  15231. @item in_w, iw
  15232. Input width.
  15233. @item in_h, ih
  15234. Input height.
  15235. @item out_w, ow
  15236. Output width.
  15237. @item out_h, oh
  15238. Output height.
  15239. @item in
  15240. Input frame count.
  15241. @item on
  15242. Output frame count.
  15243. @item x
  15244. @item y
  15245. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15246. for current input frame.
  15247. @item px
  15248. @item py
  15249. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15250. not yet such frame (first input frame).
  15251. @item zoom
  15252. Last calculated zoom from 'z' expression for current input frame.
  15253. @item pzoom
  15254. Last calculated zoom of last output frame of previous input frame.
  15255. @item duration
  15256. Number of output frames for current input frame. Calculated from 'd' expression
  15257. for each input frame.
  15258. @item pduration
  15259. number of output frames created for previous input frame
  15260. @item a
  15261. Rational number: input width / input height
  15262. @item sar
  15263. sample aspect ratio
  15264. @item dar
  15265. display aspect ratio
  15266. @end table
  15267. @subsection Examples
  15268. @itemize
  15269. @item
  15270. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15271. @example
  15272. 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
  15273. @end example
  15274. @item
  15275. Zoom-in up to 1.5 and pan always at center of picture:
  15276. @example
  15277. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15278. @end example
  15279. @item
  15280. Same as above but without pausing:
  15281. @example
  15282. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15283. @end example
  15284. @end itemize
  15285. @anchor{zscale}
  15286. @section zscale
  15287. Scale (resize) the input video, using the z.lib library:
  15288. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15289. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15290. The zscale filter forces the output display aspect ratio to be the same
  15291. as the input, by changing the output sample aspect ratio.
  15292. If the input image format is different from the format requested by
  15293. the next filter, the zscale filter will convert the input to the
  15294. requested format.
  15295. @subsection Options
  15296. The filter accepts the following options.
  15297. @table @option
  15298. @item width, w
  15299. @item height, h
  15300. Set the output video dimension expression. Default value is the input
  15301. dimension.
  15302. If the @var{width} or @var{w} value is 0, the input width is used for
  15303. the output. If the @var{height} or @var{h} value is 0, the input height
  15304. is used for the output.
  15305. If one and only one of the values is -n with n >= 1, the zscale filter
  15306. will use a value that maintains the aspect ratio of the input image,
  15307. calculated from the other specified dimension. After that it will,
  15308. however, make sure that the calculated dimension is divisible by n and
  15309. adjust the value if necessary.
  15310. If both values are -n with n >= 1, the behavior will be identical to
  15311. both values being set to 0 as previously detailed.
  15312. See below for the list of accepted constants for use in the dimension
  15313. expression.
  15314. @item size, s
  15315. Set the video size. For the syntax of this option, check the
  15316. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15317. @item dither, d
  15318. Set the dither type.
  15319. Possible values are:
  15320. @table @var
  15321. @item none
  15322. @item ordered
  15323. @item random
  15324. @item error_diffusion
  15325. @end table
  15326. Default is none.
  15327. @item filter, f
  15328. Set the resize filter type.
  15329. Possible values are:
  15330. @table @var
  15331. @item point
  15332. @item bilinear
  15333. @item bicubic
  15334. @item spline16
  15335. @item spline36
  15336. @item lanczos
  15337. @end table
  15338. Default is bilinear.
  15339. @item range, r
  15340. Set the color range.
  15341. Possible values are:
  15342. @table @var
  15343. @item input
  15344. @item limited
  15345. @item full
  15346. @end table
  15347. Default is same as input.
  15348. @item primaries, p
  15349. Set the color primaries.
  15350. Possible values are:
  15351. @table @var
  15352. @item input
  15353. @item 709
  15354. @item unspecified
  15355. @item 170m
  15356. @item 240m
  15357. @item 2020
  15358. @end table
  15359. Default is same as input.
  15360. @item transfer, t
  15361. Set the transfer characteristics.
  15362. Possible values are:
  15363. @table @var
  15364. @item input
  15365. @item 709
  15366. @item unspecified
  15367. @item 601
  15368. @item linear
  15369. @item 2020_10
  15370. @item 2020_12
  15371. @item smpte2084
  15372. @item iec61966-2-1
  15373. @item arib-std-b67
  15374. @end table
  15375. Default is same as input.
  15376. @item matrix, m
  15377. Set the colorspace matrix.
  15378. Possible value are:
  15379. @table @var
  15380. @item input
  15381. @item 709
  15382. @item unspecified
  15383. @item 470bg
  15384. @item 170m
  15385. @item 2020_ncl
  15386. @item 2020_cl
  15387. @end table
  15388. Default is same as input.
  15389. @item rangein, rin
  15390. Set the input color range.
  15391. Possible values are:
  15392. @table @var
  15393. @item input
  15394. @item limited
  15395. @item full
  15396. @end table
  15397. Default is same as input.
  15398. @item primariesin, pin
  15399. Set the input color primaries.
  15400. Possible values are:
  15401. @table @var
  15402. @item input
  15403. @item 709
  15404. @item unspecified
  15405. @item 170m
  15406. @item 240m
  15407. @item 2020
  15408. @end table
  15409. Default is same as input.
  15410. @item transferin, tin
  15411. Set the input transfer characteristics.
  15412. Possible values are:
  15413. @table @var
  15414. @item input
  15415. @item 709
  15416. @item unspecified
  15417. @item 601
  15418. @item linear
  15419. @item 2020_10
  15420. @item 2020_12
  15421. @end table
  15422. Default is same as input.
  15423. @item matrixin, min
  15424. Set the input colorspace matrix.
  15425. Possible value are:
  15426. @table @var
  15427. @item input
  15428. @item 709
  15429. @item unspecified
  15430. @item 470bg
  15431. @item 170m
  15432. @item 2020_ncl
  15433. @item 2020_cl
  15434. @end table
  15435. @item chromal, c
  15436. Set the output chroma location.
  15437. Possible values are:
  15438. @table @var
  15439. @item input
  15440. @item left
  15441. @item center
  15442. @item topleft
  15443. @item top
  15444. @item bottomleft
  15445. @item bottom
  15446. @end table
  15447. @item chromalin, cin
  15448. Set the input chroma location.
  15449. Possible values are:
  15450. @table @var
  15451. @item input
  15452. @item left
  15453. @item center
  15454. @item topleft
  15455. @item top
  15456. @item bottomleft
  15457. @item bottom
  15458. @end table
  15459. @item npl
  15460. Set the nominal peak luminance.
  15461. @end table
  15462. The values of the @option{w} and @option{h} options are expressions
  15463. containing the following constants:
  15464. @table @var
  15465. @item in_w
  15466. @item in_h
  15467. The input width and height
  15468. @item iw
  15469. @item ih
  15470. These are the same as @var{in_w} and @var{in_h}.
  15471. @item out_w
  15472. @item out_h
  15473. The output (scaled) width and height
  15474. @item ow
  15475. @item oh
  15476. These are the same as @var{out_w} and @var{out_h}
  15477. @item a
  15478. The same as @var{iw} / @var{ih}
  15479. @item sar
  15480. input sample aspect ratio
  15481. @item dar
  15482. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15483. @item hsub
  15484. @item vsub
  15485. horizontal and vertical input chroma subsample values. For example for the
  15486. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15487. @item ohsub
  15488. @item ovsub
  15489. horizontal and vertical output chroma subsample values. For example for the
  15490. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15491. @end table
  15492. @table @option
  15493. @end table
  15494. @c man end VIDEO FILTERS
  15495. @chapter OpenCL Video Filters
  15496. @c man begin OPENCL VIDEO FILTERS
  15497. Below is a description of the currently available OpenCL video filters.
  15498. To enable compilation of these filters you need to configure FFmpeg with
  15499. @code{--enable-opencl}.
  15500. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15501. @table @option
  15502. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15503. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15504. given device parameters.
  15505. @item -filter_hw_device @var{name}
  15506. Pass the hardware device called @var{name} to all filters in any filter graph.
  15507. @end table
  15508. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15509. @itemize
  15510. @item
  15511. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15512. @example
  15513. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15514. @end example
  15515. @end itemize
  15516. 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.
  15517. @section avgblur_opencl
  15518. Apply average blur filter.
  15519. The filter accepts the following options:
  15520. @table @option
  15521. @item sizeX
  15522. Set horizontal radius size.
  15523. Range is @code{[1, 1024]} and default value is @code{1}.
  15524. @item planes
  15525. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15526. @item sizeY
  15527. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15528. @end table
  15529. @subsection Example
  15530. @itemize
  15531. @item
  15532. 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.
  15533. @example
  15534. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15535. @end example
  15536. @end itemize
  15537. @section boxblur_opencl
  15538. Apply a boxblur algorithm to the input video.
  15539. It accepts the following parameters:
  15540. @table @option
  15541. @item luma_radius, lr
  15542. @item luma_power, lp
  15543. @item chroma_radius, cr
  15544. @item chroma_power, cp
  15545. @item alpha_radius, ar
  15546. @item alpha_power, ap
  15547. @end table
  15548. A description of the accepted options follows.
  15549. @table @option
  15550. @item luma_radius, lr
  15551. @item chroma_radius, cr
  15552. @item alpha_radius, ar
  15553. Set an expression for the box radius in pixels used for blurring the
  15554. corresponding input plane.
  15555. The radius value must be a non-negative number, and must not be
  15556. greater than the value of the expression @code{min(w,h)/2} for the
  15557. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15558. planes.
  15559. Default value for @option{luma_radius} is "2". If not specified,
  15560. @option{chroma_radius} and @option{alpha_radius} default to the
  15561. corresponding value set for @option{luma_radius}.
  15562. The expressions can contain the following constants:
  15563. @table @option
  15564. @item w
  15565. @item h
  15566. The input width and height in pixels.
  15567. @item cw
  15568. @item ch
  15569. The input chroma image width and height in pixels.
  15570. @item hsub
  15571. @item vsub
  15572. The horizontal and vertical chroma subsample values. For example, for the
  15573. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15574. @end table
  15575. @item luma_power, lp
  15576. @item chroma_power, cp
  15577. @item alpha_power, ap
  15578. Specify how many times the boxblur filter is applied to the
  15579. corresponding plane.
  15580. Default value for @option{luma_power} is 2. If not specified,
  15581. @option{chroma_power} and @option{alpha_power} default to the
  15582. corresponding value set for @option{luma_power}.
  15583. A value of 0 will disable the effect.
  15584. @end table
  15585. @subsection Examples
  15586. 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.
  15587. @itemize
  15588. @item
  15589. Apply a boxblur filter with the luma, chroma, and alpha radius
  15590. 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.
  15591. @example
  15592. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15593. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15594. @end example
  15595. @item
  15596. 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.
  15597. For the luma plane, a 2x2 box radius will be run once.
  15598. For the chroma plane, a 4x4 box radius will be run 5 times.
  15599. For the alpha plane, a 3x3 box radius will be run 7 times.
  15600. @example
  15601. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15602. @end example
  15603. @end itemize
  15604. @section convolution_opencl
  15605. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15606. The filter accepts the following options:
  15607. @table @option
  15608. @item 0m
  15609. @item 1m
  15610. @item 2m
  15611. @item 3m
  15612. Set matrix for each plane.
  15613. Matrix is sequence of 9, 25 or 49 signed numbers.
  15614. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15615. @item 0rdiv
  15616. @item 1rdiv
  15617. @item 2rdiv
  15618. @item 3rdiv
  15619. Set multiplier for calculated value for each plane.
  15620. If unset or 0, it will be sum of all matrix elements.
  15621. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15622. @item 0bias
  15623. @item 1bias
  15624. @item 2bias
  15625. @item 3bias
  15626. Set bias for each plane. This value is added to the result of the multiplication.
  15627. Useful for making the overall image brighter or darker.
  15628. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15629. @end table
  15630. @subsection Examples
  15631. @itemize
  15632. @item
  15633. Apply sharpen:
  15634. @example
  15635. -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
  15636. @end example
  15637. @item
  15638. Apply blur:
  15639. @example
  15640. -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
  15641. @end example
  15642. @item
  15643. Apply edge enhance:
  15644. @example
  15645. -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
  15646. @end example
  15647. @item
  15648. Apply edge detect:
  15649. @example
  15650. -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
  15651. @end example
  15652. @item
  15653. Apply laplacian edge detector which includes diagonals:
  15654. @example
  15655. -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
  15656. @end example
  15657. @item
  15658. Apply emboss:
  15659. @example
  15660. -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
  15661. @end example
  15662. @end itemize
  15663. @section dilation_opencl
  15664. Apply dilation effect to the video.
  15665. This filter replaces the pixel by the local(3x3) maximum.
  15666. It accepts the following options:
  15667. @table @option
  15668. @item threshold0
  15669. @item threshold1
  15670. @item threshold2
  15671. @item threshold3
  15672. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15673. If @code{0}, plane will remain unchanged.
  15674. @item coordinates
  15675. Flag which specifies the pixel to refer to.
  15676. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15677. Flags to local 3x3 coordinates region centered on @code{x}:
  15678. 1 2 3
  15679. 4 x 5
  15680. 6 7 8
  15681. @end table
  15682. @subsection Example
  15683. @itemize
  15684. @item
  15685. 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.
  15686. @example
  15687. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15688. @end example
  15689. @end itemize
  15690. @section erosion_opencl
  15691. Apply erosion effect to the video.
  15692. This filter replaces the pixel by the local(3x3) minimum.
  15693. It accepts the following options:
  15694. @table @option
  15695. @item threshold0
  15696. @item threshold1
  15697. @item threshold2
  15698. @item threshold3
  15699. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15700. If @code{0}, plane will remain unchanged.
  15701. @item coordinates
  15702. Flag which specifies the pixel to refer to.
  15703. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15704. Flags to local 3x3 coordinates region centered on @code{x}:
  15705. 1 2 3
  15706. 4 x 5
  15707. 6 7 8
  15708. @end table
  15709. @subsection Example
  15710. @itemize
  15711. @item
  15712. 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.
  15713. @example
  15714. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15715. @end example
  15716. @end itemize
  15717. @section colorkey_opencl
  15718. RGB colorspace color keying.
  15719. The filter accepts the following options:
  15720. @table @option
  15721. @item color
  15722. The color which will be replaced with transparency.
  15723. @item similarity
  15724. Similarity percentage with the key color.
  15725. 0.01 matches only the exact key color, while 1.0 matches everything.
  15726. @item blend
  15727. Blend percentage.
  15728. 0.0 makes pixels either fully transparent, or not transparent at all.
  15729. Higher values result in semi-transparent pixels, with a higher transparency
  15730. the more similar the pixels color is to the key color.
  15731. @end table
  15732. @subsection Examples
  15733. @itemize
  15734. @item
  15735. Make every semi-green pixel in the input transparent with some slight blending:
  15736. @example
  15737. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15738. @end example
  15739. @end itemize
  15740. @section deshake_opencl
  15741. Feature-point based video stabilization filter.
  15742. The filter accepts the following options:
  15743. @table @option
  15744. @item tripod
  15745. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15746. @item debug
  15747. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15748. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15749. Viewing point matches in the output video is only supported for RGB input.
  15750. Defaults to @code{0}.
  15751. @item adaptive_crop
  15752. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15753. Defaults to @code{1}.
  15754. @item refine_features
  15755. Whether or not feature points should be refined at a sub-pixel level.
  15756. This can be turned off for a slight performance gain at the cost of precision.
  15757. Defaults to @code{1}.
  15758. @item smooth_strength
  15759. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15760. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15761. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15762. Defaults to @code{0.0}.
  15763. @item smooth_window_multiplier
  15764. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15765. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15766. Acceptable values range from @code{0.1} to @code{10.0}.
  15767. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15768. potentially improving smoothness, but also increase latency and memory usage.
  15769. Defaults to @code{2.0}.
  15770. @end table
  15771. @subsection Examples
  15772. @itemize
  15773. @item
  15774. Stabilize a video with a fixed, medium smoothing strength:
  15775. @example
  15776. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15777. @end example
  15778. @item
  15779. Stabilize a video with debugging (both in console and in rendered video):
  15780. @example
  15781. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15782. @end example
  15783. @end itemize
  15784. @section nlmeans_opencl
  15785. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15786. @section overlay_opencl
  15787. Overlay one video on top of another.
  15788. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15789. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15790. The filter accepts the following options:
  15791. @table @option
  15792. @item x
  15793. Set the x coordinate of the overlaid video on the main video.
  15794. Default value is @code{0}.
  15795. @item y
  15796. Set the y coordinate of the overlaid video on the main video.
  15797. Default value is @code{0}.
  15798. @end table
  15799. @subsection Examples
  15800. @itemize
  15801. @item
  15802. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15803. @example
  15804. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15805. @end example
  15806. @item
  15807. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15808. @example
  15809. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15810. @end example
  15811. @end itemize
  15812. @section prewitt_opencl
  15813. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15814. The filter accepts the following option:
  15815. @table @option
  15816. @item planes
  15817. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15818. @item scale
  15819. Set value which will be multiplied with filtered result.
  15820. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15821. @item delta
  15822. Set value which will be added to filtered result.
  15823. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15824. @end table
  15825. @subsection Example
  15826. @itemize
  15827. @item
  15828. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15829. @example
  15830. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15831. @end example
  15832. @end itemize
  15833. @section roberts_opencl
  15834. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15835. The filter accepts the following option:
  15836. @table @option
  15837. @item planes
  15838. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15839. @item scale
  15840. Set value which will be multiplied with filtered result.
  15841. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15842. @item delta
  15843. Set value which will be added to filtered result.
  15844. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15845. @end table
  15846. @subsection Example
  15847. @itemize
  15848. @item
  15849. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15850. @example
  15851. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15852. @end example
  15853. @end itemize
  15854. @section sobel_opencl
  15855. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15856. The filter accepts the following option:
  15857. @table @option
  15858. @item planes
  15859. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15860. @item scale
  15861. Set value which will be multiplied with filtered result.
  15862. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15863. @item delta
  15864. Set value which will be added to filtered result.
  15865. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15866. @end table
  15867. @subsection Example
  15868. @itemize
  15869. @item
  15870. Apply sobel operator with scale set to 2 and delta set to 10
  15871. @example
  15872. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15873. @end example
  15874. @end itemize
  15875. @section tonemap_opencl
  15876. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15877. It accepts the following parameters:
  15878. @table @option
  15879. @item tonemap
  15880. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15881. @item param
  15882. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15883. @item desat
  15884. Apply desaturation for highlights that exceed this level of brightness. The
  15885. higher the parameter, the more color information will be preserved. This
  15886. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15887. (smoothly) turning into white instead. This makes images feel more natural,
  15888. at the cost of reducing information about out-of-range colors.
  15889. The default value is 0.5, and the algorithm here is a little different from
  15890. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15891. @item threshold
  15892. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15893. is used to detect whether the scene has changed or not. If the distance between
  15894. the current frame average brightness and the current running average exceeds
  15895. a threshold value, we would re-calculate scene average and peak brightness.
  15896. The default value is 0.2.
  15897. @item format
  15898. Specify the output pixel format.
  15899. Currently supported formats are:
  15900. @table @var
  15901. @item p010
  15902. @item nv12
  15903. @end table
  15904. @item range, r
  15905. Set the output color range.
  15906. Possible values are:
  15907. @table @var
  15908. @item tv/mpeg
  15909. @item pc/jpeg
  15910. @end table
  15911. Default is same as input.
  15912. @item primaries, p
  15913. Set the output color primaries.
  15914. Possible values are:
  15915. @table @var
  15916. @item bt709
  15917. @item bt2020
  15918. @end table
  15919. Default is same as input.
  15920. @item transfer, t
  15921. Set the output transfer characteristics.
  15922. Possible values are:
  15923. @table @var
  15924. @item bt709
  15925. @item bt2020
  15926. @end table
  15927. Default is bt709.
  15928. @item matrix, m
  15929. Set the output colorspace matrix.
  15930. Possible value are:
  15931. @table @var
  15932. @item bt709
  15933. @item bt2020
  15934. @end table
  15935. Default is same as input.
  15936. @end table
  15937. @subsection Example
  15938. @itemize
  15939. @item
  15940. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15941. @example
  15942. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15943. @end example
  15944. @end itemize
  15945. @section unsharp_opencl
  15946. Sharpen or blur the input video.
  15947. It accepts the following parameters:
  15948. @table @option
  15949. @item luma_msize_x, lx
  15950. Set the luma matrix horizontal size.
  15951. Range is @code{[1, 23]} and default value is @code{5}.
  15952. @item luma_msize_y, ly
  15953. Set the luma matrix vertical size.
  15954. Range is @code{[1, 23]} and default value is @code{5}.
  15955. @item luma_amount, la
  15956. Set the luma effect strength.
  15957. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15958. Negative values will blur the input video, while positive values will
  15959. sharpen it, a value of zero will disable the effect.
  15960. @item chroma_msize_x, cx
  15961. Set the chroma matrix horizontal size.
  15962. Range is @code{[1, 23]} and default value is @code{5}.
  15963. @item chroma_msize_y, cy
  15964. Set the chroma matrix vertical size.
  15965. Range is @code{[1, 23]} and default value is @code{5}.
  15966. @item chroma_amount, ca
  15967. Set the chroma effect strength.
  15968. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15969. Negative values will blur the input video, while positive values will
  15970. sharpen it, a value of zero will disable the effect.
  15971. @end table
  15972. All parameters are optional and default to the equivalent of the
  15973. string '5:5:1.0:5:5:0.0'.
  15974. @subsection Examples
  15975. @itemize
  15976. @item
  15977. Apply strong luma sharpen effect:
  15978. @example
  15979. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15980. @end example
  15981. @item
  15982. Apply a strong blur of both luma and chroma parameters:
  15983. @example
  15984. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15985. @end example
  15986. @end itemize
  15987. @c man end OPENCL VIDEO FILTERS
  15988. @chapter VAAPI Video Filters
  15989. @c man begin VAAPI VIDEO FILTERS
  15990. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  15991. To enable compilation of these filters you need to configure FFmpeg with
  15992. @code{--enable-vaapi}.
  15993. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  15994. @section tonemap_vappi
  15995. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  15996. It maps the dynamic range of HDR10 content to the SDR content.
  15997. It currently only accepts HDR10 as input.
  15998. It accepts the following parameters:
  15999. @table @option
  16000. @item format
  16001. Specify the output pixel format.
  16002. Currently supported formats are:
  16003. @table @var
  16004. @item p010
  16005. @item nv12
  16006. @end table
  16007. Default is nv12.
  16008. @item primaries, p
  16009. Set the output color primaries.
  16010. Default is same as input.
  16011. @item transfer, t
  16012. Set the output transfer characteristics.
  16013. Default is bt709.
  16014. @item matrix, m
  16015. Set the output colorspace matrix.
  16016. Default is same as input.
  16017. @end table
  16018. @subsection Example
  16019. @itemize
  16020. @item
  16021. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16022. @example
  16023. tonemap_vaapi=format=p010:t=bt2020-10
  16024. @end example
  16025. @end itemize
  16026. @c man end VAAPI VIDEO FILTERS
  16027. @chapter Video Sources
  16028. @c man begin VIDEO SOURCES
  16029. Below is a description of the currently available video sources.
  16030. @section buffer
  16031. Buffer video frames, and make them available to the filter chain.
  16032. This source is mainly intended for a programmatic use, in particular
  16033. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16034. It accepts the following parameters:
  16035. @table @option
  16036. @item video_size
  16037. Specify the size (width and height) of the buffered video frames. For the
  16038. syntax of this option, check the
  16039. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16040. @item width
  16041. The input video width.
  16042. @item height
  16043. The input video height.
  16044. @item pix_fmt
  16045. A string representing the pixel format of the buffered video frames.
  16046. It may be a number corresponding to a pixel format, or a pixel format
  16047. name.
  16048. @item time_base
  16049. Specify the timebase assumed by the timestamps of the buffered frames.
  16050. @item frame_rate
  16051. Specify the frame rate expected for the video stream.
  16052. @item pixel_aspect, sar
  16053. The sample (pixel) aspect ratio of the input video.
  16054. @item sws_param
  16055. Specify the optional parameters to be used for the scale filter which
  16056. is automatically inserted when an input change is detected in the
  16057. input size or format.
  16058. @item hw_frames_ctx
  16059. When using a hardware pixel format, this should be a reference to an
  16060. AVHWFramesContext describing input frames.
  16061. @end table
  16062. For example:
  16063. @example
  16064. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16065. @end example
  16066. will instruct the source to accept video frames with size 320x240 and
  16067. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16068. square pixels (1:1 sample aspect ratio).
  16069. Since the pixel format with name "yuv410p" corresponds to the number 6
  16070. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16071. this example corresponds to:
  16072. @example
  16073. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16074. @end example
  16075. Alternatively, the options can be specified as a flat string, but this
  16076. syntax is deprecated:
  16077. @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}]
  16078. @section cellauto
  16079. Create a pattern generated by an elementary cellular automaton.
  16080. The initial state of the cellular automaton can be defined through the
  16081. @option{filename} and @option{pattern} options. If such options are
  16082. not specified an initial state is created randomly.
  16083. At each new frame a new row in the video is filled with the result of
  16084. the cellular automaton next generation. The behavior when the whole
  16085. frame is filled is defined by the @option{scroll} option.
  16086. This source accepts the following options:
  16087. @table @option
  16088. @item filename, f
  16089. Read the initial cellular automaton state, i.e. the starting row, from
  16090. the specified file.
  16091. In the file, each non-whitespace character is considered an alive
  16092. cell, a newline will terminate the row, and further characters in the
  16093. file will be ignored.
  16094. @item pattern, p
  16095. Read the initial cellular automaton state, i.e. the starting row, from
  16096. the specified string.
  16097. Each non-whitespace character in the string is considered an alive
  16098. cell, a newline will terminate the row, and further characters in the
  16099. string will be ignored.
  16100. @item rate, r
  16101. Set the video rate, that is the number of frames generated per second.
  16102. Default is 25.
  16103. @item random_fill_ratio, ratio
  16104. Set the random fill ratio for the initial cellular automaton row. It
  16105. is a floating point number value ranging from 0 to 1, defaults to
  16106. 1/PHI.
  16107. This option is ignored when a file or a pattern is specified.
  16108. @item random_seed, seed
  16109. Set the seed for filling randomly the initial row, must be an integer
  16110. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16111. set to -1, the filter will try to use a good random seed on a best
  16112. effort basis.
  16113. @item rule
  16114. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16115. Default value is 110.
  16116. @item size, s
  16117. Set the size of the output video. For the syntax of this option, check the
  16118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16119. If @option{filename} or @option{pattern} is specified, the size is set
  16120. by default to the width of the specified initial state row, and the
  16121. height is set to @var{width} * PHI.
  16122. If @option{size} is set, it must contain the width of the specified
  16123. pattern string, and the specified pattern will be centered in the
  16124. larger row.
  16125. If a filename or a pattern string is not specified, the size value
  16126. defaults to "320x518" (used for a randomly generated initial state).
  16127. @item scroll
  16128. If set to 1, scroll the output upward when all the rows in the output
  16129. have been already filled. If set to 0, the new generated row will be
  16130. written over the top row just after the bottom row is filled.
  16131. Defaults to 1.
  16132. @item start_full, full
  16133. If set to 1, completely fill the output with generated rows before
  16134. outputting the first frame.
  16135. This is the default behavior, for disabling set the value to 0.
  16136. @item stitch
  16137. If set to 1, stitch the left and right row edges together.
  16138. This is the default behavior, for disabling set the value to 0.
  16139. @end table
  16140. @subsection Examples
  16141. @itemize
  16142. @item
  16143. Read the initial state from @file{pattern}, and specify an output of
  16144. size 200x400.
  16145. @example
  16146. cellauto=f=pattern:s=200x400
  16147. @end example
  16148. @item
  16149. Generate a random initial row with a width of 200 cells, with a fill
  16150. ratio of 2/3:
  16151. @example
  16152. cellauto=ratio=2/3:s=200x200
  16153. @end example
  16154. @item
  16155. Create a pattern generated by rule 18 starting by a single alive cell
  16156. centered on an initial row with width 100:
  16157. @example
  16158. cellauto=p=@@:s=100x400:full=0:rule=18
  16159. @end example
  16160. @item
  16161. Specify a more elaborated initial pattern:
  16162. @example
  16163. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16164. @end example
  16165. @end itemize
  16166. @anchor{coreimagesrc}
  16167. @section coreimagesrc
  16168. Video source generated on GPU using Apple's CoreImage API on OSX.
  16169. This video source is a specialized version of the @ref{coreimage} video filter.
  16170. Use a core image generator at the beginning of the applied filterchain to
  16171. generate the content.
  16172. The coreimagesrc video source accepts the following options:
  16173. @table @option
  16174. @item list_generators
  16175. List all available generators along with all their respective options as well as
  16176. possible minimum and maximum values along with the default values.
  16177. @example
  16178. list_generators=true
  16179. @end example
  16180. @item size, s
  16181. Specify the size of the sourced video. For the syntax of this option, check the
  16182. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16183. The default value is @code{320x240}.
  16184. @item rate, r
  16185. Specify the frame rate of the sourced video, as the number of frames
  16186. generated per second. It has to be a string in the format
  16187. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16188. number or a valid video frame rate abbreviation. The default value is
  16189. "25".
  16190. @item sar
  16191. Set the sample aspect ratio of the sourced video.
  16192. @item duration, d
  16193. Set the duration of the sourced video. See
  16194. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16195. for the accepted syntax.
  16196. If not specified, or the expressed duration is negative, the video is
  16197. supposed to be generated forever.
  16198. @end table
  16199. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16200. A complete filterchain can be used for further processing of the
  16201. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16202. and examples for details.
  16203. @subsection Examples
  16204. @itemize
  16205. @item
  16206. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16207. given as complete and escaped command-line for Apple's standard bash shell:
  16208. @example
  16209. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16210. @end example
  16211. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16212. need for a nullsrc video source.
  16213. @end itemize
  16214. @section mandelbrot
  16215. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16216. point specified with @var{start_x} and @var{start_y}.
  16217. This source accepts the following options:
  16218. @table @option
  16219. @item end_pts
  16220. Set the terminal pts value. Default value is 400.
  16221. @item end_scale
  16222. Set the terminal scale value.
  16223. Must be a floating point value. Default value is 0.3.
  16224. @item inner
  16225. Set the inner coloring mode, that is the algorithm used to draw the
  16226. Mandelbrot fractal internal region.
  16227. It shall assume one of the following values:
  16228. @table @option
  16229. @item black
  16230. Set black mode.
  16231. @item convergence
  16232. Show time until convergence.
  16233. @item mincol
  16234. Set color based on point closest to the origin of the iterations.
  16235. @item period
  16236. Set period mode.
  16237. @end table
  16238. Default value is @var{mincol}.
  16239. @item bailout
  16240. Set the bailout value. Default value is 10.0.
  16241. @item maxiter
  16242. Set the maximum of iterations performed by the rendering
  16243. algorithm. Default value is 7189.
  16244. @item outer
  16245. Set outer coloring mode.
  16246. It shall assume one of following values:
  16247. @table @option
  16248. @item iteration_count
  16249. Set iteration count mode.
  16250. @item normalized_iteration_count
  16251. set normalized iteration count mode.
  16252. @end table
  16253. Default value is @var{normalized_iteration_count}.
  16254. @item rate, r
  16255. Set frame rate, expressed as number of frames per second. Default
  16256. value is "25".
  16257. @item size, s
  16258. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16259. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16260. @item start_scale
  16261. Set the initial scale value. Default value is 3.0.
  16262. @item start_x
  16263. Set the initial x position. Must be a floating point value between
  16264. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16265. @item start_y
  16266. Set the initial y position. Must be a floating point value between
  16267. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16268. @end table
  16269. @section mptestsrc
  16270. Generate various test patterns, as generated by the MPlayer test filter.
  16271. The size of the generated video is fixed, and is 256x256.
  16272. This source is useful in particular for testing encoding features.
  16273. This source accepts the following options:
  16274. @table @option
  16275. @item rate, r
  16276. Specify the frame rate of the sourced video, as the number of frames
  16277. generated per second. It has to be a string in the format
  16278. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16279. number or a valid video frame rate abbreviation. The default value is
  16280. "25".
  16281. @item duration, d
  16282. Set the duration of the sourced video. See
  16283. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16284. for the accepted syntax.
  16285. If not specified, or the expressed duration is negative, the video is
  16286. supposed to be generated forever.
  16287. @item test, t
  16288. Set the number or the name of the test to perform. Supported tests are:
  16289. @table @option
  16290. @item dc_luma
  16291. @item dc_chroma
  16292. @item freq_luma
  16293. @item freq_chroma
  16294. @item amp_luma
  16295. @item amp_chroma
  16296. @item cbp
  16297. @item mv
  16298. @item ring1
  16299. @item ring2
  16300. @item all
  16301. @item max_frames, m
  16302. Set the maximum number of frames generated for each test, default value is 30.
  16303. @end table
  16304. Default value is "all", which will cycle through the list of all tests.
  16305. @end table
  16306. Some examples:
  16307. @example
  16308. mptestsrc=t=dc_luma
  16309. @end example
  16310. will generate a "dc_luma" test pattern.
  16311. @section frei0r_src
  16312. Provide a frei0r source.
  16313. To enable compilation of this filter you need to install the frei0r
  16314. header and configure FFmpeg with @code{--enable-frei0r}.
  16315. This source accepts the following parameters:
  16316. @table @option
  16317. @item size
  16318. The size of the video to generate. For the syntax of this option, check the
  16319. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16320. @item framerate
  16321. The framerate of the generated video. It may be a string of the form
  16322. @var{num}/@var{den} or a frame rate abbreviation.
  16323. @item filter_name
  16324. The name to the frei0r source to load. For more information regarding frei0r and
  16325. how to set the parameters, read the @ref{frei0r} section in the video filters
  16326. documentation.
  16327. @item filter_params
  16328. A '|'-separated list of parameters to pass to the frei0r source.
  16329. @end table
  16330. For example, to generate a frei0r partik0l source with size 200x200
  16331. and frame rate 10 which is overlaid on the overlay filter main input:
  16332. @example
  16333. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16334. @end example
  16335. @section life
  16336. Generate a life pattern.
  16337. This source is based on a generalization of John Conway's life game.
  16338. The sourced input represents a life grid, each pixel represents a cell
  16339. which can be in one of two possible states, alive or dead. Every cell
  16340. interacts with its eight neighbours, which are the cells that are
  16341. horizontally, vertically, or diagonally adjacent.
  16342. At each interaction the grid evolves according to the adopted rule,
  16343. which specifies the number of neighbor alive cells which will make a
  16344. cell stay alive or born. The @option{rule} option allows one to specify
  16345. the rule to adopt.
  16346. This source accepts the following options:
  16347. @table @option
  16348. @item filename, f
  16349. Set the file from which to read the initial grid state. In the file,
  16350. each non-whitespace character is considered an alive cell, and newline
  16351. is used to delimit the end of each row.
  16352. If this option is not specified, the initial grid is generated
  16353. randomly.
  16354. @item rate, r
  16355. Set the video rate, that is the number of frames generated per second.
  16356. Default is 25.
  16357. @item random_fill_ratio, ratio
  16358. Set the random fill ratio for the initial random grid. It is a
  16359. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16360. It is ignored when a file is specified.
  16361. @item random_seed, seed
  16362. Set the seed for filling the initial random grid, must be an integer
  16363. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16364. set to -1, the filter will try to use a good random seed on a best
  16365. effort basis.
  16366. @item rule
  16367. Set the life rule.
  16368. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16369. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16370. @var{NS} specifies the number of alive neighbor cells which make a
  16371. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16372. which make a dead cell to become alive (i.e. to "born").
  16373. "s" and "b" can be used in place of "S" and "B", respectively.
  16374. Alternatively a rule can be specified by an 18-bits integer. The 9
  16375. high order bits are used to encode the next cell state if it is alive
  16376. for each number of neighbor alive cells, the low order bits specify
  16377. the rule for "borning" new cells. Higher order bits encode for an
  16378. higher number of neighbor cells.
  16379. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  16380. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  16381. Default value is "S23/B3", which is the original Conway's game of life
  16382. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  16383. cells, and will born a new cell if there are three alive cells around
  16384. a dead cell.
  16385. @item size, s
  16386. Set the size of the output video. For the syntax of this option, check the
  16387. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16388. If @option{filename} is specified, the size is set by default to the
  16389. same size of the input file. If @option{size} is set, it must contain
  16390. the size specified in the input file, and the initial grid defined in
  16391. that file is centered in the larger resulting area.
  16392. If a filename is not specified, the size value defaults to "320x240"
  16393. (used for a randomly generated initial grid).
  16394. @item stitch
  16395. If set to 1, stitch the left and right grid edges together, and the
  16396. top and bottom edges also. Defaults to 1.
  16397. @item mold
  16398. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  16399. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  16400. value from 0 to 255.
  16401. @item life_color
  16402. Set the color of living (or new born) cells.
  16403. @item death_color
  16404. Set the color of dead cells. If @option{mold} is set, this is the first color
  16405. used to represent a dead cell.
  16406. @item mold_color
  16407. Set mold color, for definitely dead and moldy cells.
  16408. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  16409. ffmpeg-utils manual,ffmpeg-utils}.
  16410. @end table
  16411. @subsection Examples
  16412. @itemize
  16413. @item
  16414. Read a grid from @file{pattern}, and center it on a grid of size
  16415. 300x300 pixels:
  16416. @example
  16417. life=f=pattern:s=300x300
  16418. @end example
  16419. @item
  16420. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16421. @example
  16422. life=ratio=2/3:s=200x200
  16423. @end example
  16424. @item
  16425. Specify a custom rule for evolving a randomly generated grid:
  16426. @example
  16427. life=rule=S14/B34
  16428. @end example
  16429. @item
  16430. Full example with slow death effect (mold) using @command{ffplay}:
  16431. @example
  16432. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16433. @end example
  16434. @end itemize
  16435. @anchor{allrgb}
  16436. @anchor{allyuv}
  16437. @anchor{color}
  16438. @anchor{haldclutsrc}
  16439. @anchor{nullsrc}
  16440. @anchor{pal75bars}
  16441. @anchor{pal100bars}
  16442. @anchor{rgbtestsrc}
  16443. @anchor{smptebars}
  16444. @anchor{smptehdbars}
  16445. @anchor{testsrc}
  16446. @anchor{testsrc2}
  16447. @anchor{yuvtestsrc}
  16448. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16449. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16450. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16451. The @code{color} source provides an uniformly colored input.
  16452. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16453. @ref{haldclut} filter.
  16454. The @code{nullsrc} source returns unprocessed video frames. It is
  16455. mainly useful to be employed in analysis / debugging tools, or as the
  16456. source for filters which ignore the input data.
  16457. The @code{pal75bars} source generates a color bars pattern, based on
  16458. EBU PAL recommendations with 75% color levels.
  16459. The @code{pal100bars} source generates a color bars pattern, based on
  16460. EBU PAL recommendations with 100% color levels.
  16461. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16462. detecting RGB vs BGR issues. You should see a red, green and blue
  16463. stripe from top to bottom.
  16464. The @code{smptebars} source generates a color bars pattern, based on
  16465. the SMPTE Engineering Guideline EG 1-1990.
  16466. The @code{smptehdbars} source generates a color bars pattern, based on
  16467. the SMPTE RP 219-2002.
  16468. The @code{testsrc} source generates a test video pattern, showing a
  16469. color pattern, a scrolling gradient and a timestamp. This is mainly
  16470. intended for testing purposes.
  16471. The @code{testsrc2} source is similar to testsrc, but supports more
  16472. pixel formats instead of just @code{rgb24}. This allows using it as an
  16473. input for other tests without requiring a format conversion.
  16474. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16475. see a y, cb and cr stripe from top to bottom.
  16476. The sources accept the following parameters:
  16477. @table @option
  16478. @item level
  16479. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16480. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16481. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16482. coded on a @code{1/(N*N)} scale.
  16483. @item color, c
  16484. Specify the color of the source, only available in the @code{color}
  16485. source. For the syntax of this option, check the
  16486. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16487. @item size, s
  16488. Specify the size of the sourced video. For the syntax of this option, check the
  16489. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16490. The default value is @code{320x240}.
  16491. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16492. @code{haldclutsrc} filters.
  16493. @item rate, r
  16494. Specify the frame rate of the sourced video, as the number of frames
  16495. generated per second. It has to be a string in the format
  16496. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16497. number or a valid video frame rate abbreviation. The default value is
  16498. "25".
  16499. @item duration, d
  16500. Set the duration of the sourced video. See
  16501. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16502. for the accepted syntax.
  16503. If not specified, or the expressed duration is negative, the video is
  16504. supposed to be generated forever.
  16505. @item sar
  16506. Set the sample aspect ratio of the sourced video.
  16507. @item alpha
  16508. Specify the alpha (opacity) of the background, only available in the
  16509. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16510. 255 (fully opaque, the default).
  16511. @item decimals, n
  16512. Set the number of decimals to show in the timestamp, only available in the
  16513. @code{testsrc} source.
  16514. The displayed timestamp value will correspond to the original
  16515. timestamp value multiplied by the power of 10 of the specified
  16516. value. Default value is 0.
  16517. @end table
  16518. @subsection Examples
  16519. @itemize
  16520. @item
  16521. Generate a video with a duration of 5.3 seconds, with size
  16522. 176x144 and a frame rate of 10 frames per second:
  16523. @example
  16524. testsrc=duration=5.3:size=qcif:rate=10
  16525. @end example
  16526. @item
  16527. The following graph description will generate a red source
  16528. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16529. frames per second:
  16530. @example
  16531. color=c=red@@0.2:s=qcif:r=10
  16532. @end example
  16533. @item
  16534. If the input content is to be ignored, @code{nullsrc} can be used. The
  16535. following command generates noise in the luminance plane by employing
  16536. the @code{geq} filter:
  16537. @example
  16538. nullsrc=s=256x256, geq=random(1)*255:128:128
  16539. @end example
  16540. @end itemize
  16541. @subsection Commands
  16542. The @code{color} source supports the following commands:
  16543. @table @option
  16544. @item c, color
  16545. Set the color of the created image. Accepts the same syntax of the
  16546. corresponding @option{color} option.
  16547. @end table
  16548. @section openclsrc
  16549. Generate video using an OpenCL program.
  16550. @table @option
  16551. @item source
  16552. OpenCL program source file.
  16553. @item kernel
  16554. Kernel name in program.
  16555. @item size, s
  16556. Size of frames to generate. This must be set.
  16557. @item format
  16558. Pixel format to use for the generated frames. This must be set.
  16559. @item rate, r
  16560. Number of frames generated every second. Default value is '25'.
  16561. @end table
  16562. For details of how the program loading works, see the @ref{program_opencl}
  16563. filter.
  16564. Example programs:
  16565. @itemize
  16566. @item
  16567. Generate a colour ramp by setting pixel values from the position of the pixel
  16568. in the output image. (Note that this will work with all pixel formats, but
  16569. the generated output will not be the same.)
  16570. @verbatim
  16571. __kernel void ramp(__write_only image2d_t dst,
  16572. unsigned int index)
  16573. {
  16574. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16575. float4 val;
  16576. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16577. write_imagef(dst, loc, val);
  16578. }
  16579. @end verbatim
  16580. @item
  16581. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16582. @verbatim
  16583. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16584. unsigned int index)
  16585. {
  16586. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16587. float4 value = 0.0f;
  16588. int x = loc.x + index;
  16589. int y = loc.y + index;
  16590. while (x > 0 || y > 0) {
  16591. if (x % 3 == 1 && y % 3 == 1) {
  16592. value = 1.0f;
  16593. break;
  16594. }
  16595. x /= 3;
  16596. y /= 3;
  16597. }
  16598. write_imagef(dst, loc, value);
  16599. }
  16600. @end verbatim
  16601. @end itemize
  16602. @section sierpinski
  16603. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16604. This source accepts the following options:
  16605. @table @option
  16606. @item size, s
  16607. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16608. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16609. @item rate, r
  16610. Set frame rate, expressed as number of frames per second. Default
  16611. value is "25".
  16612. @item seed
  16613. Set seed which is used for random panning.
  16614. @item jump
  16615. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16616. @item type
  16617. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16618. @end table
  16619. @c man end VIDEO SOURCES
  16620. @chapter Video Sinks
  16621. @c man begin VIDEO SINKS
  16622. Below is a description of the currently available video sinks.
  16623. @section buffersink
  16624. Buffer video frames, and make them available to the end of the filter
  16625. graph.
  16626. This sink is mainly intended for programmatic use, in particular
  16627. through the interface defined in @file{libavfilter/buffersink.h}
  16628. or the options system.
  16629. It accepts a pointer to an AVBufferSinkContext structure, which
  16630. defines the incoming buffers' formats, to be passed as the opaque
  16631. parameter to @code{avfilter_init_filter} for initialization.
  16632. @section nullsink
  16633. Null video sink: do absolutely nothing with the input video. It is
  16634. mainly useful as a template and for use in analysis / debugging
  16635. tools.
  16636. @c man end VIDEO SINKS
  16637. @chapter Multimedia Filters
  16638. @c man begin MULTIMEDIA FILTERS
  16639. Below is a description of the currently available multimedia filters.
  16640. @section abitscope
  16641. Convert input audio to a video output, displaying the audio bit scope.
  16642. The filter accepts the following options:
  16643. @table @option
  16644. @item rate, r
  16645. Set frame rate, expressed as number of frames per second. Default
  16646. value is "25".
  16647. @item size, s
  16648. Specify the video size for the output. For the syntax of this option, check the
  16649. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16650. Default value is @code{1024x256}.
  16651. @item colors
  16652. Specify list of colors separated by space or by '|' which will be used to
  16653. draw channels. Unrecognized or missing colors will be replaced
  16654. by white color.
  16655. @end table
  16656. @section adrawgraph
  16657. Draw a graph using input audio metadata.
  16658. See @ref{drawgraph}
  16659. @section agraphmonitor
  16660. See @ref{graphmonitor}.
  16661. @section ahistogram
  16662. Convert input audio to a video output, displaying the volume histogram.
  16663. The filter accepts the following options:
  16664. @table @option
  16665. @item dmode
  16666. Specify how histogram is calculated.
  16667. It accepts the following values:
  16668. @table @samp
  16669. @item single
  16670. Use single histogram for all channels.
  16671. @item separate
  16672. Use separate histogram for each channel.
  16673. @end table
  16674. Default is @code{single}.
  16675. @item rate, r
  16676. Set frame rate, expressed as number of frames per second. Default
  16677. value is "25".
  16678. @item size, s
  16679. Specify the video size for the output. For the syntax of this option, check the
  16680. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16681. Default value is @code{hd720}.
  16682. @item scale
  16683. Set display scale.
  16684. It accepts the following values:
  16685. @table @samp
  16686. @item log
  16687. logarithmic
  16688. @item sqrt
  16689. square root
  16690. @item cbrt
  16691. cubic root
  16692. @item lin
  16693. linear
  16694. @item rlog
  16695. reverse logarithmic
  16696. @end table
  16697. Default is @code{log}.
  16698. @item ascale
  16699. Set amplitude scale.
  16700. It accepts the following values:
  16701. @table @samp
  16702. @item log
  16703. logarithmic
  16704. @item lin
  16705. linear
  16706. @end table
  16707. Default is @code{log}.
  16708. @item acount
  16709. Set how much frames to accumulate in histogram.
  16710. Default is 1. Setting this to -1 accumulates all frames.
  16711. @item rheight
  16712. Set histogram ratio of window height.
  16713. @item slide
  16714. Set sonogram sliding.
  16715. It accepts the following values:
  16716. @table @samp
  16717. @item replace
  16718. replace old rows with new ones.
  16719. @item scroll
  16720. scroll from top to bottom.
  16721. @end table
  16722. Default is @code{replace}.
  16723. @end table
  16724. @section aphasemeter
  16725. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16726. representing mean phase of current audio frame. A video output can also be produced and is
  16727. enabled by default. The audio is passed through as first output.
  16728. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16729. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16730. and @code{1} means channels are in phase.
  16731. The filter accepts the following options, all related to its video output:
  16732. @table @option
  16733. @item rate, r
  16734. Set the output frame rate. Default value is @code{25}.
  16735. @item size, s
  16736. Set the video size for the output. For the syntax of this option, check the
  16737. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16738. Default value is @code{800x400}.
  16739. @item rc
  16740. @item gc
  16741. @item bc
  16742. Specify the red, green, blue contrast. Default values are @code{2},
  16743. @code{7} and @code{1}.
  16744. Allowed range is @code{[0, 255]}.
  16745. @item mpc
  16746. Set color which will be used for drawing median phase. If color is
  16747. @code{none} which is default, no median phase value will be drawn.
  16748. @item video
  16749. Enable video output. Default is enabled.
  16750. @end table
  16751. @section avectorscope
  16752. Convert input audio to a video output, representing the audio vector
  16753. scope.
  16754. The filter is used to measure the difference between channels of stereo
  16755. audio stream. A monaural signal, consisting of identical left and right
  16756. signal, results in straight vertical line. Any stereo separation is visible
  16757. as a deviation from this line, creating a Lissajous figure.
  16758. If the straight (or deviation from it) but horizontal line appears this
  16759. indicates that the left and right channels are out of phase.
  16760. The filter accepts the following options:
  16761. @table @option
  16762. @item mode, m
  16763. Set the vectorscope mode.
  16764. Available values are:
  16765. @table @samp
  16766. @item lissajous
  16767. Lissajous rotated by 45 degrees.
  16768. @item lissajous_xy
  16769. Same as above but not rotated.
  16770. @item polar
  16771. Shape resembling half of circle.
  16772. @end table
  16773. Default value is @samp{lissajous}.
  16774. @item size, s
  16775. Set the video size for the output. For the syntax of this option, check the
  16776. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16777. Default value is @code{400x400}.
  16778. @item rate, r
  16779. Set the output frame rate. Default value is @code{25}.
  16780. @item rc
  16781. @item gc
  16782. @item bc
  16783. @item ac
  16784. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16785. @code{160}, @code{80} and @code{255}.
  16786. Allowed range is @code{[0, 255]}.
  16787. @item rf
  16788. @item gf
  16789. @item bf
  16790. @item af
  16791. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16792. @code{10}, @code{5} and @code{5}.
  16793. Allowed range is @code{[0, 255]}.
  16794. @item zoom
  16795. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16796. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16797. @item draw
  16798. Set the vectorscope drawing mode.
  16799. Available values are:
  16800. @table @samp
  16801. @item dot
  16802. Draw dot for each sample.
  16803. @item line
  16804. Draw line between previous and current sample.
  16805. @end table
  16806. Default value is @samp{dot}.
  16807. @item scale
  16808. Specify amplitude scale of audio samples.
  16809. Available values are:
  16810. @table @samp
  16811. @item lin
  16812. Linear.
  16813. @item sqrt
  16814. Square root.
  16815. @item cbrt
  16816. Cubic root.
  16817. @item log
  16818. Logarithmic.
  16819. @end table
  16820. @item swap
  16821. Swap left channel axis with right channel axis.
  16822. @item mirror
  16823. Mirror axis.
  16824. @table @samp
  16825. @item none
  16826. No mirror.
  16827. @item x
  16828. Mirror only x axis.
  16829. @item y
  16830. Mirror only y axis.
  16831. @item xy
  16832. Mirror both axis.
  16833. @end table
  16834. @end table
  16835. @subsection Examples
  16836. @itemize
  16837. @item
  16838. Complete example using @command{ffplay}:
  16839. @example
  16840. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16841. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16842. @end example
  16843. @end itemize
  16844. @section bench, abench
  16845. Benchmark part of a filtergraph.
  16846. The filter accepts the following options:
  16847. @table @option
  16848. @item action
  16849. Start or stop a timer.
  16850. Available values are:
  16851. @table @samp
  16852. @item start
  16853. Get the current time, set it as frame metadata (using the key
  16854. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16855. @item stop
  16856. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16857. the input frame metadata to get the time difference. Time difference, average,
  16858. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16859. @code{min}) are then printed. The timestamps are expressed in seconds.
  16860. @end table
  16861. @end table
  16862. @subsection Examples
  16863. @itemize
  16864. @item
  16865. Benchmark @ref{selectivecolor} filter:
  16866. @example
  16867. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16868. @end example
  16869. @end itemize
  16870. @section concat
  16871. Concatenate audio and video streams, joining them together one after the
  16872. other.
  16873. The filter works on segments of synchronized video and audio streams. All
  16874. segments must have the same number of streams of each type, and that will
  16875. also be the number of streams at output.
  16876. The filter accepts the following options:
  16877. @table @option
  16878. @item n
  16879. Set the number of segments. Default is 2.
  16880. @item v
  16881. Set the number of output video streams, that is also the number of video
  16882. streams in each segment. Default is 1.
  16883. @item a
  16884. Set the number of output audio streams, that is also the number of audio
  16885. streams in each segment. Default is 0.
  16886. @item unsafe
  16887. Activate unsafe mode: do not fail if segments have a different format.
  16888. @end table
  16889. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16890. @var{a} audio outputs.
  16891. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16892. segment, in the same order as the outputs, then the inputs for the second
  16893. segment, etc.
  16894. Related streams do not always have exactly the same duration, for various
  16895. reasons including codec frame size or sloppy authoring. For that reason,
  16896. related synchronized streams (e.g. a video and its audio track) should be
  16897. concatenated at once. The concat filter will use the duration of the longest
  16898. stream in each segment (except the last one), and if necessary pad shorter
  16899. audio streams with silence.
  16900. For this filter to work correctly, all segments must start at timestamp 0.
  16901. All corresponding streams must have the same parameters in all segments; the
  16902. filtering system will automatically select a common pixel format for video
  16903. streams, and a common sample format, sample rate and channel layout for
  16904. audio streams, but other settings, such as resolution, must be converted
  16905. explicitly by the user.
  16906. Different frame rates are acceptable but will result in variable frame rate
  16907. at output; be sure to configure the output file to handle it.
  16908. @subsection Examples
  16909. @itemize
  16910. @item
  16911. Concatenate an opening, an episode and an ending, all in bilingual version
  16912. (video in stream 0, audio in streams 1 and 2):
  16913. @example
  16914. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16915. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16916. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16917. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16918. @end example
  16919. @item
  16920. Concatenate two parts, handling audio and video separately, using the
  16921. (a)movie sources, and adjusting the resolution:
  16922. @example
  16923. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16924. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16925. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16926. @end example
  16927. Note that a desync will happen at the stitch if the audio and video streams
  16928. do not have exactly the same duration in the first file.
  16929. @end itemize
  16930. @subsection Commands
  16931. This filter supports the following commands:
  16932. @table @option
  16933. @item next
  16934. Close the current segment and step to the next one
  16935. @end table
  16936. @anchor{ebur128}
  16937. @section ebur128
  16938. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16939. level. By default, it logs a message at a frequency of 10Hz with the
  16940. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16941. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16942. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16943. sample format is double-precision floating point. The input stream will be converted to
  16944. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16945. after this filter to obtain the original parameters.
  16946. The filter also has a video output (see the @var{video} option) with a real
  16947. time graph to observe the loudness evolution. The graphic contains the logged
  16948. message mentioned above, so it is not printed anymore when this option is set,
  16949. unless the verbose logging is set. The main graphing area contains the
  16950. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16951. the momentary loudness (400 milliseconds), but can optionally be configured
  16952. to instead display short-term loudness (see @var{gauge}).
  16953. The green area marks a +/- 1LU target range around the target loudness
  16954. (-23LUFS by default, unless modified through @var{target}).
  16955. More information about the Loudness Recommendation EBU R128 on
  16956. @url{http://tech.ebu.ch/loudness}.
  16957. The filter accepts the following options:
  16958. @table @option
  16959. @item video
  16960. Activate the video output. The audio stream is passed unchanged whether this
  16961. option is set or no. The video stream will be the first output stream if
  16962. activated. Default is @code{0}.
  16963. @item size
  16964. Set the video size. This option is for video only. For the syntax of this
  16965. option, check the
  16966. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16967. Default and minimum resolution is @code{640x480}.
  16968. @item meter
  16969. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16970. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16971. other integer value between this range is allowed.
  16972. @item metadata
  16973. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16974. into 100ms output frames, each of them containing various loudness information
  16975. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16976. Default is @code{0}.
  16977. @item framelog
  16978. Force the frame logging level.
  16979. Available values are:
  16980. @table @samp
  16981. @item info
  16982. information logging level
  16983. @item verbose
  16984. verbose logging level
  16985. @end table
  16986. By default, the logging level is set to @var{info}. If the @option{video} or
  16987. the @option{metadata} options are set, it switches to @var{verbose}.
  16988. @item peak
  16989. Set peak mode(s).
  16990. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16991. values are:
  16992. @table @samp
  16993. @item none
  16994. Disable any peak mode (default).
  16995. @item sample
  16996. Enable sample-peak mode.
  16997. Simple peak mode looking for the higher sample value. It logs a message
  16998. for sample-peak (identified by @code{SPK}).
  16999. @item true
  17000. Enable true-peak mode.
  17001. If enabled, the peak lookup is done on an over-sampled version of the input
  17002. stream for better peak accuracy. It logs a message for true-peak.
  17003. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17004. This mode requires a build with @code{libswresample}.
  17005. @end table
  17006. @item dualmono
  17007. Treat mono input files as "dual mono". If a mono file is intended for playback
  17008. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17009. If set to @code{true}, this option will compensate for this effect.
  17010. Multi-channel input files are not affected by this option.
  17011. @item panlaw
  17012. Set a specific pan law to be used for the measurement of dual mono files.
  17013. This parameter is optional, and has a default value of -3.01dB.
  17014. @item target
  17015. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17016. This parameter is optional and has a default value of -23LUFS as specified
  17017. by EBU R128. However, material published online may prefer a level of -16LUFS
  17018. (e.g. for use with podcasts or video platforms).
  17019. @item gauge
  17020. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17021. @code{shortterm}. By default the momentary value will be used, but in certain
  17022. scenarios it may be more useful to observe the short term value instead (e.g.
  17023. live mixing).
  17024. @item scale
  17025. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17026. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17027. video output, not the summary or continuous log output.
  17028. @end table
  17029. @subsection Examples
  17030. @itemize
  17031. @item
  17032. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17033. @example
  17034. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17035. @end example
  17036. @item
  17037. Run an analysis with @command{ffmpeg}:
  17038. @example
  17039. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17040. @end example
  17041. @end itemize
  17042. @section interleave, ainterleave
  17043. Temporally interleave frames from several inputs.
  17044. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17045. These filters read frames from several inputs and send the oldest
  17046. queued frame to the output.
  17047. Input streams must have well defined, monotonically increasing frame
  17048. timestamp values.
  17049. In order to submit one frame to output, these filters need to enqueue
  17050. at least one frame for each input, so they cannot work in case one
  17051. input is not yet terminated and will not receive incoming frames.
  17052. For example consider the case when one input is a @code{select} filter
  17053. which always drops input frames. The @code{interleave} filter will keep
  17054. reading from that input, but it will never be able to send new frames
  17055. to output until the input sends an end-of-stream signal.
  17056. Also, depending on inputs synchronization, the filters will drop
  17057. frames in case one input receives more frames than the other ones, and
  17058. the queue is already filled.
  17059. These filters accept the following options:
  17060. @table @option
  17061. @item nb_inputs, n
  17062. Set the number of different inputs, it is 2 by default.
  17063. @end table
  17064. @subsection Examples
  17065. @itemize
  17066. @item
  17067. Interleave frames belonging to different streams using @command{ffmpeg}:
  17068. @example
  17069. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17070. @end example
  17071. @item
  17072. Add flickering blur effect:
  17073. @example
  17074. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17075. @end example
  17076. @end itemize
  17077. @section metadata, ametadata
  17078. Manipulate frame metadata.
  17079. This filter accepts the following options:
  17080. @table @option
  17081. @item mode
  17082. Set mode of operation of the filter.
  17083. Can be one of the following:
  17084. @table @samp
  17085. @item select
  17086. If both @code{value} and @code{key} is set, select frames
  17087. which have such metadata. If only @code{key} is set, select
  17088. every frame that has such key in metadata.
  17089. @item add
  17090. Add new metadata @code{key} and @code{value}. If key is already available
  17091. do nothing.
  17092. @item modify
  17093. Modify value of already present key.
  17094. @item delete
  17095. If @code{value} is set, delete only keys that have such value.
  17096. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17097. the frame.
  17098. @item print
  17099. Print key and its value if metadata was found. If @code{key} is not set print all
  17100. metadata values available in frame.
  17101. @end table
  17102. @item key
  17103. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17104. @item value
  17105. Set metadata value which will be used. This option is mandatory for
  17106. @code{modify} and @code{add} mode.
  17107. @item function
  17108. Which function to use when comparing metadata value and @code{value}.
  17109. Can be one of following:
  17110. @table @samp
  17111. @item same_str
  17112. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17113. @item starts_with
  17114. Values are interpreted as strings, returns true if metadata value starts with
  17115. the @code{value} option string.
  17116. @item less
  17117. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17118. @item equal
  17119. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17120. @item greater
  17121. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17122. @item expr
  17123. Values are interpreted as floats, returns true if expression from option @code{expr}
  17124. evaluates to true.
  17125. @item ends_with
  17126. Values are interpreted as strings, returns true if metadata value ends with
  17127. the @code{value} option string.
  17128. @end table
  17129. @item expr
  17130. Set expression which is used when @code{function} is set to @code{expr}.
  17131. The expression is evaluated through the eval API and can contain the following
  17132. constants:
  17133. @table @option
  17134. @item VALUE1
  17135. Float representation of @code{value} from metadata key.
  17136. @item VALUE2
  17137. Float representation of @code{value} as supplied by user in @code{value} option.
  17138. @end table
  17139. @item file
  17140. If specified in @code{print} mode, output is written to the named file. Instead of
  17141. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17142. for standard output. If @code{file} option is not set, output is written to the log
  17143. with AV_LOG_INFO loglevel.
  17144. @end table
  17145. @subsection Examples
  17146. @itemize
  17147. @item
  17148. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17149. between 0 and 1.
  17150. @example
  17151. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17152. @end example
  17153. @item
  17154. Print silencedetect output to file @file{metadata.txt}.
  17155. @example
  17156. silencedetect,ametadata=mode=print:file=metadata.txt
  17157. @end example
  17158. @item
  17159. Direct all metadata to a pipe with file descriptor 4.
  17160. @example
  17161. metadata=mode=print:file='pipe\:4'
  17162. @end example
  17163. @end itemize
  17164. @section perms, aperms
  17165. Set read/write permissions for the output frames.
  17166. These filters are mainly aimed at developers to test direct path in the
  17167. following filter in the filtergraph.
  17168. The filters accept the following options:
  17169. @table @option
  17170. @item mode
  17171. Select the permissions mode.
  17172. It accepts the following values:
  17173. @table @samp
  17174. @item none
  17175. Do nothing. This is the default.
  17176. @item ro
  17177. Set all the output frames read-only.
  17178. @item rw
  17179. Set all the output frames directly writable.
  17180. @item toggle
  17181. Make the frame read-only if writable, and writable if read-only.
  17182. @item random
  17183. Set each output frame read-only or writable randomly.
  17184. @end table
  17185. @item seed
  17186. Set the seed for the @var{random} mode, must be an integer included between
  17187. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17188. @code{-1}, the filter will try to use a good random seed on a best effort
  17189. basis.
  17190. @end table
  17191. Note: in case of auto-inserted filter between the permission filter and the
  17192. following one, the permission might not be received as expected in that
  17193. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17194. perms/aperms filter can avoid this problem.
  17195. @section realtime, arealtime
  17196. Slow down filtering to match real time approximately.
  17197. These filters will pause the filtering for a variable amount of time to
  17198. match the output rate with the input timestamps.
  17199. They are similar to the @option{re} option to @code{ffmpeg}.
  17200. They accept the following options:
  17201. @table @option
  17202. @item limit
  17203. Time limit for the pauses. Any pause longer than that will be considered
  17204. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17205. @item speed
  17206. Speed factor for processing. The value must be a float larger than zero.
  17207. Values larger than 1.0 will result in faster than realtime processing,
  17208. smaller will slow processing down. The @var{limit} is automatically adapted
  17209. accordingly. Default is 1.0.
  17210. A processing speed faster than what is possible without these filters cannot
  17211. be achieved.
  17212. @end table
  17213. @anchor{select}
  17214. @section select, aselect
  17215. Select frames to pass in output.
  17216. This filter accepts the following options:
  17217. @table @option
  17218. @item expr, e
  17219. Set expression, which is evaluated for each input frame.
  17220. If the expression is evaluated to zero, the frame is discarded.
  17221. If the evaluation result is negative or NaN, the frame is sent to the
  17222. first output; otherwise it is sent to the output with index
  17223. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17224. For example a value of @code{1.2} corresponds to the output with index
  17225. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17226. @item outputs, n
  17227. Set the number of outputs. The output to which to send the selected
  17228. frame is based on the result of the evaluation. Default value is 1.
  17229. @end table
  17230. The expression can contain the following constants:
  17231. @table @option
  17232. @item n
  17233. The (sequential) number of the filtered frame, starting from 0.
  17234. @item selected_n
  17235. The (sequential) number of the selected frame, starting from 0.
  17236. @item prev_selected_n
  17237. The sequential number of the last selected frame. It's NAN if undefined.
  17238. @item TB
  17239. The timebase of the input timestamps.
  17240. @item pts
  17241. The PTS (Presentation TimeStamp) of the filtered video frame,
  17242. expressed in @var{TB} units. It's NAN if undefined.
  17243. @item t
  17244. The PTS of the filtered video frame,
  17245. expressed in seconds. It's NAN if undefined.
  17246. @item prev_pts
  17247. The PTS of the previously filtered video frame. It's NAN if undefined.
  17248. @item prev_selected_pts
  17249. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17250. @item prev_selected_t
  17251. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17252. @item start_pts
  17253. The PTS of the first video frame in the video. It's NAN if undefined.
  17254. @item start_t
  17255. The time of the first video frame in the video. It's NAN if undefined.
  17256. @item pict_type @emph{(video only)}
  17257. The type of the filtered frame. It can assume one of the following
  17258. values:
  17259. @table @option
  17260. @item I
  17261. @item P
  17262. @item B
  17263. @item S
  17264. @item SI
  17265. @item SP
  17266. @item BI
  17267. @end table
  17268. @item interlace_type @emph{(video only)}
  17269. The frame interlace type. It can assume one of the following values:
  17270. @table @option
  17271. @item PROGRESSIVE
  17272. The frame is progressive (not interlaced).
  17273. @item TOPFIRST
  17274. The frame is top-field-first.
  17275. @item BOTTOMFIRST
  17276. The frame is bottom-field-first.
  17277. @end table
  17278. @item consumed_sample_n @emph{(audio only)}
  17279. the number of selected samples before the current frame
  17280. @item samples_n @emph{(audio only)}
  17281. the number of samples in the current frame
  17282. @item sample_rate @emph{(audio only)}
  17283. the input sample rate
  17284. @item key
  17285. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17286. @item pos
  17287. the position in the file of the filtered frame, -1 if the information
  17288. is not available (e.g. for synthetic video)
  17289. @item scene @emph{(video only)}
  17290. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17291. probability for the current frame to introduce a new scene, while a higher
  17292. value means the current frame is more likely to be one (see the example below)
  17293. @item concatdec_select
  17294. The concat demuxer can select only part of a concat input file by setting an
  17295. inpoint and an outpoint, but the output packets may not be entirely contained
  17296. in the selected interval. By using this variable, it is possible to skip frames
  17297. generated by the concat demuxer which are not exactly contained in the selected
  17298. interval.
  17299. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17300. and the @var{lavf.concat.duration} packet metadata values which are also
  17301. present in the decoded frames.
  17302. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17303. start_time and either the duration metadata is missing or the frame pts is less
  17304. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17305. missing.
  17306. That basically means that an input frame is selected if its pts is within the
  17307. interval set by the concat demuxer.
  17308. @end table
  17309. The default value of the select expression is "1".
  17310. @subsection Examples
  17311. @itemize
  17312. @item
  17313. Select all frames in input:
  17314. @example
  17315. select
  17316. @end example
  17317. The example above is the same as:
  17318. @example
  17319. select=1
  17320. @end example
  17321. @item
  17322. Skip all frames:
  17323. @example
  17324. select=0
  17325. @end example
  17326. @item
  17327. Select only I-frames:
  17328. @example
  17329. select='eq(pict_type\,I)'
  17330. @end example
  17331. @item
  17332. Select one frame every 100:
  17333. @example
  17334. select='not(mod(n\,100))'
  17335. @end example
  17336. @item
  17337. Select only frames contained in the 10-20 time interval:
  17338. @example
  17339. select=between(t\,10\,20)
  17340. @end example
  17341. @item
  17342. Select only I-frames contained in the 10-20 time interval:
  17343. @example
  17344. select=between(t\,10\,20)*eq(pict_type\,I)
  17345. @end example
  17346. @item
  17347. Select frames with a minimum distance of 10 seconds:
  17348. @example
  17349. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17350. @end example
  17351. @item
  17352. Use aselect to select only audio frames with samples number > 100:
  17353. @example
  17354. aselect='gt(samples_n\,100)'
  17355. @end example
  17356. @item
  17357. Create a mosaic of the first scenes:
  17358. @example
  17359. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17360. @end example
  17361. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17362. choice.
  17363. @item
  17364. Send even and odd frames to separate outputs, and compose them:
  17365. @example
  17366. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17367. @end example
  17368. @item
  17369. Select useful frames from an ffconcat file which is using inpoints and
  17370. outpoints but where the source files are not intra frame only.
  17371. @example
  17372. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17373. @end example
  17374. @end itemize
  17375. @section sendcmd, asendcmd
  17376. Send commands to filters in the filtergraph.
  17377. These filters read commands to be sent to other filters in the
  17378. filtergraph.
  17379. @code{sendcmd} must be inserted between two video filters,
  17380. @code{asendcmd} must be inserted between two audio filters, but apart
  17381. from that they act the same way.
  17382. The specification of commands can be provided in the filter arguments
  17383. with the @var{commands} option, or in a file specified by the
  17384. @var{filename} option.
  17385. These filters accept the following options:
  17386. @table @option
  17387. @item commands, c
  17388. Set the commands to be read and sent to the other filters.
  17389. @item filename, f
  17390. Set the filename of the commands to be read and sent to the other
  17391. filters.
  17392. @end table
  17393. @subsection Commands syntax
  17394. A commands description consists of a sequence of interval
  17395. specifications, comprising a list of commands to be executed when a
  17396. particular event related to that interval occurs. The occurring event
  17397. is typically the current frame time entering or leaving a given time
  17398. interval.
  17399. An interval is specified by the following syntax:
  17400. @example
  17401. @var{START}[-@var{END}] @var{COMMANDS};
  17402. @end example
  17403. The time interval is specified by the @var{START} and @var{END} times.
  17404. @var{END} is optional and defaults to the maximum time.
  17405. The current frame time is considered within the specified interval if
  17406. it is included in the interval [@var{START}, @var{END}), that is when
  17407. the time is greater or equal to @var{START} and is lesser than
  17408. @var{END}.
  17409. @var{COMMANDS} consists of a sequence of one or more command
  17410. specifications, separated by ",", relating to that interval. The
  17411. syntax of a command specification is given by:
  17412. @example
  17413. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17414. @end example
  17415. @var{FLAGS} is optional and specifies the type of events relating to
  17416. the time interval which enable sending the specified command, and must
  17417. be a non-null sequence of identifier flags separated by "+" or "|" and
  17418. enclosed between "[" and "]".
  17419. The following flags are recognized:
  17420. @table @option
  17421. @item enter
  17422. The command is sent when the current frame timestamp enters the
  17423. specified interval. In other words, the command is sent when the
  17424. previous frame timestamp was not in the given interval, and the
  17425. current is.
  17426. @item leave
  17427. The command is sent when the current frame timestamp leaves the
  17428. specified interval. In other words, the command is sent when the
  17429. previous frame timestamp was in the given interval, and the
  17430. current is not.
  17431. @end table
  17432. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17433. assumed.
  17434. @var{TARGET} specifies the target of the command, usually the name of
  17435. the filter class or a specific filter instance name.
  17436. @var{COMMAND} specifies the name of the command for the target filter.
  17437. @var{ARG} is optional and specifies the optional list of argument for
  17438. the given @var{COMMAND}.
  17439. Between one interval specification and another, whitespaces, or
  17440. sequences of characters starting with @code{#} until the end of line,
  17441. are ignored and can be used to annotate comments.
  17442. A simplified BNF description of the commands specification syntax
  17443. follows:
  17444. @example
  17445. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17446. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17447. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17448. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17449. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17450. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17451. @end example
  17452. @subsection Examples
  17453. @itemize
  17454. @item
  17455. Specify audio tempo change at second 4:
  17456. @example
  17457. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17458. @end example
  17459. @item
  17460. Target a specific filter instance:
  17461. @example
  17462. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17463. @end example
  17464. @item
  17465. Specify a list of drawtext and hue commands in a file.
  17466. @example
  17467. # show text in the interval 5-10
  17468. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17469. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17470. # desaturate the image in the interval 15-20
  17471. 15.0-20.0 [enter] hue s 0,
  17472. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17473. [leave] hue s 1,
  17474. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17475. # apply an exponential saturation fade-out effect, starting from time 25
  17476. 25 [enter] hue s exp(25-t)
  17477. @end example
  17478. A filtergraph allowing to read and process the above command list
  17479. stored in a file @file{test.cmd}, can be specified with:
  17480. @example
  17481. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17482. @end example
  17483. @end itemize
  17484. @anchor{setpts}
  17485. @section setpts, asetpts
  17486. Change the PTS (presentation timestamp) of the input frames.
  17487. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17488. This filter accepts the following options:
  17489. @table @option
  17490. @item expr
  17491. The expression which is evaluated for each frame to construct its timestamp.
  17492. @end table
  17493. The expression is evaluated through the eval API and can contain the following
  17494. constants:
  17495. @table @option
  17496. @item FRAME_RATE, FR
  17497. frame rate, only defined for constant frame-rate video
  17498. @item PTS
  17499. The presentation timestamp in input
  17500. @item N
  17501. The count of the input frame for video or the number of consumed samples,
  17502. not including the current frame for audio, starting from 0.
  17503. @item NB_CONSUMED_SAMPLES
  17504. The number of consumed samples, not including the current frame (only
  17505. audio)
  17506. @item NB_SAMPLES, S
  17507. The number of samples in the current frame (only audio)
  17508. @item SAMPLE_RATE, SR
  17509. The audio sample rate.
  17510. @item STARTPTS
  17511. The PTS of the first frame.
  17512. @item STARTT
  17513. the time in seconds of the first frame
  17514. @item INTERLACED
  17515. State whether the current frame is interlaced.
  17516. @item T
  17517. the time in seconds of the current frame
  17518. @item POS
  17519. original position in the file of the frame, or undefined if undefined
  17520. for the current frame
  17521. @item PREV_INPTS
  17522. The previous input PTS.
  17523. @item PREV_INT
  17524. previous input time in seconds
  17525. @item PREV_OUTPTS
  17526. The previous output PTS.
  17527. @item PREV_OUTT
  17528. previous output time in seconds
  17529. @item RTCTIME
  17530. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17531. instead.
  17532. @item RTCSTART
  17533. The wallclock (RTC) time at the start of the movie in microseconds.
  17534. @item TB
  17535. The timebase of the input timestamps.
  17536. @end table
  17537. @subsection Examples
  17538. @itemize
  17539. @item
  17540. Start counting PTS from zero
  17541. @example
  17542. setpts=PTS-STARTPTS
  17543. @end example
  17544. @item
  17545. Apply fast motion effect:
  17546. @example
  17547. setpts=0.5*PTS
  17548. @end example
  17549. @item
  17550. Apply slow motion effect:
  17551. @example
  17552. setpts=2.0*PTS
  17553. @end example
  17554. @item
  17555. Set fixed rate of 25 frames per second:
  17556. @example
  17557. setpts=N/(25*TB)
  17558. @end example
  17559. @item
  17560. Set fixed rate 25 fps with some jitter:
  17561. @example
  17562. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17563. @end example
  17564. @item
  17565. Apply an offset of 10 seconds to the input PTS:
  17566. @example
  17567. setpts=PTS+10/TB
  17568. @end example
  17569. @item
  17570. Generate timestamps from a "live source" and rebase onto the current timebase:
  17571. @example
  17572. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17573. @end example
  17574. @item
  17575. Generate timestamps by counting samples:
  17576. @example
  17577. asetpts=N/SR/TB
  17578. @end example
  17579. @end itemize
  17580. @section setrange
  17581. Force color range for the output video frame.
  17582. The @code{setrange} filter marks the color range property for the
  17583. output frames. It does not change the input frame, but only sets the
  17584. corresponding property, which affects how the frame is treated by
  17585. following filters.
  17586. The filter accepts the following options:
  17587. @table @option
  17588. @item range
  17589. Available values are:
  17590. @table @samp
  17591. @item auto
  17592. Keep the same color range property.
  17593. @item unspecified, unknown
  17594. Set the color range as unspecified.
  17595. @item limited, tv, mpeg
  17596. Set the color range as limited.
  17597. @item full, pc, jpeg
  17598. Set the color range as full.
  17599. @end table
  17600. @end table
  17601. @section settb, asettb
  17602. Set the timebase to use for the output frames timestamps.
  17603. It is mainly useful for testing timebase configuration.
  17604. It accepts the following parameters:
  17605. @table @option
  17606. @item expr, tb
  17607. The expression which is evaluated into the output timebase.
  17608. @end table
  17609. The value for @option{tb} is an arithmetic expression representing a
  17610. rational. The expression can contain the constants "AVTB" (the default
  17611. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17612. audio only). Default value is "intb".
  17613. @subsection Examples
  17614. @itemize
  17615. @item
  17616. Set the timebase to 1/25:
  17617. @example
  17618. settb=expr=1/25
  17619. @end example
  17620. @item
  17621. Set the timebase to 1/10:
  17622. @example
  17623. settb=expr=0.1
  17624. @end example
  17625. @item
  17626. Set the timebase to 1001/1000:
  17627. @example
  17628. settb=1+0.001
  17629. @end example
  17630. @item
  17631. Set the timebase to 2*intb:
  17632. @example
  17633. settb=2*intb
  17634. @end example
  17635. @item
  17636. Set the default timebase value:
  17637. @example
  17638. settb=AVTB
  17639. @end example
  17640. @end itemize
  17641. @section showcqt
  17642. Convert input audio to a video output representing frequency spectrum
  17643. logarithmically using Brown-Puckette constant Q transform algorithm with
  17644. direct frequency domain coefficient calculation (but the transform itself
  17645. is not really constant Q, instead the Q factor is actually variable/clamped),
  17646. with musical tone scale, from E0 to D#10.
  17647. The filter accepts the following options:
  17648. @table @option
  17649. @item size, s
  17650. Specify the video size for the output. It must be even. For the syntax of this option,
  17651. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17652. Default value is @code{1920x1080}.
  17653. @item fps, rate, r
  17654. Set the output frame rate. Default value is @code{25}.
  17655. @item bar_h
  17656. Set the bargraph height. It must be even. Default value is @code{-1} which
  17657. computes the bargraph height automatically.
  17658. @item axis_h
  17659. Set the axis height. It must be even. Default value is @code{-1} which computes
  17660. the axis height automatically.
  17661. @item sono_h
  17662. Set the sonogram height. It must be even. Default value is @code{-1} which
  17663. computes the sonogram height automatically.
  17664. @item fullhd
  17665. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17666. instead. Default value is @code{1}.
  17667. @item sono_v, volume
  17668. Specify the sonogram volume expression. It can contain variables:
  17669. @table @option
  17670. @item bar_v
  17671. the @var{bar_v} evaluated expression
  17672. @item frequency, freq, f
  17673. the frequency where it is evaluated
  17674. @item timeclamp, tc
  17675. the value of @var{timeclamp} option
  17676. @end table
  17677. and functions:
  17678. @table @option
  17679. @item a_weighting(f)
  17680. A-weighting of equal loudness
  17681. @item b_weighting(f)
  17682. B-weighting of equal loudness
  17683. @item c_weighting(f)
  17684. C-weighting of equal loudness.
  17685. @end table
  17686. Default value is @code{16}.
  17687. @item bar_v, volume2
  17688. Specify the bargraph volume expression. It can contain variables:
  17689. @table @option
  17690. @item sono_v
  17691. the @var{sono_v} evaluated expression
  17692. @item frequency, freq, f
  17693. the frequency where it is evaluated
  17694. @item timeclamp, tc
  17695. the value of @var{timeclamp} option
  17696. @end table
  17697. and functions:
  17698. @table @option
  17699. @item a_weighting(f)
  17700. A-weighting of equal loudness
  17701. @item b_weighting(f)
  17702. B-weighting of equal loudness
  17703. @item c_weighting(f)
  17704. C-weighting of equal loudness.
  17705. @end table
  17706. Default value is @code{sono_v}.
  17707. @item sono_g, gamma
  17708. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17709. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17710. Acceptable range is @code{[1, 7]}.
  17711. @item bar_g, gamma2
  17712. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17713. @code{[1, 7]}.
  17714. @item bar_t
  17715. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17716. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17717. @item timeclamp, tc
  17718. Specify the transform timeclamp. At low frequency, there is trade-off between
  17719. accuracy in time domain and frequency domain. If timeclamp is lower,
  17720. event in time domain is represented more accurately (such as fast bass drum),
  17721. otherwise event in frequency domain is represented more accurately
  17722. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17723. @item attack
  17724. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17725. limits future samples by applying asymmetric windowing in time domain, useful
  17726. when low latency is required. Accepted range is @code{[0, 1]}.
  17727. @item basefreq
  17728. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17729. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17730. @item endfreq
  17731. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17732. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17733. @item coeffclamp
  17734. This option is deprecated and ignored.
  17735. @item tlength
  17736. Specify the transform length in time domain. Use this option to control accuracy
  17737. trade-off between time domain and frequency domain at every frequency sample.
  17738. It can contain variables:
  17739. @table @option
  17740. @item frequency, freq, f
  17741. the frequency where it is evaluated
  17742. @item timeclamp, tc
  17743. the value of @var{timeclamp} option.
  17744. @end table
  17745. Default value is @code{384*tc/(384+tc*f)}.
  17746. @item count
  17747. Specify the transform count for every video frame. Default value is @code{6}.
  17748. Acceptable range is @code{[1, 30]}.
  17749. @item fcount
  17750. Specify the transform count for every single pixel. Default value is @code{0},
  17751. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17752. @item fontfile
  17753. Specify font file for use with freetype to draw the axis. If not specified,
  17754. use embedded font. Note that drawing with font file or embedded font is not
  17755. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17756. option instead.
  17757. @item font
  17758. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17759. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17760. escaping.
  17761. @item fontcolor
  17762. Specify font color expression. This is arithmetic expression that should return
  17763. integer value 0xRRGGBB. It can contain variables:
  17764. @table @option
  17765. @item frequency, freq, f
  17766. the frequency where it is evaluated
  17767. @item timeclamp, tc
  17768. the value of @var{timeclamp} option
  17769. @end table
  17770. and functions:
  17771. @table @option
  17772. @item midi(f)
  17773. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17774. @item r(x), g(x), b(x)
  17775. red, green, and blue value of intensity x.
  17776. @end table
  17777. Default value is @code{st(0, (midi(f)-59.5)/12);
  17778. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17779. r(1-ld(1)) + b(ld(1))}.
  17780. @item axisfile
  17781. Specify image file to draw the axis. This option override @var{fontfile} and
  17782. @var{fontcolor} option.
  17783. @item axis, text
  17784. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17785. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17786. Default value is @code{1}.
  17787. @item csp
  17788. Set colorspace. The accepted values are:
  17789. @table @samp
  17790. @item unspecified
  17791. Unspecified (default)
  17792. @item bt709
  17793. BT.709
  17794. @item fcc
  17795. FCC
  17796. @item bt470bg
  17797. BT.470BG or BT.601-6 625
  17798. @item smpte170m
  17799. SMPTE-170M or BT.601-6 525
  17800. @item smpte240m
  17801. SMPTE-240M
  17802. @item bt2020ncl
  17803. BT.2020 with non-constant luminance
  17804. @end table
  17805. @item cscheme
  17806. Set spectrogram color scheme. This is list of floating point values with format
  17807. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17808. The default is @code{1|0.5|0|0|0.5|1}.
  17809. @end table
  17810. @subsection Examples
  17811. @itemize
  17812. @item
  17813. Playing audio while showing the spectrum:
  17814. @example
  17815. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17816. @end example
  17817. @item
  17818. Same as above, but with frame rate 30 fps:
  17819. @example
  17820. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17821. @end example
  17822. @item
  17823. Playing at 1280x720:
  17824. @example
  17825. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17826. @end example
  17827. @item
  17828. Disable sonogram display:
  17829. @example
  17830. sono_h=0
  17831. @end example
  17832. @item
  17833. A1 and its harmonics: A1, A2, (near)E3, A3:
  17834. @example
  17835. 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),
  17836. asplit[a][out1]; [a] showcqt [out0]'
  17837. @end example
  17838. @item
  17839. Same as above, but with more accuracy in frequency domain:
  17840. @example
  17841. 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),
  17842. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17843. @end example
  17844. @item
  17845. Custom volume:
  17846. @example
  17847. bar_v=10:sono_v=bar_v*a_weighting(f)
  17848. @end example
  17849. @item
  17850. Custom gamma, now spectrum is linear to the amplitude.
  17851. @example
  17852. bar_g=2:sono_g=2
  17853. @end example
  17854. @item
  17855. Custom tlength equation:
  17856. @example
  17857. 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)))'
  17858. @end example
  17859. @item
  17860. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17861. @example
  17862. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17863. @end example
  17864. @item
  17865. Custom font using fontconfig:
  17866. @example
  17867. font='Courier New,Monospace,mono|bold'
  17868. @end example
  17869. @item
  17870. Custom frequency range with custom axis using image file:
  17871. @example
  17872. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17873. @end example
  17874. @end itemize
  17875. @section showfreqs
  17876. Convert input audio to video output representing the audio power spectrum.
  17877. Audio amplitude is on Y-axis while frequency is on X-axis.
  17878. The filter accepts the following options:
  17879. @table @option
  17880. @item size, s
  17881. Specify size of video. For the syntax of this option, check the
  17882. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17883. Default is @code{1024x512}.
  17884. @item mode
  17885. Set display mode.
  17886. This set how each frequency bin will be represented.
  17887. It accepts the following values:
  17888. @table @samp
  17889. @item line
  17890. @item bar
  17891. @item dot
  17892. @end table
  17893. Default is @code{bar}.
  17894. @item ascale
  17895. Set amplitude scale.
  17896. It accepts the following values:
  17897. @table @samp
  17898. @item lin
  17899. Linear scale.
  17900. @item sqrt
  17901. Square root scale.
  17902. @item cbrt
  17903. Cubic root scale.
  17904. @item log
  17905. Logarithmic scale.
  17906. @end table
  17907. Default is @code{log}.
  17908. @item fscale
  17909. Set frequency scale.
  17910. It accepts the following values:
  17911. @table @samp
  17912. @item lin
  17913. Linear scale.
  17914. @item log
  17915. Logarithmic scale.
  17916. @item rlog
  17917. Reverse logarithmic scale.
  17918. @end table
  17919. Default is @code{lin}.
  17920. @item win_size
  17921. Set window size. Allowed range is from 16 to 65536.
  17922. Default is @code{2048}
  17923. @item win_func
  17924. Set windowing function.
  17925. It accepts the following values:
  17926. @table @samp
  17927. @item rect
  17928. @item bartlett
  17929. @item hanning
  17930. @item hamming
  17931. @item blackman
  17932. @item welch
  17933. @item flattop
  17934. @item bharris
  17935. @item bnuttall
  17936. @item bhann
  17937. @item sine
  17938. @item nuttall
  17939. @item lanczos
  17940. @item gauss
  17941. @item tukey
  17942. @item dolph
  17943. @item cauchy
  17944. @item parzen
  17945. @item poisson
  17946. @item bohman
  17947. @end table
  17948. Default is @code{hanning}.
  17949. @item overlap
  17950. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17951. which means optimal overlap for selected window function will be picked.
  17952. @item averaging
  17953. Set time averaging. Setting this to 0 will display current maximal peaks.
  17954. Default is @code{1}, which means time averaging is disabled.
  17955. @item colors
  17956. Specify list of colors separated by space or by '|' which will be used to
  17957. draw channel frequencies. Unrecognized or missing colors will be replaced
  17958. by white color.
  17959. @item cmode
  17960. Set channel display mode.
  17961. It accepts the following values:
  17962. @table @samp
  17963. @item combined
  17964. @item separate
  17965. @end table
  17966. Default is @code{combined}.
  17967. @item minamp
  17968. Set minimum amplitude used in @code{log} amplitude scaler.
  17969. @end table
  17970. @section showspatial
  17971. Convert stereo input audio to a video output, representing the spatial relationship
  17972. between two channels.
  17973. The filter accepts the following options:
  17974. @table @option
  17975. @item size, s
  17976. Specify the video size for the output. For the syntax of this option, check the
  17977. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17978. Default value is @code{512x512}.
  17979. @item win_size
  17980. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17981. @item win_func
  17982. Set window function.
  17983. It accepts the following values:
  17984. @table @samp
  17985. @item rect
  17986. @item bartlett
  17987. @item hann
  17988. @item hanning
  17989. @item hamming
  17990. @item blackman
  17991. @item welch
  17992. @item flattop
  17993. @item bharris
  17994. @item bnuttall
  17995. @item bhann
  17996. @item sine
  17997. @item nuttall
  17998. @item lanczos
  17999. @item gauss
  18000. @item tukey
  18001. @item dolph
  18002. @item cauchy
  18003. @item parzen
  18004. @item poisson
  18005. @item bohman
  18006. @end table
  18007. Default value is @code{hann}.
  18008. @item overlap
  18009. Set ratio of overlap window. Default value is @code{0.5}.
  18010. When value is @code{1} overlap is set to recommended size for specific
  18011. window function currently used.
  18012. @end table
  18013. @anchor{showspectrum}
  18014. @section showspectrum
  18015. Convert input audio to a video output, representing the audio frequency
  18016. spectrum.
  18017. The filter accepts the following options:
  18018. @table @option
  18019. @item size, s
  18020. Specify the video size for the output. For the syntax of this option, check the
  18021. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18022. Default value is @code{640x512}.
  18023. @item slide
  18024. Specify how the spectrum should slide along the window.
  18025. It accepts the following values:
  18026. @table @samp
  18027. @item replace
  18028. the samples start again on the left when they reach the right
  18029. @item scroll
  18030. the samples scroll from right to left
  18031. @item fullframe
  18032. frames are only produced when the samples reach the right
  18033. @item rscroll
  18034. the samples scroll from left to right
  18035. @end table
  18036. Default value is @code{replace}.
  18037. @item mode
  18038. Specify display mode.
  18039. It accepts the following values:
  18040. @table @samp
  18041. @item combined
  18042. all channels are displayed in the same row
  18043. @item separate
  18044. all channels are displayed in separate rows
  18045. @end table
  18046. Default value is @samp{combined}.
  18047. @item color
  18048. Specify display color mode.
  18049. It accepts the following values:
  18050. @table @samp
  18051. @item channel
  18052. each channel is displayed in a separate color
  18053. @item intensity
  18054. each channel is displayed using the same color scheme
  18055. @item rainbow
  18056. each channel is displayed using the rainbow color scheme
  18057. @item moreland
  18058. each channel is displayed using the moreland color scheme
  18059. @item nebulae
  18060. each channel is displayed using the nebulae color scheme
  18061. @item fire
  18062. each channel is displayed using the fire color scheme
  18063. @item fiery
  18064. each channel is displayed using the fiery color scheme
  18065. @item fruit
  18066. each channel is displayed using the fruit color scheme
  18067. @item cool
  18068. each channel is displayed using the cool color scheme
  18069. @item magma
  18070. each channel is displayed using the magma color scheme
  18071. @item green
  18072. each channel is displayed using the green color scheme
  18073. @item viridis
  18074. each channel is displayed using the viridis color scheme
  18075. @item plasma
  18076. each channel is displayed using the plasma color scheme
  18077. @item cividis
  18078. each channel is displayed using the cividis color scheme
  18079. @item terrain
  18080. each channel is displayed using the terrain color scheme
  18081. @end table
  18082. Default value is @samp{channel}.
  18083. @item scale
  18084. Specify scale used for calculating intensity color values.
  18085. It accepts the following values:
  18086. @table @samp
  18087. @item lin
  18088. linear
  18089. @item sqrt
  18090. square root, default
  18091. @item cbrt
  18092. cubic root
  18093. @item log
  18094. logarithmic
  18095. @item 4thrt
  18096. 4th root
  18097. @item 5thrt
  18098. 5th root
  18099. @end table
  18100. Default value is @samp{sqrt}.
  18101. @item fscale
  18102. Specify frequency scale.
  18103. It accepts the following values:
  18104. @table @samp
  18105. @item lin
  18106. linear
  18107. @item log
  18108. logarithmic
  18109. @end table
  18110. Default value is @samp{lin}.
  18111. @item saturation
  18112. Set saturation modifier for displayed colors. Negative values provide
  18113. alternative color scheme. @code{0} is no saturation at all.
  18114. Saturation must be in [-10.0, 10.0] range.
  18115. Default value is @code{1}.
  18116. @item win_func
  18117. Set window function.
  18118. It accepts the following values:
  18119. @table @samp
  18120. @item rect
  18121. @item bartlett
  18122. @item hann
  18123. @item hanning
  18124. @item hamming
  18125. @item blackman
  18126. @item welch
  18127. @item flattop
  18128. @item bharris
  18129. @item bnuttall
  18130. @item bhann
  18131. @item sine
  18132. @item nuttall
  18133. @item lanczos
  18134. @item gauss
  18135. @item tukey
  18136. @item dolph
  18137. @item cauchy
  18138. @item parzen
  18139. @item poisson
  18140. @item bohman
  18141. @end table
  18142. Default value is @code{hann}.
  18143. @item orientation
  18144. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18145. @code{horizontal}. Default is @code{vertical}.
  18146. @item overlap
  18147. Set ratio of overlap window. Default value is @code{0}.
  18148. When value is @code{1} overlap is set to recommended size for specific
  18149. window function currently used.
  18150. @item gain
  18151. Set scale gain for calculating intensity color values.
  18152. Default value is @code{1}.
  18153. @item data
  18154. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18155. @item rotation
  18156. Set color rotation, must be in [-1.0, 1.0] range.
  18157. Default value is @code{0}.
  18158. @item start
  18159. Set start frequency from which to display spectrogram. Default is @code{0}.
  18160. @item stop
  18161. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18162. @item fps
  18163. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18164. @item legend
  18165. Draw time and frequency axes and legends. Default is disabled.
  18166. @end table
  18167. The usage is very similar to the showwaves filter; see the examples in that
  18168. section.
  18169. @subsection Examples
  18170. @itemize
  18171. @item
  18172. Large window with logarithmic color scaling:
  18173. @example
  18174. showspectrum=s=1280x480:scale=log
  18175. @end example
  18176. @item
  18177. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18178. @example
  18179. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18180. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18181. @end example
  18182. @end itemize
  18183. @section showspectrumpic
  18184. Convert input audio to a single video frame, representing the audio frequency
  18185. spectrum.
  18186. The filter accepts the following options:
  18187. @table @option
  18188. @item size, s
  18189. Specify the video size for the output. For the syntax of this option, check the
  18190. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18191. Default value is @code{4096x2048}.
  18192. @item mode
  18193. Specify display mode.
  18194. It accepts the following values:
  18195. @table @samp
  18196. @item combined
  18197. all channels are displayed in the same row
  18198. @item separate
  18199. all channels are displayed in separate rows
  18200. @end table
  18201. Default value is @samp{combined}.
  18202. @item color
  18203. Specify display color mode.
  18204. It accepts the following values:
  18205. @table @samp
  18206. @item channel
  18207. each channel is displayed in a separate color
  18208. @item intensity
  18209. each channel is displayed using the same color scheme
  18210. @item rainbow
  18211. each channel is displayed using the rainbow color scheme
  18212. @item moreland
  18213. each channel is displayed using the moreland color scheme
  18214. @item nebulae
  18215. each channel is displayed using the nebulae color scheme
  18216. @item fire
  18217. each channel is displayed using the fire color scheme
  18218. @item fiery
  18219. each channel is displayed using the fiery color scheme
  18220. @item fruit
  18221. each channel is displayed using the fruit color scheme
  18222. @item cool
  18223. each channel is displayed using the cool color scheme
  18224. @item magma
  18225. each channel is displayed using the magma color scheme
  18226. @item green
  18227. each channel is displayed using the green color scheme
  18228. @item viridis
  18229. each channel is displayed using the viridis color scheme
  18230. @item plasma
  18231. each channel is displayed using the plasma color scheme
  18232. @item cividis
  18233. each channel is displayed using the cividis color scheme
  18234. @item terrain
  18235. each channel is displayed using the terrain color scheme
  18236. @end table
  18237. Default value is @samp{intensity}.
  18238. @item scale
  18239. Specify scale used for calculating intensity color values.
  18240. It accepts the following values:
  18241. @table @samp
  18242. @item lin
  18243. linear
  18244. @item sqrt
  18245. square root, default
  18246. @item cbrt
  18247. cubic root
  18248. @item log
  18249. logarithmic
  18250. @item 4thrt
  18251. 4th root
  18252. @item 5thrt
  18253. 5th root
  18254. @end table
  18255. Default value is @samp{log}.
  18256. @item fscale
  18257. Specify frequency scale.
  18258. It accepts the following values:
  18259. @table @samp
  18260. @item lin
  18261. linear
  18262. @item log
  18263. logarithmic
  18264. @end table
  18265. Default value is @samp{lin}.
  18266. @item saturation
  18267. Set saturation modifier for displayed colors. Negative values provide
  18268. alternative color scheme. @code{0} is no saturation at all.
  18269. Saturation must be in [-10.0, 10.0] range.
  18270. Default value is @code{1}.
  18271. @item win_func
  18272. Set window function.
  18273. It accepts the following values:
  18274. @table @samp
  18275. @item rect
  18276. @item bartlett
  18277. @item hann
  18278. @item hanning
  18279. @item hamming
  18280. @item blackman
  18281. @item welch
  18282. @item flattop
  18283. @item bharris
  18284. @item bnuttall
  18285. @item bhann
  18286. @item sine
  18287. @item nuttall
  18288. @item lanczos
  18289. @item gauss
  18290. @item tukey
  18291. @item dolph
  18292. @item cauchy
  18293. @item parzen
  18294. @item poisson
  18295. @item bohman
  18296. @end table
  18297. Default value is @code{hann}.
  18298. @item orientation
  18299. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18300. @code{horizontal}. Default is @code{vertical}.
  18301. @item gain
  18302. Set scale gain for calculating intensity color values.
  18303. Default value is @code{1}.
  18304. @item legend
  18305. Draw time and frequency axes and legends. Default is enabled.
  18306. @item rotation
  18307. Set color rotation, must be in [-1.0, 1.0] range.
  18308. Default value is @code{0}.
  18309. @item start
  18310. Set start frequency from which to display spectrogram. Default is @code{0}.
  18311. @item stop
  18312. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18313. @end table
  18314. @subsection Examples
  18315. @itemize
  18316. @item
  18317. Extract an audio spectrogram of a whole audio track
  18318. in a 1024x1024 picture using @command{ffmpeg}:
  18319. @example
  18320. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18321. @end example
  18322. @end itemize
  18323. @section showvolume
  18324. Convert input audio volume to a video output.
  18325. The filter accepts the following options:
  18326. @table @option
  18327. @item rate, r
  18328. Set video rate.
  18329. @item b
  18330. Set border width, allowed range is [0, 5]. Default is 1.
  18331. @item w
  18332. Set channel width, allowed range is [80, 8192]. Default is 400.
  18333. @item h
  18334. Set channel height, allowed range is [1, 900]. Default is 20.
  18335. @item f
  18336. Set fade, allowed range is [0, 1]. Default is 0.95.
  18337. @item c
  18338. Set volume color expression.
  18339. The expression can use the following variables:
  18340. @table @option
  18341. @item VOLUME
  18342. Current max volume of channel in dB.
  18343. @item PEAK
  18344. Current peak.
  18345. @item CHANNEL
  18346. Current channel number, starting from 0.
  18347. @end table
  18348. @item t
  18349. If set, displays channel names. Default is enabled.
  18350. @item v
  18351. If set, displays volume values. Default is enabled.
  18352. @item o
  18353. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18354. default is @code{h}.
  18355. @item s
  18356. Set step size, allowed range is [0, 5]. Default is 0, which means
  18357. step is disabled.
  18358. @item p
  18359. Set background opacity, allowed range is [0, 1]. Default is 0.
  18360. @item m
  18361. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18362. default is @code{p}.
  18363. @item ds
  18364. Set display scale, can be linear: @code{lin} or log: @code{log},
  18365. default is @code{lin}.
  18366. @item dm
  18367. In second.
  18368. If set to > 0., display a line for the max level
  18369. in the previous seconds.
  18370. default is disabled: @code{0.}
  18371. @item dmc
  18372. The color of the max line. Use when @code{dm} option is set to > 0.
  18373. default is: @code{orange}
  18374. @end table
  18375. @section showwaves
  18376. Convert input audio to a video output, representing the samples waves.
  18377. The filter accepts the following options:
  18378. @table @option
  18379. @item size, s
  18380. Specify the video size for the output. For the syntax of this option, check the
  18381. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18382. Default value is @code{600x240}.
  18383. @item mode
  18384. Set display mode.
  18385. Available values are:
  18386. @table @samp
  18387. @item point
  18388. Draw a point for each sample.
  18389. @item line
  18390. Draw a vertical line for each sample.
  18391. @item p2p
  18392. Draw a point for each sample and a line between them.
  18393. @item cline
  18394. Draw a centered vertical line for each sample.
  18395. @end table
  18396. Default value is @code{point}.
  18397. @item n
  18398. Set the number of samples which are printed on the same column. A
  18399. larger value will decrease the frame rate. Must be a positive
  18400. integer. This option can be set only if the value for @var{rate}
  18401. is not explicitly specified.
  18402. @item rate, r
  18403. Set the (approximate) output frame rate. This is done by setting the
  18404. option @var{n}. Default value is "25".
  18405. @item split_channels
  18406. Set if channels should be drawn separately or overlap. Default value is 0.
  18407. @item colors
  18408. Set colors separated by '|' which are going to be used for drawing of each channel.
  18409. @item scale
  18410. Set amplitude scale.
  18411. Available values are:
  18412. @table @samp
  18413. @item lin
  18414. Linear.
  18415. @item log
  18416. Logarithmic.
  18417. @item sqrt
  18418. Square root.
  18419. @item cbrt
  18420. Cubic root.
  18421. @end table
  18422. Default is linear.
  18423. @item draw
  18424. Set the draw mode. This is mostly useful to set for high @var{n}.
  18425. Available values are:
  18426. @table @samp
  18427. @item scale
  18428. Scale pixel values for each drawn sample.
  18429. @item full
  18430. Draw every sample directly.
  18431. @end table
  18432. Default value is @code{scale}.
  18433. @end table
  18434. @subsection Examples
  18435. @itemize
  18436. @item
  18437. Output the input file audio and the corresponding video representation
  18438. at the same time:
  18439. @example
  18440. amovie=a.mp3,asplit[out0],showwaves[out1]
  18441. @end example
  18442. @item
  18443. Create a synthetic signal and show it with showwaves, forcing a
  18444. frame rate of 30 frames per second:
  18445. @example
  18446. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18447. @end example
  18448. @end itemize
  18449. @section showwavespic
  18450. Convert input audio to a single video frame, representing the samples waves.
  18451. The filter accepts the following options:
  18452. @table @option
  18453. @item size, s
  18454. Specify the video size for the output. For the syntax of this option, check the
  18455. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18456. Default value is @code{600x240}.
  18457. @item split_channels
  18458. Set if channels should be drawn separately or overlap. Default value is 0.
  18459. @item colors
  18460. Set colors separated by '|' which are going to be used for drawing of each channel.
  18461. @item scale
  18462. Set amplitude scale.
  18463. Available values are:
  18464. @table @samp
  18465. @item lin
  18466. Linear.
  18467. @item log
  18468. Logarithmic.
  18469. @item sqrt
  18470. Square root.
  18471. @item cbrt
  18472. Cubic root.
  18473. @end table
  18474. Default is linear.
  18475. @item draw
  18476. Set the draw mode.
  18477. Available values are:
  18478. @table @samp
  18479. @item scale
  18480. Scale pixel values for each drawn sample.
  18481. @item full
  18482. Draw every sample directly.
  18483. @end table
  18484. Default value is @code{scale}.
  18485. @end table
  18486. @subsection Examples
  18487. @itemize
  18488. @item
  18489. Extract a channel split representation of the wave form of a whole audio track
  18490. in a 1024x800 picture using @command{ffmpeg}:
  18491. @example
  18492. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18493. @end example
  18494. @end itemize
  18495. @section sidedata, asidedata
  18496. Delete frame side data, or select frames based on it.
  18497. This filter accepts the following options:
  18498. @table @option
  18499. @item mode
  18500. Set mode of operation of the filter.
  18501. Can be one of the following:
  18502. @table @samp
  18503. @item select
  18504. Select every frame with side data of @code{type}.
  18505. @item delete
  18506. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18507. data in the frame.
  18508. @end table
  18509. @item type
  18510. Set side data type used with all modes. Must be set for @code{select} mode. For
  18511. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18512. in @file{libavutil/frame.h}. For example, to choose
  18513. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18514. @end table
  18515. @section spectrumsynth
  18516. Synthesize audio from 2 input video spectrums, first input stream represents
  18517. magnitude across time and second represents phase across time.
  18518. The filter will transform from frequency domain as displayed in videos back
  18519. to time domain as presented in audio output.
  18520. This filter is primarily created for reversing processed @ref{showspectrum}
  18521. filter outputs, but can synthesize sound from other spectrograms too.
  18522. But in such case results are going to be poor if the phase data is not
  18523. available, because in such cases phase data need to be recreated, usually
  18524. it's just recreated from random noise.
  18525. For best results use gray only output (@code{channel} color mode in
  18526. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18527. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18528. @code{data} option. Inputs videos should generally use @code{fullframe}
  18529. slide mode as that saves resources needed for decoding video.
  18530. The filter accepts the following options:
  18531. @table @option
  18532. @item sample_rate
  18533. Specify sample rate of output audio, the sample rate of audio from which
  18534. spectrum was generated may differ.
  18535. @item channels
  18536. Set number of channels represented in input video spectrums.
  18537. @item scale
  18538. Set scale which was used when generating magnitude input spectrum.
  18539. Can be @code{lin} or @code{log}. Default is @code{log}.
  18540. @item slide
  18541. Set slide which was used when generating inputs spectrums.
  18542. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18543. Default is @code{fullframe}.
  18544. @item win_func
  18545. Set window function used for resynthesis.
  18546. @item overlap
  18547. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18548. which means optimal overlap for selected window function will be picked.
  18549. @item orientation
  18550. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18551. Default is @code{vertical}.
  18552. @end table
  18553. @subsection Examples
  18554. @itemize
  18555. @item
  18556. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18557. then resynthesize videos back to audio with spectrumsynth:
  18558. @example
  18559. 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
  18560. 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
  18561. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18562. @end example
  18563. @end itemize
  18564. @section split, asplit
  18565. Split input into several identical outputs.
  18566. @code{asplit} works with audio input, @code{split} with video.
  18567. The filter accepts a single parameter which specifies the number of outputs. If
  18568. unspecified, it defaults to 2.
  18569. @subsection Examples
  18570. @itemize
  18571. @item
  18572. Create two separate outputs from the same input:
  18573. @example
  18574. [in] split [out0][out1]
  18575. @end example
  18576. @item
  18577. To create 3 or more outputs, you need to specify the number of
  18578. outputs, like in:
  18579. @example
  18580. [in] asplit=3 [out0][out1][out2]
  18581. @end example
  18582. @item
  18583. Create two separate outputs from the same input, one cropped and
  18584. one padded:
  18585. @example
  18586. [in] split [splitout1][splitout2];
  18587. [splitout1] crop=100:100:0:0 [cropout];
  18588. [splitout2] pad=200:200:100:100 [padout];
  18589. @end example
  18590. @item
  18591. Create 5 copies of the input audio with @command{ffmpeg}:
  18592. @example
  18593. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18594. @end example
  18595. @end itemize
  18596. @section zmq, azmq
  18597. Receive commands sent through a libzmq client, and forward them to
  18598. filters in the filtergraph.
  18599. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18600. must be inserted between two video filters, @code{azmq} between two
  18601. audio filters. Both are capable to send messages to any filter type.
  18602. To enable these filters you need to install the libzmq library and
  18603. headers and configure FFmpeg with @code{--enable-libzmq}.
  18604. For more information about libzmq see:
  18605. @url{http://www.zeromq.org/}
  18606. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18607. receives messages sent through a network interface defined by the
  18608. @option{bind_address} (or the abbreviation "@option{b}") option.
  18609. Default value of this option is @file{tcp://localhost:5555}. You may
  18610. want to alter this value to your needs, but do not forget to escape any
  18611. ':' signs (see @ref{filtergraph escaping}).
  18612. The received message must be in the form:
  18613. @example
  18614. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18615. @end example
  18616. @var{TARGET} specifies the target of the command, usually the name of
  18617. the filter class or a specific filter instance name. The default
  18618. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18619. but you can override this by using the @samp{filter_name@@id} syntax
  18620. (see @ref{Filtergraph syntax}).
  18621. @var{COMMAND} specifies the name of the command for the target filter.
  18622. @var{ARG} is optional and specifies the optional argument list for the
  18623. given @var{COMMAND}.
  18624. Upon reception, the message is processed and the corresponding command
  18625. is injected into the filtergraph. Depending on the result, the filter
  18626. will send a reply to the client, adopting the format:
  18627. @example
  18628. @var{ERROR_CODE} @var{ERROR_REASON}
  18629. @var{MESSAGE}
  18630. @end example
  18631. @var{MESSAGE} is optional.
  18632. @subsection Examples
  18633. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18634. be used to send commands processed by these filters.
  18635. Consider the following filtergraph generated by @command{ffplay}.
  18636. In this example the last overlay filter has an instance name. All other
  18637. filters will have default instance names.
  18638. @example
  18639. ffplay -dumpgraph 1 -f lavfi "
  18640. color=s=100x100:c=red [l];
  18641. color=s=100x100:c=blue [r];
  18642. nullsrc=s=200x100, zmq [bg];
  18643. [bg][l] overlay [bg+l];
  18644. [bg+l][r] overlay@@my=x=100 "
  18645. @end example
  18646. To change the color of the left side of the video, the following
  18647. command can be used:
  18648. @example
  18649. echo Parsed_color_0 c yellow | tools/zmqsend
  18650. @end example
  18651. To change the right side:
  18652. @example
  18653. echo Parsed_color_1 c pink | tools/zmqsend
  18654. @end example
  18655. To change the position of the right side:
  18656. @example
  18657. echo overlay@@my x 150 | tools/zmqsend
  18658. @end example
  18659. @c man end MULTIMEDIA FILTERS
  18660. @chapter Multimedia Sources
  18661. @c man begin MULTIMEDIA SOURCES
  18662. Below is a description of the currently available multimedia sources.
  18663. @section amovie
  18664. This is the same as @ref{movie} source, except it selects an audio
  18665. stream by default.
  18666. @anchor{movie}
  18667. @section movie
  18668. Read audio and/or video stream(s) from a movie container.
  18669. It accepts the following parameters:
  18670. @table @option
  18671. @item filename
  18672. The name of the resource to read (not necessarily a file; it can also be a
  18673. device or a stream accessed through some protocol).
  18674. @item format_name, f
  18675. Specifies the format assumed for the movie to read, and can be either
  18676. the name of a container or an input device. If not specified, the
  18677. format is guessed from @var{movie_name} or by probing.
  18678. @item seek_point, sp
  18679. Specifies the seek point in seconds. The frames will be output
  18680. starting from this seek point. The parameter is evaluated with
  18681. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18682. postfix. The default value is "0".
  18683. @item streams, s
  18684. Specifies the streams to read. Several streams can be specified,
  18685. separated by "+". The source will then have as many outputs, in the
  18686. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18687. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18688. respectively the default (best suited) video and audio stream. Default
  18689. is "dv", or "da" if the filter is called as "amovie".
  18690. @item stream_index, si
  18691. Specifies the index of the video stream to read. If the value is -1,
  18692. the most suitable video stream will be automatically selected. The default
  18693. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18694. audio instead of video.
  18695. @item loop
  18696. Specifies how many times to read the stream in sequence.
  18697. If the value is 0, the stream will be looped infinitely.
  18698. Default value is "1".
  18699. Note that when the movie is looped the source timestamps are not
  18700. changed, so it will generate non monotonically increasing timestamps.
  18701. @item discontinuity
  18702. Specifies the time difference between frames above which the point is
  18703. considered a timestamp discontinuity which is removed by adjusting the later
  18704. timestamps.
  18705. @end table
  18706. It allows overlaying a second video on top of the main input of
  18707. a filtergraph, as shown in this graph:
  18708. @example
  18709. input -----------> deltapts0 --> overlay --> output
  18710. ^
  18711. |
  18712. movie --> scale--> deltapts1 -------+
  18713. @end example
  18714. @subsection Examples
  18715. @itemize
  18716. @item
  18717. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18718. on top of the input labelled "in":
  18719. @example
  18720. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18721. [in] setpts=PTS-STARTPTS [main];
  18722. [main][over] overlay=16:16 [out]
  18723. @end example
  18724. @item
  18725. Read from a video4linux2 device, and overlay it on top of the input
  18726. labelled "in":
  18727. @example
  18728. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18729. [in] setpts=PTS-STARTPTS [main];
  18730. [main][over] overlay=16:16 [out]
  18731. @end example
  18732. @item
  18733. Read the first video stream and the audio stream with id 0x81 from
  18734. dvd.vob; the video is connected to the pad named "video" and the audio is
  18735. connected to the pad named "audio":
  18736. @example
  18737. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18738. @end example
  18739. @end itemize
  18740. @subsection Commands
  18741. Both movie and amovie support the following commands:
  18742. @table @option
  18743. @item seek
  18744. Perform seek using "av_seek_frame".
  18745. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18746. @itemize
  18747. @item
  18748. @var{stream_index}: If stream_index is -1, a default
  18749. stream is selected, and @var{timestamp} is automatically converted
  18750. from AV_TIME_BASE units to the stream specific time_base.
  18751. @item
  18752. @var{timestamp}: Timestamp in AVStream.time_base units
  18753. or, if no stream is specified, in AV_TIME_BASE units.
  18754. @item
  18755. @var{flags}: Flags which select direction and seeking mode.
  18756. @end itemize
  18757. @item get_duration
  18758. Get movie duration in AV_TIME_BASE units.
  18759. @end table
  18760. @c man end MULTIMEDIA SOURCES