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.

27331 lines
723KB

  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. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @subsection Commands
  505. This filter supports the all above options as @ref{commands}.
  506. @section acue
  507. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  508. filter.
  509. @section adeclick
  510. Remove impulsive noise from input audio.
  511. Samples detected as impulsive noise are replaced by interpolated samples using
  512. autoregressive modelling.
  513. @table @option
  514. @item window, w
  515. Set window size, in milliseconds. Allowed range is from @code{10} to
  516. @code{100}. Default value is @code{55} milliseconds.
  517. This sets size of window which will be processed at once.
  518. @item overlap, o
  519. Set window overlap, in percentage of window size. Allowed range is from
  520. @code{50} to @code{95}. Default value is @code{75} percent.
  521. Setting this to a very high value increases impulsive noise removal but makes
  522. whole process much slower.
  523. @item arorder, a
  524. Set autoregression order, in percentage of window size. Allowed range is from
  525. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  526. controls quality of interpolated samples using neighbour good samples.
  527. @item threshold, t
  528. Set threshold value. Allowed range is from @code{1} to @code{100}.
  529. Default value is @code{2}.
  530. This controls the strength of impulsive noise which is going to be removed.
  531. The lower value, the more samples will be detected as impulsive noise.
  532. @item burst, b
  533. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  534. @code{10}. Default value is @code{2}.
  535. If any two samples detected as noise are spaced less than this value then any
  536. sample between those two samples will be also detected as noise.
  537. @item method, m
  538. Set overlap method.
  539. It accepts the following values:
  540. @table @option
  541. @item add, a
  542. Select overlap-add method. Even not interpolated samples are slightly
  543. changed with this method.
  544. @item save, s
  545. Select overlap-save method. Not interpolated samples remain unchanged.
  546. @end table
  547. Default value is @code{a}.
  548. @end table
  549. @section adeclip
  550. Remove clipped samples from input audio.
  551. Samples detected as clipped are replaced by interpolated samples using
  552. autoregressive modelling.
  553. @table @option
  554. @item window, w
  555. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  556. Default value is @code{55} milliseconds.
  557. This sets size of window which will be processed at once.
  558. @item overlap, o
  559. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  560. to @code{95}. Default value is @code{75} percent.
  561. @item arorder, a
  562. Set autoregression order, in percentage of window size. Allowed range is from
  563. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  564. quality of interpolated samples using neighbour good samples.
  565. @item threshold, t
  566. Set threshold value. Allowed range is from @code{1} to @code{100}.
  567. Default value is @code{10}. Higher values make clip detection less aggressive.
  568. @item hsize, n
  569. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  570. Default value is @code{1000}. Higher values make clip detection less aggressive.
  571. @item method, m
  572. Set overlap method.
  573. It accepts the following values:
  574. @table @option
  575. @item add, a
  576. Select overlap-add method. Even not interpolated samples are slightly changed
  577. with this method.
  578. @item save, s
  579. Select overlap-save method. Not interpolated samples remain unchanged.
  580. @end table
  581. Default value is @code{a}.
  582. @end table
  583. @section adelay
  584. Delay one or more audio channels.
  585. Samples in delayed channel are filled with silence.
  586. The filter accepts the following option:
  587. @table @option
  588. @item delays
  589. Set list of delays in milliseconds for each channel separated by '|'.
  590. Unused delays will be silently ignored. If number of given delays is
  591. smaller than number of channels all remaining channels will not be delayed.
  592. If you want to delay exact number of samples, append 'S' to number.
  593. If you want instead to delay in seconds, append 's' to number.
  594. @item all
  595. Use last set delay for all remaining channels. By default is disabled.
  596. This option if enabled changes how option @code{delays} is interpreted.
  597. @end table
  598. @subsection Examples
  599. @itemize
  600. @item
  601. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  602. the second channel (and any other channels that may be present) unchanged.
  603. @example
  604. adelay=1500|0|500
  605. @end example
  606. @item
  607. Delay second channel by 500 samples, the third channel by 700 samples and leave
  608. the first channel (and any other channels that may be present) unchanged.
  609. @example
  610. adelay=0|500S|700S
  611. @end example
  612. @item
  613. Delay all channels by same number of samples:
  614. @example
  615. adelay=delays=64S:all=1
  616. @end example
  617. @end itemize
  618. @section adenorm
  619. Remedy denormals in audio by adding extremely low-level noise.
  620. This filter shall be placed before any filter that can produce denormals.
  621. A description of the accepted parameters follows.
  622. @table @option
  623. @item level
  624. Set level of added noise in dB. Default is @code{-351}.
  625. Allowed range is from -451 to -90.
  626. @item type
  627. Set type of added noise.
  628. @table @option
  629. @item dc
  630. Add DC signal.
  631. @item ac
  632. Add AC signal.
  633. @item square
  634. Add square signal.
  635. @item pulse
  636. Add pulse signal.
  637. @end table
  638. Default is @code{dc}.
  639. @end table
  640. @subsection Commands
  641. This filter supports the all above options as @ref{commands}.
  642. @section aderivative, aintegral
  643. Compute derivative/integral of audio stream.
  644. Applying both filters one after another produces original audio.
  645. @section aecho
  646. Apply echoing to the input audio.
  647. Echoes are reflected sound and can occur naturally amongst mountains
  648. (and sometimes large buildings) when talking or shouting; digital echo
  649. effects emulate this behaviour and are often used to help fill out the
  650. sound of a single instrument or vocal. The time difference between the
  651. original signal and the reflection is the @code{delay}, and the
  652. loudness of the reflected signal is the @code{decay}.
  653. Multiple echoes can have different delays and decays.
  654. A description of the accepted parameters follows.
  655. @table @option
  656. @item in_gain
  657. Set input gain of reflected signal. Default is @code{0.6}.
  658. @item out_gain
  659. Set output gain of reflected signal. Default is @code{0.3}.
  660. @item delays
  661. Set list of time intervals in milliseconds between original signal and reflections
  662. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  663. Default is @code{1000}.
  664. @item decays
  665. Set list of loudness of reflected signals separated by '|'.
  666. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  667. Default is @code{0.5}.
  668. @end table
  669. @subsection Examples
  670. @itemize
  671. @item
  672. Make it sound as if there are twice as many instruments as are actually playing:
  673. @example
  674. aecho=0.8:0.88:60:0.4
  675. @end example
  676. @item
  677. If delay is very short, then it sounds like a (metallic) robot playing music:
  678. @example
  679. aecho=0.8:0.88:6:0.4
  680. @end example
  681. @item
  682. A longer delay will sound like an open air concert in the mountains:
  683. @example
  684. aecho=0.8:0.9:1000:0.3
  685. @end example
  686. @item
  687. Same as above but with one more mountain:
  688. @example
  689. aecho=0.8:0.9:1000|1800:0.3|0.25
  690. @end example
  691. @end itemize
  692. @section aemphasis
  693. Audio emphasis filter creates or restores material directly taken from LPs or
  694. emphased CDs with different filter curves. E.g. to store music on vinyl the
  695. signal has to be altered by a filter first to even out the disadvantages of
  696. this recording medium.
  697. Once the material is played back the inverse filter has to be applied to
  698. restore the distortion of the frequency response.
  699. The filter accepts the following options:
  700. @table @option
  701. @item level_in
  702. Set input gain.
  703. @item level_out
  704. Set output gain.
  705. @item mode
  706. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  707. use @code{production} mode. Default is @code{reproduction} mode.
  708. @item type
  709. Set filter type. Selects medium. Can be one of the following:
  710. @table @option
  711. @item col
  712. select Columbia.
  713. @item emi
  714. select EMI.
  715. @item bsi
  716. select BSI (78RPM).
  717. @item riaa
  718. select RIAA.
  719. @item cd
  720. select Compact Disc (CD).
  721. @item 50fm
  722. select 50µs (FM).
  723. @item 75fm
  724. select 75µs (FM).
  725. @item 50kf
  726. select 50µs (FM-KF).
  727. @item 75kf
  728. select 75µs (FM-KF).
  729. @end table
  730. @end table
  731. @subsection Commands
  732. This filter supports the all above options as @ref{commands}.
  733. @section aeval
  734. Modify an audio signal according to the specified expressions.
  735. This filter accepts one or more expressions (one for each channel),
  736. which are evaluated and used to modify a corresponding audio signal.
  737. It accepts the following parameters:
  738. @table @option
  739. @item exprs
  740. Set the '|'-separated expressions list for each separate channel. If
  741. the number of input channels is greater than the number of
  742. expressions, the last specified expression is used for the remaining
  743. output channels.
  744. @item channel_layout, c
  745. Set output channel layout. If not specified, the channel layout is
  746. specified by the number of expressions. If set to @samp{same}, it will
  747. use by default the same input channel layout.
  748. @end table
  749. Each expression in @var{exprs} can contain the following constants and functions:
  750. @table @option
  751. @item ch
  752. channel number of the current expression
  753. @item n
  754. number of the evaluated sample, starting from 0
  755. @item s
  756. sample rate
  757. @item t
  758. time of the evaluated sample expressed in seconds
  759. @item nb_in_channels
  760. @item nb_out_channels
  761. input and output number of channels
  762. @item val(CH)
  763. the value of input channel with number @var{CH}
  764. @end table
  765. Note: this filter is slow. For faster processing you should use a
  766. dedicated filter.
  767. @subsection Examples
  768. @itemize
  769. @item
  770. Half volume:
  771. @example
  772. aeval=val(ch)/2:c=same
  773. @end example
  774. @item
  775. Invert phase of the second channel:
  776. @example
  777. aeval=val(0)|-val(1)
  778. @end example
  779. @end itemize
  780. @section aexciter
  781. An exciter is used to produce high sound that is not present in the
  782. original signal. This is done by creating harmonic distortions of the
  783. signal which are restricted in range and added to the original signal.
  784. An Exciter raises the upper end of an audio signal without simply raising
  785. the higher frequencies like an equalizer would do to create a more
  786. "crisp" or "brilliant" sound.
  787. The filter accepts the following options:
  788. @table @option
  789. @item level_in
  790. Set input level prior processing of signal.
  791. Allowed range is from 0 to 64.
  792. Default value is 1.
  793. @item level_out
  794. Set output level after processing of signal.
  795. Allowed range is from 0 to 64.
  796. Default value is 1.
  797. @item amount
  798. Set the amount of harmonics added to original signal.
  799. Allowed range is from 0 to 64.
  800. Default value is 1.
  801. @item drive
  802. Set the amount of newly created harmonics.
  803. Allowed range is from 0.1 to 10.
  804. Default value is 8.5.
  805. @item blend
  806. Set the octave of newly created harmonics.
  807. Allowed range is from -10 to 10.
  808. Default value is 0.
  809. @item freq
  810. Set the lower frequency limit of producing harmonics in Hz.
  811. Allowed range is from 2000 to 12000 Hz.
  812. Default is 7500 Hz.
  813. @item ceil
  814. Set the upper frequency limit of producing harmonics.
  815. Allowed range is from 9999 to 20000 Hz.
  816. If value is lower than 10000 Hz no limit is applied.
  817. @item listen
  818. Mute the original signal and output only added harmonics.
  819. By default is disabled.
  820. @end table
  821. @subsection Commands
  822. This filter supports the all above options as @ref{commands}.
  823. @anchor{afade}
  824. @section afade
  825. Apply fade-in/out effect to input audio.
  826. A description of the accepted parameters follows.
  827. @table @option
  828. @item type, t
  829. Specify the effect type, can be either @code{in} for fade-in, or
  830. @code{out} for a fade-out effect. Default is @code{in}.
  831. @item start_sample, ss
  832. Specify the number of the start sample for starting to apply the fade
  833. effect. Default is 0.
  834. @item nb_samples, ns
  835. Specify the number of samples for which the fade effect has to last. At
  836. the end of the fade-in effect the output audio will have the same
  837. volume as the input audio, at the end of the fade-out transition
  838. the output audio will be silence. Default is 44100.
  839. @item start_time, st
  840. Specify the start time of the fade effect. Default is 0.
  841. The value must be specified as a time duration; see
  842. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  843. for the accepted syntax.
  844. If set this option is used instead of @var{start_sample}.
  845. @item duration, d
  846. Specify the duration of the fade effect. See
  847. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  848. for the accepted syntax.
  849. At the end of the fade-in effect the output audio will have the same
  850. volume as the input audio, at the end of the fade-out transition
  851. the output audio will be silence.
  852. By default the duration is determined by @var{nb_samples}.
  853. If set this option is used instead of @var{nb_samples}.
  854. @item curve
  855. Set curve for fade transition.
  856. It accepts the following values:
  857. @table @option
  858. @item tri
  859. select triangular, linear slope (default)
  860. @item qsin
  861. select quarter of sine wave
  862. @item hsin
  863. select half of sine wave
  864. @item esin
  865. select exponential sine wave
  866. @item log
  867. select logarithmic
  868. @item ipar
  869. select inverted parabola
  870. @item qua
  871. select quadratic
  872. @item cub
  873. select cubic
  874. @item squ
  875. select square root
  876. @item cbr
  877. select cubic root
  878. @item par
  879. select parabola
  880. @item exp
  881. select exponential
  882. @item iqsin
  883. select inverted quarter of sine wave
  884. @item ihsin
  885. select inverted half of sine wave
  886. @item dese
  887. select double-exponential seat
  888. @item desi
  889. select double-exponential sigmoid
  890. @item losi
  891. select logistic sigmoid
  892. @item sinc
  893. select sine cardinal function
  894. @item isinc
  895. select inverted sine cardinal function
  896. @item nofade
  897. no fade applied
  898. @end table
  899. @end table
  900. @subsection Commands
  901. This filter supports the all above options as @ref{commands}.
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Fade in first 15 seconds of audio:
  906. @example
  907. afade=t=in:ss=0:d=15
  908. @end example
  909. @item
  910. Fade out last 25 seconds of a 900 seconds audio:
  911. @example
  912. afade=t=out:st=875:d=25
  913. @end example
  914. @end itemize
  915. @section afftdn
  916. Denoise audio samples with FFT.
  917. A description of the accepted parameters follows.
  918. @table @option
  919. @item nr
  920. Set the noise reduction in dB, allowed range is 0.01 to 97.
  921. Default value is 12 dB.
  922. @item nf
  923. Set the noise floor in dB, allowed range is -80 to -20.
  924. Default value is -50 dB.
  925. @item nt
  926. Set the noise type.
  927. It accepts the following values:
  928. @table @option
  929. @item w
  930. Select white noise.
  931. @item v
  932. Select vinyl noise.
  933. @item s
  934. Select shellac noise.
  935. @item c
  936. Select custom noise, defined in @code{bn} option.
  937. Default value is white noise.
  938. @end table
  939. @item bn
  940. Set custom band noise for every one of 15 bands.
  941. Bands are separated by ' ' or '|'.
  942. @item rf
  943. Set the residual floor in dB, allowed range is -80 to -20.
  944. Default value is -38 dB.
  945. @item tn
  946. Enable noise tracking. By default is disabled.
  947. With this enabled, noise floor is automatically adjusted.
  948. @item tr
  949. Enable residual tracking. By default is disabled.
  950. @item om
  951. Set the output mode.
  952. It accepts the following values:
  953. @table @option
  954. @item i
  955. Pass input unchanged.
  956. @item o
  957. Pass noise filtered out.
  958. @item n
  959. Pass only noise.
  960. Default value is @var{o}.
  961. @end table
  962. @end table
  963. @subsection Commands
  964. This filter supports the following commands:
  965. @table @option
  966. @item sample_noise, sn
  967. Start or stop measuring noise profile.
  968. Syntax for the command is : "start" or "stop" string.
  969. After measuring noise profile is stopped it will be
  970. automatically applied in filtering.
  971. @item noise_reduction, nr
  972. Change noise reduction. Argument is single float number.
  973. Syntax for the command is : "@var{noise_reduction}"
  974. @item noise_floor, nf
  975. Change noise floor. Argument is single float number.
  976. Syntax for the command is : "@var{noise_floor}"
  977. @item output_mode, om
  978. Change output mode operation.
  979. Syntax for the command is : "i", "o" or "n" string.
  980. @end table
  981. @section afftfilt
  982. Apply arbitrary expressions to samples in frequency domain.
  983. @table @option
  984. @item real
  985. Set frequency domain real expression for each separate channel separated
  986. by '|'. Default is "re".
  987. If the number of input channels is greater than the number of
  988. expressions, the last specified expression is used for the remaining
  989. output channels.
  990. @item imag
  991. Set frequency domain imaginary expression for each separate channel
  992. separated by '|'. Default is "im".
  993. Each expression in @var{real} and @var{imag} can contain the following
  994. constants and functions:
  995. @table @option
  996. @item sr
  997. sample rate
  998. @item b
  999. current frequency bin number
  1000. @item nb
  1001. number of available bins
  1002. @item ch
  1003. channel number of the current expression
  1004. @item chs
  1005. number of channels
  1006. @item pts
  1007. current frame pts
  1008. @item re
  1009. current real part of frequency bin of current channel
  1010. @item im
  1011. current imaginary part of frequency bin of current channel
  1012. @item real(b, ch)
  1013. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1014. @item imag(b, ch)
  1015. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1016. @end table
  1017. @item win_size
  1018. Set window size. Allowed range is from 16 to 131072.
  1019. Default is @code{4096}
  1020. @item win_func
  1021. Set window function. Default is @code{hann}.
  1022. @item overlap
  1023. Set window overlap. If set to 1, the recommended overlap for selected
  1024. window function will be picked. Default is @code{0.75}.
  1025. @end table
  1026. @subsection Examples
  1027. @itemize
  1028. @item
  1029. Leave almost only low frequencies in audio:
  1030. @example
  1031. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1032. @end example
  1033. @item
  1034. Apply robotize effect:
  1035. @example
  1036. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1037. @end example
  1038. @item
  1039. Apply whisper effect:
  1040. @example
  1041. 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"
  1042. @end example
  1043. @end itemize
  1044. @anchor{afir}
  1045. @section afir
  1046. Apply an arbitrary Finite Impulse Response filter.
  1047. This filter is designed for applying long FIR filters,
  1048. up to 60 seconds long.
  1049. It can be used as component for digital crossover filters,
  1050. room equalization, cross talk cancellation, wavefield synthesis,
  1051. auralization, ambiophonics, ambisonics and spatialization.
  1052. This filter uses the streams higher than first one as FIR coefficients.
  1053. If the non-first stream holds a single channel, it will be used
  1054. for all input channels in the first stream, otherwise
  1055. the number of channels in the non-first stream must be same as
  1056. the number of channels in the first stream.
  1057. It accepts the following parameters:
  1058. @table @option
  1059. @item dry
  1060. Set dry gain. This sets input gain.
  1061. @item wet
  1062. Set wet gain. This sets final output gain.
  1063. @item length
  1064. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1065. @item gtype
  1066. Enable applying gain measured from power of IR.
  1067. Set which approach to use for auto gain measurement.
  1068. @table @option
  1069. @item none
  1070. Do not apply any gain.
  1071. @item peak
  1072. select peak gain, very conservative approach. This is default value.
  1073. @item dc
  1074. select DC gain, limited application.
  1075. @item gn
  1076. select gain to noise approach, this is most popular one.
  1077. @end table
  1078. @item irgain
  1079. Set gain to be applied to IR coefficients before filtering.
  1080. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1081. @item irfmt
  1082. Set format of IR stream. Can be @code{mono} or @code{input}.
  1083. Default is @code{input}.
  1084. @item maxir
  1085. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1086. Allowed range is 0.1 to 60 seconds.
  1087. @item response
  1088. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1089. By default it is disabled.
  1090. @item channel
  1091. Set for which IR channel to display frequency response. By default is first channel
  1092. displayed. This option is used only when @var{response} is enabled.
  1093. @item size
  1094. Set video stream size. This option is used only when @var{response} is enabled.
  1095. @item rate
  1096. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1097. @item minp
  1098. Set minimal partition size used for convolution. Default is @var{8192}.
  1099. Allowed range is from @var{1} to @var{32768}.
  1100. Lower values decreases latency at cost of higher CPU usage.
  1101. @item maxp
  1102. Set maximal partition size used for convolution. Default is @var{8192}.
  1103. Allowed range is from @var{8} to @var{32768}.
  1104. Lower values may increase CPU usage.
  1105. @item nbirs
  1106. Set number of input impulse responses streams which will be switchable at runtime.
  1107. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1108. @item ir
  1109. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1110. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1111. This option can be changed at runtime via @ref{commands}.
  1112. @end table
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1117. @example
  1118. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1119. @end example
  1120. @end itemize
  1121. @anchor{aformat}
  1122. @section aformat
  1123. Set output format constraints for the input audio. The framework will
  1124. negotiate the most appropriate format to minimize conversions.
  1125. It accepts the following parameters:
  1126. @table @option
  1127. @item sample_fmts, f
  1128. A '|'-separated list of requested sample formats.
  1129. @item sample_rates, r
  1130. A '|'-separated list of requested sample rates.
  1131. @item channel_layouts, cl
  1132. A '|'-separated list of requested channel layouts.
  1133. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1134. for the required syntax.
  1135. @end table
  1136. If a parameter is omitted, all values are allowed.
  1137. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1138. @example
  1139. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1140. @end example
  1141. @section afreqshift
  1142. Apply frequency shift to input audio samples.
  1143. The filter accepts the following options:
  1144. @table @option
  1145. @item shift
  1146. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1147. Default value is 0.0.
  1148. @item level
  1149. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1150. Default value is 1.0.
  1151. @end table
  1152. @subsection Commands
  1153. This filter supports the all above options as @ref{commands}.
  1154. @section agate
  1155. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1156. processing reduces disturbing noise between useful signals.
  1157. Gating is done by detecting the volume below a chosen level @var{threshold}
  1158. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1159. floor is set via @var{range}. Because an exact manipulation of the signal
  1160. would cause distortion of the waveform the reduction can be levelled over
  1161. time. This is done by setting @var{attack} and @var{release}.
  1162. @var{attack} determines how long the signal has to fall below the threshold
  1163. before any reduction will occur and @var{release} sets the time the signal
  1164. has to rise above the threshold to reduce the reduction again.
  1165. Shorter signals than the chosen attack time will be left untouched.
  1166. @table @option
  1167. @item level_in
  1168. Set input level before filtering.
  1169. Default is 1. Allowed range is from 0.015625 to 64.
  1170. @item mode
  1171. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1172. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1173. will be amplified, expanding dynamic range in upward direction.
  1174. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1175. @item range
  1176. Set the level of gain reduction when the signal is below the threshold.
  1177. Default is 0.06125. Allowed range is from 0 to 1.
  1178. Setting this to 0 disables reduction and then filter behaves like expander.
  1179. @item threshold
  1180. If a signal rises above this level the gain reduction is released.
  1181. Default is 0.125. Allowed range is from 0 to 1.
  1182. @item ratio
  1183. Set a ratio by which the signal is reduced.
  1184. Default is 2. Allowed range is from 1 to 9000.
  1185. @item attack
  1186. Amount of milliseconds the signal has to rise above the threshold before gain
  1187. reduction stops.
  1188. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1189. @item release
  1190. Amount of milliseconds the signal has to fall below the threshold before the
  1191. reduction is increased again. Default is 250 milliseconds.
  1192. Allowed range is from 0.01 to 9000.
  1193. @item makeup
  1194. Set amount of amplification of signal after processing.
  1195. Default is 1. Allowed range is from 1 to 64.
  1196. @item knee
  1197. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1198. Default is 2.828427125. Allowed range is from 1 to 8.
  1199. @item detection
  1200. Choose if exact signal should be taken for detection or an RMS like one.
  1201. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1202. @item link
  1203. Choose if the average level between all channels or the louder channel affects
  1204. the reduction.
  1205. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1206. @end table
  1207. @subsection Commands
  1208. This filter supports the all above options as @ref{commands}.
  1209. @section aiir
  1210. Apply an arbitrary Infinite Impulse Response filter.
  1211. It accepts the following parameters:
  1212. @table @option
  1213. @item zeros, z
  1214. Set B/numerator/zeros/reflection coefficients.
  1215. @item poles, p
  1216. Set A/denominator/poles/ladder coefficients.
  1217. @item gains, k
  1218. Set channels gains.
  1219. @item dry_gain
  1220. Set input gain.
  1221. @item wet_gain
  1222. Set output gain.
  1223. @item format, f
  1224. Set coefficients format.
  1225. @table @samp
  1226. @item ll
  1227. lattice-ladder function
  1228. @item sf
  1229. analog transfer function
  1230. @item tf
  1231. digital transfer function
  1232. @item zp
  1233. Z-plane zeros/poles, cartesian (default)
  1234. @item pr
  1235. Z-plane zeros/poles, polar radians
  1236. @item pd
  1237. Z-plane zeros/poles, polar degrees
  1238. @item sp
  1239. S-plane zeros/poles
  1240. @end table
  1241. @item process, r
  1242. Set type of processing.
  1243. @table @samp
  1244. @item d
  1245. direct processing
  1246. @item s
  1247. serial processing
  1248. @item p
  1249. parallel processing
  1250. @end table
  1251. @item precision, e
  1252. Set filtering precision.
  1253. @table @samp
  1254. @item dbl
  1255. double-precision floating-point (default)
  1256. @item flt
  1257. single-precision floating-point
  1258. @item i32
  1259. 32-bit integers
  1260. @item i16
  1261. 16-bit integers
  1262. @end table
  1263. @item normalize, n
  1264. Normalize filter coefficients, by default is enabled.
  1265. Enabling it will normalize magnitude response at DC to 0dB.
  1266. @item mix
  1267. How much to use filtered signal in output. Default is 1.
  1268. Range is between 0 and 1.
  1269. @item response
  1270. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1271. By default it is disabled.
  1272. @item channel
  1273. Set for which IR channel to display frequency response. By default is first channel
  1274. displayed. This option is used only when @var{response} is enabled.
  1275. @item size
  1276. Set video stream size. This option is used only when @var{response} is enabled.
  1277. @end table
  1278. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1279. order.
  1280. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1281. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1282. imaginary unit.
  1283. Different coefficients and gains can be provided for every channel, in such case
  1284. use '|' to separate coefficients or gains. Last provided coefficients will be
  1285. used for all remaining channels.
  1286. @subsection Examples
  1287. @itemize
  1288. @item
  1289. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1290. @example
  1291. 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
  1292. @end example
  1293. @item
  1294. Same as above but in @code{zp} format:
  1295. @example
  1296. 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
  1297. @end example
  1298. @item
  1299. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1300. @example
  1301. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1302. @end example
  1303. @end itemize
  1304. @section alimiter
  1305. The limiter prevents an input signal from rising over a desired threshold.
  1306. This limiter uses lookahead technology to prevent your signal from distorting.
  1307. It means that there is a small delay after the signal is processed. Keep in mind
  1308. that the delay it produces is the attack time you set.
  1309. The filter accepts the following options:
  1310. @table @option
  1311. @item level_in
  1312. Set input gain. Default is 1.
  1313. @item level_out
  1314. Set output gain. Default is 1.
  1315. @item limit
  1316. Don't let signals above this level pass the limiter. Default is 1.
  1317. @item attack
  1318. The limiter will reach its attenuation level in this amount of time in
  1319. milliseconds. Default is 5 milliseconds.
  1320. @item release
  1321. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1322. Default is 50 milliseconds.
  1323. @item asc
  1324. When gain reduction is always needed ASC takes care of releasing to an
  1325. average reduction level rather than reaching a reduction of 0 in the release
  1326. time.
  1327. @item asc_level
  1328. Select how much the release time is affected by ASC, 0 means nearly no changes
  1329. in release time while 1 produces higher release times.
  1330. @item level
  1331. Auto level output signal. Default is enabled.
  1332. This normalizes audio back to 0dB if enabled.
  1333. @end table
  1334. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1335. with @ref{aresample} before applying this filter.
  1336. @section allpass
  1337. Apply a two-pole all-pass filter with central frequency (in Hz)
  1338. @var{frequency}, and filter-width @var{width}.
  1339. An all-pass filter changes the audio's frequency to phase relationship
  1340. without changing its frequency to amplitude relationship.
  1341. The filter accepts the following options:
  1342. @table @option
  1343. @item frequency, f
  1344. Set frequency in Hz.
  1345. @item width_type, t
  1346. Set method to specify band-width of filter.
  1347. @table @option
  1348. @item h
  1349. Hz
  1350. @item q
  1351. Q-Factor
  1352. @item o
  1353. octave
  1354. @item s
  1355. slope
  1356. @item k
  1357. kHz
  1358. @end table
  1359. @item width, w
  1360. Specify the band-width of a filter in width_type units.
  1361. @item mix, m
  1362. How much to use filtered signal in output. Default is 1.
  1363. Range is between 0 and 1.
  1364. @item channels, c
  1365. Specify which channels to filter, by default all available are filtered.
  1366. @item normalize, n
  1367. Normalize biquad coefficients, by default is disabled.
  1368. Enabling it will normalize magnitude response at DC to 0dB.
  1369. @item order, o
  1370. Set the filter order, can be 1 or 2. Default is 2.
  1371. @item transform, a
  1372. Set transform type of IIR filter.
  1373. @table @option
  1374. @item di
  1375. @item dii
  1376. @item tdii
  1377. @item latt
  1378. @end table
  1379. @item precision, r
  1380. Set precison of filtering.
  1381. @table @option
  1382. @item auto
  1383. Pick automatic sample format depending on surround filters.
  1384. @item s16
  1385. Always use signed 16-bit.
  1386. @item s32
  1387. Always use signed 32-bit.
  1388. @item f32
  1389. Always use float 32-bit.
  1390. @item f64
  1391. Always use float 64-bit.
  1392. @end table
  1393. @end table
  1394. @subsection Commands
  1395. This filter supports the following commands:
  1396. @table @option
  1397. @item frequency, f
  1398. Change allpass frequency.
  1399. Syntax for the command is : "@var{frequency}"
  1400. @item width_type, t
  1401. Change allpass width_type.
  1402. Syntax for the command is : "@var{width_type}"
  1403. @item width, w
  1404. Change allpass width.
  1405. Syntax for the command is : "@var{width}"
  1406. @item mix, m
  1407. Change allpass mix.
  1408. Syntax for the command is : "@var{mix}"
  1409. @end table
  1410. @section aloop
  1411. Loop audio samples.
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item loop
  1415. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1416. Default is 0.
  1417. @item size
  1418. Set maximal number of samples. Default is 0.
  1419. @item start
  1420. Set first sample of loop. Default is 0.
  1421. @end table
  1422. @anchor{amerge}
  1423. @section amerge
  1424. Merge two or more audio streams into a single multi-channel stream.
  1425. The filter accepts the following options:
  1426. @table @option
  1427. @item inputs
  1428. Set the number of inputs. Default is 2.
  1429. @end table
  1430. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1431. the channel layout of the output will be set accordingly and the channels
  1432. will be reordered as necessary. If the channel layouts of the inputs are not
  1433. disjoint, the output will have all the channels of the first input then all
  1434. the channels of the second input, in that order, and the channel layout of
  1435. the output will be the default value corresponding to the total number of
  1436. channels.
  1437. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1438. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1439. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1440. first input, b1 is the first channel of the second input).
  1441. On the other hand, if both input are in stereo, the output channels will be
  1442. in the default order: a1, a2, b1, b2, and the channel layout will be
  1443. arbitrarily set to 4.0, which may or may not be the expected value.
  1444. All inputs must have the same sample rate, and format.
  1445. If inputs do not have the same duration, the output will stop with the
  1446. shortest.
  1447. @subsection Examples
  1448. @itemize
  1449. @item
  1450. Merge two mono files into a stereo stream:
  1451. @example
  1452. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1453. @end example
  1454. @item
  1455. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1456. @example
  1457. 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
  1458. @end example
  1459. @end itemize
  1460. @section amix
  1461. Mixes multiple audio inputs into a single output.
  1462. Note that this filter only supports float samples (the @var{amerge}
  1463. and @var{pan} audio filters support many formats). If the @var{amix}
  1464. input has integer samples then @ref{aresample} will be automatically
  1465. inserted to perform the conversion to float samples.
  1466. For example
  1467. @example
  1468. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1469. @end example
  1470. will mix 3 input audio streams to a single output with the same duration as the
  1471. first input and a dropout transition time of 3 seconds.
  1472. It accepts the following parameters:
  1473. @table @option
  1474. @item inputs
  1475. The number of inputs. If unspecified, it defaults to 2.
  1476. @item duration
  1477. How to determine the end-of-stream.
  1478. @table @option
  1479. @item longest
  1480. The duration of the longest input. (default)
  1481. @item shortest
  1482. The duration of the shortest input.
  1483. @item first
  1484. The duration of the first input.
  1485. @end table
  1486. @item dropout_transition
  1487. The transition time, in seconds, for volume renormalization when an input
  1488. stream ends. The default value is 2 seconds.
  1489. @item weights
  1490. Specify weight of each input audio stream as sequence.
  1491. Each weight is separated by space. By default all inputs have same weight.
  1492. @item normalize
  1493. Always scale inputs instead of only doing summation of samples.
  1494. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1495. by this filter if this option is disabled. By default is enabled.
  1496. @end table
  1497. @subsection Commands
  1498. This filter supports the following commands:
  1499. @table @option
  1500. @item weights
  1501. @item sum
  1502. Syntax is same as option with same name.
  1503. @end table
  1504. @section amultiply
  1505. Multiply first audio stream with second audio stream and store result
  1506. in output audio stream. Multiplication is done by multiplying each
  1507. sample from first stream with sample at same position from second stream.
  1508. With this element-wise multiplication one can create amplitude fades and
  1509. amplitude modulations.
  1510. @section anequalizer
  1511. High-order parametric multiband equalizer for each channel.
  1512. It accepts the following parameters:
  1513. @table @option
  1514. @item params
  1515. This option string is in format:
  1516. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1517. Each equalizer band is separated by '|'.
  1518. @table @option
  1519. @item chn
  1520. Set channel number to which equalization will be applied.
  1521. If input doesn't have that channel the entry is ignored.
  1522. @item f
  1523. Set central frequency for band.
  1524. If input doesn't have that frequency the entry is ignored.
  1525. @item w
  1526. Set band width in Hertz.
  1527. @item g
  1528. Set band gain in dB.
  1529. @item t
  1530. Set filter type for band, optional, can be:
  1531. @table @samp
  1532. @item 0
  1533. Butterworth, this is default.
  1534. @item 1
  1535. Chebyshev type 1.
  1536. @item 2
  1537. Chebyshev type 2.
  1538. @end table
  1539. @end table
  1540. @item curves
  1541. With this option activated frequency response of anequalizer is displayed
  1542. in video stream.
  1543. @item size
  1544. Set video stream size. Only useful if curves option is activated.
  1545. @item mgain
  1546. Set max gain that will be displayed. Only useful if curves option is activated.
  1547. Setting this to a reasonable value makes it possible to display gain which is derived from
  1548. neighbour bands which are too close to each other and thus produce higher gain
  1549. when both are activated.
  1550. @item fscale
  1551. Set frequency scale used to draw frequency response in video output.
  1552. Can be linear or logarithmic. Default is logarithmic.
  1553. @item colors
  1554. Set color for each channel curve which is going to be displayed in video stream.
  1555. This is list of color names separated by space or by '|'.
  1556. Unrecognised or missing colors will be replaced by white color.
  1557. @end table
  1558. @subsection Examples
  1559. @itemize
  1560. @item
  1561. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1562. for first 2 channels using Chebyshev type 1 filter:
  1563. @example
  1564. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1565. @end example
  1566. @end itemize
  1567. @subsection Commands
  1568. This filter supports the following commands:
  1569. @table @option
  1570. @item change
  1571. Alter existing filter parameters.
  1572. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1573. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1574. error is returned.
  1575. @var{freq} set new frequency parameter.
  1576. @var{width} set new width parameter in Hertz.
  1577. @var{gain} set new gain parameter in dB.
  1578. Full filter invocation with asendcmd may look like this:
  1579. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1580. @end table
  1581. @section anlmdn
  1582. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1583. Each sample is adjusted by looking for other samples with similar contexts. This
  1584. context similarity is defined by comparing their surrounding patches of size
  1585. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1586. The filter accepts the following options:
  1587. @table @option
  1588. @item s
  1589. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1590. @item p
  1591. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1592. Default value is 2 milliseconds.
  1593. @item r
  1594. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1595. Default value is 6 milliseconds.
  1596. @item o
  1597. Set the output mode.
  1598. It accepts the following values:
  1599. @table @option
  1600. @item i
  1601. Pass input unchanged.
  1602. @item o
  1603. Pass noise filtered out.
  1604. @item n
  1605. Pass only noise.
  1606. Default value is @var{o}.
  1607. @end table
  1608. @item m
  1609. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1610. @end table
  1611. @subsection Commands
  1612. This filter supports the all above options as @ref{commands}.
  1613. @section anlms
  1614. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1615. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1616. relate to producing the least mean square of the error signal (difference between the desired,
  1617. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1618. A description of the accepted options follows.
  1619. @table @option
  1620. @item order
  1621. Set filter order.
  1622. @item mu
  1623. Set filter mu.
  1624. @item eps
  1625. Set the filter eps.
  1626. @item leakage
  1627. Set the filter leakage.
  1628. @item out_mode
  1629. It accepts the following values:
  1630. @table @option
  1631. @item i
  1632. Pass the 1st input.
  1633. @item d
  1634. Pass the 2nd input.
  1635. @item o
  1636. Pass filtered samples.
  1637. @item n
  1638. Pass difference between desired and filtered samples.
  1639. Default value is @var{o}.
  1640. @end table
  1641. @end table
  1642. @subsection Examples
  1643. @itemize
  1644. @item
  1645. One of many usages of this filter is noise reduction, input audio is filtered
  1646. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1647. @example
  1648. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1649. @end example
  1650. @end itemize
  1651. @subsection Commands
  1652. This filter supports the same commands as options, excluding option @code{order}.
  1653. @section anull
  1654. Pass the audio source unchanged to the output.
  1655. @section apad
  1656. Pad the end of an audio stream with silence.
  1657. This can be used together with @command{ffmpeg} @option{-shortest} to
  1658. extend audio streams to the same length as the video stream.
  1659. A description of the accepted options follows.
  1660. @table @option
  1661. @item packet_size
  1662. Set silence packet size. Default value is 4096.
  1663. @item pad_len
  1664. Set the number of samples of silence to add to the end. After the
  1665. value is reached, the stream is terminated. This option is mutually
  1666. exclusive with @option{whole_len}.
  1667. @item whole_len
  1668. Set the minimum total number of samples in the output audio stream. If
  1669. the value is longer than the input audio length, silence is added to
  1670. the end, until the value is reached. This option is mutually exclusive
  1671. with @option{pad_len}.
  1672. @item pad_dur
  1673. Specify the duration of samples of silence to add. See
  1674. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1675. for the accepted syntax. Used only if set to non-zero value.
  1676. @item whole_dur
  1677. Specify the minimum total duration in the output audio stream. See
  1678. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1679. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1680. the input audio length, silence is added to the end, until the value is reached.
  1681. This option is mutually exclusive with @option{pad_dur}
  1682. @end table
  1683. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1684. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1685. the input stream indefinitely.
  1686. @subsection Examples
  1687. @itemize
  1688. @item
  1689. Add 1024 samples of silence to the end of the input:
  1690. @example
  1691. apad=pad_len=1024
  1692. @end example
  1693. @item
  1694. Make sure the audio output will contain at least 10000 samples, pad
  1695. the input with silence if required:
  1696. @example
  1697. apad=whole_len=10000
  1698. @end example
  1699. @item
  1700. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1701. video stream will always result the shortest and will be converted
  1702. until the end in the output file when using the @option{shortest}
  1703. option:
  1704. @example
  1705. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1706. @end example
  1707. @end itemize
  1708. @section aphaser
  1709. Add a phasing effect to the input audio.
  1710. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1711. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1712. A description of the accepted parameters follows.
  1713. @table @option
  1714. @item in_gain
  1715. Set input gain. Default is 0.4.
  1716. @item out_gain
  1717. Set output gain. Default is 0.74
  1718. @item delay
  1719. Set delay in milliseconds. Default is 3.0.
  1720. @item decay
  1721. Set decay. Default is 0.4.
  1722. @item speed
  1723. Set modulation speed in Hz. Default is 0.5.
  1724. @item type
  1725. Set modulation type. Default is triangular.
  1726. It accepts the following values:
  1727. @table @samp
  1728. @item triangular, t
  1729. @item sinusoidal, s
  1730. @end table
  1731. @end table
  1732. @section aphaseshift
  1733. Apply phase shift to input audio samples.
  1734. The filter accepts the following options:
  1735. @table @option
  1736. @item shift
  1737. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1738. Default value is 0.0.
  1739. @item level
  1740. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1741. Default value is 1.0.
  1742. @end table
  1743. @subsection Commands
  1744. This filter supports the all above options as @ref{commands}.
  1745. @section apulsator
  1746. Audio pulsator is something between an autopanner and a tremolo.
  1747. But it can produce funny stereo effects as well. Pulsator changes the volume
  1748. of the left and right channel based on a LFO (low frequency oscillator) with
  1749. different waveforms and shifted phases.
  1750. This filter have the ability to define an offset between left and right
  1751. channel. An offset of 0 means that both LFO shapes match each other.
  1752. The left and right channel are altered equally - a conventional tremolo.
  1753. An offset of 50% means that the shape of the right channel is exactly shifted
  1754. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1755. an autopanner. At 1 both curves match again. Every setting in between moves the
  1756. phase shift gapless between all stages and produces some "bypassing" sounds with
  1757. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1758. the 0.5) the faster the signal passes from the left to the right speaker.
  1759. The filter accepts the following options:
  1760. @table @option
  1761. @item level_in
  1762. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1763. @item level_out
  1764. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1765. @item mode
  1766. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1767. sawup or sawdown. Default is sine.
  1768. @item amount
  1769. Set modulation. Define how much of original signal is affected by the LFO.
  1770. @item offset_l
  1771. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1772. @item offset_r
  1773. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1774. @item width
  1775. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1776. @item timing
  1777. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1778. @item bpm
  1779. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1780. is set to bpm.
  1781. @item ms
  1782. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1783. is set to ms.
  1784. @item hz
  1785. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1786. if timing is set to hz.
  1787. @end table
  1788. @anchor{aresample}
  1789. @section aresample
  1790. Resample the input audio to the specified parameters, using the
  1791. libswresample library. If none are specified then the filter will
  1792. automatically convert between its input and output.
  1793. This filter is also able to stretch/squeeze the audio data to make it match
  1794. the timestamps or to inject silence / cut out audio to make it match the
  1795. timestamps, do a combination of both or do neither.
  1796. The filter accepts the syntax
  1797. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1798. expresses a sample rate and @var{resampler_options} is a list of
  1799. @var{key}=@var{value} pairs, separated by ":". See the
  1800. @ref{Resampler Options,,"Resampler Options" section in the
  1801. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1802. for the complete list of supported options.
  1803. @subsection Examples
  1804. @itemize
  1805. @item
  1806. Resample the input audio to 44100Hz:
  1807. @example
  1808. aresample=44100
  1809. @end example
  1810. @item
  1811. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1812. samples per second compensation:
  1813. @example
  1814. aresample=async=1000
  1815. @end example
  1816. @end itemize
  1817. @section areverse
  1818. Reverse an audio clip.
  1819. Warning: This filter requires memory to buffer the entire clip, so trimming
  1820. is suggested.
  1821. @subsection Examples
  1822. @itemize
  1823. @item
  1824. Take the first 5 seconds of a clip, and reverse it.
  1825. @example
  1826. atrim=end=5,areverse
  1827. @end example
  1828. @end itemize
  1829. @section arnndn
  1830. Reduce noise from speech using Recurrent Neural Networks.
  1831. This filter accepts the following options:
  1832. @table @option
  1833. @item model, m
  1834. Set train model file to load. This option is always required.
  1835. @item mix
  1836. Set how much to mix filtered samples into final output.
  1837. Allowed range is from -1 to 1. Default value is 1.
  1838. Negative values are special, they set how much to keep filtered noise
  1839. in the final filter output. Set this option to -1 to hear actual
  1840. noise removed from input signal.
  1841. @end table
  1842. @subsection Commands
  1843. This filter supports the all above options as @ref{commands}.
  1844. @section asetnsamples
  1845. Set the number of samples per each output audio frame.
  1846. The last output packet may contain a different number of samples, as
  1847. the filter will flush all the remaining samples when the input audio
  1848. signals its end.
  1849. The filter accepts the following options:
  1850. @table @option
  1851. @item nb_out_samples, n
  1852. Set the number of frames per each output audio frame. The number is
  1853. intended as the number of samples @emph{per each channel}.
  1854. Default value is 1024.
  1855. @item pad, p
  1856. If set to 1, the filter will pad the last audio frame with zeroes, so
  1857. that the last frame will contain the same number of samples as the
  1858. previous ones. Default value is 1.
  1859. @end table
  1860. For example, to set the number of per-frame samples to 1234 and
  1861. disable padding for the last frame, use:
  1862. @example
  1863. asetnsamples=n=1234:p=0
  1864. @end example
  1865. @section asetrate
  1866. Set the sample rate without altering the PCM data.
  1867. This will result in a change of speed and pitch.
  1868. The filter accepts the following options:
  1869. @table @option
  1870. @item sample_rate, r
  1871. Set the output sample rate. Default is 44100 Hz.
  1872. @end table
  1873. @section ashowinfo
  1874. Show a line containing various information for each input audio frame.
  1875. The input audio is not modified.
  1876. The shown line contains a sequence of key/value pairs of the form
  1877. @var{key}:@var{value}.
  1878. The following values are shown in the output:
  1879. @table @option
  1880. @item n
  1881. The (sequential) number of the input frame, starting from 0.
  1882. @item pts
  1883. The presentation timestamp of the input frame, in time base units; the time base
  1884. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1885. @item pts_time
  1886. The presentation timestamp of the input frame in seconds.
  1887. @item pos
  1888. position of the frame in the input stream, -1 if this information in
  1889. unavailable and/or meaningless (for example in case of synthetic audio)
  1890. @item fmt
  1891. The sample format.
  1892. @item chlayout
  1893. The channel layout.
  1894. @item rate
  1895. The sample rate for the audio frame.
  1896. @item nb_samples
  1897. The number of samples (per channel) in the frame.
  1898. @item checksum
  1899. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1900. audio, the data is treated as if all the planes were concatenated.
  1901. @item plane_checksums
  1902. A list of Adler-32 checksums for each data plane.
  1903. @end table
  1904. @section asoftclip
  1905. Apply audio soft clipping.
  1906. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1907. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1908. This filter accepts the following options:
  1909. @table @option
  1910. @item type
  1911. Set type of soft-clipping.
  1912. It accepts the following values:
  1913. @table @option
  1914. @item hard
  1915. @item tanh
  1916. @item atan
  1917. @item cubic
  1918. @item exp
  1919. @item alg
  1920. @item quintic
  1921. @item sin
  1922. @item erf
  1923. @end table
  1924. @item threshold
  1925. Set threshold from where to start clipping. Default value is 0dB or 1.
  1926. @item output
  1927. Set gain applied to output. Default value is 0dB or 1.
  1928. @item param
  1929. Set additional parameter which controls sigmoid function.
  1930. @item oversample
  1931. Set oversampling factor.
  1932. @end table
  1933. @subsection Commands
  1934. This filter supports the all above options as @ref{commands}.
  1935. @section asr
  1936. Automatic Speech Recognition
  1937. This filter uses PocketSphinx for speech recognition. To enable
  1938. compilation of this filter, you need to configure FFmpeg with
  1939. @code{--enable-pocketsphinx}.
  1940. It accepts the following options:
  1941. @table @option
  1942. @item rate
  1943. Set sampling rate of input audio. Defaults is @code{16000}.
  1944. This need to match speech models, otherwise one will get poor results.
  1945. @item hmm
  1946. Set dictionary containing acoustic model files.
  1947. @item dict
  1948. Set pronunciation dictionary.
  1949. @item lm
  1950. Set language model file.
  1951. @item lmctl
  1952. Set language model set.
  1953. @item lmname
  1954. Set which language model to use.
  1955. @item logfn
  1956. Set output for log messages.
  1957. @end table
  1958. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1959. @anchor{astats}
  1960. @section astats
  1961. Display time domain statistical information about the audio channels.
  1962. Statistics are calculated and displayed for each audio channel and,
  1963. where applicable, an overall figure is also given.
  1964. It accepts the following option:
  1965. @table @option
  1966. @item length
  1967. Short window length in seconds, used for peak and trough RMS measurement.
  1968. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1969. @item metadata
  1970. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1971. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1972. disabled.
  1973. Available keys for each channel are:
  1974. DC_offset
  1975. Min_level
  1976. Max_level
  1977. Min_difference
  1978. Max_difference
  1979. Mean_difference
  1980. RMS_difference
  1981. Peak_level
  1982. RMS_peak
  1983. RMS_trough
  1984. Crest_factor
  1985. Flat_factor
  1986. Peak_count
  1987. Noise_floor
  1988. Noise_floor_count
  1989. Bit_depth
  1990. Dynamic_range
  1991. Zero_crossings
  1992. Zero_crossings_rate
  1993. Number_of_NaNs
  1994. Number_of_Infs
  1995. Number_of_denormals
  1996. and for Overall:
  1997. DC_offset
  1998. Min_level
  1999. Max_level
  2000. Min_difference
  2001. Max_difference
  2002. Mean_difference
  2003. RMS_difference
  2004. Peak_level
  2005. RMS_level
  2006. RMS_peak
  2007. RMS_trough
  2008. Flat_factor
  2009. Peak_count
  2010. Noise_floor
  2011. Noise_floor_count
  2012. Bit_depth
  2013. Number_of_samples
  2014. Number_of_NaNs
  2015. Number_of_Infs
  2016. Number_of_denormals
  2017. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  2018. this @code{lavfi.astats.Overall.Peak_count}.
  2019. For description what each key means read below.
  2020. @item reset
  2021. Set number of frame after which stats are going to be recalculated.
  2022. Default is disabled.
  2023. @item measure_perchannel
  2024. Select the entries which need to be measured per channel. The metadata keys can
  2025. be used as flags, default is @option{all} which measures everything.
  2026. @option{none} disables all per channel measurement.
  2027. @item measure_overall
  2028. Select the entries which need to be measured overall. The metadata keys can
  2029. be used as flags, default is @option{all} which measures everything.
  2030. @option{none} disables all overall measurement.
  2031. @end table
  2032. A description of each shown parameter follows:
  2033. @table @option
  2034. @item DC offset
  2035. Mean amplitude displacement from zero.
  2036. @item Min level
  2037. Minimal sample level.
  2038. @item Max level
  2039. Maximal sample level.
  2040. @item Min difference
  2041. Minimal difference between two consecutive samples.
  2042. @item Max difference
  2043. Maximal difference between two consecutive samples.
  2044. @item Mean difference
  2045. Mean difference between two consecutive samples.
  2046. The average of each difference between two consecutive samples.
  2047. @item RMS difference
  2048. Root Mean Square difference between two consecutive samples.
  2049. @item Peak level dB
  2050. @item RMS level dB
  2051. Standard peak and RMS level measured in dBFS.
  2052. @item RMS peak dB
  2053. @item RMS trough dB
  2054. Peak and trough values for RMS level measured over a short window.
  2055. @item Crest factor
  2056. Standard ratio of peak to RMS level (note: not in dB).
  2057. @item Flat factor
  2058. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2059. (i.e. either @var{Min level} or @var{Max level}).
  2060. @item Peak count
  2061. Number of occasions (not the number of samples) that the signal attained either
  2062. @var{Min level} or @var{Max level}.
  2063. @item Noise floor dB
  2064. Minimum local peak measured in dBFS over a short window.
  2065. @item Noise floor count
  2066. Number of occasions (not the number of samples) that the signal attained
  2067. @var{Noise floor}.
  2068. @item Bit depth
  2069. Overall bit depth of audio. Number of bits used for each sample.
  2070. @item Dynamic range
  2071. Measured dynamic range of audio in dB.
  2072. @item Zero crossings
  2073. Number of points where the waveform crosses the zero level axis.
  2074. @item Zero crossings rate
  2075. Rate of Zero crossings and number of audio samples.
  2076. @end table
  2077. @section asubboost
  2078. Boost subwoofer frequencies.
  2079. The filter accepts the following options:
  2080. @table @option
  2081. @item dry
  2082. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2083. Default value is 0.7.
  2084. @item wet
  2085. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2086. Default value is 0.7.
  2087. @item decay
  2088. Set delay line decay gain value. Allowed range is from 0 to 1.
  2089. Default value is 0.7.
  2090. @item feedback
  2091. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2092. Default value is 0.9.
  2093. @item cutoff
  2094. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2095. Default value is 100.
  2096. @item slope
  2097. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2098. Default value is 0.5.
  2099. @item delay
  2100. Set delay. Allowed range is from 1 to 100.
  2101. Default value is 20.
  2102. @end table
  2103. @subsection Commands
  2104. This filter supports the all above options as @ref{commands}.
  2105. @section asubcut
  2106. Cut subwoofer frequencies.
  2107. This filter allows to set custom, steeper
  2108. roll off than highpass filter, and thus is able to more attenuate
  2109. frequency content in stop-band.
  2110. The filter accepts the following options:
  2111. @table @option
  2112. @item cutoff
  2113. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2114. Default value is 20.
  2115. @item order
  2116. Set filter order. Available values are from 3 to 20.
  2117. Default value is 10.
  2118. @item level
  2119. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2120. @end table
  2121. @subsection Commands
  2122. This filter supports the all above options as @ref{commands}.
  2123. @section asupercut
  2124. Cut super frequencies.
  2125. The filter accepts the following options:
  2126. @table @option
  2127. @item cutoff
  2128. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2129. Default value is 20000.
  2130. @item order
  2131. Set filter order. Available values are from 3 to 20.
  2132. Default value is 10.
  2133. @item level
  2134. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2135. @end table
  2136. @subsection Commands
  2137. This filter supports the all above options as @ref{commands}.
  2138. @section asuperpass
  2139. Apply high order Butterworth band-pass filter.
  2140. The filter accepts the following options:
  2141. @table @option
  2142. @item centerf
  2143. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2144. Default value is 1000.
  2145. @item order
  2146. Set filter order. Available values are from 4 to 20.
  2147. Default value is 4.
  2148. @item qfactor
  2149. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2150. @item level
  2151. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2152. @end table
  2153. @subsection Commands
  2154. This filter supports the all above options as @ref{commands}.
  2155. @section asuperstop
  2156. Apply high order Butterworth band-stop filter.
  2157. The filter accepts the following options:
  2158. @table @option
  2159. @item centerf
  2160. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2161. Default value is 1000.
  2162. @item order
  2163. Set filter order. Available values are from 4 to 20.
  2164. Default value is 4.
  2165. @item qfactor
  2166. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2167. @item level
  2168. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2169. @end table
  2170. @subsection Commands
  2171. This filter supports the all above options as @ref{commands}.
  2172. @section atempo
  2173. Adjust audio tempo.
  2174. The filter accepts exactly one parameter, the audio tempo. If not
  2175. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2176. be in the [0.5, 100.0] range.
  2177. Note that tempo greater than 2 will skip some samples rather than
  2178. blend them in. If for any reason this is a concern it is always
  2179. possible to daisy-chain several instances of atempo to achieve the
  2180. desired product tempo.
  2181. @subsection Examples
  2182. @itemize
  2183. @item
  2184. Slow down audio to 80% tempo:
  2185. @example
  2186. atempo=0.8
  2187. @end example
  2188. @item
  2189. To speed up audio to 300% tempo:
  2190. @example
  2191. atempo=3
  2192. @end example
  2193. @item
  2194. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2195. @example
  2196. atempo=sqrt(3),atempo=sqrt(3)
  2197. @end example
  2198. @end itemize
  2199. @subsection Commands
  2200. This filter supports the following commands:
  2201. @table @option
  2202. @item tempo
  2203. Change filter tempo scale factor.
  2204. Syntax for the command is : "@var{tempo}"
  2205. @end table
  2206. @section atrim
  2207. Trim the input so that the output contains one continuous subpart of the input.
  2208. It accepts the following parameters:
  2209. @table @option
  2210. @item start
  2211. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2212. sample with the timestamp @var{start} will be the first sample in the output.
  2213. @item end
  2214. Specify time of the first audio sample that will be dropped, i.e. the
  2215. audio sample immediately preceding the one with the timestamp @var{end} will be
  2216. the last sample in the output.
  2217. @item start_pts
  2218. Same as @var{start}, except this option sets the start timestamp in samples
  2219. instead of seconds.
  2220. @item end_pts
  2221. Same as @var{end}, except this option sets the end timestamp in samples instead
  2222. of seconds.
  2223. @item duration
  2224. The maximum duration of the output in seconds.
  2225. @item start_sample
  2226. The number of the first sample that should be output.
  2227. @item end_sample
  2228. The number of the first sample that should be dropped.
  2229. @end table
  2230. @option{start}, @option{end}, and @option{duration} are expressed as time
  2231. duration specifications; see
  2232. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2233. Note that the first two sets of the start/end options and the @option{duration}
  2234. option look at the frame timestamp, while the _sample options simply count the
  2235. samples that pass through the filter. So start/end_pts and start/end_sample will
  2236. give different results when the timestamps are wrong, inexact or do not start at
  2237. zero. Also note that this filter does not modify the timestamps. If you wish
  2238. to have the output timestamps start at zero, insert the asetpts filter after the
  2239. atrim filter.
  2240. If multiple start or end options are set, this filter tries to be greedy and
  2241. keep all samples that match at least one of the specified constraints. To keep
  2242. only the part that matches all the constraints at once, chain multiple atrim
  2243. filters.
  2244. The defaults are such that all the input is kept. So it is possible to set e.g.
  2245. just the end values to keep everything before the specified time.
  2246. Examples:
  2247. @itemize
  2248. @item
  2249. Drop everything except the second minute of input:
  2250. @example
  2251. ffmpeg -i INPUT -af atrim=60:120
  2252. @end example
  2253. @item
  2254. Keep only the first 1000 samples:
  2255. @example
  2256. ffmpeg -i INPUT -af atrim=end_sample=1000
  2257. @end example
  2258. @end itemize
  2259. @section axcorrelate
  2260. Calculate normalized cross-correlation between two input audio streams.
  2261. Resulted samples are always between -1 and 1 inclusive.
  2262. If result is 1 it means two input samples are highly correlated in that selected segment.
  2263. Result 0 means they are not correlated at all.
  2264. If result is -1 it means two input samples are out of phase, which means they cancel each
  2265. other.
  2266. The filter accepts the following options:
  2267. @table @option
  2268. @item size
  2269. Set size of segment over which cross-correlation is calculated.
  2270. Default is 256. Allowed range is from 2 to 131072.
  2271. @item algo
  2272. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2273. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2274. are always zero and thus need much less calculations to make.
  2275. This is generally not true, but is valid for typical audio streams.
  2276. @end table
  2277. @subsection Examples
  2278. @itemize
  2279. @item
  2280. Calculate correlation between channels in stereo audio stream:
  2281. @example
  2282. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2283. @end example
  2284. @end itemize
  2285. @section bandpass
  2286. Apply a two-pole Butterworth band-pass filter with central
  2287. frequency @var{frequency}, and (3dB-point) band-width width.
  2288. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2289. instead of the default: constant 0dB peak gain.
  2290. The filter roll off at 6dB per octave (20dB per decade).
  2291. The filter accepts the following options:
  2292. @table @option
  2293. @item frequency, f
  2294. Set the filter's central frequency. Default is @code{3000}.
  2295. @item csg
  2296. Constant skirt gain if set to 1. Defaults to 0.
  2297. @item width_type, t
  2298. Set method to specify band-width of filter.
  2299. @table @option
  2300. @item h
  2301. Hz
  2302. @item q
  2303. Q-Factor
  2304. @item o
  2305. octave
  2306. @item s
  2307. slope
  2308. @item k
  2309. kHz
  2310. @end table
  2311. @item width, w
  2312. Specify the band-width of a filter in width_type units.
  2313. @item mix, m
  2314. How much to use filtered signal in output. Default is 1.
  2315. Range is between 0 and 1.
  2316. @item channels, c
  2317. Specify which channels to filter, by default all available are filtered.
  2318. @item normalize, n
  2319. Normalize biquad coefficients, by default is disabled.
  2320. Enabling it will normalize magnitude response at DC to 0dB.
  2321. @item transform, a
  2322. Set transform type of IIR filter.
  2323. @table @option
  2324. @item di
  2325. @item dii
  2326. @item tdii
  2327. @item latt
  2328. @end table
  2329. @item precision, r
  2330. Set precison of filtering.
  2331. @table @option
  2332. @item auto
  2333. Pick automatic sample format depending on surround filters.
  2334. @item s16
  2335. Always use signed 16-bit.
  2336. @item s32
  2337. Always use signed 32-bit.
  2338. @item f32
  2339. Always use float 32-bit.
  2340. @item f64
  2341. Always use float 64-bit.
  2342. @end table
  2343. @end table
  2344. @subsection Commands
  2345. This filter supports the following commands:
  2346. @table @option
  2347. @item frequency, f
  2348. Change bandpass frequency.
  2349. Syntax for the command is : "@var{frequency}"
  2350. @item width_type, t
  2351. Change bandpass width_type.
  2352. Syntax for the command is : "@var{width_type}"
  2353. @item width, w
  2354. Change bandpass width.
  2355. Syntax for the command is : "@var{width}"
  2356. @item mix, m
  2357. Change bandpass mix.
  2358. Syntax for the command is : "@var{mix}"
  2359. @end table
  2360. @section bandreject
  2361. Apply a two-pole Butterworth band-reject filter with central
  2362. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2363. The filter roll off at 6dB per octave (20dB per decade).
  2364. The filter accepts the following options:
  2365. @table @option
  2366. @item frequency, f
  2367. Set the filter's central frequency. Default is @code{3000}.
  2368. @item width_type, t
  2369. Set method to specify band-width of filter.
  2370. @table @option
  2371. @item h
  2372. Hz
  2373. @item q
  2374. Q-Factor
  2375. @item o
  2376. octave
  2377. @item s
  2378. slope
  2379. @item k
  2380. kHz
  2381. @end table
  2382. @item width, w
  2383. Specify the band-width of a filter in width_type units.
  2384. @item mix, m
  2385. How much to use filtered signal in output. Default is 1.
  2386. Range is between 0 and 1.
  2387. @item channels, c
  2388. Specify which channels to filter, by default all available are filtered.
  2389. @item normalize, n
  2390. Normalize biquad coefficients, by default is disabled.
  2391. Enabling it will normalize magnitude response at DC to 0dB.
  2392. @item transform, a
  2393. Set transform type of IIR filter.
  2394. @table @option
  2395. @item di
  2396. @item dii
  2397. @item tdii
  2398. @item latt
  2399. @end table
  2400. @item precision, r
  2401. Set precison of filtering.
  2402. @table @option
  2403. @item auto
  2404. Pick automatic sample format depending on surround filters.
  2405. @item s16
  2406. Always use signed 16-bit.
  2407. @item s32
  2408. Always use signed 32-bit.
  2409. @item f32
  2410. Always use float 32-bit.
  2411. @item f64
  2412. Always use float 64-bit.
  2413. @end table
  2414. @end table
  2415. @subsection Commands
  2416. This filter supports the following commands:
  2417. @table @option
  2418. @item frequency, f
  2419. Change bandreject frequency.
  2420. Syntax for the command is : "@var{frequency}"
  2421. @item width_type, t
  2422. Change bandreject width_type.
  2423. Syntax for the command is : "@var{width_type}"
  2424. @item width, w
  2425. Change bandreject width.
  2426. Syntax for the command is : "@var{width}"
  2427. @item mix, m
  2428. Change bandreject mix.
  2429. Syntax for the command is : "@var{mix}"
  2430. @end table
  2431. @section bass, lowshelf
  2432. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2433. shelving filter with a response similar to that of a standard
  2434. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2435. The filter accepts the following options:
  2436. @table @option
  2437. @item gain, g
  2438. Give the gain at 0 Hz. Its useful range is about -20
  2439. (for a large cut) to +20 (for a large boost).
  2440. Beware of clipping when using a positive gain.
  2441. @item frequency, f
  2442. Set the filter's central frequency and so can be used
  2443. to extend or reduce the frequency range to be boosted or cut.
  2444. The default value is @code{100} Hz.
  2445. @item width_type, t
  2446. Set method to specify band-width of filter.
  2447. @table @option
  2448. @item h
  2449. Hz
  2450. @item q
  2451. Q-Factor
  2452. @item o
  2453. octave
  2454. @item s
  2455. slope
  2456. @item k
  2457. kHz
  2458. @end table
  2459. @item width, w
  2460. Determine how steep is the filter's shelf transition.
  2461. @item poles, p
  2462. Set number of poles. Default is 2.
  2463. @item mix, m
  2464. How much to use filtered signal in output. Default is 1.
  2465. Range is between 0 and 1.
  2466. @item channels, c
  2467. Specify which channels to filter, by default all available are filtered.
  2468. @item normalize, n
  2469. Normalize biquad coefficients, by default is disabled.
  2470. Enabling it will normalize magnitude response at DC to 0dB.
  2471. @item transform, a
  2472. Set transform type of IIR filter.
  2473. @table @option
  2474. @item di
  2475. @item dii
  2476. @item tdii
  2477. @item latt
  2478. @end table
  2479. @item precision, r
  2480. Set precison of filtering.
  2481. @table @option
  2482. @item auto
  2483. Pick automatic sample format depending on surround filters.
  2484. @item s16
  2485. Always use signed 16-bit.
  2486. @item s32
  2487. Always use signed 32-bit.
  2488. @item f32
  2489. Always use float 32-bit.
  2490. @item f64
  2491. Always use float 64-bit.
  2492. @end table
  2493. @end table
  2494. @subsection Commands
  2495. This filter supports the following commands:
  2496. @table @option
  2497. @item frequency, f
  2498. Change bass frequency.
  2499. Syntax for the command is : "@var{frequency}"
  2500. @item width_type, t
  2501. Change bass width_type.
  2502. Syntax for the command is : "@var{width_type}"
  2503. @item width, w
  2504. Change bass width.
  2505. Syntax for the command is : "@var{width}"
  2506. @item gain, g
  2507. Change bass gain.
  2508. Syntax for the command is : "@var{gain}"
  2509. @item mix, m
  2510. Change bass mix.
  2511. Syntax for the command is : "@var{mix}"
  2512. @end table
  2513. @section biquad
  2514. Apply a biquad IIR filter with the given coefficients.
  2515. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2516. are the numerator and denominator coefficients respectively.
  2517. and @var{channels}, @var{c} specify which channels to filter, by default all
  2518. available are filtered.
  2519. @subsection Commands
  2520. This filter supports the following commands:
  2521. @table @option
  2522. @item a0
  2523. @item a1
  2524. @item a2
  2525. @item b0
  2526. @item b1
  2527. @item b2
  2528. Change biquad parameter.
  2529. Syntax for the command is : "@var{value}"
  2530. @item mix, m
  2531. How much to use filtered signal in output. Default is 1.
  2532. Range is between 0 and 1.
  2533. @item channels, c
  2534. Specify which channels to filter, by default all available are filtered.
  2535. @item normalize, n
  2536. Normalize biquad coefficients, by default is disabled.
  2537. Enabling it will normalize magnitude response at DC to 0dB.
  2538. @item transform, a
  2539. Set transform type of IIR filter.
  2540. @table @option
  2541. @item di
  2542. @item dii
  2543. @item tdii
  2544. @item latt
  2545. @end table
  2546. @item precision, r
  2547. Set precison of filtering.
  2548. @table @option
  2549. @item auto
  2550. Pick automatic sample format depending on surround filters.
  2551. @item s16
  2552. Always use signed 16-bit.
  2553. @item s32
  2554. Always use signed 32-bit.
  2555. @item f32
  2556. Always use float 32-bit.
  2557. @item f64
  2558. Always use float 64-bit.
  2559. @end table
  2560. @end table
  2561. @section bs2b
  2562. Bauer stereo to binaural transformation, which improves headphone listening of
  2563. stereo audio records.
  2564. To enable compilation of this filter you need to configure FFmpeg with
  2565. @code{--enable-libbs2b}.
  2566. It accepts the following parameters:
  2567. @table @option
  2568. @item profile
  2569. Pre-defined crossfeed level.
  2570. @table @option
  2571. @item default
  2572. Default level (fcut=700, feed=50).
  2573. @item cmoy
  2574. Chu Moy circuit (fcut=700, feed=60).
  2575. @item jmeier
  2576. Jan Meier circuit (fcut=650, feed=95).
  2577. @end table
  2578. @item fcut
  2579. Cut frequency (in Hz).
  2580. @item feed
  2581. Feed level (in Hz).
  2582. @end table
  2583. @section channelmap
  2584. Remap input channels to new locations.
  2585. It accepts the following parameters:
  2586. @table @option
  2587. @item map
  2588. Map channels from input to output. The argument is a '|'-separated list of
  2589. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2590. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2591. channel (e.g. FL for front left) or its index in the input channel layout.
  2592. @var{out_channel} is the name of the output channel or its index in the output
  2593. channel layout. If @var{out_channel} is not given then it is implicitly an
  2594. index, starting with zero and increasing by one for each mapping.
  2595. @item channel_layout
  2596. The channel layout of the output stream.
  2597. @end table
  2598. If no mapping is present, the filter will implicitly map input channels to
  2599. output channels, preserving indices.
  2600. @subsection Examples
  2601. @itemize
  2602. @item
  2603. For example, assuming a 5.1+downmix input MOV file,
  2604. @example
  2605. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2606. @end example
  2607. will create an output WAV file tagged as stereo from the downmix channels of
  2608. the input.
  2609. @item
  2610. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2611. @example
  2612. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2613. @end example
  2614. @end itemize
  2615. @section channelsplit
  2616. Split each channel from an input audio stream into a separate output stream.
  2617. It accepts the following parameters:
  2618. @table @option
  2619. @item channel_layout
  2620. The channel layout of the input stream. The default is "stereo".
  2621. @item channels
  2622. A channel layout describing the channels to be extracted as separate output streams
  2623. or "all" to extract each input channel as a separate stream. The default is "all".
  2624. Choosing channels not present in channel layout in the input will result in an error.
  2625. @end table
  2626. @subsection Examples
  2627. @itemize
  2628. @item
  2629. For example, assuming a stereo input MP3 file,
  2630. @example
  2631. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2632. @end example
  2633. will create an output Matroska file with two audio streams, one containing only
  2634. the left channel and the other the right channel.
  2635. @item
  2636. Split a 5.1 WAV file into per-channel files:
  2637. @example
  2638. ffmpeg -i in.wav -filter_complex
  2639. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2640. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2641. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2642. side_right.wav
  2643. @end example
  2644. @item
  2645. Extract only LFE from a 5.1 WAV file:
  2646. @example
  2647. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2648. -map '[LFE]' lfe.wav
  2649. @end example
  2650. @end itemize
  2651. @section chorus
  2652. Add a chorus effect to the audio.
  2653. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2654. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2655. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2656. The modulation depth defines the range the modulated delay is played before or after
  2657. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2658. sound tuned around the original one, like in a chorus where some vocals are slightly
  2659. off key.
  2660. It accepts the following parameters:
  2661. @table @option
  2662. @item in_gain
  2663. Set input gain. Default is 0.4.
  2664. @item out_gain
  2665. Set output gain. Default is 0.4.
  2666. @item delays
  2667. Set delays. A typical delay is around 40ms to 60ms.
  2668. @item decays
  2669. Set decays.
  2670. @item speeds
  2671. Set speeds.
  2672. @item depths
  2673. Set depths.
  2674. @end table
  2675. @subsection Examples
  2676. @itemize
  2677. @item
  2678. A single delay:
  2679. @example
  2680. chorus=0.7:0.9:55:0.4:0.25:2
  2681. @end example
  2682. @item
  2683. Two delays:
  2684. @example
  2685. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2686. @end example
  2687. @item
  2688. Fuller sounding chorus with three delays:
  2689. @example
  2690. 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
  2691. @end example
  2692. @end itemize
  2693. @section compand
  2694. Compress or expand the audio's dynamic range.
  2695. It accepts the following parameters:
  2696. @table @option
  2697. @item attacks
  2698. @item decays
  2699. A list of times in seconds for each channel over which the instantaneous level
  2700. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2701. increase of volume and @var{decays} refers to decrease of volume. For most
  2702. situations, the attack time (response to the audio getting louder) should be
  2703. shorter than the decay time, because the human ear is more sensitive to sudden
  2704. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2705. a typical value for decay is 0.8 seconds.
  2706. If specified number of attacks & decays is lower than number of channels, the last
  2707. set attack/decay will be used for all remaining channels.
  2708. @item points
  2709. A list of points for the transfer function, specified in dB relative to the
  2710. maximum possible signal amplitude. Each key points list must be defined using
  2711. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2712. @code{x0/y0 x1/y1 x2/y2 ....}
  2713. The input values must be in strictly increasing order but the transfer function
  2714. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2715. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2716. function are @code{-70/-70|-60/-20|1/0}.
  2717. @item soft-knee
  2718. Set the curve radius in dB for all joints. It defaults to 0.01.
  2719. @item gain
  2720. Set the additional gain in dB to be applied at all points on the transfer
  2721. function. This allows for easy adjustment of the overall gain.
  2722. It defaults to 0.
  2723. @item volume
  2724. Set an initial volume, in dB, to be assumed for each channel when filtering
  2725. starts. This permits the user to supply a nominal level initially, so that, for
  2726. example, a very large gain is not applied to initial signal levels before the
  2727. companding has begun to operate. A typical value for audio which is initially
  2728. quiet is -90 dB. It defaults to 0.
  2729. @item delay
  2730. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2731. delayed before being fed to the volume adjuster. Specifying a delay
  2732. approximately equal to the attack/decay times allows the filter to effectively
  2733. operate in predictive rather than reactive mode. It defaults to 0.
  2734. @end table
  2735. @subsection Examples
  2736. @itemize
  2737. @item
  2738. Make music with both quiet and loud passages suitable for listening to in a
  2739. noisy environment:
  2740. @example
  2741. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2742. @end example
  2743. Another example for audio with whisper and explosion parts:
  2744. @example
  2745. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2746. @end example
  2747. @item
  2748. A noise gate for when the noise is at a lower level than the signal:
  2749. @example
  2750. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2751. @end example
  2752. @item
  2753. Here is another noise gate, this time for when the noise is at a higher level
  2754. than the signal (making it, in some ways, similar to squelch):
  2755. @example
  2756. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2757. @end example
  2758. @item
  2759. 2:1 compression starting at -6dB:
  2760. @example
  2761. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2762. @end example
  2763. @item
  2764. 2:1 compression starting at -9dB:
  2765. @example
  2766. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2767. @end example
  2768. @item
  2769. 2:1 compression starting at -12dB:
  2770. @example
  2771. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2772. @end example
  2773. @item
  2774. 2:1 compression starting at -18dB:
  2775. @example
  2776. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2777. @end example
  2778. @item
  2779. 3:1 compression starting at -15dB:
  2780. @example
  2781. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2782. @end example
  2783. @item
  2784. Compressor/Gate:
  2785. @example
  2786. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2787. @end example
  2788. @item
  2789. Expander:
  2790. @example
  2791. 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
  2792. @end example
  2793. @item
  2794. Hard limiter at -6dB:
  2795. @example
  2796. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2797. @end example
  2798. @item
  2799. Hard limiter at -12dB:
  2800. @example
  2801. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2802. @end example
  2803. @item
  2804. Hard noise gate at -35 dB:
  2805. @example
  2806. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2807. @end example
  2808. @item
  2809. Soft limiter:
  2810. @example
  2811. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2812. @end example
  2813. @end itemize
  2814. @section compensationdelay
  2815. Compensation Delay Line is a metric based delay to compensate differing
  2816. positions of microphones or speakers.
  2817. For example, you have recorded guitar with two microphones placed in
  2818. different locations. Because the front of sound wave has fixed speed in
  2819. normal conditions, the phasing of microphones can vary and depends on
  2820. their location and interposition. The best sound mix can be achieved when
  2821. these microphones are in phase (synchronized). Note that a distance of
  2822. ~30 cm between microphones makes one microphone capture the signal in
  2823. antiphase to the other microphone. That makes the final mix sound moody.
  2824. This filter helps to solve phasing problems by adding different delays
  2825. to each microphone track and make them synchronized.
  2826. The best result can be reached when you take one track as base and
  2827. synchronize other tracks one by one with it.
  2828. Remember that synchronization/delay tolerance depends on sample rate, too.
  2829. Higher sample rates will give more tolerance.
  2830. The filter accepts the following parameters:
  2831. @table @option
  2832. @item mm
  2833. Set millimeters distance. This is compensation distance for fine tuning.
  2834. Default is 0.
  2835. @item cm
  2836. Set cm distance. This is compensation distance for tightening distance setup.
  2837. Default is 0.
  2838. @item m
  2839. Set meters distance. This is compensation distance for hard distance setup.
  2840. Default is 0.
  2841. @item dry
  2842. Set dry amount. Amount of unprocessed (dry) signal.
  2843. Default is 0.
  2844. @item wet
  2845. Set wet amount. Amount of processed (wet) signal.
  2846. Default is 1.
  2847. @item temp
  2848. Set temperature in degrees Celsius. This is the temperature of the environment.
  2849. Default is 20.
  2850. @end table
  2851. @section crossfeed
  2852. Apply headphone crossfeed filter.
  2853. Crossfeed is the process of blending the left and right channels of stereo
  2854. audio recording.
  2855. It is mainly used to reduce extreme stereo separation of low frequencies.
  2856. The intent is to produce more speaker like sound to the listener.
  2857. The filter accepts the following options:
  2858. @table @option
  2859. @item strength
  2860. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2861. This sets gain of low shelf filter for side part of stereo image.
  2862. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2863. @item range
  2864. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2865. This sets cut off frequency of low shelf filter. Default is cut off near
  2866. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2867. @item slope
  2868. Set curve slope of low shelf filter. Default is 0.5.
  2869. Allowed range is from 0.01 to 1.
  2870. @item level_in
  2871. Set input gain. Default is 0.9.
  2872. @item level_out
  2873. Set output gain. Default is 1.
  2874. @end table
  2875. @subsection Commands
  2876. This filter supports the all above options as @ref{commands}.
  2877. @section crystalizer
  2878. Simple algorithm for audio noise sharpening.
  2879. This filter linearly increases differences betweeen each audio sample.
  2880. The filter accepts the following options:
  2881. @table @option
  2882. @item i
  2883. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  2884. (unchanged sound) to 10.0 (maximum effect).
  2885. To inverse filtering use negative value.
  2886. @item c
  2887. Enable clipping. By default is enabled.
  2888. @end table
  2889. @subsection Commands
  2890. This filter supports the all above options as @ref{commands}.
  2891. @section dcshift
  2892. Apply a DC shift to the audio.
  2893. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2894. in the recording chain) from the audio. The effect of a DC offset is reduced
  2895. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2896. a signal has a DC offset.
  2897. @table @option
  2898. @item shift
  2899. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2900. the audio.
  2901. @item limitergain
  2902. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2903. used to prevent clipping.
  2904. @end table
  2905. @section deesser
  2906. Apply de-essing to the audio samples.
  2907. @table @option
  2908. @item i
  2909. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2910. Default is 0.
  2911. @item m
  2912. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2913. Default is 0.5.
  2914. @item f
  2915. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2916. Default is 0.5.
  2917. @item s
  2918. Set the output mode.
  2919. It accepts the following values:
  2920. @table @option
  2921. @item i
  2922. Pass input unchanged.
  2923. @item o
  2924. Pass ess filtered out.
  2925. @item e
  2926. Pass only ess.
  2927. Default value is @var{o}.
  2928. @end table
  2929. @end table
  2930. @section drmeter
  2931. Measure audio dynamic range.
  2932. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2933. is found in transition material. And anything less that 8 have very poor dynamics
  2934. and is very compressed.
  2935. The filter accepts the following options:
  2936. @table @option
  2937. @item length
  2938. Set window length in seconds used to split audio into segments of equal length.
  2939. Default is 3 seconds.
  2940. @end table
  2941. @section dynaudnorm
  2942. Dynamic Audio Normalizer.
  2943. This filter applies a certain amount of gain to the input audio in order
  2944. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2945. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2946. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2947. This allows for applying extra gain to the "quiet" sections of the audio
  2948. while avoiding distortions or clipping the "loud" sections. In other words:
  2949. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2950. sections, in the sense that the volume of each section is brought to the
  2951. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2952. this goal *without* applying "dynamic range compressing". It will retain 100%
  2953. of the dynamic range *within* each section of the audio file.
  2954. @table @option
  2955. @item framelen, f
  2956. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2957. Default is 500 milliseconds.
  2958. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2959. referred to as frames. This is required, because a peak magnitude has no
  2960. meaning for just a single sample value. Instead, we need to determine the
  2961. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2962. normalizer would simply use the peak magnitude of the complete file, the
  2963. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2964. frame. The length of a frame is specified in milliseconds. By default, the
  2965. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2966. been found to give good results with most files.
  2967. Note that the exact frame length, in number of samples, will be determined
  2968. automatically, based on the sampling rate of the individual input audio file.
  2969. @item gausssize, g
  2970. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2971. number. Default is 31.
  2972. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2973. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2974. is specified in frames, centered around the current frame. For the sake of
  2975. simplicity, this must be an odd number. Consequently, the default value of 31
  2976. takes into account the current frame, as well as the 15 preceding frames and
  2977. the 15 subsequent frames. Using a larger window results in a stronger
  2978. smoothing effect and thus in less gain variation, i.e. slower gain
  2979. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2980. effect and thus in more gain variation, i.e. faster gain adaptation.
  2981. In other words, the more you increase this value, the more the Dynamic Audio
  2982. Normalizer will behave like a "traditional" normalization filter. On the
  2983. contrary, the more you decrease this value, the more the Dynamic Audio
  2984. Normalizer will behave like a dynamic range compressor.
  2985. @item peak, p
  2986. Set the target peak value. This specifies the highest permissible magnitude
  2987. level for the normalized audio input. This filter will try to approach the
  2988. target peak magnitude as closely as possible, but at the same time it also
  2989. makes sure that the normalized signal will never exceed the peak magnitude.
  2990. A frame's maximum local gain factor is imposed directly by the target peak
  2991. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2992. It is not recommended to go above this value.
  2993. @item maxgain, m
  2994. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2995. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2996. factor for each input frame, i.e. the maximum gain factor that does not
  2997. result in clipping or distortion. The maximum gain factor is determined by
  2998. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2999. additionally bounds the frame's maximum gain factor by a predetermined
  3000. (global) maximum gain factor. This is done in order to avoid excessive gain
  3001. factors in "silent" or almost silent frames. By default, the maximum gain
  3002. factor is 10.0, For most inputs the default value should be sufficient and
  3003. it usually is not recommended to increase this value. Though, for input
  3004. with an extremely low overall volume level, it may be necessary to allow even
  3005. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3006. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3007. Instead, a "sigmoid" threshold function will be applied. This way, the
  3008. gain factors will smoothly approach the threshold value, but never exceed that
  3009. value.
  3010. @item targetrms, r
  3011. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3012. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3013. This means that the maximum local gain factor for each frame is defined
  3014. (only) by the frame's highest magnitude sample. This way, the samples can
  3015. be amplified as much as possible without exceeding the maximum signal
  3016. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3017. Normalizer can also take into account the frame's root mean square,
  3018. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3019. determine the power of a time-varying signal. It is therefore considered
  3020. that the RMS is a better approximation of the "perceived loudness" than
  3021. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3022. frames to a constant RMS value, a uniform "perceived loudness" can be
  3023. established. If a target RMS value has been specified, a frame's local gain
  3024. factor is defined as the factor that would result in exactly that RMS value.
  3025. Note, however, that the maximum local gain factor is still restricted by the
  3026. frame's highest magnitude sample, in order to prevent clipping.
  3027. @item coupling, n
  3028. Enable channels coupling. By default is enabled.
  3029. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3030. amount. This means the same gain factor will be applied to all channels, i.e.
  3031. the maximum possible gain factor is determined by the "loudest" channel.
  3032. However, in some recordings, it may happen that the volume of the different
  3033. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3034. In this case, this option can be used to disable the channel coupling. This way,
  3035. the gain factor will be determined independently for each channel, depending
  3036. only on the individual channel's highest magnitude sample. This allows for
  3037. harmonizing the volume of the different channels.
  3038. @item correctdc, c
  3039. Enable DC bias correction. By default is disabled.
  3040. An audio signal (in the time domain) is a sequence of sample values.
  3041. In the Dynamic Audio Normalizer these sample values are represented in the
  3042. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3043. audio signal, or "waveform", should be centered around the zero point.
  3044. That means if we calculate the mean value of all samples in a file, or in a
  3045. single frame, then the result should be 0.0 or at least very close to that
  3046. value. If, however, there is a significant deviation of the mean value from
  3047. 0.0, in either positive or negative direction, this is referred to as a
  3048. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3049. Audio Normalizer provides optional DC bias correction.
  3050. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3051. the mean value, or "DC correction" offset, of each input frame and subtract
  3052. that value from all of the frame's sample values which ensures those samples
  3053. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3054. boundaries, the DC correction offset values will be interpolated smoothly
  3055. between neighbouring frames.
  3056. @item altboundary, b
  3057. Enable alternative boundary mode. By default is disabled.
  3058. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3059. around each frame. This includes the preceding frames as well as the
  3060. subsequent frames. However, for the "boundary" frames, located at the very
  3061. beginning and at the very end of the audio file, not all neighbouring
  3062. frames are available. In particular, for the first few frames in the audio
  3063. file, the preceding frames are not known. And, similarly, for the last few
  3064. frames in the audio file, the subsequent frames are not known. Thus, the
  3065. question arises which gain factors should be assumed for the missing frames
  3066. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3067. to deal with this situation. The default boundary mode assumes a gain factor
  3068. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3069. "fade out" at the beginning and at the end of the input, respectively.
  3070. @item compress, s
  3071. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3072. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3073. compression. This means that signal peaks will not be pruned and thus the
  3074. full dynamic range will be retained within each local neighbourhood. However,
  3075. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3076. normalization algorithm with a more "traditional" compression.
  3077. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3078. (thresholding) function. If (and only if) the compression feature is enabled,
  3079. all input frames will be processed by a soft knee thresholding function prior
  3080. to the actual normalization process. Put simply, the thresholding function is
  3081. going to prune all samples whose magnitude exceeds a certain threshold value.
  3082. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3083. value. Instead, the threshold value will be adjusted for each individual
  3084. frame.
  3085. In general, smaller parameters result in stronger compression, and vice versa.
  3086. Values below 3.0 are not recommended, because audible distortion may appear.
  3087. @item threshold, t
  3088. Set the target threshold value. This specifies the lowest permissible
  3089. magnitude level for the audio input which will be normalized.
  3090. If input frame volume is above this value frame will be normalized.
  3091. Otherwise frame may not be normalized at all. The default value is set
  3092. to 0, which means all input frames will be normalized.
  3093. This option is mostly useful if digital noise is not wanted to be amplified.
  3094. @end table
  3095. @subsection Commands
  3096. This filter supports the all above options as @ref{commands}.
  3097. @section earwax
  3098. Make audio easier to listen to on headphones.
  3099. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3100. so that when listened to on headphones the stereo image is moved from
  3101. inside your head (standard for headphones) to outside and in front of
  3102. the listener (standard for speakers).
  3103. Ported from SoX.
  3104. @section equalizer
  3105. Apply a two-pole peaking equalisation (EQ) filter. With this
  3106. filter, the signal-level at and around a selected frequency can
  3107. be increased or decreased, whilst (unlike bandpass and bandreject
  3108. filters) that at all other frequencies is unchanged.
  3109. In order to produce complex equalisation curves, this filter can
  3110. be given several times, each with a different central frequency.
  3111. The filter accepts the following options:
  3112. @table @option
  3113. @item frequency, f
  3114. Set the filter's central frequency in Hz.
  3115. @item width_type, t
  3116. Set method to specify band-width of filter.
  3117. @table @option
  3118. @item h
  3119. Hz
  3120. @item q
  3121. Q-Factor
  3122. @item o
  3123. octave
  3124. @item s
  3125. slope
  3126. @item k
  3127. kHz
  3128. @end table
  3129. @item width, w
  3130. Specify the band-width of a filter in width_type units.
  3131. @item gain, g
  3132. Set the required gain or attenuation in dB.
  3133. Beware of clipping when using a positive gain.
  3134. @item mix, m
  3135. How much to use filtered signal in output. Default is 1.
  3136. Range is between 0 and 1.
  3137. @item channels, c
  3138. Specify which channels to filter, by default all available are filtered.
  3139. @item normalize, n
  3140. Normalize biquad coefficients, by default is disabled.
  3141. Enabling it will normalize magnitude response at DC to 0dB.
  3142. @item transform, a
  3143. Set transform type of IIR filter.
  3144. @table @option
  3145. @item di
  3146. @item dii
  3147. @item tdii
  3148. @item latt
  3149. @end table
  3150. @item precision, r
  3151. Set precison of filtering.
  3152. @table @option
  3153. @item auto
  3154. Pick automatic sample format depending on surround filters.
  3155. @item s16
  3156. Always use signed 16-bit.
  3157. @item s32
  3158. Always use signed 32-bit.
  3159. @item f32
  3160. Always use float 32-bit.
  3161. @item f64
  3162. Always use float 64-bit.
  3163. @end table
  3164. @end table
  3165. @subsection Examples
  3166. @itemize
  3167. @item
  3168. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3169. @example
  3170. equalizer=f=1000:t=h:width=200:g=-10
  3171. @end example
  3172. @item
  3173. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3174. @example
  3175. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3176. @end example
  3177. @end itemize
  3178. @subsection Commands
  3179. This filter supports the following commands:
  3180. @table @option
  3181. @item frequency, f
  3182. Change equalizer frequency.
  3183. Syntax for the command is : "@var{frequency}"
  3184. @item width_type, t
  3185. Change equalizer width_type.
  3186. Syntax for the command is : "@var{width_type}"
  3187. @item width, w
  3188. Change equalizer width.
  3189. Syntax for the command is : "@var{width}"
  3190. @item gain, g
  3191. Change equalizer gain.
  3192. Syntax for the command is : "@var{gain}"
  3193. @item mix, m
  3194. Change equalizer mix.
  3195. Syntax for the command is : "@var{mix}"
  3196. @end table
  3197. @section extrastereo
  3198. Linearly increases the difference between left and right channels which
  3199. adds some sort of "live" effect to playback.
  3200. The filter accepts the following options:
  3201. @table @option
  3202. @item m
  3203. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3204. (average of both channels), with 1.0 sound will be unchanged, with
  3205. -1.0 left and right channels will be swapped.
  3206. @item c
  3207. Enable clipping. By default is enabled.
  3208. @end table
  3209. @subsection Commands
  3210. This filter supports the all above options as @ref{commands}.
  3211. @section firequalizer
  3212. Apply FIR Equalization using arbitrary frequency response.
  3213. The filter accepts the following option:
  3214. @table @option
  3215. @item gain
  3216. Set gain curve equation (in dB). The expression can contain variables:
  3217. @table @option
  3218. @item f
  3219. the evaluated frequency
  3220. @item sr
  3221. sample rate
  3222. @item ch
  3223. channel number, set to 0 when multichannels evaluation is disabled
  3224. @item chid
  3225. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3226. multichannels evaluation is disabled
  3227. @item chs
  3228. number of channels
  3229. @item chlayout
  3230. channel_layout, see libavutil/channel_layout.h
  3231. @end table
  3232. and functions:
  3233. @table @option
  3234. @item gain_interpolate(f)
  3235. interpolate gain on frequency f based on gain_entry
  3236. @item cubic_interpolate(f)
  3237. same as gain_interpolate, but smoother
  3238. @end table
  3239. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3240. @item gain_entry
  3241. Set gain entry for gain_interpolate function. The expression can
  3242. contain functions:
  3243. @table @option
  3244. @item entry(f, g)
  3245. store gain entry at frequency f with value g
  3246. @end table
  3247. This option is also available as command.
  3248. @item delay
  3249. Set filter delay in seconds. Higher value means more accurate.
  3250. Default is @code{0.01}.
  3251. @item accuracy
  3252. Set filter accuracy in Hz. Lower value means more accurate.
  3253. Default is @code{5}.
  3254. @item wfunc
  3255. Set window function. Acceptable values are:
  3256. @table @option
  3257. @item rectangular
  3258. rectangular window, useful when gain curve is already smooth
  3259. @item hann
  3260. hann window (default)
  3261. @item hamming
  3262. hamming window
  3263. @item blackman
  3264. blackman window
  3265. @item nuttall3
  3266. 3-terms continuous 1st derivative nuttall window
  3267. @item mnuttall3
  3268. minimum 3-terms discontinuous nuttall window
  3269. @item nuttall
  3270. 4-terms continuous 1st derivative nuttall window
  3271. @item bnuttall
  3272. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3273. @item bharris
  3274. blackman-harris window
  3275. @item tukey
  3276. tukey window
  3277. @end table
  3278. @item fixed
  3279. If enabled, use fixed number of audio samples. This improves speed when
  3280. filtering with large delay. Default is disabled.
  3281. @item multi
  3282. Enable multichannels evaluation on gain. Default is disabled.
  3283. @item zero_phase
  3284. Enable zero phase mode by subtracting timestamp to compensate delay.
  3285. Default is disabled.
  3286. @item scale
  3287. Set scale used by gain. Acceptable values are:
  3288. @table @option
  3289. @item linlin
  3290. linear frequency, linear gain
  3291. @item linlog
  3292. linear frequency, logarithmic (in dB) gain (default)
  3293. @item loglin
  3294. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3295. @item loglog
  3296. logarithmic frequency, logarithmic gain
  3297. @end table
  3298. @item dumpfile
  3299. Set file for dumping, suitable for gnuplot.
  3300. @item dumpscale
  3301. Set scale for dumpfile. Acceptable values are same with scale option.
  3302. Default is linlog.
  3303. @item fft2
  3304. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3305. Default is disabled.
  3306. @item min_phase
  3307. Enable minimum phase impulse response. Default is disabled.
  3308. @end table
  3309. @subsection Examples
  3310. @itemize
  3311. @item
  3312. lowpass at 1000 Hz:
  3313. @example
  3314. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3315. @end example
  3316. @item
  3317. lowpass at 1000 Hz with gain_entry:
  3318. @example
  3319. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3320. @end example
  3321. @item
  3322. custom equalization:
  3323. @example
  3324. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3325. @end example
  3326. @item
  3327. higher delay with zero phase to compensate delay:
  3328. @example
  3329. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3330. @end example
  3331. @item
  3332. lowpass on left channel, highpass on right channel:
  3333. @example
  3334. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3335. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3336. @end example
  3337. @end itemize
  3338. @section flanger
  3339. Apply a flanging effect to the audio.
  3340. The filter accepts the following options:
  3341. @table @option
  3342. @item delay
  3343. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3344. @item depth
  3345. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3346. @item regen
  3347. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3348. Default value is 0.
  3349. @item width
  3350. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3351. Default value is 71.
  3352. @item speed
  3353. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3354. @item shape
  3355. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3356. Default value is @var{sinusoidal}.
  3357. @item phase
  3358. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3359. Default value is 25.
  3360. @item interp
  3361. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3362. Default is @var{linear}.
  3363. @end table
  3364. @section haas
  3365. Apply Haas effect to audio.
  3366. Note that this makes most sense to apply on mono signals.
  3367. With this filter applied to mono signals it give some directionality and
  3368. stretches its stereo image.
  3369. The filter accepts the following options:
  3370. @table @option
  3371. @item level_in
  3372. Set input level. By default is @var{1}, or 0dB
  3373. @item level_out
  3374. Set output level. By default is @var{1}, or 0dB.
  3375. @item side_gain
  3376. Set gain applied to side part of signal. By default is @var{1}.
  3377. @item middle_source
  3378. Set kind of middle source. Can be one of the following:
  3379. @table @samp
  3380. @item left
  3381. Pick left channel.
  3382. @item right
  3383. Pick right channel.
  3384. @item mid
  3385. Pick middle part signal of stereo image.
  3386. @item side
  3387. Pick side part signal of stereo image.
  3388. @end table
  3389. @item middle_phase
  3390. Change middle phase. By default is disabled.
  3391. @item left_delay
  3392. Set left channel delay. By default is @var{2.05} milliseconds.
  3393. @item left_balance
  3394. Set left channel balance. By default is @var{-1}.
  3395. @item left_gain
  3396. Set left channel gain. By default is @var{1}.
  3397. @item left_phase
  3398. Change left phase. By default is disabled.
  3399. @item right_delay
  3400. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3401. @item right_balance
  3402. Set right channel balance. By default is @var{1}.
  3403. @item right_gain
  3404. Set right channel gain. By default is @var{1}.
  3405. @item right_phase
  3406. Change right phase. By default is enabled.
  3407. @end table
  3408. @section hdcd
  3409. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3410. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3411. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3412. of HDCD, and detects the Transient Filter flag.
  3413. @example
  3414. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3415. @end example
  3416. When using the filter with wav, note the default encoding for wav is 16-bit,
  3417. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3418. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3419. @example
  3420. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3421. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3422. @end example
  3423. The filter accepts the following options:
  3424. @table @option
  3425. @item disable_autoconvert
  3426. Disable any automatic format conversion or resampling in the filter graph.
  3427. @item process_stereo
  3428. Process the stereo channels together. If target_gain does not match between
  3429. channels, consider it invalid and use the last valid target_gain.
  3430. @item cdt_ms
  3431. Set the code detect timer period in ms.
  3432. @item force_pe
  3433. Always extend peaks above -3dBFS even if PE isn't signaled.
  3434. @item analyze_mode
  3435. Replace audio with a solid tone and adjust the amplitude to signal some
  3436. specific aspect of the decoding process. The output file can be loaded in
  3437. an audio editor alongside the original to aid analysis.
  3438. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3439. Modes are:
  3440. @table @samp
  3441. @item 0, off
  3442. Disabled
  3443. @item 1, lle
  3444. Gain adjustment level at each sample
  3445. @item 2, pe
  3446. Samples where peak extend occurs
  3447. @item 3, cdt
  3448. Samples where the code detect timer is active
  3449. @item 4, tgm
  3450. Samples where the target gain does not match between channels
  3451. @end table
  3452. @end table
  3453. @section headphone
  3454. Apply head-related transfer functions (HRTFs) to create virtual
  3455. loudspeakers around the user for binaural listening via headphones.
  3456. The HRIRs are provided via additional streams, for each channel
  3457. one stereo input stream is needed.
  3458. The filter accepts the following options:
  3459. @table @option
  3460. @item map
  3461. Set mapping of input streams for convolution.
  3462. The argument is a '|'-separated list of channel names in order as they
  3463. are given as additional stream inputs for filter.
  3464. This also specify number of input streams. Number of input streams
  3465. must be not less than number of channels in first stream plus one.
  3466. @item gain
  3467. Set gain applied to audio. Value is in dB. Default is 0.
  3468. @item type
  3469. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3470. processing audio in time domain which is slow.
  3471. @var{freq} is processing audio in frequency domain which is fast.
  3472. Default is @var{freq}.
  3473. @item lfe
  3474. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3475. @item size
  3476. Set size of frame in number of samples which will be processed at once.
  3477. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3478. @item hrir
  3479. Set format of hrir stream.
  3480. Default value is @var{stereo}. Alternative value is @var{multich}.
  3481. If value is set to @var{stereo}, number of additional streams should
  3482. be greater or equal to number of input channels in first input stream.
  3483. Also each additional stream should have stereo number of channels.
  3484. If value is set to @var{multich}, number of additional streams should
  3485. be exactly one. Also number of input channels of additional stream
  3486. should be equal or greater than twice number of channels of first input
  3487. stream.
  3488. @end table
  3489. @subsection Examples
  3490. @itemize
  3491. @item
  3492. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3493. each amovie filter use stereo file with IR coefficients as input.
  3494. The files give coefficients for each position of virtual loudspeaker:
  3495. @example
  3496. ffmpeg -i input.wav
  3497. -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"
  3498. output.wav
  3499. @end example
  3500. @item
  3501. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3502. but now in @var{multich} @var{hrir} format.
  3503. @example
  3504. 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"
  3505. output.wav
  3506. @end example
  3507. @end itemize
  3508. @section highpass
  3509. Apply a high-pass filter with 3dB point frequency.
  3510. The filter can be either single-pole, or double-pole (the default).
  3511. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3512. The filter accepts the following options:
  3513. @table @option
  3514. @item frequency, f
  3515. Set frequency in Hz. Default is 3000.
  3516. @item poles, p
  3517. Set number of poles. Default is 2.
  3518. @item width_type, t
  3519. Set method to specify band-width of filter.
  3520. @table @option
  3521. @item h
  3522. Hz
  3523. @item q
  3524. Q-Factor
  3525. @item o
  3526. octave
  3527. @item s
  3528. slope
  3529. @item k
  3530. kHz
  3531. @end table
  3532. @item width, w
  3533. Specify the band-width of a filter in width_type units.
  3534. Applies only to double-pole filter.
  3535. The default is 0.707q and gives a Butterworth response.
  3536. @item mix, m
  3537. How much to use filtered signal in output. Default is 1.
  3538. Range is between 0 and 1.
  3539. @item channels, c
  3540. Specify which channels to filter, by default all available are filtered.
  3541. @item normalize, n
  3542. Normalize biquad coefficients, by default is disabled.
  3543. Enabling it will normalize magnitude response at DC to 0dB.
  3544. @item transform, a
  3545. Set transform type of IIR filter.
  3546. @table @option
  3547. @item di
  3548. @item dii
  3549. @item tdii
  3550. @item latt
  3551. @end table
  3552. @item precision, r
  3553. Set precison of filtering.
  3554. @table @option
  3555. @item auto
  3556. Pick automatic sample format depending on surround filters.
  3557. @item s16
  3558. Always use signed 16-bit.
  3559. @item s32
  3560. Always use signed 32-bit.
  3561. @item f32
  3562. Always use float 32-bit.
  3563. @item f64
  3564. Always use float 64-bit.
  3565. @end table
  3566. @end table
  3567. @subsection Commands
  3568. This filter supports the following commands:
  3569. @table @option
  3570. @item frequency, f
  3571. Change highpass frequency.
  3572. Syntax for the command is : "@var{frequency}"
  3573. @item width_type, t
  3574. Change highpass width_type.
  3575. Syntax for the command is : "@var{width_type}"
  3576. @item width, w
  3577. Change highpass width.
  3578. Syntax for the command is : "@var{width}"
  3579. @item mix, m
  3580. Change highpass mix.
  3581. Syntax for the command is : "@var{mix}"
  3582. @end table
  3583. @section join
  3584. Join multiple input streams into one multi-channel stream.
  3585. It accepts the following parameters:
  3586. @table @option
  3587. @item inputs
  3588. The number of input streams. It defaults to 2.
  3589. @item channel_layout
  3590. The desired output channel layout. It defaults to stereo.
  3591. @item map
  3592. Map channels from inputs to output. The argument is a '|'-separated list of
  3593. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3594. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3595. can be either the name of the input channel (e.g. FL for front left) or its
  3596. index in the specified input stream. @var{out_channel} is the name of the output
  3597. channel.
  3598. @end table
  3599. The filter will attempt to guess the mappings when they are not specified
  3600. explicitly. It does so by first trying to find an unused matching input channel
  3601. and if that fails it picks the first unused input channel.
  3602. Join 3 inputs (with properly set channel layouts):
  3603. @example
  3604. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3605. @end example
  3606. Build a 5.1 output from 6 single-channel streams:
  3607. @example
  3608. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3609. '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'
  3610. out
  3611. @end example
  3612. @section ladspa
  3613. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3614. To enable compilation of this filter you need to configure FFmpeg with
  3615. @code{--enable-ladspa}.
  3616. @table @option
  3617. @item file, f
  3618. Specifies the name of LADSPA plugin library to load. If the environment
  3619. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3620. each one of the directories specified by the colon separated list in
  3621. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3622. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3623. @file{/usr/lib/ladspa/}.
  3624. @item plugin, p
  3625. Specifies the plugin within the library. Some libraries contain only
  3626. one plugin, but others contain many of them. If this is not set filter
  3627. will list all available plugins within the specified library.
  3628. @item controls, c
  3629. Set the '|' separated list of controls which are zero or more floating point
  3630. values that determine the behavior of the loaded plugin (for example delay,
  3631. threshold or gain).
  3632. Controls need to be defined using the following syntax:
  3633. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3634. @var{valuei} is the value set on the @var{i}-th control.
  3635. Alternatively they can be also defined using the following syntax:
  3636. @var{value0}|@var{value1}|@var{value2}|..., where
  3637. @var{valuei} is the value set on the @var{i}-th control.
  3638. If @option{controls} is set to @code{help}, all available controls and
  3639. their valid ranges are printed.
  3640. @item sample_rate, s
  3641. Specify the sample rate, default to 44100. Only used if plugin have
  3642. zero inputs.
  3643. @item nb_samples, n
  3644. Set the number of samples per channel per each output frame, default
  3645. is 1024. Only used if plugin have zero inputs.
  3646. @item duration, d
  3647. Set the minimum duration of the sourced audio. See
  3648. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3649. for the accepted syntax.
  3650. Note that the resulting duration may be greater than the specified duration,
  3651. as the generated audio is always cut at the end of a complete frame.
  3652. If not specified, or the expressed duration is negative, the audio is
  3653. supposed to be generated forever.
  3654. Only used if plugin have zero inputs.
  3655. @item latency, l
  3656. Enable latency compensation, by default is disabled.
  3657. Only used if plugin have inputs.
  3658. @end table
  3659. @subsection Examples
  3660. @itemize
  3661. @item
  3662. List all available plugins within amp (LADSPA example plugin) library:
  3663. @example
  3664. ladspa=file=amp
  3665. @end example
  3666. @item
  3667. List all available controls and their valid ranges for @code{vcf_notch}
  3668. plugin from @code{VCF} library:
  3669. @example
  3670. ladspa=f=vcf:p=vcf_notch:c=help
  3671. @end example
  3672. @item
  3673. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3674. plugin library:
  3675. @example
  3676. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3677. @end example
  3678. @item
  3679. Add reverberation to the audio using TAP-plugins
  3680. (Tom's Audio Processing plugins):
  3681. @example
  3682. ladspa=file=tap_reverb:tap_reverb
  3683. @end example
  3684. @item
  3685. Generate white noise, with 0.2 amplitude:
  3686. @example
  3687. ladspa=file=cmt:noise_source_white:c=c0=.2
  3688. @end example
  3689. @item
  3690. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3691. @code{C* Audio Plugin Suite} (CAPS) library:
  3692. @example
  3693. ladspa=file=caps:Click:c=c1=20'
  3694. @end example
  3695. @item
  3696. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3697. @example
  3698. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3699. @end example
  3700. @item
  3701. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3702. @code{SWH Plugins} collection:
  3703. @example
  3704. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3705. @end example
  3706. @item
  3707. Attenuate low frequencies using Multiband EQ from Steve Harris
  3708. @code{SWH Plugins} collection:
  3709. @example
  3710. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3711. @end example
  3712. @item
  3713. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3714. (CAPS) library:
  3715. @example
  3716. ladspa=caps:Narrower
  3717. @end example
  3718. @item
  3719. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3720. @example
  3721. ladspa=caps:White:.2
  3722. @end example
  3723. @item
  3724. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3725. @example
  3726. ladspa=caps:Fractal:c=c1=1
  3727. @end example
  3728. @item
  3729. Dynamic volume normalization using @code{VLevel} plugin:
  3730. @example
  3731. ladspa=vlevel-ladspa:vlevel_mono
  3732. @end example
  3733. @end itemize
  3734. @subsection Commands
  3735. This filter supports the following commands:
  3736. @table @option
  3737. @item cN
  3738. Modify the @var{N}-th control value.
  3739. If the specified value is not valid, it is ignored and prior one is kept.
  3740. @end table
  3741. @section loudnorm
  3742. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3743. Support for both single pass (livestreams, files) and double pass (files) modes.
  3744. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3745. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3746. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3747. The filter accepts the following options:
  3748. @table @option
  3749. @item I, i
  3750. Set integrated loudness target.
  3751. Range is -70.0 - -5.0. Default value is -24.0.
  3752. @item LRA, lra
  3753. Set loudness range target.
  3754. Range is 1.0 - 20.0. Default value is 7.0.
  3755. @item TP, tp
  3756. Set maximum true peak.
  3757. Range is -9.0 - +0.0. Default value is -2.0.
  3758. @item measured_I, measured_i
  3759. Measured IL of input file.
  3760. Range is -99.0 - +0.0.
  3761. @item measured_LRA, measured_lra
  3762. Measured LRA of input file.
  3763. Range is 0.0 - 99.0.
  3764. @item measured_TP, measured_tp
  3765. Measured true peak of input file.
  3766. Range is -99.0 - +99.0.
  3767. @item measured_thresh
  3768. Measured threshold of input file.
  3769. Range is -99.0 - +0.0.
  3770. @item offset
  3771. Set offset gain. Gain is applied before the true-peak limiter.
  3772. Range is -99.0 - +99.0. Default is +0.0.
  3773. @item linear
  3774. Normalize by linearly scaling the source audio.
  3775. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3776. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3777. be lower than source LRA and the change in integrated loudness shouldn't
  3778. result in a true peak which exceeds the target TP. If any of these
  3779. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3780. Options are @code{true} or @code{false}. Default is @code{true}.
  3781. @item dual_mono
  3782. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3783. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3784. If set to @code{true}, this option will compensate for this effect.
  3785. Multi-channel input files are not affected by this option.
  3786. Options are true or false. Default is false.
  3787. @item print_format
  3788. Set print format for stats. Options are summary, json, or none.
  3789. Default value is none.
  3790. @end table
  3791. @section lowpass
  3792. Apply a low-pass filter with 3dB point frequency.
  3793. The filter can be either single-pole or double-pole (the default).
  3794. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3795. The filter accepts the following options:
  3796. @table @option
  3797. @item frequency, f
  3798. Set frequency in Hz. Default is 500.
  3799. @item poles, p
  3800. Set number of poles. Default is 2.
  3801. @item width_type, t
  3802. Set method to specify band-width of filter.
  3803. @table @option
  3804. @item h
  3805. Hz
  3806. @item q
  3807. Q-Factor
  3808. @item o
  3809. octave
  3810. @item s
  3811. slope
  3812. @item k
  3813. kHz
  3814. @end table
  3815. @item width, w
  3816. Specify the band-width of a filter in width_type units.
  3817. Applies only to double-pole filter.
  3818. The default is 0.707q and gives a Butterworth response.
  3819. @item mix, m
  3820. How much to use filtered signal in output. Default is 1.
  3821. Range is between 0 and 1.
  3822. @item channels, c
  3823. Specify which channels to filter, by default all available are filtered.
  3824. @item normalize, n
  3825. Normalize biquad coefficients, by default is disabled.
  3826. Enabling it will normalize magnitude response at DC to 0dB.
  3827. @item transform, a
  3828. Set transform type of IIR filter.
  3829. @table @option
  3830. @item di
  3831. @item dii
  3832. @item tdii
  3833. @item latt
  3834. @end table
  3835. @item precision, r
  3836. Set precison of filtering.
  3837. @table @option
  3838. @item auto
  3839. Pick automatic sample format depending on surround filters.
  3840. @item s16
  3841. Always use signed 16-bit.
  3842. @item s32
  3843. Always use signed 32-bit.
  3844. @item f32
  3845. Always use float 32-bit.
  3846. @item f64
  3847. Always use float 64-bit.
  3848. @end table
  3849. @end table
  3850. @subsection Examples
  3851. @itemize
  3852. @item
  3853. Lowpass only LFE channel, it LFE is not present it does nothing:
  3854. @example
  3855. lowpass=c=LFE
  3856. @end example
  3857. @end itemize
  3858. @subsection Commands
  3859. This filter supports the following commands:
  3860. @table @option
  3861. @item frequency, f
  3862. Change lowpass frequency.
  3863. Syntax for the command is : "@var{frequency}"
  3864. @item width_type, t
  3865. Change lowpass width_type.
  3866. Syntax for the command is : "@var{width_type}"
  3867. @item width, w
  3868. Change lowpass width.
  3869. Syntax for the command is : "@var{width}"
  3870. @item mix, m
  3871. Change lowpass mix.
  3872. Syntax for the command is : "@var{mix}"
  3873. @end table
  3874. @section lv2
  3875. Load a LV2 (LADSPA Version 2) plugin.
  3876. To enable compilation of this filter you need to configure FFmpeg with
  3877. @code{--enable-lv2}.
  3878. @table @option
  3879. @item plugin, p
  3880. Specifies the plugin URI. You may need to escape ':'.
  3881. @item controls, c
  3882. Set the '|' separated list of controls which are zero or more floating point
  3883. values that determine the behavior of the loaded plugin (for example delay,
  3884. threshold or gain).
  3885. If @option{controls} is set to @code{help}, all available controls and
  3886. their valid ranges are printed.
  3887. @item sample_rate, s
  3888. Specify the sample rate, default to 44100. Only used if plugin have
  3889. zero inputs.
  3890. @item nb_samples, n
  3891. Set the number of samples per channel per each output frame, default
  3892. is 1024. Only used if plugin have zero inputs.
  3893. @item duration, d
  3894. Set the minimum duration of the sourced audio. See
  3895. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3896. for the accepted syntax.
  3897. Note that the resulting duration may be greater than the specified duration,
  3898. as the generated audio is always cut at the end of a complete frame.
  3899. If not specified, or the expressed duration is negative, the audio is
  3900. supposed to be generated forever.
  3901. Only used if plugin have zero inputs.
  3902. @end table
  3903. @subsection Examples
  3904. @itemize
  3905. @item
  3906. Apply bass enhancer plugin from Calf:
  3907. @example
  3908. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3909. @end example
  3910. @item
  3911. Apply vinyl plugin from Calf:
  3912. @example
  3913. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3914. @end example
  3915. @item
  3916. Apply bit crusher plugin from ArtyFX:
  3917. @example
  3918. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3919. @end example
  3920. @end itemize
  3921. @section mcompand
  3922. Multiband Compress or expand the audio's dynamic range.
  3923. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3924. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3925. response when absent compander action.
  3926. It accepts the following parameters:
  3927. @table @option
  3928. @item args
  3929. This option syntax is:
  3930. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3931. For explanation of each item refer to compand filter documentation.
  3932. @end table
  3933. @anchor{pan}
  3934. @section pan
  3935. Mix channels with specific gain levels. The filter accepts the output
  3936. channel layout followed by a set of channels definitions.
  3937. This filter is also designed to efficiently remap the channels of an audio
  3938. stream.
  3939. The filter accepts parameters of the form:
  3940. "@var{l}|@var{outdef}|@var{outdef}|..."
  3941. @table @option
  3942. @item l
  3943. output channel layout or number of channels
  3944. @item outdef
  3945. output channel specification, of the form:
  3946. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3947. @item out_name
  3948. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3949. number (c0, c1, etc.)
  3950. @item gain
  3951. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3952. @item in_name
  3953. input channel to use, see out_name for details; it is not possible to mix
  3954. named and numbered input channels
  3955. @end table
  3956. If the `=' in a channel specification is replaced by `<', then the gains for
  3957. that specification will be renormalized so that the total is 1, thus
  3958. avoiding clipping noise.
  3959. @subsection Mixing examples
  3960. For example, if you want to down-mix from stereo to mono, but with a bigger
  3961. factor for the left channel:
  3962. @example
  3963. pan=1c|c0=0.9*c0+0.1*c1
  3964. @end example
  3965. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3966. 7-channels surround:
  3967. @example
  3968. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3969. @end example
  3970. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3971. that should be preferred (see "-ac" option) unless you have very specific
  3972. needs.
  3973. @subsection Remapping examples
  3974. The channel remapping will be effective if, and only if:
  3975. @itemize
  3976. @item gain coefficients are zeroes or ones,
  3977. @item only one input per channel output,
  3978. @end itemize
  3979. If all these conditions are satisfied, the filter will notify the user ("Pure
  3980. channel mapping detected"), and use an optimized and lossless method to do the
  3981. remapping.
  3982. For example, if you have a 5.1 source and want a stereo audio stream by
  3983. dropping the extra channels:
  3984. @example
  3985. pan="stereo| c0=FL | c1=FR"
  3986. @end example
  3987. Given the same source, you can also switch front left and front right channels
  3988. and keep the input channel layout:
  3989. @example
  3990. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3991. @end example
  3992. If the input is a stereo audio stream, you can mute the front left channel (and
  3993. still keep the stereo channel layout) with:
  3994. @example
  3995. pan="stereo|c1=c1"
  3996. @end example
  3997. Still with a stereo audio stream input, you can copy the right channel in both
  3998. front left and right:
  3999. @example
  4000. pan="stereo| c0=FR | c1=FR"
  4001. @end example
  4002. @section replaygain
  4003. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4004. outputs it unchanged.
  4005. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4006. @section resample
  4007. Convert the audio sample format, sample rate and channel layout. It is
  4008. not meant to be used directly.
  4009. @section rubberband
  4010. Apply time-stretching and pitch-shifting with librubberband.
  4011. To enable compilation of this filter, you need to configure FFmpeg with
  4012. @code{--enable-librubberband}.
  4013. The filter accepts the following options:
  4014. @table @option
  4015. @item tempo
  4016. Set tempo scale factor.
  4017. @item pitch
  4018. Set pitch scale factor.
  4019. @item transients
  4020. Set transients detector.
  4021. Possible values are:
  4022. @table @var
  4023. @item crisp
  4024. @item mixed
  4025. @item smooth
  4026. @end table
  4027. @item detector
  4028. Set detector.
  4029. Possible values are:
  4030. @table @var
  4031. @item compound
  4032. @item percussive
  4033. @item soft
  4034. @end table
  4035. @item phase
  4036. Set phase.
  4037. Possible values are:
  4038. @table @var
  4039. @item laminar
  4040. @item independent
  4041. @end table
  4042. @item window
  4043. Set processing window size.
  4044. Possible values are:
  4045. @table @var
  4046. @item standard
  4047. @item short
  4048. @item long
  4049. @end table
  4050. @item smoothing
  4051. Set smoothing.
  4052. Possible values are:
  4053. @table @var
  4054. @item off
  4055. @item on
  4056. @end table
  4057. @item formant
  4058. Enable formant preservation when shift pitching.
  4059. Possible values are:
  4060. @table @var
  4061. @item shifted
  4062. @item preserved
  4063. @end table
  4064. @item pitchq
  4065. Set pitch quality.
  4066. Possible values are:
  4067. @table @var
  4068. @item quality
  4069. @item speed
  4070. @item consistency
  4071. @end table
  4072. @item channels
  4073. Set channels.
  4074. Possible values are:
  4075. @table @var
  4076. @item apart
  4077. @item together
  4078. @end table
  4079. @end table
  4080. @subsection Commands
  4081. This filter supports the following commands:
  4082. @table @option
  4083. @item tempo
  4084. Change filter tempo scale factor.
  4085. Syntax for the command is : "@var{tempo}"
  4086. @item pitch
  4087. Change filter pitch scale factor.
  4088. Syntax for the command is : "@var{pitch}"
  4089. @end table
  4090. @section sidechaincompress
  4091. This filter acts like normal compressor but has the ability to compress
  4092. detected signal using second input signal.
  4093. It needs two input streams and returns one output stream.
  4094. First input stream will be processed depending on second stream signal.
  4095. The filtered signal then can be filtered with other filters in later stages of
  4096. processing. See @ref{pan} and @ref{amerge} filter.
  4097. The filter accepts the following options:
  4098. @table @option
  4099. @item level_in
  4100. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4101. @item mode
  4102. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4103. Default is @code{downward}.
  4104. @item threshold
  4105. If a signal of second stream raises above this level it will affect the gain
  4106. reduction of first stream.
  4107. By default is 0.125. Range is between 0.00097563 and 1.
  4108. @item ratio
  4109. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4110. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4111. Default is 2. Range is between 1 and 20.
  4112. @item attack
  4113. Amount of milliseconds the signal has to rise above the threshold before gain
  4114. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4115. @item release
  4116. Amount of milliseconds the signal has to fall below the threshold before
  4117. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4118. @item makeup
  4119. Set the amount by how much signal will be amplified after processing.
  4120. Default is 1. Range is from 1 to 64.
  4121. @item knee
  4122. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4123. Default is 2.82843. Range is between 1 and 8.
  4124. @item link
  4125. Choose if the @code{average} level between all channels of side-chain stream
  4126. or the louder(@code{maximum}) channel of side-chain stream affects the
  4127. reduction. Default is @code{average}.
  4128. @item detection
  4129. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4130. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4131. @item level_sc
  4132. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4133. @item mix
  4134. How much to use compressed signal in output. Default is 1.
  4135. Range is between 0 and 1.
  4136. @end table
  4137. @subsection Commands
  4138. This filter supports the all above options as @ref{commands}.
  4139. @subsection Examples
  4140. @itemize
  4141. @item
  4142. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4143. depending on the signal of 2nd input and later compressed signal to be
  4144. merged with 2nd input:
  4145. @example
  4146. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4147. @end example
  4148. @end itemize
  4149. @section sidechaingate
  4150. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4151. filter the detected signal before sending it to the gain reduction stage.
  4152. Normally a gate uses the full range signal to detect a level above the
  4153. threshold.
  4154. For example: If you cut all lower frequencies from your sidechain signal
  4155. the gate will decrease the volume of your track only if not enough highs
  4156. appear. With this technique you are able to reduce the resonation of a
  4157. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4158. guitar.
  4159. It needs two input streams and returns one output stream.
  4160. First input stream will be processed depending on second stream signal.
  4161. The filter accepts the following options:
  4162. @table @option
  4163. @item level_in
  4164. Set input level before filtering.
  4165. Default is 1. Allowed range is from 0.015625 to 64.
  4166. @item mode
  4167. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4168. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4169. will be amplified, expanding dynamic range in upward direction.
  4170. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4171. @item range
  4172. Set the level of gain reduction when the signal is below the threshold.
  4173. Default is 0.06125. Allowed range is from 0 to 1.
  4174. Setting this to 0 disables reduction and then filter behaves like expander.
  4175. @item threshold
  4176. If a signal rises above this level the gain reduction is released.
  4177. Default is 0.125. Allowed range is from 0 to 1.
  4178. @item ratio
  4179. Set a ratio about which the signal is reduced.
  4180. Default is 2. Allowed range is from 1 to 9000.
  4181. @item attack
  4182. Amount of milliseconds the signal has to rise above the threshold before gain
  4183. reduction stops.
  4184. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4185. @item release
  4186. Amount of milliseconds the signal has to fall below the threshold before the
  4187. reduction is increased again. Default is 250 milliseconds.
  4188. Allowed range is from 0.01 to 9000.
  4189. @item makeup
  4190. Set amount of amplification of signal after processing.
  4191. Default is 1. Allowed range is from 1 to 64.
  4192. @item knee
  4193. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4194. Default is 2.828427125. Allowed range is from 1 to 8.
  4195. @item detection
  4196. Choose if exact signal should be taken for detection or an RMS like one.
  4197. Default is rms. Can be peak or rms.
  4198. @item link
  4199. Choose if the average level between all channels or the louder channel affects
  4200. the reduction.
  4201. Default is average. Can be average or maximum.
  4202. @item level_sc
  4203. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4204. @end table
  4205. @subsection Commands
  4206. This filter supports the all above options as @ref{commands}.
  4207. @section silencedetect
  4208. Detect silence in an audio stream.
  4209. This filter logs a message when it detects that the input audio volume is less
  4210. or equal to a noise tolerance value for a duration greater or equal to the
  4211. minimum detected noise duration.
  4212. The printed times and duration are expressed in seconds. The
  4213. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4214. is set on the first frame whose timestamp equals or exceeds the detection
  4215. duration and it contains the timestamp of the first frame of the silence.
  4216. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4217. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4218. keys are set on the first frame after the silence. If @option{mono} is
  4219. enabled, and each channel is evaluated separately, the @code{.X}
  4220. suffixed keys are used, and @code{X} corresponds to the channel number.
  4221. The filter accepts the following options:
  4222. @table @option
  4223. @item noise, n
  4224. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4225. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4226. @item duration, d
  4227. Set silence duration until notification (default is 2 seconds). See
  4228. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4229. for the accepted syntax.
  4230. @item mono, m
  4231. Process each channel separately, instead of combined. By default is disabled.
  4232. @end table
  4233. @subsection Examples
  4234. @itemize
  4235. @item
  4236. Detect 5 seconds of silence with -50dB noise tolerance:
  4237. @example
  4238. silencedetect=n=-50dB:d=5
  4239. @end example
  4240. @item
  4241. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4242. tolerance in @file{silence.mp3}:
  4243. @example
  4244. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4245. @end example
  4246. @end itemize
  4247. @section silenceremove
  4248. Remove silence from the beginning, middle or end of the audio.
  4249. The filter accepts the following options:
  4250. @table @option
  4251. @item start_periods
  4252. This value is used to indicate if audio should be trimmed at beginning of
  4253. the audio. A value of zero indicates no silence should be trimmed from the
  4254. beginning. When specifying a non-zero value, it trims audio up until it
  4255. finds non-silence. Normally, when trimming silence from beginning of audio
  4256. the @var{start_periods} will be @code{1} but it can be increased to higher
  4257. values to trim all audio up to specific count of non-silence periods.
  4258. Default value is @code{0}.
  4259. @item start_duration
  4260. Specify the amount of time that non-silence must be detected before it stops
  4261. trimming audio. By increasing the duration, bursts of noises can be treated
  4262. as silence and trimmed off. Default value is @code{0}.
  4263. @item start_threshold
  4264. This indicates what sample value should be treated as silence. For digital
  4265. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4266. you may wish to increase the value to account for background noise.
  4267. Can be specified in dB (in case "dB" is appended to the specified value)
  4268. or amplitude ratio. Default value is @code{0}.
  4269. @item start_silence
  4270. Specify max duration of silence at beginning that will be kept after
  4271. trimming. Default is 0, which is equal to trimming all samples detected
  4272. as silence.
  4273. @item start_mode
  4274. Specify mode of detection of silence end in start of multi-channel audio.
  4275. Can be @var{any} or @var{all}. Default is @var{any}.
  4276. With @var{any}, any sample that is detected as non-silence will cause
  4277. stopped trimming of silence.
  4278. With @var{all}, only if all channels are detected as non-silence will cause
  4279. stopped trimming of silence.
  4280. @item stop_periods
  4281. Set the count for trimming silence from the end of audio.
  4282. To remove silence from the middle of a file, specify a @var{stop_periods}
  4283. that is negative. This value is then treated as a positive value and is
  4284. used to indicate the effect should restart processing as specified by
  4285. @var{start_periods}, making it suitable for removing periods of silence
  4286. in the middle of the audio.
  4287. Default value is @code{0}.
  4288. @item stop_duration
  4289. Specify a duration of silence that must exist before audio is not copied any
  4290. more. By specifying a higher duration, silence that is wanted can be left in
  4291. the audio.
  4292. Default value is @code{0}.
  4293. @item stop_threshold
  4294. This is the same as @option{start_threshold} but for trimming silence from
  4295. the end of audio.
  4296. Can be specified in dB (in case "dB" is appended to the specified value)
  4297. or amplitude ratio. Default value is @code{0}.
  4298. @item stop_silence
  4299. Specify max duration of silence at end that will be kept after
  4300. trimming. Default is 0, which is equal to trimming all samples detected
  4301. as silence.
  4302. @item stop_mode
  4303. Specify mode of detection of silence start in end of multi-channel audio.
  4304. Can be @var{any} or @var{all}. Default is @var{any}.
  4305. With @var{any}, any sample that is detected as non-silence will cause
  4306. stopped trimming of silence.
  4307. With @var{all}, only if all channels are detected as non-silence will cause
  4308. stopped trimming of silence.
  4309. @item detection
  4310. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4311. and works better with digital silence which is exactly 0.
  4312. Default value is @code{rms}.
  4313. @item window
  4314. Set duration in number of seconds used to calculate size of window in number
  4315. of samples for detecting silence.
  4316. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4317. @end table
  4318. @subsection Examples
  4319. @itemize
  4320. @item
  4321. The following example shows how this filter can be used to start a recording
  4322. that does not contain the delay at the start which usually occurs between
  4323. pressing the record button and the start of the performance:
  4324. @example
  4325. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4326. @end example
  4327. @item
  4328. Trim all silence encountered from beginning to end where there is more than 1
  4329. second of silence in audio:
  4330. @example
  4331. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4332. @end example
  4333. @item
  4334. Trim all digital silence samples, using peak detection, from beginning to end
  4335. where there is more than 0 samples of digital silence in audio and digital
  4336. silence is detected in all channels at same positions in stream:
  4337. @example
  4338. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4339. @end example
  4340. @end itemize
  4341. @section sofalizer
  4342. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4343. loudspeakers around the user for binaural listening via headphones (audio
  4344. formats up to 9 channels supported).
  4345. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4346. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4347. Austrian Academy of Sciences.
  4348. To enable compilation of this filter you need to configure FFmpeg with
  4349. @code{--enable-libmysofa}.
  4350. The filter accepts the following options:
  4351. @table @option
  4352. @item sofa
  4353. Set the SOFA file used for rendering.
  4354. @item gain
  4355. Set gain applied to audio. Value is in dB. Default is 0.
  4356. @item rotation
  4357. Set rotation of virtual loudspeakers in deg. Default is 0.
  4358. @item elevation
  4359. Set elevation of virtual speakers in deg. Default is 0.
  4360. @item radius
  4361. Set distance in meters between loudspeakers and the listener with near-field
  4362. HRTFs. Default is 1.
  4363. @item type
  4364. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4365. processing audio in time domain which is slow.
  4366. @var{freq} is processing audio in frequency domain which is fast.
  4367. Default is @var{freq}.
  4368. @item speakers
  4369. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4370. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4371. Each virtual loudspeaker is described with short channel name following with
  4372. azimuth and elevation in degrees.
  4373. Each virtual loudspeaker description is separated by '|'.
  4374. For example to override front left and front right channel positions use:
  4375. 'speakers=FL 45 15|FR 345 15'.
  4376. Descriptions with unrecognised channel names are ignored.
  4377. @item lfegain
  4378. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4379. @item framesize
  4380. Set custom frame size in number of samples. Default is 1024.
  4381. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4382. is set to @var{freq}.
  4383. @item normalize
  4384. Should all IRs be normalized upon importing SOFA file.
  4385. By default is enabled.
  4386. @item interpolate
  4387. Should nearest IRs be interpolated with neighbor IRs if exact position
  4388. does not match. By default is disabled.
  4389. @item minphase
  4390. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4391. @item anglestep
  4392. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4393. @item radstep
  4394. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4395. @end table
  4396. @subsection Examples
  4397. @itemize
  4398. @item
  4399. Using ClubFritz6 sofa file:
  4400. @example
  4401. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4402. @end example
  4403. @item
  4404. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4405. @example
  4406. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4407. @end example
  4408. @item
  4409. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4410. and also with custom gain:
  4411. @example
  4412. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4413. @end example
  4414. @end itemize
  4415. @section speechnorm
  4416. Speech Normalizer.
  4417. This filter expands or compresses each half-cycle of audio samples
  4418. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4419. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4420. The filter accepts the following options:
  4421. @table @option
  4422. @item peak, p
  4423. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4424. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4425. @item expansion, e
  4426. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4427. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4428. would be such that local peak value reaches target peak value but never to surpass it and that
  4429. ratio between new and previous peak value does not surpass this option value.
  4430. @item compression, c
  4431. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4432. This option controls maximum local half-cycle of samples compression. This option is used
  4433. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4434. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4435. that peak's half-cycle will be compressed by current compression factor.
  4436. @item threshold, t
  4437. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4438. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4439. Any half-cycle samples with their local peak value below or same as this option value will be
  4440. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4441. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4442. @item raise, r
  4443. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4444. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4445. each new half-cycle until it reaches @option{expansion} value.
  4446. Setting this options too high may lead to distortions.
  4447. @item fall, f
  4448. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4449. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4450. each new half-cycle until it reaches @option{compression} value.
  4451. @item channels, h
  4452. Specify which channels to filter, by default all available channels are filtered.
  4453. @item invert, i
  4454. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4455. option. When enabled any half-cycle of samples with their local peak value below or same as
  4456. @option{threshold} option will be expanded otherwise it will be compressed.
  4457. @item link, l
  4458. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4459. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4460. is enabled the minimum of all possible gains for each filtered channel is used.
  4461. @end table
  4462. @subsection Commands
  4463. This filter supports the all above options as @ref{commands}.
  4464. @section stereotools
  4465. This filter has some handy utilities to manage stereo signals, for converting
  4466. M/S stereo recordings to L/R signal while having control over the parameters
  4467. or spreading the stereo image of master track.
  4468. The filter accepts the following options:
  4469. @table @option
  4470. @item level_in
  4471. Set input level before filtering for both channels. Defaults is 1.
  4472. Allowed range is from 0.015625 to 64.
  4473. @item level_out
  4474. Set output level after filtering for both channels. Defaults is 1.
  4475. Allowed range is from 0.015625 to 64.
  4476. @item balance_in
  4477. Set input balance between both channels. Default is 0.
  4478. Allowed range is from -1 to 1.
  4479. @item balance_out
  4480. Set output balance between both channels. Default is 0.
  4481. Allowed range is from -1 to 1.
  4482. @item softclip
  4483. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4484. clipping. Disabled by default.
  4485. @item mutel
  4486. Mute the left channel. Disabled by default.
  4487. @item muter
  4488. Mute the right channel. Disabled by default.
  4489. @item phasel
  4490. Change the phase of the left channel. Disabled by default.
  4491. @item phaser
  4492. Change the phase of the right channel. Disabled by default.
  4493. @item mode
  4494. Set stereo mode. Available values are:
  4495. @table @samp
  4496. @item lr>lr
  4497. Left/Right to Left/Right, this is default.
  4498. @item lr>ms
  4499. Left/Right to Mid/Side.
  4500. @item ms>lr
  4501. Mid/Side to Left/Right.
  4502. @item lr>ll
  4503. Left/Right to Left/Left.
  4504. @item lr>rr
  4505. Left/Right to Right/Right.
  4506. @item lr>l+r
  4507. Left/Right to Left + Right.
  4508. @item lr>rl
  4509. Left/Right to Right/Left.
  4510. @item ms>ll
  4511. Mid/Side to Left/Left.
  4512. @item ms>rr
  4513. Mid/Side to Right/Right.
  4514. @item ms>rl
  4515. Mid/Side to Right/Left.
  4516. @item lr>l-r
  4517. Left/Right to Left - Right.
  4518. @end table
  4519. @item slev
  4520. Set level of side signal. Default is 1.
  4521. Allowed range is from 0.015625 to 64.
  4522. @item sbal
  4523. Set balance of side signal. Default is 0.
  4524. Allowed range is from -1 to 1.
  4525. @item mlev
  4526. Set level of the middle signal. Default is 1.
  4527. Allowed range is from 0.015625 to 64.
  4528. @item mpan
  4529. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4530. @item base
  4531. Set stereo base between mono and inversed channels. Default is 0.
  4532. Allowed range is from -1 to 1.
  4533. @item delay
  4534. Set delay in milliseconds how much to delay left from right channel and
  4535. vice versa. Default is 0. Allowed range is from -20 to 20.
  4536. @item sclevel
  4537. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4538. @item phase
  4539. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4540. @item bmode_in, bmode_out
  4541. Set balance mode for balance_in/balance_out option.
  4542. Can be one of the following:
  4543. @table @samp
  4544. @item balance
  4545. Classic balance mode. Attenuate one channel at time.
  4546. Gain is raised up to 1.
  4547. @item amplitude
  4548. Similar as classic mode above but gain is raised up to 2.
  4549. @item power
  4550. Equal power distribution, from -6dB to +6dB range.
  4551. @end table
  4552. @end table
  4553. @subsection Commands
  4554. This filter supports the all above options as @ref{commands}.
  4555. @subsection Examples
  4556. @itemize
  4557. @item
  4558. Apply karaoke like effect:
  4559. @example
  4560. stereotools=mlev=0.015625
  4561. @end example
  4562. @item
  4563. Convert M/S signal to L/R:
  4564. @example
  4565. "stereotools=mode=ms>lr"
  4566. @end example
  4567. @end itemize
  4568. @section stereowiden
  4569. This filter enhance the stereo effect by suppressing signal common to both
  4570. channels and by delaying the signal of left into right and vice versa,
  4571. thereby widening the stereo effect.
  4572. The filter accepts the following options:
  4573. @table @option
  4574. @item delay
  4575. Time in milliseconds of the delay of left signal into right and vice versa.
  4576. Default is 20 milliseconds.
  4577. @item feedback
  4578. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4579. effect of left signal in right output and vice versa which gives widening
  4580. effect. Default is 0.3.
  4581. @item crossfeed
  4582. Cross feed of left into right with inverted phase. This helps in suppressing
  4583. the mono. If the value is 1 it will cancel all the signal common to both
  4584. channels. Default is 0.3.
  4585. @item drymix
  4586. Set level of input signal of original channel. Default is 0.8.
  4587. @end table
  4588. @subsection Commands
  4589. This filter supports the all above options except @code{delay} as @ref{commands}.
  4590. @section superequalizer
  4591. Apply 18 band equalizer.
  4592. The filter accepts the following options:
  4593. @table @option
  4594. @item 1b
  4595. Set 65Hz band gain.
  4596. @item 2b
  4597. Set 92Hz band gain.
  4598. @item 3b
  4599. Set 131Hz band gain.
  4600. @item 4b
  4601. Set 185Hz band gain.
  4602. @item 5b
  4603. Set 262Hz band gain.
  4604. @item 6b
  4605. Set 370Hz band gain.
  4606. @item 7b
  4607. Set 523Hz band gain.
  4608. @item 8b
  4609. Set 740Hz band gain.
  4610. @item 9b
  4611. Set 1047Hz band gain.
  4612. @item 10b
  4613. Set 1480Hz band gain.
  4614. @item 11b
  4615. Set 2093Hz band gain.
  4616. @item 12b
  4617. Set 2960Hz band gain.
  4618. @item 13b
  4619. Set 4186Hz band gain.
  4620. @item 14b
  4621. Set 5920Hz band gain.
  4622. @item 15b
  4623. Set 8372Hz band gain.
  4624. @item 16b
  4625. Set 11840Hz band gain.
  4626. @item 17b
  4627. Set 16744Hz band gain.
  4628. @item 18b
  4629. Set 20000Hz band gain.
  4630. @end table
  4631. @section surround
  4632. Apply audio surround upmix filter.
  4633. This filter allows to produce multichannel output from audio stream.
  4634. The filter accepts the following options:
  4635. @table @option
  4636. @item chl_out
  4637. Set output channel layout. By default, this is @var{5.1}.
  4638. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4639. for the required syntax.
  4640. @item chl_in
  4641. Set input channel layout. By default, this is @var{stereo}.
  4642. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4643. for the required syntax.
  4644. @item level_in
  4645. Set input volume level. By default, this is @var{1}.
  4646. @item level_out
  4647. Set output volume level. By default, this is @var{1}.
  4648. @item lfe
  4649. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4650. @item lfe_low
  4651. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4652. @item lfe_high
  4653. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4654. @item lfe_mode
  4655. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4656. In @var{add} mode, LFE channel is created from input audio and added to output.
  4657. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4658. also all non-LFE output channels are subtracted with output LFE channel.
  4659. @item angle
  4660. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4661. Default is @var{90}.
  4662. @item fc_in
  4663. Set front center input volume. By default, this is @var{1}.
  4664. @item fc_out
  4665. Set front center output volume. By default, this is @var{1}.
  4666. @item fl_in
  4667. Set front left input volume. By default, this is @var{1}.
  4668. @item fl_out
  4669. Set front left output volume. By default, this is @var{1}.
  4670. @item fr_in
  4671. Set front right input volume. By default, this is @var{1}.
  4672. @item fr_out
  4673. Set front right output volume. By default, this is @var{1}.
  4674. @item sl_in
  4675. Set side left input volume. By default, this is @var{1}.
  4676. @item sl_out
  4677. Set side left output volume. By default, this is @var{1}.
  4678. @item sr_in
  4679. Set side right input volume. By default, this is @var{1}.
  4680. @item sr_out
  4681. Set side right output volume. By default, this is @var{1}.
  4682. @item bl_in
  4683. Set back left input volume. By default, this is @var{1}.
  4684. @item bl_out
  4685. Set back left output volume. By default, this is @var{1}.
  4686. @item br_in
  4687. Set back right input volume. By default, this is @var{1}.
  4688. @item br_out
  4689. Set back right output volume. By default, this is @var{1}.
  4690. @item bc_in
  4691. Set back center input volume. By default, this is @var{1}.
  4692. @item bc_out
  4693. Set back center output volume. By default, this is @var{1}.
  4694. @item lfe_in
  4695. Set LFE input volume. By default, this is @var{1}.
  4696. @item lfe_out
  4697. Set LFE output volume. By default, this is @var{1}.
  4698. @item allx
  4699. Set spread usage of stereo image across X axis for all channels.
  4700. @item ally
  4701. Set spread usage of stereo image across Y axis for all channels.
  4702. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4703. Set spread usage of stereo image across X axis for each channel.
  4704. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4705. Set spread usage of stereo image across Y axis for each channel.
  4706. @item win_size
  4707. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4708. @item win_func
  4709. Set window function.
  4710. It accepts the following values:
  4711. @table @samp
  4712. @item rect
  4713. @item bartlett
  4714. @item hann, hanning
  4715. @item hamming
  4716. @item blackman
  4717. @item welch
  4718. @item flattop
  4719. @item bharris
  4720. @item bnuttall
  4721. @item bhann
  4722. @item sine
  4723. @item nuttall
  4724. @item lanczos
  4725. @item gauss
  4726. @item tukey
  4727. @item dolph
  4728. @item cauchy
  4729. @item parzen
  4730. @item poisson
  4731. @item bohman
  4732. @end table
  4733. Default is @code{hann}.
  4734. @item overlap
  4735. Set window overlap. If set to 1, the recommended overlap for selected
  4736. window function will be picked. Default is @code{0.5}.
  4737. @end table
  4738. @section treble, highshelf
  4739. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4740. shelving filter with a response similar to that of a standard
  4741. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4742. The filter accepts the following options:
  4743. @table @option
  4744. @item gain, g
  4745. Give the gain at whichever is the lower of ~22 kHz and the
  4746. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4747. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4748. @item frequency, f
  4749. Set the filter's central frequency and so can be used
  4750. to extend or reduce the frequency range to be boosted or cut.
  4751. The default value is @code{3000} Hz.
  4752. @item width_type, t
  4753. Set method to specify band-width of filter.
  4754. @table @option
  4755. @item h
  4756. Hz
  4757. @item q
  4758. Q-Factor
  4759. @item o
  4760. octave
  4761. @item s
  4762. slope
  4763. @item k
  4764. kHz
  4765. @end table
  4766. @item width, w
  4767. Determine how steep is the filter's shelf transition.
  4768. @item poles, p
  4769. Set number of poles. Default is 2.
  4770. @item mix, m
  4771. How much to use filtered signal in output. Default is 1.
  4772. Range is between 0 and 1.
  4773. @item channels, c
  4774. Specify which channels to filter, by default all available are filtered.
  4775. @item normalize, n
  4776. Normalize biquad coefficients, by default is disabled.
  4777. Enabling it will normalize magnitude response at DC to 0dB.
  4778. @item transform, a
  4779. Set transform type of IIR filter.
  4780. @table @option
  4781. @item di
  4782. @item dii
  4783. @item tdii
  4784. @item latt
  4785. @end table
  4786. @item precision, r
  4787. Set precison of filtering.
  4788. @table @option
  4789. @item auto
  4790. Pick automatic sample format depending on surround filters.
  4791. @item s16
  4792. Always use signed 16-bit.
  4793. @item s32
  4794. Always use signed 32-bit.
  4795. @item f32
  4796. Always use float 32-bit.
  4797. @item f64
  4798. Always use float 64-bit.
  4799. @end table
  4800. @end table
  4801. @subsection Commands
  4802. This filter supports the following commands:
  4803. @table @option
  4804. @item frequency, f
  4805. Change treble frequency.
  4806. Syntax for the command is : "@var{frequency}"
  4807. @item width_type, t
  4808. Change treble width_type.
  4809. Syntax for the command is : "@var{width_type}"
  4810. @item width, w
  4811. Change treble width.
  4812. Syntax for the command is : "@var{width}"
  4813. @item gain, g
  4814. Change treble gain.
  4815. Syntax for the command is : "@var{gain}"
  4816. @item mix, m
  4817. Change treble mix.
  4818. Syntax for the command is : "@var{mix}"
  4819. @end table
  4820. @section tremolo
  4821. Sinusoidal amplitude modulation.
  4822. The filter accepts the following options:
  4823. @table @option
  4824. @item f
  4825. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4826. (20 Hz or lower) will result in a tremolo effect.
  4827. This filter may also be used as a ring modulator by specifying
  4828. a modulation frequency higher than 20 Hz.
  4829. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4830. @item d
  4831. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4832. Default value is 0.5.
  4833. @end table
  4834. @section vibrato
  4835. Sinusoidal phase modulation.
  4836. The filter accepts the following options:
  4837. @table @option
  4838. @item f
  4839. Modulation frequency in Hertz.
  4840. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4841. @item d
  4842. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4843. Default value is 0.5.
  4844. @end table
  4845. @section volume
  4846. Adjust the input audio volume.
  4847. It accepts the following parameters:
  4848. @table @option
  4849. @item volume
  4850. Set audio volume expression.
  4851. Output values are clipped to the maximum value.
  4852. The output audio volume is given by the relation:
  4853. @example
  4854. @var{output_volume} = @var{volume} * @var{input_volume}
  4855. @end example
  4856. The default value for @var{volume} is "1.0".
  4857. @item precision
  4858. This parameter represents the mathematical precision.
  4859. It determines which input sample formats will be allowed, which affects the
  4860. precision of the volume scaling.
  4861. @table @option
  4862. @item fixed
  4863. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4864. @item float
  4865. 32-bit floating-point; this limits input sample format to FLT. (default)
  4866. @item double
  4867. 64-bit floating-point; this limits input sample format to DBL.
  4868. @end table
  4869. @item replaygain
  4870. Choose the behaviour on encountering ReplayGain side data in input frames.
  4871. @table @option
  4872. @item drop
  4873. Remove ReplayGain side data, ignoring its contents (the default).
  4874. @item ignore
  4875. Ignore ReplayGain side data, but leave it in the frame.
  4876. @item track
  4877. Prefer the track gain, if present.
  4878. @item album
  4879. Prefer the album gain, if present.
  4880. @end table
  4881. @item replaygain_preamp
  4882. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4883. Default value for @var{replaygain_preamp} is 0.0.
  4884. @item replaygain_noclip
  4885. Prevent clipping by limiting the gain applied.
  4886. Default value for @var{replaygain_noclip} is 1.
  4887. @item eval
  4888. Set when the volume expression is evaluated.
  4889. It accepts the following values:
  4890. @table @samp
  4891. @item once
  4892. only evaluate expression once during the filter initialization, or
  4893. when the @samp{volume} command is sent
  4894. @item frame
  4895. evaluate expression for each incoming frame
  4896. @end table
  4897. Default value is @samp{once}.
  4898. @end table
  4899. The volume expression can contain the following parameters.
  4900. @table @option
  4901. @item n
  4902. frame number (starting at zero)
  4903. @item nb_channels
  4904. number of channels
  4905. @item nb_consumed_samples
  4906. number of samples consumed by the filter
  4907. @item nb_samples
  4908. number of samples in the current frame
  4909. @item pos
  4910. original frame position in the file
  4911. @item pts
  4912. frame PTS
  4913. @item sample_rate
  4914. sample rate
  4915. @item startpts
  4916. PTS at start of stream
  4917. @item startt
  4918. time at start of stream
  4919. @item t
  4920. frame time
  4921. @item tb
  4922. timestamp timebase
  4923. @item volume
  4924. last set volume value
  4925. @end table
  4926. Note that when @option{eval} is set to @samp{once} only the
  4927. @var{sample_rate} and @var{tb} variables are available, all other
  4928. variables will evaluate to NAN.
  4929. @subsection Commands
  4930. This filter supports the following commands:
  4931. @table @option
  4932. @item volume
  4933. Modify the volume expression.
  4934. The command accepts the same syntax of the corresponding option.
  4935. If the specified expression is not valid, it is kept at its current
  4936. value.
  4937. @end table
  4938. @subsection Examples
  4939. @itemize
  4940. @item
  4941. Halve the input audio volume:
  4942. @example
  4943. volume=volume=0.5
  4944. volume=volume=1/2
  4945. volume=volume=-6.0206dB
  4946. @end example
  4947. In all the above example the named key for @option{volume} can be
  4948. omitted, for example like in:
  4949. @example
  4950. volume=0.5
  4951. @end example
  4952. @item
  4953. Increase input audio power by 6 decibels using fixed-point precision:
  4954. @example
  4955. volume=volume=6dB:precision=fixed
  4956. @end example
  4957. @item
  4958. Fade volume after time 10 with an annihilation period of 5 seconds:
  4959. @example
  4960. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4961. @end example
  4962. @end itemize
  4963. @section volumedetect
  4964. Detect the volume of the input video.
  4965. The filter has no parameters. The input is not modified. Statistics about
  4966. the volume will be printed in the log when the input stream end is reached.
  4967. In particular it will show the mean volume (root mean square), maximum
  4968. volume (on a per-sample basis), and the beginning of a histogram of the
  4969. registered volume values (from the maximum value to a cumulated 1/1000 of
  4970. the samples).
  4971. All volumes are in decibels relative to the maximum PCM value.
  4972. @subsection Examples
  4973. Here is an excerpt of the output:
  4974. @example
  4975. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4976. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4977. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4978. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4979. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4980. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4981. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4982. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4983. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4984. @end example
  4985. It means that:
  4986. @itemize
  4987. @item
  4988. The mean square energy is approximately -27 dB, or 10^-2.7.
  4989. @item
  4990. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4991. @item
  4992. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4993. @end itemize
  4994. In other words, raising the volume by +4 dB does not cause any clipping,
  4995. raising it by +5 dB causes clipping for 6 samples, etc.
  4996. @c man end AUDIO FILTERS
  4997. @chapter Audio Sources
  4998. @c man begin AUDIO SOURCES
  4999. Below is a description of the currently available audio sources.
  5000. @section abuffer
  5001. Buffer audio frames, and make them available to the filter chain.
  5002. This source is mainly intended for a programmatic use, in particular
  5003. through the interface defined in @file{libavfilter/buffersrc.h}.
  5004. It accepts the following parameters:
  5005. @table @option
  5006. @item time_base
  5007. The timebase which will be used for timestamps of submitted frames. It must be
  5008. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5009. @item sample_rate
  5010. The sample rate of the incoming audio buffers.
  5011. @item sample_fmt
  5012. The sample format of the incoming audio buffers.
  5013. Either a sample format name or its corresponding integer representation from
  5014. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5015. @item channel_layout
  5016. The channel layout of the incoming audio buffers.
  5017. Either a channel layout name from channel_layout_map in
  5018. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5019. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5020. @item channels
  5021. The number of channels of the incoming audio buffers.
  5022. If both @var{channels} and @var{channel_layout} are specified, then they
  5023. must be consistent.
  5024. @end table
  5025. @subsection Examples
  5026. @example
  5027. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5028. @end example
  5029. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5030. Since the sample format with name "s16p" corresponds to the number
  5031. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5032. equivalent to:
  5033. @example
  5034. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5035. @end example
  5036. @section aevalsrc
  5037. Generate an audio signal specified by an expression.
  5038. This source accepts in input one or more expressions (one for each
  5039. channel), which are evaluated and used to generate a corresponding
  5040. audio signal.
  5041. This source accepts the following options:
  5042. @table @option
  5043. @item exprs
  5044. Set the '|'-separated expressions list for each separate channel. In case the
  5045. @option{channel_layout} option is not specified, the selected channel layout
  5046. depends on the number of provided expressions. Otherwise the last
  5047. specified expression is applied to the remaining output channels.
  5048. @item channel_layout, c
  5049. Set the channel layout. The number of channels in the specified layout
  5050. must be equal to the number of specified expressions.
  5051. @item duration, d
  5052. Set the minimum duration of the sourced audio. See
  5053. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5054. for the accepted syntax.
  5055. Note that the resulting duration may be greater than the specified
  5056. duration, as the generated audio is always cut at the end of a
  5057. complete frame.
  5058. If not specified, or the expressed duration is negative, the audio is
  5059. supposed to be generated forever.
  5060. @item nb_samples, n
  5061. Set the number of samples per channel per each output frame,
  5062. default to 1024.
  5063. @item sample_rate, s
  5064. Specify the sample rate, default to 44100.
  5065. @end table
  5066. Each expression in @var{exprs} can contain the following constants:
  5067. @table @option
  5068. @item n
  5069. number of the evaluated sample, starting from 0
  5070. @item t
  5071. time of the evaluated sample expressed in seconds, starting from 0
  5072. @item s
  5073. sample rate
  5074. @end table
  5075. @subsection Examples
  5076. @itemize
  5077. @item
  5078. Generate silence:
  5079. @example
  5080. aevalsrc=0
  5081. @end example
  5082. @item
  5083. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5084. 8000 Hz:
  5085. @example
  5086. aevalsrc="sin(440*2*PI*t):s=8000"
  5087. @end example
  5088. @item
  5089. Generate a two channels signal, specify the channel layout (Front
  5090. Center + Back Center) explicitly:
  5091. @example
  5092. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5093. @end example
  5094. @item
  5095. Generate white noise:
  5096. @example
  5097. aevalsrc="-2+random(0)"
  5098. @end example
  5099. @item
  5100. Generate an amplitude modulated signal:
  5101. @example
  5102. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5103. @end example
  5104. @item
  5105. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5106. @example
  5107. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5108. @end example
  5109. @end itemize
  5110. @section afirsrc
  5111. Generate a FIR coefficients using frequency sampling method.
  5112. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5113. The filter accepts the following options:
  5114. @table @option
  5115. @item taps, t
  5116. Set number of filter coefficents in output audio stream.
  5117. Default value is 1025.
  5118. @item frequency, f
  5119. Set frequency points from where magnitude and phase are set.
  5120. This must be in non decreasing order, and first element must be 0, while last element
  5121. must be 1. Elements are separated by white spaces.
  5122. @item magnitude, m
  5123. Set magnitude value for every frequency point set by @option{frequency}.
  5124. Number of values must be same as number of frequency points.
  5125. Values are separated by white spaces.
  5126. @item phase, p
  5127. Set phase value for every frequency point set by @option{frequency}.
  5128. Number of values must be same as number of frequency points.
  5129. Values are separated by white spaces.
  5130. @item sample_rate, r
  5131. Set sample rate, default is 44100.
  5132. @item nb_samples, n
  5133. Set number of samples per each frame. Default is 1024.
  5134. @item win_func, w
  5135. Set window function. Default is blackman.
  5136. @end table
  5137. @section anullsrc
  5138. The null audio source, return unprocessed audio frames. It is mainly useful
  5139. as a template and to be employed in analysis / debugging tools, or as
  5140. the source for filters which ignore the input data (for example the sox
  5141. synth filter).
  5142. This source accepts the following options:
  5143. @table @option
  5144. @item channel_layout, cl
  5145. Specifies the channel layout, and can be either an integer or a string
  5146. representing a channel layout. The default value of @var{channel_layout}
  5147. is "stereo".
  5148. Check the channel_layout_map definition in
  5149. @file{libavutil/channel_layout.c} for the mapping between strings and
  5150. channel layout values.
  5151. @item sample_rate, r
  5152. Specifies the sample rate, and defaults to 44100.
  5153. @item nb_samples, n
  5154. Set the number of samples per requested frames.
  5155. @item duration, d
  5156. Set the duration of the sourced audio. See
  5157. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5158. for the accepted syntax.
  5159. If not specified, or the expressed duration is negative, the audio is
  5160. supposed to be generated forever.
  5161. @end table
  5162. @subsection Examples
  5163. @itemize
  5164. @item
  5165. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5166. @example
  5167. anullsrc=r=48000:cl=4
  5168. @end example
  5169. @item
  5170. Do the same operation with a more obvious syntax:
  5171. @example
  5172. anullsrc=r=48000:cl=mono
  5173. @end example
  5174. @end itemize
  5175. All the parameters need to be explicitly defined.
  5176. @section flite
  5177. Synthesize a voice utterance using the libflite library.
  5178. To enable compilation of this filter you need to configure FFmpeg with
  5179. @code{--enable-libflite}.
  5180. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5181. The filter accepts the following options:
  5182. @table @option
  5183. @item list_voices
  5184. If set to 1, list the names of the available voices and exit
  5185. immediately. Default value is 0.
  5186. @item nb_samples, n
  5187. Set the maximum number of samples per frame. Default value is 512.
  5188. @item textfile
  5189. Set the filename containing the text to speak.
  5190. @item text
  5191. Set the text to speak.
  5192. @item voice, v
  5193. Set the voice to use for the speech synthesis. Default value is
  5194. @code{kal}. See also the @var{list_voices} option.
  5195. @end table
  5196. @subsection Examples
  5197. @itemize
  5198. @item
  5199. Read from file @file{speech.txt}, and synthesize the text using the
  5200. standard flite voice:
  5201. @example
  5202. flite=textfile=speech.txt
  5203. @end example
  5204. @item
  5205. Read the specified text selecting the @code{slt} voice:
  5206. @example
  5207. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5208. @end example
  5209. @item
  5210. Input text to ffmpeg:
  5211. @example
  5212. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5213. @end example
  5214. @item
  5215. Make @file{ffplay} speak the specified text, using @code{flite} and
  5216. the @code{lavfi} device:
  5217. @example
  5218. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5219. @end example
  5220. @end itemize
  5221. For more information about libflite, check:
  5222. @url{http://www.festvox.org/flite/}
  5223. @section anoisesrc
  5224. Generate a noise audio signal.
  5225. The filter accepts the following options:
  5226. @table @option
  5227. @item sample_rate, r
  5228. Specify the sample rate. Default value is 48000 Hz.
  5229. @item amplitude, a
  5230. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5231. is 1.0.
  5232. @item duration, d
  5233. Specify the duration of the generated audio stream. Not specifying this option
  5234. results in noise with an infinite length.
  5235. @item color, colour, c
  5236. Specify the color of noise. Available noise colors are white, pink, brown,
  5237. blue, violet and velvet. Default color is white.
  5238. @item seed, s
  5239. Specify a value used to seed the PRNG.
  5240. @item nb_samples, n
  5241. Set the number of samples per each output frame, default is 1024.
  5242. @end table
  5243. @subsection Examples
  5244. @itemize
  5245. @item
  5246. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5247. @example
  5248. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5249. @end example
  5250. @end itemize
  5251. @section hilbert
  5252. Generate odd-tap Hilbert transform FIR coefficients.
  5253. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5254. the signal by 90 degrees.
  5255. This is used in many matrix coding schemes and for analytic signal generation.
  5256. The process is often written as a multiplication by i (or j), the imaginary unit.
  5257. The filter accepts the following options:
  5258. @table @option
  5259. @item sample_rate, s
  5260. Set sample rate, default is 44100.
  5261. @item taps, t
  5262. Set length of FIR filter, default is 22051.
  5263. @item nb_samples, n
  5264. Set number of samples per each frame.
  5265. @item win_func, w
  5266. Set window function to be used when generating FIR coefficients.
  5267. @end table
  5268. @section sinc
  5269. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5270. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5271. The filter accepts the following options:
  5272. @table @option
  5273. @item sample_rate, r
  5274. Set sample rate, default is 44100.
  5275. @item nb_samples, n
  5276. Set number of samples per each frame. Default is 1024.
  5277. @item hp
  5278. Set high-pass frequency. Default is 0.
  5279. @item lp
  5280. Set low-pass frequency. Default is 0.
  5281. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5282. is higher than 0 then filter will create band-pass filter coefficients,
  5283. otherwise band-reject filter coefficients.
  5284. @item phase
  5285. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5286. @item beta
  5287. Set Kaiser window beta.
  5288. @item att
  5289. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5290. @item round
  5291. Enable rounding, by default is disabled.
  5292. @item hptaps
  5293. Set number of taps for high-pass filter.
  5294. @item lptaps
  5295. Set number of taps for low-pass filter.
  5296. @end table
  5297. @section sine
  5298. Generate an audio signal made of a sine wave with amplitude 1/8.
  5299. The audio signal is bit-exact.
  5300. The filter accepts the following options:
  5301. @table @option
  5302. @item frequency, f
  5303. Set the carrier frequency. Default is 440 Hz.
  5304. @item beep_factor, b
  5305. Enable a periodic beep every second with frequency @var{beep_factor} times
  5306. the carrier frequency. Default is 0, meaning the beep is disabled.
  5307. @item sample_rate, r
  5308. Specify the sample rate, default is 44100.
  5309. @item duration, d
  5310. Specify the duration of the generated audio stream.
  5311. @item samples_per_frame
  5312. Set the number of samples per output frame.
  5313. The expression can contain the following constants:
  5314. @table @option
  5315. @item n
  5316. The (sequential) number of the output audio frame, starting from 0.
  5317. @item pts
  5318. The PTS (Presentation TimeStamp) of the output audio frame,
  5319. expressed in @var{TB} units.
  5320. @item t
  5321. The PTS of the output audio frame, expressed in seconds.
  5322. @item TB
  5323. The timebase of the output audio frames.
  5324. @end table
  5325. Default is @code{1024}.
  5326. @end table
  5327. @subsection Examples
  5328. @itemize
  5329. @item
  5330. Generate a simple 440 Hz sine wave:
  5331. @example
  5332. sine
  5333. @end example
  5334. @item
  5335. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5336. @example
  5337. sine=220:4:d=5
  5338. sine=f=220:b=4:d=5
  5339. sine=frequency=220:beep_factor=4:duration=5
  5340. @end example
  5341. @item
  5342. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5343. pattern:
  5344. @example
  5345. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5346. @end example
  5347. @end itemize
  5348. @c man end AUDIO SOURCES
  5349. @chapter Audio Sinks
  5350. @c man begin AUDIO SINKS
  5351. Below is a description of the currently available audio sinks.
  5352. @section abuffersink
  5353. Buffer audio frames, and make them available to the end of filter chain.
  5354. This sink is mainly intended for programmatic use, in particular
  5355. through the interface defined in @file{libavfilter/buffersink.h}
  5356. or the options system.
  5357. It accepts a pointer to an AVABufferSinkContext structure, which
  5358. defines the incoming buffers' formats, to be passed as the opaque
  5359. parameter to @code{avfilter_init_filter} for initialization.
  5360. @section anullsink
  5361. Null audio sink; do absolutely nothing with the input audio. It is
  5362. mainly useful as a template and for use in analysis / debugging
  5363. tools.
  5364. @c man end AUDIO SINKS
  5365. @chapter Video Filters
  5366. @c man begin VIDEO FILTERS
  5367. When you configure your FFmpeg build, you can disable any of the
  5368. existing filters using @code{--disable-filters}.
  5369. The configure output will show the video filters included in your
  5370. build.
  5371. Below is a description of the currently available video filters.
  5372. @section addroi
  5373. Mark a region of interest in a video frame.
  5374. The frame data is passed through unchanged, but metadata is attached
  5375. to the frame indicating regions of interest which can affect the
  5376. behaviour of later encoding. Multiple regions can be marked by
  5377. applying the filter multiple times.
  5378. @table @option
  5379. @item x
  5380. Region distance in pixels from the left edge of the frame.
  5381. @item y
  5382. Region distance in pixels from the top edge of the frame.
  5383. @item w
  5384. Region width in pixels.
  5385. @item h
  5386. Region height in pixels.
  5387. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5388. and may contain the following variables:
  5389. @table @option
  5390. @item iw
  5391. Width of the input frame.
  5392. @item ih
  5393. Height of the input frame.
  5394. @end table
  5395. @item qoffset
  5396. Quantisation offset to apply within the region.
  5397. This must be a real value in the range -1 to +1. A value of zero
  5398. indicates no quality change. A negative value asks for better quality
  5399. (less quantisation), while a positive value asks for worse quality
  5400. (greater quantisation).
  5401. The range is calibrated so that the extreme values indicate the
  5402. largest possible offset - if the rest of the frame is encoded with the
  5403. worst possible quality, an offset of -1 indicates that this region
  5404. should be encoded with the best possible quality anyway. Intermediate
  5405. values are then interpolated in some codec-dependent way.
  5406. For example, in 10-bit H.264 the quantisation parameter varies between
  5407. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5408. this region should be encoded with a QP around one-tenth of the full
  5409. range better than the rest of the frame. So, if most of the frame
  5410. were to be encoded with a QP of around 30, this region would get a QP
  5411. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5412. An extreme value of -1 would indicate that this region should be
  5413. encoded with the best possible quality regardless of the treatment of
  5414. the rest of the frame - that is, should be encoded at a QP of -12.
  5415. @item clear
  5416. If set to true, remove any existing regions of interest marked on the
  5417. frame before adding the new one.
  5418. @end table
  5419. @subsection Examples
  5420. @itemize
  5421. @item
  5422. Mark the centre quarter of the frame as interesting.
  5423. @example
  5424. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5425. @end example
  5426. @item
  5427. Mark the 100-pixel-wide region on the left edge of the frame as very
  5428. uninteresting (to be encoded at much lower quality than the rest of
  5429. the frame).
  5430. @example
  5431. addroi=0:0:100:ih:+1/5
  5432. @end example
  5433. @end itemize
  5434. @section alphaextract
  5435. Extract the alpha component from the input as a grayscale video. This
  5436. is especially useful with the @var{alphamerge} filter.
  5437. @section alphamerge
  5438. Add or replace the alpha component of the primary input with the
  5439. grayscale value of a second input. This is intended for use with
  5440. @var{alphaextract} to allow the transmission or storage of frame
  5441. sequences that have alpha in a format that doesn't support an alpha
  5442. channel.
  5443. For example, to reconstruct full frames from a normal YUV-encoded video
  5444. and a separate video created with @var{alphaextract}, you might use:
  5445. @example
  5446. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5447. @end example
  5448. @section amplify
  5449. Amplify differences between current pixel and pixels of adjacent frames in
  5450. same pixel location.
  5451. This filter accepts the following options:
  5452. @table @option
  5453. @item radius
  5454. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5455. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5456. @item factor
  5457. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5458. @item threshold
  5459. Set threshold for difference amplification. Any difference greater or equal to
  5460. this value will not alter source pixel. Default is 10.
  5461. Allowed range is from 0 to 65535.
  5462. @item tolerance
  5463. Set tolerance for difference amplification. Any difference lower to
  5464. this value will not alter source pixel. Default is 0.
  5465. Allowed range is from 0 to 65535.
  5466. @item low
  5467. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5468. This option controls maximum possible value that will decrease source pixel value.
  5469. @item high
  5470. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5471. This option controls maximum possible value that will increase source pixel value.
  5472. @item planes
  5473. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5474. @end table
  5475. @subsection Commands
  5476. This filter supports the following @ref{commands} that corresponds to option of same name:
  5477. @table @option
  5478. @item factor
  5479. @item threshold
  5480. @item tolerance
  5481. @item low
  5482. @item high
  5483. @item planes
  5484. @end table
  5485. @section ass
  5486. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5487. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5488. Substation Alpha) subtitles files.
  5489. This filter accepts the following option in addition to the common options from
  5490. the @ref{subtitles} filter:
  5491. @table @option
  5492. @item shaping
  5493. Set the shaping engine
  5494. Available values are:
  5495. @table @samp
  5496. @item auto
  5497. The default libass shaping engine, which is the best available.
  5498. @item simple
  5499. Fast, font-agnostic shaper that can do only substitutions
  5500. @item complex
  5501. Slower shaper using OpenType for substitutions and positioning
  5502. @end table
  5503. The default is @code{auto}.
  5504. @end table
  5505. @section atadenoise
  5506. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5507. The filter accepts the following options:
  5508. @table @option
  5509. @item 0a
  5510. Set threshold A for 1st plane. Default is 0.02.
  5511. Valid range is 0 to 0.3.
  5512. @item 0b
  5513. Set threshold B for 1st plane. Default is 0.04.
  5514. Valid range is 0 to 5.
  5515. @item 1a
  5516. Set threshold A for 2nd plane. Default is 0.02.
  5517. Valid range is 0 to 0.3.
  5518. @item 1b
  5519. Set threshold B for 2nd plane. Default is 0.04.
  5520. Valid range is 0 to 5.
  5521. @item 2a
  5522. Set threshold A for 3rd plane. Default is 0.02.
  5523. Valid range is 0 to 0.3.
  5524. @item 2b
  5525. Set threshold B for 3rd plane. Default is 0.04.
  5526. Valid range is 0 to 5.
  5527. Threshold A is designed to react on abrupt changes in the input signal and
  5528. threshold B is designed to react on continuous changes in the input signal.
  5529. @item s
  5530. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5531. number in range [5, 129].
  5532. @item p
  5533. Set what planes of frame filter will use for averaging. Default is all.
  5534. @item a
  5535. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5536. Alternatively can be set to @code{s} serial.
  5537. Parallel can be faster then serial, while other way around is never true.
  5538. Parallel will abort early on first change being greater then thresholds, while serial
  5539. will continue processing other side of frames if they are equal or below thresholds.
  5540. @item 0s
  5541. @item 1s
  5542. @item 2s
  5543. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  5544. Valid range is from 0 to 32767.
  5545. This options controls weight for each pixel in radius defined by size.
  5546. Default value means every pixel have same weight.
  5547. Setting this option to 0 effectively disables filtering.
  5548. @end table
  5549. @subsection Commands
  5550. This filter supports same @ref{commands} as options except option @code{s}.
  5551. The command accepts the same syntax of the corresponding option.
  5552. @section avgblur
  5553. Apply average blur filter.
  5554. The filter accepts the following options:
  5555. @table @option
  5556. @item sizeX
  5557. Set horizontal radius size.
  5558. @item planes
  5559. Set which planes to filter. By default all planes are filtered.
  5560. @item sizeY
  5561. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5562. Default is @code{0}.
  5563. @end table
  5564. @subsection Commands
  5565. This filter supports same commands as options.
  5566. The command accepts the same syntax of the corresponding option.
  5567. If the specified expression is not valid, it is kept at its current
  5568. value.
  5569. @section bbox
  5570. Compute the bounding box for the non-black pixels in the input frame
  5571. luminance plane.
  5572. This filter computes the bounding box containing all the pixels with a
  5573. luminance value greater than the minimum allowed value.
  5574. The parameters describing the bounding box are printed on the filter
  5575. log.
  5576. The filter accepts the following option:
  5577. @table @option
  5578. @item min_val
  5579. Set the minimal luminance value. Default is @code{16}.
  5580. @end table
  5581. @subsection Commands
  5582. This filter supports the all above options as @ref{commands}.
  5583. @section bilateral
  5584. Apply bilateral filter, spatial smoothing while preserving edges.
  5585. The filter accepts the following options:
  5586. @table @option
  5587. @item sigmaS
  5588. Set sigma of gaussian function to calculate spatial weight.
  5589. Allowed range is 0 to 512. Default is 0.1.
  5590. @item sigmaR
  5591. Set sigma of gaussian function to calculate range weight.
  5592. Allowed range is 0 to 1. Default is 0.1.
  5593. @item planes
  5594. Set planes to filter. Default is first only.
  5595. @end table
  5596. @subsection Commands
  5597. This filter supports the all above options as @ref{commands}.
  5598. @section bitplanenoise
  5599. Show and measure bit plane noise.
  5600. The filter accepts the following options:
  5601. @table @option
  5602. @item bitplane
  5603. Set which plane to analyze. Default is @code{1}.
  5604. @item filter
  5605. Filter out noisy pixels from @code{bitplane} set above.
  5606. Default is disabled.
  5607. @end table
  5608. @section blackdetect
  5609. Detect video intervals that are (almost) completely black. Can be
  5610. useful to detect chapter transitions, commercials, or invalid
  5611. recordings.
  5612. The filter outputs its detection analysis to both the log as well as
  5613. frame metadata. If a black segment of at least the specified minimum
  5614. duration is found, a line with the start and end timestamps as well
  5615. as duration is printed to the log with level @code{info}. In addition,
  5616. a log line with level @code{debug} is printed per frame showing the
  5617. black amount detected for that frame.
  5618. The filter also attaches metadata to the first frame of a black
  5619. segment with key @code{lavfi.black_start} and to the first frame
  5620. after the black segment ends with key @code{lavfi.black_end}. The
  5621. value is the frame's timestamp. This metadata is added regardless
  5622. of the minimum duration specified.
  5623. The filter accepts the following options:
  5624. @table @option
  5625. @item black_min_duration, d
  5626. Set the minimum detected black duration expressed in seconds. It must
  5627. be a non-negative floating point number.
  5628. Default value is 2.0.
  5629. @item picture_black_ratio_th, pic_th
  5630. Set the threshold for considering a picture "black".
  5631. Express the minimum value for the ratio:
  5632. @example
  5633. @var{nb_black_pixels} / @var{nb_pixels}
  5634. @end example
  5635. for which a picture is considered black.
  5636. Default value is 0.98.
  5637. @item pixel_black_th, pix_th
  5638. Set the threshold for considering a pixel "black".
  5639. The threshold expresses the maximum pixel luminance value for which a
  5640. pixel is considered "black". The provided value is scaled according to
  5641. the following equation:
  5642. @example
  5643. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5644. @end example
  5645. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5646. the input video format, the range is [0-255] for YUV full-range
  5647. formats and [16-235] for YUV non full-range formats.
  5648. Default value is 0.10.
  5649. @end table
  5650. The following example sets the maximum pixel threshold to the minimum
  5651. value, and detects only black intervals of 2 or more seconds:
  5652. @example
  5653. blackdetect=d=2:pix_th=0.00
  5654. @end example
  5655. @section blackframe
  5656. Detect frames that are (almost) completely black. Can be useful to
  5657. detect chapter transitions or commercials. Output lines consist of
  5658. the frame number of the detected frame, the percentage of blackness,
  5659. the position in the file if known or -1 and the timestamp in seconds.
  5660. In order to display the output lines, you need to set the loglevel at
  5661. least to the AV_LOG_INFO value.
  5662. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5663. The value represents the percentage of pixels in the picture that
  5664. are below the threshold value.
  5665. It accepts the following parameters:
  5666. @table @option
  5667. @item amount
  5668. The percentage of the pixels that have to be below the threshold; it defaults to
  5669. @code{98}.
  5670. @item threshold, thresh
  5671. The threshold below which a pixel value is considered black; it defaults to
  5672. @code{32}.
  5673. @end table
  5674. @anchor{blend}
  5675. @section blend
  5676. Blend two video frames into each other.
  5677. The @code{blend} filter takes two input streams and outputs one
  5678. stream, the first input is the "top" layer and second input is
  5679. "bottom" layer. By default, the output terminates when the longest input terminates.
  5680. The @code{tblend} (time blend) filter takes two consecutive frames
  5681. from one single stream, and outputs the result obtained by blending
  5682. the new frame on top of the old frame.
  5683. A description of the accepted options follows.
  5684. @table @option
  5685. @item c0_mode
  5686. @item c1_mode
  5687. @item c2_mode
  5688. @item c3_mode
  5689. @item all_mode
  5690. Set blend mode for specific pixel component or all pixel components in case
  5691. of @var{all_mode}. Default value is @code{normal}.
  5692. Available values for component modes are:
  5693. @table @samp
  5694. @item addition
  5695. @item grainmerge
  5696. @item and
  5697. @item average
  5698. @item burn
  5699. @item darken
  5700. @item difference
  5701. @item grainextract
  5702. @item divide
  5703. @item dodge
  5704. @item freeze
  5705. @item exclusion
  5706. @item extremity
  5707. @item glow
  5708. @item hardlight
  5709. @item hardmix
  5710. @item heat
  5711. @item lighten
  5712. @item linearlight
  5713. @item multiply
  5714. @item multiply128
  5715. @item negation
  5716. @item normal
  5717. @item or
  5718. @item overlay
  5719. @item phoenix
  5720. @item pinlight
  5721. @item reflect
  5722. @item screen
  5723. @item softlight
  5724. @item subtract
  5725. @item vividlight
  5726. @item xor
  5727. @end table
  5728. @item c0_opacity
  5729. @item c1_opacity
  5730. @item c2_opacity
  5731. @item c3_opacity
  5732. @item all_opacity
  5733. Set blend opacity for specific pixel component or all pixel components in case
  5734. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5735. @item c0_expr
  5736. @item c1_expr
  5737. @item c2_expr
  5738. @item c3_expr
  5739. @item all_expr
  5740. Set blend expression for specific pixel component or all pixel components in case
  5741. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5742. The expressions can use the following variables:
  5743. @table @option
  5744. @item N
  5745. The sequential number of the filtered frame, starting from @code{0}.
  5746. @item X
  5747. @item Y
  5748. the coordinates of the current sample
  5749. @item W
  5750. @item H
  5751. the width and height of currently filtered plane
  5752. @item SW
  5753. @item SH
  5754. Width and height scale for the plane being filtered. It is the
  5755. ratio between the dimensions of the current plane to the luma plane,
  5756. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5757. the luma plane and @code{0.5,0.5} for the chroma planes.
  5758. @item T
  5759. Time of the current frame, expressed in seconds.
  5760. @item TOP, A
  5761. Value of pixel component at current location for first video frame (top layer).
  5762. @item BOTTOM, B
  5763. Value of pixel component at current location for second video frame (bottom layer).
  5764. @end table
  5765. @end table
  5766. The @code{blend} filter also supports the @ref{framesync} options.
  5767. @subsection Examples
  5768. @itemize
  5769. @item
  5770. Apply transition from bottom layer to top layer in first 10 seconds:
  5771. @example
  5772. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5773. @end example
  5774. @item
  5775. Apply linear horizontal transition from top layer to bottom layer:
  5776. @example
  5777. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5778. @end example
  5779. @item
  5780. Apply 1x1 checkerboard effect:
  5781. @example
  5782. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5783. @end example
  5784. @item
  5785. Apply uncover left effect:
  5786. @example
  5787. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5788. @end example
  5789. @item
  5790. Apply uncover down effect:
  5791. @example
  5792. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5793. @end example
  5794. @item
  5795. Apply uncover up-left effect:
  5796. @example
  5797. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5798. @end example
  5799. @item
  5800. Split diagonally video and shows top and bottom layer on each side:
  5801. @example
  5802. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5803. @end example
  5804. @item
  5805. Display differences between the current and the previous frame:
  5806. @example
  5807. tblend=all_mode=grainextract
  5808. @end example
  5809. @end itemize
  5810. @subsection Commands
  5811. This filter supports same @ref{commands} as options.
  5812. @section bm3d
  5813. Denoise frames using Block-Matching 3D algorithm.
  5814. The filter accepts the following options.
  5815. @table @option
  5816. @item sigma
  5817. Set denoising strength. Default value is 1.
  5818. Allowed range is from 0 to 999.9.
  5819. The denoising algorithm is very sensitive to sigma, so adjust it
  5820. according to the source.
  5821. @item block
  5822. Set local patch size. This sets dimensions in 2D.
  5823. @item bstep
  5824. Set sliding step for processing blocks. Default value is 4.
  5825. Allowed range is from 1 to 64.
  5826. Smaller values allows processing more reference blocks and is slower.
  5827. @item group
  5828. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5829. When set to 1, no block matching is done. Larger values allows more blocks
  5830. in single group.
  5831. Allowed range is from 1 to 256.
  5832. @item range
  5833. Set radius for search block matching. Default is 9.
  5834. Allowed range is from 1 to INT32_MAX.
  5835. @item mstep
  5836. Set step between two search locations for block matching. Default is 1.
  5837. Allowed range is from 1 to 64. Smaller is slower.
  5838. @item thmse
  5839. Set threshold of mean square error for block matching. Valid range is 0 to
  5840. INT32_MAX.
  5841. @item hdthr
  5842. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5843. Larger values results in stronger hard-thresholding filtering in frequency
  5844. domain.
  5845. @item estim
  5846. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5847. Default is @code{basic}.
  5848. @item ref
  5849. If enabled, filter will use 2nd stream for block matching.
  5850. Default is disabled for @code{basic} value of @var{estim} option,
  5851. and always enabled if value of @var{estim} is @code{final}.
  5852. @item planes
  5853. Set planes to filter. Default is all available except alpha.
  5854. @end table
  5855. @subsection Examples
  5856. @itemize
  5857. @item
  5858. Basic filtering with bm3d:
  5859. @example
  5860. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5861. @end example
  5862. @item
  5863. Same as above, but filtering only luma:
  5864. @example
  5865. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5866. @end example
  5867. @item
  5868. Same as above, but with both estimation modes:
  5869. @example
  5870. 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
  5871. @end example
  5872. @item
  5873. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5874. @example
  5875. 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
  5876. @end example
  5877. @end itemize
  5878. @section boxblur
  5879. Apply a boxblur algorithm to the input video.
  5880. It accepts the following parameters:
  5881. @table @option
  5882. @item luma_radius, lr
  5883. @item luma_power, lp
  5884. @item chroma_radius, cr
  5885. @item chroma_power, cp
  5886. @item alpha_radius, ar
  5887. @item alpha_power, ap
  5888. @end table
  5889. A description of the accepted options follows.
  5890. @table @option
  5891. @item luma_radius, lr
  5892. @item chroma_radius, cr
  5893. @item alpha_radius, ar
  5894. Set an expression for the box radius in pixels used for blurring the
  5895. corresponding input plane.
  5896. The radius value must be a non-negative number, and must not be
  5897. greater than the value of the expression @code{min(w,h)/2} for the
  5898. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5899. planes.
  5900. Default value for @option{luma_radius} is "2". If not specified,
  5901. @option{chroma_radius} and @option{alpha_radius} default to the
  5902. corresponding value set for @option{luma_radius}.
  5903. The expressions can contain the following constants:
  5904. @table @option
  5905. @item w
  5906. @item h
  5907. The input width and height in pixels.
  5908. @item cw
  5909. @item ch
  5910. The input chroma image width and height in pixels.
  5911. @item hsub
  5912. @item vsub
  5913. The horizontal and vertical chroma subsample values. For example, for the
  5914. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5915. @end table
  5916. @item luma_power, lp
  5917. @item chroma_power, cp
  5918. @item alpha_power, ap
  5919. Specify how many times the boxblur filter is applied to the
  5920. corresponding plane.
  5921. Default value for @option{luma_power} is 2. If not specified,
  5922. @option{chroma_power} and @option{alpha_power} default to the
  5923. corresponding value set for @option{luma_power}.
  5924. A value of 0 will disable the effect.
  5925. @end table
  5926. @subsection Examples
  5927. @itemize
  5928. @item
  5929. Apply a boxblur filter with the luma, chroma, and alpha radii
  5930. set to 2:
  5931. @example
  5932. boxblur=luma_radius=2:luma_power=1
  5933. boxblur=2:1
  5934. @end example
  5935. @item
  5936. Set the luma radius to 2, and alpha and chroma radius to 0:
  5937. @example
  5938. boxblur=2:1:cr=0:ar=0
  5939. @end example
  5940. @item
  5941. Set the luma and chroma radii to a fraction of the video dimension:
  5942. @example
  5943. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5944. @end example
  5945. @end itemize
  5946. @section bwdif
  5947. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5948. Deinterlacing Filter").
  5949. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5950. interpolation algorithms.
  5951. It accepts the following parameters:
  5952. @table @option
  5953. @item mode
  5954. The interlacing mode to adopt. It accepts one of the following values:
  5955. @table @option
  5956. @item 0, send_frame
  5957. Output one frame for each frame.
  5958. @item 1, send_field
  5959. Output one frame for each field.
  5960. @end table
  5961. The default value is @code{send_field}.
  5962. @item parity
  5963. The picture field parity assumed for the input interlaced video. It accepts one
  5964. of the following values:
  5965. @table @option
  5966. @item 0, tff
  5967. Assume the top field is first.
  5968. @item 1, bff
  5969. Assume the bottom field is first.
  5970. @item -1, auto
  5971. Enable automatic detection of field parity.
  5972. @end table
  5973. The default value is @code{auto}.
  5974. If the interlacing is unknown or the decoder does not export this information,
  5975. top field first will be assumed.
  5976. @item deint
  5977. Specify which frames to deinterlace. Accepts one of the following
  5978. values:
  5979. @table @option
  5980. @item 0, all
  5981. Deinterlace all frames.
  5982. @item 1, interlaced
  5983. Only deinterlace frames marked as interlaced.
  5984. @end table
  5985. The default value is @code{all}.
  5986. @end table
  5987. @section cas
  5988. Apply Contrast Adaptive Sharpen filter to video stream.
  5989. The filter accepts the following options:
  5990. @table @option
  5991. @item strength
  5992. Set the sharpening strength. Default value is 0.
  5993. @item planes
  5994. Set planes to filter. Default value is to filter all
  5995. planes except alpha plane.
  5996. @end table
  5997. @subsection Commands
  5998. This filter supports same @ref{commands} as options.
  5999. @section chromahold
  6000. Remove all color information for all colors except for certain one.
  6001. The filter accepts the following options:
  6002. @table @option
  6003. @item color
  6004. The color which will not be replaced with neutral chroma.
  6005. @item similarity
  6006. Similarity percentage with the above color.
  6007. 0.01 matches only the exact key color, while 1.0 matches everything.
  6008. @item blend
  6009. Blend percentage.
  6010. 0.0 makes pixels either fully gray, or not gray at all.
  6011. Higher values result in more preserved color.
  6012. @item yuv
  6013. Signals that the color passed is already in YUV instead of RGB.
  6014. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6015. This can be used to pass exact YUV values as hexadecimal numbers.
  6016. @end table
  6017. @subsection Commands
  6018. This filter supports same @ref{commands} as options.
  6019. The command accepts the same syntax of the corresponding option.
  6020. If the specified expression is not valid, it is kept at its current
  6021. value.
  6022. @section chromakey
  6023. YUV colorspace color/chroma keying.
  6024. The filter accepts the following options:
  6025. @table @option
  6026. @item color
  6027. The color which will be replaced with transparency.
  6028. @item similarity
  6029. Similarity percentage with the key color.
  6030. 0.01 matches only the exact key color, while 1.0 matches everything.
  6031. @item blend
  6032. Blend percentage.
  6033. 0.0 makes pixels either fully transparent, or not transparent at all.
  6034. Higher values result in semi-transparent pixels, with a higher transparency
  6035. the more similar the pixels color is to the key color.
  6036. @item yuv
  6037. Signals that the color passed is already in YUV instead of RGB.
  6038. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6039. This can be used to pass exact YUV values as hexadecimal numbers.
  6040. @end table
  6041. @subsection Commands
  6042. This filter supports same @ref{commands} as options.
  6043. The command accepts the same syntax of the corresponding option.
  6044. If the specified expression is not valid, it is kept at its current
  6045. value.
  6046. @subsection Examples
  6047. @itemize
  6048. @item
  6049. Make every green pixel in the input image transparent:
  6050. @example
  6051. ffmpeg -i input.png -vf chromakey=green out.png
  6052. @end example
  6053. @item
  6054. Overlay a greenscreen-video on top of a static black background.
  6055. @example
  6056. 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
  6057. @end example
  6058. @end itemize
  6059. @section chromanr
  6060. Reduce chrominance noise.
  6061. The filter accepts the following options:
  6062. @table @option
  6063. @item thres
  6064. Set threshold for averaging chrominance values.
  6065. Sum of absolute difference of Y, U and V pixel components of current
  6066. pixel and neighbour pixels lower than this threshold will be used in
  6067. averaging. Luma component is left unchanged and is copied to output.
  6068. Default value is 30. Allowed range is from 1 to 200.
  6069. @item sizew
  6070. Set horizontal radius of rectangle used for averaging.
  6071. Allowed range is from 1 to 100. Default value is 5.
  6072. @item sizeh
  6073. Set vertical radius of rectangle used for averaging.
  6074. Allowed range is from 1 to 100. Default value is 5.
  6075. @item stepw
  6076. Set horizontal step when averaging. Default value is 1.
  6077. Allowed range is from 1 to 50.
  6078. Mostly useful to speed-up filtering.
  6079. @item steph
  6080. Set vertical step when averaging. Default value is 1.
  6081. Allowed range is from 1 to 50.
  6082. Mostly useful to speed-up filtering.
  6083. @item threy
  6084. Set Y threshold for averaging chrominance values.
  6085. Set finer control for max allowed difference between Y components
  6086. of current pixel and neigbour pixels.
  6087. Default value is 200. Allowed range is from 1 to 200.
  6088. @item threu
  6089. Set U threshold for averaging chrominance values.
  6090. Set finer control for max allowed difference between U components
  6091. of current pixel and neigbour pixels.
  6092. Default value is 200. Allowed range is from 1 to 200.
  6093. @item threv
  6094. Set V threshold for averaging chrominance values.
  6095. Set finer control for max allowed difference between V components
  6096. of current pixel and neigbour pixels.
  6097. Default value is 200. Allowed range is from 1 to 200.
  6098. @end table
  6099. @subsection Commands
  6100. This filter supports same @ref{commands} as options.
  6101. The command accepts the same syntax of the corresponding option.
  6102. @section chromashift
  6103. Shift chroma pixels horizontally and/or vertically.
  6104. The filter accepts the following options:
  6105. @table @option
  6106. @item cbh
  6107. Set amount to shift chroma-blue horizontally.
  6108. @item cbv
  6109. Set amount to shift chroma-blue vertically.
  6110. @item crh
  6111. Set amount to shift chroma-red horizontally.
  6112. @item crv
  6113. Set amount to shift chroma-red vertically.
  6114. @item edge
  6115. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6116. @end table
  6117. @subsection Commands
  6118. This filter supports the all above options as @ref{commands}.
  6119. @section ciescope
  6120. Display CIE color diagram with pixels overlaid onto it.
  6121. The filter accepts the following options:
  6122. @table @option
  6123. @item system
  6124. Set color system.
  6125. @table @samp
  6126. @item ntsc, 470m
  6127. @item ebu, 470bg
  6128. @item smpte
  6129. @item 240m
  6130. @item apple
  6131. @item widergb
  6132. @item cie1931
  6133. @item rec709, hdtv
  6134. @item uhdtv, rec2020
  6135. @item dcip3
  6136. @end table
  6137. @item cie
  6138. Set CIE system.
  6139. @table @samp
  6140. @item xyy
  6141. @item ucs
  6142. @item luv
  6143. @end table
  6144. @item gamuts
  6145. Set what gamuts to draw.
  6146. See @code{system} option for available values.
  6147. @item size, s
  6148. Set ciescope size, by default set to 512.
  6149. @item intensity, i
  6150. Set intensity used to map input pixel values to CIE diagram.
  6151. @item contrast
  6152. Set contrast used to draw tongue colors that are out of active color system gamut.
  6153. @item corrgamma
  6154. Correct gamma displayed on scope, by default enabled.
  6155. @item showwhite
  6156. Show white point on CIE diagram, by default disabled.
  6157. @item gamma
  6158. Set input gamma. Used only with XYZ input color space.
  6159. @end table
  6160. @section codecview
  6161. Visualize information exported by some codecs.
  6162. Some codecs can export information through frames using side-data or other
  6163. means. For example, some MPEG based codecs export motion vectors through the
  6164. @var{export_mvs} flag in the codec @option{flags2} option.
  6165. The filter accepts the following option:
  6166. @table @option
  6167. @item mv
  6168. Set motion vectors to visualize.
  6169. Available flags for @var{mv} are:
  6170. @table @samp
  6171. @item pf
  6172. forward predicted MVs of P-frames
  6173. @item bf
  6174. forward predicted MVs of B-frames
  6175. @item bb
  6176. backward predicted MVs of B-frames
  6177. @end table
  6178. @item qp
  6179. Display quantization parameters using the chroma planes.
  6180. @item mv_type, mvt
  6181. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6182. Available flags for @var{mv_type} are:
  6183. @table @samp
  6184. @item fp
  6185. forward predicted MVs
  6186. @item bp
  6187. backward predicted MVs
  6188. @end table
  6189. @item frame_type, ft
  6190. Set frame type to visualize motion vectors of.
  6191. Available flags for @var{frame_type} are:
  6192. @table @samp
  6193. @item if
  6194. intra-coded frames (I-frames)
  6195. @item pf
  6196. predicted frames (P-frames)
  6197. @item bf
  6198. bi-directionally predicted frames (B-frames)
  6199. @end table
  6200. @end table
  6201. @subsection Examples
  6202. @itemize
  6203. @item
  6204. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6205. @example
  6206. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6207. @end example
  6208. @item
  6209. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6210. @example
  6211. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6212. @end example
  6213. @end itemize
  6214. @section colorbalance
  6215. Modify intensity of primary colors (red, green and blue) of input frames.
  6216. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6217. regions for the red-cyan, green-magenta or blue-yellow balance.
  6218. A positive adjustment value shifts the balance towards the primary color, a negative
  6219. value towards the complementary color.
  6220. The filter accepts the following options:
  6221. @table @option
  6222. @item rs
  6223. @item gs
  6224. @item bs
  6225. Adjust red, green and blue shadows (darkest pixels).
  6226. @item rm
  6227. @item gm
  6228. @item bm
  6229. Adjust red, green and blue midtones (medium pixels).
  6230. @item rh
  6231. @item gh
  6232. @item bh
  6233. Adjust red, green and blue highlights (brightest pixels).
  6234. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6235. @item pl
  6236. Preserve lightness when changing color balance. Default is disabled.
  6237. @end table
  6238. @subsection Examples
  6239. @itemize
  6240. @item
  6241. Add red color cast to shadows:
  6242. @example
  6243. colorbalance=rs=.3
  6244. @end example
  6245. @end itemize
  6246. @subsection Commands
  6247. This filter supports the all above options as @ref{commands}.
  6248. @section colorcontrast
  6249. Adjust color contrast between RGB components.
  6250. The filter accepts the following options:
  6251. @table @option
  6252. @item rc
  6253. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6254. @item gm
  6255. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6256. @item by
  6257. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6258. @item rcw
  6259. @item gmw
  6260. @item byw
  6261. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  6262. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  6263. @item pl
  6264. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  6265. @end table
  6266. @subsection Commands
  6267. This filter supports the all above options as @ref{commands}.
  6268. @section colorcorrect
  6269. Adjust color white balance selectively for blacks and whites.
  6270. This filter operates in YUV colorspace.
  6271. The filter accepts the following options:
  6272. @table @option
  6273. @item rl
  6274. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  6275. Default value is 0.
  6276. @item bl
  6277. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  6278. Default value is 0.
  6279. @item rh
  6280. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6281. Default value is 0.
  6282. @item bh
  6283. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6284. Default value is 0.
  6285. @item saturation
  6286. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  6287. Default value is 1.
  6288. @end table
  6289. @subsection Commands
  6290. This filter supports the all above options as @ref{commands}.
  6291. @section colorchannelmixer
  6292. Adjust video input frames by re-mixing color channels.
  6293. This filter modifies a color channel by adding the values associated to
  6294. the other channels of the same pixels. For example if the value to
  6295. modify is red, the output value will be:
  6296. @example
  6297. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6298. @end example
  6299. The filter accepts the following options:
  6300. @table @option
  6301. @item rr
  6302. @item rg
  6303. @item rb
  6304. @item ra
  6305. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6306. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6307. @item gr
  6308. @item gg
  6309. @item gb
  6310. @item ga
  6311. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6312. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6313. @item br
  6314. @item bg
  6315. @item bb
  6316. @item ba
  6317. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6318. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6319. @item ar
  6320. @item ag
  6321. @item ab
  6322. @item aa
  6323. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6324. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6325. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6326. @item pl
  6327. Preserve lightness when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  6328. Default is @code{0.0}, thus disabled.
  6329. @end table
  6330. @subsection Examples
  6331. @itemize
  6332. @item
  6333. Convert source to grayscale:
  6334. @example
  6335. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6336. @end example
  6337. @item
  6338. Simulate sepia tones:
  6339. @example
  6340. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6341. @end example
  6342. @end itemize
  6343. @subsection Commands
  6344. This filter supports the all above options as @ref{commands}.
  6345. @section colorize
  6346. Overlay a solid color on the video stream.
  6347. The filter accepts the following options:
  6348. @table @option
  6349. @item hue
  6350. Set the color hue. Allowed range is from 0 to 360.
  6351. Default value is 0.
  6352. @item saturation
  6353. Set the color saturation. Allowed range is from 0 to 1.
  6354. Default value is 0.5.
  6355. @item lightness
  6356. Set the color lightness. Allowed range is from 0 to 1.
  6357. Default value is 0.5.
  6358. @item mix
  6359. Set the mix of source lightness. By default is set to 1.0.
  6360. Allowed range is from 0.0 to 1.0.
  6361. @end table
  6362. @subsection Commands
  6363. This filter supports the all above options as @ref{commands}.
  6364. @section colorkey
  6365. RGB colorspace color keying.
  6366. The filter accepts the following options:
  6367. @table @option
  6368. @item color
  6369. The color which will be replaced with transparency.
  6370. @item similarity
  6371. Similarity percentage with the key color.
  6372. 0.01 matches only the exact key color, while 1.0 matches everything.
  6373. @item blend
  6374. Blend percentage.
  6375. 0.0 makes pixels either fully transparent, or not transparent at all.
  6376. Higher values result in semi-transparent pixels, with a higher transparency
  6377. the more similar the pixels color is to the key color.
  6378. @end table
  6379. @subsection Examples
  6380. @itemize
  6381. @item
  6382. Make every green pixel in the input image transparent:
  6383. @example
  6384. ffmpeg -i input.png -vf colorkey=green out.png
  6385. @end example
  6386. @item
  6387. Overlay a greenscreen-video on top of a static background image.
  6388. @example
  6389. 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
  6390. @end example
  6391. @end itemize
  6392. @subsection Commands
  6393. This filter supports same @ref{commands} as options.
  6394. The command accepts the same syntax of the corresponding option.
  6395. If the specified expression is not valid, it is kept at its current
  6396. value.
  6397. @section colorhold
  6398. Remove all color information for all RGB colors except for certain one.
  6399. The filter accepts the following options:
  6400. @table @option
  6401. @item color
  6402. The color which will not be replaced with neutral gray.
  6403. @item similarity
  6404. Similarity percentage with the above color.
  6405. 0.01 matches only the exact key color, while 1.0 matches everything.
  6406. @item blend
  6407. Blend percentage. 0.0 makes pixels fully gray.
  6408. Higher values result in more preserved color.
  6409. @end table
  6410. @subsection Commands
  6411. This filter supports same @ref{commands} as options.
  6412. The command accepts the same syntax of the corresponding option.
  6413. If the specified expression is not valid, it is kept at its current
  6414. value.
  6415. @section colorlevels
  6416. Adjust video input frames using levels.
  6417. The filter accepts the following options:
  6418. @table @option
  6419. @item rimin
  6420. @item gimin
  6421. @item bimin
  6422. @item aimin
  6423. Adjust red, green, blue and alpha input black point.
  6424. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6425. @item rimax
  6426. @item gimax
  6427. @item bimax
  6428. @item aimax
  6429. Adjust red, green, blue and alpha input white point.
  6430. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6431. Input levels are used to lighten highlights (bright tones), darken shadows
  6432. (dark tones), change the balance of bright and dark tones.
  6433. @item romin
  6434. @item gomin
  6435. @item bomin
  6436. @item aomin
  6437. Adjust red, green, blue and alpha output black point.
  6438. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6439. @item romax
  6440. @item gomax
  6441. @item bomax
  6442. @item aomax
  6443. Adjust red, green, blue and alpha output white point.
  6444. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6445. Output levels allows manual selection of a constrained output level range.
  6446. @end table
  6447. @subsection Examples
  6448. @itemize
  6449. @item
  6450. Make video output darker:
  6451. @example
  6452. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6453. @end example
  6454. @item
  6455. Increase contrast:
  6456. @example
  6457. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6458. @end example
  6459. @item
  6460. Make video output lighter:
  6461. @example
  6462. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6463. @end example
  6464. @item
  6465. Increase brightness:
  6466. @example
  6467. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6468. @end example
  6469. @end itemize
  6470. @subsection Commands
  6471. This filter supports the all above options as @ref{commands}.
  6472. @section colormatrix
  6473. Convert color matrix.
  6474. The filter accepts the following options:
  6475. @table @option
  6476. @item src
  6477. @item dst
  6478. Specify the source and destination color matrix. Both values must be
  6479. specified.
  6480. The accepted values are:
  6481. @table @samp
  6482. @item bt709
  6483. BT.709
  6484. @item fcc
  6485. FCC
  6486. @item bt601
  6487. BT.601
  6488. @item bt470
  6489. BT.470
  6490. @item bt470bg
  6491. BT.470BG
  6492. @item smpte170m
  6493. SMPTE-170M
  6494. @item smpte240m
  6495. SMPTE-240M
  6496. @item bt2020
  6497. BT.2020
  6498. @end table
  6499. @end table
  6500. For example to convert from BT.601 to SMPTE-240M, use the command:
  6501. @example
  6502. colormatrix=bt601:smpte240m
  6503. @end example
  6504. @section colorspace
  6505. Convert colorspace, transfer characteristics or color primaries.
  6506. Input video needs to have an even size.
  6507. The filter accepts the following options:
  6508. @table @option
  6509. @anchor{all}
  6510. @item all
  6511. Specify all color properties at once.
  6512. The accepted values are:
  6513. @table @samp
  6514. @item bt470m
  6515. BT.470M
  6516. @item bt470bg
  6517. BT.470BG
  6518. @item bt601-6-525
  6519. BT.601-6 525
  6520. @item bt601-6-625
  6521. BT.601-6 625
  6522. @item bt709
  6523. BT.709
  6524. @item smpte170m
  6525. SMPTE-170M
  6526. @item smpte240m
  6527. SMPTE-240M
  6528. @item bt2020
  6529. BT.2020
  6530. @end table
  6531. @anchor{space}
  6532. @item space
  6533. Specify output colorspace.
  6534. The accepted values are:
  6535. @table @samp
  6536. @item bt709
  6537. BT.709
  6538. @item fcc
  6539. FCC
  6540. @item bt470bg
  6541. BT.470BG or BT.601-6 625
  6542. @item smpte170m
  6543. SMPTE-170M or BT.601-6 525
  6544. @item smpte240m
  6545. SMPTE-240M
  6546. @item ycgco
  6547. YCgCo
  6548. @item bt2020ncl
  6549. BT.2020 with non-constant luminance
  6550. @end table
  6551. @anchor{trc}
  6552. @item trc
  6553. Specify output transfer characteristics.
  6554. The accepted values are:
  6555. @table @samp
  6556. @item bt709
  6557. BT.709
  6558. @item bt470m
  6559. BT.470M
  6560. @item bt470bg
  6561. BT.470BG
  6562. @item gamma22
  6563. Constant gamma of 2.2
  6564. @item gamma28
  6565. Constant gamma of 2.8
  6566. @item smpte170m
  6567. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6568. @item smpte240m
  6569. SMPTE-240M
  6570. @item srgb
  6571. SRGB
  6572. @item iec61966-2-1
  6573. iec61966-2-1
  6574. @item iec61966-2-4
  6575. iec61966-2-4
  6576. @item xvycc
  6577. xvycc
  6578. @item bt2020-10
  6579. BT.2020 for 10-bits content
  6580. @item bt2020-12
  6581. BT.2020 for 12-bits content
  6582. @end table
  6583. @anchor{primaries}
  6584. @item primaries
  6585. Specify output color primaries.
  6586. The accepted values are:
  6587. @table @samp
  6588. @item bt709
  6589. BT.709
  6590. @item bt470m
  6591. BT.470M
  6592. @item bt470bg
  6593. BT.470BG or BT.601-6 625
  6594. @item smpte170m
  6595. SMPTE-170M or BT.601-6 525
  6596. @item smpte240m
  6597. SMPTE-240M
  6598. @item film
  6599. film
  6600. @item smpte431
  6601. SMPTE-431
  6602. @item smpte432
  6603. SMPTE-432
  6604. @item bt2020
  6605. BT.2020
  6606. @item jedec-p22
  6607. JEDEC P22 phosphors
  6608. @end table
  6609. @anchor{range}
  6610. @item range
  6611. Specify output color range.
  6612. The accepted values are:
  6613. @table @samp
  6614. @item tv
  6615. TV (restricted) range
  6616. @item mpeg
  6617. MPEG (restricted) range
  6618. @item pc
  6619. PC (full) range
  6620. @item jpeg
  6621. JPEG (full) range
  6622. @end table
  6623. @item format
  6624. Specify output color format.
  6625. The accepted values are:
  6626. @table @samp
  6627. @item yuv420p
  6628. YUV 4:2:0 planar 8-bits
  6629. @item yuv420p10
  6630. YUV 4:2:0 planar 10-bits
  6631. @item yuv420p12
  6632. YUV 4:2:0 planar 12-bits
  6633. @item yuv422p
  6634. YUV 4:2:2 planar 8-bits
  6635. @item yuv422p10
  6636. YUV 4:2:2 planar 10-bits
  6637. @item yuv422p12
  6638. YUV 4:2:2 planar 12-bits
  6639. @item yuv444p
  6640. YUV 4:4:4 planar 8-bits
  6641. @item yuv444p10
  6642. YUV 4:4:4 planar 10-bits
  6643. @item yuv444p12
  6644. YUV 4:4:4 planar 12-bits
  6645. @end table
  6646. @item fast
  6647. Do a fast conversion, which skips gamma/primary correction. This will take
  6648. significantly less CPU, but will be mathematically incorrect. To get output
  6649. compatible with that produced by the colormatrix filter, use fast=1.
  6650. @item dither
  6651. Specify dithering mode.
  6652. The accepted values are:
  6653. @table @samp
  6654. @item none
  6655. No dithering
  6656. @item fsb
  6657. Floyd-Steinberg dithering
  6658. @end table
  6659. @item wpadapt
  6660. Whitepoint adaptation mode.
  6661. The accepted values are:
  6662. @table @samp
  6663. @item bradford
  6664. Bradford whitepoint adaptation
  6665. @item vonkries
  6666. von Kries whitepoint adaptation
  6667. @item identity
  6668. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6669. @end table
  6670. @item iall
  6671. Override all input properties at once. Same accepted values as @ref{all}.
  6672. @item ispace
  6673. Override input colorspace. Same accepted values as @ref{space}.
  6674. @item iprimaries
  6675. Override input color primaries. Same accepted values as @ref{primaries}.
  6676. @item itrc
  6677. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6678. @item irange
  6679. Override input color range. Same accepted values as @ref{range}.
  6680. @end table
  6681. The filter converts the transfer characteristics, color space and color
  6682. primaries to the specified user values. The output value, if not specified,
  6683. is set to a default value based on the "all" property. If that property is
  6684. also not specified, the filter will log an error. The output color range and
  6685. format default to the same value as the input color range and format. The
  6686. input transfer characteristics, color space, color primaries and color range
  6687. should be set on the input data. If any of these are missing, the filter will
  6688. log an error and no conversion will take place.
  6689. For example to convert the input to SMPTE-240M, use the command:
  6690. @example
  6691. colorspace=smpte240m
  6692. @end example
  6693. @section colortemperature
  6694. Adjust color temperature in video to simulate variations in ambient color temperature.
  6695. The filter accepts the following options:
  6696. @table @option
  6697. @item temperature
  6698. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  6699. Default value is 6500 K.
  6700. @item mix
  6701. Set mixing with filtered output. Allowed range is from 0 to 1.
  6702. Default value is 1.
  6703. @item pl
  6704. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  6705. Default value is 0.
  6706. @end table
  6707. @subsection Commands
  6708. This filter supports same @ref{commands} as options.
  6709. @section convolution
  6710. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6711. The filter accepts the following options:
  6712. @table @option
  6713. @item 0m
  6714. @item 1m
  6715. @item 2m
  6716. @item 3m
  6717. Set matrix for each plane.
  6718. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6719. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6720. @item 0rdiv
  6721. @item 1rdiv
  6722. @item 2rdiv
  6723. @item 3rdiv
  6724. Set multiplier for calculated value for each plane.
  6725. If unset or 0, it will be sum of all matrix elements.
  6726. @item 0bias
  6727. @item 1bias
  6728. @item 2bias
  6729. @item 3bias
  6730. Set bias for each plane. This value is added to the result of the multiplication.
  6731. Useful for making the overall image brighter or darker. Default is 0.0.
  6732. @item 0mode
  6733. @item 1mode
  6734. @item 2mode
  6735. @item 3mode
  6736. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6737. Default is @var{square}.
  6738. @end table
  6739. @subsection Commands
  6740. This filter supports the all above options as @ref{commands}.
  6741. @subsection Examples
  6742. @itemize
  6743. @item
  6744. Apply sharpen:
  6745. @example
  6746. 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"
  6747. @end example
  6748. @item
  6749. Apply blur:
  6750. @example
  6751. 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"
  6752. @end example
  6753. @item
  6754. Apply edge enhance:
  6755. @example
  6756. 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"
  6757. @end example
  6758. @item
  6759. Apply edge detect:
  6760. @example
  6761. 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"
  6762. @end example
  6763. @item
  6764. Apply laplacian edge detector which includes diagonals:
  6765. @example
  6766. 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"
  6767. @end example
  6768. @item
  6769. Apply emboss:
  6770. @example
  6771. 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"
  6772. @end example
  6773. @end itemize
  6774. @section convolve
  6775. Apply 2D convolution of video stream in frequency domain using second stream
  6776. as impulse.
  6777. The filter accepts the following options:
  6778. @table @option
  6779. @item planes
  6780. Set which planes to process.
  6781. @item impulse
  6782. Set which impulse video frames will be processed, can be @var{first}
  6783. or @var{all}. Default is @var{all}.
  6784. @end table
  6785. The @code{convolve} filter also supports the @ref{framesync} options.
  6786. @section copy
  6787. Copy the input video source unchanged to the output. This is mainly useful for
  6788. testing purposes.
  6789. @anchor{coreimage}
  6790. @section coreimage
  6791. Video filtering on GPU using Apple's CoreImage API on OSX.
  6792. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6793. processed by video hardware. However, software-based OpenGL implementations
  6794. exist which means there is no guarantee for hardware processing. It depends on
  6795. the respective OSX.
  6796. There are many filters and image generators provided by Apple that come with a
  6797. large variety of options. The filter has to be referenced by its name along
  6798. with its options.
  6799. The coreimage filter accepts the following options:
  6800. @table @option
  6801. @item list_filters
  6802. List all available filters and generators along with all their respective
  6803. options as well as possible minimum and maximum values along with the default
  6804. values.
  6805. @example
  6806. list_filters=true
  6807. @end example
  6808. @item filter
  6809. Specify all filters by their respective name and options.
  6810. Use @var{list_filters} to determine all valid filter names and options.
  6811. Numerical options are specified by a float value and are automatically clamped
  6812. to their respective value range. Vector and color options have to be specified
  6813. by a list of space separated float values. Character escaping has to be done.
  6814. A special option name @code{default} is available to use default options for a
  6815. filter.
  6816. It is required to specify either @code{default} or at least one of the filter options.
  6817. All omitted options are used with their default values.
  6818. The syntax of the filter string is as follows:
  6819. @example
  6820. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6821. @end example
  6822. @item output_rect
  6823. Specify a rectangle where the output of the filter chain is copied into the
  6824. input image. It is given by a list of space separated float values:
  6825. @example
  6826. output_rect=x\ y\ width\ height
  6827. @end example
  6828. If not given, the output rectangle equals the dimensions of the input image.
  6829. The output rectangle is automatically cropped at the borders of the input
  6830. image. Negative values are valid for each component.
  6831. @example
  6832. output_rect=25\ 25\ 100\ 100
  6833. @end example
  6834. @end table
  6835. Several filters can be chained for successive processing without GPU-HOST
  6836. transfers allowing for fast processing of complex filter chains.
  6837. Currently, only filters with zero (generators) or exactly one (filters) input
  6838. image and one output image are supported. Also, transition filters are not yet
  6839. usable as intended.
  6840. Some filters generate output images with additional padding depending on the
  6841. respective filter kernel. The padding is automatically removed to ensure the
  6842. filter output has the same size as the input image.
  6843. For image generators, the size of the output image is determined by the
  6844. previous output image of the filter chain or the input image of the whole
  6845. filterchain, respectively. The generators do not use the pixel information of
  6846. this image to generate their output. However, the generated output is
  6847. blended onto this image, resulting in partial or complete coverage of the
  6848. output image.
  6849. The @ref{coreimagesrc} video source can be used for generating input images
  6850. which are directly fed into the filter chain. By using it, providing input
  6851. images by another video source or an input video is not required.
  6852. @subsection Examples
  6853. @itemize
  6854. @item
  6855. List all filters available:
  6856. @example
  6857. coreimage=list_filters=true
  6858. @end example
  6859. @item
  6860. Use the CIBoxBlur filter with default options to blur an image:
  6861. @example
  6862. coreimage=filter=CIBoxBlur@@default
  6863. @end example
  6864. @item
  6865. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6866. its center at 100x100 and a radius of 50 pixels:
  6867. @example
  6868. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6869. @end example
  6870. @item
  6871. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6872. given as complete and escaped command-line for Apple's standard bash shell:
  6873. @example
  6874. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6875. @end example
  6876. @end itemize
  6877. @section cover_rect
  6878. Cover a rectangular object
  6879. It accepts the following options:
  6880. @table @option
  6881. @item cover
  6882. Filepath of the optional cover image, needs to be in yuv420.
  6883. @item mode
  6884. Set covering mode.
  6885. It accepts the following values:
  6886. @table @samp
  6887. @item cover
  6888. cover it by the supplied image
  6889. @item blur
  6890. cover it by interpolating the surrounding pixels
  6891. @end table
  6892. Default value is @var{blur}.
  6893. @end table
  6894. @subsection Examples
  6895. @itemize
  6896. @item
  6897. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6898. @example
  6899. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6900. @end example
  6901. @end itemize
  6902. @section crop
  6903. Crop the input video to given dimensions.
  6904. It accepts the following parameters:
  6905. @table @option
  6906. @item w, out_w
  6907. The width of the output video. It defaults to @code{iw}.
  6908. This expression is evaluated only once during the filter
  6909. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6910. @item h, out_h
  6911. The height of the output video. It defaults to @code{ih}.
  6912. This expression is evaluated only once during the filter
  6913. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6914. @item x
  6915. The horizontal position, in the input video, of the left edge of the output
  6916. video. It defaults to @code{(in_w-out_w)/2}.
  6917. This expression is evaluated per-frame.
  6918. @item y
  6919. The vertical position, in the input video, of the top edge of the output video.
  6920. It defaults to @code{(in_h-out_h)/2}.
  6921. This expression is evaluated per-frame.
  6922. @item keep_aspect
  6923. If set to 1 will force the output display aspect ratio
  6924. to be the same of the input, by changing the output sample aspect
  6925. ratio. It defaults to 0.
  6926. @item exact
  6927. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6928. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6929. It defaults to 0.
  6930. @end table
  6931. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6932. expressions containing the following constants:
  6933. @table @option
  6934. @item x
  6935. @item y
  6936. The computed values for @var{x} and @var{y}. They are evaluated for
  6937. each new frame.
  6938. @item in_w
  6939. @item in_h
  6940. The input width and height.
  6941. @item iw
  6942. @item ih
  6943. These are the same as @var{in_w} and @var{in_h}.
  6944. @item out_w
  6945. @item out_h
  6946. The output (cropped) width and height.
  6947. @item ow
  6948. @item oh
  6949. These are the same as @var{out_w} and @var{out_h}.
  6950. @item a
  6951. same as @var{iw} / @var{ih}
  6952. @item sar
  6953. input sample aspect ratio
  6954. @item dar
  6955. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6956. @item hsub
  6957. @item vsub
  6958. horizontal and vertical chroma subsample values. For example for the
  6959. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6960. @item n
  6961. The number of the input frame, starting from 0.
  6962. @item pos
  6963. the position in the file of the input frame, NAN if unknown
  6964. @item t
  6965. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6966. @end table
  6967. The expression for @var{out_w} may depend on the value of @var{out_h},
  6968. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6969. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6970. evaluated after @var{out_w} and @var{out_h}.
  6971. The @var{x} and @var{y} parameters specify the expressions for the
  6972. position of the top-left corner of the output (non-cropped) area. They
  6973. are evaluated for each frame. If the evaluated value is not valid, it
  6974. is approximated to the nearest valid value.
  6975. The expression for @var{x} may depend on @var{y}, and the expression
  6976. for @var{y} may depend on @var{x}.
  6977. @subsection Examples
  6978. @itemize
  6979. @item
  6980. Crop area with size 100x100 at position (12,34).
  6981. @example
  6982. crop=100:100:12:34
  6983. @end example
  6984. Using named options, the example above becomes:
  6985. @example
  6986. crop=w=100:h=100:x=12:y=34
  6987. @end example
  6988. @item
  6989. Crop the central input area with size 100x100:
  6990. @example
  6991. crop=100:100
  6992. @end example
  6993. @item
  6994. Crop the central input area with size 2/3 of the input video:
  6995. @example
  6996. crop=2/3*in_w:2/3*in_h
  6997. @end example
  6998. @item
  6999. Crop the input video central square:
  7000. @example
  7001. crop=out_w=in_h
  7002. crop=in_h
  7003. @end example
  7004. @item
  7005. Delimit the rectangle with the top-left corner placed at position
  7006. 100:100 and the right-bottom corner corresponding to the right-bottom
  7007. corner of the input image.
  7008. @example
  7009. crop=in_w-100:in_h-100:100:100
  7010. @end example
  7011. @item
  7012. Crop 10 pixels from the left and right borders, and 20 pixels from
  7013. the top and bottom borders
  7014. @example
  7015. crop=in_w-2*10:in_h-2*20
  7016. @end example
  7017. @item
  7018. Keep only the bottom right quarter of the input image:
  7019. @example
  7020. crop=in_w/2:in_h/2:in_w/2:in_h/2
  7021. @end example
  7022. @item
  7023. Crop height for getting Greek harmony:
  7024. @example
  7025. crop=in_w:1/PHI*in_w
  7026. @end example
  7027. @item
  7028. Apply trembling effect:
  7029. @example
  7030. 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)
  7031. @end example
  7032. @item
  7033. Apply erratic camera effect depending on timestamp:
  7034. @example
  7035. 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)"
  7036. @end example
  7037. @item
  7038. Set x depending on the value of y:
  7039. @example
  7040. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  7041. @end example
  7042. @end itemize
  7043. @subsection Commands
  7044. This filter supports the following commands:
  7045. @table @option
  7046. @item w, out_w
  7047. @item h, out_h
  7048. @item x
  7049. @item y
  7050. Set width/height of the output video and the horizontal/vertical position
  7051. in the input video.
  7052. The command accepts the same syntax of the corresponding option.
  7053. If the specified expression is not valid, it is kept at its current
  7054. value.
  7055. @end table
  7056. @section cropdetect
  7057. Auto-detect the crop size.
  7058. It calculates the necessary cropping parameters and prints the
  7059. recommended parameters via the logging system. The detected dimensions
  7060. correspond to the non-black area of the input video.
  7061. It accepts the following parameters:
  7062. @table @option
  7063. @item limit
  7064. Set higher black value threshold, which can be optionally specified
  7065. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  7066. value greater to the set value is considered non-black. It defaults to 24.
  7067. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  7068. on the bitdepth of the pixel format.
  7069. @item round
  7070. The value which the width/height should be divisible by. It defaults to
  7071. 16. The offset is automatically adjusted to center the video. Use 2 to
  7072. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7073. encoding to most video codecs.
  7074. @item skip
  7075. Set the number of initial frames for which evaluation is skipped.
  7076. Default is 2. Range is 0 to INT_MAX.
  7077. @item reset_count, reset
  7078. Set the counter that determines after how many frames cropdetect will
  7079. reset the previously detected largest video area and start over to
  7080. detect the current optimal crop area. Default value is 0.
  7081. This can be useful when channel logos distort the video area. 0
  7082. indicates 'never reset', and returns the largest area encountered during
  7083. playback.
  7084. @end table
  7085. @anchor{cue}
  7086. @section cue
  7087. Delay video filtering until a given wallclock timestamp. The filter first
  7088. passes on @option{preroll} amount of frames, then it buffers at most
  7089. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7090. it forwards the buffered frames and also any subsequent frames coming in its
  7091. input.
  7092. The filter can be used synchronize the output of multiple ffmpeg processes for
  7093. realtime output devices like decklink. By putting the delay in the filtering
  7094. chain and pre-buffering frames the process can pass on data to output almost
  7095. immediately after the target wallclock timestamp is reached.
  7096. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7097. some use cases.
  7098. @table @option
  7099. @item cue
  7100. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7101. @item preroll
  7102. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7103. @item buffer
  7104. The maximum duration of content to buffer before waiting for the cue expressed
  7105. in seconds. Default is 0.
  7106. @end table
  7107. @anchor{curves}
  7108. @section curves
  7109. Apply color adjustments using curves.
  7110. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  7111. component (red, green and blue) has its values defined by @var{N} key points
  7112. tied from each other using a smooth curve. The x-axis represents the pixel
  7113. values from the input frame, and the y-axis the new pixel values to be set for
  7114. the output frame.
  7115. By default, a component curve is defined by the two points @var{(0;0)} and
  7116. @var{(1;1)}. This creates a straight line where each original pixel value is
  7117. "adjusted" to its own value, which means no change to the image.
  7118. The filter allows you to redefine these two points and add some more. A new
  7119. curve (using a natural cubic spline interpolation) will be define to pass
  7120. smoothly through all these new coordinates. The new defined points needs to be
  7121. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  7122. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  7123. the vector spaces, the values will be clipped accordingly.
  7124. The filter accepts the following options:
  7125. @table @option
  7126. @item preset
  7127. Select one of the available color presets. This option can be used in addition
  7128. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  7129. options takes priority on the preset values.
  7130. Available presets are:
  7131. @table @samp
  7132. @item none
  7133. @item color_negative
  7134. @item cross_process
  7135. @item darker
  7136. @item increase_contrast
  7137. @item lighter
  7138. @item linear_contrast
  7139. @item medium_contrast
  7140. @item negative
  7141. @item strong_contrast
  7142. @item vintage
  7143. @end table
  7144. Default is @code{none}.
  7145. @item master, m
  7146. Set the master key points. These points will define a second pass mapping. It
  7147. is sometimes called a "luminance" or "value" mapping. It can be used with
  7148. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7149. post-processing LUT.
  7150. @item red, r
  7151. Set the key points for the red component.
  7152. @item green, g
  7153. Set the key points for the green component.
  7154. @item blue, b
  7155. Set the key points for the blue component.
  7156. @item all
  7157. Set the key points for all components (not including master).
  7158. Can be used in addition to the other key points component
  7159. options. In this case, the unset component(s) will fallback on this
  7160. @option{all} setting.
  7161. @item psfile
  7162. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7163. @item plot
  7164. Save Gnuplot script of the curves in specified file.
  7165. @end table
  7166. To avoid some filtergraph syntax conflicts, each key points list need to be
  7167. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7168. @subsection Commands
  7169. This filter supports same @ref{commands} as options.
  7170. @subsection Examples
  7171. @itemize
  7172. @item
  7173. Increase slightly the middle level of blue:
  7174. @example
  7175. curves=blue='0/0 0.5/0.58 1/1'
  7176. @end example
  7177. @item
  7178. Vintage effect:
  7179. @example
  7180. 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'
  7181. @end example
  7182. Here we obtain the following coordinates for each components:
  7183. @table @var
  7184. @item red
  7185. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7186. @item green
  7187. @code{(0;0) (0.50;0.48) (1;1)}
  7188. @item blue
  7189. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7190. @end table
  7191. @item
  7192. The previous example can also be achieved with the associated built-in preset:
  7193. @example
  7194. curves=preset=vintage
  7195. @end example
  7196. @item
  7197. Or simply:
  7198. @example
  7199. curves=vintage
  7200. @end example
  7201. @item
  7202. Use a Photoshop preset and redefine the points of the green component:
  7203. @example
  7204. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7205. @end example
  7206. @item
  7207. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7208. and @command{gnuplot}:
  7209. @example
  7210. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7211. gnuplot -p /tmp/curves.plt
  7212. @end example
  7213. @end itemize
  7214. @section datascope
  7215. Video data analysis filter.
  7216. This filter shows hexadecimal pixel values of part of video.
  7217. The filter accepts the following options:
  7218. @table @option
  7219. @item size, s
  7220. Set output video size.
  7221. @item x
  7222. Set x offset from where to pick pixels.
  7223. @item y
  7224. Set y offset from where to pick pixels.
  7225. @item mode
  7226. Set scope mode, can be one of the following:
  7227. @table @samp
  7228. @item mono
  7229. Draw hexadecimal pixel values with white color on black background.
  7230. @item color
  7231. Draw hexadecimal pixel values with input video pixel color on black
  7232. background.
  7233. @item color2
  7234. Draw hexadecimal pixel values on color background picked from input video,
  7235. the text color is picked in such way so its always visible.
  7236. @end table
  7237. @item axis
  7238. Draw rows and columns numbers on left and top of video.
  7239. @item opacity
  7240. Set background opacity.
  7241. @item format
  7242. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7243. @item components
  7244. Set pixel components to display. By default all pixel components are displayed.
  7245. @end table
  7246. @subsection Commands
  7247. This filter supports same @ref{commands} as options excluding @code{size} option.
  7248. @section dblur
  7249. Apply Directional blur filter.
  7250. The filter accepts the following options:
  7251. @table @option
  7252. @item angle
  7253. Set angle of directional blur. Default is @code{45}.
  7254. @item radius
  7255. Set radius of directional blur. Default is @code{5}.
  7256. @item planes
  7257. Set which planes to filter. By default all planes are filtered.
  7258. @end table
  7259. @subsection Commands
  7260. This filter supports same @ref{commands} as options.
  7261. The command accepts the same syntax of the corresponding option.
  7262. If the specified expression is not valid, it is kept at its current
  7263. value.
  7264. @section dctdnoiz
  7265. Denoise frames using 2D DCT (frequency domain filtering).
  7266. This filter is not designed for real time.
  7267. The filter accepts the following options:
  7268. @table @option
  7269. @item sigma, s
  7270. Set the noise sigma constant.
  7271. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7272. coefficient (absolute value) below this threshold with be dropped.
  7273. If you need a more advanced filtering, see @option{expr}.
  7274. Default is @code{0}.
  7275. @item overlap
  7276. Set number overlapping pixels for each block. Since the filter can be slow, you
  7277. may want to reduce this value, at the cost of a less effective filter and the
  7278. risk of various artefacts.
  7279. If the overlapping value doesn't permit processing the whole input width or
  7280. height, a warning will be displayed and according borders won't be denoised.
  7281. Default value is @var{blocksize}-1, which is the best possible setting.
  7282. @item expr, e
  7283. Set the coefficient factor expression.
  7284. For each coefficient of a DCT block, this expression will be evaluated as a
  7285. multiplier value for the coefficient.
  7286. If this is option is set, the @option{sigma} option will be ignored.
  7287. The absolute value of the coefficient can be accessed through the @var{c}
  7288. variable.
  7289. @item n
  7290. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7291. @var{blocksize}, which is the width and height of the processed blocks.
  7292. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7293. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7294. on the speed processing. Also, a larger block size does not necessarily means a
  7295. better de-noising.
  7296. @end table
  7297. @subsection Examples
  7298. Apply a denoise with a @option{sigma} of @code{4.5}:
  7299. @example
  7300. dctdnoiz=4.5
  7301. @end example
  7302. The same operation can be achieved using the expression system:
  7303. @example
  7304. dctdnoiz=e='gte(c, 4.5*3)'
  7305. @end example
  7306. Violent denoise using a block size of @code{16x16}:
  7307. @example
  7308. dctdnoiz=15:n=4
  7309. @end example
  7310. @section deband
  7311. Remove banding artifacts from input video.
  7312. It works by replacing banded pixels with average value of referenced pixels.
  7313. The filter accepts the following options:
  7314. @table @option
  7315. @item 1thr
  7316. @item 2thr
  7317. @item 3thr
  7318. @item 4thr
  7319. Set banding detection threshold for each plane. Default is 0.02.
  7320. Valid range is 0.00003 to 0.5.
  7321. If difference between current pixel and reference pixel is less than threshold,
  7322. it will be considered as banded.
  7323. @item range, r
  7324. Banding detection range in pixels. Default is 16. If positive, random number
  7325. in range 0 to set value will be used. If negative, exact absolute value
  7326. will be used.
  7327. The range defines square of four pixels around current pixel.
  7328. @item direction, d
  7329. Set direction in radians from which four pixel will be compared. If positive,
  7330. random direction from 0 to set direction will be picked. If negative, exact of
  7331. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7332. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7333. column.
  7334. @item blur, b
  7335. If enabled, current pixel is compared with average value of all four
  7336. surrounding pixels. The default is enabled. If disabled current pixel is
  7337. compared with all four surrounding pixels. The pixel is considered banded
  7338. if only all four differences with surrounding pixels are less than threshold.
  7339. @item coupling, c
  7340. If enabled, current pixel is changed if and only if all pixel components are banded,
  7341. e.g. banding detection threshold is triggered for all color components.
  7342. The default is disabled.
  7343. @end table
  7344. @subsection Commands
  7345. This filter supports the all above options as @ref{commands}.
  7346. @section deblock
  7347. Remove blocking artifacts from input video.
  7348. The filter accepts the following options:
  7349. @table @option
  7350. @item filter
  7351. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7352. This controls what kind of deblocking is applied.
  7353. @item block
  7354. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7355. @item alpha
  7356. @item beta
  7357. @item gamma
  7358. @item delta
  7359. Set blocking detection thresholds. Allowed range is 0 to 1.
  7360. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7361. Using higher threshold gives more deblocking strength.
  7362. Setting @var{alpha} controls threshold detection at exact edge of block.
  7363. Remaining options controls threshold detection near the edge. Each one for
  7364. below/above or left/right. Setting any of those to @var{0} disables
  7365. deblocking.
  7366. @item planes
  7367. Set planes to filter. Default is to filter all available planes.
  7368. @end table
  7369. @subsection Examples
  7370. @itemize
  7371. @item
  7372. Deblock using weak filter and block size of 4 pixels.
  7373. @example
  7374. deblock=filter=weak:block=4
  7375. @end example
  7376. @item
  7377. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7378. deblocking more edges.
  7379. @example
  7380. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7381. @end example
  7382. @item
  7383. Similar as above, but filter only first plane.
  7384. @example
  7385. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7386. @end example
  7387. @item
  7388. Similar as above, but filter only second and third plane.
  7389. @example
  7390. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7391. @end example
  7392. @end itemize
  7393. @subsection Commands
  7394. This filter supports the all above options as @ref{commands}.
  7395. @anchor{decimate}
  7396. @section decimate
  7397. Drop duplicated frames at regular intervals.
  7398. The filter accepts the following options:
  7399. @table @option
  7400. @item cycle
  7401. Set the number of frames from which one will be dropped. Setting this to
  7402. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7403. Default is @code{5}.
  7404. @item dupthresh
  7405. Set the threshold for duplicate detection. If the difference metric for a frame
  7406. is less than or equal to this value, then it is declared as duplicate. Default
  7407. is @code{1.1}
  7408. @item scthresh
  7409. Set scene change threshold. Default is @code{15}.
  7410. @item blockx
  7411. @item blocky
  7412. Set the size of the x and y-axis blocks used during metric calculations.
  7413. Larger blocks give better noise suppression, but also give worse detection of
  7414. small movements. Must be a power of two. Default is @code{32}.
  7415. @item ppsrc
  7416. Mark main input as a pre-processed input and activate clean source input
  7417. stream. This allows the input to be pre-processed with various filters to help
  7418. the metrics calculation while keeping the frame selection lossless. When set to
  7419. @code{1}, the first stream is for the pre-processed input, and the second
  7420. stream is the clean source from where the kept frames are chosen. Default is
  7421. @code{0}.
  7422. @item chroma
  7423. Set whether or not chroma is considered in the metric calculations. Default is
  7424. @code{1}.
  7425. @end table
  7426. @section deconvolve
  7427. Apply 2D deconvolution of video stream in frequency domain using second stream
  7428. as impulse.
  7429. The filter accepts the following options:
  7430. @table @option
  7431. @item planes
  7432. Set which planes to process.
  7433. @item impulse
  7434. Set which impulse video frames will be processed, can be @var{first}
  7435. or @var{all}. Default is @var{all}.
  7436. @item noise
  7437. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7438. and height are not same and not power of 2 or if stream prior to convolving
  7439. had noise.
  7440. @end table
  7441. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7442. @section dedot
  7443. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7444. It accepts the following options:
  7445. @table @option
  7446. @item m
  7447. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7448. @var{rainbows} for cross-color reduction.
  7449. @item lt
  7450. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7451. @item tl
  7452. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7453. @item tc
  7454. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7455. @item ct
  7456. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7457. @end table
  7458. @section deflate
  7459. Apply deflate effect to the video.
  7460. This filter replaces the pixel by the local(3x3) average by taking into account
  7461. only values lower than the pixel.
  7462. It accepts the following options:
  7463. @table @option
  7464. @item threshold0
  7465. @item threshold1
  7466. @item threshold2
  7467. @item threshold3
  7468. Limit the maximum change for each plane, default is 65535.
  7469. If 0, plane will remain unchanged.
  7470. @end table
  7471. @subsection Commands
  7472. This filter supports the all above options as @ref{commands}.
  7473. @section deflicker
  7474. Remove temporal frame luminance variations.
  7475. It accepts the following options:
  7476. @table @option
  7477. @item size, s
  7478. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7479. @item mode, m
  7480. Set averaging mode to smooth temporal luminance variations.
  7481. Available values are:
  7482. @table @samp
  7483. @item am
  7484. Arithmetic mean
  7485. @item gm
  7486. Geometric mean
  7487. @item hm
  7488. Harmonic mean
  7489. @item qm
  7490. Quadratic mean
  7491. @item cm
  7492. Cubic mean
  7493. @item pm
  7494. Power mean
  7495. @item median
  7496. Median
  7497. @end table
  7498. @item bypass
  7499. Do not actually modify frame. Useful when one only wants metadata.
  7500. @end table
  7501. @section dejudder
  7502. Remove judder produced by partially interlaced telecined content.
  7503. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7504. source was partially telecined content then the output of @code{pullup,dejudder}
  7505. will have a variable frame rate. May change the recorded frame rate of the
  7506. container. Aside from that change, this filter will not affect constant frame
  7507. rate video.
  7508. The option available in this filter is:
  7509. @table @option
  7510. @item cycle
  7511. Specify the length of the window over which the judder repeats.
  7512. Accepts any integer greater than 1. Useful values are:
  7513. @table @samp
  7514. @item 4
  7515. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7516. @item 5
  7517. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7518. @item 20
  7519. If a mixture of the two.
  7520. @end table
  7521. The default is @samp{4}.
  7522. @end table
  7523. @section delogo
  7524. Suppress a TV station logo by a simple interpolation of the surrounding
  7525. pixels. Just set a rectangle covering the logo and watch it disappear
  7526. (and sometimes something even uglier appear - your mileage may vary).
  7527. It accepts the following parameters:
  7528. @table @option
  7529. @item x
  7530. @item y
  7531. Specify the top left corner coordinates of the logo. They must be
  7532. specified.
  7533. @item w
  7534. @item h
  7535. Specify the width and height of the logo to clear. They must be
  7536. specified.
  7537. @item show
  7538. When set to 1, a green rectangle is drawn on the screen to simplify
  7539. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7540. The default value is 0.
  7541. The rectangle is drawn on the outermost pixels which will be (partly)
  7542. replaced with interpolated values. The values of the next pixels
  7543. immediately outside this rectangle in each direction will be used to
  7544. compute the interpolated pixel values inside the rectangle.
  7545. @end table
  7546. @subsection Examples
  7547. @itemize
  7548. @item
  7549. Set a rectangle covering the area with top left corner coordinates 0,0
  7550. and size 100x77:
  7551. @example
  7552. delogo=x=0:y=0:w=100:h=77
  7553. @end example
  7554. @end itemize
  7555. @anchor{derain}
  7556. @section derain
  7557. Remove the rain in the input image/video by applying the derain methods based on
  7558. convolutional neural networks. Supported models:
  7559. @itemize
  7560. @item
  7561. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7562. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7563. @end itemize
  7564. Training as well as model generation scripts are provided in
  7565. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7566. Native model files (.model) can be generated from TensorFlow model
  7567. files (.pb) by using tools/python/convert.py
  7568. The filter accepts the following options:
  7569. @table @option
  7570. @item filter_type
  7571. Specify which filter to use. This option accepts the following values:
  7572. @table @samp
  7573. @item derain
  7574. Derain filter. To conduct derain filter, you need to use a derain model.
  7575. @item dehaze
  7576. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7577. @end table
  7578. Default value is @samp{derain}.
  7579. @item dnn_backend
  7580. Specify which DNN backend to use for model loading and execution. This option accepts
  7581. the following values:
  7582. @table @samp
  7583. @item native
  7584. Native implementation of DNN loading and execution.
  7585. @item tensorflow
  7586. TensorFlow backend. To enable this backend you
  7587. need to install the TensorFlow for C library (see
  7588. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7589. @code{--enable-libtensorflow}
  7590. @end table
  7591. Default value is @samp{native}.
  7592. @item model
  7593. Set path to model file specifying network architecture and its parameters.
  7594. Note that different backends use different file formats. TensorFlow and native
  7595. backend can load files for only its format.
  7596. @end table
  7597. It can also be finished with @ref{dnn_processing} filter.
  7598. @section deshake
  7599. Attempt to fix small changes in horizontal and/or vertical shift. This
  7600. filter helps remove camera shake from hand-holding a camera, bumping a
  7601. tripod, moving on a vehicle, etc.
  7602. The filter accepts the following options:
  7603. @table @option
  7604. @item x
  7605. @item y
  7606. @item w
  7607. @item h
  7608. Specify a rectangular area where to limit the search for motion
  7609. vectors.
  7610. If desired the search for motion vectors can be limited to a
  7611. rectangular area of the frame defined by its top left corner, width
  7612. and height. These parameters have the same meaning as the drawbox
  7613. filter which can be used to visualise the position of the bounding
  7614. box.
  7615. This is useful when simultaneous movement of subjects within the frame
  7616. might be confused for camera motion by the motion vector search.
  7617. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7618. then the full frame is used. This allows later options to be set
  7619. without specifying the bounding box for the motion vector search.
  7620. Default - search the whole frame.
  7621. @item rx
  7622. @item ry
  7623. Specify the maximum extent of movement in x and y directions in the
  7624. range 0-64 pixels. Default 16.
  7625. @item edge
  7626. Specify how to generate pixels to fill blanks at the edge of the
  7627. frame. Available values are:
  7628. @table @samp
  7629. @item blank, 0
  7630. Fill zeroes at blank locations
  7631. @item original, 1
  7632. Original image at blank locations
  7633. @item clamp, 2
  7634. Extruded edge value at blank locations
  7635. @item mirror, 3
  7636. Mirrored edge at blank locations
  7637. @end table
  7638. Default value is @samp{mirror}.
  7639. @item blocksize
  7640. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7641. default 8.
  7642. @item contrast
  7643. Specify the contrast threshold for blocks. Only blocks with more than
  7644. the specified contrast (difference between darkest and lightest
  7645. pixels) will be considered. Range 1-255, default 125.
  7646. @item search
  7647. Specify the search strategy. Available values are:
  7648. @table @samp
  7649. @item exhaustive, 0
  7650. Set exhaustive search
  7651. @item less, 1
  7652. Set less exhaustive search.
  7653. @end table
  7654. Default value is @samp{exhaustive}.
  7655. @item filename
  7656. If set then a detailed log of the motion search is written to the
  7657. specified file.
  7658. @end table
  7659. @section despill
  7660. Remove unwanted contamination of foreground colors, caused by reflected color of
  7661. greenscreen or bluescreen.
  7662. This filter accepts the following options:
  7663. @table @option
  7664. @item type
  7665. Set what type of despill to use.
  7666. @item mix
  7667. Set how spillmap will be generated.
  7668. @item expand
  7669. Set how much to get rid of still remaining spill.
  7670. @item red
  7671. Controls amount of red in spill area.
  7672. @item green
  7673. Controls amount of green in spill area.
  7674. Should be -1 for greenscreen.
  7675. @item blue
  7676. Controls amount of blue in spill area.
  7677. Should be -1 for bluescreen.
  7678. @item brightness
  7679. Controls brightness of spill area, preserving colors.
  7680. @item alpha
  7681. Modify alpha from generated spillmap.
  7682. @end table
  7683. @subsection Commands
  7684. This filter supports the all above options as @ref{commands}.
  7685. @section detelecine
  7686. Apply an exact inverse of the telecine operation. It requires a predefined
  7687. pattern specified using the pattern option which must be the same as that passed
  7688. to the telecine filter.
  7689. This filter accepts the following options:
  7690. @table @option
  7691. @item first_field
  7692. @table @samp
  7693. @item top, t
  7694. top field first
  7695. @item bottom, b
  7696. bottom field first
  7697. The default value is @code{top}.
  7698. @end table
  7699. @item pattern
  7700. A string of numbers representing the pulldown pattern you wish to apply.
  7701. The default value is @code{23}.
  7702. @item start_frame
  7703. A number representing position of the first frame with respect to the telecine
  7704. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7705. @end table
  7706. @section dilation
  7707. Apply dilation effect to the video.
  7708. This filter replaces the pixel by the local(3x3) maximum.
  7709. It accepts the following options:
  7710. @table @option
  7711. @item threshold0
  7712. @item threshold1
  7713. @item threshold2
  7714. @item threshold3
  7715. Limit the maximum change for each plane, default is 65535.
  7716. If 0, plane will remain unchanged.
  7717. @item coordinates
  7718. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7719. pixels are used.
  7720. Flags to local 3x3 coordinates maps like this:
  7721. 1 2 3
  7722. 4 5
  7723. 6 7 8
  7724. @end table
  7725. @subsection Commands
  7726. This filter supports the all above options as @ref{commands}.
  7727. @section displace
  7728. Displace pixels as indicated by second and third input stream.
  7729. It takes three input streams and outputs one stream, the first input is the
  7730. source, and second and third input are displacement maps.
  7731. The second input specifies how much to displace pixels along the
  7732. x-axis, while the third input specifies how much to displace pixels
  7733. along the y-axis.
  7734. If one of displacement map streams terminates, last frame from that
  7735. displacement map will be used.
  7736. Note that once generated, displacements maps can be reused over and over again.
  7737. A description of the accepted options follows.
  7738. @table @option
  7739. @item edge
  7740. Set displace behavior for pixels that are out of range.
  7741. Available values are:
  7742. @table @samp
  7743. @item blank
  7744. Missing pixels are replaced by black pixels.
  7745. @item smear
  7746. Adjacent pixels will spread out to replace missing pixels.
  7747. @item wrap
  7748. Out of range pixels are wrapped so they point to pixels of other side.
  7749. @item mirror
  7750. Out of range pixels will be replaced with mirrored pixels.
  7751. @end table
  7752. Default is @samp{smear}.
  7753. @end table
  7754. @subsection Examples
  7755. @itemize
  7756. @item
  7757. Add ripple effect to rgb input of video size hd720:
  7758. @example
  7759. 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
  7760. @end example
  7761. @item
  7762. Add wave effect to rgb input of video size hd720:
  7763. @example
  7764. 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
  7765. @end example
  7766. @end itemize
  7767. @section dnn_detect
  7768. Do object detection with deep neural networks.
  7769. The filter accepts the following options:
  7770. @table @option
  7771. @item dnn_backend
  7772. Specify which DNN backend to use for model loading and execution. This option accepts
  7773. only openvino now, tensorflow backends will be added.
  7774. @item model
  7775. Set path to model file specifying network architecture and its parameters.
  7776. Note that different backends use different file formats.
  7777. @item input
  7778. Set the input name of the dnn network.
  7779. @item output
  7780. Set the output name of the dnn network.
  7781. @item confidence
  7782. Set the confidence threshold (default: 0.5).
  7783. @item labels
  7784. Set path to label file specifying the mapping between label id and name.
  7785. Each label name is written in one line, tailing spaces and empty lines are skipped.
  7786. The first line is the name of label id 0 (usually it is 'background'),
  7787. and the second line is the name of label id 1, etc.
  7788. The label id is considered as name if the label file is not provided.
  7789. @item backend_configs
  7790. Set the configs to be passed into backend
  7791. @item async
  7792. use DNN async execution if set (default: set),
  7793. roll back to sync execution if the backend does not support async.
  7794. @end table
  7795. @anchor{dnn_processing}
  7796. @section dnn_processing
  7797. Do image processing with deep neural networks. It works together with another filter
  7798. which converts the pixel format of the Frame to what the dnn network requires.
  7799. The filter accepts the following options:
  7800. @table @option
  7801. @item dnn_backend
  7802. Specify which DNN backend to use for model loading and execution. This option accepts
  7803. the following values:
  7804. @table @samp
  7805. @item native
  7806. Native implementation of DNN loading and execution.
  7807. @item tensorflow
  7808. TensorFlow backend. To enable this backend you
  7809. need to install the TensorFlow for C library (see
  7810. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7811. @code{--enable-libtensorflow}
  7812. @item openvino
  7813. OpenVINO backend. To enable this backend you
  7814. need to build and install the OpenVINO for C library (see
  7815. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7816. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7817. be needed if the header files and libraries are not installed into system path)
  7818. @end table
  7819. Default value is @samp{native}.
  7820. @item model
  7821. Set path to model file specifying network architecture and its parameters.
  7822. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7823. backend can load files for only its format.
  7824. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7825. @item input
  7826. Set the input name of the dnn network.
  7827. @item output
  7828. Set the output name of the dnn network.
  7829. @item async
  7830. use DNN async execution if set (default: set),
  7831. roll back to sync execution if the backend does not support async.
  7832. @end table
  7833. @subsection Examples
  7834. @itemize
  7835. @item
  7836. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7837. @example
  7838. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7839. @end example
  7840. @item
  7841. Halve the pixel value of the frame with format gray32f:
  7842. @example
  7843. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7844. @end example
  7845. @item
  7846. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7847. @example
  7848. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7849. @end example
  7850. @item
  7851. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7852. @example
  7853. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7854. @end example
  7855. @end itemize
  7856. @section drawbox
  7857. Draw a colored box on the input image.
  7858. It accepts the following parameters:
  7859. @table @option
  7860. @item x
  7861. @item y
  7862. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7863. @item width, w
  7864. @item height, h
  7865. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7866. the input width and height. It defaults to 0.
  7867. @item color, c
  7868. Specify the color of the box to write. For the general syntax of this option,
  7869. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7870. value @code{invert} is used, the box edge color is the same as the
  7871. video with inverted luma.
  7872. @item thickness, t
  7873. The expression which sets the thickness of the box edge.
  7874. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7875. See below for the list of accepted constants.
  7876. @item replace
  7877. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7878. will overwrite the video's color and alpha pixels.
  7879. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7880. @end table
  7881. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7882. following constants:
  7883. @table @option
  7884. @item dar
  7885. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7886. @item hsub
  7887. @item vsub
  7888. horizontal and vertical chroma subsample values. For example for the
  7889. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7890. @item in_h, ih
  7891. @item in_w, iw
  7892. The input width and height.
  7893. @item sar
  7894. The input sample aspect ratio.
  7895. @item x
  7896. @item y
  7897. The x and y offset coordinates where the box is drawn.
  7898. @item w
  7899. @item h
  7900. The width and height of the drawn box.
  7901. @item t
  7902. The thickness of the drawn box.
  7903. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7904. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7905. @end table
  7906. @subsection Examples
  7907. @itemize
  7908. @item
  7909. Draw a black box around the edge of the input image:
  7910. @example
  7911. drawbox
  7912. @end example
  7913. @item
  7914. Draw a box with color red and an opacity of 50%:
  7915. @example
  7916. drawbox=10:20:200:60:red@@0.5
  7917. @end example
  7918. The previous example can be specified as:
  7919. @example
  7920. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7921. @end example
  7922. @item
  7923. Fill the box with pink color:
  7924. @example
  7925. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7926. @end example
  7927. @item
  7928. Draw a 2-pixel red 2.40:1 mask:
  7929. @example
  7930. 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
  7931. @end example
  7932. @end itemize
  7933. @subsection Commands
  7934. This filter supports same commands as options.
  7935. The command accepts the same syntax of the corresponding option.
  7936. If the specified expression is not valid, it is kept at its current
  7937. value.
  7938. @anchor{drawgraph}
  7939. @section drawgraph
  7940. Draw a graph using input video metadata.
  7941. It accepts the following parameters:
  7942. @table @option
  7943. @item m1
  7944. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7945. @item fg1
  7946. Set 1st foreground color expression.
  7947. @item m2
  7948. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7949. @item fg2
  7950. Set 2nd foreground color expression.
  7951. @item m3
  7952. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7953. @item fg3
  7954. Set 3rd foreground color expression.
  7955. @item m4
  7956. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7957. @item fg4
  7958. Set 4th foreground color expression.
  7959. @item min
  7960. Set minimal value of metadata value.
  7961. @item max
  7962. Set maximal value of metadata value.
  7963. @item bg
  7964. Set graph background color. Default is white.
  7965. @item mode
  7966. Set graph mode.
  7967. Available values for mode is:
  7968. @table @samp
  7969. @item bar
  7970. @item dot
  7971. @item line
  7972. @end table
  7973. Default is @code{line}.
  7974. @item slide
  7975. Set slide mode.
  7976. Available values for slide is:
  7977. @table @samp
  7978. @item frame
  7979. Draw new frame when right border is reached.
  7980. @item replace
  7981. Replace old columns with new ones.
  7982. @item scroll
  7983. Scroll from right to left.
  7984. @item rscroll
  7985. Scroll from left to right.
  7986. @item picture
  7987. Draw single picture.
  7988. @end table
  7989. Default is @code{frame}.
  7990. @item size
  7991. Set size of graph video. For the syntax of this option, check the
  7992. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7993. The default value is @code{900x256}.
  7994. @item rate, r
  7995. Set the output frame rate. Default value is @code{25}.
  7996. The foreground color expressions can use the following variables:
  7997. @table @option
  7998. @item MIN
  7999. Minimal value of metadata value.
  8000. @item MAX
  8001. Maximal value of metadata value.
  8002. @item VAL
  8003. Current metadata key value.
  8004. @end table
  8005. The color is defined as 0xAABBGGRR.
  8006. @end table
  8007. Example using metadata from @ref{signalstats} filter:
  8008. @example
  8009. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  8010. @end example
  8011. Example using metadata from @ref{ebur128} filter:
  8012. @example
  8013. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  8014. @end example
  8015. @section drawgrid
  8016. Draw a grid on the input image.
  8017. It accepts the following parameters:
  8018. @table @option
  8019. @item x
  8020. @item y
  8021. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  8022. @item width, w
  8023. @item height, h
  8024. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  8025. input width and height, respectively, minus @code{thickness}, so image gets
  8026. framed. Default to 0.
  8027. @item color, c
  8028. Specify the color of the grid. For the general syntax of this option,
  8029. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8030. value @code{invert} is used, the grid color is the same as the
  8031. video with inverted luma.
  8032. @item thickness, t
  8033. The expression which sets the thickness of the grid line. Default value is @code{1}.
  8034. See below for the list of accepted constants.
  8035. @item replace
  8036. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  8037. will overwrite the video's color and alpha pixels.
  8038. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  8039. @end table
  8040. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8041. following constants:
  8042. @table @option
  8043. @item dar
  8044. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8045. @item hsub
  8046. @item vsub
  8047. horizontal and vertical chroma subsample values. For example for the
  8048. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8049. @item in_h, ih
  8050. @item in_w, iw
  8051. The input grid cell width and height.
  8052. @item sar
  8053. The input sample aspect ratio.
  8054. @item x
  8055. @item y
  8056. The x and y coordinates of some point of grid intersection (meant to configure offset).
  8057. @item w
  8058. @item h
  8059. The width and height of the drawn cell.
  8060. @item t
  8061. The thickness of the drawn cell.
  8062. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8063. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8064. @end table
  8065. @subsection Examples
  8066. @itemize
  8067. @item
  8068. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  8069. @example
  8070. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  8071. @end example
  8072. @item
  8073. Draw a white 3x3 grid with an opacity of 50%:
  8074. @example
  8075. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  8076. @end example
  8077. @end itemize
  8078. @subsection Commands
  8079. This filter supports same commands as options.
  8080. The command accepts the same syntax of the corresponding option.
  8081. If the specified expression is not valid, it is kept at its current
  8082. value.
  8083. @anchor{drawtext}
  8084. @section drawtext
  8085. Draw a text string or text from a specified file on top of a video, using the
  8086. libfreetype library.
  8087. To enable compilation of this filter, you need to configure FFmpeg with
  8088. @code{--enable-libfreetype}.
  8089. To enable default font fallback and the @var{font} option you need to
  8090. configure FFmpeg with @code{--enable-libfontconfig}.
  8091. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  8092. @code{--enable-libfribidi}.
  8093. @subsection Syntax
  8094. It accepts the following parameters:
  8095. @table @option
  8096. @item box
  8097. Used to draw a box around text using the background color.
  8098. The value must be either 1 (enable) or 0 (disable).
  8099. The default value of @var{box} is 0.
  8100. @item boxborderw
  8101. Set the width of the border to be drawn around the box using @var{boxcolor}.
  8102. The default value of @var{boxborderw} is 0.
  8103. @item boxcolor
  8104. The color to be used for drawing box around text. For the syntax of this
  8105. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8106. The default value of @var{boxcolor} is "white".
  8107. @item line_spacing
  8108. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  8109. The default value of @var{line_spacing} is 0.
  8110. @item borderw
  8111. Set the width of the border to be drawn around the text using @var{bordercolor}.
  8112. The default value of @var{borderw} is 0.
  8113. @item bordercolor
  8114. Set the color to be used for drawing border around text. For the syntax of this
  8115. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8116. The default value of @var{bordercolor} is "black".
  8117. @item expansion
  8118. Select how the @var{text} is expanded. Can be either @code{none},
  8119. @code{strftime} (deprecated) or
  8120. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  8121. below for details.
  8122. @item basetime
  8123. Set a start time for the count. Value is in microseconds. Only applied
  8124. in the deprecated strftime expansion mode. To emulate in normal expansion
  8125. mode use the @code{pts} function, supplying the start time (in seconds)
  8126. as the second argument.
  8127. @item fix_bounds
  8128. If true, check and fix text coords to avoid clipping.
  8129. @item fontcolor
  8130. The color to be used for drawing fonts. For the syntax of this option, check
  8131. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8132. The default value of @var{fontcolor} is "black".
  8133. @item fontcolor_expr
  8134. String which is expanded the same way as @var{text} to obtain dynamic
  8135. @var{fontcolor} value. By default this option has empty value and is not
  8136. processed. When this option is set, it overrides @var{fontcolor} option.
  8137. @item font
  8138. The font family to be used for drawing text. By default Sans.
  8139. @item fontfile
  8140. The font file to be used for drawing text. The path must be included.
  8141. This parameter is mandatory if the fontconfig support is disabled.
  8142. @item alpha
  8143. Draw the text applying alpha blending. The value can
  8144. be a number between 0.0 and 1.0.
  8145. The expression accepts the same variables @var{x, y} as well.
  8146. The default value is 1.
  8147. Please see @var{fontcolor_expr}.
  8148. @item fontsize
  8149. The font size to be used for drawing text.
  8150. The default value of @var{fontsize} is 16.
  8151. @item text_shaping
  8152. If set to 1, attempt to shape the text (for example, reverse the order of
  8153. right-to-left text and join Arabic characters) before drawing it.
  8154. Otherwise, just draw the text exactly as given.
  8155. By default 1 (if supported).
  8156. @item ft_load_flags
  8157. The flags to be used for loading the fonts.
  8158. The flags map the corresponding flags supported by libfreetype, and are
  8159. a combination of the following values:
  8160. @table @var
  8161. @item default
  8162. @item no_scale
  8163. @item no_hinting
  8164. @item render
  8165. @item no_bitmap
  8166. @item vertical_layout
  8167. @item force_autohint
  8168. @item crop_bitmap
  8169. @item pedantic
  8170. @item ignore_global_advance_width
  8171. @item no_recurse
  8172. @item ignore_transform
  8173. @item monochrome
  8174. @item linear_design
  8175. @item no_autohint
  8176. @end table
  8177. Default value is "default".
  8178. For more information consult the documentation for the FT_LOAD_*
  8179. libfreetype flags.
  8180. @item shadowcolor
  8181. The color to be used for drawing a shadow behind the drawn text. For the
  8182. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8183. ffmpeg-utils manual,ffmpeg-utils}.
  8184. The default value of @var{shadowcolor} is "black".
  8185. @item shadowx
  8186. @item shadowy
  8187. The x and y offsets for the text shadow position with respect to the
  8188. position of the text. They can be either positive or negative
  8189. values. The default value for both is "0".
  8190. @item start_number
  8191. The starting frame number for the n/frame_num variable. The default value
  8192. is "0".
  8193. @item tabsize
  8194. The size in number of spaces to use for rendering the tab.
  8195. Default value is 4.
  8196. @item timecode
  8197. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8198. format. It can be used with or without text parameter. @var{timecode_rate}
  8199. option must be specified.
  8200. @item timecode_rate, rate, r
  8201. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8202. integer. Minimum value is "1".
  8203. Drop-frame timecode is supported for frame rates 30 & 60.
  8204. @item tc24hmax
  8205. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8206. Default is 0 (disabled).
  8207. @item text
  8208. The text string to be drawn. The text must be a sequence of UTF-8
  8209. encoded characters.
  8210. This parameter is mandatory if no file is specified with the parameter
  8211. @var{textfile}.
  8212. @item textfile
  8213. A text file containing text to be drawn. The text must be a sequence
  8214. of UTF-8 encoded characters.
  8215. This parameter is mandatory if no text string is specified with the
  8216. parameter @var{text}.
  8217. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8218. @item reload
  8219. If set to 1, the @var{textfile} will be reloaded before each frame.
  8220. Be sure to update it atomically, or it may be read partially, or even fail.
  8221. @item x
  8222. @item y
  8223. The expressions which specify the offsets where text will be drawn
  8224. within the video frame. They are relative to the top/left border of the
  8225. output image.
  8226. The default value of @var{x} and @var{y} is "0".
  8227. See below for the list of accepted constants and functions.
  8228. @end table
  8229. The parameters for @var{x} and @var{y} are expressions containing the
  8230. following constants and functions:
  8231. @table @option
  8232. @item dar
  8233. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8234. @item hsub
  8235. @item vsub
  8236. horizontal and vertical chroma subsample values. For example for the
  8237. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8238. @item line_h, lh
  8239. the height of each text line
  8240. @item main_h, h, H
  8241. the input height
  8242. @item main_w, w, W
  8243. the input width
  8244. @item max_glyph_a, ascent
  8245. the maximum distance from the baseline to the highest/upper grid
  8246. coordinate used to place a glyph outline point, for all the rendered
  8247. glyphs.
  8248. It is a positive value, due to the grid's orientation with the Y axis
  8249. upwards.
  8250. @item max_glyph_d, descent
  8251. the maximum distance from the baseline to the lowest grid coordinate
  8252. used to place a glyph outline point, for all the rendered glyphs.
  8253. This is a negative value, due to the grid's orientation, with the Y axis
  8254. upwards.
  8255. @item max_glyph_h
  8256. maximum glyph height, that is the maximum height for all the glyphs
  8257. contained in the rendered text, it is equivalent to @var{ascent} -
  8258. @var{descent}.
  8259. @item max_glyph_w
  8260. maximum glyph width, that is the maximum width for all the glyphs
  8261. contained in the rendered text
  8262. @item n
  8263. the number of input frame, starting from 0
  8264. @item rand(min, max)
  8265. return a random number included between @var{min} and @var{max}
  8266. @item sar
  8267. The input sample aspect ratio.
  8268. @item t
  8269. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8270. @item text_h, th
  8271. the height of the rendered text
  8272. @item text_w, tw
  8273. the width of the rendered text
  8274. @item x
  8275. @item y
  8276. the x and y offset coordinates where the text is drawn.
  8277. These parameters allow the @var{x} and @var{y} expressions to refer
  8278. to each other, so you can for example specify @code{y=x/dar}.
  8279. @item pict_type
  8280. A one character description of the current frame's picture type.
  8281. @item pkt_pos
  8282. The current packet's position in the input file or stream
  8283. (in bytes, from the start of the input). A value of -1 indicates
  8284. this info is not available.
  8285. @item pkt_duration
  8286. The current packet's duration, in seconds.
  8287. @item pkt_size
  8288. The current packet's size (in bytes).
  8289. @end table
  8290. @anchor{drawtext_expansion}
  8291. @subsection Text expansion
  8292. If @option{expansion} is set to @code{strftime},
  8293. the filter recognizes strftime() sequences in the provided text and
  8294. expands them accordingly. Check the documentation of strftime(). This
  8295. feature is deprecated.
  8296. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8297. If @option{expansion} is set to @code{normal} (which is the default),
  8298. the following expansion mechanism is used.
  8299. The backslash character @samp{\}, followed by any character, always expands to
  8300. the second character.
  8301. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8302. braces is a function name, possibly followed by arguments separated by ':'.
  8303. If the arguments contain special characters or delimiters (':' or '@}'),
  8304. they should be escaped.
  8305. Note that they probably must also be escaped as the value for the
  8306. @option{text} option in the filter argument string and as the filter
  8307. argument in the filtergraph description, and possibly also for the shell,
  8308. that makes up to four levels of escaping; using a text file avoids these
  8309. problems.
  8310. The following functions are available:
  8311. @table @command
  8312. @item expr, e
  8313. The expression evaluation result.
  8314. It must take one argument specifying the expression to be evaluated,
  8315. which accepts the same constants and functions as the @var{x} and
  8316. @var{y} values. Note that not all constants should be used, for
  8317. example the text size is not known when evaluating the expression, so
  8318. the constants @var{text_w} and @var{text_h} will have an undefined
  8319. value.
  8320. @item expr_int_format, eif
  8321. Evaluate the expression's value and output as formatted integer.
  8322. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8323. The second argument specifies the output format. Allowed values are @samp{x},
  8324. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8325. @code{printf} function.
  8326. The third parameter is optional and sets the number of positions taken by the output.
  8327. It can be used to add padding with zeros from the left.
  8328. @item gmtime
  8329. The time at which the filter is running, expressed in UTC.
  8330. It can accept an argument: a strftime() format string.
  8331. @item localtime
  8332. The time at which the filter is running, expressed in the local time zone.
  8333. It can accept an argument: a strftime() format string.
  8334. @item metadata
  8335. Frame metadata. Takes one or two arguments.
  8336. The first argument is mandatory and specifies the metadata key.
  8337. The second argument is optional and specifies a default value, used when the
  8338. metadata key is not found or empty.
  8339. Available metadata can be identified by inspecting entries
  8340. starting with TAG included within each frame section
  8341. printed by running @code{ffprobe -show_frames}.
  8342. String metadata generated in filters leading to
  8343. the drawtext filter are also available.
  8344. @item n, frame_num
  8345. The frame number, starting from 0.
  8346. @item pict_type
  8347. A one character description of the current picture type.
  8348. @item pts
  8349. The timestamp of the current frame.
  8350. It can take up to three arguments.
  8351. The first argument is the format of the timestamp; it defaults to @code{flt}
  8352. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8353. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8354. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8355. @code{localtime} stands for the timestamp of the frame formatted as
  8356. local time zone time.
  8357. The second argument is an offset added to the timestamp.
  8358. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8359. supplied to present the hour part of the formatted timestamp in 24h format
  8360. (00-23).
  8361. If the format is set to @code{localtime} or @code{gmtime},
  8362. a third argument may be supplied: a strftime() format string.
  8363. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8364. @end table
  8365. @subsection Commands
  8366. This filter supports altering parameters via commands:
  8367. @table @option
  8368. @item reinit
  8369. Alter existing filter parameters.
  8370. Syntax for the argument is the same as for filter invocation, e.g.
  8371. @example
  8372. fontsize=56:fontcolor=green:text='Hello World'
  8373. @end example
  8374. Full filter invocation with sendcmd would look like this:
  8375. @example
  8376. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8377. @end example
  8378. @end table
  8379. If the entire argument can't be parsed or applied as valid values then the filter will
  8380. continue with its existing parameters.
  8381. @subsection Examples
  8382. @itemize
  8383. @item
  8384. Draw "Test Text" with font FreeSerif, using the default values for the
  8385. optional parameters.
  8386. @example
  8387. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8388. @end example
  8389. @item
  8390. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8391. and y=50 (counting from the top-left corner of the screen), text is
  8392. yellow with a red box around it. Both the text and the box have an
  8393. opacity of 20%.
  8394. @example
  8395. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8396. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8397. @end example
  8398. Note that the double quotes are not necessary if spaces are not used
  8399. within the parameter list.
  8400. @item
  8401. Show the text at the center of the video frame:
  8402. @example
  8403. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8404. @end example
  8405. @item
  8406. Show the text at a random position, switching to a new position every 30 seconds:
  8407. @example
  8408. 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)"
  8409. @end example
  8410. @item
  8411. Show a text line sliding from right to left in the last row of the video
  8412. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8413. with no newlines.
  8414. @example
  8415. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8416. @end example
  8417. @item
  8418. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8419. @example
  8420. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8421. @end example
  8422. @item
  8423. Draw a single green letter "g", at the center of the input video.
  8424. The glyph baseline is placed at half screen height.
  8425. @example
  8426. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8427. @end example
  8428. @item
  8429. Show text for 1 second every 3 seconds:
  8430. @example
  8431. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8432. @end example
  8433. @item
  8434. Use fontconfig to set the font. Note that the colons need to be escaped.
  8435. @example
  8436. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8437. @end example
  8438. @item
  8439. Draw "Test Text" with font size dependent on height of the video.
  8440. @example
  8441. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8442. @end example
  8443. @item
  8444. Print the date of a real-time encoding (see strftime(3)):
  8445. @example
  8446. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8447. @end example
  8448. @item
  8449. Show text fading in and out (appearing/disappearing):
  8450. @example
  8451. #!/bin/sh
  8452. DS=1.0 # display start
  8453. DE=10.0 # display end
  8454. FID=1.5 # fade in duration
  8455. FOD=5 # fade out duration
  8456. 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 @}"
  8457. @end example
  8458. @item
  8459. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8460. and the @option{fontsize} value are included in the @option{y} offset.
  8461. @example
  8462. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8463. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8464. @end example
  8465. @item
  8466. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8467. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8468. must have option @option{-export_path_metadata 1} for the special metadata fields
  8469. to be available for filters.
  8470. @example
  8471. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8472. @end example
  8473. @end itemize
  8474. For more information about libfreetype, check:
  8475. @url{http://www.freetype.org/}.
  8476. For more information about fontconfig, check:
  8477. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8478. For more information about libfribidi, check:
  8479. @url{http://fribidi.org/}.
  8480. @section edgedetect
  8481. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8482. The filter accepts the following options:
  8483. @table @option
  8484. @item low
  8485. @item high
  8486. Set low and high threshold values used by the Canny thresholding
  8487. algorithm.
  8488. The high threshold selects the "strong" edge pixels, which are then
  8489. connected through 8-connectivity with the "weak" edge pixels selected
  8490. by the low threshold.
  8491. @var{low} and @var{high} threshold values must be chosen in the range
  8492. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8493. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8494. is @code{50/255}.
  8495. @item mode
  8496. Define the drawing mode.
  8497. @table @samp
  8498. @item wires
  8499. Draw white/gray wires on black background.
  8500. @item colormix
  8501. Mix the colors to create a paint/cartoon effect.
  8502. @item canny
  8503. Apply Canny edge detector on all selected planes.
  8504. @end table
  8505. Default value is @var{wires}.
  8506. @item planes
  8507. Select planes for filtering. By default all available planes are filtered.
  8508. @end table
  8509. @subsection Examples
  8510. @itemize
  8511. @item
  8512. Standard edge detection with custom values for the hysteresis thresholding:
  8513. @example
  8514. edgedetect=low=0.1:high=0.4
  8515. @end example
  8516. @item
  8517. Painting effect without thresholding:
  8518. @example
  8519. edgedetect=mode=colormix:high=0
  8520. @end example
  8521. @end itemize
  8522. @section elbg
  8523. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8524. For each input image, the filter will compute the optimal mapping from
  8525. the input to the output given the codebook length, that is the number
  8526. of distinct output colors.
  8527. This filter accepts the following options.
  8528. @table @option
  8529. @item codebook_length, l
  8530. Set codebook length. The value must be a positive integer, and
  8531. represents the number of distinct output colors. Default value is 256.
  8532. @item nb_steps, n
  8533. Set the maximum number of iterations to apply for computing the optimal
  8534. mapping. The higher the value the better the result and the higher the
  8535. computation time. Default value is 1.
  8536. @item seed, s
  8537. Set a random seed, must be an integer included between 0 and
  8538. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8539. will try to use a good random seed on a best effort basis.
  8540. @item pal8
  8541. Set pal8 output pixel format. This option does not work with codebook
  8542. length greater than 256. Default is disabled.
  8543. @end table
  8544. @section entropy
  8545. Measure graylevel entropy in histogram of color channels of video frames.
  8546. It accepts the following parameters:
  8547. @table @option
  8548. @item mode
  8549. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8550. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8551. between neighbour histogram values.
  8552. @end table
  8553. @section epx
  8554. Apply the EPX magnification filter which is designed for pixel art.
  8555. It accepts the following option:
  8556. @table @option
  8557. @item n
  8558. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  8559. @code{3xEPX}.
  8560. Default is @code{3}.
  8561. @end table
  8562. @section eq
  8563. Set brightness, contrast, saturation and approximate gamma adjustment.
  8564. The filter accepts the following options:
  8565. @table @option
  8566. @item contrast
  8567. Set the contrast expression. The value must be a float value in range
  8568. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8569. @item brightness
  8570. Set the brightness expression. The value must be a float value in
  8571. range @code{-1.0} to @code{1.0}. The default value is "0".
  8572. @item saturation
  8573. Set the saturation expression. The value must be a float in
  8574. range @code{0.0} to @code{3.0}. The default value is "1".
  8575. @item gamma
  8576. Set the gamma expression. The value must be a float in range
  8577. @code{0.1} to @code{10.0}. The default value is "1".
  8578. @item gamma_r
  8579. Set the gamma expression for red. The value must be a float in
  8580. range @code{0.1} to @code{10.0}. The default value is "1".
  8581. @item gamma_g
  8582. Set the gamma expression for green. The value must be a float in range
  8583. @code{0.1} to @code{10.0}. The default value is "1".
  8584. @item gamma_b
  8585. Set the gamma expression for blue. The value must be a float in range
  8586. @code{0.1} to @code{10.0}. The default value is "1".
  8587. @item gamma_weight
  8588. Set the gamma weight expression. It can be used to reduce the effect
  8589. of a high gamma value on bright image areas, e.g. keep them from
  8590. getting overamplified and just plain white. The value must be a float
  8591. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8592. gamma correction all the way down while @code{1.0} leaves it at its
  8593. full strength. Default is "1".
  8594. @item eval
  8595. Set when the expressions for brightness, contrast, saturation and
  8596. gamma expressions are evaluated.
  8597. It accepts the following values:
  8598. @table @samp
  8599. @item init
  8600. only evaluate expressions once during the filter initialization or
  8601. when a command is processed
  8602. @item frame
  8603. evaluate expressions for each incoming frame
  8604. @end table
  8605. Default value is @samp{init}.
  8606. @end table
  8607. The expressions accept the following parameters:
  8608. @table @option
  8609. @item n
  8610. frame count of the input frame starting from 0
  8611. @item pos
  8612. byte position of the corresponding packet in the input file, NAN if
  8613. unspecified
  8614. @item r
  8615. frame rate of the input video, NAN if the input frame rate is unknown
  8616. @item t
  8617. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8618. @end table
  8619. @subsection Commands
  8620. The filter supports the following commands:
  8621. @table @option
  8622. @item contrast
  8623. Set the contrast expression.
  8624. @item brightness
  8625. Set the brightness expression.
  8626. @item saturation
  8627. Set the saturation expression.
  8628. @item gamma
  8629. Set the gamma expression.
  8630. @item gamma_r
  8631. Set the gamma_r expression.
  8632. @item gamma_g
  8633. Set gamma_g expression.
  8634. @item gamma_b
  8635. Set gamma_b expression.
  8636. @item gamma_weight
  8637. Set gamma_weight expression.
  8638. The command accepts the same syntax of the corresponding option.
  8639. If the specified expression is not valid, it is kept at its current
  8640. value.
  8641. @end table
  8642. @section erosion
  8643. Apply erosion effect to the video.
  8644. This filter replaces the pixel by the local(3x3) minimum.
  8645. It accepts the following options:
  8646. @table @option
  8647. @item threshold0
  8648. @item threshold1
  8649. @item threshold2
  8650. @item threshold3
  8651. Limit the maximum change for each plane, default is 65535.
  8652. If 0, plane will remain unchanged.
  8653. @item coordinates
  8654. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8655. pixels are used.
  8656. Flags to local 3x3 coordinates maps like this:
  8657. 1 2 3
  8658. 4 5
  8659. 6 7 8
  8660. @end table
  8661. @subsection Commands
  8662. This filter supports the all above options as @ref{commands}.
  8663. @section estdif
  8664. Deinterlace the input video ("estdif" stands for "Edge Slope
  8665. Tracing Deinterlacing Filter").
  8666. Spatial only filter that uses edge slope tracing algorithm
  8667. to interpolate missing lines.
  8668. It accepts the following parameters:
  8669. @table @option
  8670. @item mode
  8671. The interlacing mode to adopt. It accepts one of the following values:
  8672. @table @option
  8673. @item frame
  8674. Output one frame for each frame.
  8675. @item field
  8676. Output one frame for each field.
  8677. @end table
  8678. The default value is @code{field}.
  8679. @item parity
  8680. The picture field parity assumed for the input interlaced video. It accepts one
  8681. of the following values:
  8682. @table @option
  8683. @item tff
  8684. Assume the top field is first.
  8685. @item bff
  8686. Assume the bottom field is first.
  8687. @item auto
  8688. Enable automatic detection of field parity.
  8689. @end table
  8690. The default value is @code{auto}.
  8691. If the interlacing is unknown or the decoder does not export this information,
  8692. top field first will be assumed.
  8693. @item deint
  8694. Specify which frames to deinterlace. Accepts one of the following
  8695. values:
  8696. @table @option
  8697. @item all
  8698. Deinterlace all frames.
  8699. @item interlaced
  8700. Only deinterlace frames marked as interlaced.
  8701. @end table
  8702. The default value is @code{all}.
  8703. @item rslope
  8704. Specify the search radius for edge slope tracing. Default value is 1.
  8705. Allowed range is from 1 to 15.
  8706. @item redge
  8707. Specify the search radius for best edge matching. Default value is 2.
  8708. Allowed range is from 0 to 15.
  8709. @item interp
  8710. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  8711. of the following values:
  8712. @table @option
  8713. @item 2p
  8714. Two-point interpolation.
  8715. @item 4p
  8716. Four-point interpolation.
  8717. @item 6p
  8718. Six-point interpolation.
  8719. @end table
  8720. @end table
  8721. @subsection Commands
  8722. This filter supports same @ref{commands} as options.
  8723. @section exposure
  8724. Adjust exposure of the video stream.
  8725. The filter accepts the following options:
  8726. @table @option
  8727. @item exposure
  8728. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  8729. Default value is 0 EV.
  8730. @item black
  8731. Set the black level correction. Allowed range is from -1.0 to 1.0.
  8732. Default value is 0.
  8733. @end table
  8734. @subsection Commands
  8735. This filter supports same @ref{commands} as options.
  8736. @section extractplanes
  8737. Extract color channel components from input video stream into
  8738. separate grayscale video streams.
  8739. The filter accepts the following option:
  8740. @table @option
  8741. @item planes
  8742. Set plane(s) to extract.
  8743. Available values for planes are:
  8744. @table @samp
  8745. @item y
  8746. @item u
  8747. @item v
  8748. @item a
  8749. @item r
  8750. @item g
  8751. @item b
  8752. @end table
  8753. Choosing planes not available in the input will result in an error.
  8754. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8755. with @code{y}, @code{u}, @code{v} planes at same time.
  8756. @end table
  8757. @subsection Examples
  8758. @itemize
  8759. @item
  8760. Extract luma, u and v color channel component from input video frame
  8761. into 3 grayscale outputs:
  8762. @example
  8763. 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
  8764. @end example
  8765. @end itemize
  8766. @section fade
  8767. Apply a fade-in/out effect to the input video.
  8768. It accepts the following parameters:
  8769. @table @option
  8770. @item type, t
  8771. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8772. effect.
  8773. Default is @code{in}.
  8774. @item start_frame, s
  8775. Specify the number of the frame to start applying the fade
  8776. effect at. Default is 0.
  8777. @item nb_frames, n
  8778. The number of frames that the fade effect lasts. At the end of the
  8779. fade-in effect, the output video will have the same intensity as the input video.
  8780. At the end of the fade-out transition, the output video will be filled with the
  8781. selected @option{color}.
  8782. Default is 25.
  8783. @item alpha
  8784. If set to 1, fade only alpha channel, if one exists on the input.
  8785. Default value is 0.
  8786. @item start_time, st
  8787. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8788. effect. If both start_frame and start_time are specified, the fade will start at
  8789. whichever comes last. Default is 0.
  8790. @item duration, d
  8791. The number of seconds for which the fade effect has to last. At the end of the
  8792. fade-in effect the output video will have the same intensity as the input video,
  8793. at the end of the fade-out transition the output video will be filled with the
  8794. selected @option{color}.
  8795. If both duration and nb_frames are specified, duration is used. Default is 0
  8796. (nb_frames is used by default).
  8797. @item color, c
  8798. Specify the color of the fade. Default is "black".
  8799. @end table
  8800. @subsection Examples
  8801. @itemize
  8802. @item
  8803. Fade in the first 30 frames of video:
  8804. @example
  8805. fade=in:0:30
  8806. @end example
  8807. The command above is equivalent to:
  8808. @example
  8809. fade=t=in:s=0:n=30
  8810. @end example
  8811. @item
  8812. Fade out the last 45 frames of a 200-frame video:
  8813. @example
  8814. fade=out:155:45
  8815. fade=type=out:start_frame=155:nb_frames=45
  8816. @end example
  8817. @item
  8818. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8819. @example
  8820. fade=in:0:25, fade=out:975:25
  8821. @end example
  8822. @item
  8823. Make the first 5 frames yellow, then fade in from frame 5-24:
  8824. @example
  8825. fade=in:5:20:color=yellow
  8826. @end example
  8827. @item
  8828. Fade in alpha over first 25 frames of video:
  8829. @example
  8830. fade=in:0:25:alpha=1
  8831. @end example
  8832. @item
  8833. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8834. @example
  8835. fade=t=in:st=5.5:d=0.5
  8836. @end example
  8837. @end itemize
  8838. @section fftdnoiz
  8839. Denoise frames using 3D FFT (frequency domain filtering).
  8840. The filter accepts the following options:
  8841. @table @option
  8842. @item sigma
  8843. Set the noise sigma constant. This sets denoising strength.
  8844. Default value is 1. Allowed range is from 0 to 30.
  8845. Using very high sigma with low overlap may give blocking artifacts.
  8846. @item amount
  8847. Set amount of denoising. By default all detected noise is reduced.
  8848. Default value is 1. Allowed range is from 0 to 1.
  8849. @item block
  8850. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8851. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8852. block size in pixels is 2^4 which is 16.
  8853. @item overlap
  8854. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8855. @item prev
  8856. Set number of previous frames to use for denoising. By default is set to 0.
  8857. @item next
  8858. Set number of next frames to to use for denoising. By default is set to 0.
  8859. @item planes
  8860. Set planes which will be filtered, by default are all available filtered
  8861. except alpha.
  8862. @end table
  8863. @section fftfilt
  8864. Apply arbitrary expressions to samples in frequency domain
  8865. @table @option
  8866. @item dc_Y
  8867. Adjust the dc value (gain) of the luma plane of the image. The filter
  8868. accepts an integer value in range @code{0} to @code{1000}. The default
  8869. value is set to @code{0}.
  8870. @item dc_U
  8871. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8872. filter accepts an integer value in range @code{0} to @code{1000}. The
  8873. default value is set to @code{0}.
  8874. @item dc_V
  8875. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8876. filter accepts an integer value in range @code{0} to @code{1000}. The
  8877. default value is set to @code{0}.
  8878. @item weight_Y
  8879. Set the frequency domain weight expression for the luma plane.
  8880. @item weight_U
  8881. Set the frequency domain weight expression for the 1st chroma plane.
  8882. @item weight_V
  8883. Set the frequency domain weight expression for the 2nd chroma plane.
  8884. @item eval
  8885. Set when the expressions are evaluated.
  8886. It accepts the following values:
  8887. @table @samp
  8888. @item init
  8889. Only evaluate expressions once during the filter initialization.
  8890. @item frame
  8891. Evaluate expressions for each incoming frame.
  8892. @end table
  8893. Default value is @samp{init}.
  8894. The filter accepts the following variables:
  8895. @item X
  8896. @item Y
  8897. The coordinates of the current sample.
  8898. @item W
  8899. @item H
  8900. The width and height of the image.
  8901. @item N
  8902. The number of input frame, starting from 0.
  8903. @end table
  8904. @subsection Examples
  8905. @itemize
  8906. @item
  8907. High-pass:
  8908. @example
  8909. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8910. @end example
  8911. @item
  8912. Low-pass:
  8913. @example
  8914. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8915. @end example
  8916. @item
  8917. Sharpen:
  8918. @example
  8919. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8920. @end example
  8921. @item
  8922. Blur:
  8923. @example
  8924. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8925. @end example
  8926. @end itemize
  8927. @section field
  8928. Extract a single field from an interlaced image using stride
  8929. arithmetic to avoid wasting CPU time. The output frames are marked as
  8930. non-interlaced.
  8931. The filter accepts the following options:
  8932. @table @option
  8933. @item type
  8934. Specify whether to extract the top (if the value is @code{0} or
  8935. @code{top}) or the bottom field (if the value is @code{1} or
  8936. @code{bottom}).
  8937. @end table
  8938. @section fieldhint
  8939. Create new frames by copying the top and bottom fields from surrounding frames
  8940. supplied as numbers by the hint file.
  8941. @table @option
  8942. @item hint
  8943. Set file containing hints: absolute/relative frame numbers.
  8944. There must be one line for each frame in a clip. Each line must contain two
  8945. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8946. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8947. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8948. for @code{relative} mode. First number tells from which frame to pick up top
  8949. field and second number tells from which frame to pick up bottom field.
  8950. If optionally followed by @code{+} output frame will be marked as interlaced,
  8951. else if followed by @code{-} output frame will be marked as progressive, else
  8952. it will be marked same as input frame.
  8953. If optionally followed by @code{t} output frame will use only top field, or in
  8954. case of @code{b} it will use only bottom field.
  8955. If line starts with @code{#} or @code{;} that line is skipped.
  8956. @item mode
  8957. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8958. @end table
  8959. Example of first several lines of @code{hint} file for @code{relative} mode:
  8960. @example
  8961. 0,0 - # first frame
  8962. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8963. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8964. 1,0 -
  8965. 0,0 -
  8966. 0,0 -
  8967. 1,0 -
  8968. 1,0 -
  8969. 1,0 -
  8970. 0,0 -
  8971. 0,0 -
  8972. 1,0 -
  8973. 1,0 -
  8974. 1,0 -
  8975. 0,0 -
  8976. @end example
  8977. @section fieldmatch
  8978. Field matching filter for inverse telecine. It is meant to reconstruct the
  8979. progressive frames from a telecined stream. The filter does not drop duplicated
  8980. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8981. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8982. The separation of the field matching and the decimation is notably motivated by
  8983. the possibility of inserting a de-interlacing filter fallback between the two.
  8984. If the source has mixed telecined and real interlaced content,
  8985. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8986. But these remaining combed frames will be marked as interlaced, and thus can be
  8987. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8988. In addition to the various configuration options, @code{fieldmatch} can take an
  8989. optional second stream, activated through the @option{ppsrc} option. If
  8990. enabled, the frames reconstruction will be based on the fields and frames from
  8991. this second stream. This allows the first input to be pre-processed in order to
  8992. help the various algorithms of the filter, while keeping the output lossless
  8993. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8994. or brightness/contrast adjustments can help.
  8995. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8996. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8997. which @code{fieldmatch} is based on. While the semantic and usage are very
  8998. close, some behaviour and options names can differ.
  8999. The @ref{decimate} filter currently only works for constant frame rate input.
  9000. If your input has mixed telecined (30fps) and progressive content with a lower
  9001. framerate like 24fps use the following filterchain to produce the necessary cfr
  9002. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  9003. The filter accepts the following options:
  9004. @table @option
  9005. @item order
  9006. Specify the assumed field order of the input stream. Available values are:
  9007. @table @samp
  9008. @item auto
  9009. Auto detect parity (use FFmpeg's internal parity value).
  9010. @item bff
  9011. Assume bottom field first.
  9012. @item tff
  9013. Assume top field first.
  9014. @end table
  9015. Note that it is sometimes recommended not to trust the parity announced by the
  9016. stream.
  9017. Default value is @var{auto}.
  9018. @item mode
  9019. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  9020. sense that it won't risk creating jerkiness due to duplicate frames when
  9021. possible, but if there are bad edits or blended fields it will end up
  9022. outputting combed frames when a good match might actually exist. On the other
  9023. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  9024. but will almost always find a good frame if there is one. The other values are
  9025. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  9026. jerkiness and creating duplicate frames versus finding good matches in sections
  9027. with bad edits, orphaned fields, blended fields, etc.
  9028. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  9029. Available values are:
  9030. @table @samp
  9031. @item pc
  9032. 2-way matching (p/c)
  9033. @item pc_n
  9034. 2-way matching, and trying 3rd match if still combed (p/c + n)
  9035. @item pc_u
  9036. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  9037. @item pc_n_ub
  9038. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  9039. still combed (p/c + n + u/b)
  9040. @item pcn
  9041. 3-way matching (p/c/n)
  9042. @item pcn_ub
  9043. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  9044. detected as combed (p/c/n + u/b)
  9045. @end table
  9046. The parenthesis at the end indicate the matches that would be used for that
  9047. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  9048. @var{top}).
  9049. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  9050. the slowest.
  9051. Default value is @var{pc_n}.
  9052. @item ppsrc
  9053. Mark the main input stream as a pre-processed input, and enable the secondary
  9054. input stream as the clean source to pick the fields from. See the filter
  9055. introduction for more details. It is similar to the @option{clip2} feature from
  9056. VFM/TFM.
  9057. Default value is @code{0} (disabled).
  9058. @item field
  9059. Set the field to match from. It is recommended to set this to the same value as
  9060. @option{order} unless you experience matching failures with that setting. In
  9061. certain circumstances changing the field that is used to match from can have a
  9062. large impact on matching performance. Available values are:
  9063. @table @samp
  9064. @item auto
  9065. Automatic (same value as @option{order}).
  9066. @item bottom
  9067. Match from the bottom field.
  9068. @item top
  9069. Match from the top field.
  9070. @end table
  9071. Default value is @var{auto}.
  9072. @item mchroma
  9073. Set whether or not chroma is included during the match comparisons. In most
  9074. cases it is recommended to leave this enabled. You should set this to @code{0}
  9075. only if your clip has bad chroma problems such as heavy rainbowing or other
  9076. artifacts. Setting this to @code{0} could also be used to speed things up at
  9077. the cost of some accuracy.
  9078. Default value is @code{1}.
  9079. @item y0
  9080. @item y1
  9081. These define an exclusion band which excludes the lines between @option{y0} and
  9082. @option{y1} from being included in the field matching decision. An exclusion
  9083. band can be used to ignore subtitles, a logo, or other things that may
  9084. interfere with the matching. @option{y0} sets the starting scan line and
  9085. @option{y1} sets the ending line; all lines in between @option{y0} and
  9086. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  9087. @option{y0} and @option{y1} to the same value will disable the feature.
  9088. @option{y0} and @option{y1} defaults to @code{0}.
  9089. @item scthresh
  9090. Set the scene change detection threshold as a percentage of maximum change on
  9091. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  9092. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  9093. @option{scthresh} is @code{[0.0, 100.0]}.
  9094. Default value is @code{12.0}.
  9095. @item combmatch
  9096. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  9097. account the combed scores of matches when deciding what match to use as the
  9098. final match. Available values are:
  9099. @table @samp
  9100. @item none
  9101. No final matching based on combed scores.
  9102. @item sc
  9103. Combed scores are only used when a scene change is detected.
  9104. @item full
  9105. Use combed scores all the time.
  9106. @end table
  9107. Default is @var{sc}.
  9108. @item combdbg
  9109. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  9110. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  9111. Available values are:
  9112. @table @samp
  9113. @item none
  9114. No forced calculation.
  9115. @item pcn
  9116. Force p/c/n calculations.
  9117. @item pcnub
  9118. Force p/c/n/u/b calculations.
  9119. @end table
  9120. Default value is @var{none}.
  9121. @item cthresh
  9122. This is the area combing threshold used for combed frame detection. This
  9123. essentially controls how "strong" or "visible" combing must be to be detected.
  9124. Larger values mean combing must be more visible and smaller values mean combing
  9125. can be less visible or strong and still be detected. Valid settings are from
  9126. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  9127. be detected as combed). This is basically a pixel difference value. A good
  9128. range is @code{[8, 12]}.
  9129. Default value is @code{9}.
  9130. @item chroma
  9131. Sets whether or not chroma is considered in the combed frame decision. Only
  9132. disable this if your source has chroma problems (rainbowing, etc.) that are
  9133. causing problems for the combed frame detection with chroma enabled. Actually,
  9134. using @option{chroma}=@var{0} is usually more reliable, except for the case
  9135. where there is chroma only combing in the source.
  9136. Default value is @code{0}.
  9137. @item blockx
  9138. @item blocky
  9139. Respectively set the x-axis and y-axis size of the window used during combed
  9140. frame detection. This has to do with the size of the area in which
  9141. @option{combpel} pixels are required to be detected as combed for a frame to be
  9142. declared combed. See the @option{combpel} parameter description for more info.
  9143. Possible values are any number that is a power of 2 starting at 4 and going up
  9144. to 512.
  9145. Default value is @code{16}.
  9146. @item combpel
  9147. The number of combed pixels inside any of the @option{blocky} by
  9148. @option{blockx} size blocks on the frame for the frame to be detected as
  9149. combed. While @option{cthresh} controls how "visible" the combing must be, this
  9150. setting controls "how much" combing there must be in any localized area (a
  9151. window defined by the @option{blockx} and @option{blocky} settings) on the
  9152. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  9153. which point no frames will ever be detected as combed). This setting is known
  9154. as @option{MI} in TFM/VFM vocabulary.
  9155. Default value is @code{80}.
  9156. @end table
  9157. @anchor{p/c/n/u/b meaning}
  9158. @subsection p/c/n/u/b meaning
  9159. @subsubsection p/c/n
  9160. We assume the following telecined stream:
  9161. @example
  9162. Top fields: 1 2 2 3 4
  9163. Bottom fields: 1 2 3 4 4
  9164. @end example
  9165. The numbers correspond to the progressive frame the fields relate to. Here, the
  9166. first two frames are progressive, the 3rd and 4th are combed, and so on.
  9167. When @code{fieldmatch} is configured to run a matching from bottom
  9168. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  9169. @example
  9170. Input stream:
  9171. T 1 2 2 3 4
  9172. B 1 2 3 4 4 <-- matching reference
  9173. Matches: c c n n c
  9174. Output stream:
  9175. T 1 2 3 4 4
  9176. B 1 2 3 4 4
  9177. @end example
  9178. As a result of the field matching, we can see that some frames get duplicated.
  9179. To perform a complete inverse telecine, you need to rely on a decimation filter
  9180. after this operation. See for instance the @ref{decimate} filter.
  9181. The same operation now matching from top fields (@option{field}=@var{top})
  9182. looks like this:
  9183. @example
  9184. Input stream:
  9185. T 1 2 2 3 4 <-- matching reference
  9186. B 1 2 3 4 4
  9187. Matches: c c p p c
  9188. Output stream:
  9189. T 1 2 2 3 4
  9190. B 1 2 2 3 4
  9191. @end example
  9192. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  9193. basically, they refer to the frame and field of the opposite parity:
  9194. @itemize
  9195. @item @var{p} matches the field of the opposite parity in the previous frame
  9196. @item @var{c} matches the field of the opposite parity in the current frame
  9197. @item @var{n} matches the field of the opposite parity in the next frame
  9198. @end itemize
  9199. @subsubsection u/b
  9200. The @var{u} and @var{b} matching are a bit special in the sense that they match
  9201. from the opposite parity flag. In the following examples, we assume that we are
  9202. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  9203. 'x' is placed above and below each matched fields.
  9204. With bottom matching (@option{field}=@var{bottom}):
  9205. @example
  9206. Match: c p n b u
  9207. x x x x x
  9208. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9209. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9210. x x x x x
  9211. Output frames:
  9212. 2 1 2 2 2
  9213. 2 2 2 1 3
  9214. @end example
  9215. With top matching (@option{field}=@var{top}):
  9216. @example
  9217. Match: c p n b u
  9218. x x x x x
  9219. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9220. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9221. x x x x x
  9222. Output frames:
  9223. 2 2 2 1 2
  9224. 2 1 3 2 2
  9225. @end example
  9226. @subsection Examples
  9227. Simple IVTC of a top field first telecined stream:
  9228. @example
  9229. fieldmatch=order=tff:combmatch=none, decimate
  9230. @end example
  9231. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9232. @example
  9233. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9234. @end example
  9235. @section fieldorder
  9236. Transform the field order of the input video.
  9237. It accepts the following parameters:
  9238. @table @option
  9239. @item order
  9240. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9241. for bottom field first.
  9242. @end table
  9243. The default value is @samp{tff}.
  9244. The transformation is done by shifting the picture content up or down
  9245. by one line, and filling the remaining line with appropriate picture content.
  9246. This method is consistent with most broadcast field order converters.
  9247. If the input video is not flagged as being interlaced, or it is already
  9248. flagged as being of the required output field order, then this filter does
  9249. not alter the incoming video.
  9250. It is very useful when converting to or from PAL DV material,
  9251. which is bottom field first.
  9252. For example:
  9253. @example
  9254. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9255. @end example
  9256. @section fifo, afifo
  9257. Buffer input images and send them when they are requested.
  9258. It is mainly useful when auto-inserted by the libavfilter
  9259. framework.
  9260. It does not take parameters.
  9261. @section fillborders
  9262. Fill borders of the input video, without changing video stream dimensions.
  9263. Sometimes video can have garbage at the four edges and you may not want to
  9264. crop video input to keep size multiple of some number.
  9265. This filter accepts the following options:
  9266. @table @option
  9267. @item left
  9268. Number of pixels to fill from left border.
  9269. @item right
  9270. Number of pixels to fill from right border.
  9271. @item top
  9272. Number of pixels to fill from top border.
  9273. @item bottom
  9274. Number of pixels to fill from bottom border.
  9275. @item mode
  9276. Set fill mode.
  9277. It accepts the following values:
  9278. @table @samp
  9279. @item smear
  9280. fill pixels using outermost pixels
  9281. @item mirror
  9282. fill pixels using mirroring (half sample symmetric)
  9283. @item fixed
  9284. fill pixels with constant value
  9285. @item reflect
  9286. fill pixels using reflecting (whole sample symmetric)
  9287. @item wrap
  9288. fill pixels using wrapping
  9289. @item fade
  9290. fade pixels to constant value
  9291. @end table
  9292. Default is @var{smear}.
  9293. @item color
  9294. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9295. @end table
  9296. @subsection Commands
  9297. This filter supports same @ref{commands} as options.
  9298. The command accepts the same syntax of the corresponding option.
  9299. If the specified expression is not valid, it is kept at its current
  9300. value.
  9301. @section find_rect
  9302. Find a rectangular object
  9303. It accepts the following options:
  9304. @table @option
  9305. @item object
  9306. Filepath of the object image, needs to be in gray8.
  9307. @item threshold
  9308. Detection threshold, default is 0.5.
  9309. @item mipmaps
  9310. Number of mipmaps, default is 3.
  9311. @item xmin, ymin, xmax, ymax
  9312. Specifies the rectangle in which to search.
  9313. @item discard
  9314. Discard frames where object is not detected. Default is disabled.
  9315. @end table
  9316. @subsection Examples
  9317. @itemize
  9318. @item
  9319. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9320. @example
  9321. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9322. @end example
  9323. @end itemize
  9324. @section floodfill
  9325. Flood area with values of same pixel components with another values.
  9326. It accepts the following options:
  9327. @table @option
  9328. @item x
  9329. Set pixel x coordinate.
  9330. @item y
  9331. Set pixel y coordinate.
  9332. @item s0
  9333. Set source #0 component value.
  9334. @item s1
  9335. Set source #1 component value.
  9336. @item s2
  9337. Set source #2 component value.
  9338. @item s3
  9339. Set source #3 component value.
  9340. @item d0
  9341. Set destination #0 component value.
  9342. @item d1
  9343. Set destination #1 component value.
  9344. @item d2
  9345. Set destination #2 component value.
  9346. @item d3
  9347. Set destination #3 component value.
  9348. @end table
  9349. @anchor{format}
  9350. @section format
  9351. Convert the input video to one of the specified pixel formats.
  9352. Libavfilter will try to pick one that is suitable as input to
  9353. the next filter.
  9354. It accepts the following parameters:
  9355. @table @option
  9356. @item pix_fmts
  9357. A '|'-separated list of pixel format names, such as
  9358. "pix_fmts=yuv420p|monow|rgb24".
  9359. @end table
  9360. @subsection Examples
  9361. @itemize
  9362. @item
  9363. Convert the input video to the @var{yuv420p} format
  9364. @example
  9365. format=pix_fmts=yuv420p
  9366. @end example
  9367. Convert the input video to any of the formats in the list
  9368. @example
  9369. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9370. @end example
  9371. @end itemize
  9372. @anchor{fps}
  9373. @section fps
  9374. Convert the video to specified constant frame rate by duplicating or dropping
  9375. frames as necessary.
  9376. It accepts the following parameters:
  9377. @table @option
  9378. @item fps
  9379. The desired output frame rate. The default is @code{25}.
  9380. @item start_time
  9381. Assume the first PTS should be the given value, in seconds. This allows for
  9382. padding/trimming at the start of stream. By default, no assumption is made
  9383. about the first frame's expected PTS, so no padding or trimming is done.
  9384. For example, this could be set to 0 to pad the beginning with duplicates of
  9385. the first frame if a video stream starts after the audio stream or to trim any
  9386. frames with a negative PTS.
  9387. @item round
  9388. Timestamp (PTS) rounding method.
  9389. Possible values are:
  9390. @table @option
  9391. @item zero
  9392. round towards 0
  9393. @item inf
  9394. round away from 0
  9395. @item down
  9396. round towards -infinity
  9397. @item up
  9398. round towards +infinity
  9399. @item near
  9400. round to nearest
  9401. @end table
  9402. The default is @code{near}.
  9403. @item eof_action
  9404. Action performed when reading the last frame.
  9405. Possible values are:
  9406. @table @option
  9407. @item round
  9408. Use same timestamp rounding method as used for other frames.
  9409. @item pass
  9410. Pass through last frame if input duration has not been reached yet.
  9411. @end table
  9412. The default is @code{round}.
  9413. @end table
  9414. Alternatively, the options can be specified as a flat string:
  9415. @var{fps}[:@var{start_time}[:@var{round}]].
  9416. See also the @ref{setpts} filter.
  9417. @subsection Examples
  9418. @itemize
  9419. @item
  9420. A typical usage in order to set the fps to 25:
  9421. @example
  9422. fps=fps=25
  9423. @end example
  9424. @item
  9425. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9426. @example
  9427. fps=fps=film:round=near
  9428. @end example
  9429. @end itemize
  9430. @section framepack
  9431. Pack two different video streams into a stereoscopic video, setting proper
  9432. metadata on supported codecs. The two views should have the same size and
  9433. framerate and processing will stop when the shorter video ends. Please note
  9434. that you may conveniently adjust view properties with the @ref{scale} and
  9435. @ref{fps} filters.
  9436. It accepts the following parameters:
  9437. @table @option
  9438. @item format
  9439. The desired packing format. Supported values are:
  9440. @table @option
  9441. @item sbs
  9442. The views are next to each other (default).
  9443. @item tab
  9444. The views are on top of each other.
  9445. @item lines
  9446. The views are packed by line.
  9447. @item columns
  9448. The views are packed by column.
  9449. @item frameseq
  9450. The views are temporally interleaved.
  9451. @end table
  9452. @end table
  9453. Some examples:
  9454. @example
  9455. # Convert left and right views into a frame-sequential video
  9456. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9457. # Convert views into a side-by-side video with the same output resolution as the input
  9458. 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
  9459. @end example
  9460. @section framerate
  9461. Change the frame rate by interpolating new video output frames from the source
  9462. frames.
  9463. This filter is not designed to function correctly with interlaced media. If
  9464. you wish to change the frame rate of interlaced media then you are required
  9465. to deinterlace before this filter and re-interlace after this filter.
  9466. A description of the accepted options follows.
  9467. @table @option
  9468. @item fps
  9469. Specify the output frames per second. This option can also be specified
  9470. as a value alone. The default is @code{50}.
  9471. @item interp_start
  9472. Specify the start of a range where the output frame will be created as a
  9473. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9474. the default is @code{15}.
  9475. @item interp_end
  9476. Specify the end of a range where the output frame will be created as a
  9477. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9478. the default is @code{240}.
  9479. @item scene
  9480. Specify the level at which a scene change is detected as a value between
  9481. 0 and 100 to indicate a new scene; a low value reflects a low
  9482. probability for the current frame to introduce a new scene, while a higher
  9483. value means the current frame is more likely to be one.
  9484. The default is @code{8.2}.
  9485. @item flags
  9486. Specify flags influencing the filter process.
  9487. Available value for @var{flags} is:
  9488. @table @option
  9489. @item scene_change_detect, scd
  9490. Enable scene change detection using the value of the option @var{scene}.
  9491. This flag is enabled by default.
  9492. @end table
  9493. @end table
  9494. @section framestep
  9495. Select one frame every N-th frame.
  9496. This filter accepts the following option:
  9497. @table @option
  9498. @item step
  9499. Select frame after every @code{step} frames.
  9500. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9501. @end table
  9502. @section freezedetect
  9503. Detect frozen video.
  9504. This filter logs a message and sets frame metadata when it detects that the
  9505. input video has no significant change in content during a specified duration.
  9506. Video freeze detection calculates the mean average absolute difference of all
  9507. the components of video frames and compares it to a noise floor.
  9508. The printed times and duration are expressed in seconds. The
  9509. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9510. whose timestamp equals or exceeds the detection duration and it contains the
  9511. timestamp of the first frame of the freeze. The
  9512. @code{lavfi.freezedetect.freeze_duration} and
  9513. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9514. after the freeze.
  9515. The filter accepts the following options:
  9516. @table @option
  9517. @item noise, n
  9518. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9519. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9520. 0.001.
  9521. @item duration, d
  9522. Set freeze duration until notification (default is 2 seconds).
  9523. @end table
  9524. @section freezeframes
  9525. Freeze video frames.
  9526. This filter freezes video frames using frame from 2nd input.
  9527. The filter accepts the following options:
  9528. @table @option
  9529. @item first
  9530. Set number of first frame from which to start freeze.
  9531. @item last
  9532. Set number of last frame from which to end freeze.
  9533. @item replace
  9534. Set number of frame from 2nd input which will be used instead of replaced frames.
  9535. @end table
  9536. @anchor{frei0r}
  9537. @section frei0r
  9538. Apply a frei0r effect to the input video.
  9539. To enable the compilation of this filter, you need to install the frei0r
  9540. header and configure FFmpeg with @code{--enable-frei0r}.
  9541. It accepts the following parameters:
  9542. @table @option
  9543. @item filter_name
  9544. The name of the frei0r effect to load. If the environment variable
  9545. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9546. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9547. Otherwise, the standard frei0r paths are searched, in this order:
  9548. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9549. @file{/usr/lib/frei0r-1/}.
  9550. @item filter_params
  9551. A '|'-separated list of parameters to pass to the frei0r effect.
  9552. @end table
  9553. A frei0r effect parameter can be a boolean (its value is either
  9554. "y" or "n"), a double, a color (specified as
  9555. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9556. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9557. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9558. a position (specified as @var{X}/@var{Y}, where
  9559. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9560. The number and types of parameters depend on the loaded effect. If an
  9561. effect parameter is not specified, the default value is set.
  9562. @subsection Examples
  9563. @itemize
  9564. @item
  9565. Apply the distort0r effect, setting the first two double parameters:
  9566. @example
  9567. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9568. @end example
  9569. @item
  9570. Apply the colordistance effect, taking a color as the first parameter:
  9571. @example
  9572. frei0r=colordistance:0.2/0.3/0.4
  9573. frei0r=colordistance:violet
  9574. frei0r=colordistance:0x112233
  9575. @end example
  9576. @item
  9577. Apply the perspective effect, specifying the top left and top right image
  9578. positions:
  9579. @example
  9580. frei0r=perspective:0.2/0.2|0.8/0.2
  9581. @end example
  9582. @end itemize
  9583. For more information, see
  9584. @url{http://frei0r.dyne.org}
  9585. @subsection Commands
  9586. This filter supports the @option{filter_params} option as @ref{commands}.
  9587. @section fspp
  9588. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9589. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9590. processing filter, one of them is performed once per block, not per pixel.
  9591. This allows for much higher speed.
  9592. The filter accepts the following options:
  9593. @table @option
  9594. @item quality
  9595. Set quality. This option defines the number of levels for averaging. It accepts
  9596. an integer in the range 4-5. Default value is @code{4}.
  9597. @item qp
  9598. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9599. If not set, the filter will use the QP from the video stream (if available).
  9600. @item strength
  9601. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9602. more details but also more artifacts, while higher values make the image smoother
  9603. but also blurrier. Default value is @code{0} − PSNR optimal.
  9604. @item use_bframe_qp
  9605. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9606. option may cause flicker since the B-Frames have often larger QP. Default is
  9607. @code{0} (not enabled).
  9608. @end table
  9609. @section gblur
  9610. Apply Gaussian blur filter.
  9611. The filter accepts the following options:
  9612. @table @option
  9613. @item sigma
  9614. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9615. @item steps
  9616. Set number of steps for Gaussian approximation. Default is @code{1}.
  9617. @item planes
  9618. Set which planes to filter. By default all planes are filtered.
  9619. @item sigmaV
  9620. Set vertical sigma, if negative it will be same as @code{sigma}.
  9621. Default is @code{-1}.
  9622. @end table
  9623. @subsection Commands
  9624. This filter supports same commands as options.
  9625. The command accepts the same syntax of the corresponding option.
  9626. If the specified expression is not valid, it is kept at its current
  9627. value.
  9628. @section geq
  9629. Apply generic equation to each pixel.
  9630. The filter accepts the following options:
  9631. @table @option
  9632. @item lum_expr, lum
  9633. Set the luminance expression.
  9634. @item cb_expr, cb
  9635. Set the chrominance blue expression.
  9636. @item cr_expr, cr
  9637. Set the chrominance red expression.
  9638. @item alpha_expr, a
  9639. Set the alpha expression.
  9640. @item red_expr, r
  9641. Set the red expression.
  9642. @item green_expr, g
  9643. Set the green expression.
  9644. @item blue_expr, b
  9645. Set the blue expression.
  9646. @end table
  9647. The colorspace is selected according to the specified options. If one
  9648. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9649. options is specified, the filter will automatically select a YCbCr
  9650. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9651. @option{blue_expr} options is specified, it will select an RGB
  9652. colorspace.
  9653. If one of the chrominance expression is not defined, it falls back on the other
  9654. one. If no alpha expression is specified it will evaluate to opaque value.
  9655. If none of chrominance expressions are specified, they will evaluate
  9656. to the luminance expression.
  9657. The expressions can use the following variables and functions:
  9658. @table @option
  9659. @item N
  9660. The sequential number of the filtered frame, starting from @code{0}.
  9661. @item X
  9662. @item Y
  9663. The coordinates of the current sample.
  9664. @item W
  9665. @item H
  9666. The width and height of the image.
  9667. @item SW
  9668. @item SH
  9669. Width and height scale depending on the currently filtered plane. It is the
  9670. ratio between the corresponding luma plane number of pixels and the current
  9671. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9672. @code{0.5,0.5} for chroma planes.
  9673. @item T
  9674. Time of the current frame, expressed in seconds.
  9675. @item p(x, y)
  9676. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9677. plane.
  9678. @item lum(x, y)
  9679. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9680. plane.
  9681. @item cb(x, y)
  9682. Return the value of the pixel at location (@var{x},@var{y}) of the
  9683. blue-difference chroma plane. Return 0 if there is no such plane.
  9684. @item cr(x, y)
  9685. Return the value of the pixel at location (@var{x},@var{y}) of the
  9686. red-difference chroma plane. Return 0 if there is no such plane.
  9687. @item r(x, y)
  9688. @item g(x, y)
  9689. @item b(x, y)
  9690. Return the value of the pixel at location (@var{x},@var{y}) of the
  9691. red/green/blue component. Return 0 if there is no such component.
  9692. @item alpha(x, y)
  9693. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9694. plane. Return 0 if there is no such plane.
  9695. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  9696. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9697. sums of samples within a rectangle. See the functions without the sum postfix.
  9698. @item interpolation
  9699. Set one of interpolation methods:
  9700. @table @option
  9701. @item nearest, n
  9702. @item bilinear, b
  9703. @end table
  9704. Default is bilinear.
  9705. @end table
  9706. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9707. automatically clipped to the closer edge.
  9708. Please note that this filter can use multiple threads in which case each slice
  9709. will have its own expression state. If you want to use only a single expression
  9710. state because your expressions depend on previous state then you should limit
  9711. the number of filter threads to 1.
  9712. @subsection Examples
  9713. @itemize
  9714. @item
  9715. Flip the image horizontally:
  9716. @example
  9717. geq=p(W-X\,Y)
  9718. @end example
  9719. @item
  9720. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9721. wavelength of 100 pixels:
  9722. @example
  9723. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9724. @end example
  9725. @item
  9726. Generate a fancy enigmatic moving light:
  9727. @example
  9728. 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
  9729. @end example
  9730. @item
  9731. Generate a quick emboss effect:
  9732. @example
  9733. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9734. @end example
  9735. @item
  9736. Modify RGB components depending on pixel position:
  9737. @example
  9738. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9739. @end example
  9740. @item
  9741. Create a radial gradient that is the same size as the input (also see
  9742. the @ref{vignette} filter):
  9743. @example
  9744. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9745. @end example
  9746. @end itemize
  9747. @section gradfun
  9748. Fix the banding artifacts that are sometimes introduced into nearly flat
  9749. regions by truncation to 8-bit color depth.
  9750. Interpolate the gradients that should go where the bands are, and
  9751. dither them.
  9752. It is designed for playback only. Do not use it prior to
  9753. lossy compression, because compression tends to lose the dither and
  9754. bring back the bands.
  9755. It accepts the following parameters:
  9756. @table @option
  9757. @item strength
  9758. The maximum amount by which the filter will change any one pixel. This is also
  9759. the threshold for detecting nearly flat regions. Acceptable values range from
  9760. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9761. valid range.
  9762. @item radius
  9763. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9764. gradients, but also prevents the filter from modifying the pixels near detailed
  9765. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9766. values will be clipped to the valid range.
  9767. @end table
  9768. Alternatively, the options can be specified as a flat string:
  9769. @var{strength}[:@var{radius}]
  9770. @subsection Examples
  9771. @itemize
  9772. @item
  9773. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9774. @example
  9775. gradfun=3.5:8
  9776. @end example
  9777. @item
  9778. Specify radius, omitting the strength (which will fall-back to the default
  9779. value):
  9780. @example
  9781. gradfun=radius=8
  9782. @end example
  9783. @end itemize
  9784. @anchor{graphmonitor}
  9785. @section graphmonitor
  9786. Show various filtergraph stats.
  9787. With this filter one can debug complete filtergraph.
  9788. Especially issues with links filling with queued frames.
  9789. The filter accepts the following options:
  9790. @table @option
  9791. @item size, s
  9792. Set video output size. Default is @var{hd720}.
  9793. @item opacity, o
  9794. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9795. @item mode, m
  9796. Set output mode, can be @var{fulll} or @var{compact}.
  9797. In @var{compact} mode only filters with some queued frames have displayed stats.
  9798. @item flags, f
  9799. Set flags which enable which stats are shown in video.
  9800. Available values for flags are:
  9801. @table @samp
  9802. @item queue
  9803. Display number of queued frames in each link.
  9804. @item frame_count_in
  9805. Display number of frames taken from filter.
  9806. @item frame_count_out
  9807. Display number of frames given out from filter.
  9808. @item pts
  9809. Display current filtered frame pts.
  9810. @item time
  9811. Display current filtered frame time.
  9812. @item timebase
  9813. Display time base for filter link.
  9814. @item format
  9815. Display used format for filter link.
  9816. @item size
  9817. Display video size or number of audio channels in case of audio used by filter link.
  9818. @item rate
  9819. Display video frame rate or sample rate in case of audio used by filter link.
  9820. @item eof
  9821. Display link output status.
  9822. @end table
  9823. @item rate, r
  9824. Set upper limit for video rate of output stream, Default value is @var{25}.
  9825. This guarantee that output video frame rate will not be higher than this value.
  9826. @end table
  9827. @section greyedge
  9828. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9829. and corrects the scene colors accordingly.
  9830. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9831. The filter accepts the following options:
  9832. @table @option
  9833. @item difford
  9834. The order of differentiation to be applied on the scene. Must be chosen in the range
  9835. [0,2] and default value is 1.
  9836. @item minknorm
  9837. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9838. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9839. max value instead of calculating Minkowski distance.
  9840. @item sigma
  9841. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9842. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9843. can't be equal to 0 if @var{difford} is greater than 0.
  9844. @end table
  9845. @subsection Examples
  9846. @itemize
  9847. @item
  9848. Grey Edge:
  9849. @example
  9850. greyedge=difford=1:minknorm=5:sigma=2
  9851. @end example
  9852. @item
  9853. Max Edge:
  9854. @example
  9855. greyedge=difford=1:minknorm=0:sigma=2
  9856. @end example
  9857. @end itemize
  9858. @anchor{haldclut}
  9859. @section haldclut
  9860. Apply a Hald CLUT to a video stream.
  9861. First input is the video stream to process, and second one is the Hald CLUT.
  9862. The Hald CLUT input can be a simple picture or a complete video stream.
  9863. The filter accepts the following options:
  9864. @table @option
  9865. @item shortest
  9866. Force termination when the shortest input terminates. Default is @code{0}.
  9867. @item repeatlast
  9868. Continue applying the last CLUT after the end of the stream. A value of
  9869. @code{0} disable the filter after the last frame of the CLUT is reached.
  9870. Default is @code{1}.
  9871. @end table
  9872. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9873. filters share the same internals).
  9874. This filter also supports the @ref{framesync} options.
  9875. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9876. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9877. @subsection Commands
  9878. This filter supports the @code{interp} option as @ref{commands}.
  9879. @subsection Workflow examples
  9880. @subsubsection Hald CLUT video stream
  9881. Generate an identity Hald CLUT stream altered with various effects:
  9882. @example
  9883. 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
  9884. @end example
  9885. Note: make sure you use a lossless codec.
  9886. Then use it with @code{haldclut} to apply it on some random stream:
  9887. @example
  9888. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9889. @end example
  9890. The Hald CLUT will be applied to the 10 first seconds (duration of
  9891. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9892. to the remaining frames of the @code{mandelbrot} stream.
  9893. @subsubsection Hald CLUT with preview
  9894. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9895. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9896. biggest possible square starting at the top left of the picture. The remaining
  9897. padding pixels (bottom or right) will be ignored. This area can be used to add
  9898. a preview of the Hald CLUT.
  9899. Typically, the following generated Hald CLUT will be supported by the
  9900. @code{haldclut} filter:
  9901. @example
  9902. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9903. pad=iw+320 [padded_clut];
  9904. smptebars=s=320x256, split [a][b];
  9905. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9906. [main][b] overlay=W-320" -frames:v 1 clut.png
  9907. @end example
  9908. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9909. bars are displayed on the right-top, and below the same color bars processed by
  9910. the color changes.
  9911. Then, the effect of this Hald CLUT can be visualized with:
  9912. @example
  9913. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9914. @end example
  9915. @section hflip
  9916. Flip the input video horizontally.
  9917. For example, to horizontally flip the input video with @command{ffmpeg}:
  9918. @example
  9919. ffmpeg -i in.avi -vf "hflip" out.avi
  9920. @end example
  9921. @section histeq
  9922. This filter applies a global color histogram equalization on a
  9923. per-frame basis.
  9924. It can be used to correct video that has a compressed range of pixel
  9925. intensities. The filter redistributes the pixel intensities to
  9926. equalize their distribution across the intensity range. It may be
  9927. viewed as an "automatically adjusting contrast filter". This filter is
  9928. useful only for correcting degraded or poorly captured source
  9929. video.
  9930. The filter accepts the following options:
  9931. @table @option
  9932. @item strength
  9933. Determine the amount of equalization to be applied. As the strength
  9934. is reduced, the distribution of pixel intensities more-and-more
  9935. approaches that of the input frame. The value must be a float number
  9936. in the range [0,1] and defaults to 0.200.
  9937. @item intensity
  9938. Set the maximum intensity that can generated and scale the output
  9939. values appropriately. The strength should be set as desired and then
  9940. the intensity can be limited if needed to avoid washing-out. The value
  9941. must be a float number in the range [0,1] and defaults to 0.210.
  9942. @item antibanding
  9943. Set the antibanding level. If enabled the filter will randomly vary
  9944. the luminance of output pixels by a small amount to avoid banding of
  9945. the histogram. Possible values are @code{none}, @code{weak} or
  9946. @code{strong}. It defaults to @code{none}.
  9947. @end table
  9948. @anchor{histogram}
  9949. @section histogram
  9950. Compute and draw a color distribution histogram for the input video.
  9951. The computed histogram is a representation of the color component
  9952. distribution in an image.
  9953. Standard histogram displays the color components distribution in an image.
  9954. Displays color graph for each color component. Shows distribution of
  9955. the Y, U, V, A or R, G, B components, depending on input format, in the
  9956. current frame. Below each graph a color component scale meter is shown.
  9957. The filter accepts the following options:
  9958. @table @option
  9959. @item level_height
  9960. Set height of level. Default value is @code{200}.
  9961. Allowed range is [50, 2048].
  9962. @item scale_height
  9963. Set height of color scale. Default value is @code{12}.
  9964. Allowed range is [0, 40].
  9965. @item display_mode
  9966. Set display mode.
  9967. It accepts the following values:
  9968. @table @samp
  9969. @item stack
  9970. Per color component graphs are placed below each other.
  9971. @item parade
  9972. Per color component graphs are placed side by side.
  9973. @item overlay
  9974. Presents information identical to that in the @code{parade}, except
  9975. that the graphs representing color components are superimposed directly
  9976. over one another.
  9977. @end table
  9978. Default is @code{stack}.
  9979. @item levels_mode
  9980. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9981. Default is @code{linear}.
  9982. @item components
  9983. Set what color components to display.
  9984. Default is @code{7}.
  9985. @item fgopacity
  9986. Set foreground opacity. Default is @code{0.7}.
  9987. @item bgopacity
  9988. Set background opacity. Default is @code{0.5}.
  9989. @end table
  9990. @subsection Examples
  9991. @itemize
  9992. @item
  9993. Calculate and draw histogram:
  9994. @example
  9995. ffplay -i input -vf histogram
  9996. @end example
  9997. @end itemize
  9998. @anchor{hqdn3d}
  9999. @section hqdn3d
  10000. This is a high precision/quality 3d denoise filter. It aims to reduce
  10001. image noise, producing smooth images and making still images really
  10002. still. It should enhance compressibility.
  10003. It accepts the following optional parameters:
  10004. @table @option
  10005. @item luma_spatial
  10006. A non-negative floating point number which specifies spatial luma strength.
  10007. It defaults to 4.0.
  10008. @item chroma_spatial
  10009. A non-negative floating point number which specifies spatial chroma strength.
  10010. It defaults to 3.0*@var{luma_spatial}/4.0.
  10011. @item luma_tmp
  10012. A floating point number which specifies luma temporal strength. It defaults to
  10013. 6.0*@var{luma_spatial}/4.0.
  10014. @item chroma_tmp
  10015. A floating point number which specifies chroma temporal strength. It defaults to
  10016. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  10017. @end table
  10018. @subsection Commands
  10019. This filter supports same @ref{commands} as options.
  10020. The command accepts the same syntax of the corresponding option.
  10021. If the specified expression is not valid, it is kept at its current
  10022. value.
  10023. @anchor{hwdownload}
  10024. @section hwdownload
  10025. Download hardware frames to system memory.
  10026. The input must be in hardware frames, and the output a non-hardware format.
  10027. Not all formats will be supported on the output - it may be necessary to insert
  10028. an additional @option{format} filter immediately following in the graph to get
  10029. the output in a supported format.
  10030. @section hwmap
  10031. Map hardware frames to system memory or to another device.
  10032. This filter has several different modes of operation; which one is used depends
  10033. on the input and output formats:
  10034. @itemize
  10035. @item
  10036. Hardware frame input, normal frame output
  10037. Map the input frames to system memory and pass them to the output. If the
  10038. original hardware frame is later required (for example, after overlaying
  10039. something else on part of it), the @option{hwmap} filter can be used again
  10040. in the next mode to retrieve it.
  10041. @item
  10042. Normal frame input, hardware frame output
  10043. If the input is actually a software-mapped hardware frame, then unmap it -
  10044. that is, return the original hardware frame.
  10045. Otherwise, a device must be provided. Create new hardware surfaces on that
  10046. device for the output, then map them back to the software format at the input
  10047. and give those frames to the preceding filter. This will then act like the
  10048. @option{hwupload} filter, but may be able to avoid an additional copy when
  10049. the input is already in a compatible format.
  10050. @item
  10051. Hardware frame input and output
  10052. A device must be supplied for the output, either directly or with the
  10053. @option{derive_device} option. The input and output devices must be of
  10054. different types and compatible - the exact meaning of this is
  10055. system-dependent, but typically it means that they must refer to the same
  10056. underlying hardware context (for example, refer to the same graphics card).
  10057. If the input frames were originally created on the output device, then unmap
  10058. to retrieve the original frames.
  10059. Otherwise, map the frames to the output device - create new hardware frames
  10060. on the output corresponding to the frames on the input.
  10061. @end itemize
  10062. The following additional parameters are accepted:
  10063. @table @option
  10064. @item mode
  10065. Set the frame mapping mode. Some combination of:
  10066. @table @var
  10067. @item read
  10068. The mapped frame should be readable.
  10069. @item write
  10070. The mapped frame should be writeable.
  10071. @item overwrite
  10072. The mapping will always overwrite the entire frame.
  10073. This may improve performance in some cases, as the original contents of the
  10074. frame need not be loaded.
  10075. @item direct
  10076. The mapping must not involve any copying.
  10077. Indirect mappings to copies of frames are created in some cases where either
  10078. direct mapping is not possible or it would have unexpected properties.
  10079. Setting this flag ensures that the mapping is direct and will fail if that is
  10080. not possible.
  10081. @end table
  10082. Defaults to @var{read+write} if not specified.
  10083. @item derive_device @var{type}
  10084. Rather than using the device supplied at initialisation, instead derive a new
  10085. device of type @var{type} from the device the input frames exist on.
  10086. @item reverse
  10087. In a hardware to hardware mapping, map in reverse - create frames in the sink
  10088. and map them back to the source. This may be necessary in some cases where
  10089. a mapping in one direction is required but only the opposite direction is
  10090. supported by the devices being used.
  10091. This option is dangerous - it may break the preceding filter in undefined
  10092. ways if there are any additional constraints on that filter's output.
  10093. Do not use it without fully understanding the implications of its use.
  10094. @end table
  10095. @anchor{hwupload}
  10096. @section hwupload
  10097. Upload system memory frames to hardware surfaces.
  10098. The device to upload to must be supplied when the filter is initialised. If
  10099. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  10100. option or with the @option{derive_device} option. The input and output devices
  10101. must be of different types and compatible - the exact meaning of this is
  10102. system-dependent, but typically it means that they must refer to the same
  10103. underlying hardware context (for example, refer to the same graphics card).
  10104. The following additional parameters are accepted:
  10105. @table @option
  10106. @item derive_device @var{type}
  10107. Rather than using the device supplied at initialisation, instead derive a new
  10108. device of type @var{type} from the device the input frames exist on.
  10109. @end table
  10110. @anchor{hwupload_cuda}
  10111. @section hwupload_cuda
  10112. Upload system memory frames to a CUDA device.
  10113. It accepts the following optional parameters:
  10114. @table @option
  10115. @item device
  10116. The number of the CUDA device to use
  10117. @end table
  10118. @section hqx
  10119. Apply a high-quality magnification filter designed for pixel art. This filter
  10120. was originally created by Maxim Stepin.
  10121. It accepts the following option:
  10122. @table @option
  10123. @item n
  10124. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  10125. @code{hq3x} and @code{4} for @code{hq4x}.
  10126. Default is @code{3}.
  10127. @end table
  10128. @section hstack
  10129. Stack input videos horizontally.
  10130. All streams must be of same pixel format and of same height.
  10131. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10132. to create same output.
  10133. The filter accepts the following option:
  10134. @table @option
  10135. @item inputs
  10136. Set number of input streams. Default is 2.
  10137. @item shortest
  10138. If set to 1, force the output to terminate when the shortest input
  10139. terminates. Default value is 0.
  10140. @end table
  10141. @section hue
  10142. Modify the hue and/or the saturation of the input.
  10143. It accepts the following parameters:
  10144. @table @option
  10145. @item h
  10146. Specify the hue angle as a number of degrees. It accepts an expression,
  10147. and defaults to "0".
  10148. @item s
  10149. Specify the saturation in the [-10,10] range. It accepts an expression and
  10150. defaults to "1".
  10151. @item H
  10152. Specify the hue angle as a number of radians. It accepts an
  10153. expression, and defaults to "0".
  10154. @item b
  10155. Specify the brightness in the [-10,10] range. It accepts an expression and
  10156. defaults to "0".
  10157. @end table
  10158. @option{h} and @option{H} are mutually exclusive, and can't be
  10159. specified at the same time.
  10160. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  10161. expressions containing the following constants:
  10162. @table @option
  10163. @item n
  10164. frame count of the input frame starting from 0
  10165. @item pts
  10166. presentation timestamp of the input frame expressed in time base units
  10167. @item r
  10168. frame rate of the input video, NAN if the input frame rate is unknown
  10169. @item t
  10170. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10171. @item tb
  10172. time base of the input video
  10173. @end table
  10174. @subsection Examples
  10175. @itemize
  10176. @item
  10177. Set the hue to 90 degrees and the saturation to 1.0:
  10178. @example
  10179. hue=h=90:s=1
  10180. @end example
  10181. @item
  10182. Same command but expressing the hue in radians:
  10183. @example
  10184. hue=H=PI/2:s=1
  10185. @end example
  10186. @item
  10187. Rotate hue and make the saturation swing between 0
  10188. and 2 over a period of 1 second:
  10189. @example
  10190. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  10191. @end example
  10192. @item
  10193. Apply a 3 seconds saturation fade-in effect starting at 0:
  10194. @example
  10195. hue="s=min(t/3\,1)"
  10196. @end example
  10197. The general fade-in expression can be written as:
  10198. @example
  10199. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  10200. @end example
  10201. @item
  10202. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  10203. @example
  10204. hue="s=max(0\, min(1\, (8-t)/3))"
  10205. @end example
  10206. The general fade-out expression can be written as:
  10207. @example
  10208. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  10209. @end example
  10210. @end itemize
  10211. @subsection Commands
  10212. This filter supports the following commands:
  10213. @table @option
  10214. @item b
  10215. @item s
  10216. @item h
  10217. @item H
  10218. Modify the hue and/or the saturation and/or brightness of the input video.
  10219. The command accepts the same syntax of the corresponding option.
  10220. If the specified expression is not valid, it is kept at its current
  10221. value.
  10222. @end table
  10223. @section hysteresis
  10224. Grow first stream into second stream by connecting components.
  10225. This makes it possible to build more robust edge masks.
  10226. This filter accepts the following options:
  10227. @table @option
  10228. @item planes
  10229. Set which planes will be processed as bitmap, unprocessed planes will be
  10230. copied from first stream.
  10231. By default value 0xf, all planes will be processed.
  10232. @item threshold
  10233. Set threshold which is used in filtering. If pixel component value is higher than
  10234. this value filter algorithm for connecting components is activated.
  10235. By default value is 0.
  10236. @end table
  10237. The @code{hysteresis} filter also supports the @ref{framesync} options.
  10238. @section identity
  10239. Obtain the identity score between two input videos.
  10240. This filter takes two input videos.
  10241. Both input videos must have the same resolution and pixel format for
  10242. this filter to work correctly. Also it assumes that both inputs
  10243. have the same number of frames, which are compared one by one.
  10244. The obtained per component, average, min and max identity score is printed through
  10245. the logging system.
  10246. The filter stores the calculated identity scores of each frame in frame metadata.
  10247. In the below example the input file @file{main.mpg} being processed is compared
  10248. with the reference file @file{ref.mpg}.
  10249. @example
  10250. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  10251. @end example
  10252. @section idet
  10253. Detect video interlacing type.
  10254. This filter tries to detect if the input frames are interlaced, progressive,
  10255. top or bottom field first. It will also try to detect fields that are
  10256. repeated between adjacent frames (a sign of telecine).
  10257. Single frame detection considers only immediately adjacent frames when classifying each frame.
  10258. Multiple frame detection incorporates the classification history of previous frames.
  10259. The filter will log these metadata values:
  10260. @table @option
  10261. @item single.current_frame
  10262. Detected type of current frame using single-frame detection. One of:
  10263. ``tff'' (top field first), ``bff'' (bottom field first),
  10264. ``progressive'', or ``undetermined''
  10265. @item single.tff
  10266. Cumulative number of frames detected as top field first using single-frame detection.
  10267. @item multiple.tff
  10268. Cumulative number of frames detected as top field first using multiple-frame detection.
  10269. @item single.bff
  10270. Cumulative number of frames detected as bottom field first using single-frame detection.
  10271. @item multiple.current_frame
  10272. Detected type of current frame using multiple-frame detection. One of:
  10273. ``tff'' (top field first), ``bff'' (bottom field first),
  10274. ``progressive'', or ``undetermined''
  10275. @item multiple.bff
  10276. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  10277. @item single.progressive
  10278. Cumulative number of frames detected as progressive using single-frame detection.
  10279. @item multiple.progressive
  10280. Cumulative number of frames detected as progressive using multiple-frame detection.
  10281. @item single.undetermined
  10282. Cumulative number of frames that could not be classified using single-frame detection.
  10283. @item multiple.undetermined
  10284. Cumulative number of frames that could not be classified using multiple-frame detection.
  10285. @item repeated.current_frame
  10286. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  10287. @item repeated.neither
  10288. Cumulative number of frames with no repeated field.
  10289. @item repeated.top
  10290. Cumulative number of frames with the top field repeated from the previous frame's top field.
  10291. @item repeated.bottom
  10292. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  10293. @end table
  10294. The filter accepts the following options:
  10295. @table @option
  10296. @item intl_thres
  10297. Set interlacing threshold.
  10298. @item prog_thres
  10299. Set progressive threshold.
  10300. @item rep_thres
  10301. Threshold for repeated field detection.
  10302. @item half_life
  10303. Number of frames after which a given frame's contribution to the
  10304. statistics is halved (i.e., it contributes only 0.5 to its
  10305. classification). The default of 0 means that all frames seen are given
  10306. full weight of 1.0 forever.
  10307. @item analyze_interlaced_flag
  10308. When this is not 0 then idet will use the specified number of frames to determine
  10309. if the interlaced flag is accurate, it will not count undetermined frames.
  10310. If the flag is found to be accurate it will be used without any further
  10311. computations, if it is found to be inaccurate it will be cleared without any
  10312. further computations. This allows inserting the idet filter as a low computational
  10313. method to clean up the interlaced flag
  10314. @end table
  10315. @section il
  10316. Deinterleave or interleave fields.
  10317. This filter allows one to process interlaced images fields without
  10318. deinterlacing them. Deinterleaving splits the input frame into 2
  10319. fields (so called half pictures). Odd lines are moved to the top
  10320. half of the output image, even lines to the bottom half.
  10321. You can process (filter) them independently and then re-interleave them.
  10322. The filter accepts the following options:
  10323. @table @option
  10324. @item luma_mode, l
  10325. @item chroma_mode, c
  10326. @item alpha_mode, a
  10327. Available values for @var{luma_mode}, @var{chroma_mode} and
  10328. @var{alpha_mode} are:
  10329. @table @samp
  10330. @item none
  10331. Do nothing.
  10332. @item deinterleave, d
  10333. Deinterleave fields, placing one above the other.
  10334. @item interleave, i
  10335. Interleave fields. Reverse the effect of deinterleaving.
  10336. @end table
  10337. Default value is @code{none}.
  10338. @item luma_swap, ls
  10339. @item chroma_swap, cs
  10340. @item alpha_swap, as
  10341. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  10342. @end table
  10343. @subsection Commands
  10344. This filter supports the all above options as @ref{commands}.
  10345. @section inflate
  10346. Apply inflate effect to the video.
  10347. This filter replaces the pixel by the local(3x3) average by taking into account
  10348. only values higher than the pixel.
  10349. It accepts the following options:
  10350. @table @option
  10351. @item threshold0
  10352. @item threshold1
  10353. @item threshold2
  10354. @item threshold3
  10355. Limit the maximum change for each plane, default is 65535.
  10356. If 0, plane will remain unchanged.
  10357. @end table
  10358. @subsection Commands
  10359. This filter supports the all above options as @ref{commands}.
  10360. @section interlace
  10361. Simple interlacing filter from progressive contents. This interleaves upper (or
  10362. lower) lines from odd frames with lower (or upper) lines from even frames,
  10363. halving the frame rate and preserving image height.
  10364. @example
  10365. Original Original New Frame
  10366. Frame 'j' Frame 'j+1' (tff)
  10367. ========== =========== ==================
  10368. Line 0 --------------------> Frame 'j' Line 0
  10369. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10370. Line 2 ---------------------> Frame 'j' Line 2
  10371. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10372. ... ... ...
  10373. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10374. @end example
  10375. It accepts the following optional parameters:
  10376. @table @option
  10377. @item scan
  10378. This determines whether the interlaced frame is taken from the even
  10379. (tff - default) or odd (bff) lines of the progressive frame.
  10380. @item lowpass
  10381. Vertical lowpass filter to avoid twitter interlacing and
  10382. reduce moire patterns.
  10383. @table @samp
  10384. @item 0, off
  10385. Disable vertical lowpass filter
  10386. @item 1, linear
  10387. Enable linear filter (default)
  10388. @item 2, complex
  10389. Enable complex filter. This will slightly less reduce twitter and moire
  10390. but better retain detail and subjective sharpness impression.
  10391. @end table
  10392. @end table
  10393. @section kerndeint
  10394. Deinterlace input video by applying Donald Graft's adaptive kernel
  10395. deinterling. Work on interlaced parts of a video to produce
  10396. progressive frames.
  10397. The description of the accepted parameters follows.
  10398. @table @option
  10399. @item thresh
  10400. Set the threshold which affects the filter's tolerance when
  10401. determining if a pixel line must be processed. It must be an integer
  10402. in the range [0,255] and defaults to 10. A value of 0 will result in
  10403. applying the process on every pixels.
  10404. @item map
  10405. Paint pixels exceeding the threshold value to white if set to 1.
  10406. Default is 0.
  10407. @item order
  10408. Set the fields order. Swap fields if set to 1, leave fields alone if
  10409. 0. Default is 0.
  10410. @item sharp
  10411. Enable additional sharpening if set to 1. Default is 0.
  10412. @item twoway
  10413. Enable twoway sharpening if set to 1. Default is 0.
  10414. @end table
  10415. @subsection Examples
  10416. @itemize
  10417. @item
  10418. Apply default values:
  10419. @example
  10420. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10421. @end example
  10422. @item
  10423. Enable additional sharpening:
  10424. @example
  10425. kerndeint=sharp=1
  10426. @end example
  10427. @item
  10428. Paint processed pixels in white:
  10429. @example
  10430. kerndeint=map=1
  10431. @end example
  10432. @end itemize
  10433. @section kirsch
  10434. Apply kirsch operator to input video stream.
  10435. The filter accepts the following option:
  10436. @table @option
  10437. @item planes
  10438. Set which planes will be processed, unprocessed planes will be copied.
  10439. By default value 0xf, all planes will be processed.
  10440. @item scale
  10441. Set value which will be multiplied with filtered result.
  10442. @item delta
  10443. Set value which will be added to filtered result.
  10444. @end table
  10445. @subsection Commands
  10446. This filter supports the all above options as @ref{commands}.
  10447. @section lagfun
  10448. Slowly update darker pixels.
  10449. This filter makes short flashes of light appear longer.
  10450. This filter accepts the following options:
  10451. @table @option
  10452. @item decay
  10453. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10454. @item planes
  10455. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10456. @end table
  10457. @subsection Commands
  10458. This filter supports the all above options as @ref{commands}.
  10459. @section lenscorrection
  10460. Correct radial lens distortion
  10461. This filter can be used to correct for radial distortion as can result from the use
  10462. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10463. one can use tools available for example as part of opencv or simply trial-and-error.
  10464. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10465. and extract the k1 and k2 coefficients from the resulting matrix.
  10466. Note that effectively the same filter is available in the open-source tools Krita and
  10467. Digikam from the KDE project.
  10468. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10469. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10470. brightness distribution, so you may want to use both filters together in certain
  10471. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10472. be applied before or after lens correction.
  10473. @subsection Options
  10474. The filter accepts the following options:
  10475. @table @option
  10476. @item cx
  10477. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10478. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10479. width. Default is 0.5.
  10480. @item cy
  10481. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10482. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10483. height. Default is 0.5.
  10484. @item k1
  10485. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10486. no correction. Default is 0.
  10487. @item k2
  10488. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10489. 0 means no correction. Default is 0.
  10490. @item i
  10491. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  10492. Default is @code{nearest}.
  10493. @item fc
  10494. Specify the color of the unmapped pixels. For the syntax of this option,
  10495. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10496. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  10497. @end table
  10498. The formula that generates the correction is:
  10499. @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)
  10500. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10501. distances from the focal point in the source and target images, respectively.
  10502. @subsection Commands
  10503. This filter supports the all above options as @ref{commands}.
  10504. @section lensfun
  10505. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10506. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10507. to apply the lens correction. The filter will load the lensfun database and
  10508. query it to find the corresponding camera and lens entries in the database. As
  10509. long as these entries can be found with the given options, the filter can
  10510. perform corrections on frames. Note that incomplete strings will result in the
  10511. filter choosing the best match with the given options, and the filter will
  10512. output the chosen camera and lens models (logged with level "info"). You must
  10513. provide the make, camera model, and lens model as they are required.
  10514. The filter accepts the following options:
  10515. @table @option
  10516. @item make
  10517. The make of the camera (for example, "Canon"). This option is required.
  10518. @item model
  10519. The model of the camera (for example, "Canon EOS 100D"). This option is
  10520. required.
  10521. @item lens_model
  10522. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10523. option is required.
  10524. @item mode
  10525. The type of correction to apply. The following values are valid options:
  10526. @table @samp
  10527. @item vignetting
  10528. Enables fixing lens vignetting.
  10529. @item geometry
  10530. Enables fixing lens geometry. This is the default.
  10531. @item subpixel
  10532. Enables fixing chromatic aberrations.
  10533. @item vig_geo
  10534. Enables fixing lens vignetting and lens geometry.
  10535. @item vig_subpixel
  10536. Enables fixing lens vignetting and chromatic aberrations.
  10537. @item distortion
  10538. Enables fixing both lens geometry and chromatic aberrations.
  10539. @item all
  10540. Enables all possible corrections.
  10541. @end table
  10542. @item focal_length
  10543. The focal length of the image/video (zoom; expected constant for video). For
  10544. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10545. range should be chosen when using that lens. Default 18.
  10546. @item aperture
  10547. The aperture of the image/video (expected constant for video). Note that
  10548. aperture is only used for vignetting correction. Default 3.5.
  10549. @item focus_distance
  10550. The focus distance of the image/video (expected constant for video). Note that
  10551. focus distance is only used for vignetting and only slightly affects the
  10552. vignetting correction process. If unknown, leave it at the default value (which
  10553. is 1000).
  10554. @item scale
  10555. The scale factor which is applied after transformation. After correction the
  10556. video is no longer necessarily rectangular. This parameter controls how much of
  10557. the resulting image is visible. The value 0 means that a value will be chosen
  10558. automatically such that there is little or no unmapped area in the output
  10559. image. 1.0 means that no additional scaling is done. Lower values may result
  10560. in more of the corrected image being visible, while higher values may avoid
  10561. unmapped areas in the output.
  10562. @item target_geometry
  10563. The target geometry of the output image/video. The following values are valid
  10564. options:
  10565. @table @samp
  10566. @item rectilinear (default)
  10567. @item fisheye
  10568. @item panoramic
  10569. @item equirectangular
  10570. @item fisheye_orthographic
  10571. @item fisheye_stereographic
  10572. @item fisheye_equisolid
  10573. @item fisheye_thoby
  10574. @end table
  10575. @item reverse
  10576. Apply the reverse of image correction (instead of correcting distortion, apply
  10577. it).
  10578. @item interpolation
  10579. The type of interpolation used when correcting distortion. The following values
  10580. are valid options:
  10581. @table @samp
  10582. @item nearest
  10583. @item linear (default)
  10584. @item lanczos
  10585. @end table
  10586. @end table
  10587. @subsection Examples
  10588. @itemize
  10589. @item
  10590. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10591. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10592. aperture of "8.0".
  10593. @example
  10594. 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
  10595. @end example
  10596. @item
  10597. Apply the same as before, but only for the first 5 seconds of video.
  10598. @example
  10599. 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
  10600. @end example
  10601. @end itemize
  10602. @section libvmaf
  10603. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10604. score between two input videos.
  10605. The obtained VMAF score is printed through the logging system.
  10606. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10607. After installing the library it can be enabled using:
  10608. @code{./configure --enable-libvmaf}.
  10609. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10610. The filter has following options:
  10611. @table @option
  10612. @item model_path
  10613. Set the model path which is to be used for SVM.
  10614. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10615. @item log_path
  10616. Set the file path to be used to store logs.
  10617. @item log_fmt
  10618. Set the format of the log file (csv, json or xml).
  10619. @item enable_transform
  10620. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10621. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10622. Default value: @code{false}
  10623. @item phone_model
  10624. Invokes the phone model which will generate VMAF scores higher than in the
  10625. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10626. Default value: @code{false}
  10627. @item psnr
  10628. Enables computing psnr along with vmaf.
  10629. Default value: @code{false}
  10630. @item ssim
  10631. Enables computing ssim along with vmaf.
  10632. Default value: @code{false}
  10633. @item ms_ssim
  10634. Enables computing ms_ssim along with vmaf.
  10635. Default value: @code{false}
  10636. @item pool
  10637. Set the pool method to be used for computing vmaf.
  10638. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10639. @item n_threads
  10640. Set number of threads to be used when computing vmaf.
  10641. Default value: @code{0}, which makes use of all available logical processors.
  10642. @item n_subsample
  10643. Set interval for frame subsampling used when computing vmaf.
  10644. Default value: @code{1}
  10645. @item enable_conf_interval
  10646. Enables confidence interval.
  10647. Default value: @code{false}
  10648. @end table
  10649. This filter also supports the @ref{framesync} options.
  10650. @subsection Examples
  10651. @itemize
  10652. @item
  10653. On the below examples the input file @file{main.mpg} being processed is
  10654. compared with the reference file @file{ref.mpg}.
  10655. @example
  10656. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10657. @end example
  10658. @item
  10659. Example with options:
  10660. @example
  10661. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10662. @end example
  10663. @item
  10664. Example with options and different containers:
  10665. @example
  10666. 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 -
  10667. @end example
  10668. @end itemize
  10669. @section limiter
  10670. Limits the pixel components values to the specified range [min, max].
  10671. The filter accepts the following options:
  10672. @table @option
  10673. @item min
  10674. Lower bound. Defaults to the lowest allowed value for the input.
  10675. @item max
  10676. Upper bound. Defaults to the highest allowed value for the input.
  10677. @item planes
  10678. Specify which planes will be processed. Defaults to all available.
  10679. @end table
  10680. @subsection Commands
  10681. This filter supports the all above options as @ref{commands}.
  10682. @section loop
  10683. Loop video frames.
  10684. The filter accepts the following options:
  10685. @table @option
  10686. @item loop
  10687. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10688. Default is 0.
  10689. @item size
  10690. Set maximal size in number of frames. Default is 0.
  10691. @item start
  10692. Set first frame of loop. Default is 0.
  10693. @end table
  10694. @subsection Examples
  10695. @itemize
  10696. @item
  10697. Loop single first frame infinitely:
  10698. @example
  10699. loop=loop=-1:size=1:start=0
  10700. @end example
  10701. @item
  10702. Loop single first frame 10 times:
  10703. @example
  10704. loop=loop=10:size=1:start=0
  10705. @end example
  10706. @item
  10707. Loop 10 first frames 5 times:
  10708. @example
  10709. loop=loop=5:size=10:start=0
  10710. @end example
  10711. @end itemize
  10712. @section lut1d
  10713. Apply a 1D LUT to an input video.
  10714. The filter accepts the following options:
  10715. @table @option
  10716. @item file
  10717. Set the 1D LUT file name.
  10718. Currently supported formats:
  10719. @table @samp
  10720. @item cube
  10721. Iridas
  10722. @item csp
  10723. cineSpace
  10724. @end table
  10725. @item interp
  10726. Select interpolation mode.
  10727. Available values are:
  10728. @table @samp
  10729. @item nearest
  10730. Use values from the nearest defined point.
  10731. @item linear
  10732. Interpolate values using the linear interpolation.
  10733. @item cosine
  10734. Interpolate values using the cosine interpolation.
  10735. @item cubic
  10736. Interpolate values using the cubic interpolation.
  10737. @item spline
  10738. Interpolate values using the spline interpolation.
  10739. @end table
  10740. @end table
  10741. @subsection Commands
  10742. This filter supports the all above options as @ref{commands}.
  10743. @anchor{lut3d}
  10744. @section lut3d
  10745. Apply a 3D LUT to an input video.
  10746. The filter accepts the following options:
  10747. @table @option
  10748. @item file
  10749. Set the 3D LUT file name.
  10750. Currently supported formats:
  10751. @table @samp
  10752. @item 3dl
  10753. AfterEffects
  10754. @item cube
  10755. Iridas
  10756. @item dat
  10757. DaVinci
  10758. @item m3d
  10759. Pandora
  10760. @item csp
  10761. cineSpace
  10762. @end table
  10763. @item interp
  10764. Select interpolation mode.
  10765. Available values are:
  10766. @table @samp
  10767. @item nearest
  10768. Use values from the nearest defined point.
  10769. @item trilinear
  10770. Interpolate values using the 8 points defining a cube.
  10771. @item tetrahedral
  10772. Interpolate values using a tetrahedron.
  10773. @item pyramid
  10774. Interpolate values using a pyramid.
  10775. @item prism
  10776. Interpolate values using a prism.
  10777. @end table
  10778. @end table
  10779. @subsection Commands
  10780. This filter supports the @code{interp} option as @ref{commands}.
  10781. @section lumakey
  10782. Turn certain luma values into transparency.
  10783. The filter accepts the following options:
  10784. @table @option
  10785. @item threshold
  10786. Set the luma which will be used as base for transparency.
  10787. Default value is @code{0}.
  10788. @item tolerance
  10789. Set the range of luma values to be keyed out.
  10790. Default value is @code{0.01}.
  10791. @item softness
  10792. Set the range of softness. Default value is @code{0}.
  10793. Use this to control gradual transition from zero to full transparency.
  10794. @end table
  10795. @subsection Commands
  10796. This filter supports same @ref{commands} as options.
  10797. The command accepts the same syntax of the corresponding option.
  10798. If the specified expression is not valid, it is kept at its current
  10799. value.
  10800. @section lut, lutrgb, lutyuv
  10801. Compute a look-up table for binding each pixel component input value
  10802. to an output value, and apply it to the input video.
  10803. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10804. to an RGB input video.
  10805. These filters accept the following parameters:
  10806. @table @option
  10807. @item c0
  10808. set first pixel component expression
  10809. @item c1
  10810. set second pixel component expression
  10811. @item c2
  10812. set third pixel component expression
  10813. @item c3
  10814. set fourth pixel component expression, corresponds to the alpha component
  10815. @item r
  10816. set red component expression
  10817. @item g
  10818. set green component expression
  10819. @item b
  10820. set blue component expression
  10821. @item a
  10822. alpha component expression
  10823. @item y
  10824. set Y/luminance component expression
  10825. @item u
  10826. set U/Cb component expression
  10827. @item v
  10828. set V/Cr component expression
  10829. @end table
  10830. Each of them specifies the expression to use for computing the lookup table for
  10831. the corresponding pixel component values.
  10832. The exact component associated to each of the @var{c*} options depends on the
  10833. format in input.
  10834. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10835. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10836. The expressions can contain the following constants and functions:
  10837. @table @option
  10838. @item w
  10839. @item h
  10840. The input width and height.
  10841. @item val
  10842. The input value for the pixel component.
  10843. @item clipval
  10844. The input value, clipped to the @var{minval}-@var{maxval} range.
  10845. @item maxval
  10846. The maximum value for the pixel component.
  10847. @item minval
  10848. The minimum value for the pixel component.
  10849. @item negval
  10850. The negated value for the pixel component value, clipped to the
  10851. @var{minval}-@var{maxval} range; it corresponds to the expression
  10852. "maxval-clipval+minval".
  10853. @item clip(val)
  10854. The computed value in @var{val}, clipped to the
  10855. @var{minval}-@var{maxval} range.
  10856. @item gammaval(gamma)
  10857. The computed gamma correction value of the pixel component value,
  10858. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10859. expression
  10860. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10861. @end table
  10862. All expressions default to "val".
  10863. @subsection Commands
  10864. This filter supports same @ref{commands} as options.
  10865. @subsection Examples
  10866. @itemize
  10867. @item
  10868. Negate input video:
  10869. @example
  10870. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10871. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10872. @end example
  10873. The above is the same as:
  10874. @example
  10875. lutrgb="r=negval:g=negval:b=negval"
  10876. lutyuv="y=negval:u=negval:v=negval"
  10877. @end example
  10878. @item
  10879. Negate luminance:
  10880. @example
  10881. lutyuv=y=negval
  10882. @end example
  10883. @item
  10884. Remove chroma components, turning the video into a graytone image:
  10885. @example
  10886. lutyuv="u=128:v=128"
  10887. @end example
  10888. @item
  10889. Apply a luma burning effect:
  10890. @example
  10891. lutyuv="y=2*val"
  10892. @end example
  10893. @item
  10894. Remove green and blue components:
  10895. @example
  10896. lutrgb="g=0:b=0"
  10897. @end example
  10898. @item
  10899. Set a constant alpha channel value on input:
  10900. @example
  10901. format=rgba,lutrgb=a="maxval-minval/2"
  10902. @end example
  10903. @item
  10904. Correct luminance gamma by a factor of 0.5:
  10905. @example
  10906. lutyuv=y=gammaval(0.5)
  10907. @end example
  10908. @item
  10909. Discard least significant bits of luma:
  10910. @example
  10911. lutyuv=y='bitand(val, 128+64+32)'
  10912. @end example
  10913. @item
  10914. Technicolor like effect:
  10915. @example
  10916. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10917. @end example
  10918. @end itemize
  10919. @section lut2, tlut2
  10920. The @code{lut2} filter takes two input streams and outputs one
  10921. stream.
  10922. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10923. from one single stream.
  10924. This filter accepts the following parameters:
  10925. @table @option
  10926. @item c0
  10927. set first pixel component expression
  10928. @item c1
  10929. set second pixel component expression
  10930. @item c2
  10931. set third pixel component expression
  10932. @item c3
  10933. set fourth pixel component expression, corresponds to the alpha component
  10934. @item d
  10935. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10936. which means bit depth is automatically picked from first input format.
  10937. @end table
  10938. The @code{lut2} filter also supports the @ref{framesync} options.
  10939. Each of them specifies the expression to use for computing the lookup table for
  10940. the corresponding pixel component values.
  10941. The exact component associated to each of the @var{c*} options depends on the
  10942. format in inputs.
  10943. The expressions can contain the following constants:
  10944. @table @option
  10945. @item w
  10946. @item h
  10947. The input width and height.
  10948. @item x
  10949. The first input value for the pixel component.
  10950. @item y
  10951. The second input value for the pixel component.
  10952. @item bdx
  10953. The first input video bit depth.
  10954. @item bdy
  10955. The second input video bit depth.
  10956. @end table
  10957. All expressions default to "x".
  10958. @subsection Commands
  10959. This filter supports the all above options as @ref{commands} except option @code{d}.
  10960. @subsection Examples
  10961. @itemize
  10962. @item
  10963. Highlight differences between two RGB video streams:
  10964. @example
  10965. 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)'
  10966. @end example
  10967. @item
  10968. Highlight differences between two YUV video streams:
  10969. @example
  10970. 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)'
  10971. @end example
  10972. @item
  10973. Show max difference between two video streams:
  10974. @example
  10975. 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)))'
  10976. @end example
  10977. @end itemize
  10978. @section maskedclamp
  10979. Clamp the first input stream with the second input and third input stream.
  10980. Returns the value of first stream to be between second input
  10981. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10982. This filter accepts the following options:
  10983. @table @option
  10984. @item undershoot
  10985. Default value is @code{0}.
  10986. @item overshoot
  10987. Default value is @code{0}.
  10988. @item planes
  10989. Set which planes will be processed as bitmap, unprocessed planes will be
  10990. copied from first stream.
  10991. By default value 0xf, all planes will be processed.
  10992. @end table
  10993. @subsection Commands
  10994. This filter supports the all above options as @ref{commands}.
  10995. @section maskedmax
  10996. Merge the second and third input stream into output stream using absolute differences
  10997. between second input stream and first input stream and absolute difference between
  10998. third input stream and first input stream. The picked value will be from second input
  10999. stream if second absolute difference is greater than first one or from third input stream
  11000. otherwise.
  11001. This filter accepts the following options:
  11002. @table @option
  11003. @item planes
  11004. Set which planes will be processed as bitmap, unprocessed planes will be
  11005. copied from first stream.
  11006. By default value 0xf, all planes will be processed.
  11007. @end table
  11008. @subsection Commands
  11009. This filter supports the all above options as @ref{commands}.
  11010. @section maskedmerge
  11011. Merge the first input stream with the second input stream using per pixel
  11012. weights in the third input stream.
  11013. A value of 0 in the third stream pixel component means that pixel component
  11014. from first stream is returned unchanged, while maximum value (eg. 255 for
  11015. 8-bit videos) means that pixel component from second stream is returned
  11016. unchanged. Intermediate values define the amount of merging between both
  11017. input stream's pixel components.
  11018. This filter accepts the following options:
  11019. @table @option
  11020. @item planes
  11021. Set which planes will be processed as bitmap, unprocessed planes will be
  11022. copied from first stream.
  11023. By default value 0xf, all planes will be processed.
  11024. @end table
  11025. @subsection Commands
  11026. This filter supports the all above options as @ref{commands}.
  11027. @section maskedmin
  11028. Merge the second and third input stream into output stream using absolute differences
  11029. between second input stream and first input stream and absolute difference between
  11030. third input stream and first input stream. The picked value will be from second input
  11031. stream if second absolute difference is less than first one or from third input stream
  11032. otherwise.
  11033. This filter accepts the following options:
  11034. @table @option
  11035. @item planes
  11036. Set which planes will be processed as bitmap, unprocessed planes will be
  11037. copied from first stream.
  11038. By default value 0xf, all planes will be processed.
  11039. @end table
  11040. @subsection Commands
  11041. This filter supports the all above options as @ref{commands}.
  11042. @section maskedthreshold
  11043. Pick pixels comparing absolute difference of two video streams with fixed
  11044. threshold.
  11045. If absolute difference between pixel component of first and second video
  11046. stream is equal or lower than user supplied threshold than pixel component
  11047. from first video stream is picked, otherwise pixel component from second
  11048. video stream is picked.
  11049. This filter accepts the following options:
  11050. @table @option
  11051. @item threshold
  11052. Set threshold used when picking pixels from absolute difference from two input
  11053. video streams.
  11054. @item planes
  11055. Set which planes will be processed as bitmap, unprocessed planes will be
  11056. copied from second stream.
  11057. By default value 0xf, all planes will be processed.
  11058. @end table
  11059. @subsection Commands
  11060. This filter supports the all above options as @ref{commands}.
  11061. @section maskfun
  11062. Create mask from input video.
  11063. For example it is useful to create motion masks after @code{tblend} filter.
  11064. This filter accepts the following options:
  11065. @table @option
  11066. @item low
  11067. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  11068. @item high
  11069. Set high threshold. Any pixel component higher than this value will be set to max value
  11070. allowed for current pixel format.
  11071. @item planes
  11072. Set planes to filter, by default all available planes are filtered.
  11073. @item fill
  11074. Fill all frame pixels with this value.
  11075. @item sum
  11076. Set max average pixel value for frame. If sum of all pixel components is higher that this
  11077. average, output frame will be completely filled with value set by @var{fill} option.
  11078. Typically useful for scene changes when used in combination with @code{tblend} filter.
  11079. @end table
  11080. @subsection Commands
  11081. This filter supports the all above options as @ref{commands}.
  11082. @section mcdeint
  11083. Apply motion-compensation deinterlacing.
  11084. It needs one field per frame as input and must thus be used together
  11085. with yadif=1/3 or equivalent.
  11086. This filter accepts the following options:
  11087. @table @option
  11088. @item mode
  11089. Set the deinterlacing mode.
  11090. It accepts one of the following values:
  11091. @table @samp
  11092. @item fast
  11093. @item medium
  11094. @item slow
  11095. use iterative motion estimation
  11096. @item extra_slow
  11097. like @samp{slow}, but use multiple reference frames.
  11098. @end table
  11099. Default value is @samp{fast}.
  11100. @item parity
  11101. Set the picture field parity assumed for the input video. It must be
  11102. one of the following values:
  11103. @table @samp
  11104. @item 0, tff
  11105. assume top field first
  11106. @item 1, bff
  11107. assume bottom field first
  11108. @end table
  11109. Default value is @samp{bff}.
  11110. @item qp
  11111. Set per-block quantization parameter (QP) used by the internal
  11112. encoder.
  11113. Higher values should result in a smoother motion vector field but less
  11114. optimal individual vectors. Default value is 1.
  11115. @end table
  11116. @section median
  11117. Pick median pixel from certain rectangle defined by radius.
  11118. This filter accepts the following options:
  11119. @table @option
  11120. @item radius
  11121. Set horizontal radius size. Default value is @code{1}.
  11122. Allowed range is integer from 1 to 127.
  11123. @item planes
  11124. Set which planes to process. Default is @code{15}, which is all available planes.
  11125. @item radiusV
  11126. Set vertical radius size. Default value is @code{0}.
  11127. Allowed range is integer from 0 to 127.
  11128. If it is 0, value will be picked from horizontal @code{radius} option.
  11129. @item percentile
  11130. Set median percentile. Default value is @code{0.5}.
  11131. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  11132. minimum values, and @code{1} maximum values.
  11133. @end table
  11134. @subsection Commands
  11135. This filter supports same @ref{commands} as options.
  11136. The command accepts the same syntax of the corresponding option.
  11137. If the specified expression is not valid, it is kept at its current
  11138. value.
  11139. @section mergeplanes
  11140. Merge color channel components from several video streams.
  11141. The filter accepts up to 4 input streams, and merge selected input
  11142. planes to the output video.
  11143. This filter accepts the following options:
  11144. @table @option
  11145. @item mapping
  11146. Set input to output plane mapping. Default is @code{0}.
  11147. The mappings is specified as a bitmap. It should be specified as a
  11148. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  11149. mapping for the first plane of the output stream. 'A' sets the number of
  11150. the input stream to use (from 0 to 3), and 'a' the plane number of the
  11151. corresponding input to use (from 0 to 3). The rest of the mappings is
  11152. similar, 'Bb' describes the mapping for the output stream second
  11153. plane, 'Cc' describes the mapping for the output stream third plane and
  11154. 'Dd' describes the mapping for the output stream fourth plane.
  11155. @item format
  11156. Set output pixel format. Default is @code{yuva444p}.
  11157. @end table
  11158. @subsection Examples
  11159. @itemize
  11160. @item
  11161. Merge three gray video streams of same width and height into single video stream:
  11162. @example
  11163. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  11164. @end example
  11165. @item
  11166. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  11167. @example
  11168. [a0][a1]mergeplanes=0x00010210:yuva444p
  11169. @end example
  11170. @item
  11171. Swap Y and A plane in yuva444p stream:
  11172. @example
  11173. format=yuva444p,mergeplanes=0x03010200:yuva444p
  11174. @end example
  11175. @item
  11176. Swap U and V plane in yuv420p stream:
  11177. @example
  11178. format=yuv420p,mergeplanes=0x000201:yuv420p
  11179. @end example
  11180. @item
  11181. Cast a rgb24 clip to yuv444p:
  11182. @example
  11183. format=rgb24,mergeplanes=0x000102:yuv444p
  11184. @end example
  11185. @end itemize
  11186. @section mestimate
  11187. Estimate and export motion vectors using block matching algorithms.
  11188. Motion vectors are stored in frame side data to be used by other filters.
  11189. This filter accepts the following options:
  11190. @table @option
  11191. @item method
  11192. Specify the motion estimation method. Accepts one of the following values:
  11193. @table @samp
  11194. @item esa
  11195. Exhaustive search algorithm.
  11196. @item tss
  11197. Three step search algorithm.
  11198. @item tdls
  11199. Two dimensional logarithmic search algorithm.
  11200. @item ntss
  11201. New three step search algorithm.
  11202. @item fss
  11203. Four step search algorithm.
  11204. @item ds
  11205. Diamond search algorithm.
  11206. @item hexbs
  11207. Hexagon-based search algorithm.
  11208. @item epzs
  11209. Enhanced predictive zonal search algorithm.
  11210. @item umh
  11211. Uneven multi-hexagon search algorithm.
  11212. @end table
  11213. Default value is @samp{esa}.
  11214. @item mb_size
  11215. Macroblock size. Default @code{16}.
  11216. @item search_param
  11217. Search parameter. Default @code{7}.
  11218. @end table
  11219. @section midequalizer
  11220. Apply Midway Image Equalization effect using two video streams.
  11221. Midway Image Equalization adjusts a pair of images to have the same
  11222. histogram, while maintaining their dynamics as much as possible. It's
  11223. useful for e.g. matching exposures from a pair of stereo cameras.
  11224. This filter has two inputs and one output, which must be of same pixel format, but
  11225. may be of different sizes. The output of filter is first input adjusted with
  11226. midway histogram of both inputs.
  11227. This filter accepts the following option:
  11228. @table @option
  11229. @item planes
  11230. Set which planes to process. Default is @code{15}, which is all available planes.
  11231. @end table
  11232. @section minterpolate
  11233. Convert the video to specified frame rate using motion interpolation.
  11234. This filter accepts the following options:
  11235. @table @option
  11236. @item fps
  11237. 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}.
  11238. @item mi_mode
  11239. Motion interpolation mode. Following values are accepted:
  11240. @table @samp
  11241. @item dup
  11242. Duplicate previous or next frame for interpolating new ones.
  11243. @item blend
  11244. Blend source frames. Interpolated frame is mean of previous and next frames.
  11245. @item mci
  11246. Motion compensated interpolation. Following options are effective when this mode is selected:
  11247. @table @samp
  11248. @item mc_mode
  11249. Motion compensation mode. Following values are accepted:
  11250. @table @samp
  11251. @item obmc
  11252. Overlapped block motion compensation.
  11253. @item aobmc
  11254. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  11255. @end table
  11256. Default mode is @samp{obmc}.
  11257. @item me_mode
  11258. Motion estimation mode. Following values are accepted:
  11259. @table @samp
  11260. @item bidir
  11261. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  11262. @item bilat
  11263. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  11264. @end table
  11265. Default mode is @samp{bilat}.
  11266. @item me
  11267. The algorithm to be used for motion estimation. Following values are accepted:
  11268. @table @samp
  11269. @item esa
  11270. Exhaustive search algorithm.
  11271. @item tss
  11272. Three step search algorithm.
  11273. @item tdls
  11274. Two dimensional logarithmic search algorithm.
  11275. @item ntss
  11276. New three step search algorithm.
  11277. @item fss
  11278. Four step search algorithm.
  11279. @item ds
  11280. Diamond search algorithm.
  11281. @item hexbs
  11282. Hexagon-based search algorithm.
  11283. @item epzs
  11284. Enhanced predictive zonal search algorithm.
  11285. @item umh
  11286. Uneven multi-hexagon search algorithm.
  11287. @end table
  11288. Default algorithm is @samp{epzs}.
  11289. @item mb_size
  11290. Macroblock size. Default @code{16}.
  11291. @item search_param
  11292. Motion estimation search parameter. Default @code{32}.
  11293. @item vsbmc
  11294. 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).
  11295. @end table
  11296. @end table
  11297. @item scd
  11298. 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:
  11299. @table @samp
  11300. @item none
  11301. Disable scene change detection.
  11302. @item fdiff
  11303. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  11304. @end table
  11305. Default method is @samp{fdiff}.
  11306. @item scd_threshold
  11307. Scene change detection threshold. Default is @code{10.}.
  11308. @end table
  11309. @section mix
  11310. Mix several video input streams into one video stream.
  11311. A description of the accepted options follows.
  11312. @table @option
  11313. @item inputs
  11314. The number of inputs. If unspecified, it defaults to 2.
  11315. @item weights
  11316. Specify weight of each input video stream as sequence.
  11317. Each weight is separated by space. If number of weights
  11318. is smaller than number of @var{frames} last specified
  11319. weight will be used for all remaining unset weights.
  11320. @item scale
  11321. Specify scale, if it is set it will be multiplied with sum
  11322. of each weight multiplied with pixel values to give final destination
  11323. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11324. @item duration
  11325. Specify how end of stream is determined.
  11326. @table @samp
  11327. @item longest
  11328. The duration of the longest input. (default)
  11329. @item shortest
  11330. The duration of the shortest input.
  11331. @item first
  11332. The duration of the first input.
  11333. @end table
  11334. @end table
  11335. @subsection Commands
  11336. This filter supports the following commands:
  11337. @table @option
  11338. @item weights
  11339. @item scale
  11340. Syntax is same as option with same name.
  11341. @end table
  11342. @section monochrome
  11343. Convert video to gray using custom color filter.
  11344. A description of the accepted options follows.
  11345. @table @option
  11346. @item cb
  11347. Set the chroma blue spot. Allowed range is from -1 to 1.
  11348. Default value is 0.
  11349. @item cr
  11350. Set the chroma red spot. Allowed range is from -1 to 1.
  11351. Default value is 0.
  11352. @item size
  11353. Set the color filter size. Allowed range is from .1 to 10.
  11354. Default value is 1.
  11355. @item high
  11356. Set the highlights strength. Allowed range is from 0 to 1.
  11357. Default value is 0.
  11358. @end table
  11359. @subsection Commands
  11360. This filter supports the all above options as @ref{commands}.
  11361. @section mpdecimate
  11362. Drop frames that do not differ greatly from the previous frame in
  11363. order to reduce frame rate.
  11364. The main use of this filter is for very-low-bitrate encoding
  11365. (e.g. streaming over dialup modem), but it could in theory be used for
  11366. fixing movies that were inverse-telecined incorrectly.
  11367. A description of the accepted options follows.
  11368. @table @option
  11369. @item max
  11370. Set the maximum number of consecutive frames which can be dropped (if
  11371. positive), or the minimum interval between dropped frames (if
  11372. negative). If the value is 0, the frame is dropped disregarding the
  11373. number of previous sequentially dropped frames.
  11374. Default value is 0.
  11375. @item hi
  11376. @item lo
  11377. @item frac
  11378. Set the dropping threshold values.
  11379. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  11380. represent actual pixel value differences, so a threshold of 64
  11381. corresponds to 1 unit of difference for each pixel, or the same spread
  11382. out differently over the block.
  11383. A frame is a candidate for dropping if no 8x8 blocks differ by more
  11384. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  11385. meaning the whole image) differ by more than a threshold of @option{lo}.
  11386. Default value for @option{hi} is 64*12, default value for @option{lo} is
  11387. 64*5, and default value for @option{frac} is 0.33.
  11388. @end table
  11389. @section msad
  11390. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  11391. This filter takes two input videos.
  11392. Both input videos must have the same resolution and pixel format for
  11393. this filter to work correctly. Also it assumes that both inputs
  11394. have the same number of frames, which are compared one by one.
  11395. The obtained per component, average, min and max MSAD is printed through
  11396. the logging system.
  11397. The filter stores the calculated MSAD of each frame in frame metadata.
  11398. In the below example the input file @file{main.mpg} being processed is compared
  11399. with the reference file @file{ref.mpg}.
  11400. @example
  11401. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  11402. @end example
  11403. @section negate
  11404. Negate (invert) the input video.
  11405. It accepts the following option:
  11406. @table @option
  11407. @item negate_alpha
  11408. With value 1, it negates the alpha component, if present. Default value is 0.
  11409. @end table
  11410. @subsection Commands
  11411. This filter supports same @ref{commands} as options.
  11412. @anchor{nlmeans}
  11413. @section nlmeans
  11414. Denoise frames using Non-Local Means algorithm.
  11415. Each pixel is adjusted by looking for other pixels with similar contexts. This
  11416. context similarity is defined by comparing their surrounding patches of size
  11417. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  11418. around the pixel.
  11419. Note that the research area defines centers for patches, which means some
  11420. patches will be made of pixels outside that research area.
  11421. The filter accepts the following options.
  11422. @table @option
  11423. @item s
  11424. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  11425. @item p
  11426. Set patch size. Default is 7. Must be odd number in range [0, 99].
  11427. @item pc
  11428. Same as @option{p} but for chroma planes.
  11429. The default value is @var{0} and means automatic.
  11430. @item r
  11431. Set research size. Default is 15. Must be odd number in range [0, 99].
  11432. @item rc
  11433. Same as @option{r} but for chroma planes.
  11434. The default value is @var{0} and means automatic.
  11435. @end table
  11436. @section nnedi
  11437. Deinterlace video using neural network edge directed interpolation.
  11438. This filter accepts the following options:
  11439. @table @option
  11440. @item weights
  11441. Mandatory option, without binary file filter can not work.
  11442. Currently file can be found here:
  11443. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  11444. @item deint
  11445. Set which frames to deinterlace, by default it is @code{all}.
  11446. Can be @code{all} or @code{interlaced}.
  11447. @item field
  11448. Set mode of operation.
  11449. Can be one of the following:
  11450. @table @samp
  11451. @item af
  11452. Use frame flags, both fields.
  11453. @item a
  11454. Use frame flags, single field.
  11455. @item t
  11456. Use top field only.
  11457. @item b
  11458. Use bottom field only.
  11459. @item tf
  11460. Use both fields, top first.
  11461. @item bf
  11462. Use both fields, bottom first.
  11463. @end table
  11464. @item planes
  11465. Set which planes to process, by default filter process all frames.
  11466. @item nsize
  11467. Set size of local neighborhood around each pixel, used by the predictor neural
  11468. network.
  11469. Can be one of the following:
  11470. @table @samp
  11471. @item s8x6
  11472. @item s16x6
  11473. @item s32x6
  11474. @item s48x6
  11475. @item s8x4
  11476. @item s16x4
  11477. @item s32x4
  11478. @end table
  11479. @item nns
  11480. Set the number of neurons in predictor neural network.
  11481. Can be one of the following:
  11482. @table @samp
  11483. @item n16
  11484. @item n32
  11485. @item n64
  11486. @item n128
  11487. @item n256
  11488. @end table
  11489. @item qual
  11490. Controls the number of different neural network predictions that are blended
  11491. together to compute the final output value. Can be @code{fast}, default or
  11492. @code{slow}.
  11493. @item etype
  11494. Set which set of weights to use in the predictor.
  11495. Can be one of the following:
  11496. @table @samp
  11497. @item a, abs
  11498. weights trained to minimize absolute error
  11499. @item s, mse
  11500. weights trained to minimize squared error
  11501. @end table
  11502. @item pscrn
  11503. Controls whether or not the prescreener neural network is used to decide
  11504. which pixels should be processed by the predictor neural network and which
  11505. can be handled by simple cubic interpolation.
  11506. The prescreener is trained to know whether cubic interpolation will be
  11507. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11508. The computational complexity of the prescreener nn is much less than that of
  11509. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11510. using the prescreener generally results in much faster processing.
  11511. The prescreener is pretty accurate, so the difference between using it and not
  11512. using it is almost always unnoticeable.
  11513. Can be one of the following:
  11514. @table @samp
  11515. @item none
  11516. @item original
  11517. @item new
  11518. @item new2
  11519. @item new3
  11520. @end table
  11521. Default is @code{new}.
  11522. @end table
  11523. @subsection Commands
  11524. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  11525. @section noformat
  11526. Force libavfilter not to use any of the specified pixel formats for the
  11527. input to the next filter.
  11528. It accepts the following parameters:
  11529. @table @option
  11530. @item pix_fmts
  11531. A '|'-separated list of pixel format names, such as
  11532. pix_fmts=yuv420p|monow|rgb24".
  11533. @end table
  11534. @subsection Examples
  11535. @itemize
  11536. @item
  11537. Force libavfilter to use a format different from @var{yuv420p} for the
  11538. input to the vflip filter:
  11539. @example
  11540. noformat=pix_fmts=yuv420p,vflip
  11541. @end example
  11542. @item
  11543. Convert the input video to any of the formats not contained in the list:
  11544. @example
  11545. noformat=yuv420p|yuv444p|yuv410p
  11546. @end example
  11547. @end itemize
  11548. @section noise
  11549. Add noise on video input frame.
  11550. The filter accepts the following options:
  11551. @table @option
  11552. @item all_seed
  11553. @item c0_seed
  11554. @item c1_seed
  11555. @item c2_seed
  11556. @item c3_seed
  11557. Set noise seed for specific pixel component or all pixel components in case
  11558. of @var{all_seed}. Default value is @code{123457}.
  11559. @item all_strength, alls
  11560. @item c0_strength, c0s
  11561. @item c1_strength, c1s
  11562. @item c2_strength, c2s
  11563. @item c3_strength, c3s
  11564. Set noise strength for specific pixel component or all pixel components in case
  11565. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11566. @item all_flags, allf
  11567. @item c0_flags, c0f
  11568. @item c1_flags, c1f
  11569. @item c2_flags, c2f
  11570. @item c3_flags, c3f
  11571. Set pixel component flags or set flags for all components if @var{all_flags}.
  11572. Available values for component flags are:
  11573. @table @samp
  11574. @item a
  11575. averaged temporal noise (smoother)
  11576. @item p
  11577. mix random noise with a (semi)regular pattern
  11578. @item t
  11579. temporal noise (noise pattern changes between frames)
  11580. @item u
  11581. uniform noise (gaussian otherwise)
  11582. @end table
  11583. @end table
  11584. @subsection Examples
  11585. Add temporal and uniform noise to input video:
  11586. @example
  11587. noise=alls=20:allf=t+u
  11588. @end example
  11589. @section normalize
  11590. Normalize RGB video (aka histogram stretching, contrast stretching).
  11591. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11592. For each channel of each frame, the filter computes the input range and maps
  11593. it linearly to the user-specified output range. The output range defaults
  11594. to the full dynamic range from pure black to pure white.
  11595. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11596. changes in brightness) caused when small dark or bright objects enter or leave
  11597. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11598. video camera, and, like a video camera, it may cause a period of over- or
  11599. under-exposure of the video.
  11600. The R,G,B channels can be normalized independently, which may cause some
  11601. color shifting, or linked together as a single channel, which prevents
  11602. color shifting. Linked normalization preserves hue. Independent normalization
  11603. does not, so it can be used to remove some color casts. Independent and linked
  11604. normalization can be combined in any ratio.
  11605. The normalize filter accepts the following options:
  11606. @table @option
  11607. @item blackpt
  11608. @item whitept
  11609. Colors which define the output range. The minimum input value is mapped to
  11610. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11611. The defaults are black and white respectively. Specifying white for
  11612. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11613. normalized video. Shades of grey can be used to reduce the dynamic range
  11614. (contrast). Specifying saturated colors here can create some interesting
  11615. effects.
  11616. @item smoothing
  11617. The number of previous frames to use for temporal smoothing. The input range
  11618. of each channel is smoothed using a rolling average over the current frame
  11619. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11620. smoothing).
  11621. @item independence
  11622. Controls the ratio of independent (color shifting) channel normalization to
  11623. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11624. independent. Defaults to 1.0 (fully independent).
  11625. @item strength
  11626. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11627. expensive no-op. Defaults to 1.0 (full strength).
  11628. @end table
  11629. @subsection Commands
  11630. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11631. The command accepts the same syntax of the corresponding option.
  11632. If the specified expression is not valid, it is kept at its current
  11633. value.
  11634. @subsection Examples
  11635. Stretch video contrast to use the full dynamic range, with no temporal
  11636. smoothing; may flicker depending on the source content:
  11637. @example
  11638. normalize=blackpt=black:whitept=white:smoothing=0
  11639. @end example
  11640. As above, but with 50 frames of temporal smoothing; flicker should be
  11641. reduced, depending on the source content:
  11642. @example
  11643. normalize=blackpt=black:whitept=white:smoothing=50
  11644. @end example
  11645. As above, but with hue-preserving linked channel normalization:
  11646. @example
  11647. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11648. @end example
  11649. As above, but with half strength:
  11650. @example
  11651. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11652. @end example
  11653. Map the darkest input color to red, the brightest input color to cyan:
  11654. @example
  11655. normalize=blackpt=red:whitept=cyan
  11656. @end example
  11657. @section null
  11658. Pass the video source unchanged to the output.
  11659. @section ocr
  11660. Optical Character Recognition
  11661. This filter uses Tesseract for optical character recognition. To enable
  11662. compilation of this filter, you need to configure FFmpeg with
  11663. @code{--enable-libtesseract}.
  11664. It accepts the following options:
  11665. @table @option
  11666. @item datapath
  11667. Set datapath to tesseract data. Default is to use whatever was
  11668. set at installation.
  11669. @item language
  11670. Set language, default is "eng".
  11671. @item whitelist
  11672. Set character whitelist.
  11673. @item blacklist
  11674. Set character blacklist.
  11675. @end table
  11676. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11677. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11678. @section ocv
  11679. Apply a video transform using libopencv.
  11680. To enable this filter, install the libopencv library and headers and
  11681. configure FFmpeg with @code{--enable-libopencv}.
  11682. It accepts the following parameters:
  11683. @table @option
  11684. @item filter_name
  11685. The name of the libopencv filter to apply.
  11686. @item filter_params
  11687. The parameters to pass to the libopencv filter. If not specified, the default
  11688. values are assumed.
  11689. @end table
  11690. Refer to the official libopencv documentation for more precise
  11691. information:
  11692. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11693. Several libopencv filters are supported; see the following subsections.
  11694. @anchor{dilate}
  11695. @subsection dilate
  11696. Dilate an image by using a specific structuring element.
  11697. It corresponds to the libopencv function @code{cvDilate}.
  11698. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11699. @var{struct_el} represents a structuring element, and has the syntax:
  11700. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11701. @var{cols} and @var{rows} represent the number of columns and rows of
  11702. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11703. point, and @var{shape} the shape for the structuring element. @var{shape}
  11704. must be "rect", "cross", "ellipse", or "custom".
  11705. If the value for @var{shape} is "custom", it must be followed by a
  11706. string of the form "=@var{filename}". The file with name
  11707. @var{filename} is assumed to represent a binary image, with each
  11708. printable character corresponding to a bright pixel. When a custom
  11709. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11710. or columns and rows of the read file are assumed instead.
  11711. The default value for @var{struct_el} is "3x3+0x0/rect".
  11712. @var{nb_iterations} specifies the number of times the transform is
  11713. applied to the image, and defaults to 1.
  11714. Some examples:
  11715. @example
  11716. # Use the default values
  11717. ocv=dilate
  11718. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11719. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11720. # Read the shape from the file diamond.shape, iterating two times.
  11721. # The file diamond.shape may contain a pattern of characters like this
  11722. # *
  11723. # ***
  11724. # *****
  11725. # ***
  11726. # *
  11727. # The specified columns and rows are ignored
  11728. # but the anchor point coordinates are not
  11729. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11730. @end example
  11731. @subsection erode
  11732. Erode an image by using a specific structuring element.
  11733. It corresponds to the libopencv function @code{cvErode}.
  11734. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11735. with the same syntax and semantics as the @ref{dilate} filter.
  11736. @subsection smooth
  11737. Smooth the input video.
  11738. The filter takes the following parameters:
  11739. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11740. @var{type} is the type of smooth filter to apply, and must be one of
  11741. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11742. or "bilateral". The default value is "gaussian".
  11743. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11744. depends on the smooth type. @var{param1} and
  11745. @var{param2} accept integer positive values or 0. @var{param3} and
  11746. @var{param4} accept floating point values.
  11747. The default value for @var{param1} is 3. The default value for the
  11748. other parameters is 0.
  11749. These parameters correspond to the parameters assigned to the
  11750. libopencv function @code{cvSmooth}.
  11751. @section oscilloscope
  11752. 2D Video Oscilloscope.
  11753. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11754. It accepts the following parameters:
  11755. @table @option
  11756. @item x
  11757. Set scope center x position.
  11758. @item y
  11759. Set scope center y position.
  11760. @item s
  11761. Set scope size, relative to frame diagonal.
  11762. @item t
  11763. Set scope tilt/rotation.
  11764. @item o
  11765. Set trace opacity.
  11766. @item tx
  11767. Set trace center x position.
  11768. @item ty
  11769. Set trace center y position.
  11770. @item tw
  11771. Set trace width, relative to width of frame.
  11772. @item th
  11773. Set trace height, relative to height of frame.
  11774. @item c
  11775. Set which components to trace. By default it traces first three components.
  11776. @item g
  11777. Draw trace grid. By default is enabled.
  11778. @item st
  11779. Draw some statistics. By default is enabled.
  11780. @item sc
  11781. Draw scope. By default is enabled.
  11782. @end table
  11783. @subsection Commands
  11784. This filter supports same @ref{commands} as options.
  11785. The command accepts the same syntax of the corresponding option.
  11786. If the specified expression is not valid, it is kept at its current
  11787. value.
  11788. @subsection Examples
  11789. @itemize
  11790. @item
  11791. Inspect full first row of video frame.
  11792. @example
  11793. oscilloscope=x=0.5:y=0:s=1
  11794. @end example
  11795. @item
  11796. Inspect full last row of video frame.
  11797. @example
  11798. oscilloscope=x=0.5:y=1:s=1
  11799. @end example
  11800. @item
  11801. Inspect full 5th line of video frame of height 1080.
  11802. @example
  11803. oscilloscope=x=0.5:y=5/1080:s=1
  11804. @end example
  11805. @item
  11806. Inspect full last column of video frame.
  11807. @example
  11808. oscilloscope=x=1:y=0.5:s=1:t=1
  11809. @end example
  11810. @end itemize
  11811. @anchor{overlay}
  11812. @section overlay
  11813. Overlay one video on top of another.
  11814. It takes two inputs and has one output. The first input is the "main"
  11815. video on which the second input is overlaid.
  11816. It accepts the following parameters:
  11817. A description of the accepted options follows.
  11818. @table @option
  11819. @item x
  11820. @item y
  11821. Set the expression for the x and y coordinates of the overlaid video
  11822. on the main video. Default value is "0" for both expressions. In case
  11823. the expression is invalid, it is set to a huge value (meaning that the
  11824. overlay will not be displayed within the output visible area).
  11825. @item eof_action
  11826. See @ref{framesync}.
  11827. @item eval
  11828. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11829. It accepts the following values:
  11830. @table @samp
  11831. @item init
  11832. only evaluate expressions once during the filter initialization or
  11833. when a command is processed
  11834. @item frame
  11835. evaluate expressions for each incoming frame
  11836. @end table
  11837. Default value is @samp{frame}.
  11838. @item shortest
  11839. See @ref{framesync}.
  11840. @item format
  11841. Set the format for the output video.
  11842. It accepts the following values:
  11843. @table @samp
  11844. @item yuv420
  11845. force YUV420 output
  11846. @item yuv420p10
  11847. force YUV420p10 output
  11848. @item yuv422
  11849. force YUV422 output
  11850. @item yuv422p10
  11851. force YUV422p10 output
  11852. @item yuv444
  11853. force YUV444 output
  11854. @item rgb
  11855. force packed RGB output
  11856. @item gbrp
  11857. force planar RGB output
  11858. @item auto
  11859. automatically pick format
  11860. @end table
  11861. Default value is @samp{yuv420}.
  11862. @item repeatlast
  11863. See @ref{framesync}.
  11864. @item alpha
  11865. Set format of alpha of the overlaid video, it can be @var{straight} or
  11866. @var{premultiplied}. Default is @var{straight}.
  11867. @end table
  11868. The @option{x}, and @option{y} expressions can contain the following
  11869. parameters.
  11870. @table @option
  11871. @item main_w, W
  11872. @item main_h, H
  11873. The main input width and height.
  11874. @item overlay_w, w
  11875. @item overlay_h, h
  11876. The overlay input width and height.
  11877. @item x
  11878. @item y
  11879. The computed values for @var{x} and @var{y}. They are evaluated for
  11880. each new frame.
  11881. @item hsub
  11882. @item vsub
  11883. horizontal and vertical chroma subsample values of the output
  11884. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11885. @var{vsub} is 1.
  11886. @item n
  11887. the number of input frame, starting from 0
  11888. @item pos
  11889. the position in the file of the input frame, NAN if unknown
  11890. @item t
  11891. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11892. @end table
  11893. This filter also supports the @ref{framesync} options.
  11894. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11895. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11896. when @option{eval} is set to @samp{init}.
  11897. Be aware that frames are taken from each input video in timestamp
  11898. order, hence, if their initial timestamps differ, it is a good idea
  11899. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11900. have them begin in the same zero timestamp, as the example for
  11901. the @var{movie} filter does.
  11902. You can chain together more overlays but you should test the
  11903. efficiency of such approach.
  11904. @subsection Commands
  11905. This filter supports the following commands:
  11906. @table @option
  11907. @item x
  11908. @item y
  11909. Modify the x and y of the overlay input.
  11910. The command accepts the same syntax of the corresponding option.
  11911. If the specified expression is not valid, it is kept at its current
  11912. value.
  11913. @end table
  11914. @subsection Examples
  11915. @itemize
  11916. @item
  11917. Draw the overlay at 10 pixels from the bottom right corner of the main
  11918. video:
  11919. @example
  11920. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11921. @end example
  11922. Using named options the example above becomes:
  11923. @example
  11924. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11925. @end example
  11926. @item
  11927. Insert a transparent PNG logo in the bottom left corner of the input,
  11928. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11929. @example
  11930. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11931. @end example
  11932. @item
  11933. Insert 2 different transparent PNG logos (second logo on bottom
  11934. right corner) using the @command{ffmpeg} tool:
  11935. @example
  11936. 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
  11937. @end example
  11938. @item
  11939. Add a transparent color layer on top of the main video; @code{WxH}
  11940. must specify the size of the main input to the overlay filter:
  11941. @example
  11942. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11943. @end example
  11944. @item
  11945. Play an original video and a filtered version (here with the deshake
  11946. filter) side by side using the @command{ffplay} tool:
  11947. @example
  11948. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11949. @end example
  11950. The above command is the same as:
  11951. @example
  11952. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11953. @end example
  11954. @item
  11955. Make a sliding overlay appearing from the left to the right top part of the
  11956. screen starting since time 2:
  11957. @example
  11958. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11959. @end example
  11960. @item
  11961. Compose output by putting two input videos side to side:
  11962. @example
  11963. ffmpeg -i left.avi -i right.avi -filter_complex "
  11964. nullsrc=size=200x100 [background];
  11965. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11966. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11967. [background][left] overlay=shortest=1 [background+left];
  11968. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11969. "
  11970. @end example
  11971. @item
  11972. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11973. @example
  11974. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11975. -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]'
  11976. masked.avi
  11977. @end example
  11978. @item
  11979. Chain several overlays in cascade:
  11980. @example
  11981. nullsrc=s=200x200 [bg];
  11982. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11983. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11984. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11985. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11986. [in3] null, [mid2] overlay=100:100 [out0]
  11987. @end example
  11988. @end itemize
  11989. @anchor{overlay_cuda}
  11990. @section overlay_cuda
  11991. Overlay one video on top of another.
  11992. This is the CUDA variant of the @ref{overlay} filter.
  11993. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11994. It takes two inputs and has one output. The first input is the "main"
  11995. video on which the second input is overlaid.
  11996. It accepts the following parameters:
  11997. @table @option
  11998. @item x
  11999. @item y
  12000. Set the x and y coordinates of the overlaid video on the main video.
  12001. Default value is "0" for both expressions.
  12002. @item eof_action
  12003. See @ref{framesync}.
  12004. @item shortest
  12005. See @ref{framesync}.
  12006. @item repeatlast
  12007. See @ref{framesync}.
  12008. @end table
  12009. This filter also supports the @ref{framesync} options.
  12010. @section owdenoise
  12011. Apply Overcomplete Wavelet denoiser.
  12012. The filter accepts the following options:
  12013. @table @option
  12014. @item depth
  12015. Set depth.
  12016. Larger depth values will denoise lower frequency components more, but
  12017. slow down filtering.
  12018. Must be an int in the range 8-16, default is @code{8}.
  12019. @item luma_strength, ls
  12020. Set luma strength.
  12021. Must be a double value in the range 0-1000, default is @code{1.0}.
  12022. @item chroma_strength, cs
  12023. Set chroma strength.
  12024. Must be a double value in the range 0-1000, default is @code{1.0}.
  12025. @end table
  12026. @anchor{pad}
  12027. @section pad
  12028. Add paddings to the input image, and place the original input at the
  12029. provided @var{x}, @var{y} coordinates.
  12030. It accepts the following parameters:
  12031. @table @option
  12032. @item width, w
  12033. @item height, h
  12034. Specify an expression for the size of the output image with the
  12035. paddings added. If the value for @var{width} or @var{height} is 0, the
  12036. corresponding input size is used for the output.
  12037. The @var{width} expression can reference the value set by the
  12038. @var{height} expression, and vice versa.
  12039. The default value of @var{width} and @var{height} is 0.
  12040. @item x
  12041. @item y
  12042. Specify the offsets to place the input image at within the padded area,
  12043. with respect to the top/left border of the output image.
  12044. The @var{x} expression can reference the value set by the @var{y}
  12045. expression, and vice versa.
  12046. The default value of @var{x} and @var{y} is 0.
  12047. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  12048. so the input image is centered on the padded area.
  12049. @item color
  12050. Specify the color of the padded area. For the syntax of this option,
  12051. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12052. manual,ffmpeg-utils}.
  12053. The default value of @var{color} is "black".
  12054. @item eval
  12055. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  12056. It accepts the following values:
  12057. @table @samp
  12058. @item init
  12059. Only evaluate expressions once during the filter initialization or when
  12060. a command is processed.
  12061. @item frame
  12062. Evaluate expressions for each incoming frame.
  12063. @end table
  12064. Default value is @samp{init}.
  12065. @item aspect
  12066. Pad to aspect instead to a resolution.
  12067. @end table
  12068. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  12069. options are expressions containing the following constants:
  12070. @table @option
  12071. @item in_w
  12072. @item in_h
  12073. The input video width and height.
  12074. @item iw
  12075. @item ih
  12076. These are the same as @var{in_w} and @var{in_h}.
  12077. @item out_w
  12078. @item out_h
  12079. The output width and height (the size of the padded area), as
  12080. specified by the @var{width} and @var{height} expressions.
  12081. @item ow
  12082. @item oh
  12083. These are the same as @var{out_w} and @var{out_h}.
  12084. @item x
  12085. @item y
  12086. The x and y offsets as specified by the @var{x} and @var{y}
  12087. expressions, or NAN if not yet specified.
  12088. @item a
  12089. same as @var{iw} / @var{ih}
  12090. @item sar
  12091. input sample aspect ratio
  12092. @item dar
  12093. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  12094. @item hsub
  12095. @item vsub
  12096. The horizontal and vertical chroma subsample values. For example for the
  12097. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12098. @end table
  12099. @subsection Examples
  12100. @itemize
  12101. @item
  12102. Add paddings with the color "violet" to the input video. The output video
  12103. size is 640x480, and the top-left corner of the input video is placed at
  12104. column 0, row 40
  12105. @example
  12106. pad=640:480:0:40:violet
  12107. @end example
  12108. The example above is equivalent to the following command:
  12109. @example
  12110. pad=width=640:height=480:x=0:y=40:color=violet
  12111. @end example
  12112. @item
  12113. Pad the input to get an output with dimensions increased by 3/2,
  12114. and put the input video at the center of the padded area:
  12115. @example
  12116. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  12117. @end example
  12118. @item
  12119. Pad the input to get a squared output with size equal to the maximum
  12120. value between the input width and height, and put the input video at
  12121. the center of the padded area:
  12122. @example
  12123. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  12124. @end example
  12125. @item
  12126. Pad the input to get a final w/h ratio of 16:9:
  12127. @example
  12128. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  12129. @end example
  12130. @item
  12131. In case of anamorphic video, in order to set the output display aspect
  12132. correctly, it is necessary to use @var{sar} in the expression,
  12133. according to the relation:
  12134. @example
  12135. (ih * X / ih) * sar = output_dar
  12136. X = output_dar / sar
  12137. @end example
  12138. Thus the previous example needs to be modified to:
  12139. @example
  12140. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  12141. @end example
  12142. @item
  12143. Double the output size and put the input video in the bottom-right
  12144. corner of the output padded area:
  12145. @example
  12146. pad="2*iw:2*ih:ow-iw:oh-ih"
  12147. @end example
  12148. @end itemize
  12149. @anchor{palettegen}
  12150. @section palettegen
  12151. Generate one palette for a whole video stream.
  12152. It accepts the following options:
  12153. @table @option
  12154. @item max_colors
  12155. Set the maximum number of colors to quantize in the palette.
  12156. Note: the palette will still contain 256 colors; the unused palette entries
  12157. will be black.
  12158. @item reserve_transparent
  12159. Create a palette of 255 colors maximum and reserve the last one for
  12160. transparency. Reserving the transparency color is useful for GIF optimization.
  12161. If not set, the maximum of colors in the palette will be 256. You probably want
  12162. to disable this option for a standalone image.
  12163. Set by default.
  12164. @item transparency_color
  12165. Set the color that will be used as background for transparency.
  12166. @item stats_mode
  12167. Set statistics mode.
  12168. It accepts the following values:
  12169. @table @samp
  12170. @item full
  12171. Compute full frame histograms.
  12172. @item diff
  12173. Compute histograms only for the part that differs from previous frame. This
  12174. might be relevant to give more importance to the moving part of your input if
  12175. the background is static.
  12176. @item single
  12177. Compute new histogram for each frame.
  12178. @end table
  12179. Default value is @var{full}.
  12180. @end table
  12181. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  12182. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  12183. color quantization of the palette. This information is also visible at
  12184. @var{info} logging level.
  12185. @subsection Examples
  12186. @itemize
  12187. @item
  12188. Generate a representative palette of a given video using @command{ffmpeg}:
  12189. @example
  12190. ffmpeg -i input.mkv -vf palettegen palette.png
  12191. @end example
  12192. @end itemize
  12193. @section paletteuse
  12194. Use a palette to downsample an input video stream.
  12195. The filter takes two inputs: one video stream and a palette. The palette must
  12196. be a 256 pixels image.
  12197. It accepts the following options:
  12198. @table @option
  12199. @item dither
  12200. Select dithering mode. Available algorithms are:
  12201. @table @samp
  12202. @item bayer
  12203. Ordered 8x8 bayer dithering (deterministic)
  12204. @item heckbert
  12205. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  12206. Note: this dithering is sometimes considered "wrong" and is included as a
  12207. reference.
  12208. @item floyd_steinberg
  12209. Floyd and Steingberg dithering (error diffusion)
  12210. @item sierra2
  12211. Frankie Sierra dithering v2 (error diffusion)
  12212. @item sierra2_4a
  12213. Frankie Sierra dithering v2 "Lite" (error diffusion)
  12214. @end table
  12215. Default is @var{sierra2_4a}.
  12216. @item bayer_scale
  12217. When @var{bayer} dithering is selected, this option defines the scale of the
  12218. pattern (how much the crosshatch pattern is visible). A low value means more
  12219. visible pattern for less banding, and higher value means less visible pattern
  12220. at the cost of more banding.
  12221. The option must be an integer value in the range [0,5]. Default is @var{2}.
  12222. @item diff_mode
  12223. If set, define the zone to process
  12224. @table @samp
  12225. @item rectangle
  12226. Only the changing rectangle will be reprocessed. This is similar to GIF
  12227. cropping/offsetting compression mechanism. This option can be useful for speed
  12228. if only a part of the image is changing, and has use cases such as limiting the
  12229. scope of the error diffusal @option{dither} to the rectangle that bounds the
  12230. moving scene (it leads to more deterministic output if the scene doesn't change
  12231. much, and as a result less moving noise and better GIF compression).
  12232. @end table
  12233. Default is @var{none}.
  12234. @item new
  12235. Take new palette for each output frame.
  12236. @item alpha_threshold
  12237. Sets the alpha threshold for transparency. Alpha values above this threshold
  12238. will be treated as completely opaque, and values below this threshold will be
  12239. treated as completely transparent.
  12240. The option must be an integer value in the range [0,255]. Default is @var{128}.
  12241. @end table
  12242. @subsection Examples
  12243. @itemize
  12244. @item
  12245. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  12246. using @command{ffmpeg}:
  12247. @example
  12248. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  12249. @end example
  12250. @end itemize
  12251. @section perspective
  12252. Correct perspective of video not recorded perpendicular to the screen.
  12253. A description of the accepted parameters follows.
  12254. @table @option
  12255. @item x0
  12256. @item y0
  12257. @item x1
  12258. @item y1
  12259. @item x2
  12260. @item y2
  12261. @item x3
  12262. @item y3
  12263. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  12264. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  12265. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  12266. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  12267. then the corners of the source will be sent to the specified coordinates.
  12268. The expressions can use the following variables:
  12269. @table @option
  12270. @item W
  12271. @item H
  12272. the width and height of video frame.
  12273. @item in
  12274. Input frame count.
  12275. @item on
  12276. Output frame count.
  12277. @end table
  12278. @item interpolation
  12279. Set interpolation for perspective correction.
  12280. It accepts the following values:
  12281. @table @samp
  12282. @item linear
  12283. @item cubic
  12284. @end table
  12285. Default value is @samp{linear}.
  12286. @item sense
  12287. Set interpretation of coordinate options.
  12288. It accepts the following values:
  12289. @table @samp
  12290. @item 0, source
  12291. Send point in the source specified by the given coordinates to
  12292. the corners of the destination.
  12293. @item 1, destination
  12294. Send the corners of the source to the point in the destination specified
  12295. by the given coordinates.
  12296. Default value is @samp{source}.
  12297. @end table
  12298. @item eval
  12299. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  12300. It accepts the following values:
  12301. @table @samp
  12302. @item init
  12303. only evaluate expressions once during the filter initialization or
  12304. when a command is processed
  12305. @item frame
  12306. evaluate expressions for each incoming frame
  12307. @end table
  12308. Default value is @samp{init}.
  12309. @end table
  12310. @section phase
  12311. Delay interlaced video by one field time so that the field order changes.
  12312. The intended use is to fix PAL movies that have been captured with the
  12313. opposite field order to the film-to-video transfer.
  12314. A description of the accepted parameters follows.
  12315. @table @option
  12316. @item mode
  12317. Set phase mode.
  12318. It accepts the following values:
  12319. @table @samp
  12320. @item t
  12321. Capture field order top-first, transfer bottom-first.
  12322. Filter will delay the bottom field.
  12323. @item b
  12324. Capture field order bottom-first, transfer top-first.
  12325. Filter will delay the top field.
  12326. @item p
  12327. Capture and transfer with the same field order. This mode only exists
  12328. for the documentation of the other options to refer to, but if you
  12329. actually select it, the filter will faithfully do nothing.
  12330. @item a
  12331. Capture field order determined automatically by field flags, transfer
  12332. opposite.
  12333. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  12334. basis using field flags. If no field information is available,
  12335. then this works just like @samp{u}.
  12336. @item u
  12337. Capture unknown or varying, transfer opposite.
  12338. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  12339. analyzing the images and selecting the alternative that produces best
  12340. match between the fields.
  12341. @item T
  12342. Capture top-first, transfer unknown or varying.
  12343. Filter selects among @samp{t} and @samp{p} using image analysis.
  12344. @item B
  12345. Capture bottom-first, transfer unknown or varying.
  12346. Filter selects among @samp{b} and @samp{p} using image analysis.
  12347. @item A
  12348. Capture determined by field flags, transfer unknown or varying.
  12349. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  12350. image analysis. If no field information is available, then this works just
  12351. like @samp{U}. This is the default mode.
  12352. @item U
  12353. Both capture and transfer unknown or varying.
  12354. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  12355. @end table
  12356. @end table
  12357. @subsection Commands
  12358. This filter supports the all above options as @ref{commands}.
  12359. @section photosensitivity
  12360. Reduce various flashes in video, so to help users with epilepsy.
  12361. It accepts the following options:
  12362. @table @option
  12363. @item frames, f
  12364. Set how many frames to use when filtering. Default is 30.
  12365. @item threshold, t
  12366. Set detection threshold factor. Default is 1.
  12367. Lower is stricter.
  12368. @item skip
  12369. Set how many pixels to skip when sampling frames. Default is 1.
  12370. Allowed range is from 1 to 1024.
  12371. @item bypass
  12372. Leave frames unchanged. Default is disabled.
  12373. @end table
  12374. @section pixdesctest
  12375. Pixel format descriptor test filter, mainly useful for internal
  12376. testing. The output video should be equal to the input video.
  12377. For example:
  12378. @example
  12379. format=monow, pixdesctest
  12380. @end example
  12381. can be used to test the monowhite pixel format descriptor definition.
  12382. @section pixscope
  12383. Display sample values of color channels. Mainly useful for checking color
  12384. and levels. Minimum supported resolution is 640x480.
  12385. The filters accept the following options:
  12386. @table @option
  12387. @item x
  12388. Set scope X position, relative offset on X axis.
  12389. @item y
  12390. Set scope Y position, relative offset on Y axis.
  12391. @item w
  12392. Set scope width.
  12393. @item h
  12394. Set scope height.
  12395. @item o
  12396. Set window opacity. This window also holds statistics about pixel area.
  12397. @item wx
  12398. Set window X position, relative offset on X axis.
  12399. @item wy
  12400. Set window Y position, relative offset on Y axis.
  12401. @end table
  12402. @subsection Commands
  12403. This filter supports same @ref{commands} as options.
  12404. @section pp
  12405. Enable the specified chain of postprocessing subfilters using libpostproc. This
  12406. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  12407. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  12408. Each subfilter and some options have a short and a long name that can be used
  12409. interchangeably, i.e. dr/dering are the same.
  12410. The filters accept the following options:
  12411. @table @option
  12412. @item subfilters
  12413. Set postprocessing subfilters string.
  12414. @end table
  12415. All subfilters share common options to determine their scope:
  12416. @table @option
  12417. @item a/autoq
  12418. Honor the quality commands for this subfilter.
  12419. @item c/chrom
  12420. Do chrominance filtering, too (default).
  12421. @item y/nochrom
  12422. Do luminance filtering only (no chrominance).
  12423. @item n/noluma
  12424. Do chrominance filtering only (no luminance).
  12425. @end table
  12426. These options can be appended after the subfilter name, separated by a '|'.
  12427. Available subfilters are:
  12428. @table @option
  12429. @item hb/hdeblock[|difference[|flatness]]
  12430. Horizontal deblocking filter
  12431. @table @option
  12432. @item difference
  12433. Difference factor where higher values mean more deblocking (default: @code{32}).
  12434. @item flatness
  12435. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12436. @end table
  12437. @item vb/vdeblock[|difference[|flatness]]
  12438. Vertical deblocking filter
  12439. @table @option
  12440. @item difference
  12441. Difference factor where higher values mean more deblocking (default: @code{32}).
  12442. @item flatness
  12443. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12444. @end table
  12445. @item ha/hadeblock[|difference[|flatness]]
  12446. Accurate horizontal deblocking filter
  12447. @table @option
  12448. @item difference
  12449. Difference factor where higher values mean more deblocking (default: @code{32}).
  12450. @item flatness
  12451. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12452. @end table
  12453. @item va/vadeblock[|difference[|flatness]]
  12454. Accurate vertical deblocking filter
  12455. @table @option
  12456. @item difference
  12457. Difference factor where higher values mean more deblocking (default: @code{32}).
  12458. @item flatness
  12459. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12460. @end table
  12461. @end table
  12462. The horizontal and vertical deblocking filters share the difference and
  12463. flatness values so you cannot set different horizontal and vertical
  12464. thresholds.
  12465. @table @option
  12466. @item h1/x1hdeblock
  12467. Experimental horizontal deblocking filter
  12468. @item v1/x1vdeblock
  12469. Experimental vertical deblocking filter
  12470. @item dr/dering
  12471. Deringing filter
  12472. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12473. @table @option
  12474. @item threshold1
  12475. larger -> stronger filtering
  12476. @item threshold2
  12477. larger -> stronger filtering
  12478. @item threshold3
  12479. larger -> stronger filtering
  12480. @end table
  12481. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12482. @table @option
  12483. @item f/fullyrange
  12484. Stretch luminance to @code{0-255}.
  12485. @end table
  12486. @item lb/linblenddeint
  12487. Linear blend deinterlacing filter that deinterlaces the given block by
  12488. filtering all lines with a @code{(1 2 1)} filter.
  12489. @item li/linipoldeint
  12490. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12491. linearly interpolating every second line.
  12492. @item ci/cubicipoldeint
  12493. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12494. cubically interpolating every second line.
  12495. @item md/mediandeint
  12496. Median deinterlacing filter that deinterlaces the given block by applying a
  12497. median filter to every second line.
  12498. @item fd/ffmpegdeint
  12499. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12500. second line with a @code{(-1 4 2 4 -1)} filter.
  12501. @item l5/lowpass5
  12502. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12503. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12504. @item fq/forceQuant[|quantizer]
  12505. Overrides the quantizer table from the input with the constant quantizer you
  12506. specify.
  12507. @table @option
  12508. @item quantizer
  12509. Quantizer to use
  12510. @end table
  12511. @item de/default
  12512. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12513. @item fa/fast
  12514. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12515. @item ac
  12516. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12517. @end table
  12518. @subsection Examples
  12519. @itemize
  12520. @item
  12521. Apply horizontal and vertical deblocking, deringing and automatic
  12522. brightness/contrast:
  12523. @example
  12524. pp=hb/vb/dr/al
  12525. @end example
  12526. @item
  12527. Apply default filters without brightness/contrast correction:
  12528. @example
  12529. pp=de/-al
  12530. @end example
  12531. @item
  12532. Apply default filters and temporal denoiser:
  12533. @example
  12534. pp=default/tmpnoise|1|2|3
  12535. @end example
  12536. @item
  12537. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12538. automatically depending on available CPU time:
  12539. @example
  12540. pp=hb|y/vb|a
  12541. @end example
  12542. @end itemize
  12543. @section pp7
  12544. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12545. similar to spp = 6 with 7 point DCT, where only the center sample is
  12546. used after IDCT.
  12547. The filter accepts the following options:
  12548. @table @option
  12549. @item qp
  12550. Force a constant quantization parameter. It accepts an integer in range
  12551. 0 to 63. If not set, the filter will use the QP from the video stream
  12552. (if available).
  12553. @item mode
  12554. Set thresholding mode. Available modes are:
  12555. @table @samp
  12556. @item hard
  12557. Set hard thresholding.
  12558. @item soft
  12559. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12560. @item medium
  12561. Set medium thresholding (good results, default).
  12562. @end table
  12563. @end table
  12564. @section premultiply
  12565. Apply alpha premultiply effect to input video stream using first plane
  12566. of second stream as alpha.
  12567. Both streams must have same dimensions and same pixel format.
  12568. The filter accepts the following option:
  12569. @table @option
  12570. @item planes
  12571. Set which planes will be processed, unprocessed planes will be copied.
  12572. By default value 0xf, all planes will be processed.
  12573. @item inplace
  12574. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12575. @end table
  12576. @section prewitt
  12577. Apply prewitt operator to input video stream.
  12578. The filter accepts the following option:
  12579. @table @option
  12580. @item planes
  12581. Set which planes will be processed, unprocessed planes will be copied.
  12582. By default value 0xf, all planes will be processed.
  12583. @item scale
  12584. Set value which will be multiplied with filtered result.
  12585. @item delta
  12586. Set value which will be added to filtered result.
  12587. @end table
  12588. @subsection Commands
  12589. This filter supports the all above options as @ref{commands}.
  12590. @section pseudocolor
  12591. Alter frame colors in video with pseudocolors.
  12592. This filter accepts the following options:
  12593. @table @option
  12594. @item c0
  12595. set pixel first component expression
  12596. @item c1
  12597. set pixel second component expression
  12598. @item c2
  12599. set pixel third component expression
  12600. @item c3
  12601. set pixel fourth component expression, corresponds to the alpha component
  12602. @item index, i
  12603. set component to use as base for altering colors
  12604. @item preset, p
  12605. Pick one of built-in LUTs. By default is set to none.
  12606. Available LUTs:
  12607. @table @samp
  12608. @item magma
  12609. @item inferno
  12610. @item plasma
  12611. @item viridis
  12612. @item turbo
  12613. @item cividis
  12614. @item range1
  12615. @item range2
  12616. @item shadows
  12617. @item highlights
  12618. @end table
  12619. @item opacity
  12620. Set opacity of output colors. Allowed range is from 0 to 1.
  12621. Default value is set to 1.
  12622. @end table
  12623. Each of the expression options specifies the expression to use for computing
  12624. the lookup table for the corresponding pixel component values.
  12625. The expressions can contain the following constants and functions:
  12626. @table @option
  12627. @item w
  12628. @item h
  12629. The input width and height.
  12630. @item val
  12631. The input value for the pixel component.
  12632. @item ymin, umin, vmin, amin
  12633. The minimum allowed component value.
  12634. @item ymax, umax, vmax, amax
  12635. The maximum allowed component value.
  12636. @end table
  12637. All expressions default to "val".
  12638. @subsection Commands
  12639. This filter supports the all above options as @ref{commands}.
  12640. @subsection Examples
  12641. @itemize
  12642. @item
  12643. Change too high luma values to gradient:
  12644. @example
  12645. 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'"
  12646. @end example
  12647. @end itemize
  12648. @section psnr
  12649. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12650. Ratio) between two input videos.
  12651. This filter takes in input two input videos, the first input is
  12652. considered the "main" source and is passed unchanged to the
  12653. output. The second input is used as a "reference" video for computing
  12654. the PSNR.
  12655. Both video inputs must have the same resolution and pixel format for
  12656. this filter to work correctly. Also it assumes that both inputs
  12657. have the same number of frames, which are compared one by one.
  12658. The obtained average PSNR is printed through the logging system.
  12659. The filter stores the accumulated MSE (mean squared error) of each
  12660. frame, and at the end of the processing it is averaged across all frames
  12661. equally, and the following formula is applied to obtain the PSNR:
  12662. @example
  12663. PSNR = 10*log10(MAX^2/MSE)
  12664. @end example
  12665. Where MAX is the average of the maximum values of each component of the
  12666. image.
  12667. The description of the accepted parameters follows.
  12668. @table @option
  12669. @item stats_file, f
  12670. If specified the filter will use the named file to save the PSNR of
  12671. each individual frame. When filename equals "-" the data is sent to
  12672. standard output.
  12673. @item stats_version
  12674. Specifies which version of the stats file format to use. Details of
  12675. each format are written below.
  12676. Default value is 1.
  12677. @item stats_add_max
  12678. Determines whether the max value is output to the stats log.
  12679. Default value is 0.
  12680. Requires stats_version >= 2. If this is set and stats_version < 2,
  12681. the filter will return an error.
  12682. @end table
  12683. This filter also supports the @ref{framesync} options.
  12684. The file printed if @var{stats_file} is selected, contains a sequence of
  12685. key/value pairs of the form @var{key}:@var{value} for each compared
  12686. couple of frames.
  12687. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12688. the list of per-frame-pair stats, with key value pairs following the frame
  12689. format with the following parameters:
  12690. @table @option
  12691. @item psnr_log_version
  12692. The version of the log file format. Will match @var{stats_version}.
  12693. @item fields
  12694. A comma separated list of the per-frame-pair parameters included in
  12695. the log.
  12696. @end table
  12697. A description of each shown per-frame-pair parameter follows:
  12698. @table @option
  12699. @item n
  12700. sequential number of the input frame, starting from 1
  12701. @item mse_avg
  12702. Mean Square Error pixel-by-pixel average difference of the compared
  12703. frames, averaged over all the image components.
  12704. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12705. Mean Square Error pixel-by-pixel average difference of the compared
  12706. frames for the component specified by the suffix.
  12707. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12708. Peak Signal to Noise ratio of the compared frames for the component
  12709. specified by the suffix.
  12710. @item max_avg, max_y, max_u, max_v
  12711. Maximum allowed value for each channel, and average over all
  12712. channels.
  12713. @end table
  12714. @subsection Examples
  12715. @itemize
  12716. @item
  12717. For example:
  12718. @example
  12719. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12720. [main][ref] psnr="stats_file=stats.log" [out]
  12721. @end example
  12722. On this example the input file being processed is compared with the
  12723. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12724. is stored in @file{stats.log}.
  12725. @item
  12726. Another example with different containers:
  12727. @example
  12728. 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 -
  12729. @end example
  12730. @end itemize
  12731. @anchor{pullup}
  12732. @section pullup
  12733. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12734. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12735. content.
  12736. The pullup filter is designed to take advantage of future context in making
  12737. its decisions. This filter is stateless in the sense that it does not lock
  12738. onto a pattern to follow, but it instead looks forward to the following
  12739. fields in order to identify matches and rebuild progressive frames.
  12740. To produce content with an even framerate, insert the fps filter after
  12741. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12742. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12743. The filter accepts the following options:
  12744. @table @option
  12745. @item jl
  12746. @item jr
  12747. @item jt
  12748. @item jb
  12749. These options set the amount of "junk" to ignore at the left, right, top, and
  12750. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12751. while top and bottom are in units of 2 lines.
  12752. The default is 8 pixels on each side.
  12753. @item sb
  12754. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12755. filter generating an occasional mismatched frame, but it may also cause an
  12756. excessive number of frames to be dropped during high motion sequences.
  12757. Conversely, setting it to -1 will make filter match fields more easily.
  12758. This may help processing of video where there is slight blurring between
  12759. the fields, but may also cause there to be interlaced frames in the output.
  12760. Default value is @code{0}.
  12761. @item mp
  12762. Set the metric plane to use. It accepts the following values:
  12763. @table @samp
  12764. @item l
  12765. Use luma plane.
  12766. @item u
  12767. Use chroma blue plane.
  12768. @item v
  12769. Use chroma red plane.
  12770. @end table
  12771. This option may be set to use chroma plane instead of the default luma plane
  12772. for doing filter's computations. This may improve accuracy on very clean
  12773. source material, but more likely will decrease accuracy, especially if there
  12774. is chroma noise (rainbow effect) or any grayscale video.
  12775. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12776. load and make pullup usable in realtime on slow machines.
  12777. @end table
  12778. For best results (without duplicated frames in the output file) it is
  12779. necessary to change the output frame rate. For example, to inverse
  12780. telecine NTSC input:
  12781. @example
  12782. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12783. @end example
  12784. @section qp
  12785. Change video quantization parameters (QP).
  12786. The filter accepts the following option:
  12787. @table @option
  12788. @item qp
  12789. Set expression for quantization parameter.
  12790. @end table
  12791. The expression is evaluated through the eval API and can contain, among others,
  12792. the following constants:
  12793. @table @var
  12794. @item known
  12795. 1 if index is not 129, 0 otherwise.
  12796. @item qp
  12797. Sequential index starting from -129 to 128.
  12798. @end table
  12799. @subsection Examples
  12800. @itemize
  12801. @item
  12802. Some equation like:
  12803. @example
  12804. qp=2+2*sin(PI*qp)
  12805. @end example
  12806. @end itemize
  12807. @section random
  12808. Flush video frames from internal cache of frames into a random order.
  12809. No frame is discarded.
  12810. Inspired by @ref{frei0r} nervous filter.
  12811. @table @option
  12812. @item frames
  12813. Set size in number of frames of internal cache, in range from @code{2} to
  12814. @code{512}. Default is @code{30}.
  12815. @item seed
  12816. Set seed for random number generator, must be an integer included between
  12817. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12818. less than @code{0}, the filter will try to use a good random seed on a
  12819. best effort basis.
  12820. @end table
  12821. @section readeia608
  12822. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12823. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12824. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12825. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12826. @table @option
  12827. @item lavfi.readeia608.X.cc
  12828. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12829. @item lavfi.readeia608.X.line
  12830. The number of the line on which the EIA-608 data was identified and read.
  12831. @end table
  12832. This filter accepts the following options:
  12833. @table @option
  12834. @item scan_min
  12835. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12836. @item scan_max
  12837. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12838. @item spw
  12839. Set the ratio of width reserved for sync code detection.
  12840. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12841. @item chp
  12842. Enable checking the parity bit. In the event of a parity error, the filter will output
  12843. @code{0x00} for that character. Default is false.
  12844. @item lp
  12845. Lowpass lines prior to further processing. Default is enabled.
  12846. @end table
  12847. @subsection Commands
  12848. This filter supports the all above options as @ref{commands}.
  12849. @subsection Examples
  12850. @itemize
  12851. @item
  12852. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12853. @example
  12854. 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
  12855. @end example
  12856. @end itemize
  12857. @section readvitc
  12858. Read vertical interval timecode (VITC) information from the top lines of a
  12859. video frame.
  12860. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12861. timecode value, if a valid timecode has been detected. Further metadata key
  12862. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12863. timecode data has been found or not.
  12864. This filter accepts the following options:
  12865. @table @option
  12866. @item scan_max
  12867. Set the maximum number of lines to scan for VITC data. If the value is set to
  12868. @code{-1} the full video frame is scanned. Default is @code{45}.
  12869. @item thr_b
  12870. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12871. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12872. @item thr_w
  12873. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12874. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12875. @end table
  12876. @subsection Examples
  12877. @itemize
  12878. @item
  12879. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12880. draw @code{--:--:--:--} as a placeholder:
  12881. @example
  12882. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12883. @end example
  12884. @end itemize
  12885. @section remap
  12886. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12887. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12888. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12889. value for pixel will be used for destination pixel.
  12890. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12891. will have Xmap/Ymap video stream dimensions.
  12892. Xmap and Ymap input video streams are 16bit depth, single channel.
  12893. @table @option
  12894. @item format
  12895. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12896. Default is @code{color}.
  12897. @item fill
  12898. Specify the color of the unmapped pixels. For the syntax of this option,
  12899. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12900. manual,ffmpeg-utils}. Default color is @code{black}.
  12901. @end table
  12902. @section removegrain
  12903. The removegrain filter is a spatial denoiser for progressive video.
  12904. @table @option
  12905. @item m0
  12906. Set mode for the first plane.
  12907. @item m1
  12908. Set mode for the second plane.
  12909. @item m2
  12910. Set mode for the third plane.
  12911. @item m3
  12912. Set mode for the fourth plane.
  12913. @end table
  12914. Range of mode is from 0 to 24. Description of each mode follows:
  12915. @table @var
  12916. @item 0
  12917. Leave input plane unchanged. Default.
  12918. @item 1
  12919. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12920. @item 2
  12921. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12922. @item 3
  12923. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12924. @item 4
  12925. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12926. This is equivalent to a median filter.
  12927. @item 5
  12928. Line-sensitive clipping giving the minimal change.
  12929. @item 6
  12930. Line-sensitive clipping, intermediate.
  12931. @item 7
  12932. Line-sensitive clipping, intermediate.
  12933. @item 8
  12934. Line-sensitive clipping, intermediate.
  12935. @item 9
  12936. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12937. @item 10
  12938. Replaces the target pixel with the closest neighbour.
  12939. @item 11
  12940. [1 2 1] horizontal and vertical kernel blur.
  12941. @item 12
  12942. Same as mode 11.
  12943. @item 13
  12944. Bob mode, interpolates top field from the line where the neighbours
  12945. pixels are the closest.
  12946. @item 14
  12947. Bob mode, interpolates bottom field from the line where the neighbours
  12948. pixels are the closest.
  12949. @item 15
  12950. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12951. interpolation formula.
  12952. @item 16
  12953. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12954. interpolation formula.
  12955. @item 17
  12956. Clips the pixel with the minimum and maximum of respectively the maximum and
  12957. minimum of each pair of opposite neighbour pixels.
  12958. @item 18
  12959. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12960. the current pixel is minimal.
  12961. @item 19
  12962. Replaces the pixel with the average of its 8 neighbours.
  12963. @item 20
  12964. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12965. @item 21
  12966. Clips pixels using the averages of opposite neighbour.
  12967. @item 22
  12968. Same as mode 21 but simpler and faster.
  12969. @item 23
  12970. Small edge and halo removal, but reputed useless.
  12971. @item 24
  12972. Similar as 23.
  12973. @end table
  12974. @section removelogo
  12975. Suppress a TV station logo, using an image file to determine which
  12976. pixels comprise the logo. It works by filling in the pixels that
  12977. comprise the logo with neighboring pixels.
  12978. The filter accepts the following options:
  12979. @table @option
  12980. @item filename, f
  12981. Set the filter bitmap file, which can be any image format supported by
  12982. libavformat. The width and height of the image file must match those of the
  12983. video stream being processed.
  12984. @end table
  12985. Pixels in the provided bitmap image with a value of zero are not
  12986. considered part of the logo, non-zero pixels are considered part of
  12987. the logo. If you use white (255) for the logo and black (0) for the
  12988. rest, you will be safe. For making the filter bitmap, it is
  12989. recommended to take a screen capture of a black frame with the logo
  12990. visible, and then using a threshold filter followed by the erode
  12991. filter once or twice.
  12992. If needed, little splotches can be fixed manually. Remember that if
  12993. logo pixels are not covered, the filter quality will be much
  12994. reduced. Marking too many pixels as part of the logo does not hurt as
  12995. much, but it will increase the amount of blurring needed to cover over
  12996. the image and will destroy more information than necessary, and extra
  12997. pixels will slow things down on a large logo.
  12998. @section repeatfields
  12999. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  13000. fields based on its value.
  13001. @section reverse
  13002. Reverse a video clip.
  13003. Warning: This filter requires memory to buffer the entire clip, so trimming
  13004. is suggested.
  13005. @subsection Examples
  13006. @itemize
  13007. @item
  13008. Take the first 5 seconds of a clip, and reverse it.
  13009. @example
  13010. trim=end=5,reverse
  13011. @end example
  13012. @end itemize
  13013. @section rgbashift
  13014. Shift R/G/B/A pixels horizontally and/or vertically.
  13015. The filter accepts the following options:
  13016. @table @option
  13017. @item rh
  13018. Set amount to shift red horizontally.
  13019. @item rv
  13020. Set amount to shift red vertically.
  13021. @item gh
  13022. Set amount to shift green horizontally.
  13023. @item gv
  13024. Set amount to shift green vertically.
  13025. @item bh
  13026. Set amount to shift blue horizontally.
  13027. @item bv
  13028. Set amount to shift blue vertically.
  13029. @item ah
  13030. Set amount to shift alpha horizontally.
  13031. @item av
  13032. Set amount to shift alpha vertically.
  13033. @item edge
  13034. Set edge mode, can be @var{smear}, default, or @var{warp}.
  13035. @end table
  13036. @subsection Commands
  13037. This filter supports the all above options as @ref{commands}.
  13038. @section roberts
  13039. Apply roberts cross operator to input video stream.
  13040. The filter accepts the following option:
  13041. @table @option
  13042. @item planes
  13043. Set which planes will be processed, unprocessed planes will be copied.
  13044. By default value 0xf, all planes will be processed.
  13045. @item scale
  13046. Set value which will be multiplied with filtered result.
  13047. @item delta
  13048. Set value which will be added to filtered result.
  13049. @end table
  13050. @subsection Commands
  13051. This filter supports the all above options as @ref{commands}.
  13052. @section rotate
  13053. Rotate video by an arbitrary angle expressed in radians.
  13054. The filter accepts the following options:
  13055. A description of the optional parameters follows.
  13056. @table @option
  13057. @item angle, a
  13058. Set an expression for the angle by which to rotate the input video
  13059. clockwise, expressed as a number of radians. A negative value will
  13060. result in a counter-clockwise rotation. By default it is set to "0".
  13061. This expression is evaluated for each frame.
  13062. @item out_w, ow
  13063. Set the output width expression, default value is "iw".
  13064. This expression is evaluated just once during configuration.
  13065. @item out_h, oh
  13066. Set the output height expression, default value is "ih".
  13067. This expression is evaluated just once during configuration.
  13068. @item bilinear
  13069. Enable bilinear interpolation if set to 1, a value of 0 disables
  13070. it. Default value is 1.
  13071. @item fillcolor, c
  13072. Set the color used to fill the output area not covered by the rotated
  13073. image. For the general syntax of this option, check the
  13074. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13075. If the special value "none" is selected then no
  13076. background is printed (useful for example if the background is never shown).
  13077. Default value is "black".
  13078. @end table
  13079. The expressions for the angle and the output size can contain the
  13080. following constants and functions:
  13081. @table @option
  13082. @item n
  13083. sequential number of the input frame, starting from 0. It is always NAN
  13084. before the first frame is filtered.
  13085. @item t
  13086. time in seconds of the input frame, it is set to 0 when the filter is
  13087. configured. It is always NAN before the first frame is filtered.
  13088. @item hsub
  13089. @item vsub
  13090. horizontal and vertical chroma subsample values. For example for the
  13091. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13092. @item in_w, iw
  13093. @item in_h, ih
  13094. the input video width and height
  13095. @item out_w, ow
  13096. @item out_h, oh
  13097. the output width and height, that is the size of the padded area as
  13098. specified by the @var{width} and @var{height} expressions
  13099. @item rotw(a)
  13100. @item roth(a)
  13101. the minimal width/height required for completely containing the input
  13102. video rotated by @var{a} radians.
  13103. These are only available when computing the @option{out_w} and
  13104. @option{out_h} expressions.
  13105. @end table
  13106. @subsection Examples
  13107. @itemize
  13108. @item
  13109. Rotate the input by PI/6 radians clockwise:
  13110. @example
  13111. rotate=PI/6
  13112. @end example
  13113. @item
  13114. Rotate the input by PI/6 radians counter-clockwise:
  13115. @example
  13116. rotate=-PI/6
  13117. @end example
  13118. @item
  13119. Rotate the input by 45 degrees clockwise:
  13120. @example
  13121. rotate=45*PI/180
  13122. @end example
  13123. @item
  13124. Apply a constant rotation with period T, starting from an angle of PI/3:
  13125. @example
  13126. rotate=PI/3+2*PI*t/T
  13127. @end example
  13128. @item
  13129. Make the input video rotation oscillating with a period of T
  13130. seconds and an amplitude of A radians:
  13131. @example
  13132. rotate=A*sin(2*PI/T*t)
  13133. @end example
  13134. @item
  13135. Rotate the video, output size is chosen so that the whole rotating
  13136. input video is always completely contained in the output:
  13137. @example
  13138. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  13139. @end example
  13140. @item
  13141. Rotate the video, reduce the output size so that no background is ever
  13142. shown:
  13143. @example
  13144. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  13145. @end example
  13146. @end itemize
  13147. @subsection Commands
  13148. The filter supports the following commands:
  13149. @table @option
  13150. @item a, angle
  13151. Set the angle expression.
  13152. The command accepts the same syntax of the corresponding option.
  13153. If the specified expression is not valid, it is kept at its current
  13154. value.
  13155. @end table
  13156. @section sab
  13157. Apply Shape Adaptive Blur.
  13158. The filter accepts the following options:
  13159. @table @option
  13160. @item luma_radius, lr
  13161. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  13162. value is 1.0. A greater value will result in a more blurred image, and
  13163. in slower processing.
  13164. @item luma_pre_filter_radius, lpfr
  13165. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  13166. value is 1.0.
  13167. @item luma_strength, ls
  13168. Set luma maximum difference between pixels to still be considered, must
  13169. be a value in the 0.1-100.0 range, default value is 1.0.
  13170. @item chroma_radius, cr
  13171. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  13172. greater value will result in a more blurred image, and in slower
  13173. processing.
  13174. @item chroma_pre_filter_radius, cpfr
  13175. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  13176. @item chroma_strength, cs
  13177. Set chroma maximum difference between pixels to still be considered,
  13178. must be a value in the -0.9-100.0 range.
  13179. @end table
  13180. Each chroma option value, if not explicitly specified, is set to the
  13181. corresponding luma option value.
  13182. @anchor{scale}
  13183. @section scale
  13184. Scale (resize) the input video, using the libswscale library.
  13185. The scale filter forces the output display aspect ratio to be the same
  13186. of the input, by changing the output sample aspect ratio.
  13187. If the input image format is different from the format requested by
  13188. the next filter, the scale filter will convert the input to the
  13189. requested format.
  13190. @subsection Options
  13191. The filter accepts the following options, or any of the options
  13192. supported by the libswscale scaler.
  13193. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  13194. the complete list of scaler options.
  13195. @table @option
  13196. @item width, w
  13197. @item height, h
  13198. Set the output video dimension expression. Default value is the input
  13199. dimension.
  13200. If the @var{width} or @var{w} value is 0, the input width is used for
  13201. the output. If the @var{height} or @var{h} value is 0, the input height
  13202. is used for the output.
  13203. If one and only one of the values is -n with n >= 1, the scale filter
  13204. will use a value that maintains the aspect ratio of the input image,
  13205. calculated from the other specified dimension. After that it will,
  13206. however, make sure that the calculated dimension is divisible by n and
  13207. adjust the value if necessary.
  13208. If both values are -n with n >= 1, the behavior will be identical to
  13209. both values being set to 0 as previously detailed.
  13210. See below for the list of accepted constants for use in the dimension
  13211. expression.
  13212. @item eval
  13213. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  13214. @table @samp
  13215. @item init
  13216. Only evaluate expressions once during the filter initialization or when a command is processed.
  13217. @item frame
  13218. Evaluate expressions for each incoming frame.
  13219. @end table
  13220. Default value is @samp{init}.
  13221. @item interl
  13222. Set the interlacing mode. It accepts the following values:
  13223. @table @samp
  13224. @item 1
  13225. Force interlaced aware scaling.
  13226. @item 0
  13227. Do not apply interlaced scaling.
  13228. @item -1
  13229. Select interlaced aware scaling depending on whether the source frames
  13230. are flagged as interlaced or not.
  13231. @end table
  13232. Default value is @samp{0}.
  13233. @item flags
  13234. Set libswscale scaling flags. See
  13235. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13236. complete list of values. If not explicitly specified the filter applies
  13237. the default flags.
  13238. @item param0, param1
  13239. Set libswscale input parameters for scaling algorithms that need them. See
  13240. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13241. complete documentation. If not explicitly specified the filter applies
  13242. empty parameters.
  13243. @item size, s
  13244. Set the video size. For the syntax of this option, check the
  13245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13246. @item in_color_matrix
  13247. @item out_color_matrix
  13248. Set in/output YCbCr color space type.
  13249. This allows the autodetected value to be overridden as well as allows forcing
  13250. a specific value used for the output and encoder.
  13251. If not specified, the color space type depends on the pixel format.
  13252. Possible values:
  13253. @table @samp
  13254. @item auto
  13255. Choose automatically.
  13256. @item bt709
  13257. Format conforming to International Telecommunication Union (ITU)
  13258. Recommendation BT.709.
  13259. @item fcc
  13260. Set color space conforming to the United States Federal Communications
  13261. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  13262. @item bt601
  13263. @item bt470
  13264. @item smpte170m
  13265. Set color space conforming to:
  13266. @itemize
  13267. @item
  13268. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  13269. @item
  13270. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  13271. @item
  13272. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  13273. @end itemize
  13274. @item smpte240m
  13275. Set color space conforming to SMPTE ST 240:1999.
  13276. @item bt2020
  13277. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  13278. @end table
  13279. @item in_range
  13280. @item out_range
  13281. Set in/output YCbCr sample range.
  13282. This allows the autodetected value to be overridden as well as allows forcing
  13283. a specific value used for the output and encoder. If not specified, the
  13284. range depends on the pixel format. Possible values:
  13285. @table @samp
  13286. @item auto/unknown
  13287. Choose automatically.
  13288. @item jpeg/full/pc
  13289. Set full range (0-255 in case of 8-bit luma).
  13290. @item mpeg/limited/tv
  13291. Set "MPEG" range (16-235 in case of 8-bit luma).
  13292. @end table
  13293. @item force_original_aspect_ratio
  13294. Enable decreasing or increasing output video width or height if necessary to
  13295. keep the original aspect ratio. Possible values:
  13296. @table @samp
  13297. @item disable
  13298. Scale the video as specified and disable this feature.
  13299. @item decrease
  13300. The output video dimensions will automatically be decreased if needed.
  13301. @item increase
  13302. The output video dimensions will automatically be increased if needed.
  13303. @end table
  13304. One useful instance of this option is that when you know a specific device's
  13305. maximum allowed resolution, you can use this to limit the output video to
  13306. that, while retaining the aspect ratio. For example, device A allows
  13307. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13308. decrease) and specifying 1280x720 to the command line makes the output
  13309. 1280x533.
  13310. Please note that this is a different thing than specifying -1 for @option{w}
  13311. or @option{h}, you still need to specify the output resolution for this option
  13312. to work.
  13313. @item force_divisible_by
  13314. Ensures that both the output dimensions, width and height, are divisible by the
  13315. given integer when used together with @option{force_original_aspect_ratio}. This
  13316. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13317. This option respects the value set for @option{force_original_aspect_ratio},
  13318. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13319. may be slightly modified.
  13320. This option can be handy if you need to have a video fit within or exceed
  13321. a defined resolution using @option{force_original_aspect_ratio} but also have
  13322. encoder restrictions on width or height divisibility.
  13323. @end table
  13324. The values of the @option{w} and @option{h} options are expressions
  13325. containing the following constants:
  13326. @table @var
  13327. @item in_w
  13328. @item in_h
  13329. The input width and height
  13330. @item iw
  13331. @item ih
  13332. These are the same as @var{in_w} and @var{in_h}.
  13333. @item out_w
  13334. @item out_h
  13335. The output (scaled) width and height
  13336. @item ow
  13337. @item oh
  13338. These are the same as @var{out_w} and @var{out_h}
  13339. @item a
  13340. The same as @var{iw} / @var{ih}
  13341. @item sar
  13342. input sample aspect ratio
  13343. @item dar
  13344. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13345. @item hsub
  13346. @item vsub
  13347. horizontal and vertical input chroma subsample values. For example for the
  13348. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13349. @item ohsub
  13350. @item ovsub
  13351. horizontal and vertical output chroma subsample values. For example for the
  13352. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13353. @item n
  13354. The (sequential) number of the input frame, starting from 0.
  13355. Only available with @code{eval=frame}.
  13356. @item t
  13357. The presentation timestamp of the input frame, expressed as a number of
  13358. seconds. Only available with @code{eval=frame}.
  13359. @item pos
  13360. The position (byte offset) of the frame in the input stream, or NaN if
  13361. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13362. Only available with @code{eval=frame}.
  13363. @end table
  13364. @subsection Examples
  13365. @itemize
  13366. @item
  13367. Scale the input video to a size of 200x100
  13368. @example
  13369. scale=w=200:h=100
  13370. @end example
  13371. This is equivalent to:
  13372. @example
  13373. scale=200:100
  13374. @end example
  13375. or:
  13376. @example
  13377. scale=200x100
  13378. @end example
  13379. @item
  13380. Specify a size abbreviation for the output size:
  13381. @example
  13382. scale=qcif
  13383. @end example
  13384. which can also be written as:
  13385. @example
  13386. scale=size=qcif
  13387. @end example
  13388. @item
  13389. Scale the input to 2x:
  13390. @example
  13391. scale=w=2*iw:h=2*ih
  13392. @end example
  13393. @item
  13394. The above is the same as:
  13395. @example
  13396. scale=2*in_w:2*in_h
  13397. @end example
  13398. @item
  13399. Scale the input to 2x with forced interlaced scaling:
  13400. @example
  13401. scale=2*iw:2*ih:interl=1
  13402. @end example
  13403. @item
  13404. Scale the input to half size:
  13405. @example
  13406. scale=w=iw/2:h=ih/2
  13407. @end example
  13408. @item
  13409. Increase the width, and set the height to the same size:
  13410. @example
  13411. scale=3/2*iw:ow
  13412. @end example
  13413. @item
  13414. Seek Greek harmony:
  13415. @example
  13416. scale=iw:1/PHI*iw
  13417. scale=ih*PHI:ih
  13418. @end example
  13419. @item
  13420. Increase the height, and set the width to 3/2 of the height:
  13421. @example
  13422. scale=w=3/2*oh:h=3/5*ih
  13423. @end example
  13424. @item
  13425. Increase the size, making the size a multiple of the chroma
  13426. subsample values:
  13427. @example
  13428. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  13429. @end example
  13430. @item
  13431. Increase the width to a maximum of 500 pixels,
  13432. keeping the same aspect ratio as the input:
  13433. @example
  13434. scale=w='min(500\, iw*3/2):h=-1'
  13435. @end example
  13436. @item
  13437. Make pixels square by combining scale and setsar:
  13438. @example
  13439. scale='trunc(ih*dar):ih',setsar=1/1
  13440. @end example
  13441. @item
  13442. Make pixels square by combining scale and setsar,
  13443. making sure the resulting resolution is even (required by some codecs):
  13444. @example
  13445. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  13446. @end example
  13447. @end itemize
  13448. @subsection Commands
  13449. This filter supports the following commands:
  13450. @table @option
  13451. @item width, w
  13452. @item height, h
  13453. Set the output video dimension expression.
  13454. The command accepts the same syntax of the corresponding option.
  13455. If the specified expression is not valid, it is kept at its current
  13456. value.
  13457. @end table
  13458. @section scale_npp
  13459. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  13460. format conversion on CUDA video frames. Setting the output width and height
  13461. works in the same way as for the @var{scale} filter.
  13462. The following additional options are accepted:
  13463. @table @option
  13464. @item format
  13465. The pixel format of the output CUDA frames. If set to the string "same" (the
  13466. default), the input format will be kept. Note that automatic format negotiation
  13467. and conversion is not yet supported for hardware frames
  13468. @item interp_algo
  13469. The interpolation algorithm used for resizing. One of the following:
  13470. @table @option
  13471. @item nn
  13472. Nearest neighbour.
  13473. @item linear
  13474. @item cubic
  13475. @item cubic2p_bspline
  13476. 2-parameter cubic (B=1, C=0)
  13477. @item cubic2p_catmullrom
  13478. 2-parameter cubic (B=0, C=1/2)
  13479. @item cubic2p_b05c03
  13480. 2-parameter cubic (B=1/2, C=3/10)
  13481. @item super
  13482. Supersampling
  13483. @item lanczos
  13484. @end table
  13485. @item force_original_aspect_ratio
  13486. Enable decreasing or increasing output video width or height if necessary to
  13487. keep the original aspect ratio. Possible values:
  13488. @table @samp
  13489. @item disable
  13490. Scale the video as specified and disable this feature.
  13491. @item decrease
  13492. The output video dimensions will automatically be decreased if needed.
  13493. @item increase
  13494. The output video dimensions will automatically be increased if needed.
  13495. @end table
  13496. One useful instance of this option is that when you know a specific device's
  13497. maximum allowed resolution, you can use this to limit the output video to
  13498. that, while retaining the aspect ratio. For example, device A allows
  13499. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13500. decrease) and specifying 1280x720 to the command line makes the output
  13501. 1280x533.
  13502. Please note that this is a different thing than specifying -1 for @option{w}
  13503. or @option{h}, you still need to specify the output resolution for this option
  13504. to work.
  13505. @item force_divisible_by
  13506. Ensures that both the output dimensions, width and height, are divisible by the
  13507. given integer when used together with @option{force_original_aspect_ratio}. This
  13508. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13509. This option respects the value set for @option{force_original_aspect_ratio},
  13510. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13511. may be slightly modified.
  13512. This option can be handy if you need to have a video fit within or exceed
  13513. a defined resolution using @option{force_original_aspect_ratio} but also have
  13514. encoder restrictions on width or height divisibility.
  13515. @end table
  13516. @section scale2ref
  13517. Scale (resize) the input video, based on a reference video.
  13518. See the scale filter for available options, scale2ref supports the same but
  13519. uses the reference video instead of the main input as basis. scale2ref also
  13520. supports the following additional constants for the @option{w} and
  13521. @option{h} options:
  13522. @table @var
  13523. @item main_w
  13524. @item main_h
  13525. The main input video's width and height
  13526. @item main_a
  13527. The same as @var{main_w} / @var{main_h}
  13528. @item main_sar
  13529. The main input video's sample aspect ratio
  13530. @item main_dar, mdar
  13531. The main input video's display aspect ratio. Calculated from
  13532. @code{(main_w / main_h) * main_sar}.
  13533. @item main_hsub
  13534. @item main_vsub
  13535. The main input video's horizontal and vertical chroma subsample values.
  13536. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13537. is 1.
  13538. @item main_n
  13539. The (sequential) number of the main input frame, starting from 0.
  13540. Only available with @code{eval=frame}.
  13541. @item main_t
  13542. The presentation timestamp of the main input frame, expressed as a number of
  13543. seconds. Only available with @code{eval=frame}.
  13544. @item main_pos
  13545. The position (byte offset) of the frame in the main input stream, or NaN if
  13546. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13547. Only available with @code{eval=frame}.
  13548. @end table
  13549. @subsection Examples
  13550. @itemize
  13551. @item
  13552. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13553. @example
  13554. 'scale2ref[b][a];[a][b]overlay'
  13555. @end example
  13556. @item
  13557. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13558. @example
  13559. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13560. @end example
  13561. @end itemize
  13562. @subsection Commands
  13563. This filter supports the following commands:
  13564. @table @option
  13565. @item width, w
  13566. @item height, h
  13567. Set the output video dimension expression.
  13568. The command accepts the same syntax of the corresponding option.
  13569. If the specified expression is not valid, it is kept at its current
  13570. value.
  13571. @end table
  13572. @section scroll
  13573. Scroll input video horizontally and/or vertically by constant speed.
  13574. The filter accepts the following options:
  13575. @table @option
  13576. @item horizontal, h
  13577. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13578. Negative values changes scrolling direction.
  13579. @item vertical, v
  13580. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13581. Negative values changes scrolling direction.
  13582. @item hpos
  13583. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13584. @item vpos
  13585. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13586. @end table
  13587. @subsection Commands
  13588. This filter supports the following @ref{commands}:
  13589. @table @option
  13590. @item horizontal, h
  13591. Set the horizontal scrolling speed.
  13592. @item vertical, v
  13593. Set the vertical scrolling speed.
  13594. @end table
  13595. @anchor{scdet}
  13596. @section scdet
  13597. Detect video scene change.
  13598. This filter sets frame metadata with mafd between frame, the scene score, and
  13599. forward the frame to the next filter, so they can use these metadata to detect
  13600. scene change or others.
  13601. In addition, this filter logs a message and sets frame metadata when it detects
  13602. a scene change by @option{threshold}.
  13603. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13604. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13605. to detect scene change.
  13606. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13607. detect scene change with @option{threshold}.
  13608. The filter accepts the following options:
  13609. @table @option
  13610. @item threshold, t
  13611. Set the scene change detection threshold as a percentage of maximum change. Good
  13612. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13613. @code{[0., 100.]}.
  13614. Default value is @code{10.}.
  13615. @item sc_pass, s
  13616. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13617. You can enable it if you want to get snapshot of scene change frames only.
  13618. @end table
  13619. @anchor{selectivecolor}
  13620. @section selectivecolor
  13621. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13622. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13623. by the "purity" of the color (that is, how saturated it already is).
  13624. This filter is similar to the Adobe Photoshop Selective Color tool.
  13625. The filter accepts the following options:
  13626. @table @option
  13627. @item correction_method
  13628. Select color correction method.
  13629. Available values are:
  13630. @table @samp
  13631. @item absolute
  13632. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13633. component value).
  13634. @item relative
  13635. Specified adjustments are relative to the original component value.
  13636. @end table
  13637. Default is @code{absolute}.
  13638. @item reds
  13639. Adjustments for red pixels (pixels where the red component is the maximum)
  13640. @item yellows
  13641. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13642. @item greens
  13643. Adjustments for green pixels (pixels where the green component is the maximum)
  13644. @item cyans
  13645. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13646. @item blues
  13647. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13648. @item magentas
  13649. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13650. @item whites
  13651. Adjustments for white pixels (pixels where all components are greater than 128)
  13652. @item neutrals
  13653. Adjustments for all pixels except pure black and pure white
  13654. @item blacks
  13655. Adjustments for black pixels (pixels where all components are lesser than 128)
  13656. @item psfile
  13657. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13658. @end table
  13659. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13660. 4 space separated floating point adjustment values in the [-1,1] range,
  13661. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13662. pixels of its range.
  13663. @subsection Examples
  13664. @itemize
  13665. @item
  13666. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13667. increase magenta by 27% in blue areas:
  13668. @example
  13669. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13670. @end example
  13671. @item
  13672. Use a Photoshop selective color preset:
  13673. @example
  13674. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13675. @end example
  13676. @end itemize
  13677. @anchor{separatefields}
  13678. @section separatefields
  13679. The @code{separatefields} takes a frame-based video input and splits
  13680. each frame into its components fields, producing a new half height clip
  13681. with twice the frame rate and twice the frame count.
  13682. This filter use field-dominance information in frame to decide which
  13683. of each pair of fields to place first in the output.
  13684. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13685. @section setdar, setsar
  13686. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13687. output video.
  13688. This is done by changing the specified Sample (aka Pixel) Aspect
  13689. Ratio, according to the following equation:
  13690. @example
  13691. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13692. @end example
  13693. Keep in mind that the @code{setdar} filter does not modify the pixel
  13694. dimensions of the video frame. Also, the display aspect ratio set by
  13695. this filter may be changed by later filters in the filterchain,
  13696. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13697. applied.
  13698. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13699. the filter output video.
  13700. Note that as a consequence of the application of this filter, the
  13701. output display aspect ratio will change according to the equation
  13702. above.
  13703. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13704. filter may be changed by later filters in the filterchain, e.g. if
  13705. another "setsar" or a "setdar" filter is applied.
  13706. It accepts the following parameters:
  13707. @table @option
  13708. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13709. Set the aspect ratio used by the filter.
  13710. The parameter can be a floating point number string, an expression, or
  13711. a string of the form @var{num}:@var{den}, where @var{num} and
  13712. @var{den} are the numerator and denominator of the aspect ratio. If
  13713. the parameter is not specified, it is assumed the value "0".
  13714. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13715. should be escaped.
  13716. @item max
  13717. Set the maximum integer value to use for expressing numerator and
  13718. denominator when reducing the expressed aspect ratio to a rational.
  13719. Default value is @code{100}.
  13720. @end table
  13721. The parameter @var{sar} is an expression containing
  13722. the following constants:
  13723. @table @option
  13724. @item E, PI, PHI
  13725. These are approximated values for the mathematical constants e
  13726. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13727. @item w, h
  13728. The input width and height.
  13729. @item a
  13730. These are the same as @var{w} / @var{h}.
  13731. @item sar
  13732. The input sample aspect ratio.
  13733. @item dar
  13734. The input display aspect ratio. It is the same as
  13735. (@var{w} / @var{h}) * @var{sar}.
  13736. @item hsub, vsub
  13737. Horizontal and vertical chroma subsample values. For example, for the
  13738. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13739. @end table
  13740. @subsection Examples
  13741. @itemize
  13742. @item
  13743. To change the display aspect ratio to 16:9, specify one of the following:
  13744. @example
  13745. setdar=dar=1.77777
  13746. setdar=dar=16/9
  13747. @end example
  13748. @item
  13749. To change the sample aspect ratio to 10:11, specify:
  13750. @example
  13751. setsar=sar=10/11
  13752. @end example
  13753. @item
  13754. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13755. 1000 in the aspect ratio reduction, use the command:
  13756. @example
  13757. setdar=ratio=16/9:max=1000
  13758. @end example
  13759. @end itemize
  13760. @anchor{setfield}
  13761. @section setfield
  13762. Force field for the output video frame.
  13763. The @code{setfield} filter marks the interlace type field for the
  13764. output frames. It does not change the input frame, but only sets the
  13765. corresponding property, which affects how the frame is treated by
  13766. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13767. The filter accepts the following options:
  13768. @table @option
  13769. @item mode
  13770. Available values are:
  13771. @table @samp
  13772. @item auto
  13773. Keep the same field property.
  13774. @item bff
  13775. Mark the frame as bottom-field-first.
  13776. @item tff
  13777. Mark the frame as top-field-first.
  13778. @item prog
  13779. Mark the frame as progressive.
  13780. @end table
  13781. @end table
  13782. @anchor{setparams}
  13783. @section setparams
  13784. Force frame parameter for the output video frame.
  13785. The @code{setparams} filter marks interlace and color range for the
  13786. output frames. It does not change the input frame, but only sets the
  13787. corresponding property, which affects how the frame is treated by
  13788. filters/encoders.
  13789. @table @option
  13790. @item field_mode
  13791. Available values are:
  13792. @table @samp
  13793. @item auto
  13794. Keep the same field property (default).
  13795. @item bff
  13796. Mark the frame as bottom-field-first.
  13797. @item tff
  13798. Mark the frame as top-field-first.
  13799. @item prog
  13800. Mark the frame as progressive.
  13801. @end table
  13802. @item range
  13803. Available values are:
  13804. @table @samp
  13805. @item auto
  13806. Keep the same color range property (default).
  13807. @item unspecified, unknown
  13808. Mark the frame as unspecified color range.
  13809. @item limited, tv, mpeg
  13810. Mark the frame as limited range.
  13811. @item full, pc, jpeg
  13812. Mark the frame as full range.
  13813. @end table
  13814. @item color_primaries
  13815. Set the color primaries.
  13816. Available values are:
  13817. @table @samp
  13818. @item auto
  13819. Keep the same color primaries property (default).
  13820. @item bt709
  13821. @item unknown
  13822. @item bt470m
  13823. @item bt470bg
  13824. @item smpte170m
  13825. @item smpte240m
  13826. @item film
  13827. @item bt2020
  13828. @item smpte428
  13829. @item smpte431
  13830. @item smpte432
  13831. @item jedec-p22
  13832. @end table
  13833. @item color_trc
  13834. Set the color transfer.
  13835. Available values are:
  13836. @table @samp
  13837. @item auto
  13838. Keep the same color trc property (default).
  13839. @item bt709
  13840. @item unknown
  13841. @item bt470m
  13842. @item bt470bg
  13843. @item smpte170m
  13844. @item smpte240m
  13845. @item linear
  13846. @item log100
  13847. @item log316
  13848. @item iec61966-2-4
  13849. @item bt1361e
  13850. @item iec61966-2-1
  13851. @item bt2020-10
  13852. @item bt2020-12
  13853. @item smpte2084
  13854. @item smpte428
  13855. @item arib-std-b67
  13856. @end table
  13857. @item colorspace
  13858. Set the colorspace.
  13859. Available values are:
  13860. @table @samp
  13861. @item auto
  13862. Keep the same colorspace property (default).
  13863. @item gbr
  13864. @item bt709
  13865. @item unknown
  13866. @item fcc
  13867. @item bt470bg
  13868. @item smpte170m
  13869. @item smpte240m
  13870. @item ycgco
  13871. @item bt2020nc
  13872. @item bt2020c
  13873. @item smpte2085
  13874. @item chroma-derived-nc
  13875. @item chroma-derived-c
  13876. @item ictcp
  13877. @end table
  13878. @end table
  13879. @section shear
  13880. Apply shear transform to input video.
  13881. This filter supports the following options:
  13882. @table @option
  13883. @item shx
  13884. Shear factor in X-direction. Default value is 0.
  13885. Allowed range is from -2 to 2.
  13886. @item shy
  13887. Shear factor in Y-direction. Default value is 0.
  13888. Allowed range is from -2 to 2.
  13889. @item fillcolor, c
  13890. Set the color used to fill the output area not covered by the transformed
  13891. video. For the general syntax of this option, check the
  13892. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13893. If the special value "none" is selected then no
  13894. background is printed (useful for example if the background is never shown).
  13895. Default value is "black".
  13896. @item interp
  13897. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  13898. @end table
  13899. @subsection Commands
  13900. This filter supports the all above options as @ref{commands}.
  13901. @section showinfo
  13902. Show a line containing various information for each input video frame.
  13903. The input video is not modified.
  13904. This filter supports the following options:
  13905. @table @option
  13906. @item checksum
  13907. Calculate checksums of each plane. By default enabled.
  13908. @end table
  13909. The shown line contains a sequence of key/value pairs of the form
  13910. @var{key}:@var{value}.
  13911. The following values are shown in the output:
  13912. @table @option
  13913. @item n
  13914. The (sequential) number of the input frame, starting from 0.
  13915. @item pts
  13916. The Presentation TimeStamp of the input frame, expressed as a number of
  13917. time base units. The time base unit depends on the filter input pad.
  13918. @item pts_time
  13919. The Presentation TimeStamp of the input frame, expressed as a number of
  13920. seconds.
  13921. @item pos
  13922. The position of the frame in the input stream, or -1 if this information is
  13923. unavailable and/or meaningless (for example in case of synthetic video).
  13924. @item fmt
  13925. The pixel format name.
  13926. @item sar
  13927. The sample aspect ratio of the input frame, expressed in the form
  13928. @var{num}/@var{den}.
  13929. @item s
  13930. The size of the input frame. For the syntax of this option, check the
  13931. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13932. @item i
  13933. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13934. for bottom field first).
  13935. @item iskey
  13936. This is 1 if the frame is a key frame, 0 otherwise.
  13937. @item type
  13938. The picture type of the input frame ("I" for an I-frame, "P" for a
  13939. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13940. Also refer to the documentation of the @code{AVPictureType} enum and of
  13941. the @code{av_get_picture_type_char} function defined in
  13942. @file{libavutil/avutil.h}.
  13943. @item checksum
  13944. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13945. @item plane_checksum
  13946. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13947. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13948. @item mean
  13949. The mean value of pixels in each plane of the input frame, expressed in the form
  13950. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13951. @item stdev
  13952. The standard deviation of pixel values in each plane of the input frame, expressed
  13953. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13954. @end table
  13955. @section showpalette
  13956. Displays the 256 colors palette of each frame. This filter is only relevant for
  13957. @var{pal8} pixel format frames.
  13958. It accepts the following option:
  13959. @table @option
  13960. @item s
  13961. Set the size of the box used to represent one palette color entry. Default is
  13962. @code{30} (for a @code{30x30} pixel box).
  13963. @end table
  13964. @section shuffleframes
  13965. Reorder and/or duplicate and/or drop video frames.
  13966. It accepts the following parameters:
  13967. @table @option
  13968. @item mapping
  13969. Set the destination indexes of input frames.
  13970. This is space or '|' separated list of indexes that maps input frames to output
  13971. frames. Number of indexes also sets maximal value that each index may have.
  13972. '-1' index have special meaning and that is to drop frame.
  13973. @end table
  13974. The first frame has the index 0. The default is to keep the input unchanged.
  13975. @subsection Examples
  13976. @itemize
  13977. @item
  13978. Swap second and third frame of every three frames of the input:
  13979. @example
  13980. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13981. @end example
  13982. @item
  13983. Swap 10th and 1st frame of every ten frames of the input:
  13984. @example
  13985. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13986. @end example
  13987. @end itemize
  13988. @section shufflepixels
  13989. Reorder pixels in video frames.
  13990. This filter accepts the following options:
  13991. @table @option
  13992. @item direction, d
  13993. Set shuffle direction. Can be forward or inverse direction.
  13994. Default direction is forward.
  13995. @item mode, m
  13996. Set shuffle mode. Can be horizontal, vertical or block mode.
  13997. @item width, w
  13998. @item height, h
  13999. Set shuffle block_size. In case of horizontal shuffle mode only width
  14000. part of size is used, and in case of vertical shuffle mode only height
  14001. part of size is used.
  14002. @item seed, s
  14003. Set random seed used with shuffling pixels. Mainly useful to set to be able
  14004. to reverse filtering process to get original input.
  14005. For example, to reverse forward shuffle you need to use same parameters
  14006. and exact same seed and to set direction to inverse.
  14007. @end table
  14008. @section shuffleplanes
  14009. Reorder and/or duplicate video planes.
  14010. It accepts the following parameters:
  14011. @table @option
  14012. @item map0
  14013. The index of the input plane to be used as the first output plane.
  14014. @item map1
  14015. The index of the input plane to be used as the second output plane.
  14016. @item map2
  14017. The index of the input plane to be used as the third output plane.
  14018. @item map3
  14019. The index of the input plane to be used as the fourth output plane.
  14020. @end table
  14021. The first plane has the index 0. The default is to keep the input unchanged.
  14022. @subsection Examples
  14023. @itemize
  14024. @item
  14025. Swap the second and third planes of the input:
  14026. @example
  14027. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  14028. @end example
  14029. @end itemize
  14030. @anchor{signalstats}
  14031. @section signalstats
  14032. Evaluate various visual metrics that assist in determining issues associated
  14033. with the digitization of analog video media.
  14034. By default the filter will log these metadata values:
  14035. @table @option
  14036. @item YMIN
  14037. Display the minimal Y value contained within the input frame. Expressed in
  14038. range of [0-255].
  14039. @item YLOW
  14040. Display the Y value at the 10% percentile within the input frame. Expressed in
  14041. range of [0-255].
  14042. @item YAVG
  14043. Display the average Y value within the input frame. Expressed in range of
  14044. [0-255].
  14045. @item YHIGH
  14046. Display the Y value at the 90% percentile within the input frame. Expressed in
  14047. range of [0-255].
  14048. @item YMAX
  14049. Display the maximum Y value contained within the input frame. Expressed in
  14050. range of [0-255].
  14051. @item UMIN
  14052. Display the minimal U value contained within the input frame. Expressed in
  14053. range of [0-255].
  14054. @item ULOW
  14055. Display the U value at the 10% percentile within the input frame. Expressed in
  14056. range of [0-255].
  14057. @item UAVG
  14058. Display the average U value within the input frame. Expressed in range of
  14059. [0-255].
  14060. @item UHIGH
  14061. Display the U value at the 90% percentile within the input frame. Expressed in
  14062. range of [0-255].
  14063. @item UMAX
  14064. Display the maximum U value contained within the input frame. Expressed in
  14065. range of [0-255].
  14066. @item VMIN
  14067. Display the minimal V value contained within the input frame. Expressed in
  14068. range of [0-255].
  14069. @item VLOW
  14070. Display the V value at the 10% percentile within the input frame. Expressed in
  14071. range of [0-255].
  14072. @item VAVG
  14073. Display the average V value within the input frame. Expressed in range of
  14074. [0-255].
  14075. @item VHIGH
  14076. Display the V value at the 90% percentile within the input frame. Expressed in
  14077. range of [0-255].
  14078. @item VMAX
  14079. Display the maximum V value contained within the input frame. Expressed in
  14080. range of [0-255].
  14081. @item SATMIN
  14082. Display the minimal saturation value contained within the input frame.
  14083. Expressed in range of [0-~181.02].
  14084. @item SATLOW
  14085. Display the saturation value at the 10% percentile within the input frame.
  14086. Expressed in range of [0-~181.02].
  14087. @item SATAVG
  14088. Display the average saturation value within the input frame. Expressed in range
  14089. of [0-~181.02].
  14090. @item SATHIGH
  14091. Display the saturation value at the 90% percentile within the input frame.
  14092. Expressed in range of [0-~181.02].
  14093. @item SATMAX
  14094. Display the maximum saturation value contained within the input frame.
  14095. Expressed in range of [0-~181.02].
  14096. @item HUEMED
  14097. Display the median value for hue within the input frame. Expressed in range of
  14098. [0-360].
  14099. @item HUEAVG
  14100. Display the average value for hue within the input frame. Expressed in range of
  14101. [0-360].
  14102. @item YDIF
  14103. Display the average of sample value difference between all values of the Y
  14104. plane in the current frame and corresponding values of the previous input frame.
  14105. Expressed in range of [0-255].
  14106. @item UDIF
  14107. Display the average of sample value difference between all values of the U
  14108. plane in the current frame and corresponding values of the previous input frame.
  14109. Expressed in range of [0-255].
  14110. @item VDIF
  14111. Display the average of sample value difference between all values of the V
  14112. plane in the current frame and corresponding values of the previous input frame.
  14113. Expressed in range of [0-255].
  14114. @item YBITDEPTH
  14115. Display bit depth of Y plane in current frame.
  14116. Expressed in range of [0-16].
  14117. @item UBITDEPTH
  14118. Display bit depth of U plane in current frame.
  14119. Expressed in range of [0-16].
  14120. @item VBITDEPTH
  14121. Display bit depth of V plane in current frame.
  14122. Expressed in range of [0-16].
  14123. @end table
  14124. The filter accepts the following options:
  14125. @table @option
  14126. @item stat
  14127. @item out
  14128. @option{stat} specify an additional form of image analysis.
  14129. @option{out} output video with the specified type of pixel highlighted.
  14130. Both options accept the following values:
  14131. @table @samp
  14132. @item tout
  14133. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  14134. unlike the neighboring pixels of the same field. Examples of temporal outliers
  14135. include the results of video dropouts, head clogs, or tape tracking issues.
  14136. @item vrep
  14137. Identify @var{vertical line repetition}. Vertical line repetition includes
  14138. similar rows of pixels within a frame. In born-digital video vertical line
  14139. repetition is common, but this pattern is uncommon in video digitized from an
  14140. analog source. When it occurs in video that results from the digitization of an
  14141. analog source it can indicate concealment from a dropout compensator.
  14142. @item brng
  14143. Identify pixels that fall outside of legal broadcast range.
  14144. @end table
  14145. @item color, c
  14146. Set the highlight color for the @option{out} option. The default color is
  14147. yellow.
  14148. @end table
  14149. @subsection Examples
  14150. @itemize
  14151. @item
  14152. Output data of various video metrics:
  14153. @example
  14154. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  14155. @end example
  14156. @item
  14157. Output specific data about the minimum and maximum values of the Y plane per frame:
  14158. @example
  14159. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  14160. @end example
  14161. @item
  14162. Playback video while highlighting pixels that are outside of broadcast range in red.
  14163. @example
  14164. ffplay example.mov -vf signalstats="out=brng:color=red"
  14165. @end example
  14166. @item
  14167. Playback video with signalstats metadata drawn over the frame.
  14168. @example
  14169. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  14170. @end example
  14171. The contents of signalstat_drawtext.txt used in the command are:
  14172. @example
  14173. time %@{pts:hms@}
  14174. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  14175. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  14176. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  14177. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  14178. @end example
  14179. @end itemize
  14180. @anchor{signature}
  14181. @section signature
  14182. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  14183. input. In this case the matching between the inputs can be calculated additionally.
  14184. The filter always passes through the first input. The signature of each stream can
  14185. be written into a file.
  14186. It accepts the following options:
  14187. @table @option
  14188. @item detectmode
  14189. Enable or disable the matching process.
  14190. Available values are:
  14191. @table @samp
  14192. @item off
  14193. Disable the calculation of a matching (default).
  14194. @item full
  14195. Calculate the matching for the whole video and output whether the whole video
  14196. matches or only parts.
  14197. @item fast
  14198. Calculate only until a matching is found or the video ends. Should be faster in
  14199. some cases.
  14200. @end table
  14201. @item nb_inputs
  14202. Set the number of inputs. The option value must be a non negative integer.
  14203. Default value is 1.
  14204. @item filename
  14205. Set the path to which the output is written. If there is more than one input,
  14206. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  14207. integer), that will be replaced with the input number. If no filename is
  14208. specified, no output will be written. This is the default.
  14209. @item format
  14210. Choose the output format.
  14211. Available values are:
  14212. @table @samp
  14213. @item binary
  14214. Use the specified binary representation (default).
  14215. @item xml
  14216. Use the specified xml representation.
  14217. @end table
  14218. @item th_d
  14219. Set threshold to detect one word as similar. The option value must be an integer
  14220. greater than zero. The default value is 9000.
  14221. @item th_dc
  14222. Set threshold to detect all words as similar. The option value must be an integer
  14223. greater than zero. The default value is 60000.
  14224. @item th_xh
  14225. Set threshold to detect frames as similar. The option value must be an integer
  14226. greater than zero. The default value is 116.
  14227. @item th_di
  14228. Set the minimum length of a sequence in frames to recognize it as matching
  14229. sequence. The option value must be a non negative integer value.
  14230. The default value is 0.
  14231. @item th_it
  14232. Set the minimum relation, that matching frames to all frames must have.
  14233. The option value must be a double value between 0 and 1. The default value is 0.5.
  14234. @end table
  14235. @subsection Examples
  14236. @itemize
  14237. @item
  14238. To calculate the signature of an input video and store it in signature.bin:
  14239. @example
  14240. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  14241. @end example
  14242. @item
  14243. To detect whether two videos match and store the signatures in XML format in
  14244. signature0.xml and signature1.xml:
  14245. @example
  14246. 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 -
  14247. @end example
  14248. @end itemize
  14249. @anchor{smartblur}
  14250. @section smartblur
  14251. Blur the input video without impacting the outlines.
  14252. It accepts the following options:
  14253. @table @option
  14254. @item luma_radius, lr
  14255. Set the luma radius. The option value must be a float number in
  14256. the range [0.1,5.0] that specifies the variance of the gaussian filter
  14257. used to blur the image (slower if larger). Default value is 1.0.
  14258. @item luma_strength, ls
  14259. Set the luma strength. The option value must be a float number
  14260. in the range [-1.0,1.0] that configures the blurring. A value included
  14261. in [0.0,1.0] will blur the image whereas a value included in
  14262. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  14263. @item luma_threshold, lt
  14264. Set the luma threshold used as a coefficient to determine
  14265. whether a pixel should be blurred or not. The option value must be an
  14266. integer in the range [-30,30]. A value of 0 will filter all the image,
  14267. a value included in [0,30] will filter flat areas and a value included
  14268. in [-30,0] will filter edges. Default value is 0.
  14269. @item chroma_radius, cr
  14270. Set the chroma radius. The option value must be a float number in
  14271. the range [0.1,5.0] that specifies the variance of the gaussian filter
  14272. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  14273. @item chroma_strength, cs
  14274. Set the chroma strength. The option value must be a float number
  14275. in the range [-1.0,1.0] that configures the blurring. A value included
  14276. in [0.0,1.0] will blur the image whereas a value included in
  14277. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  14278. @item chroma_threshold, ct
  14279. Set the chroma threshold used as a coefficient to determine
  14280. whether a pixel should be blurred or not. The option value must be an
  14281. integer in the range [-30,30]. A value of 0 will filter all the image,
  14282. a value included in [0,30] will filter flat areas and a value included
  14283. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  14284. @end table
  14285. If a chroma option is not explicitly set, the corresponding luma value
  14286. is set.
  14287. @section sobel
  14288. Apply sobel operator to input video stream.
  14289. The filter accepts the following option:
  14290. @table @option
  14291. @item planes
  14292. Set which planes will be processed, unprocessed planes will be copied.
  14293. By default value 0xf, all planes will be processed.
  14294. @item scale
  14295. Set value which will be multiplied with filtered result.
  14296. @item delta
  14297. Set value which will be added to filtered result.
  14298. @end table
  14299. @subsection Commands
  14300. This filter supports the all above options as @ref{commands}.
  14301. @anchor{spp}
  14302. @section spp
  14303. Apply a simple postprocessing filter that compresses and decompresses the image
  14304. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  14305. and average the results.
  14306. The filter accepts the following options:
  14307. @table @option
  14308. @item quality
  14309. Set quality. This option defines the number of levels for averaging. It accepts
  14310. an integer in the range 0-6. If set to @code{0}, the filter will have no
  14311. effect. A value of @code{6} means the higher quality. For each increment of
  14312. that value the speed drops by a factor of approximately 2. Default value is
  14313. @code{3}.
  14314. @item qp
  14315. Force a constant quantization parameter. If not set, the filter will use the QP
  14316. from the video stream (if available).
  14317. @item mode
  14318. Set thresholding mode. Available modes are:
  14319. @table @samp
  14320. @item hard
  14321. Set hard thresholding (default).
  14322. @item soft
  14323. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14324. @end table
  14325. @item use_bframe_qp
  14326. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  14327. option may cause flicker since the B-Frames have often larger QP. Default is
  14328. @code{0} (not enabled).
  14329. @end table
  14330. @subsection Commands
  14331. This filter supports the following commands:
  14332. @table @option
  14333. @item quality, level
  14334. Set quality level. The value @code{max} can be used to set the maximum level,
  14335. currently @code{6}.
  14336. @end table
  14337. @anchor{sr}
  14338. @section sr
  14339. Scale the input by applying one of the super-resolution methods based on
  14340. convolutional neural networks. Supported models:
  14341. @itemize
  14342. @item
  14343. Super-Resolution Convolutional Neural Network model (SRCNN).
  14344. See @url{https://arxiv.org/abs/1501.00092}.
  14345. @item
  14346. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  14347. See @url{https://arxiv.org/abs/1609.05158}.
  14348. @end itemize
  14349. Training scripts as well as scripts for model file (.pb) saving can be found at
  14350. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  14351. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  14352. Native model files (.model) can be generated from TensorFlow model
  14353. files (.pb) by using tools/python/convert.py
  14354. The filter accepts the following options:
  14355. @table @option
  14356. @item dnn_backend
  14357. Specify which DNN backend to use for model loading and execution. This option accepts
  14358. the following values:
  14359. @table @samp
  14360. @item native
  14361. Native implementation of DNN loading and execution.
  14362. @item tensorflow
  14363. TensorFlow backend. To enable this backend you
  14364. need to install the TensorFlow for C library (see
  14365. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  14366. @code{--enable-libtensorflow}
  14367. @end table
  14368. Default value is @samp{native}.
  14369. @item model
  14370. Set path to model file specifying network architecture and its parameters.
  14371. Note that different backends use different file formats. TensorFlow backend
  14372. can load files for both formats, while native backend can load files for only
  14373. its format.
  14374. @item scale_factor
  14375. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  14376. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  14377. input upscaled using bicubic upscaling with proper scale factor.
  14378. @end table
  14379. This feature can also be finished with @ref{dnn_processing} filter.
  14380. @section ssim
  14381. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  14382. This filter takes in input two input videos, the first input is
  14383. considered the "main" source and is passed unchanged to the
  14384. output. The second input is used as a "reference" video for computing
  14385. the SSIM.
  14386. Both video inputs must have the same resolution and pixel format for
  14387. this filter to work correctly. Also it assumes that both inputs
  14388. have the same number of frames, which are compared one by one.
  14389. The filter stores the calculated SSIM of each frame.
  14390. The description of the accepted parameters follows.
  14391. @table @option
  14392. @item stats_file, f
  14393. If specified the filter will use the named file to save the SSIM of
  14394. each individual frame. When filename equals "-" the data is sent to
  14395. standard output.
  14396. @end table
  14397. The file printed if @var{stats_file} is selected, contains a sequence of
  14398. key/value pairs of the form @var{key}:@var{value} for each compared
  14399. couple of frames.
  14400. A description of each shown parameter follows:
  14401. @table @option
  14402. @item n
  14403. sequential number of the input frame, starting from 1
  14404. @item Y, U, V, R, G, B
  14405. SSIM of the compared frames for the component specified by the suffix.
  14406. @item All
  14407. SSIM of the compared frames for the whole frame.
  14408. @item dB
  14409. Same as above but in dB representation.
  14410. @end table
  14411. This filter also supports the @ref{framesync} options.
  14412. @subsection Examples
  14413. @itemize
  14414. @item
  14415. For example:
  14416. @example
  14417. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14418. [main][ref] ssim="stats_file=stats.log" [out]
  14419. @end example
  14420. On this example the input file being processed is compared with the
  14421. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  14422. is stored in @file{stats.log}.
  14423. @item
  14424. Another example with both psnr and ssim at same time:
  14425. @example
  14426. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  14427. @end example
  14428. @item
  14429. Another example with different containers:
  14430. @example
  14431. 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 -
  14432. @end example
  14433. @end itemize
  14434. @section stereo3d
  14435. Convert between different stereoscopic image formats.
  14436. The filters accept the following options:
  14437. @table @option
  14438. @item in
  14439. Set stereoscopic image format of input.
  14440. Available values for input image formats are:
  14441. @table @samp
  14442. @item sbsl
  14443. side by side parallel (left eye left, right eye right)
  14444. @item sbsr
  14445. side by side crosseye (right eye left, left eye right)
  14446. @item sbs2l
  14447. side by side parallel with half width resolution
  14448. (left eye left, right eye right)
  14449. @item sbs2r
  14450. side by side crosseye with half width resolution
  14451. (right eye left, left eye right)
  14452. @item abl
  14453. @item tbl
  14454. above-below (left eye above, right eye below)
  14455. @item abr
  14456. @item tbr
  14457. above-below (right eye above, left eye below)
  14458. @item ab2l
  14459. @item tb2l
  14460. above-below with half height resolution
  14461. (left eye above, right eye below)
  14462. @item ab2r
  14463. @item tb2r
  14464. above-below with half height resolution
  14465. (right eye above, left eye below)
  14466. @item al
  14467. alternating frames (left eye first, right eye second)
  14468. @item ar
  14469. alternating frames (right eye first, left eye second)
  14470. @item irl
  14471. interleaved rows (left eye has top row, right eye starts on next row)
  14472. @item irr
  14473. interleaved rows (right eye has top row, left eye starts on next row)
  14474. @item icl
  14475. interleaved columns, left eye first
  14476. @item icr
  14477. interleaved columns, right eye first
  14478. Default value is @samp{sbsl}.
  14479. @end table
  14480. @item out
  14481. Set stereoscopic image format of output.
  14482. @table @samp
  14483. @item sbsl
  14484. side by side parallel (left eye left, right eye right)
  14485. @item sbsr
  14486. side by side crosseye (right eye left, left eye right)
  14487. @item sbs2l
  14488. side by side parallel with half width resolution
  14489. (left eye left, right eye right)
  14490. @item sbs2r
  14491. side by side crosseye with half width resolution
  14492. (right eye left, left eye right)
  14493. @item abl
  14494. @item tbl
  14495. above-below (left eye above, right eye below)
  14496. @item abr
  14497. @item tbr
  14498. above-below (right eye above, left eye below)
  14499. @item ab2l
  14500. @item tb2l
  14501. above-below with half height resolution
  14502. (left eye above, right eye below)
  14503. @item ab2r
  14504. @item tb2r
  14505. above-below with half height resolution
  14506. (right eye above, left eye below)
  14507. @item al
  14508. alternating frames (left eye first, right eye second)
  14509. @item ar
  14510. alternating frames (right eye first, left eye second)
  14511. @item irl
  14512. interleaved rows (left eye has top row, right eye starts on next row)
  14513. @item irr
  14514. interleaved rows (right eye has top row, left eye starts on next row)
  14515. @item arbg
  14516. anaglyph red/blue gray
  14517. (red filter on left eye, blue filter on right eye)
  14518. @item argg
  14519. anaglyph red/green gray
  14520. (red filter on left eye, green filter on right eye)
  14521. @item arcg
  14522. anaglyph red/cyan gray
  14523. (red filter on left eye, cyan filter on right eye)
  14524. @item arch
  14525. anaglyph red/cyan half colored
  14526. (red filter on left eye, cyan filter on right eye)
  14527. @item arcc
  14528. anaglyph red/cyan color
  14529. (red filter on left eye, cyan filter on right eye)
  14530. @item arcd
  14531. anaglyph red/cyan color optimized with the least squares projection of dubois
  14532. (red filter on left eye, cyan filter on right eye)
  14533. @item agmg
  14534. anaglyph green/magenta gray
  14535. (green filter on left eye, magenta filter on right eye)
  14536. @item agmh
  14537. anaglyph green/magenta half colored
  14538. (green filter on left eye, magenta filter on right eye)
  14539. @item agmc
  14540. anaglyph green/magenta colored
  14541. (green filter on left eye, magenta filter on right eye)
  14542. @item agmd
  14543. anaglyph green/magenta color optimized with the least squares projection of dubois
  14544. (green filter on left eye, magenta filter on right eye)
  14545. @item aybg
  14546. anaglyph yellow/blue gray
  14547. (yellow filter on left eye, blue filter on right eye)
  14548. @item aybh
  14549. anaglyph yellow/blue half colored
  14550. (yellow filter on left eye, blue filter on right eye)
  14551. @item aybc
  14552. anaglyph yellow/blue colored
  14553. (yellow filter on left eye, blue filter on right eye)
  14554. @item aybd
  14555. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14556. (yellow filter on left eye, blue filter on right eye)
  14557. @item ml
  14558. mono output (left eye only)
  14559. @item mr
  14560. mono output (right eye only)
  14561. @item chl
  14562. checkerboard, left eye first
  14563. @item chr
  14564. checkerboard, right eye first
  14565. @item icl
  14566. interleaved columns, left eye first
  14567. @item icr
  14568. interleaved columns, right eye first
  14569. @item hdmi
  14570. HDMI frame pack
  14571. @end table
  14572. Default value is @samp{arcd}.
  14573. @end table
  14574. @subsection Examples
  14575. @itemize
  14576. @item
  14577. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14578. @example
  14579. stereo3d=sbsl:aybd
  14580. @end example
  14581. @item
  14582. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14583. @example
  14584. stereo3d=abl:sbsr
  14585. @end example
  14586. @end itemize
  14587. @section streamselect, astreamselect
  14588. Select video or audio streams.
  14589. The filter accepts the following options:
  14590. @table @option
  14591. @item inputs
  14592. Set number of inputs. Default is 2.
  14593. @item map
  14594. Set input indexes to remap to outputs.
  14595. @end table
  14596. @subsection Commands
  14597. The @code{streamselect} and @code{astreamselect} filter supports the following
  14598. commands:
  14599. @table @option
  14600. @item map
  14601. Set input indexes to remap to outputs.
  14602. @end table
  14603. @subsection Examples
  14604. @itemize
  14605. @item
  14606. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14607. @example
  14608. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14609. @end example
  14610. @item
  14611. Same as above, but for audio:
  14612. @example
  14613. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14614. @end example
  14615. @end itemize
  14616. @anchor{subtitles}
  14617. @section subtitles
  14618. Draw subtitles on top of input video using the libass library.
  14619. To enable compilation of this filter you need to configure FFmpeg with
  14620. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14621. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14622. Alpha) subtitles format.
  14623. The filter accepts the following options:
  14624. @table @option
  14625. @item filename, f
  14626. Set the filename of the subtitle file to read. It must be specified.
  14627. @item original_size
  14628. Specify the size of the original video, the video for which the ASS file
  14629. was composed. For the syntax of this option, check the
  14630. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14631. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14632. correctly scale the fonts if the aspect ratio has been changed.
  14633. @item fontsdir
  14634. Set a directory path containing fonts that can be used by the filter.
  14635. These fonts will be used in addition to whatever the font provider uses.
  14636. @item alpha
  14637. Process alpha channel, by default alpha channel is untouched.
  14638. @item charenc
  14639. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14640. useful if not UTF-8.
  14641. @item stream_index, si
  14642. Set subtitles stream index. @code{subtitles} filter only.
  14643. @item force_style
  14644. Override default style or script info parameters of the subtitles. It accepts a
  14645. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14646. @end table
  14647. If the first key is not specified, it is assumed that the first value
  14648. specifies the @option{filename}.
  14649. For example, to render the file @file{sub.srt} on top of the input
  14650. video, use the command:
  14651. @example
  14652. subtitles=sub.srt
  14653. @end example
  14654. which is equivalent to:
  14655. @example
  14656. subtitles=filename=sub.srt
  14657. @end example
  14658. To render the default subtitles stream from file @file{video.mkv}, use:
  14659. @example
  14660. subtitles=video.mkv
  14661. @end example
  14662. To render the second subtitles stream from that file, use:
  14663. @example
  14664. subtitles=video.mkv:si=1
  14665. @end example
  14666. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14667. @code{DejaVu Serif}, use:
  14668. @example
  14669. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14670. @end example
  14671. @section super2xsai
  14672. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14673. Interpolate) pixel art scaling algorithm.
  14674. Useful for enlarging pixel art images without reducing sharpness.
  14675. @section swaprect
  14676. Swap two rectangular objects in video.
  14677. This filter accepts the following options:
  14678. @table @option
  14679. @item w
  14680. Set object width.
  14681. @item h
  14682. Set object height.
  14683. @item x1
  14684. Set 1st rect x coordinate.
  14685. @item y1
  14686. Set 1st rect y coordinate.
  14687. @item x2
  14688. Set 2nd rect x coordinate.
  14689. @item y2
  14690. Set 2nd rect y coordinate.
  14691. All expressions are evaluated once for each frame.
  14692. @end table
  14693. The all options are expressions containing the following constants:
  14694. @table @option
  14695. @item w
  14696. @item h
  14697. The input width and height.
  14698. @item a
  14699. same as @var{w} / @var{h}
  14700. @item sar
  14701. input sample aspect ratio
  14702. @item dar
  14703. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14704. @item n
  14705. The number of the input frame, starting from 0.
  14706. @item t
  14707. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14708. @item pos
  14709. the position in the file of the input frame, NAN if unknown
  14710. @end table
  14711. @subsection Commands
  14712. This filter supports the all above options as @ref{commands}.
  14713. @section swapuv
  14714. Swap U & V plane.
  14715. @section tblend
  14716. Blend successive video frames.
  14717. See @ref{blend}
  14718. @section telecine
  14719. Apply telecine process to the video.
  14720. This filter accepts the following options:
  14721. @table @option
  14722. @item first_field
  14723. @table @samp
  14724. @item top, t
  14725. top field first
  14726. @item bottom, b
  14727. bottom field first
  14728. The default value is @code{top}.
  14729. @end table
  14730. @item pattern
  14731. A string of numbers representing the pulldown pattern you wish to apply.
  14732. The default value is @code{23}.
  14733. @end table
  14734. @example
  14735. Some typical patterns:
  14736. NTSC output (30i):
  14737. 27.5p: 32222
  14738. 24p: 23 (classic)
  14739. 24p: 2332 (preferred)
  14740. 20p: 33
  14741. 18p: 334
  14742. 16p: 3444
  14743. PAL output (25i):
  14744. 27.5p: 12222
  14745. 24p: 222222222223 ("Euro pulldown")
  14746. 16.67p: 33
  14747. 16p: 33333334
  14748. @end example
  14749. @section thistogram
  14750. Compute and draw a color distribution histogram for the input video across time.
  14751. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14752. at certain time, this filter shows also past histograms of number of frames defined
  14753. by @code{width} option.
  14754. The computed histogram is a representation of the color component
  14755. distribution in an image.
  14756. The filter accepts the following options:
  14757. @table @option
  14758. @item width, w
  14759. Set width of single color component output. Default value is @code{0}.
  14760. Value of @code{0} means width will be picked from input video.
  14761. This also set number of passed histograms to keep.
  14762. Allowed range is [0, 8192].
  14763. @item display_mode, d
  14764. Set display mode.
  14765. It accepts the following values:
  14766. @table @samp
  14767. @item stack
  14768. Per color component graphs are placed below each other.
  14769. @item parade
  14770. Per color component graphs are placed side by side.
  14771. @item overlay
  14772. Presents information identical to that in the @code{parade}, except
  14773. that the graphs representing color components are superimposed directly
  14774. over one another.
  14775. @end table
  14776. Default is @code{stack}.
  14777. @item levels_mode, m
  14778. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14779. Default is @code{linear}.
  14780. @item components, c
  14781. Set what color components to display.
  14782. Default is @code{7}.
  14783. @item bgopacity, b
  14784. Set background opacity. Default is @code{0.9}.
  14785. @item envelope, e
  14786. Show envelope. Default is disabled.
  14787. @item ecolor, ec
  14788. Set envelope color. Default is @code{gold}.
  14789. @item slide
  14790. Set slide mode.
  14791. Available values for slide is:
  14792. @table @samp
  14793. @item frame
  14794. Draw new frame when right border is reached.
  14795. @item replace
  14796. Replace old columns with new ones.
  14797. @item scroll
  14798. Scroll from right to left.
  14799. @item rscroll
  14800. Scroll from left to right.
  14801. @item picture
  14802. Draw single picture.
  14803. @end table
  14804. Default is @code{replace}.
  14805. @end table
  14806. @section threshold
  14807. Apply threshold effect to video stream.
  14808. This filter needs four video streams to perform thresholding.
  14809. First stream is stream we are filtering.
  14810. Second stream is holding threshold values, third stream is holding min values,
  14811. and last, fourth stream is holding max values.
  14812. The filter accepts the following option:
  14813. @table @option
  14814. @item planes
  14815. Set which planes will be processed, unprocessed planes will be copied.
  14816. By default value 0xf, all planes will be processed.
  14817. @end table
  14818. For example if first stream pixel's component value is less then threshold value
  14819. of pixel component from 2nd threshold stream, third stream value will picked,
  14820. otherwise fourth stream pixel component value will be picked.
  14821. Using color source filter one can perform various types of thresholding:
  14822. @subsection Examples
  14823. @itemize
  14824. @item
  14825. Binary threshold, using gray color as threshold:
  14826. @example
  14827. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14828. @end example
  14829. @item
  14830. Inverted binary threshold, using gray color as threshold:
  14831. @example
  14832. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14833. @end example
  14834. @item
  14835. Truncate binary threshold, using gray color as threshold:
  14836. @example
  14837. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14838. @end example
  14839. @item
  14840. Threshold to zero, using gray color as threshold:
  14841. @example
  14842. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14843. @end example
  14844. @item
  14845. Inverted threshold to zero, using gray color as threshold:
  14846. @example
  14847. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14848. @end example
  14849. @end itemize
  14850. @section thumbnail
  14851. Select the most representative frame in a given sequence of consecutive frames.
  14852. The filter accepts the following options:
  14853. @table @option
  14854. @item n
  14855. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14856. will pick one of them, and then handle the next batch of @var{n} frames until
  14857. the end. Default is @code{100}.
  14858. @end table
  14859. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14860. value will result in a higher memory usage, so a high value is not recommended.
  14861. @subsection Examples
  14862. @itemize
  14863. @item
  14864. Extract one picture each 50 frames:
  14865. @example
  14866. thumbnail=50
  14867. @end example
  14868. @item
  14869. Complete example of a thumbnail creation with @command{ffmpeg}:
  14870. @example
  14871. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14872. @end example
  14873. @end itemize
  14874. @anchor{tile}
  14875. @section tile
  14876. Tile several successive frames together.
  14877. The @ref{untile} filter can do the reverse.
  14878. The filter accepts the following options:
  14879. @table @option
  14880. @item layout
  14881. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14882. this option, check the
  14883. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14884. @item nb_frames
  14885. Set the maximum number of frames to render in the given area. It must be less
  14886. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14887. the area will be used.
  14888. @item margin
  14889. Set the outer border margin in pixels.
  14890. @item padding
  14891. Set the inner border thickness (i.e. the number of pixels between frames). For
  14892. more advanced padding options (such as having different values for the edges),
  14893. refer to the pad video filter.
  14894. @item color
  14895. Specify the color of the unused area. For the syntax of this option, check the
  14896. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14897. The default value of @var{color} is "black".
  14898. @item overlap
  14899. Set the number of frames to overlap when tiling several successive frames together.
  14900. The value must be between @code{0} and @var{nb_frames - 1}.
  14901. @item init_padding
  14902. Set the number of frames to initially be empty before displaying first output frame.
  14903. This controls how soon will one get first output frame.
  14904. The value must be between @code{0} and @var{nb_frames - 1}.
  14905. @end table
  14906. @subsection Examples
  14907. @itemize
  14908. @item
  14909. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14910. @example
  14911. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14912. @end example
  14913. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14914. duplicating each output frame to accommodate the originally detected frame
  14915. rate.
  14916. @item
  14917. Display @code{5} pictures in an area of @code{3x2} frames,
  14918. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14919. mixed flat and named options:
  14920. @example
  14921. tile=3x2:nb_frames=5:padding=7:margin=2
  14922. @end example
  14923. @end itemize
  14924. @section tinterlace
  14925. Perform various types of temporal field interlacing.
  14926. Frames are counted starting from 1, so the first input frame is
  14927. considered odd.
  14928. The filter accepts the following options:
  14929. @table @option
  14930. @item mode
  14931. Specify the mode of the interlacing. This option can also be specified
  14932. as a value alone. See below for a list of values for this option.
  14933. Available values are:
  14934. @table @samp
  14935. @item merge, 0
  14936. Move odd frames into the upper field, even into the lower field,
  14937. generating a double height frame at half frame rate.
  14938. @example
  14939. ------> time
  14940. Input:
  14941. Frame 1 Frame 2 Frame 3 Frame 4
  14942. 11111 22222 33333 44444
  14943. 11111 22222 33333 44444
  14944. 11111 22222 33333 44444
  14945. 11111 22222 33333 44444
  14946. Output:
  14947. 11111 33333
  14948. 22222 44444
  14949. 11111 33333
  14950. 22222 44444
  14951. 11111 33333
  14952. 22222 44444
  14953. 11111 33333
  14954. 22222 44444
  14955. @end example
  14956. @item drop_even, 1
  14957. Only output odd frames, even frames are dropped, generating a frame with
  14958. unchanged height at half frame rate.
  14959. @example
  14960. ------> time
  14961. Input:
  14962. Frame 1 Frame 2 Frame 3 Frame 4
  14963. 11111 22222 33333 44444
  14964. 11111 22222 33333 44444
  14965. 11111 22222 33333 44444
  14966. 11111 22222 33333 44444
  14967. Output:
  14968. 11111 33333
  14969. 11111 33333
  14970. 11111 33333
  14971. 11111 33333
  14972. @end example
  14973. @item drop_odd, 2
  14974. Only output even frames, odd frames are dropped, generating a frame with
  14975. unchanged height at half frame rate.
  14976. @example
  14977. ------> time
  14978. Input:
  14979. Frame 1 Frame 2 Frame 3 Frame 4
  14980. 11111 22222 33333 44444
  14981. 11111 22222 33333 44444
  14982. 11111 22222 33333 44444
  14983. 11111 22222 33333 44444
  14984. Output:
  14985. 22222 44444
  14986. 22222 44444
  14987. 22222 44444
  14988. 22222 44444
  14989. @end example
  14990. @item pad, 3
  14991. Expand each frame to full height, but pad alternate lines with black,
  14992. generating a frame with double height at the same input frame rate.
  14993. @example
  14994. ------> time
  14995. Input:
  14996. Frame 1 Frame 2 Frame 3 Frame 4
  14997. 11111 22222 33333 44444
  14998. 11111 22222 33333 44444
  14999. 11111 22222 33333 44444
  15000. 11111 22222 33333 44444
  15001. Output:
  15002. 11111 ..... 33333 .....
  15003. ..... 22222 ..... 44444
  15004. 11111 ..... 33333 .....
  15005. ..... 22222 ..... 44444
  15006. 11111 ..... 33333 .....
  15007. ..... 22222 ..... 44444
  15008. 11111 ..... 33333 .....
  15009. ..... 22222 ..... 44444
  15010. @end example
  15011. @item interleave_top, 4
  15012. Interleave the upper field from odd frames with the lower field from
  15013. even frames, generating a frame with unchanged height at half frame rate.
  15014. @example
  15015. ------> time
  15016. Input:
  15017. Frame 1 Frame 2 Frame 3 Frame 4
  15018. 11111<- 22222 33333<- 44444
  15019. 11111 22222<- 33333 44444<-
  15020. 11111<- 22222 33333<- 44444
  15021. 11111 22222<- 33333 44444<-
  15022. Output:
  15023. 11111 33333
  15024. 22222 44444
  15025. 11111 33333
  15026. 22222 44444
  15027. @end example
  15028. @item interleave_bottom, 5
  15029. Interleave the lower field from odd frames with the upper field from
  15030. even frames, generating a frame with unchanged height at half frame rate.
  15031. @example
  15032. ------> time
  15033. Input:
  15034. Frame 1 Frame 2 Frame 3 Frame 4
  15035. 11111 22222<- 33333 44444<-
  15036. 11111<- 22222 33333<- 44444
  15037. 11111 22222<- 33333 44444<-
  15038. 11111<- 22222 33333<- 44444
  15039. Output:
  15040. 22222 44444
  15041. 11111 33333
  15042. 22222 44444
  15043. 11111 33333
  15044. @end example
  15045. @item interlacex2, 6
  15046. Double frame rate with unchanged height. Frames are inserted each
  15047. containing the second temporal field from the previous input frame and
  15048. the first temporal field from the next input frame. This mode relies on
  15049. the top_field_first flag. Useful for interlaced video displays with no
  15050. field synchronisation.
  15051. @example
  15052. ------> time
  15053. Input:
  15054. Frame 1 Frame 2 Frame 3 Frame 4
  15055. 11111 22222 33333 44444
  15056. 11111 22222 33333 44444
  15057. 11111 22222 33333 44444
  15058. 11111 22222 33333 44444
  15059. Output:
  15060. 11111 22222 22222 33333 33333 44444 44444
  15061. 11111 11111 22222 22222 33333 33333 44444
  15062. 11111 22222 22222 33333 33333 44444 44444
  15063. 11111 11111 22222 22222 33333 33333 44444
  15064. @end example
  15065. @item mergex2, 7
  15066. Move odd frames into the upper field, even into the lower field,
  15067. generating a double height frame at same frame rate.
  15068. @example
  15069. ------> time
  15070. Input:
  15071. Frame 1 Frame 2 Frame 3 Frame 4
  15072. 11111 22222 33333 44444
  15073. 11111 22222 33333 44444
  15074. 11111 22222 33333 44444
  15075. 11111 22222 33333 44444
  15076. Output:
  15077. 11111 33333 33333 55555
  15078. 22222 22222 44444 44444
  15079. 11111 33333 33333 55555
  15080. 22222 22222 44444 44444
  15081. 11111 33333 33333 55555
  15082. 22222 22222 44444 44444
  15083. 11111 33333 33333 55555
  15084. 22222 22222 44444 44444
  15085. @end example
  15086. @end table
  15087. Numeric values are deprecated but are accepted for backward
  15088. compatibility reasons.
  15089. Default mode is @code{merge}.
  15090. @item flags
  15091. Specify flags influencing the filter process.
  15092. Available value for @var{flags} is:
  15093. @table @option
  15094. @item low_pass_filter, vlpf
  15095. Enable linear vertical low-pass filtering in the filter.
  15096. Vertical low-pass filtering is required when creating an interlaced
  15097. destination from a progressive source which contains high-frequency
  15098. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  15099. patterning.
  15100. @item complex_filter, cvlpf
  15101. Enable complex vertical low-pass filtering.
  15102. This will slightly less reduce interlace 'twitter' and Moire
  15103. patterning but better retain detail and subjective sharpness impression.
  15104. @item bypass_il
  15105. Bypass already interlaced frames, only adjust the frame rate.
  15106. @end table
  15107. Vertical low-pass filtering and bypassing already interlaced frames can only be
  15108. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  15109. @end table
  15110. @section tmedian
  15111. Pick median pixels from several successive input video frames.
  15112. The filter accepts the following options:
  15113. @table @option
  15114. @item radius
  15115. Set radius of median filter.
  15116. Default is 1. Allowed range is from 1 to 127.
  15117. @item planes
  15118. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15119. @item percentile
  15120. Set median percentile. Default value is @code{0.5}.
  15121. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15122. minimum values, and @code{1} maximum values.
  15123. @end table
  15124. @subsection Commands
  15125. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  15126. @section tmidequalizer
  15127. Apply Temporal Midway Video Equalization effect.
  15128. Midway Video Equalization adjusts a sequence of video frames to have the same
  15129. histograms, while maintaining their dynamics as much as possible. It's
  15130. useful for e.g. matching exposures from a video frames sequence.
  15131. This filter accepts the following option:
  15132. @table @option
  15133. @item radius
  15134. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  15135. @item sigma
  15136. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  15137. Setting this option to 0 effectively does nothing.
  15138. @item planes
  15139. Set which planes to process. Default is @code{15}, which is all available planes.
  15140. @end table
  15141. @section tmix
  15142. Mix successive video frames.
  15143. A description of the accepted options follows.
  15144. @table @option
  15145. @item frames
  15146. The number of successive frames to mix. If unspecified, it defaults to 3.
  15147. @item weights
  15148. Specify weight of each input video frame.
  15149. Each weight is separated by space. If number of weights is smaller than
  15150. number of @var{frames} last specified weight will be used for all remaining
  15151. unset weights.
  15152. @item scale
  15153. Specify scale, if it is set it will be multiplied with sum
  15154. of each weight multiplied with pixel values to give final destination
  15155. pixel value. By default @var{scale} is auto scaled to sum of weights.
  15156. @end table
  15157. @subsection Examples
  15158. @itemize
  15159. @item
  15160. Average 7 successive frames:
  15161. @example
  15162. tmix=frames=7:weights="1 1 1 1 1 1 1"
  15163. @end example
  15164. @item
  15165. Apply simple temporal convolution:
  15166. @example
  15167. tmix=frames=3:weights="-1 3 -1"
  15168. @end example
  15169. @item
  15170. Similar as above but only showing temporal differences:
  15171. @example
  15172. tmix=frames=3:weights="-1 2 -1":scale=1
  15173. @end example
  15174. @end itemize
  15175. @subsection Commands
  15176. This filter supports the following commands:
  15177. @table @option
  15178. @item weights
  15179. @item scale
  15180. Syntax is same as option with same name.
  15181. @end table
  15182. @anchor{tonemap}
  15183. @section tonemap
  15184. Tone map colors from different dynamic ranges.
  15185. This filter expects data in single precision floating point, as it needs to
  15186. operate on (and can output) out-of-range values. Another filter, such as
  15187. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  15188. The tonemapping algorithms implemented only work on linear light, so input
  15189. data should be linearized beforehand (and possibly correctly tagged).
  15190. @example
  15191. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  15192. @end example
  15193. @subsection Options
  15194. The filter accepts the following options.
  15195. @table @option
  15196. @item tonemap
  15197. Set the tone map algorithm to use.
  15198. Possible values are:
  15199. @table @var
  15200. @item none
  15201. Do not apply any tone map, only desaturate overbright pixels.
  15202. @item clip
  15203. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  15204. in-range values, while distorting out-of-range values.
  15205. @item linear
  15206. Stretch the entire reference gamut to a linear multiple of the display.
  15207. @item gamma
  15208. Fit a logarithmic transfer between the tone curves.
  15209. @item reinhard
  15210. Preserve overall image brightness with a simple curve, using nonlinear
  15211. contrast, which results in flattening details and degrading color accuracy.
  15212. @item hable
  15213. Preserve both dark and bright details better than @var{reinhard}, at the cost
  15214. of slightly darkening everything. Use it when detail preservation is more
  15215. important than color and brightness accuracy.
  15216. @item mobius
  15217. Smoothly map out-of-range values, while retaining contrast and colors for
  15218. in-range material as much as possible. Use it when color accuracy is more
  15219. important than detail preservation.
  15220. @end table
  15221. Default is none.
  15222. @item param
  15223. Tune the tone mapping algorithm.
  15224. This affects the following algorithms:
  15225. @table @var
  15226. @item none
  15227. Ignored.
  15228. @item linear
  15229. Specifies the scale factor to use while stretching.
  15230. Default to 1.0.
  15231. @item gamma
  15232. Specifies the exponent of the function.
  15233. Default to 1.8.
  15234. @item clip
  15235. Specify an extra linear coefficient to multiply into the signal before clipping.
  15236. Default to 1.0.
  15237. @item reinhard
  15238. Specify the local contrast coefficient at the display peak.
  15239. Default to 0.5, which means that in-gamut values will be about half as bright
  15240. as when clipping.
  15241. @item hable
  15242. Ignored.
  15243. @item mobius
  15244. Specify the transition point from linear to mobius transform. Every value
  15245. below this point is guaranteed to be mapped 1:1. The higher the value, the
  15246. more accurate the result will be, at the cost of losing bright details.
  15247. Default to 0.3, which due to the steep initial slope still preserves in-range
  15248. colors fairly accurately.
  15249. @end table
  15250. @item desat
  15251. Apply desaturation for highlights that exceed this level of brightness. The
  15252. higher the parameter, the more color information will be preserved. This
  15253. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15254. (smoothly) turning into white instead. This makes images feel more natural,
  15255. at the cost of reducing information about out-of-range colors.
  15256. The default of 2.0 is somewhat conservative and will mostly just apply to
  15257. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  15258. This option works only if the input frame has a supported color tag.
  15259. @item peak
  15260. Override signal/nominal/reference peak with this value. Useful when the
  15261. embedded peak information in display metadata is not reliable or when tone
  15262. mapping from a lower range to a higher range.
  15263. @end table
  15264. @section tpad
  15265. Temporarily pad video frames.
  15266. The filter accepts the following options:
  15267. @table @option
  15268. @item start
  15269. Specify number of delay frames before input video stream. Default is 0.
  15270. @item stop
  15271. Specify number of padding frames after input video stream.
  15272. Set to -1 to pad indefinitely. Default is 0.
  15273. @item start_mode
  15274. Set kind of frames added to beginning of stream.
  15275. Can be either @var{add} or @var{clone}.
  15276. With @var{add} frames of solid-color are added.
  15277. With @var{clone} frames are clones of first frame.
  15278. Default is @var{add}.
  15279. @item stop_mode
  15280. Set kind of frames added to end of stream.
  15281. Can be either @var{add} or @var{clone}.
  15282. With @var{add} frames of solid-color are added.
  15283. With @var{clone} frames are clones of last frame.
  15284. Default is @var{add}.
  15285. @item start_duration, stop_duration
  15286. Specify the duration of the start/stop delay. See
  15287. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15288. for the accepted syntax.
  15289. These options override @var{start} and @var{stop}. Default is 0.
  15290. @item color
  15291. Specify the color of the padded area. For the syntax of this option,
  15292. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15293. manual,ffmpeg-utils}.
  15294. The default value of @var{color} is "black".
  15295. @end table
  15296. @anchor{transpose}
  15297. @section transpose
  15298. Transpose rows with columns in the input video and optionally flip it.
  15299. It accepts the following parameters:
  15300. @table @option
  15301. @item dir
  15302. Specify the transposition direction.
  15303. Can assume the following values:
  15304. @table @samp
  15305. @item 0, 4, cclock_flip
  15306. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  15307. @example
  15308. L.R L.l
  15309. . . -> . .
  15310. l.r R.r
  15311. @end example
  15312. @item 1, 5, clock
  15313. Rotate by 90 degrees clockwise, that is:
  15314. @example
  15315. L.R l.L
  15316. . . -> . .
  15317. l.r r.R
  15318. @end example
  15319. @item 2, 6, cclock
  15320. Rotate by 90 degrees counterclockwise, that is:
  15321. @example
  15322. L.R R.r
  15323. . . -> . .
  15324. l.r L.l
  15325. @end example
  15326. @item 3, 7, clock_flip
  15327. Rotate by 90 degrees clockwise and vertically flip, that is:
  15328. @example
  15329. L.R r.R
  15330. . . -> . .
  15331. l.r l.L
  15332. @end example
  15333. @end table
  15334. For values between 4-7, the transposition is only done if the input
  15335. video geometry is portrait and not landscape. These values are
  15336. deprecated, the @code{passthrough} option should be used instead.
  15337. Numerical values are deprecated, and should be dropped in favor of
  15338. symbolic constants.
  15339. @item passthrough
  15340. Do not apply the transposition if the input geometry matches the one
  15341. specified by the specified value. It accepts the following values:
  15342. @table @samp
  15343. @item none
  15344. Always apply transposition.
  15345. @item portrait
  15346. Preserve portrait geometry (when @var{height} >= @var{width}).
  15347. @item landscape
  15348. Preserve landscape geometry (when @var{width} >= @var{height}).
  15349. @end table
  15350. Default value is @code{none}.
  15351. @end table
  15352. For example to rotate by 90 degrees clockwise and preserve portrait
  15353. layout:
  15354. @example
  15355. transpose=dir=1:passthrough=portrait
  15356. @end example
  15357. The command above can also be specified as:
  15358. @example
  15359. transpose=1:portrait
  15360. @end example
  15361. @section transpose_npp
  15362. Transpose rows with columns in the input video and optionally flip it.
  15363. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  15364. It accepts the following parameters:
  15365. @table @option
  15366. @item dir
  15367. Specify the transposition direction.
  15368. Can assume the following values:
  15369. @table @samp
  15370. @item cclock_flip
  15371. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  15372. @item clock
  15373. Rotate by 90 degrees clockwise.
  15374. @item cclock
  15375. Rotate by 90 degrees counterclockwise.
  15376. @item clock_flip
  15377. Rotate by 90 degrees clockwise and vertically flip.
  15378. @end table
  15379. @item passthrough
  15380. Do not apply the transposition if the input geometry matches the one
  15381. specified by the specified value. It accepts the following values:
  15382. @table @samp
  15383. @item none
  15384. Always apply transposition. (default)
  15385. @item portrait
  15386. Preserve portrait geometry (when @var{height} >= @var{width}).
  15387. @item landscape
  15388. Preserve landscape geometry (when @var{width} >= @var{height}).
  15389. @end table
  15390. @end table
  15391. @section trim
  15392. Trim the input so that the output contains one continuous subpart of the input.
  15393. It accepts the following parameters:
  15394. @table @option
  15395. @item start
  15396. Specify the time of the start of the kept section, i.e. the frame with the
  15397. timestamp @var{start} will be the first frame in the output.
  15398. @item end
  15399. Specify the time of the first frame that will be dropped, i.e. the frame
  15400. immediately preceding the one with the timestamp @var{end} will be the last
  15401. frame in the output.
  15402. @item start_pts
  15403. This is the same as @var{start}, except this option sets the start timestamp
  15404. in timebase units instead of seconds.
  15405. @item end_pts
  15406. This is the same as @var{end}, except this option sets the end timestamp
  15407. in timebase units instead of seconds.
  15408. @item duration
  15409. The maximum duration of the output in seconds.
  15410. @item start_frame
  15411. The number of the first frame that should be passed to the output.
  15412. @item end_frame
  15413. The number of the first frame that should be dropped.
  15414. @end table
  15415. @option{start}, @option{end}, and @option{duration} are expressed as time
  15416. duration specifications; see
  15417. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15418. for the accepted syntax.
  15419. Note that the first two sets of the start/end options and the @option{duration}
  15420. option look at the frame timestamp, while the _frame variants simply count the
  15421. frames that pass through the filter. Also note that this filter does not modify
  15422. the timestamps. If you wish for the output timestamps to start at zero, insert a
  15423. setpts filter after the trim filter.
  15424. If multiple start or end options are set, this filter tries to be greedy and
  15425. keep all the frames that match at least one of the specified constraints. To keep
  15426. only the part that matches all the constraints at once, chain multiple trim
  15427. filters.
  15428. The defaults are such that all the input is kept. So it is possible to set e.g.
  15429. just the end values to keep everything before the specified time.
  15430. Examples:
  15431. @itemize
  15432. @item
  15433. Drop everything except the second minute of input:
  15434. @example
  15435. ffmpeg -i INPUT -vf trim=60:120
  15436. @end example
  15437. @item
  15438. Keep only the first second:
  15439. @example
  15440. ffmpeg -i INPUT -vf trim=duration=1
  15441. @end example
  15442. @end itemize
  15443. @section unpremultiply
  15444. Apply alpha unpremultiply effect to input video stream using first plane
  15445. of second stream as alpha.
  15446. Both streams must have same dimensions and same pixel format.
  15447. The filter accepts the following option:
  15448. @table @option
  15449. @item planes
  15450. Set which planes will be processed, unprocessed planes will be copied.
  15451. By default value 0xf, all planes will be processed.
  15452. If the format has 1 or 2 components, then luma is bit 0.
  15453. If the format has 3 or 4 components:
  15454. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  15455. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  15456. If present, the alpha channel is always the last bit.
  15457. @item inplace
  15458. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15459. @end table
  15460. @anchor{unsharp}
  15461. @section unsharp
  15462. Sharpen or blur the input video.
  15463. It accepts the following parameters:
  15464. @table @option
  15465. @item luma_msize_x, lx
  15466. Set the luma matrix horizontal size. It must be an odd integer between
  15467. 3 and 23. The default value is 5.
  15468. @item luma_msize_y, ly
  15469. Set the luma matrix vertical size. It must be an odd integer between 3
  15470. and 23. The default value is 5.
  15471. @item luma_amount, la
  15472. Set the luma effect strength. It must be a floating point number, reasonable
  15473. values lay between -1.5 and 1.5.
  15474. Negative values will blur the input video, while positive values will
  15475. sharpen it, a value of zero will disable the effect.
  15476. Default value is 1.0.
  15477. @item chroma_msize_x, cx
  15478. Set the chroma matrix horizontal size. It must be an odd integer
  15479. between 3 and 23. The default value is 5.
  15480. @item chroma_msize_y, cy
  15481. Set the chroma matrix vertical size. It must be an odd integer
  15482. between 3 and 23. The default value is 5.
  15483. @item chroma_amount, ca
  15484. Set the chroma effect strength. It must be a floating point number, reasonable
  15485. values lay between -1.5 and 1.5.
  15486. Negative values will blur the input video, while positive values will
  15487. sharpen it, a value of zero will disable the effect.
  15488. Default value is 0.0.
  15489. @end table
  15490. All parameters are optional and default to the equivalent of the
  15491. string '5:5:1.0:5:5:0.0'.
  15492. @subsection Examples
  15493. @itemize
  15494. @item
  15495. Apply strong luma sharpen effect:
  15496. @example
  15497. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  15498. @end example
  15499. @item
  15500. Apply a strong blur of both luma and chroma parameters:
  15501. @example
  15502. unsharp=7:7:-2:7:7:-2
  15503. @end example
  15504. @end itemize
  15505. @anchor{untile}
  15506. @section untile
  15507. Decompose a video made of tiled images into the individual images.
  15508. The frame rate of the output video is the frame rate of the input video
  15509. multiplied by the number of tiles.
  15510. This filter does the reverse of @ref{tile}.
  15511. The filter accepts the following options:
  15512. @table @option
  15513. @item layout
  15514. Set the grid size (i.e. the number of lines and columns). For the syntax of
  15515. this option, check the
  15516. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15517. @end table
  15518. @subsection Examples
  15519. @itemize
  15520. @item
  15521. Produce a 1-second video from a still image file made of 25 frames stacked
  15522. vertically, like an analogic film reel:
  15523. @example
  15524. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  15525. @end example
  15526. @end itemize
  15527. @section uspp
  15528. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  15529. the image at several (or - in the case of @option{quality} level @code{8} - all)
  15530. shifts and average the results.
  15531. The way this differs from the behavior of spp is that uspp actually encodes &
  15532. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  15533. DCT similar to MJPEG.
  15534. The filter accepts the following options:
  15535. @table @option
  15536. @item quality
  15537. Set quality. This option defines the number of levels for averaging. It accepts
  15538. an integer in the range 0-8. If set to @code{0}, the filter will have no
  15539. effect. A value of @code{8} means the higher quality. For each increment of
  15540. that value the speed drops by a factor of approximately 2. Default value is
  15541. @code{3}.
  15542. @item qp
  15543. Force a constant quantization parameter. If not set, the filter will use the QP
  15544. from the video stream (if available).
  15545. @end table
  15546. @section v360
  15547. Convert 360 videos between various formats.
  15548. The filter accepts the following options:
  15549. @table @option
  15550. @item input
  15551. @item output
  15552. Set format of the input/output video.
  15553. Available formats:
  15554. @table @samp
  15555. @item e
  15556. @item equirect
  15557. Equirectangular projection.
  15558. @item c3x2
  15559. @item c6x1
  15560. @item c1x6
  15561. Cubemap with 3x2/6x1/1x6 layout.
  15562. Format specific options:
  15563. @table @option
  15564. @item in_pad
  15565. @item out_pad
  15566. Set padding proportion for the input/output cubemap. Values in decimals.
  15567. Example values:
  15568. @table @samp
  15569. @item 0
  15570. No padding.
  15571. @item 0.01
  15572. 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)
  15573. @end table
  15574. Default value is @b{@samp{0}}.
  15575. Maximum value is @b{@samp{0.1}}.
  15576. @item fin_pad
  15577. @item fout_pad
  15578. Set fixed padding for the input/output cubemap. Values in pixels.
  15579. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15580. @item in_forder
  15581. @item out_forder
  15582. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15583. Designation of directions:
  15584. @table @samp
  15585. @item r
  15586. right
  15587. @item l
  15588. left
  15589. @item u
  15590. up
  15591. @item d
  15592. down
  15593. @item f
  15594. forward
  15595. @item b
  15596. back
  15597. @end table
  15598. Default value is @b{@samp{rludfb}}.
  15599. @item in_frot
  15600. @item out_frot
  15601. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15602. Designation of angles:
  15603. @table @samp
  15604. @item 0
  15605. 0 degrees clockwise
  15606. @item 1
  15607. 90 degrees clockwise
  15608. @item 2
  15609. 180 degrees clockwise
  15610. @item 3
  15611. 270 degrees clockwise
  15612. @end table
  15613. Default value is @b{@samp{000000}}.
  15614. @end table
  15615. @item eac
  15616. Equi-Angular Cubemap.
  15617. @item flat
  15618. @item gnomonic
  15619. @item rectilinear
  15620. Regular video.
  15621. Format specific options:
  15622. @table @option
  15623. @item h_fov
  15624. @item v_fov
  15625. @item d_fov
  15626. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15627. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15628. @item ih_fov
  15629. @item iv_fov
  15630. @item id_fov
  15631. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15632. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15633. @end table
  15634. @item dfisheye
  15635. Dual fisheye.
  15636. Format specific options:
  15637. @table @option
  15638. @item h_fov
  15639. @item v_fov
  15640. @item d_fov
  15641. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15642. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15643. @item ih_fov
  15644. @item iv_fov
  15645. @item id_fov
  15646. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15647. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15648. @end table
  15649. @item barrel
  15650. @item fb
  15651. @item barrelsplit
  15652. Facebook's 360 formats.
  15653. @item sg
  15654. Stereographic format.
  15655. Format specific options:
  15656. @table @option
  15657. @item h_fov
  15658. @item v_fov
  15659. @item d_fov
  15660. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15661. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15662. @item ih_fov
  15663. @item iv_fov
  15664. @item id_fov
  15665. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15666. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15667. @end table
  15668. @item mercator
  15669. Mercator format.
  15670. @item ball
  15671. Ball format, gives significant distortion toward the back.
  15672. @item hammer
  15673. Hammer-Aitoff map projection format.
  15674. @item sinusoidal
  15675. Sinusoidal map projection format.
  15676. @item fisheye
  15677. Fisheye projection.
  15678. Format specific options:
  15679. @table @option
  15680. @item h_fov
  15681. @item v_fov
  15682. @item d_fov
  15683. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15684. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15685. @item ih_fov
  15686. @item iv_fov
  15687. @item id_fov
  15688. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15689. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15690. @end table
  15691. @item pannini
  15692. Pannini projection.
  15693. Format specific options:
  15694. @table @option
  15695. @item h_fov
  15696. Set output pannini parameter.
  15697. @item ih_fov
  15698. Set input pannini parameter.
  15699. @end table
  15700. @item cylindrical
  15701. Cylindrical projection.
  15702. Format specific options:
  15703. @table @option
  15704. @item h_fov
  15705. @item v_fov
  15706. @item d_fov
  15707. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15708. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15709. @item ih_fov
  15710. @item iv_fov
  15711. @item id_fov
  15712. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15713. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15714. @end table
  15715. @item perspective
  15716. Perspective projection. @i{(output only)}
  15717. Format specific options:
  15718. @table @option
  15719. @item v_fov
  15720. Set perspective parameter.
  15721. @end table
  15722. @item tetrahedron
  15723. Tetrahedron projection.
  15724. @item tsp
  15725. Truncated square pyramid projection.
  15726. @item he
  15727. @item hequirect
  15728. Half equirectangular projection.
  15729. @item equisolid
  15730. Equisolid format.
  15731. Format specific options:
  15732. @table @option
  15733. @item h_fov
  15734. @item v_fov
  15735. @item d_fov
  15736. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15737. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15738. @item ih_fov
  15739. @item iv_fov
  15740. @item id_fov
  15741. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15742. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15743. @end table
  15744. @item og
  15745. Orthographic format.
  15746. Format specific options:
  15747. @table @option
  15748. @item h_fov
  15749. @item v_fov
  15750. @item d_fov
  15751. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15752. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15753. @item ih_fov
  15754. @item iv_fov
  15755. @item id_fov
  15756. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15757. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15758. @end table
  15759. @item octahedron
  15760. Octahedron projection.
  15761. @end table
  15762. @item interp
  15763. Set interpolation method.@*
  15764. @i{Note: more complex interpolation methods require much more memory to run.}
  15765. Available methods:
  15766. @table @samp
  15767. @item near
  15768. @item nearest
  15769. Nearest neighbour.
  15770. @item line
  15771. @item linear
  15772. Bilinear interpolation.
  15773. @item lagrange9
  15774. Lagrange9 interpolation.
  15775. @item cube
  15776. @item cubic
  15777. Bicubic interpolation.
  15778. @item lanc
  15779. @item lanczos
  15780. Lanczos interpolation.
  15781. @item sp16
  15782. @item spline16
  15783. Spline16 interpolation.
  15784. @item gauss
  15785. @item gaussian
  15786. Gaussian interpolation.
  15787. @item mitchell
  15788. Mitchell interpolation.
  15789. @end table
  15790. Default value is @b{@samp{line}}.
  15791. @item w
  15792. @item h
  15793. Set the output video resolution.
  15794. Default resolution depends on formats.
  15795. @item in_stereo
  15796. @item out_stereo
  15797. Set the input/output stereo format.
  15798. @table @samp
  15799. @item 2d
  15800. 2D mono
  15801. @item sbs
  15802. Side by side
  15803. @item tb
  15804. Top bottom
  15805. @end table
  15806. Default value is @b{@samp{2d}} for input and output format.
  15807. @item yaw
  15808. @item pitch
  15809. @item roll
  15810. Set rotation for the output video. Values in degrees.
  15811. @item rorder
  15812. Set rotation order for the output video. Choose one item for each position.
  15813. @table @samp
  15814. @item y, Y
  15815. yaw
  15816. @item p, P
  15817. pitch
  15818. @item r, R
  15819. roll
  15820. @end table
  15821. Default value is @b{@samp{ypr}}.
  15822. @item h_flip
  15823. @item v_flip
  15824. @item d_flip
  15825. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15826. @item ih_flip
  15827. @item iv_flip
  15828. Set if input video is flipped horizontally/vertically. Boolean values.
  15829. @item in_trans
  15830. Set if input video is transposed. Boolean value, by default disabled.
  15831. @item out_trans
  15832. Set if output video needs to be transposed. Boolean value, by default disabled.
  15833. @item alpha_mask
  15834. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15835. @end table
  15836. @subsection Examples
  15837. @itemize
  15838. @item
  15839. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15840. @example
  15841. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15842. @end example
  15843. @item
  15844. Extract back view of Equi-Angular Cubemap:
  15845. @example
  15846. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15847. @end example
  15848. @item
  15849. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15850. @example
  15851. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15852. @end example
  15853. @end itemize
  15854. @subsection Commands
  15855. This filter supports subset of above options as @ref{commands}.
  15856. @section vaguedenoiser
  15857. Apply a wavelet based denoiser.
  15858. It transforms each frame from the video input into the wavelet domain,
  15859. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15860. the obtained coefficients. It does an inverse wavelet transform after.
  15861. Due to wavelet properties, it should give a nice smoothed result, and
  15862. reduced noise, without blurring picture features.
  15863. This filter accepts the following options:
  15864. @table @option
  15865. @item threshold
  15866. The filtering strength. The higher, the more filtered the video will be.
  15867. Hard thresholding can use a higher threshold than soft thresholding
  15868. before the video looks overfiltered. Default value is 2.
  15869. @item method
  15870. The filtering method the filter will use.
  15871. It accepts the following values:
  15872. @table @samp
  15873. @item hard
  15874. All values under the threshold will be zeroed.
  15875. @item soft
  15876. All values under the threshold will be zeroed. All values above will be
  15877. reduced by the threshold.
  15878. @item garrote
  15879. Scales or nullifies coefficients - intermediary between (more) soft and
  15880. (less) hard thresholding.
  15881. @end table
  15882. Default is garrote.
  15883. @item nsteps
  15884. Number of times, the wavelet will decompose the picture. Picture can't
  15885. be decomposed beyond a particular point (typically, 8 for a 640x480
  15886. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15887. @item percent
  15888. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15889. @item planes
  15890. A list of the planes to process. By default all planes are processed.
  15891. @item type
  15892. The threshold type the filter will use.
  15893. It accepts the following values:
  15894. @table @samp
  15895. @item universal
  15896. Threshold used is same for all decompositions.
  15897. @item bayes
  15898. Threshold used depends also on each decomposition coefficients.
  15899. @end table
  15900. Default is universal.
  15901. @end table
  15902. @section vectorscope
  15903. Display 2 color component values in the two dimensional graph (which is called
  15904. a vectorscope).
  15905. This filter accepts the following options:
  15906. @table @option
  15907. @item mode, m
  15908. Set vectorscope mode.
  15909. It accepts the following values:
  15910. @table @samp
  15911. @item gray
  15912. @item tint
  15913. Gray values are displayed on graph, higher brightness means more pixels have
  15914. same component color value on location in graph. This is the default mode.
  15915. @item color
  15916. Gray values are displayed on graph. Surrounding pixels values which are not
  15917. present in video frame are drawn in gradient of 2 color components which are
  15918. set by option @code{x} and @code{y}. The 3rd color component is static.
  15919. @item color2
  15920. Actual color components values present in video frame are displayed on graph.
  15921. @item color3
  15922. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15923. on graph increases value of another color component, which is luminance by
  15924. default values of @code{x} and @code{y}.
  15925. @item color4
  15926. Actual colors present in video frame are displayed on graph. If two different
  15927. colors map to same position on graph then color with higher value of component
  15928. not present in graph is picked.
  15929. @item color5
  15930. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15931. component picked from radial gradient.
  15932. @end table
  15933. @item x
  15934. Set which color component will be represented on X-axis. Default is @code{1}.
  15935. @item y
  15936. Set which color component will be represented on Y-axis. Default is @code{2}.
  15937. @item intensity, i
  15938. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15939. of color component which represents frequency of (X, Y) location in graph.
  15940. @item envelope, e
  15941. @table @samp
  15942. @item none
  15943. No envelope, this is default.
  15944. @item instant
  15945. Instant envelope, even darkest single pixel will be clearly highlighted.
  15946. @item peak
  15947. Hold maximum and minimum values presented in graph over time. This way you
  15948. can still spot out of range values without constantly looking at vectorscope.
  15949. @item peak+instant
  15950. Peak and instant envelope combined together.
  15951. @end table
  15952. @item graticule, g
  15953. Set what kind of graticule to draw.
  15954. @table @samp
  15955. @item none
  15956. @item green
  15957. @item color
  15958. @item invert
  15959. @end table
  15960. @item opacity, o
  15961. Set graticule opacity.
  15962. @item flags, f
  15963. Set graticule flags.
  15964. @table @samp
  15965. @item white
  15966. Draw graticule for white point.
  15967. @item black
  15968. Draw graticule for black point.
  15969. @item name
  15970. Draw color points short names.
  15971. @end table
  15972. @item bgopacity, b
  15973. Set background opacity.
  15974. @item lthreshold, l
  15975. Set low threshold for color component not represented on X or Y axis.
  15976. Values lower than this value will be ignored. Default is 0.
  15977. Note this value is multiplied with actual max possible value one pixel component
  15978. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15979. is 0.1 * 255 = 25.
  15980. @item hthreshold, h
  15981. Set high threshold for color component not represented on X or Y axis.
  15982. Values higher than this value will be ignored. Default is 1.
  15983. Note this value is multiplied with actual max possible value one pixel component
  15984. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15985. is 0.9 * 255 = 230.
  15986. @item colorspace, c
  15987. Set what kind of colorspace to use when drawing graticule.
  15988. @table @samp
  15989. @item auto
  15990. @item 601
  15991. @item 709
  15992. @end table
  15993. Default is auto.
  15994. @item tint0, t0
  15995. @item tint1, t1
  15996. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15997. This means no tint, and output will remain gray.
  15998. @end table
  15999. @anchor{vidstabdetect}
  16000. @section vidstabdetect
  16001. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  16002. @ref{vidstabtransform} for pass 2.
  16003. This filter generates a file with relative translation and rotation
  16004. transform information about subsequent frames, which is then used by
  16005. the @ref{vidstabtransform} filter.
  16006. To enable compilation of this filter you need to configure FFmpeg with
  16007. @code{--enable-libvidstab}.
  16008. This filter accepts the following options:
  16009. @table @option
  16010. @item result
  16011. Set the path to the file used to write the transforms information.
  16012. Default value is @file{transforms.trf}.
  16013. @item shakiness
  16014. Set how shaky the video is and how quick the camera is. It accepts an
  16015. integer in the range 1-10, a value of 1 means little shakiness, a
  16016. value of 10 means strong shakiness. Default value is 5.
  16017. @item accuracy
  16018. Set the accuracy of the detection process. It must be a value in the
  16019. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  16020. accuracy. Default value is 15.
  16021. @item stepsize
  16022. Set stepsize of the search process. The region around minimum is
  16023. scanned with 1 pixel resolution. Default value is 6.
  16024. @item mincontrast
  16025. Set minimum contrast. Below this value a local measurement field is
  16026. discarded. Must be a floating point value in the range 0-1. Default
  16027. value is 0.3.
  16028. @item tripod
  16029. Set reference frame number for tripod mode.
  16030. If enabled, the motion of the frames is compared to a reference frame
  16031. in the filtered stream, identified by the specified number. The idea
  16032. is to compensate all movements in a more-or-less static scene and keep
  16033. the camera view absolutely still.
  16034. If set to 0, it is disabled. The frames are counted starting from 1.
  16035. @item show
  16036. Show fields and transforms in the resulting frames. It accepts an
  16037. integer in the range 0-2. Default value is 0, which disables any
  16038. visualization.
  16039. @end table
  16040. @subsection Examples
  16041. @itemize
  16042. @item
  16043. Use default values:
  16044. @example
  16045. vidstabdetect
  16046. @end example
  16047. @item
  16048. Analyze strongly shaky movie and put the results in file
  16049. @file{mytransforms.trf}:
  16050. @example
  16051. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  16052. @end example
  16053. @item
  16054. Visualize the result of internal transformations in the resulting
  16055. video:
  16056. @example
  16057. vidstabdetect=show=1
  16058. @end example
  16059. @item
  16060. Analyze a video with medium shakiness using @command{ffmpeg}:
  16061. @example
  16062. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  16063. @end example
  16064. @end itemize
  16065. @anchor{vidstabtransform}
  16066. @section vidstabtransform
  16067. Video stabilization/deshaking: pass 2 of 2,
  16068. see @ref{vidstabdetect} for pass 1.
  16069. Read a file with transform information for each frame and
  16070. apply/compensate them. Together with the @ref{vidstabdetect}
  16071. filter this can be used to deshake videos. See also
  16072. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  16073. the @ref{unsharp} filter, see below.
  16074. To enable compilation of this filter you need to configure FFmpeg with
  16075. @code{--enable-libvidstab}.
  16076. @subsection Options
  16077. @table @option
  16078. @item input
  16079. Set path to the file used to read the transforms. Default value is
  16080. @file{transforms.trf}.
  16081. @item smoothing
  16082. Set the number of frames (value*2 + 1) used for lowpass filtering the
  16083. camera movements. Default value is 10.
  16084. For example a number of 10 means that 21 frames are used (10 in the
  16085. past and 10 in the future) to smoothen the motion in the video. A
  16086. larger value leads to a smoother video, but limits the acceleration of
  16087. the camera (pan/tilt movements). 0 is a special case where a static
  16088. camera is simulated.
  16089. @item optalgo
  16090. Set the camera path optimization algorithm.
  16091. Accepted values are:
  16092. @table @samp
  16093. @item gauss
  16094. gaussian kernel low-pass filter on camera motion (default)
  16095. @item avg
  16096. averaging on transformations
  16097. @end table
  16098. @item maxshift
  16099. Set maximal number of pixels to translate frames. Default value is -1,
  16100. meaning no limit.
  16101. @item maxangle
  16102. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  16103. value is -1, meaning no limit.
  16104. @item crop
  16105. Specify how to deal with borders that may be visible due to movement
  16106. compensation.
  16107. Available values are:
  16108. @table @samp
  16109. @item keep
  16110. keep image information from previous frame (default)
  16111. @item black
  16112. fill the border black
  16113. @end table
  16114. @item invert
  16115. Invert transforms if set to 1. Default value is 0.
  16116. @item relative
  16117. Consider transforms as relative to previous frame if set to 1,
  16118. absolute if set to 0. Default value is 0.
  16119. @item zoom
  16120. Set percentage to zoom. A positive value will result in a zoom-in
  16121. effect, a negative value in a zoom-out effect. Default value is 0 (no
  16122. zoom).
  16123. @item optzoom
  16124. Set optimal zooming to avoid borders.
  16125. Accepted values are:
  16126. @table @samp
  16127. @item 0
  16128. disabled
  16129. @item 1
  16130. optimal static zoom value is determined (only very strong movements
  16131. will lead to visible borders) (default)
  16132. @item 2
  16133. optimal adaptive zoom value is determined (no borders will be
  16134. visible), see @option{zoomspeed}
  16135. @end table
  16136. Note that the value given at zoom is added to the one calculated here.
  16137. @item zoomspeed
  16138. Set percent to zoom maximally each frame (enabled when
  16139. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  16140. 0.25.
  16141. @item interpol
  16142. Specify type of interpolation.
  16143. Available values are:
  16144. @table @samp
  16145. @item no
  16146. no interpolation
  16147. @item linear
  16148. linear only horizontal
  16149. @item bilinear
  16150. linear in both directions (default)
  16151. @item bicubic
  16152. cubic in both directions (slow)
  16153. @end table
  16154. @item tripod
  16155. Enable virtual tripod mode if set to 1, which is equivalent to
  16156. @code{relative=0:smoothing=0}. Default value is 0.
  16157. Use also @code{tripod} option of @ref{vidstabdetect}.
  16158. @item debug
  16159. Increase log verbosity if set to 1. Also the detected global motions
  16160. are written to the temporary file @file{global_motions.trf}. Default
  16161. value is 0.
  16162. @end table
  16163. @subsection Examples
  16164. @itemize
  16165. @item
  16166. Use @command{ffmpeg} for a typical stabilization with default values:
  16167. @example
  16168. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  16169. @end example
  16170. Note the use of the @ref{unsharp} filter which is always recommended.
  16171. @item
  16172. Zoom in a bit more and load transform data from a given file:
  16173. @example
  16174. vidstabtransform=zoom=5:input="mytransforms.trf"
  16175. @end example
  16176. @item
  16177. Smoothen the video even more:
  16178. @example
  16179. vidstabtransform=smoothing=30
  16180. @end example
  16181. @end itemize
  16182. @section vflip
  16183. Flip the input video vertically.
  16184. For example, to vertically flip a video with @command{ffmpeg}:
  16185. @example
  16186. ffmpeg -i in.avi -vf "vflip" out.avi
  16187. @end example
  16188. @section vfrdet
  16189. Detect variable frame rate video.
  16190. This filter tries to detect if the input is variable or constant frame rate.
  16191. At end it will output number of frames detected as having variable delta pts,
  16192. and ones with constant delta pts.
  16193. If there was frames with variable delta, than it will also show min, max and
  16194. average delta encountered.
  16195. @section vibrance
  16196. Boost or alter saturation.
  16197. The filter accepts the following options:
  16198. @table @option
  16199. @item intensity
  16200. Set strength of boost if positive value or strength of alter if negative value.
  16201. Default is 0. Allowed range is from -2 to 2.
  16202. @item rbal
  16203. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  16204. @item gbal
  16205. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  16206. @item bbal
  16207. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  16208. @item rlum
  16209. Set the red luma coefficient.
  16210. @item glum
  16211. Set the green luma coefficient.
  16212. @item blum
  16213. Set the blue luma coefficient.
  16214. @item alternate
  16215. If @code{intensity} is negative and this is set to 1, colors will change,
  16216. otherwise colors will be less saturated, more towards gray.
  16217. @end table
  16218. @subsection Commands
  16219. This filter supports the all above options as @ref{commands}.
  16220. @section vif
  16221. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  16222. This filter takes two input videos.
  16223. Both input videos must have the same resolution and pixel format for
  16224. this filter to work correctly. Also it assumes that both inputs
  16225. have the same number of frames, which are compared one by one.
  16226. The obtained average VIF score is printed through the logging system.
  16227. The filter stores the calculated VIF score of each frame.
  16228. In the below example the input file @file{main.mpg} being processed is compared
  16229. with the reference file @file{ref.mpg}.
  16230. @example
  16231. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  16232. @end example
  16233. @anchor{vignette}
  16234. @section vignette
  16235. Make or reverse a natural vignetting effect.
  16236. The filter accepts the following options:
  16237. @table @option
  16238. @item angle, a
  16239. Set lens angle expression as a number of radians.
  16240. The value is clipped in the @code{[0,PI/2]} range.
  16241. Default value: @code{"PI/5"}
  16242. @item x0
  16243. @item y0
  16244. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  16245. by default.
  16246. @item mode
  16247. Set forward/backward mode.
  16248. Available modes are:
  16249. @table @samp
  16250. @item forward
  16251. The larger the distance from the central point, the darker the image becomes.
  16252. @item backward
  16253. The larger the distance from the central point, the brighter the image becomes.
  16254. This can be used to reverse a vignette effect, though there is no automatic
  16255. detection to extract the lens @option{angle} and other settings (yet). It can
  16256. also be used to create a burning effect.
  16257. @end table
  16258. Default value is @samp{forward}.
  16259. @item eval
  16260. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  16261. It accepts the following values:
  16262. @table @samp
  16263. @item init
  16264. Evaluate expressions only once during the filter initialization.
  16265. @item frame
  16266. Evaluate expressions for each incoming frame. This is way slower than the
  16267. @samp{init} mode since it requires all the scalers to be re-computed, but it
  16268. allows advanced dynamic expressions.
  16269. @end table
  16270. Default value is @samp{init}.
  16271. @item dither
  16272. Set dithering to reduce the circular banding effects. Default is @code{1}
  16273. (enabled).
  16274. @item aspect
  16275. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  16276. Setting this value to the SAR of the input will make a rectangular vignetting
  16277. following the dimensions of the video.
  16278. Default is @code{1/1}.
  16279. @end table
  16280. @subsection Expressions
  16281. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  16282. following parameters.
  16283. @table @option
  16284. @item w
  16285. @item h
  16286. input width and height
  16287. @item n
  16288. the number of input frame, starting from 0
  16289. @item pts
  16290. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  16291. @var{TB} units, NAN if undefined
  16292. @item r
  16293. frame rate of the input video, NAN if the input frame rate is unknown
  16294. @item t
  16295. the PTS (Presentation TimeStamp) of the filtered video frame,
  16296. expressed in seconds, NAN if undefined
  16297. @item tb
  16298. time base of the input video
  16299. @end table
  16300. @subsection Examples
  16301. @itemize
  16302. @item
  16303. Apply simple strong vignetting effect:
  16304. @example
  16305. vignette=PI/4
  16306. @end example
  16307. @item
  16308. Make a flickering vignetting:
  16309. @example
  16310. vignette='PI/4+random(1)*PI/50':eval=frame
  16311. @end example
  16312. @end itemize
  16313. @section vmafmotion
  16314. Obtain the average VMAF motion score of a video.
  16315. It is one of the component metrics of VMAF.
  16316. The obtained average motion score is printed through the logging system.
  16317. The filter accepts the following options:
  16318. @table @option
  16319. @item stats_file
  16320. If specified, the filter will use the named file to save the motion score of
  16321. each frame with respect to the previous frame.
  16322. When filename equals "-" the data is sent to standard output.
  16323. @end table
  16324. Example:
  16325. @example
  16326. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  16327. @end example
  16328. @section vstack
  16329. Stack input videos vertically.
  16330. All streams must be of same pixel format and of same width.
  16331. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  16332. to create same output.
  16333. The filter accepts the following options:
  16334. @table @option
  16335. @item inputs
  16336. Set number of input streams. Default is 2.
  16337. @item shortest
  16338. If set to 1, force the output to terminate when the shortest input
  16339. terminates. Default value is 0.
  16340. @end table
  16341. @section w3fdif
  16342. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  16343. Deinterlacing Filter").
  16344. Based on the process described by Martin Weston for BBC R&D, and
  16345. implemented based on the de-interlace algorithm written by Jim
  16346. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  16347. uses filter coefficients calculated by BBC R&D.
  16348. This filter uses field-dominance information in frame to decide which
  16349. of each pair of fields to place first in the output.
  16350. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  16351. There are two sets of filter coefficients, so called "simple"
  16352. and "complex". Which set of filter coefficients is used can
  16353. be set by passing an optional parameter:
  16354. @table @option
  16355. @item filter
  16356. Set the interlacing filter coefficients. Accepts one of the following values:
  16357. @table @samp
  16358. @item simple
  16359. Simple filter coefficient set.
  16360. @item complex
  16361. More-complex filter coefficient set.
  16362. @end table
  16363. Default value is @samp{complex}.
  16364. @item mode
  16365. The interlacing mode to adopt. It accepts one of the following values:
  16366. @table @option
  16367. @item frame
  16368. Output one frame for each frame.
  16369. @item field
  16370. Output one frame for each field.
  16371. @end table
  16372. The default value is @code{field}.
  16373. @item parity
  16374. The picture field parity assumed for the input interlaced video. It accepts one
  16375. of the following values:
  16376. @table @option
  16377. @item tff
  16378. Assume the top field is first.
  16379. @item bff
  16380. Assume the bottom field is first.
  16381. @item auto
  16382. Enable automatic detection of field parity.
  16383. @end table
  16384. The default value is @code{auto}.
  16385. If the interlacing is unknown or the decoder does not export this information,
  16386. top field first will be assumed.
  16387. @item deint
  16388. Specify which frames to deinterlace. Accepts one of the following values:
  16389. @table @samp
  16390. @item all
  16391. Deinterlace all frames,
  16392. @item interlaced
  16393. Only deinterlace frames marked as interlaced.
  16394. @end table
  16395. Default value is @samp{all}.
  16396. @end table
  16397. @subsection Commands
  16398. This filter supports same @ref{commands} as options.
  16399. @section waveform
  16400. Video waveform monitor.
  16401. The waveform monitor plots color component intensity. By default luminance
  16402. only. Each column of the waveform corresponds to a column of pixels in the
  16403. source video.
  16404. It accepts the following options:
  16405. @table @option
  16406. @item mode, m
  16407. Can be either @code{row}, or @code{column}. Default is @code{column}.
  16408. In row mode, the graph on the left side represents color component value 0 and
  16409. the right side represents value = 255. In column mode, the top side represents
  16410. color component value = 0 and bottom side represents value = 255.
  16411. @item intensity, i
  16412. Set intensity. Smaller values are useful to find out how many values of the same
  16413. luminance are distributed across input rows/columns.
  16414. Default value is @code{0.04}. Allowed range is [0, 1].
  16415. @item mirror, r
  16416. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  16417. In mirrored mode, higher values will be represented on the left
  16418. side for @code{row} mode and at the top for @code{column} mode. Default is
  16419. @code{1} (mirrored).
  16420. @item display, d
  16421. Set display mode.
  16422. It accepts the following values:
  16423. @table @samp
  16424. @item overlay
  16425. Presents information identical to that in the @code{parade}, except
  16426. that the graphs representing color components are superimposed directly
  16427. over one another.
  16428. This display mode makes it easier to spot relative differences or similarities
  16429. in overlapping areas of the color components that are supposed to be identical,
  16430. such as neutral whites, grays, or blacks.
  16431. @item stack
  16432. Display separate graph for the color components side by side in
  16433. @code{row} mode or one below the other in @code{column} mode.
  16434. @item parade
  16435. Display separate graph for the color components side by side in
  16436. @code{column} mode or one below the other in @code{row} mode.
  16437. Using this display mode makes it easy to spot color casts in the highlights
  16438. and shadows of an image, by comparing the contours of the top and the bottom
  16439. graphs of each waveform. Since whites, grays, and blacks are characterized
  16440. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  16441. should display three waveforms of roughly equal width/height. If not, the
  16442. correction is easy to perform by making level adjustments the three waveforms.
  16443. @end table
  16444. Default is @code{stack}.
  16445. @item components, c
  16446. Set which color components to display. Default is 1, which means only luminance
  16447. or red color component if input is in RGB colorspace. If is set for example to
  16448. 7 it will display all 3 (if) available color components.
  16449. @item envelope, e
  16450. @table @samp
  16451. @item none
  16452. No envelope, this is default.
  16453. @item instant
  16454. Instant envelope, minimum and maximum values presented in graph will be easily
  16455. visible even with small @code{step} value.
  16456. @item peak
  16457. Hold minimum and maximum values presented in graph across time. This way you
  16458. can still spot out of range values without constantly looking at waveforms.
  16459. @item peak+instant
  16460. Peak and instant envelope combined together.
  16461. @end table
  16462. @item filter, f
  16463. @table @samp
  16464. @item lowpass
  16465. No filtering, this is default.
  16466. @item flat
  16467. Luma and chroma combined together.
  16468. @item aflat
  16469. Similar as above, but shows difference between blue and red chroma.
  16470. @item xflat
  16471. Similar as above, but use different colors.
  16472. @item yflat
  16473. Similar as above, but again with different colors.
  16474. @item chroma
  16475. Displays only chroma.
  16476. @item color
  16477. Displays actual color value on waveform.
  16478. @item acolor
  16479. Similar as above, but with luma showing frequency of chroma values.
  16480. @end table
  16481. @item graticule, g
  16482. Set which graticule to display.
  16483. @table @samp
  16484. @item none
  16485. Do not display graticule.
  16486. @item green
  16487. Display green graticule showing legal broadcast ranges.
  16488. @item orange
  16489. Display orange graticule showing legal broadcast ranges.
  16490. @item invert
  16491. Display invert graticule showing legal broadcast ranges.
  16492. @end table
  16493. @item opacity, o
  16494. Set graticule opacity.
  16495. @item flags, fl
  16496. Set graticule flags.
  16497. @table @samp
  16498. @item numbers
  16499. Draw numbers above lines. By default enabled.
  16500. @item dots
  16501. Draw dots instead of lines.
  16502. @end table
  16503. @item scale, s
  16504. Set scale used for displaying graticule.
  16505. @table @samp
  16506. @item digital
  16507. @item millivolts
  16508. @item ire
  16509. @end table
  16510. Default is digital.
  16511. @item bgopacity, b
  16512. Set background opacity.
  16513. @item tint0, t0
  16514. @item tint1, t1
  16515. Set tint for output.
  16516. Only used with lowpass filter and when display is not overlay and input
  16517. pixel formats are not RGB.
  16518. @end table
  16519. @section weave, doubleweave
  16520. The @code{weave} takes a field-based video input and join
  16521. each two sequential fields into single frame, producing a new double
  16522. height clip with half the frame rate and half the frame count.
  16523. The @code{doubleweave} works same as @code{weave} but without
  16524. halving frame rate and frame count.
  16525. It accepts the following option:
  16526. @table @option
  16527. @item first_field
  16528. Set first field. Available values are:
  16529. @table @samp
  16530. @item top, t
  16531. Set the frame as top-field-first.
  16532. @item bottom, b
  16533. Set the frame as bottom-field-first.
  16534. @end table
  16535. @end table
  16536. @subsection Examples
  16537. @itemize
  16538. @item
  16539. Interlace video using @ref{select} and @ref{separatefields} filter:
  16540. @example
  16541. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  16542. @end example
  16543. @end itemize
  16544. @section xbr
  16545. Apply the xBR high-quality magnification filter which is designed for pixel
  16546. art. It follows a set of edge-detection rules, see
  16547. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  16548. It accepts the following option:
  16549. @table @option
  16550. @item n
  16551. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  16552. @code{3xBR} and @code{4} for @code{4xBR}.
  16553. Default is @code{3}.
  16554. @end table
  16555. @section xfade
  16556. Apply cross fade from one input video stream to another input video stream.
  16557. The cross fade is applied for specified duration.
  16558. The filter accepts the following options:
  16559. @table @option
  16560. @item transition
  16561. Set one of available transition effects:
  16562. @table @samp
  16563. @item custom
  16564. @item fade
  16565. @item wipeleft
  16566. @item wiperight
  16567. @item wipeup
  16568. @item wipedown
  16569. @item slideleft
  16570. @item slideright
  16571. @item slideup
  16572. @item slidedown
  16573. @item circlecrop
  16574. @item rectcrop
  16575. @item distance
  16576. @item fadeblack
  16577. @item fadewhite
  16578. @item radial
  16579. @item smoothleft
  16580. @item smoothright
  16581. @item smoothup
  16582. @item smoothdown
  16583. @item circleopen
  16584. @item circleclose
  16585. @item vertopen
  16586. @item vertclose
  16587. @item horzopen
  16588. @item horzclose
  16589. @item dissolve
  16590. @item pixelize
  16591. @item diagtl
  16592. @item diagtr
  16593. @item diagbl
  16594. @item diagbr
  16595. @item hlslice
  16596. @item hrslice
  16597. @item vuslice
  16598. @item vdslice
  16599. @item hblur
  16600. @item fadegrays
  16601. @item wipetl
  16602. @item wipetr
  16603. @item wipebl
  16604. @item wipebr
  16605. @item squeezeh
  16606. @item squeezev
  16607. @end table
  16608. Default transition effect is fade.
  16609. @item duration
  16610. Set cross fade duration in seconds.
  16611. Default duration is 1 second.
  16612. @item offset
  16613. Set cross fade start relative to first input stream in seconds.
  16614. Default offset is 0.
  16615. @item expr
  16616. Set expression for custom transition effect.
  16617. The expressions can use the following variables and functions:
  16618. @table @option
  16619. @item X
  16620. @item Y
  16621. The coordinates of the current sample.
  16622. @item W
  16623. @item H
  16624. The width and height of the image.
  16625. @item P
  16626. Progress of transition effect.
  16627. @item PLANE
  16628. Currently processed plane.
  16629. @item A
  16630. Return value of first input at current location and plane.
  16631. @item B
  16632. Return value of second input at current location and plane.
  16633. @item a0(x, y)
  16634. @item a1(x, y)
  16635. @item a2(x, y)
  16636. @item a3(x, y)
  16637. Return the value of the pixel at location (@var{x},@var{y}) of the
  16638. first/second/third/fourth component of first input.
  16639. @item b0(x, y)
  16640. @item b1(x, y)
  16641. @item b2(x, y)
  16642. @item b3(x, y)
  16643. Return the value of the pixel at location (@var{x},@var{y}) of the
  16644. first/second/third/fourth component of second input.
  16645. @end table
  16646. @end table
  16647. @subsection Examples
  16648. @itemize
  16649. @item
  16650. Cross fade from one input video to another input video, with fade transition and duration of transition
  16651. of 2 seconds starting at offset of 5 seconds:
  16652. @example
  16653. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16654. @end example
  16655. @end itemize
  16656. @section xmedian
  16657. Pick median pixels from several input videos.
  16658. The filter accepts the following options:
  16659. @table @option
  16660. @item inputs
  16661. Set number of inputs.
  16662. Default is 3. Allowed range is from 3 to 255.
  16663. If number of inputs is even number, than result will be mean value between two median values.
  16664. @item planes
  16665. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16666. @item percentile
  16667. Set median percentile. Default value is @code{0.5}.
  16668. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16669. minimum values, and @code{1} maximum values.
  16670. @end table
  16671. @subsection Commands
  16672. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  16673. @section xstack
  16674. Stack video inputs into custom layout.
  16675. All streams must be of same pixel format.
  16676. The filter accepts the following options:
  16677. @table @option
  16678. @item inputs
  16679. Set number of input streams. Default is 2.
  16680. @item layout
  16681. Specify layout of inputs.
  16682. This option requires the desired layout configuration to be explicitly set by the user.
  16683. This sets position of each video input in output. Each input
  16684. is separated by '|'.
  16685. The first number represents the column, and the second number represents the row.
  16686. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16687. where X is video input from which to take width or height.
  16688. Multiple values can be used when separated by '+'. In such
  16689. case values are summed together.
  16690. Note that if inputs are of different sizes gaps may appear, as not all of
  16691. the output video frame will be filled. Similarly, videos can overlap each
  16692. other if their position doesn't leave enough space for the full frame of
  16693. adjoining videos.
  16694. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16695. a layout must be set by the user.
  16696. @item shortest
  16697. If set to 1, force the output to terminate when the shortest input
  16698. terminates. Default value is 0.
  16699. @item fill
  16700. If set to valid color, all unused pixels will be filled with that color.
  16701. By default fill is set to none, so it is disabled.
  16702. @end table
  16703. @subsection Examples
  16704. @itemize
  16705. @item
  16706. Display 4 inputs into 2x2 grid.
  16707. Layout:
  16708. @example
  16709. input1(0, 0) | input3(w0, 0)
  16710. input2(0, h0) | input4(w0, h0)
  16711. @end example
  16712. @example
  16713. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16714. @end example
  16715. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16716. @item
  16717. Display 4 inputs into 1x4 grid.
  16718. Layout:
  16719. @example
  16720. input1(0, 0)
  16721. input2(0, h0)
  16722. input3(0, h0+h1)
  16723. input4(0, h0+h1+h2)
  16724. @end example
  16725. @example
  16726. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16727. @end example
  16728. Note that if inputs are of different widths, unused space will appear.
  16729. @item
  16730. Display 9 inputs into 3x3 grid.
  16731. Layout:
  16732. @example
  16733. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16734. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16735. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16736. @end example
  16737. @example
  16738. 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
  16739. @end example
  16740. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16741. @item
  16742. Display 16 inputs into 4x4 grid.
  16743. Layout:
  16744. @example
  16745. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16746. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16747. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16748. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16749. @end example
  16750. @example
  16751. 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|
  16752. 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
  16753. @end example
  16754. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16755. @end itemize
  16756. @anchor{yadif}
  16757. @section yadif
  16758. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16759. filter").
  16760. It accepts the following parameters:
  16761. @table @option
  16762. @item mode
  16763. The interlacing mode to adopt. It accepts one of the following values:
  16764. @table @option
  16765. @item 0, send_frame
  16766. Output one frame for each frame.
  16767. @item 1, send_field
  16768. Output one frame for each field.
  16769. @item 2, send_frame_nospatial
  16770. Like @code{send_frame}, but it skips the spatial interlacing check.
  16771. @item 3, send_field_nospatial
  16772. Like @code{send_field}, but it skips the spatial interlacing check.
  16773. @end table
  16774. The default value is @code{send_frame}.
  16775. @item parity
  16776. The picture field parity assumed for the input interlaced video. It accepts one
  16777. of the following values:
  16778. @table @option
  16779. @item 0, tff
  16780. Assume the top field is first.
  16781. @item 1, bff
  16782. Assume the bottom field is first.
  16783. @item -1, auto
  16784. Enable automatic detection of field parity.
  16785. @end table
  16786. The default value is @code{auto}.
  16787. If the interlacing is unknown or the decoder does not export this information,
  16788. top field first will be assumed.
  16789. @item deint
  16790. Specify which frames to deinterlace. Accepts one of the following
  16791. values:
  16792. @table @option
  16793. @item 0, all
  16794. Deinterlace all frames.
  16795. @item 1, interlaced
  16796. Only deinterlace frames marked as interlaced.
  16797. @end table
  16798. The default value is @code{all}.
  16799. @end table
  16800. @section yadif_cuda
  16801. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16802. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16803. and/or nvenc.
  16804. It accepts the following parameters:
  16805. @table @option
  16806. @item mode
  16807. The interlacing mode to adopt. It accepts one of the following values:
  16808. @table @option
  16809. @item 0, send_frame
  16810. Output one frame for each frame.
  16811. @item 1, send_field
  16812. Output one frame for each field.
  16813. @item 2, send_frame_nospatial
  16814. Like @code{send_frame}, but it skips the spatial interlacing check.
  16815. @item 3, send_field_nospatial
  16816. Like @code{send_field}, but it skips the spatial interlacing check.
  16817. @end table
  16818. The default value is @code{send_frame}.
  16819. @item parity
  16820. The picture field parity assumed for the input interlaced video. It accepts one
  16821. of the following values:
  16822. @table @option
  16823. @item 0, tff
  16824. Assume the top field is first.
  16825. @item 1, bff
  16826. Assume the bottom field is first.
  16827. @item -1, auto
  16828. Enable automatic detection of field parity.
  16829. @end table
  16830. The default value is @code{auto}.
  16831. If the interlacing is unknown or the decoder does not export this information,
  16832. top field first will be assumed.
  16833. @item deint
  16834. Specify which frames to deinterlace. Accepts one of the following
  16835. values:
  16836. @table @option
  16837. @item 0, all
  16838. Deinterlace all frames.
  16839. @item 1, interlaced
  16840. Only deinterlace frames marked as interlaced.
  16841. @end table
  16842. The default value is @code{all}.
  16843. @end table
  16844. @section yaepblur
  16845. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16846. The algorithm is described in
  16847. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16848. It accepts the following parameters:
  16849. @table @option
  16850. @item radius, r
  16851. Set the window radius. Default value is 3.
  16852. @item planes, p
  16853. Set which planes to filter. Default is only the first plane.
  16854. @item sigma, s
  16855. Set blur strength. Default value is 128.
  16856. @end table
  16857. @subsection Commands
  16858. This filter supports same @ref{commands} as options.
  16859. @section zoompan
  16860. Apply Zoom & Pan effect.
  16861. This filter accepts the following options:
  16862. @table @option
  16863. @item zoom, z
  16864. Set the zoom expression. Range is 1-10. Default is 1.
  16865. @item x
  16866. @item y
  16867. Set the x and y expression. Default is 0.
  16868. @item d
  16869. Set the duration expression in number of frames.
  16870. This sets for how many number of frames effect will last for
  16871. single input image. Default is 90.
  16872. @item s
  16873. Set the output image size, default is 'hd720'.
  16874. @item fps
  16875. Set the output frame rate, default is '25'.
  16876. @end table
  16877. Each expression can contain the following constants:
  16878. @table @option
  16879. @item in_w, iw
  16880. Input width.
  16881. @item in_h, ih
  16882. Input height.
  16883. @item out_w, ow
  16884. Output width.
  16885. @item out_h, oh
  16886. Output height.
  16887. @item in
  16888. Input frame count.
  16889. @item on
  16890. Output frame count.
  16891. @item in_time, it
  16892. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16893. @item out_time, time, ot
  16894. The output timestamp expressed in seconds.
  16895. @item x
  16896. @item y
  16897. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16898. for current input frame.
  16899. @item px
  16900. @item py
  16901. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16902. not yet such frame (first input frame).
  16903. @item zoom
  16904. Last calculated zoom from 'z' expression for current input frame.
  16905. @item pzoom
  16906. Last calculated zoom of last output frame of previous input frame.
  16907. @item duration
  16908. Number of output frames for current input frame. Calculated from 'd' expression
  16909. for each input frame.
  16910. @item pduration
  16911. number of output frames created for previous input frame
  16912. @item a
  16913. Rational number: input width / input height
  16914. @item sar
  16915. sample aspect ratio
  16916. @item dar
  16917. display aspect ratio
  16918. @end table
  16919. @subsection Examples
  16920. @itemize
  16921. @item
  16922. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16923. @example
  16924. 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
  16925. @end example
  16926. @item
  16927. Zoom in up to 1.5x and pan always at center of picture:
  16928. @example
  16929. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16930. @end example
  16931. @item
  16932. Same as above but without pausing:
  16933. @example
  16934. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16935. @end example
  16936. @item
  16937. Zoom in 2x into center of picture only for the first second of the input video:
  16938. @example
  16939. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16940. @end example
  16941. @end itemize
  16942. @anchor{zscale}
  16943. @section zscale
  16944. Scale (resize) the input video, using the z.lib library:
  16945. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16946. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16947. The zscale filter forces the output display aspect ratio to be the same
  16948. as the input, by changing the output sample aspect ratio.
  16949. If the input image format is different from the format requested by
  16950. the next filter, the zscale filter will convert the input to the
  16951. requested format.
  16952. @subsection Options
  16953. The filter accepts the following options.
  16954. @table @option
  16955. @item width, w
  16956. @item height, h
  16957. Set the output video dimension expression. Default value is the input
  16958. dimension.
  16959. If the @var{width} or @var{w} value is 0, the input width is used for
  16960. the output. If the @var{height} or @var{h} value is 0, the input height
  16961. is used for the output.
  16962. If one and only one of the values is -n with n >= 1, the zscale filter
  16963. will use a value that maintains the aspect ratio of the input image,
  16964. calculated from the other specified dimension. After that it will,
  16965. however, make sure that the calculated dimension is divisible by n and
  16966. adjust the value if necessary.
  16967. If both values are -n with n >= 1, the behavior will be identical to
  16968. both values being set to 0 as previously detailed.
  16969. See below for the list of accepted constants for use in the dimension
  16970. expression.
  16971. @item size, s
  16972. Set the video size. For the syntax of this option, check the
  16973. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16974. @item dither, d
  16975. Set the dither type.
  16976. Possible values are:
  16977. @table @var
  16978. @item none
  16979. @item ordered
  16980. @item random
  16981. @item error_diffusion
  16982. @end table
  16983. Default is none.
  16984. @item filter, f
  16985. Set the resize filter type.
  16986. Possible values are:
  16987. @table @var
  16988. @item point
  16989. @item bilinear
  16990. @item bicubic
  16991. @item spline16
  16992. @item spline36
  16993. @item lanczos
  16994. @end table
  16995. Default is bilinear.
  16996. @item range, r
  16997. Set the color range.
  16998. Possible values are:
  16999. @table @var
  17000. @item input
  17001. @item limited
  17002. @item full
  17003. @end table
  17004. Default is same as input.
  17005. @item primaries, p
  17006. Set the color primaries.
  17007. Possible values are:
  17008. @table @var
  17009. @item input
  17010. @item 709
  17011. @item unspecified
  17012. @item 170m
  17013. @item 240m
  17014. @item 2020
  17015. @end table
  17016. Default is same as input.
  17017. @item transfer, t
  17018. Set the transfer characteristics.
  17019. Possible values are:
  17020. @table @var
  17021. @item input
  17022. @item 709
  17023. @item unspecified
  17024. @item 601
  17025. @item linear
  17026. @item 2020_10
  17027. @item 2020_12
  17028. @item smpte2084
  17029. @item iec61966-2-1
  17030. @item arib-std-b67
  17031. @end table
  17032. Default is same as input.
  17033. @item matrix, m
  17034. Set the colorspace matrix.
  17035. Possible value are:
  17036. @table @var
  17037. @item input
  17038. @item 709
  17039. @item unspecified
  17040. @item 470bg
  17041. @item 170m
  17042. @item 2020_ncl
  17043. @item 2020_cl
  17044. @end table
  17045. Default is same as input.
  17046. @item rangein, rin
  17047. Set the input color range.
  17048. Possible values are:
  17049. @table @var
  17050. @item input
  17051. @item limited
  17052. @item full
  17053. @end table
  17054. Default is same as input.
  17055. @item primariesin, pin
  17056. Set the input color primaries.
  17057. Possible values are:
  17058. @table @var
  17059. @item input
  17060. @item 709
  17061. @item unspecified
  17062. @item 170m
  17063. @item 240m
  17064. @item 2020
  17065. @end table
  17066. Default is same as input.
  17067. @item transferin, tin
  17068. Set the input transfer characteristics.
  17069. Possible values are:
  17070. @table @var
  17071. @item input
  17072. @item 709
  17073. @item unspecified
  17074. @item 601
  17075. @item linear
  17076. @item 2020_10
  17077. @item 2020_12
  17078. @end table
  17079. Default is same as input.
  17080. @item matrixin, min
  17081. Set the input colorspace matrix.
  17082. Possible value are:
  17083. @table @var
  17084. @item input
  17085. @item 709
  17086. @item unspecified
  17087. @item 470bg
  17088. @item 170m
  17089. @item 2020_ncl
  17090. @item 2020_cl
  17091. @end table
  17092. @item chromal, c
  17093. Set the output chroma location.
  17094. Possible values are:
  17095. @table @var
  17096. @item input
  17097. @item left
  17098. @item center
  17099. @item topleft
  17100. @item top
  17101. @item bottomleft
  17102. @item bottom
  17103. @end table
  17104. @item chromalin, cin
  17105. Set the input chroma location.
  17106. Possible values are:
  17107. @table @var
  17108. @item input
  17109. @item left
  17110. @item center
  17111. @item topleft
  17112. @item top
  17113. @item bottomleft
  17114. @item bottom
  17115. @end table
  17116. @item npl
  17117. Set the nominal peak luminance.
  17118. @item param_a
  17119. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  17120. filter taps for lanczos.
  17121. @item param_b
  17122. Parameter B for scaling filters. Parameter "c" for bicubic.
  17123. @end table
  17124. The values of the @option{w} and @option{h} options are expressions
  17125. containing the following constants:
  17126. @table @var
  17127. @item in_w
  17128. @item in_h
  17129. The input width and height
  17130. @item iw
  17131. @item ih
  17132. These are the same as @var{in_w} and @var{in_h}.
  17133. @item out_w
  17134. @item out_h
  17135. The output (scaled) width and height
  17136. @item ow
  17137. @item oh
  17138. These are the same as @var{out_w} and @var{out_h}
  17139. @item a
  17140. The same as @var{iw} / @var{ih}
  17141. @item sar
  17142. input sample aspect ratio
  17143. @item dar
  17144. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  17145. @item hsub
  17146. @item vsub
  17147. horizontal and vertical input chroma subsample values. For example for the
  17148. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  17149. @item ohsub
  17150. @item ovsub
  17151. horizontal and vertical output chroma subsample values. For example for the
  17152. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  17153. @end table
  17154. @subsection Commands
  17155. This filter supports the following commands:
  17156. @table @option
  17157. @item width, w
  17158. @item height, h
  17159. Set the output video dimension expression.
  17160. The command accepts the same syntax of the corresponding option.
  17161. If the specified expression is not valid, it is kept at its current
  17162. value.
  17163. @end table
  17164. @c man end VIDEO FILTERS
  17165. @chapter OpenCL Video Filters
  17166. @c man begin OPENCL VIDEO FILTERS
  17167. Below is a description of the currently available OpenCL video filters.
  17168. To enable compilation of these filters you need to configure FFmpeg with
  17169. @code{--enable-opencl}.
  17170. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  17171. @table @option
  17172. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  17173. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  17174. given device parameters.
  17175. @item -filter_hw_device @var{name}
  17176. Pass the hardware device called @var{name} to all filters in any filter graph.
  17177. @end table
  17178. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  17179. @itemize
  17180. @item
  17181. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  17182. @example
  17183. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  17184. @end example
  17185. @end itemize
  17186. 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.
  17187. @section avgblur_opencl
  17188. Apply average blur filter.
  17189. The filter accepts the following options:
  17190. @table @option
  17191. @item sizeX
  17192. Set horizontal radius size.
  17193. Range is @code{[1, 1024]} and default value is @code{1}.
  17194. @item planes
  17195. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17196. @item sizeY
  17197. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  17198. @end table
  17199. @subsection Example
  17200. @itemize
  17201. @item
  17202. 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.
  17203. @example
  17204. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  17205. @end example
  17206. @end itemize
  17207. @section boxblur_opencl
  17208. Apply a boxblur algorithm to the input video.
  17209. It accepts the following parameters:
  17210. @table @option
  17211. @item luma_radius, lr
  17212. @item luma_power, lp
  17213. @item chroma_radius, cr
  17214. @item chroma_power, cp
  17215. @item alpha_radius, ar
  17216. @item alpha_power, ap
  17217. @end table
  17218. A description of the accepted options follows.
  17219. @table @option
  17220. @item luma_radius, lr
  17221. @item chroma_radius, cr
  17222. @item alpha_radius, ar
  17223. Set an expression for the box radius in pixels used for blurring the
  17224. corresponding input plane.
  17225. The radius value must be a non-negative number, and must not be
  17226. greater than the value of the expression @code{min(w,h)/2} for the
  17227. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  17228. planes.
  17229. Default value for @option{luma_radius} is "2". If not specified,
  17230. @option{chroma_radius} and @option{alpha_radius} default to the
  17231. corresponding value set for @option{luma_radius}.
  17232. The expressions can contain the following constants:
  17233. @table @option
  17234. @item w
  17235. @item h
  17236. The input width and height in pixels.
  17237. @item cw
  17238. @item ch
  17239. The input chroma image width and height in pixels.
  17240. @item hsub
  17241. @item vsub
  17242. The horizontal and vertical chroma subsample values. For example, for the
  17243. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  17244. @end table
  17245. @item luma_power, lp
  17246. @item chroma_power, cp
  17247. @item alpha_power, ap
  17248. Specify how many times the boxblur filter is applied to the
  17249. corresponding plane.
  17250. Default value for @option{luma_power} is 2. If not specified,
  17251. @option{chroma_power} and @option{alpha_power} default to the
  17252. corresponding value set for @option{luma_power}.
  17253. A value of 0 will disable the effect.
  17254. @end table
  17255. @subsection Examples
  17256. 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.
  17257. @itemize
  17258. @item
  17259. Apply a boxblur filter with the luma, chroma, and alpha radius
  17260. 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.
  17261. @example
  17262. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  17263. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  17264. @end example
  17265. @item
  17266. 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.
  17267. For the luma plane, a 2x2 box radius will be run once.
  17268. For the chroma plane, a 4x4 box radius will be run 5 times.
  17269. For the alpha plane, a 3x3 box radius will be run 7 times.
  17270. @example
  17271. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  17272. @end example
  17273. @end itemize
  17274. @section colorkey_opencl
  17275. RGB colorspace color keying.
  17276. The filter accepts the following options:
  17277. @table @option
  17278. @item color
  17279. The color which will be replaced with transparency.
  17280. @item similarity
  17281. Similarity percentage with the key color.
  17282. 0.01 matches only the exact key color, while 1.0 matches everything.
  17283. @item blend
  17284. Blend percentage.
  17285. 0.0 makes pixels either fully transparent, or not transparent at all.
  17286. Higher values result in semi-transparent pixels, with a higher transparency
  17287. the more similar the pixels color is to the key color.
  17288. @end table
  17289. @subsection Examples
  17290. @itemize
  17291. @item
  17292. Make every semi-green pixel in the input transparent with some slight blending:
  17293. @example
  17294. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  17295. @end example
  17296. @end itemize
  17297. @section convolution_opencl
  17298. Apply convolution of 3x3, 5x5, 7x7 matrix.
  17299. The filter accepts the following options:
  17300. @table @option
  17301. @item 0m
  17302. @item 1m
  17303. @item 2m
  17304. @item 3m
  17305. Set matrix for each plane.
  17306. Matrix is sequence of 9, 25 or 49 signed numbers.
  17307. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  17308. @item 0rdiv
  17309. @item 1rdiv
  17310. @item 2rdiv
  17311. @item 3rdiv
  17312. Set multiplier for calculated value for each plane.
  17313. If unset or 0, it will be sum of all matrix elements.
  17314. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  17315. @item 0bias
  17316. @item 1bias
  17317. @item 2bias
  17318. @item 3bias
  17319. Set bias for each plane. This value is added to the result of the multiplication.
  17320. Useful for making the overall image brighter or darker.
  17321. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  17322. @end table
  17323. @subsection Examples
  17324. @itemize
  17325. @item
  17326. Apply sharpen:
  17327. @example
  17328. -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
  17329. @end example
  17330. @item
  17331. Apply blur:
  17332. @example
  17333. -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
  17334. @end example
  17335. @item
  17336. Apply edge enhance:
  17337. @example
  17338. -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
  17339. @end example
  17340. @item
  17341. Apply edge detect:
  17342. @example
  17343. -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
  17344. @end example
  17345. @item
  17346. Apply laplacian edge detector which includes diagonals:
  17347. @example
  17348. -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
  17349. @end example
  17350. @item
  17351. Apply emboss:
  17352. @example
  17353. -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
  17354. @end example
  17355. @end itemize
  17356. @section erosion_opencl
  17357. Apply erosion effect to the video.
  17358. This filter replaces the pixel by the local(3x3) minimum.
  17359. It accepts the following options:
  17360. @table @option
  17361. @item threshold0
  17362. @item threshold1
  17363. @item threshold2
  17364. @item threshold3
  17365. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17366. If @code{0}, plane will remain unchanged.
  17367. @item coordinates
  17368. Flag which specifies the pixel to refer to.
  17369. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17370. Flags to local 3x3 coordinates region centered on @code{x}:
  17371. 1 2 3
  17372. 4 x 5
  17373. 6 7 8
  17374. @end table
  17375. @subsection Example
  17376. @itemize
  17377. @item
  17378. 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.
  17379. @example
  17380. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17381. @end example
  17382. @end itemize
  17383. @section deshake_opencl
  17384. Feature-point based video stabilization filter.
  17385. The filter accepts the following options:
  17386. @table @option
  17387. @item tripod
  17388. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  17389. @item debug
  17390. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  17391. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  17392. Viewing point matches in the output video is only supported for RGB input.
  17393. Defaults to @code{0}.
  17394. @item adaptive_crop
  17395. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  17396. Defaults to @code{1}.
  17397. @item refine_features
  17398. Whether or not feature points should be refined at a sub-pixel level.
  17399. This can be turned off for a slight performance gain at the cost of precision.
  17400. Defaults to @code{1}.
  17401. @item smooth_strength
  17402. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  17403. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  17404. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  17405. Defaults to @code{0.0}.
  17406. @item smooth_window_multiplier
  17407. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  17408. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  17409. Acceptable values range from @code{0.1} to @code{10.0}.
  17410. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  17411. potentially improving smoothness, but also increase latency and memory usage.
  17412. Defaults to @code{2.0}.
  17413. @end table
  17414. @subsection Examples
  17415. @itemize
  17416. @item
  17417. Stabilize a video with a fixed, medium smoothing strength:
  17418. @example
  17419. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  17420. @end example
  17421. @item
  17422. Stabilize a video with debugging (both in console and in rendered video):
  17423. @example
  17424. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  17425. @end example
  17426. @end itemize
  17427. @section dilation_opencl
  17428. Apply dilation effect to the video.
  17429. This filter replaces the pixel by the local(3x3) maximum.
  17430. It accepts the following options:
  17431. @table @option
  17432. @item threshold0
  17433. @item threshold1
  17434. @item threshold2
  17435. @item threshold3
  17436. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17437. If @code{0}, plane will remain unchanged.
  17438. @item coordinates
  17439. Flag which specifies the pixel to refer to.
  17440. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17441. Flags to local 3x3 coordinates region centered on @code{x}:
  17442. 1 2 3
  17443. 4 x 5
  17444. 6 7 8
  17445. @end table
  17446. @subsection Example
  17447. @itemize
  17448. @item
  17449. 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.
  17450. @example
  17451. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17452. @end example
  17453. @end itemize
  17454. @section nlmeans_opencl
  17455. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  17456. @section overlay_opencl
  17457. Overlay one video on top of another.
  17458. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  17459. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  17460. The filter accepts the following options:
  17461. @table @option
  17462. @item x
  17463. Set the x coordinate of the overlaid video on the main video.
  17464. Default value is @code{0}.
  17465. @item y
  17466. Set the y coordinate of the overlaid video on the main video.
  17467. Default value is @code{0}.
  17468. @end table
  17469. @subsection Examples
  17470. @itemize
  17471. @item
  17472. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  17473. @example
  17474. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17475. @end example
  17476. @item
  17477. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  17478. @example
  17479. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17480. @end example
  17481. @end itemize
  17482. @section pad_opencl
  17483. Add paddings to the input image, and place the original input at the
  17484. provided @var{x}, @var{y} coordinates.
  17485. It accepts the following options:
  17486. @table @option
  17487. @item width, w
  17488. @item height, h
  17489. Specify an expression for the size of the output image with the
  17490. paddings added. If the value for @var{width} or @var{height} is 0, the
  17491. corresponding input size is used for the output.
  17492. The @var{width} expression can reference the value set by the
  17493. @var{height} expression, and vice versa.
  17494. The default value of @var{width} and @var{height} is 0.
  17495. @item x
  17496. @item y
  17497. Specify the offsets to place the input image at within the padded area,
  17498. with respect to the top/left border of the output image.
  17499. The @var{x} expression can reference the value set by the @var{y}
  17500. expression, and vice versa.
  17501. The default value of @var{x} and @var{y} is 0.
  17502. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  17503. so the input image is centered on the padded area.
  17504. @item color
  17505. Specify the color of the padded area. For the syntax of this option,
  17506. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17507. manual,ffmpeg-utils}.
  17508. @item aspect
  17509. Pad to an aspect instead to a resolution.
  17510. @end table
  17511. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  17512. options are expressions containing the following constants:
  17513. @table @option
  17514. @item in_w
  17515. @item in_h
  17516. The input video width and height.
  17517. @item iw
  17518. @item ih
  17519. These are the same as @var{in_w} and @var{in_h}.
  17520. @item out_w
  17521. @item out_h
  17522. The output width and height (the size of the padded area), as
  17523. specified by the @var{width} and @var{height} expressions.
  17524. @item ow
  17525. @item oh
  17526. These are the same as @var{out_w} and @var{out_h}.
  17527. @item x
  17528. @item y
  17529. The x and y offsets as specified by the @var{x} and @var{y}
  17530. expressions, or NAN if not yet specified.
  17531. @item a
  17532. same as @var{iw} / @var{ih}
  17533. @item sar
  17534. input sample aspect ratio
  17535. @item dar
  17536. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  17537. @end table
  17538. @section prewitt_opencl
  17539. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  17540. The filter accepts the following option:
  17541. @table @option
  17542. @item planes
  17543. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17544. @item scale
  17545. Set value which will be multiplied with filtered result.
  17546. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17547. @item delta
  17548. Set value which will be added to filtered result.
  17549. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17550. @end table
  17551. @subsection Example
  17552. @itemize
  17553. @item
  17554. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  17555. @example
  17556. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17557. @end example
  17558. @end itemize
  17559. @anchor{program_opencl}
  17560. @section program_opencl
  17561. Filter video using an OpenCL program.
  17562. @table @option
  17563. @item source
  17564. OpenCL program source file.
  17565. @item kernel
  17566. Kernel name in program.
  17567. @item inputs
  17568. Number of inputs to the filter. Defaults to 1.
  17569. @item size, s
  17570. Size of output frames. Defaults to the same as the first input.
  17571. @end table
  17572. The @code{program_opencl} filter also supports the @ref{framesync} options.
  17573. The program source file must contain a kernel function with the given name,
  17574. which will be run once for each plane of the output. Each run on a plane
  17575. gets enqueued as a separate 2D global NDRange with one work-item for each
  17576. pixel to be generated. The global ID offset for each work-item is therefore
  17577. the coordinates of a pixel in the destination image.
  17578. The kernel function needs to take the following arguments:
  17579. @itemize
  17580. @item
  17581. Destination image, @var{__write_only image2d_t}.
  17582. This image will become the output; the kernel should write all of it.
  17583. @item
  17584. Frame index, @var{unsigned int}.
  17585. This is a counter starting from zero and increasing by one for each frame.
  17586. @item
  17587. Source images, @var{__read_only image2d_t}.
  17588. These are the most recent images on each input. The kernel may read from
  17589. them to generate the output, but they can't be written to.
  17590. @end itemize
  17591. Example programs:
  17592. @itemize
  17593. @item
  17594. Copy the input to the output (output must be the same size as the input).
  17595. @verbatim
  17596. __kernel void copy(__write_only image2d_t destination,
  17597. unsigned int index,
  17598. __read_only image2d_t source)
  17599. {
  17600. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17601. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17602. float4 value = read_imagef(source, sampler, location);
  17603. write_imagef(destination, location, value);
  17604. }
  17605. @end verbatim
  17606. @item
  17607. Apply a simple transformation, rotating the input by an amount increasing
  17608. with the index counter. Pixel values are linearly interpolated by the
  17609. sampler, and the output need not have the same dimensions as the input.
  17610. @verbatim
  17611. __kernel void rotate_image(__write_only image2d_t dst,
  17612. unsigned int index,
  17613. __read_only image2d_t src)
  17614. {
  17615. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17616. CLK_FILTER_LINEAR);
  17617. float angle = (float)index / 100.0f;
  17618. float2 dst_dim = convert_float2(get_image_dim(dst));
  17619. float2 src_dim = convert_float2(get_image_dim(src));
  17620. float2 dst_cen = dst_dim / 2.0f;
  17621. float2 src_cen = src_dim / 2.0f;
  17622. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17623. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17624. float2 src_pos = {
  17625. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17626. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17627. };
  17628. src_pos = src_pos * src_dim / dst_dim;
  17629. float2 src_loc = src_pos + src_cen;
  17630. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17631. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17632. write_imagef(dst, dst_loc, 0.5f);
  17633. else
  17634. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17635. }
  17636. @end verbatim
  17637. @item
  17638. Blend two inputs together, with the amount of each input used varying
  17639. with the index counter.
  17640. @verbatim
  17641. __kernel void blend_images(__write_only image2d_t dst,
  17642. unsigned int index,
  17643. __read_only image2d_t src1,
  17644. __read_only image2d_t src2)
  17645. {
  17646. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17647. CLK_FILTER_LINEAR);
  17648. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17649. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17650. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17651. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17652. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17653. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17654. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17655. }
  17656. @end verbatim
  17657. @end itemize
  17658. @section roberts_opencl
  17659. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17660. The filter accepts the following option:
  17661. @table @option
  17662. @item planes
  17663. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17664. @item scale
  17665. Set value which will be multiplied with filtered result.
  17666. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17667. @item delta
  17668. Set value which will be added to filtered result.
  17669. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17670. @end table
  17671. @subsection Example
  17672. @itemize
  17673. @item
  17674. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17675. @example
  17676. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17677. @end example
  17678. @end itemize
  17679. @section sobel_opencl
  17680. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17681. The filter accepts the following option:
  17682. @table @option
  17683. @item planes
  17684. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17685. @item scale
  17686. Set value which will be multiplied with filtered result.
  17687. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17688. @item delta
  17689. Set value which will be added to filtered result.
  17690. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17691. @end table
  17692. @subsection Example
  17693. @itemize
  17694. @item
  17695. Apply sobel operator with scale set to 2 and delta set to 10
  17696. @example
  17697. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17698. @end example
  17699. @end itemize
  17700. @section tonemap_opencl
  17701. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17702. It accepts the following parameters:
  17703. @table @option
  17704. @item tonemap
  17705. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17706. @item param
  17707. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17708. @item desat
  17709. Apply desaturation for highlights that exceed this level of brightness. The
  17710. higher the parameter, the more color information will be preserved. This
  17711. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17712. (smoothly) turning into white instead. This makes images feel more natural,
  17713. at the cost of reducing information about out-of-range colors.
  17714. The default value is 0.5, and the algorithm here is a little different from
  17715. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17716. @item threshold
  17717. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17718. is used to detect whether the scene has changed or not. If the distance between
  17719. the current frame average brightness and the current running average exceeds
  17720. a threshold value, we would re-calculate scene average and peak brightness.
  17721. The default value is 0.2.
  17722. @item format
  17723. Specify the output pixel format.
  17724. Currently supported formats are:
  17725. @table @var
  17726. @item p010
  17727. @item nv12
  17728. @end table
  17729. @item range, r
  17730. Set the output color range.
  17731. Possible values are:
  17732. @table @var
  17733. @item tv/mpeg
  17734. @item pc/jpeg
  17735. @end table
  17736. Default is same as input.
  17737. @item primaries, p
  17738. Set the output color primaries.
  17739. Possible values are:
  17740. @table @var
  17741. @item bt709
  17742. @item bt2020
  17743. @end table
  17744. Default is same as input.
  17745. @item transfer, t
  17746. Set the output transfer characteristics.
  17747. Possible values are:
  17748. @table @var
  17749. @item bt709
  17750. @item bt2020
  17751. @end table
  17752. Default is bt709.
  17753. @item matrix, m
  17754. Set the output colorspace matrix.
  17755. Possible value are:
  17756. @table @var
  17757. @item bt709
  17758. @item bt2020
  17759. @end table
  17760. Default is same as input.
  17761. @end table
  17762. @subsection Example
  17763. @itemize
  17764. @item
  17765. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17766. @example
  17767. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17768. @end example
  17769. @end itemize
  17770. @section unsharp_opencl
  17771. Sharpen or blur the input video.
  17772. It accepts the following parameters:
  17773. @table @option
  17774. @item luma_msize_x, lx
  17775. Set the luma matrix horizontal size.
  17776. Range is @code{[1, 23]} and default value is @code{5}.
  17777. @item luma_msize_y, ly
  17778. Set the luma matrix vertical size.
  17779. Range is @code{[1, 23]} and default value is @code{5}.
  17780. @item luma_amount, la
  17781. Set the luma effect strength.
  17782. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17783. Negative values will blur the input video, while positive values will
  17784. sharpen it, a value of zero will disable the effect.
  17785. @item chroma_msize_x, cx
  17786. Set the chroma matrix horizontal size.
  17787. Range is @code{[1, 23]} and default value is @code{5}.
  17788. @item chroma_msize_y, cy
  17789. Set the chroma matrix vertical size.
  17790. Range is @code{[1, 23]} and default value is @code{5}.
  17791. @item chroma_amount, ca
  17792. Set the chroma effect strength.
  17793. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17794. Negative values will blur the input video, while positive values will
  17795. sharpen it, a value of zero will disable the effect.
  17796. @end table
  17797. All parameters are optional and default to the equivalent of the
  17798. string '5:5:1.0:5:5:0.0'.
  17799. @subsection Examples
  17800. @itemize
  17801. @item
  17802. Apply strong luma sharpen effect:
  17803. @example
  17804. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17805. @end example
  17806. @item
  17807. Apply a strong blur of both luma and chroma parameters:
  17808. @example
  17809. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17810. @end example
  17811. @end itemize
  17812. @section xfade_opencl
  17813. Cross fade two videos with custom transition effect by using OpenCL.
  17814. It accepts the following options:
  17815. @table @option
  17816. @item transition
  17817. Set one of possible transition effects.
  17818. @table @option
  17819. @item custom
  17820. Select custom transition effect, the actual transition description
  17821. will be picked from source and kernel options.
  17822. @item fade
  17823. @item wipeleft
  17824. @item wiperight
  17825. @item wipeup
  17826. @item wipedown
  17827. @item slideleft
  17828. @item slideright
  17829. @item slideup
  17830. @item slidedown
  17831. Default transition is fade.
  17832. @end table
  17833. @item source
  17834. OpenCL program source file for custom transition.
  17835. @item kernel
  17836. Set name of kernel to use for custom transition from program source file.
  17837. @item duration
  17838. Set duration of video transition.
  17839. @item offset
  17840. Set time of start of transition relative to first video.
  17841. @end table
  17842. The program source file must contain a kernel function with the given name,
  17843. which will be run once for each plane of the output. Each run on a plane
  17844. gets enqueued as a separate 2D global NDRange with one work-item for each
  17845. pixel to be generated. The global ID offset for each work-item is therefore
  17846. the coordinates of a pixel in the destination image.
  17847. The kernel function needs to take the following arguments:
  17848. @itemize
  17849. @item
  17850. Destination image, @var{__write_only image2d_t}.
  17851. This image will become the output; the kernel should write all of it.
  17852. @item
  17853. First Source image, @var{__read_only image2d_t}.
  17854. Second Source image, @var{__read_only image2d_t}.
  17855. These are the most recent images on each input. The kernel may read from
  17856. them to generate the output, but they can't be written to.
  17857. @item
  17858. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17859. @end itemize
  17860. Example programs:
  17861. @itemize
  17862. @item
  17863. Apply dots curtain transition effect:
  17864. @verbatim
  17865. __kernel void blend_images(__write_only image2d_t dst,
  17866. __read_only image2d_t src1,
  17867. __read_only image2d_t src2,
  17868. float progress)
  17869. {
  17870. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17871. CLK_FILTER_LINEAR);
  17872. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17873. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17874. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17875. rp = rp / dim;
  17876. float2 dots = (float2)(20.0, 20.0);
  17877. float2 center = (float2)(0,0);
  17878. float2 unused;
  17879. float4 val1 = read_imagef(src1, sampler, p);
  17880. float4 val2 = read_imagef(src2, sampler, p);
  17881. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17882. write_imagef(dst, p, next ? val1 : val2);
  17883. }
  17884. @end verbatim
  17885. @end itemize
  17886. @c man end OPENCL VIDEO FILTERS
  17887. @chapter VAAPI Video Filters
  17888. @c man begin VAAPI VIDEO FILTERS
  17889. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17890. To enable compilation of these filters you need to configure FFmpeg with
  17891. @code{--enable-vaapi}.
  17892. 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}
  17893. @section tonemap_vaapi
  17894. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17895. It maps the dynamic range of HDR10 content to the SDR content.
  17896. It currently only accepts HDR10 as input.
  17897. It accepts the following parameters:
  17898. @table @option
  17899. @item format
  17900. Specify the output pixel format.
  17901. Currently supported formats are:
  17902. @table @var
  17903. @item p010
  17904. @item nv12
  17905. @end table
  17906. Default is nv12.
  17907. @item primaries, p
  17908. Set the output color primaries.
  17909. Default is same as input.
  17910. @item transfer, t
  17911. Set the output transfer characteristics.
  17912. Default is bt709.
  17913. @item matrix, m
  17914. Set the output colorspace matrix.
  17915. Default is same as input.
  17916. @end table
  17917. @subsection Example
  17918. @itemize
  17919. @item
  17920. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17921. @example
  17922. tonemap_vaapi=format=p010:t=bt2020-10
  17923. @end example
  17924. @end itemize
  17925. @c man end VAAPI VIDEO FILTERS
  17926. @chapter Video Sources
  17927. @c man begin VIDEO SOURCES
  17928. Below is a description of the currently available video sources.
  17929. @section buffer
  17930. Buffer video frames, and make them available to the filter chain.
  17931. This source is mainly intended for a programmatic use, in particular
  17932. through the interface defined in @file{libavfilter/buffersrc.h}.
  17933. It accepts the following parameters:
  17934. @table @option
  17935. @item video_size
  17936. Specify the size (width and height) of the buffered video frames. For the
  17937. syntax of this option, check the
  17938. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17939. @item width
  17940. The input video width.
  17941. @item height
  17942. The input video height.
  17943. @item pix_fmt
  17944. A string representing the pixel format of the buffered video frames.
  17945. It may be a number corresponding to a pixel format, or a pixel format
  17946. name.
  17947. @item time_base
  17948. Specify the timebase assumed by the timestamps of the buffered frames.
  17949. @item frame_rate
  17950. Specify the frame rate expected for the video stream.
  17951. @item pixel_aspect, sar
  17952. The sample (pixel) aspect ratio of the input video.
  17953. @item sws_param
  17954. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17955. to the filtergraph description to specify swscale flags for automatically
  17956. inserted scalers. See @ref{Filtergraph syntax}.
  17957. @item hw_frames_ctx
  17958. When using a hardware pixel format, this should be a reference to an
  17959. AVHWFramesContext describing input frames.
  17960. @end table
  17961. For example:
  17962. @example
  17963. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17964. @end example
  17965. will instruct the source to accept video frames with size 320x240 and
  17966. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17967. square pixels (1:1 sample aspect ratio).
  17968. Since the pixel format with name "yuv410p" corresponds to the number 6
  17969. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17970. this example corresponds to:
  17971. @example
  17972. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17973. @end example
  17974. Alternatively, the options can be specified as a flat string, but this
  17975. syntax is deprecated:
  17976. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17977. @section cellauto
  17978. Create a pattern generated by an elementary cellular automaton.
  17979. The initial state of the cellular automaton can be defined through the
  17980. @option{filename} and @option{pattern} options. If such options are
  17981. not specified an initial state is created randomly.
  17982. At each new frame a new row in the video is filled with the result of
  17983. the cellular automaton next generation. The behavior when the whole
  17984. frame is filled is defined by the @option{scroll} option.
  17985. This source accepts the following options:
  17986. @table @option
  17987. @item filename, f
  17988. Read the initial cellular automaton state, i.e. the starting row, from
  17989. the specified file.
  17990. In the file, each non-whitespace character is considered an alive
  17991. cell, a newline will terminate the row, and further characters in the
  17992. file will be ignored.
  17993. @item pattern, p
  17994. Read the initial cellular automaton state, i.e. the starting row, from
  17995. the specified string.
  17996. Each non-whitespace character in the string is considered an alive
  17997. cell, a newline will terminate the row, and further characters in the
  17998. string will be ignored.
  17999. @item rate, r
  18000. Set the video rate, that is the number of frames generated per second.
  18001. Default is 25.
  18002. @item random_fill_ratio, ratio
  18003. Set the random fill ratio for the initial cellular automaton row. It
  18004. is a floating point number value ranging from 0 to 1, defaults to
  18005. 1/PHI.
  18006. This option is ignored when a file or a pattern is specified.
  18007. @item random_seed, seed
  18008. Set the seed for filling randomly the initial row, must be an integer
  18009. included between 0 and UINT32_MAX. If not specified, or if explicitly
  18010. set to -1, the filter will try to use a good random seed on a best
  18011. effort basis.
  18012. @item rule
  18013. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  18014. Default value is 110.
  18015. @item size, s
  18016. Set the size of the output video. For the syntax of this option, check the
  18017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18018. If @option{filename} or @option{pattern} is specified, the size is set
  18019. by default to the width of the specified initial state row, and the
  18020. height is set to @var{width} * PHI.
  18021. If @option{size} is set, it must contain the width of the specified
  18022. pattern string, and the specified pattern will be centered in the
  18023. larger row.
  18024. If a filename or a pattern string is not specified, the size value
  18025. defaults to "320x518" (used for a randomly generated initial state).
  18026. @item scroll
  18027. If set to 1, scroll the output upward when all the rows in the output
  18028. have been already filled. If set to 0, the new generated row will be
  18029. written over the top row just after the bottom row is filled.
  18030. Defaults to 1.
  18031. @item start_full, full
  18032. If set to 1, completely fill the output with generated rows before
  18033. outputting the first frame.
  18034. This is the default behavior, for disabling set the value to 0.
  18035. @item stitch
  18036. If set to 1, stitch the left and right row edges together.
  18037. This is the default behavior, for disabling set the value to 0.
  18038. @end table
  18039. @subsection Examples
  18040. @itemize
  18041. @item
  18042. Read the initial state from @file{pattern}, and specify an output of
  18043. size 200x400.
  18044. @example
  18045. cellauto=f=pattern:s=200x400
  18046. @end example
  18047. @item
  18048. Generate a random initial row with a width of 200 cells, with a fill
  18049. ratio of 2/3:
  18050. @example
  18051. cellauto=ratio=2/3:s=200x200
  18052. @end example
  18053. @item
  18054. Create a pattern generated by rule 18 starting by a single alive cell
  18055. centered on an initial row with width 100:
  18056. @example
  18057. cellauto=p=@@:s=100x400:full=0:rule=18
  18058. @end example
  18059. @item
  18060. Specify a more elaborated initial pattern:
  18061. @example
  18062. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  18063. @end example
  18064. @end itemize
  18065. @anchor{coreimagesrc}
  18066. @section coreimagesrc
  18067. Video source generated on GPU using Apple's CoreImage API on OSX.
  18068. This video source is a specialized version of the @ref{coreimage} video filter.
  18069. Use a core image generator at the beginning of the applied filterchain to
  18070. generate the content.
  18071. The coreimagesrc video source accepts the following options:
  18072. @table @option
  18073. @item list_generators
  18074. List all available generators along with all their respective options as well as
  18075. possible minimum and maximum values along with the default values.
  18076. @example
  18077. list_generators=true
  18078. @end example
  18079. @item size, s
  18080. Specify the size of the sourced video. For the syntax of this option, check the
  18081. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18082. The default value is @code{320x240}.
  18083. @item rate, r
  18084. Specify the frame rate of the sourced video, as the number of frames
  18085. generated per second. It has to be a string in the format
  18086. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18087. number or a valid video frame rate abbreviation. The default value is
  18088. "25".
  18089. @item sar
  18090. Set the sample aspect ratio of the sourced video.
  18091. @item duration, d
  18092. Set the duration of the sourced video. See
  18093. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18094. for the accepted syntax.
  18095. If not specified, or the expressed duration is negative, the video is
  18096. supposed to be generated forever.
  18097. @end table
  18098. Additionally, all options of the @ref{coreimage} video filter are accepted.
  18099. A complete filterchain can be used for further processing of the
  18100. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  18101. and examples for details.
  18102. @subsection Examples
  18103. @itemize
  18104. @item
  18105. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  18106. given as complete and escaped command-line for Apple's standard bash shell:
  18107. @example
  18108. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  18109. @end example
  18110. This example is equivalent to the QRCode example of @ref{coreimage} without the
  18111. need for a nullsrc video source.
  18112. @end itemize
  18113. @section gradients
  18114. Generate several gradients.
  18115. @table @option
  18116. @item size, s
  18117. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18118. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18119. @item rate, r
  18120. Set frame rate, expressed as number of frames per second. Default
  18121. value is "25".
  18122. @item c0, c1, c2, c3, c4, c5, c6, c7
  18123. Set 8 colors. Default values for colors is to pick random one.
  18124. @item x0, y0, y0, y1
  18125. Set gradient line source and destination points. If negative or out of range, random ones
  18126. are picked.
  18127. @item nb_colors, n
  18128. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  18129. @item seed
  18130. Set seed for picking gradient line points.
  18131. @item duration, d
  18132. Set the duration of the sourced video. See
  18133. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18134. for the accepted syntax.
  18135. If not specified, or the expressed duration is negative, the video is
  18136. supposed to be generated forever.
  18137. @item speed
  18138. Set speed of gradients rotation.
  18139. @end table
  18140. @section mandelbrot
  18141. Generate a Mandelbrot set fractal, and progressively zoom towards the
  18142. point specified with @var{start_x} and @var{start_y}.
  18143. This source accepts the following options:
  18144. @table @option
  18145. @item end_pts
  18146. Set the terminal pts value. Default value is 400.
  18147. @item end_scale
  18148. Set the terminal scale value.
  18149. Must be a floating point value. Default value is 0.3.
  18150. @item inner
  18151. Set the inner coloring mode, that is the algorithm used to draw the
  18152. Mandelbrot fractal internal region.
  18153. It shall assume one of the following values:
  18154. @table @option
  18155. @item black
  18156. Set black mode.
  18157. @item convergence
  18158. Show time until convergence.
  18159. @item mincol
  18160. Set color based on point closest to the origin of the iterations.
  18161. @item period
  18162. Set period mode.
  18163. @end table
  18164. Default value is @var{mincol}.
  18165. @item bailout
  18166. Set the bailout value. Default value is 10.0.
  18167. @item maxiter
  18168. Set the maximum of iterations performed by the rendering
  18169. algorithm. Default value is 7189.
  18170. @item outer
  18171. Set outer coloring mode.
  18172. It shall assume one of following values:
  18173. @table @option
  18174. @item iteration_count
  18175. Set iteration count mode.
  18176. @item normalized_iteration_count
  18177. set normalized iteration count mode.
  18178. @end table
  18179. Default value is @var{normalized_iteration_count}.
  18180. @item rate, r
  18181. Set frame rate, expressed as number of frames per second. Default
  18182. value is "25".
  18183. @item size, s
  18184. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18185. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18186. @item start_scale
  18187. Set the initial scale value. Default value is 3.0.
  18188. @item start_x
  18189. Set the initial x position. Must be a floating point value between
  18190. -100 and 100. Default value is -0.743643887037158704752191506114774.
  18191. @item start_y
  18192. Set the initial y position. Must be a floating point value between
  18193. -100 and 100. Default value is -0.131825904205311970493132056385139.
  18194. @end table
  18195. @section mptestsrc
  18196. Generate various test patterns, as generated by the MPlayer test filter.
  18197. The size of the generated video is fixed, and is 256x256.
  18198. This source is useful in particular for testing encoding features.
  18199. This source accepts the following options:
  18200. @table @option
  18201. @item rate, r
  18202. Specify the frame rate of the sourced video, as the number of frames
  18203. generated per second. It has to be a string in the format
  18204. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18205. number or a valid video frame rate abbreviation. The default value is
  18206. "25".
  18207. @item duration, d
  18208. Set the duration of the sourced video. See
  18209. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18210. for the accepted syntax.
  18211. If not specified, or the expressed duration is negative, the video is
  18212. supposed to be generated forever.
  18213. @item test, t
  18214. Set the number or the name of the test to perform. Supported tests are:
  18215. @table @option
  18216. @item dc_luma
  18217. @item dc_chroma
  18218. @item freq_luma
  18219. @item freq_chroma
  18220. @item amp_luma
  18221. @item amp_chroma
  18222. @item cbp
  18223. @item mv
  18224. @item ring1
  18225. @item ring2
  18226. @item all
  18227. @item max_frames, m
  18228. Set the maximum number of frames generated for each test, default value is 30.
  18229. @end table
  18230. Default value is "all", which will cycle through the list of all tests.
  18231. @end table
  18232. Some examples:
  18233. @example
  18234. mptestsrc=t=dc_luma
  18235. @end example
  18236. will generate a "dc_luma" test pattern.
  18237. @section frei0r_src
  18238. Provide a frei0r source.
  18239. To enable compilation of this filter you need to install the frei0r
  18240. header and configure FFmpeg with @code{--enable-frei0r}.
  18241. This source accepts the following parameters:
  18242. @table @option
  18243. @item size
  18244. The size of the video to generate. For the syntax of this option, check the
  18245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18246. @item framerate
  18247. The framerate of the generated video. It may be a string of the form
  18248. @var{num}/@var{den} or a frame rate abbreviation.
  18249. @item filter_name
  18250. The name to the frei0r source to load. For more information regarding frei0r and
  18251. how to set the parameters, read the @ref{frei0r} section in the video filters
  18252. documentation.
  18253. @item filter_params
  18254. A '|'-separated list of parameters to pass to the frei0r source.
  18255. @end table
  18256. For example, to generate a frei0r partik0l source with size 200x200
  18257. and frame rate 10 which is overlaid on the overlay filter main input:
  18258. @example
  18259. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  18260. @end example
  18261. @section life
  18262. Generate a life pattern.
  18263. This source is based on a generalization of John Conway's life game.
  18264. The sourced input represents a life grid, each pixel represents a cell
  18265. which can be in one of two possible states, alive or dead. Every cell
  18266. interacts with its eight neighbours, which are the cells that are
  18267. horizontally, vertically, or diagonally adjacent.
  18268. At each interaction the grid evolves according to the adopted rule,
  18269. which specifies the number of neighbor alive cells which will make a
  18270. cell stay alive or born. The @option{rule} option allows one to specify
  18271. the rule to adopt.
  18272. This source accepts the following options:
  18273. @table @option
  18274. @item filename, f
  18275. Set the file from which to read the initial grid state. In the file,
  18276. each non-whitespace character is considered an alive cell, and newline
  18277. is used to delimit the end of each row.
  18278. If this option is not specified, the initial grid is generated
  18279. randomly.
  18280. @item rate, r
  18281. Set the video rate, that is the number of frames generated per second.
  18282. Default is 25.
  18283. @item random_fill_ratio, ratio
  18284. Set the random fill ratio for the initial random grid. It is a
  18285. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  18286. It is ignored when a file is specified.
  18287. @item random_seed, seed
  18288. Set the seed for filling the initial random grid, must be an integer
  18289. included between 0 and UINT32_MAX. If not specified, or if explicitly
  18290. set to -1, the filter will try to use a good random seed on a best
  18291. effort basis.
  18292. @item rule
  18293. Set the life rule.
  18294. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  18295. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  18296. @var{NS} specifies the number of alive neighbor cells which make a
  18297. live cell stay alive, and @var{NB} the number of alive neighbor cells
  18298. which make a dead cell to become alive (i.e. to "born").
  18299. "s" and "b" can be used in place of "S" and "B", respectively.
  18300. Alternatively a rule can be specified by an 18-bits integer. The 9
  18301. high order bits are used to encode the next cell state if it is alive
  18302. for each number of neighbor alive cells, the low order bits specify
  18303. the rule for "borning" new cells. Higher order bits encode for an
  18304. higher number of neighbor cells.
  18305. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  18306. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  18307. Default value is "S23/B3", which is the original Conway's game of life
  18308. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  18309. cells, and will born a new cell if there are three alive cells around
  18310. a dead cell.
  18311. @item size, s
  18312. Set the size of the output video. For the syntax of this option, check the
  18313. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18314. If @option{filename} is specified, the size is set by default to the
  18315. same size of the input file. If @option{size} is set, it must contain
  18316. the size specified in the input file, and the initial grid defined in
  18317. that file is centered in the larger resulting area.
  18318. If a filename is not specified, the size value defaults to "320x240"
  18319. (used for a randomly generated initial grid).
  18320. @item stitch
  18321. If set to 1, stitch the left and right grid edges together, and the
  18322. top and bottom edges also. Defaults to 1.
  18323. @item mold
  18324. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  18325. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  18326. value from 0 to 255.
  18327. @item life_color
  18328. Set the color of living (or new born) cells.
  18329. @item death_color
  18330. Set the color of dead cells. If @option{mold} is set, this is the first color
  18331. used to represent a dead cell.
  18332. @item mold_color
  18333. Set mold color, for definitely dead and moldy cells.
  18334. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  18335. ffmpeg-utils manual,ffmpeg-utils}.
  18336. @end table
  18337. @subsection Examples
  18338. @itemize
  18339. @item
  18340. Read a grid from @file{pattern}, and center it on a grid of size
  18341. 300x300 pixels:
  18342. @example
  18343. life=f=pattern:s=300x300
  18344. @end example
  18345. @item
  18346. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  18347. @example
  18348. life=ratio=2/3:s=200x200
  18349. @end example
  18350. @item
  18351. Specify a custom rule for evolving a randomly generated grid:
  18352. @example
  18353. life=rule=S14/B34
  18354. @end example
  18355. @item
  18356. Full example with slow death effect (mold) using @command{ffplay}:
  18357. @example
  18358. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  18359. @end example
  18360. @end itemize
  18361. @anchor{allrgb}
  18362. @anchor{allyuv}
  18363. @anchor{color}
  18364. @anchor{haldclutsrc}
  18365. @anchor{nullsrc}
  18366. @anchor{pal75bars}
  18367. @anchor{pal100bars}
  18368. @anchor{rgbtestsrc}
  18369. @anchor{smptebars}
  18370. @anchor{smptehdbars}
  18371. @anchor{testsrc}
  18372. @anchor{testsrc2}
  18373. @anchor{yuvtestsrc}
  18374. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  18375. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  18376. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  18377. The @code{color} source provides an uniformly colored input.
  18378. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  18379. @ref{haldclut} filter.
  18380. The @code{nullsrc} source returns unprocessed video frames. It is
  18381. mainly useful to be employed in analysis / debugging tools, or as the
  18382. source for filters which ignore the input data.
  18383. The @code{pal75bars} source generates a color bars pattern, based on
  18384. EBU PAL recommendations with 75% color levels.
  18385. The @code{pal100bars} source generates a color bars pattern, based on
  18386. EBU PAL recommendations with 100% color levels.
  18387. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  18388. detecting RGB vs BGR issues. You should see a red, green and blue
  18389. stripe from top to bottom.
  18390. The @code{smptebars} source generates a color bars pattern, based on
  18391. the SMPTE Engineering Guideline EG 1-1990.
  18392. The @code{smptehdbars} source generates a color bars pattern, based on
  18393. the SMPTE RP 219-2002.
  18394. The @code{testsrc} source generates a test video pattern, showing a
  18395. color pattern, a scrolling gradient and a timestamp. This is mainly
  18396. intended for testing purposes.
  18397. The @code{testsrc2} source is similar to testsrc, but supports more
  18398. pixel formats instead of just @code{rgb24}. This allows using it as an
  18399. input for other tests without requiring a format conversion.
  18400. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  18401. see a y, cb and cr stripe from top to bottom.
  18402. The sources accept the following parameters:
  18403. @table @option
  18404. @item level
  18405. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  18406. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  18407. pixels to be used as identity matrix for 3D lookup tables. Each component is
  18408. coded on a @code{1/(N*N)} scale.
  18409. @item color, c
  18410. Specify the color of the source, only available in the @code{color}
  18411. source. For the syntax of this option, check the
  18412. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18413. @item size, s
  18414. Specify the size of the sourced video. For the syntax of this option, check the
  18415. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18416. The default value is @code{320x240}.
  18417. This option is not available with the @code{allrgb}, @code{allyuv}, and
  18418. @code{haldclutsrc} filters.
  18419. @item rate, r
  18420. Specify the frame rate of the sourced video, as the number of frames
  18421. generated per second. It has to be a string in the format
  18422. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18423. number or a valid video frame rate abbreviation. The default value is
  18424. "25".
  18425. @item duration, d
  18426. Set the duration of the sourced video. See
  18427. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18428. for the accepted syntax.
  18429. If not specified, or the expressed duration is negative, the video is
  18430. supposed to be generated forever.
  18431. Since the frame rate is used as time base, all frames including the last one
  18432. will have their full duration. If the specified duration is not a multiple
  18433. of the frame duration, it will be rounded up.
  18434. @item sar
  18435. Set the sample aspect ratio of the sourced video.
  18436. @item alpha
  18437. Specify the alpha (opacity) of the background, only available in the
  18438. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  18439. 255 (fully opaque, the default).
  18440. @item decimals, n
  18441. Set the number of decimals to show in the timestamp, only available in the
  18442. @code{testsrc} source.
  18443. The displayed timestamp value will correspond to the original
  18444. timestamp value multiplied by the power of 10 of the specified
  18445. value. Default value is 0.
  18446. @end table
  18447. @subsection Examples
  18448. @itemize
  18449. @item
  18450. Generate a video with a duration of 5.3 seconds, with size
  18451. 176x144 and a frame rate of 10 frames per second:
  18452. @example
  18453. testsrc=duration=5.3:size=qcif:rate=10
  18454. @end example
  18455. @item
  18456. The following graph description will generate a red source
  18457. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  18458. frames per second:
  18459. @example
  18460. color=c=red@@0.2:s=qcif:r=10
  18461. @end example
  18462. @item
  18463. If the input content is to be ignored, @code{nullsrc} can be used. The
  18464. following command generates noise in the luminance plane by employing
  18465. the @code{geq} filter:
  18466. @example
  18467. nullsrc=s=256x256, geq=random(1)*255:128:128
  18468. @end example
  18469. @end itemize
  18470. @subsection Commands
  18471. The @code{color} source supports the following commands:
  18472. @table @option
  18473. @item c, color
  18474. Set the color of the created image. Accepts the same syntax of the
  18475. corresponding @option{color} option.
  18476. @end table
  18477. @section openclsrc
  18478. Generate video using an OpenCL program.
  18479. @table @option
  18480. @item source
  18481. OpenCL program source file.
  18482. @item kernel
  18483. Kernel name in program.
  18484. @item size, s
  18485. Size of frames to generate. This must be set.
  18486. @item format
  18487. Pixel format to use for the generated frames. This must be set.
  18488. @item rate, r
  18489. Number of frames generated every second. Default value is '25'.
  18490. @end table
  18491. For details of how the program loading works, see the @ref{program_opencl}
  18492. filter.
  18493. Example programs:
  18494. @itemize
  18495. @item
  18496. Generate a colour ramp by setting pixel values from the position of the pixel
  18497. in the output image. (Note that this will work with all pixel formats, but
  18498. the generated output will not be the same.)
  18499. @verbatim
  18500. __kernel void ramp(__write_only image2d_t dst,
  18501. unsigned int index)
  18502. {
  18503. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18504. float4 val;
  18505. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  18506. write_imagef(dst, loc, val);
  18507. }
  18508. @end verbatim
  18509. @item
  18510. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  18511. @verbatim
  18512. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  18513. unsigned int index)
  18514. {
  18515. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18516. float4 value = 0.0f;
  18517. int x = loc.x + index;
  18518. int y = loc.y + index;
  18519. while (x > 0 || y > 0) {
  18520. if (x % 3 == 1 && y % 3 == 1) {
  18521. value = 1.0f;
  18522. break;
  18523. }
  18524. x /= 3;
  18525. y /= 3;
  18526. }
  18527. write_imagef(dst, loc, value);
  18528. }
  18529. @end verbatim
  18530. @end itemize
  18531. @section sierpinski
  18532. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  18533. This source accepts the following options:
  18534. @table @option
  18535. @item size, s
  18536. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18537. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18538. @item rate, r
  18539. Set frame rate, expressed as number of frames per second. Default
  18540. value is "25".
  18541. @item seed
  18542. Set seed which is used for random panning.
  18543. @item jump
  18544. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  18545. @item type
  18546. Set fractal type, can be default @code{carpet} or @code{triangle}.
  18547. @end table
  18548. @c man end VIDEO SOURCES
  18549. @chapter Video Sinks
  18550. @c man begin VIDEO SINKS
  18551. Below is a description of the currently available video sinks.
  18552. @section buffersink
  18553. Buffer video frames, and make them available to the end of the filter
  18554. graph.
  18555. This sink is mainly intended for programmatic use, in particular
  18556. through the interface defined in @file{libavfilter/buffersink.h}
  18557. or the options system.
  18558. It accepts a pointer to an AVBufferSinkContext structure, which
  18559. defines the incoming buffers' formats, to be passed as the opaque
  18560. parameter to @code{avfilter_init_filter} for initialization.
  18561. @section nullsink
  18562. Null video sink: do absolutely nothing with the input video. It is
  18563. mainly useful as a template and for use in analysis / debugging
  18564. tools.
  18565. @c man end VIDEO SINKS
  18566. @chapter Multimedia Filters
  18567. @c man begin MULTIMEDIA FILTERS
  18568. Below is a description of the currently available multimedia filters.
  18569. @section abitscope
  18570. Convert input audio to a video output, displaying the audio bit scope.
  18571. The filter accepts the following options:
  18572. @table @option
  18573. @item rate, r
  18574. Set frame rate, expressed as number of frames per second. Default
  18575. value is "25".
  18576. @item size, s
  18577. Specify the video size for the output. For the syntax of this option, check the
  18578. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18579. Default value is @code{1024x256}.
  18580. @item colors
  18581. Specify list of colors separated by space or by '|' which will be used to
  18582. draw channels. Unrecognized or missing colors will be replaced
  18583. by white color.
  18584. @end table
  18585. @section adrawgraph
  18586. Draw a graph using input audio metadata.
  18587. See @ref{drawgraph}
  18588. @section agraphmonitor
  18589. See @ref{graphmonitor}.
  18590. @section ahistogram
  18591. Convert input audio to a video output, displaying the volume histogram.
  18592. The filter accepts the following options:
  18593. @table @option
  18594. @item dmode
  18595. Specify how histogram is calculated.
  18596. It accepts the following values:
  18597. @table @samp
  18598. @item single
  18599. Use single histogram for all channels.
  18600. @item separate
  18601. Use separate histogram for each channel.
  18602. @end table
  18603. Default is @code{single}.
  18604. @item rate, r
  18605. Set frame rate, expressed as number of frames per second. Default
  18606. value is "25".
  18607. @item size, s
  18608. Specify the video size for the output. For the syntax of this option, check the
  18609. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18610. Default value is @code{hd720}.
  18611. @item scale
  18612. Set display scale.
  18613. It accepts the following values:
  18614. @table @samp
  18615. @item log
  18616. logarithmic
  18617. @item sqrt
  18618. square root
  18619. @item cbrt
  18620. cubic root
  18621. @item lin
  18622. linear
  18623. @item rlog
  18624. reverse logarithmic
  18625. @end table
  18626. Default is @code{log}.
  18627. @item ascale
  18628. Set amplitude scale.
  18629. It accepts the following values:
  18630. @table @samp
  18631. @item log
  18632. logarithmic
  18633. @item lin
  18634. linear
  18635. @end table
  18636. Default is @code{log}.
  18637. @item acount
  18638. Set how much frames to accumulate in histogram.
  18639. Default is 1. Setting this to -1 accumulates all frames.
  18640. @item rheight
  18641. Set histogram ratio of window height.
  18642. @item slide
  18643. Set sonogram sliding.
  18644. It accepts the following values:
  18645. @table @samp
  18646. @item replace
  18647. replace old rows with new ones.
  18648. @item scroll
  18649. scroll from top to bottom.
  18650. @end table
  18651. Default is @code{replace}.
  18652. @end table
  18653. @section aphasemeter
  18654. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18655. representing mean phase of current audio frame. A video output can also be produced and is
  18656. enabled by default. The audio is passed through as first output.
  18657. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18658. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18659. and @code{1} means channels are in phase.
  18660. The filter accepts the following options, all related to its video output:
  18661. @table @option
  18662. @item rate, r
  18663. Set the output frame rate. Default value is @code{25}.
  18664. @item size, s
  18665. Set the video size for the output. For the syntax of this option, check the
  18666. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18667. Default value is @code{800x400}.
  18668. @item rc
  18669. @item gc
  18670. @item bc
  18671. Specify the red, green, blue contrast. Default values are @code{2},
  18672. @code{7} and @code{1}.
  18673. Allowed range is @code{[0, 255]}.
  18674. @item mpc
  18675. Set color which will be used for drawing median phase. If color is
  18676. @code{none} which is default, no median phase value will be drawn.
  18677. @item video
  18678. Enable video output. Default is enabled.
  18679. @end table
  18680. @subsection phasing detection
  18681. The filter also detects out of phase and mono sequences in stereo streams.
  18682. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18683. The filter accepts the following options for this detection:
  18684. @table @option
  18685. @item phasing
  18686. Enable mono and out of phase detection. Default is disabled.
  18687. @item tolerance, t
  18688. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18689. Allowed range is @code{[0, 1]}.
  18690. @item angle, a
  18691. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18692. Allowed range is @code{[90, 180]}.
  18693. @item duration, d
  18694. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18695. @end table
  18696. @subsection Examples
  18697. @itemize
  18698. @item
  18699. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18700. @example
  18701. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18702. @end example
  18703. @end itemize
  18704. @section avectorscope
  18705. Convert input audio to a video output, representing the audio vector
  18706. scope.
  18707. The filter is used to measure the difference between channels of stereo
  18708. audio stream. A monaural signal, consisting of identical left and right
  18709. signal, results in straight vertical line. Any stereo separation is visible
  18710. as a deviation from this line, creating a Lissajous figure.
  18711. If the straight (or deviation from it) but horizontal line appears this
  18712. indicates that the left and right channels are out of phase.
  18713. The filter accepts the following options:
  18714. @table @option
  18715. @item mode, m
  18716. Set the vectorscope mode.
  18717. Available values are:
  18718. @table @samp
  18719. @item lissajous
  18720. Lissajous rotated by 45 degrees.
  18721. @item lissajous_xy
  18722. Same as above but not rotated.
  18723. @item polar
  18724. Shape resembling half of circle.
  18725. @end table
  18726. Default value is @samp{lissajous}.
  18727. @item size, s
  18728. Set the video size for the output. For the syntax of this option, check the
  18729. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18730. Default value is @code{400x400}.
  18731. @item rate, r
  18732. Set the output frame rate. Default value is @code{25}.
  18733. @item rc
  18734. @item gc
  18735. @item bc
  18736. @item ac
  18737. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18738. @code{160}, @code{80} and @code{255}.
  18739. Allowed range is @code{[0, 255]}.
  18740. @item rf
  18741. @item gf
  18742. @item bf
  18743. @item af
  18744. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18745. @code{10}, @code{5} and @code{5}.
  18746. Allowed range is @code{[0, 255]}.
  18747. @item zoom
  18748. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18749. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18750. @item draw
  18751. Set the vectorscope drawing mode.
  18752. Available values are:
  18753. @table @samp
  18754. @item dot
  18755. Draw dot for each sample.
  18756. @item line
  18757. Draw line between previous and current sample.
  18758. @end table
  18759. Default value is @samp{dot}.
  18760. @item scale
  18761. Specify amplitude scale of audio samples.
  18762. Available values are:
  18763. @table @samp
  18764. @item lin
  18765. Linear.
  18766. @item sqrt
  18767. Square root.
  18768. @item cbrt
  18769. Cubic root.
  18770. @item log
  18771. Logarithmic.
  18772. @end table
  18773. @item swap
  18774. Swap left channel axis with right channel axis.
  18775. @item mirror
  18776. Mirror axis.
  18777. @table @samp
  18778. @item none
  18779. No mirror.
  18780. @item x
  18781. Mirror only x axis.
  18782. @item y
  18783. Mirror only y axis.
  18784. @item xy
  18785. Mirror both axis.
  18786. @end table
  18787. @end table
  18788. @subsection Examples
  18789. @itemize
  18790. @item
  18791. Complete example using @command{ffplay}:
  18792. @example
  18793. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18794. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18795. @end example
  18796. @end itemize
  18797. @section bench, abench
  18798. Benchmark part of a filtergraph.
  18799. The filter accepts the following options:
  18800. @table @option
  18801. @item action
  18802. Start or stop a timer.
  18803. Available values are:
  18804. @table @samp
  18805. @item start
  18806. Get the current time, set it as frame metadata (using the key
  18807. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18808. @item stop
  18809. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18810. the input frame metadata to get the time difference. Time difference, average,
  18811. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18812. @code{min}) are then printed. The timestamps are expressed in seconds.
  18813. @end table
  18814. @end table
  18815. @subsection Examples
  18816. @itemize
  18817. @item
  18818. Benchmark @ref{selectivecolor} filter:
  18819. @example
  18820. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18821. @end example
  18822. @end itemize
  18823. @section concat
  18824. Concatenate audio and video streams, joining them together one after the
  18825. other.
  18826. The filter works on segments of synchronized video and audio streams. All
  18827. segments must have the same number of streams of each type, and that will
  18828. also be the number of streams at output.
  18829. The filter accepts the following options:
  18830. @table @option
  18831. @item n
  18832. Set the number of segments. Default is 2.
  18833. @item v
  18834. Set the number of output video streams, that is also the number of video
  18835. streams in each segment. Default is 1.
  18836. @item a
  18837. Set the number of output audio streams, that is also the number of audio
  18838. streams in each segment. Default is 0.
  18839. @item unsafe
  18840. Activate unsafe mode: do not fail if segments have a different format.
  18841. @end table
  18842. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18843. @var{a} audio outputs.
  18844. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18845. segment, in the same order as the outputs, then the inputs for the second
  18846. segment, etc.
  18847. Related streams do not always have exactly the same duration, for various
  18848. reasons including codec frame size or sloppy authoring. For that reason,
  18849. related synchronized streams (e.g. a video and its audio track) should be
  18850. concatenated at once. The concat filter will use the duration of the longest
  18851. stream in each segment (except the last one), and if necessary pad shorter
  18852. audio streams with silence.
  18853. For this filter to work correctly, all segments must start at timestamp 0.
  18854. All corresponding streams must have the same parameters in all segments; the
  18855. filtering system will automatically select a common pixel format for video
  18856. streams, and a common sample format, sample rate and channel layout for
  18857. audio streams, but other settings, such as resolution, must be converted
  18858. explicitly by the user.
  18859. Different frame rates are acceptable but will result in variable frame rate
  18860. at output; be sure to configure the output file to handle it.
  18861. @subsection Examples
  18862. @itemize
  18863. @item
  18864. Concatenate an opening, an episode and an ending, all in bilingual version
  18865. (video in stream 0, audio in streams 1 and 2):
  18866. @example
  18867. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18868. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18869. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18870. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18871. @end example
  18872. @item
  18873. Concatenate two parts, handling audio and video separately, using the
  18874. (a)movie sources, and adjusting the resolution:
  18875. @example
  18876. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18877. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18878. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18879. @end example
  18880. Note that a desync will happen at the stitch if the audio and video streams
  18881. do not have exactly the same duration in the first file.
  18882. @end itemize
  18883. @subsection Commands
  18884. This filter supports the following commands:
  18885. @table @option
  18886. @item next
  18887. Close the current segment and step to the next one
  18888. @end table
  18889. @anchor{ebur128}
  18890. @section ebur128
  18891. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18892. level. By default, it logs a message at a frequency of 10Hz with the
  18893. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18894. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18895. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18896. sample format is double-precision floating point. The input stream will be converted to
  18897. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18898. after this filter to obtain the original parameters.
  18899. The filter also has a video output (see the @var{video} option) with a real
  18900. time graph to observe the loudness evolution. The graphic contains the logged
  18901. message mentioned above, so it is not printed anymore when this option is set,
  18902. unless the verbose logging is set. The main graphing area contains the
  18903. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18904. the momentary loudness (400 milliseconds), but can optionally be configured
  18905. to instead display short-term loudness (see @var{gauge}).
  18906. The green area marks a +/- 1LU target range around the target loudness
  18907. (-23LUFS by default, unless modified through @var{target}).
  18908. More information about the Loudness Recommendation EBU R128 on
  18909. @url{http://tech.ebu.ch/loudness}.
  18910. The filter accepts the following options:
  18911. @table @option
  18912. @item video
  18913. Activate the video output. The audio stream is passed unchanged whether this
  18914. option is set or no. The video stream will be the first output stream if
  18915. activated. Default is @code{0}.
  18916. @item size
  18917. Set the video size. This option is for video only. For the syntax of this
  18918. option, check the
  18919. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18920. Default and minimum resolution is @code{640x480}.
  18921. @item meter
  18922. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18923. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18924. other integer value between this range is allowed.
  18925. @item metadata
  18926. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18927. into 100ms output frames, each of them containing various loudness information
  18928. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18929. Default is @code{0}.
  18930. @item framelog
  18931. Force the frame logging level.
  18932. Available values are:
  18933. @table @samp
  18934. @item info
  18935. information logging level
  18936. @item verbose
  18937. verbose logging level
  18938. @end table
  18939. By default, the logging level is set to @var{info}. If the @option{video} or
  18940. the @option{metadata} options are set, it switches to @var{verbose}.
  18941. @item peak
  18942. Set peak mode(s).
  18943. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18944. values are:
  18945. @table @samp
  18946. @item none
  18947. Disable any peak mode (default).
  18948. @item sample
  18949. Enable sample-peak mode.
  18950. Simple peak mode looking for the higher sample value. It logs a message
  18951. for sample-peak (identified by @code{SPK}).
  18952. @item true
  18953. Enable true-peak mode.
  18954. If enabled, the peak lookup is done on an over-sampled version of the input
  18955. stream for better peak accuracy. It logs a message for true-peak.
  18956. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18957. This mode requires a build with @code{libswresample}.
  18958. @end table
  18959. @item dualmono
  18960. Treat mono input files as "dual mono". If a mono file is intended for playback
  18961. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18962. If set to @code{true}, this option will compensate for this effect.
  18963. Multi-channel input files are not affected by this option.
  18964. @item panlaw
  18965. Set a specific pan law to be used for the measurement of dual mono files.
  18966. This parameter is optional, and has a default value of -3.01dB.
  18967. @item target
  18968. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18969. This parameter is optional and has a default value of -23LUFS as specified
  18970. by EBU R128. However, material published online may prefer a level of -16LUFS
  18971. (e.g. for use with podcasts or video platforms).
  18972. @item gauge
  18973. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18974. @code{shortterm}. By default the momentary value will be used, but in certain
  18975. scenarios it may be more useful to observe the short term value instead (e.g.
  18976. live mixing).
  18977. @item scale
  18978. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18979. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18980. video output, not the summary or continuous log output.
  18981. @end table
  18982. @subsection Examples
  18983. @itemize
  18984. @item
  18985. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18986. @example
  18987. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18988. @end example
  18989. @item
  18990. Run an analysis with @command{ffmpeg}:
  18991. @example
  18992. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18993. @end example
  18994. @end itemize
  18995. @section interleave, ainterleave
  18996. Temporally interleave frames from several inputs.
  18997. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18998. These filters read frames from several inputs and send the oldest
  18999. queued frame to the output.
  19000. Input streams must have well defined, monotonically increasing frame
  19001. timestamp values.
  19002. In order to submit one frame to output, these filters need to enqueue
  19003. at least one frame for each input, so they cannot work in case one
  19004. input is not yet terminated and will not receive incoming frames.
  19005. For example consider the case when one input is a @code{select} filter
  19006. which always drops input frames. The @code{interleave} filter will keep
  19007. reading from that input, but it will never be able to send new frames
  19008. to output until the input sends an end-of-stream signal.
  19009. Also, depending on inputs synchronization, the filters will drop
  19010. frames in case one input receives more frames than the other ones, and
  19011. the queue is already filled.
  19012. These filters accept the following options:
  19013. @table @option
  19014. @item nb_inputs, n
  19015. Set the number of different inputs, it is 2 by default.
  19016. @item duration
  19017. How to determine the end-of-stream.
  19018. @table @option
  19019. @item longest
  19020. The duration of the longest input. (default)
  19021. @item shortest
  19022. The duration of the shortest input.
  19023. @item first
  19024. The duration of the first input.
  19025. @end table
  19026. @end table
  19027. @subsection Examples
  19028. @itemize
  19029. @item
  19030. Interleave frames belonging to different streams using @command{ffmpeg}:
  19031. @example
  19032. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  19033. @end example
  19034. @item
  19035. Add flickering blur effect:
  19036. @example
  19037. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  19038. @end example
  19039. @end itemize
  19040. @section metadata, ametadata
  19041. Manipulate frame metadata.
  19042. This filter accepts the following options:
  19043. @table @option
  19044. @item mode
  19045. Set mode of operation of the filter.
  19046. Can be one of the following:
  19047. @table @samp
  19048. @item select
  19049. If both @code{value} and @code{key} is set, select frames
  19050. which have such metadata. If only @code{key} is set, select
  19051. every frame that has such key in metadata.
  19052. @item add
  19053. Add new metadata @code{key} and @code{value}. If key is already available
  19054. do nothing.
  19055. @item modify
  19056. Modify value of already present key.
  19057. @item delete
  19058. If @code{value} is set, delete only keys that have such value.
  19059. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  19060. the frame.
  19061. @item print
  19062. Print key and its value if metadata was found. If @code{key} is not set print all
  19063. metadata values available in frame.
  19064. @end table
  19065. @item key
  19066. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  19067. @item value
  19068. Set metadata value which will be used. This option is mandatory for
  19069. @code{modify} and @code{add} mode.
  19070. @item function
  19071. Which function to use when comparing metadata value and @code{value}.
  19072. Can be one of following:
  19073. @table @samp
  19074. @item same_str
  19075. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  19076. @item starts_with
  19077. Values are interpreted as strings, returns true if metadata value starts with
  19078. the @code{value} option string.
  19079. @item less
  19080. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  19081. @item equal
  19082. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  19083. @item greater
  19084. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  19085. @item expr
  19086. Values are interpreted as floats, returns true if expression from option @code{expr}
  19087. evaluates to true.
  19088. @item ends_with
  19089. Values are interpreted as strings, returns true if metadata value ends with
  19090. the @code{value} option string.
  19091. @end table
  19092. @item expr
  19093. Set expression which is used when @code{function} is set to @code{expr}.
  19094. The expression is evaluated through the eval API and can contain the following
  19095. constants:
  19096. @table @option
  19097. @item VALUE1
  19098. Float representation of @code{value} from metadata key.
  19099. @item VALUE2
  19100. Float representation of @code{value} as supplied by user in @code{value} option.
  19101. @end table
  19102. @item file
  19103. If specified in @code{print} mode, output is written to the named file. Instead of
  19104. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  19105. for standard output. If @code{file} option is not set, output is written to the log
  19106. with AV_LOG_INFO loglevel.
  19107. @item direct
  19108. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  19109. @end table
  19110. @subsection Examples
  19111. @itemize
  19112. @item
  19113. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  19114. between 0 and 1.
  19115. @example
  19116. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  19117. @end example
  19118. @item
  19119. Print silencedetect output to file @file{metadata.txt}.
  19120. @example
  19121. silencedetect,ametadata=mode=print:file=metadata.txt
  19122. @end example
  19123. @item
  19124. Direct all metadata to a pipe with file descriptor 4.
  19125. @example
  19126. metadata=mode=print:file='pipe\:4'
  19127. @end example
  19128. @end itemize
  19129. @section perms, aperms
  19130. Set read/write permissions for the output frames.
  19131. These filters are mainly aimed at developers to test direct path in the
  19132. following filter in the filtergraph.
  19133. The filters accept the following options:
  19134. @table @option
  19135. @item mode
  19136. Select the permissions mode.
  19137. It accepts the following values:
  19138. @table @samp
  19139. @item none
  19140. Do nothing. This is the default.
  19141. @item ro
  19142. Set all the output frames read-only.
  19143. @item rw
  19144. Set all the output frames directly writable.
  19145. @item toggle
  19146. Make the frame read-only if writable, and writable if read-only.
  19147. @item random
  19148. Set each output frame read-only or writable randomly.
  19149. @end table
  19150. @item seed
  19151. Set the seed for the @var{random} mode, must be an integer included between
  19152. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  19153. @code{-1}, the filter will try to use a good random seed on a best effort
  19154. basis.
  19155. @end table
  19156. Note: in case of auto-inserted filter between the permission filter and the
  19157. following one, the permission might not be received as expected in that
  19158. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  19159. perms/aperms filter can avoid this problem.
  19160. @section realtime, arealtime
  19161. Slow down filtering to match real time approximately.
  19162. These filters will pause the filtering for a variable amount of time to
  19163. match the output rate with the input timestamps.
  19164. They are similar to the @option{re} option to @code{ffmpeg}.
  19165. They accept the following options:
  19166. @table @option
  19167. @item limit
  19168. Time limit for the pauses. Any pause longer than that will be considered
  19169. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  19170. @item speed
  19171. Speed factor for processing. The value must be a float larger than zero.
  19172. Values larger than 1.0 will result in faster than realtime processing,
  19173. smaller will slow processing down. The @var{limit} is automatically adapted
  19174. accordingly. Default is 1.0.
  19175. A processing speed faster than what is possible without these filters cannot
  19176. be achieved.
  19177. @end table
  19178. @anchor{select}
  19179. @section select, aselect
  19180. Select frames to pass in output.
  19181. This filter accepts the following options:
  19182. @table @option
  19183. @item expr, e
  19184. Set expression, which is evaluated for each input frame.
  19185. If the expression is evaluated to zero, the frame is discarded.
  19186. If the evaluation result is negative or NaN, the frame is sent to the
  19187. first output; otherwise it is sent to the output with index
  19188. @code{ceil(val)-1}, assuming that the input index starts from 0.
  19189. For example a value of @code{1.2} corresponds to the output with index
  19190. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  19191. @item outputs, n
  19192. Set the number of outputs. The output to which to send the selected
  19193. frame is based on the result of the evaluation. Default value is 1.
  19194. @end table
  19195. The expression can contain the following constants:
  19196. @table @option
  19197. @item n
  19198. The (sequential) number of the filtered frame, starting from 0.
  19199. @item selected_n
  19200. The (sequential) number of the selected frame, starting from 0.
  19201. @item prev_selected_n
  19202. The sequential number of the last selected frame. It's NAN if undefined.
  19203. @item TB
  19204. The timebase of the input timestamps.
  19205. @item pts
  19206. The PTS (Presentation TimeStamp) of the filtered video frame,
  19207. expressed in @var{TB} units. It's NAN if undefined.
  19208. @item t
  19209. The PTS of the filtered video frame,
  19210. expressed in seconds. It's NAN if undefined.
  19211. @item prev_pts
  19212. The PTS of the previously filtered video frame. It's NAN if undefined.
  19213. @item prev_selected_pts
  19214. The PTS of the last previously filtered video frame. It's NAN if undefined.
  19215. @item prev_selected_t
  19216. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  19217. @item start_pts
  19218. The PTS of the first video frame in the video. It's NAN if undefined.
  19219. @item start_t
  19220. The time of the first video frame in the video. It's NAN if undefined.
  19221. @item pict_type @emph{(video only)}
  19222. The type of the filtered frame. It can assume one of the following
  19223. values:
  19224. @table @option
  19225. @item I
  19226. @item P
  19227. @item B
  19228. @item S
  19229. @item SI
  19230. @item SP
  19231. @item BI
  19232. @end table
  19233. @item interlace_type @emph{(video only)}
  19234. The frame interlace type. It can assume one of the following values:
  19235. @table @option
  19236. @item PROGRESSIVE
  19237. The frame is progressive (not interlaced).
  19238. @item TOPFIRST
  19239. The frame is top-field-first.
  19240. @item BOTTOMFIRST
  19241. The frame is bottom-field-first.
  19242. @end table
  19243. @item consumed_sample_n @emph{(audio only)}
  19244. the number of selected samples before the current frame
  19245. @item samples_n @emph{(audio only)}
  19246. the number of samples in the current frame
  19247. @item sample_rate @emph{(audio only)}
  19248. the input sample rate
  19249. @item key
  19250. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  19251. @item pos
  19252. the position in the file of the filtered frame, -1 if the information
  19253. is not available (e.g. for synthetic video)
  19254. @item scene @emph{(video only)}
  19255. value between 0 and 1 to indicate a new scene; a low value reflects a low
  19256. probability for the current frame to introduce a new scene, while a higher
  19257. value means the current frame is more likely to be one (see the example below)
  19258. @item concatdec_select
  19259. The concat demuxer can select only part of a concat input file by setting an
  19260. inpoint and an outpoint, but the output packets may not be entirely contained
  19261. in the selected interval. By using this variable, it is possible to skip frames
  19262. generated by the concat demuxer which are not exactly contained in the selected
  19263. interval.
  19264. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  19265. and the @var{lavf.concat.duration} packet metadata values which are also
  19266. present in the decoded frames.
  19267. The @var{concatdec_select} variable is -1 if the frame pts is at least
  19268. start_time and either the duration metadata is missing or the frame pts is less
  19269. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  19270. missing.
  19271. That basically means that an input frame is selected if its pts is within the
  19272. interval set by the concat demuxer.
  19273. @end table
  19274. The default value of the select expression is "1".
  19275. @subsection Examples
  19276. @itemize
  19277. @item
  19278. Select all frames in input:
  19279. @example
  19280. select
  19281. @end example
  19282. The example above is the same as:
  19283. @example
  19284. select=1
  19285. @end example
  19286. @item
  19287. Skip all frames:
  19288. @example
  19289. select=0
  19290. @end example
  19291. @item
  19292. Select only I-frames:
  19293. @example
  19294. select='eq(pict_type\,I)'
  19295. @end example
  19296. @item
  19297. Select one frame every 100:
  19298. @example
  19299. select='not(mod(n\,100))'
  19300. @end example
  19301. @item
  19302. Select only frames contained in the 10-20 time interval:
  19303. @example
  19304. select=between(t\,10\,20)
  19305. @end example
  19306. @item
  19307. Select only I-frames contained in the 10-20 time interval:
  19308. @example
  19309. select=between(t\,10\,20)*eq(pict_type\,I)
  19310. @end example
  19311. @item
  19312. Select frames with a minimum distance of 10 seconds:
  19313. @example
  19314. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  19315. @end example
  19316. @item
  19317. Use aselect to select only audio frames with samples number > 100:
  19318. @example
  19319. aselect='gt(samples_n\,100)'
  19320. @end example
  19321. @item
  19322. Create a mosaic of the first scenes:
  19323. @example
  19324. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  19325. @end example
  19326. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  19327. choice.
  19328. @item
  19329. Send even and odd frames to separate outputs, and compose them:
  19330. @example
  19331. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  19332. @end example
  19333. @item
  19334. Select useful frames from an ffconcat file which is using inpoints and
  19335. outpoints but where the source files are not intra frame only.
  19336. @example
  19337. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  19338. @end example
  19339. @end itemize
  19340. @section sendcmd, asendcmd
  19341. Send commands to filters in the filtergraph.
  19342. These filters read commands to be sent to other filters in the
  19343. filtergraph.
  19344. @code{sendcmd} must be inserted between two video filters,
  19345. @code{asendcmd} must be inserted between two audio filters, but apart
  19346. from that they act the same way.
  19347. The specification of commands can be provided in the filter arguments
  19348. with the @var{commands} option, or in a file specified by the
  19349. @var{filename} option.
  19350. These filters accept the following options:
  19351. @table @option
  19352. @item commands, c
  19353. Set the commands to be read and sent to the other filters.
  19354. @item filename, f
  19355. Set the filename of the commands to be read and sent to the other
  19356. filters.
  19357. @end table
  19358. @subsection Commands syntax
  19359. A commands description consists of a sequence of interval
  19360. specifications, comprising a list of commands to be executed when a
  19361. particular event related to that interval occurs. The occurring event
  19362. is typically the current frame time entering or leaving a given time
  19363. interval.
  19364. An interval is specified by the following syntax:
  19365. @example
  19366. @var{START}[-@var{END}] @var{COMMANDS};
  19367. @end example
  19368. The time interval is specified by the @var{START} and @var{END} times.
  19369. @var{END} is optional and defaults to the maximum time.
  19370. The current frame time is considered within the specified interval if
  19371. it is included in the interval [@var{START}, @var{END}), that is when
  19372. the time is greater or equal to @var{START} and is lesser than
  19373. @var{END}.
  19374. @var{COMMANDS} consists of a sequence of one or more command
  19375. specifications, separated by ",", relating to that interval. The
  19376. syntax of a command specification is given by:
  19377. @example
  19378. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  19379. @end example
  19380. @var{FLAGS} is optional and specifies the type of events relating to
  19381. the time interval which enable sending the specified command, and must
  19382. be a non-null sequence of identifier flags separated by "+" or "|" and
  19383. enclosed between "[" and "]".
  19384. The following flags are recognized:
  19385. @table @option
  19386. @item enter
  19387. The command is sent when the current frame timestamp enters the
  19388. specified interval. In other words, the command is sent when the
  19389. previous frame timestamp was not in the given interval, and the
  19390. current is.
  19391. @item leave
  19392. The command is sent when the current frame timestamp leaves the
  19393. specified interval. In other words, the command is sent when the
  19394. previous frame timestamp was in the given interval, and the
  19395. current is not.
  19396. @item expr
  19397. The command @var{ARG} is interpreted as expression and result of
  19398. expression is passed as @var{ARG}.
  19399. The expression is evaluated through the eval API and can contain the following
  19400. constants:
  19401. @table @option
  19402. @item POS
  19403. Original position in the file of the frame, or undefined if undefined
  19404. for the current frame.
  19405. @item PTS
  19406. The presentation timestamp in input.
  19407. @item N
  19408. The count of the input frame for video or audio, starting from 0.
  19409. @item T
  19410. The time in seconds of the current frame.
  19411. @item TS
  19412. The start time in seconds of the current command interval.
  19413. @item TE
  19414. The end time in seconds of the current command interval.
  19415. @item TI
  19416. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  19417. @end table
  19418. @end table
  19419. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  19420. assumed.
  19421. @var{TARGET} specifies the target of the command, usually the name of
  19422. the filter class or a specific filter instance name.
  19423. @var{COMMAND} specifies the name of the command for the target filter.
  19424. @var{ARG} is optional and specifies the optional list of argument for
  19425. the given @var{COMMAND}.
  19426. Between one interval specification and another, whitespaces, or
  19427. sequences of characters starting with @code{#} until the end of line,
  19428. are ignored and can be used to annotate comments.
  19429. A simplified BNF description of the commands specification syntax
  19430. follows:
  19431. @example
  19432. @var{COMMAND_FLAG} ::= "enter" | "leave"
  19433. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  19434. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  19435. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  19436. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  19437. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  19438. @end example
  19439. @subsection Examples
  19440. @itemize
  19441. @item
  19442. Specify audio tempo change at second 4:
  19443. @example
  19444. asendcmd=c='4.0 atempo tempo 1.5',atempo
  19445. @end example
  19446. @item
  19447. Target a specific filter instance:
  19448. @example
  19449. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  19450. @end example
  19451. @item
  19452. Specify a list of drawtext and hue commands in a file.
  19453. @example
  19454. # show text in the interval 5-10
  19455. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  19456. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  19457. # desaturate the image in the interval 15-20
  19458. 15.0-20.0 [enter] hue s 0,
  19459. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  19460. [leave] hue s 1,
  19461. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  19462. # apply an exponential saturation fade-out effect, starting from time 25
  19463. 25 [enter] hue s exp(25-t)
  19464. @end example
  19465. A filtergraph allowing to read and process the above command list
  19466. stored in a file @file{test.cmd}, can be specified with:
  19467. @example
  19468. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  19469. @end example
  19470. @end itemize
  19471. @anchor{setpts}
  19472. @section setpts, asetpts
  19473. Change the PTS (presentation timestamp) of the input frames.
  19474. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  19475. This filter accepts the following options:
  19476. @table @option
  19477. @item expr
  19478. The expression which is evaluated for each frame to construct its timestamp.
  19479. @end table
  19480. The expression is evaluated through the eval API and can contain the following
  19481. constants:
  19482. @table @option
  19483. @item FRAME_RATE, FR
  19484. frame rate, only defined for constant frame-rate video
  19485. @item PTS
  19486. The presentation timestamp in input
  19487. @item N
  19488. The count of the input frame for video or the number of consumed samples,
  19489. not including the current frame for audio, starting from 0.
  19490. @item NB_CONSUMED_SAMPLES
  19491. The number of consumed samples, not including the current frame (only
  19492. audio)
  19493. @item NB_SAMPLES, S
  19494. The number of samples in the current frame (only audio)
  19495. @item SAMPLE_RATE, SR
  19496. The audio sample rate.
  19497. @item STARTPTS
  19498. The PTS of the first frame.
  19499. @item STARTT
  19500. the time in seconds of the first frame
  19501. @item INTERLACED
  19502. State whether the current frame is interlaced.
  19503. @item T
  19504. the time in seconds of the current frame
  19505. @item POS
  19506. original position in the file of the frame, or undefined if undefined
  19507. for the current frame
  19508. @item PREV_INPTS
  19509. The previous input PTS.
  19510. @item PREV_INT
  19511. previous input time in seconds
  19512. @item PREV_OUTPTS
  19513. The previous output PTS.
  19514. @item PREV_OUTT
  19515. previous output time in seconds
  19516. @item RTCTIME
  19517. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  19518. instead.
  19519. @item RTCSTART
  19520. The wallclock (RTC) time at the start of the movie in microseconds.
  19521. @item TB
  19522. The timebase of the input timestamps.
  19523. @end table
  19524. @subsection Examples
  19525. @itemize
  19526. @item
  19527. Start counting PTS from zero
  19528. @example
  19529. setpts=PTS-STARTPTS
  19530. @end example
  19531. @item
  19532. Apply fast motion effect:
  19533. @example
  19534. setpts=0.5*PTS
  19535. @end example
  19536. @item
  19537. Apply slow motion effect:
  19538. @example
  19539. setpts=2.0*PTS
  19540. @end example
  19541. @item
  19542. Set fixed rate of 25 frames per second:
  19543. @example
  19544. setpts=N/(25*TB)
  19545. @end example
  19546. @item
  19547. Set fixed rate 25 fps with some jitter:
  19548. @example
  19549. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  19550. @end example
  19551. @item
  19552. Apply an offset of 10 seconds to the input PTS:
  19553. @example
  19554. setpts=PTS+10/TB
  19555. @end example
  19556. @item
  19557. Generate timestamps from a "live source" and rebase onto the current timebase:
  19558. @example
  19559. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  19560. @end example
  19561. @item
  19562. Generate timestamps by counting samples:
  19563. @example
  19564. asetpts=N/SR/TB
  19565. @end example
  19566. @end itemize
  19567. @section setrange
  19568. Force color range for the output video frame.
  19569. The @code{setrange} filter marks the color range property for the
  19570. output frames. It does not change the input frame, but only sets the
  19571. corresponding property, which affects how the frame is treated by
  19572. following filters.
  19573. The filter accepts the following options:
  19574. @table @option
  19575. @item range
  19576. Available values are:
  19577. @table @samp
  19578. @item auto
  19579. Keep the same color range property.
  19580. @item unspecified, unknown
  19581. Set the color range as unspecified.
  19582. @item limited, tv, mpeg
  19583. Set the color range as limited.
  19584. @item full, pc, jpeg
  19585. Set the color range as full.
  19586. @end table
  19587. @end table
  19588. @section settb, asettb
  19589. Set the timebase to use for the output frames timestamps.
  19590. It is mainly useful for testing timebase configuration.
  19591. It accepts the following parameters:
  19592. @table @option
  19593. @item expr, tb
  19594. The expression which is evaluated into the output timebase.
  19595. @end table
  19596. The value for @option{tb} is an arithmetic expression representing a
  19597. rational. The expression can contain the constants "AVTB" (the default
  19598. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19599. audio only). Default value is "intb".
  19600. @subsection Examples
  19601. @itemize
  19602. @item
  19603. Set the timebase to 1/25:
  19604. @example
  19605. settb=expr=1/25
  19606. @end example
  19607. @item
  19608. Set the timebase to 1/10:
  19609. @example
  19610. settb=expr=0.1
  19611. @end example
  19612. @item
  19613. Set the timebase to 1001/1000:
  19614. @example
  19615. settb=1+0.001
  19616. @end example
  19617. @item
  19618. Set the timebase to 2*intb:
  19619. @example
  19620. settb=2*intb
  19621. @end example
  19622. @item
  19623. Set the default timebase value:
  19624. @example
  19625. settb=AVTB
  19626. @end example
  19627. @end itemize
  19628. @section showcqt
  19629. Convert input audio to a video output representing frequency spectrum
  19630. logarithmically using Brown-Puckette constant Q transform algorithm with
  19631. direct frequency domain coefficient calculation (but the transform itself
  19632. is not really constant Q, instead the Q factor is actually variable/clamped),
  19633. with musical tone scale, from E0 to D#10.
  19634. The filter accepts the following options:
  19635. @table @option
  19636. @item size, s
  19637. Specify the video size for the output. It must be even. For the syntax of this option,
  19638. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19639. Default value is @code{1920x1080}.
  19640. @item fps, rate, r
  19641. Set the output frame rate. Default value is @code{25}.
  19642. @item bar_h
  19643. Set the bargraph height. It must be even. Default value is @code{-1} which
  19644. computes the bargraph height automatically.
  19645. @item axis_h
  19646. Set the axis height. It must be even. Default value is @code{-1} which computes
  19647. the axis height automatically.
  19648. @item sono_h
  19649. Set the sonogram height. It must be even. Default value is @code{-1} which
  19650. computes the sonogram height automatically.
  19651. @item fullhd
  19652. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19653. instead. Default value is @code{1}.
  19654. @item sono_v, volume
  19655. Specify the sonogram volume expression. It can contain variables:
  19656. @table @option
  19657. @item bar_v
  19658. the @var{bar_v} evaluated expression
  19659. @item frequency, freq, f
  19660. the frequency where it is evaluated
  19661. @item timeclamp, tc
  19662. the value of @var{timeclamp} option
  19663. @end table
  19664. and functions:
  19665. @table @option
  19666. @item a_weighting(f)
  19667. A-weighting of equal loudness
  19668. @item b_weighting(f)
  19669. B-weighting of equal loudness
  19670. @item c_weighting(f)
  19671. C-weighting of equal loudness.
  19672. @end table
  19673. Default value is @code{16}.
  19674. @item bar_v, volume2
  19675. Specify the bargraph volume expression. It can contain variables:
  19676. @table @option
  19677. @item sono_v
  19678. the @var{sono_v} evaluated expression
  19679. @item frequency, freq, f
  19680. the frequency where it is evaluated
  19681. @item timeclamp, tc
  19682. the value of @var{timeclamp} option
  19683. @end table
  19684. and functions:
  19685. @table @option
  19686. @item a_weighting(f)
  19687. A-weighting of equal loudness
  19688. @item b_weighting(f)
  19689. B-weighting of equal loudness
  19690. @item c_weighting(f)
  19691. C-weighting of equal loudness.
  19692. @end table
  19693. Default value is @code{sono_v}.
  19694. @item sono_g, gamma
  19695. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19696. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19697. Acceptable range is @code{[1, 7]}.
  19698. @item bar_g, gamma2
  19699. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19700. @code{[1, 7]}.
  19701. @item bar_t
  19702. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19703. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19704. @item timeclamp, tc
  19705. Specify the transform timeclamp. At low frequency, there is trade-off between
  19706. accuracy in time domain and frequency domain. If timeclamp is lower,
  19707. event in time domain is represented more accurately (such as fast bass drum),
  19708. otherwise event in frequency domain is represented more accurately
  19709. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19710. @item attack
  19711. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19712. limits future samples by applying asymmetric windowing in time domain, useful
  19713. when low latency is required. Accepted range is @code{[0, 1]}.
  19714. @item basefreq
  19715. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19716. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19717. @item endfreq
  19718. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19719. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19720. @item coeffclamp
  19721. This option is deprecated and ignored.
  19722. @item tlength
  19723. Specify the transform length in time domain. Use this option to control accuracy
  19724. trade-off between time domain and frequency domain at every frequency sample.
  19725. It can contain variables:
  19726. @table @option
  19727. @item frequency, freq, f
  19728. the frequency where it is evaluated
  19729. @item timeclamp, tc
  19730. the value of @var{timeclamp} option.
  19731. @end table
  19732. Default value is @code{384*tc/(384+tc*f)}.
  19733. @item count
  19734. Specify the transform count for every video frame. Default value is @code{6}.
  19735. Acceptable range is @code{[1, 30]}.
  19736. @item fcount
  19737. Specify the transform count for every single pixel. Default value is @code{0},
  19738. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19739. @item fontfile
  19740. Specify font file for use with freetype to draw the axis. If not specified,
  19741. use embedded font. Note that drawing with font file or embedded font is not
  19742. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19743. option instead.
  19744. @item font
  19745. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19746. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19747. escaping.
  19748. @item fontcolor
  19749. Specify font color expression. This is arithmetic expression that should return
  19750. integer value 0xRRGGBB. It can contain variables:
  19751. @table @option
  19752. @item frequency, freq, f
  19753. the frequency where it is evaluated
  19754. @item timeclamp, tc
  19755. the value of @var{timeclamp} option
  19756. @end table
  19757. and functions:
  19758. @table @option
  19759. @item midi(f)
  19760. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19761. @item r(x), g(x), b(x)
  19762. red, green, and blue value of intensity x.
  19763. @end table
  19764. Default value is @code{st(0, (midi(f)-59.5)/12);
  19765. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19766. r(1-ld(1)) + b(ld(1))}.
  19767. @item axisfile
  19768. Specify image file to draw the axis. This option override @var{fontfile} and
  19769. @var{fontcolor} option.
  19770. @item axis, text
  19771. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19772. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19773. Default value is @code{1}.
  19774. @item csp
  19775. Set colorspace. The accepted values are:
  19776. @table @samp
  19777. @item unspecified
  19778. Unspecified (default)
  19779. @item bt709
  19780. BT.709
  19781. @item fcc
  19782. FCC
  19783. @item bt470bg
  19784. BT.470BG or BT.601-6 625
  19785. @item smpte170m
  19786. SMPTE-170M or BT.601-6 525
  19787. @item smpte240m
  19788. SMPTE-240M
  19789. @item bt2020ncl
  19790. BT.2020 with non-constant luminance
  19791. @end table
  19792. @item cscheme
  19793. Set spectrogram color scheme. This is list of floating point values with format
  19794. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19795. The default is @code{1|0.5|0|0|0.5|1}.
  19796. @end table
  19797. @subsection Examples
  19798. @itemize
  19799. @item
  19800. Playing audio while showing the spectrum:
  19801. @example
  19802. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19803. @end example
  19804. @item
  19805. Same as above, but with frame rate 30 fps:
  19806. @example
  19807. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19808. @end example
  19809. @item
  19810. Playing at 1280x720:
  19811. @example
  19812. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19813. @end example
  19814. @item
  19815. Disable sonogram display:
  19816. @example
  19817. sono_h=0
  19818. @end example
  19819. @item
  19820. A1 and its harmonics: A1, A2, (near)E3, A3:
  19821. @example
  19822. 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),
  19823. asplit[a][out1]; [a] showcqt [out0]'
  19824. @end example
  19825. @item
  19826. Same as above, but with more accuracy in frequency domain:
  19827. @example
  19828. 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),
  19829. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19830. @end example
  19831. @item
  19832. Custom volume:
  19833. @example
  19834. bar_v=10:sono_v=bar_v*a_weighting(f)
  19835. @end example
  19836. @item
  19837. Custom gamma, now spectrum is linear to the amplitude.
  19838. @example
  19839. bar_g=2:sono_g=2
  19840. @end example
  19841. @item
  19842. Custom tlength equation:
  19843. @example
  19844. 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)))'
  19845. @end example
  19846. @item
  19847. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19848. @example
  19849. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19850. @end example
  19851. @item
  19852. Custom font using fontconfig:
  19853. @example
  19854. font='Courier New,Monospace,mono|bold'
  19855. @end example
  19856. @item
  19857. Custom frequency range with custom axis using image file:
  19858. @example
  19859. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19860. @end example
  19861. @end itemize
  19862. @section showfreqs
  19863. Convert input audio to video output representing the audio power spectrum.
  19864. Audio amplitude is on Y-axis while frequency is on X-axis.
  19865. The filter accepts the following options:
  19866. @table @option
  19867. @item size, s
  19868. Specify size of video. For the syntax of this option, check the
  19869. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19870. Default is @code{1024x512}.
  19871. @item mode
  19872. Set display mode.
  19873. This set how each frequency bin will be represented.
  19874. It accepts the following values:
  19875. @table @samp
  19876. @item line
  19877. @item bar
  19878. @item dot
  19879. @end table
  19880. Default is @code{bar}.
  19881. @item ascale
  19882. Set amplitude scale.
  19883. It accepts the following values:
  19884. @table @samp
  19885. @item lin
  19886. Linear scale.
  19887. @item sqrt
  19888. Square root scale.
  19889. @item cbrt
  19890. Cubic root scale.
  19891. @item log
  19892. Logarithmic scale.
  19893. @end table
  19894. Default is @code{log}.
  19895. @item fscale
  19896. Set frequency scale.
  19897. It accepts the following values:
  19898. @table @samp
  19899. @item lin
  19900. Linear scale.
  19901. @item log
  19902. Logarithmic scale.
  19903. @item rlog
  19904. Reverse logarithmic scale.
  19905. @end table
  19906. Default is @code{lin}.
  19907. @item win_size
  19908. Set window size. Allowed range is from 16 to 65536.
  19909. Default is @code{2048}
  19910. @item win_func
  19911. Set windowing function.
  19912. It accepts the following values:
  19913. @table @samp
  19914. @item rect
  19915. @item bartlett
  19916. @item hanning
  19917. @item hamming
  19918. @item blackman
  19919. @item welch
  19920. @item flattop
  19921. @item bharris
  19922. @item bnuttall
  19923. @item bhann
  19924. @item sine
  19925. @item nuttall
  19926. @item lanczos
  19927. @item gauss
  19928. @item tukey
  19929. @item dolph
  19930. @item cauchy
  19931. @item parzen
  19932. @item poisson
  19933. @item bohman
  19934. @end table
  19935. Default is @code{hanning}.
  19936. @item overlap
  19937. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19938. which means optimal overlap for selected window function will be picked.
  19939. @item averaging
  19940. Set time averaging. Setting this to 0 will display current maximal peaks.
  19941. Default is @code{1}, which means time averaging is disabled.
  19942. @item colors
  19943. Specify list of colors separated by space or by '|' which will be used to
  19944. draw channel frequencies. Unrecognized or missing colors will be replaced
  19945. by white color.
  19946. @item cmode
  19947. Set channel display mode.
  19948. It accepts the following values:
  19949. @table @samp
  19950. @item combined
  19951. @item separate
  19952. @end table
  19953. Default is @code{combined}.
  19954. @item minamp
  19955. Set minimum amplitude used in @code{log} amplitude scaler.
  19956. @item data
  19957. Set data display mode.
  19958. It accepts the following values:
  19959. @table @samp
  19960. @item magnitude
  19961. @item phase
  19962. @item delay
  19963. @end table
  19964. Default is @code{magnitude}.
  19965. @end table
  19966. @section showspatial
  19967. Convert stereo input audio to a video output, representing the spatial relationship
  19968. between two channels.
  19969. The filter accepts the following options:
  19970. @table @option
  19971. @item size, s
  19972. Specify the video size for the output. For the syntax of this option, check the
  19973. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19974. Default value is @code{512x512}.
  19975. @item win_size
  19976. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19977. @item win_func
  19978. Set window function.
  19979. It accepts the following values:
  19980. @table @samp
  19981. @item rect
  19982. @item bartlett
  19983. @item hann
  19984. @item hanning
  19985. @item hamming
  19986. @item blackman
  19987. @item welch
  19988. @item flattop
  19989. @item bharris
  19990. @item bnuttall
  19991. @item bhann
  19992. @item sine
  19993. @item nuttall
  19994. @item lanczos
  19995. @item gauss
  19996. @item tukey
  19997. @item dolph
  19998. @item cauchy
  19999. @item parzen
  20000. @item poisson
  20001. @item bohman
  20002. @end table
  20003. Default value is @code{hann}.
  20004. @item overlap
  20005. Set ratio of overlap window. Default value is @code{0.5}.
  20006. When value is @code{1} overlap is set to recommended size for specific
  20007. window function currently used.
  20008. @end table
  20009. @anchor{showspectrum}
  20010. @section showspectrum
  20011. Convert input audio to a video output, representing the audio frequency
  20012. spectrum.
  20013. The filter accepts the following options:
  20014. @table @option
  20015. @item size, s
  20016. Specify the video size for the output. For the syntax of this option, check the
  20017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20018. Default value is @code{640x512}.
  20019. @item slide
  20020. Specify how the spectrum should slide along the window.
  20021. It accepts the following values:
  20022. @table @samp
  20023. @item replace
  20024. the samples start again on the left when they reach the right
  20025. @item scroll
  20026. the samples scroll from right to left
  20027. @item fullframe
  20028. frames are only produced when the samples reach the right
  20029. @item rscroll
  20030. the samples scroll from left to right
  20031. @end table
  20032. Default value is @code{replace}.
  20033. @item mode
  20034. Specify display mode.
  20035. It accepts the following values:
  20036. @table @samp
  20037. @item combined
  20038. all channels are displayed in the same row
  20039. @item separate
  20040. all channels are displayed in separate rows
  20041. @end table
  20042. Default value is @samp{combined}.
  20043. @item color
  20044. Specify display color mode.
  20045. It accepts the following values:
  20046. @table @samp
  20047. @item channel
  20048. each channel is displayed in a separate color
  20049. @item intensity
  20050. each channel is displayed using the same color scheme
  20051. @item rainbow
  20052. each channel is displayed using the rainbow color scheme
  20053. @item moreland
  20054. each channel is displayed using the moreland color scheme
  20055. @item nebulae
  20056. each channel is displayed using the nebulae color scheme
  20057. @item fire
  20058. each channel is displayed using the fire color scheme
  20059. @item fiery
  20060. each channel is displayed using the fiery color scheme
  20061. @item fruit
  20062. each channel is displayed using the fruit color scheme
  20063. @item cool
  20064. each channel is displayed using the cool color scheme
  20065. @item magma
  20066. each channel is displayed using the magma color scheme
  20067. @item green
  20068. each channel is displayed using the green color scheme
  20069. @item viridis
  20070. each channel is displayed using the viridis color scheme
  20071. @item plasma
  20072. each channel is displayed using the plasma color scheme
  20073. @item cividis
  20074. each channel is displayed using the cividis color scheme
  20075. @item terrain
  20076. each channel is displayed using the terrain color scheme
  20077. @end table
  20078. Default value is @samp{channel}.
  20079. @item scale
  20080. Specify scale used for calculating intensity color values.
  20081. It accepts the following values:
  20082. @table @samp
  20083. @item lin
  20084. linear
  20085. @item sqrt
  20086. square root, default
  20087. @item cbrt
  20088. cubic root
  20089. @item log
  20090. logarithmic
  20091. @item 4thrt
  20092. 4th root
  20093. @item 5thrt
  20094. 5th root
  20095. @end table
  20096. Default value is @samp{sqrt}.
  20097. @item fscale
  20098. Specify frequency scale.
  20099. It accepts the following values:
  20100. @table @samp
  20101. @item lin
  20102. linear
  20103. @item log
  20104. logarithmic
  20105. @end table
  20106. Default value is @samp{lin}.
  20107. @item saturation
  20108. Set saturation modifier for displayed colors. Negative values provide
  20109. alternative color scheme. @code{0} is no saturation at all.
  20110. Saturation must be in [-10.0, 10.0] range.
  20111. Default value is @code{1}.
  20112. @item win_func
  20113. Set window function.
  20114. It accepts the following values:
  20115. @table @samp
  20116. @item rect
  20117. @item bartlett
  20118. @item hann
  20119. @item hanning
  20120. @item hamming
  20121. @item blackman
  20122. @item welch
  20123. @item flattop
  20124. @item bharris
  20125. @item bnuttall
  20126. @item bhann
  20127. @item sine
  20128. @item nuttall
  20129. @item lanczos
  20130. @item gauss
  20131. @item tukey
  20132. @item dolph
  20133. @item cauchy
  20134. @item parzen
  20135. @item poisson
  20136. @item bohman
  20137. @end table
  20138. Default value is @code{hann}.
  20139. @item orientation
  20140. Set orientation of time vs frequency axis. Can be @code{vertical} or
  20141. @code{horizontal}. Default is @code{vertical}.
  20142. @item overlap
  20143. Set ratio of overlap window. Default value is @code{0}.
  20144. When value is @code{1} overlap is set to recommended size for specific
  20145. window function currently used.
  20146. @item gain
  20147. Set scale gain for calculating intensity color values.
  20148. Default value is @code{1}.
  20149. @item data
  20150. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  20151. @item rotation
  20152. Set color rotation, must be in [-1.0, 1.0] range.
  20153. Default value is @code{0}.
  20154. @item start
  20155. Set start frequency from which to display spectrogram. Default is @code{0}.
  20156. @item stop
  20157. Set stop frequency to which to display spectrogram. Default is @code{0}.
  20158. @item fps
  20159. Set upper frame rate limit. Default is @code{auto}, unlimited.
  20160. @item legend
  20161. Draw time and frequency axes and legends. Default is disabled.
  20162. @end table
  20163. The usage is very similar to the showwaves filter; see the examples in that
  20164. section.
  20165. @subsection Examples
  20166. @itemize
  20167. @item
  20168. Large window with logarithmic color scaling:
  20169. @example
  20170. showspectrum=s=1280x480:scale=log
  20171. @end example
  20172. @item
  20173. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  20174. @example
  20175. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  20176. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  20177. @end example
  20178. @end itemize
  20179. @section showspectrumpic
  20180. Convert input audio to a single video frame, representing the audio frequency
  20181. spectrum.
  20182. The filter accepts the following options:
  20183. @table @option
  20184. @item size, s
  20185. Specify the video size for the output. For the syntax of this option, check the
  20186. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20187. Default value is @code{4096x2048}.
  20188. @item mode
  20189. Specify display mode.
  20190. It accepts the following values:
  20191. @table @samp
  20192. @item combined
  20193. all channels are displayed in the same row
  20194. @item separate
  20195. all channels are displayed in separate rows
  20196. @end table
  20197. Default value is @samp{combined}.
  20198. @item color
  20199. Specify display color mode.
  20200. It accepts the following values:
  20201. @table @samp
  20202. @item channel
  20203. each channel is displayed in a separate color
  20204. @item intensity
  20205. each channel is displayed using the same color scheme
  20206. @item rainbow
  20207. each channel is displayed using the rainbow color scheme
  20208. @item moreland
  20209. each channel is displayed using the moreland color scheme
  20210. @item nebulae
  20211. each channel is displayed using the nebulae color scheme
  20212. @item fire
  20213. each channel is displayed using the fire color scheme
  20214. @item fiery
  20215. each channel is displayed using the fiery color scheme
  20216. @item fruit
  20217. each channel is displayed using the fruit color scheme
  20218. @item cool
  20219. each channel is displayed using the cool color scheme
  20220. @item magma
  20221. each channel is displayed using the magma color scheme
  20222. @item green
  20223. each channel is displayed using the green color scheme
  20224. @item viridis
  20225. each channel is displayed using the viridis color scheme
  20226. @item plasma
  20227. each channel is displayed using the plasma color scheme
  20228. @item cividis
  20229. each channel is displayed using the cividis color scheme
  20230. @item terrain
  20231. each channel is displayed using the terrain color scheme
  20232. @end table
  20233. Default value is @samp{intensity}.
  20234. @item scale
  20235. Specify scale used for calculating intensity color values.
  20236. It accepts the following values:
  20237. @table @samp
  20238. @item lin
  20239. linear
  20240. @item sqrt
  20241. square root, default
  20242. @item cbrt
  20243. cubic root
  20244. @item log
  20245. logarithmic
  20246. @item 4thrt
  20247. 4th root
  20248. @item 5thrt
  20249. 5th root
  20250. @end table
  20251. Default value is @samp{log}.
  20252. @item fscale
  20253. Specify frequency scale.
  20254. It accepts the following values:
  20255. @table @samp
  20256. @item lin
  20257. linear
  20258. @item log
  20259. logarithmic
  20260. @end table
  20261. Default value is @samp{lin}.
  20262. @item saturation
  20263. Set saturation modifier for displayed colors. Negative values provide
  20264. alternative color scheme. @code{0} is no saturation at all.
  20265. Saturation must be in [-10.0, 10.0] range.
  20266. Default value is @code{1}.
  20267. @item win_func
  20268. Set window function.
  20269. It accepts the following values:
  20270. @table @samp
  20271. @item rect
  20272. @item bartlett
  20273. @item hann
  20274. @item hanning
  20275. @item hamming
  20276. @item blackman
  20277. @item welch
  20278. @item flattop
  20279. @item bharris
  20280. @item bnuttall
  20281. @item bhann
  20282. @item sine
  20283. @item nuttall
  20284. @item lanczos
  20285. @item gauss
  20286. @item tukey
  20287. @item dolph
  20288. @item cauchy
  20289. @item parzen
  20290. @item poisson
  20291. @item bohman
  20292. @end table
  20293. Default value is @code{hann}.
  20294. @item orientation
  20295. Set orientation of time vs frequency axis. Can be @code{vertical} or
  20296. @code{horizontal}. Default is @code{vertical}.
  20297. @item gain
  20298. Set scale gain for calculating intensity color values.
  20299. Default value is @code{1}.
  20300. @item legend
  20301. Draw time and frequency axes and legends. Default is enabled.
  20302. @item rotation
  20303. Set color rotation, must be in [-1.0, 1.0] range.
  20304. Default value is @code{0}.
  20305. @item start
  20306. Set start frequency from which to display spectrogram. Default is @code{0}.
  20307. @item stop
  20308. Set stop frequency to which to display spectrogram. Default is @code{0}.
  20309. @end table
  20310. @subsection Examples
  20311. @itemize
  20312. @item
  20313. Extract an audio spectrogram of a whole audio track
  20314. in a 1024x1024 picture using @command{ffmpeg}:
  20315. @example
  20316. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  20317. @end example
  20318. @end itemize
  20319. @section showvolume
  20320. Convert input audio volume to a video output.
  20321. The filter accepts the following options:
  20322. @table @option
  20323. @item rate, r
  20324. Set video rate.
  20325. @item b
  20326. Set border width, allowed range is [0, 5]. Default is 1.
  20327. @item w
  20328. Set channel width, allowed range is [80, 8192]. Default is 400.
  20329. @item h
  20330. Set channel height, allowed range is [1, 900]. Default is 20.
  20331. @item f
  20332. Set fade, allowed range is [0, 1]. Default is 0.95.
  20333. @item c
  20334. Set volume color expression.
  20335. The expression can use the following variables:
  20336. @table @option
  20337. @item VOLUME
  20338. Current max volume of channel in dB.
  20339. @item PEAK
  20340. Current peak.
  20341. @item CHANNEL
  20342. Current channel number, starting from 0.
  20343. @end table
  20344. @item t
  20345. If set, displays channel names. Default is enabled.
  20346. @item v
  20347. If set, displays volume values. Default is enabled.
  20348. @item o
  20349. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  20350. default is @code{h}.
  20351. @item s
  20352. Set step size, allowed range is [0, 5]. Default is 0, which means
  20353. step is disabled.
  20354. @item p
  20355. Set background opacity, allowed range is [0, 1]. Default is 0.
  20356. @item m
  20357. Set metering mode, can be peak: @code{p} or rms: @code{r},
  20358. default is @code{p}.
  20359. @item ds
  20360. Set display scale, can be linear: @code{lin} or log: @code{log},
  20361. default is @code{lin}.
  20362. @item dm
  20363. In second.
  20364. If set to > 0., display a line for the max level
  20365. in the previous seconds.
  20366. default is disabled: @code{0.}
  20367. @item dmc
  20368. The color of the max line. Use when @code{dm} option is set to > 0.
  20369. default is: @code{orange}
  20370. @end table
  20371. @section showwaves
  20372. Convert input audio to a video output, representing the samples waves.
  20373. The filter accepts the following options:
  20374. @table @option
  20375. @item size, s
  20376. Specify the video size for the output. For the syntax of this option, check the
  20377. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20378. Default value is @code{600x240}.
  20379. @item mode
  20380. Set display mode.
  20381. Available values are:
  20382. @table @samp
  20383. @item point
  20384. Draw a point for each sample.
  20385. @item line
  20386. Draw a vertical line for each sample.
  20387. @item p2p
  20388. Draw a point for each sample and a line between them.
  20389. @item cline
  20390. Draw a centered vertical line for each sample.
  20391. @end table
  20392. Default value is @code{point}.
  20393. @item n
  20394. Set the number of samples which are printed on the same column. A
  20395. larger value will decrease the frame rate. Must be a positive
  20396. integer. This option can be set only if the value for @var{rate}
  20397. is not explicitly specified.
  20398. @item rate, r
  20399. Set the (approximate) output frame rate. This is done by setting the
  20400. option @var{n}. Default value is "25".
  20401. @item split_channels
  20402. Set if channels should be drawn separately or overlap. Default value is 0.
  20403. @item colors
  20404. Set colors separated by '|' which are going to be used for drawing of each channel.
  20405. @item scale
  20406. Set amplitude scale.
  20407. Available values are:
  20408. @table @samp
  20409. @item lin
  20410. Linear.
  20411. @item log
  20412. Logarithmic.
  20413. @item sqrt
  20414. Square root.
  20415. @item cbrt
  20416. Cubic root.
  20417. @end table
  20418. Default is linear.
  20419. @item draw
  20420. Set the draw mode. This is mostly useful to set for high @var{n}.
  20421. Available values are:
  20422. @table @samp
  20423. @item scale
  20424. Scale pixel values for each drawn sample.
  20425. @item full
  20426. Draw every sample directly.
  20427. @end table
  20428. Default value is @code{scale}.
  20429. @end table
  20430. @subsection Examples
  20431. @itemize
  20432. @item
  20433. Output the input file audio and the corresponding video representation
  20434. at the same time:
  20435. @example
  20436. amovie=a.mp3,asplit[out0],showwaves[out1]
  20437. @end example
  20438. @item
  20439. Create a synthetic signal and show it with showwaves, forcing a
  20440. frame rate of 30 frames per second:
  20441. @example
  20442. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  20443. @end example
  20444. @end itemize
  20445. @section showwavespic
  20446. Convert input audio to a single video frame, representing the samples waves.
  20447. The filter accepts the following options:
  20448. @table @option
  20449. @item size, s
  20450. Specify the video size for the output. For the syntax of this option, check the
  20451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20452. Default value is @code{600x240}.
  20453. @item split_channels
  20454. Set if channels should be drawn separately or overlap. Default value is 0.
  20455. @item colors
  20456. Set colors separated by '|' which are going to be used for drawing of each channel.
  20457. @item scale
  20458. Set amplitude scale.
  20459. Available values are:
  20460. @table @samp
  20461. @item lin
  20462. Linear.
  20463. @item log
  20464. Logarithmic.
  20465. @item sqrt
  20466. Square root.
  20467. @item cbrt
  20468. Cubic root.
  20469. @end table
  20470. Default is linear.
  20471. @item draw
  20472. Set the draw mode.
  20473. Available values are:
  20474. @table @samp
  20475. @item scale
  20476. Scale pixel values for each drawn sample.
  20477. @item full
  20478. Draw every sample directly.
  20479. @end table
  20480. Default value is @code{scale}.
  20481. @item filter
  20482. Set the filter mode.
  20483. Available values are:
  20484. @table @samp
  20485. @item average
  20486. Use average samples values for each drawn sample.
  20487. @item peak
  20488. Use peak samples values for each drawn sample.
  20489. @end table
  20490. Default value is @code{average}.
  20491. @end table
  20492. @subsection Examples
  20493. @itemize
  20494. @item
  20495. Extract a channel split representation of the wave form of a whole audio track
  20496. in a 1024x800 picture using @command{ffmpeg}:
  20497. @example
  20498. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  20499. @end example
  20500. @end itemize
  20501. @section sidedata, asidedata
  20502. Delete frame side data, or select frames based on it.
  20503. This filter accepts the following options:
  20504. @table @option
  20505. @item mode
  20506. Set mode of operation of the filter.
  20507. Can be one of the following:
  20508. @table @samp
  20509. @item select
  20510. Select every frame with side data of @code{type}.
  20511. @item delete
  20512. Delete side data of @code{type}. If @code{type} is not set, delete all side
  20513. data in the frame.
  20514. @end table
  20515. @item type
  20516. Set side data type used with all modes. Must be set for @code{select} mode. For
  20517. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  20518. in @file{libavutil/frame.h}. For example, to choose
  20519. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  20520. @end table
  20521. @section spectrumsynth
  20522. Synthesize audio from 2 input video spectrums, first input stream represents
  20523. magnitude across time and second represents phase across time.
  20524. The filter will transform from frequency domain as displayed in videos back
  20525. to time domain as presented in audio output.
  20526. This filter is primarily created for reversing processed @ref{showspectrum}
  20527. filter outputs, but can synthesize sound from other spectrograms too.
  20528. But in such case results are going to be poor if the phase data is not
  20529. available, because in such cases phase data need to be recreated, usually
  20530. it's just recreated from random noise.
  20531. For best results use gray only output (@code{channel} color mode in
  20532. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  20533. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  20534. @code{data} option. Inputs videos should generally use @code{fullframe}
  20535. slide mode as that saves resources needed for decoding video.
  20536. The filter accepts the following options:
  20537. @table @option
  20538. @item sample_rate
  20539. Specify sample rate of output audio, the sample rate of audio from which
  20540. spectrum was generated may differ.
  20541. @item channels
  20542. Set number of channels represented in input video spectrums.
  20543. @item scale
  20544. Set scale which was used when generating magnitude input spectrum.
  20545. Can be @code{lin} or @code{log}. Default is @code{log}.
  20546. @item slide
  20547. Set slide which was used when generating inputs spectrums.
  20548. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  20549. Default is @code{fullframe}.
  20550. @item win_func
  20551. Set window function used for resynthesis.
  20552. @item overlap
  20553. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  20554. which means optimal overlap for selected window function will be picked.
  20555. @item orientation
  20556. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  20557. Default is @code{vertical}.
  20558. @end table
  20559. @subsection Examples
  20560. @itemize
  20561. @item
  20562. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  20563. then resynthesize videos back to audio with spectrumsynth:
  20564. @example
  20565. 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
  20566. 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
  20567. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  20568. @end example
  20569. @end itemize
  20570. @section split, asplit
  20571. Split input into several identical outputs.
  20572. @code{asplit} works with audio input, @code{split} with video.
  20573. The filter accepts a single parameter which specifies the number of outputs. If
  20574. unspecified, it defaults to 2.
  20575. @subsection Examples
  20576. @itemize
  20577. @item
  20578. Create two separate outputs from the same input:
  20579. @example
  20580. [in] split [out0][out1]
  20581. @end example
  20582. @item
  20583. To create 3 or more outputs, you need to specify the number of
  20584. outputs, like in:
  20585. @example
  20586. [in] asplit=3 [out0][out1][out2]
  20587. @end example
  20588. @item
  20589. Create two separate outputs from the same input, one cropped and
  20590. one padded:
  20591. @example
  20592. [in] split [splitout1][splitout2];
  20593. [splitout1] crop=100:100:0:0 [cropout];
  20594. [splitout2] pad=200:200:100:100 [padout];
  20595. @end example
  20596. @item
  20597. Create 5 copies of the input audio with @command{ffmpeg}:
  20598. @example
  20599. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20600. @end example
  20601. @end itemize
  20602. @section zmq, azmq
  20603. Receive commands sent through a libzmq client, and forward them to
  20604. filters in the filtergraph.
  20605. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20606. must be inserted between two video filters, @code{azmq} between two
  20607. audio filters. Both are capable to send messages to any filter type.
  20608. To enable these filters you need to install the libzmq library and
  20609. headers and configure FFmpeg with @code{--enable-libzmq}.
  20610. For more information about libzmq see:
  20611. @url{http://www.zeromq.org/}
  20612. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20613. receives messages sent through a network interface defined by the
  20614. @option{bind_address} (or the abbreviation "@option{b}") option.
  20615. Default value of this option is @file{tcp://localhost:5555}. You may
  20616. want to alter this value to your needs, but do not forget to escape any
  20617. ':' signs (see @ref{filtergraph escaping}).
  20618. The received message must be in the form:
  20619. @example
  20620. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20621. @end example
  20622. @var{TARGET} specifies the target of the command, usually the name of
  20623. the filter class or a specific filter instance name. The default
  20624. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20625. but you can override this by using the @samp{filter_name@@id} syntax
  20626. (see @ref{Filtergraph syntax}).
  20627. @var{COMMAND} specifies the name of the command for the target filter.
  20628. @var{ARG} is optional and specifies the optional argument list for the
  20629. given @var{COMMAND}.
  20630. Upon reception, the message is processed and the corresponding command
  20631. is injected into the filtergraph. Depending on the result, the filter
  20632. will send a reply to the client, adopting the format:
  20633. @example
  20634. @var{ERROR_CODE} @var{ERROR_REASON}
  20635. @var{MESSAGE}
  20636. @end example
  20637. @var{MESSAGE} is optional.
  20638. @subsection Examples
  20639. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20640. be used to send commands processed by these filters.
  20641. Consider the following filtergraph generated by @command{ffplay}.
  20642. In this example the last overlay filter has an instance name. All other
  20643. filters will have default instance names.
  20644. @example
  20645. ffplay -dumpgraph 1 -f lavfi "
  20646. color=s=100x100:c=red [l];
  20647. color=s=100x100:c=blue [r];
  20648. nullsrc=s=200x100, zmq [bg];
  20649. [bg][l] overlay [bg+l];
  20650. [bg+l][r] overlay@@my=x=100 "
  20651. @end example
  20652. To change the color of the left side of the video, the following
  20653. command can be used:
  20654. @example
  20655. echo Parsed_color_0 c yellow | tools/zmqsend
  20656. @end example
  20657. To change the right side:
  20658. @example
  20659. echo Parsed_color_1 c pink | tools/zmqsend
  20660. @end example
  20661. To change the position of the right side:
  20662. @example
  20663. echo overlay@@my x 150 | tools/zmqsend
  20664. @end example
  20665. @c man end MULTIMEDIA FILTERS
  20666. @chapter Multimedia Sources
  20667. @c man begin MULTIMEDIA SOURCES
  20668. Below is a description of the currently available multimedia sources.
  20669. @section amovie
  20670. This is the same as @ref{movie} source, except it selects an audio
  20671. stream by default.
  20672. @anchor{movie}
  20673. @section movie
  20674. Read audio and/or video stream(s) from a movie container.
  20675. It accepts the following parameters:
  20676. @table @option
  20677. @item filename
  20678. The name of the resource to read (not necessarily a file; it can also be a
  20679. device or a stream accessed through some protocol).
  20680. @item format_name, f
  20681. Specifies the format assumed for the movie to read, and can be either
  20682. the name of a container or an input device. If not specified, the
  20683. format is guessed from @var{movie_name} or by probing.
  20684. @item seek_point, sp
  20685. Specifies the seek point in seconds. The frames will be output
  20686. starting from this seek point. The parameter is evaluated with
  20687. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20688. postfix. The default value is "0".
  20689. @item streams, s
  20690. Specifies the streams to read. Several streams can be specified,
  20691. separated by "+". The source will then have as many outputs, in the
  20692. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20693. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20694. respectively the default (best suited) video and audio stream. Default
  20695. is "dv", or "da" if the filter is called as "amovie".
  20696. @item stream_index, si
  20697. Specifies the index of the video stream to read. If the value is -1,
  20698. the most suitable video stream will be automatically selected. The default
  20699. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20700. audio instead of video.
  20701. @item loop
  20702. Specifies how many times to read the stream in sequence.
  20703. If the value is 0, the stream will be looped infinitely.
  20704. Default value is "1".
  20705. Note that when the movie is looped the source timestamps are not
  20706. changed, so it will generate non monotonically increasing timestamps.
  20707. @item discontinuity
  20708. Specifies the time difference between frames above which the point is
  20709. considered a timestamp discontinuity which is removed by adjusting the later
  20710. timestamps.
  20711. @end table
  20712. It allows overlaying a second video on top of the main input of
  20713. a filtergraph, as shown in this graph:
  20714. @example
  20715. input -----------> deltapts0 --> overlay --> output
  20716. ^
  20717. |
  20718. movie --> scale--> deltapts1 -------+
  20719. @end example
  20720. @subsection Examples
  20721. @itemize
  20722. @item
  20723. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20724. on top of the input labelled "in":
  20725. @example
  20726. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20727. [in] setpts=PTS-STARTPTS [main];
  20728. [main][over] overlay=16:16 [out]
  20729. @end example
  20730. @item
  20731. Read from a video4linux2 device, and overlay it on top of the input
  20732. labelled "in":
  20733. @example
  20734. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20735. [in] setpts=PTS-STARTPTS [main];
  20736. [main][over] overlay=16:16 [out]
  20737. @end example
  20738. @item
  20739. Read the first video stream and the audio stream with id 0x81 from
  20740. dvd.vob; the video is connected to the pad named "video" and the audio is
  20741. connected to the pad named "audio":
  20742. @example
  20743. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20744. @end example
  20745. @end itemize
  20746. @subsection Commands
  20747. Both movie and amovie support the following commands:
  20748. @table @option
  20749. @item seek
  20750. Perform seek using "av_seek_frame".
  20751. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20752. @itemize
  20753. @item
  20754. @var{stream_index}: If stream_index is -1, a default
  20755. stream is selected, and @var{timestamp} is automatically converted
  20756. from AV_TIME_BASE units to the stream specific time_base.
  20757. @item
  20758. @var{timestamp}: Timestamp in AVStream.time_base units
  20759. or, if no stream is specified, in AV_TIME_BASE units.
  20760. @item
  20761. @var{flags}: Flags which select direction and seeking mode.
  20762. @end itemize
  20763. @item get_duration
  20764. Get movie duration in AV_TIME_BASE units.
  20765. @end table
  20766. @c man end MULTIMEDIA SOURCES