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.

24515 lines
652KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @section acontrast
  356. Simple audio dynamic range compression/expansion filter.
  357. The filter accepts the following options:
  358. @table @option
  359. @item contrast
  360. Set contrast. Default is 33. Allowed range is between 0 and 100.
  361. @end table
  362. @section acopy
  363. Copy the input audio source unchanged to the output. This is mainly useful for
  364. testing purposes.
  365. @section acrossfade
  366. Apply cross fade from one input audio stream to another input audio stream.
  367. The cross fade is applied for specified duration near the end of first stream.
  368. The filter accepts the following options:
  369. @table @option
  370. @item nb_samples, ns
  371. Specify the number of samples for which the cross fade effect has to last.
  372. At the end of the cross fade effect the first input audio will be completely
  373. silent. Default is 44100.
  374. @item duration, d
  375. Specify the duration of the cross fade effect. See
  376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  377. for the accepted syntax.
  378. By default the duration is determined by @var{nb_samples}.
  379. If set this option is used instead of @var{nb_samples}.
  380. @item overlap, o
  381. Should first stream end overlap with second stream start. Default is enabled.
  382. @item curve1
  383. Set curve for cross fade transition for first stream.
  384. @item curve2
  385. Set curve for cross fade transition for second stream.
  386. For description of available curve types see @ref{afade} filter description.
  387. @end table
  388. @subsection Examples
  389. @itemize
  390. @item
  391. Cross fade from one input to another:
  392. @example
  393. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  394. @end example
  395. @item
  396. Cross fade from one input to another but without overlapping:
  397. @example
  398. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  399. @end example
  400. @end itemize
  401. @section acrossover
  402. Split audio stream into several bands.
  403. This filter splits audio stream into two or more frequency ranges.
  404. Summing all streams back will give flat output.
  405. The filter accepts the following options:
  406. @table @option
  407. @item split
  408. Set split frequencies. Those must be positive and increasing.
  409. @item order
  410. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  411. Default is @var{4th}.
  412. @end table
  413. @section acrusher
  414. Reduce audio bit resolution.
  415. This filter is bit crusher with enhanced functionality. A bit crusher
  416. is used to audibly reduce number of bits an audio signal is sampled
  417. with. This doesn't change the bit depth at all, it just produces the
  418. effect. Material reduced in bit depth sounds more harsh and "digital".
  419. This filter is able to even round to continuous values instead of discrete
  420. bit depths.
  421. Additionally it has a D/C offset which results in different crushing of
  422. the lower and the upper half of the signal.
  423. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  424. Another feature of this filter is the logarithmic mode.
  425. This setting switches from linear distances between bits to logarithmic ones.
  426. The result is a much more "natural" sounding crusher which doesn't gate low
  427. signals for example. The human ear has a logarithmic perception,
  428. so this kind of crushing is much more pleasant.
  429. Logarithmic crushing is also able to get anti-aliased.
  430. The filter accepts the following options:
  431. @table @option
  432. @item level_in
  433. Set level in.
  434. @item level_out
  435. Set level out.
  436. @item bits
  437. Set bit reduction.
  438. @item mix
  439. Set mixing amount.
  440. @item mode
  441. Can be linear: @code{lin} or logarithmic: @code{log}.
  442. @item dc
  443. Set DC.
  444. @item aa
  445. Set anti-aliasing.
  446. @item samples
  447. Set sample reduction.
  448. @item lfo
  449. Enable LFO. By default disabled.
  450. @item lforange
  451. Set LFO range.
  452. @item lforate
  453. Set LFO rate.
  454. @end table
  455. @section acue
  456. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  457. filter.
  458. @section adeclick
  459. Remove impulsive noise from input audio.
  460. Samples detected as impulsive noise are replaced by interpolated samples using
  461. autoregressive modelling.
  462. @table @option
  463. @item w
  464. Set window size, in milliseconds. Allowed range is from @code{10} to
  465. @code{100}. Default value is @code{55} milliseconds.
  466. This sets size of window which will be processed at once.
  467. @item o
  468. Set window overlap, in percentage of window size. Allowed range is from
  469. @code{50} to @code{95}. Default value is @code{75} percent.
  470. Setting this to a very high value increases impulsive noise removal but makes
  471. whole process much slower.
  472. @item a
  473. Set autoregression order, in percentage of window size. Allowed range is from
  474. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  475. controls quality of interpolated samples using neighbour good samples.
  476. @item t
  477. Set threshold value. Allowed range is from @code{1} to @code{100}.
  478. Default value is @code{2}.
  479. This controls the strength of impulsive noise which is going to be removed.
  480. The lower value, the more samples will be detected as impulsive noise.
  481. @item b
  482. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  483. @code{10}. Default value is @code{2}.
  484. If any two samples detected as noise are spaced less than this value then any
  485. sample between those two samples will be also detected as noise.
  486. @item m
  487. Set overlap method.
  488. It accepts the following values:
  489. @table @option
  490. @item a
  491. Select overlap-add method. Even not interpolated samples are slightly
  492. changed with this method.
  493. @item s
  494. Select overlap-save method. Not interpolated samples remain unchanged.
  495. @end table
  496. Default value is @code{a}.
  497. @end table
  498. @section adeclip
  499. Remove clipped samples from input audio.
  500. Samples detected as clipped are replaced by interpolated samples using
  501. autoregressive modelling.
  502. @table @option
  503. @item w
  504. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  505. Default value is @code{55} milliseconds.
  506. This sets size of window which will be processed at once.
  507. @item o
  508. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  509. to @code{95}. Default value is @code{75} percent.
  510. @item a
  511. Set autoregression order, in percentage of window size. Allowed range is from
  512. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  513. quality of interpolated samples using neighbour good samples.
  514. @item t
  515. Set threshold value. Allowed range is from @code{1} to @code{100}.
  516. Default value is @code{10}. Higher values make clip detection less aggressive.
  517. @item n
  518. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  519. Default value is @code{1000}. Higher values make clip detection less aggressive.
  520. @item m
  521. Set overlap method.
  522. It accepts the following values:
  523. @table @option
  524. @item a
  525. Select overlap-add method. Even not interpolated samples are slightly changed
  526. with this method.
  527. @item s
  528. Select overlap-save method. Not interpolated samples remain unchanged.
  529. @end table
  530. Default value is @code{a}.
  531. @end table
  532. @section adelay
  533. Delay one or more audio channels.
  534. Samples in delayed channel are filled with silence.
  535. The filter accepts the following option:
  536. @table @option
  537. @item delays
  538. Set list of delays in milliseconds for each channel separated by '|'.
  539. Unused delays will be silently ignored. If number of given delays is
  540. smaller than number of channels all remaining channels will not be delayed.
  541. If you want to delay exact number of samples, append 'S' to number.
  542. If you want instead to delay in seconds, append 's' to number.
  543. @item all
  544. Use last set delay for all remaining channels. By default is disabled.
  545. This option if enabled changes how option @code{delays} is interpreted.
  546. @end table
  547. @subsection Examples
  548. @itemize
  549. @item
  550. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  551. the second channel (and any other channels that may be present) unchanged.
  552. @example
  553. adelay=1500|0|500
  554. @end example
  555. @item
  556. Delay second channel by 500 samples, the third channel by 700 samples and leave
  557. the first channel (and any other channels that may be present) unchanged.
  558. @example
  559. adelay=0|500S|700S
  560. @end example
  561. @item
  562. Delay all channels by same number of samples:
  563. @example
  564. adelay=delays=64S:all=1
  565. @end example
  566. @end itemize
  567. @section aderivative, aintegral
  568. Compute derivative/integral of audio stream.
  569. Applying both filters one after another produces original audio.
  570. @section aecho
  571. Apply echoing to the input audio.
  572. Echoes are reflected sound and can occur naturally amongst mountains
  573. (and sometimes large buildings) when talking or shouting; digital echo
  574. effects emulate this behaviour and are often used to help fill out the
  575. sound of a single instrument or vocal. The time difference between the
  576. original signal and the reflection is the @code{delay}, and the
  577. loudness of the reflected signal is the @code{decay}.
  578. Multiple echoes can have different delays and decays.
  579. A description of the accepted parameters follows.
  580. @table @option
  581. @item in_gain
  582. Set input gain of reflected signal. Default is @code{0.6}.
  583. @item out_gain
  584. Set output gain of reflected signal. Default is @code{0.3}.
  585. @item delays
  586. Set list of time intervals in milliseconds between original signal and reflections
  587. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  588. Default is @code{1000}.
  589. @item decays
  590. Set list of loudness of reflected signals separated by '|'.
  591. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  592. Default is @code{0.5}.
  593. @end table
  594. @subsection Examples
  595. @itemize
  596. @item
  597. Make it sound as if there are twice as many instruments as are actually playing:
  598. @example
  599. aecho=0.8:0.88:60:0.4
  600. @end example
  601. @item
  602. If delay is very short, then it sounds like a (metallic) robot playing music:
  603. @example
  604. aecho=0.8:0.88:6:0.4
  605. @end example
  606. @item
  607. A longer delay will sound like an open air concert in the mountains:
  608. @example
  609. aecho=0.8:0.9:1000:0.3
  610. @end example
  611. @item
  612. Same as above but with one more mountain:
  613. @example
  614. aecho=0.8:0.9:1000|1800:0.3|0.25
  615. @end example
  616. @end itemize
  617. @section aemphasis
  618. Audio emphasis filter creates or restores material directly taken from LPs or
  619. emphased CDs with different filter curves. E.g. to store music on vinyl the
  620. signal has to be altered by a filter first to even out the disadvantages of
  621. this recording medium.
  622. Once the material is played back the inverse filter has to be applied to
  623. restore the distortion of the frequency response.
  624. The filter accepts the following options:
  625. @table @option
  626. @item level_in
  627. Set input gain.
  628. @item level_out
  629. Set output gain.
  630. @item mode
  631. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  632. use @code{production} mode. Default is @code{reproduction} mode.
  633. @item type
  634. Set filter type. Selects medium. Can be one of the following:
  635. @table @option
  636. @item col
  637. select Columbia.
  638. @item emi
  639. select EMI.
  640. @item bsi
  641. select BSI (78RPM).
  642. @item riaa
  643. select RIAA.
  644. @item cd
  645. select Compact Disc (CD).
  646. @item 50fm
  647. select 50µs (FM).
  648. @item 75fm
  649. select 75µs (FM).
  650. @item 50kf
  651. select 50µs (FM-KF).
  652. @item 75kf
  653. select 75µs (FM-KF).
  654. @end table
  655. @end table
  656. @section aeval
  657. Modify an audio signal according to the specified expressions.
  658. This filter accepts one or more expressions (one for each channel),
  659. which are evaluated and used to modify a corresponding audio signal.
  660. It accepts the following parameters:
  661. @table @option
  662. @item exprs
  663. Set the '|'-separated expressions list for each separate channel. If
  664. the number of input channels is greater than the number of
  665. expressions, the last specified expression is used for the remaining
  666. output channels.
  667. @item channel_layout, c
  668. Set output channel layout. If not specified, the channel layout is
  669. specified by the number of expressions. If set to @samp{same}, it will
  670. use by default the same input channel layout.
  671. @end table
  672. Each expression in @var{exprs} can contain the following constants and functions:
  673. @table @option
  674. @item ch
  675. channel number of the current expression
  676. @item n
  677. number of the evaluated sample, starting from 0
  678. @item s
  679. sample rate
  680. @item t
  681. time of the evaluated sample expressed in seconds
  682. @item nb_in_channels
  683. @item nb_out_channels
  684. input and output number of channels
  685. @item val(CH)
  686. the value of input channel with number @var{CH}
  687. @end table
  688. Note: this filter is slow. For faster processing you should use a
  689. dedicated filter.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Half volume:
  694. @example
  695. aeval=val(ch)/2:c=same
  696. @end example
  697. @item
  698. Invert phase of the second channel:
  699. @example
  700. aeval=val(0)|-val(1)
  701. @end example
  702. @end itemize
  703. @anchor{afade}
  704. @section afade
  705. Apply fade-in/out effect to input audio.
  706. A description of the accepted parameters follows.
  707. @table @option
  708. @item type, t
  709. Specify the effect type, can be either @code{in} for fade-in, or
  710. @code{out} for a fade-out effect. Default is @code{in}.
  711. @item start_sample, ss
  712. Specify the number of the start sample for starting to apply the fade
  713. effect. Default is 0.
  714. @item nb_samples, ns
  715. Specify the number of samples for which the fade effect has to last. At
  716. the end of the fade-in effect the output audio will have the same
  717. volume as the input audio, at the end of the fade-out transition
  718. the output audio will be silence. Default is 44100.
  719. @item start_time, st
  720. Specify the start time of the fade effect. Default is 0.
  721. The value must be specified as a time duration; see
  722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  723. for the accepted syntax.
  724. If set this option is used instead of @var{start_sample}.
  725. @item duration, d
  726. Specify the duration of the fade effect. See
  727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  728. for the accepted syntax.
  729. At the end of the fade-in effect the output audio will have the same
  730. volume as the input audio, at the end of the fade-out transition
  731. the output audio will be silence.
  732. By default the duration is determined by @var{nb_samples}.
  733. If set this option is used instead of @var{nb_samples}.
  734. @item curve
  735. Set curve for fade transition.
  736. It accepts the following values:
  737. @table @option
  738. @item tri
  739. select triangular, linear slope (default)
  740. @item qsin
  741. select quarter of sine wave
  742. @item hsin
  743. select half of sine wave
  744. @item esin
  745. select exponential sine wave
  746. @item log
  747. select logarithmic
  748. @item ipar
  749. select inverted parabola
  750. @item qua
  751. select quadratic
  752. @item cub
  753. select cubic
  754. @item squ
  755. select square root
  756. @item cbr
  757. select cubic root
  758. @item par
  759. select parabola
  760. @item exp
  761. select exponential
  762. @item iqsin
  763. select inverted quarter of sine wave
  764. @item ihsin
  765. select inverted half of sine wave
  766. @item dese
  767. select double-exponential seat
  768. @item desi
  769. select double-exponential sigmoid
  770. @item losi
  771. select logistic sigmoid
  772. @item nofade
  773. no fade applied
  774. @end table
  775. @end table
  776. @subsection Examples
  777. @itemize
  778. @item
  779. Fade in first 15 seconds of audio:
  780. @example
  781. afade=t=in:ss=0:d=15
  782. @end example
  783. @item
  784. Fade out last 25 seconds of a 900 seconds audio:
  785. @example
  786. afade=t=out:st=875:d=25
  787. @end example
  788. @end itemize
  789. @section afftdn
  790. Denoise audio samples with FFT.
  791. A description of the accepted parameters follows.
  792. @table @option
  793. @item nr
  794. Set the noise reduction in dB, allowed range is 0.01 to 97.
  795. Default value is 12 dB.
  796. @item nf
  797. Set the noise floor in dB, allowed range is -80 to -20.
  798. Default value is -50 dB.
  799. @item nt
  800. Set the noise type.
  801. It accepts the following values:
  802. @table @option
  803. @item w
  804. Select white noise.
  805. @item v
  806. Select vinyl noise.
  807. @item s
  808. Select shellac noise.
  809. @item c
  810. Select custom noise, defined in @code{bn} option.
  811. Default value is white noise.
  812. @end table
  813. @item bn
  814. Set custom band noise for every one of 15 bands.
  815. Bands are separated by ' ' or '|'.
  816. @item rf
  817. Set the residual floor in dB, allowed range is -80 to -20.
  818. Default value is -38 dB.
  819. @item tn
  820. Enable noise tracking. By default is disabled.
  821. With this enabled, noise floor is automatically adjusted.
  822. @item tr
  823. Enable residual tracking. By default is disabled.
  824. @item om
  825. Set the output mode.
  826. It accepts the following values:
  827. @table @option
  828. @item i
  829. Pass input unchanged.
  830. @item o
  831. Pass noise filtered out.
  832. @item n
  833. Pass only noise.
  834. Default value is @var{o}.
  835. @end table
  836. @end table
  837. @subsection Commands
  838. This filter supports the following commands:
  839. @table @option
  840. @item sample_noise, sn
  841. Start or stop measuring noise profile.
  842. Syntax for the command is : "start" or "stop" string.
  843. After measuring noise profile is stopped it will be
  844. automatically applied in filtering.
  845. @item noise_reduction, nr
  846. Change noise reduction. Argument is single float number.
  847. Syntax for the command is : "@var{noise_reduction}"
  848. @item noise_floor, nf
  849. Change noise floor. Argument is single float number.
  850. Syntax for the command is : "@var{noise_floor}"
  851. @item output_mode, om
  852. Change output mode operation.
  853. Syntax for the command is : "i", "o" or "n" string.
  854. @end table
  855. @section afftfilt
  856. Apply arbitrary expressions to samples in frequency domain.
  857. @table @option
  858. @item real
  859. Set frequency domain real expression for each separate channel separated
  860. by '|'. Default is "re".
  861. If the number of input channels is greater than the number of
  862. expressions, the last specified expression is used for the remaining
  863. output channels.
  864. @item imag
  865. Set frequency domain imaginary expression for each separate channel
  866. separated by '|'. Default is "im".
  867. Each expression in @var{real} and @var{imag} can contain the following
  868. constants and functions:
  869. @table @option
  870. @item sr
  871. sample rate
  872. @item b
  873. current frequency bin number
  874. @item nb
  875. number of available bins
  876. @item ch
  877. channel number of the current expression
  878. @item chs
  879. number of channels
  880. @item pts
  881. current frame pts
  882. @item re
  883. current real part of frequency bin of current channel
  884. @item im
  885. current imaginary part of frequency bin of current channel
  886. @item real(b, ch)
  887. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  888. @item imag(b, ch)
  889. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  890. @end table
  891. @item win_size
  892. Set window size. Allowed range is from 16 to 131072.
  893. Default is @code{4096}
  894. @item win_func
  895. Set window function. Default is @code{hann}.
  896. @item overlap
  897. Set window overlap. If set to 1, the recommended overlap for selected
  898. window function will be picked. Default is @code{0.75}.
  899. @end table
  900. @subsection Examples
  901. @itemize
  902. @item
  903. Leave almost only low frequencies in audio:
  904. @example
  905. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  906. @end example
  907. @item
  908. Apply robotize effect:
  909. @example
  910. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  911. @end example
  912. @item
  913. Apply whisper effect:
  914. @example
  915. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  916. @end example
  917. @end itemize
  918. @anchor{afir}
  919. @section afir
  920. Apply an arbitrary Frequency Impulse Response filter.
  921. This filter is designed for applying long FIR filters,
  922. up to 60 seconds long.
  923. It can be used as component for digital crossover filters,
  924. room equalization, cross talk cancellation, wavefield synthesis,
  925. auralization, ambiophonics, ambisonics and spatialization.
  926. This filter uses the second stream as FIR coefficients.
  927. If the second stream holds a single channel, it will be used
  928. for all input channels in the first stream, otherwise
  929. the number of channels in the second stream must be same as
  930. the number of channels in the first stream.
  931. It accepts the following parameters:
  932. @table @option
  933. @item dry
  934. Set dry gain. This sets input gain.
  935. @item wet
  936. Set wet gain. This sets final output gain.
  937. @item length
  938. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  939. @item gtype
  940. Enable applying gain measured from power of IR.
  941. Set which approach to use for auto gain measurement.
  942. @table @option
  943. @item none
  944. Do not apply any gain.
  945. @item peak
  946. select peak gain, very conservative approach. This is default value.
  947. @item dc
  948. select DC gain, limited application.
  949. @item gn
  950. select gain to noise approach, this is most popular one.
  951. @end table
  952. @item irgain
  953. Set gain to be applied to IR coefficients before filtering.
  954. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  955. @item irfmt
  956. Set format of IR stream. Can be @code{mono} or @code{input}.
  957. Default is @code{input}.
  958. @item maxir
  959. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  960. Allowed range is 0.1 to 60 seconds.
  961. @item response
  962. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  963. By default it is disabled.
  964. @item channel
  965. Set for which IR channel to display frequency response. By default is first channel
  966. displayed. This option is used only when @var{response} is enabled.
  967. @item size
  968. Set video stream size. This option is used only when @var{response} is enabled.
  969. @item rate
  970. Set video stream frame rate. This option is used only when @var{response} is enabled.
  971. @item minp
  972. Set minimal partition size used for convolution. Default is @var{8192}.
  973. Allowed range is from @var{8} to @var{32768}.
  974. Lower values decreases latency at cost of higher CPU usage.
  975. @item maxp
  976. Set maximal partition size used for convolution. Default is @var{8192}.
  977. Allowed range is from @var{8} to @var{32768}.
  978. Lower values may increase CPU usage.
  979. @end table
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  984. @example
  985. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  986. @end example
  987. @end itemize
  988. @anchor{aformat}
  989. @section aformat
  990. Set output format constraints for the input audio. The framework will
  991. negotiate the most appropriate format to minimize conversions.
  992. It accepts the following parameters:
  993. @table @option
  994. @item sample_fmts
  995. A '|'-separated list of requested sample formats.
  996. @item sample_rates
  997. A '|'-separated list of requested sample rates.
  998. @item channel_layouts
  999. A '|'-separated list of requested channel layouts.
  1000. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1001. for the required syntax.
  1002. @end table
  1003. If a parameter is omitted, all values are allowed.
  1004. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1005. @example
  1006. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1007. @end example
  1008. @section agate
  1009. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1010. processing reduces disturbing noise between useful signals.
  1011. Gating is done by detecting the volume below a chosen level @var{threshold}
  1012. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1013. floor is set via @var{range}. Because an exact manipulation of the signal
  1014. would cause distortion of the waveform the reduction can be levelled over
  1015. time. This is done by setting @var{attack} and @var{release}.
  1016. @var{attack} determines how long the signal has to fall below the threshold
  1017. before any reduction will occur and @var{release} sets the time the signal
  1018. has to rise above the threshold to reduce the reduction again.
  1019. Shorter signals than the chosen attack time will be left untouched.
  1020. @table @option
  1021. @item level_in
  1022. Set input level before filtering.
  1023. Default is 1. Allowed range is from 0.015625 to 64.
  1024. @item mode
  1025. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1026. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1027. will be amplified, expanding dynamic range in upward direction.
  1028. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1029. @item range
  1030. Set the level of gain reduction when the signal is below the threshold.
  1031. Default is 0.06125. Allowed range is from 0 to 1.
  1032. Setting this to 0 disables reduction and then filter behaves like expander.
  1033. @item threshold
  1034. If a signal rises above this level the gain reduction is released.
  1035. Default is 0.125. Allowed range is from 0 to 1.
  1036. @item ratio
  1037. Set a ratio by which the signal is reduced.
  1038. Default is 2. Allowed range is from 1 to 9000.
  1039. @item attack
  1040. Amount of milliseconds the signal has to rise above the threshold before gain
  1041. reduction stops.
  1042. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1043. @item release
  1044. Amount of milliseconds the signal has to fall below the threshold before the
  1045. reduction is increased again. Default is 250 milliseconds.
  1046. Allowed range is from 0.01 to 9000.
  1047. @item makeup
  1048. Set amount of amplification of signal after processing.
  1049. Default is 1. Allowed range is from 1 to 64.
  1050. @item knee
  1051. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1052. Default is 2.828427125. Allowed range is from 1 to 8.
  1053. @item detection
  1054. Choose if exact signal should be taken for detection or an RMS like one.
  1055. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1056. @item link
  1057. Choose if the average level between all channels or the louder channel affects
  1058. the reduction.
  1059. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1060. @end table
  1061. @section aiir
  1062. Apply an arbitrary Infinite Impulse Response filter.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item z
  1066. Set numerator/zeros coefficients.
  1067. @item p
  1068. Set denominator/poles coefficients.
  1069. @item k
  1070. Set channels gains.
  1071. @item dry_gain
  1072. Set input gain.
  1073. @item wet_gain
  1074. Set output gain.
  1075. @item f
  1076. Set coefficients format.
  1077. @table @samp
  1078. @item tf
  1079. transfer function
  1080. @item zp
  1081. Z-plane zeros/poles, cartesian (default)
  1082. @item pr
  1083. Z-plane zeros/poles, polar radians
  1084. @item pd
  1085. Z-plane zeros/poles, polar degrees
  1086. @end table
  1087. @item r
  1088. Set kind of processing.
  1089. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1090. @item e
  1091. Set filtering precision.
  1092. @table @samp
  1093. @item dbl
  1094. double-precision floating-point (default)
  1095. @item flt
  1096. single-precision floating-point
  1097. @item i32
  1098. 32-bit integers
  1099. @item i16
  1100. 16-bit integers
  1101. @end table
  1102. @item mix
  1103. How much to use filtered signal in output. Default is 1.
  1104. Range is between 0 and 1.
  1105. @item response
  1106. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1107. By default it is disabled.
  1108. @item channel
  1109. Set for which IR channel to display frequency response. By default is first channel
  1110. displayed. This option is used only when @var{response} is enabled.
  1111. @item size
  1112. Set video stream size. This option is used only when @var{response} is enabled.
  1113. @end table
  1114. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1115. order.
  1116. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1117. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1118. imaginary unit.
  1119. Different coefficients and gains can be provided for every channel, in such case
  1120. use '|' to separate coefficients or gains. Last provided coefficients will be
  1121. used for all remaining channels.
  1122. @subsection Examples
  1123. @itemize
  1124. @item
  1125. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1126. @example
  1127. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1128. @end example
  1129. @item
  1130. Same as above but in @code{zp} format:
  1131. @example
  1132. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1133. @end example
  1134. @end itemize
  1135. @section alimiter
  1136. The limiter prevents an input signal from rising over a desired threshold.
  1137. This limiter uses lookahead technology to prevent your signal from distorting.
  1138. It means that there is a small delay after the signal is processed. Keep in mind
  1139. that the delay it produces is the attack time you set.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item level_in
  1143. Set input gain. Default is 1.
  1144. @item level_out
  1145. Set output gain. Default is 1.
  1146. @item limit
  1147. Don't let signals above this level pass the limiter. Default is 1.
  1148. @item attack
  1149. The limiter will reach its attenuation level in this amount of time in
  1150. milliseconds. Default is 5 milliseconds.
  1151. @item release
  1152. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1153. Default is 50 milliseconds.
  1154. @item asc
  1155. When gain reduction is always needed ASC takes care of releasing to an
  1156. average reduction level rather than reaching a reduction of 0 in the release
  1157. time.
  1158. @item asc_level
  1159. Select how much the release time is affected by ASC, 0 means nearly no changes
  1160. in release time while 1 produces higher release times.
  1161. @item level
  1162. Auto level output signal. Default is enabled.
  1163. This normalizes audio back to 0dB if enabled.
  1164. @end table
  1165. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1166. with @ref{aresample} before applying this filter.
  1167. @section allpass
  1168. Apply a two-pole all-pass filter with central frequency (in Hz)
  1169. @var{frequency}, and filter-width @var{width}.
  1170. An all-pass filter changes the audio's frequency to phase relationship
  1171. without changing its frequency to amplitude relationship.
  1172. The filter accepts the following options:
  1173. @table @option
  1174. @item frequency, f
  1175. Set frequency in Hz.
  1176. @item width_type, t
  1177. Set method to specify band-width of filter.
  1178. @table @option
  1179. @item h
  1180. Hz
  1181. @item q
  1182. Q-Factor
  1183. @item o
  1184. octave
  1185. @item s
  1186. slope
  1187. @item k
  1188. kHz
  1189. @end table
  1190. @item width, w
  1191. Specify the band-width of a filter in width_type units.
  1192. @item mix, m
  1193. How much to use filtered signal in output. Default is 1.
  1194. Range is between 0 and 1.
  1195. @item channels, c
  1196. Specify which channels to filter, by default all available are filtered.
  1197. @item normalize, n
  1198. Normalize biquad coefficients, by default is disabled.
  1199. Enabling it will normalize magnitude response at DC to 0dB.
  1200. @end table
  1201. @subsection Commands
  1202. This filter supports the following commands:
  1203. @table @option
  1204. @item frequency, f
  1205. Change allpass frequency.
  1206. Syntax for the command is : "@var{frequency}"
  1207. @item width_type, t
  1208. Change allpass width_type.
  1209. Syntax for the command is : "@var{width_type}"
  1210. @item width, w
  1211. Change allpass width.
  1212. Syntax for the command is : "@var{width}"
  1213. @item mix, m
  1214. Change allpass mix.
  1215. Syntax for the command is : "@var{mix}"
  1216. @end table
  1217. @section aloop
  1218. Loop audio samples.
  1219. The filter accepts the following options:
  1220. @table @option
  1221. @item loop
  1222. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1223. Default is 0.
  1224. @item size
  1225. Set maximal number of samples. Default is 0.
  1226. @item start
  1227. Set first sample of loop. Default is 0.
  1228. @end table
  1229. @anchor{amerge}
  1230. @section amerge
  1231. Merge two or more audio streams into a single multi-channel stream.
  1232. The filter accepts the following options:
  1233. @table @option
  1234. @item inputs
  1235. Set the number of inputs. Default is 2.
  1236. @end table
  1237. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1238. the channel layout of the output will be set accordingly and the channels
  1239. will be reordered as necessary. If the channel layouts of the inputs are not
  1240. disjoint, the output will have all the channels of the first input then all
  1241. the channels of the second input, in that order, and the channel layout of
  1242. the output will be the default value corresponding to the total number of
  1243. channels.
  1244. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1245. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1246. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1247. first input, b1 is the first channel of the second input).
  1248. On the other hand, if both input are in stereo, the output channels will be
  1249. in the default order: a1, a2, b1, b2, and the channel layout will be
  1250. arbitrarily set to 4.0, which may or may not be the expected value.
  1251. All inputs must have the same sample rate, and format.
  1252. If inputs do not have the same duration, the output will stop with the
  1253. shortest.
  1254. @subsection Examples
  1255. @itemize
  1256. @item
  1257. Merge two mono files into a stereo stream:
  1258. @example
  1259. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1260. @end example
  1261. @item
  1262. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1263. @example
  1264. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1265. @end example
  1266. @end itemize
  1267. @section amix
  1268. Mixes multiple audio inputs into a single output.
  1269. Note that this filter only supports float samples (the @var{amerge}
  1270. and @var{pan} audio filters support many formats). If the @var{amix}
  1271. input has integer samples then @ref{aresample} will be automatically
  1272. inserted to perform the conversion to float samples.
  1273. For example
  1274. @example
  1275. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1276. @end example
  1277. will mix 3 input audio streams to a single output with the same duration as the
  1278. first input and a dropout transition time of 3 seconds.
  1279. It accepts the following parameters:
  1280. @table @option
  1281. @item inputs
  1282. The number of inputs. If unspecified, it defaults to 2.
  1283. @item duration
  1284. How to determine the end-of-stream.
  1285. @table @option
  1286. @item longest
  1287. The duration of the longest input. (default)
  1288. @item shortest
  1289. The duration of the shortest input.
  1290. @item first
  1291. The duration of the first input.
  1292. @end table
  1293. @item dropout_transition
  1294. The transition time, in seconds, for volume renormalization when an input
  1295. stream ends. The default value is 2 seconds.
  1296. @item weights
  1297. Specify weight of each input audio stream as sequence.
  1298. Each weight is separated by space. By default all inputs have same weight.
  1299. @end table
  1300. @section amultiply
  1301. Multiply first audio stream with second audio stream and store result
  1302. in output audio stream. Multiplication is done by multiplying each
  1303. sample from first stream with sample at same position from second stream.
  1304. With this element-wise multiplication one can create amplitude fades and
  1305. amplitude modulations.
  1306. @section anequalizer
  1307. High-order parametric multiband equalizer for each channel.
  1308. It accepts the following parameters:
  1309. @table @option
  1310. @item params
  1311. This option string is in format:
  1312. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1313. Each equalizer band is separated by '|'.
  1314. @table @option
  1315. @item chn
  1316. Set channel number to which equalization will be applied.
  1317. If input doesn't have that channel the entry is ignored.
  1318. @item f
  1319. Set central frequency for band.
  1320. If input doesn't have that frequency the entry is ignored.
  1321. @item w
  1322. Set band width in hertz.
  1323. @item g
  1324. Set band gain in dB.
  1325. @item t
  1326. Set filter type for band, optional, can be:
  1327. @table @samp
  1328. @item 0
  1329. Butterworth, this is default.
  1330. @item 1
  1331. Chebyshev type 1.
  1332. @item 2
  1333. Chebyshev type 2.
  1334. @end table
  1335. @end table
  1336. @item curves
  1337. With this option activated frequency response of anequalizer is displayed
  1338. in video stream.
  1339. @item size
  1340. Set video stream size. Only useful if curves option is activated.
  1341. @item mgain
  1342. Set max gain that will be displayed. Only useful if curves option is activated.
  1343. Setting this to a reasonable value makes it possible to display gain which is derived from
  1344. neighbour bands which are too close to each other and thus produce higher gain
  1345. when both are activated.
  1346. @item fscale
  1347. Set frequency scale used to draw frequency response in video output.
  1348. Can be linear or logarithmic. Default is logarithmic.
  1349. @item colors
  1350. Set color for each channel curve which is going to be displayed in video stream.
  1351. This is list of color names separated by space or by '|'.
  1352. Unrecognised or missing colors will be replaced by white color.
  1353. @end table
  1354. @subsection Examples
  1355. @itemize
  1356. @item
  1357. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1358. for first 2 channels using Chebyshev type 1 filter:
  1359. @example
  1360. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1361. @end example
  1362. @end itemize
  1363. @subsection Commands
  1364. This filter supports the following commands:
  1365. @table @option
  1366. @item change
  1367. Alter existing filter parameters.
  1368. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1369. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1370. error is returned.
  1371. @var{freq} set new frequency parameter.
  1372. @var{width} set new width parameter in herz.
  1373. @var{gain} set new gain parameter in dB.
  1374. Full filter invocation with asendcmd may look like this:
  1375. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1376. @end table
  1377. @section anlmdn
  1378. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1379. Each sample is adjusted by looking for other samples with similar contexts. This
  1380. context similarity is defined by comparing their surrounding patches of size
  1381. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1382. The filter accepts the following options:
  1383. @table @option
  1384. @item s
  1385. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1386. @item p
  1387. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1388. Default value is 2 milliseconds.
  1389. @item r
  1390. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1391. Default value is 6 milliseconds.
  1392. @item o
  1393. Set the output mode.
  1394. It accepts the following values:
  1395. @table @option
  1396. @item i
  1397. Pass input unchanged.
  1398. @item o
  1399. Pass noise filtered out.
  1400. @item n
  1401. Pass only noise.
  1402. Default value is @var{o}.
  1403. @end table
  1404. @item m
  1405. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1406. @end table
  1407. @subsection Commands
  1408. This filter supports the following commands:
  1409. @table @option
  1410. @item s
  1411. Change denoise strength. Argument is single float number.
  1412. Syntax for the command is : "@var{s}"
  1413. @item o
  1414. Change output mode.
  1415. Syntax for the command is : "i", "o" or "n" string.
  1416. @end table
  1417. @section anlms
  1418. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1419. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1420. relate to producing the least mean square of the error signal (difference between the desired,
  1421. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1422. A description of the accepted options follows.
  1423. @table @option
  1424. @item order
  1425. Set filter order.
  1426. @item mu
  1427. Set filter mu.
  1428. @item eps
  1429. Set the filter eps.
  1430. @item leakage
  1431. Set the filter leakage.
  1432. @item out_mode
  1433. It accepts the following values:
  1434. @table @option
  1435. @item i
  1436. Pass the 1st input.
  1437. @item d
  1438. Pass the 2nd input.
  1439. @item o
  1440. Pass filtered samples.
  1441. @item n
  1442. Pass difference between desired and filtered samples.
  1443. Default value is @var{o}.
  1444. @end table
  1445. @end table
  1446. @subsection Examples
  1447. @itemize
  1448. @item
  1449. One of many usages of this filter is noise reduction, input audio is filtered
  1450. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1451. @example
  1452. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1453. @end example
  1454. @end itemize
  1455. @subsection Commands
  1456. This filter supports the same commands as options, excluding option @code{order}.
  1457. @section anull
  1458. Pass the audio source unchanged to the output.
  1459. @section apad
  1460. Pad the end of an audio stream with silence.
  1461. This can be used together with @command{ffmpeg} @option{-shortest} to
  1462. extend audio streams to the same length as the video stream.
  1463. A description of the accepted options follows.
  1464. @table @option
  1465. @item packet_size
  1466. Set silence packet size. Default value is 4096.
  1467. @item pad_len
  1468. Set the number of samples of silence to add to the end. After the
  1469. value is reached, the stream is terminated. This option is mutually
  1470. exclusive with @option{whole_len}.
  1471. @item whole_len
  1472. Set the minimum total number of samples in the output audio stream. If
  1473. the value is longer than the input audio length, silence is added to
  1474. the end, until the value is reached. This option is mutually exclusive
  1475. with @option{pad_len}.
  1476. @item pad_dur
  1477. Specify the duration of samples of silence to add. See
  1478. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1479. for the accepted syntax. Used only if set to non-zero value.
  1480. @item whole_dur
  1481. Specify the minimum total duration in the output audio stream. See
  1482. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1483. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1484. the input audio length, silence is added to the end, until the value is reached.
  1485. This option is mutually exclusive with @option{pad_dur}
  1486. @end table
  1487. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1488. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1489. the input stream indefinitely.
  1490. @subsection Examples
  1491. @itemize
  1492. @item
  1493. Add 1024 samples of silence to the end of the input:
  1494. @example
  1495. apad=pad_len=1024
  1496. @end example
  1497. @item
  1498. Make sure the audio output will contain at least 10000 samples, pad
  1499. the input with silence if required:
  1500. @example
  1501. apad=whole_len=10000
  1502. @end example
  1503. @item
  1504. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1505. video stream will always result the shortest and will be converted
  1506. until the end in the output file when using the @option{shortest}
  1507. option:
  1508. @example
  1509. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1510. @end example
  1511. @end itemize
  1512. @section aphaser
  1513. Add a phasing effect to the input audio.
  1514. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1515. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1516. A description of the accepted parameters follows.
  1517. @table @option
  1518. @item in_gain
  1519. Set input gain. Default is 0.4.
  1520. @item out_gain
  1521. Set output gain. Default is 0.74
  1522. @item delay
  1523. Set delay in milliseconds. Default is 3.0.
  1524. @item decay
  1525. Set decay. Default is 0.4.
  1526. @item speed
  1527. Set modulation speed in Hz. Default is 0.5.
  1528. @item type
  1529. Set modulation type. Default is triangular.
  1530. It accepts the following values:
  1531. @table @samp
  1532. @item triangular, t
  1533. @item sinusoidal, s
  1534. @end table
  1535. @end table
  1536. @section apulsator
  1537. Audio pulsator is something between an autopanner and a tremolo.
  1538. But it can produce funny stereo effects as well. Pulsator changes the volume
  1539. of the left and right channel based on a LFO (low frequency oscillator) with
  1540. different waveforms and shifted phases.
  1541. This filter have the ability to define an offset between left and right
  1542. channel. An offset of 0 means that both LFO shapes match each other.
  1543. The left and right channel are altered equally - a conventional tremolo.
  1544. An offset of 50% means that the shape of the right channel is exactly shifted
  1545. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1546. an autopanner. At 1 both curves match again. Every setting in between moves the
  1547. phase shift gapless between all stages and produces some "bypassing" sounds with
  1548. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1549. the 0.5) the faster the signal passes from the left to the right speaker.
  1550. The filter accepts the following options:
  1551. @table @option
  1552. @item level_in
  1553. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1554. @item level_out
  1555. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1556. @item mode
  1557. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1558. sawup or sawdown. Default is sine.
  1559. @item amount
  1560. Set modulation. Define how much of original signal is affected by the LFO.
  1561. @item offset_l
  1562. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1563. @item offset_r
  1564. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1565. @item width
  1566. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1567. @item timing
  1568. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1569. @item bpm
  1570. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1571. is set to bpm.
  1572. @item ms
  1573. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1574. is set to ms.
  1575. @item hz
  1576. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1577. if timing is set to hz.
  1578. @end table
  1579. @anchor{aresample}
  1580. @section aresample
  1581. Resample the input audio to the specified parameters, using the
  1582. libswresample library. If none are specified then the filter will
  1583. automatically convert between its input and output.
  1584. This filter is also able to stretch/squeeze the audio data to make it match
  1585. the timestamps or to inject silence / cut out audio to make it match the
  1586. timestamps, do a combination of both or do neither.
  1587. The filter accepts the syntax
  1588. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1589. expresses a sample rate and @var{resampler_options} is a list of
  1590. @var{key}=@var{value} pairs, separated by ":". See the
  1591. @ref{Resampler Options,,"Resampler Options" section in the
  1592. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1593. for the complete list of supported options.
  1594. @subsection Examples
  1595. @itemize
  1596. @item
  1597. Resample the input audio to 44100Hz:
  1598. @example
  1599. aresample=44100
  1600. @end example
  1601. @item
  1602. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1603. samples per second compensation:
  1604. @example
  1605. aresample=async=1000
  1606. @end example
  1607. @end itemize
  1608. @section areverse
  1609. Reverse an audio clip.
  1610. Warning: This filter requires memory to buffer the entire clip, so trimming
  1611. is suggested.
  1612. @subsection Examples
  1613. @itemize
  1614. @item
  1615. Take the first 5 seconds of a clip, and reverse it.
  1616. @example
  1617. atrim=end=5,areverse
  1618. @end example
  1619. @end itemize
  1620. @section arnndn
  1621. Reduce noise from speech using Recurrent Neural Networks.
  1622. This filter accepts the following options:
  1623. @table @option
  1624. @item model, m
  1625. Set train model file to load. This option is always required.
  1626. @end table
  1627. @section asetnsamples
  1628. Set the number of samples per each output audio frame.
  1629. The last output packet may contain a different number of samples, as
  1630. the filter will flush all the remaining samples when the input audio
  1631. signals its end.
  1632. The filter accepts the following options:
  1633. @table @option
  1634. @item nb_out_samples, n
  1635. Set the number of frames per each output audio frame. The number is
  1636. intended as the number of samples @emph{per each channel}.
  1637. Default value is 1024.
  1638. @item pad, p
  1639. If set to 1, the filter will pad the last audio frame with zeroes, so
  1640. that the last frame will contain the same number of samples as the
  1641. previous ones. Default value is 1.
  1642. @end table
  1643. For example, to set the number of per-frame samples to 1234 and
  1644. disable padding for the last frame, use:
  1645. @example
  1646. asetnsamples=n=1234:p=0
  1647. @end example
  1648. @section asetrate
  1649. Set the sample rate without altering the PCM data.
  1650. This will result in a change of speed and pitch.
  1651. The filter accepts the following options:
  1652. @table @option
  1653. @item sample_rate, r
  1654. Set the output sample rate. Default is 44100 Hz.
  1655. @end table
  1656. @section ashowinfo
  1657. Show a line containing various information for each input audio frame.
  1658. The input audio is not modified.
  1659. The shown line contains a sequence of key/value pairs of the form
  1660. @var{key}:@var{value}.
  1661. The following values are shown in the output:
  1662. @table @option
  1663. @item n
  1664. The (sequential) number of the input frame, starting from 0.
  1665. @item pts
  1666. The presentation timestamp of the input frame, in time base units; the time base
  1667. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1668. @item pts_time
  1669. The presentation timestamp of the input frame in seconds.
  1670. @item pos
  1671. position of the frame in the input stream, -1 if this information in
  1672. unavailable and/or meaningless (for example in case of synthetic audio)
  1673. @item fmt
  1674. The sample format.
  1675. @item chlayout
  1676. The channel layout.
  1677. @item rate
  1678. The sample rate for the audio frame.
  1679. @item nb_samples
  1680. The number of samples (per channel) in the frame.
  1681. @item checksum
  1682. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1683. audio, the data is treated as if all the planes were concatenated.
  1684. @item plane_checksums
  1685. A list of Adler-32 checksums for each data plane.
  1686. @end table
  1687. @section asoftclip
  1688. Apply audio soft clipping.
  1689. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1690. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1691. This filter accepts the following options:
  1692. @table @option
  1693. @item type
  1694. Set type of soft-clipping.
  1695. It accepts the following values:
  1696. @table @option
  1697. @item tanh
  1698. @item atan
  1699. @item cubic
  1700. @item exp
  1701. @item alg
  1702. @item quintic
  1703. @item sin
  1704. @end table
  1705. @item param
  1706. Set additional parameter which controls sigmoid function.
  1707. @end table
  1708. @section asr
  1709. Automatic Speech Recognition
  1710. This filter uses PocketSphinx for speech recognition. To enable
  1711. compilation of this filter, you need to configure FFmpeg with
  1712. @code{--enable-pocketsphinx}.
  1713. It accepts the following options:
  1714. @table @option
  1715. @item rate
  1716. Set sampling rate of input audio. Defaults is @code{16000}.
  1717. This need to match speech models, otherwise one will get poor results.
  1718. @item hmm
  1719. Set dictionary containing acoustic model files.
  1720. @item dict
  1721. Set pronunciation dictionary.
  1722. @item lm
  1723. Set language model file.
  1724. @item lmctl
  1725. Set language model set.
  1726. @item lmname
  1727. Set which language model to use.
  1728. @item logfn
  1729. Set output for log messages.
  1730. @end table
  1731. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1732. @anchor{astats}
  1733. @section astats
  1734. Display time domain statistical information about the audio channels.
  1735. Statistics are calculated and displayed for each audio channel and,
  1736. where applicable, an overall figure is also given.
  1737. It accepts the following option:
  1738. @table @option
  1739. @item length
  1740. Short window length in seconds, used for peak and trough RMS measurement.
  1741. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1742. @item metadata
  1743. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1744. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1745. disabled.
  1746. Available keys for each channel are:
  1747. DC_offset
  1748. Min_level
  1749. Max_level
  1750. Min_difference
  1751. Max_difference
  1752. Mean_difference
  1753. RMS_difference
  1754. Peak_level
  1755. RMS_peak
  1756. RMS_trough
  1757. Crest_factor
  1758. Flat_factor
  1759. Peak_count
  1760. Bit_depth
  1761. Dynamic_range
  1762. Zero_crossings
  1763. Zero_crossings_rate
  1764. Number_of_NaNs
  1765. Number_of_Infs
  1766. Number_of_denormals
  1767. and for Overall:
  1768. DC_offset
  1769. Min_level
  1770. Max_level
  1771. Min_difference
  1772. Max_difference
  1773. Mean_difference
  1774. RMS_difference
  1775. Peak_level
  1776. RMS_level
  1777. RMS_peak
  1778. RMS_trough
  1779. Flat_factor
  1780. Peak_count
  1781. Bit_depth
  1782. Number_of_samples
  1783. Number_of_NaNs
  1784. Number_of_Infs
  1785. Number_of_denormals
  1786. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1787. this @code{lavfi.astats.Overall.Peak_count}.
  1788. For description what each key means read below.
  1789. @item reset
  1790. Set number of frame after which stats are going to be recalculated.
  1791. Default is disabled.
  1792. @item measure_perchannel
  1793. Select the entries which need to be measured per channel. The metadata keys can
  1794. be used as flags, default is @option{all} which measures everything.
  1795. @option{none} disables all per channel measurement.
  1796. @item measure_overall
  1797. Select the entries which need to be measured overall. The metadata keys can
  1798. be used as flags, default is @option{all} which measures everything.
  1799. @option{none} disables all overall measurement.
  1800. @end table
  1801. A description of each shown parameter follows:
  1802. @table @option
  1803. @item DC offset
  1804. Mean amplitude displacement from zero.
  1805. @item Min level
  1806. Minimal sample level.
  1807. @item Max level
  1808. Maximal sample level.
  1809. @item Min difference
  1810. Minimal difference between two consecutive samples.
  1811. @item Max difference
  1812. Maximal difference between two consecutive samples.
  1813. @item Mean difference
  1814. Mean difference between two consecutive samples.
  1815. The average of each difference between two consecutive samples.
  1816. @item RMS difference
  1817. Root Mean Square difference between two consecutive samples.
  1818. @item Peak level dB
  1819. @item RMS level dB
  1820. Standard peak and RMS level measured in dBFS.
  1821. @item RMS peak dB
  1822. @item RMS trough dB
  1823. Peak and trough values for RMS level measured over a short window.
  1824. @item Crest factor
  1825. Standard ratio of peak to RMS level (note: not in dB).
  1826. @item Flat factor
  1827. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1828. (i.e. either @var{Min level} or @var{Max level}).
  1829. @item Peak count
  1830. Number of occasions (not the number of samples) that the signal attained either
  1831. @var{Min level} or @var{Max level}.
  1832. @item Bit depth
  1833. Overall bit depth of audio. Number of bits used for each sample.
  1834. @item Dynamic range
  1835. Measured dynamic range of audio in dB.
  1836. @item Zero crossings
  1837. Number of points where the waveform crosses the zero level axis.
  1838. @item Zero crossings rate
  1839. Rate of Zero crossings and number of audio samples.
  1840. @end table
  1841. @section atempo
  1842. Adjust audio tempo.
  1843. The filter accepts exactly one parameter, the audio tempo. If not
  1844. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1845. be in the [0.5, 100.0] range.
  1846. Note that tempo greater than 2 will skip some samples rather than
  1847. blend them in. If for any reason this is a concern it is always
  1848. possible to daisy-chain several instances of atempo to achieve the
  1849. desired product tempo.
  1850. @subsection Examples
  1851. @itemize
  1852. @item
  1853. Slow down audio to 80% tempo:
  1854. @example
  1855. atempo=0.8
  1856. @end example
  1857. @item
  1858. To speed up audio to 300% tempo:
  1859. @example
  1860. atempo=3
  1861. @end example
  1862. @item
  1863. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1864. @example
  1865. atempo=sqrt(3),atempo=sqrt(3)
  1866. @end example
  1867. @end itemize
  1868. @subsection Commands
  1869. This filter supports the following commands:
  1870. @table @option
  1871. @item tempo
  1872. Change filter tempo scale factor.
  1873. Syntax for the command is : "@var{tempo}"
  1874. @end table
  1875. @section atrim
  1876. Trim the input so that the output contains one continuous subpart of the input.
  1877. It accepts the following parameters:
  1878. @table @option
  1879. @item start
  1880. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1881. sample with the timestamp @var{start} will be the first sample in the output.
  1882. @item end
  1883. Specify time of the first audio sample that will be dropped, i.e. the
  1884. audio sample immediately preceding the one with the timestamp @var{end} will be
  1885. the last sample in the output.
  1886. @item start_pts
  1887. Same as @var{start}, except this option sets the start timestamp in samples
  1888. instead of seconds.
  1889. @item end_pts
  1890. Same as @var{end}, except this option sets the end timestamp in samples instead
  1891. of seconds.
  1892. @item duration
  1893. The maximum duration of the output in seconds.
  1894. @item start_sample
  1895. The number of the first sample that should be output.
  1896. @item end_sample
  1897. The number of the first sample that should be dropped.
  1898. @end table
  1899. @option{start}, @option{end}, and @option{duration} are expressed as time
  1900. duration specifications; see
  1901. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1902. Note that the first two sets of the start/end options and the @option{duration}
  1903. option look at the frame timestamp, while the _sample options simply count the
  1904. samples that pass through the filter. So start/end_pts and start/end_sample will
  1905. give different results when the timestamps are wrong, inexact or do not start at
  1906. zero. Also note that this filter does not modify the timestamps. If you wish
  1907. to have the output timestamps start at zero, insert the asetpts filter after the
  1908. atrim filter.
  1909. If multiple start or end options are set, this filter tries to be greedy and
  1910. keep all samples that match at least one of the specified constraints. To keep
  1911. only the part that matches all the constraints at once, chain multiple atrim
  1912. filters.
  1913. The defaults are such that all the input is kept. So it is possible to set e.g.
  1914. just the end values to keep everything before the specified time.
  1915. Examples:
  1916. @itemize
  1917. @item
  1918. Drop everything except the second minute of input:
  1919. @example
  1920. ffmpeg -i INPUT -af atrim=60:120
  1921. @end example
  1922. @item
  1923. Keep only the first 1000 samples:
  1924. @example
  1925. ffmpeg -i INPUT -af atrim=end_sample=1000
  1926. @end example
  1927. @end itemize
  1928. @section axcorrelate
  1929. Calculate normalized cross-correlation between two input audio streams.
  1930. Resulted samples are always between -1 and 1 inclusive.
  1931. If result is 1 it means two input samples are highly correlated in that selected segment.
  1932. Result 0 means they are not correlated at all.
  1933. If result is -1 it means two input samples are out of phase, which means they cancel each
  1934. other.
  1935. The filter accepts the following options:
  1936. @table @option
  1937. @item size
  1938. Set size of segment over which cross-correlation is calculated.
  1939. Default is 256. Allowed range is from 2 to 131072.
  1940. @item algo
  1941. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1942. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1943. are always zero and thus need much less calculations to make.
  1944. This is generally not true, but is valid for typical audio streams.
  1945. @end table
  1946. @subsection Examples
  1947. @itemize
  1948. @item
  1949. Calculate correlation between channels in stereo audio stream:
  1950. @example
  1951. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  1952. @end example
  1953. @end itemize
  1954. @section bandpass
  1955. Apply a two-pole Butterworth band-pass filter with central
  1956. frequency @var{frequency}, and (3dB-point) band-width width.
  1957. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1958. instead of the default: constant 0dB peak gain.
  1959. The filter roll off at 6dB per octave (20dB per decade).
  1960. The filter accepts the following options:
  1961. @table @option
  1962. @item frequency, f
  1963. Set the filter's central frequency. Default is @code{3000}.
  1964. @item csg
  1965. Constant skirt gain if set to 1. Defaults to 0.
  1966. @item width_type, t
  1967. Set method to specify band-width of filter.
  1968. @table @option
  1969. @item h
  1970. Hz
  1971. @item q
  1972. Q-Factor
  1973. @item o
  1974. octave
  1975. @item s
  1976. slope
  1977. @item k
  1978. kHz
  1979. @end table
  1980. @item width, w
  1981. Specify the band-width of a filter in width_type units.
  1982. @item mix, m
  1983. How much to use filtered signal in output. Default is 1.
  1984. Range is between 0 and 1.
  1985. @item channels, c
  1986. Specify which channels to filter, by default all available are filtered.
  1987. @item normalize, n
  1988. Normalize biquad coefficients, by default is disabled.
  1989. Enabling it will normalize magnitude response at DC to 0dB.
  1990. @end table
  1991. @subsection Commands
  1992. This filter supports the following commands:
  1993. @table @option
  1994. @item frequency, f
  1995. Change bandpass frequency.
  1996. Syntax for the command is : "@var{frequency}"
  1997. @item width_type, t
  1998. Change bandpass width_type.
  1999. Syntax for the command is : "@var{width_type}"
  2000. @item width, w
  2001. Change bandpass width.
  2002. Syntax for the command is : "@var{width}"
  2003. @item mix, m
  2004. Change bandpass mix.
  2005. Syntax for the command is : "@var{mix}"
  2006. @end table
  2007. @section bandreject
  2008. Apply a two-pole Butterworth band-reject filter with central
  2009. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2010. The filter roll off at 6dB per octave (20dB per decade).
  2011. The filter accepts the following options:
  2012. @table @option
  2013. @item frequency, f
  2014. Set the filter's central frequency. Default is @code{3000}.
  2015. @item width_type, t
  2016. Set method to specify band-width of filter.
  2017. @table @option
  2018. @item h
  2019. Hz
  2020. @item q
  2021. Q-Factor
  2022. @item o
  2023. octave
  2024. @item s
  2025. slope
  2026. @item k
  2027. kHz
  2028. @end table
  2029. @item width, w
  2030. Specify the band-width of a filter in width_type units.
  2031. @item mix, m
  2032. How much to use filtered signal in output. Default is 1.
  2033. Range is between 0 and 1.
  2034. @item channels, c
  2035. Specify which channels to filter, by default all available are filtered.
  2036. @item normalize, n
  2037. Normalize biquad coefficients, by default is disabled.
  2038. Enabling it will normalize magnitude response at DC to 0dB.
  2039. @end table
  2040. @subsection Commands
  2041. This filter supports the following commands:
  2042. @table @option
  2043. @item frequency, f
  2044. Change bandreject frequency.
  2045. Syntax for the command is : "@var{frequency}"
  2046. @item width_type, t
  2047. Change bandreject width_type.
  2048. Syntax for the command is : "@var{width_type}"
  2049. @item width, w
  2050. Change bandreject width.
  2051. Syntax for the command is : "@var{width}"
  2052. @item mix, m
  2053. Change bandreject mix.
  2054. Syntax for the command is : "@var{mix}"
  2055. @end table
  2056. @section bass, lowshelf
  2057. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2058. shelving filter with a response similar to that of a standard
  2059. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2060. The filter accepts the following options:
  2061. @table @option
  2062. @item gain, g
  2063. Give the gain at 0 Hz. Its useful range is about -20
  2064. (for a large cut) to +20 (for a large boost).
  2065. Beware of clipping when using a positive gain.
  2066. @item frequency, f
  2067. Set the filter's central frequency and so can be used
  2068. to extend or reduce the frequency range to be boosted or cut.
  2069. The default value is @code{100} Hz.
  2070. @item width_type, t
  2071. Set method to specify band-width of filter.
  2072. @table @option
  2073. @item h
  2074. Hz
  2075. @item q
  2076. Q-Factor
  2077. @item o
  2078. octave
  2079. @item s
  2080. slope
  2081. @item k
  2082. kHz
  2083. @end table
  2084. @item width, w
  2085. Determine how steep is the filter's shelf transition.
  2086. @item mix, m
  2087. How much to use filtered signal in output. Default is 1.
  2088. Range is between 0 and 1.
  2089. @item channels, c
  2090. Specify which channels to filter, by default all available are filtered.
  2091. @item normalize, n
  2092. Normalize biquad coefficients, by default is disabled.
  2093. Enabling it will normalize magnitude response at DC to 0dB.
  2094. @end table
  2095. @subsection Commands
  2096. This filter supports the following commands:
  2097. @table @option
  2098. @item frequency, f
  2099. Change bass frequency.
  2100. Syntax for the command is : "@var{frequency}"
  2101. @item width_type, t
  2102. Change bass width_type.
  2103. Syntax for the command is : "@var{width_type}"
  2104. @item width, w
  2105. Change bass width.
  2106. Syntax for the command is : "@var{width}"
  2107. @item gain, g
  2108. Change bass gain.
  2109. Syntax for the command is : "@var{gain}"
  2110. @item mix, m
  2111. Change bass mix.
  2112. Syntax for the command is : "@var{mix}"
  2113. @end table
  2114. @section biquad
  2115. Apply a biquad IIR filter with the given coefficients.
  2116. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2117. are the numerator and denominator coefficients respectively.
  2118. and @var{channels}, @var{c} specify which channels to filter, by default all
  2119. available are filtered.
  2120. @subsection Commands
  2121. This filter supports the following commands:
  2122. @table @option
  2123. @item a0
  2124. @item a1
  2125. @item a2
  2126. @item b0
  2127. @item b1
  2128. @item b2
  2129. Change biquad parameter.
  2130. Syntax for the command is : "@var{value}"
  2131. @item mix, m
  2132. How much to use filtered signal in output. Default is 1.
  2133. Range is between 0 and 1.
  2134. @item channels, c
  2135. Specify which channels to filter, by default all available are filtered.
  2136. @item normalize, n
  2137. Normalize biquad coefficients, by default is disabled.
  2138. Enabling it will normalize magnitude response at DC to 0dB.
  2139. @end table
  2140. @section bs2b
  2141. Bauer stereo to binaural transformation, which improves headphone listening of
  2142. stereo audio records.
  2143. To enable compilation of this filter you need to configure FFmpeg with
  2144. @code{--enable-libbs2b}.
  2145. It accepts the following parameters:
  2146. @table @option
  2147. @item profile
  2148. Pre-defined crossfeed level.
  2149. @table @option
  2150. @item default
  2151. Default level (fcut=700, feed=50).
  2152. @item cmoy
  2153. Chu Moy circuit (fcut=700, feed=60).
  2154. @item jmeier
  2155. Jan Meier circuit (fcut=650, feed=95).
  2156. @end table
  2157. @item fcut
  2158. Cut frequency (in Hz).
  2159. @item feed
  2160. Feed level (in Hz).
  2161. @end table
  2162. @section channelmap
  2163. Remap input channels to new locations.
  2164. It accepts the following parameters:
  2165. @table @option
  2166. @item map
  2167. Map channels from input to output. The argument is a '|'-separated list of
  2168. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2169. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2170. channel (e.g. FL for front left) or its index in the input channel layout.
  2171. @var{out_channel} is the name of the output channel or its index in the output
  2172. channel layout. If @var{out_channel} is not given then it is implicitly an
  2173. index, starting with zero and increasing by one for each mapping.
  2174. @item channel_layout
  2175. The channel layout of the output stream.
  2176. @end table
  2177. If no mapping is present, the filter will implicitly map input channels to
  2178. output channels, preserving indices.
  2179. @subsection Examples
  2180. @itemize
  2181. @item
  2182. For example, assuming a 5.1+downmix input MOV file,
  2183. @example
  2184. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2185. @end example
  2186. will create an output WAV file tagged as stereo from the downmix channels of
  2187. the input.
  2188. @item
  2189. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2190. @example
  2191. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2192. @end example
  2193. @end itemize
  2194. @section channelsplit
  2195. Split each channel from an input audio stream into a separate output stream.
  2196. It accepts the following parameters:
  2197. @table @option
  2198. @item channel_layout
  2199. The channel layout of the input stream. The default is "stereo".
  2200. @item channels
  2201. A channel layout describing the channels to be extracted as separate output streams
  2202. or "all" to extract each input channel as a separate stream. The default is "all".
  2203. Choosing channels not present in channel layout in the input will result in an error.
  2204. @end table
  2205. @subsection Examples
  2206. @itemize
  2207. @item
  2208. For example, assuming a stereo input MP3 file,
  2209. @example
  2210. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2211. @end example
  2212. will create an output Matroska file with two audio streams, one containing only
  2213. the left channel and the other the right channel.
  2214. @item
  2215. Split a 5.1 WAV file into per-channel files:
  2216. @example
  2217. ffmpeg -i in.wav -filter_complex
  2218. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2219. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2220. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2221. side_right.wav
  2222. @end example
  2223. @item
  2224. Extract only LFE from a 5.1 WAV file:
  2225. @example
  2226. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2227. -map '[LFE]' lfe.wav
  2228. @end example
  2229. @end itemize
  2230. @section chorus
  2231. Add a chorus effect to the audio.
  2232. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2233. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2234. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2235. The modulation depth defines the range the modulated delay is played before or after
  2236. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2237. sound tuned around the original one, like in a chorus where some vocals are slightly
  2238. off key.
  2239. It accepts the following parameters:
  2240. @table @option
  2241. @item in_gain
  2242. Set input gain. Default is 0.4.
  2243. @item out_gain
  2244. Set output gain. Default is 0.4.
  2245. @item delays
  2246. Set delays. A typical delay is around 40ms to 60ms.
  2247. @item decays
  2248. Set decays.
  2249. @item speeds
  2250. Set speeds.
  2251. @item depths
  2252. Set depths.
  2253. @end table
  2254. @subsection Examples
  2255. @itemize
  2256. @item
  2257. A single delay:
  2258. @example
  2259. chorus=0.7:0.9:55:0.4:0.25:2
  2260. @end example
  2261. @item
  2262. Two delays:
  2263. @example
  2264. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2265. @end example
  2266. @item
  2267. Fuller sounding chorus with three delays:
  2268. @example
  2269. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  2270. @end example
  2271. @end itemize
  2272. @section compand
  2273. Compress or expand the audio's dynamic range.
  2274. It accepts the following parameters:
  2275. @table @option
  2276. @item attacks
  2277. @item decays
  2278. A list of times in seconds for each channel over which the instantaneous level
  2279. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2280. increase of volume and @var{decays} refers to decrease of volume. For most
  2281. situations, the attack time (response to the audio getting louder) should be
  2282. shorter than the decay time, because the human ear is more sensitive to sudden
  2283. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2284. a typical value for decay is 0.8 seconds.
  2285. If specified number of attacks & decays is lower than number of channels, the last
  2286. set attack/decay will be used for all remaining channels.
  2287. @item points
  2288. A list of points for the transfer function, specified in dB relative to the
  2289. maximum possible signal amplitude. Each key points list must be defined using
  2290. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2291. @code{x0/y0 x1/y1 x2/y2 ....}
  2292. The input values must be in strictly increasing order but the transfer function
  2293. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2294. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2295. function are @code{-70/-70|-60/-20|1/0}.
  2296. @item soft-knee
  2297. Set the curve radius in dB for all joints. It defaults to 0.01.
  2298. @item gain
  2299. Set the additional gain in dB to be applied at all points on the transfer
  2300. function. This allows for easy adjustment of the overall gain.
  2301. It defaults to 0.
  2302. @item volume
  2303. Set an initial volume, in dB, to be assumed for each channel when filtering
  2304. starts. This permits the user to supply a nominal level initially, so that, for
  2305. example, a very large gain is not applied to initial signal levels before the
  2306. companding has begun to operate. A typical value for audio which is initially
  2307. quiet is -90 dB. It defaults to 0.
  2308. @item delay
  2309. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2310. delayed before being fed to the volume adjuster. Specifying a delay
  2311. approximately equal to the attack/decay times allows the filter to effectively
  2312. operate in predictive rather than reactive mode. It defaults to 0.
  2313. @end table
  2314. @subsection Examples
  2315. @itemize
  2316. @item
  2317. Make music with both quiet and loud passages suitable for listening to in a
  2318. noisy environment:
  2319. @example
  2320. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2321. @end example
  2322. Another example for audio with whisper and explosion parts:
  2323. @example
  2324. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2325. @end example
  2326. @item
  2327. A noise gate for when the noise is at a lower level than the signal:
  2328. @example
  2329. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2330. @end example
  2331. @item
  2332. Here is another noise gate, this time for when the noise is at a higher level
  2333. than the signal (making it, in some ways, similar to squelch):
  2334. @example
  2335. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2336. @end example
  2337. @item
  2338. 2:1 compression starting at -6dB:
  2339. @example
  2340. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2341. @end example
  2342. @item
  2343. 2:1 compression starting at -9dB:
  2344. @example
  2345. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2346. @end example
  2347. @item
  2348. 2:1 compression starting at -12dB:
  2349. @example
  2350. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2351. @end example
  2352. @item
  2353. 2:1 compression starting at -18dB:
  2354. @example
  2355. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2356. @end example
  2357. @item
  2358. 3:1 compression starting at -15dB:
  2359. @example
  2360. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2361. @end example
  2362. @item
  2363. Compressor/Gate:
  2364. @example
  2365. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2366. @end example
  2367. @item
  2368. Expander:
  2369. @example
  2370. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  2371. @end example
  2372. @item
  2373. Hard limiter at -6dB:
  2374. @example
  2375. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2376. @end example
  2377. @item
  2378. Hard limiter at -12dB:
  2379. @example
  2380. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2381. @end example
  2382. @item
  2383. Hard noise gate at -35 dB:
  2384. @example
  2385. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2386. @end example
  2387. @item
  2388. Soft limiter:
  2389. @example
  2390. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2391. @end example
  2392. @end itemize
  2393. @section compensationdelay
  2394. Compensation Delay Line is a metric based delay to compensate differing
  2395. positions of microphones or speakers.
  2396. For example, you have recorded guitar with two microphones placed in
  2397. different locations. Because the front of sound wave has fixed speed in
  2398. normal conditions, the phasing of microphones can vary and depends on
  2399. their location and interposition. The best sound mix can be achieved when
  2400. these microphones are in phase (synchronized). Note that a distance of
  2401. ~30 cm between microphones makes one microphone capture the signal in
  2402. antiphase to the other microphone. That makes the final mix sound moody.
  2403. This filter helps to solve phasing problems by adding different delays
  2404. to each microphone track and make them synchronized.
  2405. The best result can be reached when you take one track as base and
  2406. synchronize other tracks one by one with it.
  2407. Remember that synchronization/delay tolerance depends on sample rate, too.
  2408. Higher sample rates will give more tolerance.
  2409. The filter accepts the following parameters:
  2410. @table @option
  2411. @item mm
  2412. Set millimeters distance. This is compensation distance for fine tuning.
  2413. Default is 0.
  2414. @item cm
  2415. Set cm distance. This is compensation distance for tightening distance setup.
  2416. Default is 0.
  2417. @item m
  2418. Set meters distance. This is compensation distance for hard distance setup.
  2419. Default is 0.
  2420. @item dry
  2421. Set dry amount. Amount of unprocessed (dry) signal.
  2422. Default is 0.
  2423. @item wet
  2424. Set wet amount. Amount of processed (wet) signal.
  2425. Default is 1.
  2426. @item temp
  2427. Set temperature in degrees Celsius. This is the temperature of the environment.
  2428. Default is 20.
  2429. @end table
  2430. @section crossfeed
  2431. Apply headphone crossfeed filter.
  2432. Crossfeed is the process of blending the left and right channels of stereo
  2433. audio recording.
  2434. It is mainly used to reduce extreme stereo separation of low frequencies.
  2435. The intent is to produce more speaker like sound to the listener.
  2436. The filter accepts the following options:
  2437. @table @option
  2438. @item strength
  2439. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2440. This sets gain of low shelf filter for side part of stereo image.
  2441. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2442. @item range
  2443. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2444. This sets cut off frequency of low shelf filter. Default is cut off near
  2445. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2446. @item level_in
  2447. Set input gain. Default is 0.9.
  2448. @item level_out
  2449. Set output gain. Default is 1.
  2450. @end table
  2451. @section crystalizer
  2452. Simple algorithm to expand audio dynamic range.
  2453. The filter accepts the following options:
  2454. @table @option
  2455. @item i
  2456. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2457. (unchanged sound) to 10.0 (maximum effect).
  2458. @item c
  2459. Enable clipping. By default is enabled.
  2460. @end table
  2461. @section dcshift
  2462. Apply a DC shift to the audio.
  2463. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2464. in the recording chain) from the audio. The effect of a DC offset is reduced
  2465. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2466. a signal has a DC offset.
  2467. @table @option
  2468. @item shift
  2469. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2470. the audio.
  2471. @item limitergain
  2472. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2473. used to prevent clipping.
  2474. @end table
  2475. @section deesser
  2476. Apply de-essing to the audio samples.
  2477. @table @option
  2478. @item i
  2479. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2480. Default is 0.
  2481. @item m
  2482. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2483. Default is 0.5.
  2484. @item f
  2485. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2486. Default is 0.5.
  2487. @item s
  2488. Set the output mode.
  2489. It accepts the following values:
  2490. @table @option
  2491. @item i
  2492. Pass input unchanged.
  2493. @item o
  2494. Pass ess filtered out.
  2495. @item e
  2496. Pass only ess.
  2497. Default value is @var{o}.
  2498. @end table
  2499. @end table
  2500. @section drmeter
  2501. Measure audio dynamic range.
  2502. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2503. is found in transition material. And anything less that 8 have very poor dynamics
  2504. and is very compressed.
  2505. The filter accepts the following options:
  2506. @table @option
  2507. @item length
  2508. Set window length in seconds used to split audio into segments of equal length.
  2509. Default is 3 seconds.
  2510. @end table
  2511. @section dynaudnorm
  2512. Dynamic Audio Normalizer.
  2513. This filter applies a certain amount of gain to the input audio in order
  2514. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2515. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2516. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2517. This allows for applying extra gain to the "quiet" sections of the audio
  2518. while avoiding distortions or clipping the "loud" sections. In other words:
  2519. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2520. sections, in the sense that the volume of each section is brought to the
  2521. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2522. this goal *without* applying "dynamic range compressing". It will retain 100%
  2523. of the dynamic range *within* each section of the audio file.
  2524. @table @option
  2525. @item framelen, f
  2526. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2527. Default is 500 milliseconds.
  2528. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2529. referred to as frames. This is required, because a peak magnitude has no
  2530. meaning for just a single sample value. Instead, we need to determine the
  2531. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2532. normalizer would simply use the peak magnitude of the complete file, the
  2533. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2534. frame. The length of a frame is specified in milliseconds. By default, the
  2535. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2536. been found to give good results with most files.
  2537. Note that the exact frame length, in number of samples, will be determined
  2538. automatically, based on the sampling rate of the individual input audio file.
  2539. @item gausssize, g
  2540. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2541. number. Default is 31.
  2542. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2543. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2544. is specified in frames, centered around the current frame. For the sake of
  2545. simplicity, this must be an odd number. Consequently, the default value of 31
  2546. takes into account the current frame, as well as the 15 preceding frames and
  2547. the 15 subsequent frames. Using a larger window results in a stronger
  2548. smoothing effect and thus in less gain variation, i.e. slower gain
  2549. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2550. effect and thus in more gain variation, i.e. faster gain adaptation.
  2551. In other words, the more you increase this value, the more the Dynamic Audio
  2552. Normalizer will behave like a "traditional" normalization filter. On the
  2553. contrary, the more you decrease this value, the more the Dynamic Audio
  2554. Normalizer will behave like a dynamic range compressor.
  2555. @item peak, p
  2556. Set the target peak value. This specifies the highest permissible magnitude
  2557. level for the normalized audio input. This filter will try to approach the
  2558. target peak magnitude as closely as possible, but at the same time it also
  2559. makes sure that the normalized signal will never exceed the peak magnitude.
  2560. A frame's maximum local gain factor is imposed directly by the target peak
  2561. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2562. It is not recommended to go above this value.
  2563. @item maxgain, m
  2564. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2565. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2566. factor for each input frame, i.e. the maximum gain factor that does not
  2567. result in clipping or distortion. The maximum gain factor is determined by
  2568. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2569. additionally bounds the frame's maximum gain factor by a predetermined
  2570. (global) maximum gain factor. This is done in order to avoid excessive gain
  2571. factors in "silent" or almost silent frames. By default, the maximum gain
  2572. factor is 10.0, For most inputs the default value should be sufficient and
  2573. it usually is not recommended to increase this value. Though, for input
  2574. with an extremely low overall volume level, it may be necessary to allow even
  2575. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2576. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2577. Instead, a "sigmoid" threshold function will be applied. This way, the
  2578. gain factors will smoothly approach the threshold value, but never exceed that
  2579. value.
  2580. @item targetrms, r
  2581. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2582. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2583. This means that the maximum local gain factor for each frame is defined
  2584. (only) by the frame's highest magnitude sample. This way, the samples can
  2585. be amplified as much as possible without exceeding the maximum signal
  2586. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2587. Normalizer can also take into account the frame's root mean square,
  2588. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2589. determine the power of a time-varying signal. It is therefore considered
  2590. that the RMS is a better approximation of the "perceived loudness" than
  2591. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2592. frames to a constant RMS value, a uniform "perceived loudness" can be
  2593. established. If a target RMS value has been specified, a frame's local gain
  2594. factor is defined as the factor that would result in exactly that RMS value.
  2595. Note, however, that the maximum local gain factor is still restricted by the
  2596. frame's highest magnitude sample, in order to prevent clipping.
  2597. @item coupling, n
  2598. Enable channels coupling. By default is enabled.
  2599. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2600. amount. This means the same gain factor will be applied to all channels, i.e.
  2601. the maximum possible gain factor is determined by the "loudest" channel.
  2602. However, in some recordings, it may happen that the volume of the different
  2603. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2604. In this case, this option can be used to disable the channel coupling. This way,
  2605. the gain factor will be determined independently for each channel, depending
  2606. only on the individual channel's highest magnitude sample. This allows for
  2607. harmonizing the volume of the different channels.
  2608. @item correctdc, c
  2609. Enable DC bias correction. By default is disabled.
  2610. An audio signal (in the time domain) is a sequence of sample values.
  2611. In the Dynamic Audio Normalizer these sample values are represented in the
  2612. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2613. audio signal, or "waveform", should be centered around the zero point.
  2614. That means if we calculate the mean value of all samples in a file, or in a
  2615. single frame, then the result should be 0.0 or at least very close to that
  2616. value. If, however, there is a significant deviation of the mean value from
  2617. 0.0, in either positive or negative direction, this is referred to as a
  2618. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2619. Audio Normalizer provides optional DC bias correction.
  2620. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2621. the mean value, or "DC correction" offset, of each input frame and subtract
  2622. that value from all of the frame's sample values which ensures those samples
  2623. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2624. boundaries, the DC correction offset values will be interpolated smoothly
  2625. between neighbouring frames.
  2626. @item altboundary, b
  2627. Enable alternative boundary mode. By default is disabled.
  2628. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2629. around each frame. This includes the preceding frames as well as the
  2630. subsequent frames. However, for the "boundary" frames, located at the very
  2631. beginning and at the very end of the audio file, not all neighbouring
  2632. frames are available. In particular, for the first few frames in the audio
  2633. file, the preceding frames are not known. And, similarly, for the last few
  2634. frames in the audio file, the subsequent frames are not known. Thus, the
  2635. question arises which gain factors should be assumed for the missing frames
  2636. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2637. to deal with this situation. The default boundary mode assumes a gain factor
  2638. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2639. "fade out" at the beginning and at the end of the input, respectively.
  2640. @item compress, s
  2641. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2642. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2643. compression. This means that signal peaks will not be pruned and thus the
  2644. full dynamic range will be retained within each local neighbourhood. However,
  2645. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2646. normalization algorithm with a more "traditional" compression.
  2647. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2648. (thresholding) function. If (and only if) the compression feature is enabled,
  2649. all input frames will be processed by a soft knee thresholding function prior
  2650. to the actual normalization process. Put simply, the thresholding function is
  2651. going to prune all samples whose magnitude exceeds a certain threshold value.
  2652. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2653. value. Instead, the threshold value will be adjusted for each individual
  2654. frame.
  2655. In general, smaller parameters result in stronger compression, and vice versa.
  2656. Values below 3.0 are not recommended, because audible distortion may appear.
  2657. @end table
  2658. @section earwax
  2659. Make audio easier to listen to on headphones.
  2660. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2661. so that when listened to on headphones the stereo image is moved from
  2662. inside your head (standard for headphones) to outside and in front of
  2663. the listener (standard for speakers).
  2664. Ported from SoX.
  2665. @section equalizer
  2666. Apply a two-pole peaking equalisation (EQ) filter. With this
  2667. filter, the signal-level at and around a selected frequency can
  2668. be increased or decreased, whilst (unlike bandpass and bandreject
  2669. filters) that at all other frequencies is unchanged.
  2670. In order to produce complex equalisation curves, this filter can
  2671. be given several times, each with a different central frequency.
  2672. The filter accepts the following options:
  2673. @table @option
  2674. @item frequency, f
  2675. Set the filter's central frequency in Hz.
  2676. @item width_type, t
  2677. Set method to specify band-width of filter.
  2678. @table @option
  2679. @item h
  2680. Hz
  2681. @item q
  2682. Q-Factor
  2683. @item o
  2684. octave
  2685. @item s
  2686. slope
  2687. @item k
  2688. kHz
  2689. @end table
  2690. @item width, w
  2691. Specify the band-width of a filter in width_type units.
  2692. @item gain, g
  2693. Set the required gain or attenuation in dB.
  2694. Beware of clipping when using a positive gain.
  2695. @item mix, m
  2696. How much to use filtered signal in output. Default is 1.
  2697. Range is between 0 and 1.
  2698. @item channels, c
  2699. Specify which channels to filter, by default all available are filtered.
  2700. @item normalize, n
  2701. Normalize biquad coefficients, by default is disabled.
  2702. Enabling it will normalize magnitude response at DC to 0dB.
  2703. @end table
  2704. @subsection Examples
  2705. @itemize
  2706. @item
  2707. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2708. @example
  2709. equalizer=f=1000:t=h:width=200:g=-10
  2710. @end example
  2711. @item
  2712. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2713. @example
  2714. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2715. @end example
  2716. @end itemize
  2717. @subsection Commands
  2718. This filter supports the following commands:
  2719. @table @option
  2720. @item frequency, f
  2721. Change equalizer frequency.
  2722. Syntax for the command is : "@var{frequency}"
  2723. @item width_type, t
  2724. Change equalizer width_type.
  2725. Syntax for the command is : "@var{width_type}"
  2726. @item width, w
  2727. Change equalizer width.
  2728. Syntax for the command is : "@var{width}"
  2729. @item gain, g
  2730. Change equalizer gain.
  2731. Syntax for the command is : "@var{gain}"
  2732. @item mix, m
  2733. Change equalizer mix.
  2734. Syntax for the command is : "@var{mix}"
  2735. @end table
  2736. @section extrastereo
  2737. Linearly increases the difference between left and right channels which
  2738. adds some sort of "live" effect to playback.
  2739. The filter accepts the following options:
  2740. @table @option
  2741. @item m
  2742. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2743. (average of both channels), with 1.0 sound will be unchanged, with
  2744. -1.0 left and right channels will be swapped.
  2745. @item c
  2746. Enable clipping. By default is enabled.
  2747. @end table
  2748. @section firequalizer
  2749. Apply FIR Equalization using arbitrary frequency response.
  2750. The filter accepts the following option:
  2751. @table @option
  2752. @item gain
  2753. Set gain curve equation (in dB). The expression can contain variables:
  2754. @table @option
  2755. @item f
  2756. the evaluated frequency
  2757. @item sr
  2758. sample rate
  2759. @item ch
  2760. channel number, set to 0 when multichannels evaluation is disabled
  2761. @item chid
  2762. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2763. multichannels evaluation is disabled
  2764. @item chs
  2765. number of channels
  2766. @item chlayout
  2767. channel_layout, see libavutil/channel_layout.h
  2768. @end table
  2769. and functions:
  2770. @table @option
  2771. @item gain_interpolate(f)
  2772. interpolate gain on frequency f based on gain_entry
  2773. @item cubic_interpolate(f)
  2774. same as gain_interpolate, but smoother
  2775. @end table
  2776. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2777. @item gain_entry
  2778. Set gain entry for gain_interpolate function. The expression can
  2779. contain functions:
  2780. @table @option
  2781. @item entry(f, g)
  2782. store gain entry at frequency f with value g
  2783. @end table
  2784. This option is also available as command.
  2785. @item delay
  2786. Set filter delay in seconds. Higher value means more accurate.
  2787. Default is @code{0.01}.
  2788. @item accuracy
  2789. Set filter accuracy in Hz. Lower value means more accurate.
  2790. Default is @code{5}.
  2791. @item wfunc
  2792. Set window function. Acceptable values are:
  2793. @table @option
  2794. @item rectangular
  2795. rectangular window, useful when gain curve is already smooth
  2796. @item hann
  2797. hann window (default)
  2798. @item hamming
  2799. hamming window
  2800. @item blackman
  2801. blackman window
  2802. @item nuttall3
  2803. 3-terms continuous 1st derivative nuttall window
  2804. @item mnuttall3
  2805. minimum 3-terms discontinuous nuttall window
  2806. @item nuttall
  2807. 4-terms continuous 1st derivative nuttall window
  2808. @item bnuttall
  2809. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2810. @item bharris
  2811. blackman-harris window
  2812. @item tukey
  2813. tukey window
  2814. @end table
  2815. @item fixed
  2816. If enabled, use fixed number of audio samples. This improves speed when
  2817. filtering with large delay. Default is disabled.
  2818. @item multi
  2819. Enable multichannels evaluation on gain. Default is disabled.
  2820. @item zero_phase
  2821. Enable zero phase mode by subtracting timestamp to compensate delay.
  2822. Default is disabled.
  2823. @item scale
  2824. Set scale used by gain. Acceptable values are:
  2825. @table @option
  2826. @item linlin
  2827. linear frequency, linear gain
  2828. @item linlog
  2829. linear frequency, logarithmic (in dB) gain (default)
  2830. @item loglin
  2831. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2832. @item loglog
  2833. logarithmic frequency, logarithmic gain
  2834. @end table
  2835. @item dumpfile
  2836. Set file for dumping, suitable for gnuplot.
  2837. @item dumpscale
  2838. Set scale for dumpfile. Acceptable values are same with scale option.
  2839. Default is linlog.
  2840. @item fft2
  2841. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2842. Default is disabled.
  2843. @item min_phase
  2844. Enable minimum phase impulse response. Default is disabled.
  2845. @end table
  2846. @subsection Examples
  2847. @itemize
  2848. @item
  2849. lowpass at 1000 Hz:
  2850. @example
  2851. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2852. @end example
  2853. @item
  2854. lowpass at 1000 Hz with gain_entry:
  2855. @example
  2856. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2857. @end example
  2858. @item
  2859. custom equalization:
  2860. @example
  2861. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2862. @end example
  2863. @item
  2864. higher delay with zero phase to compensate delay:
  2865. @example
  2866. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2867. @end example
  2868. @item
  2869. lowpass on left channel, highpass on right channel:
  2870. @example
  2871. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2872. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2873. @end example
  2874. @end itemize
  2875. @section flanger
  2876. Apply a flanging effect to the audio.
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item delay
  2880. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2881. @item depth
  2882. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2883. @item regen
  2884. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2885. Default value is 0.
  2886. @item width
  2887. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2888. Default value is 71.
  2889. @item speed
  2890. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2891. @item shape
  2892. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2893. Default value is @var{sinusoidal}.
  2894. @item phase
  2895. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2896. Default value is 25.
  2897. @item interp
  2898. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2899. Default is @var{linear}.
  2900. @end table
  2901. @section haas
  2902. Apply Haas effect to audio.
  2903. Note that this makes most sense to apply on mono signals.
  2904. With this filter applied to mono signals it give some directionality and
  2905. stretches its stereo image.
  2906. The filter accepts the following options:
  2907. @table @option
  2908. @item level_in
  2909. Set input level. By default is @var{1}, or 0dB
  2910. @item level_out
  2911. Set output level. By default is @var{1}, or 0dB.
  2912. @item side_gain
  2913. Set gain applied to side part of signal. By default is @var{1}.
  2914. @item middle_source
  2915. Set kind of middle source. Can be one of the following:
  2916. @table @samp
  2917. @item left
  2918. Pick left channel.
  2919. @item right
  2920. Pick right channel.
  2921. @item mid
  2922. Pick middle part signal of stereo image.
  2923. @item side
  2924. Pick side part signal of stereo image.
  2925. @end table
  2926. @item middle_phase
  2927. Change middle phase. By default is disabled.
  2928. @item left_delay
  2929. Set left channel delay. By default is @var{2.05} milliseconds.
  2930. @item left_balance
  2931. Set left channel balance. By default is @var{-1}.
  2932. @item left_gain
  2933. Set left channel gain. By default is @var{1}.
  2934. @item left_phase
  2935. Change left phase. By default is disabled.
  2936. @item right_delay
  2937. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2938. @item right_balance
  2939. Set right channel balance. By default is @var{1}.
  2940. @item right_gain
  2941. Set right channel gain. By default is @var{1}.
  2942. @item right_phase
  2943. Change right phase. By default is enabled.
  2944. @end table
  2945. @section hdcd
  2946. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2947. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2948. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2949. of HDCD, and detects the Transient Filter flag.
  2950. @example
  2951. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2952. @end example
  2953. When using the filter with wav, note the default encoding for wav is 16-bit,
  2954. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2955. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2956. @example
  2957. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2958. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2959. @end example
  2960. The filter accepts the following options:
  2961. @table @option
  2962. @item disable_autoconvert
  2963. Disable any automatic format conversion or resampling in the filter graph.
  2964. @item process_stereo
  2965. Process the stereo channels together. If target_gain does not match between
  2966. channels, consider it invalid and use the last valid target_gain.
  2967. @item cdt_ms
  2968. Set the code detect timer period in ms.
  2969. @item force_pe
  2970. Always extend peaks above -3dBFS even if PE isn't signaled.
  2971. @item analyze_mode
  2972. Replace audio with a solid tone and adjust the amplitude to signal some
  2973. specific aspect of the decoding process. The output file can be loaded in
  2974. an audio editor alongside the original to aid analysis.
  2975. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2976. Modes are:
  2977. @table @samp
  2978. @item 0, off
  2979. Disabled
  2980. @item 1, lle
  2981. Gain adjustment level at each sample
  2982. @item 2, pe
  2983. Samples where peak extend occurs
  2984. @item 3, cdt
  2985. Samples where the code detect timer is active
  2986. @item 4, tgm
  2987. Samples where the target gain does not match between channels
  2988. @end table
  2989. @end table
  2990. @section headphone
  2991. Apply head-related transfer functions (HRTFs) to create virtual
  2992. loudspeakers around the user for binaural listening via headphones.
  2993. The HRIRs are provided via additional streams, for each channel
  2994. one stereo input stream is needed.
  2995. The filter accepts the following options:
  2996. @table @option
  2997. @item map
  2998. Set mapping of input streams for convolution.
  2999. The argument is a '|'-separated list of channel names in order as they
  3000. are given as additional stream inputs for filter.
  3001. This also specify number of input streams. Number of input streams
  3002. must be not less than number of channels in first stream plus one.
  3003. @item gain
  3004. Set gain applied to audio. Value is in dB. Default is 0.
  3005. @item type
  3006. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3007. processing audio in time domain which is slow.
  3008. @var{freq} is processing audio in frequency domain which is fast.
  3009. Default is @var{freq}.
  3010. @item lfe
  3011. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3012. @item size
  3013. Set size of frame in number of samples which will be processed at once.
  3014. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3015. @item hrir
  3016. Set format of hrir stream.
  3017. Default value is @var{stereo}. Alternative value is @var{multich}.
  3018. If value is set to @var{stereo}, number of additional streams should
  3019. be greater or equal to number of input channels in first input stream.
  3020. Also each additional stream should have stereo number of channels.
  3021. If value is set to @var{multich}, number of additional streams should
  3022. be exactly one. Also number of input channels of additional stream
  3023. should be equal or greater than twice number of channels of first input
  3024. stream.
  3025. @end table
  3026. @subsection Examples
  3027. @itemize
  3028. @item
  3029. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3030. each amovie filter use stereo file with IR coefficients as input.
  3031. The files give coefficients for each position of virtual loudspeaker:
  3032. @example
  3033. ffmpeg -i input.wav
  3034. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  3035. output.wav
  3036. @end example
  3037. @item
  3038. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3039. but now in @var{multich} @var{hrir} format.
  3040. @example
  3041. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  3042. output.wav
  3043. @end example
  3044. @end itemize
  3045. @section highpass
  3046. Apply a high-pass filter with 3dB point frequency.
  3047. The filter can be either single-pole, or double-pole (the default).
  3048. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3049. The filter accepts the following options:
  3050. @table @option
  3051. @item frequency, f
  3052. Set frequency in Hz. Default is 3000.
  3053. @item poles, p
  3054. Set number of poles. Default is 2.
  3055. @item width_type, t
  3056. Set method to specify band-width of filter.
  3057. @table @option
  3058. @item h
  3059. Hz
  3060. @item q
  3061. Q-Factor
  3062. @item o
  3063. octave
  3064. @item s
  3065. slope
  3066. @item k
  3067. kHz
  3068. @end table
  3069. @item width, w
  3070. Specify the band-width of a filter in width_type units.
  3071. Applies only to double-pole filter.
  3072. The default is 0.707q and gives a Butterworth response.
  3073. @item mix, m
  3074. How much to use filtered signal in output. Default is 1.
  3075. Range is between 0 and 1.
  3076. @item channels, c
  3077. Specify which channels to filter, by default all available are filtered.
  3078. @item normalize, n
  3079. Normalize biquad coefficients, by default is disabled.
  3080. Enabling it will normalize magnitude response at DC to 0dB.
  3081. @end table
  3082. @subsection Commands
  3083. This filter supports the following commands:
  3084. @table @option
  3085. @item frequency, f
  3086. Change highpass frequency.
  3087. Syntax for the command is : "@var{frequency}"
  3088. @item width_type, t
  3089. Change highpass width_type.
  3090. Syntax for the command is : "@var{width_type}"
  3091. @item width, w
  3092. Change highpass width.
  3093. Syntax for the command is : "@var{width}"
  3094. @item mix, m
  3095. Change highpass mix.
  3096. Syntax for the command is : "@var{mix}"
  3097. @end table
  3098. @section join
  3099. Join multiple input streams into one multi-channel stream.
  3100. It accepts the following parameters:
  3101. @table @option
  3102. @item inputs
  3103. The number of input streams. It defaults to 2.
  3104. @item channel_layout
  3105. The desired output channel layout. It defaults to stereo.
  3106. @item map
  3107. Map channels from inputs to output. The argument is a '|'-separated list of
  3108. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3109. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3110. can be either the name of the input channel (e.g. FL for front left) or its
  3111. index in the specified input stream. @var{out_channel} is the name of the output
  3112. channel.
  3113. @end table
  3114. The filter will attempt to guess the mappings when they are not specified
  3115. explicitly. It does so by first trying to find an unused matching input channel
  3116. and if that fails it picks the first unused input channel.
  3117. Join 3 inputs (with properly set channel layouts):
  3118. @example
  3119. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3120. @end example
  3121. Build a 5.1 output from 6 single-channel streams:
  3122. @example
  3123. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3124. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  3125. out
  3126. @end example
  3127. @section ladspa
  3128. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3129. To enable compilation of this filter you need to configure FFmpeg with
  3130. @code{--enable-ladspa}.
  3131. @table @option
  3132. @item file, f
  3133. Specifies the name of LADSPA plugin library to load. If the environment
  3134. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3135. each one of the directories specified by the colon separated list in
  3136. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3137. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3138. @file{/usr/lib/ladspa/}.
  3139. @item plugin, p
  3140. Specifies the plugin within the library. Some libraries contain only
  3141. one plugin, but others contain many of them. If this is not set filter
  3142. will list all available plugins within the specified library.
  3143. @item controls, c
  3144. Set the '|' separated list of controls which are zero or more floating point
  3145. values that determine the behavior of the loaded plugin (for example delay,
  3146. threshold or gain).
  3147. Controls need to be defined using the following syntax:
  3148. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3149. @var{valuei} is the value set on the @var{i}-th control.
  3150. Alternatively they can be also defined using the following syntax:
  3151. @var{value0}|@var{value1}|@var{value2}|..., where
  3152. @var{valuei} is the value set on the @var{i}-th control.
  3153. If @option{controls} is set to @code{help}, all available controls and
  3154. their valid ranges are printed.
  3155. @item sample_rate, s
  3156. Specify the sample rate, default to 44100. Only used if plugin have
  3157. zero inputs.
  3158. @item nb_samples, n
  3159. Set the number of samples per channel per each output frame, default
  3160. is 1024. Only used if plugin have zero inputs.
  3161. @item duration, d
  3162. Set the minimum duration of the sourced audio. See
  3163. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3164. for the accepted syntax.
  3165. Note that the resulting duration may be greater than the specified duration,
  3166. as the generated audio is always cut at the end of a complete frame.
  3167. If not specified, or the expressed duration is negative, the audio is
  3168. supposed to be generated forever.
  3169. Only used if plugin have zero inputs.
  3170. @end table
  3171. @subsection Examples
  3172. @itemize
  3173. @item
  3174. List all available plugins within amp (LADSPA example plugin) library:
  3175. @example
  3176. ladspa=file=amp
  3177. @end example
  3178. @item
  3179. List all available controls and their valid ranges for @code{vcf_notch}
  3180. plugin from @code{VCF} library:
  3181. @example
  3182. ladspa=f=vcf:p=vcf_notch:c=help
  3183. @end example
  3184. @item
  3185. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3186. plugin library:
  3187. @example
  3188. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3189. @end example
  3190. @item
  3191. Add reverberation to the audio using TAP-plugins
  3192. (Tom's Audio Processing plugins):
  3193. @example
  3194. ladspa=file=tap_reverb:tap_reverb
  3195. @end example
  3196. @item
  3197. Generate white noise, with 0.2 amplitude:
  3198. @example
  3199. ladspa=file=cmt:noise_source_white:c=c0=.2
  3200. @end example
  3201. @item
  3202. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3203. @code{C* Audio Plugin Suite} (CAPS) library:
  3204. @example
  3205. ladspa=file=caps:Click:c=c1=20'
  3206. @end example
  3207. @item
  3208. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3209. @example
  3210. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3211. @end example
  3212. @item
  3213. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3214. @code{SWH Plugins} collection:
  3215. @example
  3216. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3217. @end example
  3218. @item
  3219. Attenuate low frequencies using Multiband EQ from Steve Harris
  3220. @code{SWH Plugins} collection:
  3221. @example
  3222. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3223. @end example
  3224. @item
  3225. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3226. (CAPS) library:
  3227. @example
  3228. ladspa=caps:Narrower
  3229. @end example
  3230. @item
  3231. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3232. @example
  3233. ladspa=caps:White:.2
  3234. @end example
  3235. @item
  3236. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3237. @example
  3238. ladspa=caps:Fractal:c=c1=1
  3239. @end example
  3240. @item
  3241. Dynamic volume normalization using @code{VLevel} plugin:
  3242. @example
  3243. ladspa=vlevel-ladspa:vlevel_mono
  3244. @end example
  3245. @end itemize
  3246. @subsection Commands
  3247. This filter supports the following commands:
  3248. @table @option
  3249. @item cN
  3250. Modify the @var{N}-th control value.
  3251. If the specified value is not valid, it is ignored and prior one is kept.
  3252. @end table
  3253. @section loudnorm
  3254. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3255. Support for both single pass (livestreams, files) and double pass (files) modes.
  3256. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3257. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3258. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3259. The filter accepts the following options:
  3260. @table @option
  3261. @item I, i
  3262. Set integrated loudness target.
  3263. Range is -70.0 - -5.0. Default value is -24.0.
  3264. @item LRA, lra
  3265. Set loudness range target.
  3266. Range is 1.0 - 20.0. Default value is 7.0.
  3267. @item TP, tp
  3268. Set maximum true peak.
  3269. Range is -9.0 - +0.0. Default value is -2.0.
  3270. @item measured_I, measured_i
  3271. Measured IL of input file.
  3272. Range is -99.0 - +0.0.
  3273. @item measured_LRA, measured_lra
  3274. Measured LRA of input file.
  3275. Range is 0.0 - 99.0.
  3276. @item measured_TP, measured_tp
  3277. Measured true peak of input file.
  3278. Range is -99.0 - +99.0.
  3279. @item measured_thresh
  3280. Measured threshold of input file.
  3281. Range is -99.0 - +0.0.
  3282. @item offset
  3283. Set offset gain. Gain is applied before the true-peak limiter.
  3284. Range is -99.0 - +99.0. Default is +0.0.
  3285. @item linear
  3286. Normalize linearly if possible.
  3287. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3288. to be specified in order to use this mode.
  3289. Options are true or false. Default is true.
  3290. @item dual_mono
  3291. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3292. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3293. If set to @code{true}, this option will compensate for this effect.
  3294. Multi-channel input files are not affected by this option.
  3295. Options are true or false. Default is false.
  3296. @item print_format
  3297. Set print format for stats. Options are summary, json, or none.
  3298. Default value is none.
  3299. @end table
  3300. @section lowpass
  3301. Apply a low-pass filter with 3dB point frequency.
  3302. The filter can be either single-pole or double-pole (the default).
  3303. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3304. The filter accepts the following options:
  3305. @table @option
  3306. @item frequency, f
  3307. Set frequency in Hz. Default is 500.
  3308. @item poles, p
  3309. Set number of poles. Default is 2.
  3310. @item width_type, t
  3311. Set method to specify band-width of filter.
  3312. @table @option
  3313. @item h
  3314. Hz
  3315. @item q
  3316. Q-Factor
  3317. @item o
  3318. octave
  3319. @item s
  3320. slope
  3321. @item k
  3322. kHz
  3323. @end table
  3324. @item width, w
  3325. Specify the band-width of a filter in width_type units.
  3326. Applies only to double-pole filter.
  3327. The default is 0.707q and gives a Butterworth response.
  3328. @item mix, m
  3329. How much to use filtered signal in output. Default is 1.
  3330. Range is between 0 and 1.
  3331. @item channels, c
  3332. Specify which channels to filter, by default all available are filtered.
  3333. @item normalize, n
  3334. Normalize biquad coefficients, by default is disabled.
  3335. Enabling it will normalize magnitude response at DC to 0dB.
  3336. @end table
  3337. @subsection Examples
  3338. @itemize
  3339. @item
  3340. Lowpass only LFE channel, it LFE is not present it does nothing:
  3341. @example
  3342. lowpass=c=LFE
  3343. @end example
  3344. @end itemize
  3345. @subsection Commands
  3346. This filter supports the following commands:
  3347. @table @option
  3348. @item frequency, f
  3349. Change lowpass frequency.
  3350. Syntax for the command is : "@var{frequency}"
  3351. @item width_type, t
  3352. Change lowpass width_type.
  3353. Syntax for the command is : "@var{width_type}"
  3354. @item width, w
  3355. Change lowpass width.
  3356. Syntax for the command is : "@var{width}"
  3357. @item mix, m
  3358. Change lowpass mix.
  3359. Syntax for the command is : "@var{mix}"
  3360. @end table
  3361. @section lv2
  3362. Load a LV2 (LADSPA Version 2) plugin.
  3363. To enable compilation of this filter you need to configure FFmpeg with
  3364. @code{--enable-lv2}.
  3365. @table @option
  3366. @item plugin, p
  3367. Specifies the plugin URI. You may need to escape ':'.
  3368. @item controls, c
  3369. Set the '|' separated list of controls which are zero or more floating point
  3370. values that determine the behavior of the loaded plugin (for example delay,
  3371. threshold or gain).
  3372. If @option{controls} is set to @code{help}, all available controls and
  3373. their valid ranges are printed.
  3374. @item sample_rate, s
  3375. Specify the sample rate, default to 44100. Only used if plugin have
  3376. zero inputs.
  3377. @item nb_samples, n
  3378. Set the number of samples per channel per each output frame, default
  3379. is 1024. Only used if plugin have zero inputs.
  3380. @item duration, d
  3381. Set the minimum duration of the sourced audio. See
  3382. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3383. for the accepted syntax.
  3384. Note that the resulting duration may be greater than the specified duration,
  3385. as the generated audio is always cut at the end of a complete frame.
  3386. If not specified, or the expressed duration is negative, the audio is
  3387. supposed to be generated forever.
  3388. Only used if plugin have zero inputs.
  3389. @end table
  3390. @subsection Examples
  3391. @itemize
  3392. @item
  3393. Apply bass enhancer plugin from Calf:
  3394. @example
  3395. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3396. @end example
  3397. @item
  3398. Apply vinyl plugin from Calf:
  3399. @example
  3400. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3401. @end example
  3402. @item
  3403. Apply bit crusher plugin from ArtyFX:
  3404. @example
  3405. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3406. @end example
  3407. @end itemize
  3408. @section mcompand
  3409. Multiband Compress or expand the audio's dynamic range.
  3410. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3411. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3412. response when absent compander action.
  3413. It accepts the following parameters:
  3414. @table @option
  3415. @item args
  3416. This option syntax is:
  3417. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3418. For explanation of each item refer to compand filter documentation.
  3419. @end table
  3420. @anchor{pan}
  3421. @section pan
  3422. Mix channels with specific gain levels. The filter accepts the output
  3423. channel layout followed by a set of channels definitions.
  3424. This filter is also designed to efficiently remap the channels of an audio
  3425. stream.
  3426. The filter accepts parameters of the form:
  3427. "@var{l}|@var{outdef}|@var{outdef}|..."
  3428. @table @option
  3429. @item l
  3430. output channel layout or number of channels
  3431. @item outdef
  3432. output channel specification, of the form:
  3433. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3434. @item out_name
  3435. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3436. number (c0, c1, etc.)
  3437. @item gain
  3438. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3439. @item in_name
  3440. input channel to use, see out_name for details; it is not possible to mix
  3441. named and numbered input channels
  3442. @end table
  3443. If the `=' in a channel specification is replaced by `<', then the gains for
  3444. that specification will be renormalized so that the total is 1, thus
  3445. avoiding clipping noise.
  3446. @subsection Mixing examples
  3447. For example, if you want to down-mix from stereo to mono, but with a bigger
  3448. factor for the left channel:
  3449. @example
  3450. pan=1c|c0=0.9*c0+0.1*c1
  3451. @end example
  3452. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3453. 7-channels surround:
  3454. @example
  3455. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3456. @end example
  3457. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3458. that should be preferred (see "-ac" option) unless you have very specific
  3459. needs.
  3460. @subsection Remapping examples
  3461. The channel remapping will be effective if, and only if:
  3462. @itemize
  3463. @item gain coefficients are zeroes or ones,
  3464. @item only one input per channel output,
  3465. @end itemize
  3466. If all these conditions are satisfied, the filter will notify the user ("Pure
  3467. channel mapping detected"), and use an optimized and lossless method to do the
  3468. remapping.
  3469. For example, if you have a 5.1 source and want a stereo audio stream by
  3470. dropping the extra channels:
  3471. @example
  3472. pan="stereo| c0=FL | c1=FR"
  3473. @end example
  3474. Given the same source, you can also switch front left and front right channels
  3475. and keep the input channel layout:
  3476. @example
  3477. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3478. @end example
  3479. If the input is a stereo audio stream, you can mute the front left channel (and
  3480. still keep the stereo channel layout) with:
  3481. @example
  3482. pan="stereo|c1=c1"
  3483. @end example
  3484. Still with a stereo audio stream input, you can copy the right channel in both
  3485. front left and right:
  3486. @example
  3487. pan="stereo| c0=FR | c1=FR"
  3488. @end example
  3489. @section replaygain
  3490. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3491. outputs it unchanged.
  3492. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3493. @section resample
  3494. Convert the audio sample format, sample rate and channel layout. It is
  3495. not meant to be used directly.
  3496. @section rubberband
  3497. Apply time-stretching and pitch-shifting with librubberband.
  3498. To enable compilation of this filter, you need to configure FFmpeg with
  3499. @code{--enable-librubberband}.
  3500. The filter accepts the following options:
  3501. @table @option
  3502. @item tempo
  3503. Set tempo scale factor.
  3504. @item pitch
  3505. Set pitch scale factor.
  3506. @item transients
  3507. Set transients detector.
  3508. Possible values are:
  3509. @table @var
  3510. @item crisp
  3511. @item mixed
  3512. @item smooth
  3513. @end table
  3514. @item detector
  3515. Set detector.
  3516. Possible values are:
  3517. @table @var
  3518. @item compound
  3519. @item percussive
  3520. @item soft
  3521. @end table
  3522. @item phase
  3523. Set phase.
  3524. Possible values are:
  3525. @table @var
  3526. @item laminar
  3527. @item independent
  3528. @end table
  3529. @item window
  3530. Set processing window size.
  3531. Possible values are:
  3532. @table @var
  3533. @item standard
  3534. @item short
  3535. @item long
  3536. @end table
  3537. @item smoothing
  3538. Set smoothing.
  3539. Possible values are:
  3540. @table @var
  3541. @item off
  3542. @item on
  3543. @end table
  3544. @item formant
  3545. Enable formant preservation when shift pitching.
  3546. Possible values are:
  3547. @table @var
  3548. @item shifted
  3549. @item preserved
  3550. @end table
  3551. @item pitchq
  3552. Set pitch quality.
  3553. Possible values are:
  3554. @table @var
  3555. @item quality
  3556. @item speed
  3557. @item consistency
  3558. @end table
  3559. @item channels
  3560. Set channels.
  3561. Possible values are:
  3562. @table @var
  3563. @item apart
  3564. @item together
  3565. @end table
  3566. @end table
  3567. @subsection Commands
  3568. This filter supports the following commands:
  3569. @table @option
  3570. @item tempo
  3571. Change filter tempo scale factor.
  3572. Syntax for the command is : "@var{tempo}"
  3573. @item pitch
  3574. Change filter pitch scale factor.
  3575. Syntax for the command is : "@var{pitch}"
  3576. @end table
  3577. @section sidechaincompress
  3578. This filter acts like normal compressor but has the ability to compress
  3579. detected signal using second input signal.
  3580. It needs two input streams and returns one output stream.
  3581. First input stream will be processed depending on second stream signal.
  3582. The filtered signal then can be filtered with other filters in later stages of
  3583. processing. See @ref{pan} and @ref{amerge} filter.
  3584. The filter accepts the following options:
  3585. @table @option
  3586. @item level_in
  3587. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3588. @item mode
  3589. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3590. Default is @code{downward}.
  3591. @item threshold
  3592. If a signal of second stream raises above this level it will affect the gain
  3593. reduction of first stream.
  3594. By default is 0.125. Range is between 0.00097563 and 1.
  3595. @item ratio
  3596. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3597. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3598. Default is 2. Range is between 1 and 20.
  3599. @item attack
  3600. Amount of milliseconds the signal has to rise above the threshold before gain
  3601. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3602. @item release
  3603. Amount of milliseconds the signal has to fall below the threshold before
  3604. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3605. @item makeup
  3606. Set the amount by how much signal will be amplified after processing.
  3607. Default is 1. Range is from 1 to 64.
  3608. @item knee
  3609. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3610. Default is 2.82843. Range is between 1 and 8.
  3611. @item link
  3612. Choose if the @code{average} level between all channels of side-chain stream
  3613. or the louder(@code{maximum}) channel of side-chain stream affects the
  3614. reduction. Default is @code{average}.
  3615. @item detection
  3616. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3617. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3618. @item level_sc
  3619. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3620. @item mix
  3621. How much to use compressed signal in output. Default is 1.
  3622. Range is between 0 and 1.
  3623. @end table
  3624. @subsection Examples
  3625. @itemize
  3626. @item
  3627. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3628. depending on the signal of 2nd input and later compressed signal to be
  3629. merged with 2nd input:
  3630. @example
  3631. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3632. @end example
  3633. @end itemize
  3634. @section sidechaingate
  3635. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3636. filter the detected signal before sending it to the gain reduction stage.
  3637. Normally a gate uses the full range signal to detect a level above the
  3638. threshold.
  3639. For example: If you cut all lower frequencies from your sidechain signal
  3640. the gate will decrease the volume of your track only if not enough highs
  3641. appear. With this technique you are able to reduce the resonation of a
  3642. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3643. guitar.
  3644. It needs two input streams and returns one output stream.
  3645. First input stream will be processed depending on second stream signal.
  3646. The filter accepts the following options:
  3647. @table @option
  3648. @item level_in
  3649. Set input level before filtering.
  3650. Default is 1. Allowed range is from 0.015625 to 64.
  3651. @item mode
  3652. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3653. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3654. will be amplified, expanding dynamic range in upward direction.
  3655. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3656. @item range
  3657. Set the level of gain reduction when the signal is below the threshold.
  3658. Default is 0.06125. Allowed range is from 0 to 1.
  3659. Setting this to 0 disables reduction and then filter behaves like expander.
  3660. @item threshold
  3661. If a signal rises above this level the gain reduction is released.
  3662. Default is 0.125. Allowed range is from 0 to 1.
  3663. @item ratio
  3664. Set a ratio about which the signal is reduced.
  3665. Default is 2. Allowed range is from 1 to 9000.
  3666. @item attack
  3667. Amount of milliseconds the signal has to rise above the threshold before gain
  3668. reduction stops.
  3669. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3670. @item release
  3671. Amount of milliseconds the signal has to fall below the threshold before the
  3672. reduction is increased again. Default is 250 milliseconds.
  3673. Allowed range is from 0.01 to 9000.
  3674. @item makeup
  3675. Set amount of amplification of signal after processing.
  3676. Default is 1. Allowed range is from 1 to 64.
  3677. @item knee
  3678. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3679. Default is 2.828427125. Allowed range is from 1 to 8.
  3680. @item detection
  3681. Choose if exact signal should be taken for detection or an RMS like one.
  3682. Default is rms. Can be peak or rms.
  3683. @item link
  3684. Choose if the average level between all channels or the louder channel affects
  3685. the reduction.
  3686. Default is average. Can be average or maximum.
  3687. @item level_sc
  3688. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3689. @end table
  3690. @section silencedetect
  3691. Detect silence in an audio stream.
  3692. This filter logs a message when it detects that the input audio volume is less
  3693. or equal to a noise tolerance value for a duration greater or equal to the
  3694. minimum detected noise duration.
  3695. The printed times and duration are expressed in seconds. The
  3696. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3697. is set on the first frame whose timestamp equals or exceeds the detection
  3698. duration and it contains the timestamp of the first frame of the silence.
  3699. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3700. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3701. keys are set on the first frame after the silence. If @option{mono} is
  3702. enabled, and each channel is evaluated separately, the @code{.X}
  3703. suffixed keys are used, and @code{X} corresponds to the channel number.
  3704. The filter accepts the following options:
  3705. @table @option
  3706. @item noise, n
  3707. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3708. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3709. @item duration, d
  3710. Set silence duration until notification (default is 2 seconds). See
  3711. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3712. for the accepted syntax.
  3713. @item mono, m
  3714. Process each channel separately, instead of combined. By default is disabled.
  3715. @end table
  3716. @subsection Examples
  3717. @itemize
  3718. @item
  3719. Detect 5 seconds of silence with -50dB noise tolerance:
  3720. @example
  3721. silencedetect=n=-50dB:d=5
  3722. @end example
  3723. @item
  3724. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3725. tolerance in @file{silence.mp3}:
  3726. @example
  3727. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3728. @end example
  3729. @end itemize
  3730. @section silenceremove
  3731. Remove silence from the beginning, middle or end of the audio.
  3732. The filter accepts the following options:
  3733. @table @option
  3734. @item start_periods
  3735. This value is used to indicate if audio should be trimmed at beginning of
  3736. the audio. A value of zero indicates no silence should be trimmed from the
  3737. beginning. When specifying a non-zero value, it trims audio up until it
  3738. finds non-silence. Normally, when trimming silence from beginning of audio
  3739. the @var{start_periods} will be @code{1} but it can be increased to higher
  3740. values to trim all audio up to specific count of non-silence periods.
  3741. Default value is @code{0}.
  3742. @item start_duration
  3743. Specify the amount of time that non-silence must be detected before it stops
  3744. trimming audio. By increasing the duration, bursts of noises can be treated
  3745. as silence and trimmed off. Default value is @code{0}.
  3746. @item start_threshold
  3747. This indicates what sample value should be treated as silence. For digital
  3748. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3749. you may wish to increase the value to account for background noise.
  3750. Can be specified in dB (in case "dB" is appended to the specified value)
  3751. or amplitude ratio. Default value is @code{0}.
  3752. @item start_silence
  3753. Specify max duration of silence at beginning that will be kept after
  3754. trimming. Default is 0, which is equal to trimming all samples detected
  3755. as silence.
  3756. @item start_mode
  3757. Specify mode of detection of silence end in start of multi-channel audio.
  3758. Can be @var{any} or @var{all}. Default is @var{any}.
  3759. With @var{any}, any sample that is detected as non-silence will cause
  3760. stopped trimming of silence.
  3761. With @var{all}, only if all channels are detected as non-silence will cause
  3762. stopped trimming of silence.
  3763. @item stop_periods
  3764. Set the count for trimming silence from the end of audio.
  3765. To remove silence from the middle of a file, specify a @var{stop_periods}
  3766. that is negative. This value is then treated as a positive value and is
  3767. used to indicate the effect should restart processing as specified by
  3768. @var{start_periods}, making it suitable for removing periods of silence
  3769. in the middle of the audio.
  3770. Default value is @code{0}.
  3771. @item stop_duration
  3772. Specify a duration of silence that must exist before audio is not copied any
  3773. more. By specifying a higher duration, silence that is wanted can be left in
  3774. the audio.
  3775. Default value is @code{0}.
  3776. @item stop_threshold
  3777. This is the same as @option{start_threshold} but for trimming silence from
  3778. the end of audio.
  3779. Can be specified in dB (in case "dB" is appended to the specified value)
  3780. or amplitude ratio. Default value is @code{0}.
  3781. @item stop_silence
  3782. Specify max duration of silence at end that will be kept after
  3783. trimming. Default is 0, which is equal to trimming all samples detected
  3784. as silence.
  3785. @item stop_mode
  3786. Specify mode of detection of silence start in end of multi-channel audio.
  3787. Can be @var{any} or @var{all}. Default is @var{any}.
  3788. With @var{any}, any sample that is detected as non-silence will cause
  3789. stopped trimming of silence.
  3790. With @var{all}, only if all channels are detected as non-silence will cause
  3791. stopped trimming of silence.
  3792. @item detection
  3793. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3794. and works better with digital silence which is exactly 0.
  3795. Default value is @code{rms}.
  3796. @item window
  3797. Set duration in number of seconds used to calculate size of window in number
  3798. of samples for detecting silence.
  3799. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3800. @end table
  3801. @subsection Examples
  3802. @itemize
  3803. @item
  3804. The following example shows how this filter can be used to start a recording
  3805. that does not contain the delay at the start which usually occurs between
  3806. pressing the record button and the start of the performance:
  3807. @example
  3808. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3809. @end example
  3810. @item
  3811. Trim all silence encountered from beginning to end where there is more than 1
  3812. second of silence in audio:
  3813. @example
  3814. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3815. @end example
  3816. @item
  3817. Trim all digital silence samples, using peak detection, from beginning to end
  3818. where there is more than 0 samples of digital silence in audio and digital
  3819. silence is detected in all channels at same positions in stream:
  3820. @example
  3821. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3822. @end example
  3823. @end itemize
  3824. @section sofalizer
  3825. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3826. loudspeakers around the user for binaural listening via headphones (audio
  3827. formats up to 9 channels supported).
  3828. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3829. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3830. Austrian Academy of Sciences.
  3831. To enable compilation of this filter you need to configure FFmpeg with
  3832. @code{--enable-libmysofa}.
  3833. The filter accepts the following options:
  3834. @table @option
  3835. @item sofa
  3836. Set the SOFA file used for rendering.
  3837. @item gain
  3838. Set gain applied to audio. Value is in dB. Default is 0.
  3839. @item rotation
  3840. Set rotation of virtual loudspeakers in deg. Default is 0.
  3841. @item elevation
  3842. Set elevation of virtual speakers in deg. Default is 0.
  3843. @item radius
  3844. Set distance in meters between loudspeakers and the listener with near-field
  3845. HRTFs. Default is 1.
  3846. @item type
  3847. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3848. processing audio in time domain which is slow.
  3849. @var{freq} is processing audio in frequency domain which is fast.
  3850. Default is @var{freq}.
  3851. @item speakers
  3852. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3853. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3854. Each virtual loudspeaker is described with short channel name following with
  3855. azimuth and elevation in degrees.
  3856. Each virtual loudspeaker description is separated by '|'.
  3857. For example to override front left and front right channel positions use:
  3858. 'speakers=FL 45 15|FR 345 15'.
  3859. Descriptions with unrecognised channel names are ignored.
  3860. @item lfegain
  3861. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3862. @item framesize
  3863. Set custom frame size in number of samples. Default is 1024.
  3864. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3865. is set to @var{freq}.
  3866. @item normalize
  3867. Should all IRs be normalized upon importing SOFA file.
  3868. By default is enabled.
  3869. @item interpolate
  3870. Should nearest IRs be interpolated with neighbor IRs if exact position
  3871. does not match. By default is disabled.
  3872. @item minphase
  3873. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3874. @item anglestep
  3875. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3876. @item radstep
  3877. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3878. @end table
  3879. @subsection Examples
  3880. @itemize
  3881. @item
  3882. Using ClubFritz6 sofa file:
  3883. @example
  3884. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3885. @end example
  3886. @item
  3887. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3888. @example
  3889. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3890. @end example
  3891. @item
  3892. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3893. and also with custom gain:
  3894. @example
  3895. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3896. @end example
  3897. @end itemize
  3898. @section stereotools
  3899. This filter has some handy utilities to manage stereo signals, for converting
  3900. M/S stereo recordings to L/R signal while having control over the parameters
  3901. or spreading the stereo image of master track.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item level_in
  3905. Set input level before filtering for both channels. Defaults is 1.
  3906. Allowed range is from 0.015625 to 64.
  3907. @item level_out
  3908. Set output level after filtering for both channels. Defaults is 1.
  3909. Allowed range is from 0.015625 to 64.
  3910. @item balance_in
  3911. Set input balance between both channels. Default is 0.
  3912. Allowed range is from -1 to 1.
  3913. @item balance_out
  3914. Set output balance between both channels. Default is 0.
  3915. Allowed range is from -1 to 1.
  3916. @item softclip
  3917. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3918. clipping. Disabled by default.
  3919. @item mutel
  3920. Mute the left channel. Disabled by default.
  3921. @item muter
  3922. Mute the right channel. Disabled by default.
  3923. @item phasel
  3924. Change the phase of the left channel. Disabled by default.
  3925. @item phaser
  3926. Change the phase of the right channel. Disabled by default.
  3927. @item mode
  3928. Set stereo mode. Available values are:
  3929. @table @samp
  3930. @item lr>lr
  3931. Left/Right to Left/Right, this is default.
  3932. @item lr>ms
  3933. Left/Right to Mid/Side.
  3934. @item ms>lr
  3935. Mid/Side to Left/Right.
  3936. @item lr>ll
  3937. Left/Right to Left/Left.
  3938. @item lr>rr
  3939. Left/Right to Right/Right.
  3940. @item lr>l+r
  3941. Left/Right to Left + Right.
  3942. @item lr>rl
  3943. Left/Right to Right/Left.
  3944. @item ms>ll
  3945. Mid/Side to Left/Left.
  3946. @item ms>rr
  3947. Mid/Side to Right/Right.
  3948. @end table
  3949. @item slev
  3950. Set level of side signal. Default is 1.
  3951. Allowed range is from 0.015625 to 64.
  3952. @item sbal
  3953. Set balance of side signal. Default is 0.
  3954. Allowed range is from -1 to 1.
  3955. @item mlev
  3956. Set level of the middle signal. Default is 1.
  3957. Allowed range is from 0.015625 to 64.
  3958. @item mpan
  3959. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3960. @item base
  3961. Set stereo base between mono and inversed channels. Default is 0.
  3962. Allowed range is from -1 to 1.
  3963. @item delay
  3964. Set delay in milliseconds how much to delay left from right channel and
  3965. vice versa. Default is 0. Allowed range is from -20 to 20.
  3966. @item sclevel
  3967. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3968. @item phase
  3969. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3970. @item bmode_in, bmode_out
  3971. Set balance mode for balance_in/balance_out option.
  3972. Can be one of the following:
  3973. @table @samp
  3974. @item balance
  3975. Classic balance mode. Attenuate one channel at time.
  3976. Gain is raised up to 1.
  3977. @item amplitude
  3978. Similar as classic mode above but gain is raised up to 2.
  3979. @item power
  3980. Equal power distribution, from -6dB to +6dB range.
  3981. @end table
  3982. @end table
  3983. @subsection Examples
  3984. @itemize
  3985. @item
  3986. Apply karaoke like effect:
  3987. @example
  3988. stereotools=mlev=0.015625
  3989. @end example
  3990. @item
  3991. Convert M/S signal to L/R:
  3992. @example
  3993. "stereotools=mode=ms>lr"
  3994. @end example
  3995. @end itemize
  3996. @section stereowiden
  3997. This filter enhance the stereo effect by suppressing signal common to both
  3998. channels and by delaying the signal of left into right and vice versa,
  3999. thereby widening the stereo effect.
  4000. The filter accepts the following options:
  4001. @table @option
  4002. @item delay
  4003. Time in milliseconds of the delay of left signal into right and vice versa.
  4004. Default is 20 milliseconds.
  4005. @item feedback
  4006. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4007. effect of left signal in right output and vice versa which gives widening
  4008. effect. Default is 0.3.
  4009. @item crossfeed
  4010. Cross feed of left into right with inverted phase. This helps in suppressing
  4011. the mono. If the value is 1 it will cancel all the signal common to both
  4012. channels. Default is 0.3.
  4013. @item drymix
  4014. Set level of input signal of original channel. Default is 0.8.
  4015. @end table
  4016. @section superequalizer
  4017. Apply 18 band equalizer.
  4018. The filter accepts the following options:
  4019. @table @option
  4020. @item 1b
  4021. Set 65Hz band gain.
  4022. @item 2b
  4023. Set 92Hz band gain.
  4024. @item 3b
  4025. Set 131Hz band gain.
  4026. @item 4b
  4027. Set 185Hz band gain.
  4028. @item 5b
  4029. Set 262Hz band gain.
  4030. @item 6b
  4031. Set 370Hz band gain.
  4032. @item 7b
  4033. Set 523Hz band gain.
  4034. @item 8b
  4035. Set 740Hz band gain.
  4036. @item 9b
  4037. Set 1047Hz band gain.
  4038. @item 10b
  4039. Set 1480Hz band gain.
  4040. @item 11b
  4041. Set 2093Hz band gain.
  4042. @item 12b
  4043. Set 2960Hz band gain.
  4044. @item 13b
  4045. Set 4186Hz band gain.
  4046. @item 14b
  4047. Set 5920Hz band gain.
  4048. @item 15b
  4049. Set 8372Hz band gain.
  4050. @item 16b
  4051. Set 11840Hz band gain.
  4052. @item 17b
  4053. Set 16744Hz band gain.
  4054. @item 18b
  4055. Set 20000Hz band gain.
  4056. @end table
  4057. @section surround
  4058. Apply audio surround upmix filter.
  4059. This filter allows to produce multichannel output from audio stream.
  4060. The filter accepts the following options:
  4061. @table @option
  4062. @item chl_out
  4063. Set output channel layout. By default, this is @var{5.1}.
  4064. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4065. for the required syntax.
  4066. @item chl_in
  4067. Set input channel layout. By default, this is @var{stereo}.
  4068. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4069. for the required syntax.
  4070. @item level_in
  4071. Set input volume level. By default, this is @var{1}.
  4072. @item level_out
  4073. Set output volume level. By default, this is @var{1}.
  4074. @item lfe
  4075. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4076. @item lfe_low
  4077. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4078. @item lfe_high
  4079. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4080. @item lfe_mode
  4081. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4082. In @var{add} mode, LFE channel is created from input audio and added to output.
  4083. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4084. also all non-LFE output channels are subtracted with output LFE channel.
  4085. @item angle
  4086. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4087. Default is @var{90}.
  4088. @item fc_in
  4089. Set front center input volume. By default, this is @var{1}.
  4090. @item fc_out
  4091. Set front center output volume. By default, this is @var{1}.
  4092. @item fl_in
  4093. Set front left input volume. By default, this is @var{1}.
  4094. @item fl_out
  4095. Set front left output volume. By default, this is @var{1}.
  4096. @item fr_in
  4097. Set front right input volume. By default, this is @var{1}.
  4098. @item fr_out
  4099. Set front right output volume. By default, this is @var{1}.
  4100. @item sl_in
  4101. Set side left input volume. By default, this is @var{1}.
  4102. @item sl_out
  4103. Set side left output volume. By default, this is @var{1}.
  4104. @item sr_in
  4105. Set side right input volume. By default, this is @var{1}.
  4106. @item sr_out
  4107. Set side right output volume. By default, this is @var{1}.
  4108. @item bl_in
  4109. Set back left input volume. By default, this is @var{1}.
  4110. @item bl_out
  4111. Set back left output volume. By default, this is @var{1}.
  4112. @item br_in
  4113. Set back right input volume. By default, this is @var{1}.
  4114. @item br_out
  4115. Set back right output volume. By default, this is @var{1}.
  4116. @item bc_in
  4117. Set back center input volume. By default, this is @var{1}.
  4118. @item bc_out
  4119. Set back center output volume. By default, this is @var{1}.
  4120. @item lfe_in
  4121. Set LFE input volume. By default, this is @var{1}.
  4122. @item lfe_out
  4123. Set LFE output volume. By default, this is @var{1}.
  4124. @item allx
  4125. Set spread usage of stereo image across X axis for all channels.
  4126. @item ally
  4127. Set spread usage of stereo image across Y axis for all channels.
  4128. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4129. Set spread usage of stereo image across X axis for each channel.
  4130. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4131. Set spread usage of stereo image across Y axis for each channel.
  4132. @item win_size
  4133. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4134. @item win_func
  4135. Set window function.
  4136. It accepts the following values:
  4137. @table @samp
  4138. @item rect
  4139. @item bartlett
  4140. @item hann, hanning
  4141. @item hamming
  4142. @item blackman
  4143. @item welch
  4144. @item flattop
  4145. @item bharris
  4146. @item bnuttall
  4147. @item bhann
  4148. @item sine
  4149. @item nuttall
  4150. @item lanczos
  4151. @item gauss
  4152. @item tukey
  4153. @item dolph
  4154. @item cauchy
  4155. @item parzen
  4156. @item poisson
  4157. @item bohman
  4158. @end table
  4159. Default is @code{hann}.
  4160. @item overlap
  4161. Set window overlap. If set to 1, the recommended overlap for selected
  4162. window function will be picked. Default is @code{0.5}.
  4163. @end table
  4164. @section treble, highshelf
  4165. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4166. shelving filter with a response similar to that of a standard
  4167. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4168. The filter accepts the following options:
  4169. @table @option
  4170. @item gain, g
  4171. Give the gain at whichever is the lower of ~22 kHz and the
  4172. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4173. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4174. @item frequency, f
  4175. Set the filter's central frequency and so can be used
  4176. to extend or reduce the frequency range to be boosted or cut.
  4177. The default value is @code{3000} Hz.
  4178. @item width_type, t
  4179. Set method to specify band-width of filter.
  4180. @table @option
  4181. @item h
  4182. Hz
  4183. @item q
  4184. Q-Factor
  4185. @item o
  4186. octave
  4187. @item s
  4188. slope
  4189. @item k
  4190. kHz
  4191. @end table
  4192. @item width, w
  4193. Determine how steep is the filter's shelf transition.
  4194. @item mix, m
  4195. How much to use filtered signal in output. Default is 1.
  4196. Range is between 0 and 1.
  4197. @item channels, c
  4198. Specify which channels to filter, by default all available are filtered.
  4199. @item normalize, n
  4200. Normalize biquad coefficients, by default is disabled.
  4201. Enabling it will normalize magnitude response at DC to 0dB.
  4202. @end table
  4203. @subsection Commands
  4204. This filter supports the following commands:
  4205. @table @option
  4206. @item frequency, f
  4207. Change treble frequency.
  4208. Syntax for the command is : "@var{frequency}"
  4209. @item width_type, t
  4210. Change treble width_type.
  4211. Syntax for the command is : "@var{width_type}"
  4212. @item width, w
  4213. Change treble width.
  4214. Syntax for the command is : "@var{width}"
  4215. @item gain, g
  4216. Change treble gain.
  4217. Syntax for the command is : "@var{gain}"
  4218. @item mix, m
  4219. Change treble mix.
  4220. Syntax for the command is : "@var{mix}"
  4221. @end table
  4222. @section tremolo
  4223. Sinusoidal amplitude modulation.
  4224. The filter accepts the following options:
  4225. @table @option
  4226. @item f
  4227. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4228. (20 Hz or lower) will result in a tremolo effect.
  4229. This filter may also be used as a ring modulator by specifying
  4230. a modulation frequency higher than 20 Hz.
  4231. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4232. @item d
  4233. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4234. Default value is 0.5.
  4235. @end table
  4236. @section vibrato
  4237. Sinusoidal phase modulation.
  4238. The filter accepts the following options:
  4239. @table @option
  4240. @item f
  4241. Modulation frequency in Hertz.
  4242. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4243. @item d
  4244. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4245. Default value is 0.5.
  4246. @end table
  4247. @section volume
  4248. Adjust the input audio volume.
  4249. It accepts the following parameters:
  4250. @table @option
  4251. @item volume
  4252. Set audio volume expression.
  4253. Output values are clipped to the maximum value.
  4254. The output audio volume is given by the relation:
  4255. @example
  4256. @var{output_volume} = @var{volume} * @var{input_volume}
  4257. @end example
  4258. The default value for @var{volume} is "1.0".
  4259. @item precision
  4260. This parameter represents the mathematical precision.
  4261. It determines which input sample formats will be allowed, which affects the
  4262. precision of the volume scaling.
  4263. @table @option
  4264. @item fixed
  4265. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4266. @item float
  4267. 32-bit floating-point; this limits input sample format to FLT. (default)
  4268. @item double
  4269. 64-bit floating-point; this limits input sample format to DBL.
  4270. @end table
  4271. @item replaygain
  4272. Choose the behaviour on encountering ReplayGain side data in input frames.
  4273. @table @option
  4274. @item drop
  4275. Remove ReplayGain side data, ignoring its contents (the default).
  4276. @item ignore
  4277. Ignore ReplayGain side data, but leave it in the frame.
  4278. @item track
  4279. Prefer the track gain, if present.
  4280. @item album
  4281. Prefer the album gain, if present.
  4282. @end table
  4283. @item replaygain_preamp
  4284. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4285. Default value for @var{replaygain_preamp} is 0.0.
  4286. @item eval
  4287. Set when the volume expression is evaluated.
  4288. It accepts the following values:
  4289. @table @samp
  4290. @item once
  4291. only evaluate expression once during the filter initialization, or
  4292. when the @samp{volume} command is sent
  4293. @item frame
  4294. evaluate expression for each incoming frame
  4295. @end table
  4296. Default value is @samp{once}.
  4297. @end table
  4298. The volume expression can contain the following parameters.
  4299. @table @option
  4300. @item n
  4301. frame number (starting at zero)
  4302. @item nb_channels
  4303. number of channels
  4304. @item nb_consumed_samples
  4305. number of samples consumed by the filter
  4306. @item nb_samples
  4307. number of samples in the current frame
  4308. @item pos
  4309. original frame position in the file
  4310. @item pts
  4311. frame PTS
  4312. @item sample_rate
  4313. sample rate
  4314. @item startpts
  4315. PTS at start of stream
  4316. @item startt
  4317. time at start of stream
  4318. @item t
  4319. frame time
  4320. @item tb
  4321. timestamp timebase
  4322. @item volume
  4323. last set volume value
  4324. @end table
  4325. Note that when @option{eval} is set to @samp{once} only the
  4326. @var{sample_rate} and @var{tb} variables are available, all other
  4327. variables will evaluate to NAN.
  4328. @subsection Commands
  4329. This filter supports the following commands:
  4330. @table @option
  4331. @item volume
  4332. Modify the volume expression.
  4333. The command accepts the same syntax of the corresponding option.
  4334. If the specified expression is not valid, it is kept at its current
  4335. value.
  4336. @item replaygain_noclip
  4337. Prevent clipping by limiting the gain applied.
  4338. Default value for @var{replaygain_noclip} is 1.
  4339. @end table
  4340. @subsection Examples
  4341. @itemize
  4342. @item
  4343. Halve the input audio volume:
  4344. @example
  4345. volume=volume=0.5
  4346. volume=volume=1/2
  4347. volume=volume=-6.0206dB
  4348. @end example
  4349. In all the above example the named key for @option{volume} can be
  4350. omitted, for example like in:
  4351. @example
  4352. volume=0.5
  4353. @end example
  4354. @item
  4355. Increase input audio power by 6 decibels using fixed-point precision:
  4356. @example
  4357. volume=volume=6dB:precision=fixed
  4358. @end example
  4359. @item
  4360. Fade volume after time 10 with an annihilation period of 5 seconds:
  4361. @example
  4362. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4363. @end example
  4364. @end itemize
  4365. @section volumedetect
  4366. Detect the volume of the input video.
  4367. The filter has no parameters. The input is not modified. Statistics about
  4368. the volume will be printed in the log when the input stream end is reached.
  4369. In particular it will show the mean volume (root mean square), maximum
  4370. volume (on a per-sample basis), and the beginning of a histogram of the
  4371. registered volume values (from the maximum value to a cumulated 1/1000 of
  4372. the samples).
  4373. All volumes are in decibels relative to the maximum PCM value.
  4374. @subsection Examples
  4375. Here is an excerpt of the output:
  4376. @example
  4377. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4378. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4379. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4380. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4381. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4382. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4383. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4384. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4385. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4386. @end example
  4387. It means that:
  4388. @itemize
  4389. @item
  4390. The mean square energy is approximately -27 dB, or 10^-2.7.
  4391. @item
  4392. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4393. @item
  4394. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4395. @end itemize
  4396. In other words, raising the volume by +4 dB does not cause any clipping,
  4397. raising it by +5 dB causes clipping for 6 samples, etc.
  4398. @c man end AUDIO FILTERS
  4399. @chapter Audio Sources
  4400. @c man begin AUDIO SOURCES
  4401. Below is a description of the currently available audio sources.
  4402. @section abuffer
  4403. Buffer audio frames, and make them available to the filter chain.
  4404. This source is mainly intended for a programmatic use, in particular
  4405. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4406. It accepts the following parameters:
  4407. @table @option
  4408. @item time_base
  4409. The timebase which will be used for timestamps of submitted frames. It must be
  4410. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4411. @item sample_rate
  4412. The sample rate of the incoming audio buffers.
  4413. @item sample_fmt
  4414. The sample format of the incoming audio buffers.
  4415. Either a sample format name or its corresponding integer representation from
  4416. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4417. @item channel_layout
  4418. The channel layout of the incoming audio buffers.
  4419. Either a channel layout name from channel_layout_map in
  4420. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4421. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4422. @item channels
  4423. The number of channels of the incoming audio buffers.
  4424. If both @var{channels} and @var{channel_layout} are specified, then they
  4425. must be consistent.
  4426. @end table
  4427. @subsection Examples
  4428. @example
  4429. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4430. @end example
  4431. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4432. Since the sample format with name "s16p" corresponds to the number
  4433. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4434. equivalent to:
  4435. @example
  4436. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4437. @end example
  4438. @section aevalsrc
  4439. Generate an audio signal specified by an expression.
  4440. This source accepts in input one or more expressions (one for each
  4441. channel), which are evaluated and used to generate a corresponding
  4442. audio signal.
  4443. This source accepts the following options:
  4444. @table @option
  4445. @item exprs
  4446. Set the '|'-separated expressions list for each separate channel. In case the
  4447. @option{channel_layout} option is not specified, the selected channel layout
  4448. depends on the number of provided expressions. Otherwise the last
  4449. specified expression is applied to the remaining output channels.
  4450. @item channel_layout, c
  4451. Set the channel layout. The number of channels in the specified layout
  4452. must be equal to the number of specified expressions.
  4453. @item duration, d
  4454. Set the minimum duration of the sourced audio. See
  4455. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4456. for the accepted syntax.
  4457. Note that the resulting duration may be greater than the specified
  4458. duration, as the generated audio is always cut at the end of a
  4459. complete frame.
  4460. If not specified, or the expressed duration is negative, the audio is
  4461. supposed to be generated forever.
  4462. @item nb_samples, n
  4463. Set the number of samples per channel per each output frame,
  4464. default to 1024.
  4465. @item sample_rate, s
  4466. Specify the sample rate, default to 44100.
  4467. @end table
  4468. Each expression in @var{exprs} can contain the following constants:
  4469. @table @option
  4470. @item n
  4471. number of the evaluated sample, starting from 0
  4472. @item t
  4473. time of the evaluated sample expressed in seconds, starting from 0
  4474. @item s
  4475. sample rate
  4476. @end table
  4477. @subsection Examples
  4478. @itemize
  4479. @item
  4480. Generate silence:
  4481. @example
  4482. aevalsrc=0
  4483. @end example
  4484. @item
  4485. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4486. 8000 Hz:
  4487. @example
  4488. aevalsrc="sin(440*2*PI*t):s=8000"
  4489. @end example
  4490. @item
  4491. Generate a two channels signal, specify the channel layout (Front
  4492. Center + Back Center) explicitly:
  4493. @example
  4494. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4495. @end example
  4496. @item
  4497. Generate white noise:
  4498. @example
  4499. aevalsrc="-2+random(0)"
  4500. @end example
  4501. @item
  4502. Generate an amplitude modulated signal:
  4503. @example
  4504. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4505. @end example
  4506. @item
  4507. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4508. @example
  4509. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4510. @end example
  4511. @end itemize
  4512. @section anullsrc
  4513. The null audio source, return unprocessed audio frames. It is mainly useful
  4514. as a template and to be employed in analysis / debugging tools, or as
  4515. the source for filters which ignore the input data (for example the sox
  4516. synth filter).
  4517. This source accepts the following options:
  4518. @table @option
  4519. @item channel_layout, cl
  4520. Specifies the channel layout, and can be either an integer or a string
  4521. representing a channel layout. The default value of @var{channel_layout}
  4522. is "stereo".
  4523. Check the channel_layout_map definition in
  4524. @file{libavutil/channel_layout.c} for the mapping between strings and
  4525. channel layout values.
  4526. @item sample_rate, r
  4527. Specifies the sample rate, and defaults to 44100.
  4528. @item nb_samples, n
  4529. Set the number of samples per requested frames.
  4530. @end table
  4531. @subsection Examples
  4532. @itemize
  4533. @item
  4534. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4535. @example
  4536. anullsrc=r=48000:cl=4
  4537. @end example
  4538. @item
  4539. Do the same operation with a more obvious syntax:
  4540. @example
  4541. anullsrc=r=48000:cl=mono
  4542. @end example
  4543. @end itemize
  4544. All the parameters need to be explicitly defined.
  4545. @section flite
  4546. Synthesize a voice utterance using the libflite library.
  4547. To enable compilation of this filter you need to configure FFmpeg with
  4548. @code{--enable-libflite}.
  4549. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4550. The filter accepts the following options:
  4551. @table @option
  4552. @item list_voices
  4553. If set to 1, list the names of the available voices and exit
  4554. immediately. Default value is 0.
  4555. @item nb_samples, n
  4556. Set the maximum number of samples per frame. Default value is 512.
  4557. @item textfile
  4558. Set the filename containing the text to speak.
  4559. @item text
  4560. Set the text to speak.
  4561. @item voice, v
  4562. Set the voice to use for the speech synthesis. Default value is
  4563. @code{kal}. See also the @var{list_voices} option.
  4564. @end table
  4565. @subsection Examples
  4566. @itemize
  4567. @item
  4568. Read from file @file{speech.txt}, and synthesize the text using the
  4569. standard flite voice:
  4570. @example
  4571. flite=textfile=speech.txt
  4572. @end example
  4573. @item
  4574. Read the specified text selecting the @code{slt} voice:
  4575. @example
  4576. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4577. @end example
  4578. @item
  4579. Input text to ffmpeg:
  4580. @example
  4581. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4582. @end example
  4583. @item
  4584. Make @file{ffplay} speak the specified text, using @code{flite} and
  4585. the @code{lavfi} device:
  4586. @example
  4587. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4588. @end example
  4589. @end itemize
  4590. For more information about libflite, check:
  4591. @url{http://www.festvox.org/flite/}
  4592. @section anoisesrc
  4593. Generate a noise audio signal.
  4594. The filter accepts the following options:
  4595. @table @option
  4596. @item sample_rate, r
  4597. Specify the sample rate. Default value is 48000 Hz.
  4598. @item amplitude, a
  4599. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4600. is 1.0.
  4601. @item duration, d
  4602. Specify the duration of the generated audio stream. Not specifying this option
  4603. results in noise with an infinite length.
  4604. @item color, colour, c
  4605. Specify the color of noise. Available noise colors are white, pink, brown,
  4606. blue and violet. Default color is white.
  4607. @item seed, s
  4608. Specify a value used to seed the PRNG.
  4609. @item nb_samples, n
  4610. Set the number of samples per each output frame, default is 1024.
  4611. @end table
  4612. @subsection Examples
  4613. @itemize
  4614. @item
  4615. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4616. @example
  4617. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4618. @end example
  4619. @end itemize
  4620. @section hilbert
  4621. Generate odd-tap Hilbert transform FIR coefficients.
  4622. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4623. the signal by 90 degrees.
  4624. This is used in many matrix coding schemes and for analytic signal generation.
  4625. The process is often written as a multiplication by i (or j), the imaginary unit.
  4626. The filter accepts the following options:
  4627. @table @option
  4628. @item sample_rate, s
  4629. Set sample rate, default is 44100.
  4630. @item taps, t
  4631. Set length of FIR filter, default is 22051.
  4632. @item nb_samples, n
  4633. Set number of samples per each frame.
  4634. @item win_func, w
  4635. Set window function to be used when generating FIR coefficients.
  4636. @end table
  4637. @section sinc
  4638. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4639. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4640. The filter accepts the following options:
  4641. @table @option
  4642. @item sample_rate, r
  4643. Set sample rate, default is 44100.
  4644. @item nb_samples, n
  4645. Set number of samples per each frame. Default is 1024.
  4646. @item hp
  4647. Set high-pass frequency. Default is 0.
  4648. @item lp
  4649. Set low-pass frequency. Default is 0.
  4650. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4651. is higher than 0 then filter will create band-pass filter coefficients,
  4652. otherwise band-reject filter coefficients.
  4653. @item phase
  4654. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4655. @item beta
  4656. Set Kaiser window beta.
  4657. @item att
  4658. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4659. @item round
  4660. Enable rounding, by default is disabled.
  4661. @item hptaps
  4662. Set number of taps for high-pass filter.
  4663. @item lptaps
  4664. Set number of taps for low-pass filter.
  4665. @end table
  4666. @section sine
  4667. Generate an audio signal made of a sine wave with amplitude 1/8.
  4668. The audio signal is bit-exact.
  4669. The filter accepts the following options:
  4670. @table @option
  4671. @item frequency, f
  4672. Set the carrier frequency. Default is 440 Hz.
  4673. @item beep_factor, b
  4674. Enable a periodic beep every second with frequency @var{beep_factor} times
  4675. the carrier frequency. Default is 0, meaning the beep is disabled.
  4676. @item sample_rate, r
  4677. Specify the sample rate, default is 44100.
  4678. @item duration, d
  4679. Specify the duration of the generated audio stream.
  4680. @item samples_per_frame
  4681. Set the number of samples per output frame.
  4682. The expression can contain the following constants:
  4683. @table @option
  4684. @item n
  4685. The (sequential) number of the output audio frame, starting from 0.
  4686. @item pts
  4687. The PTS (Presentation TimeStamp) of the output audio frame,
  4688. expressed in @var{TB} units.
  4689. @item t
  4690. The PTS of the output audio frame, expressed in seconds.
  4691. @item TB
  4692. The timebase of the output audio frames.
  4693. @end table
  4694. Default is @code{1024}.
  4695. @end table
  4696. @subsection Examples
  4697. @itemize
  4698. @item
  4699. Generate a simple 440 Hz sine wave:
  4700. @example
  4701. sine
  4702. @end example
  4703. @item
  4704. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4705. @example
  4706. sine=220:4:d=5
  4707. sine=f=220:b=4:d=5
  4708. sine=frequency=220:beep_factor=4:duration=5
  4709. @end example
  4710. @item
  4711. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4712. pattern:
  4713. @example
  4714. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4715. @end example
  4716. @end itemize
  4717. @c man end AUDIO SOURCES
  4718. @chapter Audio Sinks
  4719. @c man begin AUDIO SINKS
  4720. Below is a description of the currently available audio sinks.
  4721. @section abuffersink
  4722. Buffer audio frames, and make them available to the end of filter chain.
  4723. This sink is mainly intended for programmatic use, in particular
  4724. through the interface defined in @file{libavfilter/buffersink.h}
  4725. or the options system.
  4726. It accepts a pointer to an AVABufferSinkContext structure, which
  4727. defines the incoming buffers' formats, to be passed as the opaque
  4728. parameter to @code{avfilter_init_filter} for initialization.
  4729. @section anullsink
  4730. Null audio sink; do absolutely nothing with the input audio. It is
  4731. mainly useful as a template and for use in analysis / debugging
  4732. tools.
  4733. @c man end AUDIO SINKS
  4734. @chapter Video Filters
  4735. @c man begin VIDEO FILTERS
  4736. When you configure your FFmpeg build, you can disable any of the
  4737. existing filters using @code{--disable-filters}.
  4738. The configure output will show the video filters included in your
  4739. build.
  4740. Below is a description of the currently available video filters.
  4741. @section addroi
  4742. Mark a region of interest in a video frame.
  4743. The frame data is passed through unchanged, but metadata is attached
  4744. to the frame indicating regions of interest which can affect the
  4745. behaviour of later encoding. Multiple regions can be marked by
  4746. applying the filter multiple times.
  4747. @table @option
  4748. @item x
  4749. Region distance in pixels from the left edge of the frame.
  4750. @item y
  4751. Region distance in pixels from the top edge of the frame.
  4752. @item w
  4753. Region width in pixels.
  4754. @item h
  4755. Region height in pixels.
  4756. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4757. and may contain the following variables:
  4758. @table @option
  4759. @item iw
  4760. Width of the input frame.
  4761. @item ih
  4762. Height of the input frame.
  4763. @end table
  4764. @item qoffset
  4765. Quantisation offset to apply within the region.
  4766. This must be a real value in the range -1 to +1. A value of zero
  4767. indicates no quality change. A negative value asks for better quality
  4768. (less quantisation), while a positive value asks for worse quality
  4769. (greater quantisation).
  4770. The range is calibrated so that the extreme values indicate the
  4771. largest possible offset - if the rest of the frame is encoded with the
  4772. worst possible quality, an offset of -1 indicates that this region
  4773. should be encoded with the best possible quality anyway. Intermediate
  4774. values are then interpolated in some codec-dependent way.
  4775. For example, in 10-bit H.264 the quantisation parameter varies between
  4776. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4777. this region should be encoded with a QP around one-tenth of the full
  4778. range better than the rest of the frame. So, if most of the frame
  4779. were to be encoded with a QP of around 30, this region would get a QP
  4780. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4781. An extreme value of -1 would indicate that this region should be
  4782. encoded with the best possible quality regardless of the treatment of
  4783. the rest of the frame - that is, should be encoded at a QP of -12.
  4784. @item clear
  4785. If set to true, remove any existing regions of interest marked on the
  4786. frame before adding the new one.
  4787. @end table
  4788. @subsection Examples
  4789. @itemize
  4790. @item
  4791. Mark the centre quarter of the frame as interesting.
  4792. @example
  4793. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4794. @end example
  4795. @item
  4796. Mark the 100-pixel-wide region on the left edge of the frame as very
  4797. uninteresting (to be encoded at much lower quality than the rest of
  4798. the frame).
  4799. @example
  4800. addroi=0:0:100:ih:+1/5
  4801. @end example
  4802. @end itemize
  4803. @section alphaextract
  4804. Extract the alpha component from the input as a grayscale video. This
  4805. is especially useful with the @var{alphamerge} filter.
  4806. @section alphamerge
  4807. Add or replace the alpha component of the primary input with the
  4808. grayscale value of a second input. This is intended for use with
  4809. @var{alphaextract} to allow the transmission or storage of frame
  4810. sequences that have alpha in a format that doesn't support an alpha
  4811. channel.
  4812. For example, to reconstruct full frames from a normal YUV-encoded video
  4813. and a separate video created with @var{alphaextract}, you might use:
  4814. @example
  4815. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4816. @end example
  4817. Since this filter is designed for reconstruction, it operates on frame
  4818. sequences without considering timestamps, and terminates when either
  4819. input reaches end of stream. This will cause problems if your encoding
  4820. pipeline drops frames. If you're trying to apply an image as an
  4821. overlay to a video stream, consider the @var{overlay} filter instead.
  4822. @section amplify
  4823. Amplify differences between current pixel and pixels of adjacent frames in
  4824. same pixel location.
  4825. This filter accepts the following options:
  4826. @table @option
  4827. @item radius
  4828. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4829. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4830. @item factor
  4831. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4832. @item threshold
  4833. Set threshold for difference amplification. Any difference greater or equal to
  4834. this value will not alter source pixel. Default is 10.
  4835. Allowed range is from 0 to 65535.
  4836. @item tolerance
  4837. Set tolerance for difference amplification. Any difference lower to
  4838. this value will not alter source pixel. Default is 0.
  4839. Allowed range is from 0 to 65535.
  4840. @item low
  4841. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4842. This option controls maximum possible value that will decrease source pixel value.
  4843. @item high
  4844. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4845. This option controls maximum possible value that will increase source pixel value.
  4846. @item planes
  4847. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4848. @end table
  4849. @subsection Commands
  4850. This filter supports the following @ref{commands} that corresponds to option of same name:
  4851. @table @option
  4852. @item factor
  4853. @item threshold
  4854. @item tolerance
  4855. @item low
  4856. @item high
  4857. @item planes
  4858. @end table
  4859. @section ass
  4860. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4861. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4862. Substation Alpha) subtitles files.
  4863. This filter accepts the following option in addition to the common options from
  4864. the @ref{subtitles} filter:
  4865. @table @option
  4866. @item shaping
  4867. Set the shaping engine
  4868. Available values are:
  4869. @table @samp
  4870. @item auto
  4871. The default libass shaping engine, which is the best available.
  4872. @item simple
  4873. Fast, font-agnostic shaper that can do only substitutions
  4874. @item complex
  4875. Slower shaper using OpenType for substitutions and positioning
  4876. @end table
  4877. The default is @code{auto}.
  4878. @end table
  4879. @section atadenoise
  4880. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4881. The filter accepts the following options:
  4882. @table @option
  4883. @item 0a
  4884. Set threshold A for 1st plane. Default is 0.02.
  4885. Valid range is 0 to 0.3.
  4886. @item 0b
  4887. Set threshold B for 1st plane. Default is 0.04.
  4888. Valid range is 0 to 5.
  4889. @item 1a
  4890. Set threshold A for 2nd plane. Default is 0.02.
  4891. Valid range is 0 to 0.3.
  4892. @item 1b
  4893. Set threshold B for 2nd plane. Default is 0.04.
  4894. Valid range is 0 to 5.
  4895. @item 2a
  4896. Set threshold A for 3rd plane. Default is 0.02.
  4897. Valid range is 0 to 0.3.
  4898. @item 2b
  4899. Set threshold B for 3rd plane. Default is 0.04.
  4900. Valid range is 0 to 5.
  4901. Threshold A is designed to react on abrupt changes in the input signal and
  4902. threshold B is designed to react on continuous changes in the input signal.
  4903. @item s
  4904. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4905. number in range [5, 129].
  4906. @item p
  4907. Set what planes of frame filter will use for averaging. Default is all.
  4908. @item a
  4909. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4910. Alternatively can be set to @code{s} serial.
  4911. Parallel can be faster then serial, while other way around is never true.
  4912. Parallel will abort early on first change being greater then thresholds, while serial
  4913. will continue processing other side of frames if they are equal or bellow thresholds.
  4914. @end table
  4915. @subsection Commands
  4916. This filter supports same @ref{commands} as options except option @code{s}.
  4917. The command accepts the same syntax of the corresponding option.
  4918. @section avgblur
  4919. Apply average blur filter.
  4920. The filter accepts the following options:
  4921. @table @option
  4922. @item sizeX
  4923. Set horizontal radius size.
  4924. @item planes
  4925. Set which planes to filter. By default all planes are filtered.
  4926. @item sizeY
  4927. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4928. Default is @code{0}.
  4929. @end table
  4930. @subsection Commands
  4931. This filter supports same commands as options.
  4932. The command accepts the same syntax of the corresponding option.
  4933. If the specified expression is not valid, it is kept at its current
  4934. value.
  4935. @section bbox
  4936. Compute the bounding box for the non-black pixels in the input frame
  4937. luminance plane.
  4938. This filter computes the bounding box containing all the pixels with a
  4939. luminance value greater than the minimum allowed value.
  4940. The parameters describing the bounding box are printed on the filter
  4941. log.
  4942. The filter accepts the following option:
  4943. @table @option
  4944. @item min_val
  4945. Set the minimal luminance value. Default is @code{16}.
  4946. @end table
  4947. @section bilateral
  4948. Apply bilateral filter, spatial smoothing while preserving edges.
  4949. The filter accepts the following options:
  4950. @table @option
  4951. @item sigmaS
  4952. Set sigma of gaussian function to calculate spatial weight.
  4953. Allowed range is 0 to 10. Default is 0.1.
  4954. @item sigmaR
  4955. Set sigma of gaussian function to calculate range weight.
  4956. Allowed range is 0 to 1. Default is 0.1.
  4957. @item planes
  4958. Set planes to filter. Default is first only.
  4959. @end table
  4960. @section bitplanenoise
  4961. Show and measure bit plane noise.
  4962. The filter accepts the following options:
  4963. @table @option
  4964. @item bitplane
  4965. Set which plane to analyze. Default is @code{1}.
  4966. @item filter
  4967. Filter out noisy pixels from @code{bitplane} set above.
  4968. Default is disabled.
  4969. @end table
  4970. @section blackdetect
  4971. Detect video intervals that are (almost) completely black. Can be
  4972. useful to detect chapter transitions, commercials, or invalid
  4973. recordings. Output lines contains the time for the start, end and
  4974. duration of the detected black interval expressed in seconds.
  4975. In order to display the output lines, you need to set the loglevel at
  4976. least to the AV_LOG_INFO value.
  4977. The filter accepts the following options:
  4978. @table @option
  4979. @item black_min_duration, d
  4980. Set the minimum detected black duration expressed in seconds. It must
  4981. be a non-negative floating point number.
  4982. Default value is 2.0.
  4983. @item picture_black_ratio_th, pic_th
  4984. Set the threshold for considering a picture "black".
  4985. Express the minimum value for the ratio:
  4986. @example
  4987. @var{nb_black_pixels} / @var{nb_pixels}
  4988. @end example
  4989. for which a picture is considered black.
  4990. Default value is 0.98.
  4991. @item pixel_black_th, pix_th
  4992. Set the threshold for considering a pixel "black".
  4993. The threshold expresses the maximum pixel luminance value for which a
  4994. pixel is considered "black". The provided value is scaled according to
  4995. the following equation:
  4996. @example
  4997. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4998. @end example
  4999. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5000. the input video format, the range is [0-255] for YUV full-range
  5001. formats and [16-235] for YUV non full-range formats.
  5002. Default value is 0.10.
  5003. @end table
  5004. The following example sets the maximum pixel threshold to the minimum
  5005. value, and detects only black intervals of 2 or more seconds:
  5006. @example
  5007. blackdetect=d=2:pix_th=0.00
  5008. @end example
  5009. @section blackframe
  5010. Detect frames that are (almost) completely black. Can be useful to
  5011. detect chapter transitions or commercials. Output lines consist of
  5012. the frame number of the detected frame, the percentage of blackness,
  5013. the position in the file if known or -1 and the timestamp in seconds.
  5014. In order to display the output lines, you need to set the loglevel at
  5015. least to the AV_LOG_INFO value.
  5016. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5017. The value represents the percentage of pixels in the picture that
  5018. are below the threshold value.
  5019. It accepts the following parameters:
  5020. @table @option
  5021. @item amount
  5022. The percentage of the pixels that have to be below the threshold; it defaults to
  5023. @code{98}.
  5024. @item threshold, thresh
  5025. The threshold below which a pixel value is considered black; it defaults to
  5026. @code{32}.
  5027. @end table
  5028. @section blend, tblend
  5029. Blend two video frames into each other.
  5030. The @code{blend} filter takes two input streams and outputs one
  5031. stream, the first input is the "top" layer and second input is
  5032. "bottom" layer. By default, the output terminates when the longest input terminates.
  5033. The @code{tblend} (time blend) filter takes two consecutive frames
  5034. from one single stream, and outputs the result obtained by blending
  5035. the new frame on top of the old frame.
  5036. A description of the accepted options follows.
  5037. @table @option
  5038. @item c0_mode
  5039. @item c1_mode
  5040. @item c2_mode
  5041. @item c3_mode
  5042. @item all_mode
  5043. Set blend mode for specific pixel component or all pixel components in case
  5044. of @var{all_mode}. Default value is @code{normal}.
  5045. Available values for component modes are:
  5046. @table @samp
  5047. @item addition
  5048. @item grainmerge
  5049. @item and
  5050. @item average
  5051. @item burn
  5052. @item darken
  5053. @item difference
  5054. @item grainextract
  5055. @item divide
  5056. @item dodge
  5057. @item freeze
  5058. @item exclusion
  5059. @item extremity
  5060. @item glow
  5061. @item hardlight
  5062. @item hardmix
  5063. @item heat
  5064. @item lighten
  5065. @item linearlight
  5066. @item multiply
  5067. @item multiply128
  5068. @item negation
  5069. @item normal
  5070. @item or
  5071. @item overlay
  5072. @item phoenix
  5073. @item pinlight
  5074. @item reflect
  5075. @item screen
  5076. @item softlight
  5077. @item subtract
  5078. @item vividlight
  5079. @item xor
  5080. @end table
  5081. @item c0_opacity
  5082. @item c1_opacity
  5083. @item c2_opacity
  5084. @item c3_opacity
  5085. @item all_opacity
  5086. Set blend opacity for specific pixel component or all pixel components in case
  5087. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5088. @item c0_expr
  5089. @item c1_expr
  5090. @item c2_expr
  5091. @item c3_expr
  5092. @item all_expr
  5093. Set blend expression for specific pixel component or all pixel components in case
  5094. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5095. The expressions can use the following variables:
  5096. @table @option
  5097. @item N
  5098. The sequential number of the filtered frame, starting from @code{0}.
  5099. @item X
  5100. @item Y
  5101. the coordinates of the current sample
  5102. @item W
  5103. @item H
  5104. the width and height of currently filtered plane
  5105. @item SW
  5106. @item SH
  5107. Width and height scale for the plane being filtered. It is the
  5108. ratio between the dimensions of the current plane to the luma plane,
  5109. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5110. the luma plane and @code{0.5,0.5} for the chroma planes.
  5111. @item T
  5112. Time of the current frame, expressed in seconds.
  5113. @item TOP, A
  5114. Value of pixel component at current location for first video frame (top layer).
  5115. @item BOTTOM, B
  5116. Value of pixel component at current location for second video frame (bottom layer).
  5117. @end table
  5118. @end table
  5119. The @code{blend} filter also supports the @ref{framesync} options.
  5120. @subsection Examples
  5121. @itemize
  5122. @item
  5123. Apply transition from bottom layer to top layer in first 10 seconds:
  5124. @example
  5125. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5126. @end example
  5127. @item
  5128. Apply linear horizontal transition from top layer to bottom layer:
  5129. @example
  5130. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5131. @end example
  5132. @item
  5133. Apply 1x1 checkerboard effect:
  5134. @example
  5135. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5136. @end example
  5137. @item
  5138. Apply uncover left effect:
  5139. @example
  5140. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5141. @end example
  5142. @item
  5143. Apply uncover down effect:
  5144. @example
  5145. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5146. @end example
  5147. @item
  5148. Apply uncover up-left effect:
  5149. @example
  5150. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5151. @end example
  5152. @item
  5153. Split diagonally video and shows top and bottom layer on each side:
  5154. @example
  5155. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5156. @end example
  5157. @item
  5158. Display differences between the current and the previous frame:
  5159. @example
  5160. tblend=all_mode=grainextract
  5161. @end example
  5162. @end itemize
  5163. @section bm3d
  5164. Denoise frames using Block-Matching 3D algorithm.
  5165. The filter accepts the following options.
  5166. @table @option
  5167. @item sigma
  5168. Set denoising strength. Default value is 1.
  5169. Allowed range is from 0 to 999.9.
  5170. The denoising algorithm is very sensitive to sigma, so adjust it
  5171. according to the source.
  5172. @item block
  5173. Set local patch size. This sets dimensions in 2D.
  5174. @item bstep
  5175. Set sliding step for processing blocks. Default value is 4.
  5176. Allowed range is from 1 to 64.
  5177. Smaller values allows processing more reference blocks and is slower.
  5178. @item group
  5179. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5180. When set to 1, no block matching is done. Larger values allows more blocks
  5181. in single group.
  5182. Allowed range is from 1 to 256.
  5183. @item range
  5184. Set radius for search block matching. Default is 9.
  5185. Allowed range is from 1 to INT32_MAX.
  5186. @item mstep
  5187. Set step between two search locations for block matching. Default is 1.
  5188. Allowed range is from 1 to 64. Smaller is slower.
  5189. @item thmse
  5190. Set threshold of mean square error for block matching. Valid range is 0 to
  5191. INT32_MAX.
  5192. @item hdthr
  5193. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5194. Larger values results in stronger hard-thresholding filtering in frequency
  5195. domain.
  5196. @item estim
  5197. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5198. Default is @code{basic}.
  5199. @item ref
  5200. If enabled, filter will use 2nd stream for block matching.
  5201. Default is disabled for @code{basic} value of @var{estim} option,
  5202. and always enabled if value of @var{estim} is @code{final}.
  5203. @item planes
  5204. Set planes to filter. Default is all available except alpha.
  5205. @end table
  5206. @subsection Examples
  5207. @itemize
  5208. @item
  5209. Basic filtering with bm3d:
  5210. @example
  5211. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5212. @end example
  5213. @item
  5214. Same as above, but filtering only luma:
  5215. @example
  5216. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5217. @end example
  5218. @item
  5219. Same as above, but with both estimation modes:
  5220. @example
  5221. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  5222. @end example
  5223. @item
  5224. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5225. @example
  5226. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  5227. @end example
  5228. @end itemize
  5229. @section boxblur
  5230. Apply a boxblur algorithm to the input video.
  5231. It accepts the following parameters:
  5232. @table @option
  5233. @item luma_radius, lr
  5234. @item luma_power, lp
  5235. @item chroma_radius, cr
  5236. @item chroma_power, cp
  5237. @item alpha_radius, ar
  5238. @item alpha_power, ap
  5239. @end table
  5240. A description of the accepted options follows.
  5241. @table @option
  5242. @item luma_radius, lr
  5243. @item chroma_radius, cr
  5244. @item alpha_radius, ar
  5245. Set an expression for the box radius in pixels used for blurring the
  5246. corresponding input plane.
  5247. The radius value must be a non-negative number, and must not be
  5248. greater than the value of the expression @code{min(w,h)/2} for the
  5249. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5250. planes.
  5251. Default value for @option{luma_radius} is "2". If not specified,
  5252. @option{chroma_radius} and @option{alpha_radius} default to the
  5253. corresponding value set for @option{luma_radius}.
  5254. The expressions can contain the following constants:
  5255. @table @option
  5256. @item w
  5257. @item h
  5258. The input width and height in pixels.
  5259. @item cw
  5260. @item ch
  5261. The input chroma image width and height in pixels.
  5262. @item hsub
  5263. @item vsub
  5264. The horizontal and vertical chroma subsample values. For example, for the
  5265. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5266. @end table
  5267. @item luma_power, lp
  5268. @item chroma_power, cp
  5269. @item alpha_power, ap
  5270. Specify how many times the boxblur filter is applied to the
  5271. corresponding plane.
  5272. Default value for @option{luma_power} is 2. If not specified,
  5273. @option{chroma_power} and @option{alpha_power} default to the
  5274. corresponding value set for @option{luma_power}.
  5275. A value of 0 will disable the effect.
  5276. @end table
  5277. @subsection Examples
  5278. @itemize
  5279. @item
  5280. Apply a boxblur filter with the luma, chroma, and alpha radii
  5281. set to 2:
  5282. @example
  5283. boxblur=luma_radius=2:luma_power=1
  5284. boxblur=2:1
  5285. @end example
  5286. @item
  5287. Set the luma radius to 2, and alpha and chroma radius to 0:
  5288. @example
  5289. boxblur=2:1:cr=0:ar=0
  5290. @end example
  5291. @item
  5292. Set the luma and chroma radii to a fraction of the video dimension:
  5293. @example
  5294. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5295. @end example
  5296. @end itemize
  5297. @section bwdif
  5298. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5299. Deinterlacing Filter").
  5300. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5301. interpolation algorithms.
  5302. It accepts the following parameters:
  5303. @table @option
  5304. @item mode
  5305. The interlacing mode to adopt. It accepts one of the following values:
  5306. @table @option
  5307. @item 0, send_frame
  5308. Output one frame for each frame.
  5309. @item 1, send_field
  5310. Output one frame for each field.
  5311. @end table
  5312. The default value is @code{send_field}.
  5313. @item parity
  5314. The picture field parity assumed for the input interlaced video. It accepts one
  5315. of the following values:
  5316. @table @option
  5317. @item 0, tff
  5318. Assume the top field is first.
  5319. @item 1, bff
  5320. Assume the bottom field is first.
  5321. @item -1, auto
  5322. Enable automatic detection of field parity.
  5323. @end table
  5324. The default value is @code{auto}.
  5325. If the interlacing is unknown or the decoder does not export this information,
  5326. top field first will be assumed.
  5327. @item deint
  5328. Specify which frames to deinterlace. Accepts one of the following
  5329. values:
  5330. @table @option
  5331. @item 0, all
  5332. Deinterlace all frames.
  5333. @item 1, interlaced
  5334. Only deinterlace frames marked as interlaced.
  5335. @end table
  5336. The default value is @code{all}.
  5337. @end table
  5338. @section chromahold
  5339. Remove all color information for all colors except for certain one.
  5340. The filter accepts the following options:
  5341. @table @option
  5342. @item color
  5343. The color which will not be replaced with neutral chroma.
  5344. @item similarity
  5345. Similarity percentage with the above color.
  5346. 0.01 matches only the exact key color, while 1.0 matches everything.
  5347. @item blend
  5348. Blend percentage.
  5349. 0.0 makes pixels either fully gray, or not gray at all.
  5350. Higher values result in more preserved color.
  5351. @item yuv
  5352. Signals that the color passed is already in YUV instead of RGB.
  5353. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5354. This can be used to pass exact YUV values as hexadecimal numbers.
  5355. @end table
  5356. @subsection Commands
  5357. This filter supports same @ref{commands} as options.
  5358. The command accepts the same syntax of the corresponding option.
  5359. If the specified expression is not valid, it is kept at its current
  5360. value.
  5361. @section chromakey
  5362. YUV colorspace color/chroma keying.
  5363. The filter accepts the following options:
  5364. @table @option
  5365. @item color
  5366. The color which will be replaced with transparency.
  5367. @item similarity
  5368. Similarity percentage with the key color.
  5369. 0.01 matches only the exact key color, while 1.0 matches everything.
  5370. @item blend
  5371. Blend percentage.
  5372. 0.0 makes pixels either fully transparent, or not transparent at all.
  5373. Higher values result in semi-transparent pixels, with a higher transparency
  5374. the more similar the pixels color is to the key color.
  5375. @item yuv
  5376. Signals that the color passed is already in YUV instead of RGB.
  5377. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5378. This can be used to pass exact YUV values as hexadecimal numbers.
  5379. @end table
  5380. @subsection Commands
  5381. This filter supports same @ref{commands} as options.
  5382. The command accepts the same syntax of the corresponding option.
  5383. If the specified expression is not valid, it is kept at its current
  5384. value.
  5385. @subsection Examples
  5386. @itemize
  5387. @item
  5388. Make every green pixel in the input image transparent:
  5389. @example
  5390. ffmpeg -i input.png -vf chromakey=green out.png
  5391. @end example
  5392. @item
  5393. Overlay a greenscreen-video on top of a static black background.
  5394. @example
  5395. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  5396. @end example
  5397. @end itemize
  5398. @section chromashift
  5399. Shift chroma pixels horizontally and/or vertically.
  5400. The filter accepts the following options:
  5401. @table @option
  5402. @item cbh
  5403. Set amount to shift chroma-blue horizontally.
  5404. @item cbv
  5405. Set amount to shift chroma-blue vertically.
  5406. @item crh
  5407. Set amount to shift chroma-red horizontally.
  5408. @item crv
  5409. Set amount to shift chroma-red vertically.
  5410. @item edge
  5411. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5412. @end table
  5413. @subsection Commands
  5414. This filter supports the all above options as @ref{commands}.
  5415. @section ciescope
  5416. Display CIE color diagram with pixels overlaid onto it.
  5417. The filter accepts the following options:
  5418. @table @option
  5419. @item system
  5420. Set color system.
  5421. @table @samp
  5422. @item ntsc, 470m
  5423. @item ebu, 470bg
  5424. @item smpte
  5425. @item 240m
  5426. @item apple
  5427. @item widergb
  5428. @item cie1931
  5429. @item rec709, hdtv
  5430. @item uhdtv, rec2020
  5431. @item dcip3
  5432. @end table
  5433. @item cie
  5434. Set CIE system.
  5435. @table @samp
  5436. @item xyy
  5437. @item ucs
  5438. @item luv
  5439. @end table
  5440. @item gamuts
  5441. Set what gamuts to draw.
  5442. See @code{system} option for available values.
  5443. @item size, s
  5444. Set ciescope size, by default set to 512.
  5445. @item intensity, i
  5446. Set intensity used to map input pixel values to CIE diagram.
  5447. @item contrast
  5448. Set contrast used to draw tongue colors that are out of active color system gamut.
  5449. @item corrgamma
  5450. Correct gamma displayed on scope, by default enabled.
  5451. @item showwhite
  5452. Show white point on CIE diagram, by default disabled.
  5453. @item gamma
  5454. Set input gamma. Used only with XYZ input color space.
  5455. @end table
  5456. @section codecview
  5457. Visualize information exported by some codecs.
  5458. Some codecs can export information through frames using side-data or other
  5459. means. For example, some MPEG based codecs export motion vectors through the
  5460. @var{export_mvs} flag in the codec @option{flags2} option.
  5461. The filter accepts the following option:
  5462. @table @option
  5463. @item mv
  5464. Set motion vectors to visualize.
  5465. Available flags for @var{mv} are:
  5466. @table @samp
  5467. @item pf
  5468. forward predicted MVs of P-frames
  5469. @item bf
  5470. forward predicted MVs of B-frames
  5471. @item bb
  5472. backward predicted MVs of B-frames
  5473. @end table
  5474. @item qp
  5475. Display quantization parameters using the chroma planes.
  5476. @item mv_type, mvt
  5477. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5478. Available flags for @var{mv_type} are:
  5479. @table @samp
  5480. @item fp
  5481. forward predicted MVs
  5482. @item bp
  5483. backward predicted MVs
  5484. @end table
  5485. @item frame_type, ft
  5486. Set frame type to visualize motion vectors of.
  5487. Available flags for @var{frame_type} are:
  5488. @table @samp
  5489. @item if
  5490. intra-coded frames (I-frames)
  5491. @item pf
  5492. predicted frames (P-frames)
  5493. @item bf
  5494. bi-directionally predicted frames (B-frames)
  5495. @end table
  5496. @end table
  5497. @subsection Examples
  5498. @itemize
  5499. @item
  5500. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5501. @example
  5502. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5503. @end example
  5504. @item
  5505. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5506. @example
  5507. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5508. @end example
  5509. @end itemize
  5510. @section colorbalance
  5511. Modify intensity of primary colors (red, green and blue) of input frames.
  5512. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5513. regions for the red-cyan, green-magenta or blue-yellow balance.
  5514. A positive adjustment value shifts the balance towards the primary color, a negative
  5515. value towards the complementary color.
  5516. The filter accepts the following options:
  5517. @table @option
  5518. @item rs
  5519. @item gs
  5520. @item bs
  5521. Adjust red, green and blue shadows (darkest pixels).
  5522. @item rm
  5523. @item gm
  5524. @item bm
  5525. Adjust red, green and blue midtones (medium pixels).
  5526. @item rh
  5527. @item gh
  5528. @item bh
  5529. Adjust red, green and blue highlights (brightest pixels).
  5530. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5531. @item pl
  5532. Preserve lightness when changing color balance. Default is disabled.
  5533. @end table
  5534. @subsection Examples
  5535. @itemize
  5536. @item
  5537. Add red color cast to shadows:
  5538. @example
  5539. colorbalance=rs=.3
  5540. @end example
  5541. @end itemize
  5542. @subsection Commands
  5543. This filter supports the all above options as @ref{commands}.
  5544. @section colorchannelmixer
  5545. Adjust video input frames by re-mixing color channels.
  5546. This filter modifies a color channel by adding the values associated to
  5547. the other channels of the same pixels. For example if the value to
  5548. modify is red, the output value will be:
  5549. @example
  5550. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5551. @end example
  5552. The filter accepts the following options:
  5553. @table @option
  5554. @item rr
  5555. @item rg
  5556. @item rb
  5557. @item ra
  5558. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5559. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5560. @item gr
  5561. @item gg
  5562. @item gb
  5563. @item ga
  5564. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5565. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5566. @item br
  5567. @item bg
  5568. @item bb
  5569. @item ba
  5570. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5571. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5572. @item ar
  5573. @item ag
  5574. @item ab
  5575. @item aa
  5576. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5577. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5578. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5579. @end table
  5580. @subsection Examples
  5581. @itemize
  5582. @item
  5583. Convert source to grayscale:
  5584. @example
  5585. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5586. @end example
  5587. @item
  5588. Simulate sepia tones:
  5589. @example
  5590. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5591. @end example
  5592. @end itemize
  5593. @subsection Commands
  5594. This filter supports the all above options as @ref{commands}.
  5595. @section colorkey
  5596. RGB colorspace color keying.
  5597. The filter accepts the following options:
  5598. @table @option
  5599. @item color
  5600. The color which will be replaced with transparency.
  5601. @item similarity
  5602. Similarity percentage with the key color.
  5603. 0.01 matches only the exact key color, while 1.0 matches everything.
  5604. @item blend
  5605. Blend percentage.
  5606. 0.0 makes pixels either fully transparent, or not transparent at all.
  5607. Higher values result in semi-transparent pixels, with a higher transparency
  5608. the more similar the pixels color is to the key color.
  5609. @end table
  5610. @subsection Examples
  5611. @itemize
  5612. @item
  5613. Make every green pixel in the input image transparent:
  5614. @example
  5615. ffmpeg -i input.png -vf colorkey=green out.png
  5616. @end example
  5617. @item
  5618. Overlay a greenscreen-video on top of a static background image.
  5619. @example
  5620. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  5621. @end example
  5622. @end itemize
  5623. @section colorhold
  5624. Remove all color information for all RGB colors except for certain one.
  5625. The filter accepts the following options:
  5626. @table @option
  5627. @item color
  5628. The color which will not be replaced with neutral gray.
  5629. @item similarity
  5630. Similarity percentage with the above color.
  5631. 0.01 matches only the exact key color, while 1.0 matches everything.
  5632. @item blend
  5633. Blend percentage. 0.0 makes pixels fully gray.
  5634. Higher values result in more preserved color.
  5635. @end table
  5636. @section colorlevels
  5637. Adjust video input frames using levels.
  5638. The filter accepts the following options:
  5639. @table @option
  5640. @item rimin
  5641. @item gimin
  5642. @item bimin
  5643. @item aimin
  5644. Adjust red, green, blue and alpha input black point.
  5645. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5646. @item rimax
  5647. @item gimax
  5648. @item bimax
  5649. @item aimax
  5650. Adjust red, green, blue and alpha input white point.
  5651. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5652. Input levels are used to lighten highlights (bright tones), darken shadows
  5653. (dark tones), change the balance of bright and dark tones.
  5654. @item romin
  5655. @item gomin
  5656. @item bomin
  5657. @item aomin
  5658. Adjust red, green, blue and alpha output black point.
  5659. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5660. @item romax
  5661. @item gomax
  5662. @item bomax
  5663. @item aomax
  5664. Adjust red, green, blue and alpha output white point.
  5665. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5666. Output levels allows manual selection of a constrained output level range.
  5667. @end table
  5668. @subsection Examples
  5669. @itemize
  5670. @item
  5671. Make video output darker:
  5672. @example
  5673. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5674. @end example
  5675. @item
  5676. Increase contrast:
  5677. @example
  5678. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5679. @end example
  5680. @item
  5681. Make video output lighter:
  5682. @example
  5683. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5684. @end example
  5685. @item
  5686. Increase brightness:
  5687. @example
  5688. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5689. @end example
  5690. @end itemize
  5691. @section colormatrix
  5692. Convert color matrix.
  5693. The filter accepts the following options:
  5694. @table @option
  5695. @item src
  5696. @item dst
  5697. Specify the source and destination color matrix. Both values must be
  5698. specified.
  5699. The accepted values are:
  5700. @table @samp
  5701. @item bt709
  5702. BT.709
  5703. @item fcc
  5704. FCC
  5705. @item bt601
  5706. BT.601
  5707. @item bt470
  5708. BT.470
  5709. @item bt470bg
  5710. BT.470BG
  5711. @item smpte170m
  5712. SMPTE-170M
  5713. @item smpte240m
  5714. SMPTE-240M
  5715. @item bt2020
  5716. BT.2020
  5717. @end table
  5718. @end table
  5719. For example to convert from BT.601 to SMPTE-240M, use the command:
  5720. @example
  5721. colormatrix=bt601:smpte240m
  5722. @end example
  5723. @section colorspace
  5724. Convert colorspace, transfer characteristics or color primaries.
  5725. Input video needs to have an even size.
  5726. The filter accepts the following options:
  5727. @table @option
  5728. @anchor{all}
  5729. @item all
  5730. Specify all color properties at once.
  5731. The accepted values are:
  5732. @table @samp
  5733. @item bt470m
  5734. BT.470M
  5735. @item bt470bg
  5736. BT.470BG
  5737. @item bt601-6-525
  5738. BT.601-6 525
  5739. @item bt601-6-625
  5740. BT.601-6 625
  5741. @item bt709
  5742. BT.709
  5743. @item smpte170m
  5744. SMPTE-170M
  5745. @item smpte240m
  5746. SMPTE-240M
  5747. @item bt2020
  5748. BT.2020
  5749. @end table
  5750. @anchor{space}
  5751. @item space
  5752. Specify output colorspace.
  5753. The accepted values are:
  5754. @table @samp
  5755. @item bt709
  5756. BT.709
  5757. @item fcc
  5758. FCC
  5759. @item bt470bg
  5760. BT.470BG or BT.601-6 625
  5761. @item smpte170m
  5762. SMPTE-170M or BT.601-6 525
  5763. @item smpte240m
  5764. SMPTE-240M
  5765. @item ycgco
  5766. YCgCo
  5767. @item bt2020ncl
  5768. BT.2020 with non-constant luminance
  5769. @end table
  5770. @anchor{trc}
  5771. @item trc
  5772. Specify output transfer characteristics.
  5773. The accepted values are:
  5774. @table @samp
  5775. @item bt709
  5776. BT.709
  5777. @item bt470m
  5778. BT.470M
  5779. @item bt470bg
  5780. BT.470BG
  5781. @item gamma22
  5782. Constant gamma of 2.2
  5783. @item gamma28
  5784. Constant gamma of 2.8
  5785. @item smpte170m
  5786. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5787. @item smpte240m
  5788. SMPTE-240M
  5789. @item srgb
  5790. SRGB
  5791. @item iec61966-2-1
  5792. iec61966-2-1
  5793. @item iec61966-2-4
  5794. iec61966-2-4
  5795. @item xvycc
  5796. xvycc
  5797. @item bt2020-10
  5798. BT.2020 for 10-bits content
  5799. @item bt2020-12
  5800. BT.2020 for 12-bits content
  5801. @end table
  5802. @anchor{primaries}
  5803. @item primaries
  5804. Specify output color primaries.
  5805. The accepted values are:
  5806. @table @samp
  5807. @item bt709
  5808. BT.709
  5809. @item bt470m
  5810. BT.470M
  5811. @item bt470bg
  5812. BT.470BG or BT.601-6 625
  5813. @item smpte170m
  5814. SMPTE-170M or BT.601-6 525
  5815. @item smpte240m
  5816. SMPTE-240M
  5817. @item film
  5818. film
  5819. @item smpte431
  5820. SMPTE-431
  5821. @item smpte432
  5822. SMPTE-432
  5823. @item bt2020
  5824. BT.2020
  5825. @item jedec-p22
  5826. JEDEC P22 phosphors
  5827. @end table
  5828. @anchor{range}
  5829. @item range
  5830. Specify output color range.
  5831. The accepted values are:
  5832. @table @samp
  5833. @item tv
  5834. TV (restricted) range
  5835. @item mpeg
  5836. MPEG (restricted) range
  5837. @item pc
  5838. PC (full) range
  5839. @item jpeg
  5840. JPEG (full) range
  5841. @end table
  5842. @item format
  5843. Specify output color format.
  5844. The accepted values are:
  5845. @table @samp
  5846. @item yuv420p
  5847. YUV 4:2:0 planar 8-bits
  5848. @item yuv420p10
  5849. YUV 4:2:0 planar 10-bits
  5850. @item yuv420p12
  5851. YUV 4:2:0 planar 12-bits
  5852. @item yuv422p
  5853. YUV 4:2:2 planar 8-bits
  5854. @item yuv422p10
  5855. YUV 4:2:2 planar 10-bits
  5856. @item yuv422p12
  5857. YUV 4:2:2 planar 12-bits
  5858. @item yuv444p
  5859. YUV 4:4:4 planar 8-bits
  5860. @item yuv444p10
  5861. YUV 4:4:4 planar 10-bits
  5862. @item yuv444p12
  5863. YUV 4:4:4 planar 12-bits
  5864. @end table
  5865. @item fast
  5866. Do a fast conversion, which skips gamma/primary correction. This will take
  5867. significantly less CPU, but will be mathematically incorrect. To get output
  5868. compatible with that produced by the colormatrix filter, use fast=1.
  5869. @item dither
  5870. Specify dithering mode.
  5871. The accepted values are:
  5872. @table @samp
  5873. @item none
  5874. No dithering
  5875. @item fsb
  5876. Floyd-Steinberg dithering
  5877. @end table
  5878. @item wpadapt
  5879. Whitepoint adaptation mode.
  5880. The accepted values are:
  5881. @table @samp
  5882. @item bradford
  5883. Bradford whitepoint adaptation
  5884. @item vonkries
  5885. von Kries whitepoint adaptation
  5886. @item identity
  5887. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5888. @end table
  5889. @item iall
  5890. Override all input properties at once. Same accepted values as @ref{all}.
  5891. @item ispace
  5892. Override input colorspace. Same accepted values as @ref{space}.
  5893. @item iprimaries
  5894. Override input color primaries. Same accepted values as @ref{primaries}.
  5895. @item itrc
  5896. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5897. @item irange
  5898. Override input color range. Same accepted values as @ref{range}.
  5899. @end table
  5900. The filter converts the transfer characteristics, color space and color
  5901. primaries to the specified user values. The output value, if not specified,
  5902. is set to a default value based on the "all" property. If that property is
  5903. also not specified, the filter will log an error. The output color range and
  5904. format default to the same value as the input color range and format. The
  5905. input transfer characteristics, color space, color primaries and color range
  5906. should be set on the input data. If any of these are missing, the filter will
  5907. log an error and no conversion will take place.
  5908. For example to convert the input to SMPTE-240M, use the command:
  5909. @example
  5910. colorspace=smpte240m
  5911. @end example
  5912. @section convolution
  5913. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5914. The filter accepts the following options:
  5915. @table @option
  5916. @item 0m
  5917. @item 1m
  5918. @item 2m
  5919. @item 3m
  5920. Set matrix for each plane.
  5921. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5922. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5923. @item 0rdiv
  5924. @item 1rdiv
  5925. @item 2rdiv
  5926. @item 3rdiv
  5927. Set multiplier for calculated value for each plane.
  5928. If unset or 0, it will be sum of all matrix elements.
  5929. @item 0bias
  5930. @item 1bias
  5931. @item 2bias
  5932. @item 3bias
  5933. Set bias for each plane. This value is added to the result of the multiplication.
  5934. Useful for making the overall image brighter or darker. Default is 0.0.
  5935. @item 0mode
  5936. @item 1mode
  5937. @item 2mode
  5938. @item 3mode
  5939. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5940. Default is @var{square}.
  5941. @end table
  5942. @subsection Examples
  5943. @itemize
  5944. @item
  5945. Apply sharpen:
  5946. @example
  5947. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  5948. @end example
  5949. @item
  5950. Apply blur:
  5951. @example
  5952. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  5953. @end example
  5954. @item
  5955. Apply edge enhance:
  5956. @example
  5957. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  5958. @end example
  5959. @item
  5960. Apply edge detect:
  5961. @example
  5962. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  5963. @end example
  5964. @item
  5965. Apply laplacian edge detector which includes diagonals:
  5966. @example
  5967. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  5968. @end example
  5969. @item
  5970. Apply emboss:
  5971. @example
  5972. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  5973. @end example
  5974. @end itemize
  5975. @section convolve
  5976. Apply 2D convolution of video stream in frequency domain using second stream
  5977. as impulse.
  5978. The filter accepts the following options:
  5979. @table @option
  5980. @item planes
  5981. Set which planes to process.
  5982. @item impulse
  5983. Set which impulse video frames will be processed, can be @var{first}
  5984. or @var{all}. Default is @var{all}.
  5985. @end table
  5986. The @code{convolve} filter also supports the @ref{framesync} options.
  5987. @section copy
  5988. Copy the input video source unchanged to the output. This is mainly useful for
  5989. testing purposes.
  5990. @anchor{coreimage}
  5991. @section coreimage
  5992. Video filtering on GPU using Apple's CoreImage API on OSX.
  5993. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5994. processed by video hardware. However, software-based OpenGL implementations
  5995. exist which means there is no guarantee for hardware processing. It depends on
  5996. the respective OSX.
  5997. There are many filters and image generators provided by Apple that come with a
  5998. large variety of options. The filter has to be referenced by its name along
  5999. with its options.
  6000. The coreimage filter accepts the following options:
  6001. @table @option
  6002. @item list_filters
  6003. List all available filters and generators along with all their respective
  6004. options as well as possible minimum and maximum values along with the default
  6005. values.
  6006. @example
  6007. list_filters=true
  6008. @end example
  6009. @item filter
  6010. Specify all filters by their respective name and options.
  6011. Use @var{list_filters} to determine all valid filter names and options.
  6012. Numerical options are specified by a float value and are automatically clamped
  6013. to their respective value range. Vector and color options have to be specified
  6014. by a list of space separated float values. Character escaping has to be done.
  6015. A special option name @code{default} is available to use default options for a
  6016. filter.
  6017. It is required to specify either @code{default} or at least one of the filter options.
  6018. All omitted options are used with their default values.
  6019. The syntax of the filter string is as follows:
  6020. @example
  6021. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6022. @end example
  6023. @item output_rect
  6024. Specify a rectangle where the output of the filter chain is copied into the
  6025. input image. It is given by a list of space separated float values:
  6026. @example
  6027. output_rect=x\ y\ width\ height
  6028. @end example
  6029. If not given, the output rectangle equals the dimensions of the input image.
  6030. The output rectangle is automatically cropped at the borders of the input
  6031. image. Negative values are valid for each component.
  6032. @example
  6033. output_rect=25\ 25\ 100\ 100
  6034. @end example
  6035. @end table
  6036. Several filters can be chained for successive processing without GPU-HOST
  6037. transfers allowing for fast processing of complex filter chains.
  6038. Currently, only filters with zero (generators) or exactly one (filters) input
  6039. image and one output image are supported. Also, transition filters are not yet
  6040. usable as intended.
  6041. Some filters generate output images with additional padding depending on the
  6042. respective filter kernel. The padding is automatically removed to ensure the
  6043. filter output has the same size as the input image.
  6044. For image generators, the size of the output image is determined by the
  6045. previous output image of the filter chain or the input image of the whole
  6046. filterchain, respectively. The generators do not use the pixel information of
  6047. this image to generate their output. However, the generated output is
  6048. blended onto this image, resulting in partial or complete coverage of the
  6049. output image.
  6050. The @ref{coreimagesrc} video source can be used for generating input images
  6051. which are directly fed into the filter chain. By using it, providing input
  6052. images by another video source or an input video is not required.
  6053. @subsection Examples
  6054. @itemize
  6055. @item
  6056. List all filters available:
  6057. @example
  6058. coreimage=list_filters=true
  6059. @end example
  6060. @item
  6061. Use the CIBoxBlur filter with default options to blur an image:
  6062. @example
  6063. coreimage=filter=CIBoxBlur@@default
  6064. @end example
  6065. @item
  6066. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6067. its center at 100x100 and a radius of 50 pixels:
  6068. @example
  6069. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6070. @end example
  6071. @item
  6072. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6073. given as complete and escaped command-line for Apple's standard bash shell:
  6074. @example
  6075. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6076. @end example
  6077. @end itemize
  6078. @section cover_rect
  6079. Cover a rectangular object
  6080. It accepts the following options:
  6081. @table @option
  6082. @item cover
  6083. Filepath of the optional cover image, needs to be in yuv420.
  6084. @item mode
  6085. Set covering mode.
  6086. It accepts the following values:
  6087. @table @samp
  6088. @item cover
  6089. cover it by the supplied image
  6090. @item blur
  6091. cover it by interpolating the surrounding pixels
  6092. @end table
  6093. Default value is @var{blur}.
  6094. @end table
  6095. @subsection Examples
  6096. @itemize
  6097. @item
  6098. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6099. @example
  6100. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6101. @end example
  6102. @end itemize
  6103. @section crop
  6104. Crop the input video to given dimensions.
  6105. It accepts the following parameters:
  6106. @table @option
  6107. @item w, out_w
  6108. The width of the output video. It defaults to @code{iw}.
  6109. This expression is evaluated only once during the filter
  6110. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6111. @item h, out_h
  6112. The height of the output video. It defaults to @code{ih}.
  6113. This expression is evaluated only once during the filter
  6114. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6115. @item x
  6116. The horizontal position, in the input video, of the left edge of the output
  6117. video. It defaults to @code{(in_w-out_w)/2}.
  6118. This expression is evaluated per-frame.
  6119. @item y
  6120. The vertical position, in the input video, of the top edge of the output video.
  6121. It defaults to @code{(in_h-out_h)/2}.
  6122. This expression is evaluated per-frame.
  6123. @item keep_aspect
  6124. If set to 1 will force the output display aspect ratio
  6125. to be the same of the input, by changing the output sample aspect
  6126. ratio. It defaults to 0.
  6127. @item exact
  6128. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6129. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6130. It defaults to 0.
  6131. @end table
  6132. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6133. expressions containing the following constants:
  6134. @table @option
  6135. @item x
  6136. @item y
  6137. The computed values for @var{x} and @var{y}. They are evaluated for
  6138. each new frame.
  6139. @item in_w
  6140. @item in_h
  6141. The input width and height.
  6142. @item iw
  6143. @item ih
  6144. These are the same as @var{in_w} and @var{in_h}.
  6145. @item out_w
  6146. @item out_h
  6147. The output (cropped) width and height.
  6148. @item ow
  6149. @item oh
  6150. These are the same as @var{out_w} and @var{out_h}.
  6151. @item a
  6152. same as @var{iw} / @var{ih}
  6153. @item sar
  6154. input sample aspect ratio
  6155. @item dar
  6156. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6157. @item hsub
  6158. @item vsub
  6159. horizontal and vertical chroma subsample values. For example for the
  6160. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6161. @item n
  6162. The number of the input frame, starting from 0.
  6163. @item pos
  6164. the position in the file of the input frame, NAN if unknown
  6165. @item t
  6166. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6167. @end table
  6168. The expression for @var{out_w} may depend on the value of @var{out_h},
  6169. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6170. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6171. evaluated after @var{out_w} and @var{out_h}.
  6172. The @var{x} and @var{y} parameters specify the expressions for the
  6173. position of the top-left corner of the output (non-cropped) area. They
  6174. are evaluated for each frame. If the evaluated value is not valid, it
  6175. is approximated to the nearest valid value.
  6176. The expression for @var{x} may depend on @var{y}, and the expression
  6177. for @var{y} may depend on @var{x}.
  6178. @subsection Examples
  6179. @itemize
  6180. @item
  6181. Crop area with size 100x100 at position (12,34).
  6182. @example
  6183. crop=100:100:12:34
  6184. @end example
  6185. Using named options, the example above becomes:
  6186. @example
  6187. crop=w=100:h=100:x=12:y=34
  6188. @end example
  6189. @item
  6190. Crop the central input area with size 100x100:
  6191. @example
  6192. crop=100:100
  6193. @end example
  6194. @item
  6195. Crop the central input area with size 2/3 of the input video:
  6196. @example
  6197. crop=2/3*in_w:2/3*in_h
  6198. @end example
  6199. @item
  6200. Crop the input video central square:
  6201. @example
  6202. crop=out_w=in_h
  6203. crop=in_h
  6204. @end example
  6205. @item
  6206. Delimit the rectangle with the top-left corner placed at position
  6207. 100:100 and the right-bottom corner corresponding to the right-bottom
  6208. corner of the input image.
  6209. @example
  6210. crop=in_w-100:in_h-100:100:100
  6211. @end example
  6212. @item
  6213. Crop 10 pixels from the left and right borders, and 20 pixels from
  6214. the top and bottom borders
  6215. @example
  6216. crop=in_w-2*10:in_h-2*20
  6217. @end example
  6218. @item
  6219. Keep only the bottom right quarter of the input image:
  6220. @example
  6221. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6222. @end example
  6223. @item
  6224. Crop height for getting Greek harmony:
  6225. @example
  6226. crop=in_w:1/PHI*in_w
  6227. @end example
  6228. @item
  6229. Apply trembling effect:
  6230. @example
  6231. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
  6232. @end example
  6233. @item
  6234. Apply erratic camera effect depending on timestamp:
  6235. @example
  6236. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  6237. @end example
  6238. @item
  6239. Set x depending on the value of y:
  6240. @example
  6241. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6242. @end example
  6243. @end itemize
  6244. @subsection Commands
  6245. This filter supports the following commands:
  6246. @table @option
  6247. @item w, out_w
  6248. @item h, out_h
  6249. @item x
  6250. @item y
  6251. Set width/height of the output video and the horizontal/vertical position
  6252. in the input video.
  6253. The command accepts the same syntax of the corresponding option.
  6254. If the specified expression is not valid, it is kept at its current
  6255. value.
  6256. @end table
  6257. @section cropdetect
  6258. Auto-detect the crop size.
  6259. It calculates the necessary cropping parameters and prints the
  6260. recommended parameters via the logging system. The detected dimensions
  6261. correspond to the non-black area of the input video.
  6262. It accepts the following parameters:
  6263. @table @option
  6264. @item limit
  6265. Set higher black value threshold, which can be optionally specified
  6266. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6267. value greater to the set value is considered non-black. It defaults to 24.
  6268. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6269. on the bitdepth of the pixel format.
  6270. @item round
  6271. The value which the width/height should be divisible by. It defaults to
  6272. 16. The offset is automatically adjusted to center the video. Use 2 to
  6273. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6274. encoding to most video codecs.
  6275. @item reset_count, reset
  6276. Set the counter that determines after how many frames cropdetect will
  6277. reset the previously detected largest video area and start over to
  6278. detect the current optimal crop area. Default value is 0.
  6279. This can be useful when channel logos distort the video area. 0
  6280. indicates 'never reset', and returns the largest area encountered during
  6281. playback.
  6282. @end table
  6283. @anchor{cue}
  6284. @section cue
  6285. Delay video filtering until a given wallclock timestamp. The filter first
  6286. passes on @option{preroll} amount of frames, then it buffers at most
  6287. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6288. it forwards the buffered frames and also any subsequent frames coming in its
  6289. input.
  6290. The filter can be used synchronize the output of multiple ffmpeg processes for
  6291. realtime output devices like decklink. By putting the delay in the filtering
  6292. chain and pre-buffering frames the process can pass on data to output almost
  6293. immediately after the target wallclock timestamp is reached.
  6294. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6295. some use cases.
  6296. @table @option
  6297. @item cue
  6298. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6299. @item preroll
  6300. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6301. @item buffer
  6302. The maximum duration of content to buffer before waiting for the cue expressed
  6303. in seconds. Default is 0.
  6304. @end table
  6305. @anchor{curves}
  6306. @section curves
  6307. Apply color adjustments using curves.
  6308. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6309. component (red, green and blue) has its values defined by @var{N} key points
  6310. tied from each other using a smooth curve. The x-axis represents the pixel
  6311. values from the input frame, and the y-axis the new pixel values to be set for
  6312. the output frame.
  6313. By default, a component curve is defined by the two points @var{(0;0)} and
  6314. @var{(1;1)}. This creates a straight line where each original pixel value is
  6315. "adjusted" to its own value, which means no change to the image.
  6316. The filter allows you to redefine these two points and add some more. A new
  6317. curve (using a natural cubic spline interpolation) will be define to pass
  6318. smoothly through all these new coordinates. The new defined points needs to be
  6319. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6320. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6321. the vector spaces, the values will be clipped accordingly.
  6322. The filter accepts the following options:
  6323. @table @option
  6324. @item preset
  6325. Select one of the available color presets. This option can be used in addition
  6326. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6327. options takes priority on the preset values.
  6328. Available presets are:
  6329. @table @samp
  6330. @item none
  6331. @item color_negative
  6332. @item cross_process
  6333. @item darker
  6334. @item increase_contrast
  6335. @item lighter
  6336. @item linear_contrast
  6337. @item medium_contrast
  6338. @item negative
  6339. @item strong_contrast
  6340. @item vintage
  6341. @end table
  6342. Default is @code{none}.
  6343. @item master, m
  6344. Set the master key points. These points will define a second pass mapping. It
  6345. is sometimes called a "luminance" or "value" mapping. It can be used with
  6346. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6347. post-processing LUT.
  6348. @item red, r
  6349. Set the key points for the red component.
  6350. @item green, g
  6351. Set the key points for the green component.
  6352. @item blue, b
  6353. Set the key points for the blue component.
  6354. @item all
  6355. Set the key points for all components (not including master).
  6356. Can be used in addition to the other key points component
  6357. options. In this case, the unset component(s) will fallback on this
  6358. @option{all} setting.
  6359. @item psfile
  6360. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6361. @item plot
  6362. Save Gnuplot script of the curves in specified file.
  6363. @end table
  6364. To avoid some filtergraph syntax conflicts, each key points list need to be
  6365. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6366. @subsection Examples
  6367. @itemize
  6368. @item
  6369. Increase slightly the middle level of blue:
  6370. @example
  6371. curves=blue='0/0 0.5/0.58 1/1'
  6372. @end example
  6373. @item
  6374. Vintage effect:
  6375. @example
  6376. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  6377. @end example
  6378. Here we obtain the following coordinates for each components:
  6379. @table @var
  6380. @item red
  6381. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6382. @item green
  6383. @code{(0;0) (0.50;0.48) (1;1)}
  6384. @item blue
  6385. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6386. @end table
  6387. @item
  6388. The previous example can also be achieved with the associated built-in preset:
  6389. @example
  6390. curves=preset=vintage
  6391. @end example
  6392. @item
  6393. Or simply:
  6394. @example
  6395. curves=vintage
  6396. @end example
  6397. @item
  6398. Use a Photoshop preset and redefine the points of the green component:
  6399. @example
  6400. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6401. @end example
  6402. @item
  6403. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6404. and @command{gnuplot}:
  6405. @example
  6406. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6407. gnuplot -p /tmp/curves.plt
  6408. @end example
  6409. @end itemize
  6410. @section datascope
  6411. Video data analysis filter.
  6412. This filter shows hexadecimal pixel values of part of video.
  6413. The filter accepts the following options:
  6414. @table @option
  6415. @item size, s
  6416. Set output video size.
  6417. @item x
  6418. Set x offset from where to pick pixels.
  6419. @item y
  6420. Set y offset from where to pick pixels.
  6421. @item mode
  6422. Set scope mode, can be one of the following:
  6423. @table @samp
  6424. @item mono
  6425. Draw hexadecimal pixel values with white color on black background.
  6426. @item color
  6427. Draw hexadecimal pixel values with input video pixel color on black
  6428. background.
  6429. @item color2
  6430. Draw hexadecimal pixel values on color background picked from input video,
  6431. the text color is picked in such way so its always visible.
  6432. @end table
  6433. @item axis
  6434. Draw rows and columns numbers on left and top of video.
  6435. @item opacity
  6436. Set background opacity.
  6437. @end table
  6438. @section dctdnoiz
  6439. Denoise frames using 2D DCT (frequency domain filtering).
  6440. This filter is not designed for real time.
  6441. The filter accepts the following options:
  6442. @table @option
  6443. @item sigma, s
  6444. Set the noise sigma constant.
  6445. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6446. coefficient (absolute value) below this threshold with be dropped.
  6447. If you need a more advanced filtering, see @option{expr}.
  6448. Default is @code{0}.
  6449. @item overlap
  6450. Set number overlapping pixels for each block. Since the filter can be slow, you
  6451. may want to reduce this value, at the cost of a less effective filter and the
  6452. risk of various artefacts.
  6453. If the overlapping value doesn't permit processing the whole input width or
  6454. height, a warning will be displayed and according borders won't be denoised.
  6455. Default value is @var{blocksize}-1, which is the best possible setting.
  6456. @item expr, e
  6457. Set the coefficient factor expression.
  6458. For each coefficient of a DCT block, this expression will be evaluated as a
  6459. multiplier value for the coefficient.
  6460. If this is option is set, the @option{sigma} option will be ignored.
  6461. The absolute value of the coefficient can be accessed through the @var{c}
  6462. variable.
  6463. @item n
  6464. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6465. @var{blocksize}, which is the width and height of the processed blocks.
  6466. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6467. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6468. on the speed processing. Also, a larger block size does not necessarily means a
  6469. better de-noising.
  6470. @end table
  6471. @subsection Examples
  6472. Apply a denoise with a @option{sigma} of @code{4.5}:
  6473. @example
  6474. dctdnoiz=4.5
  6475. @end example
  6476. The same operation can be achieved using the expression system:
  6477. @example
  6478. dctdnoiz=e='gte(c, 4.5*3)'
  6479. @end example
  6480. Violent denoise using a block size of @code{16x16}:
  6481. @example
  6482. dctdnoiz=15:n=4
  6483. @end example
  6484. @section deband
  6485. Remove banding artifacts from input video.
  6486. It works by replacing banded pixels with average value of referenced pixels.
  6487. The filter accepts the following options:
  6488. @table @option
  6489. @item 1thr
  6490. @item 2thr
  6491. @item 3thr
  6492. @item 4thr
  6493. Set banding detection threshold for each plane. Default is 0.02.
  6494. Valid range is 0.00003 to 0.5.
  6495. If difference between current pixel and reference pixel is less than threshold,
  6496. it will be considered as banded.
  6497. @item range, r
  6498. Banding detection range in pixels. Default is 16. If positive, random number
  6499. in range 0 to set value will be used. If negative, exact absolute value
  6500. will be used.
  6501. The range defines square of four pixels around current pixel.
  6502. @item direction, d
  6503. Set direction in radians from which four pixel will be compared. If positive,
  6504. random direction from 0 to set direction will be picked. If negative, exact of
  6505. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6506. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6507. column.
  6508. @item blur, b
  6509. If enabled, current pixel is compared with average value of all four
  6510. surrounding pixels. The default is enabled. If disabled current pixel is
  6511. compared with all four surrounding pixels. The pixel is considered banded
  6512. if only all four differences with surrounding pixels are less than threshold.
  6513. @item coupling, c
  6514. If enabled, current pixel is changed if and only if all pixel components are banded,
  6515. e.g. banding detection threshold is triggered for all color components.
  6516. The default is disabled.
  6517. @end table
  6518. @section deblock
  6519. Remove blocking artifacts from input video.
  6520. The filter accepts the following options:
  6521. @table @option
  6522. @item filter
  6523. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6524. This controls what kind of deblocking is applied.
  6525. @item block
  6526. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6527. @item alpha
  6528. @item beta
  6529. @item gamma
  6530. @item delta
  6531. Set blocking detection thresholds. Allowed range is 0 to 1.
  6532. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6533. Using higher threshold gives more deblocking strength.
  6534. Setting @var{alpha} controls threshold detection at exact edge of block.
  6535. Remaining options controls threshold detection near the edge. Each one for
  6536. below/above or left/right. Setting any of those to @var{0} disables
  6537. deblocking.
  6538. @item planes
  6539. Set planes to filter. Default is to filter all available planes.
  6540. @end table
  6541. @subsection Examples
  6542. @itemize
  6543. @item
  6544. Deblock using weak filter and block size of 4 pixels.
  6545. @example
  6546. deblock=filter=weak:block=4
  6547. @end example
  6548. @item
  6549. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6550. deblocking more edges.
  6551. @example
  6552. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6553. @end example
  6554. @item
  6555. Similar as above, but filter only first plane.
  6556. @example
  6557. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6558. @end example
  6559. @item
  6560. Similar as above, but filter only second and third plane.
  6561. @example
  6562. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6563. @end example
  6564. @end itemize
  6565. @anchor{decimate}
  6566. @section decimate
  6567. Drop duplicated frames at regular intervals.
  6568. The filter accepts the following options:
  6569. @table @option
  6570. @item cycle
  6571. Set the number of frames from which one will be dropped. Setting this to
  6572. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6573. Default is @code{5}.
  6574. @item dupthresh
  6575. Set the threshold for duplicate detection. If the difference metric for a frame
  6576. is less than or equal to this value, then it is declared as duplicate. Default
  6577. is @code{1.1}
  6578. @item scthresh
  6579. Set scene change threshold. Default is @code{15}.
  6580. @item blockx
  6581. @item blocky
  6582. Set the size of the x and y-axis blocks used during metric calculations.
  6583. Larger blocks give better noise suppression, but also give worse detection of
  6584. small movements. Must be a power of two. Default is @code{32}.
  6585. @item ppsrc
  6586. Mark main input as a pre-processed input and activate clean source input
  6587. stream. This allows the input to be pre-processed with various filters to help
  6588. the metrics calculation while keeping the frame selection lossless. When set to
  6589. @code{1}, the first stream is for the pre-processed input, and the second
  6590. stream is the clean source from where the kept frames are chosen. Default is
  6591. @code{0}.
  6592. @item chroma
  6593. Set whether or not chroma is considered in the metric calculations. Default is
  6594. @code{1}.
  6595. @end table
  6596. @section deconvolve
  6597. Apply 2D deconvolution of video stream in frequency domain using second stream
  6598. as impulse.
  6599. The filter accepts the following options:
  6600. @table @option
  6601. @item planes
  6602. Set which planes to process.
  6603. @item impulse
  6604. Set which impulse video frames will be processed, can be @var{first}
  6605. or @var{all}. Default is @var{all}.
  6606. @item noise
  6607. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6608. and height are not same and not power of 2 or if stream prior to convolving
  6609. had noise.
  6610. @end table
  6611. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6612. @section dedot
  6613. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6614. It accepts the following options:
  6615. @table @option
  6616. @item m
  6617. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6618. @var{rainbows} for cross-color reduction.
  6619. @item lt
  6620. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6621. @item tl
  6622. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6623. @item tc
  6624. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6625. @item ct
  6626. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6627. @end table
  6628. @section deflate
  6629. Apply deflate effect to the video.
  6630. This filter replaces the pixel by the local(3x3) average by taking into account
  6631. only values lower than the pixel.
  6632. It accepts the following options:
  6633. @table @option
  6634. @item threshold0
  6635. @item threshold1
  6636. @item threshold2
  6637. @item threshold3
  6638. Limit the maximum change for each plane, default is 65535.
  6639. If 0, plane will remain unchanged.
  6640. @end table
  6641. @section deflicker
  6642. Remove temporal frame luminance variations.
  6643. It accepts the following options:
  6644. @table @option
  6645. @item size, s
  6646. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6647. @item mode, m
  6648. Set averaging mode to smooth temporal luminance variations.
  6649. Available values are:
  6650. @table @samp
  6651. @item am
  6652. Arithmetic mean
  6653. @item gm
  6654. Geometric mean
  6655. @item hm
  6656. Harmonic mean
  6657. @item qm
  6658. Quadratic mean
  6659. @item cm
  6660. Cubic mean
  6661. @item pm
  6662. Power mean
  6663. @item median
  6664. Median
  6665. @end table
  6666. @item bypass
  6667. Do not actually modify frame. Useful when one only wants metadata.
  6668. @end table
  6669. @section dejudder
  6670. Remove judder produced by partially interlaced telecined content.
  6671. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6672. source was partially telecined content then the output of @code{pullup,dejudder}
  6673. will have a variable frame rate. May change the recorded frame rate of the
  6674. container. Aside from that change, this filter will not affect constant frame
  6675. rate video.
  6676. The option available in this filter is:
  6677. @table @option
  6678. @item cycle
  6679. Specify the length of the window over which the judder repeats.
  6680. Accepts any integer greater than 1. Useful values are:
  6681. @table @samp
  6682. @item 4
  6683. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6684. @item 5
  6685. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6686. @item 20
  6687. If a mixture of the two.
  6688. @end table
  6689. The default is @samp{4}.
  6690. @end table
  6691. @section delogo
  6692. Suppress a TV station logo by a simple interpolation of the surrounding
  6693. pixels. Just set a rectangle covering the logo and watch it disappear
  6694. (and sometimes something even uglier appear - your mileage may vary).
  6695. It accepts the following parameters:
  6696. @table @option
  6697. @item x
  6698. @item y
  6699. Specify the top left corner coordinates of the logo. They must be
  6700. specified.
  6701. @item w
  6702. @item h
  6703. Specify the width and height of the logo to clear. They must be
  6704. specified.
  6705. @item band, t
  6706. Specify the thickness of the fuzzy edge of the rectangle (added to
  6707. @var{w} and @var{h}). The default value is 1. This option is
  6708. deprecated, setting higher values should no longer be necessary and
  6709. is not recommended.
  6710. @item show
  6711. When set to 1, a green rectangle is drawn on the screen to simplify
  6712. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6713. The default value is 0.
  6714. The rectangle is drawn on the outermost pixels which will be (partly)
  6715. replaced with interpolated values. The values of the next pixels
  6716. immediately outside this rectangle in each direction will be used to
  6717. compute the interpolated pixel values inside the rectangle.
  6718. @end table
  6719. @subsection Examples
  6720. @itemize
  6721. @item
  6722. Set a rectangle covering the area with top left corner coordinates 0,0
  6723. and size 100x77, and a band of size 10:
  6724. @example
  6725. delogo=x=0:y=0:w=100:h=77:band=10
  6726. @end example
  6727. @end itemize
  6728. @section derain
  6729. Remove the rain in the input image/video by applying the derain methods based on
  6730. convolutional neural networks. Supported models:
  6731. @itemize
  6732. @item
  6733. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6734. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6735. @end itemize
  6736. Training as well as model generation scripts are provided in
  6737. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6738. Native model files (.model) can be generated from TensorFlow model
  6739. files (.pb) by using tools/python/convert.py
  6740. The filter accepts the following options:
  6741. @table @option
  6742. @item filter_type
  6743. Specify which filter to use. This option accepts the following values:
  6744. @table @samp
  6745. @item derain
  6746. Derain filter. To conduct derain filter, you need to use a derain model.
  6747. @item dehaze
  6748. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6749. @end table
  6750. Default value is @samp{derain}.
  6751. @item dnn_backend
  6752. Specify which DNN backend to use for model loading and execution. This option accepts
  6753. the following values:
  6754. @table @samp
  6755. @item native
  6756. Native implementation of DNN loading and execution.
  6757. @item tensorflow
  6758. TensorFlow backend. To enable this backend you
  6759. need to install the TensorFlow for C library (see
  6760. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6761. @code{--enable-libtensorflow}
  6762. @end table
  6763. Default value is @samp{native}.
  6764. @item model
  6765. Set path to model file specifying network architecture and its parameters.
  6766. Note that different backends use different file formats. TensorFlow and native
  6767. backend can load files for only its format.
  6768. @end table
  6769. @section deshake
  6770. Attempt to fix small changes in horizontal and/or vertical shift. This
  6771. filter helps remove camera shake from hand-holding a camera, bumping a
  6772. tripod, moving on a vehicle, etc.
  6773. The filter accepts the following options:
  6774. @table @option
  6775. @item x
  6776. @item y
  6777. @item w
  6778. @item h
  6779. Specify a rectangular area where to limit the search for motion
  6780. vectors.
  6781. If desired the search for motion vectors can be limited to a
  6782. rectangular area of the frame defined by its top left corner, width
  6783. and height. These parameters have the same meaning as the drawbox
  6784. filter which can be used to visualise the position of the bounding
  6785. box.
  6786. This is useful when simultaneous movement of subjects within the frame
  6787. might be confused for camera motion by the motion vector search.
  6788. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6789. then the full frame is used. This allows later options to be set
  6790. without specifying the bounding box for the motion vector search.
  6791. Default - search the whole frame.
  6792. @item rx
  6793. @item ry
  6794. Specify the maximum extent of movement in x and y directions in the
  6795. range 0-64 pixels. Default 16.
  6796. @item edge
  6797. Specify how to generate pixels to fill blanks at the edge of the
  6798. frame. Available values are:
  6799. @table @samp
  6800. @item blank, 0
  6801. Fill zeroes at blank locations
  6802. @item original, 1
  6803. Original image at blank locations
  6804. @item clamp, 2
  6805. Extruded edge value at blank locations
  6806. @item mirror, 3
  6807. Mirrored edge at blank locations
  6808. @end table
  6809. Default value is @samp{mirror}.
  6810. @item blocksize
  6811. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6812. default 8.
  6813. @item contrast
  6814. Specify the contrast threshold for blocks. Only blocks with more than
  6815. the specified contrast (difference between darkest and lightest
  6816. pixels) will be considered. Range 1-255, default 125.
  6817. @item search
  6818. Specify the search strategy. Available values are:
  6819. @table @samp
  6820. @item exhaustive, 0
  6821. Set exhaustive search
  6822. @item less, 1
  6823. Set less exhaustive search.
  6824. @end table
  6825. Default value is @samp{exhaustive}.
  6826. @item filename
  6827. If set then a detailed log of the motion search is written to the
  6828. specified file.
  6829. @end table
  6830. @section despill
  6831. Remove unwanted contamination of foreground colors, caused by reflected color of
  6832. greenscreen or bluescreen.
  6833. This filter accepts the following options:
  6834. @table @option
  6835. @item type
  6836. Set what type of despill to use.
  6837. @item mix
  6838. Set how spillmap will be generated.
  6839. @item expand
  6840. Set how much to get rid of still remaining spill.
  6841. @item red
  6842. Controls amount of red in spill area.
  6843. @item green
  6844. Controls amount of green in spill area.
  6845. Should be -1 for greenscreen.
  6846. @item blue
  6847. Controls amount of blue in spill area.
  6848. Should be -1 for bluescreen.
  6849. @item brightness
  6850. Controls brightness of spill area, preserving colors.
  6851. @item alpha
  6852. Modify alpha from generated spillmap.
  6853. @end table
  6854. @section detelecine
  6855. Apply an exact inverse of the telecine operation. It requires a predefined
  6856. pattern specified using the pattern option which must be the same as that passed
  6857. to the telecine filter.
  6858. This filter accepts the following options:
  6859. @table @option
  6860. @item first_field
  6861. @table @samp
  6862. @item top, t
  6863. top field first
  6864. @item bottom, b
  6865. bottom field first
  6866. The default value is @code{top}.
  6867. @end table
  6868. @item pattern
  6869. A string of numbers representing the pulldown pattern you wish to apply.
  6870. The default value is @code{23}.
  6871. @item start_frame
  6872. A number representing position of the first frame with respect to the telecine
  6873. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6874. @end table
  6875. @section dilation
  6876. Apply dilation effect to the video.
  6877. This filter replaces the pixel by the local(3x3) maximum.
  6878. It accepts the following options:
  6879. @table @option
  6880. @item threshold0
  6881. @item threshold1
  6882. @item threshold2
  6883. @item threshold3
  6884. Limit the maximum change for each plane, default is 65535.
  6885. If 0, plane will remain unchanged.
  6886. @item coordinates
  6887. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6888. pixels are used.
  6889. Flags to local 3x3 coordinates maps like this:
  6890. 1 2 3
  6891. 4 5
  6892. 6 7 8
  6893. @end table
  6894. @section displace
  6895. Displace pixels as indicated by second and third input stream.
  6896. It takes three input streams and outputs one stream, the first input is the
  6897. source, and second and third input are displacement maps.
  6898. The second input specifies how much to displace pixels along the
  6899. x-axis, while the third input specifies how much to displace pixels
  6900. along the y-axis.
  6901. If one of displacement map streams terminates, last frame from that
  6902. displacement map will be used.
  6903. Note that once generated, displacements maps can be reused over and over again.
  6904. A description of the accepted options follows.
  6905. @table @option
  6906. @item edge
  6907. Set displace behavior for pixels that are out of range.
  6908. Available values are:
  6909. @table @samp
  6910. @item blank
  6911. Missing pixels are replaced by black pixels.
  6912. @item smear
  6913. Adjacent pixels will spread out to replace missing pixels.
  6914. @item wrap
  6915. Out of range pixels are wrapped so they point to pixels of other side.
  6916. @item mirror
  6917. Out of range pixels will be replaced with mirrored pixels.
  6918. @end table
  6919. Default is @samp{smear}.
  6920. @end table
  6921. @subsection Examples
  6922. @itemize
  6923. @item
  6924. Add ripple effect to rgb input of video size hd720:
  6925. @example
  6926. 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
  6927. @end example
  6928. @item
  6929. Add wave effect to rgb input of video size hd720:
  6930. @example
  6931. 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
  6932. @end example
  6933. @end itemize
  6934. @section dnn_processing
  6935. Do image processing with deep neural networks. Currently only AVFrame with RGB24
  6936. and BGR24 are supported, more formats will be added later.
  6937. The filter accepts the following options:
  6938. @table @option
  6939. @item dnn_backend
  6940. Specify which DNN backend to use for model loading and execution. This option accepts
  6941. the following values:
  6942. @table @samp
  6943. @item native
  6944. Native implementation of DNN loading and execution.
  6945. @item tensorflow
  6946. TensorFlow backend. To enable this backend you
  6947. need to install the TensorFlow for C library (see
  6948. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6949. @code{--enable-libtensorflow}
  6950. @end table
  6951. Default value is @samp{native}.
  6952. @item model
  6953. Set path to model file specifying network architecture and its parameters.
  6954. Note that different backends use different file formats. TensorFlow and native
  6955. backend can load files for only its format.
  6956. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  6957. @item input
  6958. Set the input name of the dnn network.
  6959. @item output
  6960. Set the output name of the dnn network.
  6961. @item fmt
  6962. Set the pixel format for the Frame. Allowed values are @code{AV_PIX_FMT_RGB24}, and @code{AV_PIX_FMT_BGR24}.
  6963. Default value is @code{AV_PIX_FMT_RGB24}.
  6964. @end table
  6965. @section drawbox
  6966. Draw a colored box on the input image.
  6967. It accepts the following parameters:
  6968. @table @option
  6969. @item x
  6970. @item y
  6971. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6972. @item width, w
  6973. @item height, h
  6974. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6975. the input width and height. It defaults to 0.
  6976. @item color, c
  6977. Specify the color of the box to write. For the general syntax of this option,
  6978. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6979. value @code{invert} is used, the box edge color is the same as the
  6980. video with inverted luma.
  6981. @item thickness, t
  6982. The expression which sets the thickness of the box edge.
  6983. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6984. See below for the list of accepted constants.
  6985. @item replace
  6986. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6987. will overwrite the video's color and alpha pixels.
  6988. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6989. @end table
  6990. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6991. following constants:
  6992. @table @option
  6993. @item dar
  6994. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6995. @item hsub
  6996. @item vsub
  6997. horizontal and vertical chroma subsample values. For example for the
  6998. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6999. @item in_h, ih
  7000. @item in_w, iw
  7001. The input width and height.
  7002. @item sar
  7003. The input sample aspect ratio.
  7004. @item x
  7005. @item y
  7006. The x and y offset coordinates where the box is drawn.
  7007. @item w
  7008. @item h
  7009. The width and height of the drawn box.
  7010. @item t
  7011. The thickness of the drawn box.
  7012. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7013. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7014. @end table
  7015. @subsection Examples
  7016. @itemize
  7017. @item
  7018. Draw a black box around the edge of the input image:
  7019. @example
  7020. drawbox
  7021. @end example
  7022. @item
  7023. Draw a box with color red and an opacity of 50%:
  7024. @example
  7025. drawbox=10:20:200:60:red@@0.5
  7026. @end example
  7027. The previous example can be specified as:
  7028. @example
  7029. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7030. @end example
  7031. @item
  7032. Fill the box with pink color:
  7033. @example
  7034. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7035. @end example
  7036. @item
  7037. Draw a 2-pixel red 2.40:1 mask:
  7038. @example
  7039. 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
  7040. @end example
  7041. @end itemize
  7042. @subsection Commands
  7043. This filter supports same commands as options.
  7044. The command accepts the same syntax of the corresponding option.
  7045. If the specified expression is not valid, it is kept at its current
  7046. value.
  7047. @anchor{drawgraph}
  7048. @section drawgraph
  7049. Draw a graph using input video metadata.
  7050. It accepts the following parameters:
  7051. @table @option
  7052. @item m1
  7053. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7054. @item fg1
  7055. Set 1st foreground color expression.
  7056. @item m2
  7057. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7058. @item fg2
  7059. Set 2nd foreground color expression.
  7060. @item m3
  7061. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7062. @item fg3
  7063. Set 3rd foreground color expression.
  7064. @item m4
  7065. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7066. @item fg4
  7067. Set 4th foreground color expression.
  7068. @item min
  7069. Set minimal value of metadata value.
  7070. @item max
  7071. Set maximal value of metadata value.
  7072. @item bg
  7073. Set graph background color. Default is white.
  7074. @item mode
  7075. Set graph mode.
  7076. Available values for mode is:
  7077. @table @samp
  7078. @item bar
  7079. @item dot
  7080. @item line
  7081. @end table
  7082. Default is @code{line}.
  7083. @item slide
  7084. Set slide mode.
  7085. Available values for slide is:
  7086. @table @samp
  7087. @item frame
  7088. Draw new frame when right border is reached.
  7089. @item replace
  7090. Replace old columns with new ones.
  7091. @item scroll
  7092. Scroll from right to left.
  7093. @item rscroll
  7094. Scroll from left to right.
  7095. @item picture
  7096. Draw single picture.
  7097. @end table
  7098. Default is @code{frame}.
  7099. @item size
  7100. Set size of graph video. For the syntax of this option, check the
  7101. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7102. The default value is @code{900x256}.
  7103. The foreground color expressions can use the following variables:
  7104. @table @option
  7105. @item MIN
  7106. Minimal value of metadata value.
  7107. @item MAX
  7108. Maximal value of metadata value.
  7109. @item VAL
  7110. Current metadata key value.
  7111. @end table
  7112. The color is defined as 0xAABBGGRR.
  7113. @end table
  7114. Example using metadata from @ref{signalstats} filter:
  7115. @example
  7116. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7117. @end example
  7118. Example using metadata from @ref{ebur128} filter:
  7119. @example
  7120. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7121. @end example
  7122. @section drawgrid
  7123. Draw a grid on the input image.
  7124. It accepts the following parameters:
  7125. @table @option
  7126. @item x
  7127. @item y
  7128. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7129. @item width, w
  7130. @item height, h
  7131. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7132. input width and height, respectively, minus @code{thickness}, so image gets
  7133. framed. Default to 0.
  7134. @item color, c
  7135. Specify the color of the grid. For the general syntax of this option,
  7136. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7137. value @code{invert} is used, the grid color is the same as the
  7138. video with inverted luma.
  7139. @item thickness, t
  7140. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7141. See below for the list of accepted constants.
  7142. @item replace
  7143. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7144. will overwrite the video's color and alpha pixels.
  7145. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7146. @end table
  7147. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7148. following constants:
  7149. @table @option
  7150. @item dar
  7151. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7152. @item hsub
  7153. @item vsub
  7154. horizontal and vertical chroma subsample values. For example for the
  7155. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7156. @item in_h, ih
  7157. @item in_w, iw
  7158. The input grid cell width and height.
  7159. @item sar
  7160. The input sample aspect ratio.
  7161. @item x
  7162. @item y
  7163. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7164. @item w
  7165. @item h
  7166. The width and height of the drawn cell.
  7167. @item t
  7168. The thickness of the drawn cell.
  7169. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7170. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7171. @end table
  7172. @subsection Examples
  7173. @itemize
  7174. @item
  7175. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7176. @example
  7177. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7178. @end example
  7179. @item
  7180. Draw a white 3x3 grid with an opacity of 50%:
  7181. @example
  7182. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7183. @end example
  7184. @end itemize
  7185. @subsection Commands
  7186. This filter supports same commands as options.
  7187. The command accepts the same syntax of the corresponding option.
  7188. If the specified expression is not valid, it is kept at its current
  7189. value.
  7190. @anchor{drawtext}
  7191. @section drawtext
  7192. Draw a text string or text from a specified file on top of a video, using the
  7193. libfreetype library.
  7194. To enable compilation of this filter, you need to configure FFmpeg with
  7195. @code{--enable-libfreetype}.
  7196. To enable default font fallback and the @var{font} option you need to
  7197. configure FFmpeg with @code{--enable-libfontconfig}.
  7198. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7199. @code{--enable-libfribidi}.
  7200. @subsection Syntax
  7201. It accepts the following parameters:
  7202. @table @option
  7203. @item box
  7204. Used to draw a box around text using the background color.
  7205. The value must be either 1 (enable) or 0 (disable).
  7206. The default value of @var{box} is 0.
  7207. @item boxborderw
  7208. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7209. The default value of @var{boxborderw} is 0.
  7210. @item boxcolor
  7211. The color to be used for drawing box around text. For the syntax of this
  7212. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7213. The default value of @var{boxcolor} is "white".
  7214. @item line_spacing
  7215. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7216. The default value of @var{line_spacing} is 0.
  7217. @item borderw
  7218. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7219. The default value of @var{borderw} is 0.
  7220. @item bordercolor
  7221. Set the color to be used for drawing border around text. For the syntax of this
  7222. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7223. The default value of @var{bordercolor} is "black".
  7224. @item expansion
  7225. Select how the @var{text} is expanded. Can be either @code{none},
  7226. @code{strftime} (deprecated) or
  7227. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7228. below for details.
  7229. @item basetime
  7230. Set a start time for the count. Value is in microseconds. Only applied
  7231. in the deprecated strftime expansion mode. To emulate in normal expansion
  7232. mode use the @code{pts} function, supplying the start time (in seconds)
  7233. as the second argument.
  7234. @item fix_bounds
  7235. If true, check and fix text coords to avoid clipping.
  7236. @item fontcolor
  7237. The color to be used for drawing fonts. For the syntax of this option, check
  7238. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7239. The default value of @var{fontcolor} is "black".
  7240. @item fontcolor_expr
  7241. String which is expanded the same way as @var{text} to obtain dynamic
  7242. @var{fontcolor} value. By default this option has empty value and is not
  7243. processed. When this option is set, it overrides @var{fontcolor} option.
  7244. @item font
  7245. The font family to be used for drawing text. By default Sans.
  7246. @item fontfile
  7247. The font file to be used for drawing text. The path must be included.
  7248. This parameter is mandatory if the fontconfig support is disabled.
  7249. @item alpha
  7250. Draw the text applying alpha blending. The value can
  7251. be a number between 0.0 and 1.0.
  7252. The expression accepts the same variables @var{x, y} as well.
  7253. The default value is 1.
  7254. Please see @var{fontcolor_expr}.
  7255. @item fontsize
  7256. The font size to be used for drawing text.
  7257. The default value of @var{fontsize} is 16.
  7258. @item text_shaping
  7259. If set to 1, attempt to shape the text (for example, reverse the order of
  7260. right-to-left text and join Arabic characters) before drawing it.
  7261. Otherwise, just draw the text exactly as given.
  7262. By default 1 (if supported).
  7263. @item ft_load_flags
  7264. The flags to be used for loading the fonts.
  7265. The flags map the corresponding flags supported by libfreetype, and are
  7266. a combination of the following values:
  7267. @table @var
  7268. @item default
  7269. @item no_scale
  7270. @item no_hinting
  7271. @item render
  7272. @item no_bitmap
  7273. @item vertical_layout
  7274. @item force_autohint
  7275. @item crop_bitmap
  7276. @item pedantic
  7277. @item ignore_global_advance_width
  7278. @item no_recurse
  7279. @item ignore_transform
  7280. @item monochrome
  7281. @item linear_design
  7282. @item no_autohint
  7283. @end table
  7284. Default value is "default".
  7285. For more information consult the documentation for the FT_LOAD_*
  7286. libfreetype flags.
  7287. @item shadowcolor
  7288. The color to be used for drawing a shadow behind the drawn text. For the
  7289. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7290. ffmpeg-utils manual,ffmpeg-utils}.
  7291. The default value of @var{shadowcolor} is "black".
  7292. @item shadowx
  7293. @item shadowy
  7294. The x and y offsets for the text shadow position with respect to the
  7295. position of the text. They can be either positive or negative
  7296. values. The default value for both is "0".
  7297. @item start_number
  7298. The starting frame number for the n/frame_num variable. The default value
  7299. is "0".
  7300. @item tabsize
  7301. The size in number of spaces to use for rendering the tab.
  7302. Default value is 4.
  7303. @item timecode
  7304. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7305. format. It can be used with or without text parameter. @var{timecode_rate}
  7306. option must be specified.
  7307. @item timecode_rate, rate, r
  7308. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7309. integer. Minimum value is "1".
  7310. Drop-frame timecode is supported for frame rates 30 & 60.
  7311. @item tc24hmax
  7312. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7313. Default is 0 (disabled).
  7314. @item text
  7315. The text string to be drawn. The text must be a sequence of UTF-8
  7316. encoded characters.
  7317. This parameter is mandatory if no file is specified with the parameter
  7318. @var{textfile}.
  7319. @item textfile
  7320. A text file containing text to be drawn. The text must be a sequence
  7321. of UTF-8 encoded characters.
  7322. This parameter is mandatory if no text string is specified with the
  7323. parameter @var{text}.
  7324. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7325. @item reload
  7326. If set to 1, the @var{textfile} will be reloaded before each frame.
  7327. Be sure to update it atomically, or it may be read partially, or even fail.
  7328. @item x
  7329. @item y
  7330. The expressions which specify the offsets where text will be drawn
  7331. within the video frame. They are relative to the top/left border of the
  7332. output image.
  7333. The default value of @var{x} and @var{y} is "0".
  7334. See below for the list of accepted constants and functions.
  7335. @end table
  7336. The parameters for @var{x} and @var{y} are expressions containing the
  7337. following constants and functions:
  7338. @table @option
  7339. @item dar
  7340. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7341. @item hsub
  7342. @item vsub
  7343. horizontal and vertical chroma subsample values. For example for the
  7344. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7345. @item line_h, lh
  7346. the height of each text line
  7347. @item main_h, h, H
  7348. the input height
  7349. @item main_w, w, W
  7350. the input width
  7351. @item max_glyph_a, ascent
  7352. the maximum distance from the baseline to the highest/upper grid
  7353. coordinate used to place a glyph outline point, for all the rendered
  7354. glyphs.
  7355. It is a positive value, due to the grid's orientation with the Y axis
  7356. upwards.
  7357. @item max_glyph_d, descent
  7358. the maximum distance from the baseline to the lowest grid coordinate
  7359. used to place a glyph outline point, for all the rendered glyphs.
  7360. This is a negative value, due to the grid's orientation, with the Y axis
  7361. upwards.
  7362. @item max_glyph_h
  7363. maximum glyph height, that is the maximum height for all the glyphs
  7364. contained in the rendered text, it is equivalent to @var{ascent} -
  7365. @var{descent}.
  7366. @item max_glyph_w
  7367. maximum glyph width, that is the maximum width for all the glyphs
  7368. contained in the rendered text
  7369. @item n
  7370. the number of input frame, starting from 0
  7371. @item rand(min, max)
  7372. return a random number included between @var{min} and @var{max}
  7373. @item sar
  7374. The input sample aspect ratio.
  7375. @item t
  7376. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7377. @item text_h, th
  7378. the height of the rendered text
  7379. @item text_w, tw
  7380. the width of the rendered text
  7381. @item x
  7382. @item y
  7383. the x and y offset coordinates where the text is drawn.
  7384. These parameters allow the @var{x} and @var{y} expressions to refer
  7385. to each other, so you can for example specify @code{y=x/dar}.
  7386. @item pict_type
  7387. A one character description of the current frame's picture type.
  7388. @item pkt_pos
  7389. The current packet's position in the input file or stream
  7390. (in bytes, from the start of the input). A value of -1 indicates
  7391. this info is not available.
  7392. @item pkt_duration
  7393. The current packet's duration, in seconds.
  7394. @item pkt_size
  7395. The current packet's size (in bytes).
  7396. @end table
  7397. @anchor{drawtext_expansion}
  7398. @subsection Text expansion
  7399. If @option{expansion} is set to @code{strftime},
  7400. the filter recognizes strftime() sequences in the provided text and
  7401. expands them accordingly. Check the documentation of strftime(). This
  7402. feature is deprecated.
  7403. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7404. If @option{expansion} is set to @code{normal} (which is the default),
  7405. the following expansion mechanism is used.
  7406. The backslash character @samp{\}, followed by any character, always expands to
  7407. the second character.
  7408. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7409. braces is a function name, possibly followed by arguments separated by ':'.
  7410. If the arguments contain special characters or delimiters (':' or '@}'),
  7411. they should be escaped.
  7412. Note that they probably must also be escaped as the value for the
  7413. @option{text} option in the filter argument string and as the filter
  7414. argument in the filtergraph description, and possibly also for the shell,
  7415. that makes up to four levels of escaping; using a text file avoids these
  7416. problems.
  7417. The following functions are available:
  7418. @table @command
  7419. @item expr, e
  7420. The expression evaluation result.
  7421. It must take one argument specifying the expression to be evaluated,
  7422. which accepts the same constants and functions as the @var{x} and
  7423. @var{y} values. Note that not all constants should be used, for
  7424. example the text size is not known when evaluating the expression, so
  7425. the constants @var{text_w} and @var{text_h} will have an undefined
  7426. value.
  7427. @item expr_int_format, eif
  7428. Evaluate the expression's value and output as formatted integer.
  7429. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7430. The second argument specifies the output format. Allowed values are @samp{x},
  7431. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7432. @code{printf} function.
  7433. The third parameter is optional and sets the number of positions taken by the output.
  7434. It can be used to add padding with zeros from the left.
  7435. @item gmtime
  7436. The time at which the filter is running, expressed in UTC.
  7437. It can accept an argument: a strftime() format string.
  7438. @item localtime
  7439. The time at which the filter is running, expressed in the local time zone.
  7440. It can accept an argument: a strftime() format string.
  7441. @item metadata
  7442. Frame metadata. Takes one or two arguments.
  7443. The first argument is mandatory and specifies the metadata key.
  7444. The second argument is optional and specifies a default value, used when the
  7445. metadata key is not found or empty.
  7446. Available metadata can be identified by inspecting entries
  7447. starting with TAG included within each frame section
  7448. printed by running @code{ffprobe -show_frames}.
  7449. String metadata generated in filters leading to
  7450. the drawtext filter are also available.
  7451. @item n, frame_num
  7452. The frame number, starting from 0.
  7453. @item pict_type
  7454. A one character description of the current picture type.
  7455. @item pts
  7456. The timestamp of the current frame.
  7457. It can take up to three arguments.
  7458. The first argument is the format of the timestamp; it defaults to @code{flt}
  7459. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7460. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7461. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7462. @code{localtime} stands for the timestamp of the frame formatted as
  7463. local time zone time.
  7464. The second argument is an offset added to the timestamp.
  7465. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7466. supplied to present the hour part of the formatted timestamp in 24h format
  7467. (00-23).
  7468. If the format is set to @code{localtime} or @code{gmtime},
  7469. a third argument may be supplied: a strftime() format string.
  7470. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7471. @end table
  7472. @subsection Commands
  7473. This filter supports altering parameters via commands:
  7474. @table @option
  7475. @item reinit
  7476. Alter existing filter parameters.
  7477. Syntax for the argument is the same as for filter invocation, e.g.
  7478. @example
  7479. fontsize=56:fontcolor=green:text='Hello World'
  7480. @end example
  7481. Full filter invocation with sendcmd would look like this:
  7482. @example
  7483. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7484. @end example
  7485. @end table
  7486. If the entire argument can't be parsed or applied as valid values then the filter will
  7487. continue with its existing parameters.
  7488. @subsection Examples
  7489. @itemize
  7490. @item
  7491. Draw "Test Text" with font FreeSerif, using the default values for the
  7492. optional parameters.
  7493. @example
  7494. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7495. @end example
  7496. @item
  7497. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7498. and y=50 (counting from the top-left corner of the screen), text is
  7499. yellow with a red box around it. Both the text and the box have an
  7500. opacity of 20%.
  7501. @example
  7502. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7503. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7504. @end example
  7505. Note that the double quotes are not necessary if spaces are not used
  7506. within the parameter list.
  7507. @item
  7508. Show the text at the center of the video frame:
  7509. @example
  7510. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7511. @end example
  7512. @item
  7513. Show the text at a random position, switching to a new position every 30 seconds:
  7514. @example
  7515. 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)"
  7516. @end example
  7517. @item
  7518. Show a text line sliding from right to left in the last row of the video
  7519. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7520. with no newlines.
  7521. @example
  7522. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7523. @end example
  7524. @item
  7525. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7526. @example
  7527. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7528. @end example
  7529. @item
  7530. Draw a single green letter "g", at the center of the input video.
  7531. The glyph baseline is placed at half screen height.
  7532. @example
  7533. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7534. @end example
  7535. @item
  7536. Show text for 1 second every 3 seconds:
  7537. @example
  7538. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7539. @end example
  7540. @item
  7541. Use fontconfig to set the font. Note that the colons need to be escaped.
  7542. @example
  7543. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7544. @end example
  7545. @item
  7546. Print the date of a real-time encoding (see strftime(3)):
  7547. @example
  7548. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7549. @end example
  7550. @item
  7551. Show text fading in and out (appearing/disappearing):
  7552. @example
  7553. #!/bin/sh
  7554. DS=1.0 # display start
  7555. DE=10.0 # display end
  7556. FID=1.5 # fade in duration
  7557. FOD=5 # fade out duration
  7558. 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 @}"
  7559. @end example
  7560. @item
  7561. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7562. and the @option{fontsize} value are included in the @option{y} offset.
  7563. @example
  7564. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7565. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7566. @end example
  7567. @end itemize
  7568. For more information about libfreetype, check:
  7569. @url{http://www.freetype.org/}.
  7570. For more information about fontconfig, check:
  7571. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7572. For more information about libfribidi, check:
  7573. @url{http://fribidi.org/}.
  7574. @section edgedetect
  7575. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7576. The filter accepts the following options:
  7577. @table @option
  7578. @item low
  7579. @item high
  7580. Set low and high threshold values used by the Canny thresholding
  7581. algorithm.
  7582. The high threshold selects the "strong" edge pixels, which are then
  7583. connected through 8-connectivity with the "weak" edge pixels selected
  7584. by the low threshold.
  7585. @var{low} and @var{high} threshold values must be chosen in the range
  7586. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7587. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7588. is @code{50/255}.
  7589. @item mode
  7590. Define the drawing mode.
  7591. @table @samp
  7592. @item wires
  7593. Draw white/gray wires on black background.
  7594. @item colormix
  7595. Mix the colors to create a paint/cartoon effect.
  7596. @item canny
  7597. Apply Canny edge detector on all selected planes.
  7598. @end table
  7599. Default value is @var{wires}.
  7600. @item planes
  7601. Select planes for filtering. By default all available planes are filtered.
  7602. @end table
  7603. @subsection Examples
  7604. @itemize
  7605. @item
  7606. Standard edge detection with custom values for the hysteresis thresholding:
  7607. @example
  7608. edgedetect=low=0.1:high=0.4
  7609. @end example
  7610. @item
  7611. Painting effect without thresholding:
  7612. @example
  7613. edgedetect=mode=colormix:high=0
  7614. @end example
  7615. @end itemize
  7616. @section elbg
  7617. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7618. For each input image, the filter will compute the optimal mapping from
  7619. the input to the output given the codebook length, that is the number
  7620. of distinct output colors.
  7621. This filter accepts the following options.
  7622. @table @option
  7623. @item codebook_length, l
  7624. Set codebook length. The value must be a positive integer, and
  7625. represents the number of distinct output colors. Default value is 256.
  7626. @item nb_steps, n
  7627. Set the maximum number of iterations to apply for computing the optimal
  7628. mapping. The higher the value the better the result and the higher the
  7629. computation time. Default value is 1.
  7630. @item seed, s
  7631. Set a random seed, must be an integer included between 0 and
  7632. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7633. will try to use a good random seed on a best effort basis.
  7634. @item pal8
  7635. Set pal8 output pixel format. This option does not work with codebook
  7636. length greater than 256.
  7637. @end table
  7638. @section entropy
  7639. Measure graylevel entropy in histogram of color channels of video frames.
  7640. It accepts the following parameters:
  7641. @table @option
  7642. @item mode
  7643. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7644. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7645. between neighbour histogram values.
  7646. @end table
  7647. @section eq
  7648. Set brightness, contrast, saturation and approximate gamma adjustment.
  7649. The filter accepts the following options:
  7650. @table @option
  7651. @item contrast
  7652. Set the contrast expression. The value must be a float value in range
  7653. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7654. @item brightness
  7655. Set the brightness expression. The value must be a float value in
  7656. range @code{-1.0} to @code{1.0}. The default value is "0".
  7657. @item saturation
  7658. Set the saturation expression. The value must be a float in
  7659. range @code{0.0} to @code{3.0}. The default value is "1".
  7660. @item gamma
  7661. Set the gamma expression. The value must be a float in range
  7662. @code{0.1} to @code{10.0}. The default value is "1".
  7663. @item gamma_r
  7664. Set the gamma expression for red. The value must be a float in
  7665. range @code{0.1} to @code{10.0}. The default value is "1".
  7666. @item gamma_g
  7667. Set the gamma expression for green. The value must be a float in range
  7668. @code{0.1} to @code{10.0}. The default value is "1".
  7669. @item gamma_b
  7670. Set the gamma expression for blue. The value must be a float in range
  7671. @code{0.1} to @code{10.0}. The default value is "1".
  7672. @item gamma_weight
  7673. Set the gamma weight expression. It can be used to reduce the effect
  7674. of a high gamma value on bright image areas, e.g. keep them from
  7675. getting overamplified and just plain white. The value must be a float
  7676. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7677. gamma correction all the way down while @code{1.0} leaves it at its
  7678. full strength. Default is "1".
  7679. @item eval
  7680. Set when the expressions for brightness, contrast, saturation and
  7681. gamma expressions are evaluated.
  7682. It accepts the following values:
  7683. @table @samp
  7684. @item init
  7685. only evaluate expressions once during the filter initialization or
  7686. when a command is processed
  7687. @item frame
  7688. evaluate expressions for each incoming frame
  7689. @end table
  7690. Default value is @samp{init}.
  7691. @end table
  7692. The expressions accept the following parameters:
  7693. @table @option
  7694. @item n
  7695. frame count of the input frame starting from 0
  7696. @item pos
  7697. byte position of the corresponding packet in the input file, NAN if
  7698. unspecified
  7699. @item r
  7700. frame rate of the input video, NAN if the input frame rate is unknown
  7701. @item t
  7702. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7703. @end table
  7704. @subsection Commands
  7705. The filter supports the following commands:
  7706. @table @option
  7707. @item contrast
  7708. Set the contrast expression.
  7709. @item brightness
  7710. Set the brightness expression.
  7711. @item saturation
  7712. Set the saturation expression.
  7713. @item gamma
  7714. Set the gamma expression.
  7715. @item gamma_r
  7716. Set the gamma_r expression.
  7717. @item gamma_g
  7718. Set gamma_g expression.
  7719. @item gamma_b
  7720. Set gamma_b expression.
  7721. @item gamma_weight
  7722. Set gamma_weight expression.
  7723. The command accepts the same syntax of the corresponding option.
  7724. If the specified expression is not valid, it is kept at its current
  7725. value.
  7726. @end table
  7727. @section erosion
  7728. Apply erosion effect to the video.
  7729. This filter replaces the pixel by the local(3x3) minimum.
  7730. It accepts the following options:
  7731. @table @option
  7732. @item threshold0
  7733. @item threshold1
  7734. @item threshold2
  7735. @item threshold3
  7736. Limit the maximum change for each plane, default is 65535.
  7737. If 0, plane will remain unchanged.
  7738. @item coordinates
  7739. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7740. pixels are used.
  7741. Flags to local 3x3 coordinates maps like this:
  7742. 1 2 3
  7743. 4 5
  7744. 6 7 8
  7745. @end table
  7746. @section extractplanes
  7747. Extract color channel components from input video stream into
  7748. separate grayscale video streams.
  7749. The filter accepts the following option:
  7750. @table @option
  7751. @item planes
  7752. Set plane(s) to extract.
  7753. Available values for planes are:
  7754. @table @samp
  7755. @item y
  7756. @item u
  7757. @item v
  7758. @item a
  7759. @item r
  7760. @item g
  7761. @item b
  7762. @end table
  7763. Choosing planes not available in the input will result in an error.
  7764. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7765. with @code{y}, @code{u}, @code{v} planes at same time.
  7766. @end table
  7767. @subsection Examples
  7768. @itemize
  7769. @item
  7770. Extract luma, u and v color channel component from input video frame
  7771. into 3 grayscale outputs:
  7772. @example
  7773. 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
  7774. @end example
  7775. @end itemize
  7776. @section fade
  7777. Apply a fade-in/out effect to the input video.
  7778. It accepts the following parameters:
  7779. @table @option
  7780. @item type, t
  7781. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7782. effect.
  7783. Default is @code{in}.
  7784. @item start_frame, s
  7785. Specify the number of the frame to start applying the fade
  7786. effect at. Default is 0.
  7787. @item nb_frames, n
  7788. The number of frames that the fade effect lasts. At the end of the
  7789. fade-in effect, the output video will have the same intensity as the input video.
  7790. At the end of the fade-out transition, the output video will be filled with the
  7791. selected @option{color}.
  7792. Default is 25.
  7793. @item alpha
  7794. If set to 1, fade only alpha channel, if one exists on the input.
  7795. Default value is 0.
  7796. @item start_time, st
  7797. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7798. effect. If both start_frame and start_time are specified, the fade will start at
  7799. whichever comes last. Default is 0.
  7800. @item duration, d
  7801. The number of seconds for which the fade effect has to last. At the end of the
  7802. fade-in effect the output video will have the same intensity as the input video,
  7803. at the end of the fade-out transition the output video will be filled with the
  7804. selected @option{color}.
  7805. If both duration and nb_frames are specified, duration is used. Default is 0
  7806. (nb_frames is used by default).
  7807. @item color, c
  7808. Specify the color of the fade. Default is "black".
  7809. @end table
  7810. @subsection Examples
  7811. @itemize
  7812. @item
  7813. Fade in the first 30 frames of video:
  7814. @example
  7815. fade=in:0:30
  7816. @end example
  7817. The command above is equivalent to:
  7818. @example
  7819. fade=t=in:s=0:n=30
  7820. @end example
  7821. @item
  7822. Fade out the last 45 frames of a 200-frame video:
  7823. @example
  7824. fade=out:155:45
  7825. fade=type=out:start_frame=155:nb_frames=45
  7826. @end example
  7827. @item
  7828. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7829. @example
  7830. fade=in:0:25, fade=out:975:25
  7831. @end example
  7832. @item
  7833. Make the first 5 frames yellow, then fade in from frame 5-24:
  7834. @example
  7835. fade=in:5:20:color=yellow
  7836. @end example
  7837. @item
  7838. Fade in alpha over first 25 frames of video:
  7839. @example
  7840. fade=in:0:25:alpha=1
  7841. @end example
  7842. @item
  7843. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7844. @example
  7845. fade=t=in:st=5.5:d=0.5
  7846. @end example
  7847. @end itemize
  7848. @section fftdnoiz
  7849. Denoise frames using 3D FFT (frequency domain filtering).
  7850. The filter accepts the following options:
  7851. @table @option
  7852. @item sigma
  7853. Set the noise sigma constant. This sets denoising strength.
  7854. Default value is 1. Allowed range is from 0 to 30.
  7855. Using very high sigma with low overlap may give blocking artifacts.
  7856. @item amount
  7857. Set amount of denoising. By default all detected noise is reduced.
  7858. Default value is 1. Allowed range is from 0 to 1.
  7859. @item block
  7860. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7861. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7862. block size in pixels is 2^4 which is 16.
  7863. @item overlap
  7864. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7865. @item prev
  7866. Set number of previous frames to use for denoising. By default is set to 0.
  7867. @item next
  7868. Set number of next frames to to use for denoising. By default is set to 0.
  7869. @item planes
  7870. Set planes which will be filtered, by default are all available filtered
  7871. except alpha.
  7872. @end table
  7873. @section fftfilt
  7874. Apply arbitrary expressions to samples in frequency domain
  7875. @table @option
  7876. @item dc_Y
  7877. Adjust the dc value (gain) of the luma plane of the image. The filter
  7878. accepts an integer value in range @code{0} to @code{1000}. The default
  7879. value is set to @code{0}.
  7880. @item dc_U
  7881. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7882. filter accepts an integer value in range @code{0} to @code{1000}. The
  7883. default value is set to @code{0}.
  7884. @item dc_V
  7885. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7886. filter accepts an integer value in range @code{0} to @code{1000}. The
  7887. default value is set to @code{0}.
  7888. @item weight_Y
  7889. Set the frequency domain weight expression for the luma plane.
  7890. @item weight_U
  7891. Set the frequency domain weight expression for the 1st chroma plane.
  7892. @item weight_V
  7893. Set the frequency domain weight expression for the 2nd chroma plane.
  7894. @item eval
  7895. Set when the expressions are evaluated.
  7896. It accepts the following values:
  7897. @table @samp
  7898. @item init
  7899. Only evaluate expressions once during the filter initialization.
  7900. @item frame
  7901. Evaluate expressions for each incoming frame.
  7902. @end table
  7903. Default value is @samp{init}.
  7904. The filter accepts the following variables:
  7905. @item X
  7906. @item Y
  7907. The coordinates of the current sample.
  7908. @item W
  7909. @item H
  7910. The width and height of the image.
  7911. @item N
  7912. The number of input frame, starting from 0.
  7913. @end table
  7914. @subsection Examples
  7915. @itemize
  7916. @item
  7917. High-pass:
  7918. @example
  7919. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7920. @end example
  7921. @item
  7922. Low-pass:
  7923. @example
  7924. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7925. @end example
  7926. @item
  7927. Sharpen:
  7928. @example
  7929. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7930. @end example
  7931. @item
  7932. Blur:
  7933. @example
  7934. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7935. @end example
  7936. @end itemize
  7937. @section field
  7938. Extract a single field from an interlaced image using stride
  7939. arithmetic to avoid wasting CPU time. The output frames are marked as
  7940. non-interlaced.
  7941. The filter accepts the following options:
  7942. @table @option
  7943. @item type
  7944. Specify whether to extract the top (if the value is @code{0} or
  7945. @code{top}) or the bottom field (if the value is @code{1} or
  7946. @code{bottom}).
  7947. @end table
  7948. @section fieldhint
  7949. Create new frames by copying the top and bottom fields from surrounding frames
  7950. supplied as numbers by the hint file.
  7951. @table @option
  7952. @item hint
  7953. Set file containing hints: absolute/relative frame numbers.
  7954. There must be one line for each frame in a clip. Each line must contain two
  7955. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7956. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7957. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7958. for @code{relative} mode. First number tells from which frame to pick up top
  7959. field and second number tells from which frame to pick up bottom field.
  7960. If optionally followed by @code{+} output frame will be marked as interlaced,
  7961. else if followed by @code{-} output frame will be marked as progressive, else
  7962. it will be marked same as input frame.
  7963. If optionally followed by @code{t} output frame will use only top field, or in
  7964. case of @code{b} it will use only bottom field.
  7965. If line starts with @code{#} or @code{;} that line is skipped.
  7966. @item mode
  7967. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7968. @end table
  7969. Example of first several lines of @code{hint} file for @code{relative} mode:
  7970. @example
  7971. 0,0 - # first frame
  7972. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7973. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7974. 1,0 -
  7975. 0,0 -
  7976. 0,0 -
  7977. 1,0 -
  7978. 1,0 -
  7979. 1,0 -
  7980. 0,0 -
  7981. 0,0 -
  7982. 1,0 -
  7983. 1,0 -
  7984. 1,0 -
  7985. 0,0 -
  7986. @end example
  7987. @section fieldmatch
  7988. Field matching filter for inverse telecine. It is meant to reconstruct the
  7989. progressive frames from a telecined stream. The filter does not drop duplicated
  7990. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7991. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7992. The separation of the field matching and the decimation is notably motivated by
  7993. the possibility of inserting a de-interlacing filter fallback between the two.
  7994. If the source has mixed telecined and real interlaced content,
  7995. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7996. But these remaining combed frames will be marked as interlaced, and thus can be
  7997. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7998. In addition to the various configuration options, @code{fieldmatch} can take an
  7999. optional second stream, activated through the @option{ppsrc} option. If
  8000. enabled, the frames reconstruction will be based on the fields and frames from
  8001. this second stream. This allows the first input to be pre-processed in order to
  8002. help the various algorithms of the filter, while keeping the output lossless
  8003. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8004. or brightness/contrast adjustments can help.
  8005. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8006. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8007. which @code{fieldmatch} is based on. While the semantic and usage are very
  8008. close, some behaviour and options names can differ.
  8009. The @ref{decimate} filter currently only works for constant frame rate input.
  8010. If your input has mixed telecined (30fps) and progressive content with a lower
  8011. framerate like 24fps use the following filterchain to produce the necessary cfr
  8012. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8013. The filter accepts the following options:
  8014. @table @option
  8015. @item order
  8016. Specify the assumed field order of the input stream. Available values are:
  8017. @table @samp
  8018. @item auto
  8019. Auto detect parity (use FFmpeg's internal parity value).
  8020. @item bff
  8021. Assume bottom field first.
  8022. @item tff
  8023. Assume top field first.
  8024. @end table
  8025. Note that it is sometimes recommended not to trust the parity announced by the
  8026. stream.
  8027. Default value is @var{auto}.
  8028. @item mode
  8029. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8030. sense that it won't risk creating jerkiness due to duplicate frames when
  8031. possible, but if there are bad edits or blended fields it will end up
  8032. outputting combed frames when a good match might actually exist. On the other
  8033. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8034. but will almost always find a good frame if there is one. The other values are
  8035. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8036. jerkiness and creating duplicate frames versus finding good matches in sections
  8037. with bad edits, orphaned fields, blended fields, etc.
  8038. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8039. Available values are:
  8040. @table @samp
  8041. @item pc
  8042. 2-way matching (p/c)
  8043. @item pc_n
  8044. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8045. @item pc_u
  8046. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8047. @item pc_n_ub
  8048. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8049. still combed (p/c + n + u/b)
  8050. @item pcn
  8051. 3-way matching (p/c/n)
  8052. @item pcn_ub
  8053. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8054. detected as combed (p/c/n + u/b)
  8055. @end table
  8056. The parenthesis at the end indicate the matches that would be used for that
  8057. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8058. @var{top}).
  8059. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8060. the slowest.
  8061. Default value is @var{pc_n}.
  8062. @item ppsrc
  8063. Mark the main input stream as a pre-processed input, and enable the secondary
  8064. input stream as the clean source to pick the fields from. See the filter
  8065. introduction for more details. It is similar to the @option{clip2} feature from
  8066. VFM/TFM.
  8067. Default value is @code{0} (disabled).
  8068. @item field
  8069. Set the field to match from. It is recommended to set this to the same value as
  8070. @option{order} unless you experience matching failures with that setting. In
  8071. certain circumstances changing the field that is used to match from can have a
  8072. large impact on matching performance. Available values are:
  8073. @table @samp
  8074. @item auto
  8075. Automatic (same value as @option{order}).
  8076. @item bottom
  8077. Match from the bottom field.
  8078. @item top
  8079. Match from the top field.
  8080. @end table
  8081. Default value is @var{auto}.
  8082. @item mchroma
  8083. Set whether or not chroma is included during the match comparisons. In most
  8084. cases it is recommended to leave this enabled. You should set this to @code{0}
  8085. only if your clip has bad chroma problems such as heavy rainbowing or other
  8086. artifacts. Setting this to @code{0} could also be used to speed things up at
  8087. the cost of some accuracy.
  8088. Default value is @code{1}.
  8089. @item y0
  8090. @item y1
  8091. These define an exclusion band which excludes the lines between @option{y0} and
  8092. @option{y1} from being included in the field matching decision. An exclusion
  8093. band can be used to ignore subtitles, a logo, or other things that may
  8094. interfere with the matching. @option{y0} sets the starting scan line and
  8095. @option{y1} sets the ending line; all lines in between @option{y0} and
  8096. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8097. @option{y0} and @option{y1} to the same value will disable the feature.
  8098. @option{y0} and @option{y1} defaults to @code{0}.
  8099. @item scthresh
  8100. Set the scene change detection threshold as a percentage of maximum change on
  8101. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8102. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8103. @option{scthresh} is @code{[0.0, 100.0]}.
  8104. Default value is @code{12.0}.
  8105. @item combmatch
  8106. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8107. account the combed scores of matches when deciding what match to use as the
  8108. final match. Available values are:
  8109. @table @samp
  8110. @item none
  8111. No final matching based on combed scores.
  8112. @item sc
  8113. Combed scores are only used when a scene change is detected.
  8114. @item full
  8115. Use combed scores all the time.
  8116. @end table
  8117. Default is @var{sc}.
  8118. @item combdbg
  8119. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8120. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8121. Available values are:
  8122. @table @samp
  8123. @item none
  8124. No forced calculation.
  8125. @item pcn
  8126. Force p/c/n calculations.
  8127. @item pcnub
  8128. Force p/c/n/u/b calculations.
  8129. @end table
  8130. Default value is @var{none}.
  8131. @item cthresh
  8132. This is the area combing threshold used for combed frame detection. This
  8133. essentially controls how "strong" or "visible" combing must be to be detected.
  8134. Larger values mean combing must be more visible and smaller values mean combing
  8135. can be less visible or strong and still be detected. Valid settings are from
  8136. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8137. be detected as combed). This is basically a pixel difference value. A good
  8138. range is @code{[8, 12]}.
  8139. Default value is @code{9}.
  8140. @item chroma
  8141. Sets whether or not chroma is considered in the combed frame decision. Only
  8142. disable this if your source has chroma problems (rainbowing, etc.) that are
  8143. causing problems for the combed frame detection with chroma enabled. Actually,
  8144. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8145. where there is chroma only combing in the source.
  8146. Default value is @code{0}.
  8147. @item blockx
  8148. @item blocky
  8149. Respectively set the x-axis and y-axis size of the window used during combed
  8150. frame detection. This has to do with the size of the area in which
  8151. @option{combpel} pixels are required to be detected as combed for a frame to be
  8152. declared combed. See the @option{combpel} parameter description for more info.
  8153. Possible values are any number that is a power of 2 starting at 4 and going up
  8154. to 512.
  8155. Default value is @code{16}.
  8156. @item combpel
  8157. The number of combed pixels inside any of the @option{blocky} by
  8158. @option{blockx} size blocks on the frame for the frame to be detected as
  8159. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8160. setting controls "how much" combing there must be in any localized area (a
  8161. window defined by the @option{blockx} and @option{blocky} settings) on the
  8162. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8163. which point no frames will ever be detected as combed). This setting is known
  8164. as @option{MI} in TFM/VFM vocabulary.
  8165. Default value is @code{80}.
  8166. @end table
  8167. @anchor{p/c/n/u/b meaning}
  8168. @subsection p/c/n/u/b meaning
  8169. @subsubsection p/c/n
  8170. We assume the following telecined stream:
  8171. @example
  8172. Top fields: 1 2 2 3 4
  8173. Bottom fields: 1 2 3 4 4
  8174. @end example
  8175. The numbers correspond to the progressive frame the fields relate to. Here, the
  8176. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8177. When @code{fieldmatch} is configured to run a matching from bottom
  8178. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8179. @example
  8180. Input stream:
  8181. T 1 2 2 3 4
  8182. B 1 2 3 4 4 <-- matching reference
  8183. Matches: c c n n c
  8184. Output stream:
  8185. T 1 2 3 4 4
  8186. B 1 2 3 4 4
  8187. @end example
  8188. As a result of the field matching, we can see that some frames get duplicated.
  8189. To perform a complete inverse telecine, you need to rely on a decimation filter
  8190. after this operation. See for instance the @ref{decimate} filter.
  8191. The same operation now matching from top fields (@option{field}=@var{top})
  8192. looks like this:
  8193. @example
  8194. Input stream:
  8195. T 1 2 2 3 4 <-- matching reference
  8196. B 1 2 3 4 4
  8197. Matches: c c p p c
  8198. Output stream:
  8199. T 1 2 2 3 4
  8200. B 1 2 2 3 4
  8201. @end example
  8202. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8203. basically, they refer to the frame and field of the opposite parity:
  8204. @itemize
  8205. @item @var{p} matches the field of the opposite parity in the previous frame
  8206. @item @var{c} matches the field of the opposite parity in the current frame
  8207. @item @var{n} matches the field of the opposite parity in the next frame
  8208. @end itemize
  8209. @subsubsection u/b
  8210. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8211. from the opposite parity flag. In the following examples, we assume that we are
  8212. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8213. 'x' is placed above and below each matched fields.
  8214. With bottom matching (@option{field}=@var{bottom}):
  8215. @example
  8216. Match: c p n b u
  8217. x x x x x
  8218. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8219. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8220. x x x x x
  8221. Output frames:
  8222. 2 1 2 2 2
  8223. 2 2 2 1 3
  8224. @end example
  8225. With top matching (@option{field}=@var{top}):
  8226. @example
  8227. Match: c p n b u
  8228. x x x x x
  8229. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8230. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8231. x x x x x
  8232. Output frames:
  8233. 2 2 2 1 2
  8234. 2 1 3 2 2
  8235. @end example
  8236. @subsection Examples
  8237. Simple IVTC of a top field first telecined stream:
  8238. @example
  8239. fieldmatch=order=tff:combmatch=none, decimate
  8240. @end example
  8241. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8242. @example
  8243. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8244. @end example
  8245. @section fieldorder
  8246. Transform the field order of the input video.
  8247. It accepts the following parameters:
  8248. @table @option
  8249. @item order
  8250. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8251. for bottom field first.
  8252. @end table
  8253. The default value is @samp{tff}.
  8254. The transformation is done by shifting the picture content up or down
  8255. by one line, and filling the remaining line with appropriate picture content.
  8256. This method is consistent with most broadcast field order converters.
  8257. If the input video is not flagged as being interlaced, or it is already
  8258. flagged as being of the required output field order, then this filter does
  8259. not alter the incoming video.
  8260. It is very useful when converting to or from PAL DV material,
  8261. which is bottom field first.
  8262. For example:
  8263. @example
  8264. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8265. @end example
  8266. @section fifo, afifo
  8267. Buffer input images and send them when they are requested.
  8268. It is mainly useful when auto-inserted by the libavfilter
  8269. framework.
  8270. It does not take parameters.
  8271. @section fillborders
  8272. Fill borders of the input video, without changing video stream dimensions.
  8273. Sometimes video can have garbage at the four edges and you may not want to
  8274. crop video input to keep size multiple of some number.
  8275. This filter accepts the following options:
  8276. @table @option
  8277. @item left
  8278. Number of pixels to fill from left border.
  8279. @item right
  8280. Number of pixels to fill from right border.
  8281. @item top
  8282. Number of pixels to fill from top border.
  8283. @item bottom
  8284. Number of pixels to fill from bottom border.
  8285. @item mode
  8286. Set fill mode.
  8287. It accepts the following values:
  8288. @table @samp
  8289. @item smear
  8290. fill pixels using outermost pixels
  8291. @item mirror
  8292. fill pixels using mirroring
  8293. @item fixed
  8294. fill pixels with constant value
  8295. @end table
  8296. Default is @var{smear}.
  8297. @item color
  8298. Set color for pixels in fixed mode. Default is @var{black}.
  8299. @end table
  8300. @subsection Commands
  8301. This filter supports same @ref{commands} as options.
  8302. The command accepts the same syntax of the corresponding option.
  8303. If the specified expression is not valid, it is kept at its current
  8304. value.
  8305. @section find_rect
  8306. Find a rectangular object
  8307. It accepts the following options:
  8308. @table @option
  8309. @item object
  8310. Filepath of the object image, needs to be in gray8.
  8311. @item threshold
  8312. Detection threshold, default is 0.5.
  8313. @item mipmaps
  8314. Number of mipmaps, default is 3.
  8315. @item xmin, ymin, xmax, ymax
  8316. Specifies the rectangle in which to search.
  8317. @end table
  8318. @subsection Examples
  8319. @itemize
  8320. @item
  8321. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8322. @example
  8323. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8324. @end example
  8325. @end itemize
  8326. @section floodfill
  8327. Flood area with values of same pixel components with another values.
  8328. It accepts the following options:
  8329. @table @option
  8330. @item x
  8331. Set pixel x coordinate.
  8332. @item y
  8333. Set pixel y coordinate.
  8334. @item s0
  8335. Set source #0 component value.
  8336. @item s1
  8337. Set source #1 component value.
  8338. @item s2
  8339. Set source #2 component value.
  8340. @item s3
  8341. Set source #3 component value.
  8342. @item d0
  8343. Set destination #0 component value.
  8344. @item d1
  8345. Set destination #1 component value.
  8346. @item d2
  8347. Set destination #2 component value.
  8348. @item d3
  8349. Set destination #3 component value.
  8350. @end table
  8351. @anchor{format}
  8352. @section format
  8353. Convert the input video to one of the specified pixel formats.
  8354. Libavfilter will try to pick one that is suitable as input to
  8355. the next filter.
  8356. It accepts the following parameters:
  8357. @table @option
  8358. @item pix_fmts
  8359. A '|'-separated list of pixel format names, such as
  8360. "pix_fmts=yuv420p|monow|rgb24".
  8361. @end table
  8362. @subsection Examples
  8363. @itemize
  8364. @item
  8365. Convert the input video to the @var{yuv420p} format
  8366. @example
  8367. format=pix_fmts=yuv420p
  8368. @end example
  8369. Convert the input video to any of the formats in the list
  8370. @example
  8371. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8372. @end example
  8373. @end itemize
  8374. @anchor{fps}
  8375. @section fps
  8376. Convert the video to specified constant frame rate by duplicating or dropping
  8377. frames as necessary.
  8378. It accepts the following parameters:
  8379. @table @option
  8380. @item fps
  8381. The desired output frame rate. The default is @code{25}.
  8382. @item start_time
  8383. Assume the first PTS should be the given value, in seconds. This allows for
  8384. padding/trimming at the start of stream. By default, no assumption is made
  8385. about the first frame's expected PTS, so no padding or trimming is done.
  8386. For example, this could be set to 0 to pad the beginning with duplicates of
  8387. the first frame if a video stream starts after the audio stream or to trim any
  8388. frames with a negative PTS.
  8389. @item round
  8390. Timestamp (PTS) rounding method.
  8391. Possible values are:
  8392. @table @option
  8393. @item zero
  8394. round towards 0
  8395. @item inf
  8396. round away from 0
  8397. @item down
  8398. round towards -infinity
  8399. @item up
  8400. round towards +infinity
  8401. @item near
  8402. round to nearest
  8403. @end table
  8404. The default is @code{near}.
  8405. @item eof_action
  8406. Action performed when reading the last frame.
  8407. Possible values are:
  8408. @table @option
  8409. @item round
  8410. Use same timestamp rounding method as used for other frames.
  8411. @item pass
  8412. Pass through last frame if input duration has not been reached yet.
  8413. @end table
  8414. The default is @code{round}.
  8415. @end table
  8416. Alternatively, the options can be specified as a flat string:
  8417. @var{fps}[:@var{start_time}[:@var{round}]].
  8418. See also the @ref{setpts} filter.
  8419. @subsection Examples
  8420. @itemize
  8421. @item
  8422. A typical usage in order to set the fps to 25:
  8423. @example
  8424. fps=fps=25
  8425. @end example
  8426. @item
  8427. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8428. @example
  8429. fps=fps=film:round=near
  8430. @end example
  8431. @end itemize
  8432. @section framepack
  8433. Pack two different video streams into a stereoscopic video, setting proper
  8434. metadata on supported codecs. The two views should have the same size and
  8435. framerate and processing will stop when the shorter video ends. Please note
  8436. that you may conveniently adjust view properties with the @ref{scale} and
  8437. @ref{fps} filters.
  8438. It accepts the following parameters:
  8439. @table @option
  8440. @item format
  8441. The desired packing format. Supported values are:
  8442. @table @option
  8443. @item sbs
  8444. The views are next to each other (default).
  8445. @item tab
  8446. The views are on top of each other.
  8447. @item lines
  8448. The views are packed by line.
  8449. @item columns
  8450. The views are packed by column.
  8451. @item frameseq
  8452. The views are temporally interleaved.
  8453. @end table
  8454. @end table
  8455. Some examples:
  8456. @example
  8457. # Convert left and right views into a frame-sequential video
  8458. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8459. # Convert views into a side-by-side video with the same output resolution as the input
  8460. 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
  8461. @end example
  8462. @section framerate
  8463. Change the frame rate by interpolating new video output frames from the source
  8464. frames.
  8465. This filter is not designed to function correctly with interlaced media. If
  8466. you wish to change the frame rate of interlaced media then you are required
  8467. to deinterlace before this filter and re-interlace after this filter.
  8468. A description of the accepted options follows.
  8469. @table @option
  8470. @item fps
  8471. Specify the output frames per second. This option can also be specified
  8472. as a value alone. The default is @code{50}.
  8473. @item interp_start
  8474. Specify the start of a range where the output frame will be created as a
  8475. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8476. the default is @code{15}.
  8477. @item interp_end
  8478. Specify the end of a range where the output frame will be created as a
  8479. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8480. the default is @code{240}.
  8481. @item scene
  8482. Specify the level at which a scene change is detected as a value between
  8483. 0 and 100 to indicate a new scene; a low value reflects a low
  8484. probability for the current frame to introduce a new scene, while a higher
  8485. value means the current frame is more likely to be one.
  8486. The default is @code{8.2}.
  8487. @item flags
  8488. Specify flags influencing the filter process.
  8489. Available value for @var{flags} is:
  8490. @table @option
  8491. @item scene_change_detect, scd
  8492. Enable scene change detection using the value of the option @var{scene}.
  8493. This flag is enabled by default.
  8494. @end table
  8495. @end table
  8496. @section framestep
  8497. Select one frame every N-th frame.
  8498. This filter accepts the following option:
  8499. @table @option
  8500. @item step
  8501. Select frame after every @code{step} frames.
  8502. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8503. @end table
  8504. @section freezedetect
  8505. Detect frozen video.
  8506. This filter logs a message and sets frame metadata when it detects that the
  8507. input video has no significant change in content during a specified duration.
  8508. Video freeze detection calculates the mean average absolute difference of all
  8509. the components of video frames and compares it to a noise floor.
  8510. The printed times and duration are expressed in seconds. The
  8511. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8512. whose timestamp equals or exceeds the detection duration and it contains the
  8513. timestamp of the first frame of the freeze. The
  8514. @code{lavfi.freezedetect.freeze_duration} and
  8515. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8516. after the freeze.
  8517. The filter accepts the following options:
  8518. @table @option
  8519. @item noise, n
  8520. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8521. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8522. 0.001.
  8523. @item duration, d
  8524. Set freeze duration until notification (default is 2 seconds).
  8525. @end table
  8526. @anchor{frei0r}
  8527. @section frei0r
  8528. Apply a frei0r effect to the input video.
  8529. To enable the compilation of this filter, you need to install the frei0r
  8530. header and configure FFmpeg with @code{--enable-frei0r}.
  8531. It accepts the following parameters:
  8532. @table @option
  8533. @item filter_name
  8534. The name of the frei0r effect to load. If the environment variable
  8535. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8536. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8537. Otherwise, the standard frei0r paths are searched, in this order:
  8538. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8539. @file{/usr/lib/frei0r-1/}.
  8540. @item filter_params
  8541. A '|'-separated list of parameters to pass to the frei0r effect.
  8542. @end table
  8543. A frei0r effect parameter can be a boolean (its value is either
  8544. "y" or "n"), a double, a color (specified as
  8545. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8546. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8547. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8548. a position (specified as @var{X}/@var{Y}, where
  8549. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8550. The number and types of parameters depend on the loaded effect. If an
  8551. effect parameter is not specified, the default value is set.
  8552. @subsection Examples
  8553. @itemize
  8554. @item
  8555. Apply the distort0r effect, setting the first two double parameters:
  8556. @example
  8557. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8558. @end example
  8559. @item
  8560. Apply the colordistance effect, taking a color as the first parameter:
  8561. @example
  8562. frei0r=colordistance:0.2/0.3/0.4
  8563. frei0r=colordistance:violet
  8564. frei0r=colordistance:0x112233
  8565. @end example
  8566. @item
  8567. Apply the perspective effect, specifying the top left and top right image
  8568. positions:
  8569. @example
  8570. frei0r=perspective:0.2/0.2|0.8/0.2
  8571. @end example
  8572. @end itemize
  8573. For more information, see
  8574. @url{http://frei0r.dyne.org}
  8575. @section fspp
  8576. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8577. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8578. processing filter, one of them is performed once per block, not per pixel.
  8579. This allows for much higher speed.
  8580. The filter accepts the following options:
  8581. @table @option
  8582. @item quality
  8583. Set quality. This option defines the number of levels for averaging. It accepts
  8584. an integer in the range 4-5. Default value is @code{4}.
  8585. @item qp
  8586. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8587. If not set, the filter will use the QP from the video stream (if available).
  8588. @item strength
  8589. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8590. more details but also more artifacts, while higher values make the image smoother
  8591. but also blurrier. Default value is @code{0} − PSNR optimal.
  8592. @item use_bframe_qp
  8593. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8594. option may cause flicker since the B-Frames have often larger QP. Default is
  8595. @code{0} (not enabled).
  8596. @end table
  8597. @section gblur
  8598. Apply Gaussian blur filter.
  8599. The filter accepts the following options:
  8600. @table @option
  8601. @item sigma
  8602. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8603. @item steps
  8604. Set number of steps for Gaussian approximation. Default is @code{1}.
  8605. @item planes
  8606. Set which planes to filter. By default all planes are filtered.
  8607. @item sigmaV
  8608. Set vertical sigma, if negative it will be same as @code{sigma}.
  8609. Default is @code{-1}.
  8610. @end table
  8611. @subsection Commands
  8612. This filter supports same commands as options.
  8613. The command accepts the same syntax of the corresponding option.
  8614. If the specified expression is not valid, it is kept at its current
  8615. value.
  8616. @section geq
  8617. Apply generic equation to each pixel.
  8618. The filter accepts the following options:
  8619. @table @option
  8620. @item lum_expr, lum
  8621. Set the luminance expression.
  8622. @item cb_expr, cb
  8623. Set the chrominance blue expression.
  8624. @item cr_expr, cr
  8625. Set the chrominance red expression.
  8626. @item alpha_expr, a
  8627. Set the alpha expression.
  8628. @item red_expr, r
  8629. Set the red expression.
  8630. @item green_expr, g
  8631. Set the green expression.
  8632. @item blue_expr, b
  8633. Set the blue expression.
  8634. @end table
  8635. The colorspace is selected according to the specified options. If one
  8636. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8637. options is specified, the filter will automatically select a YCbCr
  8638. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8639. @option{blue_expr} options is specified, it will select an RGB
  8640. colorspace.
  8641. If one of the chrominance expression is not defined, it falls back on the other
  8642. one. If no alpha expression is specified it will evaluate to opaque value.
  8643. If none of chrominance expressions are specified, they will evaluate
  8644. to the luminance expression.
  8645. The expressions can use the following variables and functions:
  8646. @table @option
  8647. @item N
  8648. The sequential number of the filtered frame, starting from @code{0}.
  8649. @item X
  8650. @item Y
  8651. The coordinates of the current sample.
  8652. @item W
  8653. @item H
  8654. The width and height of the image.
  8655. @item SW
  8656. @item SH
  8657. Width and height scale depending on the currently filtered plane. It is the
  8658. ratio between the corresponding luma plane number of pixels and the current
  8659. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8660. @code{0.5,0.5} for chroma planes.
  8661. @item T
  8662. Time of the current frame, expressed in seconds.
  8663. @item p(x, y)
  8664. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8665. plane.
  8666. @item lum(x, y)
  8667. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8668. plane.
  8669. @item cb(x, y)
  8670. Return the value of the pixel at location (@var{x},@var{y}) of the
  8671. blue-difference chroma plane. Return 0 if there is no such plane.
  8672. @item cr(x, y)
  8673. Return the value of the pixel at location (@var{x},@var{y}) of the
  8674. red-difference chroma plane. Return 0 if there is no such plane.
  8675. @item r(x, y)
  8676. @item g(x, y)
  8677. @item b(x, y)
  8678. Return the value of the pixel at location (@var{x},@var{y}) of the
  8679. red/green/blue component. Return 0 if there is no such component.
  8680. @item alpha(x, y)
  8681. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8682. plane. Return 0 if there is no such plane.
  8683. @item interpolation
  8684. Set one of interpolation methods:
  8685. @table @option
  8686. @item nearest, n
  8687. @item bilinear, b
  8688. @end table
  8689. Default is bilinear.
  8690. @end table
  8691. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8692. automatically clipped to the closer edge.
  8693. @subsection Examples
  8694. @itemize
  8695. @item
  8696. Flip the image horizontally:
  8697. @example
  8698. geq=p(W-X\,Y)
  8699. @end example
  8700. @item
  8701. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8702. wavelength of 100 pixels:
  8703. @example
  8704. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8705. @end example
  8706. @item
  8707. Generate a fancy enigmatic moving light:
  8708. @example
  8709. 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
  8710. @end example
  8711. @item
  8712. Generate a quick emboss effect:
  8713. @example
  8714. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8715. @end example
  8716. @item
  8717. Modify RGB components depending on pixel position:
  8718. @example
  8719. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8720. @end example
  8721. @item
  8722. Create a radial gradient that is the same size as the input (also see
  8723. the @ref{vignette} filter):
  8724. @example
  8725. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8726. @end example
  8727. @end itemize
  8728. @section gradfun
  8729. Fix the banding artifacts that are sometimes introduced into nearly flat
  8730. regions by truncation to 8-bit color depth.
  8731. Interpolate the gradients that should go where the bands are, and
  8732. dither them.
  8733. It is designed for playback only. Do not use it prior to
  8734. lossy compression, because compression tends to lose the dither and
  8735. bring back the bands.
  8736. It accepts the following parameters:
  8737. @table @option
  8738. @item strength
  8739. The maximum amount by which the filter will change any one pixel. This is also
  8740. the threshold for detecting nearly flat regions. Acceptable values range from
  8741. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8742. valid range.
  8743. @item radius
  8744. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8745. gradients, but also prevents the filter from modifying the pixels near detailed
  8746. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8747. values will be clipped to the valid range.
  8748. @end table
  8749. Alternatively, the options can be specified as a flat string:
  8750. @var{strength}[:@var{radius}]
  8751. @subsection Examples
  8752. @itemize
  8753. @item
  8754. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8755. @example
  8756. gradfun=3.5:8
  8757. @end example
  8758. @item
  8759. Specify radius, omitting the strength (which will fall-back to the default
  8760. value):
  8761. @example
  8762. gradfun=radius=8
  8763. @end example
  8764. @end itemize
  8765. @anchor{graphmonitor}
  8766. @section graphmonitor
  8767. Show various filtergraph stats.
  8768. With this filter one can debug complete filtergraph.
  8769. Especially issues with links filling with queued frames.
  8770. The filter accepts the following options:
  8771. @table @option
  8772. @item size, s
  8773. Set video output size. Default is @var{hd720}.
  8774. @item opacity, o
  8775. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8776. @item mode, m
  8777. Set output mode, can be @var{fulll} or @var{compact}.
  8778. In @var{compact} mode only filters with some queued frames have displayed stats.
  8779. @item flags, f
  8780. Set flags which enable which stats are shown in video.
  8781. Available values for flags are:
  8782. @table @samp
  8783. @item queue
  8784. Display number of queued frames in each link.
  8785. @item frame_count_in
  8786. Display number of frames taken from filter.
  8787. @item frame_count_out
  8788. Display number of frames given out from filter.
  8789. @item pts
  8790. Display current filtered frame pts.
  8791. @item time
  8792. Display current filtered frame time.
  8793. @item timebase
  8794. Display time base for filter link.
  8795. @item format
  8796. Display used format for filter link.
  8797. @item size
  8798. Display video size or number of audio channels in case of audio used by filter link.
  8799. @item rate
  8800. Display video frame rate or sample rate in case of audio used by filter link.
  8801. @end table
  8802. @item rate, r
  8803. Set upper limit for video rate of output stream, Default value is @var{25}.
  8804. This guarantee that output video frame rate will not be higher than this value.
  8805. @end table
  8806. @section greyedge
  8807. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8808. and corrects the scene colors accordingly.
  8809. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8810. The filter accepts the following options:
  8811. @table @option
  8812. @item difford
  8813. The order of differentiation to be applied on the scene. Must be chosen in the range
  8814. [0,2] and default value is 1.
  8815. @item minknorm
  8816. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8817. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8818. max value instead of calculating Minkowski distance.
  8819. @item sigma
  8820. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8821. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8822. can't be equal to 0 if @var{difford} is greater than 0.
  8823. @end table
  8824. @subsection Examples
  8825. @itemize
  8826. @item
  8827. Grey Edge:
  8828. @example
  8829. greyedge=difford=1:minknorm=5:sigma=2
  8830. @end example
  8831. @item
  8832. Max Edge:
  8833. @example
  8834. greyedge=difford=1:minknorm=0:sigma=2
  8835. @end example
  8836. @end itemize
  8837. @anchor{haldclut}
  8838. @section haldclut
  8839. Apply a Hald CLUT to a video stream.
  8840. First input is the video stream to process, and second one is the Hald CLUT.
  8841. The Hald CLUT input can be a simple picture or a complete video stream.
  8842. The filter accepts the following options:
  8843. @table @option
  8844. @item shortest
  8845. Force termination when the shortest input terminates. Default is @code{0}.
  8846. @item repeatlast
  8847. Continue applying the last CLUT after the end of the stream. A value of
  8848. @code{0} disable the filter after the last frame of the CLUT is reached.
  8849. Default is @code{1}.
  8850. @end table
  8851. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8852. filters share the same internals).
  8853. This filter also supports the @ref{framesync} options.
  8854. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8855. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8856. @subsection Workflow examples
  8857. @subsubsection Hald CLUT video stream
  8858. Generate an identity Hald CLUT stream altered with various effects:
  8859. @example
  8860. 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
  8861. @end example
  8862. Note: make sure you use a lossless codec.
  8863. Then use it with @code{haldclut} to apply it on some random stream:
  8864. @example
  8865. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8866. @end example
  8867. The Hald CLUT will be applied to the 10 first seconds (duration of
  8868. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8869. to the remaining frames of the @code{mandelbrot} stream.
  8870. @subsubsection Hald CLUT with preview
  8871. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8872. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8873. biggest possible square starting at the top left of the picture. The remaining
  8874. padding pixels (bottom or right) will be ignored. This area can be used to add
  8875. a preview of the Hald CLUT.
  8876. Typically, the following generated Hald CLUT will be supported by the
  8877. @code{haldclut} filter:
  8878. @example
  8879. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8880. pad=iw+320 [padded_clut];
  8881. smptebars=s=320x256, split [a][b];
  8882. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8883. [main][b] overlay=W-320" -frames:v 1 clut.png
  8884. @end example
  8885. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8886. bars are displayed on the right-top, and below the same color bars processed by
  8887. the color changes.
  8888. Then, the effect of this Hald CLUT can be visualized with:
  8889. @example
  8890. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8891. @end example
  8892. @section hflip
  8893. Flip the input video horizontally.
  8894. For example, to horizontally flip the input video with @command{ffmpeg}:
  8895. @example
  8896. ffmpeg -i in.avi -vf "hflip" out.avi
  8897. @end example
  8898. @section histeq
  8899. This filter applies a global color histogram equalization on a
  8900. per-frame basis.
  8901. It can be used to correct video that has a compressed range of pixel
  8902. intensities. The filter redistributes the pixel intensities to
  8903. equalize their distribution across the intensity range. It may be
  8904. viewed as an "automatically adjusting contrast filter". This filter is
  8905. useful only for correcting degraded or poorly captured source
  8906. video.
  8907. The filter accepts the following options:
  8908. @table @option
  8909. @item strength
  8910. Determine the amount of equalization to be applied. As the strength
  8911. is reduced, the distribution of pixel intensities more-and-more
  8912. approaches that of the input frame. The value must be a float number
  8913. in the range [0,1] and defaults to 0.200.
  8914. @item intensity
  8915. Set the maximum intensity that can generated and scale the output
  8916. values appropriately. The strength should be set as desired and then
  8917. the intensity can be limited if needed to avoid washing-out. The value
  8918. must be a float number in the range [0,1] and defaults to 0.210.
  8919. @item antibanding
  8920. Set the antibanding level. If enabled the filter will randomly vary
  8921. the luminance of output pixels by a small amount to avoid banding of
  8922. the histogram. Possible values are @code{none}, @code{weak} or
  8923. @code{strong}. It defaults to @code{none}.
  8924. @end table
  8925. @section histogram
  8926. Compute and draw a color distribution histogram for the input video.
  8927. The computed histogram is a representation of the color component
  8928. distribution in an image.
  8929. Standard histogram displays the color components distribution in an image.
  8930. Displays color graph for each color component. Shows distribution of
  8931. the Y, U, V, A or R, G, B components, depending on input format, in the
  8932. current frame. Below each graph a color component scale meter is shown.
  8933. The filter accepts the following options:
  8934. @table @option
  8935. @item level_height
  8936. Set height of level. Default value is @code{200}.
  8937. Allowed range is [50, 2048].
  8938. @item scale_height
  8939. Set height of color scale. Default value is @code{12}.
  8940. Allowed range is [0, 40].
  8941. @item display_mode
  8942. Set display mode.
  8943. It accepts the following values:
  8944. @table @samp
  8945. @item stack
  8946. Per color component graphs are placed below each other.
  8947. @item parade
  8948. Per color component graphs are placed side by side.
  8949. @item overlay
  8950. Presents information identical to that in the @code{parade}, except
  8951. that the graphs representing color components are superimposed directly
  8952. over one another.
  8953. @end table
  8954. Default is @code{stack}.
  8955. @item levels_mode
  8956. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8957. Default is @code{linear}.
  8958. @item components
  8959. Set what color components to display.
  8960. Default is @code{7}.
  8961. @item fgopacity
  8962. Set foreground opacity. Default is @code{0.7}.
  8963. @item bgopacity
  8964. Set background opacity. Default is @code{0.5}.
  8965. @end table
  8966. @subsection Examples
  8967. @itemize
  8968. @item
  8969. Calculate and draw histogram:
  8970. @example
  8971. ffplay -i input -vf histogram
  8972. @end example
  8973. @end itemize
  8974. @anchor{hqdn3d}
  8975. @section hqdn3d
  8976. This is a high precision/quality 3d denoise filter. It aims to reduce
  8977. image noise, producing smooth images and making still images really
  8978. still. It should enhance compressibility.
  8979. It accepts the following optional parameters:
  8980. @table @option
  8981. @item luma_spatial
  8982. A non-negative floating point number which specifies spatial luma strength.
  8983. It defaults to 4.0.
  8984. @item chroma_spatial
  8985. A non-negative floating point number which specifies spatial chroma strength.
  8986. It defaults to 3.0*@var{luma_spatial}/4.0.
  8987. @item luma_tmp
  8988. A floating point number which specifies luma temporal strength. It defaults to
  8989. 6.0*@var{luma_spatial}/4.0.
  8990. @item chroma_tmp
  8991. A floating point number which specifies chroma temporal strength. It defaults to
  8992. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8993. @end table
  8994. @subsection Commands
  8995. This filter supports same @ref{commands} as options.
  8996. The command accepts the same syntax of the corresponding option.
  8997. If the specified expression is not valid, it is kept at its current
  8998. value.
  8999. @anchor{hwdownload}
  9000. @section hwdownload
  9001. Download hardware frames to system memory.
  9002. The input must be in hardware frames, and the output a non-hardware format.
  9003. Not all formats will be supported on the output - it may be necessary to insert
  9004. an additional @option{format} filter immediately following in the graph to get
  9005. the output in a supported format.
  9006. @section hwmap
  9007. Map hardware frames to system memory or to another device.
  9008. This filter has several different modes of operation; which one is used depends
  9009. on the input and output formats:
  9010. @itemize
  9011. @item
  9012. Hardware frame input, normal frame output
  9013. Map the input frames to system memory and pass them to the output. If the
  9014. original hardware frame is later required (for example, after overlaying
  9015. something else on part of it), the @option{hwmap} filter can be used again
  9016. in the next mode to retrieve it.
  9017. @item
  9018. Normal frame input, hardware frame output
  9019. If the input is actually a software-mapped hardware frame, then unmap it -
  9020. that is, return the original hardware frame.
  9021. Otherwise, a device must be provided. Create new hardware surfaces on that
  9022. device for the output, then map them back to the software format at the input
  9023. and give those frames to the preceding filter. This will then act like the
  9024. @option{hwupload} filter, but may be able to avoid an additional copy when
  9025. the input is already in a compatible format.
  9026. @item
  9027. Hardware frame input and output
  9028. A device must be supplied for the output, either directly or with the
  9029. @option{derive_device} option. The input and output devices must be of
  9030. different types and compatible - the exact meaning of this is
  9031. system-dependent, but typically it means that they must refer to the same
  9032. underlying hardware context (for example, refer to the same graphics card).
  9033. If the input frames were originally created on the output device, then unmap
  9034. to retrieve the original frames.
  9035. Otherwise, map the frames to the output device - create new hardware frames
  9036. on the output corresponding to the frames on the input.
  9037. @end itemize
  9038. The following additional parameters are accepted:
  9039. @table @option
  9040. @item mode
  9041. Set the frame mapping mode. Some combination of:
  9042. @table @var
  9043. @item read
  9044. The mapped frame should be readable.
  9045. @item write
  9046. The mapped frame should be writeable.
  9047. @item overwrite
  9048. The mapping will always overwrite the entire frame.
  9049. This may improve performance in some cases, as the original contents of the
  9050. frame need not be loaded.
  9051. @item direct
  9052. The mapping must not involve any copying.
  9053. Indirect mappings to copies of frames are created in some cases where either
  9054. direct mapping is not possible or it would have unexpected properties.
  9055. Setting this flag ensures that the mapping is direct and will fail if that is
  9056. not possible.
  9057. @end table
  9058. Defaults to @var{read+write} if not specified.
  9059. @item derive_device @var{type}
  9060. Rather than using the device supplied at initialisation, instead derive a new
  9061. device of type @var{type} from the device the input frames exist on.
  9062. @item reverse
  9063. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9064. and map them back to the source. This may be necessary in some cases where
  9065. a mapping in one direction is required but only the opposite direction is
  9066. supported by the devices being used.
  9067. This option is dangerous - it may break the preceding filter in undefined
  9068. ways if there are any additional constraints on that filter's output.
  9069. Do not use it without fully understanding the implications of its use.
  9070. @end table
  9071. @anchor{hwupload}
  9072. @section hwupload
  9073. Upload system memory frames to hardware surfaces.
  9074. The device to upload to must be supplied when the filter is initialised. If
  9075. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9076. option.
  9077. @anchor{hwupload_cuda}
  9078. @section hwupload_cuda
  9079. Upload system memory frames to a CUDA device.
  9080. It accepts the following optional parameters:
  9081. @table @option
  9082. @item device
  9083. The number of the CUDA device to use
  9084. @end table
  9085. @section hqx
  9086. Apply a high-quality magnification filter designed for pixel art. This filter
  9087. was originally created by Maxim Stepin.
  9088. It accepts the following option:
  9089. @table @option
  9090. @item n
  9091. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9092. @code{hq3x} and @code{4} for @code{hq4x}.
  9093. Default is @code{3}.
  9094. @end table
  9095. @section hstack
  9096. Stack input videos horizontally.
  9097. All streams must be of same pixel format and of same height.
  9098. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9099. to create same output.
  9100. The filter accepts the following option:
  9101. @table @option
  9102. @item inputs
  9103. Set number of input streams. Default is 2.
  9104. @item shortest
  9105. If set to 1, force the output to terminate when the shortest input
  9106. terminates. Default value is 0.
  9107. @end table
  9108. @section hue
  9109. Modify the hue and/or the saturation of the input.
  9110. It accepts the following parameters:
  9111. @table @option
  9112. @item h
  9113. Specify the hue angle as a number of degrees. It accepts an expression,
  9114. and defaults to "0".
  9115. @item s
  9116. Specify the saturation in the [-10,10] range. It accepts an expression and
  9117. defaults to "1".
  9118. @item H
  9119. Specify the hue angle as a number of radians. It accepts an
  9120. expression, and defaults to "0".
  9121. @item b
  9122. Specify the brightness in the [-10,10] range. It accepts an expression and
  9123. defaults to "0".
  9124. @end table
  9125. @option{h} and @option{H} are mutually exclusive, and can't be
  9126. specified at the same time.
  9127. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9128. expressions containing the following constants:
  9129. @table @option
  9130. @item n
  9131. frame count of the input frame starting from 0
  9132. @item pts
  9133. presentation timestamp of the input frame expressed in time base units
  9134. @item r
  9135. frame rate of the input video, NAN if the input frame rate is unknown
  9136. @item t
  9137. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9138. @item tb
  9139. time base of the input video
  9140. @end table
  9141. @subsection Examples
  9142. @itemize
  9143. @item
  9144. Set the hue to 90 degrees and the saturation to 1.0:
  9145. @example
  9146. hue=h=90:s=1
  9147. @end example
  9148. @item
  9149. Same command but expressing the hue in radians:
  9150. @example
  9151. hue=H=PI/2:s=1
  9152. @end example
  9153. @item
  9154. Rotate hue and make the saturation swing between 0
  9155. and 2 over a period of 1 second:
  9156. @example
  9157. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9158. @end example
  9159. @item
  9160. Apply a 3 seconds saturation fade-in effect starting at 0:
  9161. @example
  9162. hue="s=min(t/3\,1)"
  9163. @end example
  9164. The general fade-in expression can be written as:
  9165. @example
  9166. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9167. @end example
  9168. @item
  9169. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9170. @example
  9171. hue="s=max(0\, min(1\, (8-t)/3))"
  9172. @end example
  9173. The general fade-out expression can be written as:
  9174. @example
  9175. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9176. @end example
  9177. @end itemize
  9178. @subsection Commands
  9179. This filter supports the following commands:
  9180. @table @option
  9181. @item b
  9182. @item s
  9183. @item h
  9184. @item H
  9185. Modify the hue and/or the saturation and/or brightness of the input video.
  9186. The command accepts the same syntax of the corresponding option.
  9187. If the specified expression is not valid, it is kept at its current
  9188. value.
  9189. @end table
  9190. @section hysteresis
  9191. Grow first stream into second stream by connecting components.
  9192. This makes it possible to build more robust edge masks.
  9193. This filter accepts the following options:
  9194. @table @option
  9195. @item planes
  9196. Set which planes will be processed as bitmap, unprocessed planes will be
  9197. copied from first stream.
  9198. By default value 0xf, all planes will be processed.
  9199. @item threshold
  9200. Set threshold which is used in filtering. If pixel component value is higher than
  9201. this value filter algorithm for connecting components is activated.
  9202. By default value is 0.
  9203. @end table
  9204. @section idet
  9205. Detect video interlacing type.
  9206. This filter tries to detect if the input frames are interlaced, progressive,
  9207. top or bottom field first. It will also try to detect fields that are
  9208. repeated between adjacent frames (a sign of telecine).
  9209. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9210. Multiple frame detection incorporates the classification history of previous frames.
  9211. The filter will log these metadata values:
  9212. @table @option
  9213. @item single.current_frame
  9214. Detected type of current frame using single-frame detection. One of:
  9215. ``tff'' (top field first), ``bff'' (bottom field first),
  9216. ``progressive'', or ``undetermined''
  9217. @item single.tff
  9218. Cumulative number of frames detected as top field first using single-frame detection.
  9219. @item multiple.tff
  9220. Cumulative number of frames detected as top field first using multiple-frame detection.
  9221. @item single.bff
  9222. Cumulative number of frames detected as bottom field first using single-frame detection.
  9223. @item multiple.current_frame
  9224. Detected type of current frame using multiple-frame detection. One of:
  9225. ``tff'' (top field first), ``bff'' (bottom field first),
  9226. ``progressive'', or ``undetermined''
  9227. @item multiple.bff
  9228. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9229. @item single.progressive
  9230. Cumulative number of frames detected as progressive using single-frame detection.
  9231. @item multiple.progressive
  9232. Cumulative number of frames detected as progressive using multiple-frame detection.
  9233. @item single.undetermined
  9234. Cumulative number of frames that could not be classified using single-frame detection.
  9235. @item multiple.undetermined
  9236. Cumulative number of frames that could not be classified using multiple-frame detection.
  9237. @item repeated.current_frame
  9238. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9239. @item repeated.neither
  9240. Cumulative number of frames with no repeated field.
  9241. @item repeated.top
  9242. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9243. @item repeated.bottom
  9244. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9245. @end table
  9246. The filter accepts the following options:
  9247. @table @option
  9248. @item intl_thres
  9249. Set interlacing threshold.
  9250. @item prog_thres
  9251. Set progressive threshold.
  9252. @item rep_thres
  9253. Threshold for repeated field detection.
  9254. @item half_life
  9255. Number of frames after which a given frame's contribution to the
  9256. statistics is halved (i.e., it contributes only 0.5 to its
  9257. classification). The default of 0 means that all frames seen are given
  9258. full weight of 1.0 forever.
  9259. @item analyze_interlaced_flag
  9260. When this is not 0 then idet will use the specified number of frames to determine
  9261. if the interlaced flag is accurate, it will not count undetermined frames.
  9262. If the flag is found to be accurate it will be used without any further
  9263. computations, if it is found to be inaccurate it will be cleared without any
  9264. further computations. This allows inserting the idet filter as a low computational
  9265. method to clean up the interlaced flag
  9266. @end table
  9267. @section il
  9268. Deinterleave or interleave fields.
  9269. This filter allows one to process interlaced images fields without
  9270. deinterlacing them. Deinterleaving splits the input frame into 2
  9271. fields (so called half pictures). Odd lines are moved to the top
  9272. half of the output image, even lines to the bottom half.
  9273. You can process (filter) them independently and then re-interleave them.
  9274. The filter accepts the following options:
  9275. @table @option
  9276. @item luma_mode, l
  9277. @item chroma_mode, c
  9278. @item alpha_mode, a
  9279. Available values for @var{luma_mode}, @var{chroma_mode} and
  9280. @var{alpha_mode} are:
  9281. @table @samp
  9282. @item none
  9283. Do nothing.
  9284. @item deinterleave, d
  9285. Deinterleave fields, placing one above the other.
  9286. @item interleave, i
  9287. Interleave fields. Reverse the effect of deinterleaving.
  9288. @end table
  9289. Default value is @code{none}.
  9290. @item luma_swap, ls
  9291. @item chroma_swap, cs
  9292. @item alpha_swap, as
  9293. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9294. @end table
  9295. @section inflate
  9296. Apply inflate effect to the video.
  9297. This filter replaces the pixel by the local(3x3) average by taking into account
  9298. only values higher than the pixel.
  9299. It accepts the following options:
  9300. @table @option
  9301. @item threshold0
  9302. @item threshold1
  9303. @item threshold2
  9304. @item threshold3
  9305. Limit the maximum change for each plane, default is 65535.
  9306. If 0, plane will remain unchanged.
  9307. @end table
  9308. @section interlace
  9309. Simple interlacing filter from progressive contents. This interleaves upper (or
  9310. lower) lines from odd frames with lower (or upper) lines from even frames,
  9311. halving the frame rate and preserving image height.
  9312. @example
  9313. Original Original New Frame
  9314. Frame 'j' Frame 'j+1' (tff)
  9315. ========== =========== ==================
  9316. Line 0 --------------------> Frame 'j' Line 0
  9317. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9318. Line 2 ---------------------> Frame 'j' Line 2
  9319. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9320. ... ... ...
  9321. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9322. @end example
  9323. It accepts the following optional parameters:
  9324. @table @option
  9325. @item scan
  9326. This determines whether the interlaced frame is taken from the even
  9327. (tff - default) or odd (bff) lines of the progressive frame.
  9328. @item lowpass
  9329. Vertical lowpass filter to avoid twitter interlacing and
  9330. reduce moire patterns.
  9331. @table @samp
  9332. @item 0, off
  9333. Disable vertical lowpass filter
  9334. @item 1, linear
  9335. Enable linear filter (default)
  9336. @item 2, complex
  9337. Enable complex filter. This will slightly less reduce twitter and moire
  9338. but better retain detail and subjective sharpness impression.
  9339. @end table
  9340. @end table
  9341. @section kerndeint
  9342. Deinterlace input video by applying Donald Graft's adaptive kernel
  9343. deinterling. Work on interlaced parts of a video to produce
  9344. progressive frames.
  9345. The description of the accepted parameters follows.
  9346. @table @option
  9347. @item thresh
  9348. Set the threshold which affects the filter's tolerance when
  9349. determining if a pixel line must be processed. It must be an integer
  9350. in the range [0,255] and defaults to 10. A value of 0 will result in
  9351. applying the process on every pixels.
  9352. @item map
  9353. Paint pixels exceeding the threshold value to white if set to 1.
  9354. Default is 0.
  9355. @item order
  9356. Set the fields order. Swap fields if set to 1, leave fields alone if
  9357. 0. Default is 0.
  9358. @item sharp
  9359. Enable additional sharpening if set to 1. Default is 0.
  9360. @item twoway
  9361. Enable twoway sharpening if set to 1. Default is 0.
  9362. @end table
  9363. @subsection Examples
  9364. @itemize
  9365. @item
  9366. Apply default values:
  9367. @example
  9368. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9369. @end example
  9370. @item
  9371. Enable additional sharpening:
  9372. @example
  9373. kerndeint=sharp=1
  9374. @end example
  9375. @item
  9376. Paint processed pixels in white:
  9377. @example
  9378. kerndeint=map=1
  9379. @end example
  9380. @end itemize
  9381. @section lagfun
  9382. Slowly update darker pixels.
  9383. This filter makes short flashes of light appear longer.
  9384. This filter accepts the following options:
  9385. @table @option
  9386. @item decay
  9387. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9388. @item planes
  9389. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9390. @end table
  9391. @section lenscorrection
  9392. Correct radial lens distortion
  9393. This filter can be used to correct for radial distortion as can result from the use
  9394. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9395. one can use tools available for example as part of opencv or simply trial-and-error.
  9396. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9397. and extract the k1 and k2 coefficients from the resulting matrix.
  9398. Note that effectively the same filter is available in the open-source tools Krita and
  9399. Digikam from the KDE project.
  9400. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9401. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9402. brightness distribution, so you may want to use both filters together in certain
  9403. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9404. be applied before or after lens correction.
  9405. @subsection Options
  9406. The filter accepts the following options:
  9407. @table @option
  9408. @item cx
  9409. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9410. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9411. width. Default is 0.5.
  9412. @item cy
  9413. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9414. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9415. height. Default is 0.5.
  9416. @item k1
  9417. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9418. no correction. Default is 0.
  9419. @item k2
  9420. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9421. 0 means no correction. Default is 0.
  9422. @end table
  9423. The formula that generates the correction is:
  9424. @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)
  9425. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9426. distances from the focal point in the source and target images, respectively.
  9427. @section lensfun
  9428. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9429. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9430. to apply the lens correction. The filter will load the lensfun database and
  9431. query it to find the corresponding camera and lens entries in the database. As
  9432. long as these entries can be found with the given options, the filter can
  9433. perform corrections on frames. Note that incomplete strings will result in the
  9434. filter choosing the best match with the given options, and the filter will
  9435. output the chosen camera and lens models (logged with level "info"). You must
  9436. provide the make, camera model, and lens model as they are required.
  9437. The filter accepts the following options:
  9438. @table @option
  9439. @item make
  9440. The make of the camera (for example, "Canon"). This option is required.
  9441. @item model
  9442. The model of the camera (for example, "Canon EOS 100D"). This option is
  9443. required.
  9444. @item lens_model
  9445. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9446. option is required.
  9447. @item mode
  9448. The type of correction to apply. The following values are valid options:
  9449. @table @samp
  9450. @item vignetting
  9451. Enables fixing lens vignetting.
  9452. @item geometry
  9453. Enables fixing lens geometry. This is the default.
  9454. @item subpixel
  9455. Enables fixing chromatic aberrations.
  9456. @item vig_geo
  9457. Enables fixing lens vignetting and lens geometry.
  9458. @item vig_subpixel
  9459. Enables fixing lens vignetting and chromatic aberrations.
  9460. @item distortion
  9461. Enables fixing both lens geometry and chromatic aberrations.
  9462. @item all
  9463. Enables all possible corrections.
  9464. @end table
  9465. @item focal_length
  9466. The focal length of the image/video (zoom; expected constant for video). For
  9467. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9468. range should be chosen when using that lens. Default 18.
  9469. @item aperture
  9470. The aperture of the image/video (expected constant for video). Note that
  9471. aperture is only used for vignetting correction. Default 3.5.
  9472. @item focus_distance
  9473. The focus distance of the image/video (expected constant for video). Note that
  9474. focus distance is only used for vignetting and only slightly affects the
  9475. vignetting correction process. If unknown, leave it at the default value (which
  9476. is 1000).
  9477. @item scale
  9478. The scale factor which is applied after transformation. After correction the
  9479. video is no longer necessarily rectangular. This parameter controls how much of
  9480. the resulting image is visible. The value 0 means that a value will be chosen
  9481. automatically such that there is little or no unmapped area in the output
  9482. image. 1.0 means that no additional scaling is done. Lower values may result
  9483. in more of the corrected image being visible, while higher values may avoid
  9484. unmapped areas in the output.
  9485. @item target_geometry
  9486. The target geometry of the output image/video. The following values are valid
  9487. options:
  9488. @table @samp
  9489. @item rectilinear (default)
  9490. @item fisheye
  9491. @item panoramic
  9492. @item equirectangular
  9493. @item fisheye_orthographic
  9494. @item fisheye_stereographic
  9495. @item fisheye_equisolid
  9496. @item fisheye_thoby
  9497. @end table
  9498. @item reverse
  9499. Apply the reverse of image correction (instead of correcting distortion, apply
  9500. it).
  9501. @item interpolation
  9502. The type of interpolation used when correcting distortion. The following values
  9503. are valid options:
  9504. @table @samp
  9505. @item nearest
  9506. @item linear (default)
  9507. @item lanczos
  9508. @end table
  9509. @end table
  9510. @subsection Examples
  9511. @itemize
  9512. @item
  9513. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9514. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9515. aperture of "8.0".
  9516. @example
  9517. 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
  9518. @end example
  9519. @item
  9520. Apply the same as before, but only for the first 5 seconds of video.
  9521. @example
  9522. 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
  9523. @end example
  9524. @end itemize
  9525. @section libvmaf
  9526. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9527. score between two input videos.
  9528. The obtained VMAF score is printed through the logging system.
  9529. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9530. After installing the library it can be enabled using:
  9531. @code{./configure --enable-libvmaf --enable-version3}.
  9532. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9533. The filter has following options:
  9534. @table @option
  9535. @item model_path
  9536. Set the model path which is to be used for SVM.
  9537. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9538. @item log_path
  9539. Set the file path to be used to store logs.
  9540. @item log_fmt
  9541. Set the format of the log file (xml or json).
  9542. @item enable_transform
  9543. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9544. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9545. Default value: @code{false}
  9546. @item phone_model
  9547. Invokes the phone model which will generate VMAF scores higher than in the
  9548. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9549. Default value: @code{false}
  9550. @item psnr
  9551. Enables computing psnr along with vmaf.
  9552. Default value: @code{false}
  9553. @item ssim
  9554. Enables computing ssim along with vmaf.
  9555. Default value: @code{false}
  9556. @item ms_ssim
  9557. Enables computing ms_ssim along with vmaf.
  9558. Default value: @code{false}
  9559. @item pool
  9560. Set the pool method to be used for computing vmaf.
  9561. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9562. @item n_threads
  9563. Set number of threads to be used when computing vmaf.
  9564. Default value: @code{0}, which makes use of all available logical processors.
  9565. @item n_subsample
  9566. Set interval for frame subsampling used when computing vmaf.
  9567. Default value: @code{1}
  9568. @item enable_conf_interval
  9569. Enables confidence interval.
  9570. Default value: @code{false}
  9571. @end table
  9572. This filter also supports the @ref{framesync} options.
  9573. @subsection Examples
  9574. @itemize
  9575. @item
  9576. On the below examples the input file @file{main.mpg} being processed is
  9577. compared with the reference file @file{ref.mpg}.
  9578. @example
  9579. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9580. @end example
  9581. @item
  9582. Example with options:
  9583. @example
  9584. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9585. @end example
  9586. @item
  9587. Example with options and different containers:
  9588. @example
  9589. 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 -
  9590. @end example
  9591. @end itemize
  9592. @section limiter
  9593. Limits the pixel components values to the specified range [min, max].
  9594. The filter accepts the following options:
  9595. @table @option
  9596. @item min
  9597. Lower bound. Defaults to the lowest allowed value for the input.
  9598. @item max
  9599. Upper bound. Defaults to the highest allowed value for the input.
  9600. @item planes
  9601. Specify which planes will be processed. Defaults to all available.
  9602. @end table
  9603. @section loop
  9604. Loop video frames.
  9605. The filter accepts the following options:
  9606. @table @option
  9607. @item loop
  9608. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9609. Default is 0.
  9610. @item size
  9611. Set maximal size in number of frames. Default is 0.
  9612. @item start
  9613. Set first frame of loop. Default is 0.
  9614. @end table
  9615. @subsection Examples
  9616. @itemize
  9617. @item
  9618. Loop single first frame infinitely:
  9619. @example
  9620. loop=loop=-1:size=1:start=0
  9621. @end example
  9622. @item
  9623. Loop single first frame 10 times:
  9624. @example
  9625. loop=loop=10:size=1:start=0
  9626. @end example
  9627. @item
  9628. Loop 10 first frames 5 times:
  9629. @example
  9630. loop=loop=5:size=10:start=0
  9631. @end example
  9632. @end itemize
  9633. @section lut1d
  9634. Apply a 1D LUT to an input video.
  9635. The filter accepts the following options:
  9636. @table @option
  9637. @item file
  9638. Set the 1D LUT file name.
  9639. Currently supported formats:
  9640. @table @samp
  9641. @item cube
  9642. Iridas
  9643. @item csp
  9644. cineSpace
  9645. @end table
  9646. @item interp
  9647. Select interpolation mode.
  9648. Available values are:
  9649. @table @samp
  9650. @item nearest
  9651. Use values from the nearest defined point.
  9652. @item linear
  9653. Interpolate values using the linear interpolation.
  9654. @item cosine
  9655. Interpolate values using the cosine interpolation.
  9656. @item cubic
  9657. Interpolate values using the cubic interpolation.
  9658. @item spline
  9659. Interpolate values using the spline interpolation.
  9660. @end table
  9661. @end table
  9662. @anchor{lut3d}
  9663. @section lut3d
  9664. Apply a 3D LUT to an input video.
  9665. The filter accepts the following options:
  9666. @table @option
  9667. @item file
  9668. Set the 3D LUT file name.
  9669. Currently supported formats:
  9670. @table @samp
  9671. @item 3dl
  9672. AfterEffects
  9673. @item cube
  9674. Iridas
  9675. @item dat
  9676. DaVinci
  9677. @item m3d
  9678. Pandora
  9679. @item csp
  9680. cineSpace
  9681. @end table
  9682. @item interp
  9683. Select interpolation mode.
  9684. Available values are:
  9685. @table @samp
  9686. @item nearest
  9687. Use values from the nearest defined point.
  9688. @item trilinear
  9689. Interpolate values using the 8 points defining a cube.
  9690. @item tetrahedral
  9691. Interpolate values using a tetrahedron.
  9692. @end table
  9693. @end table
  9694. @section lumakey
  9695. Turn certain luma values into transparency.
  9696. The filter accepts the following options:
  9697. @table @option
  9698. @item threshold
  9699. Set the luma which will be used as base for transparency.
  9700. Default value is @code{0}.
  9701. @item tolerance
  9702. Set the range of luma values to be keyed out.
  9703. Default value is @code{0.01}.
  9704. @item softness
  9705. Set the range of softness. Default value is @code{0}.
  9706. Use this to control gradual transition from zero to full transparency.
  9707. @end table
  9708. @subsection Commands
  9709. This filter supports same @ref{commands} as options.
  9710. The command accepts the same syntax of the corresponding option.
  9711. If the specified expression is not valid, it is kept at its current
  9712. value.
  9713. @section lut, lutrgb, lutyuv
  9714. Compute a look-up table for binding each pixel component input value
  9715. to an output value, and apply it to the input video.
  9716. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9717. to an RGB input video.
  9718. These filters accept the following parameters:
  9719. @table @option
  9720. @item c0
  9721. set first pixel component expression
  9722. @item c1
  9723. set second pixel component expression
  9724. @item c2
  9725. set third pixel component expression
  9726. @item c3
  9727. set fourth pixel component expression, corresponds to the alpha component
  9728. @item r
  9729. set red component expression
  9730. @item g
  9731. set green component expression
  9732. @item b
  9733. set blue component expression
  9734. @item a
  9735. alpha component expression
  9736. @item y
  9737. set Y/luminance component expression
  9738. @item u
  9739. set U/Cb component expression
  9740. @item v
  9741. set V/Cr component expression
  9742. @end table
  9743. Each of them specifies the expression to use for computing the lookup table for
  9744. the corresponding pixel component values.
  9745. The exact component associated to each of the @var{c*} options depends on the
  9746. format in input.
  9747. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9748. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9749. The expressions can contain the following constants and functions:
  9750. @table @option
  9751. @item w
  9752. @item h
  9753. The input width and height.
  9754. @item val
  9755. The input value for the pixel component.
  9756. @item clipval
  9757. The input value, clipped to the @var{minval}-@var{maxval} range.
  9758. @item maxval
  9759. The maximum value for the pixel component.
  9760. @item minval
  9761. The minimum value for the pixel component.
  9762. @item negval
  9763. The negated value for the pixel component value, clipped to the
  9764. @var{minval}-@var{maxval} range; it corresponds to the expression
  9765. "maxval-clipval+minval".
  9766. @item clip(val)
  9767. The computed value in @var{val}, clipped to the
  9768. @var{minval}-@var{maxval} range.
  9769. @item gammaval(gamma)
  9770. The computed gamma correction value of the pixel component value,
  9771. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9772. expression
  9773. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9774. @end table
  9775. All expressions default to "val".
  9776. @subsection Examples
  9777. @itemize
  9778. @item
  9779. Negate input video:
  9780. @example
  9781. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9782. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9783. @end example
  9784. The above is the same as:
  9785. @example
  9786. lutrgb="r=negval:g=negval:b=negval"
  9787. lutyuv="y=negval:u=negval:v=negval"
  9788. @end example
  9789. @item
  9790. Negate luminance:
  9791. @example
  9792. lutyuv=y=negval
  9793. @end example
  9794. @item
  9795. Remove chroma components, turning the video into a graytone image:
  9796. @example
  9797. lutyuv="u=128:v=128"
  9798. @end example
  9799. @item
  9800. Apply a luma burning effect:
  9801. @example
  9802. lutyuv="y=2*val"
  9803. @end example
  9804. @item
  9805. Remove green and blue components:
  9806. @example
  9807. lutrgb="g=0:b=0"
  9808. @end example
  9809. @item
  9810. Set a constant alpha channel value on input:
  9811. @example
  9812. format=rgba,lutrgb=a="maxval-minval/2"
  9813. @end example
  9814. @item
  9815. Correct luminance gamma by a factor of 0.5:
  9816. @example
  9817. lutyuv=y=gammaval(0.5)
  9818. @end example
  9819. @item
  9820. Discard least significant bits of luma:
  9821. @example
  9822. lutyuv=y='bitand(val, 128+64+32)'
  9823. @end example
  9824. @item
  9825. Technicolor like effect:
  9826. @example
  9827. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9828. @end example
  9829. @end itemize
  9830. @section lut2, tlut2
  9831. The @code{lut2} filter takes two input streams and outputs one
  9832. stream.
  9833. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9834. from one single stream.
  9835. This filter accepts the following parameters:
  9836. @table @option
  9837. @item c0
  9838. set first pixel component expression
  9839. @item c1
  9840. set second pixel component expression
  9841. @item c2
  9842. set third pixel component expression
  9843. @item c3
  9844. set fourth pixel component expression, corresponds to the alpha component
  9845. @item d
  9846. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9847. which means bit depth is automatically picked from first input format.
  9848. @end table
  9849. Each of them specifies the expression to use for computing the lookup table for
  9850. the corresponding pixel component values.
  9851. The exact component associated to each of the @var{c*} options depends on the
  9852. format in inputs.
  9853. The expressions can contain the following constants:
  9854. @table @option
  9855. @item w
  9856. @item h
  9857. The input width and height.
  9858. @item x
  9859. The first input value for the pixel component.
  9860. @item y
  9861. The second input value for the pixel component.
  9862. @item bdx
  9863. The first input video bit depth.
  9864. @item bdy
  9865. The second input video bit depth.
  9866. @end table
  9867. All expressions default to "x".
  9868. @subsection Examples
  9869. @itemize
  9870. @item
  9871. Highlight differences between two RGB video streams:
  9872. @example
  9873. 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)'
  9874. @end example
  9875. @item
  9876. Highlight differences between two YUV video streams:
  9877. @example
  9878. 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)'
  9879. @end example
  9880. @item
  9881. Show max difference between two video streams:
  9882. @example
  9883. 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)))'
  9884. @end example
  9885. @end itemize
  9886. @section maskedclamp
  9887. Clamp the first input stream with the second input and third input stream.
  9888. Returns the value of first stream to be between second input
  9889. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9890. This filter accepts the following options:
  9891. @table @option
  9892. @item undershoot
  9893. Default value is @code{0}.
  9894. @item overshoot
  9895. Default value is @code{0}.
  9896. @item planes
  9897. Set which planes will be processed as bitmap, unprocessed planes will be
  9898. copied from first stream.
  9899. By default value 0xf, all planes will be processed.
  9900. @end table
  9901. @section maskedmax
  9902. Merge the second and third input stream into output stream using absolute differences
  9903. between second input stream and first input stream and absolute difference between
  9904. third input stream and first input stream. The picked value will be from second input
  9905. stream if second absolute difference is greater than first one or from third input stream
  9906. otherwise.
  9907. This filter accepts the following options:
  9908. @table @option
  9909. @item planes
  9910. Set which planes will be processed as bitmap, unprocessed planes will be
  9911. copied from first stream.
  9912. By default value 0xf, all planes will be processed.
  9913. @end table
  9914. @section maskedmerge
  9915. Merge the first input stream with the second input stream using per pixel
  9916. weights in the third input stream.
  9917. A value of 0 in the third stream pixel component means that pixel component
  9918. from first stream is returned unchanged, while maximum value (eg. 255 for
  9919. 8-bit videos) means that pixel component from second stream is returned
  9920. unchanged. Intermediate values define the amount of merging between both
  9921. input stream's pixel components.
  9922. This filter accepts the following options:
  9923. @table @option
  9924. @item planes
  9925. Set which planes will be processed as bitmap, unprocessed planes will be
  9926. copied from first stream.
  9927. By default value 0xf, all planes will be processed.
  9928. @end table
  9929. @section maskedmin
  9930. Merge the second and third input stream into output stream using absolute differences
  9931. between second input stream and first input stream and absolute difference between
  9932. third input stream and first input stream. The picked value will be from second input
  9933. stream if second absolute difference is less than first one or from third input stream
  9934. otherwise.
  9935. This filter accepts the following options:
  9936. @table @option
  9937. @item planes
  9938. Set which planes will be processed as bitmap, unprocessed planes will be
  9939. copied from first stream.
  9940. By default value 0xf, all planes will be processed.
  9941. @end table
  9942. @section maskfun
  9943. Create mask from input video.
  9944. For example it is useful to create motion masks after @code{tblend} filter.
  9945. This filter accepts the following options:
  9946. @table @option
  9947. @item low
  9948. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9949. @item high
  9950. Set high threshold. Any pixel component higher than this value will be set to max value
  9951. allowed for current pixel format.
  9952. @item planes
  9953. Set planes to filter, by default all available planes are filtered.
  9954. @item fill
  9955. Fill all frame pixels with this value.
  9956. @item sum
  9957. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9958. average, output frame will be completely filled with value set by @var{fill} option.
  9959. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9960. @end table
  9961. @section mcdeint
  9962. Apply motion-compensation deinterlacing.
  9963. It needs one field per frame as input and must thus be used together
  9964. with yadif=1/3 or equivalent.
  9965. This filter accepts the following options:
  9966. @table @option
  9967. @item mode
  9968. Set the deinterlacing mode.
  9969. It accepts one of the following values:
  9970. @table @samp
  9971. @item fast
  9972. @item medium
  9973. @item slow
  9974. use iterative motion estimation
  9975. @item extra_slow
  9976. like @samp{slow}, but use multiple reference frames.
  9977. @end table
  9978. Default value is @samp{fast}.
  9979. @item parity
  9980. Set the picture field parity assumed for the input video. It must be
  9981. one of the following values:
  9982. @table @samp
  9983. @item 0, tff
  9984. assume top field first
  9985. @item 1, bff
  9986. assume bottom field first
  9987. @end table
  9988. Default value is @samp{bff}.
  9989. @item qp
  9990. Set per-block quantization parameter (QP) used by the internal
  9991. encoder.
  9992. Higher values should result in a smoother motion vector field but less
  9993. optimal individual vectors. Default value is 1.
  9994. @end table
  9995. @section median
  9996. Pick median pixel from certain rectangle defined by radius.
  9997. This filter accepts the following options:
  9998. @table @option
  9999. @item radius
  10000. Set horizontal radius size. Default value is @code{1}.
  10001. Allowed range is integer from 1 to 127.
  10002. @item planes
  10003. Set which planes to process. Default is @code{15}, which is all available planes.
  10004. @item radiusV
  10005. Set vertical radius size. Default value is @code{0}.
  10006. Allowed range is integer from 0 to 127.
  10007. If it is 0, value will be picked from horizontal @code{radius} option.
  10008. @end table
  10009. @subsection Commands
  10010. This filter supports same @ref{commands} as options.
  10011. The command accepts the same syntax of the corresponding option.
  10012. If the specified expression is not valid, it is kept at its current
  10013. value.
  10014. @section mergeplanes
  10015. Merge color channel components from several video streams.
  10016. The filter accepts up to 4 input streams, and merge selected input
  10017. planes to the output video.
  10018. This filter accepts the following options:
  10019. @table @option
  10020. @item mapping
  10021. Set input to output plane mapping. Default is @code{0}.
  10022. The mappings is specified as a bitmap. It should be specified as a
  10023. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10024. mapping for the first plane of the output stream. 'A' sets the number of
  10025. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10026. corresponding input to use (from 0 to 3). The rest of the mappings is
  10027. similar, 'Bb' describes the mapping for the output stream second
  10028. plane, 'Cc' describes the mapping for the output stream third plane and
  10029. 'Dd' describes the mapping for the output stream fourth plane.
  10030. @item format
  10031. Set output pixel format. Default is @code{yuva444p}.
  10032. @end table
  10033. @subsection Examples
  10034. @itemize
  10035. @item
  10036. Merge three gray video streams of same width and height into single video stream:
  10037. @example
  10038. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10039. @end example
  10040. @item
  10041. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10042. @example
  10043. [a0][a1]mergeplanes=0x00010210:yuva444p
  10044. @end example
  10045. @item
  10046. Swap Y and A plane in yuva444p stream:
  10047. @example
  10048. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10049. @end example
  10050. @item
  10051. Swap U and V plane in yuv420p stream:
  10052. @example
  10053. format=yuv420p,mergeplanes=0x000201:yuv420p
  10054. @end example
  10055. @item
  10056. Cast a rgb24 clip to yuv444p:
  10057. @example
  10058. format=rgb24,mergeplanes=0x000102:yuv444p
  10059. @end example
  10060. @end itemize
  10061. @section mestimate
  10062. Estimate and export motion vectors using block matching algorithms.
  10063. Motion vectors are stored in frame side data to be used by other filters.
  10064. This filter accepts the following options:
  10065. @table @option
  10066. @item method
  10067. Specify the motion estimation method. Accepts one of the following values:
  10068. @table @samp
  10069. @item esa
  10070. Exhaustive search algorithm.
  10071. @item tss
  10072. Three step search algorithm.
  10073. @item tdls
  10074. Two dimensional logarithmic search algorithm.
  10075. @item ntss
  10076. New three step search algorithm.
  10077. @item fss
  10078. Four step search algorithm.
  10079. @item ds
  10080. Diamond search algorithm.
  10081. @item hexbs
  10082. Hexagon-based search algorithm.
  10083. @item epzs
  10084. Enhanced predictive zonal search algorithm.
  10085. @item umh
  10086. Uneven multi-hexagon search algorithm.
  10087. @end table
  10088. Default value is @samp{esa}.
  10089. @item mb_size
  10090. Macroblock size. Default @code{16}.
  10091. @item search_param
  10092. Search parameter. Default @code{7}.
  10093. @end table
  10094. @section midequalizer
  10095. Apply Midway Image Equalization effect using two video streams.
  10096. Midway Image Equalization adjusts a pair of images to have the same
  10097. histogram, while maintaining their dynamics as much as possible. It's
  10098. useful for e.g. matching exposures from a pair of stereo cameras.
  10099. This filter has two inputs and one output, which must be of same pixel format, but
  10100. may be of different sizes. The output of filter is first input adjusted with
  10101. midway histogram of both inputs.
  10102. This filter accepts the following option:
  10103. @table @option
  10104. @item planes
  10105. Set which planes to process. Default is @code{15}, which is all available planes.
  10106. @end table
  10107. @section minterpolate
  10108. Convert the video to specified frame rate using motion interpolation.
  10109. This filter accepts the following options:
  10110. @table @option
  10111. @item fps
  10112. 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}.
  10113. @item mi_mode
  10114. Motion interpolation mode. Following values are accepted:
  10115. @table @samp
  10116. @item dup
  10117. Duplicate previous or next frame for interpolating new ones.
  10118. @item blend
  10119. Blend source frames. Interpolated frame is mean of previous and next frames.
  10120. @item mci
  10121. Motion compensated interpolation. Following options are effective when this mode is selected:
  10122. @table @samp
  10123. @item mc_mode
  10124. Motion compensation mode. Following values are accepted:
  10125. @table @samp
  10126. @item obmc
  10127. Overlapped block motion compensation.
  10128. @item aobmc
  10129. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10130. @end table
  10131. Default mode is @samp{obmc}.
  10132. @item me_mode
  10133. Motion estimation mode. Following values are accepted:
  10134. @table @samp
  10135. @item bidir
  10136. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10137. @item bilat
  10138. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10139. @end table
  10140. Default mode is @samp{bilat}.
  10141. @item me
  10142. The algorithm to be used for motion estimation. Following values are accepted:
  10143. @table @samp
  10144. @item esa
  10145. Exhaustive search algorithm.
  10146. @item tss
  10147. Three step search algorithm.
  10148. @item tdls
  10149. Two dimensional logarithmic search algorithm.
  10150. @item ntss
  10151. New three step search algorithm.
  10152. @item fss
  10153. Four step search algorithm.
  10154. @item ds
  10155. Diamond search algorithm.
  10156. @item hexbs
  10157. Hexagon-based search algorithm.
  10158. @item epzs
  10159. Enhanced predictive zonal search algorithm.
  10160. @item umh
  10161. Uneven multi-hexagon search algorithm.
  10162. @end table
  10163. Default algorithm is @samp{epzs}.
  10164. @item mb_size
  10165. Macroblock size. Default @code{16}.
  10166. @item search_param
  10167. Motion estimation search parameter. Default @code{32}.
  10168. @item vsbmc
  10169. 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).
  10170. @end table
  10171. @end table
  10172. @item scd
  10173. 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:
  10174. @table @samp
  10175. @item none
  10176. Disable scene change detection.
  10177. @item fdiff
  10178. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10179. @end table
  10180. Default method is @samp{fdiff}.
  10181. @item scd_threshold
  10182. Scene change detection threshold. Default is @code{5.0}.
  10183. @end table
  10184. @section mix
  10185. Mix several video input streams into one video stream.
  10186. A description of the accepted options follows.
  10187. @table @option
  10188. @item nb_inputs
  10189. The number of inputs. If unspecified, it defaults to 2.
  10190. @item weights
  10191. Specify weight of each input video stream as sequence.
  10192. Each weight is separated by space. If number of weights
  10193. is smaller than number of @var{frames} last specified
  10194. weight will be used for all remaining unset weights.
  10195. @item scale
  10196. Specify scale, if it is set it will be multiplied with sum
  10197. of each weight multiplied with pixel values to give final destination
  10198. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10199. @item duration
  10200. Specify how end of stream is determined.
  10201. @table @samp
  10202. @item longest
  10203. The duration of the longest input. (default)
  10204. @item shortest
  10205. The duration of the shortest input.
  10206. @item first
  10207. The duration of the first input.
  10208. @end table
  10209. @end table
  10210. @section mpdecimate
  10211. Drop frames that do not differ greatly from the previous frame in
  10212. order to reduce frame rate.
  10213. The main use of this filter is for very-low-bitrate encoding
  10214. (e.g. streaming over dialup modem), but it could in theory be used for
  10215. fixing movies that were inverse-telecined incorrectly.
  10216. A description of the accepted options follows.
  10217. @table @option
  10218. @item max
  10219. Set the maximum number of consecutive frames which can be dropped (if
  10220. positive), or the minimum interval between dropped frames (if
  10221. negative). If the value is 0, the frame is dropped disregarding the
  10222. number of previous sequentially dropped frames.
  10223. Default value is 0.
  10224. @item hi
  10225. @item lo
  10226. @item frac
  10227. Set the dropping threshold values.
  10228. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10229. represent actual pixel value differences, so a threshold of 64
  10230. corresponds to 1 unit of difference for each pixel, or the same spread
  10231. out differently over the block.
  10232. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10233. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10234. meaning the whole image) differ by more than a threshold of @option{lo}.
  10235. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10236. 64*5, and default value for @option{frac} is 0.33.
  10237. @end table
  10238. @section negate
  10239. Negate (invert) the input video.
  10240. It accepts the following option:
  10241. @table @option
  10242. @item negate_alpha
  10243. With value 1, it negates the alpha component, if present. Default value is 0.
  10244. @end table
  10245. @anchor{nlmeans}
  10246. @section nlmeans
  10247. Denoise frames using Non-Local Means algorithm.
  10248. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10249. context similarity is defined by comparing their surrounding patches of size
  10250. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10251. around the pixel.
  10252. Note that the research area defines centers for patches, which means some
  10253. patches will be made of pixels outside that research area.
  10254. The filter accepts the following options.
  10255. @table @option
  10256. @item s
  10257. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10258. @item p
  10259. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10260. @item pc
  10261. Same as @option{p} but for chroma planes.
  10262. The default value is @var{0} and means automatic.
  10263. @item r
  10264. Set research size. Default is 15. Must be odd number in range [0, 99].
  10265. @item rc
  10266. Same as @option{r} but for chroma planes.
  10267. The default value is @var{0} and means automatic.
  10268. @end table
  10269. @section nnedi
  10270. Deinterlace video using neural network edge directed interpolation.
  10271. This filter accepts the following options:
  10272. @table @option
  10273. @item weights
  10274. Mandatory option, without binary file filter can not work.
  10275. Currently file can be found here:
  10276. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10277. @item deint
  10278. Set which frames to deinterlace, by default it is @code{all}.
  10279. Can be @code{all} or @code{interlaced}.
  10280. @item field
  10281. Set mode of operation.
  10282. Can be one of the following:
  10283. @table @samp
  10284. @item af
  10285. Use frame flags, both fields.
  10286. @item a
  10287. Use frame flags, single field.
  10288. @item t
  10289. Use top field only.
  10290. @item b
  10291. Use bottom field only.
  10292. @item tf
  10293. Use both fields, top first.
  10294. @item bf
  10295. Use both fields, bottom first.
  10296. @end table
  10297. @item planes
  10298. Set which planes to process, by default filter process all frames.
  10299. @item nsize
  10300. Set size of local neighborhood around each pixel, used by the predictor neural
  10301. network.
  10302. Can be one of the following:
  10303. @table @samp
  10304. @item s8x6
  10305. @item s16x6
  10306. @item s32x6
  10307. @item s48x6
  10308. @item s8x4
  10309. @item s16x4
  10310. @item s32x4
  10311. @end table
  10312. @item nns
  10313. Set the number of neurons in predictor neural network.
  10314. Can be one of the following:
  10315. @table @samp
  10316. @item n16
  10317. @item n32
  10318. @item n64
  10319. @item n128
  10320. @item n256
  10321. @end table
  10322. @item qual
  10323. Controls the number of different neural network predictions that are blended
  10324. together to compute the final output value. Can be @code{fast}, default or
  10325. @code{slow}.
  10326. @item etype
  10327. Set which set of weights to use in the predictor.
  10328. Can be one of the following:
  10329. @table @samp
  10330. @item a
  10331. weights trained to minimize absolute error
  10332. @item s
  10333. weights trained to minimize squared error
  10334. @end table
  10335. @item pscrn
  10336. Controls whether or not the prescreener neural network is used to decide
  10337. which pixels should be processed by the predictor neural network and which
  10338. can be handled by simple cubic interpolation.
  10339. The prescreener is trained to know whether cubic interpolation will be
  10340. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10341. The computational complexity of the prescreener nn is much less than that of
  10342. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10343. using the prescreener generally results in much faster processing.
  10344. The prescreener is pretty accurate, so the difference between using it and not
  10345. using it is almost always unnoticeable.
  10346. Can be one of the following:
  10347. @table @samp
  10348. @item none
  10349. @item original
  10350. @item new
  10351. @end table
  10352. Default is @code{new}.
  10353. @item fapprox
  10354. Set various debugging flags.
  10355. @end table
  10356. @section noformat
  10357. Force libavfilter not to use any of the specified pixel formats for the
  10358. input to the next filter.
  10359. It accepts the following parameters:
  10360. @table @option
  10361. @item pix_fmts
  10362. A '|'-separated list of pixel format names, such as
  10363. pix_fmts=yuv420p|monow|rgb24".
  10364. @end table
  10365. @subsection Examples
  10366. @itemize
  10367. @item
  10368. Force libavfilter to use a format different from @var{yuv420p} for the
  10369. input to the vflip filter:
  10370. @example
  10371. noformat=pix_fmts=yuv420p,vflip
  10372. @end example
  10373. @item
  10374. Convert the input video to any of the formats not contained in the list:
  10375. @example
  10376. noformat=yuv420p|yuv444p|yuv410p
  10377. @end example
  10378. @end itemize
  10379. @section noise
  10380. Add noise on video input frame.
  10381. The filter accepts the following options:
  10382. @table @option
  10383. @item all_seed
  10384. @item c0_seed
  10385. @item c1_seed
  10386. @item c2_seed
  10387. @item c3_seed
  10388. Set noise seed for specific pixel component or all pixel components in case
  10389. of @var{all_seed}. Default value is @code{123457}.
  10390. @item all_strength, alls
  10391. @item c0_strength, c0s
  10392. @item c1_strength, c1s
  10393. @item c2_strength, c2s
  10394. @item c3_strength, c3s
  10395. Set noise strength for specific pixel component or all pixel components in case
  10396. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10397. @item all_flags, allf
  10398. @item c0_flags, c0f
  10399. @item c1_flags, c1f
  10400. @item c2_flags, c2f
  10401. @item c3_flags, c3f
  10402. Set pixel component flags or set flags for all components if @var{all_flags}.
  10403. Available values for component flags are:
  10404. @table @samp
  10405. @item a
  10406. averaged temporal noise (smoother)
  10407. @item p
  10408. mix random noise with a (semi)regular pattern
  10409. @item t
  10410. temporal noise (noise pattern changes between frames)
  10411. @item u
  10412. uniform noise (gaussian otherwise)
  10413. @end table
  10414. @end table
  10415. @subsection Examples
  10416. Add temporal and uniform noise to input video:
  10417. @example
  10418. noise=alls=20:allf=t+u
  10419. @end example
  10420. @section normalize
  10421. Normalize RGB video (aka histogram stretching, contrast stretching).
  10422. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10423. For each channel of each frame, the filter computes the input range and maps
  10424. it linearly to the user-specified output range. The output range defaults
  10425. to the full dynamic range from pure black to pure white.
  10426. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10427. changes in brightness) caused when small dark or bright objects enter or leave
  10428. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10429. video camera, and, like a video camera, it may cause a period of over- or
  10430. under-exposure of the video.
  10431. The R,G,B channels can be normalized independently, which may cause some
  10432. color shifting, or linked together as a single channel, which prevents
  10433. color shifting. Linked normalization preserves hue. Independent normalization
  10434. does not, so it can be used to remove some color casts. Independent and linked
  10435. normalization can be combined in any ratio.
  10436. The normalize filter accepts the following options:
  10437. @table @option
  10438. @item blackpt
  10439. @item whitept
  10440. Colors which define the output range. The minimum input value is mapped to
  10441. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10442. The defaults are black and white respectively. Specifying white for
  10443. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10444. normalized video. Shades of grey can be used to reduce the dynamic range
  10445. (contrast). Specifying saturated colors here can create some interesting
  10446. effects.
  10447. @item smoothing
  10448. The number of previous frames to use for temporal smoothing. The input range
  10449. of each channel is smoothed using a rolling average over the current frame
  10450. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10451. smoothing).
  10452. @item independence
  10453. Controls the ratio of independent (color shifting) channel normalization to
  10454. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10455. independent. Defaults to 1.0 (fully independent).
  10456. @item strength
  10457. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10458. expensive no-op. Defaults to 1.0 (full strength).
  10459. @end table
  10460. @subsection Commands
  10461. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10462. The command accepts the same syntax of the corresponding option.
  10463. If the specified expression is not valid, it is kept at its current
  10464. value.
  10465. @subsection Examples
  10466. Stretch video contrast to use the full dynamic range, with no temporal
  10467. smoothing; may flicker depending on the source content:
  10468. @example
  10469. normalize=blackpt=black:whitept=white:smoothing=0
  10470. @end example
  10471. As above, but with 50 frames of temporal smoothing; flicker should be
  10472. reduced, depending on the source content:
  10473. @example
  10474. normalize=blackpt=black:whitept=white:smoothing=50
  10475. @end example
  10476. As above, but with hue-preserving linked channel normalization:
  10477. @example
  10478. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10479. @end example
  10480. As above, but with half strength:
  10481. @example
  10482. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10483. @end example
  10484. Map the darkest input color to red, the brightest input color to cyan:
  10485. @example
  10486. normalize=blackpt=red:whitept=cyan
  10487. @end example
  10488. @section null
  10489. Pass the video source unchanged to the output.
  10490. @section ocr
  10491. Optical Character Recognition
  10492. This filter uses Tesseract for optical character recognition. To enable
  10493. compilation of this filter, you need to configure FFmpeg with
  10494. @code{--enable-libtesseract}.
  10495. It accepts the following options:
  10496. @table @option
  10497. @item datapath
  10498. Set datapath to tesseract data. Default is to use whatever was
  10499. set at installation.
  10500. @item language
  10501. Set language, default is "eng".
  10502. @item whitelist
  10503. Set character whitelist.
  10504. @item blacklist
  10505. Set character blacklist.
  10506. @end table
  10507. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10508. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10509. @section ocv
  10510. Apply a video transform using libopencv.
  10511. To enable this filter, install the libopencv library and headers and
  10512. configure FFmpeg with @code{--enable-libopencv}.
  10513. It accepts the following parameters:
  10514. @table @option
  10515. @item filter_name
  10516. The name of the libopencv filter to apply.
  10517. @item filter_params
  10518. The parameters to pass to the libopencv filter. If not specified, the default
  10519. values are assumed.
  10520. @end table
  10521. Refer to the official libopencv documentation for more precise
  10522. information:
  10523. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10524. Several libopencv filters are supported; see the following subsections.
  10525. @anchor{dilate}
  10526. @subsection dilate
  10527. Dilate an image by using a specific structuring element.
  10528. It corresponds to the libopencv function @code{cvDilate}.
  10529. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10530. @var{struct_el} represents a structuring element, and has the syntax:
  10531. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10532. @var{cols} and @var{rows} represent the number of columns and rows of
  10533. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10534. point, and @var{shape} the shape for the structuring element. @var{shape}
  10535. must be "rect", "cross", "ellipse", or "custom".
  10536. If the value for @var{shape} is "custom", it must be followed by a
  10537. string of the form "=@var{filename}". The file with name
  10538. @var{filename} is assumed to represent a binary image, with each
  10539. printable character corresponding to a bright pixel. When a custom
  10540. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10541. or columns and rows of the read file are assumed instead.
  10542. The default value for @var{struct_el} is "3x3+0x0/rect".
  10543. @var{nb_iterations} specifies the number of times the transform is
  10544. applied to the image, and defaults to 1.
  10545. Some examples:
  10546. @example
  10547. # Use the default values
  10548. ocv=dilate
  10549. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10550. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10551. # Read the shape from the file diamond.shape, iterating two times.
  10552. # The file diamond.shape may contain a pattern of characters like this
  10553. # *
  10554. # ***
  10555. # *****
  10556. # ***
  10557. # *
  10558. # The specified columns and rows are ignored
  10559. # but the anchor point coordinates are not
  10560. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10561. @end example
  10562. @subsection erode
  10563. Erode an image by using a specific structuring element.
  10564. It corresponds to the libopencv function @code{cvErode}.
  10565. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10566. with the same syntax and semantics as the @ref{dilate} filter.
  10567. @subsection smooth
  10568. Smooth the input video.
  10569. The filter takes the following parameters:
  10570. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10571. @var{type} is the type of smooth filter to apply, and must be one of
  10572. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10573. or "bilateral". The default value is "gaussian".
  10574. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10575. depends on the smooth type. @var{param1} and
  10576. @var{param2} accept integer positive values or 0. @var{param3} and
  10577. @var{param4} accept floating point values.
  10578. The default value for @var{param1} is 3. The default value for the
  10579. other parameters is 0.
  10580. These parameters correspond to the parameters assigned to the
  10581. libopencv function @code{cvSmooth}.
  10582. @section oscilloscope
  10583. 2D Video Oscilloscope.
  10584. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10585. It accepts the following parameters:
  10586. @table @option
  10587. @item x
  10588. Set scope center x position.
  10589. @item y
  10590. Set scope center y position.
  10591. @item s
  10592. Set scope size, relative to frame diagonal.
  10593. @item t
  10594. Set scope tilt/rotation.
  10595. @item o
  10596. Set trace opacity.
  10597. @item tx
  10598. Set trace center x position.
  10599. @item ty
  10600. Set trace center y position.
  10601. @item tw
  10602. Set trace width, relative to width of frame.
  10603. @item th
  10604. Set trace height, relative to height of frame.
  10605. @item c
  10606. Set which components to trace. By default it traces first three components.
  10607. @item g
  10608. Draw trace grid. By default is enabled.
  10609. @item st
  10610. Draw some statistics. By default is enabled.
  10611. @item sc
  10612. Draw scope. By default is enabled.
  10613. @end table
  10614. @subsection Commands
  10615. This filter supports same @ref{commands} as options.
  10616. The command accepts the same syntax of the corresponding option.
  10617. If the specified expression is not valid, it is kept at its current
  10618. value.
  10619. @subsection Examples
  10620. @itemize
  10621. @item
  10622. Inspect full first row of video frame.
  10623. @example
  10624. oscilloscope=x=0.5:y=0:s=1
  10625. @end example
  10626. @item
  10627. Inspect full last row of video frame.
  10628. @example
  10629. oscilloscope=x=0.5:y=1:s=1
  10630. @end example
  10631. @item
  10632. Inspect full 5th line of video frame of height 1080.
  10633. @example
  10634. oscilloscope=x=0.5:y=5/1080:s=1
  10635. @end example
  10636. @item
  10637. Inspect full last column of video frame.
  10638. @example
  10639. oscilloscope=x=1:y=0.5:s=1:t=1
  10640. @end example
  10641. @end itemize
  10642. @anchor{overlay}
  10643. @section overlay
  10644. Overlay one video on top of another.
  10645. It takes two inputs and has one output. The first input is the "main"
  10646. video on which the second input is overlaid.
  10647. It accepts the following parameters:
  10648. A description of the accepted options follows.
  10649. @table @option
  10650. @item x
  10651. @item y
  10652. Set the expression for the x and y coordinates of the overlaid video
  10653. on the main video. Default value is "0" for both expressions. In case
  10654. the expression is invalid, it is set to a huge value (meaning that the
  10655. overlay will not be displayed within the output visible area).
  10656. @item eof_action
  10657. See @ref{framesync}.
  10658. @item eval
  10659. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10660. It accepts the following values:
  10661. @table @samp
  10662. @item init
  10663. only evaluate expressions once during the filter initialization or
  10664. when a command is processed
  10665. @item frame
  10666. evaluate expressions for each incoming frame
  10667. @end table
  10668. Default value is @samp{frame}.
  10669. @item shortest
  10670. See @ref{framesync}.
  10671. @item format
  10672. Set the format for the output video.
  10673. It accepts the following values:
  10674. @table @samp
  10675. @item yuv420
  10676. force YUV420 output
  10677. @item yuv422
  10678. force YUV422 output
  10679. @item yuv444
  10680. force YUV444 output
  10681. @item rgb
  10682. force packed RGB output
  10683. @item gbrp
  10684. force planar RGB output
  10685. @item auto
  10686. automatically pick format
  10687. @end table
  10688. Default value is @samp{yuv420}.
  10689. @item repeatlast
  10690. See @ref{framesync}.
  10691. @item alpha
  10692. Set format of alpha of the overlaid video, it can be @var{straight} or
  10693. @var{premultiplied}. Default is @var{straight}.
  10694. @end table
  10695. The @option{x}, and @option{y} expressions can contain the following
  10696. parameters.
  10697. @table @option
  10698. @item main_w, W
  10699. @item main_h, H
  10700. The main input width and height.
  10701. @item overlay_w, w
  10702. @item overlay_h, h
  10703. The overlay input width and height.
  10704. @item x
  10705. @item y
  10706. The computed values for @var{x} and @var{y}. They are evaluated for
  10707. each new frame.
  10708. @item hsub
  10709. @item vsub
  10710. horizontal and vertical chroma subsample values of the output
  10711. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10712. @var{vsub} is 1.
  10713. @item n
  10714. the number of input frame, starting from 0
  10715. @item pos
  10716. the position in the file of the input frame, NAN if unknown
  10717. @item t
  10718. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10719. @end table
  10720. This filter also supports the @ref{framesync} options.
  10721. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10722. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10723. when @option{eval} is set to @samp{init}.
  10724. Be aware that frames are taken from each input video in timestamp
  10725. order, hence, if their initial timestamps differ, it is a good idea
  10726. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10727. have them begin in the same zero timestamp, as the example for
  10728. the @var{movie} filter does.
  10729. You can chain together more overlays but you should test the
  10730. efficiency of such approach.
  10731. @subsection Commands
  10732. This filter supports the following commands:
  10733. @table @option
  10734. @item x
  10735. @item y
  10736. Modify the x and y of the overlay input.
  10737. The command accepts the same syntax of the corresponding option.
  10738. If the specified expression is not valid, it is kept at its current
  10739. value.
  10740. @end table
  10741. @subsection Examples
  10742. @itemize
  10743. @item
  10744. Draw the overlay at 10 pixels from the bottom right corner of the main
  10745. video:
  10746. @example
  10747. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10748. @end example
  10749. Using named options the example above becomes:
  10750. @example
  10751. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10752. @end example
  10753. @item
  10754. Insert a transparent PNG logo in the bottom left corner of the input,
  10755. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10756. @example
  10757. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10758. @end example
  10759. @item
  10760. Insert 2 different transparent PNG logos (second logo on bottom
  10761. right corner) using the @command{ffmpeg} tool:
  10762. @example
  10763. 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
  10764. @end example
  10765. @item
  10766. Add a transparent color layer on top of the main video; @code{WxH}
  10767. must specify the size of the main input to the overlay filter:
  10768. @example
  10769. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10770. @end example
  10771. @item
  10772. Play an original video and a filtered version (here with the deshake
  10773. filter) side by side using the @command{ffplay} tool:
  10774. @example
  10775. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10776. @end example
  10777. The above command is the same as:
  10778. @example
  10779. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10780. @end example
  10781. @item
  10782. Make a sliding overlay appearing from the left to the right top part of the
  10783. screen starting since time 2:
  10784. @example
  10785. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10786. @end example
  10787. @item
  10788. Compose output by putting two input videos side to side:
  10789. @example
  10790. ffmpeg -i left.avi -i right.avi -filter_complex "
  10791. nullsrc=size=200x100 [background];
  10792. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10793. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10794. [background][left] overlay=shortest=1 [background+left];
  10795. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10796. "
  10797. @end example
  10798. @item
  10799. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10800. @example
  10801. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10802. -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]'
  10803. masked.avi
  10804. @end example
  10805. @item
  10806. Chain several overlays in cascade:
  10807. @example
  10808. nullsrc=s=200x200 [bg];
  10809. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10810. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10811. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10812. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10813. [in3] null, [mid2] overlay=100:100 [out0]
  10814. @end example
  10815. @end itemize
  10816. @section owdenoise
  10817. Apply Overcomplete Wavelet denoiser.
  10818. The filter accepts the following options:
  10819. @table @option
  10820. @item depth
  10821. Set depth.
  10822. Larger depth values will denoise lower frequency components more, but
  10823. slow down filtering.
  10824. Must be an int in the range 8-16, default is @code{8}.
  10825. @item luma_strength, ls
  10826. Set luma strength.
  10827. Must be a double value in the range 0-1000, default is @code{1.0}.
  10828. @item chroma_strength, cs
  10829. Set chroma strength.
  10830. Must be a double value in the range 0-1000, default is @code{1.0}.
  10831. @end table
  10832. @anchor{pad}
  10833. @section pad
  10834. Add paddings to the input image, and place the original input at the
  10835. provided @var{x}, @var{y} coordinates.
  10836. It accepts the following parameters:
  10837. @table @option
  10838. @item width, w
  10839. @item height, h
  10840. Specify an expression for the size of the output image with the
  10841. paddings added. If the value for @var{width} or @var{height} is 0, the
  10842. corresponding input size is used for the output.
  10843. The @var{width} expression can reference the value set by the
  10844. @var{height} expression, and vice versa.
  10845. The default value of @var{width} and @var{height} is 0.
  10846. @item x
  10847. @item y
  10848. Specify the offsets to place the input image at within the padded area,
  10849. with respect to the top/left border of the output image.
  10850. The @var{x} expression can reference the value set by the @var{y}
  10851. expression, and vice versa.
  10852. The default value of @var{x} and @var{y} is 0.
  10853. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10854. so the input image is centered on the padded area.
  10855. @item color
  10856. Specify the color of the padded area. For the syntax of this option,
  10857. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10858. manual,ffmpeg-utils}.
  10859. The default value of @var{color} is "black".
  10860. @item eval
  10861. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10862. It accepts the following values:
  10863. @table @samp
  10864. @item init
  10865. Only evaluate expressions once during the filter initialization or when
  10866. a command is processed.
  10867. @item frame
  10868. Evaluate expressions for each incoming frame.
  10869. @end table
  10870. Default value is @samp{init}.
  10871. @item aspect
  10872. Pad to aspect instead to a resolution.
  10873. @end table
  10874. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10875. options are expressions containing the following constants:
  10876. @table @option
  10877. @item in_w
  10878. @item in_h
  10879. The input video width and height.
  10880. @item iw
  10881. @item ih
  10882. These are the same as @var{in_w} and @var{in_h}.
  10883. @item out_w
  10884. @item out_h
  10885. The output width and height (the size of the padded area), as
  10886. specified by the @var{width} and @var{height} expressions.
  10887. @item ow
  10888. @item oh
  10889. These are the same as @var{out_w} and @var{out_h}.
  10890. @item x
  10891. @item y
  10892. The x and y offsets as specified by the @var{x} and @var{y}
  10893. expressions, or NAN if not yet specified.
  10894. @item a
  10895. same as @var{iw} / @var{ih}
  10896. @item sar
  10897. input sample aspect ratio
  10898. @item dar
  10899. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10900. @item hsub
  10901. @item vsub
  10902. The horizontal and vertical chroma subsample values. For example for the
  10903. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10904. @end table
  10905. @subsection Examples
  10906. @itemize
  10907. @item
  10908. Add paddings with the color "violet" to the input video. The output video
  10909. size is 640x480, and the top-left corner of the input video is placed at
  10910. column 0, row 40
  10911. @example
  10912. pad=640:480:0:40:violet
  10913. @end example
  10914. The example above is equivalent to the following command:
  10915. @example
  10916. pad=width=640:height=480:x=0:y=40:color=violet
  10917. @end example
  10918. @item
  10919. Pad the input to get an output with dimensions increased by 3/2,
  10920. and put the input video at the center of the padded area:
  10921. @example
  10922. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10923. @end example
  10924. @item
  10925. Pad the input to get a squared output with size equal to the maximum
  10926. value between the input width and height, and put the input video at
  10927. the center of the padded area:
  10928. @example
  10929. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10930. @end example
  10931. @item
  10932. Pad the input to get a final w/h ratio of 16:9:
  10933. @example
  10934. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10935. @end example
  10936. @item
  10937. In case of anamorphic video, in order to set the output display aspect
  10938. correctly, it is necessary to use @var{sar} in the expression,
  10939. according to the relation:
  10940. @example
  10941. (ih * X / ih) * sar = output_dar
  10942. X = output_dar / sar
  10943. @end example
  10944. Thus the previous example needs to be modified to:
  10945. @example
  10946. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10947. @end example
  10948. @item
  10949. Double the output size and put the input video in the bottom-right
  10950. corner of the output padded area:
  10951. @example
  10952. pad="2*iw:2*ih:ow-iw:oh-ih"
  10953. @end example
  10954. @end itemize
  10955. @anchor{palettegen}
  10956. @section palettegen
  10957. Generate one palette for a whole video stream.
  10958. It accepts the following options:
  10959. @table @option
  10960. @item max_colors
  10961. Set the maximum number of colors to quantize in the palette.
  10962. Note: the palette will still contain 256 colors; the unused palette entries
  10963. will be black.
  10964. @item reserve_transparent
  10965. Create a palette of 255 colors maximum and reserve the last one for
  10966. transparency. Reserving the transparency color is useful for GIF optimization.
  10967. If not set, the maximum of colors in the palette will be 256. You probably want
  10968. to disable this option for a standalone image.
  10969. Set by default.
  10970. @item transparency_color
  10971. Set the color that will be used as background for transparency.
  10972. @item stats_mode
  10973. Set statistics mode.
  10974. It accepts the following values:
  10975. @table @samp
  10976. @item full
  10977. Compute full frame histograms.
  10978. @item diff
  10979. Compute histograms only for the part that differs from previous frame. This
  10980. might be relevant to give more importance to the moving part of your input if
  10981. the background is static.
  10982. @item single
  10983. Compute new histogram for each frame.
  10984. @end table
  10985. Default value is @var{full}.
  10986. @end table
  10987. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10988. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10989. color quantization of the palette. This information is also visible at
  10990. @var{info} logging level.
  10991. @subsection Examples
  10992. @itemize
  10993. @item
  10994. Generate a representative palette of a given video using @command{ffmpeg}:
  10995. @example
  10996. ffmpeg -i input.mkv -vf palettegen palette.png
  10997. @end example
  10998. @end itemize
  10999. @section paletteuse
  11000. Use a palette to downsample an input video stream.
  11001. The filter takes two inputs: one video stream and a palette. The palette must
  11002. be a 256 pixels image.
  11003. It accepts the following options:
  11004. @table @option
  11005. @item dither
  11006. Select dithering mode. Available algorithms are:
  11007. @table @samp
  11008. @item bayer
  11009. Ordered 8x8 bayer dithering (deterministic)
  11010. @item heckbert
  11011. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11012. Note: this dithering is sometimes considered "wrong" and is included as a
  11013. reference.
  11014. @item floyd_steinberg
  11015. Floyd and Steingberg dithering (error diffusion)
  11016. @item sierra2
  11017. Frankie Sierra dithering v2 (error diffusion)
  11018. @item sierra2_4a
  11019. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11020. @end table
  11021. Default is @var{sierra2_4a}.
  11022. @item bayer_scale
  11023. When @var{bayer} dithering is selected, this option defines the scale of the
  11024. pattern (how much the crosshatch pattern is visible). A low value means more
  11025. visible pattern for less banding, and higher value means less visible pattern
  11026. at the cost of more banding.
  11027. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11028. @item diff_mode
  11029. If set, define the zone to process
  11030. @table @samp
  11031. @item rectangle
  11032. Only the changing rectangle will be reprocessed. This is similar to GIF
  11033. cropping/offsetting compression mechanism. This option can be useful for speed
  11034. if only a part of the image is changing, and has use cases such as limiting the
  11035. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11036. moving scene (it leads to more deterministic output if the scene doesn't change
  11037. much, and as a result less moving noise and better GIF compression).
  11038. @end table
  11039. Default is @var{none}.
  11040. @item new
  11041. Take new palette for each output frame.
  11042. @item alpha_threshold
  11043. Sets the alpha threshold for transparency. Alpha values above this threshold
  11044. will be treated as completely opaque, and values below this threshold will be
  11045. treated as completely transparent.
  11046. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11047. @end table
  11048. @subsection Examples
  11049. @itemize
  11050. @item
  11051. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11052. using @command{ffmpeg}:
  11053. @example
  11054. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11055. @end example
  11056. @end itemize
  11057. @section perspective
  11058. Correct perspective of video not recorded perpendicular to the screen.
  11059. A description of the accepted parameters follows.
  11060. @table @option
  11061. @item x0
  11062. @item y0
  11063. @item x1
  11064. @item y1
  11065. @item x2
  11066. @item y2
  11067. @item x3
  11068. @item y3
  11069. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11070. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11071. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11072. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11073. then the corners of the source will be sent to the specified coordinates.
  11074. The expressions can use the following variables:
  11075. @table @option
  11076. @item W
  11077. @item H
  11078. the width and height of video frame.
  11079. @item in
  11080. Input frame count.
  11081. @item on
  11082. Output frame count.
  11083. @end table
  11084. @item interpolation
  11085. Set interpolation for perspective correction.
  11086. It accepts the following values:
  11087. @table @samp
  11088. @item linear
  11089. @item cubic
  11090. @end table
  11091. Default value is @samp{linear}.
  11092. @item sense
  11093. Set interpretation of coordinate options.
  11094. It accepts the following values:
  11095. @table @samp
  11096. @item 0, source
  11097. Send point in the source specified by the given coordinates to
  11098. the corners of the destination.
  11099. @item 1, destination
  11100. Send the corners of the source to the point in the destination specified
  11101. by the given coordinates.
  11102. Default value is @samp{source}.
  11103. @end table
  11104. @item eval
  11105. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11106. It accepts the following values:
  11107. @table @samp
  11108. @item init
  11109. only evaluate expressions once during the filter initialization or
  11110. when a command is processed
  11111. @item frame
  11112. evaluate expressions for each incoming frame
  11113. @end table
  11114. Default value is @samp{init}.
  11115. @end table
  11116. @section phase
  11117. Delay interlaced video by one field time so that the field order changes.
  11118. The intended use is to fix PAL movies that have been captured with the
  11119. opposite field order to the film-to-video transfer.
  11120. A description of the accepted parameters follows.
  11121. @table @option
  11122. @item mode
  11123. Set phase mode.
  11124. It accepts the following values:
  11125. @table @samp
  11126. @item t
  11127. Capture field order top-first, transfer bottom-first.
  11128. Filter will delay the bottom field.
  11129. @item b
  11130. Capture field order bottom-first, transfer top-first.
  11131. Filter will delay the top field.
  11132. @item p
  11133. Capture and transfer with the same field order. This mode only exists
  11134. for the documentation of the other options to refer to, but if you
  11135. actually select it, the filter will faithfully do nothing.
  11136. @item a
  11137. Capture field order determined automatically by field flags, transfer
  11138. opposite.
  11139. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11140. basis using field flags. If no field information is available,
  11141. then this works just like @samp{u}.
  11142. @item u
  11143. Capture unknown or varying, transfer opposite.
  11144. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11145. analyzing the images and selecting the alternative that produces best
  11146. match between the fields.
  11147. @item T
  11148. Capture top-first, transfer unknown or varying.
  11149. Filter selects among @samp{t} and @samp{p} using image analysis.
  11150. @item B
  11151. Capture bottom-first, transfer unknown or varying.
  11152. Filter selects among @samp{b} and @samp{p} using image analysis.
  11153. @item A
  11154. Capture determined by field flags, transfer unknown or varying.
  11155. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11156. image analysis. If no field information is available, then this works just
  11157. like @samp{U}. This is the default mode.
  11158. @item U
  11159. Both capture and transfer unknown or varying.
  11160. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11161. @end table
  11162. @end table
  11163. @section photosensitivity
  11164. Reduce various flashes in video, so to help users with epilepsy.
  11165. It accepts the following options:
  11166. @table @option
  11167. @item frames, f
  11168. Set how many frames to use when filtering. Default is 30.
  11169. @item threshold, t
  11170. Set detection threshold factor. Default is 1.
  11171. Lower is stricter.
  11172. @item skip
  11173. Set how many pixels to skip when sampling frames. Default is 1.
  11174. Allowed range is from 1 to 1024.
  11175. @item bypass
  11176. Leave frames unchanged. Default is disabled.
  11177. @end table
  11178. @section pixdesctest
  11179. Pixel format descriptor test filter, mainly useful for internal
  11180. testing. The output video should be equal to the input video.
  11181. For example:
  11182. @example
  11183. format=monow, pixdesctest
  11184. @end example
  11185. can be used to test the monowhite pixel format descriptor definition.
  11186. @section pixscope
  11187. Display sample values of color channels. Mainly useful for checking color
  11188. and levels. Minimum supported resolution is 640x480.
  11189. The filters accept the following options:
  11190. @table @option
  11191. @item x
  11192. Set scope X position, relative offset on X axis.
  11193. @item y
  11194. Set scope Y position, relative offset on Y axis.
  11195. @item w
  11196. Set scope width.
  11197. @item h
  11198. Set scope height.
  11199. @item o
  11200. Set window opacity. This window also holds statistics about pixel area.
  11201. @item wx
  11202. Set window X position, relative offset on X axis.
  11203. @item wy
  11204. Set window Y position, relative offset on Y axis.
  11205. @end table
  11206. @section pp
  11207. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11208. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11209. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11210. Each subfilter and some options have a short and a long name that can be used
  11211. interchangeably, i.e. dr/dering are the same.
  11212. The filters accept the following options:
  11213. @table @option
  11214. @item subfilters
  11215. Set postprocessing subfilters string.
  11216. @end table
  11217. All subfilters share common options to determine their scope:
  11218. @table @option
  11219. @item a/autoq
  11220. Honor the quality commands for this subfilter.
  11221. @item c/chrom
  11222. Do chrominance filtering, too (default).
  11223. @item y/nochrom
  11224. Do luminance filtering only (no chrominance).
  11225. @item n/noluma
  11226. Do chrominance filtering only (no luminance).
  11227. @end table
  11228. These options can be appended after the subfilter name, separated by a '|'.
  11229. Available subfilters are:
  11230. @table @option
  11231. @item hb/hdeblock[|difference[|flatness]]
  11232. Horizontal deblocking filter
  11233. @table @option
  11234. @item difference
  11235. Difference factor where higher values mean more deblocking (default: @code{32}).
  11236. @item flatness
  11237. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11238. @end table
  11239. @item vb/vdeblock[|difference[|flatness]]
  11240. Vertical deblocking filter
  11241. @table @option
  11242. @item difference
  11243. Difference factor where higher values mean more deblocking (default: @code{32}).
  11244. @item flatness
  11245. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11246. @end table
  11247. @item ha/hadeblock[|difference[|flatness]]
  11248. Accurate horizontal deblocking filter
  11249. @table @option
  11250. @item difference
  11251. Difference factor where higher values mean more deblocking (default: @code{32}).
  11252. @item flatness
  11253. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11254. @end table
  11255. @item va/vadeblock[|difference[|flatness]]
  11256. Accurate vertical deblocking filter
  11257. @table @option
  11258. @item difference
  11259. Difference factor where higher values mean more deblocking (default: @code{32}).
  11260. @item flatness
  11261. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11262. @end table
  11263. @end table
  11264. The horizontal and vertical deblocking filters share the difference and
  11265. flatness values so you cannot set different horizontal and vertical
  11266. thresholds.
  11267. @table @option
  11268. @item h1/x1hdeblock
  11269. Experimental horizontal deblocking filter
  11270. @item v1/x1vdeblock
  11271. Experimental vertical deblocking filter
  11272. @item dr/dering
  11273. Deringing filter
  11274. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11275. @table @option
  11276. @item threshold1
  11277. larger -> stronger filtering
  11278. @item threshold2
  11279. larger -> stronger filtering
  11280. @item threshold3
  11281. larger -> stronger filtering
  11282. @end table
  11283. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11284. @table @option
  11285. @item f/fullyrange
  11286. Stretch luminance to @code{0-255}.
  11287. @end table
  11288. @item lb/linblenddeint
  11289. Linear blend deinterlacing filter that deinterlaces the given block by
  11290. filtering all lines with a @code{(1 2 1)} filter.
  11291. @item li/linipoldeint
  11292. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11293. linearly interpolating every second line.
  11294. @item ci/cubicipoldeint
  11295. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11296. cubically interpolating every second line.
  11297. @item md/mediandeint
  11298. Median deinterlacing filter that deinterlaces the given block by applying a
  11299. median filter to every second line.
  11300. @item fd/ffmpegdeint
  11301. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11302. second line with a @code{(-1 4 2 4 -1)} filter.
  11303. @item l5/lowpass5
  11304. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11305. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11306. @item fq/forceQuant[|quantizer]
  11307. Overrides the quantizer table from the input with the constant quantizer you
  11308. specify.
  11309. @table @option
  11310. @item quantizer
  11311. Quantizer to use
  11312. @end table
  11313. @item de/default
  11314. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11315. @item fa/fast
  11316. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11317. @item ac
  11318. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11319. @end table
  11320. @subsection Examples
  11321. @itemize
  11322. @item
  11323. Apply horizontal and vertical deblocking, deringing and automatic
  11324. brightness/contrast:
  11325. @example
  11326. pp=hb/vb/dr/al
  11327. @end example
  11328. @item
  11329. Apply default filters without brightness/contrast correction:
  11330. @example
  11331. pp=de/-al
  11332. @end example
  11333. @item
  11334. Apply default filters and temporal denoiser:
  11335. @example
  11336. pp=default/tmpnoise|1|2|3
  11337. @end example
  11338. @item
  11339. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11340. automatically depending on available CPU time:
  11341. @example
  11342. pp=hb|y/vb|a
  11343. @end example
  11344. @end itemize
  11345. @section pp7
  11346. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11347. similar to spp = 6 with 7 point DCT, where only the center sample is
  11348. used after IDCT.
  11349. The filter accepts the following options:
  11350. @table @option
  11351. @item qp
  11352. Force a constant quantization parameter. It accepts an integer in range
  11353. 0 to 63. If not set, the filter will use the QP from the video stream
  11354. (if available).
  11355. @item mode
  11356. Set thresholding mode. Available modes are:
  11357. @table @samp
  11358. @item hard
  11359. Set hard thresholding.
  11360. @item soft
  11361. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11362. @item medium
  11363. Set medium thresholding (good results, default).
  11364. @end table
  11365. @end table
  11366. @section premultiply
  11367. Apply alpha premultiply effect to input video stream using first plane
  11368. of second stream as alpha.
  11369. Both streams must have same dimensions and same pixel format.
  11370. The filter accepts the following option:
  11371. @table @option
  11372. @item planes
  11373. Set which planes will be processed, unprocessed planes will be copied.
  11374. By default value 0xf, all planes will be processed.
  11375. @item inplace
  11376. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11377. @end table
  11378. @section prewitt
  11379. Apply prewitt operator to input video stream.
  11380. The filter accepts the following option:
  11381. @table @option
  11382. @item planes
  11383. Set which planes will be processed, unprocessed planes will be copied.
  11384. By default value 0xf, all planes will be processed.
  11385. @item scale
  11386. Set value which will be multiplied with filtered result.
  11387. @item delta
  11388. Set value which will be added to filtered result.
  11389. @end table
  11390. @anchor{program_opencl}
  11391. @section program_opencl
  11392. Filter video using an OpenCL program.
  11393. @table @option
  11394. @item source
  11395. OpenCL program source file.
  11396. @item kernel
  11397. Kernel name in program.
  11398. @item inputs
  11399. Number of inputs to the filter. Defaults to 1.
  11400. @item size, s
  11401. Size of output frames. Defaults to the same as the first input.
  11402. @end table
  11403. The program source file must contain a kernel function with the given name,
  11404. which will be run once for each plane of the output. Each run on a plane
  11405. gets enqueued as a separate 2D global NDRange with one work-item for each
  11406. pixel to be generated. The global ID offset for each work-item is therefore
  11407. the coordinates of a pixel in the destination image.
  11408. The kernel function needs to take the following arguments:
  11409. @itemize
  11410. @item
  11411. Destination image, @var{__write_only image2d_t}.
  11412. This image will become the output; the kernel should write all of it.
  11413. @item
  11414. Frame index, @var{unsigned int}.
  11415. This is a counter starting from zero and increasing by one for each frame.
  11416. @item
  11417. Source images, @var{__read_only image2d_t}.
  11418. These are the most recent images on each input. The kernel may read from
  11419. them to generate the output, but they can't be written to.
  11420. @end itemize
  11421. Example programs:
  11422. @itemize
  11423. @item
  11424. Copy the input to the output (output must be the same size as the input).
  11425. @verbatim
  11426. __kernel void copy(__write_only image2d_t destination,
  11427. unsigned int index,
  11428. __read_only image2d_t source)
  11429. {
  11430. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11431. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11432. float4 value = read_imagef(source, sampler, location);
  11433. write_imagef(destination, location, value);
  11434. }
  11435. @end verbatim
  11436. @item
  11437. Apply a simple transformation, rotating the input by an amount increasing
  11438. with the index counter. Pixel values are linearly interpolated by the
  11439. sampler, and the output need not have the same dimensions as the input.
  11440. @verbatim
  11441. __kernel void rotate_image(__write_only image2d_t dst,
  11442. unsigned int index,
  11443. __read_only image2d_t src)
  11444. {
  11445. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11446. CLK_FILTER_LINEAR);
  11447. float angle = (float)index / 100.0f;
  11448. float2 dst_dim = convert_float2(get_image_dim(dst));
  11449. float2 src_dim = convert_float2(get_image_dim(src));
  11450. float2 dst_cen = dst_dim / 2.0f;
  11451. float2 src_cen = src_dim / 2.0f;
  11452. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11453. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11454. float2 src_pos = {
  11455. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11456. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11457. };
  11458. src_pos = src_pos * src_dim / dst_dim;
  11459. float2 src_loc = src_pos + src_cen;
  11460. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11461. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11462. write_imagef(dst, dst_loc, 0.5f);
  11463. else
  11464. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11465. }
  11466. @end verbatim
  11467. @item
  11468. Blend two inputs together, with the amount of each input used varying
  11469. with the index counter.
  11470. @verbatim
  11471. __kernel void blend_images(__write_only image2d_t dst,
  11472. unsigned int index,
  11473. __read_only image2d_t src1,
  11474. __read_only image2d_t src2)
  11475. {
  11476. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11477. CLK_FILTER_LINEAR);
  11478. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11479. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11480. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11481. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11482. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11483. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11484. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11485. }
  11486. @end verbatim
  11487. @end itemize
  11488. @section pseudocolor
  11489. Alter frame colors in video with pseudocolors.
  11490. This filter accepts the following options:
  11491. @table @option
  11492. @item c0
  11493. set pixel first component expression
  11494. @item c1
  11495. set pixel second component expression
  11496. @item c2
  11497. set pixel third component expression
  11498. @item c3
  11499. set pixel fourth component expression, corresponds to the alpha component
  11500. @item i
  11501. set component to use as base for altering colors
  11502. @end table
  11503. Each of them specifies the expression to use for computing the lookup table for
  11504. the corresponding pixel component values.
  11505. The expressions can contain the following constants and functions:
  11506. @table @option
  11507. @item w
  11508. @item h
  11509. The input width and height.
  11510. @item val
  11511. The input value for the pixel component.
  11512. @item ymin, umin, vmin, amin
  11513. The minimum allowed component value.
  11514. @item ymax, umax, vmax, amax
  11515. The maximum allowed component value.
  11516. @end table
  11517. All expressions default to "val".
  11518. @subsection Examples
  11519. @itemize
  11520. @item
  11521. Change too high luma values to gradient:
  11522. @example
  11523. 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'"
  11524. @end example
  11525. @end itemize
  11526. @section psnr
  11527. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11528. Ratio) between two input videos.
  11529. This filter takes in input two input videos, the first input is
  11530. considered the "main" source and is passed unchanged to the
  11531. output. The second input is used as a "reference" video for computing
  11532. the PSNR.
  11533. Both video inputs must have the same resolution and pixel format for
  11534. this filter to work correctly. Also it assumes that both inputs
  11535. have the same number of frames, which are compared one by one.
  11536. The obtained average PSNR is printed through the logging system.
  11537. The filter stores the accumulated MSE (mean squared error) of each
  11538. frame, and at the end of the processing it is averaged across all frames
  11539. equally, and the following formula is applied to obtain the PSNR:
  11540. @example
  11541. PSNR = 10*log10(MAX^2/MSE)
  11542. @end example
  11543. Where MAX is the average of the maximum values of each component of the
  11544. image.
  11545. The description of the accepted parameters follows.
  11546. @table @option
  11547. @item stats_file, f
  11548. If specified the filter will use the named file to save the PSNR of
  11549. each individual frame. When filename equals "-" the data is sent to
  11550. standard output.
  11551. @item stats_version
  11552. Specifies which version of the stats file format to use. Details of
  11553. each format are written below.
  11554. Default value is 1.
  11555. @item stats_add_max
  11556. Determines whether the max value is output to the stats log.
  11557. Default value is 0.
  11558. Requires stats_version >= 2. If this is set and stats_version < 2,
  11559. the filter will return an error.
  11560. @end table
  11561. This filter also supports the @ref{framesync} options.
  11562. The file printed if @var{stats_file} is selected, contains a sequence of
  11563. key/value pairs of the form @var{key}:@var{value} for each compared
  11564. couple of frames.
  11565. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11566. the list of per-frame-pair stats, with key value pairs following the frame
  11567. format with the following parameters:
  11568. @table @option
  11569. @item psnr_log_version
  11570. The version of the log file format. Will match @var{stats_version}.
  11571. @item fields
  11572. A comma separated list of the per-frame-pair parameters included in
  11573. the log.
  11574. @end table
  11575. A description of each shown per-frame-pair parameter follows:
  11576. @table @option
  11577. @item n
  11578. sequential number of the input frame, starting from 1
  11579. @item mse_avg
  11580. Mean Square Error pixel-by-pixel average difference of the compared
  11581. frames, averaged over all the image components.
  11582. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11583. Mean Square Error pixel-by-pixel average difference of the compared
  11584. frames for the component specified by the suffix.
  11585. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11586. Peak Signal to Noise ratio of the compared frames for the component
  11587. specified by the suffix.
  11588. @item max_avg, max_y, max_u, max_v
  11589. Maximum allowed value for each channel, and average over all
  11590. channels.
  11591. @end table
  11592. @subsection Examples
  11593. @itemize
  11594. @item
  11595. For example:
  11596. @example
  11597. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11598. [main][ref] psnr="stats_file=stats.log" [out]
  11599. @end example
  11600. On this example the input file being processed is compared with the
  11601. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11602. is stored in @file{stats.log}.
  11603. @item
  11604. Another example with different containers:
  11605. @example
  11606. 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 -
  11607. @end example
  11608. @end itemize
  11609. @anchor{pullup}
  11610. @section pullup
  11611. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11612. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11613. content.
  11614. The pullup filter is designed to take advantage of future context in making
  11615. its decisions. This filter is stateless in the sense that it does not lock
  11616. onto a pattern to follow, but it instead looks forward to the following
  11617. fields in order to identify matches and rebuild progressive frames.
  11618. To produce content with an even framerate, insert the fps filter after
  11619. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11620. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11621. The filter accepts the following options:
  11622. @table @option
  11623. @item jl
  11624. @item jr
  11625. @item jt
  11626. @item jb
  11627. These options set the amount of "junk" to ignore at the left, right, top, and
  11628. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11629. while top and bottom are in units of 2 lines.
  11630. The default is 8 pixels on each side.
  11631. @item sb
  11632. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11633. filter generating an occasional mismatched frame, but it may also cause an
  11634. excessive number of frames to be dropped during high motion sequences.
  11635. Conversely, setting it to -1 will make filter match fields more easily.
  11636. This may help processing of video where there is slight blurring between
  11637. the fields, but may also cause there to be interlaced frames in the output.
  11638. Default value is @code{0}.
  11639. @item mp
  11640. Set the metric plane to use. It accepts the following values:
  11641. @table @samp
  11642. @item l
  11643. Use luma plane.
  11644. @item u
  11645. Use chroma blue plane.
  11646. @item v
  11647. Use chroma red plane.
  11648. @end table
  11649. This option may be set to use chroma plane instead of the default luma plane
  11650. for doing filter's computations. This may improve accuracy on very clean
  11651. source material, but more likely will decrease accuracy, especially if there
  11652. is chroma noise (rainbow effect) or any grayscale video.
  11653. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11654. load and make pullup usable in realtime on slow machines.
  11655. @end table
  11656. For best results (without duplicated frames in the output file) it is
  11657. necessary to change the output frame rate. For example, to inverse
  11658. telecine NTSC input:
  11659. @example
  11660. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11661. @end example
  11662. @section qp
  11663. Change video quantization parameters (QP).
  11664. The filter accepts the following option:
  11665. @table @option
  11666. @item qp
  11667. Set expression for quantization parameter.
  11668. @end table
  11669. The expression is evaluated through the eval API and can contain, among others,
  11670. the following constants:
  11671. @table @var
  11672. @item known
  11673. 1 if index is not 129, 0 otherwise.
  11674. @item qp
  11675. Sequential index starting from -129 to 128.
  11676. @end table
  11677. @subsection Examples
  11678. @itemize
  11679. @item
  11680. Some equation like:
  11681. @example
  11682. qp=2+2*sin(PI*qp)
  11683. @end example
  11684. @end itemize
  11685. @section random
  11686. Flush video frames from internal cache of frames into a random order.
  11687. No frame is discarded.
  11688. Inspired by @ref{frei0r} nervous filter.
  11689. @table @option
  11690. @item frames
  11691. Set size in number of frames of internal cache, in range from @code{2} to
  11692. @code{512}. Default is @code{30}.
  11693. @item seed
  11694. Set seed for random number generator, must be an integer included between
  11695. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11696. less than @code{0}, the filter will try to use a good random seed on a
  11697. best effort basis.
  11698. @end table
  11699. @section readeia608
  11700. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11701. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11702. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11703. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11704. @table @option
  11705. @item lavfi.readeia608.X.cc
  11706. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11707. @item lavfi.readeia608.X.line
  11708. The number of the line on which the EIA-608 data was identified and read.
  11709. @end table
  11710. This filter accepts the following options:
  11711. @table @option
  11712. @item scan_min
  11713. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11714. @item scan_max
  11715. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11716. @item mac
  11717. Set minimal acceptable amplitude change for sync codes detection.
  11718. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11719. @item spw
  11720. Set the ratio of width reserved for sync code detection.
  11721. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11722. @item mhd
  11723. Set the max peaks height difference for sync code detection.
  11724. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11725. @item mpd
  11726. Set max peaks period difference for sync code detection.
  11727. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11728. @item msd
  11729. Set the first two max start code bits differences.
  11730. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11731. @item bhd
  11732. Set the minimum ratio of bits height compared to 3rd start code bit.
  11733. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11734. @item th_w
  11735. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11736. @item th_b
  11737. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11738. @item chp
  11739. Enable checking the parity bit. In the event of a parity error, the filter will output
  11740. @code{0x00} for that character. Default is false.
  11741. @item lp
  11742. Lowpass lines prior to further processing. Default is disabled.
  11743. @end table
  11744. @subsection Examples
  11745. @itemize
  11746. @item
  11747. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11748. @example
  11749. 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
  11750. @end example
  11751. @end itemize
  11752. @section readvitc
  11753. Read vertical interval timecode (VITC) information from the top lines of a
  11754. video frame.
  11755. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11756. timecode value, if a valid timecode has been detected. Further metadata key
  11757. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11758. timecode data has been found or not.
  11759. This filter accepts the following options:
  11760. @table @option
  11761. @item scan_max
  11762. Set the maximum number of lines to scan for VITC data. If the value is set to
  11763. @code{-1} the full video frame is scanned. Default is @code{45}.
  11764. @item thr_b
  11765. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11766. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11767. @item thr_w
  11768. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11769. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11770. @end table
  11771. @subsection Examples
  11772. @itemize
  11773. @item
  11774. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11775. draw @code{--:--:--:--} as a placeholder:
  11776. @example
  11777. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11778. @end example
  11779. @end itemize
  11780. @section remap
  11781. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11782. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11783. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11784. value for pixel will be used for destination pixel.
  11785. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11786. will have Xmap/Ymap video stream dimensions.
  11787. Xmap and Ymap input video streams are 16bit depth, single channel.
  11788. @table @option
  11789. @item format
  11790. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11791. Default is @code{color}.
  11792. @end table
  11793. @section removegrain
  11794. The removegrain filter is a spatial denoiser for progressive video.
  11795. @table @option
  11796. @item m0
  11797. Set mode for the first plane.
  11798. @item m1
  11799. Set mode for the second plane.
  11800. @item m2
  11801. Set mode for the third plane.
  11802. @item m3
  11803. Set mode for the fourth plane.
  11804. @end table
  11805. Range of mode is from 0 to 24. Description of each mode follows:
  11806. @table @var
  11807. @item 0
  11808. Leave input plane unchanged. Default.
  11809. @item 1
  11810. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11811. @item 2
  11812. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11813. @item 3
  11814. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11815. @item 4
  11816. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11817. This is equivalent to a median filter.
  11818. @item 5
  11819. Line-sensitive clipping giving the minimal change.
  11820. @item 6
  11821. Line-sensitive clipping, intermediate.
  11822. @item 7
  11823. Line-sensitive clipping, intermediate.
  11824. @item 8
  11825. Line-sensitive clipping, intermediate.
  11826. @item 9
  11827. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11828. @item 10
  11829. Replaces the target pixel with the closest neighbour.
  11830. @item 11
  11831. [1 2 1] horizontal and vertical kernel blur.
  11832. @item 12
  11833. Same as mode 11.
  11834. @item 13
  11835. Bob mode, interpolates top field from the line where the neighbours
  11836. pixels are the closest.
  11837. @item 14
  11838. Bob mode, interpolates bottom field from the line where the neighbours
  11839. pixels are the closest.
  11840. @item 15
  11841. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11842. interpolation formula.
  11843. @item 16
  11844. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11845. interpolation formula.
  11846. @item 17
  11847. Clips the pixel with the minimum and maximum of respectively the maximum and
  11848. minimum of each pair of opposite neighbour pixels.
  11849. @item 18
  11850. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11851. the current pixel is minimal.
  11852. @item 19
  11853. Replaces the pixel with the average of its 8 neighbours.
  11854. @item 20
  11855. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11856. @item 21
  11857. Clips pixels using the averages of opposite neighbour.
  11858. @item 22
  11859. Same as mode 21 but simpler and faster.
  11860. @item 23
  11861. Small edge and halo removal, but reputed useless.
  11862. @item 24
  11863. Similar as 23.
  11864. @end table
  11865. @section removelogo
  11866. Suppress a TV station logo, using an image file to determine which
  11867. pixels comprise the logo. It works by filling in the pixels that
  11868. comprise the logo with neighboring pixels.
  11869. The filter accepts the following options:
  11870. @table @option
  11871. @item filename, f
  11872. Set the filter bitmap file, which can be any image format supported by
  11873. libavformat. The width and height of the image file must match those of the
  11874. video stream being processed.
  11875. @end table
  11876. Pixels in the provided bitmap image with a value of zero are not
  11877. considered part of the logo, non-zero pixels are considered part of
  11878. the logo. If you use white (255) for the logo and black (0) for the
  11879. rest, you will be safe. For making the filter bitmap, it is
  11880. recommended to take a screen capture of a black frame with the logo
  11881. visible, and then using a threshold filter followed by the erode
  11882. filter once or twice.
  11883. If needed, little splotches can be fixed manually. Remember that if
  11884. logo pixels are not covered, the filter quality will be much
  11885. reduced. Marking too many pixels as part of the logo does not hurt as
  11886. much, but it will increase the amount of blurring needed to cover over
  11887. the image and will destroy more information than necessary, and extra
  11888. pixels will slow things down on a large logo.
  11889. @section repeatfields
  11890. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11891. fields based on its value.
  11892. @section reverse
  11893. Reverse a video clip.
  11894. Warning: This filter requires memory to buffer the entire clip, so trimming
  11895. is suggested.
  11896. @subsection Examples
  11897. @itemize
  11898. @item
  11899. Take the first 5 seconds of a clip, and reverse it.
  11900. @example
  11901. trim=end=5,reverse
  11902. @end example
  11903. @end itemize
  11904. @section rgbashift
  11905. Shift R/G/B/A pixels horizontally and/or vertically.
  11906. The filter accepts the following options:
  11907. @table @option
  11908. @item rh
  11909. Set amount to shift red horizontally.
  11910. @item rv
  11911. Set amount to shift red vertically.
  11912. @item gh
  11913. Set amount to shift green horizontally.
  11914. @item gv
  11915. Set amount to shift green vertically.
  11916. @item bh
  11917. Set amount to shift blue horizontally.
  11918. @item bv
  11919. Set amount to shift blue vertically.
  11920. @item ah
  11921. Set amount to shift alpha horizontally.
  11922. @item av
  11923. Set amount to shift alpha vertically.
  11924. @item edge
  11925. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11926. @end table
  11927. @subsection Commands
  11928. This filter supports the all above options as @ref{commands}.
  11929. @section roberts
  11930. Apply roberts cross operator to input video stream.
  11931. The filter accepts the following option:
  11932. @table @option
  11933. @item planes
  11934. Set which planes will be processed, unprocessed planes will be copied.
  11935. By default value 0xf, all planes will be processed.
  11936. @item scale
  11937. Set value which will be multiplied with filtered result.
  11938. @item delta
  11939. Set value which will be added to filtered result.
  11940. @end table
  11941. @section rotate
  11942. Rotate video by an arbitrary angle expressed in radians.
  11943. The filter accepts the following options:
  11944. A description of the optional parameters follows.
  11945. @table @option
  11946. @item angle, a
  11947. Set an expression for the angle by which to rotate the input video
  11948. clockwise, expressed as a number of radians. A negative value will
  11949. result in a counter-clockwise rotation. By default it is set to "0".
  11950. This expression is evaluated for each frame.
  11951. @item out_w, ow
  11952. Set the output width expression, default value is "iw".
  11953. This expression is evaluated just once during configuration.
  11954. @item out_h, oh
  11955. Set the output height expression, default value is "ih".
  11956. This expression is evaluated just once during configuration.
  11957. @item bilinear
  11958. Enable bilinear interpolation if set to 1, a value of 0 disables
  11959. it. Default value is 1.
  11960. @item fillcolor, c
  11961. Set the color used to fill the output area not covered by the rotated
  11962. image. For the general syntax of this option, check the
  11963. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11964. If the special value "none" is selected then no
  11965. background is printed (useful for example if the background is never shown).
  11966. Default value is "black".
  11967. @end table
  11968. The expressions for the angle and the output size can contain the
  11969. following constants and functions:
  11970. @table @option
  11971. @item n
  11972. sequential number of the input frame, starting from 0. It is always NAN
  11973. before the first frame is filtered.
  11974. @item t
  11975. time in seconds of the input frame, it is set to 0 when the filter is
  11976. configured. It is always NAN before the first frame is filtered.
  11977. @item hsub
  11978. @item vsub
  11979. horizontal and vertical chroma subsample values. For example for the
  11980. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11981. @item in_w, iw
  11982. @item in_h, ih
  11983. the input video width and height
  11984. @item out_w, ow
  11985. @item out_h, oh
  11986. the output width and height, that is the size of the padded area as
  11987. specified by the @var{width} and @var{height} expressions
  11988. @item rotw(a)
  11989. @item roth(a)
  11990. the minimal width/height required for completely containing the input
  11991. video rotated by @var{a} radians.
  11992. These are only available when computing the @option{out_w} and
  11993. @option{out_h} expressions.
  11994. @end table
  11995. @subsection Examples
  11996. @itemize
  11997. @item
  11998. Rotate the input by PI/6 radians clockwise:
  11999. @example
  12000. rotate=PI/6
  12001. @end example
  12002. @item
  12003. Rotate the input by PI/6 radians counter-clockwise:
  12004. @example
  12005. rotate=-PI/6
  12006. @end example
  12007. @item
  12008. Rotate the input by 45 degrees clockwise:
  12009. @example
  12010. rotate=45*PI/180
  12011. @end example
  12012. @item
  12013. Apply a constant rotation with period T, starting from an angle of PI/3:
  12014. @example
  12015. rotate=PI/3+2*PI*t/T
  12016. @end example
  12017. @item
  12018. Make the input video rotation oscillating with a period of T
  12019. seconds and an amplitude of A radians:
  12020. @example
  12021. rotate=A*sin(2*PI/T*t)
  12022. @end example
  12023. @item
  12024. Rotate the video, output size is chosen so that the whole rotating
  12025. input video is always completely contained in the output:
  12026. @example
  12027. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12028. @end example
  12029. @item
  12030. Rotate the video, reduce the output size so that no background is ever
  12031. shown:
  12032. @example
  12033. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12034. @end example
  12035. @end itemize
  12036. @subsection Commands
  12037. The filter supports the following commands:
  12038. @table @option
  12039. @item a, angle
  12040. Set the angle expression.
  12041. The command accepts the same syntax of the corresponding option.
  12042. If the specified expression is not valid, it is kept at its current
  12043. value.
  12044. @end table
  12045. @section sab
  12046. Apply Shape Adaptive Blur.
  12047. The filter accepts the following options:
  12048. @table @option
  12049. @item luma_radius, lr
  12050. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12051. value is 1.0. A greater value will result in a more blurred image, and
  12052. in slower processing.
  12053. @item luma_pre_filter_radius, lpfr
  12054. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12055. value is 1.0.
  12056. @item luma_strength, ls
  12057. Set luma maximum difference between pixels to still be considered, must
  12058. be a value in the 0.1-100.0 range, default value is 1.0.
  12059. @item chroma_radius, cr
  12060. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12061. greater value will result in a more blurred image, and in slower
  12062. processing.
  12063. @item chroma_pre_filter_radius, cpfr
  12064. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12065. @item chroma_strength, cs
  12066. Set chroma maximum difference between pixels to still be considered,
  12067. must be a value in the -0.9-100.0 range.
  12068. @end table
  12069. Each chroma option value, if not explicitly specified, is set to the
  12070. corresponding luma option value.
  12071. @anchor{scale}
  12072. @section scale
  12073. Scale (resize) the input video, using the libswscale library.
  12074. The scale filter forces the output display aspect ratio to be the same
  12075. of the input, by changing the output sample aspect ratio.
  12076. If the input image format is different from the format requested by
  12077. the next filter, the scale filter will convert the input to the
  12078. requested format.
  12079. @subsection Options
  12080. The filter accepts the following options, or any of the options
  12081. supported by the libswscale scaler.
  12082. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12083. the complete list of scaler options.
  12084. @table @option
  12085. @item width, w
  12086. @item height, h
  12087. Set the output video dimension expression. Default value is the input
  12088. dimension.
  12089. If the @var{width} or @var{w} value is 0, the input width is used for
  12090. the output. If the @var{height} or @var{h} value is 0, the input height
  12091. is used for the output.
  12092. If one and only one of the values is -n with n >= 1, the scale filter
  12093. will use a value that maintains the aspect ratio of the input image,
  12094. calculated from the other specified dimension. After that it will,
  12095. however, make sure that the calculated dimension is divisible by n and
  12096. adjust the value if necessary.
  12097. If both values are -n with n >= 1, the behavior will be identical to
  12098. both values being set to 0 as previously detailed.
  12099. See below for the list of accepted constants for use in the dimension
  12100. expression.
  12101. @item eval
  12102. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12103. @table @samp
  12104. @item init
  12105. Only evaluate expressions once during the filter initialization or when a command is processed.
  12106. @item frame
  12107. Evaluate expressions for each incoming frame.
  12108. @end table
  12109. Default value is @samp{init}.
  12110. @item interl
  12111. Set the interlacing mode. It accepts the following values:
  12112. @table @samp
  12113. @item 1
  12114. Force interlaced aware scaling.
  12115. @item 0
  12116. Do not apply interlaced scaling.
  12117. @item -1
  12118. Select interlaced aware scaling depending on whether the source frames
  12119. are flagged as interlaced or not.
  12120. @end table
  12121. Default value is @samp{0}.
  12122. @item flags
  12123. Set libswscale scaling flags. See
  12124. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12125. complete list of values. If not explicitly specified the filter applies
  12126. the default flags.
  12127. @item param0, param1
  12128. Set libswscale input parameters for scaling algorithms that need them. See
  12129. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12130. complete documentation. If not explicitly specified the filter applies
  12131. empty parameters.
  12132. @item size, s
  12133. Set the video size. For the syntax of this option, check the
  12134. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12135. @item in_color_matrix
  12136. @item out_color_matrix
  12137. Set in/output YCbCr color space type.
  12138. This allows the autodetected value to be overridden as well as allows forcing
  12139. a specific value used for the output and encoder.
  12140. If not specified, the color space type depends on the pixel format.
  12141. Possible values:
  12142. @table @samp
  12143. @item auto
  12144. Choose automatically.
  12145. @item bt709
  12146. Format conforming to International Telecommunication Union (ITU)
  12147. Recommendation BT.709.
  12148. @item fcc
  12149. Set color space conforming to the United States Federal Communications
  12150. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12151. @item bt601
  12152. @item bt470
  12153. @item smpte170m
  12154. Set color space conforming to:
  12155. @itemize
  12156. @item
  12157. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12158. @item
  12159. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12160. @item
  12161. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12162. @end itemize
  12163. @item smpte240m
  12164. Set color space conforming to SMPTE ST 240:1999.
  12165. @item bt2020
  12166. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12167. @end table
  12168. @item in_range
  12169. @item out_range
  12170. Set in/output YCbCr sample range.
  12171. This allows the autodetected value to be overridden as well as allows forcing
  12172. a specific value used for the output and encoder. If not specified, the
  12173. range depends on the pixel format. Possible values:
  12174. @table @samp
  12175. @item auto/unknown
  12176. Choose automatically.
  12177. @item jpeg/full/pc
  12178. Set full range (0-255 in case of 8-bit luma).
  12179. @item mpeg/limited/tv
  12180. Set "MPEG" range (16-235 in case of 8-bit luma).
  12181. @end table
  12182. @item force_original_aspect_ratio
  12183. Enable decreasing or increasing output video width or height if necessary to
  12184. keep the original aspect ratio. Possible values:
  12185. @table @samp
  12186. @item disable
  12187. Scale the video as specified and disable this feature.
  12188. @item decrease
  12189. The output video dimensions will automatically be decreased if needed.
  12190. @item increase
  12191. The output video dimensions will automatically be increased if needed.
  12192. @end table
  12193. One useful instance of this option is that when you know a specific device's
  12194. maximum allowed resolution, you can use this to limit the output video to
  12195. that, while retaining the aspect ratio. For example, device A allows
  12196. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12197. decrease) and specifying 1280x720 to the command line makes the output
  12198. 1280x533.
  12199. Please note that this is a different thing than specifying -1 for @option{w}
  12200. or @option{h}, you still need to specify the output resolution for this option
  12201. to work.
  12202. @item force_divisible_by
  12203. Ensures that both the output dimensions, width and height, are divisible by the
  12204. given integer when used together with @option{force_original_aspect_ratio}. This
  12205. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12206. This option respects the value set for @option{force_original_aspect_ratio},
  12207. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12208. may be slightly modified.
  12209. This option can be handy if you need to have a video fit within or exceed
  12210. a defined resolution using @option{force_original_aspect_ratio} but also have
  12211. encoder restrictions on width or height divisibility.
  12212. @end table
  12213. The values of the @option{w} and @option{h} options are expressions
  12214. containing the following constants:
  12215. @table @var
  12216. @item in_w
  12217. @item in_h
  12218. The input width and height
  12219. @item iw
  12220. @item ih
  12221. These are the same as @var{in_w} and @var{in_h}.
  12222. @item out_w
  12223. @item out_h
  12224. The output (scaled) width and height
  12225. @item ow
  12226. @item oh
  12227. These are the same as @var{out_w} and @var{out_h}
  12228. @item a
  12229. The same as @var{iw} / @var{ih}
  12230. @item sar
  12231. input sample aspect ratio
  12232. @item dar
  12233. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12234. @item hsub
  12235. @item vsub
  12236. horizontal and vertical input chroma subsample values. For example for the
  12237. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12238. @item ohsub
  12239. @item ovsub
  12240. horizontal and vertical output chroma subsample values. For example for the
  12241. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12242. @end table
  12243. @subsection Examples
  12244. @itemize
  12245. @item
  12246. Scale the input video to a size of 200x100
  12247. @example
  12248. scale=w=200:h=100
  12249. @end example
  12250. This is equivalent to:
  12251. @example
  12252. scale=200:100
  12253. @end example
  12254. or:
  12255. @example
  12256. scale=200x100
  12257. @end example
  12258. @item
  12259. Specify a size abbreviation for the output size:
  12260. @example
  12261. scale=qcif
  12262. @end example
  12263. which can also be written as:
  12264. @example
  12265. scale=size=qcif
  12266. @end example
  12267. @item
  12268. Scale the input to 2x:
  12269. @example
  12270. scale=w=2*iw:h=2*ih
  12271. @end example
  12272. @item
  12273. The above is the same as:
  12274. @example
  12275. scale=2*in_w:2*in_h
  12276. @end example
  12277. @item
  12278. Scale the input to 2x with forced interlaced scaling:
  12279. @example
  12280. scale=2*iw:2*ih:interl=1
  12281. @end example
  12282. @item
  12283. Scale the input to half size:
  12284. @example
  12285. scale=w=iw/2:h=ih/2
  12286. @end example
  12287. @item
  12288. Increase the width, and set the height to the same size:
  12289. @example
  12290. scale=3/2*iw:ow
  12291. @end example
  12292. @item
  12293. Seek Greek harmony:
  12294. @example
  12295. scale=iw:1/PHI*iw
  12296. scale=ih*PHI:ih
  12297. @end example
  12298. @item
  12299. Increase the height, and set the width to 3/2 of the height:
  12300. @example
  12301. scale=w=3/2*oh:h=3/5*ih
  12302. @end example
  12303. @item
  12304. Increase the size, making the size a multiple of the chroma
  12305. subsample values:
  12306. @example
  12307. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12308. @end example
  12309. @item
  12310. Increase the width to a maximum of 500 pixels,
  12311. keeping the same aspect ratio as the input:
  12312. @example
  12313. scale=w='min(500\, iw*3/2):h=-1'
  12314. @end example
  12315. @item
  12316. Make pixels square by combining scale and setsar:
  12317. @example
  12318. scale='trunc(ih*dar):ih',setsar=1/1
  12319. @end example
  12320. @item
  12321. Make pixels square by combining scale and setsar,
  12322. making sure the resulting resolution is even (required by some codecs):
  12323. @example
  12324. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12325. @end example
  12326. @end itemize
  12327. @subsection Commands
  12328. This filter supports the following commands:
  12329. @table @option
  12330. @item width, w
  12331. @item height, h
  12332. Set the output video dimension expression.
  12333. The command accepts the same syntax of the corresponding option.
  12334. If the specified expression is not valid, it is kept at its current
  12335. value.
  12336. @end table
  12337. @section scale_npp
  12338. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12339. format conversion on CUDA video frames. Setting the output width and height
  12340. works in the same way as for the @var{scale} filter.
  12341. The following additional options are accepted:
  12342. @table @option
  12343. @item format
  12344. The pixel format of the output CUDA frames. If set to the string "same" (the
  12345. default), the input format will be kept. Note that automatic format negotiation
  12346. and conversion is not yet supported for hardware frames
  12347. @item interp_algo
  12348. The interpolation algorithm used for resizing. One of the following:
  12349. @table @option
  12350. @item nn
  12351. Nearest neighbour.
  12352. @item linear
  12353. @item cubic
  12354. @item cubic2p_bspline
  12355. 2-parameter cubic (B=1, C=0)
  12356. @item cubic2p_catmullrom
  12357. 2-parameter cubic (B=0, C=1/2)
  12358. @item cubic2p_b05c03
  12359. 2-parameter cubic (B=1/2, C=3/10)
  12360. @item super
  12361. Supersampling
  12362. @item lanczos
  12363. @end table
  12364. @end table
  12365. @section scale2ref
  12366. Scale (resize) the input video, based on a reference video.
  12367. See the scale filter for available options, scale2ref supports the same but
  12368. uses the reference video instead of the main input as basis. scale2ref also
  12369. supports the following additional constants for the @option{w} and
  12370. @option{h} options:
  12371. @table @var
  12372. @item main_w
  12373. @item main_h
  12374. The main input video's width and height
  12375. @item main_a
  12376. The same as @var{main_w} / @var{main_h}
  12377. @item main_sar
  12378. The main input video's sample aspect ratio
  12379. @item main_dar, mdar
  12380. The main input video's display aspect ratio. Calculated from
  12381. @code{(main_w / main_h) * main_sar}.
  12382. @item main_hsub
  12383. @item main_vsub
  12384. The main input video's horizontal and vertical chroma subsample values.
  12385. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12386. is 1.
  12387. @end table
  12388. @subsection Examples
  12389. @itemize
  12390. @item
  12391. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12392. @example
  12393. 'scale2ref[b][a];[a][b]overlay'
  12394. @end example
  12395. @item
  12396. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12397. @example
  12398. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12399. @end example
  12400. @end itemize
  12401. @section scroll
  12402. Scroll input video horizontally and/or vertically by constant speed.
  12403. The filter accepts the following options:
  12404. @table @option
  12405. @item horizontal, h
  12406. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12407. Negative values changes scrolling direction.
  12408. @item vertical, v
  12409. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12410. Negative values changes scrolling direction.
  12411. @item hpos
  12412. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12413. @item vpos
  12414. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12415. @end table
  12416. @subsection Commands
  12417. This filter supports the following @ref{commands}:
  12418. @table @option
  12419. @item horizontal, h
  12420. Set the horizontal scrolling speed.
  12421. @item vertical, v
  12422. Set the vertical scrolling speed.
  12423. @end table
  12424. @anchor{selectivecolor}
  12425. @section selectivecolor
  12426. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12427. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12428. by the "purity" of the color (that is, how saturated it already is).
  12429. This filter is similar to the Adobe Photoshop Selective Color tool.
  12430. The filter accepts the following options:
  12431. @table @option
  12432. @item correction_method
  12433. Select color correction method.
  12434. Available values are:
  12435. @table @samp
  12436. @item absolute
  12437. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12438. component value).
  12439. @item relative
  12440. Specified adjustments are relative to the original component value.
  12441. @end table
  12442. Default is @code{absolute}.
  12443. @item reds
  12444. Adjustments for red pixels (pixels where the red component is the maximum)
  12445. @item yellows
  12446. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12447. @item greens
  12448. Adjustments for green pixels (pixels where the green component is the maximum)
  12449. @item cyans
  12450. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12451. @item blues
  12452. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12453. @item magentas
  12454. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12455. @item whites
  12456. Adjustments for white pixels (pixels where all components are greater than 128)
  12457. @item neutrals
  12458. Adjustments for all pixels except pure black and pure white
  12459. @item blacks
  12460. Adjustments for black pixels (pixels where all components are lesser than 128)
  12461. @item psfile
  12462. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12463. @end table
  12464. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12465. 4 space separated floating point adjustment values in the [-1,1] range,
  12466. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12467. pixels of its range.
  12468. @subsection Examples
  12469. @itemize
  12470. @item
  12471. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12472. increase magenta by 27% in blue areas:
  12473. @example
  12474. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12475. @end example
  12476. @item
  12477. Use a Photoshop selective color preset:
  12478. @example
  12479. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12480. @end example
  12481. @end itemize
  12482. @anchor{separatefields}
  12483. @section separatefields
  12484. The @code{separatefields} takes a frame-based video input and splits
  12485. each frame into its components fields, producing a new half height clip
  12486. with twice the frame rate and twice the frame count.
  12487. This filter use field-dominance information in frame to decide which
  12488. of each pair of fields to place first in the output.
  12489. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12490. @section setdar, setsar
  12491. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12492. output video.
  12493. This is done by changing the specified Sample (aka Pixel) Aspect
  12494. Ratio, according to the following equation:
  12495. @example
  12496. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12497. @end example
  12498. Keep in mind that the @code{setdar} filter does not modify the pixel
  12499. dimensions of the video frame. Also, the display aspect ratio set by
  12500. this filter may be changed by later filters in the filterchain,
  12501. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12502. applied.
  12503. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12504. the filter output video.
  12505. Note that as a consequence of the application of this filter, the
  12506. output display aspect ratio will change according to the equation
  12507. above.
  12508. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12509. filter may be changed by later filters in the filterchain, e.g. if
  12510. another "setsar" or a "setdar" filter is applied.
  12511. It accepts the following parameters:
  12512. @table @option
  12513. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12514. Set the aspect ratio used by the filter.
  12515. The parameter can be a floating point number string, an expression, or
  12516. a string of the form @var{num}:@var{den}, where @var{num} and
  12517. @var{den} are the numerator and denominator of the aspect ratio. If
  12518. the parameter is not specified, it is assumed the value "0".
  12519. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12520. should be escaped.
  12521. @item max
  12522. Set the maximum integer value to use for expressing numerator and
  12523. denominator when reducing the expressed aspect ratio to a rational.
  12524. Default value is @code{100}.
  12525. @end table
  12526. The parameter @var{sar} is an expression containing
  12527. the following constants:
  12528. @table @option
  12529. @item E, PI, PHI
  12530. These are approximated values for the mathematical constants e
  12531. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12532. @item w, h
  12533. The input width and height.
  12534. @item a
  12535. These are the same as @var{w} / @var{h}.
  12536. @item sar
  12537. The input sample aspect ratio.
  12538. @item dar
  12539. The input display aspect ratio. It is the same as
  12540. (@var{w} / @var{h}) * @var{sar}.
  12541. @item hsub, vsub
  12542. Horizontal and vertical chroma subsample values. For example, for the
  12543. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12544. @end table
  12545. @subsection Examples
  12546. @itemize
  12547. @item
  12548. To change the display aspect ratio to 16:9, specify one of the following:
  12549. @example
  12550. setdar=dar=1.77777
  12551. setdar=dar=16/9
  12552. @end example
  12553. @item
  12554. To change the sample aspect ratio to 10:11, specify:
  12555. @example
  12556. setsar=sar=10/11
  12557. @end example
  12558. @item
  12559. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12560. 1000 in the aspect ratio reduction, use the command:
  12561. @example
  12562. setdar=ratio=16/9:max=1000
  12563. @end example
  12564. @end itemize
  12565. @anchor{setfield}
  12566. @section setfield
  12567. Force field for the output video frame.
  12568. The @code{setfield} filter marks the interlace type field for the
  12569. output frames. It does not change the input frame, but only sets the
  12570. corresponding property, which affects how the frame is treated by
  12571. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12572. The filter accepts the following options:
  12573. @table @option
  12574. @item mode
  12575. Available values are:
  12576. @table @samp
  12577. @item auto
  12578. Keep the same field property.
  12579. @item bff
  12580. Mark the frame as bottom-field-first.
  12581. @item tff
  12582. Mark the frame as top-field-first.
  12583. @item prog
  12584. Mark the frame as progressive.
  12585. @end table
  12586. @end table
  12587. @anchor{setparams}
  12588. @section setparams
  12589. Force frame parameter for the output video frame.
  12590. The @code{setparams} filter marks interlace and color range for the
  12591. output frames. It does not change the input frame, but only sets the
  12592. corresponding property, which affects how the frame is treated by
  12593. filters/encoders.
  12594. @table @option
  12595. @item field_mode
  12596. Available values are:
  12597. @table @samp
  12598. @item auto
  12599. Keep the same field property (default).
  12600. @item bff
  12601. Mark the frame as bottom-field-first.
  12602. @item tff
  12603. Mark the frame as top-field-first.
  12604. @item prog
  12605. Mark the frame as progressive.
  12606. @end table
  12607. @item range
  12608. Available values are:
  12609. @table @samp
  12610. @item auto
  12611. Keep the same color range property (default).
  12612. @item unspecified, unknown
  12613. Mark the frame as unspecified color range.
  12614. @item limited, tv, mpeg
  12615. Mark the frame as limited range.
  12616. @item full, pc, jpeg
  12617. Mark the frame as full range.
  12618. @end table
  12619. @item color_primaries
  12620. Set the color primaries.
  12621. Available values are:
  12622. @table @samp
  12623. @item auto
  12624. Keep the same color primaries property (default).
  12625. @item bt709
  12626. @item unknown
  12627. @item bt470m
  12628. @item bt470bg
  12629. @item smpte170m
  12630. @item smpte240m
  12631. @item film
  12632. @item bt2020
  12633. @item smpte428
  12634. @item smpte431
  12635. @item smpte432
  12636. @item jedec-p22
  12637. @end table
  12638. @item color_trc
  12639. Set the color transfer.
  12640. Available values are:
  12641. @table @samp
  12642. @item auto
  12643. Keep the same color trc property (default).
  12644. @item bt709
  12645. @item unknown
  12646. @item bt470m
  12647. @item bt470bg
  12648. @item smpte170m
  12649. @item smpte240m
  12650. @item linear
  12651. @item log100
  12652. @item log316
  12653. @item iec61966-2-4
  12654. @item bt1361e
  12655. @item iec61966-2-1
  12656. @item bt2020-10
  12657. @item bt2020-12
  12658. @item smpte2084
  12659. @item smpte428
  12660. @item arib-std-b67
  12661. @end table
  12662. @item colorspace
  12663. Set the colorspace.
  12664. Available values are:
  12665. @table @samp
  12666. @item auto
  12667. Keep the same colorspace property (default).
  12668. @item gbr
  12669. @item bt709
  12670. @item unknown
  12671. @item fcc
  12672. @item bt470bg
  12673. @item smpte170m
  12674. @item smpte240m
  12675. @item ycgco
  12676. @item bt2020nc
  12677. @item bt2020c
  12678. @item smpte2085
  12679. @item chroma-derived-nc
  12680. @item chroma-derived-c
  12681. @item ictcp
  12682. @end table
  12683. @end table
  12684. @section showinfo
  12685. Show a line containing various information for each input video frame.
  12686. The input video is not modified.
  12687. This filter supports the following options:
  12688. @table @option
  12689. @item checksum
  12690. Calculate checksums of each plane. By default enabled.
  12691. @end table
  12692. The shown line contains a sequence of key/value pairs of the form
  12693. @var{key}:@var{value}.
  12694. The following values are shown in the output:
  12695. @table @option
  12696. @item n
  12697. The (sequential) number of the input frame, starting from 0.
  12698. @item pts
  12699. The Presentation TimeStamp of the input frame, expressed as a number of
  12700. time base units. The time base unit depends on the filter input pad.
  12701. @item pts_time
  12702. The Presentation TimeStamp of the input frame, expressed as a number of
  12703. seconds.
  12704. @item pos
  12705. The position of the frame in the input stream, or -1 if this information is
  12706. unavailable and/or meaningless (for example in case of synthetic video).
  12707. @item fmt
  12708. The pixel format name.
  12709. @item sar
  12710. The sample aspect ratio of the input frame, expressed in the form
  12711. @var{num}/@var{den}.
  12712. @item s
  12713. The size of the input frame. For the syntax of this option, check the
  12714. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12715. @item i
  12716. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12717. for bottom field first).
  12718. @item iskey
  12719. This is 1 if the frame is a key frame, 0 otherwise.
  12720. @item type
  12721. The picture type of the input frame ("I" for an I-frame, "P" for a
  12722. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12723. Also refer to the documentation of the @code{AVPictureType} enum and of
  12724. the @code{av_get_picture_type_char} function defined in
  12725. @file{libavutil/avutil.h}.
  12726. @item checksum
  12727. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12728. @item plane_checksum
  12729. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12730. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12731. @end table
  12732. @section showpalette
  12733. Displays the 256 colors palette of each frame. This filter is only relevant for
  12734. @var{pal8} pixel format frames.
  12735. It accepts the following option:
  12736. @table @option
  12737. @item s
  12738. Set the size of the box used to represent one palette color entry. Default is
  12739. @code{30} (for a @code{30x30} pixel box).
  12740. @end table
  12741. @section shuffleframes
  12742. Reorder and/or duplicate and/or drop video frames.
  12743. It accepts the following parameters:
  12744. @table @option
  12745. @item mapping
  12746. Set the destination indexes of input frames.
  12747. This is space or '|' separated list of indexes that maps input frames to output
  12748. frames. Number of indexes also sets maximal value that each index may have.
  12749. '-1' index have special meaning and that is to drop frame.
  12750. @end table
  12751. The first frame has the index 0. The default is to keep the input unchanged.
  12752. @subsection Examples
  12753. @itemize
  12754. @item
  12755. Swap second and third frame of every three frames of the input:
  12756. @example
  12757. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12758. @end example
  12759. @item
  12760. Swap 10th and 1st frame of every ten frames of the input:
  12761. @example
  12762. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12763. @end example
  12764. @end itemize
  12765. @section shuffleplanes
  12766. Reorder and/or duplicate video planes.
  12767. It accepts the following parameters:
  12768. @table @option
  12769. @item map0
  12770. The index of the input plane to be used as the first output plane.
  12771. @item map1
  12772. The index of the input plane to be used as the second output plane.
  12773. @item map2
  12774. The index of the input plane to be used as the third output plane.
  12775. @item map3
  12776. The index of the input plane to be used as the fourth output plane.
  12777. @end table
  12778. The first plane has the index 0. The default is to keep the input unchanged.
  12779. @subsection Examples
  12780. @itemize
  12781. @item
  12782. Swap the second and third planes of the input:
  12783. @example
  12784. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12785. @end example
  12786. @end itemize
  12787. @anchor{signalstats}
  12788. @section signalstats
  12789. Evaluate various visual metrics that assist in determining issues associated
  12790. with the digitization of analog video media.
  12791. By default the filter will log these metadata values:
  12792. @table @option
  12793. @item YMIN
  12794. Display the minimal Y value contained within the input frame. Expressed in
  12795. range of [0-255].
  12796. @item YLOW
  12797. Display the Y value at the 10% percentile within the input frame. Expressed in
  12798. range of [0-255].
  12799. @item YAVG
  12800. Display the average Y value within the input frame. Expressed in range of
  12801. [0-255].
  12802. @item YHIGH
  12803. Display the Y value at the 90% percentile within the input frame. Expressed in
  12804. range of [0-255].
  12805. @item YMAX
  12806. Display the maximum Y value contained within the input frame. Expressed in
  12807. range of [0-255].
  12808. @item UMIN
  12809. Display the minimal U value contained within the input frame. Expressed in
  12810. range of [0-255].
  12811. @item ULOW
  12812. Display the U value at the 10% percentile within the input frame. Expressed in
  12813. range of [0-255].
  12814. @item UAVG
  12815. Display the average U value within the input frame. Expressed in range of
  12816. [0-255].
  12817. @item UHIGH
  12818. Display the U value at the 90% percentile within the input frame. Expressed in
  12819. range of [0-255].
  12820. @item UMAX
  12821. Display the maximum U value contained within the input frame. Expressed in
  12822. range of [0-255].
  12823. @item VMIN
  12824. Display the minimal V value contained within the input frame. Expressed in
  12825. range of [0-255].
  12826. @item VLOW
  12827. Display the V value at the 10% percentile within the input frame. Expressed in
  12828. range of [0-255].
  12829. @item VAVG
  12830. Display the average V value within the input frame. Expressed in range of
  12831. [0-255].
  12832. @item VHIGH
  12833. Display the V value at the 90% percentile within the input frame. Expressed in
  12834. range of [0-255].
  12835. @item VMAX
  12836. Display the maximum V value contained within the input frame. Expressed in
  12837. range of [0-255].
  12838. @item SATMIN
  12839. Display the minimal saturation value contained within the input frame.
  12840. Expressed in range of [0-~181.02].
  12841. @item SATLOW
  12842. Display the saturation value at the 10% percentile within the input frame.
  12843. Expressed in range of [0-~181.02].
  12844. @item SATAVG
  12845. Display the average saturation value within the input frame. Expressed in range
  12846. of [0-~181.02].
  12847. @item SATHIGH
  12848. Display the saturation value at the 90% percentile within the input frame.
  12849. Expressed in range of [0-~181.02].
  12850. @item SATMAX
  12851. Display the maximum saturation value contained within the input frame.
  12852. Expressed in range of [0-~181.02].
  12853. @item HUEMED
  12854. Display the median value for hue within the input frame. Expressed in range of
  12855. [0-360].
  12856. @item HUEAVG
  12857. Display the average value for hue within the input frame. Expressed in range of
  12858. [0-360].
  12859. @item YDIF
  12860. Display the average of sample value difference between all values of the Y
  12861. plane in the current frame and corresponding values of the previous input frame.
  12862. Expressed in range of [0-255].
  12863. @item UDIF
  12864. Display the average of sample value difference between all values of the U
  12865. plane in the current frame and corresponding values of the previous input frame.
  12866. Expressed in range of [0-255].
  12867. @item VDIF
  12868. Display the average of sample value difference between all values of the V
  12869. plane in the current frame and corresponding values of the previous input frame.
  12870. Expressed in range of [0-255].
  12871. @item YBITDEPTH
  12872. Display bit depth of Y plane in current frame.
  12873. Expressed in range of [0-16].
  12874. @item UBITDEPTH
  12875. Display bit depth of U plane in current frame.
  12876. Expressed in range of [0-16].
  12877. @item VBITDEPTH
  12878. Display bit depth of V plane in current frame.
  12879. Expressed in range of [0-16].
  12880. @end table
  12881. The filter accepts the following options:
  12882. @table @option
  12883. @item stat
  12884. @item out
  12885. @option{stat} specify an additional form of image analysis.
  12886. @option{out} output video with the specified type of pixel highlighted.
  12887. Both options accept the following values:
  12888. @table @samp
  12889. @item tout
  12890. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12891. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12892. include the results of video dropouts, head clogs, or tape tracking issues.
  12893. @item vrep
  12894. Identify @var{vertical line repetition}. Vertical line repetition includes
  12895. similar rows of pixels within a frame. In born-digital video vertical line
  12896. repetition is common, but this pattern is uncommon in video digitized from an
  12897. analog source. When it occurs in video that results from the digitization of an
  12898. analog source it can indicate concealment from a dropout compensator.
  12899. @item brng
  12900. Identify pixels that fall outside of legal broadcast range.
  12901. @end table
  12902. @item color, c
  12903. Set the highlight color for the @option{out} option. The default color is
  12904. yellow.
  12905. @end table
  12906. @subsection Examples
  12907. @itemize
  12908. @item
  12909. Output data of various video metrics:
  12910. @example
  12911. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12912. @end example
  12913. @item
  12914. Output specific data about the minimum and maximum values of the Y plane per frame:
  12915. @example
  12916. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12917. @end example
  12918. @item
  12919. Playback video while highlighting pixels that are outside of broadcast range in red.
  12920. @example
  12921. ffplay example.mov -vf signalstats="out=brng:color=red"
  12922. @end example
  12923. @item
  12924. Playback video with signalstats metadata drawn over the frame.
  12925. @example
  12926. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12927. @end example
  12928. The contents of signalstat_drawtext.txt used in the command are:
  12929. @example
  12930. time %@{pts:hms@}
  12931. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12932. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12933. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12934. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12935. @end example
  12936. @end itemize
  12937. @anchor{signature}
  12938. @section signature
  12939. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12940. input. In this case the matching between the inputs can be calculated additionally.
  12941. The filter always passes through the first input. The signature of each stream can
  12942. be written into a file.
  12943. It accepts the following options:
  12944. @table @option
  12945. @item detectmode
  12946. Enable or disable the matching process.
  12947. Available values are:
  12948. @table @samp
  12949. @item off
  12950. Disable the calculation of a matching (default).
  12951. @item full
  12952. Calculate the matching for the whole video and output whether the whole video
  12953. matches or only parts.
  12954. @item fast
  12955. Calculate only until a matching is found or the video ends. Should be faster in
  12956. some cases.
  12957. @end table
  12958. @item nb_inputs
  12959. Set the number of inputs. The option value must be a non negative integer.
  12960. Default value is 1.
  12961. @item filename
  12962. Set the path to which the output is written. If there is more than one input,
  12963. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12964. integer), that will be replaced with the input number. If no filename is
  12965. specified, no output will be written. This is the default.
  12966. @item format
  12967. Choose the output format.
  12968. Available values are:
  12969. @table @samp
  12970. @item binary
  12971. Use the specified binary representation (default).
  12972. @item xml
  12973. Use the specified xml representation.
  12974. @end table
  12975. @item th_d
  12976. Set threshold to detect one word as similar. The option value must be an integer
  12977. greater than zero. The default value is 9000.
  12978. @item th_dc
  12979. Set threshold to detect all words as similar. The option value must be an integer
  12980. greater than zero. The default value is 60000.
  12981. @item th_xh
  12982. Set threshold to detect frames as similar. The option value must be an integer
  12983. greater than zero. The default value is 116.
  12984. @item th_di
  12985. Set the minimum length of a sequence in frames to recognize it as matching
  12986. sequence. The option value must be a non negative integer value.
  12987. The default value is 0.
  12988. @item th_it
  12989. Set the minimum relation, that matching frames to all frames must have.
  12990. The option value must be a double value between 0 and 1. The default value is 0.5.
  12991. @end table
  12992. @subsection Examples
  12993. @itemize
  12994. @item
  12995. To calculate the signature of an input video and store it in signature.bin:
  12996. @example
  12997. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12998. @end example
  12999. @item
  13000. To detect whether two videos match and store the signatures in XML format in
  13001. signature0.xml and signature1.xml:
  13002. @example
  13003. 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 -
  13004. @end example
  13005. @end itemize
  13006. @anchor{smartblur}
  13007. @section smartblur
  13008. Blur the input video without impacting the outlines.
  13009. It accepts the following options:
  13010. @table @option
  13011. @item luma_radius, lr
  13012. Set the luma radius. The option value must be a float number in
  13013. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13014. used to blur the image (slower if larger). Default value is 1.0.
  13015. @item luma_strength, ls
  13016. Set the luma strength. The option value must be a float number
  13017. in the range [-1.0,1.0] that configures the blurring. A value included
  13018. in [0.0,1.0] will blur the image whereas a value included in
  13019. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13020. @item luma_threshold, lt
  13021. Set the luma threshold used as a coefficient to determine
  13022. whether a pixel should be blurred or not. The option value must be an
  13023. integer in the range [-30,30]. A value of 0 will filter all the image,
  13024. a value included in [0,30] will filter flat areas and a value included
  13025. in [-30,0] will filter edges. Default value is 0.
  13026. @item chroma_radius, cr
  13027. Set the chroma radius. The option value must be a float number in
  13028. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13029. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13030. @item chroma_strength, cs
  13031. Set the chroma strength. The option value must be a float number
  13032. in the range [-1.0,1.0] that configures the blurring. A value included
  13033. in [0.0,1.0] will blur the image whereas a value included in
  13034. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13035. @item chroma_threshold, ct
  13036. Set the chroma threshold used as a coefficient to determine
  13037. whether a pixel should be blurred or not. The option value must be an
  13038. integer in the range [-30,30]. A value of 0 will filter all the image,
  13039. a value included in [0,30] will filter flat areas and a value included
  13040. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13041. @end table
  13042. If a chroma option is not explicitly set, the corresponding luma value
  13043. is set.
  13044. @section sobel
  13045. Apply sobel operator to input video stream.
  13046. The filter accepts the following option:
  13047. @table @option
  13048. @item planes
  13049. Set which planes will be processed, unprocessed planes will be copied.
  13050. By default value 0xf, all planes will be processed.
  13051. @item scale
  13052. Set value which will be multiplied with filtered result.
  13053. @item delta
  13054. Set value which will be added to filtered result.
  13055. @end table
  13056. @anchor{spp}
  13057. @section spp
  13058. Apply a simple postprocessing filter that compresses and decompresses the image
  13059. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13060. and average the results.
  13061. The filter accepts the following options:
  13062. @table @option
  13063. @item quality
  13064. Set quality. This option defines the number of levels for averaging. It accepts
  13065. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13066. effect. A value of @code{6} means the higher quality. For each increment of
  13067. that value the speed drops by a factor of approximately 2. Default value is
  13068. @code{3}.
  13069. @item qp
  13070. Force a constant quantization parameter. If not set, the filter will use the QP
  13071. from the video stream (if available).
  13072. @item mode
  13073. Set thresholding mode. Available modes are:
  13074. @table @samp
  13075. @item hard
  13076. Set hard thresholding (default).
  13077. @item soft
  13078. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13079. @end table
  13080. @item use_bframe_qp
  13081. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13082. option may cause flicker since the B-Frames have often larger QP. Default is
  13083. @code{0} (not enabled).
  13084. @end table
  13085. @section sr
  13086. Scale the input by applying one of the super-resolution methods based on
  13087. convolutional neural networks. Supported models:
  13088. @itemize
  13089. @item
  13090. Super-Resolution Convolutional Neural Network model (SRCNN).
  13091. See @url{https://arxiv.org/abs/1501.00092}.
  13092. @item
  13093. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13094. See @url{https://arxiv.org/abs/1609.05158}.
  13095. @end itemize
  13096. Training scripts as well as scripts for model file (.pb) saving can be found at
  13097. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13098. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13099. Native model files (.model) can be generated from TensorFlow model
  13100. files (.pb) by using tools/python/convert.py
  13101. The filter accepts the following options:
  13102. @table @option
  13103. @item dnn_backend
  13104. Specify which DNN backend to use for model loading and execution. This option accepts
  13105. the following values:
  13106. @table @samp
  13107. @item native
  13108. Native implementation of DNN loading and execution.
  13109. @item tensorflow
  13110. TensorFlow backend. To enable this backend you
  13111. need to install the TensorFlow for C library (see
  13112. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13113. @code{--enable-libtensorflow}
  13114. @end table
  13115. Default value is @samp{native}.
  13116. @item model
  13117. Set path to model file specifying network architecture and its parameters.
  13118. Note that different backends use different file formats. TensorFlow backend
  13119. can load files for both formats, while native backend can load files for only
  13120. its format.
  13121. @item scale_factor
  13122. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13123. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13124. input upscaled using bicubic upscaling with proper scale factor.
  13125. @end table
  13126. @section ssim
  13127. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13128. This filter takes in input two input videos, the first input is
  13129. considered the "main" source and is passed unchanged to the
  13130. output. The second input is used as a "reference" video for computing
  13131. the SSIM.
  13132. Both video inputs must have the same resolution and pixel format for
  13133. this filter to work correctly. Also it assumes that both inputs
  13134. have the same number of frames, which are compared one by one.
  13135. The filter stores the calculated SSIM of each frame.
  13136. The description of the accepted parameters follows.
  13137. @table @option
  13138. @item stats_file, f
  13139. If specified the filter will use the named file to save the SSIM of
  13140. each individual frame. When filename equals "-" the data is sent to
  13141. standard output.
  13142. @end table
  13143. The file printed if @var{stats_file} is selected, contains a sequence of
  13144. key/value pairs of the form @var{key}:@var{value} for each compared
  13145. couple of frames.
  13146. A description of each shown parameter follows:
  13147. @table @option
  13148. @item n
  13149. sequential number of the input frame, starting from 1
  13150. @item Y, U, V, R, G, B
  13151. SSIM of the compared frames for the component specified by the suffix.
  13152. @item All
  13153. SSIM of the compared frames for the whole frame.
  13154. @item dB
  13155. Same as above but in dB representation.
  13156. @end table
  13157. This filter also supports the @ref{framesync} options.
  13158. @subsection Examples
  13159. @itemize
  13160. @item
  13161. For example:
  13162. @example
  13163. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13164. [main][ref] ssim="stats_file=stats.log" [out]
  13165. @end example
  13166. On this example the input file being processed is compared with the
  13167. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13168. is stored in @file{stats.log}.
  13169. @item
  13170. Another example with both psnr and ssim at same time:
  13171. @example
  13172. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13173. @end example
  13174. @item
  13175. Another example with different containers:
  13176. @example
  13177. 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 -
  13178. @end example
  13179. @end itemize
  13180. @section stereo3d
  13181. Convert between different stereoscopic image formats.
  13182. The filters accept the following options:
  13183. @table @option
  13184. @item in
  13185. Set stereoscopic image format of input.
  13186. Available values for input image formats are:
  13187. @table @samp
  13188. @item sbsl
  13189. side by side parallel (left eye left, right eye right)
  13190. @item sbsr
  13191. side by side crosseye (right eye left, left eye right)
  13192. @item sbs2l
  13193. side by side parallel with half width resolution
  13194. (left eye left, right eye right)
  13195. @item sbs2r
  13196. side by side crosseye with half width resolution
  13197. (right eye left, left eye right)
  13198. @item abl
  13199. @item tbl
  13200. above-below (left eye above, right eye below)
  13201. @item abr
  13202. @item tbr
  13203. above-below (right eye above, left eye below)
  13204. @item ab2l
  13205. @item tb2l
  13206. above-below with half height resolution
  13207. (left eye above, right eye below)
  13208. @item ab2r
  13209. @item tb2r
  13210. above-below with half height resolution
  13211. (right eye above, left eye below)
  13212. @item al
  13213. alternating frames (left eye first, right eye second)
  13214. @item ar
  13215. alternating frames (right eye first, left eye second)
  13216. @item irl
  13217. interleaved rows (left eye has top row, right eye starts on next row)
  13218. @item irr
  13219. interleaved rows (right eye has top row, left eye starts on next row)
  13220. @item icl
  13221. interleaved columns, left eye first
  13222. @item icr
  13223. interleaved columns, right eye first
  13224. Default value is @samp{sbsl}.
  13225. @end table
  13226. @item out
  13227. Set stereoscopic image format of output.
  13228. @table @samp
  13229. @item sbsl
  13230. side by side parallel (left eye left, right eye right)
  13231. @item sbsr
  13232. side by side crosseye (right eye left, left eye right)
  13233. @item sbs2l
  13234. side by side parallel with half width resolution
  13235. (left eye left, right eye right)
  13236. @item sbs2r
  13237. side by side crosseye with half width resolution
  13238. (right eye left, left eye right)
  13239. @item abl
  13240. @item tbl
  13241. above-below (left eye above, right eye below)
  13242. @item abr
  13243. @item tbr
  13244. above-below (right eye above, left eye below)
  13245. @item ab2l
  13246. @item tb2l
  13247. above-below with half height resolution
  13248. (left eye above, right eye below)
  13249. @item ab2r
  13250. @item tb2r
  13251. above-below with half height resolution
  13252. (right eye above, left eye below)
  13253. @item al
  13254. alternating frames (left eye first, right eye second)
  13255. @item ar
  13256. alternating frames (right eye first, left eye second)
  13257. @item irl
  13258. interleaved rows (left eye has top row, right eye starts on next row)
  13259. @item irr
  13260. interleaved rows (right eye has top row, left eye starts on next row)
  13261. @item arbg
  13262. anaglyph red/blue gray
  13263. (red filter on left eye, blue filter on right eye)
  13264. @item argg
  13265. anaglyph red/green gray
  13266. (red filter on left eye, green filter on right eye)
  13267. @item arcg
  13268. anaglyph red/cyan gray
  13269. (red filter on left eye, cyan filter on right eye)
  13270. @item arch
  13271. anaglyph red/cyan half colored
  13272. (red filter on left eye, cyan filter on right eye)
  13273. @item arcc
  13274. anaglyph red/cyan color
  13275. (red filter on left eye, cyan filter on right eye)
  13276. @item arcd
  13277. anaglyph red/cyan color optimized with the least squares projection of dubois
  13278. (red filter on left eye, cyan filter on right eye)
  13279. @item agmg
  13280. anaglyph green/magenta gray
  13281. (green filter on left eye, magenta filter on right eye)
  13282. @item agmh
  13283. anaglyph green/magenta half colored
  13284. (green filter on left eye, magenta filter on right eye)
  13285. @item agmc
  13286. anaglyph green/magenta colored
  13287. (green filter on left eye, magenta filter on right eye)
  13288. @item agmd
  13289. anaglyph green/magenta color optimized with the least squares projection of dubois
  13290. (green filter on left eye, magenta filter on right eye)
  13291. @item aybg
  13292. anaglyph yellow/blue gray
  13293. (yellow filter on left eye, blue filter on right eye)
  13294. @item aybh
  13295. anaglyph yellow/blue half colored
  13296. (yellow filter on left eye, blue filter on right eye)
  13297. @item aybc
  13298. anaglyph yellow/blue colored
  13299. (yellow filter on left eye, blue filter on right eye)
  13300. @item aybd
  13301. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13302. (yellow filter on left eye, blue filter on right eye)
  13303. @item ml
  13304. mono output (left eye only)
  13305. @item mr
  13306. mono output (right eye only)
  13307. @item chl
  13308. checkerboard, left eye first
  13309. @item chr
  13310. checkerboard, right eye first
  13311. @item icl
  13312. interleaved columns, left eye first
  13313. @item icr
  13314. interleaved columns, right eye first
  13315. @item hdmi
  13316. HDMI frame pack
  13317. @end table
  13318. Default value is @samp{arcd}.
  13319. @end table
  13320. @subsection Examples
  13321. @itemize
  13322. @item
  13323. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13324. @example
  13325. stereo3d=sbsl:aybd
  13326. @end example
  13327. @item
  13328. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13329. @example
  13330. stereo3d=abl:sbsr
  13331. @end example
  13332. @end itemize
  13333. @section streamselect, astreamselect
  13334. Select video or audio streams.
  13335. The filter accepts the following options:
  13336. @table @option
  13337. @item inputs
  13338. Set number of inputs. Default is 2.
  13339. @item map
  13340. Set input indexes to remap to outputs.
  13341. @end table
  13342. @subsection Commands
  13343. The @code{streamselect} and @code{astreamselect} filter supports the following
  13344. commands:
  13345. @table @option
  13346. @item map
  13347. Set input indexes to remap to outputs.
  13348. @end table
  13349. @subsection Examples
  13350. @itemize
  13351. @item
  13352. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13353. @example
  13354. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13355. @end example
  13356. @item
  13357. Same as above, but for audio:
  13358. @example
  13359. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13360. @end example
  13361. @end itemize
  13362. @anchor{subtitles}
  13363. @section subtitles
  13364. Draw subtitles on top of input video using the libass library.
  13365. To enable compilation of this filter you need to configure FFmpeg with
  13366. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13367. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13368. Alpha) subtitles format.
  13369. The filter accepts the following options:
  13370. @table @option
  13371. @item filename, f
  13372. Set the filename of the subtitle file to read. It must be specified.
  13373. @item original_size
  13374. Specify the size of the original video, the video for which the ASS file
  13375. was composed. For the syntax of this option, check the
  13376. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13377. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13378. correctly scale the fonts if the aspect ratio has been changed.
  13379. @item fontsdir
  13380. Set a directory path containing fonts that can be used by the filter.
  13381. These fonts will be used in addition to whatever the font provider uses.
  13382. @item alpha
  13383. Process alpha channel, by default alpha channel is untouched.
  13384. @item charenc
  13385. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13386. useful if not UTF-8.
  13387. @item stream_index, si
  13388. Set subtitles stream index. @code{subtitles} filter only.
  13389. @item force_style
  13390. Override default style or script info parameters of the subtitles. It accepts a
  13391. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13392. @end table
  13393. If the first key is not specified, it is assumed that the first value
  13394. specifies the @option{filename}.
  13395. For example, to render the file @file{sub.srt} on top of the input
  13396. video, use the command:
  13397. @example
  13398. subtitles=sub.srt
  13399. @end example
  13400. which is equivalent to:
  13401. @example
  13402. subtitles=filename=sub.srt
  13403. @end example
  13404. To render the default subtitles stream from file @file{video.mkv}, use:
  13405. @example
  13406. subtitles=video.mkv
  13407. @end example
  13408. To render the second subtitles stream from that file, use:
  13409. @example
  13410. subtitles=video.mkv:si=1
  13411. @end example
  13412. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13413. @code{DejaVu Serif}, use:
  13414. @example
  13415. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13416. @end example
  13417. @section super2xsai
  13418. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13419. Interpolate) pixel art scaling algorithm.
  13420. Useful for enlarging pixel art images without reducing sharpness.
  13421. @section swaprect
  13422. Swap two rectangular objects in video.
  13423. This filter accepts the following options:
  13424. @table @option
  13425. @item w
  13426. Set object width.
  13427. @item h
  13428. Set object height.
  13429. @item x1
  13430. Set 1st rect x coordinate.
  13431. @item y1
  13432. Set 1st rect y coordinate.
  13433. @item x2
  13434. Set 2nd rect x coordinate.
  13435. @item y2
  13436. Set 2nd rect y coordinate.
  13437. All expressions are evaluated once for each frame.
  13438. @end table
  13439. The all options are expressions containing the following constants:
  13440. @table @option
  13441. @item w
  13442. @item h
  13443. The input width and height.
  13444. @item a
  13445. same as @var{w} / @var{h}
  13446. @item sar
  13447. input sample aspect ratio
  13448. @item dar
  13449. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13450. @item n
  13451. The number of the input frame, starting from 0.
  13452. @item t
  13453. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13454. @item pos
  13455. the position in the file of the input frame, NAN if unknown
  13456. @end table
  13457. @section swapuv
  13458. Swap U & V plane.
  13459. @section telecine
  13460. Apply telecine process to the video.
  13461. This filter accepts the following options:
  13462. @table @option
  13463. @item first_field
  13464. @table @samp
  13465. @item top, t
  13466. top field first
  13467. @item bottom, b
  13468. bottom field first
  13469. The default value is @code{top}.
  13470. @end table
  13471. @item pattern
  13472. A string of numbers representing the pulldown pattern you wish to apply.
  13473. The default value is @code{23}.
  13474. @end table
  13475. @example
  13476. Some typical patterns:
  13477. NTSC output (30i):
  13478. 27.5p: 32222
  13479. 24p: 23 (classic)
  13480. 24p: 2332 (preferred)
  13481. 20p: 33
  13482. 18p: 334
  13483. 16p: 3444
  13484. PAL output (25i):
  13485. 27.5p: 12222
  13486. 24p: 222222222223 ("Euro pulldown")
  13487. 16.67p: 33
  13488. 16p: 33333334
  13489. @end example
  13490. @section threshold
  13491. Apply threshold effect to video stream.
  13492. This filter needs four video streams to perform thresholding.
  13493. First stream is stream we are filtering.
  13494. Second stream is holding threshold values, third stream is holding min values,
  13495. and last, fourth stream is holding max values.
  13496. The filter accepts the following option:
  13497. @table @option
  13498. @item planes
  13499. Set which planes will be processed, unprocessed planes will be copied.
  13500. By default value 0xf, all planes will be processed.
  13501. @end table
  13502. For example if first stream pixel's component value is less then threshold value
  13503. of pixel component from 2nd threshold stream, third stream value will picked,
  13504. otherwise fourth stream pixel component value will be picked.
  13505. Using color source filter one can perform various types of thresholding:
  13506. @subsection Examples
  13507. @itemize
  13508. @item
  13509. Binary threshold, using gray color as threshold:
  13510. @example
  13511. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13512. @end example
  13513. @item
  13514. Inverted binary threshold, using gray color as threshold:
  13515. @example
  13516. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13517. @end example
  13518. @item
  13519. Truncate binary threshold, using gray color as threshold:
  13520. @example
  13521. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13522. @end example
  13523. @item
  13524. Threshold to zero, using gray color as threshold:
  13525. @example
  13526. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13527. @end example
  13528. @item
  13529. Inverted threshold to zero, using gray color as threshold:
  13530. @example
  13531. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13532. @end example
  13533. @end itemize
  13534. @section thumbnail
  13535. Select the most representative frame in a given sequence of consecutive frames.
  13536. The filter accepts the following options:
  13537. @table @option
  13538. @item n
  13539. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13540. will pick one of them, and then handle the next batch of @var{n} frames until
  13541. the end. Default is @code{100}.
  13542. @end table
  13543. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13544. value will result in a higher memory usage, so a high value is not recommended.
  13545. @subsection Examples
  13546. @itemize
  13547. @item
  13548. Extract one picture each 50 frames:
  13549. @example
  13550. thumbnail=50
  13551. @end example
  13552. @item
  13553. Complete example of a thumbnail creation with @command{ffmpeg}:
  13554. @example
  13555. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13556. @end example
  13557. @end itemize
  13558. @section tile
  13559. Tile several successive frames together.
  13560. The filter accepts the following options:
  13561. @table @option
  13562. @item layout
  13563. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13564. this option, check the
  13565. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13566. @item nb_frames
  13567. Set the maximum number of frames to render in the given area. It must be less
  13568. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13569. the area will be used.
  13570. @item margin
  13571. Set the outer border margin in pixels.
  13572. @item padding
  13573. Set the inner border thickness (i.e. the number of pixels between frames). For
  13574. more advanced padding options (such as having different values for the edges),
  13575. refer to the pad video filter.
  13576. @item color
  13577. Specify the color of the unused area. For the syntax of this option, check the
  13578. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13579. The default value of @var{color} is "black".
  13580. @item overlap
  13581. Set the number of frames to overlap when tiling several successive frames together.
  13582. The value must be between @code{0} and @var{nb_frames - 1}.
  13583. @item init_padding
  13584. Set the number of frames to initially be empty before displaying first output frame.
  13585. This controls how soon will one get first output frame.
  13586. The value must be between @code{0} and @var{nb_frames - 1}.
  13587. @end table
  13588. @subsection Examples
  13589. @itemize
  13590. @item
  13591. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13592. @example
  13593. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13594. @end example
  13595. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13596. duplicating each output frame to accommodate the originally detected frame
  13597. rate.
  13598. @item
  13599. Display @code{5} pictures in an area of @code{3x2} frames,
  13600. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13601. mixed flat and named options:
  13602. @example
  13603. tile=3x2:nb_frames=5:padding=7:margin=2
  13604. @end example
  13605. @end itemize
  13606. @section tinterlace
  13607. Perform various types of temporal field interlacing.
  13608. Frames are counted starting from 1, so the first input frame is
  13609. considered odd.
  13610. The filter accepts the following options:
  13611. @table @option
  13612. @item mode
  13613. Specify the mode of the interlacing. This option can also be specified
  13614. as a value alone. See below for a list of values for this option.
  13615. Available values are:
  13616. @table @samp
  13617. @item merge, 0
  13618. Move odd frames into the upper field, even into the lower field,
  13619. generating a double height frame at half frame rate.
  13620. @example
  13621. ------> time
  13622. Input:
  13623. Frame 1 Frame 2 Frame 3 Frame 4
  13624. 11111 22222 33333 44444
  13625. 11111 22222 33333 44444
  13626. 11111 22222 33333 44444
  13627. 11111 22222 33333 44444
  13628. Output:
  13629. 11111 33333
  13630. 22222 44444
  13631. 11111 33333
  13632. 22222 44444
  13633. 11111 33333
  13634. 22222 44444
  13635. 11111 33333
  13636. 22222 44444
  13637. @end example
  13638. @item drop_even, 1
  13639. Only output odd frames, even frames are dropped, generating a frame with
  13640. unchanged height at half frame rate.
  13641. @example
  13642. ------> time
  13643. Input:
  13644. Frame 1 Frame 2 Frame 3 Frame 4
  13645. 11111 22222 33333 44444
  13646. 11111 22222 33333 44444
  13647. 11111 22222 33333 44444
  13648. 11111 22222 33333 44444
  13649. Output:
  13650. 11111 33333
  13651. 11111 33333
  13652. 11111 33333
  13653. 11111 33333
  13654. @end example
  13655. @item drop_odd, 2
  13656. Only output even frames, odd frames are dropped, generating a frame with
  13657. unchanged height at half frame rate.
  13658. @example
  13659. ------> time
  13660. Input:
  13661. Frame 1 Frame 2 Frame 3 Frame 4
  13662. 11111 22222 33333 44444
  13663. 11111 22222 33333 44444
  13664. 11111 22222 33333 44444
  13665. 11111 22222 33333 44444
  13666. Output:
  13667. 22222 44444
  13668. 22222 44444
  13669. 22222 44444
  13670. 22222 44444
  13671. @end example
  13672. @item pad, 3
  13673. Expand each frame to full height, but pad alternate lines with black,
  13674. generating a frame with double height at the same input frame rate.
  13675. @example
  13676. ------> time
  13677. Input:
  13678. Frame 1 Frame 2 Frame 3 Frame 4
  13679. 11111 22222 33333 44444
  13680. 11111 22222 33333 44444
  13681. 11111 22222 33333 44444
  13682. 11111 22222 33333 44444
  13683. Output:
  13684. 11111 ..... 33333 .....
  13685. ..... 22222 ..... 44444
  13686. 11111 ..... 33333 .....
  13687. ..... 22222 ..... 44444
  13688. 11111 ..... 33333 .....
  13689. ..... 22222 ..... 44444
  13690. 11111 ..... 33333 .....
  13691. ..... 22222 ..... 44444
  13692. @end example
  13693. @item interleave_top, 4
  13694. Interleave the upper field from odd frames with the lower field from
  13695. even frames, generating a frame with unchanged height at half frame rate.
  13696. @example
  13697. ------> time
  13698. Input:
  13699. Frame 1 Frame 2 Frame 3 Frame 4
  13700. 11111<- 22222 33333<- 44444
  13701. 11111 22222<- 33333 44444<-
  13702. 11111<- 22222 33333<- 44444
  13703. 11111 22222<- 33333 44444<-
  13704. Output:
  13705. 11111 33333
  13706. 22222 44444
  13707. 11111 33333
  13708. 22222 44444
  13709. @end example
  13710. @item interleave_bottom, 5
  13711. Interleave the lower field from odd frames with the upper field from
  13712. even frames, generating a frame with unchanged height at half frame rate.
  13713. @example
  13714. ------> time
  13715. Input:
  13716. Frame 1 Frame 2 Frame 3 Frame 4
  13717. 11111 22222<- 33333 44444<-
  13718. 11111<- 22222 33333<- 44444
  13719. 11111 22222<- 33333 44444<-
  13720. 11111<- 22222 33333<- 44444
  13721. Output:
  13722. 22222 44444
  13723. 11111 33333
  13724. 22222 44444
  13725. 11111 33333
  13726. @end example
  13727. @item interlacex2, 6
  13728. Double frame rate with unchanged height. Frames are inserted each
  13729. containing the second temporal field from the previous input frame and
  13730. the first temporal field from the next input frame. This mode relies on
  13731. the top_field_first flag. Useful for interlaced video displays with no
  13732. field synchronisation.
  13733. @example
  13734. ------> time
  13735. Input:
  13736. Frame 1 Frame 2 Frame 3 Frame 4
  13737. 11111 22222 33333 44444
  13738. 11111 22222 33333 44444
  13739. 11111 22222 33333 44444
  13740. 11111 22222 33333 44444
  13741. Output:
  13742. 11111 22222 22222 33333 33333 44444 44444
  13743. 11111 11111 22222 22222 33333 33333 44444
  13744. 11111 22222 22222 33333 33333 44444 44444
  13745. 11111 11111 22222 22222 33333 33333 44444
  13746. @end example
  13747. @item mergex2, 7
  13748. Move odd frames into the upper field, even into the lower field,
  13749. generating a double height frame at same frame rate.
  13750. @example
  13751. ------> time
  13752. Input:
  13753. Frame 1 Frame 2 Frame 3 Frame 4
  13754. 11111 22222 33333 44444
  13755. 11111 22222 33333 44444
  13756. 11111 22222 33333 44444
  13757. 11111 22222 33333 44444
  13758. Output:
  13759. 11111 33333 33333 55555
  13760. 22222 22222 44444 44444
  13761. 11111 33333 33333 55555
  13762. 22222 22222 44444 44444
  13763. 11111 33333 33333 55555
  13764. 22222 22222 44444 44444
  13765. 11111 33333 33333 55555
  13766. 22222 22222 44444 44444
  13767. @end example
  13768. @end table
  13769. Numeric values are deprecated but are accepted for backward
  13770. compatibility reasons.
  13771. Default mode is @code{merge}.
  13772. @item flags
  13773. Specify flags influencing the filter process.
  13774. Available value for @var{flags} is:
  13775. @table @option
  13776. @item low_pass_filter, vlpf
  13777. Enable linear vertical low-pass filtering in the filter.
  13778. Vertical low-pass filtering is required when creating an interlaced
  13779. destination from a progressive source which contains high-frequency
  13780. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13781. patterning.
  13782. @item complex_filter, cvlpf
  13783. Enable complex vertical low-pass filtering.
  13784. This will slightly less reduce interlace 'twitter' and Moire
  13785. patterning but better retain detail and subjective sharpness impression.
  13786. @end table
  13787. Vertical low-pass filtering can only be enabled for @option{mode}
  13788. @var{interleave_top} and @var{interleave_bottom}.
  13789. @end table
  13790. @section tmix
  13791. Mix successive video frames.
  13792. A description of the accepted options follows.
  13793. @table @option
  13794. @item frames
  13795. The number of successive frames to mix. If unspecified, it defaults to 3.
  13796. @item weights
  13797. Specify weight of each input video frame.
  13798. Each weight is separated by space. If number of weights is smaller than
  13799. number of @var{frames} last specified weight will be used for all remaining
  13800. unset weights.
  13801. @item scale
  13802. Specify scale, if it is set it will be multiplied with sum
  13803. of each weight multiplied with pixel values to give final destination
  13804. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13805. @end table
  13806. @subsection Examples
  13807. @itemize
  13808. @item
  13809. Average 7 successive frames:
  13810. @example
  13811. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13812. @end example
  13813. @item
  13814. Apply simple temporal convolution:
  13815. @example
  13816. tmix=frames=3:weights="-1 3 -1"
  13817. @end example
  13818. @item
  13819. Similar as above but only showing temporal differences:
  13820. @example
  13821. tmix=frames=3:weights="-1 2 -1":scale=1
  13822. @end example
  13823. @end itemize
  13824. @anchor{tonemap}
  13825. @section tonemap
  13826. Tone map colors from different dynamic ranges.
  13827. This filter expects data in single precision floating point, as it needs to
  13828. operate on (and can output) out-of-range values. Another filter, such as
  13829. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13830. The tonemapping algorithms implemented only work on linear light, so input
  13831. data should be linearized beforehand (and possibly correctly tagged).
  13832. @example
  13833. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13834. @end example
  13835. @subsection Options
  13836. The filter accepts the following options.
  13837. @table @option
  13838. @item tonemap
  13839. Set the tone map algorithm to use.
  13840. Possible values are:
  13841. @table @var
  13842. @item none
  13843. Do not apply any tone map, only desaturate overbright pixels.
  13844. @item clip
  13845. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13846. in-range values, while distorting out-of-range values.
  13847. @item linear
  13848. Stretch the entire reference gamut to a linear multiple of the display.
  13849. @item gamma
  13850. Fit a logarithmic transfer between the tone curves.
  13851. @item reinhard
  13852. Preserve overall image brightness with a simple curve, using nonlinear
  13853. contrast, which results in flattening details and degrading color accuracy.
  13854. @item hable
  13855. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13856. of slightly darkening everything. Use it when detail preservation is more
  13857. important than color and brightness accuracy.
  13858. @item mobius
  13859. Smoothly map out-of-range values, while retaining contrast and colors for
  13860. in-range material as much as possible. Use it when color accuracy is more
  13861. important than detail preservation.
  13862. @end table
  13863. Default is none.
  13864. @item param
  13865. Tune the tone mapping algorithm.
  13866. This affects the following algorithms:
  13867. @table @var
  13868. @item none
  13869. Ignored.
  13870. @item linear
  13871. Specifies the scale factor to use while stretching.
  13872. Default to 1.0.
  13873. @item gamma
  13874. Specifies the exponent of the function.
  13875. Default to 1.8.
  13876. @item clip
  13877. Specify an extra linear coefficient to multiply into the signal before clipping.
  13878. Default to 1.0.
  13879. @item reinhard
  13880. Specify the local contrast coefficient at the display peak.
  13881. Default to 0.5, which means that in-gamut values will be about half as bright
  13882. as when clipping.
  13883. @item hable
  13884. Ignored.
  13885. @item mobius
  13886. Specify the transition point from linear to mobius transform. Every value
  13887. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13888. more accurate the result will be, at the cost of losing bright details.
  13889. Default to 0.3, which due to the steep initial slope still preserves in-range
  13890. colors fairly accurately.
  13891. @end table
  13892. @item desat
  13893. Apply desaturation for highlights that exceed this level of brightness. The
  13894. higher the parameter, the more color information will be preserved. This
  13895. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13896. (smoothly) turning into white instead. This makes images feel more natural,
  13897. at the cost of reducing information about out-of-range colors.
  13898. The default of 2.0 is somewhat conservative and will mostly just apply to
  13899. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13900. This option works only if the input frame has a supported color tag.
  13901. @item peak
  13902. Override signal/nominal/reference peak with this value. Useful when the
  13903. embedded peak information in display metadata is not reliable or when tone
  13904. mapping from a lower range to a higher range.
  13905. @end table
  13906. @section tpad
  13907. Temporarily pad video frames.
  13908. The filter accepts the following options:
  13909. @table @option
  13910. @item start
  13911. Specify number of delay frames before input video stream.
  13912. @item stop
  13913. Specify number of padding frames after input video stream.
  13914. Set to -1 to pad indefinitely.
  13915. @item start_mode
  13916. Set kind of frames added to beginning of stream.
  13917. Can be either @var{add} or @var{clone}.
  13918. With @var{add} frames of solid-color are added.
  13919. With @var{clone} frames are clones of first frame.
  13920. @item stop_mode
  13921. Set kind of frames added to end of stream.
  13922. Can be either @var{add} or @var{clone}.
  13923. With @var{add} frames of solid-color are added.
  13924. With @var{clone} frames are clones of last frame.
  13925. @item start_duration, stop_duration
  13926. Specify the duration of the start/stop delay. See
  13927. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13928. for the accepted syntax.
  13929. These options override @var{start} and @var{stop}.
  13930. @item color
  13931. Specify the color of the padded area. For the syntax of this option,
  13932. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13933. manual,ffmpeg-utils}.
  13934. The default value of @var{color} is "black".
  13935. @end table
  13936. @anchor{transpose}
  13937. @section transpose
  13938. Transpose rows with columns in the input video and optionally flip it.
  13939. It accepts the following parameters:
  13940. @table @option
  13941. @item dir
  13942. Specify the transposition direction.
  13943. Can assume the following values:
  13944. @table @samp
  13945. @item 0, 4, cclock_flip
  13946. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13947. @example
  13948. L.R L.l
  13949. . . -> . .
  13950. l.r R.r
  13951. @end example
  13952. @item 1, 5, clock
  13953. Rotate by 90 degrees clockwise, that is:
  13954. @example
  13955. L.R l.L
  13956. . . -> . .
  13957. l.r r.R
  13958. @end example
  13959. @item 2, 6, cclock
  13960. Rotate by 90 degrees counterclockwise, that is:
  13961. @example
  13962. L.R R.r
  13963. . . -> . .
  13964. l.r L.l
  13965. @end example
  13966. @item 3, 7, clock_flip
  13967. Rotate by 90 degrees clockwise and vertically flip, that is:
  13968. @example
  13969. L.R r.R
  13970. . . -> . .
  13971. l.r l.L
  13972. @end example
  13973. @end table
  13974. For values between 4-7, the transposition is only done if the input
  13975. video geometry is portrait and not landscape. These values are
  13976. deprecated, the @code{passthrough} option should be used instead.
  13977. Numerical values are deprecated, and should be dropped in favor of
  13978. symbolic constants.
  13979. @item passthrough
  13980. Do not apply the transposition if the input geometry matches the one
  13981. specified by the specified value. It accepts the following values:
  13982. @table @samp
  13983. @item none
  13984. Always apply transposition.
  13985. @item portrait
  13986. Preserve portrait geometry (when @var{height} >= @var{width}).
  13987. @item landscape
  13988. Preserve landscape geometry (when @var{width} >= @var{height}).
  13989. @end table
  13990. Default value is @code{none}.
  13991. @end table
  13992. For example to rotate by 90 degrees clockwise and preserve portrait
  13993. layout:
  13994. @example
  13995. transpose=dir=1:passthrough=portrait
  13996. @end example
  13997. The command above can also be specified as:
  13998. @example
  13999. transpose=1:portrait
  14000. @end example
  14001. @section transpose_npp
  14002. Transpose rows with columns in the input video and optionally flip it.
  14003. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14004. It accepts the following parameters:
  14005. @table @option
  14006. @item dir
  14007. Specify the transposition direction.
  14008. Can assume the following values:
  14009. @table @samp
  14010. @item cclock_flip
  14011. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14012. @item clock
  14013. Rotate by 90 degrees clockwise.
  14014. @item cclock
  14015. Rotate by 90 degrees counterclockwise.
  14016. @item clock_flip
  14017. Rotate by 90 degrees clockwise and vertically flip.
  14018. @end table
  14019. @item passthrough
  14020. Do not apply the transposition if the input geometry matches the one
  14021. specified by the specified value. It accepts the following values:
  14022. @table @samp
  14023. @item none
  14024. Always apply transposition. (default)
  14025. @item portrait
  14026. Preserve portrait geometry (when @var{height} >= @var{width}).
  14027. @item landscape
  14028. Preserve landscape geometry (when @var{width} >= @var{height}).
  14029. @end table
  14030. @end table
  14031. @section trim
  14032. Trim the input so that the output contains one continuous subpart of the input.
  14033. It accepts the following parameters:
  14034. @table @option
  14035. @item start
  14036. Specify the time of the start of the kept section, i.e. the frame with the
  14037. timestamp @var{start} will be the first frame in the output.
  14038. @item end
  14039. Specify the time of the first frame that will be dropped, i.e. the frame
  14040. immediately preceding the one with the timestamp @var{end} will be the last
  14041. frame in the output.
  14042. @item start_pts
  14043. This is the same as @var{start}, except this option sets the start timestamp
  14044. in timebase units instead of seconds.
  14045. @item end_pts
  14046. This is the same as @var{end}, except this option sets the end timestamp
  14047. in timebase units instead of seconds.
  14048. @item duration
  14049. The maximum duration of the output in seconds.
  14050. @item start_frame
  14051. The number of the first frame that should be passed to the output.
  14052. @item end_frame
  14053. The number of the first frame that should be dropped.
  14054. @end table
  14055. @option{start}, @option{end}, and @option{duration} are expressed as time
  14056. duration specifications; see
  14057. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14058. for the accepted syntax.
  14059. Note that the first two sets of the start/end options and the @option{duration}
  14060. option look at the frame timestamp, while the _frame variants simply count the
  14061. frames that pass through the filter. Also note that this filter does not modify
  14062. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14063. setpts filter after the trim filter.
  14064. If multiple start or end options are set, this filter tries to be greedy and
  14065. keep all the frames that match at least one of the specified constraints. To keep
  14066. only the part that matches all the constraints at once, chain multiple trim
  14067. filters.
  14068. The defaults are such that all the input is kept. So it is possible to set e.g.
  14069. just the end values to keep everything before the specified time.
  14070. Examples:
  14071. @itemize
  14072. @item
  14073. Drop everything except the second minute of input:
  14074. @example
  14075. ffmpeg -i INPUT -vf trim=60:120
  14076. @end example
  14077. @item
  14078. Keep only the first second:
  14079. @example
  14080. ffmpeg -i INPUT -vf trim=duration=1
  14081. @end example
  14082. @end itemize
  14083. @section unpremultiply
  14084. Apply alpha unpremultiply effect to input video stream using first plane
  14085. of second stream as alpha.
  14086. Both streams must have same dimensions and same pixel format.
  14087. The filter accepts the following option:
  14088. @table @option
  14089. @item planes
  14090. Set which planes will be processed, unprocessed planes will be copied.
  14091. By default value 0xf, all planes will be processed.
  14092. If the format has 1 or 2 components, then luma is bit 0.
  14093. If the format has 3 or 4 components:
  14094. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14095. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14096. If present, the alpha channel is always the last bit.
  14097. @item inplace
  14098. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14099. @end table
  14100. @anchor{unsharp}
  14101. @section unsharp
  14102. Sharpen or blur the input video.
  14103. It accepts the following parameters:
  14104. @table @option
  14105. @item luma_msize_x, lx
  14106. Set the luma matrix horizontal size. It must be an odd integer between
  14107. 3 and 23. The default value is 5.
  14108. @item luma_msize_y, ly
  14109. Set the luma matrix vertical size. It must be an odd integer between 3
  14110. and 23. The default value is 5.
  14111. @item luma_amount, la
  14112. Set the luma effect strength. It must be a floating point number, reasonable
  14113. values lay between -1.5 and 1.5.
  14114. Negative values will blur the input video, while positive values will
  14115. sharpen it, a value of zero will disable the effect.
  14116. Default value is 1.0.
  14117. @item chroma_msize_x, cx
  14118. Set the chroma matrix horizontal size. It must be an odd integer
  14119. between 3 and 23. The default value is 5.
  14120. @item chroma_msize_y, cy
  14121. Set the chroma matrix vertical size. It must be an odd integer
  14122. between 3 and 23. The default value is 5.
  14123. @item chroma_amount, ca
  14124. Set the chroma effect strength. It must be a floating point number, reasonable
  14125. values lay between -1.5 and 1.5.
  14126. Negative values will blur the input video, while positive values will
  14127. sharpen it, a value of zero will disable the effect.
  14128. Default value is 0.0.
  14129. @end table
  14130. All parameters are optional and default to the equivalent of the
  14131. string '5:5:1.0:5:5:0.0'.
  14132. @subsection Examples
  14133. @itemize
  14134. @item
  14135. Apply strong luma sharpen effect:
  14136. @example
  14137. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14138. @end example
  14139. @item
  14140. Apply a strong blur of both luma and chroma parameters:
  14141. @example
  14142. unsharp=7:7:-2:7:7:-2
  14143. @end example
  14144. @end itemize
  14145. @section uspp
  14146. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14147. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14148. shifts and average the results.
  14149. The way this differs from the behavior of spp is that uspp actually encodes &
  14150. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14151. DCT similar to MJPEG.
  14152. The filter accepts the following options:
  14153. @table @option
  14154. @item quality
  14155. Set quality. This option defines the number of levels for averaging. It accepts
  14156. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14157. effect. A value of @code{8} means the higher quality. For each increment of
  14158. that value the speed drops by a factor of approximately 2. Default value is
  14159. @code{3}.
  14160. @item qp
  14161. Force a constant quantization parameter. If not set, the filter will use the QP
  14162. from the video stream (if available).
  14163. @end table
  14164. @section v360
  14165. Convert 360 videos between various formats.
  14166. The filter accepts the following options:
  14167. @table @option
  14168. @item input
  14169. @item output
  14170. Set format of the input/output video.
  14171. Available formats:
  14172. @table @samp
  14173. @item e
  14174. @item equirect
  14175. Equirectangular projection.
  14176. @item c3x2
  14177. @item c6x1
  14178. @item c1x6
  14179. Cubemap with 3x2/6x1/1x6 layout.
  14180. Format specific options:
  14181. @table @option
  14182. @item in_pad
  14183. @item out_pad
  14184. Set padding proportion for the input/output cubemap. Values in decimals.
  14185. Example values:
  14186. @table @samp
  14187. @item 0
  14188. No padding.
  14189. @item 0.01
  14190. 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)
  14191. @end table
  14192. Default value is @b{@samp{0}}.
  14193. @item fin_pad
  14194. @item fout_pad
  14195. Set fixed padding for the input/output cubemap. Values in pixels.
  14196. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14197. @item in_forder
  14198. @item out_forder
  14199. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14200. Designation of directions:
  14201. @table @samp
  14202. @item r
  14203. right
  14204. @item l
  14205. left
  14206. @item u
  14207. up
  14208. @item d
  14209. down
  14210. @item f
  14211. forward
  14212. @item b
  14213. back
  14214. @end table
  14215. Default value is @b{@samp{rludfb}}.
  14216. @item in_frot
  14217. @item out_frot
  14218. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14219. Designation of angles:
  14220. @table @samp
  14221. @item 0
  14222. 0 degrees clockwise
  14223. @item 1
  14224. 90 degrees clockwise
  14225. @item 2
  14226. 180 degrees clockwise
  14227. @item 3
  14228. 270 degrees clockwise
  14229. @end table
  14230. Default value is @b{@samp{000000}}.
  14231. @end table
  14232. @item eac
  14233. Equi-Angular Cubemap.
  14234. @item flat
  14235. @item gnomonic
  14236. @item rectilinear
  14237. Regular video. @i{(output only)}
  14238. Format specific options:
  14239. @table @option
  14240. @item h_fov
  14241. @item v_fov
  14242. @item d_fov
  14243. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14244. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14245. @end table
  14246. @item dfisheye
  14247. Dual fisheye.
  14248. Format specific options:
  14249. @table @option
  14250. @item in_pad
  14251. @item out_pad
  14252. Set padding proportion. Values in decimals.
  14253. Example values:
  14254. @table @samp
  14255. @item 0
  14256. No padding.
  14257. @item 0.01
  14258. 1% padding.
  14259. @end table
  14260. Default value is @b{@samp{0}}.
  14261. @end table
  14262. @item barrel
  14263. @item fb
  14264. Facebook's 360 format.
  14265. @item sg
  14266. Stereographic format.
  14267. Format specific options:
  14268. @table @option
  14269. @item h_fov
  14270. @item v_fov
  14271. @item d_fov
  14272. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14273. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14274. @end table
  14275. @item mercator
  14276. Mercator format.
  14277. @item ball
  14278. Ball format, gives significant distortion toward the back.
  14279. @item hammer
  14280. Hammer-Aitoff map projection format.
  14281. @item sinusoidal
  14282. Sinusoidal map projection format.
  14283. @end table
  14284. @item interp
  14285. Set interpolation method.@*
  14286. @i{Note: more complex interpolation methods require much more memory to run.}
  14287. Available methods:
  14288. @table @samp
  14289. @item near
  14290. @item nearest
  14291. Nearest neighbour.
  14292. @item line
  14293. @item linear
  14294. Bilinear interpolation.
  14295. @item cube
  14296. @item cubic
  14297. Bicubic interpolation.
  14298. @item lanc
  14299. @item lanczos
  14300. Lanczos interpolation.
  14301. @end table
  14302. Default value is @b{@samp{line}}.
  14303. @item w
  14304. @item h
  14305. Set the output video resolution.
  14306. Default resolution depends on formats.
  14307. @item in_stereo
  14308. @item out_stereo
  14309. Set the input/output stereo format.
  14310. @table @samp
  14311. @item 2d
  14312. 2D mono
  14313. @item sbs
  14314. Side by side
  14315. @item tb
  14316. Top bottom
  14317. @end table
  14318. Default value is @b{@samp{2d}} for input and output format.
  14319. @item yaw
  14320. @item pitch
  14321. @item roll
  14322. Set rotation for the output video. Values in degrees.
  14323. @item rorder
  14324. Set rotation order for the output video. Choose one item for each position.
  14325. @table @samp
  14326. @item y, Y
  14327. yaw
  14328. @item p, P
  14329. pitch
  14330. @item r, R
  14331. roll
  14332. @end table
  14333. Default value is @b{@samp{ypr}}.
  14334. @item h_flip
  14335. @item v_flip
  14336. @item d_flip
  14337. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14338. @item ih_flip
  14339. @item iv_flip
  14340. Set if input video is flipped horizontally/vertically. Boolean values.
  14341. @item in_trans
  14342. Set if input video is transposed. Boolean value, by default disabled.
  14343. @item out_trans
  14344. Set if output video needs to be transposed. Boolean value, by default disabled.
  14345. @end table
  14346. @subsection Examples
  14347. @itemize
  14348. @item
  14349. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14350. @example
  14351. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14352. @end example
  14353. @item
  14354. Extract back view of Equi-Angular Cubemap:
  14355. @example
  14356. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14357. @end example
  14358. @item
  14359. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14360. @example
  14361. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14362. @end example
  14363. @end itemize
  14364. @section vaguedenoiser
  14365. Apply a wavelet based denoiser.
  14366. It transforms each frame from the video input into the wavelet domain,
  14367. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14368. the obtained coefficients. It does an inverse wavelet transform after.
  14369. Due to wavelet properties, it should give a nice smoothed result, and
  14370. reduced noise, without blurring picture features.
  14371. This filter accepts the following options:
  14372. @table @option
  14373. @item threshold
  14374. The filtering strength. The higher, the more filtered the video will be.
  14375. Hard thresholding can use a higher threshold than soft thresholding
  14376. before the video looks overfiltered. Default value is 2.
  14377. @item method
  14378. The filtering method the filter will use.
  14379. It accepts the following values:
  14380. @table @samp
  14381. @item hard
  14382. All values under the threshold will be zeroed.
  14383. @item soft
  14384. All values under the threshold will be zeroed. All values above will be
  14385. reduced by the threshold.
  14386. @item garrote
  14387. Scales or nullifies coefficients - intermediary between (more) soft and
  14388. (less) hard thresholding.
  14389. @end table
  14390. Default is garrote.
  14391. @item nsteps
  14392. Number of times, the wavelet will decompose the picture. Picture can't
  14393. be decomposed beyond a particular point (typically, 8 for a 640x480
  14394. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14395. @item percent
  14396. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14397. @item planes
  14398. A list of the planes to process. By default all planes are processed.
  14399. @end table
  14400. @section vectorscope
  14401. Display 2 color component values in the two dimensional graph (which is called
  14402. a vectorscope).
  14403. This filter accepts the following options:
  14404. @table @option
  14405. @item mode, m
  14406. Set vectorscope mode.
  14407. It accepts the following values:
  14408. @table @samp
  14409. @item gray
  14410. Gray values are displayed on graph, higher brightness means more pixels have
  14411. same component color value on location in graph. This is the default mode.
  14412. @item color
  14413. Gray values are displayed on graph. Surrounding pixels values which are not
  14414. present in video frame are drawn in gradient of 2 color components which are
  14415. set by option @code{x} and @code{y}. The 3rd color component is static.
  14416. @item color2
  14417. Actual color components values present in video frame are displayed on graph.
  14418. @item color3
  14419. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14420. on graph increases value of another color component, which is luminance by
  14421. default values of @code{x} and @code{y}.
  14422. @item color4
  14423. Actual colors present in video frame are displayed on graph. If two different
  14424. colors map to same position on graph then color with higher value of component
  14425. not present in graph is picked.
  14426. @item color5
  14427. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14428. component picked from radial gradient.
  14429. @end table
  14430. @item x
  14431. Set which color component will be represented on X-axis. Default is @code{1}.
  14432. @item y
  14433. Set which color component will be represented on Y-axis. Default is @code{2}.
  14434. @item intensity, i
  14435. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14436. of color component which represents frequency of (X, Y) location in graph.
  14437. @item envelope, e
  14438. @table @samp
  14439. @item none
  14440. No envelope, this is default.
  14441. @item instant
  14442. Instant envelope, even darkest single pixel will be clearly highlighted.
  14443. @item peak
  14444. Hold maximum and minimum values presented in graph over time. This way you
  14445. can still spot out of range values without constantly looking at vectorscope.
  14446. @item peak+instant
  14447. Peak and instant envelope combined together.
  14448. @end table
  14449. @item graticule, g
  14450. Set what kind of graticule to draw.
  14451. @table @samp
  14452. @item none
  14453. @item green
  14454. @item color
  14455. @end table
  14456. @item opacity, o
  14457. Set graticule opacity.
  14458. @item flags, f
  14459. Set graticule flags.
  14460. @table @samp
  14461. @item white
  14462. Draw graticule for white point.
  14463. @item black
  14464. Draw graticule for black point.
  14465. @item name
  14466. Draw color points short names.
  14467. @end table
  14468. @item bgopacity, b
  14469. Set background opacity.
  14470. @item lthreshold, l
  14471. Set low threshold for color component not represented on X or Y axis.
  14472. Values lower than this value will be ignored. Default is 0.
  14473. Note this value is multiplied with actual max possible value one pixel component
  14474. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14475. is 0.1 * 255 = 25.
  14476. @item hthreshold, h
  14477. Set high threshold for color component not represented on X or Y axis.
  14478. Values higher than this value will be ignored. Default is 1.
  14479. Note this value is multiplied with actual max possible value one pixel component
  14480. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14481. is 0.9 * 255 = 230.
  14482. @item colorspace, c
  14483. Set what kind of colorspace to use when drawing graticule.
  14484. @table @samp
  14485. @item auto
  14486. @item 601
  14487. @item 709
  14488. @end table
  14489. Default is auto.
  14490. @end table
  14491. @anchor{vidstabdetect}
  14492. @section vidstabdetect
  14493. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14494. @ref{vidstabtransform} for pass 2.
  14495. This filter generates a file with relative translation and rotation
  14496. transform information about subsequent frames, which is then used by
  14497. the @ref{vidstabtransform} filter.
  14498. To enable compilation of this filter you need to configure FFmpeg with
  14499. @code{--enable-libvidstab}.
  14500. This filter accepts the following options:
  14501. @table @option
  14502. @item result
  14503. Set the path to the file used to write the transforms information.
  14504. Default value is @file{transforms.trf}.
  14505. @item shakiness
  14506. Set how shaky the video is and how quick the camera is. It accepts an
  14507. integer in the range 1-10, a value of 1 means little shakiness, a
  14508. value of 10 means strong shakiness. Default value is 5.
  14509. @item accuracy
  14510. Set the accuracy of the detection process. It must be a value in the
  14511. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14512. accuracy. Default value is 15.
  14513. @item stepsize
  14514. Set stepsize of the search process. The region around minimum is
  14515. scanned with 1 pixel resolution. Default value is 6.
  14516. @item mincontrast
  14517. Set minimum contrast. Below this value a local measurement field is
  14518. discarded. Must be a floating point value in the range 0-1. Default
  14519. value is 0.3.
  14520. @item tripod
  14521. Set reference frame number for tripod mode.
  14522. If enabled, the motion of the frames is compared to a reference frame
  14523. in the filtered stream, identified by the specified number. The idea
  14524. is to compensate all movements in a more-or-less static scene and keep
  14525. the camera view absolutely still.
  14526. If set to 0, it is disabled. The frames are counted starting from 1.
  14527. @item show
  14528. Show fields and transforms in the resulting frames. It accepts an
  14529. integer in the range 0-2. Default value is 0, which disables any
  14530. visualization.
  14531. @end table
  14532. @subsection Examples
  14533. @itemize
  14534. @item
  14535. Use default values:
  14536. @example
  14537. vidstabdetect
  14538. @end example
  14539. @item
  14540. Analyze strongly shaky movie and put the results in file
  14541. @file{mytransforms.trf}:
  14542. @example
  14543. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14544. @end example
  14545. @item
  14546. Visualize the result of internal transformations in the resulting
  14547. video:
  14548. @example
  14549. vidstabdetect=show=1
  14550. @end example
  14551. @item
  14552. Analyze a video with medium shakiness using @command{ffmpeg}:
  14553. @example
  14554. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14555. @end example
  14556. @end itemize
  14557. @anchor{vidstabtransform}
  14558. @section vidstabtransform
  14559. Video stabilization/deshaking: pass 2 of 2,
  14560. see @ref{vidstabdetect} for pass 1.
  14561. Read a file with transform information for each frame and
  14562. apply/compensate them. Together with the @ref{vidstabdetect}
  14563. filter this can be used to deshake videos. See also
  14564. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14565. the @ref{unsharp} filter, see below.
  14566. To enable compilation of this filter you need to configure FFmpeg with
  14567. @code{--enable-libvidstab}.
  14568. @subsection Options
  14569. @table @option
  14570. @item input
  14571. Set path to the file used to read the transforms. Default value is
  14572. @file{transforms.trf}.
  14573. @item smoothing
  14574. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14575. camera movements. Default value is 10.
  14576. For example a number of 10 means that 21 frames are used (10 in the
  14577. past and 10 in the future) to smoothen the motion in the video. A
  14578. larger value leads to a smoother video, but limits the acceleration of
  14579. the camera (pan/tilt movements). 0 is a special case where a static
  14580. camera is simulated.
  14581. @item optalgo
  14582. Set the camera path optimization algorithm.
  14583. Accepted values are:
  14584. @table @samp
  14585. @item gauss
  14586. gaussian kernel low-pass filter on camera motion (default)
  14587. @item avg
  14588. averaging on transformations
  14589. @end table
  14590. @item maxshift
  14591. Set maximal number of pixels to translate frames. Default value is -1,
  14592. meaning no limit.
  14593. @item maxangle
  14594. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14595. value is -1, meaning no limit.
  14596. @item crop
  14597. Specify how to deal with borders that may be visible due to movement
  14598. compensation.
  14599. Available values are:
  14600. @table @samp
  14601. @item keep
  14602. keep image information from previous frame (default)
  14603. @item black
  14604. fill the border black
  14605. @end table
  14606. @item invert
  14607. Invert transforms if set to 1. Default value is 0.
  14608. @item relative
  14609. Consider transforms as relative to previous frame if set to 1,
  14610. absolute if set to 0. Default value is 0.
  14611. @item zoom
  14612. Set percentage to zoom. A positive value will result in a zoom-in
  14613. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14614. zoom).
  14615. @item optzoom
  14616. Set optimal zooming to avoid borders.
  14617. Accepted values are:
  14618. @table @samp
  14619. @item 0
  14620. disabled
  14621. @item 1
  14622. optimal static zoom value is determined (only very strong movements
  14623. will lead to visible borders) (default)
  14624. @item 2
  14625. optimal adaptive zoom value is determined (no borders will be
  14626. visible), see @option{zoomspeed}
  14627. @end table
  14628. Note that the value given at zoom is added to the one calculated here.
  14629. @item zoomspeed
  14630. Set percent to zoom maximally each frame (enabled when
  14631. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14632. 0.25.
  14633. @item interpol
  14634. Specify type of interpolation.
  14635. Available values are:
  14636. @table @samp
  14637. @item no
  14638. no interpolation
  14639. @item linear
  14640. linear only horizontal
  14641. @item bilinear
  14642. linear in both directions (default)
  14643. @item bicubic
  14644. cubic in both directions (slow)
  14645. @end table
  14646. @item tripod
  14647. Enable virtual tripod mode if set to 1, which is equivalent to
  14648. @code{relative=0:smoothing=0}. Default value is 0.
  14649. Use also @code{tripod} option of @ref{vidstabdetect}.
  14650. @item debug
  14651. Increase log verbosity if set to 1. Also the detected global motions
  14652. are written to the temporary file @file{global_motions.trf}. Default
  14653. value is 0.
  14654. @end table
  14655. @subsection Examples
  14656. @itemize
  14657. @item
  14658. Use @command{ffmpeg} for a typical stabilization with default values:
  14659. @example
  14660. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14661. @end example
  14662. Note the use of the @ref{unsharp} filter which is always recommended.
  14663. @item
  14664. Zoom in a bit more and load transform data from a given file:
  14665. @example
  14666. vidstabtransform=zoom=5:input="mytransforms.trf"
  14667. @end example
  14668. @item
  14669. Smoothen the video even more:
  14670. @example
  14671. vidstabtransform=smoothing=30
  14672. @end example
  14673. @end itemize
  14674. @section vflip
  14675. Flip the input video vertically.
  14676. For example, to vertically flip a video with @command{ffmpeg}:
  14677. @example
  14678. ffmpeg -i in.avi -vf "vflip" out.avi
  14679. @end example
  14680. @section vfrdet
  14681. Detect variable frame rate video.
  14682. This filter tries to detect if the input is variable or constant frame rate.
  14683. At end it will output number of frames detected as having variable delta pts,
  14684. and ones with constant delta pts.
  14685. If there was frames with variable delta, than it will also show min, max and
  14686. average delta encountered.
  14687. @section vibrance
  14688. Boost or alter saturation.
  14689. The filter accepts the following options:
  14690. @table @option
  14691. @item intensity
  14692. Set strength of boost if positive value or strength of alter if negative value.
  14693. Default is 0. Allowed range is from -2 to 2.
  14694. @item rbal
  14695. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14696. @item gbal
  14697. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14698. @item bbal
  14699. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14700. @item rlum
  14701. Set the red luma coefficient.
  14702. @item glum
  14703. Set the green luma coefficient.
  14704. @item blum
  14705. Set the blue luma coefficient.
  14706. @item alternate
  14707. If @code{intensity} is negative and this is set to 1, colors will change,
  14708. otherwise colors will be less saturated, more towards gray.
  14709. @end table
  14710. @anchor{vignette}
  14711. @section vignette
  14712. Make or reverse a natural vignetting effect.
  14713. The filter accepts the following options:
  14714. @table @option
  14715. @item angle, a
  14716. Set lens angle expression as a number of radians.
  14717. The value is clipped in the @code{[0,PI/2]} range.
  14718. Default value: @code{"PI/5"}
  14719. @item x0
  14720. @item y0
  14721. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14722. by default.
  14723. @item mode
  14724. Set forward/backward mode.
  14725. Available modes are:
  14726. @table @samp
  14727. @item forward
  14728. The larger the distance from the central point, the darker the image becomes.
  14729. @item backward
  14730. The larger the distance from the central point, the brighter the image becomes.
  14731. This can be used to reverse a vignette effect, though there is no automatic
  14732. detection to extract the lens @option{angle} and other settings (yet). It can
  14733. also be used to create a burning effect.
  14734. @end table
  14735. Default value is @samp{forward}.
  14736. @item eval
  14737. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14738. It accepts the following values:
  14739. @table @samp
  14740. @item init
  14741. Evaluate expressions only once during the filter initialization.
  14742. @item frame
  14743. Evaluate expressions for each incoming frame. This is way slower than the
  14744. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14745. allows advanced dynamic expressions.
  14746. @end table
  14747. Default value is @samp{init}.
  14748. @item dither
  14749. Set dithering to reduce the circular banding effects. Default is @code{1}
  14750. (enabled).
  14751. @item aspect
  14752. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14753. Setting this value to the SAR of the input will make a rectangular vignetting
  14754. following the dimensions of the video.
  14755. Default is @code{1/1}.
  14756. @end table
  14757. @subsection Expressions
  14758. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14759. following parameters.
  14760. @table @option
  14761. @item w
  14762. @item h
  14763. input width and height
  14764. @item n
  14765. the number of input frame, starting from 0
  14766. @item pts
  14767. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14768. @var{TB} units, NAN if undefined
  14769. @item r
  14770. frame rate of the input video, NAN if the input frame rate is unknown
  14771. @item t
  14772. the PTS (Presentation TimeStamp) of the filtered video frame,
  14773. expressed in seconds, NAN if undefined
  14774. @item tb
  14775. time base of the input video
  14776. @end table
  14777. @subsection Examples
  14778. @itemize
  14779. @item
  14780. Apply simple strong vignetting effect:
  14781. @example
  14782. vignette=PI/4
  14783. @end example
  14784. @item
  14785. Make a flickering vignetting:
  14786. @example
  14787. vignette='PI/4+random(1)*PI/50':eval=frame
  14788. @end example
  14789. @end itemize
  14790. @section vmafmotion
  14791. Obtain the average VMAF motion score of a video.
  14792. It is one of the component metrics of VMAF.
  14793. The obtained average motion score is printed through the logging system.
  14794. The filter accepts the following options:
  14795. @table @option
  14796. @item stats_file
  14797. If specified, the filter will use the named file to save the motion score of
  14798. each frame with respect to the previous frame.
  14799. When filename equals "-" the data is sent to standard output.
  14800. @end table
  14801. Example:
  14802. @example
  14803. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  14804. @end example
  14805. @section vstack
  14806. Stack input videos vertically.
  14807. All streams must be of same pixel format and of same width.
  14808. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14809. to create same output.
  14810. The filter accepts the following options:
  14811. @table @option
  14812. @item inputs
  14813. Set number of input streams. Default is 2.
  14814. @item shortest
  14815. If set to 1, force the output to terminate when the shortest input
  14816. terminates. Default value is 0.
  14817. @end table
  14818. @section w3fdif
  14819. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14820. Deinterlacing Filter").
  14821. Based on the process described by Martin Weston for BBC R&D, and
  14822. implemented based on the de-interlace algorithm written by Jim
  14823. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14824. uses filter coefficients calculated by BBC R&D.
  14825. This filter uses field-dominance information in frame to decide which
  14826. of each pair of fields to place first in the output.
  14827. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14828. There are two sets of filter coefficients, so called "simple"
  14829. and "complex". Which set of filter coefficients is used can
  14830. be set by passing an optional parameter:
  14831. @table @option
  14832. @item filter
  14833. Set the interlacing filter coefficients. Accepts one of the following values:
  14834. @table @samp
  14835. @item simple
  14836. Simple filter coefficient set.
  14837. @item complex
  14838. More-complex filter coefficient set.
  14839. @end table
  14840. Default value is @samp{complex}.
  14841. @item deint
  14842. Specify which frames to deinterlace. Accepts one of the following values:
  14843. @table @samp
  14844. @item all
  14845. Deinterlace all frames,
  14846. @item interlaced
  14847. Only deinterlace frames marked as interlaced.
  14848. @end table
  14849. Default value is @samp{all}.
  14850. @end table
  14851. @section waveform
  14852. Video waveform monitor.
  14853. The waveform monitor plots color component intensity. By default luminance
  14854. only. Each column of the waveform corresponds to a column of pixels in the
  14855. source video.
  14856. It accepts the following options:
  14857. @table @option
  14858. @item mode, m
  14859. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14860. In row mode, the graph on the left side represents color component value 0 and
  14861. the right side represents value = 255. In column mode, the top side represents
  14862. color component value = 0 and bottom side represents value = 255.
  14863. @item intensity, i
  14864. Set intensity. Smaller values are useful to find out how many values of the same
  14865. luminance are distributed across input rows/columns.
  14866. Default value is @code{0.04}. Allowed range is [0, 1].
  14867. @item mirror, r
  14868. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14869. In mirrored mode, higher values will be represented on the left
  14870. side for @code{row} mode and at the top for @code{column} mode. Default is
  14871. @code{1} (mirrored).
  14872. @item display, d
  14873. Set display mode.
  14874. It accepts the following values:
  14875. @table @samp
  14876. @item overlay
  14877. Presents information identical to that in the @code{parade}, except
  14878. that the graphs representing color components are superimposed directly
  14879. over one another.
  14880. This display mode makes it easier to spot relative differences or similarities
  14881. in overlapping areas of the color components that are supposed to be identical,
  14882. such as neutral whites, grays, or blacks.
  14883. @item stack
  14884. Display separate graph for the color components side by side in
  14885. @code{row} mode or one below the other in @code{column} mode.
  14886. @item parade
  14887. Display separate graph for the color components side by side in
  14888. @code{column} mode or one below the other in @code{row} mode.
  14889. Using this display mode makes it easy to spot color casts in the highlights
  14890. and shadows of an image, by comparing the contours of the top and the bottom
  14891. graphs of each waveform. Since whites, grays, and blacks are characterized
  14892. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14893. should display three waveforms of roughly equal width/height. If not, the
  14894. correction is easy to perform by making level adjustments the three waveforms.
  14895. @end table
  14896. Default is @code{stack}.
  14897. @item components, c
  14898. Set which color components to display. Default is 1, which means only luminance
  14899. or red color component if input is in RGB colorspace. If is set for example to
  14900. 7 it will display all 3 (if) available color components.
  14901. @item envelope, e
  14902. @table @samp
  14903. @item none
  14904. No envelope, this is default.
  14905. @item instant
  14906. Instant envelope, minimum and maximum values presented in graph will be easily
  14907. visible even with small @code{step} value.
  14908. @item peak
  14909. Hold minimum and maximum values presented in graph across time. This way you
  14910. can still spot out of range values without constantly looking at waveforms.
  14911. @item peak+instant
  14912. Peak and instant envelope combined together.
  14913. @end table
  14914. @item filter, f
  14915. @table @samp
  14916. @item lowpass
  14917. No filtering, this is default.
  14918. @item flat
  14919. Luma and chroma combined together.
  14920. @item aflat
  14921. Similar as above, but shows difference between blue and red chroma.
  14922. @item xflat
  14923. Similar as above, but use different colors.
  14924. @item yflat
  14925. Similar as above, but again with different colors.
  14926. @item chroma
  14927. Displays only chroma.
  14928. @item color
  14929. Displays actual color value on waveform.
  14930. @item acolor
  14931. Similar as above, but with luma showing frequency of chroma values.
  14932. @end table
  14933. @item graticule, g
  14934. Set which graticule to display.
  14935. @table @samp
  14936. @item none
  14937. Do not display graticule.
  14938. @item green
  14939. Display green graticule showing legal broadcast ranges.
  14940. @item orange
  14941. Display orange graticule showing legal broadcast ranges.
  14942. @item invert
  14943. Display invert graticule showing legal broadcast ranges.
  14944. @end table
  14945. @item opacity, o
  14946. Set graticule opacity.
  14947. @item flags, fl
  14948. Set graticule flags.
  14949. @table @samp
  14950. @item numbers
  14951. Draw numbers above lines. By default enabled.
  14952. @item dots
  14953. Draw dots instead of lines.
  14954. @end table
  14955. @item scale, s
  14956. Set scale used for displaying graticule.
  14957. @table @samp
  14958. @item digital
  14959. @item millivolts
  14960. @item ire
  14961. @end table
  14962. Default is digital.
  14963. @item bgopacity, b
  14964. Set background opacity.
  14965. @end table
  14966. @section weave, doubleweave
  14967. The @code{weave} takes a field-based video input and join
  14968. each two sequential fields into single frame, producing a new double
  14969. height clip with half the frame rate and half the frame count.
  14970. The @code{doubleweave} works same as @code{weave} but without
  14971. halving frame rate and frame count.
  14972. It accepts the following option:
  14973. @table @option
  14974. @item first_field
  14975. Set first field. Available values are:
  14976. @table @samp
  14977. @item top, t
  14978. Set the frame as top-field-first.
  14979. @item bottom, b
  14980. Set the frame as bottom-field-first.
  14981. @end table
  14982. @end table
  14983. @subsection Examples
  14984. @itemize
  14985. @item
  14986. Interlace video using @ref{select} and @ref{separatefields} filter:
  14987. @example
  14988. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14989. @end example
  14990. @end itemize
  14991. @section xbr
  14992. Apply the xBR high-quality magnification filter which is designed for pixel
  14993. art. It follows a set of edge-detection rules, see
  14994. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14995. It accepts the following option:
  14996. @table @option
  14997. @item n
  14998. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14999. @code{3xBR} and @code{4} for @code{4xBR}.
  15000. Default is @code{3}.
  15001. @end table
  15002. @section xmedian
  15003. Pick median pixels from several input videos.
  15004. The filter accepts the following options:
  15005. @table @option
  15006. @item inputs
  15007. Set number of inputs.
  15008. Default is 3. Allowed range is from 3 to 255.
  15009. If number of inputs is even number, than result will be mean value between two median values.
  15010. @item planes
  15011. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15012. @end table
  15013. @section xstack
  15014. Stack video inputs into custom layout.
  15015. All streams must be of same pixel format.
  15016. The filter accepts the following options:
  15017. @table @option
  15018. @item inputs
  15019. Set number of input streams. Default is 2.
  15020. @item layout
  15021. Specify layout of inputs.
  15022. This option requires the desired layout configuration to be explicitly set by the user.
  15023. This sets position of each video input in output. Each input
  15024. is separated by '|'.
  15025. The first number represents the column, and the second number represents the row.
  15026. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15027. where X is video input from which to take width or height.
  15028. Multiple values can be used when separated by '+'. In such
  15029. case values are summed together.
  15030. Note that if inputs are of different sizes gaps may appear, as not all of
  15031. the output video frame will be filled. Similarly, videos can overlap each
  15032. other if their position doesn't leave enough space for the full frame of
  15033. adjoining videos.
  15034. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15035. a layout must be set by the user.
  15036. @item shortest
  15037. If set to 1, force the output to terminate when the shortest input
  15038. terminates. Default value is 0.
  15039. @end table
  15040. @subsection Examples
  15041. @itemize
  15042. @item
  15043. Display 4 inputs into 2x2 grid.
  15044. Layout:
  15045. @example
  15046. input1(0, 0) | input3(w0, 0)
  15047. input2(0, h0) | input4(w0, h0)
  15048. @end example
  15049. @example
  15050. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15051. @end example
  15052. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15053. @item
  15054. Display 4 inputs into 1x4 grid.
  15055. Layout:
  15056. @example
  15057. input1(0, 0)
  15058. input2(0, h0)
  15059. input3(0, h0+h1)
  15060. input4(0, h0+h1+h2)
  15061. @end example
  15062. @example
  15063. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15064. @end example
  15065. Note that if inputs are of different widths, unused space will appear.
  15066. @item
  15067. Display 9 inputs into 3x3 grid.
  15068. Layout:
  15069. @example
  15070. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15071. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15072. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15073. @end example
  15074. @example
  15075. 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
  15076. @end example
  15077. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15078. @item
  15079. Display 16 inputs into 4x4 grid.
  15080. Layout:
  15081. @example
  15082. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15083. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15084. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15085. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15086. @end example
  15087. @example
  15088. 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|
  15089. 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
  15090. @end example
  15091. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15092. @end itemize
  15093. @anchor{yadif}
  15094. @section yadif
  15095. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15096. filter").
  15097. It accepts the following parameters:
  15098. @table @option
  15099. @item mode
  15100. The interlacing mode to adopt. It accepts one of the following values:
  15101. @table @option
  15102. @item 0, send_frame
  15103. Output one frame for each frame.
  15104. @item 1, send_field
  15105. Output one frame for each field.
  15106. @item 2, send_frame_nospatial
  15107. Like @code{send_frame}, but it skips the spatial interlacing check.
  15108. @item 3, send_field_nospatial
  15109. Like @code{send_field}, but it skips the spatial interlacing check.
  15110. @end table
  15111. The default value is @code{send_frame}.
  15112. @item parity
  15113. The picture field parity assumed for the input interlaced video. It accepts one
  15114. of the following values:
  15115. @table @option
  15116. @item 0, tff
  15117. Assume the top field is first.
  15118. @item 1, bff
  15119. Assume the bottom field is first.
  15120. @item -1, auto
  15121. Enable automatic detection of field parity.
  15122. @end table
  15123. The default value is @code{auto}.
  15124. If the interlacing is unknown or the decoder does not export this information,
  15125. top field first will be assumed.
  15126. @item deint
  15127. Specify which frames to deinterlace. Accepts one of the following
  15128. values:
  15129. @table @option
  15130. @item 0, all
  15131. Deinterlace all frames.
  15132. @item 1, interlaced
  15133. Only deinterlace frames marked as interlaced.
  15134. @end table
  15135. The default value is @code{all}.
  15136. @end table
  15137. @section yadif_cuda
  15138. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15139. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15140. and/or nvenc.
  15141. It accepts the following parameters:
  15142. @table @option
  15143. @item mode
  15144. The interlacing mode to adopt. It accepts one of the following values:
  15145. @table @option
  15146. @item 0, send_frame
  15147. Output one frame for each frame.
  15148. @item 1, send_field
  15149. Output one frame for each field.
  15150. @item 2, send_frame_nospatial
  15151. Like @code{send_frame}, but it skips the spatial interlacing check.
  15152. @item 3, send_field_nospatial
  15153. Like @code{send_field}, but it skips the spatial interlacing check.
  15154. @end table
  15155. The default value is @code{send_frame}.
  15156. @item parity
  15157. The picture field parity assumed for the input interlaced video. It accepts one
  15158. of the following values:
  15159. @table @option
  15160. @item 0, tff
  15161. Assume the top field is first.
  15162. @item 1, bff
  15163. Assume the bottom field is first.
  15164. @item -1, auto
  15165. Enable automatic detection of field parity.
  15166. @end table
  15167. The default value is @code{auto}.
  15168. If the interlacing is unknown or the decoder does not export this information,
  15169. top field first will be assumed.
  15170. @item deint
  15171. Specify which frames to deinterlace. Accepts one of the following
  15172. values:
  15173. @table @option
  15174. @item 0, all
  15175. Deinterlace all frames.
  15176. @item 1, interlaced
  15177. Only deinterlace frames marked as interlaced.
  15178. @end table
  15179. The default value is @code{all}.
  15180. @end table
  15181. @section zoompan
  15182. Apply Zoom & Pan effect.
  15183. This filter accepts the following options:
  15184. @table @option
  15185. @item zoom, z
  15186. Set the zoom expression. Range is 1-10. Default is 1.
  15187. @item x
  15188. @item y
  15189. Set the x and y expression. Default is 0.
  15190. @item d
  15191. Set the duration expression in number of frames.
  15192. This sets for how many number of frames effect will last for
  15193. single input image.
  15194. @item s
  15195. Set the output image size, default is 'hd720'.
  15196. @item fps
  15197. Set the output frame rate, default is '25'.
  15198. @end table
  15199. Each expression can contain the following constants:
  15200. @table @option
  15201. @item in_w, iw
  15202. Input width.
  15203. @item in_h, ih
  15204. Input height.
  15205. @item out_w, ow
  15206. Output width.
  15207. @item out_h, oh
  15208. Output height.
  15209. @item in
  15210. Input frame count.
  15211. @item on
  15212. Output frame count.
  15213. @item x
  15214. @item y
  15215. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15216. for current input frame.
  15217. @item px
  15218. @item py
  15219. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15220. not yet such frame (first input frame).
  15221. @item zoom
  15222. Last calculated zoom from 'z' expression for current input frame.
  15223. @item pzoom
  15224. Last calculated zoom of last output frame of previous input frame.
  15225. @item duration
  15226. Number of output frames for current input frame. Calculated from 'd' expression
  15227. for each input frame.
  15228. @item pduration
  15229. number of output frames created for previous input frame
  15230. @item a
  15231. Rational number: input width / input height
  15232. @item sar
  15233. sample aspect ratio
  15234. @item dar
  15235. display aspect ratio
  15236. @end table
  15237. @subsection Examples
  15238. @itemize
  15239. @item
  15240. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15241. @example
  15242. 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
  15243. @end example
  15244. @item
  15245. Zoom-in up to 1.5 and pan always at center of picture:
  15246. @example
  15247. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15248. @end example
  15249. @item
  15250. Same as above but without pausing:
  15251. @example
  15252. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15253. @end example
  15254. @end itemize
  15255. @anchor{zscale}
  15256. @section zscale
  15257. Scale (resize) the input video, using the z.lib library:
  15258. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15259. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15260. The zscale filter forces the output display aspect ratio to be the same
  15261. as the input, by changing the output sample aspect ratio.
  15262. If the input image format is different from the format requested by
  15263. the next filter, the zscale filter will convert the input to the
  15264. requested format.
  15265. @subsection Options
  15266. The filter accepts the following options.
  15267. @table @option
  15268. @item width, w
  15269. @item height, h
  15270. Set the output video dimension expression. Default value is the input
  15271. dimension.
  15272. If the @var{width} or @var{w} value is 0, the input width is used for
  15273. the output. If the @var{height} or @var{h} value is 0, the input height
  15274. is used for the output.
  15275. If one and only one of the values is -n with n >= 1, the zscale filter
  15276. will use a value that maintains the aspect ratio of the input image,
  15277. calculated from the other specified dimension. After that it will,
  15278. however, make sure that the calculated dimension is divisible by n and
  15279. adjust the value if necessary.
  15280. If both values are -n with n >= 1, the behavior will be identical to
  15281. both values being set to 0 as previously detailed.
  15282. See below for the list of accepted constants for use in the dimension
  15283. expression.
  15284. @item size, s
  15285. Set the video size. For the syntax of this option, check the
  15286. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15287. @item dither, d
  15288. Set the dither type.
  15289. Possible values are:
  15290. @table @var
  15291. @item none
  15292. @item ordered
  15293. @item random
  15294. @item error_diffusion
  15295. @end table
  15296. Default is none.
  15297. @item filter, f
  15298. Set the resize filter type.
  15299. Possible values are:
  15300. @table @var
  15301. @item point
  15302. @item bilinear
  15303. @item bicubic
  15304. @item spline16
  15305. @item spline36
  15306. @item lanczos
  15307. @end table
  15308. Default is bilinear.
  15309. @item range, r
  15310. Set the color range.
  15311. Possible values are:
  15312. @table @var
  15313. @item input
  15314. @item limited
  15315. @item full
  15316. @end table
  15317. Default is same as input.
  15318. @item primaries, p
  15319. Set the color primaries.
  15320. Possible values are:
  15321. @table @var
  15322. @item input
  15323. @item 709
  15324. @item unspecified
  15325. @item 170m
  15326. @item 240m
  15327. @item 2020
  15328. @end table
  15329. Default is same as input.
  15330. @item transfer, t
  15331. Set the transfer characteristics.
  15332. Possible values are:
  15333. @table @var
  15334. @item input
  15335. @item 709
  15336. @item unspecified
  15337. @item 601
  15338. @item linear
  15339. @item 2020_10
  15340. @item 2020_12
  15341. @item smpte2084
  15342. @item iec61966-2-1
  15343. @item arib-std-b67
  15344. @end table
  15345. Default is same as input.
  15346. @item matrix, m
  15347. Set the colorspace matrix.
  15348. Possible value are:
  15349. @table @var
  15350. @item input
  15351. @item 709
  15352. @item unspecified
  15353. @item 470bg
  15354. @item 170m
  15355. @item 2020_ncl
  15356. @item 2020_cl
  15357. @end table
  15358. Default is same as input.
  15359. @item rangein, rin
  15360. Set the input color range.
  15361. Possible values are:
  15362. @table @var
  15363. @item input
  15364. @item limited
  15365. @item full
  15366. @end table
  15367. Default is same as input.
  15368. @item primariesin, pin
  15369. Set the input color primaries.
  15370. Possible values are:
  15371. @table @var
  15372. @item input
  15373. @item 709
  15374. @item unspecified
  15375. @item 170m
  15376. @item 240m
  15377. @item 2020
  15378. @end table
  15379. Default is same as input.
  15380. @item transferin, tin
  15381. Set the input transfer characteristics.
  15382. Possible values are:
  15383. @table @var
  15384. @item input
  15385. @item 709
  15386. @item unspecified
  15387. @item 601
  15388. @item linear
  15389. @item 2020_10
  15390. @item 2020_12
  15391. @end table
  15392. Default is same as input.
  15393. @item matrixin, min
  15394. Set the input colorspace matrix.
  15395. Possible value are:
  15396. @table @var
  15397. @item input
  15398. @item 709
  15399. @item unspecified
  15400. @item 470bg
  15401. @item 170m
  15402. @item 2020_ncl
  15403. @item 2020_cl
  15404. @end table
  15405. @item chromal, c
  15406. Set the output chroma location.
  15407. Possible values are:
  15408. @table @var
  15409. @item input
  15410. @item left
  15411. @item center
  15412. @item topleft
  15413. @item top
  15414. @item bottomleft
  15415. @item bottom
  15416. @end table
  15417. @item chromalin, cin
  15418. Set the input chroma location.
  15419. Possible values are:
  15420. @table @var
  15421. @item input
  15422. @item left
  15423. @item center
  15424. @item topleft
  15425. @item top
  15426. @item bottomleft
  15427. @item bottom
  15428. @end table
  15429. @item npl
  15430. Set the nominal peak luminance.
  15431. @end table
  15432. The values of the @option{w} and @option{h} options are expressions
  15433. containing the following constants:
  15434. @table @var
  15435. @item in_w
  15436. @item in_h
  15437. The input width and height
  15438. @item iw
  15439. @item ih
  15440. These are the same as @var{in_w} and @var{in_h}.
  15441. @item out_w
  15442. @item out_h
  15443. The output (scaled) width and height
  15444. @item ow
  15445. @item oh
  15446. These are the same as @var{out_w} and @var{out_h}
  15447. @item a
  15448. The same as @var{iw} / @var{ih}
  15449. @item sar
  15450. input sample aspect ratio
  15451. @item dar
  15452. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15453. @item hsub
  15454. @item vsub
  15455. horizontal and vertical input chroma subsample values. For example for the
  15456. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15457. @item ohsub
  15458. @item ovsub
  15459. horizontal and vertical output chroma subsample values. For example for the
  15460. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15461. @end table
  15462. @table @option
  15463. @end table
  15464. @c man end VIDEO FILTERS
  15465. @chapter OpenCL Video Filters
  15466. @c man begin OPENCL VIDEO FILTERS
  15467. Below is a description of the currently available OpenCL video filters.
  15468. To enable compilation of these filters you need to configure FFmpeg with
  15469. @code{--enable-opencl}.
  15470. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15471. @table @option
  15472. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15473. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15474. given device parameters.
  15475. @item -filter_hw_device @var{name}
  15476. Pass the hardware device called @var{name} to all filters in any filter graph.
  15477. @end table
  15478. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15479. @itemize
  15480. @item
  15481. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15482. @example
  15483. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15484. @end example
  15485. @end itemize
  15486. 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.
  15487. @section avgblur_opencl
  15488. Apply average blur filter.
  15489. The filter accepts the following options:
  15490. @table @option
  15491. @item sizeX
  15492. Set horizontal radius size.
  15493. Range is @code{[1, 1024]} and default value is @code{1}.
  15494. @item planes
  15495. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15496. @item sizeY
  15497. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15498. @end table
  15499. @subsection Example
  15500. @itemize
  15501. @item
  15502. 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.
  15503. @example
  15504. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15505. @end example
  15506. @end itemize
  15507. @section boxblur_opencl
  15508. Apply a boxblur algorithm to the input video.
  15509. It accepts the following parameters:
  15510. @table @option
  15511. @item luma_radius, lr
  15512. @item luma_power, lp
  15513. @item chroma_radius, cr
  15514. @item chroma_power, cp
  15515. @item alpha_radius, ar
  15516. @item alpha_power, ap
  15517. @end table
  15518. A description of the accepted options follows.
  15519. @table @option
  15520. @item luma_radius, lr
  15521. @item chroma_radius, cr
  15522. @item alpha_radius, ar
  15523. Set an expression for the box radius in pixels used for blurring the
  15524. corresponding input plane.
  15525. The radius value must be a non-negative number, and must not be
  15526. greater than the value of the expression @code{min(w,h)/2} for the
  15527. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15528. planes.
  15529. Default value for @option{luma_radius} is "2". If not specified,
  15530. @option{chroma_radius} and @option{alpha_radius} default to the
  15531. corresponding value set for @option{luma_radius}.
  15532. The expressions can contain the following constants:
  15533. @table @option
  15534. @item w
  15535. @item h
  15536. The input width and height in pixels.
  15537. @item cw
  15538. @item ch
  15539. The input chroma image width and height in pixels.
  15540. @item hsub
  15541. @item vsub
  15542. The horizontal and vertical chroma subsample values. For example, for the
  15543. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15544. @end table
  15545. @item luma_power, lp
  15546. @item chroma_power, cp
  15547. @item alpha_power, ap
  15548. Specify how many times the boxblur filter is applied to the
  15549. corresponding plane.
  15550. Default value for @option{luma_power} is 2. If not specified,
  15551. @option{chroma_power} and @option{alpha_power} default to the
  15552. corresponding value set for @option{luma_power}.
  15553. A value of 0 will disable the effect.
  15554. @end table
  15555. @subsection Examples
  15556. 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.
  15557. @itemize
  15558. @item
  15559. Apply a boxblur filter with the luma, chroma, and alpha radius
  15560. 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.
  15561. @example
  15562. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15563. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15564. @end example
  15565. @item
  15566. 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.
  15567. For the luma plane, a 2x2 box radius will be run once.
  15568. For the chroma plane, a 4x4 box radius will be run 5 times.
  15569. For the alpha plane, a 3x3 box radius will be run 7 times.
  15570. @example
  15571. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15572. @end example
  15573. @end itemize
  15574. @section convolution_opencl
  15575. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15576. The filter accepts the following options:
  15577. @table @option
  15578. @item 0m
  15579. @item 1m
  15580. @item 2m
  15581. @item 3m
  15582. Set matrix for each plane.
  15583. Matrix is sequence of 9, 25 or 49 signed numbers.
  15584. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15585. @item 0rdiv
  15586. @item 1rdiv
  15587. @item 2rdiv
  15588. @item 3rdiv
  15589. Set multiplier for calculated value for each plane.
  15590. If unset or 0, it will be sum of all matrix elements.
  15591. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15592. @item 0bias
  15593. @item 1bias
  15594. @item 2bias
  15595. @item 3bias
  15596. Set bias for each plane. This value is added to the result of the multiplication.
  15597. Useful for making the overall image brighter or darker.
  15598. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15599. @end table
  15600. @subsection Examples
  15601. @itemize
  15602. @item
  15603. Apply sharpen:
  15604. @example
  15605. -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
  15606. @end example
  15607. @item
  15608. Apply blur:
  15609. @example
  15610. -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
  15611. @end example
  15612. @item
  15613. Apply edge enhance:
  15614. @example
  15615. -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
  15616. @end example
  15617. @item
  15618. Apply edge detect:
  15619. @example
  15620. -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
  15621. @end example
  15622. @item
  15623. Apply laplacian edge detector which includes diagonals:
  15624. @example
  15625. -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
  15626. @end example
  15627. @item
  15628. Apply emboss:
  15629. @example
  15630. -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
  15631. @end example
  15632. @end itemize
  15633. @section dilation_opencl
  15634. Apply dilation effect to the video.
  15635. This filter replaces the pixel by the local(3x3) maximum.
  15636. It accepts the following options:
  15637. @table @option
  15638. @item threshold0
  15639. @item threshold1
  15640. @item threshold2
  15641. @item threshold3
  15642. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15643. If @code{0}, plane will remain unchanged.
  15644. @item coordinates
  15645. Flag which specifies the pixel to refer to.
  15646. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15647. Flags to local 3x3 coordinates region centered on @code{x}:
  15648. 1 2 3
  15649. 4 x 5
  15650. 6 7 8
  15651. @end table
  15652. @subsection Example
  15653. @itemize
  15654. @item
  15655. 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.
  15656. @example
  15657. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15658. @end example
  15659. @end itemize
  15660. @section erosion_opencl
  15661. Apply erosion effect to the video.
  15662. This filter replaces the pixel by the local(3x3) minimum.
  15663. It accepts the following options:
  15664. @table @option
  15665. @item threshold0
  15666. @item threshold1
  15667. @item threshold2
  15668. @item threshold3
  15669. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15670. If @code{0}, plane will remain unchanged.
  15671. @item coordinates
  15672. Flag which specifies the pixel to refer to.
  15673. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15674. Flags to local 3x3 coordinates region centered on @code{x}:
  15675. 1 2 3
  15676. 4 x 5
  15677. 6 7 8
  15678. @end table
  15679. @subsection Example
  15680. @itemize
  15681. @item
  15682. 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.
  15683. @example
  15684. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15685. @end example
  15686. @end itemize
  15687. @section colorkey_opencl
  15688. RGB colorspace color keying.
  15689. The filter accepts the following options:
  15690. @table @option
  15691. @item color
  15692. The color which will be replaced with transparency.
  15693. @item similarity
  15694. Similarity percentage with the key color.
  15695. 0.01 matches only the exact key color, while 1.0 matches everything.
  15696. @item blend
  15697. Blend percentage.
  15698. 0.0 makes pixels either fully transparent, or not transparent at all.
  15699. Higher values result in semi-transparent pixels, with a higher transparency
  15700. the more similar the pixels color is to the key color.
  15701. @end table
  15702. @subsection Examples
  15703. @itemize
  15704. @item
  15705. Make every semi-green pixel in the input transparent with some slight blending:
  15706. @example
  15707. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15708. @end example
  15709. @end itemize
  15710. @section deshake_opencl
  15711. Feature-point based video stabilization filter.
  15712. The filter accepts the following options:
  15713. @table @option
  15714. @item tripod
  15715. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15716. @item debug
  15717. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15718. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15719. Viewing point matches in the output video is only supported for RGB input.
  15720. Defaults to @code{0}.
  15721. @item adaptive_crop
  15722. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15723. Defaults to @code{1}.
  15724. @item refine_features
  15725. Whether or not feature points should be refined at a sub-pixel level.
  15726. This can be turned off for a slight performance gain at the cost of precision.
  15727. Defaults to @code{1}.
  15728. @item smooth_strength
  15729. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15730. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15731. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15732. Defaults to @code{0.0}.
  15733. @item smooth_window_multiplier
  15734. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15735. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15736. Acceptable values range from @code{0.1} to @code{10.0}.
  15737. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15738. potentially improving smoothness, but also increase latency and memory usage.
  15739. Defaults to @code{2.0}.
  15740. @end table
  15741. @subsection Examples
  15742. @itemize
  15743. @item
  15744. Stabilize a video with a fixed, medium smoothing strength:
  15745. @example
  15746. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15747. @end example
  15748. @item
  15749. Stabilize a video with debugging (both in console and in rendered video):
  15750. @example
  15751. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15752. @end example
  15753. @end itemize
  15754. @section nlmeans_opencl
  15755. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15756. @section overlay_opencl
  15757. Overlay one video on top of another.
  15758. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15759. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15760. The filter accepts the following options:
  15761. @table @option
  15762. @item x
  15763. Set the x coordinate of the overlaid video on the main video.
  15764. Default value is @code{0}.
  15765. @item y
  15766. Set the y coordinate of the overlaid video on the main video.
  15767. Default value is @code{0}.
  15768. @end table
  15769. @subsection Examples
  15770. @itemize
  15771. @item
  15772. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15773. @example
  15774. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15775. @end example
  15776. @item
  15777. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15778. @example
  15779. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15780. @end example
  15781. @end itemize
  15782. @section prewitt_opencl
  15783. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15784. The filter accepts the following option:
  15785. @table @option
  15786. @item planes
  15787. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15788. @item scale
  15789. Set value which will be multiplied with filtered result.
  15790. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15791. @item delta
  15792. Set value which will be added to filtered result.
  15793. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15794. @end table
  15795. @subsection Example
  15796. @itemize
  15797. @item
  15798. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15799. @example
  15800. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15801. @end example
  15802. @end itemize
  15803. @section roberts_opencl
  15804. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15805. The filter accepts the following option:
  15806. @table @option
  15807. @item planes
  15808. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15809. @item scale
  15810. Set value which will be multiplied with filtered result.
  15811. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15812. @item delta
  15813. Set value which will be added to filtered result.
  15814. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15815. @end table
  15816. @subsection Example
  15817. @itemize
  15818. @item
  15819. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15820. @example
  15821. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15822. @end example
  15823. @end itemize
  15824. @section sobel_opencl
  15825. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15826. The filter accepts the following option:
  15827. @table @option
  15828. @item planes
  15829. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15830. @item scale
  15831. Set value which will be multiplied with filtered result.
  15832. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15833. @item delta
  15834. Set value which will be added to filtered result.
  15835. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15836. @end table
  15837. @subsection Example
  15838. @itemize
  15839. @item
  15840. Apply sobel operator with scale set to 2 and delta set to 10
  15841. @example
  15842. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15843. @end example
  15844. @end itemize
  15845. @section tonemap_opencl
  15846. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15847. It accepts the following parameters:
  15848. @table @option
  15849. @item tonemap
  15850. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15851. @item param
  15852. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15853. @item desat
  15854. Apply desaturation for highlights that exceed this level of brightness. The
  15855. higher the parameter, the more color information will be preserved. This
  15856. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15857. (smoothly) turning into white instead. This makes images feel more natural,
  15858. at the cost of reducing information about out-of-range colors.
  15859. The default value is 0.5, and the algorithm here is a little different from
  15860. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15861. @item threshold
  15862. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15863. is used to detect whether the scene has changed or not. If the distance between
  15864. the current frame average brightness and the current running average exceeds
  15865. a threshold value, we would re-calculate scene average and peak brightness.
  15866. The default value is 0.2.
  15867. @item format
  15868. Specify the output pixel format.
  15869. Currently supported formats are:
  15870. @table @var
  15871. @item p010
  15872. @item nv12
  15873. @end table
  15874. @item range, r
  15875. Set the output color range.
  15876. Possible values are:
  15877. @table @var
  15878. @item tv/mpeg
  15879. @item pc/jpeg
  15880. @end table
  15881. Default is same as input.
  15882. @item primaries, p
  15883. Set the output color primaries.
  15884. Possible values are:
  15885. @table @var
  15886. @item bt709
  15887. @item bt2020
  15888. @end table
  15889. Default is same as input.
  15890. @item transfer, t
  15891. Set the output transfer characteristics.
  15892. Possible values are:
  15893. @table @var
  15894. @item bt709
  15895. @item bt2020
  15896. @end table
  15897. Default is bt709.
  15898. @item matrix, m
  15899. Set the output colorspace matrix.
  15900. Possible value are:
  15901. @table @var
  15902. @item bt709
  15903. @item bt2020
  15904. @end table
  15905. Default is same as input.
  15906. @end table
  15907. @subsection Example
  15908. @itemize
  15909. @item
  15910. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15911. @example
  15912. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15913. @end example
  15914. @end itemize
  15915. @section unsharp_opencl
  15916. Sharpen or blur the input video.
  15917. It accepts the following parameters:
  15918. @table @option
  15919. @item luma_msize_x, lx
  15920. Set the luma matrix horizontal size.
  15921. Range is @code{[1, 23]} and default value is @code{5}.
  15922. @item luma_msize_y, ly
  15923. Set the luma matrix vertical size.
  15924. Range is @code{[1, 23]} and default value is @code{5}.
  15925. @item luma_amount, la
  15926. Set the luma effect strength.
  15927. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15928. Negative values will blur the input video, while positive values will
  15929. sharpen it, a value of zero will disable the effect.
  15930. @item chroma_msize_x, cx
  15931. Set the chroma matrix horizontal size.
  15932. Range is @code{[1, 23]} and default value is @code{5}.
  15933. @item chroma_msize_y, cy
  15934. Set the chroma matrix vertical size.
  15935. Range is @code{[1, 23]} and default value is @code{5}.
  15936. @item chroma_amount, ca
  15937. Set the chroma effect strength.
  15938. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15939. Negative values will blur the input video, while positive values will
  15940. sharpen it, a value of zero will disable the effect.
  15941. @end table
  15942. All parameters are optional and default to the equivalent of the
  15943. string '5:5:1.0:5:5:0.0'.
  15944. @subsection Examples
  15945. @itemize
  15946. @item
  15947. Apply strong luma sharpen effect:
  15948. @example
  15949. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15950. @end example
  15951. @item
  15952. Apply a strong blur of both luma and chroma parameters:
  15953. @example
  15954. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15955. @end example
  15956. @end itemize
  15957. @c man end OPENCL VIDEO FILTERS
  15958. @chapter Video Sources
  15959. @c man begin VIDEO SOURCES
  15960. Below is a description of the currently available video sources.
  15961. @section buffer
  15962. Buffer video frames, and make them available to the filter chain.
  15963. This source is mainly intended for a programmatic use, in particular
  15964. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15965. It accepts the following parameters:
  15966. @table @option
  15967. @item video_size
  15968. Specify the size (width and height) of the buffered video frames. For the
  15969. syntax of this option, check the
  15970. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15971. @item width
  15972. The input video width.
  15973. @item height
  15974. The input video height.
  15975. @item pix_fmt
  15976. A string representing the pixel format of the buffered video frames.
  15977. It may be a number corresponding to a pixel format, or a pixel format
  15978. name.
  15979. @item time_base
  15980. Specify the timebase assumed by the timestamps of the buffered frames.
  15981. @item frame_rate
  15982. Specify the frame rate expected for the video stream.
  15983. @item pixel_aspect, sar
  15984. The sample (pixel) aspect ratio of the input video.
  15985. @item sws_param
  15986. Specify the optional parameters to be used for the scale filter which
  15987. is automatically inserted when an input change is detected in the
  15988. input size or format.
  15989. @item hw_frames_ctx
  15990. When using a hardware pixel format, this should be a reference to an
  15991. AVHWFramesContext describing input frames.
  15992. @end table
  15993. For example:
  15994. @example
  15995. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15996. @end example
  15997. will instruct the source to accept video frames with size 320x240 and
  15998. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15999. square pixels (1:1 sample aspect ratio).
  16000. Since the pixel format with name "yuv410p" corresponds to the number 6
  16001. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16002. this example corresponds to:
  16003. @example
  16004. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16005. @end example
  16006. Alternatively, the options can be specified as a flat string, but this
  16007. syntax is deprecated:
  16008. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  16009. @section cellauto
  16010. Create a pattern generated by an elementary cellular automaton.
  16011. The initial state of the cellular automaton can be defined through the
  16012. @option{filename} and @option{pattern} options. If such options are
  16013. not specified an initial state is created randomly.
  16014. At each new frame a new row in the video is filled with the result of
  16015. the cellular automaton next generation. The behavior when the whole
  16016. frame is filled is defined by the @option{scroll} option.
  16017. This source accepts the following options:
  16018. @table @option
  16019. @item filename, f
  16020. Read the initial cellular automaton state, i.e. the starting row, from
  16021. the specified file.
  16022. In the file, each non-whitespace character is considered an alive
  16023. cell, a newline will terminate the row, and further characters in the
  16024. file will be ignored.
  16025. @item pattern, p
  16026. Read the initial cellular automaton state, i.e. the starting row, from
  16027. the specified string.
  16028. Each non-whitespace character in the string is considered an alive
  16029. cell, a newline will terminate the row, and further characters in the
  16030. string will be ignored.
  16031. @item rate, r
  16032. Set the video rate, that is the number of frames generated per second.
  16033. Default is 25.
  16034. @item random_fill_ratio, ratio
  16035. Set the random fill ratio for the initial cellular automaton row. It
  16036. is a floating point number value ranging from 0 to 1, defaults to
  16037. 1/PHI.
  16038. This option is ignored when a file or a pattern is specified.
  16039. @item random_seed, seed
  16040. Set the seed for filling randomly the initial row, must be an integer
  16041. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16042. set to -1, the filter will try to use a good random seed on a best
  16043. effort basis.
  16044. @item rule
  16045. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16046. Default value is 110.
  16047. @item size, s
  16048. Set the size of the output video. For the syntax of this option, check the
  16049. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16050. If @option{filename} or @option{pattern} is specified, the size is set
  16051. by default to the width of the specified initial state row, and the
  16052. height is set to @var{width} * PHI.
  16053. If @option{size} is set, it must contain the width of the specified
  16054. pattern string, and the specified pattern will be centered in the
  16055. larger row.
  16056. If a filename or a pattern string is not specified, the size value
  16057. defaults to "320x518" (used for a randomly generated initial state).
  16058. @item scroll
  16059. If set to 1, scroll the output upward when all the rows in the output
  16060. have been already filled. If set to 0, the new generated row will be
  16061. written over the top row just after the bottom row is filled.
  16062. Defaults to 1.
  16063. @item start_full, full
  16064. If set to 1, completely fill the output with generated rows before
  16065. outputting the first frame.
  16066. This is the default behavior, for disabling set the value to 0.
  16067. @item stitch
  16068. If set to 1, stitch the left and right row edges together.
  16069. This is the default behavior, for disabling set the value to 0.
  16070. @end table
  16071. @subsection Examples
  16072. @itemize
  16073. @item
  16074. Read the initial state from @file{pattern}, and specify an output of
  16075. size 200x400.
  16076. @example
  16077. cellauto=f=pattern:s=200x400
  16078. @end example
  16079. @item
  16080. Generate a random initial row with a width of 200 cells, with a fill
  16081. ratio of 2/3:
  16082. @example
  16083. cellauto=ratio=2/3:s=200x200
  16084. @end example
  16085. @item
  16086. Create a pattern generated by rule 18 starting by a single alive cell
  16087. centered on an initial row with width 100:
  16088. @example
  16089. cellauto=p=@@:s=100x400:full=0:rule=18
  16090. @end example
  16091. @item
  16092. Specify a more elaborated initial pattern:
  16093. @example
  16094. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16095. @end example
  16096. @end itemize
  16097. @anchor{coreimagesrc}
  16098. @section coreimagesrc
  16099. Video source generated on GPU using Apple's CoreImage API on OSX.
  16100. This video source is a specialized version of the @ref{coreimage} video filter.
  16101. Use a core image generator at the beginning of the applied filterchain to
  16102. generate the content.
  16103. The coreimagesrc video source accepts the following options:
  16104. @table @option
  16105. @item list_generators
  16106. List all available generators along with all their respective options as well as
  16107. possible minimum and maximum values along with the default values.
  16108. @example
  16109. list_generators=true
  16110. @end example
  16111. @item size, s
  16112. Specify the size of the sourced video. For the syntax of this option, check the
  16113. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16114. The default value is @code{320x240}.
  16115. @item rate, r
  16116. Specify the frame rate of the sourced video, as the number of frames
  16117. generated per second. It has to be a string in the format
  16118. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16119. number or a valid video frame rate abbreviation. The default value is
  16120. "25".
  16121. @item sar
  16122. Set the sample aspect ratio of the sourced video.
  16123. @item duration, d
  16124. Set the duration of the sourced video. See
  16125. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16126. for the accepted syntax.
  16127. If not specified, or the expressed duration is negative, the video is
  16128. supposed to be generated forever.
  16129. @end table
  16130. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16131. A complete filterchain can be used for further processing of the
  16132. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16133. and examples for details.
  16134. @subsection Examples
  16135. @itemize
  16136. @item
  16137. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16138. given as complete and escaped command-line for Apple's standard bash shell:
  16139. @example
  16140. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16141. @end example
  16142. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16143. need for a nullsrc video source.
  16144. @end itemize
  16145. @section mandelbrot
  16146. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16147. point specified with @var{start_x} and @var{start_y}.
  16148. This source accepts the following options:
  16149. @table @option
  16150. @item end_pts
  16151. Set the terminal pts value. Default value is 400.
  16152. @item end_scale
  16153. Set the terminal scale value.
  16154. Must be a floating point value. Default value is 0.3.
  16155. @item inner
  16156. Set the inner coloring mode, that is the algorithm used to draw the
  16157. Mandelbrot fractal internal region.
  16158. It shall assume one of the following values:
  16159. @table @option
  16160. @item black
  16161. Set black mode.
  16162. @item convergence
  16163. Show time until convergence.
  16164. @item mincol
  16165. Set color based on point closest to the origin of the iterations.
  16166. @item period
  16167. Set period mode.
  16168. @end table
  16169. Default value is @var{mincol}.
  16170. @item bailout
  16171. Set the bailout value. Default value is 10.0.
  16172. @item maxiter
  16173. Set the maximum of iterations performed by the rendering
  16174. algorithm. Default value is 7189.
  16175. @item outer
  16176. Set outer coloring mode.
  16177. It shall assume one of following values:
  16178. @table @option
  16179. @item iteration_count
  16180. Set iteration count mode.
  16181. @item normalized_iteration_count
  16182. set normalized iteration count mode.
  16183. @end table
  16184. Default value is @var{normalized_iteration_count}.
  16185. @item rate, r
  16186. Set frame rate, expressed as number of frames per second. Default
  16187. value is "25".
  16188. @item size, s
  16189. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16190. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16191. @item start_scale
  16192. Set the initial scale value. Default value is 3.0.
  16193. @item start_x
  16194. Set the initial x position. Must be a floating point value between
  16195. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16196. @item start_y
  16197. Set the initial y position. Must be a floating point value between
  16198. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16199. @end table
  16200. @section mptestsrc
  16201. Generate various test patterns, as generated by the MPlayer test filter.
  16202. The size of the generated video is fixed, and is 256x256.
  16203. This source is useful in particular for testing encoding features.
  16204. This source accepts the following options:
  16205. @table @option
  16206. @item rate, r
  16207. Specify the frame rate of the sourced video, as the number of frames
  16208. generated per second. It has to be a string in the format
  16209. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16210. number or a valid video frame rate abbreviation. The default value is
  16211. "25".
  16212. @item duration, d
  16213. Set the duration of the sourced video. See
  16214. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16215. for the accepted syntax.
  16216. If not specified, or the expressed duration is negative, the video is
  16217. supposed to be generated forever.
  16218. @item test, t
  16219. Set the number or the name of the test to perform. Supported tests are:
  16220. @table @option
  16221. @item dc_luma
  16222. @item dc_chroma
  16223. @item freq_luma
  16224. @item freq_chroma
  16225. @item amp_luma
  16226. @item amp_chroma
  16227. @item cbp
  16228. @item mv
  16229. @item ring1
  16230. @item ring2
  16231. @item all
  16232. @item max_frames, m
  16233. Set the maximum number of frames generated for each test, default value is 30.
  16234. @end table
  16235. Default value is "all", which will cycle through the list of all tests.
  16236. @end table
  16237. Some examples:
  16238. @example
  16239. mptestsrc=t=dc_luma
  16240. @end example
  16241. will generate a "dc_luma" test pattern.
  16242. @section frei0r_src
  16243. Provide a frei0r source.
  16244. To enable compilation of this filter you need to install the frei0r
  16245. header and configure FFmpeg with @code{--enable-frei0r}.
  16246. This source accepts the following parameters:
  16247. @table @option
  16248. @item size
  16249. The size of the video to generate. For the syntax of this option, check the
  16250. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16251. @item framerate
  16252. The framerate of the generated video. It may be a string of the form
  16253. @var{num}/@var{den} or a frame rate abbreviation.
  16254. @item filter_name
  16255. The name to the frei0r source to load. For more information regarding frei0r and
  16256. how to set the parameters, read the @ref{frei0r} section in the video filters
  16257. documentation.
  16258. @item filter_params
  16259. A '|'-separated list of parameters to pass to the frei0r source.
  16260. @end table
  16261. For example, to generate a frei0r partik0l source with size 200x200
  16262. and frame rate 10 which is overlaid on the overlay filter main input:
  16263. @example
  16264. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16265. @end example
  16266. @section life
  16267. Generate a life pattern.
  16268. This source is based on a generalization of John Conway's life game.
  16269. The sourced input represents a life grid, each pixel represents a cell
  16270. which can be in one of two possible states, alive or dead. Every cell
  16271. interacts with its eight neighbours, which are the cells that are
  16272. horizontally, vertically, or diagonally adjacent.
  16273. At each interaction the grid evolves according to the adopted rule,
  16274. which specifies the number of neighbor alive cells which will make a
  16275. cell stay alive or born. The @option{rule} option allows one to specify
  16276. the rule to adopt.
  16277. This source accepts the following options:
  16278. @table @option
  16279. @item filename, f
  16280. Set the file from which to read the initial grid state. In the file,
  16281. each non-whitespace character is considered an alive cell, and newline
  16282. is used to delimit the end of each row.
  16283. If this option is not specified, the initial grid is generated
  16284. randomly.
  16285. @item rate, r
  16286. Set the video rate, that is the number of frames generated per second.
  16287. Default is 25.
  16288. @item random_fill_ratio, ratio
  16289. Set the random fill ratio for the initial random grid. It is a
  16290. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16291. It is ignored when a file is specified.
  16292. @item random_seed, seed
  16293. Set the seed for filling the initial random grid, must be an integer
  16294. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16295. set to -1, the filter will try to use a good random seed on a best
  16296. effort basis.
  16297. @item rule
  16298. Set the life rule.
  16299. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16300. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16301. @var{NS} specifies the number of alive neighbor cells which make a
  16302. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16303. which make a dead cell to become alive (i.e. to "born").
  16304. "s" and "b" can be used in place of "S" and "B", respectively.
  16305. Alternatively a rule can be specified by an 18-bits integer. The 9
  16306. high order bits are used to encode the next cell state if it is alive
  16307. for each number of neighbor alive cells, the low order bits specify
  16308. the rule for "borning" new cells. Higher order bits encode for an
  16309. higher number of neighbor cells.
  16310. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  16311. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  16312. Default value is "S23/B3", which is the original Conway's game of life
  16313. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  16314. cells, and will born a new cell if there are three alive cells around
  16315. a dead cell.
  16316. @item size, s
  16317. Set the size of the output video. For the syntax of this option, check the
  16318. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16319. If @option{filename} is specified, the size is set by default to the
  16320. same size of the input file. If @option{size} is set, it must contain
  16321. the size specified in the input file, and the initial grid defined in
  16322. that file is centered in the larger resulting area.
  16323. If a filename is not specified, the size value defaults to "320x240"
  16324. (used for a randomly generated initial grid).
  16325. @item stitch
  16326. If set to 1, stitch the left and right grid edges together, and the
  16327. top and bottom edges also. Defaults to 1.
  16328. @item mold
  16329. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  16330. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  16331. value from 0 to 255.
  16332. @item life_color
  16333. Set the color of living (or new born) cells.
  16334. @item death_color
  16335. Set the color of dead cells. If @option{mold} is set, this is the first color
  16336. used to represent a dead cell.
  16337. @item mold_color
  16338. Set mold color, for definitely dead and moldy cells.
  16339. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  16340. ffmpeg-utils manual,ffmpeg-utils}.
  16341. @end table
  16342. @subsection Examples
  16343. @itemize
  16344. @item
  16345. Read a grid from @file{pattern}, and center it on a grid of size
  16346. 300x300 pixels:
  16347. @example
  16348. life=f=pattern:s=300x300
  16349. @end example
  16350. @item
  16351. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16352. @example
  16353. life=ratio=2/3:s=200x200
  16354. @end example
  16355. @item
  16356. Specify a custom rule for evolving a randomly generated grid:
  16357. @example
  16358. life=rule=S14/B34
  16359. @end example
  16360. @item
  16361. Full example with slow death effect (mold) using @command{ffplay}:
  16362. @example
  16363. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16364. @end example
  16365. @end itemize
  16366. @anchor{allrgb}
  16367. @anchor{allyuv}
  16368. @anchor{color}
  16369. @anchor{haldclutsrc}
  16370. @anchor{nullsrc}
  16371. @anchor{pal75bars}
  16372. @anchor{pal100bars}
  16373. @anchor{rgbtestsrc}
  16374. @anchor{smptebars}
  16375. @anchor{smptehdbars}
  16376. @anchor{testsrc}
  16377. @anchor{testsrc2}
  16378. @anchor{yuvtestsrc}
  16379. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16380. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16381. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16382. The @code{color} source provides an uniformly colored input.
  16383. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16384. @ref{haldclut} filter.
  16385. The @code{nullsrc} source returns unprocessed video frames. It is
  16386. mainly useful to be employed in analysis / debugging tools, or as the
  16387. source for filters which ignore the input data.
  16388. The @code{pal75bars} source generates a color bars pattern, based on
  16389. EBU PAL recommendations with 75% color levels.
  16390. The @code{pal100bars} source generates a color bars pattern, based on
  16391. EBU PAL recommendations with 100% color levels.
  16392. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16393. detecting RGB vs BGR issues. You should see a red, green and blue
  16394. stripe from top to bottom.
  16395. The @code{smptebars} source generates a color bars pattern, based on
  16396. the SMPTE Engineering Guideline EG 1-1990.
  16397. The @code{smptehdbars} source generates a color bars pattern, based on
  16398. the SMPTE RP 219-2002.
  16399. The @code{testsrc} source generates a test video pattern, showing a
  16400. color pattern, a scrolling gradient and a timestamp. This is mainly
  16401. intended for testing purposes.
  16402. The @code{testsrc2} source is similar to testsrc, but supports more
  16403. pixel formats instead of just @code{rgb24}. This allows using it as an
  16404. input for other tests without requiring a format conversion.
  16405. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16406. see a y, cb and cr stripe from top to bottom.
  16407. The sources accept the following parameters:
  16408. @table @option
  16409. @item level
  16410. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16411. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16412. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16413. coded on a @code{1/(N*N)} scale.
  16414. @item color, c
  16415. Specify the color of the source, only available in the @code{color}
  16416. source. For the syntax of this option, check the
  16417. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16418. @item size, s
  16419. Specify the size of the sourced video. For the syntax of this option, check the
  16420. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16421. The default value is @code{320x240}.
  16422. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16423. @code{haldclutsrc} filters.
  16424. @item rate, r
  16425. Specify the frame rate of the sourced video, as the number of frames
  16426. generated per second. It has to be a string in the format
  16427. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16428. number or a valid video frame rate abbreviation. The default value is
  16429. "25".
  16430. @item duration, d
  16431. Set the duration of the sourced video. See
  16432. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16433. for the accepted syntax.
  16434. If not specified, or the expressed duration is negative, the video is
  16435. supposed to be generated forever.
  16436. @item sar
  16437. Set the sample aspect ratio of the sourced video.
  16438. @item alpha
  16439. Specify the alpha (opacity) of the background, only available in the
  16440. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16441. 255 (fully opaque, the default).
  16442. @item decimals, n
  16443. Set the number of decimals to show in the timestamp, only available in the
  16444. @code{testsrc} source.
  16445. The displayed timestamp value will correspond to the original
  16446. timestamp value multiplied by the power of 10 of the specified
  16447. value. Default value is 0.
  16448. @end table
  16449. @subsection Examples
  16450. @itemize
  16451. @item
  16452. Generate a video with a duration of 5.3 seconds, with size
  16453. 176x144 and a frame rate of 10 frames per second:
  16454. @example
  16455. testsrc=duration=5.3:size=qcif:rate=10
  16456. @end example
  16457. @item
  16458. The following graph description will generate a red source
  16459. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16460. frames per second:
  16461. @example
  16462. color=c=red@@0.2:s=qcif:r=10
  16463. @end example
  16464. @item
  16465. If the input content is to be ignored, @code{nullsrc} can be used. The
  16466. following command generates noise in the luminance plane by employing
  16467. the @code{geq} filter:
  16468. @example
  16469. nullsrc=s=256x256, geq=random(1)*255:128:128
  16470. @end example
  16471. @end itemize
  16472. @subsection Commands
  16473. The @code{color} source supports the following commands:
  16474. @table @option
  16475. @item c, color
  16476. Set the color of the created image. Accepts the same syntax of the
  16477. corresponding @option{color} option.
  16478. @end table
  16479. @section openclsrc
  16480. Generate video using an OpenCL program.
  16481. @table @option
  16482. @item source
  16483. OpenCL program source file.
  16484. @item kernel
  16485. Kernel name in program.
  16486. @item size, s
  16487. Size of frames to generate. This must be set.
  16488. @item format
  16489. Pixel format to use for the generated frames. This must be set.
  16490. @item rate, r
  16491. Number of frames generated every second. Default value is '25'.
  16492. @end table
  16493. For details of how the program loading works, see the @ref{program_opencl}
  16494. filter.
  16495. Example programs:
  16496. @itemize
  16497. @item
  16498. Generate a colour ramp by setting pixel values from the position of the pixel
  16499. in the output image. (Note that this will work with all pixel formats, but
  16500. the generated output will not be the same.)
  16501. @verbatim
  16502. __kernel void ramp(__write_only image2d_t dst,
  16503. unsigned int index)
  16504. {
  16505. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16506. float4 val;
  16507. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16508. write_imagef(dst, loc, val);
  16509. }
  16510. @end verbatim
  16511. @item
  16512. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16513. @verbatim
  16514. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16515. unsigned int index)
  16516. {
  16517. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16518. float4 value = 0.0f;
  16519. int x = loc.x + index;
  16520. int y = loc.y + index;
  16521. while (x > 0 || y > 0) {
  16522. if (x % 3 == 1 && y % 3 == 1) {
  16523. value = 1.0f;
  16524. break;
  16525. }
  16526. x /= 3;
  16527. y /= 3;
  16528. }
  16529. write_imagef(dst, loc, value);
  16530. }
  16531. @end verbatim
  16532. @end itemize
  16533. @section sierpinski
  16534. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16535. This source accepts the following options:
  16536. @table @option
  16537. @item size, s
  16538. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16539. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16540. @item rate, r
  16541. Set frame rate, expressed as number of frames per second. Default
  16542. value is "25".
  16543. @item seed
  16544. Set seed which is used for random panning.
  16545. @item jump
  16546. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16547. @item type
  16548. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16549. @end table
  16550. @c man end VIDEO SOURCES
  16551. @chapter Video Sinks
  16552. @c man begin VIDEO SINKS
  16553. Below is a description of the currently available video sinks.
  16554. @section buffersink
  16555. Buffer video frames, and make them available to the end of the filter
  16556. graph.
  16557. This sink is mainly intended for programmatic use, in particular
  16558. through the interface defined in @file{libavfilter/buffersink.h}
  16559. or the options system.
  16560. It accepts a pointer to an AVBufferSinkContext structure, which
  16561. defines the incoming buffers' formats, to be passed as the opaque
  16562. parameter to @code{avfilter_init_filter} for initialization.
  16563. @section nullsink
  16564. Null video sink: do absolutely nothing with the input video. It is
  16565. mainly useful as a template and for use in analysis / debugging
  16566. tools.
  16567. @c man end VIDEO SINKS
  16568. @chapter Multimedia Filters
  16569. @c man begin MULTIMEDIA FILTERS
  16570. Below is a description of the currently available multimedia filters.
  16571. @section abitscope
  16572. Convert input audio to a video output, displaying the audio bit scope.
  16573. The filter accepts the following options:
  16574. @table @option
  16575. @item rate, r
  16576. Set frame rate, expressed as number of frames per second. Default
  16577. value is "25".
  16578. @item size, s
  16579. Specify the video size for the output. For the syntax of this option, check the
  16580. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16581. Default value is @code{1024x256}.
  16582. @item colors
  16583. Specify list of colors separated by space or by '|' which will be used to
  16584. draw channels. Unrecognized or missing colors will be replaced
  16585. by white color.
  16586. @end table
  16587. @section adrawgraph
  16588. Draw a graph using input audio metadata.
  16589. See @ref{drawgraph}
  16590. @section agraphmonitor
  16591. See @ref{graphmonitor}.
  16592. @section ahistogram
  16593. Convert input audio to a video output, displaying the volume histogram.
  16594. The filter accepts the following options:
  16595. @table @option
  16596. @item dmode
  16597. Specify how histogram is calculated.
  16598. It accepts the following values:
  16599. @table @samp
  16600. @item single
  16601. Use single histogram for all channels.
  16602. @item separate
  16603. Use separate histogram for each channel.
  16604. @end table
  16605. Default is @code{single}.
  16606. @item rate, r
  16607. Set frame rate, expressed as number of frames per second. Default
  16608. value is "25".
  16609. @item size, s
  16610. Specify the video size for the output. For the syntax of this option, check the
  16611. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16612. Default value is @code{hd720}.
  16613. @item scale
  16614. Set display scale.
  16615. It accepts the following values:
  16616. @table @samp
  16617. @item log
  16618. logarithmic
  16619. @item sqrt
  16620. square root
  16621. @item cbrt
  16622. cubic root
  16623. @item lin
  16624. linear
  16625. @item rlog
  16626. reverse logarithmic
  16627. @end table
  16628. Default is @code{log}.
  16629. @item ascale
  16630. Set amplitude scale.
  16631. It accepts the following values:
  16632. @table @samp
  16633. @item log
  16634. logarithmic
  16635. @item lin
  16636. linear
  16637. @end table
  16638. Default is @code{log}.
  16639. @item acount
  16640. Set how much frames to accumulate in histogram.
  16641. Default is 1. Setting this to -1 accumulates all frames.
  16642. @item rheight
  16643. Set histogram ratio of window height.
  16644. @item slide
  16645. Set sonogram sliding.
  16646. It accepts the following values:
  16647. @table @samp
  16648. @item replace
  16649. replace old rows with new ones.
  16650. @item scroll
  16651. scroll from top to bottom.
  16652. @end table
  16653. Default is @code{replace}.
  16654. @end table
  16655. @section aphasemeter
  16656. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16657. representing mean phase of current audio frame. A video output can also be produced and is
  16658. enabled by default. The audio is passed through as first output.
  16659. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16660. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16661. and @code{1} means channels are in phase.
  16662. The filter accepts the following options, all related to its video output:
  16663. @table @option
  16664. @item rate, r
  16665. Set the output frame rate. Default value is @code{25}.
  16666. @item size, s
  16667. Set the video size for the output. For the syntax of this option, check the
  16668. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16669. Default value is @code{800x400}.
  16670. @item rc
  16671. @item gc
  16672. @item bc
  16673. Specify the red, green, blue contrast. Default values are @code{2},
  16674. @code{7} and @code{1}.
  16675. Allowed range is @code{[0, 255]}.
  16676. @item mpc
  16677. Set color which will be used for drawing median phase. If color is
  16678. @code{none} which is default, no median phase value will be drawn.
  16679. @item video
  16680. Enable video output. Default is enabled.
  16681. @end table
  16682. @section avectorscope
  16683. Convert input audio to a video output, representing the audio vector
  16684. scope.
  16685. The filter is used to measure the difference between channels of stereo
  16686. audio stream. A monaural signal, consisting of identical left and right
  16687. signal, results in straight vertical line. Any stereo separation is visible
  16688. as a deviation from this line, creating a Lissajous figure.
  16689. If the straight (or deviation from it) but horizontal line appears this
  16690. indicates that the left and right channels are out of phase.
  16691. The filter accepts the following options:
  16692. @table @option
  16693. @item mode, m
  16694. Set the vectorscope mode.
  16695. Available values are:
  16696. @table @samp
  16697. @item lissajous
  16698. Lissajous rotated by 45 degrees.
  16699. @item lissajous_xy
  16700. Same as above but not rotated.
  16701. @item polar
  16702. Shape resembling half of circle.
  16703. @end table
  16704. Default value is @samp{lissajous}.
  16705. @item size, s
  16706. Set the video size for the output. For the syntax of this option, check the
  16707. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16708. Default value is @code{400x400}.
  16709. @item rate, r
  16710. Set the output frame rate. Default value is @code{25}.
  16711. @item rc
  16712. @item gc
  16713. @item bc
  16714. @item ac
  16715. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16716. @code{160}, @code{80} and @code{255}.
  16717. Allowed range is @code{[0, 255]}.
  16718. @item rf
  16719. @item gf
  16720. @item bf
  16721. @item af
  16722. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16723. @code{10}, @code{5} and @code{5}.
  16724. Allowed range is @code{[0, 255]}.
  16725. @item zoom
  16726. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16727. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16728. @item draw
  16729. Set the vectorscope drawing mode.
  16730. Available values are:
  16731. @table @samp
  16732. @item dot
  16733. Draw dot for each sample.
  16734. @item line
  16735. Draw line between previous and current sample.
  16736. @end table
  16737. Default value is @samp{dot}.
  16738. @item scale
  16739. Specify amplitude scale of audio samples.
  16740. Available values are:
  16741. @table @samp
  16742. @item lin
  16743. Linear.
  16744. @item sqrt
  16745. Square root.
  16746. @item cbrt
  16747. Cubic root.
  16748. @item log
  16749. Logarithmic.
  16750. @end table
  16751. @item swap
  16752. Swap left channel axis with right channel axis.
  16753. @item mirror
  16754. Mirror axis.
  16755. @table @samp
  16756. @item none
  16757. No mirror.
  16758. @item x
  16759. Mirror only x axis.
  16760. @item y
  16761. Mirror only y axis.
  16762. @item xy
  16763. Mirror both axis.
  16764. @end table
  16765. @end table
  16766. @subsection Examples
  16767. @itemize
  16768. @item
  16769. Complete example using @command{ffplay}:
  16770. @example
  16771. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16772. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16773. @end example
  16774. @end itemize
  16775. @section bench, abench
  16776. Benchmark part of a filtergraph.
  16777. The filter accepts the following options:
  16778. @table @option
  16779. @item action
  16780. Start or stop a timer.
  16781. Available values are:
  16782. @table @samp
  16783. @item start
  16784. Get the current time, set it as frame metadata (using the key
  16785. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16786. @item stop
  16787. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16788. the input frame metadata to get the time difference. Time difference, average,
  16789. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16790. @code{min}) are then printed. The timestamps are expressed in seconds.
  16791. @end table
  16792. @end table
  16793. @subsection Examples
  16794. @itemize
  16795. @item
  16796. Benchmark @ref{selectivecolor} filter:
  16797. @example
  16798. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16799. @end example
  16800. @end itemize
  16801. @section concat
  16802. Concatenate audio and video streams, joining them together one after the
  16803. other.
  16804. The filter works on segments of synchronized video and audio streams. All
  16805. segments must have the same number of streams of each type, and that will
  16806. also be the number of streams at output.
  16807. The filter accepts the following options:
  16808. @table @option
  16809. @item n
  16810. Set the number of segments. Default is 2.
  16811. @item v
  16812. Set the number of output video streams, that is also the number of video
  16813. streams in each segment. Default is 1.
  16814. @item a
  16815. Set the number of output audio streams, that is also the number of audio
  16816. streams in each segment. Default is 0.
  16817. @item unsafe
  16818. Activate unsafe mode: do not fail if segments have a different format.
  16819. @end table
  16820. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16821. @var{a} audio outputs.
  16822. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16823. segment, in the same order as the outputs, then the inputs for the second
  16824. segment, etc.
  16825. Related streams do not always have exactly the same duration, for various
  16826. reasons including codec frame size or sloppy authoring. For that reason,
  16827. related synchronized streams (e.g. a video and its audio track) should be
  16828. concatenated at once. The concat filter will use the duration of the longest
  16829. stream in each segment (except the last one), and if necessary pad shorter
  16830. audio streams with silence.
  16831. For this filter to work correctly, all segments must start at timestamp 0.
  16832. All corresponding streams must have the same parameters in all segments; the
  16833. filtering system will automatically select a common pixel format for video
  16834. streams, and a common sample format, sample rate and channel layout for
  16835. audio streams, but other settings, such as resolution, must be converted
  16836. explicitly by the user.
  16837. Different frame rates are acceptable but will result in variable frame rate
  16838. at output; be sure to configure the output file to handle it.
  16839. @subsection Examples
  16840. @itemize
  16841. @item
  16842. Concatenate an opening, an episode and an ending, all in bilingual version
  16843. (video in stream 0, audio in streams 1 and 2):
  16844. @example
  16845. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16846. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16847. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16848. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16849. @end example
  16850. @item
  16851. Concatenate two parts, handling audio and video separately, using the
  16852. (a)movie sources, and adjusting the resolution:
  16853. @example
  16854. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16855. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16856. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16857. @end example
  16858. Note that a desync will happen at the stitch if the audio and video streams
  16859. do not have exactly the same duration in the first file.
  16860. @end itemize
  16861. @subsection Commands
  16862. This filter supports the following commands:
  16863. @table @option
  16864. @item next
  16865. Close the current segment and step to the next one
  16866. @end table
  16867. @anchor{ebur128}
  16868. @section ebur128
  16869. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16870. level. By default, it logs a message at a frequency of 10Hz with the
  16871. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16872. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16873. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16874. sample format is double-precision floating point. The input stream will be converted to
  16875. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16876. after this filter to obtain the original parameters.
  16877. The filter also has a video output (see the @var{video} option) with a real
  16878. time graph to observe the loudness evolution. The graphic contains the logged
  16879. message mentioned above, so it is not printed anymore when this option is set,
  16880. unless the verbose logging is set. The main graphing area contains the
  16881. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16882. the momentary loudness (400 milliseconds), but can optionally be configured
  16883. to instead display short-term loudness (see @var{gauge}).
  16884. The green area marks a +/- 1LU target range around the target loudness
  16885. (-23LUFS by default, unless modified through @var{target}).
  16886. More information about the Loudness Recommendation EBU R128 on
  16887. @url{http://tech.ebu.ch/loudness}.
  16888. The filter accepts the following options:
  16889. @table @option
  16890. @item video
  16891. Activate the video output. The audio stream is passed unchanged whether this
  16892. option is set or no. The video stream will be the first output stream if
  16893. activated. Default is @code{0}.
  16894. @item size
  16895. Set the video size. This option is for video only. For the syntax of this
  16896. option, check the
  16897. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16898. Default and minimum resolution is @code{640x480}.
  16899. @item meter
  16900. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16901. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16902. other integer value between this range is allowed.
  16903. @item metadata
  16904. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16905. into 100ms output frames, each of them containing various loudness information
  16906. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16907. Default is @code{0}.
  16908. @item framelog
  16909. Force the frame logging level.
  16910. Available values are:
  16911. @table @samp
  16912. @item info
  16913. information logging level
  16914. @item verbose
  16915. verbose logging level
  16916. @end table
  16917. By default, the logging level is set to @var{info}. If the @option{video} or
  16918. the @option{metadata} options are set, it switches to @var{verbose}.
  16919. @item peak
  16920. Set peak mode(s).
  16921. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16922. values are:
  16923. @table @samp
  16924. @item none
  16925. Disable any peak mode (default).
  16926. @item sample
  16927. Enable sample-peak mode.
  16928. Simple peak mode looking for the higher sample value. It logs a message
  16929. for sample-peak (identified by @code{SPK}).
  16930. @item true
  16931. Enable true-peak mode.
  16932. If enabled, the peak lookup is done on an over-sampled version of the input
  16933. stream for better peak accuracy. It logs a message for true-peak.
  16934. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16935. This mode requires a build with @code{libswresample}.
  16936. @end table
  16937. @item dualmono
  16938. Treat mono input files as "dual mono". If a mono file is intended for playback
  16939. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16940. If set to @code{true}, this option will compensate for this effect.
  16941. Multi-channel input files are not affected by this option.
  16942. @item panlaw
  16943. Set a specific pan law to be used for the measurement of dual mono files.
  16944. This parameter is optional, and has a default value of -3.01dB.
  16945. @item target
  16946. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16947. This parameter is optional and has a default value of -23LUFS as specified
  16948. by EBU R128. However, material published online may prefer a level of -16LUFS
  16949. (e.g. for use with podcasts or video platforms).
  16950. @item gauge
  16951. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16952. @code{shortterm}. By default the momentary value will be used, but in certain
  16953. scenarios it may be more useful to observe the short term value instead (e.g.
  16954. live mixing).
  16955. @item scale
  16956. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16957. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16958. video output, not the summary or continuous log output.
  16959. @end table
  16960. @subsection Examples
  16961. @itemize
  16962. @item
  16963. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16964. @example
  16965. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16966. @end example
  16967. @item
  16968. Run an analysis with @command{ffmpeg}:
  16969. @example
  16970. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16971. @end example
  16972. @end itemize
  16973. @section interleave, ainterleave
  16974. Temporally interleave frames from several inputs.
  16975. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16976. These filters read frames from several inputs and send the oldest
  16977. queued frame to the output.
  16978. Input streams must have well defined, monotonically increasing frame
  16979. timestamp values.
  16980. In order to submit one frame to output, these filters need to enqueue
  16981. at least one frame for each input, so they cannot work in case one
  16982. input is not yet terminated and will not receive incoming frames.
  16983. For example consider the case when one input is a @code{select} filter
  16984. which always drops input frames. The @code{interleave} filter will keep
  16985. reading from that input, but it will never be able to send new frames
  16986. to output until the input sends an end-of-stream signal.
  16987. Also, depending on inputs synchronization, the filters will drop
  16988. frames in case one input receives more frames than the other ones, and
  16989. the queue is already filled.
  16990. These filters accept the following options:
  16991. @table @option
  16992. @item nb_inputs, n
  16993. Set the number of different inputs, it is 2 by default.
  16994. @end table
  16995. @subsection Examples
  16996. @itemize
  16997. @item
  16998. Interleave frames belonging to different streams using @command{ffmpeg}:
  16999. @example
  17000. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17001. @end example
  17002. @item
  17003. Add flickering blur effect:
  17004. @example
  17005. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17006. @end example
  17007. @end itemize
  17008. @section metadata, ametadata
  17009. Manipulate frame metadata.
  17010. This filter accepts the following options:
  17011. @table @option
  17012. @item mode
  17013. Set mode of operation of the filter.
  17014. Can be one of the following:
  17015. @table @samp
  17016. @item select
  17017. If both @code{value} and @code{key} is set, select frames
  17018. which have such metadata. If only @code{key} is set, select
  17019. every frame that has such key in metadata.
  17020. @item add
  17021. Add new metadata @code{key} and @code{value}. If key is already available
  17022. do nothing.
  17023. @item modify
  17024. Modify value of already present key.
  17025. @item delete
  17026. If @code{value} is set, delete only keys that have such value.
  17027. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17028. the frame.
  17029. @item print
  17030. Print key and its value if metadata was found. If @code{key} is not set print all
  17031. metadata values available in frame.
  17032. @end table
  17033. @item key
  17034. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17035. @item value
  17036. Set metadata value which will be used. This option is mandatory for
  17037. @code{modify} and @code{add} mode.
  17038. @item function
  17039. Which function to use when comparing metadata value and @code{value}.
  17040. Can be one of following:
  17041. @table @samp
  17042. @item same_str
  17043. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17044. @item starts_with
  17045. Values are interpreted as strings, returns true if metadata value starts with
  17046. the @code{value} option string.
  17047. @item less
  17048. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17049. @item equal
  17050. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17051. @item greater
  17052. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17053. @item expr
  17054. Values are interpreted as floats, returns true if expression from option @code{expr}
  17055. evaluates to true.
  17056. @item ends_with
  17057. Values are interpreted as strings, returns true if metadata value ends with
  17058. the @code{value} option string.
  17059. @end table
  17060. @item expr
  17061. Set expression which is used when @code{function} is set to @code{expr}.
  17062. The expression is evaluated through the eval API and can contain the following
  17063. constants:
  17064. @table @option
  17065. @item VALUE1
  17066. Float representation of @code{value} from metadata key.
  17067. @item VALUE2
  17068. Float representation of @code{value} as supplied by user in @code{value} option.
  17069. @end table
  17070. @item file
  17071. If specified in @code{print} mode, output is written to the named file. Instead of
  17072. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17073. for standard output. If @code{file} option is not set, output is written to the log
  17074. with AV_LOG_INFO loglevel.
  17075. @end table
  17076. @subsection Examples
  17077. @itemize
  17078. @item
  17079. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17080. between 0 and 1.
  17081. @example
  17082. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17083. @end example
  17084. @item
  17085. Print silencedetect output to file @file{metadata.txt}.
  17086. @example
  17087. silencedetect,ametadata=mode=print:file=metadata.txt
  17088. @end example
  17089. @item
  17090. Direct all metadata to a pipe with file descriptor 4.
  17091. @example
  17092. metadata=mode=print:file='pipe\:4'
  17093. @end example
  17094. @end itemize
  17095. @section perms, aperms
  17096. Set read/write permissions for the output frames.
  17097. These filters are mainly aimed at developers to test direct path in the
  17098. following filter in the filtergraph.
  17099. The filters accept the following options:
  17100. @table @option
  17101. @item mode
  17102. Select the permissions mode.
  17103. It accepts the following values:
  17104. @table @samp
  17105. @item none
  17106. Do nothing. This is the default.
  17107. @item ro
  17108. Set all the output frames read-only.
  17109. @item rw
  17110. Set all the output frames directly writable.
  17111. @item toggle
  17112. Make the frame read-only if writable, and writable if read-only.
  17113. @item random
  17114. Set each output frame read-only or writable randomly.
  17115. @end table
  17116. @item seed
  17117. Set the seed for the @var{random} mode, must be an integer included between
  17118. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17119. @code{-1}, the filter will try to use a good random seed on a best effort
  17120. basis.
  17121. @end table
  17122. Note: in case of auto-inserted filter between the permission filter and the
  17123. following one, the permission might not be received as expected in that
  17124. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17125. perms/aperms filter can avoid this problem.
  17126. @section realtime, arealtime
  17127. Slow down filtering to match real time approximately.
  17128. These filters will pause the filtering for a variable amount of time to
  17129. match the output rate with the input timestamps.
  17130. They are similar to the @option{re} option to @code{ffmpeg}.
  17131. They accept the following options:
  17132. @table @option
  17133. @item limit
  17134. Time limit for the pauses. Any pause longer than that will be considered
  17135. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17136. @item speed
  17137. Speed factor for processing. The value must be a float larger than zero.
  17138. Values larger than 1.0 will result in faster than realtime processing,
  17139. smaller will slow processing down. The @var{limit} is automatically adapted
  17140. accordingly. Default is 1.0.
  17141. A processing speed faster than what is possible without these filters cannot
  17142. be achieved.
  17143. @end table
  17144. @anchor{select}
  17145. @section select, aselect
  17146. Select frames to pass in output.
  17147. This filter accepts the following options:
  17148. @table @option
  17149. @item expr, e
  17150. Set expression, which is evaluated for each input frame.
  17151. If the expression is evaluated to zero, the frame is discarded.
  17152. If the evaluation result is negative or NaN, the frame is sent to the
  17153. first output; otherwise it is sent to the output with index
  17154. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17155. For example a value of @code{1.2} corresponds to the output with index
  17156. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17157. @item outputs, n
  17158. Set the number of outputs. The output to which to send the selected
  17159. frame is based on the result of the evaluation. Default value is 1.
  17160. @end table
  17161. The expression can contain the following constants:
  17162. @table @option
  17163. @item n
  17164. The (sequential) number of the filtered frame, starting from 0.
  17165. @item selected_n
  17166. The (sequential) number of the selected frame, starting from 0.
  17167. @item prev_selected_n
  17168. The sequential number of the last selected frame. It's NAN if undefined.
  17169. @item TB
  17170. The timebase of the input timestamps.
  17171. @item pts
  17172. The PTS (Presentation TimeStamp) of the filtered video frame,
  17173. expressed in @var{TB} units. It's NAN if undefined.
  17174. @item t
  17175. The PTS of the filtered video frame,
  17176. expressed in seconds. It's NAN if undefined.
  17177. @item prev_pts
  17178. The PTS of the previously filtered video frame. It's NAN if undefined.
  17179. @item prev_selected_pts
  17180. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17181. @item prev_selected_t
  17182. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17183. @item start_pts
  17184. The PTS of the first video frame in the video. It's NAN if undefined.
  17185. @item start_t
  17186. The time of the first video frame in the video. It's NAN if undefined.
  17187. @item pict_type @emph{(video only)}
  17188. The type of the filtered frame. It can assume one of the following
  17189. values:
  17190. @table @option
  17191. @item I
  17192. @item P
  17193. @item B
  17194. @item S
  17195. @item SI
  17196. @item SP
  17197. @item BI
  17198. @end table
  17199. @item interlace_type @emph{(video only)}
  17200. The frame interlace type. It can assume one of the following values:
  17201. @table @option
  17202. @item PROGRESSIVE
  17203. The frame is progressive (not interlaced).
  17204. @item TOPFIRST
  17205. The frame is top-field-first.
  17206. @item BOTTOMFIRST
  17207. The frame is bottom-field-first.
  17208. @end table
  17209. @item consumed_sample_n @emph{(audio only)}
  17210. the number of selected samples before the current frame
  17211. @item samples_n @emph{(audio only)}
  17212. the number of samples in the current frame
  17213. @item sample_rate @emph{(audio only)}
  17214. the input sample rate
  17215. @item key
  17216. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17217. @item pos
  17218. the position in the file of the filtered frame, -1 if the information
  17219. is not available (e.g. for synthetic video)
  17220. @item scene @emph{(video only)}
  17221. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17222. probability for the current frame to introduce a new scene, while a higher
  17223. value means the current frame is more likely to be one (see the example below)
  17224. @item concatdec_select
  17225. The concat demuxer can select only part of a concat input file by setting an
  17226. inpoint and an outpoint, but the output packets may not be entirely contained
  17227. in the selected interval. By using this variable, it is possible to skip frames
  17228. generated by the concat demuxer which are not exactly contained in the selected
  17229. interval.
  17230. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17231. and the @var{lavf.concat.duration} packet metadata values which are also
  17232. present in the decoded frames.
  17233. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17234. start_time and either the duration metadata is missing or the frame pts is less
  17235. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17236. missing.
  17237. That basically means that an input frame is selected if its pts is within the
  17238. interval set by the concat demuxer.
  17239. @end table
  17240. The default value of the select expression is "1".
  17241. @subsection Examples
  17242. @itemize
  17243. @item
  17244. Select all frames in input:
  17245. @example
  17246. select
  17247. @end example
  17248. The example above is the same as:
  17249. @example
  17250. select=1
  17251. @end example
  17252. @item
  17253. Skip all frames:
  17254. @example
  17255. select=0
  17256. @end example
  17257. @item
  17258. Select only I-frames:
  17259. @example
  17260. select='eq(pict_type\,I)'
  17261. @end example
  17262. @item
  17263. Select one frame every 100:
  17264. @example
  17265. select='not(mod(n\,100))'
  17266. @end example
  17267. @item
  17268. Select only frames contained in the 10-20 time interval:
  17269. @example
  17270. select=between(t\,10\,20)
  17271. @end example
  17272. @item
  17273. Select only I-frames contained in the 10-20 time interval:
  17274. @example
  17275. select=between(t\,10\,20)*eq(pict_type\,I)
  17276. @end example
  17277. @item
  17278. Select frames with a minimum distance of 10 seconds:
  17279. @example
  17280. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17281. @end example
  17282. @item
  17283. Use aselect to select only audio frames with samples number > 100:
  17284. @example
  17285. aselect='gt(samples_n\,100)'
  17286. @end example
  17287. @item
  17288. Create a mosaic of the first scenes:
  17289. @example
  17290. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17291. @end example
  17292. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17293. choice.
  17294. @item
  17295. Send even and odd frames to separate outputs, and compose them:
  17296. @example
  17297. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17298. @end example
  17299. @item
  17300. Select useful frames from an ffconcat file which is using inpoints and
  17301. outpoints but where the source files are not intra frame only.
  17302. @example
  17303. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17304. @end example
  17305. @end itemize
  17306. @section sendcmd, asendcmd
  17307. Send commands to filters in the filtergraph.
  17308. These filters read commands to be sent to other filters in the
  17309. filtergraph.
  17310. @code{sendcmd} must be inserted between two video filters,
  17311. @code{asendcmd} must be inserted between two audio filters, but apart
  17312. from that they act the same way.
  17313. The specification of commands can be provided in the filter arguments
  17314. with the @var{commands} option, or in a file specified by the
  17315. @var{filename} option.
  17316. These filters accept the following options:
  17317. @table @option
  17318. @item commands, c
  17319. Set the commands to be read and sent to the other filters.
  17320. @item filename, f
  17321. Set the filename of the commands to be read and sent to the other
  17322. filters.
  17323. @end table
  17324. @subsection Commands syntax
  17325. A commands description consists of a sequence of interval
  17326. specifications, comprising a list of commands to be executed when a
  17327. particular event related to that interval occurs. The occurring event
  17328. is typically the current frame time entering or leaving a given time
  17329. interval.
  17330. An interval is specified by the following syntax:
  17331. @example
  17332. @var{START}[-@var{END}] @var{COMMANDS};
  17333. @end example
  17334. The time interval is specified by the @var{START} and @var{END} times.
  17335. @var{END} is optional and defaults to the maximum time.
  17336. The current frame time is considered within the specified interval if
  17337. it is included in the interval [@var{START}, @var{END}), that is when
  17338. the time is greater or equal to @var{START} and is lesser than
  17339. @var{END}.
  17340. @var{COMMANDS} consists of a sequence of one or more command
  17341. specifications, separated by ",", relating to that interval. The
  17342. syntax of a command specification is given by:
  17343. @example
  17344. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17345. @end example
  17346. @var{FLAGS} is optional and specifies the type of events relating to
  17347. the time interval which enable sending the specified command, and must
  17348. be a non-null sequence of identifier flags separated by "+" or "|" and
  17349. enclosed between "[" and "]".
  17350. The following flags are recognized:
  17351. @table @option
  17352. @item enter
  17353. The command is sent when the current frame timestamp enters the
  17354. specified interval. In other words, the command is sent when the
  17355. previous frame timestamp was not in the given interval, and the
  17356. current is.
  17357. @item leave
  17358. The command is sent when the current frame timestamp leaves the
  17359. specified interval. In other words, the command is sent when the
  17360. previous frame timestamp was in the given interval, and the
  17361. current is not.
  17362. @end table
  17363. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17364. assumed.
  17365. @var{TARGET} specifies the target of the command, usually the name of
  17366. the filter class or a specific filter instance name.
  17367. @var{COMMAND} specifies the name of the command for the target filter.
  17368. @var{ARG} is optional and specifies the optional list of argument for
  17369. the given @var{COMMAND}.
  17370. Between one interval specification and another, whitespaces, or
  17371. sequences of characters starting with @code{#} until the end of line,
  17372. are ignored and can be used to annotate comments.
  17373. A simplified BNF description of the commands specification syntax
  17374. follows:
  17375. @example
  17376. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17377. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17378. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17379. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17380. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17381. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17382. @end example
  17383. @subsection Examples
  17384. @itemize
  17385. @item
  17386. Specify audio tempo change at second 4:
  17387. @example
  17388. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17389. @end example
  17390. @item
  17391. Target a specific filter instance:
  17392. @example
  17393. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17394. @end example
  17395. @item
  17396. Specify a list of drawtext and hue commands in a file.
  17397. @example
  17398. # show text in the interval 5-10
  17399. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17400. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17401. # desaturate the image in the interval 15-20
  17402. 15.0-20.0 [enter] hue s 0,
  17403. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17404. [leave] hue s 1,
  17405. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17406. # apply an exponential saturation fade-out effect, starting from time 25
  17407. 25 [enter] hue s exp(25-t)
  17408. @end example
  17409. A filtergraph allowing to read and process the above command list
  17410. stored in a file @file{test.cmd}, can be specified with:
  17411. @example
  17412. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17413. @end example
  17414. @end itemize
  17415. @anchor{setpts}
  17416. @section setpts, asetpts
  17417. Change the PTS (presentation timestamp) of the input frames.
  17418. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17419. This filter accepts the following options:
  17420. @table @option
  17421. @item expr
  17422. The expression which is evaluated for each frame to construct its timestamp.
  17423. @end table
  17424. The expression is evaluated through the eval API and can contain the following
  17425. constants:
  17426. @table @option
  17427. @item FRAME_RATE, FR
  17428. frame rate, only defined for constant frame-rate video
  17429. @item PTS
  17430. The presentation timestamp in input
  17431. @item N
  17432. The count of the input frame for video or the number of consumed samples,
  17433. not including the current frame for audio, starting from 0.
  17434. @item NB_CONSUMED_SAMPLES
  17435. The number of consumed samples, not including the current frame (only
  17436. audio)
  17437. @item NB_SAMPLES, S
  17438. The number of samples in the current frame (only audio)
  17439. @item SAMPLE_RATE, SR
  17440. The audio sample rate.
  17441. @item STARTPTS
  17442. The PTS of the first frame.
  17443. @item STARTT
  17444. the time in seconds of the first frame
  17445. @item INTERLACED
  17446. State whether the current frame is interlaced.
  17447. @item T
  17448. the time in seconds of the current frame
  17449. @item POS
  17450. original position in the file of the frame, or undefined if undefined
  17451. for the current frame
  17452. @item PREV_INPTS
  17453. The previous input PTS.
  17454. @item PREV_INT
  17455. previous input time in seconds
  17456. @item PREV_OUTPTS
  17457. The previous output PTS.
  17458. @item PREV_OUTT
  17459. previous output time in seconds
  17460. @item RTCTIME
  17461. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17462. instead.
  17463. @item RTCSTART
  17464. The wallclock (RTC) time at the start of the movie in microseconds.
  17465. @item TB
  17466. The timebase of the input timestamps.
  17467. @end table
  17468. @subsection Examples
  17469. @itemize
  17470. @item
  17471. Start counting PTS from zero
  17472. @example
  17473. setpts=PTS-STARTPTS
  17474. @end example
  17475. @item
  17476. Apply fast motion effect:
  17477. @example
  17478. setpts=0.5*PTS
  17479. @end example
  17480. @item
  17481. Apply slow motion effect:
  17482. @example
  17483. setpts=2.0*PTS
  17484. @end example
  17485. @item
  17486. Set fixed rate of 25 frames per second:
  17487. @example
  17488. setpts=N/(25*TB)
  17489. @end example
  17490. @item
  17491. Set fixed rate 25 fps with some jitter:
  17492. @example
  17493. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17494. @end example
  17495. @item
  17496. Apply an offset of 10 seconds to the input PTS:
  17497. @example
  17498. setpts=PTS+10/TB
  17499. @end example
  17500. @item
  17501. Generate timestamps from a "live source" and rebase onto the current timebase:
  17502. @example
  17503. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17504. @end example
  17505. @item
  17506. Generate timestamps by counting samples:
  17507. @example
  17508. asetpts=N/SR/TB
  17509. @end example
  17510. @end itemize
  17511. @section setrange
  17512. Force color range for the output video frame.
  17513. The @code{setrange} filter marks the color range property for the
  17514. output frames. It does not change the input frame, but only sets the
  17515. corresponding property, which affects how the frame is treated by
  17516. following filters.
  17517. The filter accepts the following options:
  17518. @table @option
  17519. @item range
  17520. Available values are:
  17521. @table @samp
  17522. @item auto
  17523. Keep the same color range property.
  17524. @item unspecified, unknown
  17525. Set the color range as unspecified.
  17526. @item limited, tv, mpeg
  17527. Set the color range as limited.
  17528. @item full, pc, jpeg
  17529. Set the color range as full.
  17530. @end table
  17531. @end table
  17532. @section settb, asettb
  17533. Set the timebase to use for the output frames timestamps.
  17534. It is mainly useful for testing timebase configuration.
  17535. It accepts the following parameters:
  17536. @table @option
  17537. @item expr, tb
  17538. The expression which is evaluated into the output timebase.
  17539. @end table
  17540. The value for @option{tb} is an arithmetic expression representing a
  17541. rational. The expression can contain the constants "AVTB" (the default
  17542. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17543. audio only). Default value is "intb".
  17544. @subsection Examples
  17545. @itemize
  17546. @item
  17547. Set the timebase to 1/25:
  17548. @example
  17549. settb=expr=1/25
  17550. @end example
  17551. @item
  17552. Set the timebase to 1/10:
  17553. @example
  17554. settb=expr=0.1
  17555. @end example
  17556. @item
  17557. Set the timebase to 1001/1000:
  17558. @example
  17559. settb=1+0.001
  17560. @end example
  17561. @item
  17562. Set the timebase to 2*intb:
  17563. @example
  17564. settb=2*intb
  17565. @end example
  17566. @item
  17567. Set the default timebase value:
  17568. @example
  17569. settb=AVTB
  17570. @end example
  17571. @end itemize
  17572. @section showcqt
  17573. Convert input audio to a video output representing frequency spectrum
  17574. logarithmically using Brown-Puckette constant Q transform algorithm with
  17575. direct frequency domain coefficient calculation (but the transform itself
  17576. is not really constant Q, instead the Q factor is actually variable/clamped),
  17577. with musical tone scale, from E0 to D#10.
  17578. The filter accepts the following options:
  17579. @table @option
  17580. @item size, s
  17581. Specify the video size for the output. It must be even. For the syntax of this option,
  17582. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17583. Default value is @code{1920x1080}.
  17584. @item fps, rate, r
  17585. Set the output frame rate. Default value is @code{25}.
  17586. @item bar_h
  17587. Set the bargraph height. It must be even. Default value is @code{-1} which
  17588. computes the bargraph height automatically.
  17589. @item axis_h
  17590. Set the axis height. It must be even. Default value is @code{-1} which computes
  17591. the axis height automatically.
  17592. @item sono_h
  17593. Set the sonogram height. It must be even. Default value is @code{-1} which
  17594. computes the sonogram height automatically.
  17595. @item fullhd
  17596. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17597. instead. Default value is @code{1}.
  17598. @item sono_v, volume
  17599. Specify the sonogram volume expression. It can contain variables:
  17600. @table @option
  17601. @item bar_v
  17602. the @var{bar_v} evaluated expression
  17603. @item frequency, freq, f
  17604. the frequency where it is evaluated
  17605. @item timeclamp, tc
  17606. the value of @var{timeclamp} option
  17607. @end table
  17608. and functions:
  17609. @table @option
  17610. @item a_weighting(f)
  17611. A-weighting of equal loudness
  17612. @item b_weighting(f)
  17613. B-weighting of equal loudness
  17614. @item c_weighting(f)
  17615. C-weighting of equal loudness.
  17616. @end table
  17617. Default value is @code{16}.
  17618. @item bar_v, volume2
  17619. Specify the bargraph volume expression. It can contain variables:
  17620. @table @option
  17621. @item sono_v
  17622. the @var{sono_v} evaluated expression
  17623. @item frequency, freq, f
  17624. the frequency where it is evaluated
  17625. @item timeclamp, tc
  17626. the value of @var{timeclamp} option
  17627. @end table
  17628. and functions:
  17629. @table @option
  17630. @item a_weighting(f)
  17631. A-weighting of equal loudness
  17632. @item b_weighting(f)
  17633. B-weighting of equal loudness
  17634. @item c_weighting(f)
  17635. C-weighting of equal loudness.
  17636. @end table
  17637. Default value is @code{sono_v}.
  17638. @item sono_g, gamma
  17639. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17640. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17641. Acceptable range is @code{[1, 7]}.
  17642. @item bar_g, gamma2
  17643. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17644. @code{[1, 7]}.
  17645. @item bar_t
  17646. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17647. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17648. @item timeclamp, tc
  17649. Specify the transform timeclamp. At low frequency, there is trade-off between
  17650. accuracy in time domain and frequency domain. If timeclamp is lower,
  17651. event in time domain is represented more accurately (such as fast bass drum),
  17652. otherwise event in frequency domain is represented more accurately
  17653. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17654. @item attack
  17655. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17656. limits future samples by applying asymmetric windowing in time domain, useful
  17657. when low latency is required. Accepted range is @code{[0, 1]}.
  17658. @item basefreq
  17659. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17660. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17661. @item endfreq
  17662. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17663. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17664. @item coeffclamp
  17665. This option is deprecated and ignored.
  17666. @item tlength
  17667. Specify the transform length in time domain. Use this option to control accuracy
  17668. trade-off between time domain and frequency domain at every frequency sample.
  17669. It can contain variables:
  17670. @table @option
  17671. @item frequency, freq, f
  17672. the frequency where it is evaluated
  17673. @item timeclamp, tc
  17674. the value of @var{timeclamp} option.
  17675. @end table
  17676. Default value is @code{384*tc/(384+tc*f)}.
  17677. @item count
  17678. Specify the transform count for every video frame. Default value is @code{6}.
  17679. Acceptable range is @code{[1, 30]}.
  17680. @item fcount
  17681. Specify the transform count for every single pixel. Default value is @code{0},
  17682. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17683. @item fontfile
  17684. Specify font file for use with freetype to draw the axis. If not specified,
  17685. use embedded font. Note that drawing with font file or embedded font is not
  17686. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17687. option instead.
  17688. @item font
  17689. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17690. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17691. escaping.
  17692. @item fontcolor
  17693. Specify font color expression. This is arithmetic expression that should return
  17694. integer value 0xRRGGBB. It can contain variables:
  17695. @table @option
  17696. @item frequency, freq, f
  17697. the frequency where it is evaluated
  17698. @item timeclamp, tc
  17699. the value of @var{timeclamp} option
  17700. @end table
  17701. and functions:
  17702. @table @option
  17703. @item midi(f)
  17704. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17705. @item r(x), g(x), b(x)
  17706. red, green, and blue value of intensity x.
  17707. @end table
  17708. Default value is @code{st(0, (midi(f)-59.5)/12);
  17709. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17710. r(1-ld(1)) + b(ld(1))}.
  17711. @item axisfile
  17712. Specify image file to draw the axis. This option override @var{fontfile} and
  17713. @var{fontcolor} option.
  17714. @item axis, text
  17715. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17716. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17717. Default value is @code{1}.
  17718. @item csp
  17719. Set colorspace. The accepted values are:
  17720. @table @samp
  17721. @item unspecified
  17722. Unspecified (default)
  17723. @item bt709
  17724. BT.709
  17725. @item fcc
  17726. FCC
  17727. @item bt470bg
  17728. BT.470BG or BT.601-6 625
  17729. @item smpte170m
  17730. SMPTE-170M or BT.601-6 525
  17731. @item smpte240m
  17732. SMPTE-240M
  17733. @item bt2020ncl
  17734. BT.2020 with non-constant luminance
  17735. @end table
  17736. @item cscheme
  17737. Set spectrogram color scheme. This is list of floating point values with format
  17738. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17739. The default is @code{1|0.5|0|0|0.5|1}.
  17740. @end table
  17741. @subsection Examples
  17742. @itemize
  17743. @item
  17744. Playing audio while showing the spectrum:
  17745. @example
  17746. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17747. @end example
  17748. @item
  17749. Same as above, but with frame rate 30 fps:
  17750. @example
  17751. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17752. @end example
  17753. @item
  17754. Playing at 1280x720:
  17755. @example
  17756. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17757. @end example
  17758. @item
  17759. Disable sonogram display:
  17760. @example
  17761. sono_h=0
  17762. @end example
  17763. @item
  17764. A1 and its harmonics: A1, A2, (near)E3, A3:
  17765. @example
  17766. 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),
  17767. asplit[a][out1]; [a] showcqt [out0]'
  17768. @end example
  17769. @item
  17770. Same as above, but with more accuracy in frequency domain:
  17771. @example
  17772. 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),
  17773. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17774. @end example
  17775. @item
  17776. Custom volume:
  17777. @example
  17778. bar_v=10:sono_v=bar_v*a_weighting(f)
  17779. @end example
  17780. @item
  17781. Custom gamma, now spectrum is linear to the amplitude.
  17782. @example
  17783. bar_g=2:sono_g=2
  17784. @end example
  17785. @item
  17786. Custom tlength equation:
  17787. @example
  17788. 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)))'
  17789. @end example
  17790. @item
  17791. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17792. @example
  17793. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17794. @end example
  17795. @item
  17796. Custom font using fontconfig:
  17797. @example
  17798. font='Courier New,Monospace,mono|bold'
  17799. @end example
  17800. @item
  17801. Custom frequency range with custom axis using image file:
  17802. @example
  17803. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17804. @end example
  17805. @end itemize
  17806. @section showfreqs
  17807. Convert input audio to video output representing the audio power spectrum.
  17808. Audio amplitude is on Y-axis while frequency is on X-axis.
  17809. The filter accepts the following options:
  17810. @table @option
  17811. @item size, s
  17812. Specify size of video. For the syntax of this option, check the
  17813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17814. Default is @code{1024x512}.
  17815. @item mode
  17816. Set display mode.
  17817. This set how each frequency bin will be represented.
  17818. It accepts the following values:
  17819. @table @samp
  17820. @item line
  17821. @item bar
  17822. @item dot
  17823. @end table
  17824. Default is @code{bar}.
  17825. @item ascale
  17826. Set amplitude scale.
  17827. It accepts the following values:
  17828. @table @samp
  17829. @item lin
  17830. Linear scale.
  17831. @item sqrt
  17832. Square root scale.
  17833. @item cbrt
  17834. Cubic root scale.
  17835. @item log
  17836. Logarithmic scale.
  17837. @end table
  17838. Default is @code{log}.
  17839. @item fscale
  17840. Set frequency scale.
  17841. It accepts the following values:
  17842. @table @samp
  17843. @item lin
  17844. Linear scale.
  17845. @item log
  17846. Logarithmic scale.
  17847. @item rlog
  17848. Reverse logarithmic scale.
  17849. @end table
  17850. Default is @code{lin}.
  17851. @item win_size
  17852. Set window size. Allowed range is from 16 to 65536.
  17853. Default is @code{2048}
  17854. @item win_func
  17855. Set windowing function.
  17856. It accepts the following values:
  17857. @table @samp
  17858. @item rect
  17859. @item bartlett
  17860. @item hanning
  17861. @item hamming
  17862. @item blackman
  17863. @item welch
  17864. @item flattop
  17865. @item bharris
  17866. @item bnuttall
  17867. @item bhann
  17868. @item sine
  17869. @item nuttall
  17870. @item lanczos
  17871. @item gauss
  17872. @item tukey
  17873. @item dolph
  17874. @item cauchy
  17875. @item parzen
  17876. @item poisson
  17877. @item bohman
  17878. @end table
  17879. Default is @code{hanning}.
  17880. @item overlap
  17881. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17882. which means optimal overlap for selected window function will be picked.
  17883. @item averaging
  17884. Set time averaging. Setting this to 0 will display current maximal peaks.
  17885. Default is @code{1}, which means time averaging is disabled.
  17886. @item colors
  17887. Specify list of colors separated by space or by '|' which will be used to
  17888. draw channel frequencies. Unrecognized or missing colors will be replaced
  17889. by white color.
  17890. @item cmode
  17891. Set channel display mode.
  17892. It accepts the following values:
  17893. @table @samp
  17894. @item combined
  17895. @item separate
  17896. @end table
  17897. Default is @code{combined}.
  17898. @item minamp
  17899. Set minimum amplitude used in @code{log} amplitude scaler.
  17900. @end table
  17901. @section showspatial
  17902. Convert stereo input audio to a video output, representing the spatial relationship
  17903. between two channels.
  17904. The filter accepts the following options:
  17905. @table @option
  17906. @item size, s
  17907. Specify the video size for the output. For the syntax of this option, check the
  17908. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17909. Default value is @code{512x512}.
  17910. @item win_size
  17911. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17912. @item win_func
  17913. Set window function.
  17914. It accepts the following values:
  17915. @table @samp
  17916. @item rect
  17917. @item bartlett
  17918. @item hann
  17919. @item hanning
  17920. @item hamming
  17921. @item blackman
  17922. @item welch
  17923. @item flattop
  17924. @item bharris
  17925. @item bnuttall
  17926. @item bhann
  17927. @item sine
  17928. @item nuttall
  17929. @item lanczos
  17930. @item gauss
  17931. @item tukey
  17932. @item dolph
  17933. @item cauchy
  17934. @item parzen
  17935. @item poisson
  17936. @item bohman
  17937. @end table
  17938. Default value is @code{hann}.
  17939. @item overlap
  17940. Set ratio of overlap window. Default value is @code{0.5}.
  17941. When value is @code{1} overlap is set to recommended size for specific
  17942. window function currently used.
  17943. @end table
  17944. @anchor{showspectrum}
  17945. @section showspectrum
  17946. Convert input audio to a video output, representing the audio frequency
  17947. spectrum.
  17948. The filter accepts the following options:
  17949. @table @option
  17950. @item size, s
  17951. Specify the video size for the output. For the syntax of this option, check the
  17952. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17953. Default value is @code{640x512}.
  17954. @item slide
  17955. Specify how the spectrum should slide along the window.
  17956. It accepts the following values:
  17957. @table @samp
  17958. @item replace
  17959. the samples start again on the left when they reach the right
  17960. @item scroll
  17961. the samples scroll from right to left
  17962. @item fullframe
  17963. frames are only produced when the samples reach the right
  17964. @item rscroll
  17965. the samples scroll from left to right
  17966. @end table
  17967. Default value is @code{replace}.
  17968. @item mode
  17969. Specify display mode.
  17970. It accepts the following values:
  17971. @table @samp
  17972. @item combined
  17973. all channels are displayed in the same row
  17974. @item separate
  17975. all channels are displayed in separate rows
  17976. @end table
  17977. Default value is @samp{combined}.
  17978. @item color
  17979. Specify display color mode.
  17980. It accepts the following values:
  17981. @table @samp
  17982. @item channel
  17983. each channel is displayed in a separate color
  17984. @item intensity
  17985. each channel is displayed using the same color scheme
  17986. @item rainbow
  17987. each channel is displayed using the rainbow color scheme
  17988. @item moreland
  17989. each channel is displayed using the moreland color scheme
  17990. @item nebulae
  17991. each channel is displayed using the nebulae color scheme
  17992. @item fire
  17993. each channel is displayed using the fire color scheme
  17994. @item fiery
  17995. each channel is displayed using the fiery color scheme
  17996. @item fruit
  17997. each channel is displayed using the fruit color scheme
  17998. @item cool
  17999. each channel is displayed using the cool color scheme
  18000. @item magma
  18001. each channel is displayed using the magma color scheme
  18002. @item green
  18003. each channel is displayed using the green color scheme
  18004. @item viridis
  18005. each channel is displayed using the viridis color scheme
  18006. @item plasma
  18007. each channel is displayed using the plasma color scheme
  18008. @item cividis
  18009. each channel is displayed using the cividis color scheme
  18010. @item terrain
  18011. each channel is displayed using the terrain color scheme
  18012. @end table
  18013. Default value is @samp{channel}.
  18014. @item scale
  18015. Specify scale used for calculating intensity color values.
  18016. It accepts the following values:
  18017. @table @samp
  18018. @item lin
  18019. linear
  18020. @item sqrt
  18021. square root, default
  18022. @item cbrt
  18023. cubic root
  18024. @item log
  18025. logarithmic
  18026. @item 4thrt
  18027. 4th root
  18028. @item 5thrt
  18029. 5th root
  18030. @end table
  18031. Default value is @samp{sqrt}.
  18032. @item fscale
  18033. Specify frequency scale.
  18034. It accepts the following values:
  18035. @table @samp
  18036. @item lin
  18037. linear
  18038. @item log
  18039. logarithmic
  18040. @end table
  18041. Default value is @samp{lin}.
  18042. @item saturation
  18043. Set saturation modifier for displayed colors. Negative values provide
  18044. alternative color scheme. @code{0} is no saturation at all.
  18045. Saturation must be in [-10.0, 10.0] range.
  18046. Default value is @code{1}.
  18047. @item win_func
  18048. Set window function.
  18049. It accepts the following values:
  18050. @table @samp
  18051. @item rect
  18052. @item bartlett
  18053. @item hann
  18054. @item hanning
  18055. @item hamming
  18056. @item blackman
  18057. @item welch
  18058. @item flattop
  18059. @item bharris
  18060. @item bnuttall
  18061. @item bhann
  18062. @item sine
  18063. @item nuttall
  18064. @item lanczos
  18065. @item gauss
  18066. @item tukey
  18067. @item dolph
  18068. @item cauchy
  18069. @item parzen
  18070. @item poisson
  18071. @item bohman
  18072. @end table
  18073. Default value is @code{hann}.
  18074. @item orientation
  18075. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18076. @code{horizontal}. Default is @code{vertical}.
  18077. @item overlap
  18078. Set ratio of overlap window. Default value is @code{0}.
  18079. When value is @code{1} overlap is set to recommended size for specific
  18080. window function currently used.
  18081. @item gain
  18082. Set scale gain for calculating intensity color values.
  18083. Default value is @code{1}.
  18084. @item data
  18085. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18086. @item rotation
  18087. Set color rotation, must be in [-1.0, 1.0] range.
  18088. Default value is @code{0}.
  18089. @item start
  18090. Set start frequency from which to display spectrogram. Default is @code{0}.
  18091. @item stop
  18092. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18093. @item fps
  18094. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18095. @item legend
  18096. Draw time and frequency axes and legends. Default is disabled.
  18097. @end table
  18098. The usage is very similar to the showwaves filter; see the examples in that
  18099. section.
  18100. @subsection Examples
  18101. @itemize
  18102. @item
  18103. Large window with logarithmic color scaling:
  18104. @example
  18105. showspectrum=s=1280x480:scale=log
  18106. @end example
  18107. @item
  18108. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18109. @example
  18110. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18111. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18112. @end example
  18113. @end itemize
  18114. @section showspectrumpic
  18115. Convert input audio to a single video frame, representing the audio frequency
  18116. spectrum.
  18117. The filter accepts the following options:
  18118. @table @option
  18119. @item size, s
  18120. Specify the video size for the output. For the syntax of this option, check the
  18121. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18122. Default value is @code{4096x2048}.
  18123. @item mode
  18124. Specify display mode.
  18125. It accepts the following values:
  18126. @table @samp
  18127. @item combined
  18128. all channels are displayed in the same row
  18129. @item separate
  18130. all channels are displayed in separate rows
  18131. @end table
  18132. Default value is @samp{combined}.
  18133. @item color
  18134. Specify display color mode.
  18135. It accepts the following values:
  18136. @table @samp
  18137. @item channel
  18138. each channel is displayed in a separate color
  18139. @item intensity
  18140. each channel is displayed using the same color scheme
  18141. @item rainbow
  18142. each channel is displayed using the rainbow color scheme
  18143. @item moreland
  18144. each channel is displayed using the moreland color scheme
  18145. @item nebulae
  18146. each channel is displayed using the nebulae color scheme
  18147. @item fire
  18148. each channel is displayed using the fire color scheme
  18149. @item fiery
  18150. each channel is displayed using the fiery color scheme
  18151. @item fruit
  18152. each channel is displayed using the fruit color scheme
  18153. @item cool
  18154. each channel is displayed using the cool color scheme
  18155. @item magma
  18156. each channel is displayed using the magma color scheme
  18157. @item green
  18158. each channel is displayed using the green color scheme
  18159. @item viridis
  18160. each channel is displayed using the viridis color scheme
  18161. @item plasma
  18162. each channel is displayed using the plasma color scheme
  18163. @item cividis
  18164. each channel is displayed using the cividis color scheme
  18165. @item terrain
  18166. each channel is displayed using the terrain color scheme
  18167. @end table
  18168. Default value is @samp{intensity}.
  18169. @item scale
  18170. Specify scale used for calculating intensity color values.
  18171. It accepts the following values:
  18172. @table @samp
  18173. @item lin
  18174. linear
  18175. @item sqrt
  18176. square root, default
  18177. @item cbrt
  18178. cubic root
  18179. @item log
  18180. logarithmic
  18181. @item 4thrt
  18182. 4th root
  18183. @item 5thrt
  18184. 5th root
  18185. @end table
  18186. Default value is @samp{log}.
  18187. @item fscale
  18188. Specify frequency scale.
  18189. It accepts the following values:
  18190. @table @samp
  18191. @item lin
  18192. linear
  18193. @item log
  18194. logarithmic
  18195. @end table
  18196. Default value is @samp{lin}.
  18197. @item saturation
  18198. Set saturation modifier for displayed colors. Negative values provide
  18199. alternative color scheme. @code{0} is no saturation at all.
  18200. Saturation must be in [-10.0, 10.0] range.
  18201. Default value is @code{1}.
  18202. @item win_func
  18203. Set window function.
  18204. It accepts the following values:
  18205. @table @samp
  18206. @item rect
  18207. @item bartlett
  18208. @item hann
  18209. @item hanning
  18210. @item hamming
  18211. @item blackman
  18212. @item welch
  18213. @item flattop
  18214. @item bharris
  18215. @item bnuttall
  18216. @item bhann
  18217. @item sine
  18218. @item nuttall
  18219. @item lanczos
  18220. @item gauss
  18221. @item tukey
  18222. @item dolph
  18223. @item cauchy
  18224. @item parzen
  18225. @item poisson
  18226. @item bohman
  18227. @end table
  18228. Default value is @code{hann}.
  18229. @item orientation
  18230. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18231. @code{horizontal}. Default is @code{vertical}.
  18232. @item gain
  18233. Set scale gain for calculating intensity color values.
  18234. Default value is @code{1}.
  18235. @item legend
  18236. Draw time and frequency axes and legends. Default is enabled.
  18237. @item rotation
  18238. Set color rotation, must be in [-1.0, 1.0] range.
  18239. Default value is @code{0}.
  18240. @item start
  18241. Set start frequency from which to display spectrogram. Default is @code{0}.
  18242. @item stop
  18243. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18244. @end table
  18245. @subsection Examples
  18246. @itemize
  18247. @item
  18248. Extract an audio spectrogram of a whole audio track
  18249. in a 1024x1024 picture using @command{ffmpeg}:
  18250. @example
  18251. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18252. @end example
  18253. @end itemize
  18254. @section showvolume
  18255. Convert input audio volume to a video output.
  18256. The filter accepts the following options:
  18257. @table @option
  18258. @item rate, r
  18259. Set video rate.
  18260. @item b
  18261. Set border width, allowed range is [0, 5]. Default is 1.
  18262. @item w
  18263. Set channel width, allowed range is [80, 8192]. Default is 400.
  18264. @item h
  18265. Set channel height, allowed range is [1, 900]. Default is 20.
  18266. @item f
  18267. Set fade, allowed range is [0, 1]. Default is 0.95.
  18268. @item c
  18269. Set volume color expression.
  18270. The expression can use the following variables:
  18271. @table @option
  18272. @item VOLUME
  18273. Current max volume of channel in dB.
  18274. @item PEAK
  18275. Current peak.
  18276. @item CHANNEL
  18277. Current channel number, starting from 0.
  18278. @end table
  18279. @item t
  18280. If set, displays channel names. Default is enabled.
  18281. @item v
  18282. If set, displays volume values. Default is enabled.
  18283. @item o
  18284. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18285. default is @code{h}.
  18286. @item s
  18287. Set step size, allowed range is [0, 5]. Default is 0, which means
  18288. step is disabled.
  18289. @item p
  18290. Set background opacity, allowed range is [0, 1]. Default is 0.
  18291. @item m
  18292. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18293. default is @code{p}.
  18294. @item ds
  18295. Set display scale, can be linear: @code{lin} or log: @code{log},
  18296. default is @code{lin}.
  18297. @item dm
  18298. In second.
  18299. If set to > 0., display a line for the max level
  18300. in the previous seconds.
  18301. default is disabled: @code{0.}
  18302. @item dmc
  18303. The color of the max line. Use when @code{dm} option is set to > 0.
  18304. default is: @code{orange}
  18305. @end table
  18306. @section showwaves
  18307. Convert input audio to a video output, representing the samples waves.
  18308. The filter accepts the following options:
  18309. @table @option
  18310. @item size, s
  18311. Specify the video size for the output. For the syntax of this option, check the
  18312. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18313. Default value is @code{600x240}.
  18314. @item mode
  18315. Set display mode.
  18316. Available values are:
  18317. @table @samp
  18318. @item point
  18319. Draw a point for each sample.
  18320. @item line
  18321. Draw a vertical line for each sample.
  18322. @item p2p
  18323. Draw a point for each sample and a line between them.
  18324. @item cline
  18325. Draw a centered vertical line for each sample.
  18326. @end table
  18327. Default value is @code{point}.
  18328. @item n
  18329. Set the number of samples which are printed on the same column. A
  18330. larger value will decrease the frame rate. Must be a positive
  18331. integer. This option can be set only if the value for @var{rate}
  18332. is not explicitly specified.
  18333. @item rate, r
  18334. Set the (approximate) output frame rate. This is done by setting the
  18335. option @var{n}. Default value is "25".
  18336. @item split_channels
  18337. Set if channels should be drawn separately or overlap. Default value is 0.
  18338. @item colors
  18339. Set colors separated by '|' which are going to be used for drawing of each channel.
  18340. @item scale
  18341. Set amplitude scale.
  18342. Available values are:
  18343. @table @samp
  18344. @item lin
  18345. Linear.
  18346. @item log
  18347. Logarithmic.
  18348. @item sqrt
  18349. Square root.
  18350. @item cbrt
  18351. Cubic root.
  18352. @end table
  18353. Default is linear.
  18354. @item draw
  18355. Set the draw mode. This is mostly useful to set for high @var{n}.
  18356. Available values are:
  18357. @table @samp
  18358. @item scale
  18359. Scale pixel values for each drawn sample.
  18360. @item full
  18361. Draw every sample directly.
  18362. @end table
  18363. Default value is @code{scale}.
  18364. @end table
  18365. @subsection Examples
  18366. @itemize
  18367. @item
  18368. Output the input file audio and the corresponding video representation
  18369. at the same time:
  18370. @example
  18371. amovie=a.mp3,asplit[out0],showwaves[out1]
  18372. @end example
  18373. @item
  18374. Create a synthetic signal and show it with showwaves, forcing a
  18375. frame rate of 30 frames per second:
  18376. @example
  18377. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18378. @end example
  18379. @end itemize
  18380. @section showwavespic
  18381. Convert input audio to a single video frame, representing the samples waves.
  18382. The filter accepts the following options:
  18383. @table @option
  18384. @item size, s
  18385. Specify the video size for the output. For the syntax of this option, check the
  18386. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18387. Default value is @code{600x240}.
  18388. @item split_channels
  18389. Set if channels should be drawn separately or overlap. Default value is 0.
  18390. @item colors
  18391. Set colors separated by '|' which are going to be used for drawing of each channel.
  18392. @item scale
  18393. Set amplitude scale.
  18394. Available values are:
  18395. @table @samp
  18396. @item lin
  18397. Linear.
  18398. @item log
  18399. Logarithmic.
  18400. @item sqrt
  18401. Square root.
  18402. @item cbrt
  18403. Cubic root.
  18404. @end table
  18405. Default is linear.
  18406. @item draw
  18407. Set the draw mode.
  18408. Available values are:
  18409. @table @samp
  18410. @item scale
  18411. Scale pixel values for each drawn sample.
  18412. @item full
  18413. Draw every sample directly.
  18414. @end table
  18415. Default value is @code{scale}.
  18416. @end table
  18417. @subsection Examples
  18418. @itemize
  18419. @item
  18420. Extract a channel split representation of the wave form of a whole audio track
  18421. in a 1024x800 picture using @command{ffmpeg}:
  18422. @example
  18423. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18424. @end example
  18425. @end itemize
  18426. @section sidedata, asidedata
  18427. Delete frame side data, or select frames based on it.
  18428. This filter accepts the following options:
  18429. @table @option
  18430. @item mode
  18431. Set mode of operation of the filter.
  18432. Can be one of the following:
  18433. @table @samp
  18434. @item select
  18435. Select every frame with side data of @code{type}.
  18436. @item delete
  18437. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18438. data in the frame.
  18439. @end table
  18440. @item type
  18441. Set side data type used with all modes. Must be set for @code{select} mode. For
  18442. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18443. in @file{libavutil/frame.h}. For example, to choose
  18444. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18445. @end table
  18446. @section spectrumsynth
  18447. Synthesize audio from 2 input video spectrums, first input stream represents
  18448. magnitude across time and second represents phase across time.
  18449. The filter will transform from frequency domain as displayed in videos back
  18450. to time domain as presented in audio output.
  18451. This filter is primarily created for reversing processed @ref{showspectrum}
  18452. filter outputs, but can synthesize sound from other spectrograms too.
  18453. But in such case results are going to be poor if the phase data is not
  18454. available, because in such cases phase data need to be recreated, usually
  18455. it's just recreated from random noise.
  18456. For best results use gray only output (@code{channel} color mode in
  18457. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18458. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18459. @code{data} option. Inputs videos should generally use @code{fullframe}
  18460. slide mode as that saves resources needed for decoding video.
  18461. The filter accepts the following options:
  18462. @table @option
  18463. @item sample_rate
  18464. Specify sample rate of output audio, the sample rate of audio from which
  18465. spectrum was generated may differ.
  18466. @item channels
  18467. Set number of channels represented in input video spectrums.
  18468. @item scale
  18469. Set scale which was used when generating magnitude input spectrum.
  18470. Can be @code{lin} or @code{log}. Default is @code{log}.
  18471. @item slide
  18472. Set slide which was used when generating inputs spectrums.
  18473. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18474. Default is @code{fullframe}.
  18475. @item win_func
  18476. Set window function used for resynthesis.
  18477. @item overlap
  18478. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18479. which means optimal overlap for selected window function will be picked.
  18480. @item orientation
  18481. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18482. Default is @code{vertical}.
  18483. @end table
  18484. @subsection Examples
  18485. @itemize
  18486. @item
  18487. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18488. then resynthesize videos back to audio with spectrumsynth:
  18489. @example
  18490. 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
  18491. 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
  18492. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18493. @end example
  18494. @end itemize
  18495. @section split, asplit
  18496. Split input into several identical outputs.
  18497. @code{asplit} works with audio input, @code{split} with video.
  18498. The filter accepts a single parameter which specifies the number of outputs. If
  18499. unspecified, it defaults to 2.
  18500. @subsection Examples
  18501. @itemize
  18502. @item
  18503. Create two separate outputs from the same input:
  18504. @example
  18505. [in] split [out0][out1]
  18506. @end example
  18507. @item
  18508. To create 3 or more outputs, you need to specify the number of
  18509. outputs, like in:
  18510. @example
  18511. [in] asplit=3 [out0][out1][out2]
  18512. @end example
  18513. @item
  18514. Create two separate outputs from the same input, one cropped and
  18515. one padded:
  18516. @example
  18517. [in] split [splitout1][splitout2];
  18518. [splitout1] crop=100:100:0:0 [cropout];
  18519. [splitout2] pad=200:200:100:100 [padout];
  18520. @end example
  18521. @item
  18522. Create 5 copies of the input audio with @command{ffmpeg}:
  18523. @example
  18524. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18525. @end example
  18526. @end itemize
  18527. @section zmq, azmq
  18528. Receive commands sent through a libzmq client, and forward them to
  18529. filters in the filtergraph.
  18530. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18531. must be inserted between two video filters, @code{azmq} between two
  18532. audio filters. Both are capable to send messages to any filter type.
  18533. To enable these filters you need to install the libzmq library and
  18534. headers and configure FFmpeg with @code{--enable-libzmq}.
  18535. For more information about libzmq see:
  18536. @url{http://www.zeromq.org/}
  18537. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18538. receives messages sent through a network interface defined by the
  18539. @option{bind_address} (or the abbreviation "@option{b}") option.
  18540. Default value of this option is @file{tcp://localhost:5555}. You may
  18541. want to alter this value to your needs, but do not forget to escape any
  18542. ':' signs (see @ref{filtergraph escaping}).
  18543. The received message must be in the form:
  18544. @example
  18545. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18546. @end example
  18547. @var{TARGET} specifies the target of the command, usually the name of
  18548. the filter class or a specific filter instance name. The default
  18549. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18550. but you can override this by using the @samp{filter_name@@id} syntax
  18551. (see @ref{Filtergraph syntax}).
  18552. @var{COMMAND} specifies the name of the command for the target filter.
  18553. @var{ARG} is optional and specifies the optional argument list for the
  18554. given @var{COMMAND}.
  18555. Upon reception, the message is processed and the corresponding command
  18556. is injected into the filtergraph. Depending on the result, the filter
  18557. will send a reply to the client, adopting the format:
  18558. @example
  18559. @var{ERROR_CODE} @var{ERROR_REASON}
  18560. @var{MESSAGE}
  18561. @end example
  18562. @var{MESSAGE} is optional.
  18563. @subsection Examples
  18564. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18565. be used to send commands processed by these filters.
  18566. Consider the following filtergraph generated by @command{ffplay}.
  18567. In this example the last overlay filter has an instance name. All other
  18568. filters will have default instance names.
  18569. @example
  18570. ffplay -dumpgraph 1 -f lavfi "
  18571. color=s=100x100:c=red [l];
  18572. color=s=100x100:c=blue [r];
  18573. nullsrc=s=200x100, zmq [bg];
  18574. [bg][l] overlay [bg+l];
  18575. [bg+l][r] overlay@@my=x=100 "
  18576. @end example
  18577. To change the color of the left side of the video, the following
  18578. command can be used:
  18579. @example
  18580. echo Parsed_color_0 c yellow | tools/zmqsend
  18581. @end example
  18582. To change the right side:
  18583. @example
  18584. echo Parsed_color_1 c pink | tools/zmqsend
  18585. @end example
  18586. To change the position of the right side:
  18587. @example
  18588. echo overlay@@my x 150 | tools/zmqsend
  18589. @end example
  18590. @c man end MULTIMEDIA FILTERS
  18591. @chapter Multimedia Sources
  18592. @c man begin MULTIMEDIA SOURCES
  18593. Below is a description of the currently available multimedia sources.
  18594. @section amovie
  18595. This is the same as @ref{movie} source, except it selects an audio
  18596. stream by default.
  18597. @anchor{movie}
  18598. @section movie
  18599. Read audio and/or video stream(s) from a movie container.
  18600. It accepts the following parameters:
  18601. @table @option
  18602. @item filename
  18603. The name of the resource to read (not necessarily a file; it can also be a
  18604. device or a stream accessed through some protocol).
  18605. @item format_name, f
  18606. Specifies the format assumed for the movie to read, and can be either
  18607. the name of a container or an input device. If not specified, the
  18608. format is guessed from @var{movie_name} or by probing.
  18609. @item seek_point, sp
  18610. Specifies the seek point in seconds. The frames will be output
  18611. starting from this seek point. The parameter is evaluated with
  18612. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18613. postfix. The default value is "0".
  18614. @item streams, s
  18615. Specifies the streams to read. Several streams can be specified,
  18616. separated by "+". The source will then have as many outputs, in the
  18617. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18618. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18619. respectively the default (best suited) video and audio stream. Default
  18620. is "dv", or "da" if the filter is called as "amovie".
  18621. @item stream_index, si
  18622. Specifies the index of the video stream to read. If the value is -1,
  18623. the most suitable video stream will be automatically selected. The default
  18624. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18625. audio instead of video.
  18626. @item loop
  18627. Specifies how many times to read the stream in sequence.
  18628. If the value is 0, the stream will be looped infinitely.
  18629. Default value is "1".
  18630. Note that when the movie is looped the source timestamps are not
  18631. changed, so it will generate non monotonically increasing timestamps.
  18632. @item discontinuity
  18633. Specifies the time difference between frames above which the point is
  18634. considered a timestamp discontinuity which is removed by adjusting the later
  18635. timestamps.
  18636. @end table
  18637. It allows overlaying a second video on top of the main input of
  18638. a filtergraph, as shown in this graph:
  18639. @example
  18640. input -----------> deltapts0 --> overlay --> output
  18641. ^
  18642. |
  18643. movie --> scale--> deltapts1 -------+
  18644. @end example
  18645. @subsection Examples
  18646. @itemize
  18647. @item
  18648. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18649. on top of the input labelled "in":
  18650. @example
  18651. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18652. [in] setpts=PTS-STARTPTS [main];
  18653. [main][over] overlay=16:16 [out]
  18654. @end example
  18655. @item
  18656. Read from a video4linux2 device, and overlay it on top of the input
  18657. labelled "in":
  18658. @example
  18659. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18660. [in] setpts=PTS-STARTPTS [main];
  18661. [main][over] overlay=16:16 [out]
  18662. @end example
  18663. @item
  18664. Read the first video stream and the audio stream with id 0x81 from
  18665. dvd.vob; the video is connected to the pad named "video" and the audio is
  18666. connected to the pad named "audio":
  18667. @example
  18668. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18669. @end example
  18670. @end itemize
  18671. @subsection Commands
  18672. Both movie and amovie support the following commands:
  18673. @table @option
  18674. @item seek
  18675. Perform seek using "av_seek_frame".
  18676. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18677. @itemize
  18678. @item
  18679. @var{stream_index}: If stream_index is -1, a default
  18680. stream is selected, and @var{timestamp} is automatically converted
  18681. from AV_TIME_BASE units to the stream specific time_base.
  18682. @item
  18683. @var{timestamp}: Timestamp in AVStream.time_base units
  18684. or, if no stream is specified, in AV_TIME_BASE units.
  18685. @item
  18686. @var{flags}: Flags which select direction and seeking mode.
  18687. @end itemize
  18688. @item get_duration
  18689. Get movie duration in AV_TIME_BASE units.
  18690. @end table
  18691. @c man end MULTIMEDIA SOURCES