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.

26076 lines
692KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. 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"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section afreqshift
  1018. Apply frequency shift to input audio samples.
  1019. The filter accepts the following options:
  1020. @table @option
  1021. @item shift
  1022. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1023. Default value is 0.0.
  1024. @end table
  1025. @subsection Commands
  1026. This filter supports the above option as @ref{commands}.
  1027. @section agate
  1028. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1029. processing reduces disturbing noise between useful signals.
  1030. Gating is done by detecting the volume below a chosen level @var{threshold}
  1031. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1032. floor is set via @var{range}. Because an exact manipulation of the signal
  1033. would cause distortion of the waveform the reduction can be levelled over
  1034. time. This is done by setting @var{attack} and @var{release}.
  1035. @var{attack} determines how long the signal has to fall below the threshold
  1036. before any reduction will occur and @var{release} sets the time the signal
  1037. has to rise above the threshold to reduce the reduction again.
  1038. Shorter signals than the chosen attack time will be left untouched.
  1039. @table @option
  1040. @item level_in
  1041. Set input level before filtering.
  1042. Default is 1. Allowed range is from 0.015625 to 64.
  1043. @item mode
  1044. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1045. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1046. will be amplified, expanding dynamic range in upward direction.
  1047. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1048. @item range
  1049. Set the level of gain reduction when the signal is below the threshold.
  1050. Default is 0.06125. Allowed range is from 0 to 1.
  1051. Setting this to 0 disables reduction and then filter behaves like expander.
  1052. @item threshold
  1053. If a signal rises above this level the gain reduction is released.
  1054. Default is 0.125. Allowed range is from 0 to 1.
  1055. @item ratio
  1056. Set a ratio by which the signal is reduced.
  1057. Default is 2. Allowed range is from 1 to 9000.
  1058. @item attack
  1059. Amount of milliseconds the signal has to rise above the threshold before gain
  1060. reduction stops.
  1061. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1062. @item release
  1063. Amount of milliseconds the signal has to fall below the threshold before the
  1064. reduction is increased again. Default is 250 milliseconds.
  1065. Allowed range is from 0.01 to 9000.
  1066. @item makeup
  1067. Set amount of amplification of signal after processing.
  1068. Default is 1. Allowed range is from 1 to 64.
  1069. @item knee
  1070. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1071. Default is 2.828427125. Allowed range is from 1 to 8.
  1072. @item detection
  1073. Choose if exact signal should be taken for detection or an RMS like one.
  1074. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1075. @item link
  1076. Choose if the average level between all channels or the louder channel affects
  1077. the reduction.
  1078. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1079. @end table
  1080. @section aiir
  1081. Apply an arbitrary Infinite Impulse Response filter.
  1082. It accepts the following parameters:
  1083. @table @option
  1084. @item zeros, z
  1085. Set numerator/zeros coefficients.
  1086. @item poles, p
  1087. Set denominator/poles coefficients.
  1088. @item gains, k
  1089. Set channels gains.
  1090. @item dry_gain
  1091. Set input gain.
  1092. @item wet_gain
  1093. Set output gain.
  1094. @item format, f
  1095. Set coefficients format.
  1096. @table @samp
  1097. @item sf
  1098. analog transfer function
  1099. @item tf
  1100. digital transfer function
  1101. @item zp
  1102. Z-plane zeros/poles, cartesian (default)
  1103. @item pr
  1104. Z-plane zeros/poles, polar radians
  1105. @item pd
  1106. Z-plane zeros/poles, polar degrees
  1107. @item sp
  1108. S-plane zeros/poles
  1109. @end table
  1110. @item process, r
  1111. Set type of processing.
  1112. @table @samp
  1113. @item d
  1114. direct processing
  1115. @item s
  1116. serial processing
  1117. @item p
  1118. parallel processing
  1119. @end table
  1120. @item precision, e
  1121. Set filtering precision.
  1122. @table @samp
  1123. @item dbl
  1124. double-precision floating-point (default)
  1125. @item flt
  1126. single-precision floating-point
  1127. @item i32
  1128. 32-bit integers
  1129. @item i16
  1130. 16-bit integers
  1131. @end table
  1132. @item normalize, n
  1133. Normalize filter coefficients, by default is enabled.
  1134. Enabling it will normalize magnitude response at DC to 0dB.
  1135. @item mix
  1136. How much to use filtered signal in output. Default is 1.
  1137. Range is between 0 and 1.
  1138. @item response
  1139. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1140. By default it is disabled.
  1141. @item channel
  1142. Set for which IR channel to display frequency response. By default is first channel
  1143. displayed. This option is used only when @var{response} is enabled.
  1144. @item size
  1145. Set video stream size. This option is used only when @var{response} is enabled.
  1146. @end table
  1147. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1148. order.
  1149. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1150. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1151. imaginary unit.
  1152. Different coefficients and gains can be provided for every channel, in such case
  1153. use '|' to separate coefficients or gains. Last provided coefficients will be
  1154. used for all remaining channels.
  1155. @subsection Examples
  1156. @itemize
  1157. @item
  1158. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1159. @example
  1160. 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
  1161. @end example
  1162. @item
  1163. Same as above but in @code{zp} format:
  1164. @example
  1165. 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
  1166. @end example
  1167. @item
  1168. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1169. @example
  1170. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1171. @end example
  1172. @end itemize
  1173. @section alimiter
  1174. The limiter prevents an input signal from rising over a desired threshold.
  1175. This limiter uses lookahead technology to prevent your signal from distorting.
  1176. It means that there is a small delay after the signal is processed. Keep in mind
  1177. that the delay it produces is the attack time you set.
  1178. The filter accepts the following options:
  1179. @table @option
  1180. @item level_in
  1181. Set input gain. Default is 1.
  1182. @item level_out
  1183. Set output gain. Default is 1.
  1184. @item limit
  1185. Don't let signals above this level pass the limiter. Default is 1.
  1186. @item attack
  1187. The limiter will reach its attenuation level in this amount of time in
  1188. milliseconds. Default is 5 milliseconds.
  1189. @item release
  1190. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1191. Default is 50 milliseconds.
  1192. @item asc
  1193. When gain reduction is always needed ASC takes care of releasing to an
  1194. average reduction level rather than reaching a reduction of 0 in the release
  1195. time.
  1196. @item asc_level
  1197. Select how much the release time is affected by ASC, 0 means nearly no changes
  1198. in release time while 1 produces higher release times.
  1199. @item level
  1200. Auto level output signal. Default is enabled.
  1201. This normalizes audio back to 0dB if enabled.
  1202. @end table
  1203. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1204. with @ref{aresample} before applying this filter.
  1205. @section allpass
  1206. Apply a two-pole all-pass filter with central frequency (in Hz)
  1207. @var{frequency}, and filter-width @var{width}.
  1208. An all-pass filter changes the audio's frequency to phase relationship
  1209. without changing its frequency to amplitude relationship.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item frequency, f
  1213. Set frequency in Hz.
  1214. @item width_type, t
  1215. Set method to specify band-width of filter.
  1216. @table @option
  1217. @item h
  1218. Hz
  1219. @item q
  1220. Q-Factor
  1221. @item o
  1222. octave
  1223. @item s
  1224. slope
  1225. @item k
  1226. kHz
  1227. @end table
  1228. @item width, w
  1229. Specify the band-width of a filter in width_type units.
  1230. @item mix, m
  1231. How much to use filtered signal in output. Default is 1.
  1232. Range is between 0 and 1.
  1233. @item channels, c
  1234. Specify which channels to filter, by default all available are filtered.
  1235. @item normalize, n
  1236. Normalize biquad coefficients, by default is disabled.
  1237. Enabling it will normalize magnitude response at DC to 0dB.
  1238. @item order, o
  1239. Set the filter order, can be 1 or 2. Default is 2.
  1240. @item transform, a
  1241. Set transform type of IIR filter.
  1242. @table @option
  1243. @item di
  1244. @item dii
  1245. @item tdii
  1246. @item latt
  1247. @end table
  1248. @end table
  1249. @subsection Commands
  1250. This filter supports the following commands:
  1251. @table @option
  1252. @item frequency, f
  1253. Change allpass frequency.
  1254. Syntax for the command is : "@var{frequency}"
  1255. @item width_type, t
  1256. Change allpass width_type.
  1257. Syntax for the command is : "@var{width_type}"
  1258. @item width, w
  1259. Change allpass width.
  1260. Syntax for the command is : "@var{width}"
  1261. @item mix, m
  1262. Change allpass mix.
  1263. Syntax for the command is : "@var{mix}"
  1264. @end table
  1265. @section aloop
  1266. Loop audio samples.
  1267. The filter accepts the following options:
  1268. @table @option
  1269. @item loop
  1270. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1271. Default is 0.
  1272. @item size
  1273. Set maximal number of samples. Default is 0.
  1274. @item start
  1275. Set first sample of loop. Default is 0.
  1276. @end table
  1277. @anchor{amerge}
  1278. @section amerge
  1279. Merge two or more audio streams into a single multi-channel stream.
  1280. The filter accepts the following options:
  1281. @table @option
  1282. @item inputs
  1283. Set the number of inputs. Default is 2.
  1284. @end table
  1285. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1286. the channel layout of the output will be set accordingly and the channels
  1287. will be reordered as necessary. If the channel layouts of the inputs are not
  1288. disjoint, the output will have all the channels of the first input then all
  1289. the channels of the second input, in that order, and the channel layout of
  1290. the output will be the default value corresponding to the total number of
  1291. channels.
  1292. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1293. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1294. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1295. first input, b1 is the first channel of the second input).
  1296. On the other hand, if both input are in stereo, the output channels will be
  1297. in the default order: a1, a2, b1, b2, and the channel layout will be
  1298. arbitrarily set to 4.0, which may or may not be the expected value.
  1299. All inputs must have the same sample rate, and format.
  1300. If inputs do not have the same duration, the output will stop with the
  1301. shortest.
  1302. @subsection Examples
  1303. @itemize
  1304. @item
  1305. Merge two mono files into a stereo stream:
  1306. @example
  1307. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1308. @end example
  1309. @item
  1310. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1311. @example
  1312. 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
  1313. @end example
  1314. @end itemize
  1315. @section amix
  1316. Mixes multiple audio inputs into a single output.
  1317. Note that this filter only supports float samples (the @var{amerge}
  1318. and @var{pan} audio filters support many formats). If the @var{amix}
  1319. input has integer samples then @ref{aresample} will be automatically
  1320. inserted to perform the conversion to float samples.
  1321. For example
  1322. @example
  1323. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1324. @end example
  1325. will mix 3 input audio streams to a single output with the same duration as the
  1326. first input and a dropout transition time of 3 seconds.
  1327. It accepts the following parameters:
  1328. @table @option
  1329. @item inputs
  1330. The number of inputs. If unspecified, it defaults to 2.
  1331. @item duration
  1332. How to determine the end-of-stream.
  1333. @table @option
  1334. @item longest
  1335. The duration of the longest input. (default)
  1336. @item shortest
  1337. The duration of the shortest input.
  1338. @item first
  1339. The duration of the first input.
  1340. @end table
  1341. @item dropout_transition
  1342. The transition time, in seconds, for volume renormalization when an input
  1343. stream ends. The default value is 2 seconds.
  1344. @item weights
  1345. Specify weight of each input audio stream as sequence.
  1346. Each weight is separated by space. By default all inputs have same weight.
  1347. @end table
  1348. @subsection Commands
  1349. This filter supports the following commands:
  1350. @table @option
  1351. @item weights
  1352. Syntax is same as option with same name.
  1353. @end table
  1354. @section amultiply
  1355. Multiply first audio stream with second audio stream and store result
  1356. in output audio stream. Multiplication is done by multiplying each
  1357. sample from first stream with sample at same position from second stream.
  1358. With this element-wise multiplication one can create amplitude fades and
  1359. amplitude modulations.
  1360. @section anequalizer
  1361. High-order parametric multiband equalizer for each channel.
  1362. It accepts the following parameters:
  1363. @table @option
  1364. @item params
  1365. This option string is in format:
  1366. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1367. Each equalizer band is separated by '|'.
  1368. @table @option
  1369. @item chn
  1370. Set channel number to which equalization will be applied.
  1371. If input doesn't have that channel the entry is ignored.
  1372. @item f
  1373. Set central frequency for band.
  1374. If input doesn't have that frequency the entry is ignored.
  1375. @item w
  1376. Set band width in hertz.
  1377. @item g
  1378. Set band gain in dB.
  1379. @item t
  1380. Set filter type for band, optional, can be:
  1381. @table @samp
  1382. @item 0
  1383. Butterworth, this is default.
  1384. @item 1
  1385. Chebyshev type 1.
  1386. @item 2
  1387. Chebyshev type 2.
  1388. @end table
  1389. @end table
  1390. @item curves
  1391. With this option activated frequency response of anequalizer is displayed
  1392. in video stream.
  1393. @item size
  1394. Set video stream size. Only useful if curves option is activated.
  1395. @item mgain
  1396. Set max gain that will be displayed. Only useful if curves option is activated.
  1397. Setting this to a reasonable value makes it possible to display gain which is derived from
  1398. neighbour bands which are too close to each other and thus produce higher gain
  1399. when both are activated.
  1400. @item fscale
  1401. Set frequency scale used to draw frequency response in video output.
  1402. Can be linear or logarithmic. Default is logarithmic.
  1403. @item colors
  1404. Set color for each channel curve which is going to be displayed in video stream.
  1405. This is list of color names separated by space or by '|'.
  1406. Unrecognised or missing colors will be replaced by white color.
  1407. @end table
  1408. @subsection Examples
  1409. @itemize
  1410. @item
  1411. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1412. for first 2 channels using Chebyshev type 1 filter:
  1413. @example
  1414. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1415. @end example
  1416. @end itemize
  1417. @subsection Commands
  1418. This filter supports the following commands:
  1419. @table @option
  1420. @item change
  1421. Alter existing filter parameters.
  1422. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1423. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1424. error is returned.
  1425. @var{freq} set new frequency parameter.
  1426. @var{width} set new width parameter in herz.
  1427. @var{gain} set new gain parameter in dB.
  1428. Full filter invocation with asendcmd may look like this:
  1429. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1430. @end table
  1431. @section anlmdn
  1432. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1433. Each sample is adjusted by looking for other samples with similar contexts. This
  1434. context similarity is defined by comparing their surrounding patches of size
  1435. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1436. The filter accepts the following options:
  1437. @table @option
  1438. @item s
  1439. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1440. @item p
  1441. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1442. Default value is 2 milliseconds.
  1443. @item r
  1444. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1445. Default value is 6 milliseconds.
  1446. @item o
  1447. Set the output mode.
  1448. It accepts the following values:
  1449. @table @option
  1450. @item i
  1451. Pass input unchanged.
  1452. @item o
  1453. Pass noise filtered out.
  1454. @item n
  1455. Pass only noise.
  1456. Default value is @var{o}.
  1457. @end table
  1458. @item m
  1459. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1460. @end table
  1461. @subsection Commands
  1462. This filter supports the following commands:
  1463. @table @option
  1464. @item s
  1465. Change denoise strength. Argument is single float number.
  1466. Syntax for the command is : "@var{s}"
  1467. @item o
  1468. Change output mode.
  1469. Syntax for the command is : "i", "o" or "n" string.
  1470. @end table
  1471. @section anlms
  1472. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1473. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1474. relate to producing the least mean square of the error signal (difference between the desired,
  1475. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1476. A description of the accepted options follows.
  1477. @table @option
  1478. @item order
  1479. Set filter order.
  1480. @item mu
  1481. Set filter mu.
  1482. @item eps
  1483. Set the filter eps.
  1484. @item leakage
  1485. Set the filter leakage.
  1486. @item out_mode
  1487. It accepts the following values:
  1488. @table @option
  1489. @item i
  1490. Pass the 1st input.
  1491. @item d
  1492. Pass the 2nd input.
  1493. @item o
  1494. Pass filtered samples.
  1495. @item n
  1496. Pass difference between desired and filtered samples.
  1497. Default value is @var{o}.
  1498. @end table
  1499. @end table
  1500. @subsection Examples
  1501. @itemize
  1502. @item
  1503. One of many usages of this filter is noise reduction, input audio is filtered
  1504. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1505. @example
  1506. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1507. @end example
  1508. @end itemize
  1509. @subsection Commands
  1510. This filter supports the same commands as options, excluding option @code{order}.
  1511. @section anull
  1512. Pass the audio source unchanged to the output.
  1513. @section apad
  1514. Pad the end of an audio stream with silence.
  1515. This can be used together with @command{ffmpeg} @option{-shortest} to
  1516. extend audio streams to the same length as the video stream.
  1517. A description of the accepted options follows.
  1518. @table @option
  1519. @item packet_size
  1520. Set silence packet size. Default value is 4096.
  1521. @item pad_len
  1522. Set the number of samples of silence to add to the end. After the
  1523. value is reached, the stream is terminated. This option is mutually
  1524. exclusive with @option{whole_len}.
  1525. @item whole_len
  1526. Set the minimum total number of samples in the output audio stream. If
  1527. the value is longer than the input audio length, silence is added to
  1528. the end, until the value is reached. This option is mutually exclusive
  1529. with @option{pad_len}.
  1530. @item pad_dur
  1531. Specify the duration of samples of silence to add. See
  1532. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1533. for the accepted syntax. Used only if set to non-zero value.
  1534. @item whole_dur
  1535. Specify the minimum total duration in the output audio stream. See
  1536. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1537. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1538. the input audio length, silence is added to the end, until the value is reached.
  1539. This option is mutually exclusive with @option{pad_dur}
  1540. @end table
  1541. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1542. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1543. the input stream indefinitely.
  1544. @subsection Examples
  1545. @itemize
  1546. @item
  1547. Add 1024 samples of silence to the end of the input:
  1548. @example
  1549. apad=pad_len=1024
  1550. @end example
  1551. @item
  1552. Make sure the audio output will contain at least 10000 samples, pad
  1553. the input with silence if required:
  1554. @example
  1555. apad=whole_len=10000
  1556. @end example
  1557. @item
  1558. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1559. video stream will always result the shortest and will be converted
  1560. until the end in the output file when using the @option{shortest}
  1561. option:
  1562. @example
  1563. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1564. @end example
  1565. @end itemize
  1566. @section aphaser
  1567. Add a phasing effect to the input audio.
  1568. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1569. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1570. A description of the accepted parameters follows.
  1571. @table @option
  1572. @item in_gain
  1573. Set input gain. Default is 0.4.
  1574. @item out_gain
  1575. Set output gain. Default is 0.74
  1576. @item delay
  1577. Set delay in milliseconds. Default is 3.0.
  1578. @item decay
  1579. Set decay. Default is 0.4.
  1580. @item speed
  1581. Set modulation speed in Hz. Default is 0.5.
  1582. @item type
  1583. Set modulation type. Default is triangular.
  1584. It accepts the following values:
  1585. @table @samp
  1586. @item triangular, t
  1587. @item sinusoidal, s
  1588. @end table
  1589. @end table
  1590. @section aphaseshift
  1591. Apply phase shift to input audio samples.
  1592. The filter accepts the following options:
  1593. @table @option
  1594. @item shift
  1595. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1596. Default value is 0.0.
  1597. @end table
  1598. @subsection Commands
  1599. This filter supports the above option as @ref{commands}.
  1600. @section apulsator
  1601. Audio pulsator is something between an autopanner and a tremolo.
  1602. But it can produce funny stereo effects as well. Pulsator changes the volume
  1603. of the left and right channel based on a LFO (low frequency oscillator) with
  1604. different waveforms and shifted phases.
  1605. This filter have the ability to define an offset between left and right
  1606. channel. An offset of 0 means that both LFO shapes match each other.
  1607. The left and right channel are altered equally - a conventional tremolo.
  1608. An offset of 50% means that the shape of the right channel is exactly shifted
  1609. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1610. an autopanner. At 1 both curves match again. Every setting in between moves the
  1611. phase shift gapless between all stages and produces some "bypassing" sounds with
  1612. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1613. the 0.5) the faster the signal passes from the left to the right speaker.
  1614. The filter accepts the following options:
  1615. @table @option
  1616. @item level_in
  1617. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1618. @item level_out
  1619. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1620. @item mode
  1621. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1622. sawup or sawdown. Default is sine.
  1623. @item amount
  1624. Set modulation. Define how much of original signal is affected by the LFO.
  1625. @item offset_l
  1626. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1627. @item offset_r
  1628. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1629. @item width
  1630. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1631. @item timing
  1632. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1633. @item bpm
  1634. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1635. is set to bpm.
  1636. @item ms
  1637. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1638. is set to ms.
  1639. @item hz
  1640. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1641. if timing is set to hz.
  1642. @end table
  1643. @anchor{aresample}
  1644. @section aresample
  1645. Resample the input audio to the specified parameters, using the
  1646. libswresample library. If none are specified then the filter will
  1647. automatically convert between its input and output.
  1648. This filter is also able to stretch/squeeze the audio data to make it match
  1649. the timestamps or to inject silence / cut out audio to make it match the
  1650. timestamps, do a combination of both or do neither.
  1651. The filter accepts the syntax
  1652. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1653. expresses a sample rate and @var{resampler_options} is a list of
  1654. @var{key}=@var{value} pairs, separated by ":". See the
  1655. @ref{Resampler Options,,"Resampler Options" section in the
  1656. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1657. for the complete list of supported options.
  1658. @subsection Examples
  1659. @itemize
  1660. @item
  1661. Resample the input audio to 44100Hz:
  1662. @example
  1663. aresample=44100
  1664. @end example
  1665. @item
  1666. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1667. samples per second compensation:
  1668. @example
  1669. aresample=async=1000
  1670. @end example
  1671. @end itemize
  1672. @section areverse
  1673. Reverse an audio clip.
  1674. Warning: This filter requires memory to buffer the entire clip, so trimming
  1675. is suggested.
  1676. @subsection Examples
  1677. @itemize
  1678. @item
  1679. Take the first 5 seconds of a clip, and reverse it.
  1680. @example
  1681. atrim=end=5,areverse
  1682. @end example
  1683. @end itemize
  1684. @section arnndn
  1685. Reduce noise from speech using Recurrent Neural Networks.
  1686. This filter accepts the following options:
  1687. @table @option
  1688. @item model, m
  1689. Set train model file to load. This option is always required.
  1690. @end table
  1691. @section asetnsamples
  1692. Set the number of samples per each output audio frame.
  1693. The last output packet may contain a different number of samples, as
  1694. the filter will flush all the remaining samples when the input audio
  1695. signals its end.
  1696. The filter accepts the following options:
  1697. @table @option
  1698. @item nb_out_samples, n
  1699. Set the number of frames per each output audio frame. The number is
  1700. intended as the number of samples @emph{per each channel}.
  1701. Default value is 1024.
  1702. @item pad, p
  1703. If set to 1, the filter will pad the last audio frame with zeroes, so
  1704. that the last frame will contain the same number of samples as the
  1705. previous ones. Default value is 1.
  1706. @end table
  1707. For example, to set the number of per-frame samples to 1234 and
  1708. disable padding for the last frame, use:
  1709. @example
  1710. asetnsamples=n=1234:p=0
  1711. @end example
  1712. @section asetrate
  1713. Set the sample rate without altering the PCM data.
  1714. This will result in a change of speed and pitch.
  1715. The filter accepts the following options:
  1716. @table @option
  1717. @item sample_rate, r
  1718. Set the output sample rate. Default is 44100 Hz.
  1719. @end table
  1720. @section ashowinfo
  1721. Show a line containing various information for each input audio frame.
  1722. The input audio is not modified.
  1723. The shown line contains a sequence of key/value pairs of the form
  1724. @var{key}:@var{value}.
  1725. The following values are shown in the output:
  1726. @table @option
  1727. @item n
  1728. The (sequential) number of the input frame, starting from 0.
  1729. @item pts
  1730. The presentation timestamp of the input frame, in time base units; the time base
  1731. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1732. @item pts_time
  1733. The presentation timestamp of the input frame in seconds.
  1734. @item pos
  1735. position of the frame in the input stream, -1 if this information in
  1736. unavailable and/or meaningless (for example in case of synthetic audio)
  1737. @item fmt
  1738. The sample format.
  1739. @item chlayout
  1740. The channel layout.
  1741. @item rate
  1742. The sample rate for the audio frame.
  1743. @item nb_samples
  1744. The number of samples (per channel) in the frame.
  1745. @item checksum
  1746. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1747. audio, the data is treated as if all the planes were concatenated.
  1748. @item plane_checksums
  1749. A list of Adler-32 checksums for each data plane.
  1750. @end table
  1751. @section asoftclip
  1752. Apply audio soft clipping.
  1753. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1754. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1755. This filter accepts the following options:
  1756. @table @option
  1757. @item type
  1758. Set type of soft-clipping.
  1759. It accepts the following values:
  1760. @table @option
  1761. @item hard
  1762. @item tanh
  1763. @item atan
  1764. @item cubic
  1765. @item exp
  1766. @item alg
  1767. @item quintic
  1768. @item sin
  1769. @item erf
  1770. @end table
  1771. @item param
  1772. Set additional parameter which controls sigmoid function.
  1773. @end table
  1774. @subsection Commands
  1775. This filter supports the all above options as @ref{commands}.
  1776. @section asr
  1777. Automatic Speech Recognition
  1778. This filter uses PocketSphinx for speech recognition. To enable
  1779. compilation of this filter, you need to configure FFmpeg with
  1780. @code{--enable-pocketsphinx}.
  1781. It accepts the following options:
  1782. @table @option
  1783. @item rate
  1784. Set sampling rate of input audio. Defaults is @code{16000}.
  1785. This need to match speech models, otherwise one will get poor results.
  1786. @item hmm
  1787. Set dictionary containing acoustic model files.
  1788. @item dict
  1789. Set pronunciation dictionary.
  1790. @item lm
  1791. Set language model file.
  1792. @item lmctl
  1793. Set language model set.
  1794. @item lmname
  1795. Set which language model to use.
  1796. @item logfn
  1797. Set output for log messages.
  1798. @end table
  1799. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1800. @anchor{astats}
  1801. @section astats
  1802. Display time domain statistical information about the audio channels.
  1803. Statistics are calculated and displayed for each audio channel and,
  1804. where applicable, an overall figure is also given.
  1805. It accepts the following option:
  1806. @table @option
  1807. @item length
  1808. Short window length in seconds, used for peak and trough RMS measurement.
  1809. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1810. @item metadata
  1811. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1812. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1813. disabled.
  1814. Available keys for each channel are:
  1815. DC_offset
  1816. Min_level
  1817. Max_level
  1818. Min_difference
  1819. Max_difference
  1820. Mean_difference
  1821. RMS_difference
  1822. Peak_level
  1823. RMS_peak
  1824. RMS_trough
  1825. Crest_factor
  1826. Flat_factor
  1827. Peak_count
  1828. Noise_floor
  1829. Noise_floor_count
  1830. Bit_depth
  1831. Dynamic_range
  1832. Zero_crossings
  1833. Zero_crossings_rate
  1834. Number_of_NaNs
  1835. Number_of_Infs
  1836. Number_of_denormals
  1837. and for Overall:
  1838. DC_offset
  1839. Min_level
  1840. Max_level
  1841. Min_difference
  1842. Max_difference
  1843. Mean_difference
  1844. RMS_difference
  1845. Peak_level
  1846. RMS_level
  1847. RMS_peak
  1848. RMS_trough
  1849. Flat_factor
  1850. Peak_count
  1851. Noise_floor
  1852. Noise_floor_count
  1853. Bit_depth
  1854. Number_of_samples
  1855. Number_of_NaNs
  1856. Number_of_Infs
  1857. Number_of_denormals
  1858. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1859. this @code{lavfi.astats.Overall.Peak_count}.
  1860. For description what each key means read below.
  1861. @item reset
  1862. Set number of frame after which stats are going to be recalculated.
  1863. Default is disabled.
  1864. @item measure_perchannel
  1865. Select the entries which need to be measured per channel. The metadata keys can
  1866. be used as flags, default is @option{all} which measures everything.
  1867. @option{none} disables all per channel measurement.
  1868. @item measure_overall
  1869. Select the entries which need to be measured overall. The metadata keys can
  1870. be used as flags, default is @option{all} which measures everything.
  1871. @option{none} disables all overall measurement.
  1872. @end table
  1873. A description of each shown parameter follows:
  1874. @table @option
  1875. @item DC offset
  1876. Mean amplitude displacement from zero.
  1877. @item Min level
  1878. Minimal sample level.
  1879. @item Max level
  1880. Maximal sample level.
  1881. @item Min difference
  1882. Minimal difference between two consecutive samples.
  1883. @item Max difference
  1884. Maximal difference between two consecutive samples.
  1885. @item Mean difference
  1886. Mean difference between two consecutive samples.
  1887. The average of each difference between two consecutive samples.
  1888. @item RMS difference
  1889. Root Mean Square difference between two consecutive samples.
  1890. @item Peak level dB
  1891. @item RMS level dB
  1892. Standard peak and RMS level measured in dBFS.
  1893. @item RMS peak dB
  1894. @item RMS trough dB
  1895. Peak and trough values for RMS level measured over a short window.
  1896. @item Crest factor
  1897. Standard ratio of peak to RMS level (note: not in dB).
  1898. @item Flat factor
  1899. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1900. (i.e. either @var{Min level} or @var{Max level}).
  1901. @item Peak count
  1902. Number of occasions (not the number of samples) that the signal attained either
  1903. @var{Min level} or @var{Max level}.
  1904. @item Noise floor dB
  1905. Minimum local peak measured in dBFS over a short window.
  1906. @item Noise floor count
  1907. Number of occasions (not the number of samples) that the signal attained
  1908. @var{Noise floor}.
  1909. @item Bit depth
  1910. Overall bit depth of audio. Number of bits used for each sample.
  1911. @item Dynamic range
  1912. Measured dynamic range of audio in dB.
  1913. @item Zero crossings
  1914. Number of points where the waveform crosses the zero level axis.
  1915. @item Zero crossings rate
  1916. Rate of Zero crossings and number of audio samples.
  1917. @end table
  1918. @section asubboost
  1919. Boost subwoofer frequencies.
  1920. The filter accepts the following options:
  1921. @table @option
  1922. @item dry
  1923. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1924. Default value is 0.5.
  1925. @item wet
  1926. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1927. Default value is 0.8.
  1928. @item decay
  1929. Set delay line decay gain value. Allowed range is from 0 to 1.
  1930. Default value is 0.7.
  1931. @item feedback
  1932. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1933. Default value is 0.5.
  1934. @item cutoff
  1935. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1936. Default value is 100.
  1937. @item slope
  1938. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1939. Default value is 0.5.
  1940. @item delay
  1941. Set delay. Allowed range is from 1 to 100.
  1942. Default value is 20.
  1943. @end table
  1944. @subsection Commands
  1945. This filter supports the all above options as @ref{commands}.
  1946. @section atempo
  1947. Adjust audio tempo.
  1948. The filter accepts exactly one parameter, the audio tempo. If not
  1949. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1950. be in the [0.5, 100.0] range.
  1951. Note that tempo greater than 2 will skip some samples rather than
  1952. blend them in. If for any reason this is a concern it is always
  1953. possible to daisy-chain several instances of atempo to achieve the
  1954. desired product tempo.
  1955. @subsection Examples
  1956. @itemize
  1957. @item
  1958. Slow down audio to 80% tempo:
  1959. @example
  1960. atempo=0.8
  1961. @end example
  1962. @item
  1963. To speed up audio to 300% tempo:
  1964. @example
  1965. atempo=3
  1966. @end example
  1967. @item
  1968. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1969. @example
  1970. atempo=sqrt(3),atempo=sqrt(3)
  1971. @end example
  1972. @end itemize
  1973. @subsection Commands
  1974. This filter supports the following commands:
  1975. @table @option
  1976. @item tempo
  1977. Change filter tempo scale factor.
  1978. Syntax for the command is : "@var{tempo}"
  1979. @end table
  1980. @section atrim
  1981. Trim the input so that the output contains one continuous subpart of the input.
  1982. It accepts the following parameters:
  1983. @table @option
  1984. @item start
  1985. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1986. sample with the timestamp @var{start} will be the first sample in the output.
  1987. @item end
  1988. Specify time of the first audio sample that will be dropped, i.e. the
  1989. audio sample immediately preceding the one with the timestamp @var{end} will be
  1990. the last sample in the output.
  1991. @item start_pts
  1992. Same as @var{start}, except this option sets the start timestamp in samples
  1993. instead of seconds.
  1994. @item end_pts
  1995. Same as @var{end}, except this option sets the end timestamp in samples instead
  1996. of seconds.
  1997. @item duration
  1998. The maximum duration of the output in seconds.
  1999. @item start_sample
  2000. The number of the first sample that should be output.
  2001. @item end_sample
  2002. The number of the first sample that should be dropped.
  2003. @end table
  2004. @option{start}, @option{end}, and @option{duration} are expressed as time
  2005. duration specifications; see
  2006. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2007. Note that the first two sets of the start/end options and the @option{duration}
  2008. option look at the frame timestamp, while the _sample options simply count the
  2009. samples that pass through the filter. So start/end_pts and start/end_sample will
  2010. give different results when the timestamps are wrong, inexact or do not start at
  2011. zero. Also note that this filter does not modify the timestamps. If you wish
  2012. to have the output timestamps start at zero, insert the asetpts filter after the
  2013. atrim filter.
  2014. If multiple start or end options are set, this filter tries to be greedy and
  2015. keep all samples that match at least one of the specified constraints. To keep
  2016. only the part that matches all the constraints at once, chain multiple atrim
  2017. filters.
  2018. The defaults are such that all the input is kept. So it is possible to set e.g.
  2019. just the end values to keep everything before the specified time.
  2020. Examples:
  2021. @itemize
  2022. @item
  2023. Drop everything except the second minute of input:
  2024. @example
  2025. ffmpeg -i INPUT -af atrim=60:120
  2026. @end example
  2027. @item
  2028. Keep only the first 1000 samples:
  2029. @example
  2030. ffmpeg -i INPUT -af atrim=end_sample=1000
  2031. @end example
  2032. @end itemize
  2033. @section axcorrelate
  2034. Calculate normalized cross-correlation between two input audio streams.
  2035. Resulted samples are always between -1 and 1 inclusive.
  2036. If result is 1 it means two input samples are highly correlated in that selected segment.
  2037. Result 0 means they are not correlated at all.
  2038. If result is -1 it means two input samples are out of phase, which means they cancel each
  2039. other.
  2040. The filter accepts the following options:
  2041. @table @option
  2042. @item size
  2043. Set size of segment over which cross-correlation is calculated.
  2044. Default is 256. Allowed range is from 2 to 131072.
  2045. @item algo
  2046. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2047. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2048. are always zero and thus need much less calculations to make.
  2049. This is generally not true, but is valid for typical audio streams.
  2050. @end table
  2051. @subsection Examples
  2052. @itemize
  2053. @item
  2054. Calculate correlation between channels in stereo audio stream:
  2055. @example
  2056. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2057. @end example
  2058. @end itemize
  2059. @section bandpass
  2060. Apply a two-pole Butterworth band-pass filter with central
  2061. frequency @var{frequency}, and (3dB-point) band-width width.
  2062. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2063. instead of the default: constant 0dB peak gain.
  2064. The filter roll off at 6dB per octave (20dB per decade).
  2065. The filter accepts the following options:
  2066. @table @option
  2067. @item frequency, f
  2068. Set the filter's central frequency. Default is @code{3000}.
  2069. @item csg
  2070. Constant skirt gain if set to 1. Defaults to 0.
  2071. @item width_type, t
  2072. Set method to specify band-width of filter.
  2073. @table @option
  2074. @item h
  2075. Hz
  2076. @item q
  2077. Q-Factor
  2078. @item o
  2079. octave
  2080. @item s
  2081. slope
  2082. @item k
  2083. kHz
  2084. @end table
  2085. @item width, w
  2086. Specify the band-width of a filter in width_type units.
  2087. @item mix, m
  2088. How much to use filtered signal in output. Default is 1.
  2089. Range is between 0 and 1.
  2090. @item channels, c
  2091. Specify which channels to filter, by default all available are filtered.
  2092. @item normalize, n
  2093. Normalize biquad coefficients, by default is disabled.
  2094. Enabling it will normalize magnitude response at DC to 0dB.
  2095. @item transform, a
  2096. Set transform type of IIR filter.
  2097. @table @option
  2098. @item di
  2099. @item dii
  2100. @item tdii
  2101. @item latt
  2102. @end table
  2103. @end table
  2104. @subsection Commands
  2105. This filter supports the following commands:
  2106. @table @option
  2107. @item frequency, f
  2108. Change bandpass frequency.
  2109. Syntax for the command is : "@var{frequency}"
  2110. @item width_type, t
  2111. Change bandpass width_type.
  2112. Syntax for the command is : "@var{width_type}"
  2113. @item width, w
  2114. Change bandpass width.
  2115. Syntax for the command is : "@var{width}"
  2116. @item mix, m
  2117. Change bandpass mix.
  2118. Syntax for the command is : "@var{mix}"
  2119. @end table
  2120. @section bandreject
  2121. Apply a two-pole Butterworth band-reject filter with central
  2122. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2123. The filter roll off at 6dB per octave (20dB per decade).
  2124. The filter accepts the following options:
  2125. @table @option
  2126. @item frequency, f
  2127. Set the filter's central frequency. Default is @code{3000}.
  2128. @item width_type, t
  2129. Set method to specify band-width of filter.
  2130. @table @option
  2131. @item h
  2132. Hz
  2133. @item q
  2134. Q-Factor
  2135. @item o
  2136. octave
  2137. @item s
  2138. slope
  2139. @item k
  2140. kHz
  2141. @end table
  2142. @item width, w
  2143. Specify the band-width of a filter in width_type units.
  2144. @item mix, m
  2145. How much to use filtered signal in output. Default is 1.
  2146. Range is between 0 and 1.
  2147. @item channels, c
  2148. Specify which channels to filter, by default all available are filtered.
  2149. @item normalize, n
  2150. Normalize biquad coefficients, by default is disabled.
  2151. Enabling it will normalize magnitude response at DC to 0dB.
  2152. @item transform, a
  2153. Set transform type of IIR filter.
  2154. @table @option
  2155. @item di
  2156. @item dii
  2157. @item tdii
  2158. @item latt
  2159. @end table
  2160. @end table
  2161. @subsection Commands
  2162. This filter supports the following commands:
  2163. @table @option
  2164. @item frequency, f
  2165. Change bandreject frequency.
  2166. Syntax for the command is : "@var{frequency}"
  2167. @item width_type, t
  2168. Change bandreject width_type.
  2169. Syntax for the command is : "@var{width_type}"
  2170. @item width, w
  2171. Change bandreject width.
  2172. Syntax for the command is : "@var{width}"
  2173. @item mix, m
  2174. Change bandreject mix.
  2175. Syntax for the command is : "@var{mix}"
  2176. @end table
  2177. @section bass, lowshelf
  2178. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2179. shelving filter with a response similar to that of a standard
  2180. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2181. The filter accepts the following options:
  2182. @table @option
  2183. @item gain, g
  2184. Give the gain at 0 Hz. Its useful range is about -20
  2185. (for a large cut) to +20 (for a large boost).
  2186. Beware of clipping when using a positive gain.
  2187. @item frequency, f
  2188. Set the filter's central frequency and so can be used
  2189. to extend or reduce the frequency range to be boosted or cut.
  2190. The default value is @code{100} Hz.
  2191. @item width_type, t
  2192. Set method to specify band-width of filter.
  2193. @table @option
  2194. @item h
  2195. Hz
  2196. @item q
  2197. Q-Factor
  2198. @item o
  2199. octave
  2200. @item s
  2201. slope
  2202. @item k
  2203. kHz
  2204. @end table
  2205. @item width, w
  2206. Determine how steep is the filter's shelf transition.
  2207. @item mix, m
  2208. How much to use filtered signal in output. Default is 1.
  2209. Range is between 0 and 1.
  2210. @item channels, c
  2211. Specify which channels to filter, by default all available are filtered.
  2212. @item normalize, n
  2213. Normalize biquad coefficients, by default is disabled.
  2214. Enabling it will normalize magnitude response at DC to 0dB.
  2215. @item transform, a
  2216. Set transform type of IIR filter.
  2217. @table @option
  2218. @item di
  2219. @item dii
  2220. @item tdii
  2221. @item latt
  2222. @end table
  2223. @end table
  2224. @subsection Commands
  2225. This filter supports the following commands:
  2226. @table @option
  2227. @item frequency, f
  2228. Change bass frequency.
  2229. Syntax for the command is : "@var{frequency}"
  2230. @item width_type, t
  2231. Change bass width_type.
  2232. Syntax for the command is : "@var{width_type}"
  2233. @item width, w
  2234. Change bass width.
  2235. Syntax for the command is : "@var{width}"
  2236. @item gain, g
  2237. Change bass gain.
  2238. Syntax for the command is : "@var{gain}"
  2239. @item mix, m
  2240. Change bass mix.
  2241. Syntax for the command is : "@var{mix}"
  2242. @end table
  2243. @section biquad
  2244. Apply a biquad IIR filter with the given coefficients.
  2245. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2246. are the numerator and denominator coefficients respectively.
  2247. and @var{channels}, @var{c} specify which channels to filter, by default all
  2248. available are filtered.
  2249. @subsection Commands
  2250. This filter supports the following commands:
  2251. @table @option
  2252. @item a0
  2253. @item a1
  2254. @item a2
  2255. @item b0
  2256. @item b1
  2257. @item b2
  2258. Change biquad parameter.
  2259. Syntax for the command is : "@var{value}"
  2260. @item mix, m
  2261. How much to use filtered signal in output. Default is 1.
  2262. Range is between 0 and 1.
  2263. @item channels, c
  2264. Specify which channels to filter, by default all available are filtered.
  2265. @item normalize, n
  2266. Normalize biquad coefficients, by default is disabled.
  2267. Enabling it will normalize magnitude response at DC to 0dB.
  2268. @item transform, a
  2269. Set transform type of IIR filter.
  2270. @table @option
  2271. @item di
  2272. @item dii
  2273. @item tdii
  2274. @item latt
  2275. @end table
  2276. @end table
  2277. @section bs2b
  2278. Bauer stereo to binaural transformation, which improves headphone listening of
  2279. stereo audio records.
  2280. To enable compilation of this filter you need to configure FFmpeg with
  2281. @code{--enable-libbs2b}.
  2282. It accepts the following parameters:
  2283. @table @option
  2284. @item profile
  2285. Pre-defined crossfeed level.
  2286. @table @option
  2287. @item default
  2288. Default level (fcut=700, feed=50).
  2289. @item cmoy
  2290. Chu Moy circuit (fcut=700, feed=60).
  2291. @item jmeier
  2292. Jan Meier circuit (fcut=650, feed=95).
  2293. @end table
  2294. @item fcut
  2295. Cut frequency (in Hz).
  2296. @item feed
  2297. Feed level (in Hz).
  2298. @end table
  2299. @section channelmap
  2300. Remap input channels to new locations.
  2301. It accepts the following parameters:
  2302. @table @option
  2303. @item map
  2304. Map channels from input to output. The argument is a '|'-separated list of
  2305. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2306. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2307. channel (e.g. FL for front left) or its index in the input channel layout.
  2308. @var{out_channel} is the name of the output channel or its index in the output
  2309. channel layout. If @var{out_channel} is not given then it is implicitly an
  2310. index, starting with zero and increasing by one for each mapping.
  2311. @item channel_layout
  2312. The channel layout of the output stream.
  2313. @end table
  2314. If no mapping is present, the filter will implicitly map input channels to
  2315. output channels, preserving indices.
  2316. @subsection Examples
  2317. @itemize
  2318. @item
  2319. For example, assuming a 5.1+downmix input MOV file,
  2320. @example
  2321. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2322. @end example
  2323. will create an output WAV file tagged as stereo from the downmix channels of
  2324. the input.
  2325. @item
  2326. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2327. @example
  2328. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2329. @end example
  2330. @end itemize
  2331. @section channelsplit
  2332. Split each channel from an input audio stream into a separate output stream.
  2333. It accepts the following parameters:
  2334. @table @option
  2335. @item channel_layout
  2336. The channel layout of the input stream. The default is "stereo".
  2337. @item channels
  2338. A channel layout describing the channels to be extracted as separate output streams
  2339. or "all" to extract each input channel as a separate stream. The default is "all".
  2340. Choosing channels not present in channel layout in the input will result in an error.
  2341. @end table
  2342. @subsection Examples
  2343. @itemize
  2344. @item
  2345. For example, assuming a stereo input MP3 file,
  2346. @example
  2347. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2348. @end example
  2349. will create an output Matroska file with two audio streams, one containing only
  2350. the left channel and the other the right channel.
  2351. @item
  2352. Split a 5.1 WAV file into per-channel files:
  2353. @example
  2354. ffmpeg -i in.wav -filter_complex
  2355. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2356. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2357. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2358. side_right.wav
  2359. @end example
  2360. @item
  2361. Extract only LFE from a 5.1 WAV file:
  2362. @example
  2363. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2364. -map '[LFE]' lfe.wav
  2365. @end example
  2366. @end itemize
  2367. @section chorus
  2368. Add a chorus effect to the audio.
  2369. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2370. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2371. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2372. The modulation depth defines the range the modulated delay is played before or after
  2373. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2374. sound tuned around the original one, like in a chorus where some vocals are slightly
  2375. off key.
  2376. It accepts the following parameters:
  2377. @table @option
  2378. @item in_gain
  2379. Set input gain. Default is 0.4.
  2380. @item out_gain
  2381. Set output gain. Default is 0.4.
  2382. @item delays
  2383. Set delays. A typical delay is around 40ms to 60ms.
  2384. @item decays
  2385. Set decays.
  2386. @item speeds
  2387. Set speeds.
  2388. @item depths
  2389. Set depths.
  2390. @end table
  2391. @subsection Examples
  2392. @itemize
  2393. @item
  2394. A single delay:
  2395. @example
  2396. chorus=0.7:0.9:55:0.4:0.25:2
  2397. @end example
  2398. @item
  2399. Two delays:
  2400. @example
  2401. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2402. @end example
  2403. @item
  2404. Fuller sounding chorus with three delays:
  2405. @example
  2406. 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
  2407. @end example
  2408. @end itemize
  2409. @section compand
  2410. Compress or expand the audio's dynamic range.
  2411. It accepts the following parameters:
  2412. @table @option
  2413. @item attacks
  2414. @item decays
  2415. A list of times in seconds for each channel over which the instantaneous level
  2416. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2417. increase of volume and @var{decays} refers to decrease of volume. For most
  2418. situations, the attack time (response to the audio getting louder) should be
  2419. shorter than the decay time, because the human ear is more sensitive to sudden
  2420. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2421. a typical value for decay is 0.8 seconds.
  2422. If specified number of attacks & decays is lower than number of channels, the last
  2423. set attack/decay will be used for all remaining channels.
  2424. @item points
  2425. A list of points for the transfer function, specified in dB relative to the
  2426. maximum possible signal amplitude. Each key points list must be defined using
  2427. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2428. @code{x0/y0 x1/y1 x2/y2 ....}
  2429. The input values must be in strictly increasing order but the transfer function
  2430. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2431. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2432. function are @code{-70/-70|-60/-20|1/0}.
  2433. @item soft-knee
  2434. Set the curve radius in dB for all joints. It defaults to 0.01.
  2435. @item gain
  2436. Set the additional gain in dB to be applied at all points on the transfer
  2437. function. This allows for easy adjustment of the overall gain.
  2438. It defaults to 0.
  2439. @item volume
  2440. Set an initial volume, in dB, to be assumed for each channel when filtering
  2441. starts. This permits the user to supply a nominal level initially, so that, for
  2442. example, a very large gain is not applied to initial signal levels before the
  2443. companding has begun to operate. A typical value for audio which is initially
  2444. quiet is -90 dB. It defaults to 0.
  2445. @item delay
  2446. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2447. delayed before being fed to the volume adjuster. Specifying a delay
  2448. approximately equal to the attack/decay times allows the filter to effectively
  2449. operate in predictive rather than reactive mode. It defaults to 0.
  2450. @end table
  2451. @subsection Examples
  2452. @itemize
  2453. @item
  2454. Make music with both quiet and loud passages suitable for listening to in a
  2455. noisy environment:
  2456. @example
  2457. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2458. @end example
  2459. Another example for audio with whisper and explosion parts:
  2460. @example
  2461. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2462. @end example
  2463. @item
  2464. A noise gate for when the noise is at a lower level than the signal:
  2465. @example
  2466. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2467. @end example
  2468. @item
  2469. Here is another noise gate, this time for when the noise is at a higher level
  2470. than the signal (making it, in some ways, similar to squelch):
  2471. @example
  2472. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2473. @end example
  2474. @item
  2475. 2:1 compression starting at -6dB:
  2476. @example
  2477. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2478. @end example
  2479. @item
  2480. 2:1 compression starting at -9dB:
  2481. @example
  2482. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2483. @end example
  2484. @item
  2485. 2:1 compression starting at -12dB:
  2486. @example
  2487. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2488. @end example
  2489. @item
  2490. 2:1 compression starting at -18dB:
  2491. @example
  2492. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2493. @end example
  2494. @item
  2495. 3:1 compression starting at -15dB:
  2496. @example
  2497. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2498. @end example
  2499. @item
  2500. Compressor/Gate:
  2501. @example
  2502. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2503. @end example
  2504. @item
  2505. Expander:
  2506. @example
  2507. 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
  2508. @end example
  2509. @item
  2510. Hard limiter at -6dB:
  2511. @example
  2512. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2513. @end example
  2514. @item
  2515. Hard limiter at -12dB:
  2516. @example
  2517. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2518. @end example
  2519. @item
  2520. Hard noise gate at -35 dB:
  2521. @example
  2522. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2523. @end example
  2524. @item
  2525. Soft limiter:
  2526. @example
  2527. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2528. @end example
  2529. @end itemize
  2530. @section compensationdelay
  2531. Compensation Delay Line is a metric based delay to compensate differing
  2532. positions of microphones or speakers.
  2533. For example, you have recorded guitar with two microphones placed in
  2534. different locations. Because the front of sound wave has fixed speed in
  2535. normal conditions, the phasing of microphones can vary and depends on
  2536. their location and interposition. The best sound mix can be achieved when
  2537. these microphones are in phase (synchronized). Note that a distance of
  2538. ~30 cm between microphones makes one microphone capture the signal in
  2539. antiphase to the other microphone. That makes the final mix sound moody.
  2540. This filter helps to solve phasing problems by adding different delays
  2541. to each microphone track and make them synchronized.
  2542. The best result can be reached when you take one track as base and
  2543. synchronize other tracks one by one with it.
  2544. Remember that synchronization/delay tolerance depends on sample rate, too.
  2545. Higher sample rates will give more tolerance.
  2546. The filter accepts the following parameters:
  2547. @table @option
  2548. @item mm
  2549. Set millimeters distance. This is compensation distance for fine tuning.
  2550. Default is 0.
  2551. @item cm
  2552. Set cm distance. This is compensation distance for tightening distance setup.
  2553. Default is 0.
  2554. @item m
  2555. Set meters distance. This is compensation distance for hard distance setup.
  2556. Default is 0.
  2557. @item dry
  2558. Set dry amount. Amount of unprocessed (dry) signal.
  2559. Default is 0.
  2560. @item wet
  2561. Set wet amount. Amount of processed (wet) signal.
  2562. Default is 1.
  2563. @item temp
  2564. Set temperature in degrees Celsius. This is the temperature of the environment.
  2565. Default is 20.
  2566. @end table
  2567. @section crossfeed
  2568. Apply headphone crossfeed filter.
  2569. Crossfeed is the process of blending the left and right channels of stereo
  2570. audio recording.
  2571. It is mainly used to reduce extreme stereo separation of low frequencies.
  2572. The intent is to produce more speaker like sound to the listener.
  2573. The filter accepts the following options:
  2574. @table @option
  2575. @item strength
  2576. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2577. This sets gain of low shelf filter for side part of stereo image.
  2578. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2579. @item range
  2580. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2581. This sets cut off frequency of low shelf filter. Default is cut off near
  2582. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2583. @item slope
  2584. Set curve slope of low shelf filter. Default is 0.5.
  2585. Allowed range is from 0.01 to 1.
  2586. @item level_in
  2587. Set input gain. Default is 0.9.
  2588. @item level_out
  2589. Set output gain. Default is 1.
  2590. @end table
  2591. @subsection Commands
  2592. This filter supports the all above options as @ref{commands}.
  2593. @section crystalizer
  2594. Simple algorithm to expand audio dynamic range.
  2595. The filter accepts the following options:
  2596. @table @option
  2597. @item i
  2598. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2599. (unchanged sound) to 10.0 (maximum effect).
  2600. @item c
  2601. Enable clipping. By default is enabled.
  2602. @end table
  2603. @subsection Commands
  2604. This filter supports the all above options as @ref{commands}.
  2605. @section dcshift
  2606. Apply a DC shift to the audio.
  2607. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2608. in the recording chain) from the audio. The effect of a DC offset is reduced
  2609. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2610. a signal has a DC offset.
  2611. @table @option
  2612. @item shift
  2613. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2614. the audio.
  2615. @item limitergain
  2616. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2617. used to prevent clipping.
  2618. @end table
  2619. @section deesser
  2620. Apply de-essing to the audio samples.
  2621. @table @option
  2622. @item i
  2623. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2624. Default is 0.
  2625. @item m
  2626. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2627. Default is 0.5.
  2628. @item f
  2629. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2630. Default is 0.5.
  2631. @item s
  2632. Set the output mode.
  2633. It accepts the following values:
  2634. @table @option
  2635. @item i
  2636. Pass input unchanged.
  2637. @item o
  2638. Pass ess filtered out.
  2639. @item e
  2640. Pass only ess.
  2641. Default value is @var{o}.
  2642. @end table
  2643. @end table
  2644. @section drmeter
  2645. Measure audio dynamic range.
  2646. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2647. is found in transition material. And anything less that 8 have very poor dynamics
  2648. and is very compressed.
  2649. The filter accepts the following options:
  2650. @table @option
  2651. @item length
  2652. Set window length in seconds used to split audio into segments of equal length.
  2653. Default is 3 seconds.
  2654. @end table
  2655. @section dynaudnorm
  2656. Dynamic Audio Normalizer.
  2657. This filter applies a certain amount of gain to the input audio in order
  2658. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2659. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2660. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2661. This allows for applying extra gain to the "quiet" sections of the audio
  2662. while avoiding distortions or clipping the "loud" sections. In other words:
  2663. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2664. sections, in the sense that the volume of each section is brought to the
  2665. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2666. this goal *without* applying "dynamic range compressing". It will retain 100%
  2667. of the dynamic range *within* each section of the audio file.
  2668. @table @option
  2669. @item framelen, f
  2670. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2671. Default is 500 milliseconds.
  2672. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2673. referred to as frames. This is required, because a peak magnitude has no
  2674. meaning for just a single sample value. Instead, we need to determine the
  2675. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2676. normalizer would simply use the peak magnitude of the complete file, the
  2677. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2678. frame. The length of a frame is specified in milliseconds. By default, the
  2679. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2680. been found to give good results with most files.
  2681. Note that the exact frame length, in number of samples, will be determined
  2682. automatically, based on the sampling rate of the individual input audio file.
  2683. @item gausssize, g
  2684. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2685. number. Default is 31.
  2686. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2687. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2688. is specified in frames, centered around the current frame. For the sake of
  2689. simplicity, this must be an odd number. Consequently, the default value of 31
  2690. takes into account the current frame, as well as the 15 preceding frames and
  2691. the 15 subsequent frames. Using a larger window results in a stronger
  2692. smoothing effect and thus in less gain variation, i.e. slower gain
  2693. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2694. effect and thus in more gain variation, i.e. faster gain adaptation.
  2695. In other words, the more you increase this value, the more the Dynamic Audio
  2696. Normalizer will behave like a "traditional" normalization filter. On the
  2697. contrary, the more you decrease this value, the more the Dynamic Audio
  2698. Normalizer will behave like a dynamic range compressor.
  2699. @item peak, p
  2700. Set the target peak value. This specifies the highest permissible magnitude
  2701. level for the normalized audio input. This filter will try to approach the
  2702. target peak magnitude as closely as possible, but at the same time it also
  2703. makes sure that the normalized signal will never exceed the peak magnitude.
  2704. A frame's maximum local gain factor is imposed directly by the target peak
  2705. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2706. It is not recommended to go above this value.
  2707. @item maxgain, m
  2708. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2709. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2710. factor for each input frame, i.e. the maximum gain factor that does not
  2711. result in clipping or distortion. The maximum gain factor is determined by
  2712. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2713. additionally bounds the frame's maximum gain factor by a predetermined
  2714. (global) maximum gain factor. This is done in order to avoid excessive gain
  2715. factors in "silent" or almost silent frames. By default, the maximum gain
  2716. factor is 10.0, For most inputs the default value should be sufficient and
  2717. it usually is not recommended to increase this value. Though, for input
  2718. with an extremely low overall volume level, it may be necessary to allow even
  2719. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2720. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2721. Instead, a "sigmoid" threshold function will be applied. This way, the
  2722. gain factors will smoothly approach the threshold value, but never exceed that
  2723. value.
  2724. @item targetrms, r
  2725. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2726. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2727. This means that the maximum local gain factor for each frame is defined
  2728. (only) by the frame's highest magnitude sample. This way, the samples can
  2729. be amplified as much as possible without exceeding the maximum signal
  2730. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2731. Normalizer can also take into account the frame's root mean square,
  2732. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2733. determine the power of a time-varying signal. It is therefore considered
  2734. that the RMS is a better approximation of the "perceived loudness" than
  2735. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2736. frames to a constant RMS value, a uniform "perceived loudness" can be
  2737. established. If a target RMS value has been specified, a frame's local gain
  2738. factor is defined as the factor that would result in exactly that RMS value.
  2739. Note, however, that the maximum local gain factor is still restricted by the
  2740. frame's highest magnitude sample, in order to prevent clipping.
  2741. @item coupling, n
  2742. Enable channels coupling. By default is enabled.
  2743. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2744. amount. This means the same gain factor will be applied to all channels, i.e.
  2745. the maximum possible gain factor is determined by the "loudest" channel.
  2746. However, in some recordings, it may happen that the volume of the different
  2747. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2748. In this case, this option can be used to disable the channel coupling. This way,
  2749. the gain factor will be determined independently for each channel, depending
  2750. only on the individual channel's highest magnitude sample. This allows for
  2751. harmonizing the volume of the different channels.
  2752. @item correctdc, c
  2753. Enable DC bias correction. By default is disabled.
  2754. An audio signal (in the time domain) is a sequence of sample values.
  2755. In the Dynamic Audio Normalizer these sample values are represented in the
  2756. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2757. audio signal, or "waveform", should be centered around the zero point.
  2758. That means if we calculate the mean value of all samples in a file, or in a
  2759. single frame, then the result should be 0.0 or at least very close to that
  2760. value. If, however, there is a significant deviation of the mean value from
  2761. 0.0, in either positive or negative direction, this is referred to as a
  2762. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2763. Audio Normalizer provides optional DC bias correction.
  2764. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2765. the mean value, or "DC correction" offset, of each input frame and subtract
  2766. that value from all of the frame's sample values which ensures those samples
  2767. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2768. boundaries, the DC correction offset values will be interpolated smoothly
  2769. between neighbouring frames.
  2770. @item altboundary, b
  2771. Enable alternative boundary mode. By default is disabled.
  2772. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2773. around each frame. This includes the preceding frames as well as the
  2774. subsequent frames. However, for the "boundary" frames, located at the very
  2775. beginning and at the very end of the audio file, not all neighbouring
  2776. frames are available. In particular, for the first few frames in the audio
  2777. file, the preceding frames are not known. And, similarly, for the last few
  2778. frames in the audio file, the subsequent frames are not known. Thus, the
  2779. question arises which gain factors should be assumed for the missing frames
  2780. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2781. to deal with this situation. The default boundary mode assumes a gain factor
  2782. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2783. "fade out" at the beginning and at the end of the input, respectively.
  2784. @item compress, s
  2785. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2786. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2787. compression. This means that signal peaks will not be pruned and thus the
  2788. full dynamic range will be retained within each local neighbourhood. However,
  2789. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2790. normalization algorithm with a more "traditional" compression.
  2791. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2792. (thresholding) function. If (and only if) the compression feature is enabled,
  2793. all input frames will be processed by a soft knee thresholding function prior
  2794. to the actual normalization process. Put simply, the thresholding function is
  2795. going to prune all samples whose magnitude exceeds a certain threshold value.
  2796. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2797. value. Instead, the threshold value will be adjusted for each individual
  2798. frame.
  2799. In general, smaller parameters result in stronger compression, and vice versa.
  2800. Values below 3.0 are not recommended, because audible distortion may appear.
  2801. @item threshold, t
  2802. Set the target threshold value. This specifies the lowest permissible
  2803. magnitude level for the audio input which will be normalized.
  2804. If input frame volume is above this value frame will be normalized.
  2805. Otherwise frame may not be normalized at all. The default value is set
  2806. to 0, which means all input frames will be normalized.
  2807. This option is mostly useful if digital noise is not wanted to be amplified.
  2808. @end table
  2809. @subsection Commands
  2810. This filter supports the all above options as @ref{commands}.
  2811. @section earwax
  2812. Make audio easier to listen to on headphones.
  2813. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2814. so that when listened to on headphones the stereo image is moved from
  2815. inside your head (standard for headphones) to outside and in front of
  2816. the listener (standard for speakers).
  2817. Ported from SoX.
  2818. @section equalizer
  2819. Apply a two-pole peaking equalisation (EQ) filter. With this
  2820. filter, the signal-level at and around a selected frequency can
  2821. be increased or decreased, whilst (unlike bandpass and bandreject
  2822. filters) that at all other frequencies is unchanged.
  2823. In order to produce complex equalisation curves, this filter can
  2824. be given several times, each with a different central frequency.
  2825. The filter accepts the following options:
  2826. @table @option
  2827. @item frequency, f
  2828. Set the filter's central frequency in Hz.
  2829. @item width_type, t
  2830. Set method to specify band-width of filter.
  2831. @table @option
  2832. @item h
  2833. Hz
  2834. @item q
  2835. Q-Factor
  2836. @item o
  2837. octave
  2838. @item s
  2839. slope
  2840. @item k
  2841. kHz
  2842. @end table
  2843. @item width, w
  2844. Specify the band-width of a filter in width_type units.
  2845. @item gain, g
  2846. Set the required gain or attenuation in dB.
  2847. Beware of clipping when using a positive gain.
  2848. @item mix, m
  2849. How much to use filtered signal in output. Default is 1.
  2850. Range is between 0 and 1.
  2851. @item channels, c
  2852. Specify which channels to filter, by default all available are filtered.
  2853. @item normalize, n
  2854. Normalize biquad coefficients, by default is disabled.
  2855. Enabling it will normalize magnitude response at DC to 0dB.
  2856. @item transform, a
  2857. Set transform type of IIR filter.
  2858. @table @option
  2859. @item di
  2860. @item dii
  2861. @item tdii
  2862. @item latt
  2863. @end table
  2864. @end table
  2865. @subsection Examples
  2866. @itemize
  2867. @item
  2868. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2869. @example
  2870. equalizer=f=1000:t=h:width=200:g=-10
  2871. @end example
  2872. @item
  2873. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2874. @example
  2875. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2876. @end example
  2877. @end itemize
  2878. @subsection Commands
  2879. This filter supports the following commands:
  2880. @table @option
  2881. @item frequency, f
  2882. Change equalizer frequency.
  2883. Syntax for the command is : "@var{frequency}"
  2884. @item width_type, t
  2885. Change equalizer width_type.
  2886. Syntax for the command is : "@var{width_type}"
  2887. @item width, w
  2888. Change equalizer width.
  2889. Syntax for the command is : "@var{width}"
  2890. @item gain, g
  2891. Change equalizer gain.
  2892. Syntax for the command is : "@var{gain}"
  2893. @item mix, m
  2894. Change equalizer mix.
  2895. Syntax for the command is : "@var{mix}"
  2896. @end table
  2897. @section extrastereo
  2898. Linearly increases the difference between left and right channels which
  2899. adds some sort of "live" effect to playback.
  2900. The filter accepts the following options:
  2901. @table @option
  2902. @item m
  2903. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2904. (average of both channels), with 1.0 sound will be unchanged, with
  2905. -1.0 left and right channels will be swapped.
  2906. @item c
  2907. Enable clipping. By default is enabled.
  2908. @end table
  2909. @subsection Commands
  2910. This filter supports the all above options as @ref{commands}.
  2911. @section firequalizer
  2912. Apply FIR Equalization using arbitrary frequency response.
  2913. The filter accepts the following option:
  2914. @table @option
  2915. @item gain
  2916. Set gain curve equation (in dB). The expression can contain variables:
  2917. @table @option
  2918. @item f
  2919. the evaluated frequency
  2920. @item sr
  2921. sample rate
  2922. @item ch
  2923. channel number, set to 0 when multichannels evaluation is disabled
  2924. @item chid
  2925. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2926. multichannels evaluation is disabled
  2927. @item chs
  2928. number of channels
  2929. @item chlayout
  2930. channel_layout, see libavutil/channel_layout.h
  2931. @end table
  2932. and functions:
  2933. @table @option
  2934. @item gain_interpolate(f)
  2935. interpolate gain on frequency f based on gain_entry
  2936. @item cubic_interpolate(f)
  2937. same as gain_interpolate, but smoother
  2938. @end table
  2939. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2940. @item gain_entry
  2941. Set gain entry for gain_interpolate function. The expression can
  2942. contain functions:
  2943. @table @option
  2944. @item entry(f, g)
  2945. store gain entry at frequency f with value g
  2946. @end table
  2947. This option is also available as command.
  2948. @item delay
  2949. Set filter delay in seconds. Higher value means more accurate.
  2950. Default is @code{0.01}.
  2951. @item accuracy
  2952. Set filter accuracy in Hz. Lower value means more accurate.
  2953. Default is @code{5}.
  2954. @item wfunc
  2955. Set window function. Acceptable values are:
  2956. @table @option
  2957. @item rectangular
  2958. rectangular window, useful when gain curve is already smooth
  2959. @item hann
  2960. hann window (default)
  2961. @item hamming
  2962. hamming window
  2963. @item blackman
  2964. blackman window
  2965. @item nuttall3
  2966. 3-terms continuous 1st derivative nuttall window
  2967. @item mnuttall3
  2968. minimum 3-terms discontinuous nuttall window
  2969. @item nuttall
  2970. 4-terms continuous 1st derivative nuttall window
  2971. @item bnuttall
  2972. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2973. @item bharris
  2974. blackman-harris window
  2975. @item tukey
  2976. tukey window
  2977. @end table
  2978. @item fixed
  2979. If enabled, use fixed number of audio samples. This improves speed when
  2980. filtering with large delay. Default is disabled.
  2981. @item multi
  2982. Enable multichannels evaluation on gain. Default is disabled.
  2983. @item zero_phase
  2984. Enable zero phase mode by subtracting timestamp to compensate delay.
  2985. Default is disabled.
  2986. @item scale
  2987. Set scale used by gain. Acceptable values are:
  2988. @table @option
  2989. @item linlin
  2990. linear frequency, linear gain
  2991. @item linlog
  2992. linear frequency, logarithmic (in dB) gain (default)
  2993. @item loglin
  2994. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2995. @item loglog
  2996. logarithmic frequency, logarithmic gain
  2997. @end table
  2998. @item dumpfile
  2999. Set file for dumping, suitable for gnuplot.
  3000. @item dumpscale
  3001. Set scale for dumpfile. Acceptable values are same with scale option.
  3002. Default is linlog.
  3003. @item fft2
  3004. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3005. Default is disabled.
  3006. @item min_phase
  3007. Enable minimum phase impulse response. Default is disabled.
  3008. @end table
  3009. @subsection Examples
  3010. @itemize
  3011. @item
  3012. lowpass at 1000 Hz:
  3013. @example
  3014. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3015. @end example
  3016. @item
  3017. lowpass at 1000 Hz with gain_entry:
  3018. @example
  3019. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3020. @end example
  3021. @item
  3022. custom equalization:
  3023. @example
  3024. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3025. @end example
  3026. @item
  3027. higher delay with zero phase to compensate delay:
  3028. @example
  3029. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3030. @end example
  3031. @item
  3032. lowpass on left channel, highpass on right channel:
  3033. @example
  3034. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3035. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3036. @end example
  3037. @end itemize
  3038. @section flanger
  3039. Apply a flanging effect to the audio.
  3040. The filter accepts the following options:
  3041. @table @option
  3042. @item delay
  3043. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3044. @item depth
  3045. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3046. @item regen
  3047. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3048. Default value is 0.
  3049. @item width
  3050. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3051. Default value is 71.
  3052. @item speed
  3053. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3054. @item shape
  3055. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3056. Default value is @var{sinusoidal}.
  3057. @item phase
  3058. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3059. Default value is 25.
  3060. @item interp
  3061. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3062. Default is @var{linear}.
  3063. @end table
  3064. @section haas
  3065. Apply Haas effect to audio.
  3066. Note that this makes most sense to apply on mono signals.
  3067. With this filter applied to mono signals it give some directionality and
  3068. stretches its stereo image.
  3069. The filter accepts the following options:
  3070. @table @option
  3071. @item level_in
  3072. Set input level. By default is @var{1}, or 0dB
  3073. @item level_out
  3074. Set output level. By default is @var{1}, or 0dB.
  3075. @item side_gain
  3076. Set gain applied to side part of signal. By default is @var{1}.
  3077. @item middle_source
  3078. Set kind of middle source. Can be one of the following:
  3079. @table @samp
  3080. @item left
  3081. Pick left channel.
  3082. @item right
  3083. Pick right channel.
  3084. @item mid
  3085. Pick middle part signal of stereo image.
  3086. @item side
  3087. Pick side part signal of stereo image.
  3088. @end table
  3089. @item middle_phase
  3090. Change middle phase. By default is disabled.
  3091. @item left_delay
  3092. Set left channel delay. By default is @var{2.05} milliseconds.
  3093. @item left_balance
  3094. Set left channel balance. By default is @var{-1}.
  3095. @item left_gain
  3096. Set left channel gain. By default is @var{1}.
  3097. @item left_phase
  3098. Change left phase. By default is disabled.
  3099. @item right_delay
  3100. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3101. @item right_balance
  3102. Set right channel balance. By default is @var{1}.
  3103. @item right_gain
  3104. Set right channel gain. By default is @var{1}.
  3105. @item right_phase
  3106. Change right phase. By default is enabled.
  3107. @end table
  3108. @section hdcd
  3109. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3110. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3111. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3112. of HDCD, and detects the Transient Filter flag.
  3113. @example
  3114. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3115. @end example
  3116. When using the filter with wav, note the default encoding for wav is 16-bit,
  3117. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3118. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3119. @example
  3120. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3121. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3122. @end example
  3123. The filter accepts the following options:
  3124. @table @option
  3125. @item disable_autoconvert
  3126. Disable any automatic format conversion or resampling in the filter graph.
  3127. @item process_stereo
  3128. Process the stereo channels together. If target_gain does not match between
  3129. channels, consider it invalid and use the last valid target_gain.
  3130. @item cdt_ms
  3131. Set the code detect timer period in ms.
  3132. @item force_pe
  3133. Always extend peaks above -3dBFS even if PE isn't signaled.
  3134. @item analyze_mode
  3135. Replace audio with a solid tone and adjust the amplitude to signal some
  3136. specific aspect of the decoding process. The output file can be loaded in
  3137. an audio editor alongside the original to aid analysis.
  3138. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3139. Modes are:
  3140. @table @samp
  3141. @item 0, off
  3142. Disabled
  3143. @item 1, lle
  3144. Gain adjustment level at each sample
  3145. @item 2, pe
  3146. Samples where peak extend occurs
  3147. @item 3, cdt
  3148. Samples where the code detect timer is active
  3149. @item 4, tgm
  3150. Samples where the target gain does not match between channels
  3151. @end table
  3152. @end table
  3153. @section headphone
  3154. Apply head-related transfer functions (HRTFs) to create virtual
  3155. loudspeakers around the user for binaural listening via headphones.
  3156. The HRIRs are provided via additional streams, for each channel
  3157. one stereo input stream is needed.
  3158. The filter accepts the following options:
  3159. @table @option
  3160. @item map
  3161. Set mapping of input streams for convolution.
  3162. The argument is a '|'-separated list of channel names in order as they
  3163. are given as additional stream inputs for filter.
  3164. This also specify number of input streams. Number of input streams
  3165. must be not less than number of channels in first stream plus one.
  3166. @item gain
  3167. Set gain applied to audio. Value is in dB. Default is 0.
  3168. @item type
  3169. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3170. processing audio in time domain which is slow.
  3171. @var{freq} is processing audio in frequency domain which is fast.
  3172. Default is @var{freq}.
  3173. @item lfe
  3174. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3175. @item size
  3176. Set size of frame in number of samples which will be processed at once.
  3177. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3178. @item hrir
  3179. Set format of hrir stream.
  3180. Default value is @var{stereo}. Alternative value is @var{multich}.
  3181. If value is set to @var{stereo}, number of additional streams should
  3182. be greater or equal to number of input channels in first input stream.
  3183. Also each additional stream should have stereo number of channels.
  3184. If value is set to @var{multich}, number of additional streams should
  3185. be exactly one. Also number of input channels of additional stream
  3186. should be equal or greater than twice number of channels of first input
  3187. stream.
  3188. @end table
  3189. @subsection Examples
  3190. @itemize
  3191. @item
  3192. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3193. each amovie filter use stereo file with IR coefficients as input.
  3194. The files give coefficients for each position of virtual loudspeaker:
  3195. @example
  3196. ffmpeg -i input.wav
  3197. -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"
  3198. output.wav
  3199. @end example
  3200. @item
  3201. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3202. but now in @var{multich} @var{hrir} format.
  3203. @example
  3204. 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"
  3205. output.wav
  3206. @end example
  3207. @end itemize
  3208. @section highpass
  3209. Apply a high-pass filter with 3dB point frequency.
  3210. The filter can be either single-pole, or double-pole (the default).
  3211. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3212. The filter accepts the following options:
  3213. @table @option
  3214. @item frequency, f
  3215. Set frequency in Hz. Default is 3000.
  3216. @item poles, p
  3217. Set number of poles. Default is 2.
  3218. @item width_type, t
  3219. Set method to specify band-width of filter.
  3220. @table @option
  3221. @item h
  3222. Hz
  3223. @item q
  3224. Q-Factor
  3225. @item o
  3226. octave
  3227. @item s
  3228. slope
  3229. @item k
  3230. kHz
  3231. @end table
  3232. @item width, w
  3233. Specify the band-width of a filter in width_type units.
  3234. Applies only to double-pole filter.
  3235. The default is 0.707q and gives a Butterworth response.
  3236. @item mix, m
  3237. How much to use filtered signal in output. Default is 1.
  3238. Range is between 0 and 1.
  3239. @item channels, c
  3240. Specify which channels to filter, by default all available are filtered.
  3241. @item normalize, n
  3242. Normalize biquad coefficients, by default is disabled.
  3243. Enabling it will normalize magnitude response at DC to 0dB.
  3244. @item transform, a
  3245. Set transform type of IIR filter.
  3246. @table @option
  3247. @item di
  3248. @item dii
  3249. @item tdii
  3250. @item latt
  3251. @end table
  3252. @end table
  3253. @subsection Commands
  3254. This filter supports the following commands:
  3255. @table @option
  3256. @item frequency, f
  3257. Change highpass frequency.
  3258. Syntax for the command is : "@var{frequency}"
  3259. @item width_type, t
  3260. Change highpass width_type.
  3261. Syntax for the command is : "@var{width_type}"
  3262. @item width, w
  3263. Change highpass width.
  3264. Syntax for the command is : "@var{width}"
  3265. @item mix, m
  3266. Change highpass mix.
  3267. Syntax for the command is : "@var{mix}"
  3268. @end table
  3269. @section join
  3270. Join multiple input streams into one multi-channel stream.
  3271. It accepts the following parameters:
  3272. @table @option
  3273. @item inputs
  3274. The number of input streams. It defaults to 2.
  3275. @item channel_layout
  3276. The desired output channel layout. It defaults to stereo.
  3277. @item map
  3278. Map channels from inputs to output. The argument is a '|'-separated list of
  3279. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3280. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3281. can be either the name of the input channel (e.g. FL for front left) or its
  3282. index in the specified input stream. @var{out_channel} is the name of the output
  3283. channel.
  3284. @end table
  3285. The filter will attempt to guess the mappings when they are not specified
  3286. explicitly. It does so by first trying to find an unused matching input channel
  3287. and if that fails it picks the first unused input channel.
  3288. Join 3 inputs (with properly set channel layouts):
  3289. @example
  3290. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3291. @end example
  3292. Build a 5.1 output from 6 single-channel streams:
  3293. @example
  3294. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3295. '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'
  3296. out
  3297. @end example
  3298. @section ladspa
  3299. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3300. To enable compilation of this filter you need to configure FFmpeg with
  3301. @code{--enable-ladspa}.
  3302. @table @option
  3303. @item file, f
  3304. Specifies the name of LADSPA plugin library to load. If the environment
  3305. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3306. each one of the directories specified by the colon separated list in
  3307. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3308. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3309. @file{/usr/lib/ladspa/}.
  3310. @item plugin, p
  3311. Specifies the plugin within the library. Some libraries contain only
  3312. one plugin, but others contain many of them. If this is not set filter
  3313. will list all available plugins within the specified library.
  3314. @item controls, c
  3315. Set the '|' separated list of controls which are zero or more floating point
  3316. values that determine the behavior of the loaded plugin (for example delay,
  3317. threshold or gain).
  3318. Controls need to be defined using the following syntax:
  3319. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3320. @var{valuei} is the value set on the @var{i}-th control.
  3321. Alternatively they can be also defined using the following syntax:
  3322. @var{value0}|@var{value1}|@var{value2}|..., where
  3323. @var{valuei} is the value set on the @var{i}-th control.
  3324. If @option{controls} is set to @code{help}, all available controls and
  3325. their valid ranges are printed.
  3326. @item sample_rate, s
  3327. Specify the sample rate, default to 44100. Only used if plugin have
  3328. zero inputs.
  3329. @item nb_samples, n
  3330. Set the number of samples per channel per each output frame, default
  3331. is 1024. Only used if plugin have zero inputs.
  3332. @item duration, d
  3333. Set the minimum duration of the sourced audio. See
  3334. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3335. for the accepted syntax.
  3336. Note that the resulting duration may be greater than the specified duration,
  3337. as the generated audio is always cut at the end of a complete frame.
  3338. If not specified, or the expressed duration is negative, the audio is
  3339. supposed to be generated forever.
  3340. Only used if plugin have zero inputs.
  3341. @item latency, l
  3342. Enable latency compensation, by default is disabled.
  3343. Only used if plugin have inputs.
  3344. @end table
  3345. @subsection Examples
  3346. @itemize
  3347. @item
  3348. List all available plugins within amp (LADSPA example plugin) library:
  3349. @example
  3350. ladspa=file=amp
  3351. @end example
  3352. @item
  3353. List all available controls and their valid ranges for @code{vcf_notch}
  3354. plugin from @code{VCF} library:
  3355. @example
  3356. ladspa=f=vcf:p=vcf_notch:c=help
  3357. @end example
  3358. @item
  3359. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3360. plugin library:
  3361. @example
  3362. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3363. @end example
  3364. @item
  3365. Add reverberation to the audio using TAP-plugins
  3366. (Tom's Audio Processing plugins):
  3367. @example
  3368. ladspa=file=tap_reverb:tap_reverb
  3369. @end example
  3370. @item
  3371. Generate white noise, with 0.2 amplitude:
  3372. @example
  3373. ladspa=file=cmt:noise_source_white:c=c0=.2
  3374. @end example
  3375. @item
  3376. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3377. @code{C* Audio Plugin Suite} (CAPS) library:
  3378. @example
  3379. ladspa=file=caps:Click:c=c1=20'
  3380. @end example
  3381. @item
  3382. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3383. @example
  3384. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3385. @end example
  3386. @item
  3387. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3388. @code{SWH Plugins} collection:
  3389. @example
  3390. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3391. @end example
  3392. @item
  3393. Attenuate low frequencies using Multiband EQ from Steve Harris
  3394. @code{SWH Plugins} collection:
  3395. @example
  3396. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3397. @end example
  3398. @item
  3399. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3400. (CAPS) library:
  3401. @example
  3402. ladspa=caps:Narrower
  3403. @end example
  3404. @item
  3405. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3406. @example
  3407. ladspa=caps:White:.2
  3408. @end example
  3409. @item
  3410. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3411. @example
  3412. ladspa=caps:Fractal:c=c1=1
  3413. @end example
  3414. @item
  3415. Dynamic volume normalization using @code{VLevel} plugin:
  3416. @example
  3417. ladspa=vlevel-ladspa:vlevel_mono
  3418. @end example
  3419. @end itemize
  3420. @subsection Commands
  3421. This filter supports the following commands:
  3422. @table @option
  3423. @item cN
  3424. Modify the @var{N}-th control value.
  3425. If the specified value is not valid, it is ignored and prior one is kept.
  3426. @end table
  3427. @section loudnorm
  3428. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3429. Support for both single pass (livestreams, files) and double pass (files) modes.
  3430. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3431. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3432. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3433. The filter accepts the following options:
  3434. @table @option
  3435. @item I, i
  3436. Set integrated loudness target.
  3437. Range is -70.0 - -5.0. Default value is -24.0.
  3438. @item LRA, lra
  3439. Set loudness range target.
  3440. Range is 1.0 - 20.0. Default value is 7.0.
  3441. @item TP, tp
  3442. Set maximum true peak.
  3443. Range is -9.0 - +0.0. Default value is -2.0.
  3444. @item measured_I, measured_i
  3445. Measured IL of input file.
  3446. Range is -99.0 - +0.0.
  3447. @item measured_LRA, measured_lra
  3448. Measured LRA of input file.
  3449. Range is 0.0 - 99.0.
  3450. @item measured_TP, measured_tp
  3451. Measured true peak of input file.
  3452. Range is -99.0 - +99.0.
  3453. @item measured_thresh
  3454. Measured threshold of input file.
  3455. Range is -99.0 - +0.0.
  3456. @item offset
  3457. Set offset gain. Gain is applied before the true-peak limiter.
  3458. Range is -99.0 - +99.0. Default is +0.0.
  3459. @item linear
  3460. Normalize by linearly scaling the source audio.
  3461. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3462. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3463. be lower than source LRA and the change in integrated loudness shouldn't
  3464. result in a true peak which exceeds the target TP. If any of these
  3465. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3466. Options are @code{true} or @code{false}. Default is @code{true}.
  3467. @item dual_mono
  3468. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3469. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3470. If set to @code{true}, this option will compensate for this effect.
  3471. Multi-channel input files are not affected by this option.
  3472. Options are true or false. Default is false.
  3473. @item print_format
  3474. Set print format for stats. Options are summary, json, or none.
  3475. Default value is none.
  3476. @end table
  3477. @section lowpass
  3478. Apply a low-pass filter with 3dB point frequency.
  3479. The filter can be either single-pole or double-pole (the default).
  3480. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3481. The filter accepts the following options:
  3482. @table @option
  3483. @item frequency, f
  3484. Set frequency in Hz. Default is 500.
  3485. @item poles, p
  3486. Set number of poles. Default is 2.
  3487. @item width_type, t
  3488. Set method to specify band-width of filter.
  3489. @table @option
  3490. @item h
  3491. Hz
  3492. @item q
  3493. Q-Factor
  3494. @item o
  3495. octave
  3496. @item s
  3497. slope
  3498. @item k
  3499. kHz
  3500. @end table
  3501. @item width, w
  3502. Specify the band-width of a filter in width_type units.
  3503. Applies only to double-pole filter.
  3504. The default is 0.707q and gives a Butterworth response.
  3505. @item mix, m
  3506. How much to use filtered signal in output. Default is 1.
  3507. Range is between 0 and 1.
  3508. @item channels, c
  3509. Specify which channels to filter, by default all available are filtered.
  3510. @item normalize, n
  3511. Normalize biquad coefficients, by default is disabled.
  3512. Enabling it will normalize magnitude response at DC to 0dB.
  3513. @item transform, a
  3514. Set transform type of IIR filter.
  3515. @table @option
  3516. @item di
  3517. @item dii
  3518. @item tdii
  3519. @item latt
  3520. @end table
  3521. @end table
  3522. @subsection Examples
  3523. @itemize
  3524. @item
  3525. Lowpass only LFE channel, it LFE is not present it does nothing:
  3526. @example
  3527. lowpass=c=LFE
  3528. @end example
  3529. @end itemize
  3530. @subsection Commands
  3531. This filter supports the following commands:
  3532. @table @option
  3533. @item frequency, f
  3534. Change lowpass frequency.
  3535. Syntax for the command is : "@var{frequency}"
  3536. @item width_type, t
  3537. Change lowpass width_type.
  3538. Syntax for the command is : "@var{width_type}"
  3539. @item width, w
  3540. Change lowpass width.
  3541. Syntax for the command is : "@var{width}"
  3542. @item mix, m
  3543. Change lowpass mix.
  3544. Syntax for the command is : "@var{mix}"
  3545. @end table
  3546. @section lv2
  3547. Load a LV2 (LADSPA Version 2) plugin.
  3548. To enable compilation of this filter you need to configure FFmpeg with
  3549. @code{--enable-lv2}.
  3550. @table @option
  3551. @item plugin, p
  3552. Specifies the plugin URI. You may need to escape ':'.
  3553. @item controls, c
  3554. Set the '|' separated list of controls which are zero or more floating point
  3555. values that determine the behavior of the loaded plugin (for example delay,
  3556. threshold or gain).
  3557. If @option{controls} is set to @code{help}, all available controls and
  3558. their valid ranges are printed.
  3559. @item sample_rate, s
  3560. Specify the sample rate, default to 44100. Only used if plugin have
  3561. zero inputs.
  3562. @item nb_samples, n
  3563. Set the number of samples per channel per each output frame, default
  3564. is 1024. Only used if plugin have zero inputs.
  3565. @item duration, d
  3566. Set the minimum duration of the sourced audio. See
  3567. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3568. for the accepted syntax.
  3569. Note that the resulting duration may be greater than the specified duration,
  3570. as the generated audio is always cut at the end of a complete frame.
  3571. If not specified, or the expressed duration is negative, the audio is
  3572. supposed to be generated forever.
  3573. Only used if plugin have zero inputs.
  3574. @end table
  3575. @subsection Examples
  3576. @itemize
  3577. @item
  3578. Apply bass enhancer plugin from Calf:
  3579. @example
  3580. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3581. @end example
  3582. @item
  3583. Apply vinyl plugin from Calf:
  3584. @example
  3585. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3586. @end example
  3587. @item
  3588. Apply bit crusher plugin from ArtyFX:
  3589. @example
  3590. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3591. @end example
  3592. @end itemize
  3593. @section mcompand
  3594. Multiband Compress or expand the audio's dynamic range.
  3595. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3596. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3597. response when absent compander action.
  3598. It accepts the following parameters:
  3599. @table @option
  3600. @item args
  3601. This option syntax is:
  3602. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3603. For explanation of each item refer to compand filter documentation.
  3604. @end table
  3605. @anchor{pan}
  3606. @section pan
  3607. Mix channels with specific gain levels. The filter accepts the output
  3608. channel layout followed by a set of channels definitions.
  3609. This filter is also designed to efficiently remap the channels of an audio
  3610. stream.
  3611. The filter accepts parameters of the form:
  3612. "@var{l}|@var{outdef}|@var{outdef}|..."
  3613. @table @option
  3614. @item l
  3615. output channel layout or number of channels
  3616. @item outdef
  3617. output channel specification, of the form:
  3618. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3619. @item out_name
  3620. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3621. number (c0, c1, etc.)
  3622. @item gain
  3623. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3624. @item in_name
  3625. input channel to use, see out_name for details; it is not possible to mix
  3626. named and numbered input channels
  3627. @end table
  3628. If the `=' in a channel specification is replaced by `<', then the gains for
  3629. that specification will be renormalized so that the total is 1, thus
  3630. avoiding clipping noise.
  3631. @subsection Mixing examples
  3632. For example, if you want to down-mix from stereo to mono, but with a bigger
  3633. factor for the left channel:
  3634. @example
  3635. pan=1c|c0=0.9*c0+0.1*c1
  3636. @end example
  3637. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3638. 7-channels surround:
  3639. @example
  3640. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3641. @end example
  3642. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3643. that should be preferred (see "-ac" option) unless you have very specific
  3644. needs.
  3645. @subsection Remapping examples
  3646. The channel remapping will be effective if, and only if:
  3647. @itemize
  3648. @item gain coefficients are zeroes or ones,
  3649. @item only one input per channel output,
  3650. @end itemize
  3651. If all these conditions are satisfied, the filter will notify the user ("Pure
  3652. channel mapping detected"), and use an optimized and lossless method to do the
  3653. remapping.
  3654. For example, if you have a 5.1 source and want a stereo audio stream by
  3655. dropping the extra channels:
  3656. @example
  3657. pan="stereo| c0=FL | c1=FR"
  3658. @end example
  3659. Given the same source, you can also switch front left and front right channels
  3660. and keep the input channel layout:
  3661. @example
  3662. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3663. @end example
  3664. If the input is a stereo audio stream, you can mute the front left channel (and
  3665. still keep the stereo channel layout) with:
  3666. @example
  3667. pan="stereo|c1=c1"
  3668. @end example
  3669. Still with a stereo audio stream input, you can copy the right channel in both
  3670. front left and right:
  3671. @example
  3672. pan="stereo| c0=FR | c1=FR"
  3673. @end example
  3674. @section replaygain
  3675. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3676. outputs it unchanged.
  3677. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3678. @section resample
  3679. Convert the audio sample format, sample rate and channel layout. It is
  3680. not meant to be used directly.
  3681. @section rubberband
  3682. Apply time-stretching and pitch-shifting with librubberband.
  3683. To enable compilation of this filter, you need to configure FFmpeg with
  3684. @code{--enable-librubberband}.
  3685. The filter accepts the following options:
  3686. @table @option
  3687. @item tempo
  3688. Set tempo scale factor.
  3689. @item pitch
  3690. Set pitch scale factor.
  3691. @item transients
  3692. Set transients detector.
  3693. Possible values are:
  3694. @table @var
  3695. @item crisp
  3696. @item mixed
  3697. @item smooth
  3698. @end table
  3699. @item detector
  3700. Set detector.
  3701. Possible values are:
  3702. @table @var
  3703. @item compound
  3704. @item percussive
  3705. @item soft
  3706. @end table
  3707. @item phase
  3708. Set phase.
  3709. Possible values are:
  3710. @table @var
  3711. @item laminar
  3712. @item independent
  3713. @end table
  3714. @item window
  3715. Set processing window size.
  3716. Possible values are:
  3717. @table @var
  3718. @item standard
  3719. @item short
  3720. @item long
  3721. @end table
  3722. @item smoothing
  3723. Set smoothing.
  3724. Possible values are:
  3725. @table @var
  3726. @item off
  3727. @item on
  3728. @end table
  3729. @item formant
  3730. Enable formant preservation when shift pitching.
  3731. Possible values are:
  3732. @table @var
  3733. @item shifted
  3734. @item preserved
  3735. @end table
  3736. @item pitchq
  3737. Set pitch quality.
  3738. Possible values are:
  3739. @table @var
  3740. @item quality
  3741. @item speed
  3742. @item consistency
  3743. @end table
  3744. @item channels
  3745. Set channels.
  3746. Possible values are:
  3747. @table @var
  3748. @item apart
  3749. @item together
  3750. @end table
  3751. @end table
  3752. @subsection Commands
  3753. This filter supports the following commands:
  3754. @table @option
  3755. @item tempo
  3756. Change filter tempo scale factor.
  3757. Syntax for the command is : "@var{tempo}"
  3758. @item pitch
  3759. Change filter pitch scale factor.
  3760. Syntax for the command is : "@var{pitch}"
  3761. @end table
  3762. @section sidechaincompress
  3763. This filter acts like normal compressor but has the ability to compress
  3764. detected signal using second input signal.
  3765. It needs two input streams and returns one output stream.
  3766. First input stream will be processed depending on second stream signal.
  3767. The filtered signal then can be filtered with other filters in later stages of
  3768. processing. See @ref{pan} and @ref{amerge} filter.
  3769. The filter accepts the following options:
  3770. @table @option
  3771. @item level_in
  3772. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3773. @item mode
  3774. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3775. Default is @code{downward}.
  3776. @item threshold
  3777. If a signal of second stream raises above this level it will affect the gain
  3778. reduction of first stream.
  3779. By default is 0.125. Range is between 0.00097563 and 1.
  3780. @item ratio
  3781. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3782. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3783. Default is 2. Range is between 1 and 20.
  3784. @item attack
  3785. Amount of milliseconds the signal has to rise above the threshold before gain
  3786. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3787. @item release
  3788. Amount of milliseconds the signal has to fall below the threshold before
  3789. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3790. @item makeup
  3791. Set the amount by how much signal will be amplified after processing.
  3792. Default is 1. Range is from 1 to 64.
  3793. @item knee
  3794. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3795. Default is 2.82843. Range is between 1 and 8.
  3796. @item link
  3797. Choose if the @code{average} level between all channels of side-chain stream
  3798. or the louder(@code{maximum}) channel of side-chain stream affects the
  3799. reduction. Default is @code{average}.
  3800. @item detection
  3801. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3802. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3803. @item level_sc
  3804. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3805. @item mix
  3806. How much to use compressed signal in output. Default is 1.
  3807. Range is between 0 and 1.
  3808. @end table
  3809. @subsection Commands
  3810. This filter supports the all above options as @ref{commands}.
  3811. @subsection Examples
  3812. @itemize
  3813. @item
  3814. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3815. depending on the signal of 2nd input and later compressed signal to be
  3816. merged with 2nd input:
  3817. @example
  3818. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3819. @end example
  3820. @end itemize
  3821. @section sidechaingate
  3822. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3823. filter the detected signal before sending it to the gain reduction stage.
  3824. Normally a gate uses the full range signal to detect a level above the
  3825. threshold.
  3826. For example: If you cut all lower frequencies from your sidechain signal
  3827. the gate will decrease the volume of your track only if not enough highs
  3828. appear. With this technique you are able to reduce the resonation of a
  3829. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3830. guitar.
  3831. It needs two input streams and returns one output stream.
  3832. First input stream will be processed depending on second stream signal.
  3833. The filter accepts the following options:
  3834. @table @option
  3835. @item level_in
  3836. Set input level before filtering.
  3837. Default is 1. Allowed range is from 0.015625 to 64.
  3838. @item mode
  3839. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3840. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3841. will be amplified, expanding dynamic range in upward direction.
  3842. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3843. @item range
  3844. Set the level of gain reduction when the signal is below the threshold.
  3845. Default is 0.06125. Allowed range is from 0 to 1.
  3846. Setting this to 0 disables reduction and then filter behaves like expander.
  3847. @item threshold
  3848. If a signal rises above this level the gain reduction is released.
  3849. Default is 0.125. Allowed range is from 0 to 1.
  3850. @item ratio
  3851. Set a ratio about which the signal is reduced.
  3852. Default is 2. Allowed range is from 1 to 9000.
  3853. @item attack
  3854. Amount of milliseconds the signal has to rise above the threshold before gain
  3855. reduction stops.
  3856. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3857. @item release
  3858. Amount of milliseconds the signal has to fall below the threshold before the
  3859. reduction is increased again. Default is 250 milliseconds.
  3860. Allowed range is from 0.01 to 9000.
  3861. @item makeup
  3862. Set amount of amplification of signal after processing.
  3863. Default is 1. Allowed range is from 1 to 64.
  3864. @item knee
  3865. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3866. Default is 2.828427125. Allowed range is from 1 to 8.
  3867. @item detection
  3868. Choose if exact signal should be taken for detection or an RMS like one.
  3869. Default is rms. Can be peak or rms.
  3870. @item link
  3871. Choose if the average level between all channels or the louder channel affects
  3872. the reduction.
  3873. Default is average. Can be average or maximum.
  3874. @item level_sc
  3875. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3876. @end table
  3877. @section silencedetect
  3878. Detect silence in an audio stream.
  3879. This filter logs a message when it detects that the input audio volume is less
  3880. or equal to a noise tolerance value for a duration greater or equal to the
  3881. minimum detected noise duration.
  3882. The printed times and duration are expressed in seconds. The
  3883. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3884. is set on the first frame whose timestamp equals or exceeds the detection
  3885. duration and it contains the timestamp of the first frame of the silence.
  3886. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3887. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3888. keys are set on the first frame after the silence. If @option{mono} is
  3889. enabled, and each channel is evaluated separately, the @code{.X}
  3890. suffixed keys are used, and @code{X} corresponds to the channel number.
  3891. The filter accepts the following options:
  3892. @table @option
  3893. @item noise, n
  3894. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3895. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3896. @item duration, d
  3897. Set silence duration until notification (default is 2 seconds). See
  3898. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3899. for the accepted syntax.
  3900. @item mono, m
  3901. Process each channel separately, instead of combined. By default is disabled.
  3902. @end table
  3903. @subsection Examples
  3904. @itemize
  3905. @item
  3906. Detect 5 seconds of silence with -50dB noise tolerance:
  3907. @example
  3908. silencedetect=n=-50dB:d=5
  3909. @end example
  3910. @item
  3911. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3912. tolerance in @file{silence.mp3}:
  3913. @example
  3914. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3915. @end example
  3916. @end itemize
  3917. @section silenceremove
  3918. Remove silence from the beginning, middle or end of the audio.
  3919. The filter accepts the following options:
  3920. @table @option
  3921. @item start_periods
  3922. This value is used to indicate if audio should be trimmed at beginning of
  3923. the audio. A value of zero indicates no silence should be trimmed from the
  3924. beginning. When specifying a non-zero value, it trims audio up until it
  3925. finds non-silence. Normally, when trimming silence from beginning of audio
  3926. the @var{start_periods} will be @code{1} but it can be increased to higher
  3927. values to trim all audio up to specific count of non-silence periods.
  3928. Default value is @code{0}.
  3929. @item start_duration
  3930. Specify the amount of time that non-silence must be detected before it stops
  3931. trimming audio. By increasing the duration, bursts of noises can be treated
  3932. as silence and trimmed off. Default value is @code{0}.
  3933. @item start_threshold
  3934. This indicates what sample value should be treated as silence. For digital
  3935. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3936. you may wish to increase the value to account for background noise.
  3937. Can be specified in dB (in case "dB" is appended to the specified value)
  3938. or amplitude ratio. Default value is @code{0}.
  3939. @item start_silence
  3940. Specify max duration of silence at beginning that will be kept after
  3941. trimming. Default is 0, which is equal to trimming all samples detected
  3942. as silence.
  3943. @item start_mode
  3944. Specify mode of detection of silence end in start of multi-channel audio.
  3945. Can be @var{any} or @var{all}. Default is @var{any}.
  3946. With @var{any}, any sample that is detected as non-silence will cause
  3947. stopped trimming of silence.
  3948. With @var{all}, only if all channels are detected as non-silence will cause
  3949. stopped trimming of silence.
  3950. @item stop_periods
  3951. Set the count for trimming silence from the end of audio.
  3952. To remove silence from the middle of a file, specify a @var{stop_periods}
  3953. that is negative. This value is then treated as a positive value and is
  3954. used to indicate the effect should restart processing as specified by
  3955. @var{start_periods}, making it suitable for removing periods of silence
  3956. in the middle of the audio.
  3957. Default value is @code{0}.
  3958. @item stop_duration
  3959. Specify a duration of silence that must exist before audio is not copied any
  3960. more. By specifying a higher duration, silence that is wanted can be left in
  3961. the audio.
  3962. Default value is @code{0}.
  3963. @item stop_threshold
  3964. This is the same as @option{start_threshold} but for trimming silence from
  3965. the end of audio.
  3966. Can be specified in dB (in case "dB" is appended to the specified value)
  3967. or amplitude ratio. Default value is @code{0}.
  3968. @item stop_silence
  3969. Specify max duration of silence at end that will be kept after
  3970. trimming. Default is 0, which is equal to trimming all samples detected
  3971. as silence.
  3972. @item stop_mode
  3973. Specify mode of detection of silence start in end of multi-channel audio.
  3974. Can be @var{any} or @var{all}. Default is @var{any}.
  3975. With @var{any}, any sample that is detected as non-silence will cause
  3976. stopped trimming of silence.
  3977. With @var{all}, only if all channels are detected as non-silence will cause
  3978. stopped trimming of silence.
  3979. @item detection
  3980. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3981. and works better with digital silence which is exactly 0.
  3982. Default value is @code{rms}.
  3983. @item window
  3984. Set duration in number of seconds used to calculate size of window in number
  3985. of samples for detecting silence.
  3986. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3987. @end table
  3988. @subsection Examples
  3989. @itemize
  3990. @item
  3991. The following example shows how this filter can be used to start a recording
  3992. that does not contain the delay at the start which usually occurs between
  3993. pressing the record button and the start of the performance:
  3994. @example
  3995. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3996. @end example
  3997. @item
  3998. Trim all silence encountered from beginning to end where there is more than 1
  3999. second of silence in audio:
  4000. @example
  4001. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4002. @end example
  4003. @item
  4004. Trim all digital silence samples, using peak detection, from beginning to end
  4005. where there is more than 0 samples of digital silence in audio and digital
  4006. silence is detected in all channels at same positions in stream:
  4007. @example
  4008. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4009. @end example
  4010. @end itemize
  4011. @section sofalizer
  4012. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4013. loudspeakers around the user for binaural listening via headphones (audio
  4014. formats up to 9 channels supported).
  4015. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4016. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4017. Austrian Academy of Sciences.
  4018. To enable compilation of this filter you need to configure FFmpeg with
  4019. @code{--enable-libmysofa}.
  4020. The filter accepts the following options:
  4021. @table @option
  4022. @item sofa
  4023. Set the SOFA file used for rendering.
  4024. @item gain
  4025. Set gain applied to audio. Value is in dB. Default is 0.
  4026. @item rotation
  4027. Set rotation of virtual loudspeakers in deg. Default is 0.
  4028. @item elevation
  4029. Set elevation of virtual speakers in deg. Default is 0.
  4030. @item radius
  4031. Set distance in meters between loudspeakers and the listener with near-field
  4032. HRTFs. Default is 1.
  4033. @item type
  4034. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4035. processing audio in time domain which is slow.
  4036. @var{freq} is processing audio in frequency domain which is fast.
  4037. Default is @var{freq}.
  4038. @item speakers
  4039. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4040. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4041. Each virtual loudspeaker is described with short channel name following with
  4042. azimuth and elevation in degrees.
  4043. Each virtual loudspeaker description is separated by '|'.
  4044. For example to override front left and front right channel positions use:
  4045. 'speakers=FL 45 15|FR 345 15'.
  4046. Descriptions with unrecognised channel names are ignored.
  4047. @item lfegain
  4048. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4049. @item framesize
  4050. Set custom frame size in number of samples. Default is 1024.
  4051. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4052. is set to @var{freq}.
  4053. @item normalize
  4054. Should all IRs be normalized upon importing SOFA file.
  4055. By default is enabled.
  4056. @item interpolate
  4057. Should nearest IRs be interpolated with neighbor IRs if exact position
  4058. does not match. By default is disabled.
  4059. @item minphase
  4060. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4061. @item anglestep
  4062. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4063. @item radstep
  4064. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4065. @end table
  4066. @subsection Examples
  4067. @itemize
  4068. @item
  4069. Using ClubFritz6 sofa file:
  4070. @example
  4071. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4072. @end example
  4073. @item
  4074. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4075. @example
  4076. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4077. @end example
  4078. @item
  4079. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4080. and also with custom gain:
  4081. @example
  4082. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4083. @end example
  4084. @end itemize
  4085. @section stereotools
  4086. This filter has some handy utilities to manage stereo signals, for converting
  4087. M/S stereo recordings to L/R signal while having control over the parameters
  4088. or spreading the stereo image of master track.
  4089. The filter accepts the following options:
  4090. @table @option
  4091. @item level_in
  4092. Set input level before filtering for both channels. Defaults is 1.
  4093. Allowed range is from 0.015625 to 64.
  4094. @item level_out
  4095. Set output level after filtering for both channels. Defaults is 1.
  4096. Allowed range is from 0.015625 to 64.
  4097. @item balance_in
  4098. Set input balance between both channels. Default is 0.
  4099. Allowed range is from -1 to 1.
  4100. @item balance_out
  4101. Set output balance between both channels. Default is 0.
  4102. Allowed range is from -1 to 1.
  4103. @item softclip
  4104. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4105. clipping. Disabled by default.
  4106. @item mutel
  4107. Mute the left channel. Disabled by default.
  4108. @item muter
  4109. Mute the right channel. Disabled by default.
  4110. @item phasel
  4111. Change the phase of the left channel. Disabled by default.
  4112. @item phaser
  4113. Change the phase of the right channel. Disabled by default.
  4114. @item mode
  4115. Set stereo mode. Available values are:
  4116. @table @samp
  4117. @item lr>lr
  4118. Left/Right to Left/Right, this is default.
  4119. @item lr>ms
  4120. Left/Right to Mid/Side.
  4121. @item ms>lr
  4122. Mid/Side to Left/Right.
  4123. @item lr>ll
  4124. Left/Right to Left/Left.
  4125. @item lr>rr
  4126. Left/Right to Right/Right.
  4127. @item lr>l+r
  4128. Left/Right to Left + Right.
  4129. @item lr>rl
  4130. Left/Right to Right/Left.
  4131. @item ms>ll
  4132. Mid/Side to Left/Left.
  4133. @item ms>rr
  4134. Mid/Side to Right/Right.
  4135. @end table
  4136. @item slev
  4137. Set level of side signal. Default is 1.
  4138. Allowed range is from 0.015625 to 64.
  4139. @item sbal
  4140. Set balance of side signal. Default is 0.
  4141. Allowed range is from -1 to 1.
  4142. @item mlev
  4143. Set level of the middle signal. Default is 1.
  4144. Allowed range is from 0.015625 to 64.
  4145. @item mpan
  4146. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4147. @item base
  4148. Set stereo base between mono and inversed channels. Default is 0.
  4149. Allowed range is from -1 to 1.
  4150. @item delay
  4151. Set delay in milliseconds how much to delay left from right channel and
  4152. vice versa. Default is 0. Allowed range is from -20 to 20.
  4153. @item sclevel
  4154. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4155. @item phase
  4156. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4157. @item bmode_in, bmode_out
  4158. Set balance mode for balance_in/balance_out option.
  4159. Can be one of the following:
  4160. @table @samp
  4161. @item balance
  4162. Classic balance mode. Attenuate one channel at time.
  4163. Gain is raised up to 1.
  4164. @item amplitude
  4165. Similar as classic mode above but gain is raised up to 2.
  4166. @item power
  4167. Equal power distribution, from -6dB to +6dB range.
  4168. @end table
  4169. @end table
  4170. @subsection Examples
  4171. @itemize
  4172. @item
  4173. Apply karaoke like effect:
  4174. @example
  4175. stereotools=mlev=0.015625
  4176. @end example
  4177. @item
  4178. Convert M/S signal to L/R:
  4179. @example
  4180. "stereotools=mode=ms>lr"
  4181. @end example
  4182. @end itemize
  4183. @section stereowiden
  4184. This filter enhance the stereo effect by suppressing signal common to both
  4185. channels and by delaying the signal of left into right and vice versa,
  4186. thereby widening the stereo effect.
  4187. The filter accepts the following options:
  4188. @table @option
  4189. @item delay
  4190. Time in milliseconds of the delay of left signal into right and vice versa.
  4191. Default is 20 milliseconds.
  4192. @item feedback
  4193. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4194. effect of left signal in right output and vice versa which gives widening
  4195. effect. Default is 0.3.
  4196. @item crossfeed
  4197. Cross feed of left into right with inverted phase. This helps in suppressing
  4198. the mono. If the value is 1 it will cancel all the signal common to both
  4199. channels. Default is 0.3.
  4200. @item drymix
  4201. Set level of input signal of original channel. Default is 0.8.
  4202. @end table
  4203. @subsection Commands
  4204. This filter supports the all above options except @code{delay} as @ref{commands}.
  4205. @section superequalizer
  4206. Apply 18 band equalizer.
  4207. The filter accepts the following options:
  4208. @table @option
  4209. @item 1b
  4210. Set 65Hz band gain.
  4211. @item 2b
  4212. Set 92Hz band gain.
  4213. @item 3b
  4214. Set 131Hz band gain.
  4215. @item 4b
  4216. Set 185Hz band gain.
  4217. @item 5b
  4218. Set 262Hz band gain.
  4219. @item 6b
  4220. Set 370Hz band gain.
  4221. @item 7b
  4222. Set 523Hz band gain.
  4223. @item 8b
  4224. Set 740Hz band gain.
  4225. @item 9b
  4226. Set 1047Hz band gain.
  4227. @item 10b
  4228. Set 1480Hz band gain.
  4229. @item 11b
  4230. Set 2093Hz band gain.
  4231. @item 12b
  4232. Set 2960Hz band gain.
  4233. @item 13b
  4234. Set 4186Hz band gain.
  4235. @item 14b
  4236. Set 5920Hz band gain.
  4237. @item 15b
  4238. Set 8372Hz band gain.
  4239. @item 16b
  4240. Set 11840Hz band gain.
  4241. @item 17b
  4242. Set 16744Hz band gain.
  4243. @item 18b
  4244. Set 20000Hz band gain.
  4245. @end table
  4246. @section surround
  4247. Apply audio surround upmix filter.
  4248. This filter allows to produce multichannel output from audio stream.
  4249. The filter accepts the following options:
  4250. @table @option
  4251. @item chl_out
  4252. Set output channel layout. By default, this is @var{5.1}.
  4253. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4254. for the required syntax.
  4255. @item chl_in
  4256. Set input channel layout. By default, this is @var{stereo}.
  4257. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4258. for the required syntax.
  4259. @item level_in
  4260. Set input volume level. By default, this is @var{1}.
  4261. @item level_out
  4262. Set output volume level. By default, this is @var{1}.
  4263. @item lfe
  4264. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4265. @item lfe_low
  4266. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4267. @item lfe_high
  4268. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4269. @item lfe_mode
  4270. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4271. In @var{add} mode, LFE channel is created from input audio and added to output.
  4272. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4273. also all non-LFE output channels are subtracted with output LFE channel.
  4274. @item angle
  4275. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4276. Default is @var{90}.
  4277. @item fc_in
  4278. Set front center input volume. By default, this is @var{1}.
  4279. @item fc_out
  4280. Set front center output volume. By default, this is @var{1}.
  4281. @item fl_in
  4282. Set front left input volume. By default, this is @var{1}.
  4283. @item fl_out
  4284. Set front left output volume. By default, this is @var{1}.
  4285. @item fr_in
  4286. Set front right input volume. By default, this is @var{1}.
  4287. @item fr_out
  4288. Set front right output volume. By default, this is @var{1}.
  4289. @item sl_in
  4290. Set side left input volume. By default, this is @var{1}.
  4291. @item sl_out
  4292. Set side left output volume. By default, this is @var{1}.
  4293. @item sr_in
  4294. Set side right input volume. By default, this is @var{1}.
  4295. @item sr_out
  4296. Set side right output volume. By default, this is @var{1}.
  4297. @item bl_in
  4298. Set back left input volume. By default, this is @var{1}.
  4299. @item bl_out
  4300. Set back left output volume. By default, this is @var{1}.
  4301. @item br_in
  4302. Set back right input volume. By default, this is @var{1}.
  4303. @item br_out
  4304. Set back right output volume. By default, this is @var{1}.
  4305. @item bc_in
  4306. Set back center input volume. By default, this is @var{1}.
  4307. @item bc_out
  4308. Set back center output volume. By default, this is @var{1}.
  4309. @item lfe_in
  4310. Set LFE input volume. By default, this is @var{1}.
  4311. @item lfe_out
  4312. Set LFE output volume. By default, this is @var{1}.
  4313. @item allx
  4314. Set spread usage of stereo image across X axis for all channels.
  4315. @item ally
  4316. Set spread usage of stereo image across Y axis for all channels.
  4317. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4318. Set spread usage of stereo image across X axis for each channel.
  4319. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4320. Set spread usage of stereo image across Y axis for each channel.
  4321. @item win_size
  4322. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4323. @item win_func
  4324. Set window function.
  4325. It accepts the following values:
  4326. @table @samp
  4327. @item rect
  4328. @item bartlett
  4329. @item hann, hanning
  4330. @item hamming
  4331. @item blackman
  4332. @item welch
  4333. @item flattop
  4334. @item bharris
  4335. @item bnuttall
  4336. @item bhann
  4337. @item sine
  4338. @item nuttall
  4339. @item lanczos
  4340. @item gauss
  4341. @item tukey
  4342. @item dolph
  4343. @item cauchy
  4344. @item parzen
  4345. @item poisson
  4346. @item bohman
  4347. @end table
  4348. Default is @code{hann}.
  4349. @item overlap
  4350. Set window overlap. If set to 1, the recommended overlap for selected
  4351. window function will be picked. Default is @code{0.5}.
  4352. @end table
  4353. @section treble, highshelf
  4354. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4355. shelving filter with a response similar to that of a standard
  4356. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4357. The filter accepts the following options:
  4358. @table @option
  4359. @item gain, g
  4360. Give the gain at whichever is the lower of ~22 kHz and the
  4361. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4362. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4363. @item frequency, f
  4364. Set the filter's central frequency and so can be used
  4365. to extend or reduce the frequency range to be boosted or cut.
  4366. The default value is @code{3000} Hz.
  4367. @item width_type, t
  4368. Set method to specify band-width of filter.
  4369. @table @option
  4370. @item h
  4371. Hz
  4372. @item q
  4373. Q-Factor
  4374. @item o
  4375. octave
  4376. @item s
  4377. slope
  4378. @item k
  4379. kHz
  4380. @end table
  4381. @item width, w
  4382. Determine how steep is the filter's shelf transition.
  4383. @item mix, m
  4384. How much to use filtered signal in output. Default is 1.
  4385. Range is between 0 and 1.
  4386. @item channels, c
  4387. Specify which channels to filter, by default all available are filtered.
  4388. @item normalize, n
  4389. Normalize biquad coefficients, by default is disabled.
  4390. Enabling it will normalize magnitude response at DC to 0dB.
  4391. @item transform, a
  4392. Set transform type of IIR filter.
  4393. @table @option
  4394. @item di
  4395. @item dii
  4396. @item tdii
  4397. @item latt
  4398. @end table
  4399. @end table
  4400. @subsection Commands
  4401. This filter supports the following commands:
  4402. @table @option
  4403. @item frequency, f
  4404. Change treble frequency.
  4405. Syntax for the command is : "@var{frequency}"
  4406. @item width_type, t
  4407. Change treble width_type.
  4408. Syntax for the command is : "@var{width_type}"
  4409. @item width, w
  4410. Change treble width.
  4411. Syntax for the command is : "@var{width}"
  4412. @item gain, g
  4413. Change treble gain.
  4414. Syntax for the command is : "@var{gain}"
  4415. @item mix, m
  4416. Change treble mix.
  4417. Syntax for the command is : "@var{mix}"
  4418. @end table
  4419. @section tremolo
  4420. Sinusoidal amplitude modulation.
  4421. The filter accepts the following options:
  4422. @table @option
  4423. @item f
  4424. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4425. (20 Hz or lower) will result in a tremolo effect.
  4426. This filter may also be used as a ring modulator by specifying
  4427. a modulation frequency higher than 20 Hz.
  4428. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4429. @item d
  4430. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4431. Default value is 0.5.
  4432. @end table
  4433. @section vibrato
  4434. Sinusoidal phase modulation.
  4435. The filter accepts the following options:
  4436. @table @option
  4437. @item f
  4438. Modulation frequency in Hertz.
  4439. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4440. @item d
  4441. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4442. Default value is 0.5.
  4443. @end table
  4444. @section volume
  4445. Adjust the input audio volume.
  4446. It accepts the following parameters:
  4447. @table @option
  4448. @item volume
  4449. Set audio volume expression.
  4450. Output values are clipped to the maximum value.
  4451. The output audio volume is given by the relation:
  4452. @example
  4453. @var{output_volume} = @var{volume} * @var{input_volume}
  4454. @end example
  4455. The default value for @var{volume} is "1.0".
  4456. @item precision
  4457. This parameter represents the mathematical precision.
  4458. It determines which input sample formats will be allowed, which affects the
  4459. precision of the volume scaling.
  4460. @table @option
  4461. @item fixed
  4462. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4463. @item float
  4464. 32-bit floating-point; this limits input sample format to FLT. (default)
  4465. @item double
  4466. 64-bit floating-point; this limits input sample format to DBL.
  4467. @end table
  4468. @item replaygain
  4469. Choose the behaviour on encountering ReplayGain side data in input frames.
  4470. @table @option
  4471. @item drop
  4472. Remove ReplayGain side data, ignoring its contents (the default).
  4473. @item ignore
  4474. Ignore ReplayGain side data, but leave it in the frame.
  4475. @item track
  4476. Prefer the track gain, if present.
  4477. @item album
  4478. Prefer the album gain, if present.
  4479. @end table
  4480. @item replaygain_preamp
  4481. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4482. Default value for @var{replaygain_preamp} is 0.0.
  4483. @item replaygain_noclip
  4484. Prevent clipping by limiting the gain applied.
  4485. Default value for @var{replaygain_noclip} is 1.
  4486. @item eval
  4487. Set when the volume expression is evaluated.
  4488. It accepts the following values:
  4489. @table @samp
  4490. @item once
  4491. only evaluate expression once during the filter initialization, or
  4492. when the @samp{volume} command is sent
  4493. @item frame
  4494. evaluate expression for each incoming frame
  4495. @end table
  4496. Default value is @samp{once}.
  4497. @end table
  4498. The volume expression can contain the following parameters.
  4499. @table @option
  4500. @item n
  4501. frame number (starting at zero)
  4502. @item nb_channels
  4503. number of channels
  4504. @item nb_consumed_samples
  4505. number of samples consumed by the filter
  4506. @item nb_samples
  4507. number of samples in the current frame
  4508. @item pos
  4509. original frame position in the file
  4510. @item pts
  4511. frame PTS
  4512. @item sample_rate
  4513. sample rate
  4514. @item startpts
  4515. PTS at start of stream
  4516. @item startt
  4517. time at start of stream
  4518. @item t
  4519. frame time
  4520. @item tb
  4521. timestamp timebase
  4522. @item volume
  4523. last set volume value
  4524. @end table
  4525. Note that when @option{eval} is set to @samp{once} only the
  4526. @var{sample_rate} and @var{tb} variables are available, all other
  4527. variables will evaluate to NAN.
  4528. @subsection Commands
  4529. This filter supports the following commands:
  4530. @table @option
  4531. @item volume
  4532. Modify the volume expression.
  4533. The command accepts the same syntax of the corresponding option.
  4534. If the specified expression is not valid, it is kept at its current
  4535. value.
  4536. @end table
  4537. @subsection Examples
  4538. @itemize
  4539. @item
  4540. Halve the input audio volume:
  4541. @example
  4542. volume=volume=0.5
  4543. volume=volume=1/2
  4544. volume=volume=-6.0206dB
  4545. @end example
  4546. In all the above example the named key for @option{volume} can be
  4547. omitted, for example like in:
  4548. @example
  4549. volume=0.5
  4550. @end example
  4551. @item
  4552. Increase input audio power by 6 decibels using fixed-point precision:
  4553. @example
  4554. volume=volume=6dB:precision=fixed
  4555. @end example
  4556. @item
  4557. Fade volume after time 10 with an annihilation period of 5 seconds:
  4558. @example
  4559. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4560. @end example
  4561. @end itemize
  4562. @section volumedetect
  4563. Detect the volume of the input video.
  4564. The filter has no parameters. The input is not modified. Statistics about
  4565. the volume will be printed in the log when the input stream end is reached.
  4566. In particular it will show the mean volume (root mean square), maximum
  4567. volume (on a per-sample basis), and the beginning of a histogram of the
  4568. registered volume values (from the maximum value to a cumulated 1/1000 of
  4569. the samples).
  4570. All volumes are in decibels relative to the maximum PCM value.
  4571. @subsection Examples
  4572. Here is an excerpt of the output:
  4573. @example
  4574. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4575. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4576. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4577. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4578. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4579. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4580. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4581. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4582. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4583. @end example
  4584. It means that:
  4585. @itemize
  4586. @item
  4587. The mean square energy is approximately -27 dB, or 10^-2.7.
  4588. @item
  4589. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4590. @item
  4591. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4592. @end itemize
  4593. In other words, raising the volume by +4 dB does not cause any clipping,
  4594. raising it by +5 dB causes clipping for 6 samples, etc.
  4595. @c man end AUDIO FILTERS
  4596. @chapter Audio Sources
  4597. @c man begin AUDIO SOURCES
  4598. Below is a description of the currently available audio sources.
  4599. @section abuffer
  4600. Buffer audio frames, and make them available to the filter chain.
  4601. This source is mainly intended for a programmatic use, in particular
  4602. through the interface defined in @file{libavfilter/buffersrc.h}.
  4603. It accepts the following parameters:
  4604. @table @option
  4605. @item time_base
  4606. The timebase which will be used for timestamps of submitted frames. It must be
  4607. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4608. @item sample_rate
  4609. The sample rate of the incoming audio buffers.
  4610. @item sample_fmt
  4611. The sample format of the incoming audio buffers.
  4612. Either a sample format name or its corresponding integer representation from
  4613. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4614. @item channel_layout
  4615. The channel layout of the incoming audio buffers.
  4616. Either a channel layout name from channel_layout_map in
  4617. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4618. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4619. @item channels
  4620. The number of channels of the incoming audio buffers.
  4621. If both @var{channels} and @var{channel_layout} are specified, then they
  4622. must be consistent.
  4623. @end table
  4624. @subsection Examples
  4625. @example
  4626. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4627. @end example
  4628. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4629. Since the sample format with name "s16p" corresponds to the number
  4630. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4631. equivalent to:
  4632. @example
  4633. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4634. @end example
  4635. @section aevalsrc
  4636. Generate an audio signal specified by an expression.
  4637. This source accepts in input one or more expressions (one for each
  4638. channel), which are evaluated and used to generate a corresponding
  4639. audio signal.
  4640. This source accepts the following options:
  4641. @table @option
  4642. @item exprs
  4643. Set the '|'-separated expressions list for each separate channel. In case the
  4644. @option{channel_layout} option is not specified, the selected channel layout
  4645. depends on the number of provided expressions. Otherwise the last
  4646. specified expression is applied to the remaining output channels.
  4647. @item channel_layout, c
  4648. Set the channel layout. The number of channels in the specified layout
  4649. must be equal to the number of specified expressions.
  4650. @item duration, d
  4651. Set the minimum duration of the sourced audio. See
  4652. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4653. for the accepted syntax.
  4654. Note that the resulting duration may be greater than the specified
  4655. duration, as the generated audio is always cut at the end of a
  4656. complete frame.
  4657. If not specified, or the expressed duration is negative, the audio is
  4658. supposed to be generated forever.
  4659. @item nb_samples, n
  4660. Set the number of samples per channel per each output frame,
  4661. default to 1024.
  4662. @item sample_rate, s
  4663. Specify the sample rate, default to 44100.
  4664. @end table
  4665. Each expression in @var{exprs} can contain the following constants:
  4666. @table @option
  4667. @item n
  4668. number of the evaluated sample, starting from 0
  4669. @item t
  4670. time of the evaluated sample expressed in seconds, starting from 0
  4671. @item s
  4672. sample rate
  4673. @end table
  4674. @subsection Examples
  4675. @itemize
  4676. @item
  4677. Generate silence:
  4678. @example
  4679. aevalsrc=0
  4680. @end example
  4681. @item
  4682. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4683. 8000 Hz:
  4684. @example
  4685. aevalsrc="sin(440*2*PI*t):s=8000"
  4686. @end example
  4687. @item
  4688. Generate a two channels signal, specify the channel layout (Front
  4689. Center + Back Center) explicitly:
  4690. @example
  4691. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4692. @end example
  4693. @item
  4694. Generate white noise:
  4695. @example
  4696. aevalsrc="-2+random(0)"
  4697. @end example
  4698. @item
  4699. Generate an amplitude modulated signal:
  4700. @example
  4701. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4702. @end example
  4703. @item
  4704. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4705. @example
  4706. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4707. @end example
  4708. @end itemize
  4709. @section afirsrc
  4710. Generate a FIR coefficients using frequency sampling method.
  4711. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4712. The filter accepts the following options:
  4713. @table @option
  4714. @item taps, t
  4715. Set number of filter coefficents in output audio stream.
  4716. Default value is 1025.
  4717. @item frequency, f
  4718. Set frequency points from where magnitude and phase are set.
  4719. This must be in non decreasing order, and first element must be 0, while last element
  4720. must be 1. Elements are separated by white spaces.
  4721. @item magnitude, m
  4722. Set magnitude value for every frequency point set by @option{frequency}.
  4723. Number of values must be same as number of frequency points.
  4724. Values are separated by white spaces.
  4725. @item phase, p
  4726. Set phase value for every frequency point set by @option{frequency}.
  4727. Number of values must be same as number of frequency points.
  4728. Values are separated by white spaces.
  4729. @item sample_rate, r
  4730. Set sample rate, default is 44100.
  4731. @item nb_samples, n
  4732. Set number of samples per each frame. Default is 1024.
  4733. @item win_func, w
  4734. Set window function. Default is blackman.
  4735. @end table
  4736. @section anullsrc
  4737. The null audio source, return unprocessed audio frames. It is mainly useful
  4738. as a template and to be employed in analysis / debugging tools, or as
  4739. the source for filters which ignore the input data (for example the sox
  4740. synth filter).
  4741. This source accepts the following options:
  4742. @table @option
  4743. @item channel_layout, cl
  4744. Specifies the channel layout, and can be either an integer or a string
  4745. representing a channel layout. The default value of @var{channel_layout}
  4746. is "stereo".
  4747. Check the channel_layout_map definition in
  4748. @file{libavutil/channel_layout.c} for the mapping between strings and
  4749. channel layout values.
  4750. @item sample_rate, r
  4751. Specifies the sample rate, and defaults to 44100.
  4752. @item nb_samples, n
  4753. Set the number of samples per requested frames.
  4754. @item duration, d
  4755. Set the duration of the sourced audio. See
  4756. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4757. for the accepted syntax.
  4758. If not specified, or the expressed duration is negative, the audio is
  4759. supposed to be generated forever.
  4760. @end table
  4761. @subsection Examples
  4762. @itemize
  4763. @item
  4764. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4765. @example
  4766. anullsrc=r=48000:cl=4
  4767. @end example
  4768. @item
  4769. Do the same operation with a more obvious syntax:
  4770. @example
  4771. anullsrc=r=48000:cl=mono
  4772. @end example
  4773. @end itemize
  4774. All the parameters need to be explicitly defined.
  4775. @section flite
  4776. Synthesize a voice utterance using the libflite library.
  4777. To enable compilation of this filter you need to configure FFmpeg with
  4778. @code{--enable-libflite}.
  4779. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4780. The filter accepts the following options:
  4781. @table @option
  4782. @item list_voices
  4783. If set to 1, list the names of the available voices and exit
  4784. immediately. Default value is 0.
  4785. @item nb_samples, n
  4786. Set the maximum number of samples per frame. Default value is 512.
  4787. @item textfile
  4788. Set the filename containing the text to speak.
  4789. @item text
  4790. Set the text to speak.
  4791. @item voice, v
  4792. Set the voice to use for the speech synthesis. Default value is
  4793. @code{kal}. See also the @var{list_voices} option.
  4794. @end table
  4795. @subsection Examples
  4796. @itemize
  4797. @item
  4798. Read from file @file{speech.txt}, and synthesize the text using the
  4799. standard flite voice:
  4800. @example
  4801. flite=textfile=speech.txt
  4802. @end example
  4803. @item
  4804. Read the specified text selecting the @code{slt} voice:
  4805. @example
  4806. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4807. @end example
  4808. @item
  4809. Input text to ffmpeg:
  4810. @example
  4811. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4812. @end example
  4813. @item
  4814. Make @file{ffplay} speak the specified text, using @code{flite} and
  4815. the @code{lavfi} device:
  4816. @example
  4817. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4818. @end example
  4819. @end itemize
  4820. For more information about libflite, check:
  4821. @url{http://www.festvox.org/flite/}
  4822. @section anoisesrc
  4823. Generate a noise audio signal.
  4824. The filter accepts the following options:
  4825. @table @option
  4826. @item sample_rate, r
  4827. Specify the sample rate. Default value is 48000 Hz.
  4828. @item amplitude, a
  4829. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4830. is 1.0.
  4831. @item duration, d
  4832. Specify the duration of the generated audio stream. Not specifying this option
  4833. results in noise with an infinite length.
  4834. @item color, colour, c
  4835. Specify the color of noise. Available noise colors are white, pink, brown,
  4836. blue, violet and velvet. Default color is white.
  4837. @item seed, s
  4838. Specify a value used to seed the PRNG.
  4839. @item nb_samples, n
  4840. Set the number of samples per each output frame, default is 1024.
  4841. @end table
  4842. @subsection Examples
  4843. @itemize
  4844. @item
  4845. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4846. @example
  4847. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4848. @end example
  4849. @end itemize
  4850. @section hilbert
  4851. Generate odd-tap Hilbert transform FIR coefficients.
  4852. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4853. the signal by 90 degrees.
  4854. This is used in many matrix coding schemes and for analytic signal generation.
  4855. The process is often written as a multiplication by i (or j), the imaginary unit.
  4856. The filter accepts the following options:
  4857. @table @option
  4858. @item sample_rate, s
  4859. Set sample rate, default is 44100.
  4860. @item taps, t
  4861. Set length of FIR filter, default is 22051.
  4862. @item nb_samples, n
  4863. Set number of samples per each frame.
  4864. @item win_func, w
  4865. Set window function to be used when generating FIR coefficients.
  4866. @end table
  4867. @section sinc
  4868. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4869. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4870. The filter accepts the following options:
  4871. @table @option
  4872. @item sample_rate, r
  4873. Set sample rate, default is 44100.
  4874. @item nb_samples, n
  4875. Set number of samples per each frame. Default is 1024.
  4876. @item hp
  4877. Set high-pass frequency. Default is 0.
  4878. @item lp
  4879. Set low-pass frequency. Default is 0.
  4880. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4881. is higher than 0 then filter will create band-pass filter coefficients,
  4882. otherwise band-reject filter coefficients.
  4883. @item phase
  4884. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4885. @item beta
  4886. Set Kaiser window beta.
  4887. @item att
  4888. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4889. @item round
  4890. Enable rounding, by default is disabled.
  4891. @item hptaps
  4892. Set number of taps for high-pass filter.
  4893. @item lptaps
  4894. Set number of taps for low-pass filter.
  4895. @end table
  4896. @section sine
  4897. Generate an audio signal made of a sine wave with amplitude 1/8.
  4898. The audio signal is bit-exact.
  4899. The filter accepts the following options:
  4900. @table @option
  4901. @item frequency, f
  4902. Set the carrier frequency. Default is 440 Hz.
  4903. @item beep_factor, b
  4904. Enable a periodic beep every second with frequency @var{beep_factor} times
  4905. the carrier frequency. Default is 0, meaning the beep is disabled.
  4906. @item sample_rate, r
  4907. Specify the sample rate, default is 44100.
  4908. @item duration, d
  4909. Specify the duration of the generated audio stream.
  4910. @item samples_per_frame
  4911. Set the number of samples per output frame.
  4912. The expression can contain the following constants:
  4913. @table @option
  4914. @item n
  4915. The (sequential) number of the output audio frame, starting from 0.
  4916. @item pts
  4917. The PTS (Presentation TimeStamp) of the output audio frame,
  4918. expressed in @var{TB} units.
  4919. @item t
  4920. The PTS of the output audio frame, expressed in seconds.
  4921. @item TB
  4922. The timebase of the output audio frames.
  4923. @end table
  4924. Default is @code{1024}.
  4925. @end table
  4926. @subsection Examples
  4927. @itemize
  4928. @item
  4929. Generate a simple 440 Hz sine wave:
  4930. @example
  4931. sine
  4932. @end example
  4933. @item
  4934. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4935. @example
  4936. sine=220:4:d=5
  4937. sine=f=220:b=4:d=5
  4938. sine=frequency=220:beep_factor=4:duration=5
  4939. @end example
  4940. @item
  4941. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4942. pattern:
  4943. @example
  4944. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4945. @end example
  4946. @end itemize
  4947. @c man end AUDIO SOURCES
  4948. @chapter Audio Sinks
  4949. @c man begin AUDIO SINKS
  4950. Below is a description of the currently available audio sinks.
  4951. @section abuffersink
  4952. Buffer audio frames, and make them available to the end of filter chain.
  4953. This sink is mainly intended for programmatic use, in particular
  4954. through the interface defined in @file{libavfilter/buffersink.h}
  4955. or the options system.
  4956. It accepts a pointer to an AVABufferSinkContext structure, which
  4957. defines the incoming buffers' formats, to be passed as the opaque
  4958. parameter to @code{avfilter_init_filter} for initialization.
  4959. @section anullsink
  4960. Null audio sink; do absolutely nothing with the input audio. It is
  4961. mainly useful as a template and for use in analysis / debugging
  4962. tools.
  4963. @c man end AUDIO SINKS
  4964. @chapter Video Filters
  4965. @c man begin VIDEO FILTERS
  4966. When you configure your FFmpeg build, you can disable any of the
  4967. existing filters using @code{--disable-filters}.
  4968. The configure output will show the video filters included in your
  4969. build.
  4970. Below is a description of the currently available video filters.
  4971. @section addroi
  4972. Mark a region of interest in a video frame.
  4973. The frame data is passed through unchanged, but metadata is attached
  4974. to the frame indicating regions of interest which can affect the
  4975. behaviour of later encoding. Multiple regions can be marked by
  4976. applying the filter multiple times.
  4977. @table @option
  4978. @item x
  4979. Region distance in pixels from the left edge of the frame.
  4980. @item y
  4981. Region distance in pixels from the top edge of the frame.
  4982. @item w
  4983. Region width in pixels.
  4984. @item h
  4985. Region height in pixels.
  4986. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4987. and may contain the following variables:
  4988. @table @option
  4989. @item iw
  4990. Width of the input frame.
  4991. @item ih
  4992. Height of the input frame.
  4993. @end table
  4994. @item qoffset
  4995. Quantisation offset to apply within the region.
  4996. This must be a real value in the range -1 to +1. A value of zero
  4997. indicates no quality change. A negative value asks for better quality
  4998. (less quantisation), while a positive value asks for worse quality
  4999. (greater quantisation).
  5000. The range is calibrated so that the extreme values indicate the
  5001. largest possible offset - if the rest of the frame is encoded with the
  5002. worst possible quality, an offset of -1 indicates that this region
  5003. should be encoded with the best possible quality anyway. Intermediate
  5004. values are then interpolated in some codec-dependent way.
  5005. For example, in 10-bit H.264 the quantisation parameter varies between
  5006. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5007. this region should be encoded with a QP around one-tenth of the full
  5008. range better than the rest of the frame. So, if most of the frame
  5009. were to be encoded with a QP of around 30, this region would get a QP
  5010. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5011. An extreme value of -1 would indicate that this region should be
  5012. encoded with the best possible quality regardless of the treatment of
  5013. the rest of the frame - that is, should be encoded at a QP of -12.
  5014. @item clear
  5015. If set to true, remove any existing regions of interest marked on the
  5016. frame before adding the new one.
  5017. @end table
  5018. @subsection Examples
  5019. @itemize
  5020. @item
  5021. Mark the centre quarter of the frame as interesting.
  5022. @example
  5023. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5024. @end example
  5025. @item
  5026. Mark the 100-pixel-wide region on the left edge of the frame as very
  5027. uninteresting (to be encoded at much lower quality than the rest of
  5028. the frame).
  5029. @example
  5030. addroi=0:0:100:ih:+1/5
  5031. @end example
  5032. @end itemize
  5033. @section alphaextract
  5034. Extract the alpha component from the input as a grayscale video. This
  5035. is especially useful with the @var{alphamerge} filter.
  5036. @section alphamerge
  5037. Add or replace the alpha component of the primary input with the
  5038. grayscale value of a second input. This is intended for use with
  5039. @var{alphaextract} to allow the transmission or storage of frame
  5040. sequences that have alpha in a format that doesn't support an alpha
  5041. channel.
  5042. For example, to reconstruct full frames from a normal YUV-encoded video
  5043. and a separate video created with @var{alphaextract}, you might use:
  5044. @example
  5045. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5046. @end example
  5047. @section amplify
  5048. Amplify differences between current pixel and pixels of adjacent frames in
  5049. same pixel location.
  5050. This filter accepts the following options:
  5051. @table @option
  5052. @item radius
  5053. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5054. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5055. @item factor
  5056. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5057. @item threshold
  5058. Set threshold for difference amplification. Any difference greater or equal to
  5059. this value will not alter source pixel. Default is 10.
  5060. Allowed range is from 0 to 65535.
  5061. @item tolerance
  5062. Set tolerance for difference amplification. Any difference lower to
  5063. this value will not alter source pixel. Default is 0.
  5064. Allowed range is from 0 to 65535.
  5065. @item low
  5066. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5067. This option controls maximum possible value that will decrease source pixel value.
  5068. @item high
  5069. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5070. This option controls maximum possible value that will increase source pixel value.
  5071. @item planes
  5072. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5073. @end table
  5074. @subsection Commands
  5075. This filter supports the following @ref{commands} that corresponds to option of same name:
  5076. @table @option
  5077. @item factor
  5078. @item threshold
  5079. @item tolerance
  5080. @item low
  5081. @item high
  5082. @item planes
  5083. @end table
  5084. @section ass
  5085. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5086. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5087. Substation Alpha) subtitles files.
  5088. This filter accepts the following option in addition to the common options from
  5089. the @ref{subtitles} filter:
  5090. @table @option
  5091. @item shaping
  5092. Set the shaping engine
  5093. Available values are:
  5094. @table @samp
  5095. @item auto
  5096. The default libass shaping engine, which is the best available.
  5097. @item simple
  5098. Fast, font-agnostic shaper that can do only substitutions
  5099. @item complex
  5100. Slower shaper using OpenType for substitutions and positioning
  5101. @end table
  5102. The default is @code{auto}.
  5103. @end table
  5104. @section atadenoise
  5105. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5106. The filter accepts the following options:
  5107. @table @option
  5108. @item 0a
  5109. Set threshold A for 1st plane. Default is 0.02.
  5110. Valid range is 0 to 0.3.
  5111. @item 0b
  5112. Set threshold B for 1st plane. Default is 0.04.
  5113. Valid range is 0 to 5.
  5114. @item 1a
  5115. Set threshold A for 2nd plane. Default is 0.02.
  5116. Valid range is 0 to 0.3.
  5117. @item 1b
  5118. Set threshold B for 2nd plane. Default is 0.04.
  5119. Valid range is 0 to 5.
  5120. @item 2a
  5121. Set threshold A for 3rd plane. Default is 0.02.
  5122. Valid range is 0 to 0.3.
  5123. @item 2b
  5124. Set threshold B for 3rd plane. Default is 0.04.
  5125. Valid range is 0 to 5.
  5126. Threshold A is designed to react on abrupt changes in the input signal and
  5127. threshold B is designed to react on continuous changes in the input signal.
  5128. @item s
  5129. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5130. number in range [5, 129].
  5131. @item p
  5132. Set what planes of frame filter will use for averaging. Default is all.
  5133. @item a
  5134. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5135. Alternatively can be set to @code{s} serial.
  5136. Parallel can be faster then serial, while other way around is never true.
  5137. Parallel will abort early on first change being greater then thresholds, while serial
  5138. will continue processing other side of frames if they are equal or bellow thresholds.
  5139. @end table
  5140. @subsection Commands
  5141. This filter supports same @ref{commands} as options except option @code{s}.
  5142. The command accepts the same syntax of the corresponding option.
  5143. @section avgblur
  5144. Apply average blur filter.
  5145. The filter accepts the following options:
  5146. @table @option
  5147. @item sizeX
  5148. Set horizontal radius size.
  5149. @item planes
  5150. Set which planes to filter. By default all planes are filtered.
  5151. @item sizeY
  5152. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5153. Default is @code{0}.
  5154. @end table
  5155. @subsection Commands
  5156. This filter supports same commands as options.
  5157. The command accepts the same syntax of the corresponding option.
  5158. If the specified expression is not valid, it is kept at its current
  5159. value.
  5160. @section bbox
  5161. Compute the bounding box for the non-black pixels in the input frame
  5162. luminance plane.
  5163. This filter computes the bounding box containing all the pixels with a
  5164. luminance value greater than the minimum allowed value.
  5165. The parameters describing the bounding box are printed on the filter
  5166. log.
  5167. The filter accepts the following option:
  5168. @table @option
  5169. @item min_val
  5170. Set the minimal luminance value. Default is @code{16}.
  5171. @end table
  5172. @section bilateral
  5173. Apply bilateral filter, spatial smoothing while preserving edges.
  5174. The filter accepts the following options:
  5175. @table @option
  5176. @item sigmaS
  5177. Set sigma of gaussian function to calculate spatial weight.
  5178. Allowed range is 0 to 512. Default is 0.1.
  5179. @item sigmaR
  5180. Set sigma of gaussian function to calculate range weight.
  5181. Allowed range is 0 to 1. Default is 0.1.
  5182. @item planes
  5183. Set planes to filter. Default is first only.
  5184. @end table
  5185. @section bitplanenoise
  5186. Show and measure bit plane noise.
  5187. The filter accepts the following options:
  5188. @table @option
  5189. @item bitplane
  5190. Set which plane to analyze. Default is @code{1}.
  5191. @item filter
  5192. Filter out noisy pixels from @code{bitplane} set above.
  5193. Default is disabled.
  5194. @end table
  5195. @section blackdetect
  5196. Detect video intervals that are (almost) completely black. Can be
  5197. useful to detect chapter transitions, commercials, or invalid
  5198. recordings.
  5199. The filter outputs its detection analysis to both the log as well as
  5200. frame metadata. If a black segment of at least the specified minimum
  5201. duration is found, a line with the start and end timestamps as well
  5202. as duration is printed to the log with level @code{info}. In addition,
  5203. a log line with level @code{debug} is printed per frame showing the
  5204. black amount detected for that frame.
  5205. The filter also attaches metadata to the first frame of a black
  5206. segment with key @code{lavfi.black_start} and to the first frame
  5207. after the black segment ends with key @code{lavfi.black_end}. The
  5208. value is the frame's timestamp. This metadata is added regardless
  5209. of the minimum duration specified.
  5210. The filter accepts the following options:
  5211. @table @option
  5212. @item black_min_duration, d
  5213. Set the minimum detected black duration expressed in seconds. It must
  5214. be a non-negative floating point number.
  5215. Default value is 2.0.
  5216. @item picture_black_ratio_th, pic_th
  5217. Set the threshold for considering a picture "black".
  5218. Express the minimum value for the ratio:
  5219. @example
  5220. @var{nb_black_pixels} / @var{nb_pixels}
  5221. @end example
  5222. for which a picture is considered black.
  5223. Default value is 0.98.
  5224. @item pixel_black_th, pix_th
  5225. Set the threshold for considering a pixel "black".
  5226. The threshold expresses the maximum pixel luminance value for which a
  5227. pixel is considered "black". The provided value is scaled according to
  5228. the following equation:
  5229. @example
  5230. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5231. @end example
  5232. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5233. the input video format, the range is [0-255] for YUV full-range
  5234. formats and [16-235] for YUV non full-range formats.
  5235. Default value is 0.10.
  5236. @end table
  5237. The following example sets the maximum pixel threshold to the minimum
  5238. value, and detects only black intervals of 2 or more seconds:
  5239. @example
  5240. blackdetect=d=2:pix_th=0.00
  5241. @end example
  5242. @section blackframe
  5243. Detect frames that are (almost) completely black. Can be useful to
  5244. detect chapter transitions or commercials. Output lines consist of
  5245. the frame number of the detected frame, the percentage of blackness,
  5246. the position in the file if known or -1 and the timestamp in seconds.
  5247. In order to display the output lines, you need to set the loglevel at
  5248. least to the AV_LOG_INFO value.
  5249. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5250. The value represents the percentage of pixels in the picture that
  5251. are below the threshold value.
  5252. It accepts the following parameters:
  5253. @table @option
  5254. @item amount
  5255. The percentage of the pixels that have to be below the threshold; it defaults to
  5256. @code{98}.
  5257. @item threshold, thresh
  5258. The threshold below which a pixel value is considered black; it defaults to
  5259. @code{32}.
  5260. @end table
  5261. @anchor{blend}
  5262. @section blend
  5263. Blend two video frames into each other.
  5264. The @code{blend} filter takes two input streams and outputs one
  5265. stream, the first input is the "top" layer and second input is
  5266. "bottom" layer. By default, the output terminates when the longest input terminates.
  5267. The @code{tblend} (time blend) filter takes two consecutive frames
  5268. from one single stream, and outputs the result obtained by blending
  5269. the new frame on top of the old frame.
  5270. A description of the accepted options follows.
  5271. @table @option
  5272. @item c0_mode
  5273. @item c1_mode
  5274. @item c2_mode
  5275. @item c3_mode
  5276. @item all_mode
  5277. Set blend mode for specific pixel component or all pixel components in case
  5278. of @var{all_mode}. Default value is @code{normal}.
  5279. Available values for component modes are:
  5280. @table @samp
  5281. @item addition
  5282. @item grainmerge
  5283. @item and
  5284. @item average
  5285. @item burn
  5286. @item darken
  5287. @item difference
  5288. @item grainextract
  5289. @item divide
  5290. @item dodge
  5291. @item freeze
  5292. @item exclusion
  5293. @item extremity
  5294. @item glow
  5295. @item hardlight
  5296. @item hardmix
  5297. @item heat
  5298. @item lighten
  5299. @item linearlight
  5300. @item multiply
  5301. @item multiply128
  5302. @item negation
  5303. @item normal
  5304. @item or
  5305. @item overlay
  5306. @item phoenix
  5307. @item pinlight
  5308. @item reflect
  5309. @item screen
  5310. @item softlight
  5311. @item subtract
  5312. @item vividlight
  5313. @item xor
  5314. @end table
  5315. @item c0_opacity
  5316. @item c1_opacity
  5317. @item c2_opacity
  5318. @item c3_opacity
  5319. @item all_opacity
  5320. Set blend opacity for specific pixel component or all pixel components in case
  5321. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5322. @item c0_expr
  5323. @item c1_expr
  5324. @item c2_expr
  5325. @item c3_expr
  5326. @item all_expr
  5327. Set blend expression for specific pixel component or all pixel components in case
  5328. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5329. The expressions can use the following variables:
  5330. @table @option
  5331. @item N
  5332. The sequential number of the filtered frame, starting from @code{0}.
  5333. @item X
  5334. @item Y
  5335. the coordinates of the current sample
  5336. @item W
  5337. @item H
  5338. the width and height of currently filtered plane
  5339. @item SW
  5340. @item SH
  5341. Width and height scale for the plane being filtered. It is the
  5342. ratio between the dimensions of the current plane to the luma plane,
  5343. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5344. the luma plane and @code{0.5,0.5} for the chroma planes.
  5345. @item T
  5346. Time of the current frame, expressed in seconds.
  5347. @item TOP, A
  5348. Value of pixel component at current location for first video frame (top layer).
  5349. @item BOTTOM, B
  5350. Value of pixel component at current location for second video frame (bottom layer).
  5351. @end table
  5352. @end table
  5353. The @code{blend} filter also supports the @ref{framesync} options.
  5354. @subsection Examples
  5355. @itemize
  5356. @item
  5357. Apply transition from bottom layer to top layer in first 10 seconds:
  5358. @example
  5359. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5360. @end example
  5361. @item
  5362. Apply linear horizontal transition from top layer to bottom layer:
  5363. @example
  5364. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5365. @end example
  5366. @item
  5367. Apply 1x1 checkerboard effect:
  5368. @example
  5369. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5370. @end example
  5371. @item
  5372. Apply uncover left effect:
  5373. @example
  5374. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5375. @end example
  5376. @item
  5377. Apply uncover down effect:
  5378. @example
  5379. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5380. @end example
  5381. @item
  5382. Apply uncover up-left effect:
  5383. @example
  5384. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5385. @end example
  5386. @item
  5387. Split diagonally video and shows top and bottom layer on each side:
  5388. @example
  5389. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5390. @end example
  5391. @item
  5392. Display differences between the current and the previous frame:
  5393. @example
  5394. tblend=all_mode=grainextract
  5395. @end example
  5396. @end itemize
  5397. @section bm3d
  5398. Denoise frames using Block-Matching 3D algorithm.
  5399. The filter accepts the following options.
  5400. @table @option
  5401. @item sigma
  5402. Set denoising strength. Default value is 1.
  5403. Allowed range is from 0 to 999.9.
  5404. The denoising algorithm is very sensitive to sigma, so adjust it
  5405. according to the source.
  5406. @item block
  5407. Set local patch size. This sets dimensions in 2D.
  5408. @item bstep
  5409. Set sliding step for processing blocks. Default value is 4.
  5410. Allowed range is from 1 to 64.
  5411. Smaller values allows processing more reference blocks and is slower.
  5412. @item group
  5413. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5414. When set to 1, no block matching is done. Larger values allows more blocks
  5415. in single group.
  5416. Allowed range is from 1 to 256.
  5417. @item range
  5418. Set radius for search block matching. Default is 9.
  5419. Allowed range is from 1 to INT32_MAX.
  5420. @item mstep
  5421. Set step between two search locations for block matching. Default is 1.
  5422. Allowed range is from 1 to 64. Smaller is slower.
  5423. @item thmse
  5424. Set threshold of mean square error for block matching. Valid range is 0 to
  5425. INT32_MAX.
  5426. @item hdthr
  5427. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5428. Larger values results in stronger hard-thresholding filtering in frequency
  5429. domain.
  5430. @item estim
  5431. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5432. Default is @code{basic}.
  5433. @item ref
  5434. If enabled, filter will use 2nd stream for block matching.
  5435. Default is disabled for @code{basic} value of @var{estim} option,
  5436. and always enabled if value of @var{estim} is @code{final}.
  5437. @item planes
  5438. Set planes to filter. Default is all available except alpha.
  5439. @end table
  5440. @subsection Examples
  5441. @itemize
  5442. @item
  5443. Basic filtering with bm3d:
  5444. @example
  5445. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5446. @end example
  5447. @item
  5448. Same as above, but filtering only luma:
  5449. @example
  5450. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5451. @end example
  5452. @item
  5453. Same as above, but with both estimation modes:
  5454. @example
  5455. 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
  5456. @end example
  5457. @item
  5458. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5459. @example
  5460. 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
  5461. @end example
  5462. @end itemize
  5463. @section boxblur
  5464. Apply a boxblur algorithm to the input video.
  5465. It accepts the following parameters:
  5466. @table @option
  5467. @item luma_radius, lr
  5468. @item luma_power, lp
  5469. @item chroma_radius, cr
  5470. @item chroma_power, cp
  5471. @item alpha_radius, ar
  5472. @item alpha_power, ap
  5473. @end table
  5474. A description of the accepted options follows.
  5475. @table @option
  5476. @item luma_radius, lr
  5477. @item chroma_radius, cr
  5478. @item alpha_radius, ar
  5479. Set an expression for the box radius in pixels used for blurring the
  5480. corresponding input plane.
  5481. The radius value must be a non-negative number, and must not be
  5482. greater than the value of the expression @code{min(w,h)/2} for the
  5483. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5484. planes.
  5485. Default value for @option{luma_radius} is "2". If not specified,
  5486. @option{chroma_radius} and @option{alpha_radius} default to the
  5487. corresponding value set for @option{luma_radius}.
  5488. The expressions can contain the following constants:
  5489. @table @option
  5490. @item w
  5491. @item h
  5492. The input width and height in pixels.
  5493. @item cw
  5494. @item ch
  5495. The input chroma image width and height in pixels.
  5496. @item hsub
  5497. @item vsub
  5498. The horizontal and vertical chroma subsample values. For example, for the
  5499. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5500. @end table
  5501. @item luma_power, lp
  5502. @item chroma_power, cp
  5503. @item alpha_power, ap
  5504. Specify how many times the boxblur filter is applied to the
  5505. corresponding plane.
  5506. Default value for @option{luma_power} is 2. If not specified,
  5507. @option{chroma_power} and @option{alpha_power} default to the
  5508. corresponding value set for @option{luma_power}.
  5509. A value of 0 will disable the effect.
  5510. @end table
  5511. @subsection Examples
  5512. @itemize
  5513. @item
  5514. Apply a boxblur filter with the luma, chroma, and alpha radii
  5515. set to 2:
  5516. @example
  5517. boxblur=luma_radius=2:luma_power=1
  5518. boxblur=2:1
  5519. @end example
  5520. @item
  5521. Set the luma radius to 2, and alpha and chroma radius to 0:
  5522. @example
  5523. boxblur=2:1:cr=0:ar=0
  5524. @end example
  5525. @item
  5526. Set the luma and chroma radii to a fraction of the video dimension:
  5527. @example
  5528. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5529. @end example
  5530. @end itemize
  5531. @section bwdif
  5532. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5533. Deinterlacing Filter").
  5534. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5535. interpolation algorithms.
  5536. It accepts the following parameters:
  5537. @table @option
  5538. @item mode
  5539. The interlacing mode to adopt. It accepts one of the following values:
  5540. @table @option
  5541. @item 0, send_frame
  5542. Output one frame for each frame.
  5543. @item 1, send_field
  5544. Output one frame for each field.
  5545. @end table
  5546. The default value is @code{send_field}.
  5547. @item parity
  5548. The picture field parity assumed for the input interlaced video. It accepts one
  5549. of the following values:
  5550. @table @option
  5551. @item 0, tff
  5552. Assume the top field is first.
  5553. @item 1, bff
  5554. Assume the bottom field is first.
  5555. @item -1, auto
  5556. Enable automatic detection of field parity.
  5557. @end table
  5558. The default value is @code{auto}.
  5559. If the interlacing is unknown or the decoder does not export this information,
  5560. top field first will be assumed.
  5561. @item deint
  5562. Specify which frames to deinterlace. Accepts one of the following
  5563. values:
  5564. @table @option
  5565. @item 0, all
  5566. Deinterlace all frames.
  5567. @item 1, interlaced
  5568. Only deinterlace frames marked as interlaced.
  5569. @end table
  5570. The default value is @code{all}.
  5571. @end table
  5572. @section cas
  5573. Apply Contrast Adaptive Sharpen filter to video stream.
  5574. The filter accepts the following options:
  5575. @table @option
  5576. @item strength
  5577. Set the sharpening strength. Default value is 0.
  5578. @item planes
  5579. Set planes to filter. Default value is to filter all
  5580. planes except alpha plane.
  5581. @end table
  5582. @section chromahold
  5583. Remove all color information for all colors except for certain one.
  5584. The filter accepts the following options:
  5585. @table @option
  5586. @item color
  5587. The color which will not be replaced with neutral chroma.
  5588. @item similarity
  5589. Similarity percentage with the above color.
  5590. 0.01 matches only the exact key color, while 1.0 matches everything.
  5591. @item blend
  5592. Blend percentage.
  5593. 0.0 makes pixels either fully gray, or not gray at all.
  5594. Higher values result in more preserved color.
  5595. @item yuv
  5596. Signals that the color passed is already in YUV instead of RGB.
  5597. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5598. This can be used to pass exact YUV values as hexadecimal numbers.
  5599. @end table
  5600. @subsection Commands
  5601. This filter supports same @ref{commands} as options.
  5602. The command accepts the same syntax of the corresponding option.
  5603. If the specified expression is not valid, it is kept at its current
  5604. value.
  5605. @section chromakey
  5606. YUV colorspace color/chroma keying.
  5607. The filter accepts the following options:
  5608. @table @option
  5609. @item color
  5610. The color which will be replaced with transparency.
  5611. @item similarity
  5612. Similarity percentage with the key color.
  5613. 0.01 matches only the exact key color, while 1.0 matches everything.
  5614. @item blend
  5615. Blend percentage.
  5616. 0.0 makes pixels either fully transparent, or not transparent at all.
  5617. Higher values result in semi-transparent pixels, with a higher transparency
  5618. the more similar the pixels color is to the key color.
  5619. @item yuv
  5620. Signals that the color passed is already in YUV instead of RGB.
  5621. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5622. This can be used to pass exact YUV values as hexadecimal numbers.
  5623. @end table
  5624. @subsection Commands
  5625. This filter supports same @ref{commands} as options.
  5626. The command accepts the same syntax of the corresponding option.
  5627. If the specified expression is not valid, it is kept at its current
  5628. value.
  5629. @subsection Examples
  5630. @itemize
  5631. @item
  5632. Make every green pixel in the input image transparent:
  5633. @example
  5634. ffmpeg -i input.png -vf chromakey=green out.png
  5635. @end example
  5636. @item
  5637. Overlay a greenscreen-video on top of a static black background.
  5638. @example
  5639. 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
  5640. @end example
  5641. @end itemize
  5642. @section chromanr
  5643. Reduce chrominance noise.
  5644. The filter accepts the following options:
  5645. @table @option
  5646. @item thres
  5647. Set threshold for averaging chrominance values.
  5648. Sum of absolute difference of U and V pixel components or current
  5649. pixel and neighbour pixels lower than this threshold will be used in
  5650. averaging. Luma component is left unchanged and is copied to output.
  5651. Default value is 30. Allowed range is from 1 to 200.
  5652. @item sizew
  5653. Set horizontal radius of rectangle used for averaging.
  5654. Allowed range is from 1 to 100. Default value is 5.
  5655. @item sizeh
  5656. Set vertical radius of rectangle used for averaging.
  5657. Allowed range is from 1 to 100. Default value is 5.
  5658. @item stepw
  5659. Set horizontal step when averaging. Default value is 1.
  5660. Allowed range is from 1 to 50.
  5661. Mostly useful to speed-up filtering.
  5662. @item steph
  5663. Set vertical step when averaging. Default value is 1.
  5664. Allowed range is from 1 to 50.
  5665. Mostly useful to speed-up filtering.
  5666. @end table
  5667. @subsection Commands
  5668. This filter supports same @ref{commands} as options.
  5669. The command accepts the same syntax of the corresponding option.
  5670. @section chromashift
  5671. Shift chroma pixels horizontally and/or vertically.
  5672. The filter accepts the following options:
  5673. @table @option
  5674. @item cbh
  5675. Set amount to shift chroma-blue horizontally.
  5676. @item cbv
  5677. Set amount to shift chroma-blue vertically.
  5678. @item crh
  5679. Set amount to shift chroma-red horizontally.
  5680. @item crv
  5681. Set amount to shift chroma-red vertically.
  5682. @item edge
  5683. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5684. @end table
  5685. @subsection Commands
  5686. This filter supports the all above options as @ref{commands}.
  5687. @section ciescope
  5688. Display CIE color diagram with pixels overlaid onto it.
  5689. The filter accepts the following options:
  5690. @table @option
  5691. @item system
  5692. Set color system.
  5693. @table @samp
  5694. @item ntsc, 470m
  5695. @item ebu, 470bg
  5696. @item smpte
  5697. @item 240m
  5698. @item apple
  5699. @item widergb
  5700. @item cie1931
  5701. @item rec709, hdtv
  5702. @item uhdtv, rec2020
  5703. @item dcip3
  5704. @end table
  5705. @item cie
  5706. Set CIE system.
  5707. @table @samp
  5708. @item xyy
  5709. @item ucs
  5710. @item luv
  5711. @end table
  5712. @item gamuts
  5713. Set what gamuts to draw.
  5714. See @code{system} option for available values.
  5715. @item size, s
  5716. Set ciescope size, by default set to 512.
  5717. @item intensity, i
  5718. Set intensity used to map input pixel values to CIE diagram.
  5719. @item contrast
  5720. Set contrast used to draw tongue colors that are out of active color system gamut.
  5721. @item corrgamma
  5722. Correct gamma displayed on scope, by default enabled.
  5723. @item showwhite
  5724. Show white point on CIE diagram, by default disabled.
  5725. @item gamma
  5726. Set input gamma. Used only with XYZ input color space.
  5727. @end table
  5728. @section codecview
  5729. Visualize information exported by some codecs.
  5730. Some codecs can export information through frames using side-data or other
  5731. means. For example, some MPEG based codecs export motion vectors through the
  5732. @var{export_mvs} flag in the codec @option{flags2} option.
  5733. The filter accepts the following option:
  5734. @table @option
  5735. @item mv
  5736. Set motion vectors to visualize.
  5737. Available flags for @var{mv} are:
  5738. @table @samp
  5739. @item pf
  5740. forward predicted MVs of P-frames
  5741. @item bf
  5742. forward predicted MVs of B-frames
  5743. @item bb
  5744. backward predicted MVs of B-frames
  5745. @end table
  5746. @item qp
  5747. Display quantization parameters using the chroma planes.
  5748. @item mv_type, mvt
  5749. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5750. Available flags for @var{mv_type} are:
  5751. @table @samp
  5752. @item fp
  5753. forward predicted MVs
  5754. @item bp
  5755. backward predicted MVs
  5756. @end table
  5757. @item frame_type, ft
  5758. Set frame type to visualize motion vectors of.
  5759. Available flags for @var{frame_type} are:
  5760. @table @samp
  5761. @item if
  5762. intra-coded frames (I-frames)
  5763. @item pf
  5764. predicted frames (P-frames)
  5765. @item bf
  5766. bi-directionally predicted frames (B-frames)
  5767. @end table
  5768. @end table
  5769. @subsection Examples
  5770. @itemize
  5771. @item
  5772. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5773. @example
  5774. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5775. @end example
  5776. @item
  5777. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5778. @example
  5779. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5780. @end example
  5781. @end itemize
  5782. @section colorbalance
  5783. Modify intensity of primary colors (red, green and blue) of input frames.
  5784. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5785. regions for the red-cyan, green-magenta or blue-yellow balance.
  5786. A positive adjustment value shifts the balance towards the primary color, a negative
  5787. value towards the complementary color.
  5788. The filter accepts the following options:
  5789. @table @option
  5790. @item rs
  5791. @item gs
  5792. @item bs
  5793. Adjust red, green and blue shadows (darkest pixels).
  5794. @item rm
  5795. @item gm
  5796. @item bm
  5797. Adjust red, green and blue midtones (medium pixels).
  5798. @item rh
  5799. @item gh
  5800. @item bh
  5801. Adjust red, green and blue highlights (brightest pixels).
  5802. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5803. @item pl
  5804. Preserve lightness when changing color balance. Default is disabled.
  5805. @end table
  5806. @subsection Examples
  5807. @itemize
  5808. @item
  5809. Add red color cast to shadows:
  5810. @example
  5811. colorbalance=rs=.3
  5812. @end example
  5813. @end itemize
  5814. @subsection Commands
  5815. This filter supports the all above options as @ref{commands}.
  5816. @section colorchannelmixer
  5817. Adjust video input frames by re-mixing color channels.
  5818. This filter modifies a color channel by adding the values associated to
  5819. the other channels of the same pixels. For example if the value to
  5820. modify is red, the output value will be:
  5821. @example
  5822. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5823. @end example
  5824. The filter accepts the following options:
  5825. @table @option
  5826. @item rr
  5827. @item rg
  5828. @item rb
  5829. @item ra
  5830. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5831. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5832. @item gr
  5833. @item gg
  5834. @item gb
  5835. @item ga
  5836. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5837. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5838. @item br
  5839. @item bg
  5840. @item bb
  5841. @item ba
  5842. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5843. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5844. @item ar
  5845. @item ag
  5846. @item ab
  5847. @item aa
  5848. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5849. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5850. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5851. @end table
  5852. @subsection Examples
  5853. @itemize
  5854. @item
  5855. Convert source to grayscale:
  5856. @example
  5857. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5858. @end example
  5859. @item
  5860. Simulate sepia tones:
  5861. @example
  5862. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5863. @end example
  5864. @end itemize
  5865. @subsection Commands
  5866. This filter supports the all above options as @ref{commands}.
  5867. @section colorkey
  5868. RGB colorspace color keying.
  5869. The filter accepts the following options:
  5870. @table @option
  5871. @item color
  5872. The color which will be replaced with transparency.
  5873. @item similarity
  5874. Similarity percentage with the key color.
  5875. 0.01 matches only the exact key color, while 1.0 matches everything.
  5876. @item blend
  5877. Blend percentage.
  5878. 0.0 makes pixels either fully transparent, or not transparent at all.
  5879. Higher values result in semi-transparent pixels, with a higher transparency
  5880. the more similar the pixels color is to the key color.
  5881. @end table
  5882. @subsection Examples
  5883. @itemize
  5884. @item
  5885. Make every green pixel in the input image transparent:
  5886. @example
  5887. ffmpeg -i input.png -vf colorkey=green out.png
  5888. @end example
  5889. @item
  5890. Overlay a greenscreen-video on top of a static background image.
  5891. @example
  5892. 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
  5893. @end example
  5894. @end itemize
  5895. @subsection Commands
  5896. This filter supports same @ref{commands} as options.
  5897. The command accepts the same syntax of the corresponding option.
  5898. If the specified expression is not valid, it is kept at its current
  5899. value.
  5900. @section colorhold
  5901. Remove all color information for all RGB colors except for certain one.
  5902. The filter accepts the following options:
  5903. @table @option
  5904. @item color
  5905. The color which will not be replaced with neutral gray.
  5906. @item similarity
  5907. Similarity percentage with the above color.
  5908. 0.01 matches only the exact key color, while 1.0 matches everything.
  5909. @item blend
  5910. Blend percentage. 0.0 makes pixels fully gray.
  5911. Higher values result in more preserved color.
  5912. @end table
  5913. @subsection Commands
  5914. This filter supports same @ref{commands} as options.
  5915. The command accepts the same syntax of the corresponding option.
  5916. If the specified expression is not valid, it is kept at its current
  5917. value.
  5918. @section colorlevels
  5919. Adjust video input frames using levels.
  5920. The filter accepts the following options:
  5921. @table @option
  5922. @item rimin
  5923. @item gimin
  5924. @item bimin
  5925. @item aimin
  5926. Adjust red, green, blue and alpha input black point.
  5927. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5928. @item rimax
  5929. @item gimax
  5930. @item bimax
  5931. @item aimax
  5932. Adjust red, green, blue and alpha input white point.
  5933. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5934. Input levels are used to lighten highlights (bright tones), darken shadows
  5935. (dark tones), change the balance of bright and dark tones.
  5936. @item romin
  5937. @item gomin
  5938. @item bomin
  5939. @item aomin
  5940. Adjust red, green, blue and alpha output black point.
  5941. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5942. @item romax
  5943. @item gomax
  5944. @item bomax
  5945. @item aomax
  5946. Adjust red, green, blue and alpha output white point.
  5947. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5948. Output levels allows manual selection of a constrained output level range.
  5949. @end table
  5950. @subsection Examples
  5951. @itemize
  5952. @item
  5953. Make video output darker:
  5954. @example
  5955. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5956. @end example
  5957. @item
  5958. Increase contrast:
  5959. @example
  5960. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5961. @end example
  5962. @item
  5963. Make video output lighter:
  5964. @example
  5965. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5966. @end example
  5967. @item
  5968. Increase brightness:
  5969. @example
  5970. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5971. @end example
  5972. @end itemize
  5973. @subsection Commands
  5974. This filter supports the all above options as @ref{commands}.
  5975. @section colormatrix
  5976. Convert color matrix.
  5977. The filter accepts the following options:
  5978. @table @option
  5979. @item src
  5980. @item dst
  5981. Specify the source and destination color matrix. Both values must be
  5982. specified.
  5983. The accepted values are:
  5984. @table @samp
  5985. @item bt709
  5986. BT.709
  5987. @item fcc
  5988. FCC
  5989. @item bt601
  5990. BT.601
  5991. @item bt470
  5992. BT.470
  5993. @item bt470bg
  5994. BT.470BG
  5995. @item smpte170m
  5996. SMPTE-170M
  5997. @item smpte240m
  5998. SMPTE-240M
  5999. @item bt2020
  6000. BT.2020
  6001. @end table
  6002. @end table
  6003. For example to convert from BT.601 to SMPTE-240M, use the command:
  6004. @example
  6005. colormatrix=bt601:smpte240m
  6006. @end example
  6007. @section colorspace
  6008. Convert colorspace, transfer characteristics or color primaries.
  6009. Input video needs to have an even size.
  6010. The filter accepts the following options:
  6011. @table @option
  6012. @anchor{all}
  6013. @item all
  6014. Specify all color properties at once.
  6015. The accepted values are:
  6016. @table @samp
  6017. @item bt470m
  6018. BT.470M
  6019. @item bt470bg
  6020. BT.470BG
  6021. @item bt601-6-525
  6022. BT.601-6 525
  6023. @item bt601-6-625
  6024. BT.601-6 625
  6025. @item bt709
  6026. BT.709
  6027. @item smpte170m
  6028. SMPTE-170M
  6029. @item smpte240m
  6030. SMPTE-240M
  6031. @item bt2020
  6032. BT.2020
  6033. @end table
  6034. @anchor{space}
  6035. @item space
  6036. Specify output colorspace.
  6037. The accepted values are:
  6038. @table @samp
  6039. @item bt709
  6040. BT.709
  6041. @item fcc
  6042. FCC
  6043. @item bt470bg
  6044. BT.470BG or BT.601-6 625
  6045. @item smpte170m
  6046. SMPTE-170M or BT.601-6 525
  6047. @item smpte240m
  6048. SMPTE-240M
  6049. @item ycgco
  6050. YCgCo
  6051. @item bt2020ncl
  6052. BT.2020 with non-constant luminance
  6053. @end table
  6054. @anchor{trc}
  6055. @item trc
  6056. Specify output transfer characteristics.
  6057. The accepted values are:
  6058. @table @samp
  6059. @item bt709
  6060. BT.709
  6061. @item bt470m
  6062. BT.470M
  6063. @item bt470bg
  6064. BT.470BG
  6065. @item gamma22
  6066. Constant gamma of 2.2
  6067. @item gamma28
  6068. Constant gamma of 2.8
  6069. @item smpte170m
  6070. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6071. @item smpte240m
  6072. SMPTE-240M
  6073. @item srgb
  6074. SRGB
  6075. @item iec61966-2-1
  6076. iec61966-2-1
  6077. @item iec61966-2-4
  6078. iec61966-2-4
  6079. @item xvycc
  6080. xvycc
  6081. @item bt2020-10
  6082. BT.2020 for 10-bits content
  6083. @item bt2020-12
  6084. BT.2020 for 12-bits content
  6085. @end table
  6086. @anchor{primaries}
  6087. @item primaries
  6088. Specify output color primaries.
  6089. The accepted values are:
  6090. @table @samp
  6091. @item bt709
  6092. BT.709
  6093. @item bt470m
  6094. BT.470M
  6095. @item bt470bg
  6096. BT.470BG or BT.601-6 625
  6097. @item smpte170m
  6098. SMPTE-170M or BT.601-6 525
  6099. @item smpte240m
  6100. SMPTE-240M
  6101. @item film
  6102. film
  6103. @item smpte431
  6104. SMPTE-431
  6105. @item smpte432
  6106. SMPTE-432
  6107. @item bt2020
  6108. BT.2020
  6109. @item jedec-p22
  6110. JEDEC P22 phosphors
  6111. @end table
  6112. @anchor{range}
  6113. @item range
  6114. Specify output color range.
  6115. The accepted values are:
  6116. @table @samp
  6117. @item tv
  6118. TV (restricted) range
  6119. @item mpeg
  6120. MPEG (restricted) range
  6121. @item pc
  6122. PC (full) range
  6123. @item jpeg
  6124. JPEG (full) range
  6125. @end table
  6126. @item format
  6127. Specify output color format.
  6128. The accepted values are:
  6129. @table @samp
  6130. @item yuv420p
  6131. YUV 4:2:0 planar 8-bits
  6132. @item yuv420p10
  6133. YUV 4:2:0 planar 10-bits
  6134. @item yuv420p12
  6135. YUV 4:2:0 planar 12-bits
  6136. @item yuv422p
  6137. YUV 4:2:2 planar 8-bits
  6138. @item yuv422p10
  6139. YUV 4:2:2 planar 10-bits
  6140. @item yuv422p12
  6141. YUV 4:2:2 planar 12-bits
  6142. @item yuv444p
  6143. YUV 4:4:4 planar 8-bits
  6144. @item yuv444p10
  6145. YUV 4:4:4 planar 10-bits
  6146. @item yuv444p12
  6147. YUV 4:4:4 planar 12-bits
  6148. @end table
  6149. @item fast
  6150. Do a fast conversion, which skips gamma/primary correction. This will take
  6151. significantly less CPU, but will be mathematically incorrect. To get output
  6152. compatible with that produced by the colormatrix filter, use fast=1.
  6153. @item dither
  6154. Specify dithering mode.
  6155. The accepted values are:
  6156. @table @samp
  6157. @item none
  6158. No dithering
  6159. @item fsb
  6160. Floyd-Steinberg dithering
  6161. @end table
  6162. @item wpadapt
  6163. Whitepoint adaptation mode.
  6164. The accepted values are:
  6165. @table @samp
  6166. @item bradford
  6167. Bradford whitepoint adaptation
  6168. @item vonkries
  6169. von Kries whitepoint adaptation
  6170. @item identity
  6171. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6172. @end table
  6173. @item iall
  6174. Override all input properties at once. Same accepted values as @ref{all}.
  6175. @item ispace
  6176. Override input colorspace. Same accepted values as @ref{space}.
  6177. @item iprimaries
  6178. Override input color primaries. Same accepted values as @ref{primaries}.
  6179. @item itrc
  6180. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6181. @item irange
  6182. Override input color range. Same accepted values as @ref{range}.
  6183. @end table
  6184. The filter converts the transfer characteristics, color space and color
  6185. primaries to the specified user values. The output value, if not specified,
  6186. is set to a default value based on the "all" property. If that property is
  6187. also not specified, the filter will log an error. The output color range and
  6188. format default to the same value as the input color range and format. The
  6189. input transfer characteristics, color space, color primaries and color range
  6190. should be set on the input data. If any of these are missing, the filter will
  6191. log an error and no conversion will take place.
  6192. For example to convert the input to SMPTE-240M, use the command:
  6193. @example
  6194. colorspace=smpte240m
  6195. @end example
  6196. @section convolution
  6197. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6198. The filter accepts the following options:
  6199. @table @option
  6200. @item 0m
  6201. @item 1m
  6202. @item 2m
  6203. @item 3m
  6204. Set matrix for each plane.
  6205. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6206. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6207. @item 0rdiv
  6208. @item 1rdiv
  6209. @item 2rdiv
  6210. @item 3rdiv
  6211. Set multiplier for calculated value for each plane.
  6212. If unset or 0, it will be sum of all matrix elements.
  6213. @item 0bias
  6214. @item 1bias
  6215. @item 2bias
  6216. @item 3bias
  6217. Set bias for each plane. This value is added to the result of the multiplication.
  6218. Useful for making the overall image brighter or darker. Default is 0.0.
  6219. @item 0mode
  6220. @item 1mode
  6221. @item 2mode
  6222. @item 3mode
  6223. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6224. Default is @var{square}.
  6225. @end table
  6226. @subsection Examples
  6227. @itemize
  6228. @item
  6229. Apply sharpen:
  6230. @example
  6231. 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"
  6232. @end example
  6233. @item
  6234. Apply blur:
  6235. @example
  6236. 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"
  6237. @end example
  6238. @item
  6239. Apply edge enhance:
  6240. @example
  6241. 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"
  6242. @end example
  6243. @item
  6244. Apply edge detect:
  6245. @example
  6246. 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"
  6247. @end example
  6248. @item
  6249. Apply laplacian edge detector which includes diagonals:
  6250. @example
  6251. 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"
  6252. @end example
  6253. @item
  6254. Apply emboss:
  6255. @example
  6256. 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"
  6257. @end example
  6258. @end itemize
  6259. @section convolve
  6260. Apply 2D convolution of video stream in frequency domain using second stream
  6261. as impulse.
  6262. The filter accepts the following options:
  6263. @table @option
  6264. @item planes
  6265. Set which planes to process.
  6266. @item impulse
  6267. Set which impulse video frames will be processed, can be @var{first}
  6268. or @var{all}. Default is @var{all}.
  6269. @end table
  6270. The @code{convolve} filter also supports the @ref{framesync} options.
  6271. @section copy
  6272. Copy the input video source unchanged to the output. This is mainly useful for
  6273. testing purposes.
  6274. @anchor{coreimage}
  6275. @section coreimage
  6276. Video filtering on GPU using Apple's CoreImage API on OSX.
  6277. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6278. processed by video hardware. However, software-based OpenGL implementations
  6279. exist which means there is no guarantee for hardware processing. It depends on
  6280. the respective OSX.
  6281. There are many filters and image generators provided by Apple that come with a
  6282. large variety of options. The filter has to be referenced by its name along
  6283. with its options.
  6284. The coreimage filter accepts the following options:
  6285. @table @option
  6286. @item list_filters
  6287. List all available filters and generators along with all their respective
  6288. options as well as possible minimum and maximum values along with the default
  6289. values.
  6290. @example
  6291. list_filters=true
  6292. @end example
  6293. @item filter
  6294. Specify all filters by their respective name and options.
  6295. Use @var{list_filters} to determine all valid filter names and options.
  6296. Numerical options are specified by a float value and are automatically clamped
  6297. to their respective value range. Vector and color options have to be specified
  6298. by a list of space separated float values. Character escaping has to be done.
  6299. A special option name @code{default} is available to use default options for a
  6300. filter.
  6301. It is required to specify either @code{default} or at least one of the filter options.
  6302. All omitted options are used with their default values.
  6303. The syntax of the filter string is as follows:
  6304. @example
  6305. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6306. @end example
  6307. @item output_rect
  6308. Specify a rectangle where the output of the filter chain is copied into the
  6309. input image. It is given by a list of space separated float values:
  6310. @example
  6311. output_rect=x\ y\ width\ height
  6312. @end example
  6313. If not given, the output rectangle equals the dimensions of the input image.
  6314. The output rectangle is automatically cropped at the borders of the input
  6315. image. Negative values are valid for each component.
  6316. @example
  6317. output_rect=25\ 25\ 100\ 100
  6318. @end example
  6319. @end table
  6320. Several filters can be chained for successive processing without GPU-HOST
  6321. transfers allowing for fast processing of complex filter chains.
  6322. Currently, only filters with zero (generators) or exactly one (filters) input
  6323. image and one output image are supported. Also, transition filters are not yet
  6324. usable as intended.
  6325. Some filters generate output images with additional padding depending on the
  6326. respective filter kernel. The padding is automatically removed to ensure the
  6327. filter output has the same size as the input image.
  6328. For image generators, the size of the output image is determined by the
  6329. previous output image of the filter chain or the input image of the whole
  6330. filterchain, respectively. The generators do not use the pixel information of
  6331. this image to generate their output. However, the generated output is
  6332. blended onto this image, resulting in partial or complete coverage of the
  6333. output image.
  6334. The @ref{coreimagesrc} video source can be used for generating input images
  6335. which are directly fed into the filter chain. By using it, providing input
  6336. images by another video source or an input video is not required.
  6337. @subsection Examples
  6338. @itemize
  6339. @item
  6340. List all filters available:
  6341. @example
  6342. coreimage=list_filters=true
  6343. @end example
  6344. @item
  6345. Use the CIBoxBlur filter with default options to blur an image:
  6346. @example
  6347. coreimage=filter=CIBoxBlur@@default
  6348. @end example
  6349. @item
  6350. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6351. its center at 100x100 and a radius of 50 pixels:
  6352. @example
  6353. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6354. @end example
  6355. @item
  6356. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6357. given as complete and escaped command-line for Apple's standard bash shell:
  6358. @example
  6359. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6360. @end example
  6361. @end itemize
  6362. @section cover_rect
  6363. Cover a rectangular object
  6364. It accepts the following options:
  6365. @table @option
  6366. @item cover
  6367. Filepath of the optional cover image, needs to be in yuv420.
  6368. @item mode
  6369. Set covering mode.
  6370. It accepts the following values:
  6371. @table @samp
  6372. @item cover
  6373. cover it by the supplied image
  6374. @item blur
  6375. cover it by interpolating the surrounding pixels
  6376. @end table
  6377. Default value is @var{blur}.
  6378. @end table
  6379. @subsection Examples
  6380. @itemize
  6381. @item
  6382. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6383. @example
  6384. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6385. @end example
  6386. @end itemize
  6387. @section crop
  6388. Crop the input video to given dimensions.
  6389. It accepts the following parameters:
  6390. @table @option
  6391. @item w, out_w
  6392. The width of the output video. It defaults to @code{iw}.
  6393. This expression is evaluated only once during the filter
  6394. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6395. @item h, out_h
  6396. The height of the output video. It defaults to @code{ih}.
  6397. This expression is evaluated only once during the filter
  6398. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6399. @item x
  6400. The horizontal position, in the input video, of the left edge of the output
  6401. video. It defaults to @code{(in_w-out_w)/2}.
  6402. This expression is evaluated per-frame.
  6403. @item y
  6404. The vertical position, in the input video, of the top edge of the output video.
  6405. It defaults to @code{(in_h-out_h)/2}.
  6406. This expression is evaluated per-frame.
  6407. @item keep_aspect
  6408. If set to 1 will force the output display aspect ratio
  6409. to be the same of the input, by changing the output sample aspect
  6410. ratio. It defaults to 0.
  6411. @item exact
  6412. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6413. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6414. It defaults to 0.
  6415. @end table
  6416. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6417. expressions containing the following constants:
  6418. @table @option
  6419. @item x
  6420. @item y
  6421. The computed values for @var{x} and @var{y}. They are evaluated for
  6422. each new frame.
  6423. @item in_w
  6424. @item in_h
  6425. The input width and height.
  6426. @item iw
  6427. @item ih
  6428. These are the same as @var{in_w} and @var{in_h}.
  6429. @item out_w
  6430. @item out_h
  6431. The output (cropped) width and height.
  6432. @item ow
  6433. @item oh
  6434. These are the same as @var{out_w} and @var{out_h}.
  6435. @item a
  6436. same as @var{iw} / @var{ih}
  6437. @item sar
  6438. input sample aspect ratio
  6439. @item dar
  6440. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6441. @item hsub
  6442. @item vsub
  6443. horizontal and vertical chroma subsample values. For example for the
  6444. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6445. @item n
  6446. The number of the input frame, starting from 0.
  6447. @item pos
  6448. the position in the file of the input frame, NAN if unknown
  6449. @item t
  6450. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6451. @end table
  6452. The expression for @var{out_w} may depend on the value of @var{out_h},
  6453. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6454. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6455. evaluated after @var{out_w} and @var{out_h}.
  6456. The @var{x} and @var{y} parameters specify the expressions for the
  6457. position of the top-left corner of the output (non-cropped) area. They
  6458. are evaluated for each frame. If the evaluated value is not valid, it
  6459. is approximated to the nearest valid value.
  6460. The expression for @var{x} may depend on @var{y}, and the expression
  6461. for @var{y} may depend on @var{x}.
  6462. @subsection Examples
  6463. @itemize
  6464. @item
  6465. Crop area with size 100x100 at position (12,34).
  6466. @example
  6467. crop=100:100:12:34
  6468. @end example
  6469. Using named options, the example above becomes:
  6470. @example
  6471. crop=w=100:h=100:x=12:y=34
  6472. @end example
  6473. @item
  6474. Crop the central input area with size 100x100:
  6475. @example
  6476. crop=100:100
  6477. @end example
  6478. @item
  6479. Crop the central input area with size 2/3 of the input video:
  6480. @example
  6481. crop=2/3*in_w:2/3*in_h
  6482. @end example
  6483. @item
  6484. Crop the input video central square:
  6485. @example
  6486. crop=out_w=in_h
  6487. crop=in_h
  6488. @end example
  6489. @item
  6490. Delimit the rectangle with the top-left corner placed at position
  6491. 100:100 and the right-bottom corner corresponding to the right-bottom
  6492. corner of the input image.
  6493. @example
  6494. crop=in_w-100:in_h-100:100:100
  6495. @end example
  6496. @item
  6497. Crop 10 pixels from the left and right borders, and 20 pixels from
  6498. the top and bottom borders
  6499. @example
  6500. crop=in_w-2*10:in_h-2*20
  6501. @end example
  6502. @item
  6503. Keep only the bottom right quarter of the input image:
  6504. @example
  6505. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6506. @end example
  6507. @item
  6508. Crop height for getting Greek harmony:
  6509. @example
  6510. crop=in_w:1/PHI*in_w
  6511. @end example
  6512. @item
  6513. Apply trembling effect:
  6514. @example
  6515. 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)
  6516. @end example
  6517. @item
  6518. Apply erratic camera effect depending on timestamp:
  6519. @example
  6520. 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)"
  6521. @end example
  6522. @item
  6523. Set x depending on the value of y:
  6524. @example
  6525. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6526. @end example
  6527. @end itemize
  6528. @subsection Commands
  6529. This filter supports the following commands:
  6530. @table @option
  6531. @item w, out_w
  6532. @item h, out_h
  6533. @item x
  6534. @item y
  6535. Set width/height of the output video and the horizontal/vertical position
  6536. in the input video.
  6537. The command accepts the same syntax of the corresponding option.
  6538. If the specified expression is not valid, it is kept at its current
  6539. value.
  6540. @end table
  6541. @section cropdetect
  6542. Auto-detect the crop size.
  6543. It calculates the necessary cropping parameters and prints the
  6544. recommended parameters via the logging system. The detected dimensions
  6545. correspond to the non-black area of the input video.
  6546. It accepts the following parameters:
  6547. @table @option
  6548. @item limit
  6549. Set higher black value threshold, which can be optionally specified
  6550. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6551. value greater to the set value is considered non-black. It defaults to 24.
  6552. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6553. on the bitdepth of the pixel format.
  6554. @item round
  6555. The value which the width/height should be divisible by. It defaults to
  6556. 16. The offset is automatically adjusted to center the video. Use 2 to
  6557. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6558. encoding to most video codecs.
  6559. @item reset_count, reset
  6560. Set the counter that determines after how many frames cropdetect will
  6561. reset the previously detected largest video area and start over to
  6562. detect the current optimal crop area. Default value is 0.
  6563. This can be useful when channel logos distort the video area. 0
  6564. indicates 'never reset', and returns the largest area encountered during
  6565. playback.
  6566. @end table
  6567. @anchor{cue}
  6568. @section cue
  6569. Delay video filtering until a given wallclock timestamp. The filter first
  6570. passes on @option{preroll} amount of frames, then it buffers at most
  6571. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6572. it forwards the buffered frames and also any subsequent frames coming in its
  6573. input.
  6574. The filter can be used synchronize the output of multiple ffmpeg processes for
  6575. realtime output devices like decklink. By putting the delay in the filtering
  6576. chain and pre-buffering frames the process can pass on data to output almost
  6577. immediately after the target wallclock timestamp is reached.
  6578. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6579. some use cases.
  6580. @table @option
  6581. @item cue
  6582. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6583. @item preroll
  6584. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6585. @item buffer
  6586. The maximum duration of content to buffer before waiting for the cue expressed
  6587. in seconds. Default is 0.
  6588. @end table
  6589. @anchor{curves}
  6590. @section curves
  6591. Apply color adjustments using curves.
  6592. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6593. component (red, green and blue) has its values defined by @var{N} key points
  6594. tied from each other using a smooth curve. The x-axis represents the pixel
  6595. values from the input frame, and the y-axis the new pixel values to be set for
  6596. the output frame.
  6597. By default, a component curve is defined by the two points @var{(0;0)} and
  6598. @var{(1;1)}. This creates a straight line where each original pixel value is
  6599. "adjusted" to its own value, which means no change to the image.
  6600. The filter allows you to redefine these two points and add some more. A new
  6601. curve (using a natural cubic spline interpolation) will be define to pass
  6602. smoothly through all these new coordinates. The new defined points needs to be
  6603. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6604. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6605. the vector spaces, the values will be clipped accordingly.
  6606. The filter accepts the following options:
  6607. @table @option
  6608. @item preset
  6609. Select one of the available color presets. This option can be used in addition
  6610. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6611. options takes priority on the preset values.
  6612. Available presets are:
  6613. @table @samp
  6614. @item none
  6615. @item color_negative
  6616. @item cross_process
  6617. @item darker
  6618. @item increase_contrast
  6619. @item lighter
  6620. @item linear_contrast
  6621. @item medium_contrast
  6622. @item negative
  6623. @item strong_contrast
  6624. @item vintage
  6625. @end table
  6626. Default is @code{none}.
  6627. @item master, m
  6628. Set the master key points. These points will define a second pass mapping. It
  6629. is sometimes called a "luminance" or "value" mapping. It can be used with
  6630. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6631. post-processing LUT.
  6632. @item red, r
  6633. Set the key points for the red component.
  6634. @item green, g
  6635. Set the key points for the green component.
  6636. @item blue, b
  6637. Set the key points for the blue component.
  6638. @item all
  6639. Set the key points for all components (not including master).
  6640. Can be used in addition to the other key points component
  6641. options. In this case, the unset component(s) will fallback on this
  6642. @option{all} setting.
  6643. @item psfile
  6644. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6645. @item plot
  6646. Save Gnuplot script of the curves in specified file.
  6647. @end table
  6648. To avoid some filtergraph syntax conflicts, each key points list need to be
  6649. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6650. @subsection Examples
  6651. @itemize
  6652. @item
  6653. Increase slightly the middle level of blue:
  6654. @example
  6655. curves=blue='0/0 0.5/0.58 1/1'
  6656. @end example
  6657. @item
  6658. Vintage effect:
  6659. @example
  6660. 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'
  6661. @end example
  6662. Here we obtain the following coordinates for each components:
  6663. @table @var
  6664. @item red
  6665. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6666. @item green
  6667. @code{(0;0) (0.50;0.48) (1;1)}
  6668. @item blue
  6669. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6670. @end table
  6671. @item
  6672. The previous example can also be achieved with the associated built-in preset:
  6673. @example
  6674. curves=preset=vintage
  6675. @end example
  6676. @item
  6677. Or simply:
  6678. @example
  6679. curves=vintage
  6680. @end example
  6681. @item
  6682. Use a Photoshop preset and redefine the points of the green component:
  6683. @example
  6684. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6685. @end example
  6686. @item
  6687. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6688. and @command{gnuplot}:
  6689. @example
  6690. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6691. gnuplot -p /tmp/curves.plt
  6692. @end example
  6693. @end itemize
  6694. @section datascope
  6695. Video data analysis filter.
  6696. This filter shows hexadecimal pixel values of part of video.
  6697. The filter accepts the following options:
  6698. @table @option
  6699. @item size, s
  6700. Set output video size.
  6701. @item x
  6702. Set x offset from where to pick pixels.
  6703. @item y
  6704. Set y offset from where to pick pixels.
  6705. @item mode
  6706. Set scope mode, can be one of the following:
  6707. @table @samp
  6708. @item mono
  6709. Draw hexadecimal pixel values with white color on black background.
  6710. @item color
  6711. Draw hexadecimal pixel values with input video pixel color on black
  6712. background.
  6713. @item color2
  6714. Draw hexadecimal pixel values on color background picked from input video,
  6715. the text color is picked in such way so its always visible.
  6716. @end table
  6717. @item axis
  6718. Draw rows and columns numbers on left and top of video.
  6719. @item opacity
  6720. Set background opacity.
  6721. @item format
  6722. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6723. @end table
  6724. @section dblur
  6725. Apply Directional blur filter.
  6726. The filter accepts the following options:
  6727. @table @option
  6728. @item angle
  6729. Set angle of directional blur. Default is @code{45}.
  6730. @item radius
  6731. Set radius of directional blur. Default is @code{5}.
  6732. @item planes
  6733. Set which planes to filter. By default all planes are filtered.
  6734. @end table
  6735. @subsection Commands
  6736. This filter supports same @ref{commands} as options.
  6737. The command accepts the same syntax of the corresponding option.
  6738. If the specified expression is not valid, it is kept at its current
  6739. value.
  6740. @section dctdnoiz
  6741. Denoise frames using 2D DCT (frequency domain filtering).
  6742. This filter is not designed for real time.
  6743. The filter accepts the following options:
  6744. @table @option
  6745. @item sigma, s
  6746. Set the noise sigma constant.
  6747. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6748. coefficient (absolute value) below this threshold with be dropped.
  6749. If you need a more advanced filtering, see @option{expr}.
  6750. Default is @code{0}.
  6751. @item overlap
  6752. Set number overlapping pixels for each block. Since the filter can be slow, you
  6753. may want to reduce this value, at the cost of a less effective filter and the
  6754. risk of various artefacts.
  6755. If the overlapping value doesn't permit processing the whole input width or
  6756. height, a warning will be displayed and according borders won't be denoised.
  6757. Default value is @var{blocksize}-1, which is the best possible setting.
  6758. @item expr, e
  6759. Set the coefficient factor expression.
  6760. For each coefficient of a DCT block, this expression will be evaluated as a
  6761. multiplier value for the coefficient.
  6762. If this is option is set, the @option{sigma} option will be ignored.
  6763. The absolute value of the coefficient can be accessed through the @var{c}
  6764. variable.
  6765. @item n
  6766. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6767. @var{blocksize}, which is the width and height of the processed blocks.
  6768. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6769. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6770. on the speed processing. Also, a larger block size does not necessarily means a
  6771. better de-noising.
  6772. @end table
  6773. @subsection Examples
  6774. Apply a denoise with a @option{sigma} of @code{4.5}:
  6775. @example
  6776. dctdnoiz=4.5
  6777. @end example
  6778. The same operation can be achieved using the expression system:
  6779. @example
  6780. dctdnoiz=e='gte(c, 4.5*3)'
  6781. @end example
  6782. Violent denoise using a block size of @code{16x16}:
  6783. @example
  6784. dctdnoiz=15:n=4
  6785. @end example
  6786. @section deband
  6787. Remove banding artifacts from input video.
  6788. It works by replacing banded pixels with average value of referenced pixels.
  6789. The filter accepts the following options:
  6790. @table @option
  6791. @item 1thr
  6792. @item 2thr
  6793. @item 3thr
  6794. @item 4thr
  6795. Set banding detection threshold for each plane. Default is 0.02.
  6796. Valid range is 0.00003 to 0.5.
  6797. If difference between current pixel and reference pixel is less than threshold,
  6798. it will be considered as banded.
  6799. @item range, r
  6800. Banding detection range in pixels. Default is 16. If positive, random number
  6801. in range 0 to set value will be used. If negative, exact absolute value
  6802. will be used.
  6803. The range defines square of four pixels around current pixel.
  6804. @item direction, d
  6805. Set direction in radians from which four pixel will be compared. If positive,
  6806. random direction from 0 to set direction will be picked. If negative, exact of
  6807. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6808. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6809. column.
  6810. @item blur, b
  6811. If enabled, current pixel is compared with average value of all four
  6812. surrounding pixels. The default is enabled. If disabled current pixel is
  6813. compared with all four surrounding pixels. The pixel is considered banded
  6814. if only all four differences with surrounding pixels are less than threshold.
  6815. @item coupling, c
  6816. If enabled, current pixel is changed if and only if all pixel components are banded,
  6817. e.g. banding detection threshold is triggered for all color components.
  6818. The default is disabled.
  6819. @end table
  6820. @section deblock
  6821. Remove blocking artifacts from input video.
  6822. The filter accepts the following options:
  6823. @table @option
  6824. @item filter
  6825. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6826. This controls what kind of deblocking is applied.
  6827. @item block
  6828. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6829. @item alpha
  6830. @item beta
  6831. @item gamma
  6832. @item delta
  6833. Set blocking detection thresholds. Allowed range is 0 to 1.
  6834. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6835. Using higher threshold gives more deblocking strength.
  6836. Setting @var{alpha} controls threshold detection at exact edge of block.
  6837. Remaining options controls threshold detection near the edge. Each one for
  6838. below/above or left/right. Setting any of those to @var{0} disables
  6839. deblocking.
  6840. @item planes
  6841. Set planes to filter. Default is to filter all available planes.
  6842. @end table
  6843. @subsection Examples
  6844. @itemize
  6845. @item
  6846. Deblock using weak filter and block size of 4 pixels.
  6847. @example
  6848. deblock=filter=weak:block=4
  6849. @end example
  6850. @item
  6851. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6852. deblocking more edges.
  6853. @example
  6854. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6855. @end example
  6856. @item
  6857. Similar as above, but filter only first plane.
  6858. @example
  6859. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6860. @end example
  6861. @item
  6862. Similar as above, but filter only second and third plane.
  6863. @example
  6864. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6865. @end example
  6866. @end itemize
  6867. @anchor{decimate}
  6868. @section decimate
  6869. Drop duplicated frames at regular intervals.
  6870. The filter accepts the following options:
  6871. @table @option
  6872. @item cycle
  6873. Set the number of frames from which one will be dropped. Setting this to
  6874. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6875. Default is @code{5}.
  6876. @item dupthresh
  6877. Set the threshold for duplicate detection. If the difference metric for a frame
  6878. is less than or equal to this value, then it is declared as duplicate. Default
  6879. is @code{1.1}
  6880. @item scthresh
  6881. Set scene change threshold. Default is @code{15}.
  6882. @item blockx
  6883. @item blocky
  6884. Set the size of the x and y-axis blocks used during metric calculations.
  6885. Larger blocks give better noise suppression, but also give worse detection of
  6886. small movements. Must be a power of two. Default is @code{32}.
  6887. @item ppsrc
  6888. Mark main input as a pre-processed input and activate clean source input
  6889. stream. This allows the input to be pre-processed with various filters to help
  6890. the metrics calculation while keeping the frame selection lossless. When set to
  6891. @code{1}, the first stream is for the pre-processed input, and the second
  6892. stream is the clean source from where the kept frames are chosen. Default is
  6893. @code{0}.
  6894. @item chroma
  6895. Set whether or not chroma is considered in the metric calculations. Default is
  6896. @code{1}.
  6897. @end table
  6898. @section deconvolve
  6899. Apply 2D deconvolution of video stream in frequency domain using second stream
  6900. as impulse.
  6901. The filter accepts the following options:
  6902. @table @option
  6903. @item planes
  6904. Set which planes to process.
  6905. @item impulse
  6906. Set which impulse video frames will be processed, can be @var{first}
  6907. or @var{all}. Default is @var{all}.
  6908. @item noise
  6909. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6910. and height are not same and not power of 2 or if stream prior to convolving
  6911. had noise.
  6912. @end table
  6913. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6914. @section dedot
  6915. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6916. It accepts the following options:
  6917. @table @option
  6918. @item m
  6919. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6920. @var{rainbows} for cross-color reduction.
  6921. @item lt
  6922. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6923. @item tl
  6924. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6925. @item tc
  6926. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6927. @item ct
  6928. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6929. @end table
  6930. @section deflate
  6931. Apply deflate effect to the video.
  6932. This filter replaces the pixel by the local(3x3) average by taking into account
  6933. only values lower than the pixel.
  6934. It accepts the following options:
  6935. @table @option
  6936. @item threshold0
  6937. @item threshold1
  6938. @item threshold2
  6939. @item threshold3
  6940. Limit the maximum change for each plane, default is 65535.
  6941. If 0, plane will remain unchanged.
  6942. @end table
  6943. @subsection Commands
  6944. This filter supports the all above options as @ref{commands}.
  6945. @section deflicker
  6946. Remove temporal frame luminance variations.
  6947. It accepts the following options:
  6948. @table @option
  6949. @item size, s
  6950. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6951. @item mode, m
  6952. Set averaging mode to smooth temporal luminance variations.
  6953. Available values are:
  6954. @table @samp
  6955. @item am
  6956. Arithmetic mean
  6957. @item gm
  6958. Geometric mean
  6959. @item hm
  6960. Harmonic mean
  6961. @item qm
  6962. Quadratic mean
  6963. @item cm
  6964. Cubic mean
  6965. @item pm
  6966. Power mean
  6967. @item median
  6968. Median
  6969. @end table
  6970. @item bypass
  6971. Do not actually modify frame. Useful when one only wants metadata.
  6972. @end table
  6973. @section dejudder
  6974. Remove judder produced by partially interlaced telecined content.
  6975. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6976. source was partially telecined content then the output of @code{pullup,dejudder}
  6977. will have a variable frame rate. May change the recorded frame rate of the
  6978. container. Aside from that change, this filter will not affect constant frame
  6979. rate video.
  6980. The option available in this filter is:
  6981. @table @option
  6982. @item cycle
  6983. Specify the length of the window over which the judder repeats.
  6984. Accepts any integer greater than 1. Useful values are:
  6985. @table @samp
  6986. @item 4
  6987. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6988. @item 5
  6989. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6990. @item 20
  6991. If a mixture of the two.
  6992. @end table
  6993. The default is @samp{4}.
  6994. @end table
  6995. @section delogo
  6996. Suppress a TV station logo by a simple interpolation of the surrounding
  6997. pixels. Just set a rectangle covering the logo and watch it disappear
  6998. (and sometimes something even uglier appear - your mileage may vary).
  6999. It accepts the following parameters:
  7000. @table @option
  7001. @item x
  7002. @item y
  7003. Specify the top left corner coordinates of the logo. They must be
  7004. specified.
  7005. @item w
  7006. @item h
  7007. Specify the width and height of the logo to clear. They must be
  7008. specified.
  7009. @item band, t
  7010. Specify the thickness of the fuzzy edge of the rectangle (added to
  7011. @var{w} and @var{h}). The default value is 1. This option is
  7012. deprecated, setting higher values should no longer be necessary and
  7013. is not recommended.
  7014. @item show
  7015. When set to 1, a green rectangle is drawn on the screen to simplify
  7016. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7017. The default value is 0.
  7018. The rectangle is drawn on the outermost pixels which will be (partly)
  7019. replaced with interpolated values. The values of the next pixels
  7020. immediately outside this rectangle in each direction will be used to
  7021. compute the interpolated pixel values inside the rectangle.
  7022. @end table
  7023. @subsection Examples
  7024. @itemize
  7025. @item
  7026. Set a rectangle covering the area with top left corner coordinates 0,0
  7027. and size 100x77, and a band of size 10:
  7028. @example
  7029. delogo=x=0:y=0:w=100:h=77:band=10
  7030. @end example
  7031. @end itemize
  7032. @anchor{derain}
  7033. @section derain
  7034. Remove the rain in the input image/video by applying the derain methods based on
  7035. convolutional neural networks. Supported models:
  7036. @itemize
  7037. @item
  7038. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7039. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7040. @end itemize
  7041. Training as well as model generation scripts are provided in
  7042. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7043. Native model files (.model) can be generated from TensorFlow model
  7044. files (.pb) by using tools/python/convert.py
  7045. The filter accepts the following options:
  7046. @table @option
  7047. @item filter_type
  7048. Specify which filter to use. This option accepts the following values:
  7049. @table @samp
  7050. @item derain
  7051. Derain filter. To conduct derain filter, you need to use a derain model.
  7052. @item dehaze
  7053. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7054. @end table
  7055. Default value is @samp{derain}.
  7056. @item dnn_backend
  7057. Specify which DNN backend to use for model loading and execution. This option accepts
  7058. the following values:
  7059. @table @samp
  7060. @item native
  7061. Native implementation of DNN loading and execution.
  7062. @item tensorflow
  7063. TensorFlow backend. To enable this backend you
  7064. need to install the TensorFlow for C library (see
  7065. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7066. @code{--enable-libtensorflow}
  7067. @end table
  7068. Default value is @samp{native}.
  7069. @item model
  7070. Set path to model file specifying network architecture and its parameters.
  7071. Note that different backends use different file formats. TensorFlow and native
  7072. backend can load files for only its format.
  7073. @end table
  7074. It can also be finished with @ref{dnn_processing} filter.
  7075. @section deshake
  7076. Attempt to fix small changes in horizontal and/or vertical shift. This
  7077. filter helps remove camera shake from hand-holding a camera, bumping a
  7078. tripod, moving on a vehicle, etc.
  7079. The filter accepts the following options:
  7080. @table @option
  7081. @item x
  7082. @item y
  7083. @item w
  7084. @item h
  7085. Specify a rectangular area where to limit the search for motion
  7086. vectors.
  7087. If desired the search for motion vectors can be limited to a
  7088. rectangular area of the frame defined by its top left corner, width
  7089. and height. These parameters have the same meaning as the drawbox
  7090. filter which can be used to visualise the position of the bounding
  7091. box.
  7092. This is useful when simultaneous movement of subjects within the frame
  7093. might be confused for camera motion by the motion vector search.
  7094. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7095. then the full frame is used. This allows later options to be set
  7096. without specifying the bounding box for the motion vector search.
  7097. Default - search the whole frame.
  7098. @item rx
  7099. @item ry
  7100. Specify the maximum extent of movement in x and y directions in the
  7101. range 0-64 pixels. Default 16.
  7102. @item edge
  7103. Specify how to generate pixels to fill blanks at the edge of the
  7104. frame. Available values are:
  7105. @table @samp
  7106. @item blank, 0
  7107. Fill zeroes at blank locations
  7108. @item original, 1
  7109. Original image at blank locations
  7110. @item clamp, 2
  7111. Extruded edge value at blank locations
  7112. @item mirror, 3
  7113. Mirrored edge at blank locations
  7114. @end table
  7115. Default value is @samp{mirror}.
  7116. @item blocksize
  7117. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7118. default 8.
  7119. @item contrast
  7120. Specify the contrast threshold for blocks. Only blocks with more than
  7121. the specified contrast (difference between darkest and lightest
  7122. pixels) will be considered. Range 1-255, default 125.
  7123. @item search
  7124. Specify the search strategy. Available values are:
  7125. @table @samp
  7126. @item exhaustive, 0
  7127. Set exhaustive search
  7128. @item less, 1
  7129. Set less exhaustive search.
  7130. @end table
  7131. Default value is @samp{exhaustive}.
  7132. @item filename
  7133. If set then a detailed log of the motion search is written to the
  7134. specified file.
  7135. @end table
  7136. @section despill
  7137. Remove unwanted contamination of foreground colors, caused by reflected color of
  7138. greenscreen or bluescreen.
  7139. This filter accepts the following options:
  7140. @table @option
  7141. @item type
  7142. Set what type of despill to use.
  7143. @item mix
  7144. Set how spillmap will be generated.
  7145. @item expand
  7146. Set how much to get rid of still remaining spill.
  7147. @item red
  7148. Controls amount of red in spill area.
  7149. @item green
  7150. Controls amount of green in spill area.
  7151. Should be -1 for greenscreen.
  7152. @item blue
  7153. Controls amount of blue in spill area.
  7154. Should be -1 for bluescreen.
  7155. @item brightness
  7156. Controls brightness of spill area, preserving colors.
  7157. @item alpha
  7158. Modify alpha from generated spillmap.
  7159. @end table
  7160. @section detelecine
  7161. Apply an exact inverse of the telecine operation. It requires a predefined
  7162. pattern specified using the pattern option which must be the same as that passed
  7163. to the telecine filter.
  7164. This filter accepts the following options:
  7165. @table @option
  7166. @item first_field
  7167. @table @samp
  7168. @item top, t
  7169. top field first
  7170. @item bottom, b
  7171. bottom field first
  7172. The default value is @code{top}.
  7173. @end table
  7174. @item pattern
  7175. A string of numbers representing the pulldown pattern you wish to apply.
  7176. The default value is @code{23}.
  7177. @item start_frame
  7178. A number representing position of the first frame with respect to the telecine
  7179. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7180. @end table
  7181. @section dilation
  7182. Apply dilation effect to the video.
  7183. This filter replaces the pixel by the local(3x3) maximum.
  7184. It accepts the following options:
  7185. @table @option
  7186. @item threshold0
  7187. @item threshold1
  7188. @item threshold2
  7189. @item threshold3
  7190. Limit the maximum change for each plane, default is 65535.
  7191. If 0, plane will remain unchanged.
  7192. @item coordinates
  7193. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7194. pixels are used.
  7195. Flags to local 3x3 coordinates maps like this:
  7196. 1 2 3
  7197. 4 5
  7198. 6 7 8
  7199. @end table
  7200. @subsection Commands
  7201. This filter supports the all above options as @ref{commands}.
  7202. @section displace
  7203. Displace pixels as indicated by second and third input stream.
  7204. It takes three input streams and outputs one stream, the first input is the
  7205. source, and second and third input are displacement maps.
  7206. The second input specifies how much to displace pixels along the
  7207. x-axis, while the third input specifies how much to displace pixels
  7208. along the y-axis.
  7209. If one of displacement map streams terminates, last frame from that
  7210. displacement map will be used.
  7211. Note that once generated, displacements maps can be reused over and over again.
  7212. A description of the accepted options follows.
  7213. @table @option
  7214. @item edge
  7215. Set displace behavior for pixels that are out of range.
  7216. Available values are:
  7217. @table @samp
  7218. @item blank
  7219. Missing pixels are replaced by black pixels.
  7220. @item smear
  7221. Adjacent pixels will spread out to replace missing pixels.
  7222. @item wrap
  7223. Out of range pixels are wrapped so they point to pixels of other side.
  7224. @item mirror
  7225. Out of range pixels will be replaced with mirrored pixels.
  7226. @end table
  7227. Default is @samp{smear}.
  7228. @end table
  7229. @subsection Examples
  7230. @itemize
  7231. @item
  7232. Add ripple effect to rgb input of video size hd720:
  7233. @example
  7234. 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
  7235. @end example
  7236. @item
  7237. Add wave effect to rgb input of video size hd720:
  7238. @example
  7239. 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
  7240. @end example
  7241. @end itemize
  7242. @anchor{dnn_processing}
  7243. @section dnn_processing
  7244. Do image processing with deep neural networks. It works together with another filter
  7245. which converts the pixel format of the Frame to what the dnn network requires.
  7246. The filter accepts the following options:
  7247. @table @option
  7248. @item dnn_backend
  7249. Specify which DNN backend to use for model loading and execution. This option accepts
  7250. the following values:
  7251. @table @samp
  7252. @item native
  7253. Native implementation of DNN loading and execution.
  7254. @item tensorflow
  7255. TensorFlow backend. To enable this backend you
  7256. need to install the TensorFlow for C library (see
  7257. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7258. @code{--enable-libtensorflow}
  7259. @item openvino
  7260. OpenVINO backend. To enable this backend you
  7261. need to build and install the OpenVINO for C library (see
  7262. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7263. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7264. be needed if the header files and libraries are not installed into system path)
  7265. @end table
  7266. Default value is @samp{native}.
  7267. @item model
  7268. Set path to model file specifying network architecture and its parameters.
  7269. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7270. backend can load files for only its format.
  7271. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7272. @item input
  7273. Set the input name of the dnn network.
  7274. @item output
  7275. Set the output name of the dnn network.
  7276. @end table
  7277. @subsection Examples
  7278. @itemize
  7279. @item
  7280. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7281. @example
  7282. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7283. @end example
  7284. @item
  7285. Halve the pixel value of the frame with format gray32f:
  7286. @example
  7287. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7288. @end example
  7289. @item
  7290. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7291. @example
  7292. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7293. @end example
  7294. @item
  7295. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7296. @example
  7297. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7298. @end example
  7299. @end itemize
  7300. @section drawbox
  7301. Draw a colored box on the input image.
  7302. It accepts the following parameters:
  7303. @table @option
  7304. @item x
  7305. @item y
  7306. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7307. @item width, w
  7308. @item height, h
  7309. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7310. the input width and height. It defaults to 0.
  7311. @item color, c
  7312. Specify the color of the box to write. For the general syntax of this option,
  7313. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7314. value @code{invert} is used, the box edge color is the same as the
  7315. video with inverted luma.
  7316. @item thickness, t
  7317. The expression which sets the thickness of the box edge.
  7318. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7319. See below for the list of accepted constants.
  7320. @item replace
  7321. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7322. will overwrite the video's color and alpha pixels.
  7323. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7324. @end table
  7325. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7326. following constants:
  7327. @table @option
  7328. @item dar
  7329. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7330. @item hsub
  7331. @item vsub
  7332. horizontal and vertical chroma subsample values. For example for the
  7333. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7334. @item in_h, ih
  7335. @item in_w, iw
  7336. The input width and height.
  7337. @item sar
  7338. The input sample aspect ratio.
  7339. @item x
  7340. @item y
  7341. The x and y offset coordinates where the box is drawn.
  7342. @item w
  7343. @item h
  7344. The width and height of the drawn box.
  7345. @item t
  7346. The thickness of the drawn box.
  7347. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7348. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7349. @end table
  7350. @subsection Examples
  7351. @itemize
  7352. @item
  7353. Draw a black box around the edge of the input image:
  7354. @example
  7355. drawbox
  7356. @end example
  7357. @item
  7358. Draw a box with color red and an opacity of 50%:
  7359. @example
  7360. drawbox=10:20:200:60:red@@0.5
  7361. @end example
  7362. The previous example can be specified as:
  7363. @example
  7364. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7365. @end example
  7366. @item
  7367. Fill the box with pink color:
  7368. @example
  7369. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7370. @end example
  7371. @item
  7372. Draw a 2-pixel red 2.40:1 mask:
  7373. @example
  7374. 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
  7375. @end example
  7376. @end itemize
  7377. @subsection Commands
  7378. This filter supports same commands as options.
  7379. The command accepts the same syntax of the corresponding option.
  7380. If the specified expression is not valid, it is kept at its current
  7381. value.
  7382. @anchor{drawgraph}
  7383. @section drawgraph
  7384. Draw a graph using input video metadata.
  7385. It accepts the following parameters:
  7386. @table @option
  7387. @item m1
  7388. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7389. @item fg1
  7390. Set 1st foreground color expression.
  7391. @item m2
  7392. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7393. @item fg2
  7394. Set 2nd foreground color expression.
  7395. @item m3
  7396. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7397. @item fg3
  7398. Set 3rd foreground color expression.
  7399. @item m4
  7400. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7401. @item fg4
  7402. Set 4th foreground color expression.
  7403. @item min
  7404. Set minimal value of metadata value.
  7405. @item max
  7406. Set maximal value of metadata value.
  7407. @item bg
  7408. Set graph background color. Default is white.
  7409. @item mode
  7410. Set graph mode.
  7411. Available values for mode is:
  7412. @table @samp
  7413. @item bar
  7414. @item dot
  7415. @item line
  7416. @end table
  7417. Default is @code{line}.
  7418. @item slide
  7419. Set slide mode.
  7420. Available values for slide is:
  7421. @table @samp
  7422. @item frame
  7423. Draw new frame when right border is reached.
  7424. @item replace
  7425. Replace old columns with new ones.
  7426. @item scroll
  7427. Scroll from right to left.
  7428. @item rscroll
  7429. Scroll from left to right.
  7430. @item picture
  7431. Draw single picture.
  7432. @end table
  7433. Default is @code{frame}.
  7434. @item size
  7435. Set size of graph video. For the syntax of this option, check the
  7436. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7437. The default value is @code{900x256}.
  7438. @item rate, r
  7439. Set the output frame rate. Default value is @code{25}.
  7440. The foreground color expressions can use the following variables:
  7441. @table @option
  7442. @item MIN
  7443. Minimal value of metadata value.
  7444. @item MAX
  7445. Maximal value of metadata value.
  7446. @item VAL
  7447. Current metadata key value.
  7448. @end table
  7449. The color is defined as 0xAABBGGRR.
  7450. @end table
  7451. Example using metadata from @ref{signalstats} filter:
  7452. @example
  7453. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7454. @end example
  7455. Example using metadata from @ref{ebur128} filter:
  7456. @example
  7457. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7458. @end example
  7459. @section drawgrid
  7460. Draw a grid on the input image.
  7461. It accepts the following parameters:
  7462. @table @option
  7463. @item x
  7464. @item y
  7465. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7466. @item width, w
  7467. @item height, h
  7468. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7469. input width and height, respectively, minus @code{thickness}, so image gets
  7470. framed. Default to 0.
  7471. @item color, c
  7472. Specify the color of the grid. For the general syntax of this option,
  7473. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7474. value @code{invert} is used, the grid color is the same as the
  7475. video with inverted luma.
  7476. @item thickness, t
  7477. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7478. See below for the list of accepted constants.
  7479. @item replace
  7480. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7481. will overwrite the video's color and alpha pixels.
  7482. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7483. @end table
  7484. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7485. following constants:
  7486. @table @option
  7487. @item dar
  7488. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7489. @item hsub
  7490. @item vsub
  7491. horizontal and vertical chroma subsample values. For example for the
  7492. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7493. @item in_h, ih
  7494. @item in_w, iw
  7495. The input grid cell width and height.
  7496. @item sar
  7497. The input sample aspect ratio.
  7498. @item x
  7499. @item y
  7500. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7501. @item w
  7502. @item h
  7503. The width and height of the drawn cell.
  7504. @item t
  7505. The thickness of the drawn cell.
  7506. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7507. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7508. @end table
  7509. @subsection Examples
  7510. @itemize
  7511. @item
  7512. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7513. @example
  7514. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7515. @end example
  7516. @item
  7517. Draw a white 3x3 grid with an opacity of 50%:
  7518. @example
  7519. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7520. @end example
  7521. @end itemize
  7522. @subsection Commands
  7523. This filter supports same commands as options.
  7524. The command accepts the same syntax of the corresponding option.
  7525. If the specified expression is not valid, it is kept at its current
  7526. value.
  7527. @anchor{drawtext}
  7528. @section drawtext
  7529. Draw a text string or text from a specified file on top of a video, using the
  7530. libfreetype library.
  7531. To enable compilation of this filter, you need to configure FFmpeg with
  7532. @code{--enable-libfreetype}.
  7533. To enable default font fallback and the @var{font} option you need to
  7534. configure FFmpeg with @code{--enable-libfontconfig}.
  7535. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7536. @code{--enable-libfribidi}.
  7537. @subsection Syntax
  7538. It accepts the following parameters:
  7539. @table @option
  7540. @item box
  7541. Used to draw a box around text using the background color.
  7542. The value must be either 1 (enable) or 0 (disable).
  7543. The default value of @var{box} is 0.
  7544. @item boxborderw
  7545. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7546. The default value of @var{boxborderw} is 0.
  7547. @item boxcolor
  7548. The color to be used for drawing box around text. For the syntax of this
  7549. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7550. The default value of @var{boxcolor} is "white".
  7551. @item line_spacing
  7552. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7553. The default value of @var{line_spacing} is 0.
  7554. @item borderw
  7555. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7556. The default value of @var{borderw} is 0.
  7557. @item bordercolor
  7558. Set the color to be used for drawing border around text. For the syntax of this
  7559. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7560. The default value of @var{bordercolor} is "black".
  7561. @item expansion
  7562. Select how the @var{text} is expanded. Can be either @code{none},
  7563. @code{strftime} (deprecated) or
  7564. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7565. below for details.
  7566. @item basetime
  7567. Set a start time for the count. Value is in microseconds. Only applied
  7568. in the deprecated strftime expansion mode. To emulate in normal expansion
  7569. mode use the @code{pts} function, supplying the start time (in seconds)
  7570. as the second argument.
  7571. @item fix_bounds
  7572. If true, check and fix text coords to avoid clipping.
  7573. @item fontcolor
  7574. The color to be used for drawing fonts. For the syntax of this option, check
  7575. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7576. The default value of @var{fontcolor} is "black".
  7577. @item fontcolor_expr
  7578. String which is expanded the same way as @var{text} to obtain dynamic
  7579. @var{fontcolor} value. By default this option has empty value and is not
  7580. processed. When this option is set, it overrides @var{fontcolor} option.
  7581. @item font
  7582. The font family to be used for drawing text. By default Sans.
  7583. @item fontfile
  7584. The font file to be used for drawing text. The path must be included.
  7585. This parameter is mandatory if the fontconfig support is disabled.
  7586. @item alpha
  7587. Draw the text applying alpha blending. The value can
  7588. be a number between 0.0 and 1.0.
  7589. The expression accepts the same variables @var{x, y} as well.
  7590. The default value is 1.
  7591. Please see @var{fontcolor_expr}.
  7592. @item fontsize
  7593. The font size to be used for drawing text.
  7594. The default value of @var{fontsize} is 16.
  7595. @item text_shaping
  7596. If set to 1, attempt to shape the text (for example, reverse the order of
  7597. right-to-left text and join Arabic characters) before drawing it.
  7598. Otherwise, just draw the text exactly as given.
  7599. By default 1 (if supported).
  7600. @item ft_load_flags
  7601. The flags to be used for loading the fonts.
  7602. The flags map the corresponding flags supported by libfreetype, and are
  7603. a combination of the following values:
  7604. @table @var
  7605. @item default
  7606. @item no_scale
  7607. @item no_hinting
  7608. @item render
  7609. @item no_bitmap
  7610. @item vertical_layout
  7611. @item force_autohint
  7612. @item crop_bitmap
  7613. @item pedantic
  7614. @item ignore_global_advance_width
  7615. @item no_recurse
  7616. @item ignore_transform
  7617. @item monochrome
  7618. @item linear_design
  7619. @item no_autohint
  7620. @end table
  7621. Default value is "default".
  7622. For more information consult the documentation for the FT_LOAD_*
  7623. libfreetype flags.
  7624. @item shadowcolor
  7625. The color to be used for drawing a shadow behind the drawn text. For the
  7626. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7627. ffmpeg-utils manual,ffmpeg-utils}.
  7628. The default value of @var{shadowcolor} is "black".
  7629. @item shadowx
  7630. @item shadowy
  7631. The x and y offsets for the text shadow position with respect to the
  7632. position of the text. They can be either positive or negative
  7633. values. The default value for both is "0".
  7634. @item start_number
  7635. The starting frame number for the n/frame_num variable. The default value
  7636. is "0".
  7637. @item tabsize
  7638. The size in number of spaces to use for rendering the tab.
  7639. Default value is 4.
  7640. @item timecode
  7641. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7642. format. It can be used with or without text parameter. @var{timecode_rate}
  7643. option must be specified.
  7644. @item timecode_rate, rate, r
  7645. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7646. integer. Minimum value is "1".
  7647. Drop-frame timecode is supported for frame rates 30 & 60.
  7648. @item tc24hmax
  7649. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7650. Default is 0 (disabled).
  7651. @item text
  7652. The text string to be drawn. The text must be a sequence of UTF-8
  7653. encoded characters.
  7654. This parameter is mandatory if no file is specified with the parameter
  7655. @var{textfile}.
  7656. @item textfile
  7657. A text file containing text to be drawn. The text must be a sequence
  7658. of UTF-8 encoded characters.
  7659. This parameter is mandatory if no text string is specified with the
  7660. parameter @var{text}.
  7661. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7662. @item reload
  7663. If set to 1, the @var{textfile} will be reloaded before each frame.
  7664. Be sure to update it atomically, or it may be read partially, or even fail.
  7665. @item x
  7666. @item y
  7667. The expressions which specify the offsets where text will be drawn
  7668. within the video frame. They are relative to the top/left border of the
  7669. output image.
  7670. The default value of @var{x} and @var{y} is "0".
  7671. See below for the list of accepted constants and functions.
  7672. @end table
  7673. The parameters for @var{x} and @var{y} are expressions containing the
  7674. following constants and functions:
  7675. @table @option
  7676. @item dar
  7677. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7678. @item hsub
  7679. @item vsub
  7680. horizontal and vertical chroma subsample values. For example for the
  7681. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7682. @item line_h, lh
  7683. the height of each text line
  7684. @item main_h, h, H
  7685. the input height
  7686. @item main_w, w, W
  7687. the input width
  7688. @item max_glyph_a, ascent
  7689. the maximum distance from the baseline to the highest/upper grid
  7690. coordinate used to place a glyph outline point, for all the rendered
  7691. glyphs.
  7692. It is a positive value, due to the grid's orientation with the Y axis
  7693. upwards.
  7694. @item max_glyph_d, descent
  7695. the maximum distance from the baseline to the lowest grid coordinate
  7696. used to place a glyph outline point, for all the rendered glyphs.
  7697. This is a negative value, due to the grid's orientation, with the Y axis
  7698. upwards.
  7699. @item max_glyph_h
  7700. maximum glyph height, that is the maximum height for all the glyphs
  7701. contained in the rendered text, it is equivalent to @var{ascent} -
  7702. @var{descent}.
  7703. @item max_glyph_w
  7704. maximum glyph width, that is the maximum width for all the glyphs
  7705. contained in the rendered text
  7706. @item n
  7707. the number of input frame, starting from 0
  7708. @item rand(min, max)
  7709. return a random number included between @var{min} and @var{max}
  7710. @item sar
  7711. The input sample aspect ratio.
  7712. @item t
  7713. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7714. @item text_h, th
  7715. the height of the rendered text
  7716. @item text_w, tw
  7717. the width of the rendered text
  7718. @item x
  7719. @item y
  7720. the x and y offset coordinates where the text is drawn.
  7721. These parameters allow the @var{x} and @var{y} expressions to refer
  7722. to each other, so you can for example specify @code{y=x/dar}.
  7723. @item pict_type
  7724. A one character description of the current frame's picture type.
  7725. @item pkt_pos
  7726. The current packet's position in the input file or stream
  7727. (in bytes, from the start of the input). A value of -1 indicates
  7728. this info is not available.
  7729. @item pkt_duration
  7730. The current packet's duration, in seconds.
  7731. @item pkt_size
  7732. The current packet's size (in bytes).
  7733. @end table
  7734. @anchor{drawtext_expansion}
  7735. @subsection Text expansion
  7736. If @option{expansion} is set to @code{strftime},
  7737. the filter recognizes strftime() sequences in the provided text and
  7738. expands them accordingly. Check the documentation of strftime(). This
  7739. feature is deprecated.
  7740. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7741. If @option{expansion} is set to @code{normal} (which is the default),
  7742. the following expansion mechanism is used.
  7743. The backslash character @samp{\}, followed by any character, always expands to
  7744. the second character.
  7745. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7746. braces is a function name, possibly followed by arguments separated by ':'.
  7747. If the arguments contain special characters or delimiters (':' or '@}'),
  7748. they should be escaped.
  7749. Note that they probably must also be escaped as the value for the
  7750. @option{text} option in the filter argument string and as the filter
  7751. argument in the filtergraph description, and possibly also for the shell,
  7752. that makes up to four levels of escaping; using a text file avoids these
  7753. problems.
  7754. The following functions are available:
  7755. @table @command
  7756. @item expr, e
  7757. The expression evaluation result.
  7758. It must take one argument specifying the expression to be evaluated,
  7759. which accepts the same constants and functions as the @var{x} and
  7760. @var{y} values. Note that not all constants should be used, for
  7761. example the text size is not known when evaluating the expression, so
  7762. the constants @var{text_w} and @var{text_h} will have an undefined
  7763. value.
  7764. @item expr_int_format, eif
  7765. Evaluate the expression's value and output as formatted integer.
  7766. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7767. The second argument specifies the output format. Allowed values are @samp{x},
  7768. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7769. @code{printf} function.
  7770. The third parameter is optional and sets the number of positions taken by the output.
  7771. It can be used to add padding with zeros from the left.
  7772. @item gmtime
  7773. The time at which the filter is running, expressed in UTC.
  7774. It can accept an argument: a strftime() format string.
  7775. @item localtime
  7776. The time at which the filter is running, expressed in the local time zone.
  7777. It can accept an argument: a strftime() format string.
  7778. @item metadata
  7779. Frame metadata. Takes one or two arguments.
  7780. The first argument is mandatory and specifies the metadata key.
  7781. The second argument is optional and specifies a default value, used when the
  7782. metadata key is not found or empty.
  7783. Available metadata can be identified by inspecting entries
  7784. starting with TAG included within each frame section
  7785. printed by running @code{ffprobe -show_frames}.
  7786. String metadata generated in filters leading to
  7787. the drawtext filter are also available.
  7788. @item n, frame_num
  7789. The frame number, starting from 0.
  7790. @item pict_type
  7791. A one character description of the current picture type.
  7792. @item pts
  7793. The timestamp of the current frame.
  7794. It can take up to three arguments.
  7795. The first argument is the format of the timestamp; it defaults to @code{flt}
  7796. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7797. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7798. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7799. @code{localtime} stands for the timestamp of the frame formatted as
  7800. local time zone time.
  7801. The second argument is an offset added to the timestamp.
  7802. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7803. supplied to present the hour part of the formatted timestamp in 24h format
  7804. (00-23).
  7805. If the format is set to @code{localtime} or @code{gmtime},
  7806. a third argument may be supplied: a strftime() format string.
  7807. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7808. @end table
  7809. @subsection Commands
  7810. This filter supports altering parameters via commands:
  7811. @table @option
  7812. @item reinit
  7813. Alter existing filter parameters.
  7814. Syntax for the argument is the same as for filter invocation, e.g.
  7815. @example
  7816. fontsize=56:fontcolor=green:text='Hello World'
  7817. @end example
  7818. Full filter invocation with sendcmd would look like this:
  7819. @example
  7820. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7821. @end example
  7822. @end table
  7823. If the entire argument can't be parsed or applied as valid values then the filter will
  7824. continue with its existing parameters.
  7825. @subsection Examples
  7826. @itemize
  7827. @item
  7828. Draw "Test Text" with font FreeSerif, using the default values for the
  7829. optional parameters.
  7830. @example
  7831. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7832. @end example
  7833. @item
  7834. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7835. and y=50 (counting from the top-left corner of the screen), text is
  7836. yellow with a red box around it. Both the text and the box have an
  7837. opacity of 20%.
  7838. @example
  7839. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7840. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7841. @end example
  7842. Note that the double quotes are not necessary if spaces are not used
  7843. within the parameter list.
  7844. @item
  7845. Show the text at the center of the video frame:
  7846. @example
  7847. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7848. @end example
  7849. @item
  7850. Show the text at a random position, switching to a new position every 30 seconds:
  7851. @example
  7852. 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)"
  7853. @end example
  7854. @item
  7855. Show a text line sliding from right to left in the last row of the video
  7856. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7857. with no newlines.
  7858. @example
  7859. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7860. @end example
  7861. @item
  7862. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7863. @example
  7864. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7865. @end example
  7866. @item
  7867. Draw a single green letter "g", at the center of the input video.
  7868. The glyph baseline is placed at half screen height.
  7869. @example
  7870. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7871. @end example
  7872. @item
  7873. Show text for 1 second every 3 seconds:
  7874. @example
  7875. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7876. @end example
  7877. @item
  7878. Use fontconfig to set the font. Note that the colons need to be escaped.
  7879. @example
  7880. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7881. @end example
  7882. @item
  7883. Draw "Test Text" with font size dependent on height of the video.
  7884. @example
  7885. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  7886. @end example
  7887. @item
  7888. Print the date of a real-time encoding (see strftime(3)):
  7889. @example
  7890. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7891. @end example
  7892. @item
  7893. Show text fading in and out (appearing/disappearing):
  7894. @example
  7895. #!/bin/sh
  7896. DS=1.0 # display start
  7897. DE=10.0 # display end
  7898. FID=1.5 # fade in duration
  7899. FOD=5 # fade out duration
  7900. 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 @}"
  7901. @end example
  7902. @item
  7903. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7904. and the @option{fontsize} value are included in the @option{y} offset.
  7905. @example
  7906. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7907. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7908. @end example
  7909. @item
  7910. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7911. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7912. must have option @option{-export_path_metadata 1} for the special metadata fields
  7913. to be available for filters.
  7914. @example
  7915. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7916. @end example
  7917. @end itemize
  7918. For more information about libfreetype, check:
  7919. @url{http://www.freetype.org/}.
  7920. For more information about fontconfig, check:
  7921. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7922. For more information about libfribidi, check:
  7923. @url{http://fribidi.org/}.
  7924. @section edgedetect
  7925. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7926. The filter accepts the following options:
  7927. @table @option
  7928. @item low
  7929. @item high
  7930. Set low and high threshold values used by the Canny thresholding
  7931. algorithm.
  7932. The high threshold selects the "strong" edge pixels, which are then
  7933. connected through 8-connectivity with the "weak" edge pixels selected
  7934. by the low threshold.
  7935. @var{low} and @var{high} threshold values must be chosen in the range
  7936. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7937. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7938. is @code{50/255}.
  7939. @item mode
  7940. Define the drawing mode.
  7941. @table @samp
  7942. @item wires
  7943. Draw white/gray wires on black background.
  7944. @item colormix
  7945. Mix the colors to create a paint/cartoon effect.
  7946. @item canny
  7947. Apply Canny edge detector on all selected planes.
  7948. @end table
  7949. Default value is @var{wires}.
  7950. @item planes
  7951. Select planes for filtering. By default all available planes are filtered.
  7952. @end table
  7953. @subsection Examples
  7954. @itemize
  7955. @item
  7956. Standard edge detection with custom values for the hysteresis thresholding:
  7957. @example
  7958. edgedetect=low=0.1:high=0.4
  7959. @end example
  7960. @item
  7961. Painting effect without thresholding:
  7962. @example
  7963. edgedetect=mode=colormix:high=0
  7964. @end example
  7965. @end itemize
  7966. @section elbg
  7967. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7968. For each input image, the filter will compute the optimal mapping from
  7969. the input to the output given the codebook length, that is the number
  7970. of distinct output colors.
  7971. This filter accepts the following options.
  7972. @table @option
  7973. @item codebook_length, l
  7974. Set codebook length. The value must be a positive integer, and
  7975. represents the number of distinct output colors. Default value is 256.
  7976. @item nb_steps, n
  7977. Set the maximum number of iterations to apply for computing the optimal
  7978. mapping. The higher the value the better the result and the higher the
  7979. computation time. Default value is 1.
  7980. @item seed, s
  7981. Set a random seed, must be an integer included between 0 and
  7982. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7983. will try to use a good random seed on a best effort basis.
  7984. @item pal8
  7985. Set pal8 output pixel format. This option does not work with codebook
  7986. length greater than 256.
  7987. @end table
  7988. @section entropy
  7989. Measure graylevel entropy in histogram of color channels of video frames.
  7990. It accepts the following parameters:
  7991. @table @option
  7992. @item mode
  7993. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7994. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7995. between neighbour histogram values.
  7996. @end table
  7997. @section eq
  7998. Set brightness, contrast, saturation and approximate gamma adjustment.
  7999. The filter accepts the following options:
  8000. @table @option
  8001. @item contrast
  8002. Set the contrast expression. The value must be a float value in range
  8003. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8004. @item brightness
  8005. Set the brightness expression. The value must be a float value in
  8006. range @code{-1.0} to @code{1.0}. The default value is "0".
  8007. @item saturation
  8008. Set the saturation expression. The value must be a float in
  8009. range @code{0.0} to @code{3.0}. The default value is "1".
  8010. @item gamma
  8011. Set the gamma expression. The value must be a float in range
  8012. @code{0.1} to @code{10.0}. The default value is "1".
  8013. @item gamma_r
  8014. Set the gamma expression for red. The value must be a float in
  8015. range @code{0.1} to @code{10.0}. The default value is "1".
  8016. @item gamma_g
  8017. Set the gamma expression for green. The value must be a float in range
  8018. @code{0.1} to @code{10.0}. The default value is "1".
  8019. @item gamma_b
  8020. Set the gamma expression for blue. The value must be a float in range
  8021. @code{0.1} to @code{10.0}. The default value is "1".
  8022. @item gamma_weight
  8023. Set the gamma weight expression. It can be used to reduce the effect
  8024. of a high gamma value on bright image areas, e.g. keep them from
  8025. getting overamplified and just plain white. The value must be a float
  8026. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8027. gamma correction all the way down while @code{1.0} leaves it at its
  8028. full strength. Default is "1".
  8029. @item eval
  8030. Set when the expressions for brightness, contrast, saturation and
  8031. gamma expressions are evaluated.
  8032. It accepts the following values:
  8033. @table @samp
  8034. @item init
  8035. only evaluate expressions once during the filter initialization or
  8036. when a command is processed
  8037. @item frame
  8038. evaluate expressions for each incoming frame
  8039. @end table
  8040. Default value is @samp{init}.
  8041. @end table
  8042. The expressions accept the following parameters:
  8043. @table @option
  8044. @item n
  8045. frame count of the input frame starting from 0
  8046. @item pos
  8047. byte position of the corresponding packet in the input file, NAN if
  8048. unspecified
  8049. @item r
  8050. frame rate of the input video, NAN if the input frame rate is unknown
  8051. @item t
  8052. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8053. @end table
  8054. @subsection Commands
  8055. The filter supports the following commands:
  8056. @table @option
  8057. @item contrast
  8058. Set the contrast expression.
  8059. @item brightness
  8060. Set the brightness expression.
  8061. @item saturation
  8062. Set the saturation expression.
  8063. @item gamma
  8064. Set the gamma expression.
  8065. @item gamma_r
  8066. Set the gamma_r expression.
  8067. @item gamma_g
  8068. Set gamma_g expression.
  8069. @item gamma_b
  8070. Set gamma_b expression.
  8071. @item gamma_weight
  8072. Set gamma_weight expression.
  8073. The command accepts the same syntax of the corresponding option.
  8074. If the specified expression is not valid, it is kept at its current
  8075. value.
  8076. @end table
  8077. @section erosion
  8078. Apply erosion effect to the video.
  8079. This filter replaces the pixel by the local(3x3) minimum.
  8080. It accepts the following options:
  8081. @table @option
  8082. @item threshold0
  8083. @item threshold1
  8084. @item threshold2
  8085. @item threshold3
  8086. Limit the maximum change for each plane, default is 65535.
  8087. If 0, plane will remain unchanged.
  8088. @item coordinates
  8089. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8090. pixels are used.
  8091. Flags to local 3x3 coordinates maps like this:
  8092. 1 2 3
  8093. 4 5
  8094. 6 7 8
  8095. @end table
  8096. @subsection Commands
  8097. This filter supports the all above options as @ref{commands}.
  8098. @section extractplanes
  8099. Extract color channel components from input video stream into
  8100. separate grayscale video streams.
  8101. The filter accepts the following option:
  8102. @table @option
  8103. @item planes
  8104. Set plane(s) to extract.
  8105. Available values for planes are:
  8106. @table @samp
  8107. @item y
  8108. @item u
  8109. @item v
  8110. @item a
  8111. @item r
  8112. @item g
  8113. @item b
  8114. @end table
  8115. Choosing planes not available in the input will result in an error.
  8116. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8117. with @code{y}, @code{u}, @code{v} planes at same time.
  8118. @end table
  8119. @subsection Examples
  8120. @itemize
  8121. @item
  8122. Extract luma, u and v color channel component from input video frame
  8123. into 3 grayscale outputs:
  8124. @example
  8125. 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
  8126. @end example
  8127. @end itemize
  8128. @section fade
  8129. Apply a fade-in/out effect to the input video.
  8130. It accepts the following parameters:
  8131. @table @option
  8132. @item type, t
  8133. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8134. effect.
  8135. Default is @code{in}.
  8136. @item start_frame, s
  8137. Specify the number of the frame to start applying the fade
  8138. effect at. Default is 0.
  8139. @item nb_frames, n
  8140. The number of frames that the fade effect lasts. At the end of the
  8141. fade-in effect, the output video will have the same intensity as the input video.
  8142. At the end of the fade-out transition, the output video will be filled with the
  8143. selected @option{color}.
  8144. Default is 25.
  8145. @item alpha
  8146. If set to 1, fade only alpha channel, if one exists on the input.
  8147. Default value is 0.
  8148. @item start_time, st
  8149. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8150. effect. If both start_frame and start_time are specified, the fade will start at
  8151. whichever comes last. Default is 0.
  8152. @item duration, d
  8153. The number of seconds for which the fade effect has to last. At the end of the
  8154. fade-in effect the output video will have the same intensity as the input video,
  8155. at the end of the fade-out transition the output video will be filled with the
  8156. selected @option{color}.
  8157. If both duration and nb_frames are specified, duration is used. Default is 0
  8158. (nb_frames is used by default).
  8159. @item color, c
  8160. Specify the color of the fade. Default is "black".
  8161. @end table
  8162. @subsection Examples
  8163. @itemize
  8164. @item
  8165. Fade in the first 30 frames of video:
  8166. @example
  8167. fade=in:0:30
  8168. @end example
  8169. The command above is equivalent to:
  8170. @example
  8171. fade=t=in:s=0:n=30
  8172. @end example
  8173. @item
  8174. Fade out the last 45 frames of a 200-frame video:
  8175. @example
  8176. fade=out:155:45
  8177. fade=type=out:start_frame=155:nb_frames=45
  8178. @end example
  8179. @item
  8180. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8181. @example
  8182. fade=in:0:25, fade=out:975:25
  8183. @end example
  8184. @item
  8185. Make the first 5 frames yellow, then fade in from frame 5-24:
  8186. @example
  8187. fade=in:5:20:color=yellow
  8188. @end example
  8189. @item
  8190. Fade in alpha over first 25 frames of video:
  8191. @example
  8192. fade=in:0:25:alpha=1
  8193. @end example
  8194. @item
  8195. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8196. @example
  8197. fade=t=in:st=5.5:d=0.5
  8198. @end example
  8199. @end itemize
  8200. @section fftdnoiz
  8201. Denoise frames using 3D FFT (frequency domain filtering).
  8202. The filter accepts the following options:
  8203. @table @option
  8204. @item sigma
  8205. Set the noise sigma constant. This sets denoising strength.
  8206. Default value is 1. Allowed range is from 0 to 30.
  8207. Using very high sigma with low overlap may give blocking artifacts.
  8208. @item amount
  8209. Set amount of denoising. By default all detected noise is reduced.
  8210. Default value is 1. Allowed range is from 0 to 1.
  8211. @item block
  8212. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8213. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8214. block size in pixels is 2^4 which is 16.
  8215. @item overlap
  8216. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8217. @item prev
  8218. Set number of previous frames to use for denoising. By default is set to 0.
  8219. @item next
  8220. Set number of next frames to to use for denoising. By default is set to 0.
  8221. @item planes
  8222. Set planes which will be filtered, by default are all available filtered
  8223. except alpha.
  8224. @end table
  8225. @section fftfilt
  8226. Apply arbitrary expressions to samples in frequency domain
  8227. @table @option
  8228. @item dc_Y
  8229. Adjust the dc value (gain) of the luma plane of the image. The filter
  8230. accepts an integer value in range @code{0} to @code{1000}. The default
  8231. value is set to @code{0}.
  8232. @item dc_U
  8233. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8234. filter accepts an integer value in range @code{0} to @code{1000}. The
  8235. default value is set to @code{0}.
  8236. @item dc_V
  8237. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8238. filter accepts an integer value in range @code{0} to @code{1000}. The
  8239. default value is set to @code{0}.
  8240. @item weight_Y
  8241. Set the frequency domain weight expression for the luma plane.
  8242. @item weight_U
  8243. Set the frequency domain weight expression for the 1st chroma plane.
  8244. @item weight_V
  8245. Set the frequency domain weight expression for the 2nd chroma plane.
  8246. @item eval
  8247. Set when the expressions are evaluated.
  8248. It accepts the following values:
  8249. @table @samp
  8250. @item init
  8251. Only evaluate expressions once during the filter initialization.
  8252. @item frame
  8253. Evaluate expressions for each incoming frame.
  8254. @end table
  8255. Default value is @samp{init}.
  8256. The filter accepts the following variables:
  8257. @item X
  8258. @item Y
  8259. The coordinates of the current sample.
  8260. @item W
  8261. @item H
  8262. The width and height of the image.
  8263. @item N
  8264. The number of input frame, starting from 0.
  8265. @end table
  8266. @subsection Examples
  8267. @itemize
  8268. @item
  8269. High-pass:
  8270. @example
  8271. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8272. @end example
  8273. @item
  8274. Low-pass:
  8275. @example
  8276. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8277. @end example
  8278. @item
  8279. Sharpen:
  8280. @example
  8281. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8282. @end example
  8283. @item
  8284. Blur:
  8285. @example
  8286. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8287. @end example
  8288. @end itemize
  8289. @section field
  8290. Extract a single field from an interlaced image using stride
  8291. arithmetic to avoid wasting CPU time. The output frames are marked as
  8292. non-interlaced.
  8293. The filter accepts the following options:
  8294. @table @option
  8295. @item type
  8296. Specify whether to extract the top (if the value is @code{0} or
  8297. @code{top}) or the bottom field (if the value is @code{1} or
  8298. @code{bottom}).
  8299. @end table
  8300. @section fieldhint
  8301. Create new frames by copying the top and bottom fields from surrounding frames
  8302. supplied as numbers by the hint file.
  8303. @table @option
  8304. @item hint
  8305. Set file containing hints: absolute/relative frame numbers.
  8306. There must be one line for each frame in a clip. Each line must contain two
  8307. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8308. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8309. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8310. for @code{relative} mode. First number tells from which frame to pick up top
  8311. field and second number tells from which frame to pick up bottom field.
  8312. If optionally followed by @code{+} output frame will be marked as interlaced,
  8313. else if followed by @code{-} output frame will be marked as progressive, else
  8314. it will be marked same as input frame.
  8315. If optionally followed by @code{t} output frame will use only top field, or in
  8316. case of @code{b} it will use only bottom field.
  8317. If line starts with @code{#} or @code{;} that line is skipped.
  8318. @item mode
  8319. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8320. @end table
  8321. Example of first several lines of @code{hint} file for @code{relative} mode:
  8322. @example
  8323. 0,0 - # first frame
  8324. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8325. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8326. 1,0 -
  8327. 0,0 -
  8328. 0,0 -
  8329. 1,0 -
  8330. 1,0 -
  8331. 1,0 -
  8332. 0,0 -
  8333. 0,0 -
  8334. 1,0 -
  8335. 1,0 -
  8336. 1,0 -
  8337. 0,0 -
  8338. @end example
  8339. @section fieldmatch
  8340. Field matching filter for inverse telecine. It is meant to reconstruct the
  8341. progressive frames from a telecined stream. The filter does not drop duplicated
  8342. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8343. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8344. The separation of the field matching and the decimation is notably motivated by
  8345. the possibility of inserting a de-interlacing filter fallback between the two.
  8346. If the source has mixed telecined and real interlaced content,
  8347. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8348. But these remaining combed frames will be marked as interlaced, and thus can be
  8349. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8350. In addition to the various configuration options, @code{fieldmatch} can take an
  8351. optional second stream, activated through the @option{ppsrc} option. If
  8352. enabled, the frames reconstruction will be based on the fields and frames from
  8353. this second stream. This allows the first input to be pre-processed in order to
  8354. help the various algorithms of the filter, while keeping the output lossless
  8355. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8356. or brightness/contrast adjustments can help.
  8357. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8358. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8359. which @code{fieldmatch} is based on. While the semantic and usage are very
  8360. close, some behaviour and options names can differ.
  8361. The @ref{decimate} filter currently only works for constant frame rate input.
  8362. If your input has mixed telecined (30fps) and progressive content with a lower
  8363. framerate like 24fps use the following filterchain to produce the necessary cfr
  8364. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8365. The filter accepts the following options:
  8366. @table @option
  8367. @item order
  8368. Specify the assumed field order of the input stream. Available values are:
  8369. @table @samp
  8370. @item auto
  8371. Auto detect parity (use FFmpeg's internal parity value).
  8372. @item bff
  8373. Assume bottom field first.
  8374. @item tff
  8375. Assume top field first.
  8376. @end table
  8377. Note that it is sometimes recommended not to trust the parity announced by the
  8378. stream.
  8379. Default value is @var{auto}.
  8380. @item mode
  8381. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8382. sense that it won't risk creating jerkiness due to duplicate frames when
  8383. possible, but if there are bad edits or blended fields it will end up
  8384. outputting combed frames when a good match might actually exist. On the other
  8385. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8386. but will almost always find a good frame if there is one. The other values are
  8387. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8388. jerkiness and creating duplicate frames versus finding good matches in sections
  8389. with bad edits, orphaned fields, blended fields, etc.
  8390. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8391. Available values are:
  8392. @table @samp
  8393. @item pc
  8394. 2-way matching (p/c)
  8395. @item pc_n
  8396. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8397. @item pc_u
  8398. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8399. @item pc_n_ub
  8400. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8401. still combed (p/c + n + u/b)
  8402. @item pcn
  8403. 3-way matching (p/c/n)
  8404. @item pcn_ub
  8405. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8406. detected as combed (p/c/n + u/b)
  8407. @end table
  8408. The parenthesis at the end indicate the matches that would be used for that
  8409. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8410. @var{top}).
  8411. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8412. the slowest.
  8413. Default value is @var{pc_n}.
  8414. @item ppsrc
  8415. Mark the main input stream as a pre-processed input, and enable the secondary
  8416. input stream as the clean source to pick the fields from. See the filter
  8417. introduction for more details. It is similar to the @option{clip2} feature from
  8418. VFM/TFM.
  8419. Default value is @code{0} (disabled).
  8420. @item field
  8421. Set the field to match from. It is recommended to set this to the same value as
  8422. @option{order} unless you experience matching failures with that setting. In
  8423. certain circumstances changing the field that is used to match from can have a
  8424. large impact on matching performance. Available values are:
  8425. @table @samp
  8426. @item auto
  8427. Automatic (same value as @option{order}).
  8428. @item bottom
  8429. Match from the bottom field.
  8430. @item top
  8431. Match from the top field.
  8432. @end table
  8433. Default value is @var{auto}.
  8434. @item mchroma
  8435. Set whether or not chroma is included during the match comparisons. In most
  8436. cases it is recommended to leave this enabled. You should set this to @code{0}
  8437. only if your clip has bad chroma problems such as heavy rainbowing or other
  8438. artifacts. Setting this to @code{0} could also be used to speed things up at
  8439. the cost of some accuracy.
  8440. Default value is @code{1}.
  8441. @item y0
  8442. @item y1
  8443. These define an exclusion band which excludes the lines between @option{y0} and
  8444. @option{y1} from being included in the field matching decision. An exclusion
  8445. band can be used to ignore subtitles, a logo, or other things that may
  8446. interfere with the matching. @option{y0} sets the starting scan line and
  8447. @option{y1} sets the ending line; all lines in between @option{y0} and
  8448. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8449. @option{y0} and @option{y1} to the same value will disable the feature.
  8450. @option{y0} and @option{y1} defaults to @code{0}.
  8451. @item scthresh
  8452. Set the scene change detection threshold as a percentage of maximum change on
  8453. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8454. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8455. @option{scthresh} is @code{[0.0, 100.0]}.
  8456. Default value is @code{12.0}.
  8457. @item combmatch
  8458. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8459. account the combed scores of matches when deciding what match to use as the
  8460. final match. Available values are:
  8461. @table @samp
  8462. @item none
  8463. No final matching based on combed scores.
  8464. @item sc
  8465. Combed scores are only used when a scene change is detected.
  8466. @item full
  8467. Use combed scores all the time.
  8468. @end table
  8469. Default is @var{sc}.
  8470. @item combdbg
  8471. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8472. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8473. Available values are:
  8474. @table @samp
  8475. @item none
  8476. No forced calculation.
  8477. @item pcn
  8478. Force p/c/n calculations.
  8479. @item pcnub
  8480. Force p/c/n/u/b calculations.
  8481. @end table
  8482. Default value is @var{none}.
  8483. @item cthresh
  8484. This is the area combing threshold used for combed frame detection. This
  8485. essentially controls how "strong" or "visible" combing must be to be detected.
  8486. Larger values mean combing must be more visible and smaller values mean combing
  8487. can be less visible or strong and still be detected. Valid settings are from
  8488. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8489. be detected as combed). This is basically a pixel difference value. A good
  8490. range is @code{[8, 12]}.
  8491. Default value is @code{9}.
  8492. @item chroma
  8493. Sets whether or not chroma is considered in the combed frame decision. Only
  8494. disable this if your source has chroma problems (rainbowing, etc.) that are
  8495. causing problems for the combed frame detection with chroma enabled. Actually,
  8496. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8497. where there is chroma only combing in the source.
  8498. Default value is @code{0}.
  8499. @item blockx
  8500. @item blocky
  8501. Respectively set the x-axis and y-axis size of the window used during combed
  8502. frame detection. This has to do with the size of the area in which
  8503. @option{combpel} pixels are required to be detected as combed for a frame to be
  8504. declared combed. See the @option{combpel} parameter description for more info.
  8505. Possible values are any number that is a power of 2 starting at 4 and going up
  8506. to 512.
  8507. Default value is @code{16}.
  8508. @item combpel
  8509. The number of combed pixels inside any of the @option{blocky} by
  8510. @option{blockx} size blocks on the frame for the frame to be detected as
  8511. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8512. setting controls "how much" combing there must be in any localized area (a
  8513. window defined by the @option{blockx} and @option{blocky} settings) on the
  8514. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8515. which point no frames will ever be detected as combed). This setting is known
  8516. as @option{MI} in TFM/VFM vocabulary.
  8517. Default value is @code{80}.
  8518. @end table
  8519. @anchor{p/c/n/u/b meaning}
  8520. @subsection p/c/n/u/b meaning
  8521. @subsubsection p/c/n
  8522. We assume the following telecined stream:
  8523. @example
  8524. Top fields: 1 2 2 3 4
  8525. Bottom fields: 1 2 3 4 4
  8526. @end example
  8527. The numbers correspond to the progressive frame the fields relate to. Here, the
  8528. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8529. When @code{fieldmatch} is configured to run a matching from bottom
  8530. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8531. @example
  8532. Input stream:
  8533. T 1 2 2 3 4
  8534. B 1 2 3 4 4 <-- matching reference
  8535. Matches: c c n n c
  8536. Output stream:
  8537. T 1 2 3 4 4
  8538. B 1 2 3 4 4
  8539. @end example
  8540. As a result of the field matching, we can see that some frames get duplicated.
  8541. To perform a complete inverse telecine, you need to rely on a decimation filter
  8542. after this operation. See for instance the @ref{decimate} filter.
  8543. The same operation now matching from top fields (@option{field}=@var{top})
  8544. looks like this:
  8545. @example
  8546. Input stream:
  8547. T 1 2 2 3 4 <-- matching reference
  8548. B 1 2 3 4 4
  8549. Matches: c c p p c
  8550. Output stream:
  8551. T 1 2 2 3 4
  8552. B 1 2 2 3 4
  8553. @end example
  8554. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8555. basically, they refer to the frame and field of the opposite parity:
  8556. @itemize
  8557. @item @var{p} matches the field of the opposite parity in the previous frame
  8558. @item @var{c} matches the field of the opposite parity in the current frame
  8559. @item @var{n} matches the field of the opposite parity in the next frame
  8560. @end itemize
  8561. @subsubsection u/b
  8562. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8563. from the opposite parity flag. In the following examples, we assume that we are
  8564. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8565. 'x' is placed above and below each matched fields.
  8566. With bottom matching (@option{field}=@var{bottom}):
  8567. @example
  8568. Match: c p n b u
  8569. x x x x x
  8570. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8571. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8572. x x x x x
  8573. Output frames:
  8574. 2 1 2 2 2
  8575. 2 2 2 1 3
  8576. @end example
  8577. With top matching (@option{field}=@var{top}):
  8578. @example
  8579. Match: c p n b u
  8580. x x x x x
  8581. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8582. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8583. x x x x x
  8584. Output frames:
  8585. 2 2 2 1 2
  8586. 2 1 3 2 2
  8587. @end example
  8588. @subsection Examples
  8589. Simple IVTC of a top field first telecined stream:
  8590. @example
  8591. fieldmatch=order=tff:combmatch=none, decimate
  8592. @end example
  8593. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8594. @example
  8595. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8596. @end example
  8597. @section fieldorder
  8598. Transform the field order of the input video.
  8599. It accepts the following parameters:
  8600. @table @option
  8601. @item order
  8602. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8603. for bottom field first.
  8604. @end table
  8605. The default value is @samp{tff}.
  8606. The transformation is done by shifting the picture content up or down
  8607. by one line, and filling the remaining line with appropriate picture content.
  8608. This method is consistent with most broadcast field order converters.
  8609. If the input video is not flagged as being interlaced, or it is already
  8610. flagged as being of the required output field order, then this filter does
  8611. not alter the incoming video.
  8612. It is very useful when converting to or from PAL DV material,
  8613. which is bottom field first.
  8614. For example:
  8615. @example
  8616. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8617. @end example
  8618. @section fifo, afifo
  8619. Buffer input images and send them when they are requested.
  8620. It is mainly useful when auto-inserted by the libavfilter
  8621. framework.
  8622. It does not take parameters.
  8623. @section fillborders
  8624. Fill borders of the input video, without changing video stream dimensions.
  8625. Sometimes video can have garbage at the four edges and you may not want to
  8626. crop video input to keep size multiple of some number.
  8627. This filter accepts the following options:
  8628. @table @option
  8629. @item left
  8630. Number of pixels to fill from left border.
  8631. @item right
  8632. Number of pixels to fill from right border.
  8633. @item top
  8634. Number of pixels to fill from top border.
  8635. @item bottom
  8636. Number of pixels to fill from bottom border.
  8637. @item mode
  8638. Set fill mode.
  8639. It accepts the following values:
  8640. @table @samp
  8641. @item smear
  8642. fill pixels using outermost pixels
  8643. @item mirror
  8644. fill pixels using mirroring
  8645. @item fixed
  8646. fill pixels with constant value
  8647. @end table
  8648. Default is @var{smear}.
  8649. @item color
  8650. Set color for pixels in fixed mode. Default is @var{black}.
  8651. @end table
  8652. @subsection Commands
  8653. This filter supports same @ref{commands} as options.
  8654. The command accepts the same syntax of the corresponding option.
  8655. If the specified expression is not valid, it is kept at its current
  8656. value.
  8657. @section find_rect
  8658. Find a rectangular object
  8659. It accepts the following options:
  8660. @table @option
  8661. @item object
  8662. Filepath of the object image, needs to be in gray8.
  8663. @item threshold
  8664. Detection threshold, default is 0.5.
  8665. @item mipmaps
  8666. Number of mipmaps, default is 3.
  8667. @item xmin, ymin, xmax, ymax
  8668. Specifies the rectangle in which to search.
  8669. @end table
  8670. @subsection Examples
  8671. @itemize
  8672. @item
  8673. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8674. @example
  8675. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8676. @end example
  8677. @end itemize
  8678. @section floodfill
  8679. Flood area with values of same pixel components with another values.
  8680. It accepts the following options:
  8681. @table @option
  8682. @item x
  8683. Set pixel x coordinate.
  8684. @item y
  8685. Set pixel y coordinate.
  8686. @item s0
  8687. Set source #0 component value.
  8688. @item s1
  8689. Set source #1 component value.
  8690. @item s2
  8691. Set source #2 component value.
  8692. @item s3
  8693. Set source #3 component value.
  8694. @item d0
  8695. Set destination #0 component value.
  8696. @item d1
  8697. Set destination #1 component value.
  8698. @item d2
  8699. Set destination #2 component value.
  8700. @item d3
  8701. Set destination #3 component value.
  8702. @end table
  8703. @anchor{format}
  8704. @section format
  8705. Convert the input video to one of the specified pixel formats.
  8706. Libavfilter will try to pick one that is suitable as input to
  8707. the next filter.
  8708. It accepts the following parameters:
  8709. @table @option
  8710. @item pix_fmts
  8711. A '|'-separated list of pixel format names, such as
  8712. "pix_fmts=yuv420p|monow|rgb24".
  8713. @end table
  8714. @subsection Examples
  8715. @itemize
  8716. @item
  8717. Convert the input video to the @var{yuv420p} format
  8718. @example
  8719. format=pix_fmts=yuv420p
  8720. @end example
  8721. Convert the input video to any of the formats in the list
  8722. @example
  8723. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8724. @end example
  8725. @end itemize
  8726. @anchor{fps}
  8727. @section fps
  8728. Convert the video to specified constant frame rate by duplicating or dropping
  8729. frames as necessary.
  8730. It accepts the following parameters:
  8731. @table @option
  8732. @item fps
  8733. The desired output frame rate. The default is @code{25}.
  8734. @item start_time
  8735. Assume the first PTS should be the given value, in seconds. This allows for
  8736. padding/trimming at the start of stream. By default, no assumption is made
  8737. about the first frame's expected PTS, so no padding or trimming is done.
  8738. For example, this could be set to 0 to pad the beginning with duplicates of
  8739. the first frame if a video stream starts after the audio stream or to trim any
  8740. frames with a negative PTS.
  8741. @item round
  8742. Timestamp (PTS) rounding method.
  8743. Possible values are:
  8744. @table @option
  8745. @item zero
  8746. round towards 0
  8747. @item inf
  8748. round away from 0
  8749. @item down
  8750. round towards -infinity
  8751. @item up
  8752. round towards +infinity
  8753. @item near
  8754. round to nearest
  8755. @end table
  8756. The default is @code{near}.
  8757. @item eof_action
  8758. Action performed when reading the last frame.
  8759. Possible values are:
  8760. @table @option
  8761. @item round
  8762. Use same timestamp rounding method as used for other frames.
  8763. @item pass
  8764. Pass through last frame if input duration has not been reached yet.
  8765. @end table
  8766. The default is @code{round}.
  8767. @end table
  8768. Alternatively, the options can be specified as a flat string:
  8769. @var{fps}[:@var{start_time}[:@var{round}]].
  8770. See also the @ref{setpts} filter.
  8771. @subsection Examples
  8772. @itemize
  8773. @item
  8774. A typical usage in order to set the fps to 25:
  8775. @example
  8776. fps=fps=25
  8777. @end example
  8778. @item
  8779. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8780. @example
  8781. fps=fps=film:round=near
  8782. @end example
  8783. @end itemize
  8784. @section framepack
  8785. Pack two different video streams into a stereoscopic video, setting proper
  8786. metadata on supported codecs. The two views should have the same size and
  8787. framerate and processing will stop when the shorter video ends. Please note
  8788. that you may conveniently adjust view properties with the @ref{scale} and
  8789. @ref{fps} filters.
  8790. It accepts the following parameters:
  8791. @table @option
  8792. @item format
  8793. The desired packing format. Supported values are:
  8794. @table @option
  8795. @item sbs
  8796. The views are next to each other (default).
  8797. @item tab
  8798. The views are on top of each other.
  8799. @item lines
  8800. The views are packed by line.
  8801. @item columns
  8802. The views are packed by column.
  8803. @item frameseq
  8804. The views are temporally interleaved.
  8805. @end table
  8806. @end table
  8807. Some examples:
  8808. @example
  8809. # Convert left and right views into a frame-sequential video
  8810. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8811. # Convert views into a side-by-side video with the same output resolution as the input
  8812. 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
  8813. @end example
  8814. @section framerate
  8815. Change the frame rate by interpolating new video output frames from the source
  8816. frames.
  8817. This filter is not designed to function correctly with interlaced media. If
  8818. you wish to change the frame rate of interlaced media then you are required
  8819. to deinterlace before this filter and re-interlace after this filter.
  8820. A description of the accepted options follows.
  8821. @table @option
  8822. @item fps
  8823. Specify the output frames per second. This option can also be specified
  8824. as a value alone. The default is @code{50}.
  8825. @item interp_start
  8826. Specify the start of a range where the output frame will be created as a
  8827. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8828. the default is @code{15}.
  8829. @item interp_end
  8830. Specify the end of a range where the output frame will be created as a
  8831. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8832. the default is @code{240}.
  8833. @item scene
  8834. Specify the level at which a scene change is detected as a value between
  8835. 0 and 100 to indicate a new scene; a low value reflects a low
  8836. probability for the current frame to introduce a new scene, while a higher
  8837. value means the current frame is more likely to be one.
  8838. The default is @code{8.2}.
  8839. @item flags
  8840. Specify flags influencing the filter process.
  8841. Available value for @var{flags} is:
  8842. @table @option
  8843. @item scene_change_detect, scd
  8844. Enable scene change detection using the value of the option @var{scene}.
  8845. This flag is enabled by default.
  8846. @end table
  8847. @end table
  8848. @section framestep
  8849. Select one frame every N-th frame.
  8850. This filter accepts the following option:
  8851. @table @option
  8852. @item step
  8853. Select frame after every @code{step} frames.
  8854. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8855. @end table
  8856. @section freezedetect
  8857. Detect frozen video.
  8858. This filter logs a message and sets frame metadata when it detects that the
  8859. input video has no significant change in content during a specified duration.
  8860. Video freeze detection calculates the mean average absolute difference of all
  8861. the components of video frames and compares it to a noise floor.
  8862. The printed times and duration are expressed in seconds. The
  8863. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8864. whose timestamp equals or exceeds the detection duration and it contains the
  8865. timestamp of the first frame of the freeze. The
  8866. @code{lavfi.freezedetect.freeze_duration} and
  8867. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8868. after the freeze.
  8869. The filter accepts the following options:
  8870. @table @option
  8871. @item noise, n
  8872. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8873. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8874. 0.001.
  8875. @item duration, d
  8876. Set freeze duration until notification (default is 2 seconds).
  8877. @end table
  8878. @section freezeframes
  8879. Freeze video frames.
  8880. This filter freezes video frames using frame from 2nd input.
  8881. The filter accepts the following options:
  8882. @table @option
  8883. @item first
  8884. Set number of first frame from which to start freeze.
  8885. @item last
  8886. Set number of last frame from which to end freeze.
  8887. @item replace
  8888. Set number of frame from 2nd input which will be used instead of replaced frames.
  8889. @end table
  8890. @anchor{frei0r}
  8891. @section frei0r
  8892. Apply a frei0r effect to the input video.
  8893. To enable the compilation of this filter, you need to install the frei0r
  8894. header and configure FFmpeg with @code{--enable-frei0r}.
  8895. It accepts the following parameters:
  8896. @table @option
  8897. @item filter_name
  8898. The name of the frei0r effect to load. If the environment variable
  8899. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8900. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8901. Otherwise, the standard frei0r paths are searched, in this order:
  8902. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8903. @file{/usr/lib/frei0r-1/}.
  8904. @item filter_params
  8905. A '|'-separated list of parameters to pass to the frei0r effect.
  8906. @end table
  8907. A frei0r effect parameter can be a boolean (its value is either
  8908. "y" or "n"), a double, a color (specified as
  8909. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8910. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8911. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8912. a position (specified as @var{X}/@var{Y}, where
  8913. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8914. The number and types of parameters depend on the loaded effect. If an
  8915. effect parameter is not specified, the default value is set.
  8916. @subsection Examples
  8917. @itemize
  8918. @item
  8919. Apply the distort0r effect, setting the first two double parameters:
  8920. @example
  8921. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8922. @end example
  8923. @item
  8924. Apply the colordistance effect, taking a color as the first parameter:
  8925. @example
  8926. frei0r=colordistance:0.2/0.3/0.4
  8927. frei0r=colordistance:violet
  8928. frei0r=colordistance:0x112233
  8929. @end example
  8930. @item
  8931. Apply the perspective effect, specifying the top left and top right image
  8932. positions:
  8933. @example
  8934. frei0r=perspective:0.2/0.2|0.8/0.2
  8935. @end example
  8936. @end itemize
  8937. For more information, see
  8938. @url{http://frei0r.dyne.org}
  8939. @section fspp
  8940. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8941. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8942. processing filter, one of them is performed once per block, not per pixel.
  8943. This allows for much higher speed.
  8944. The filter accepts the following options:
  8945. @table @option
  8946. @item quality
  8947. Set quality. This option defines the number of levels for averaging. It accepts
  8948. an integer in the range 4-5. Default value is @code{4}.
  8949. @item qp
  8950. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8951. If not set, the filter will use the QP from the video stream (if available).
  8952. @item strength
  8953. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8954. more details but also more artifacts, while higher values make the image smoother
  8955. but also blurrier. Default value is @code{0} − PSNR optimal.
  8956. @item use_bframe_qp
  8957. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8958. option may cause flicker since the B-Frames have often larger QP. Default is
  8959. @code{0} (not enabled).
  8960. @end table
  8961. @section gblur
  8962. Apply Gaussian blur filter.
  8963. The filter accepts the following options:
  8964. @table @option
  8965. @item sigma
  8966. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8967. @item steps
  8968. Set number of steps for Gaussian approximation. Default is @code{1}.
  8969. @item planes
  8970. Set which planes to filter. By default all planes are filtered.
  8971. @item sigmaV
  8972. Set vertical sigma, if negative it will be same as @code{sigma}.
  8973. Default is @code{-1}.
  8974. @end table
  8975. @subsection Commands
  8976. This filter supports same commands as options.
  8977. The command accepts the same syntax of the corresponding option.
  8978. If the specified expression is not valid, it is kept at its current
  8979. value.
  8980. @section geq
  8981. Apply generic equation to each pixel.
  8982. The filter accepts the following options:
  8983. @table @option
  8984. @item lum_expr, lum
  8985. Set the luminance expression.
  8986. @item cb_expr, cb
  8987. Set the chrominance blue expression.
  8988. @item cr_expr, cr
  8989. Set the chrominance red expression.
  8990. @item alpha_expr, a
  8991. Set the alpha expression.
  8992. @item red_expr, r
  8993. Set the red expression.
  8994. @item green_expr, g
  8995. Set the green expression.
  8996. @item blue_expr, b
  8997. Set the blue expression.
  8998. @end table
  8999. The colorspace is selected according to the specified options. If one
  9000. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9001. options is specified, the filter will automatically select a YCbCr
  9002. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9003. @option{blue_expr} options is specified, it will select an RGB
  9004. colorspace.
  9005. If one of the chrominance expression is not defined, it falls back on the other
  9006. one. If no alpha expression is specified it will evaluate to opaque value.
  9007. If none of chrominance expressions are specified, they will evaluate
  9008. to the luminance expression.
  9009. The expressions can use the following variables and functions:
  9010. @table @option
  9011. @item N
  9012. The sequential number of the filtered frame, starting from @code{0}.
  9013. @item X
  9014. @item Y
  9015. The coordinates of the current sample.
  9016. @item W
  9017. @item H
  9018. The width and height of the image.
  9019. @item SW
  9020. @item SH
  9021. Width and height scale depending on the currently filtered plane. It is the
  9022. ratio between the corresponding luma plane number of pixels and the current
  9023. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9024. @code{0.5,0.5} for chroma planes.
  9025. @item T
  9026. Time of the current frame, expressed in seconds.
  9027. @item p(x, y)
  9028. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9029. plane.
  9030. @item lum(x, y)
  9031. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9032. plane.
  9033. @item cb(x, y)
  9034. Return the value of the pixel at location (@var{x},@var{y}) of the
  9035. blue-difference chroma plane. Return 0 if there is no such plane.
  9036. @item cr(x, y)
  9037. Return the value of the pixel at location (@var{x},@var{y}) of the
  9038. red-difference chroma plane. Return 0 if there is no such plane.
  9039. @item r(x, y)
  9040. @item g(x, y)
  9041. @item b(x, y)
  9042. Return the value of the pixel at location (@var{x},@var{y}) of the
  9043. red/green/blue component. Return 0 if there is no such component.
  9044. @item alpha(x, y)
  9045. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9046. plane. Return 0 if there is no such plane.
  9047. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  9048. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9049. sums of samples within a rectangle. See the functions without the sum postfix.
  9050. @item interpolation
  9051. Set one of interpolation methods:
  9052. @table @option
  9053. @item nearest, n
  9054. @item bilinear, b
  9055. @end table
  9056. Default is bilinear.
  9057. @end table
  9058. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9059. automatically clipped to the closer edge.
  9060. Please note that this filter can use multiple threads in which case each slice
  9061. will have its own expression state. If you want to use only a single expression
  9062. state because your expressions depend on previous state then you should limit
  9063. the number of filter threads to 1.
  9064. @subsection Examples
  9065. @itemize
  9066. @item
  9067. Flip the image horizontally:
  9068. @example
  9069. geq=p(W-X\,Y)
  9070. @end example
  9071. @item
  9072. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9073. wavelength of 100 pixels:
  9074. @example
  9075. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9076. @end example
  9077. @item
  9078. Generate a fancy enigmatic moving light:
  9079. @example
  9080. 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
  9081. @end example
  9082. @item
  9083. Generate a quick emboss effect:
  9084. @example
  9085. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9086. @end example
  9087. @item
  9088. Modify RGB components depending on pixel position:
  9089. @example
  9090. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9091. @end example
  9092. @item
  9093. Create a radial gradient that is the same size as the input (also see
  9094. the @ref{vignette} filter):
  9095. @example
  9096. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9097. @end example
  9098. @end itemize
  9099. @section gradfun
  9100. Fix the banding artifacts that are sometimes introduced into nearly flat
  9101. regions by truncation to 8-bit color depth.
  9102. Interpolate the gradients that should go where the bands are, and
  9103. dither them.
  9104. It is designed for playback only. Do not use it prior to
  9105. lossy compression, because compression tends to lose the dither and
  9106. bring back the bands.
  9107. It accepts the following parameters:
  9108. @table @option
  9109. @item strength
  9110. The maximum amount by which the filter will change any one pixel. This is also
  9111. the threshold for detecting nearly flat regions. Acceptable values range from
  9112. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9113. valid range.
  9114. @item radius
  9115. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9116. gradients, but also prevents the filter from modifying the pixels near detailed
  9117. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9118. values will be clipped to the valid range.
  9119. @end table
  9120. Alternatively, the options can be specified as a flat string:
  9121. @var{strength}[:@var{radius}]
  9122. @subsection Examples
  9123. @itemize
  9124. @item
  9125. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9126. @example
  9127. gradfun=3.5:8
  9128. @end example
  9129. @item
  9130. Specify radius, omitting the strength (which will fall-back to the default
  9131. value):
  9132. @example
  9133. gradfun=radius=8
  9134. @end example
  9135. @end itemize
  9136. @anchor{graphmonitor}
  9137. @section graphmonitor
  9138. Show various filtergraph stats.
  9139. With this filter one can debug complete filtergraph.
  9140. Especially issues with links filling with queued frames.
  9141. The filter accepts the following options:
  9142. @table @option
  9143. @item size, s
  9144. Set video output size. Default is @var{hd720}.
  9145. @item opacity, o
  9146. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9147. @item mode, m
  9148. Set output mode, can be @var{fulll} or @var{compact}.
  9149. In @var{compact} mode only filters with some queued frames have displayed stats.
  9150. @item flags, f
  9151. Set flags which enable which stats are shown in video.
  9152. Available values for flags are:
  9153. @table @samp
  9154. @item queue
  9155. Display number of queued frames in each link.
  9156. @item frame_count_in
  9157. Display number of frames taken from filter.
  9158. @item frame_count_out
  9159. Display number of frames given out from filter.
  9160. @item pts
  9161. Display current filtered frame pts.
  9162. @item time
  9163. Display current filtered frame time.
  9164. @item timebase
  9165. Display time base for filter link.
  9166. @item format
  9167. Display used format for filter link.
  9168. @item size
  9169. Display video size or number of audio channels in case of audio used by filter link.
  9170. @item rate
  9171. Display video frame rate or sample rate in case of audio used by filter link.
  9172. @item eof
  9173. Display link output status.
  9174. @end table
  9175. @item rate, r
  9176. Set upper limit for video rate of output stream, Default value is @var{25}.
  9177. This guarantee that output video frame rate will not be higher than this value.
  9178. @end table
  9179. @section greyedge
  9180. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9181. and corrects the scene colors accordingly.
  9182. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9183. The filter accepts the following options:
  9184. @table @option
  9185. @item difford
  9186. The order of differentiation to be applied on the scene. Must be chosen in the range
  9187. [0,2] and default value is 1.
  9188. @item minknorm
  9189. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9190. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9191. max value instead of calculating Minkowski distance.
  9192. @item sigma
  9193. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9194. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9195. can't be equal to 0 if @var{difford} is greater than 0.
  9196. @end table
  9197. @subsection Examples
  9198. @itemize
  9199. @item
  9200. Grey Edge:
  9201. @example
  9202. greyedge=difford=1:minknorm=5:sigma=2
  9203. @end example
  9204. @item
  9205. Max Edge:
  9206. @example
  9207. greyedge=difford=1:minknorm=0:sigma=2
  9208. @end example
  9209. @end itemize
  9210. @anchor{haldclut}
  9211. @section haldclut
  9212. Apply a Hald CLUT to a video stream.
  9213. First input is the video stream to process, and second one is the Hald CLUT.
  9214. The Hald CLUT input can be a simple picture or a complete video stream.
  9215. The filter accepts the following options:
  9216. @table @option
  9217. @item shortest
  9218. Force termination when the shortest input terminates. Default is @code{0}.
  9219. @item repeatlast
  9220. Continue applying the last CLUT after the end of the stream. A value of
  9221. @code{0} disable the filter after the last frame of the CLUT is reached.
  9222. Default is @code{1}.
  9223. @end table
  9224. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9225. filters share the same internals).
  9226. This filter also supports the @ref{framesync} options.
  9227. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9228. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9229. @subsection Workflow examples
  9230. @subsubsection Hald CLUT video stream
  9231. Generate an identity Hald CLUT stream altered with various effects:
  9232. @example
  9233. 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
  9234. @end example
  9235. Note: make sure you use a lossless codec.
  9236. Then use it with @code{haldclut} to apply it on some random stream:
  9237. @example
  9238. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9239. @end example
  9240. The Hald CLUT will be applied to the 10 first seconds (duration of
  9241. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9242. to the remaining frames of the @code{mandelbrot} stream.
  9243. @subsubsection Hald CLUT with preview
  9244. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9245. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9246. biggest possible square starting at the top left of the picture. The remaining
  9247. padding pixels (bottom or right) will be ignored. This area can be used to add
  9248. a preview of the Hald CLUT.
  9249. Typically, the following generated Hald CLUT will be supported by the
  9250. @code{haldclut} filter:
  9251. @example
  9252. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9253. pad=iw+320 [padded_clut];
  9254. smptebars=s=320x256, split [a][b];
  9255. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9256. [main][b] overlay=W-320" -frames:v 1 clut.png
  9257. @end example
  9258. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9259. bars are displayed on the right-top, and below the same color bars processed by
  9260. the color changes.
  9261. Then, the effect of this Hald CLUT can be visualized with:
  9262. @example
  9263. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9264. @end example
  9265. @section hflip
  9266. Flip the input video horizontally.
  9267. For example, to horizontally flip the input video with @command{ffmpeg}:
  9268. @example
  9269. ffmpeg -i in.avi -vf "hflip" out.avi
  9270. @end example
  9271. @section histeq
  9272. This filter applies a global color histogram equalization on a
  9273. per-frame basis.
  9274. It can be used to correct video that has a compressed range of pixel
  9275. intensities. The filter redistributes the pixel intensities to
  9276. equalize their distribution across the intensity range. It may be
  9277. viewed as an "automatically adjusting contrast filter". This filter is
  9278. useful only for correcting degraded or poorly captured source
  9279. video.
  9280. The filter accepts the following options:
  9281. @table @option
  9282. @item strength
  9283. Determine the amount of equalization to be applied. As the strength
  9284. is reduced, the distribution of pixel intensities more-and-more
  9285. approaches that of the input frame. The value must be a float number
  9286. in the range [0,1] and defaults to 0.200.
  9287. @item intensity
  9288. Set the maximum intensity that can generated and scale the output
  9289. values appropriately. The strength should be set as desired and then
  9290. the intensity can be limited if needed to avoid washing-out. The value
  9291. must be a float number in the range [0,1] and defaults to 0.210.
  9292. @item antibanding
  9293. Set the antibanding level. If enabled the filter will randomly vary
  9294. the luminance of output pixels by a small amount to avoid banding of
  9295. the histogram. Possible values are @code{none}, @code{weak} or
  9296. @code{strong}. It defaults to @code{none}.
  9297. @end table
  9298. @anchor{histogram}
  9299. @section histogram
  9300. Compute and draw a color distribution histogram for the input video.
  9301. The computed histogram is a representation of the color component
  9302. distribution in an image.
  9303. Standard histogram displays the color components distribution in an image.
  9304. Displays color graph for each color component. Shows distribution of
  9305. the Y, U, V, A or R, G, B components, depending on input format, in the
  9306. current frame. Below each graph a color component scale meter is shown.
  9307. The filter accepts the following options:
  9308. @table @option
  9309. @item level_height
  9310. Set height of level. Default value is @code{200}.
  9311. Allowed range is [50, 2048].
  9312. @item scale_height
  9313. Set height of color scale. Default value is @code{12}.
  9314. Allowed range is [0, 40].
  9315. @item display_mode
  9316. Set display mode.
  9317. It accepts the following values:
  9318. @table @samp
  9319. @item stack
  9320. Per color component graphs are placed below each other.
  9321. @item parade
  9322. Per color component graphs are placed side by side.
  9323. @item overlay
  9324. Presents information identical to that in the @code{parade}, except
  9325. that the graphs representing color components are superimposed directly
  9326. over one another.
  9327. @end table
  9328. Default is @code{stack}.
  9329. @item levels_mode
  9330. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9331. Default is @code{linear}.
  9332. @item components
  9333. Set what color components to display.
  9334. Default is @code{7}.
  9335. @item fgopacity
  9336. Set foreground opacity. Default is @code{0.7}.
  9337. @item bgopacity
  9338. Set background opacity. Default is @code{0.5}.
  9339. @end table
  9340. @subsection Examples
  9341. @itemize
  9342. @item
  9343. Calculate and draw histogram:
  9344. @example
  9345. ffplay -i input -vf histogram
  9346. @end example
  9347. @end itemize
  9348. @anchor{hqdn3d}
  9349. @section hqdn3d
  9350. This is a high precision/quality 3d denoise filter. It aims to reduce
  9351. image noise, producing smooth images and making still images really
  9352. still. It should enhance compressibility.
  9353. It accepts the following optional parameters:
  9354. @table @option
  9355. @item luma_spatial
  9356. A non-negative floating point number which specifies spatial luma strength.
  9357. It defaults to 4.0.
  9358. @item chroma_spatial
  9359. A non-negative floating point number which specifies spatial chroma strength.
  9360. It defaults to 3.0*@var{luma_spatial}/4.0.
  9361. @item luma_tmp
  9362. A floating point number which specifies luma temporal strength. It defaults to
  9363. 6.0*@var{luma_spatial}/4.0.
  9364. @item chroma_tmp
  9365. A floating point number which specifies chroma temporal strength. It defaults to
  9366. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9367. @end table
  9368. @subsection Commands
  9369. This filter supports same @ref{commands} as options.
  9370. The command accepts the same syntax of the corresponding option.
  9371. If the specified expression is not valid, it is kept at its current
  9372. value.
  9373. @anchor{hwdownload}
  9374. @section hwdownload
  9375. Download hardware frames to system memory.
  9376. The input must be in hardware frames, and the output a non-hardware format.
  9377. Not all formats will be supported on the output - it may be necessary to insert
  9378. an additional @option{format} filter immediately following in the graph to get
  9379. the output in a supported format.
  9380. @section hwmap
  9381. Map hardware frames to system memory or to another device.
  9382. This filter has several different modes of operation; which one is used depends
  9383. on the input and output formats:
  9384. @itemize
  9385. @item
  9386. Hardware frame input, normal frame output
  9387. Map the input frames to system memory and pass them to the output. If the
  9388. original hardware frame is later required (for example, after overlaying
  9389. something else on part of it), the @option{hwmap} filter can be used again
  9390. in the next mode to retrieve it.
  9391. @item
  9392. Normal frame input, hardware frame output
  9393. If the input is actually a software-mapped hardware frame, then unmap it -
  9394. that is, return the original hardware frame.
  9395. Otherwise, a device must be provided. Create new hardware surfaces on that
  9396. device for the output, then map them back to the software format at the input
  9397. and give those frames to the preceding filter. This will then act like the
  9398. @option{hwupload} filter, but may be able to avoid an additional copy when
  9399. the input is already in a compatible format.
  9400. @item
  9401. Hardware frame input and output
  9402. A device must be supplied for the output, either directly or with the
  9403. @option{derive_device} option. The input and output devices must be of
  9404. different types and compatible - the exact meaning of this is
  9405. system-dependent, but typically it means that they must refer to the same
  9406. underlying hardware context (for example, refer to the same graphics card).
  9407. If the input frames were originally created on the output device, then unmap
  9408. to retrieve the original frames.
  9409. Otherwise, map the frames to the output device - create new hardware frames
  9410. on the output corresponding to the frames on the input.
  9411. @end itemize
  9412. The following additional parameters are accepted:
  9413. @table @option
  9414. @item mode
  9415. Set the frame mapping mode. Some combination of:
  9416. @table @var
  9417. @item read
  9418. The mapped frame should be readable.
  9419. @item write
  9420. The mapped frame should be writeable.
  9421. @item overwrite
  9422. The mapping will always overwrite the entire frame.
  9423. This may improve performance in some cases, as the original contents of the
  9424. frame need not be loaded.
  9425. @item direct
  9426. The mapping must not involve any copying.
  9427. Indirect mappings to copies of frames are created in some cases where either
  9428. direct mapping is not possible or it would have unexpected properties.
  9429. Setting this flag ensures that the mapping is direct and will fail if that is
  9430. not possible.
  9431. @end table
  9432. Defaults to @var{read+write} if not specified.
  9433. @item derive_device @var{type}
  9434. Rather than using the device supplied at initialisation, instead derive a new
  9435. device of type @var{type} from the device the input frames exist on.
  9436. @item reverse
  9437. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9438. and map them back to the source. This may be necessary in some cases where
  9439. a mapping in one direction is required but only the opposite direction is
  9440. supported by the devices being used.
  9441. This option is dangerous - it may break the preceding filter in undefined
  9442. ways if there are any additional constraints on that filter's output.
  9443. Do not use it without fully understanding the implications of its use.
  9444. @end table
  9445. @anchor{hwupload}
  9446. @section hwupload
  9447. Upload system memory frames to hardware surfaces.
  9448. The device to upload to must be supplied when the filter is initialised. If
  9449. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9450. option or with the @option{derive_device} option. The input and output devices
  9451. must be of different types and compatible - the exact meaning of this is
  9452. system-dependent, but typically it means that they must refer to the same
  9453. underlying hardware context (for example, refer to the same graphics card).
  9454. The following additional parameters are accepted:
  9455. @table @option
  9456. @item derive_device @var{type}
  9457. Rather than using the device supplied at initialisation, instead derive a new
  9458. device of type @var{type} from the device the input frames exist on.
  9459. @end table
  9460. @anchor{hwupload_cuda}
  9461. @section hwupload_cuda
  9462. Upload system memory frames to a CUDA device.
  9463. It accepts the following optional parameters:
  9464. @table @option
  9465. @item device
  9466. The number of the CUDA device to use
  9467. @end table
  9468. @section hqx
  9469. Apply a high-quality magnification filter designed for pixel art. This filter
  9470. was originally created by Maxim Stepin.
  9471. It accepts the following option:
  9472. @table @option
  9473. @item n
  9474. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9475. @code{hq3x} and @code{4} for @code{hq4x}.
  9476. Default is @code{3}.
  9477. @end table
  9478. @section hstack
  9479. Stack input videos horizontally.
  9480. All streams must be of same pixel format and of same height.
  9481. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9482. to create same output.
  9483. The filter accepts the following option:
  9484. @table @option
  9485. @item inputs
  9486. Set number of input streams. Default is 2.
  9487. @item shortest
  9488. If set to 1, force the output to terminate when the shortest input
  9489. terminates. Default value is 0.
  9490. @end table
  9491. @section hue
  9492. Modify the hue and/or the saturation of the input.
  9493. It accepts the following parameters:
  9494. @table @option
  9495. @item h
  9496. Specify the hue angle as a number of degrees. It accepts an expression,
  9497. and defaults to "0".
  9498. @item s
  9499. Specify the saturation in the [-10,10] range. It accepts an expression and
  9500. defaults to "1".
  9501. @item H
  9502. Specify the hue angle as a number of radians. It accepts an
  9503. expression, and defaults to "0".
  9504. @item b
  9505. Specify the brightness in the [-10,10] range. It accepts an expression and
  9506. defaults to "0".
  9507. @end table
  9508. @option{h} and @option{H} are mutually exclusive, and can't be
  9509. specified at the same time.
  9510. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9511. expressions containing the following constants:
  9512. @table @option
  9513. @item n
  9514. frame count of the input frame starting from 0
  9515. @item pts
  9516. presentation timestamp of the input frame expressed in time base units
  9517. @item r
  9518. frame rate of the input video, NAN if the input frame rate is unknown
  9519. @item t
  9520. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9521. @item tb
  9522. time base of the input video
  9523. @end table
  9524. @subsection Examples
  9525. @itemize
  9526. @item
  9527. Set the hue to 90 degrees and the saturation to 1.0:
  9528. @example
  9529. hue=h=90:s=1
  9530. @end example
  9531. @item
  9532. Same command but expressing the hue in radians:
  9533. @example
  9534. hue=H=PI/2:s=1
  9535. @end example
  9536. @item
  9537. Rotate hue and make the saturation swing between 0
  9538. and 2 over a period of 1 second:
  9539. @example
  9540. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9541. @end example
  9542. @item
  9543. Apply a 3 seconds saturation fade-in effect starting at 0:
  9544. @example
  9545. hue="s=min(t/3\,1)"
  9546. @end example
  9547. The general fade-in expression can be written as:
  9548. @example
  9549. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9550. @end example
  9551. @item
  9552. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9553. @example
  9554. hue="s=max(0\, min(1\, (8-t)/3))"
  9555. @end example
  9556. The general fade-out expression can be written as:
  9557. @example
  9558. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9559. @end example
  9560. @end itemize
  9561. @subsection Commands
  9562. This filter supports the following commands:
  9563. @table @option
  9564. @item b
  9565. @item s
  9566. @item h
  9567. @item H
  9568. Modify the hue and/or the saturation and/or brightness of the input video.
  9569. The command accepts the same syntax of the corresponding option.
  9570. If the specified expression is not valid, it is kept at its current
  9571. value.
  9572. @end table
  9573. @section hysteresis
  9574. Grow first stream into second stream by connecting components.
  9575. This makes it possible to build more robust edge masks.
  9576. This filter accepts the following options:
  9577. @table @option
  9578. @item planes
  9579. Set which planes will be processed as bitmap, unprocessed planes will be
  9580. copied from first stream.
  9581. By default value 0xf, all planes will be processed.
  9582. @item threshold
  9583. Set threshold which is used in filtering. If pixel component value is higher than
  9584. this value filter algorithm for connecting components is activated.
  9585. By default value is 0.
  9586. @end table
  9587. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9588. @section idet
  9589. Detect video interlacing type.
  9590. This filter tries to detect if the input frames are interlaced, progressive,
  9591. top or bottom field first. It will also try to detect fields that are
  9592. repeated between adjacent frames (a sign of telecine).
  9593. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9594. Multiple frame detection incorporates the classification history of previous frames.
  9595. The filter will log these metadata values:
  9596. @table @option
  9597. @item single.current_frame
  9598. Detected type of current frame using single-frame detection. One of:
  9599. ``tff'' (top field first), ``bff'' (bottom field first),
  9600. ``progressive'', or ``undetermined''
  9601. @item single.tff
  9602. Cumulative number of frames detected as top field first using single-frame detection.
  9603. @item multiple.tff
  9604. Cumulative number of frames detected as top field first using multiple-frame detection.
  9605. @item single.bff
  9606. Cumulative number of frames detected as bottom field first using single-frame detection.
  9607. @item multiple.current_frame
  9608. Detected type of current frame using multiple-frame detection. One of:
  9609. ``tff'' (top field first), ``bff'' (bottom field first),
  9610. ``progressive'', or ``undetermined''
  9611. @item multiple.bff
  9612. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9613. @item single.progressive
  9614. Cumulative number of frames detected as progressive using single-frame detection.
  9615. @item multiple.progressive
  9616. Cumulative number of frames detected as progressive using multiple-frame detection.
  9617. @item single.undetermined
  9618. Cumulative number of frames that could not be classified using single-frame detection.
  9619. @item multiple.undetermined
  9620. Cumulative number of frames that could not be classified using multiple-frame detection.
  9621. @item repeated.current_frame
  9622. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9623. @item repeated.neither
  9624. Cumulative number of frames with no repeated field.
  9625. @item repeated.top
  9626. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9627. @item repeated.bottom
  9628. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9629. @end table
  9630. The filter accepts the following options:
  9631. @table @option
  9632. @item intl_thres
  9633. Set interlacing threshold.
  9634. @item prog_thres
  9635. Set progressive threshold.
  9636. @item rep_thres
  9637. Threshold for repeated field detection.
  9638. @item half_life
  9639. Number of frames after which a given frame's contribution to the
  9640. statistics is halved (i.e., it contributes only 0.5 to its
  9641. classification). The default of 0 means that all frames seen are given
  9642. full weight of 1.0 forever.
  9643. @item analyze_interlaced_flag
  9644. When this is not 0 then idet will use the specified number of frames to determine
  9645. if the interlaced flag is accurate, it will not count undetermined frames.
  9646. If the flag is found to be accurate it will be used without any further
  9647. computations, if it is found to be inaccurate it will be cleared without any
  9648. further computations. This allows inserting the idet filter as a low computational
  9649. method to clean up the interlaced flag
  9650. @end table
  9651. @section il
  9652. Deinterleave or interleave fields.
  9653. This filter allows one to process interlaced images fields without
  9654. deinterlacing them. Deinterleaving splits the input frame into 2
  9655. fields (so called half pictures). Odd lines are moved to the top
  9656. half of the output image, even lines to the bottom half.
  9657. You can process (filter) them independently and then re-interleave them.
  9658. The filter accepts the following options:
  9659. @table @option
  9660. @item luma_mode, l
  9661. @item chroma_mode, c
  9662. @item alpha_mode, a
  9663. Available values for @var{luma_mode}, @var{chroma_mode} and
  9664. @var{alpha_mode} are:
  9665. @table @samp
  9666. @item none
  9667. Do nothing.
  9668. @item deinterleave, d
  9669. Deinterleave fields, placing one above the other.
  9670. @item interleave, i
  9671. Interleave fields. Reverse the effect of deinterleaving.
  9672. @end table
  9673. Default value is @code{none}.
  9674. @item luma_swap, ls
  9675. @item chroma_swap, cs
  9676. @item alpha_swap, as
  9677. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9678. @end table
  9679. @subsection Commands
  9680. This filter supports the all above options as @ref{commands}.
  9681. @section inflate
  9682. Apply inflate effect to the video.
  9683. This filter replaces the pixel by the local(3x3) average by taking into account
  9684. only values higher than the pixel.
  9685. It accepts the following options:
  9686. @table @option
  9687. @item threshold0
  9688. @item threshold1
  9689. @item threshold2
  9690. @item threshold3
  9691. Limit the maximum change for each plane, default is 65535.
  9692. If 0, plane will remain unchanged.
  9693. @end table
  9694. @subsection Commands
  9695. This filter supports the all above options as @ref{commands}.
  9696. @section interlace
  9697. Simple interlacing filter from progressive contents. This interleaves upper (or
  9698. lower) lines from odd frames with lower (or upper) lines from even frames,
  9699. halving the frame rate and preserving image height.
  9700. @example
  9701. Original Original New Frame
  9702. Frame 'j' Frame 'j+1' (tff)
  9703. ========== =========== ==================
  9704. Line 0 --------------------> Frame 'j' Line 0
  9705. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9706. Line 2 ---------------------> Frame 'j' Line 2
  9707. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9708. ... ... ...
  9709. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9710. @end example
  9711. It accepts the following optional parameters:
  9712. @table @option
  9713. @item scan
  9714. This determines whether the interlaced frame is taken from the even
  9715. (tff - default) or odd (bff) lines of the progressive frame.
  9716. @item lowpass
  9717. Vertical lowpass filter to avoid twitter interlacing and
  9718. reduce moire patterns.
  9719. @table @samp
  9720. @item 0, off
  9721. Disable vertical lowpass filter
  9722. @item 1, linear
  9723. Enable linear filter (default)
  9724. @item 2, complex
  9725. Enable complex filter. This will slightly less reduce twitter and moire
  9726. but better retain detail and subjective sharpness impression.
  9727. @end table
  9728. @end table
  9729. @section kerndeint
  9730. Deinterlace input video by applying Donald Graft's adaptive kernel
  9731. deinterling. Work on interlaced parts of a video to produce
  9732. progressive frames.
  9733. The description of the accepted parameters follows.
  9734. @table @option
  9735. @item thresh
  9736. Set the threshold which affects the filter's tolerance when
  9737. determining if a pixel line must be processed. It must be an integer
  9738. in the range [0,255] and defaults to 10. A value of 0 will result in
  9739. applying the process on every pixels.
  9740. @item map
  9741. Paint pixels exceeding the threshold value to white if set to 1.
  9742. Default is 0.
  9743. @item order
  9744. Set the fields order. Swap fields if set to 1, leave fields alone if
  9745. 0. Default is 0.
  9746. @item sharp
  9747. Enable additional sharpening if set to 1. Default is 0.
  9748. @item twoway
  9749. Enable twoway sharpening if set to 1. Default is 0.
  9750. @end table
  9751. @subsection Examples
  9752. @itemize
  9753. @item
  9754. Apply default values:
  9755. @example
  9756. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9757. @end example
  9758. @item
  9759. Enable additional sharpening:
  9760. @example
  9761. kerndeint=sharp=1
  9762. @end example
  9763. @item
  9764. Paint processed pixels in white:
  9765. @example
  9766. kerndeint=map=1
  9767. @end example
  9768. @end itemize
  9769. @section lagfun
  9770. Slowly update darker pixels.
  9771. This filter makes short flashes of light appear longer.
  9772. This filter accepts the following options:
  9773. @table @option
  9774. @item decay
  9775. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9776. @item planes
  9777. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9778. @end table
  9779. @section lenscorrection
  9780. Correct radial lens distortion
  9781. This filter can be used to correct for radial distortion as can result from the use
  9782. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9783. one can use tools available for example as part of opencv or simply trial-and-error.
  9784. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9785. and extract the k1 and k2 coefficients from the resulting matrix.
  9786. Note that effectively the same filter is available in the open-source tools Krita and
  9787. Digikam from the KDE project.
  9788. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9789. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9790. brightness distribution, so you may want to use both filters together in certain
  9791. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9792. be applied before or after lens correction.
  9793. @subsection Options
  9794. The filter accepts the following options:
  9795. @table @option
  9796. @item cx
  9797. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9798. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9799. width. Default is 0.5.
  9800. @item cy
  9801. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9802. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9803. height. Default is 0.5.
  9804. @item k1
  9805. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9806. no correction. Default is 0.
  9807. @item k2
  9808. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9809. 0 means no correction. Default is 0.
  9810. @end table
  9811. The formula that generates the correction is:
  9812. @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)
  9813. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9814. distances from the focal point in the source and target images, respectively.
  9815. @section lensfun
  9816. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9817. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9818. to apply the lens correction. The filter will load the lensfun database and
  9819. query it to find the corresponding camera and lens entries in the database. As
  9820. long as these entries can be found with the given options, the filter can
  9821. perform corrections on frames. Note that incomplete strings will result in the
  9822. filter choosing the best match with the given options, and the filter will
  9823. output the chosen camera and lens models (logged with level "info"). You must
  9824. provide the make, camera model, and lens model as they are required.
  9825. The filter accepts the following options:
  9826. @table @option
  9827. @item make
  9828. The make of the camera (for example, "Canon"). This option is required.
  9829. @item model
  9830. The model of the camera (for example, "Canon EOS 100D"). This option is
  9831. required.
  9832. @item lens_model
  9833. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9834. option is required.
  9835. @item mode
  9836. The type of correction to apply. The following values are valid options:
  9837. @table @samp
  9838. @item vignetting
  9839. Enables fixing lens vignetting.
  9840. @item geometry
  9841. Enables fixing lens geometry. This is the default.
  9842. @item subpixel
  9843. Enables fixing chromatic aberrations.
  9844. @item vig_geo
  9845. Enables fixing lens vignetting and lens geometry.
  9846. @item vig_subpixel
  9847. Enables fixing lens vignetting and chromatic aberrations.
  9848. @item distortion
  9849. Enables fixing both lens geometry and chromatic aberrations.
  9850. @item all
  9851. Enables all possible corrections.
  9852. @end table
  9853. @item focal_length
  9854. The focal length of the image/video (zoom; expected constant for video). For
  9855. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9856. range should be chosen when using that lens. Default 18.
  9857. @item aperture
  9858. The aperture of the image/video (expected constant for video). Note that
  9859. aperture is only used for vignetting correction. Default 3.5.
  9860. @item focus_distance
  9861. The focus distance of the image/video (expected constant for video). Note that
  9862. focus distance is only used for vignetting and only slightly affects the
  9863. vignetting correction process. If unknown, leave it at the default value (which
  9864. is 1000).
  9865. @item scale
  9866. The scale factor which is applied after transformation. After correction the
  9867. video is no longer necessarily rectangular. This parameter controls how much of
  9868. the resulting image is visible. The value 0 means that a value will be chosen
  9869. automatically such that there is little or no unmapped area in the output
  9870. image. 1.0 means that no additional scaling is done. Lower values may result
  9871. in more of the corrected image being visible, while higher values may avoid
  9872. unmapped areas in the output.
  9873. @item target_geometry
  9874. The target geometry of the output image/video. The following values are valid
  9875. options:
  9876. @table @samp
  9877. @item rectilinear (default)
  9878. @item fisheye
  9879. @item panoramic
  9880. @item equirectangular
  9881. @item fisheye_orthographic
  9882. @item fisheye_stereographic
  9883. @item fisheye_equisolid
  9884. @item fisheye_thoby
  9885. @end table
  9886. @item reverse
  9887. Apply the reverse of image correction (instead of correcting distortion, apply
  9888. it).
  9889. @item interpolation
  9890. The type of interpolation used when correcting distortion. The following values
  9891. are valid options:
  9892. @table @samp
  9893. @item nearest
  9894. @item linear (default)
  9895. @item lanczos
  9896. @end table
  9897. @end table
  9898. @subsection Examples
  9899. @itemize
  9900. @item
  9901. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9902. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9903. aperture of "8.0".
  9904. @example
  9905. 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
  9906. @end example
  9907. @item
  9908. Apply the same as before, but only for the first 5 seconds of video.
  9909. @example
  9910. 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
  9911. @end example
  9912. @end itemize
  9913. @section libvmaf
  9914. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9915. score between two input videos.
  9916. The obtained VMAF score is printed through the logging system.
  9917. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9918. After installing the library it can be enabled using:
  9919. @code{./configure --enable-libvmaf}.
  9920. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9921. The filter has following options:
  9922. @table @option
  9923. @item model_path
  9924. Set the model path which is to be used for SVM.
  9925. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9926. @item log_path
  9927. Set the file path to be used to store logs.
  9928. @item log_fmt
  9929. Set the format of the log file (csv, json or xml).
  9930. @item enable_transform
  9931. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9932. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9933. Default value: @code{false}
  9934. @item phone_model
  9935. Invokes the phone model which will generate VMAF scores higher than in the
  9936. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9937. Default value: @code{false}
  9938. @item psnr
  9939. Enables computing psnr along with vmaf.
  9940. Default value: @code{false}
  9941. @item ssim
  9942. Enables computing ssim along with vmaf.
  9943. Default value: @code{false}
  9944. @item ms_ssim
  9945. Enables computing ms_ssim along with vmaf.
  9946. Default value: @code{false}
  9947. @item pool
  9948. Set the pool method to be used for computing vmaf.
  9949. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9950. @item n_threads
  9951. Set number of threads to be used when computing vmaf.
  9952. Default value: @code{0}, which makes use of all available logical processors.
  9953. @item n_subsample
  9954. Set interval for frame subsampling used when computing vmaf.
  9955. Default value: @code{1}
  9956. @item enable_conf_interval
  9957. Enables confidence interval.
  9958. Default value: @code{false}
  9959. @end table
  9960. This filter also supports the @ref{framesync} options.
  9961. @subsection Examples
  9962. @itemize
  9963. @item
  9964. On the below examples the input file @file{main.mpg} being processed is
  9965. compared with the reference file @file{ref.mpg}.
  9966. @example
  9967. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9968. @end example
  9969. @item
  9970. Example with options:
  9971. @example
  9972. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9973. @end example
  9974. @item
  9975. Example with options and different containers:
  9976. @example
  9977. 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 -
  9978. @end example
  9979. @end itemize
  9980. @section limiter
  9981. Limits the pixel components values to the specified range [min, max].
  9982. The filter accepts the following options:
  9983. @table @option
  9984. @item min
  9985. Lower bound. Defaults to the lowest allowed value for the input.
  9986. @item max
  9987. Upper bound. Defaults to the highest allowed value for the input.
  9988. @item planes
  9989. Specify which planes will be processed. Defaults to all available.
  9990. @end table
  9991. @section loop
  9992. Loop video frames.
  9993. The filter accepts the following options:
  9994. @table @option
  9995. @item loop
  9996. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9997. Default is 0.
  9998. @item size
  9999. Set maximal size in number of frames. Default is 0.
  10000. @item start
  10001. Set first frame of loop. Default is 0.
  10002. @end table
  10003. @subsection Examples
  10004. @itemize
  10005. @item
  10006. Loop single first frame infinitely:
  10007. @example
  10008. loop=loop=-1:size=1:start=0
  10009. @end example
  10010. @item
  10011. Loop single first frame 10 times:
  10012. @example
  10013. loop=loop=10:size=1:start=0
  10014. @end example
  10015. @item
  10016. Loop 10 first frames 5 times:
  10017. @example
  10018. loop=loop=5:size=10:start=0
  10019. @end example
  10020. @end itemize
  10021. @section lut1d
  10022. Apply a 1D LUT to an input video.
  10023. The filter accepts the following options:
  10024. @table @option
  10025. @item file
  10026. Set the 1D LUT file name.
  10027. Currently supported formats:
  10028. @table @samp
  10029. @item cube
  10030. Iridas
  10031. @item csp
  10032. cineSpace
  10033. @end table
  10034. @item interp
  10035. Select interpolation mode.
  10036. Available values are:
  10037. @table @samp
  10038. @item nearest
  10039. Use values from the nearest defined point.
  10040. @item linear
  10041. Interpolate values using the linear interpolation.
  10042. @item cosine
  10043. Interpolate values using the cosine interpolation.
  10044. @item cubic
  10045. Interpolate values using the cubic interpolation.
  10046. @item spline
  10047. Interpolate values using the spline interpolation.
  10048. @end table
  10049. @end table
  10050. @anchor{lut3d}
  10051. @section lut3d
  10052. Apply a 3D LUT to an input video.
  10053. The filter accepts the following options:
  10054. @table @option
  10055. @item file
  10056. Set the 3D LUT file name.
  10057. Currently supported formats:
  10058. @table @samp
  10059. @item 3dl
  10060. AfterEffects
  10061. @item cube
  10062. Iridas
  10063. @item dat
  10064. DaVinci
  10065. @item m3d
  10066. Pandora
  10067. @item csp
  10068. cineSpace
  10069. @end table
  10070. @item interp
  10071. Select interpolation mode.
  10072. Available values are:
  10073. @table @samp
  10074. @item nearest
  10075. Use values from the nearest defined point.
  10076. @item trilinear
  10077. Interpolate values using the 8 points defining a cube.
  10078. @item tetrahedral
  10079. Interpolate values using a tetrahedron.
  10080. @end table
  10081. @end table
  10082. @section lumakey
  10083. Turn certain luma values into transparency.
  10084. The filter accepts the following options:
  10085. @table @option
  10086. @item threshold
  10087. Set the luma which will be used as base for transparency.
  10088. Default value is @code{0}.
  10089. @item tolerance
  10090. Set the range of luma values to be keyed out.
  10091. Default value is @code{0.01}.
  10092. @item softness
  10093. Set the range of softness. Default value is @code{0}.
  10094. Use this to control gradual transition from zero to full transparency.
  10095. @end table
  10096. @subsection Commands
  10097. This filter supports same @ref{commands} as options.
  10098. The command accepts the same syntax of the corresponding option.
  10099. If the specified expression is not valid, it is kept at its current
  10100. value.
  10101. @section lut, lutrgb, lutyuv
  10102. Compute a look-up table for binding each pixel component input value
  10103. to an output value, and apply it to the input video.
  10104. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10105. to an RGB input video.
  10106. These filters accept the following parameters:
  10107. @table @option
  10108. @item c0
  10109. set first pixel component expression
  10110. @item c1
  10111. set second pixel component expression
  10112. @item c2
  10113. set third pixel component expression
  10114. @item c3
  10115. set fourth pixel component expression, corresponds to the alpha component
  10116. @item r
  10117. set red component expression
  10118. @item g
  10119. set green component expression
  10120. @item b
  10121. set blue component expression
  10122. @item a
  10123. alpha component expression
  10124. @item y
  10125. set Y/luminance component expression
  10126. @item u
  10127. set U/Cb component expression
  10128. @item v
  10129. set V/Cr component expression
  10130. @end table
  10131. Each of them specifies the expression to use for computing the lookup table for
  10132. the corresponding pixel component values.
  10133. The exact component associated to each of the @var{c*} options depends on the
  10134. format in input.
  10135. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10136. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10137. The expressions can contain the following constants and functions:
  10138. @table @option
  10139. @item w
  10140. @item h
  10141. The input width and height.
  10142. @item val
  10143. The input value for the pixel component.
  10144. @item clipval
  10145. The input value, clipped to the @var{minval}-@var{maxval} range.
  10146. @item maxval
  10147. The maximum value for the pixel component.
  10148. @item minval
  10149. The minimum value for the pixel component.
  10150. @item negval
  10151. The negated value for the pixel component value, clipped to the
  10152. @var{minval}-@var{maxval} range; it corresponds to the expression
  10153. "maxval-clipval+minval".
  10154. @item clip(val)
  10155. The computed value in @var{val}, clipped to the
  10156. @var{minval}-@var{maxval} range.
  10157. @item gammaval(gamma)
  10158. The computed gamma correction value of the pixel component value,
  10159. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10160. expression
  10161. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10162. @end table
  10163. All expressions default to "val".
  10164. @subsection Examples
  10165. @itemize
  10166. @item
  10167. Negate input video:
  10168. @example
  10169. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10170. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10171. @end example
  10172. The above is the same as:
  10173. @example
  10174. lutrgb="r=negval:g=negval:b=negval"
  10175. lutyuv="y=negval:u=negval:v=negval"
  10176. @end example
  10177. @item
  10178. Negate luminance:
  10179. @example
  10180. lutyuv=y=negval
  10181. @end example
  10182. @item
  10183. Remove chroma components, turning the video into a graytone image:
  10184. @example
  10185. lutyuv="u=128:v=128"
  10186. @end example
  10187. @item
  10188. Apply a luma burning effect:
  10189. @example
  10190. lutyuv="y=2*val"
  10191. @end example
  10192. @item
  10193. Remove green and blue components:
  10194. @example
  10195. lutrgb="g=0:b=0"
  10196. @end example
  10197. @item
  10198. Set a constant alpha channel value on input:
  10199. @example
  10200. format=rgba,lutrgb=a="maxval-minval/2"
  10201. @end example
  10202. @item
  10203. Correct luminance gamma by a factor of 0.5:
  10204. @example
  10205. lutyuv=y=gammaval(0.5)
  10206. @end example
  10207. @item
  10208. Discard least significant bits of luma:
  10209. @example
  10210. lutyuv=y='bitand(val, 128+64+32)'
  10211. @end example
  10212. @item
  10213. Technicolor like effect:
  10214. @example
  10215. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10216. @end example
  10217. @end itemize
  10218. @section lut2, tlut2
  10219. The @code{lut2} filter takes two input streams and outputs one
  10220. stream.
  10221. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10222. from one single stream.
  10223. This filter accepts the following parameters:
  10224. @table @option
  10225. @item c0
  10226. set first pixel component expression
  10227. @item c1
  10228. set second pixel component expression
  10229. @item c2
  10230. set third pixel component expression
  10231. @item c3
  10232. set fourth pixel component expression, corresponds to the alpha component
  10233. @item d
  10234. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10235. which means bit depth is automatically picked from first input format.
  10236. @end table
  10237. The @code{lut2} filter also supports the @ref{framesync} options.
  10238. Each of them specifies the expression to use for computing the lookup table for
  10239. the corresponding pixel component values.
  10240. The exact component associated to each of the @var{c*} options depends on the
  10241. format in inputs.
  10242. The expressions can contain the following constants:
  10243. @table @option
  10244. @item w
  10245. @item h
  10246. The input width and height.
  10247. @item x
  10248. The first input value for the pixel component.
  10249. @item y
  10250. The second input value for the pixel component.
  10251. @item bdx
  10252. The first input video bit depth.
  10253. @item bdy
  10254. The second input video bit depth.
  10255. @end table
  10256. All expressions default to "x".
  10257. @subsection Examples
  10258. @itemize
  10259. @item
  10260. Highlight differences between two RGB video streams:
  10261. @example
  10262. 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)'
  10263. @end example
  10264. @item
  10265. Highlight differences between two YUV video streams:
  10266. @example
  10267. 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)'
  10268. @end example
  10269. @item
  10270. Show max difference between two video streams:
  10271. @example
  10272. 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)))'
  10273. @end example
  10274. @end itemize
  10275. @section maskedclamp
  10276. Clamp the first input stream with the second input and third input stream.
  10277. Returns the value of first stream to be between second input
  10278. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10279. This filter accepts the following options:
  10280. @table @option
  10281. @item undershoot
  10282. Default value is @code{0}.
  10283. @item overshoot
  10284. Default value is @code{0}.
  10285. @item planes
  10286. Set which planes will be processed as bitmap, unprocessed planes will be
  10287. copied from first stream.
  10288. By default value 0xf, all planes will be processed.
  10289. @end table
  10290. @section maskedmax
  10291. Merge the second and third input stream into output stream using absolute differences
  10292. between second input stream and first input stream and absolute difference between
  10293. third input stream and first input stream. The picked value will be from second input
  10294. stream if second absolute difference is greater than first one or from third input stream
  10295. otherwise.
  10296. This filter accepts the following options:
  10297. @table @option
  10298. @item planes
  10299. Set which planes will be processed as bitmap, unprocessed planes will be
  10300. copied from first stream.
  10301. By default value 0xf, all planes will be processed.
  10302. @end table
  10303. @section maskedmerge
  10304. Merge the first input stream with the second input stream using per pixel
  10305. weights in the third input stream.
  10306. A value of 0 in the third stream pixel component means that pixel component
  10307. from first stream is returned unchanged, while maximum value (eg. 255 for
  10308. 8-bit videos) means that pixel component from second stream is returned
  10309. unchanged. Intermediate values define the amount of merging between both
  10310. input stream's pixel components.
  10311. This filter accepts the following options:
  10312. @table @option
  10313. @item planes
  10314. Set which planes will be processed as bitmap, unprocessed planes will be
  10315. copied from first stream.
  10316. By default value 0xf, all planes will be processed.
  10317. @end table
  10318. @section maskedmin
  10319. Merge the second and third input stream into output stream using absolute differences
  10320. between second input stream and first input stream and absolute difference between
  10321. third input stream and first input stream. The picked value will be from second input
  10322. stream if second absolute difference is less than first one or from third input stream
  10323. otherwise.
  10324. This filter accepts the following options:
  10325. @table @option
  10326. @item planes
  10327. Set which planes will be processed as bitmap, unprocessed planes will be
  10328. copied from first stream.
  10329. By default value 0xf, all planes will be processed.
  10330. @end table
  10331. @section maskedthreshold
  10332. Pick pixels comparing absolute difference of two video streams with fixed
  10333. threshold.
  10334. If absolute difference between pixel component of first and second video
  10335. stream is equal or lower than user supplied threshold than pixel component
  10336. from first video stream is picked, otherwise pixel component from second
  10337. video stream is picked.
  10338. This filter accepts the following options:
  10339. @table @option
  10340. @item threshold
  10341. Set threshold used when picking pixels from absolute difference from two input
  10342. video streams.
  10343. @item planes
  10344. Set which planes will be processed as bitmap, unprocessed planes will be
  10345. copied from second stream.
  10346. By default value 0xf, all planes will be processed.
  10347. @end table
  10348. @section maskfun
  10349. Create mask from input video.
  10350. For example it is useful to create motion masks after @code{tblend} filter.
  10351. This filter accepts the following options:
  10352. @table @option
  10353. @item low
  10354. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10355. @item high
  10356. Set high threshold. Any pixel component higher than this value will be set to max value
  10357. allowed for current pixel format.
  10358. @item planes
  10359. Set planes to filter, by default all available planes are filtered.
  10360. @item fill
  10361. Fill all frame pixels with this value.
  10362. @item sum
  10363. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10364. average, output frame will be completely filled with value set by @var{fill} option.
  10365. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10366. @end table
  10367. @section mcdeint
  10368. Apply motion-compensation deinterlacing.
  10369. It needs one field per frame as input and must thus be used together
  10370. with yadif=1/3 or equivalent.
  10371. This filter accepts the following options:
  10372. @table @option
  10373. @item mode
  10374. Set the deinterlacing mode.
  10375. It accepts one of the following values:
  10376. @table @samp
  10377. @item fast
  10378. @item medium
  10379. @item slow
  10380. use iterative motion estimation
  10381. @item extra_slow
  10382. like @samp{slow}, but use multiple reference frames.
  10383. @end table
  10384. Default value is @samp{fast}.
  10385. @item parity
  10386. Set the picture field parity assumed for the input video. It must be
  10387. one of the following values:
  10388. @table @samp
  10389. @item 0, tff
  10390. assume top field first
  10391. @item 1, bff
  10392. assume bottom field first
  10393. @end table
  10394. Default value is @samp{bff}.
  10395. @item qp
  10396. Set per-block quantization parameter (QP) used by the internal
  10397. encoder.
  10398. Higher values should result in a smoother motion vector field but less
  10399. optimal individual vectors. Default value is 1.
  10400. @end table
  10401. @section median
  10402. Pick median pixel from certain rectangle defined by radius.
  10403. This filter accepts the following options:
  10404. @table @option
  10405. @item radius
  10406. Set horizontal radius size. Default value is @code{1}.
  10407. Allowed range is integer from 1 to 127.
  10408. @item planes
  10409. Set which planes to process. Default is @code{15}, which is all available planes.
  10410. @item radiusV
  10411. Set vertical radius size. Default value is @code{0}.
  10412. Allowed range is integer from 0 to 127.
  10413. If it is 0, value will be picked from horizontal @code{radius} option.
  10414. @item percentile
  10415. Set median percentile. Default value is @code{0.5}.
  10416. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10417. minimum values, and @code{1} maximum values.
  10418. @end table
  10419. @subsection Commands
  10420. This filter supports same @ref{commands} as options.
  10421. The command accepts the same syntax of the corresponding option.
  10422. If the specified expression is not valid, it is kept at its current
  10423. value.
  10424. @section mergeplanes
  10425. Merge color channel components from several video streams.
  10426. The filter accepts up to 4 input streams, and merge selected input
  10427. planes to the output video.
  10428. This filter accepts the following options:
  10429. @table @option
  10430. @item mapping
  10431. Set input to output plane mapping. Default is @code{0}.
  10432. The mappings is specified as a bitmap. It should be specified as a
  10433. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10434. mapping for the first plane of the output stream. 'A' sets the number of
  10435. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10436. corresponding input to use (from 0 to 3). The rest of the mappings is
  10437. similar, 'Bb' describes the mapping for the output stream second
  10438. plane, 'Cc' describes the mapping for the output stream third plane and
  10439. 'Dd' describes the mapping for the output stream fourth plane.
  10440. @item format
  10441. Set output pixel format. Default is @code{yuva444p}.
  10442. @end table
  10443. @subsection Examples
  10444. @itemize
  10445. @item
  10446. Merge three gray video streams of same width and height into single video stream:
  10447. @example
  10448. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10449. @end example
  10450. @item
  10451. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10452. @example
  10453. [a0][a1]mergeplanes=0x00010210:yuva444p
  10454. @end example
  10455. @item
  10456. Swap Y and A plane in yuva444p stream:
  10457. @example
  10458. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10459. @end example
  10460. @item
  10461. Swap U and V plane in yuv420p stream:
  10462. @example
  10463. format=yuv420p,mergeplanes=0x000201:yuv420p
  10464. @end example
  10465. @item
  10466. Cast a rgb24 clip to yuv444p:
  10467. @example
  10468. format=rgb24,mergeplanes=0x000102:yuv444p
  10469. @end example
  10470. @end itemize
  10471. @section mestimate
  10472. Estimate and export motion vectors using block matching algorithms.
  10473. Motion vectors are stored in frame side data to be used by other filters.
  10474. This filter accepts the following options:
  10475. @table @option
  10476. @item method
  10477. Specify the motion estimation method. Accepts one of the following values:
  10478. @table @samp
  10479. @item esa
  10480. Exhaustive search algorithm.
  10481. @item tss
  10482. Three step search algorithm.
  10483. @item tdls
  10484. Two dimensional logarithmic search algorithm.
  10485. @item ntss
  10486. New three step search algorithm.
  10487. @item fss
  10488. Four step search algorithm.
  10489. @item ds
  10490. Diamond search algorithm.
  10491. @item hexbs
  10492. Hexagon-based search algorithm.
  10493. @item epzs
  10494. Enhanced predictive zonal search algorithm.
  10495. @item umh
  10496. Uneven multi-hexagon search algorithm.
  10497. @end table
  10498. Default value is @samp{esa}.
  10499. @item mb_size
  10500. Macroblock size. Default @code{16}.
  10501. @item search_param
  10502. Search parameter. Default @code{7}.
  10503. @end table
  10504. @section midequalizer
  10505. Apply Midway Image Equalization effect using two video streams.
  10506. Midway Image Equalization adjusts a pair of images to have the same
  10507. histogram, while maintaining their dynamics as much as possible. It's
  10508. useful for e.g. matching exposures from a pair of stereo cameras.
  10509. This filter has two inputs and one output, which must be of same pixel format, but
  10510. may be of different sizes. The output of filter is first input adjusted with
  10511. midway histogram of both inputs.
  10512. This filter accepts the following option:
  10513. @table @option
  10514. @item planes
  10515. Set which planes to process. Default is @code{15}, which is all available planes.
  10516. @end table
  10517. @section minterpolate
  10518. Convert the video to specified frame rate using motion interpolation.
  10519. This filter accepts the following options:
  10520. @table @option
  10521. @item fps
  10522. 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}.
  10523. @item mi_mode
  10524. Motion interpolation mode. Following values are accepted:
  10525. @table @samp
  10526. @item dup
  10527. Duplicate previous or next frame for interpolating new ones.
  10528. @item blend
  10529. Blend source frames. Interpolated frame is mean of previous and next frames.
  10530. @item mci
  10531. Motion compensated interpolation. Following options are effective when this mode is selected:
  10532. @table @samp
  10533. @item mc_mode
  10534. Motion compensation mode. Following values are accepted:
  10535. @table @samp
  10536. @item obmc
  10537. Overlapped block motion compensation.
  10538. @item aobmc
  10539. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10540. @end table
  10541. Default mode is @samp{obmc}.
  10542. @item me_mode
  10543. Motion estimation mode. Following values are accepted:
  10544. @table @samp
  10545. @item bidir
  10546. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10547. @item bilat
  10548. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10549. @end table
  10550. Default mode is @samp{bilat}.
  10551. @item me
  10552. The algorithm to be used for motion estimation. Following values are accepted:
  10553. @table @samp
  10554. @item esa
  10555. Exhaustive search algorithm.
  10556. @item tss
  10557. Three step search algorithm.
  10558. @item tdls
  10559. Two dimensional logarithmic search algorithm.
  10560. @item ntss
  10561. New three step search algorithm.
  10562. @item fss
  10563. Four step search algorithm.
  10564. @item ds
  10565. Diamond search algorithm.
  10566. @item hexbs
  10567. Hexagon-based search algorithm.
  10568. @item epzs
  10569. Enhanced predictive zonal search algorithm.
  10570. @item umh
  10571. Uneven multi-hexagon search algorithm.
  10572. @end table
  10573. Default algorithm is @samp{epzs}.
  10574. @item mb_size
  10575. Macroblock size. Default @code{16}.
  10576. @item search_param
  10577. Motion estimation search parameter. Default @code{32}.
  10578. @item vsbmc
  10579. 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).
  10580. @end table
  10581. @end table
  10582. @item scd
  10583. 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:
  10584. @table @samp
  10585. @item none
  10586. Disable scene change detection.
  10587. @item fdiff
  10588. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10589. @end table
  10590. Default method is @samp{fdiff}.
  10591. @item scd_threshold
  10592. Scene change detection threshold. Default is @code{10.}.
  10593. @end table
  10594. @section mix
  10595. Mix several video input streams into one video stream.
  10596. A description of the accepted options follows.
  10597. @table @option
  10598. @item nb_inputs
  10599. The number of inputs. If unspecified, it defaults to 2.
  10600. @item weights
  10601. Specify weight of each input video stream as sequence.
  10602. Each weight is separated by space. If number of weights
  10603. is smaller than number of @var{frames} last specified
  10604. weight will be used for all remaining unset weights.
  10605. @item scale
  10606. Specify scale, if it is set it will be multiplied with sum
  10607. of each weight multiplied with pixel values to give final destination
  10608. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10609. @item duration
  10610. Specify how end of stream is determined.
  10611. @table @samp
  10612. @item longest
  10613. The duration of the longest input. (default)
  10614. @item shortest
  10615. The duration of the shortest input.
  10616. @item first
  10617. The duration of the first input.
  10618. @end table
  10619. @end table
  10620. @section mpdecimate
  10621. Drop frames that do not differ greatly from the previous frame in
  10622. order to reduce frame rate.
  10623. The main use of this filter is for very-low-bitrate encoding
  10624. (e.g. streaming over dialup modem), but it could in theory be used for
  10625. fixing movies that were inverse-telecined incorrectly.
  10626. A description of the accepted options follows.
  10627. @table @option
  10628. @item max
  10629. Set the maximum number of consecutive frames which can be dropped (if
  10630. positive), or the minimum interval between dropped frames (if
  10631. negative). If the value is 0, the frame is dropped disregarding the
  10632. number of previous sequentially dropped frames.
  10633. Default value is 0.
  10634. @item hi
  10635. @item lo
  10636. @item frac
  10637. Set the dropping threshold values.
  10638. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10639. represent actual pixel value differences, so a threshold of 64
  10640. corresponds to 1 unit of difference for each pixel, or the same spread
  10641. out differently over the block.
  10642. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10643. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10644. meaning the whole image) differ by more than a threshold of @option{lo}.
  10645. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10646. 64*5, and default value for @option{frac} is 0.33.
  10647. @end table
  10648. @section negate
  10649. Negate (invert) the input video.
  10650. It accepts the following option:
  10651. @table @option
  10652. @item negate_alpha
  10653. With value 1, it negates the alpha component, if present. Default value is 0.
  10654. @end table
  10655. @anchor{nlmeans}
  10656. @section nlmeans
  10657. Denoise frames using Non-Local Means algorithm.
  10658. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10659. context similarity is defined by comparing their surrounding patches of size
  10660. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10661. around the pixel.
  10662. Note that the research area defines centers for patches, which means some
  10663. patches will be made of pixels outside that research area.
  10664. The filter accepts the following options.
  10665. @table @option
  10666. @item s
  10667. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10668. @item p
  10669. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10670. @item pc
  10671. Same as @option{p} but for chroma planes.
  10672. The default value is @var{0} and means automatic.
  10673. @item r
  10674. Set research size. Default is 15. Must be odd number in range [0, 99].
  10675. @item rc
  10676. Same as @option{r} but for chroma planes.
  10677. The default value is @var{0} and means automatic.
  10678. @end table
  10679. @section nnedi
  10680. Deinterlace video using neural network edge directed interpolation.
  10681. This filter accepts the following options:
  10682. @table @option
  10683. @item weights
  10684. Mandatory option, without binary file filter can not work.
  10685. Currently file can be found here:
  10686. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10687. @item deint
  10688. Set which frames to deinterlace, by default it is @code{all}.
  10689. Can be @code{all} or @code{interlaced}.
  10690. @item field
  10691. Set mode of operation.
  10692. Can be one of the following:
  10693. @table @samp
  10694. @item af
  10695. Use frame flags, both fields.
  10696. @item a
  10697. Use frame flags, single field.
  10698. @item t
  10699. Use top field only.
  10700. @item b
  10701. Use bottom field only.
  10702. @item tf
  10703. Use both fields, top first.
  10704. @item bf
  10705. Use both fields, bottom first.
  10706. @end table
  10707. @item planes
  10708. Set which planes to process, by default filter process all frames.
  10709. @item nsize
  10710. Set size of local neighborhood around each pixel, used by the predictor neural
  10711. network.
  10712. Can be one of the following:
  10713. @table @samp
  10714. @item s8x6
  10715. @item s16x6
  10716. @item s32x6
  10717. @item s48x6
  10718. @item s8x4
  10719. @item s16x4
  10720. @item s32x4
  10721. @end table
  10722. @item nns
  10723. Set the number of neurons in predictor neural network.
  10724. Can be one of the following:
  10725. @table @samp
  10726. @item n16
  10727. @item n32
  10728. @item n64
  10729. @item n128
  10730. @item n256
  10731. @end table
  10732. @item qual
  10733. Controls the number of different neural network predictions that are blended
  10734. together to compute the final output value. Can be @code{fast}, default or
  10735. @code{slow}.
  10736. @item etype
  10737. Set which set of weights to use in the predictor.
  10738. Can be one of the following:
  10739. @table @samp
  10740. @item a
  10741. weights trained to minimize absolute error
  10742. @item s
  10743. weights trained to minimize squared error
  10744. @end table
  10745. @item pscrn
  10746. Controls whether or not the prescreener neural network is used to decide
  10747. which pixels should be processed by the predictor neural network and which
  10748. can be handled by simple cubic interpolation.
  10749. The prescreener is trained to know whether cubic interpolation will be
  10750. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10751. The computational complexity of the prescreener nn is much less than that of
  10752. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10753. using the prescreener generally results in much faster processing.
  10754. The prescreener is pretty accurate, so the difference between using it and not
  10755. using it is almost always unnoticeable.
  10756. Can be one of the following:
  10757. @table @samp
  10758. @item none
  10759. @item original
  10760. @item new
  10761. @end table
  10762. Default is @code{new}.
  10763. @item fapprox
  10764. Set various debugging flags.
  10765. @end table
  10766. @section noformat
  10767. Force libavfilter not to use any of the specified pixel formats for the
  10768. input to the next filter.
  10769. It accepts the following parameters:
  10770. @table @option
  10771. @item pix_fmts
  10772. A '|'-separated list of pixel format names, such as
  10773. pix_fmts=yuv420p|monow|rgb24".
  10774. @end table
  10775. @subsection Examples
  10776. @itemize
  10777. @item
  10778. Force libavfilter to use a format different from @var{yuv420p} for the
  10779. input to the vflip filter:
  10780. @example
  10781. noformat=pix_fmts=yuv420p,vflip
  10782. @end example
  10783. @item
  10784. Convert the input video to any of the formats not contained in the list:
  10785. @example
  10786. noformat=yuv420p|yuv444p|yuv410p
  10787. @end example
  10788. @end itemize
  10789. @section noise
  10790. Add noise on video input frame.
  10791. The filter accepts the following options:
  10792. @table @option
  10793. @item all_seed
  10794. @item c0_seed
  10795. @item c1_seed
  10796. @item c2_seed
  10797. @item c3_seed
  10798. Set noise seed for specific pixel component or all pixel components in case
  10799. of @var{all_seed}. Default value is @code{123457}.
  10800. @item all_strength, alls
  10801. @item c0_strength, c0s
  10802. @item c1_strength, c1s
  10803. @item c2_strength, c2s
  10804. @item c3_strength, c3s
  10805. Set noise strength for specific pixel component or all pixel components in case
  10806. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10807. @item all_flags, allf
  10808. @item c0_flags, c0f
  10809. @item c1_flags, c1f
  10810. @item c2_flags, c2f
  10811. @item c3_flags, c3f
  10812. Set pixel component flags or set flags for all components if @var{all_flags}.
  10813. Available values for component flags are:
  10814. @table @samp
  10815. @item a
  10816. averaged temporal noise (smoother)
  10817. @item p
  10818. mix random noise with a (semi)regular pattern
  10819. @item t
  10820. temporal noise (noise pattern changes between frames)
  10821. @item u
  10822. uniform noise (gaussian otherwise)
  10823. @end table
  10824. @end table
  10825. @subsection Examples
  10826. Add temporal and uniform noise to input video:
  10827. @example
  10828. noise=alls=20:allf=t+u
  10829. @end example
  10830. @section normalize
  10831. Normalize RGB video (aka histogram stretching, contrast stretching).
  10832. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10833. For each channel of each frame, the filter computes the input range and maps
  10834. it linearly to the user-specified output range. The output range defaults
  10835. to the full dynamic range from pure black to pure white.
  10836. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10837. changes in brightness) caused when small dark or bright objects enter or leave
  10838. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10839. video camera, and, like a video camera, it may cause a period of over- or
  10840. under-exposure of the video.
  10841. The R,G,B channels can be normalized independently, which may cause some
  10842. color shifting, or linked together as a single channel, which prevents
  10843. color shifting. Linked normalization preserves hue. Independent normalization
  10844. does not, so it can be used to remove some color casts. Independent and linked
  10845. normalization can be combined in any ratio.
  10846. The normalize filter accepts the following options:
  10847. @table @option
  10848. @item blackpt
  10849. @item whitept
  10850. Colors which define the output range. The minimum input value is mapped to
  10851. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10852. The defaults are black and white respectively. Specifying white for
  10853. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10854. normalized video. Shades of grey can be used to reduce the dynamic range
  10855. (contrast). Specifying saturated colors here can create some interesting
  10856. effects.
  10857. @item smoothing
  10858. The number of previous frames to use for temporal smoothing. The input range
  10859. of each channel is smoothed using a rolling average over the current frame
  10860. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10861. smoothing).
  10862. @item independence
  10863. Controls the ratio of independent (color shifting) channel normalization to
  10864. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10865. independent. Defaults to 1.0 (fully independent).
  10866. @item strength
  10867. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10868. expensive no-op. Defaults to 1.0 (full strength).
  10869. @end table
  10870. @subsection Commands
  10871. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10872. The command accepts the same syntax of the corresponding option.
  10873. If the specified expression is not valid, it is kept at its current
  10874. value.
  10875. @subsection Examples
  10876. Stretch video contrast to use the full dynamic range, with no temporal
  10877. smoothing; may flicker depending on the source content:
  10878. @example
  10879. normalize=blackpt=black:whitept=white:smoothing=0
  10880. @end example
  10881. As above, but with 50 frames of temporal smoothing; flicker should be
  10882. reduced, depending on the source content:
  10883. @example
  10884. normalize=blackpt=black:whitept=white:smoothing=50
  10885. @end example
  10886. As above, but with hue-preserving linked channel normalization:
  10887. @example
  10888. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10889. @end example
  10890. As above, but with half strength:
  10891. @example
  10892. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10893. @end example
  10894. Map the darkest input color to red, the brightest input color to cyan:
  10895. @example
  10896. normalize=blackpt=red:whitept=cyan
  10897. @end example
  10898. @section null
  10899. Pass the video source unchanged to the output.
  10900. @section ocr
  10901. Optical Character Recognition
  10902. This filter uses Tesseract for optical character recognition. To enable
  10903. compilation of this filter, you need to configure FFmpeg with
  10904. @code{--enable-libtesseract}.
  10905. It accepts the following options:
  10906. @table @option
  10907. @item datapath
  10908. Set datapath to tesseract data. Default is to use whatever was
  10909. set at installation.
  10910. @item language
  10911. Set language, default is "eng".
  10912. @item whitelist
  10913. Set character whitelist.
  10914. @item blacklist
  10915. Set character blacklist.
  10916. @end table
  10917. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10918. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10919. @section ocv
  10920. Apply a video transform using libopencv.
  10921. To enable this filter, install the libopencv library and headers and
  10922. configure FFmpeg with @code{--enable-libopencv}.
  10923. It accepts the following parameters:
  10924. @table @option
  10925. @item filter_name
  10926. The name of the libopencv filter to apply.
  10927. @item filter_params
  10928. The parameters to pass to the libopencv filter. If not specified, the default
  10929. values are assumed.
  10930. @end table
  10931. Refer to the official libopencv documentation for more precise
  10932. information:
  10933. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10934. Several libopencv filters are supported; see the following subsections.
  10935. @anchor{dilate}
  10936. @subsection dilate
  10937. Dilate an image by using a specific structuring element.
  10938. It corresponds to the libopencv function @code{cvDilate}.
  10939. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10940. @var{struct_el} represents a structuring element, and has the syntax:
  10941. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10942. @var{cols} and @var{rows} represent the number of columns and rows of
  10943. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10944. point, and @var{shape} the shape for the structuring element. @var{shape}
  10945. must be "rect", "cross", "ellipse", or "custom".
  10946. If the value for @var{shape} is "custom", it must be followed by a
  10947. string of the form "=@var{filename}". The file with name
  10948. @var{filename} is assumed to represent a binary image, with each
  10949. printable character corresponding to a bright pixel. When a custom
  10950. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10951. or columns and rows of the read file are assumed instead.
  10952. The default value for @var{struct_el} is "3x3+0x0/rect".
  10953. @var{nb_iterations} specifies the number of times the transform is
  10954. applied to the image, and defaults to 1.
  10955. Some examples:
  10956. @example
  10957. # Use the default values
  10958. ocv=dilate
  10959. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10960. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10961. # Read the shape from the file diamond.shape, iterating two times.
  10962. # The file diamond.shape may contain a pattern of characters like this
  10963. # *
  10964. # ***
  10965. # *****
  10966. # ***
  10967. # *
  10968. # The specified columns and rows are ignored
  10969. # but the anchor point coordinates are not
  10970. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10971. @end example
  10972. @subsection erode
  10973. Erode an image by using a specific structuring element.
  10974. It corresponds to the libopencv function @code{cvErode}.
  10975. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10976. with the same syntax and semantics as the @ref{dilate} filter.
  10977. @subsection smooth
  10978. Smooth the input video.
  10979. The filter takes the following parameters:
  10980. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10981. @var{type} is the type of smooth filter to apply, and must be one of
  10982. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10983. or "bilateral". The default value is "gaussian".
  10984. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10985. depends on the smooth type. @var{param1} and
  10986. @var{param2} accept integer positive values or 0. @var{param3} and
  10987. @var{param4} accept floating point values.
  10988. The default value for @var{param1} is 3. The default value for the
  10989. other parameters is 0.
  10990. These parameters correspond to the parameters assigned to the
  10991. libopencv function @code{cvSmooth}.
  10992. @section oscilloscope
  10993. 2D Video Oscilloscope.
  10994. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10995. It accepts the following parameters:
  10996. @table @option
  10997. @item x
  10998. Set scope center x position.
  10999. @item y
  11000. Set scope center y position.
  11001. @item s
  11002. Set scope size, relative to frame diagonal.
  11003. @item t
  11004. Set scope tilt/rotation.
  11005. @item o
  11006. Set trace opacity.
  11007. @item tx
  11008. Set trace center x position.
  11009. @item ty
  11010. Set trace center y position.
  11011. @item tw
  11012. Set trace width, relative to width of frame.
  11013. @item th
  11014. Set trace height, relative to height of frame.
  11015. @item c
  11016. Set which components to trace. By default it traces first three components.
  11017. @item g
  11018. Draw trace grid. By default is enabled.
  11019. @item st
  11020. Draw some statistics. By default is enabled.
  11021. @item sc
  11022. Draw scope. By default is enabled.
  11023. @end table
  11024. @subsection Commands
  11025. This filter supports same @ref{commands} as options.
  11026. The command accepts the same syntax of the corresponding option.
  11027. If the specified expression is not valid, it is kept at its current
  11028. value.
  11029. @subsection Examples
  11030. @itemize
  11031. @item
  11032. Inspect full first row of video frame.
  11033. @example
  11034. oscilloscope=x=0.5:y=0:s=1
  11035. @end example
  11036. @item
  11037. Inspect full last row of video frame.
  11038. @example
  11039. oscilloscope=x=0.5:y=1:s=1
  11040. @end example
  11041. @item
  11042. Inspect full 5th line of video frame of height 1080.
  11043. @example
  11044. oscilloscope=x=0.5:y=5/1080:s=1
  11045. @end example
  11046. @item
  11047. Inspect full last column of video frame.
  11048. @example
  11049. oscilloscope=x=1:y=0.5:s=1:t=1
  11050. @end example
  11051. @end itemize
  11052. @anchor{overlay}
  11053. @section overlay
  11054. Overlay one video on top of another.
  11055. It takes two inputs and has one output. The first input is the "main"
  11056. video on which the second input is overlaid.
  11057. It accepts the following parameters:
  11058. A description of the accepted options follows.
  11059. @table @option
  11060. @item x
  11061. @item y
  11062. Set the expression for the x and y coordinates of the overlaid video
  11063. on the main video. Default value is "0" for both expressions. In case
  11064. the expression is invalid, it is set to a huge value (meaning that the
  11065. overlay will not be displayed within the output visible area).
  11066. @item eof_action
  11067. See @ref{framesync}.
  11068. @item eval
  11069. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11070. It accepts the following values:
  11071. @table @samp
  11072. @item init
  11073. only evaluate expressions once during the filter initialization or
  11074. when a command is processed
  11075. @item frame
  11076. evaluate expressions for each incoming frame
  11077. @end table
  11078. Default value is @samp{frame}.
  11079. @item shortest
  11080. See @ref{framesync}.
  11081. @item format
  11082. Set the format for the output video.
  11083. It accepts the following values:
  11084. @table @samp
  11085. @item yuv420
  11086. force YUV420 output
  11087. @item yuv420p10
  11088. force YUV420p10 output
  11089. @item yuv422
  11090. force YUV422 output
  11091. @item yuv422p10
  11092. force YUV422p10 output
  11093. @item yuv444
  11094. force YUV444 output
  11095. @item rgb
  11096. force packed RGB output
  11097. @item gbrp
  11098. force planar RGB output
  11099. @item auto
  11100. automatically pick format
  11101. @end table
  11102. Default value is @samp{yuv420}.
  11103. @item repeatlast
  11104. See @ref{framesync}.
  11105. @item alpha
  11106. Set format of alpha of the overlaid video, it can be @var{straight} or
  11107. @var{premultiplied}. Default is @var{straight}.
  11108. @end table
  11109. The @option{x}, and @option{y} expressions can contain the following
  11110. parameters.
  11111. @table @option
  11112. @item main_w, W
  11113. @item main_h, H
  11114. The main input width and height.
  11115. @item overlay_w, w
  11116. @item overlay_h, h
  11117. The overlay input width and height.
  11118. @item x
  11119. @item y
  11120. The computed values for @var{x} and @var{y}. They are evaluated for
  11121. each new frame.
  11122. @item hsub
  11123. @item vsub
  11124. horizontal and vertical chroma subsample values of the output
  11125. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11126. @var{vsub} is 1.
  11127. @item n
  11128. the number of input frame, starting from 0
  11129. @item pos
  11130. the position in the file of the input frame, NAN if unknown
  11131. @item t
  11132. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11133. @end table
  11134. This filter also supports the @ref{framesync} options.
  11135. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11136. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11137. when @option{eval} is set to @samp{init}.
  11138. Be aware that frames are taken from each input video in timestamp
  11139. order, hence, if their initial timestamps differ, it is a good idea
  11140. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11141. have them begin in the same zero timestamp, as the example for
  11142. the @var{movie} filter does.
  11143. You can chain together more overlays but you should test the
  11144. efficiency of such approach.
  11145. @subsection Commands
  11146. This filter supports the following commands:
  11147. @table @option
  11148. @item x
  11149. @item y
  11150. Modify the x and y of the overlay input.
  11151. The command accepts the same syntax of the corresponding option.
  11152. If the specified expression is not valid, it is kept at its current
  11153. value.
  11154. @end table
  11155. @subsection Examples
  11156. @itemize
  11157. @item
  11158. Draw the overlay at 10 pixels from the bottom right corner of the main
  11159. video:
  11160. @example
  11161. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11162. @end example
  11163. Using named options the example above becomes:
  11164. @example
  11165. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11166. @end example
  11167. @item
  11168. Insert a transparent PNG logo in the bottom left corner of the input,
  11169. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11170. @example
  11171. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11172. @end example
  11173. @item
  11174. Insert 2 different transparent PNG logos (second logo on bottom
  11175. right corner) using the @command{ffmpeg} tool:
  11176. @example
  11177. 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
  11178. @end example
  11179. @item
  11180. Add a transparent color layer on top of the main video; @code{WxH}
  11181. must specify the size of the main input to the overlay filter:
  11182. @example
  11183. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11184. @end example
  11185. @item
  11186. Play an original video and a filtered version (here with the deshake
  11187. filter) side by side using the @command{ffplay} tool:
  11188. @example
  11189. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11190. @end example
  11191. The above command is the same as:
  11192. @example
  11193. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11194. @end example
  11195. @item
  11196. Make a sliding overlay appearing from the left to the right top part of the
  11197. screen starting since time 2:
  11198. @example
  11199. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11200. @end example
  11201. @item
  11202. Compose output by putting two input videos side to side:
  11203. @example
  11204. ffmpeg -i left.avi -i right.avi -filter_complex "
  11205. nullsrc=size=200x100 [background];
  11206. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11207. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11208. [background][left] overlay=shortest=1 [background+left];
  11209. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11210. "
  11211. @end example
  11212. @item
  11213. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11214. @example
  11215. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11216. -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]'
  11217. masked.avi
  11218. @end example
  11219. @item
  11220. Chain several overlays in cascade:
  11221. @example
  11222. nullsrc=s=200x200 [bg];
  11223. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11224. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11225. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11226. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11227. [in3] null, [mid2] overlay=100:100 [out0]
  11228. @end example
  11229. @end itemize
  11230. @anchor{overlay_cuda}
  11231. @section overlay_cuda
  11232. Overlay one video on top of another.
  11233. This is the CUDA cariant of the @ref{overlay} filter.
  11234. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11235. It takes two inputs and has one output. The first input is the "main"
  11236. video on which the second input is overlaid.
  11237. It accepts the following parameters:
  11238. @table @option
  11239. @item x
  11240. @item y
  11241. Set the x and y coordinates of the overlaid video on the main video.
  11242. Default value is "0" for both expressions.
  11243. @item eof_action
  11244. See @ref{framesync}.
  11245. @item shortest
  11246. See @ref{framesync}.
  11247. @item repeatlast
  11248. See @ref{framesync}.
  11249. @end table
  11250. This filter also supports the @ref{framesync} options.
  11251. @section owdenoise
  11252. Apply Overcomplete Wavelet denoiser.
  11253. The filter accepts the following options:
  11254. @table @option
  11255. @item depth
  11256. Set depth.
  11257. Larger depth values will denoise lower frequency components more, but
  11258. slow down filtering.
  11259. Must be an int in the range 8-16, default is @code{8}.
  11260. @item luma_strength, ls
  11261. Set luma strength.
  11262. Must be a double value in the range 0-1000, default is @code{1.0}.
  11263. @item chroma_strength, cs
  11264. Set chroma strength.
  11265. Must be a double value in the range 0-1000, default is @code{1.0}.
  11266. @end table
  11267. @anchor{pad}
  11268. @section pad
  11269. Add paddings to the input image, and place the original input at the
  11270. provided @var{x}, @var{y} coordinates.
  11271. It accepts the following parameters:
  11272. @table @option
  11273. @item width, w
  11274. @item height, h
  11275. Specify an expression for the size of the output image with the
  11276. paddings added. If the value for @var{width} or @var{height} is 0, the
  11277. corresponding input size is used for the output.
  11278. The @var{width} expression can reference the value set by the
  11279. @var{height} expression, and vice versa.
  11280. The default value of @var{width} and @var{height} is 0.
  11281. @item x
  11282. @item y
  11283. Specify the offsets to place the input image at within the padded area,
  11284. with respect to the top/left border of the output image.
  11285. The @var{x} expression can reference the value set by the @var{y}
  11286. expression, and vice versa.
  11287. The default value of @var{x} and @var{y} is 0.
  11288. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11289. so the input image is centered on the padded area.
  11290. @item color
  11291. Specify the color of the padded area. For the syntax of this option,
  11292. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11293. manual,ffmpeg-utils}.
  11294. The default value of @var{color} is "black".
  11295. @item eval
  11296. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11297. It accepts the following values:
  11298. @table @samp
  11299. @item init
  11300. Only evaluate expressions once during the filter initialization or when
  11301. a command is processed.
  11302. @item frame
  11303. Evaluate expressions for each incoming frame.
  11304. @end table
  11305. Default value is @samp{init}.
  11306. @item aspect
  11307. Pad to aspect instead to a resolution.
  11308. @end table
  11309. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11310. options are expressions containing the following constants:
  11311. @table @option
  11312. @item in_w
  11313. @item in_h
  11314. The input video width and height.
  11315. @item iw
  11316. @item ih
  11317. These are the same as @var{in_w} and @var{in_h}.
  11318. @item out_w
  11319. @item out_h
  11320. The output width and height (the size of the padded area), as
  11321. specified by the @var{width} and @var{height} expressions.
  11322. @item ow
  11323. @item oh
  11324. These are the same as @var{out_w} and @var{out_h}.
  11325. @item x
  11326. @item y
  11327. The x and y offsets as specified by the @var{x} and @var{y}
  11328. expressions, or NAN if not yet specified.
  11329. @item a
  11330. same as @var{iw} / @var{ih}
  11331. @item sar
  11332. input sample aspect ratio
  11333. @item dar
  11334. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11335. @item hsub
  11336. @item vsub
  11337. The horizontal and vertical chroma subsample values. For example for the
  11338. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11339. @end table
  11340. @subsection Examples
  11341. @itemize
  11342. @item
  11343. Add paddings with the color "violet" to the input video. The output video
  11344. size is 640x480, and the top-left corner of the input video is placed at
  11345. column 0, row 40
  11346. @example
  11347. pad=640:480:0:40:violet
  11348. @end example
  11349. The example above is equivalent to the following command:
  11350. @example
  11351. pad=width=640:height=480:x=0:y=40:color=violet
  11352. @end example
  11353. @item
  11354. Pad the input to get an output with dimensions increased by 3/2,
  11355. and put the input video at the center of the padded area:
  11356. @example
  11357. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11358. @end example
  11359. @item
  11360. Pad the input to get a squared output with size equal to the maximum
  11361. value between the input width and height, and put the input video at
  11362. the center of the padded area:
  11363. @example
  11364. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11365. @end example
  11366. @item
  11367. Pad the input to get a final w/h ratio of 16:9:
  11368. @example
  11369. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11370. @end example
  11371. @item
  11372. In case of anamorphic video, in order to set the output display aspect
  11373. correctly, it is necessary to use @var{sar} in the expression,
  11374. according to the relation:
  11375. @example
  11376. (ih * X / ih) * sar = output_dar
  11377. X = output_dar / sar
  11378. @end example
  11379. Thus the previous example needs to be modified to:
  11380. @example
  11381. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11382. @end example
  11383. @item
  11384. Double the output size and put the input video in the bottom-right
  11385. corner of the output padded area:
  11386. @example
  11387. pad="2*iw:2*ih:ow-iw:oh-ih"
  11388. @end example
  11389. @end itemize
  11390. @anchor{palettegen}
  11391. @section palettegen
  11392. Generate one palette for a whole video stream.
  11393. It accepts the following options:
  11394. @table @option
  11395. @item max_colors
  11396. Set the maximum number of colors to quantize in the palette.
  11397. Note: the palette will still contain 256 colors; the unused palette entries
  11398. will be black.
  11399. @item reserve_transparent
  11400. Create a palette of 255 colors maximum and reserve the last one for
  11401. transparency. Reserving the transparency color is useful for GIF optimization.
  11402. If not set, the maximum of colors in the palette will be 256. You probably want
  11403. to disable this option for a standalone image.
  11404. Set by default.
  11405. @item transparency_color
  11406. Set the color that will be used as background for transparency.
  11407. @item stats_mode
  11408. Set statistics mode.
  11409. It accepts the following values:
  11410. @table @samp
  11411. @item full
  11412. Compute full frame histograms.
  11413. @item diff
  11414. Compute histograms only for the part that differs from previous frame. This
  11415. might be relevant to give more importance to the moving part of your input if
  11416. the background is static.
  11417. @item single
  11418. Compute new histogram for each frame.
  11419. @end table
  11420. Default value is @var{full}.
  11421. @end table
  11422. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11423. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11424. color quantization of the palette. This information is also visible at
  11425. @var{info} logging level.
  11426. @subsection Examples
  11427. @itemize
  11428. @item
  11429. Generate a representative palette of a given video using @command{ffmpeg}:
  11430. @example
  11431. ffmpeg -i input.mkv -vf palettegen palette.png
  11432. @end example
  11433. @end itemize
  11434. @section paletteuse
  11435. Use a palette to downsample an input video stream.
  11436. The filter takes two inputs: one video stream and a palette. The palette must
  11437. be a 256 pixels image.
  11438. It accepts the following options:
  11439. @table @option
  11440. @item dither
  11441. Select dithering mode. Available algorithms are:
  11442. @table @samp
  11443. @item bayer
  11444. Ordered 8x8 bayer dithering (deterministic)
  11445. @item heckbert
  11446. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11447. Note: this dithering is sometimes considered "wrong" and is included as a
  11448. reference.
  11449. @item floyd_steinberg
  11450. Floyd and Steingberg dithering (error diffusion)
  11451. @item sierra2
  11452. Frankie Sierra dithering v2 (error diffusion)
  11453. @item sierra2_4a
  11454. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11455. @end table
  11456. Default is @var{sierra2_4a}.
  11457. @item bayer_scale
  11458. When @var{bayer} dithering is selected, this option defines the scale of the
  11459. pattern (how much the crosshatch pattern is visible). A low value means more
  11460. visible pattern for less banding, and higher value means less visible pattern
  11461. at the cost of more banding.
  11462. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11463. @item diff_mode
  11464. If set, define the zone to process
  11465. @table @samp
  11466. @item rectangle
  11467. Only the changing rectangle will be reprocessed. This is similar to GIF
  11468. cropping/offsetting compression mechanism. This option can be useful for speed
  11469. if only a part of the image is changing, and has use cases such as limiting the
  11470. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11471. moving scene (it leads to more deterministic output if the scene doesn't change
  11472. much, and as a result less moving noise and better GIF compression).
  11473. @end table
  11474. Default is @var{none}.
  11475. @item new
  11476. Take new palette for each output frame.
  11477. @item alpha_threshold
  11478. Sets the alpha threshold for transparency. Alpha values above this threshold
  11479. will be treated as completely opaque, and values below this threshold will be
  11480. treated as completely transparent.
  11481. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11482. @end table
  11483. @subsection Examples
  11484. @itemize
  11485. @item
  11486. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11487. using @command{ffmpeg}:
  11488. @example
  11489. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11490. @end example
  11491. @end itemize
  11492. @section perspective
  11493. Correct perspective of video not recorded perpendicular to the screen.
  11494. A description of the accepted parameters follows.
  11495. @table @option
  11496. @item x0
  11497. @item y0
  11498. @item x1
  11499. @item y1
  11500. @item x2
  11501. @item y2
  11502. @item x3
  11503. @item y3
  11504. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11505. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11506. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11507. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11508. then the corners of the source will be sent to the specified coordinates.
  11509. The expressions can use the following variables:
  11510. @table @option
  11511. @item W
  11512. @item H
  11513. the width and height of video frame.
  11514. @item in
  11515. Input frame count.
  11516. @item on
  11517. Output frame count.
  11518. @end table
  11519. @item interpolation
  11520. Set interpolation for perspective correction.
  11521. It accepts the following values:
  11522. @table @samp
  11523. @item linear
  11524. @item cubic
  11525. @end table
  11526. Default value is @samp{linear}.
  11527. @item sense
  11528. Set interpretation of coordinate options.
  11529. It accepts the following values:
  11530. @table @samp
  11531. @item 0, source
  11532. Send point in the source specified by the given coordinates to
  11533. the corners of the destination.
  11534. @item 1, destination
  11535. Send the corners of the source to the point in the destination specified
  11536. by the given coordinates.
  11537. Default value is @samp{source}.
  11538. @end table
  11539. @item eval
  11540. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11541. It accepts the following values:
  11542. @table @samp
  11543. @item init
  11544. only evaluate expressions once during the filter initialization or
  11545. when a command is processed
  11546. @item frame
  11547. evaluate expressions for each incoming frame
  11548. @end table
  11549. Default value is @samp{init}.
  11550. @end table
  11551. @section phase
  11552. Delay interlaced video by one field time so that the field order changes.
  11553. The intended use is to fix PAL movies that have been captured with the
  11554. opposite field order to the film-to-video transfer.
  11555. A description of the accepted parameters follows.
  11556. @table @option
  11557. @item mode
  11558. Set phase mode.
  11559. It accepts the following values:
  11560. @table @samp
  11561. @item t
  11562. Capture field order top-first, transfer bottom-first.
  11563. Filter will delay the bottom field.
  11564. @item b
  11565. Capture field order bottom-first, transfer top-first.
  11566. Filter will delay the top field.
  11567. @item p
  11568. Capture and transfer with the same field order. This mode only exists
  11569. for the documentation of the other options to refer to, but if you
  11570. actually select it, the filter will faithfully do nothing.
  11571. @item a
  11572. Capture field order determined automatically by field flags, transfer
  11573. opposite.
  11574. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11575. basis using field flags. If no field information is available,
  11576. then this works just like @samp{u}.
  11577. @item u
  11578. Capture unknown or varying, transfer opposite.
  11579. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11580. analyzing the images and selecting the alternative that produces best
  11581. match between the fields.
  11582. @item T
  11583. Capture top-first, transfer unknown or varying.
  11584. Filter selects among @samp{t} and @samp{p} using image analysis.
  11585. @item B
  11586. Capture bottom-first, transfer unknown or varying.
  11587. Filter selects among @samp{b} and @samp{p} using image analysis.
  11588. @item A
  11589. Capture determined by field flags, transfer unknown or varying.
  11590. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11591. image analysis. If no field information is available, then this works just
  11592. like @samp{U}. This is the default mode.
  11593. @item U
  11594. Both capture and transfer unknown or varying.
  11595. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11596. @end table
  11597. @end table
  11598. @section photosensitivity
  11599. Reduce various flashes in video, so to help users with epilepsy.
  11600. It accepts the following options:
  11601. @table @option
  11602. @item frames, f
  11603. Set how many frames to use when filtering. Default is 30.
  11604. @item threshold, t
  11605. Set detection threshold factor. Default is 1.
  11606. Lower is stricter.
  11607. @item skip
  11608. Set how many pixels to skip when sampling frames. Default is 1.
  11609. Allowed range is from 1 to 1024.
  11610. @item bypass
  11611. Leave frames unchanged. Default is disabled.
  11612. @end table
  11613. @section pixdesctest
  11614. Pixel format descriptor test filter, mainly useful for internal
  11615. testing. The output video should be equal to the input video.
  11616. For example:
  11617. @example
  11618. format=monow, pixdesctest
  11619. @end example
  11620. can be used to test the monowhite pixel format descriptor definition.
  11621. @section pixscope
  11622. Display sample values of color channels. Mainly useful for checking color
  11623. and levels. Minimum supported resolution is 640x480.
  11624. The filters accept the following options:
  11625. @table @option
  11626. @item x
  11627. Set scope X position, relative offset on X axis.
  11628. @item y
  11629. Set scope Y position, relative offset on Y axis.
  11630. @item w
  11631. Set scope width.
  11632. @item h
  11633. Set scope height.
  11634. @item o
  11635. Set window opacity. This window also holds statistics about pixel area.
  11636. @item wx
  11637. Set window X position, relative offset on X axis.
  11638. @item wy
  11639. Set window Y position, relative offset on Y axis.
  11640. @end table
  11641. @section pp
  11642. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11643. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11644. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11645. Each subfilter and some options have a short and a long name that can be used
  11646. interchangeably, i.e. dr/dering are the same.
  11647. The filters accept the following options:
  11648. @table @option
  11649. @item subfilters
  11650. Set postprocessing subfilters string.
  11651. @end table
  11652. All subfilters share common options to determine their scope:
  11653. @table @option
  11654. @item a/autoq
  11655. Honor the quality commands for this subfilter.
  11656. @item c/chrom
  11657. Do chrominance filtering, too (default).
  11658. @item y/nochrom
  11659. Do luminance filtering only (no chrominance).
  11660. @item n/noluma
  11661. Do chrominance filtering only (no luminance).
  11662. @end table
  11663. These options can be appended after the subfilter name, separated by a '|'.
  11664. Available subfilters are:
  11665. @table @option
  11666. @item hb/hdeblock[|difference[|flatness]]
  11667. Horizontal deblocking filter
  11668. @table @option
  11669. @item difference
  11670. Difference factor where higher values mean more deblocking (default: @code{32}).
  11671. @item flatness
  11672. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11673. @end table
  11674. @item vb/vdeblock[|difference[|flatness]]
  11675. Vertical deblocking filter
  11676. @table @option
  11677. @item difference
  11678. Difference factor where higher values mean more deblocking (default: @code{32}).
  11679. @item flatness
  11680. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11681. @end table
  11682. @item ha/hadeblock[|difference[|flatness]]
  11683. Accurate horizontal deblocking filter
  11684. @table @option
  11685. @item difference
  11686. Difference factor where higher values mean more deblocking (default: @code{32}).
  11687. @item flatness
  11688. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11689. @end table
  11690. @item va/vadeblock[|difference[|flatness]]
  11691. Accurate vertical deblocking filter
  11692. @table @option
  11693. @item difference
  11694. Difference factor where higher values mean more deblocking (default: @code{32}).
  11695. @item flatness
  11696. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11697. @end table
  11698. @end table
  11699. The horizontal and vertical deblocking filters share the difference and
  11700. flatness values so you cannot set different horizontal and vertical
  11701. thresholds.
  11702. @table @option
  11703. @item h1/x1hdeblock
  11704. Experimental horizontal deblocking filter
  11705. @item v1/x1vdeblock
  11706. Experimental vertical deblocking filter
  11707. @item dr/dering
  11708. Deringing filter
  11709. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11710. @table @option
  11711. @item threshold1
  11712. larger -> stronger filtering
  11713. @item threshold2
  11714. larger -> stronger filtering
  11715. @item threshold3
  11716. larger -> stronger filtering
  11717. @end table
  11718. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11719. @table @option
  11720. @item f/fullyrange
  11721. Stretch luminance to @code{0-255}.
  11722. @end table
  11723. @item lb/linblenddeint
  11724. Linear blend deinterlacing filter that deinterlaces the given block by
  11725. filtering all lines with a @code{(1 2 1)} filter.
  11726. @item li/linipoldeint
  11727. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11728. linearly interpolating every second line.
  11729. @item ci/cubicipoldeint
  11730. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11731. cubically interpolating every second line.
  11732. @item md/mediandeint
  11733. Median deinterlacing filter that deinterlaces the given block by applying a
  11734. median filter to every second line.
  11735. @item fd/ffmpegdeint
  11736. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11737. second line with a @code{(-1 4 2 4 -1)} filter.
  11738. @item l5/lowpass5
  11739. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11740. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11741. @item fq/forceQuant[|quantizer]
  11742. Overrides the quantizer table from the input with the constant quantizer you
  11743. specify.
  11744. @table @option
  11745. @item quantizer
  11746. Quantizer to use
  11747. @end table
  11748. @item de/default
  11749. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11750. @item fa/fast
  11751. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11752. @item ac
  11753. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11754. @end table
  11755. @subsection Examples
  11756. @itemize
  11757. @item
  11758. Apply horizontal and vertical deblocking, deringing and automatic
  11759. brightness/contrast:
  11760. @example
  11761. pp=hb/vb/dr/al
  11762. @end example
  11763. @item
  11764. Apply default filters without brightness/contrast correction:
  11765. @example
  11766. pp=de/-al
  11767. @end example
  11768. @item
  11769. Apply default filters and temporal denoiser:
  11770. @example
  11771. pp=default/tmpnoise|1|2|3
  11772. @end example
  11773. @item
  11774. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11775. automatically depending on available CPU time:
  11776. @example
  11777. pp=hb|y/vb|a
  11778. @end example
  11779. @end itemize
  11780. @section pp7
  11781. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11782. similar to spp = 6 with 7 point DCT, where only the center sample is
  11783. used after IDCT.
  11784. The filter accepts the following options:
  11785. @table @option
  11786. @item qp
  11787. Force a constant quantization parameter. It accepts an integer in range
  11788. 0 to 63. If not set, the filter will use the QP from the video stream
  11789. (if available).
  11790. @item mode
  11791. Set thresholding mode. Available modes are:
  11792. @table @samp
  11793. @item hard
  11794. Set hard thresholding.
  11795. @item soft
  11796. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11797. @item medium
  11798. Set medium thresholding (good results, default).
  11799. @end table
  11800. @end table
  11801. @section premultiply
  11802. Apply alpha premultiply effect to input video stream using first plane
  11803. of second stream as alpha.
  11804. Both streams must have same dimensions and same pixel format.
  11805. The filter accepts the following option:
  11806. @table @option
  11807. @item planes
  11808. Set which planes will be processed, unprocessed planes will be copied.
  11809. By default value 0xf, all planes will be processed.
  11810. @item inplace
  11811. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11812. @end table
  11813. @section prewitt
  11814. Apply prewitt operator to input video stream.
  11815. The filter accepts the following option:
  11816. @table @option
  11817. @item planes
  11818. Set which planes will be processed, unprocessed planes will be copied.
  11819. By default value 0xf, all planes will be processed.
  11820. @item scale
  11821. Set value which will be multiplied with filtered result.
  11822. @item delta
  11823. Set value which will be added to filtered result.
  11824. @end table
  11825. @section pseudocolor
  11826. Alter frame colors in video with pseudocolors.
  11827. This filter accepts the following options:
  11828. @table @option
  11829. @item c0
  11830. set pixel first component expression
  11831. @item c1
  11832. set pixel second component expression
  11833. @item c2
  11834. set pixel third component expression
  11835. @item c3
  11836. set pixel fourth component expression, corresponds to the alpha component
  11837. @item i
  11838. set component to use as base for altering colors
  11839. @end table
  11840. Each of them specifies the expression to use for computing the lookup table for
  11841. the corresponding pixel component values.
  11842. The expressions can contain the following constants and functions:
  11843. @table @option
  11844. @item w
  11845. @item h
  11846. The input width and height.
  11847. @item val
  11848. The input value for the pixel component.
  11849. @item ymin, umin, vmin, amin
  11850. The minimum allowed component value.
  11851. @item ymax, umax, vmax, amax
  11852. The maximum allowed component value.
  11853. @end table
  11854. All expressions default to "val".
  11855. @subsection Examples
  11856. @itemize
  11857. @item
  11858. Change too high luma values to gradient:
  11859. @example
  11860. 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'"
  11861. @end example
  11862. @end itemize
  11863. @section psnr
  11864. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11865. Ratio) between two input videos.
  11866. This filter takes in input two input videos, the first input is
  11867. considered the "main" source and is passed unchanged to the
  11868. output. The second input is used as a "reference" video for computing
  11869. the PSNR.
  11870. Both video inputs must have the same resolution and pixel format for
  11871. this filter to work correctly. Also it assumes that both inputs
  11872. have the same number of frames, which are compared one by one.
  11873. The obtained average PSNR is printed through the logging system.
  11874. The filter stores the accumulated MSE (mean squared error) of each
  11875. frame, and at the end of the processing it is averaged across all frames
  11876. equally, and the following formula is applied to obtain the PSNR:
  11877. @example
  11878. PSNR = 10*log10(MAX^2/MSE)
  11879. @end example
  11880. Where MAX is the average of the maximum values of each component of the
  11881. image.
  11882. The description of the accepted parameters follows.
  11883. @table @option
  11884. @item stats_file, f
  11885. If specified the filter will use the named file to save the PSNR of
  11886. each individual frame. When filename equals "-" the data is sent to
  11887. standard output.
  11888. @item stats_version
  11889. Specifies which version of the stats file format to use. Details of
  11890. each format are written below.
  11891. Default value is 1.
  11892. @item stats_add_max
  11893. Determines whether the max value is output to the stats log.
  11894. Default value is 0.
  11895. Requires stats_version >= 2. If this is set and stats_version < 2,
  11896. the filter will return an error.
  11897. @end table
  11898. This filter also supports the @ref{framesync} options.
  11899. The file printed if @var{stats_file} is selected, contains a sequence of
  11900. key/value pairs of the form @var{key}:@var{value} for each compared
  11901. couple of frames.
  11902. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11903. the list of per-frame-pair stats, with key value pairs following the frame
  11904. format with the following parameters:
  11905. @table @option
  11906. @item psnr_log_version
  11907. The version of the log file format. Will match @var{stats_version}.
  11908. @item fields
  11909. A comma separated list of the per-frame-pair parameters included in
  11910. the log.
  11911. @end table
  11912. A description of each shown per-frame-pair parameter follows:
  11913. @table @option
  11914. @item n
  11915. sequential number of the input frame, starting from 1
  11916. @item mse_avg
  11917. Mean Square Error pixel-by-pixel average difference of the compared
  11918. frames, averaged over all the image components.
  11919. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11920. Mean Square Error pixel-by-pixel average difference of the compared
  11921. frames for the component specified by the suffix.
  11922. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11923. Peak Signal to Noise ratio of the compared frames for the component
  11924. specified by the suffix.
  11925. @item max_avg, max_y, max_u, max_v
  11926. Maximum allowed value for each channel, and average over all
  11927. channels.
  11928. @end table
  11929. @subsection Examples
  11930. @itemize
  11931. @item
  11932. For example:
  11933. @example
  11934. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11935. [main][ref] psnr="stats_file=stats.log" [out]
  11936. @end example
  11937. On this example the input file being processed is compared with the
  11938. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11939. is stored in @file{stats.log}.
  11940. @item
  11941. Another example with different containers:
  11942. @example
  11943. 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 -
  11944. @end example
  11945. @end itemize
  11946. @anchor{pullup}
  11947. @section pullup
  11948. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11949. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11950. content.
  11951. The pullup filter is designed to take advantage of future context in making
  11952. its decisions. This filter is stateless in the sense that it does not lock
  11953. onto a pattern to follow, but it instead looks forward to the following
  11954. fields in order to identify matches and rebuild progressive frames.
  11955. To produce content with an even framerate, insert the fps filter after
  11956. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11957. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11958. The filter accepts the following options:
  11959. @table @option
  11960. @item jl
  11961. @item jr
  11962. @item jt
  11963. @item jb
  11964. These options set the amount of "junk" to ignore at the left, right, top, and
  11965. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11966. while top and bottom are in units of 2 lines.
  11967. The default is 8 pixels on each side.
  11968. @item sb
  11969. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11970. filter generating an occasional mismatched frame, but it may also cause an
  11971. excessive number of frames to be dropped during high motion sequences.
  11972. Conversely, setting it to -1 will make filter match fields more easily.
  11973. This may help processing of video where there is slight blurring between
  11974. the fields, but may also cause there to be interlaced frames in the output.
  11975. Default value is @code{0}.
  11976. @item mp
  11977. Set the metric plane to use. It accepts the following values:
  11978. @table @samp
  11979. @item l
  11980. Use luma plane.
  11981. @item u
  11982. Use chroma blue plane.
  11983. @item v
  11984. Use chroma red plane.
  11985. @end table
  11986. This option may be set to use chroma plane instead of the default luma plane
  11987. for doing filter's computations. This may improve accuracy on very clean
  11988. source material, but more likely will decrease accuracy, especially if there
  11989. is chroma noise (rainbow effect) or any grayscale video.
  11990. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11991. load and make pullup usable in realtime on slow machines.
  11992. @end table
  11993. For best results (without duplicated frames in the output file) it is
  11994. necessary to change the output frame rate. For example, to inverse
  11995. telecine NTSC input:
  11996. @example
  11997. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11998. @end example
  11999. @section qp
  12000. Change video quantization parameters (QP).
  12001. The filter accepts the following option:
  12002. @table @option
  12003. @item qp
  12004. Set expression for quantization parameter.
  12005. @end table
  12006. The expression is evaluated through the eval API and can contain, among others,
  12007. the following constants:
  12008. @table @var
  12009. @item known
  12010. 1 if index is not 129, 0 otherwise.
  12011. @item qp
  12012. Sequential index starting from -129 to 128.
  12013. @end table
  12014. @subsection Examples
  12015. @itemize
  12016. @item
  12017. Some equation like:
  12018. @example
  12019. qp=2+2*sin(PI*qp)
  12020. @end example
  12021. @end itemize
  12022. @section random
  12023. Flush video frames from internal cache of frames into a random order.
  12024. No frame is discarded.
  12025. Inspired by @ref{frei0r} nervous filter.
  12026. @table @option
  12027. @item frames
  12028. Set size in number of frames of internal cache, in range from @code{2} to
  12029. @code{512}. Default is @code{30}.
  12030. @item seed
  12031. Set seed for random number generator, must be an integer included between
  12032. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12033. less than @code{0}, the filter will try to use a good random seed on a
  12034. best effort basis.
  12035. @end table
  12036. @section readeia608
  12037. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12038. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12039. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12040. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12041. @table @option
  12042. @item lavfi.readeia608.X.cc
  12043. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12044. @item lavfi.readeia608.X.line
  12045. The number of the line on which the EIA-608 data was identified and read.
  12046. @end table
  12047. This filter accepts the following options:
  12048. @table @option
  12049. @item scan_min
  12050. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12051. @item scan_max
  12052. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12053. @item spw
  12054. Set the ratio of width reserved for sync code detection.
  12055. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12056. @item chp
  12057. Enable checking the parity bit. In the event of a parity error, the filter will output
  12058. @code{0x00} for that character. Default is false.
  12059. @item lp
  12060. Lowpass lines prior to further processing. Default is enabled.
  12061. @end table
  12062. @subsection Examples
  12063. @itemize
  12064. @item
  12065. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12066. @example
  12067. 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
  12068. @end example
  12069. @end itemize
  12070. @section readvitc
  12071. Read vertical interval timecode (VITC) information from the top lines of a
  12072. video frame.
  12073. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12074. timecode value, if a valid timecode has been detected. Further metadata key
  12075. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12076. timecode data has been found or not.
  12077. This filter accepts the following options:
  12078. @table @option
  12079. @item scan_max
  12080. Set the maximum number of lines to scan for VITC data. If the value is set to
  12081. @code{-1} the full video frame is scanned. Default is @code{45}.
  12082. @item thr_b
  12083. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12084. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12085. @item thr_w
  12086. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12087. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12088. @end table
  12089. @subsection Examples
  12090. @itemize
  12091. @item
  12092. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12093. draw @code{--:--:--:--} as a placeholder:
  12094. @example
  12095. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12096. @end example
  12097. @end itemize
  12098. @section remap
  12099. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12100. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12101. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12102. value for pixel will be used for destination pixel.
  12103. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12104. will have Xmap/Ymap video stream dimensions.
  12105. Xmap and Ymap input video streams are 16bit depth, single channel.
  12106. @table @option
  12107. @item format
  12108. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12109. Default is @code{color}.
  12110. @item fill
  12111. Specify the color of the unmapped pixels. For the syntax of this option,
  12112. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12113. manual,ffmpeg-utils}. Default color is @code{black}.
  12114. @end table
  12115. @section removegrain
  12116. The removegrain filter is a spatial denoiser for progressive video.
  12117. @table @option
  12118. @item m0
  12119. Set mode for the first plane.
  12120. @item m1
  12121. Set mode for the second plane.
  12122. @item m2
  12123. Set mode for the third plane.
  12124. @item m3
  12125. Set mode for the fourth plane.
  12126. @end table
  12127. Range of mode is from 0 to 24. Description of each mode follows:
  12128. @table @var
  12129. @item 0
  12130. Leave input plane unchanged. Default.
  12131. @item 1
  12132. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12133. @item 2
  12134. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12135. @item 3
  12136. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12137. @item 4
  12138. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12139. This is equivalent to a median filter.
  12140. @item 5
  12141. Line-sensitive clipping giving the minimal change.
  12142. @item 6
  12143. Line-sensitive clipping, intermediate.
  12144. @item 7
  12145. Line-sensitive clipping, intermediate.
  12146. @item 8
  12147. Line-sensitive clipping, intermediate.
  12148. @item 9
  12149. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12150. @item 10
  12151. Replaces the target pixel with the closest neighbour.
  12152. @item 11
  12153. [1 2 1] horizontal and vertical kernel blur.
  12154. @item 12
  12155. Same as mode 11.
  12156. @item 13
  12157. Bob mode, interpolates top field from the line where the neighbours
  12158. pixels are the closest.
  12159. @item 14
  12160. Bob mode, interpolates bottom field from the line where the neighbours
  12161. pixels are the closest.
  12162. @item 15
  12163. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12164. interpolation formula.
  12165. @item 16
  12166. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12167. interpolation formula.
  12168. @item 17
  12169. Clips the pixel with the minimum and maximum of respectively the maximum and
  12170. minimum of each pair of opposite neighbour pixels.
  12171. @item 18
  12172. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12173. the current pixel is minimal.
  12174. @item 19
  12175. Replaces the pixel with the average of its 8 neighbours.
  12176. @item 20
  12177. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12178. @item 21
  12179. Clips pixels using the averages of opposite neighbour.
  12180. @item 22
  12181. Same as mode 21 but simpler and faster.
  12182. @item 23
  12183. Small edge and halo removal, but reputed useless.
  12184. @item 24
  12185. Similar as 23.
  12186. @end table
  12187. @section removelogo
  12188. Suppress a TV station logo, using an image file to determine which
  12189. pixels comprise the logo. It works by filling in the pixels that
  12190. comprise the logo with neighboring pixels.
  12191. The filter accepts the following options:
  12192. @table @option
  12193. @item filename, f
  12194. Set the filter bitmap file, which can be any image format supported by
  12195. libavformat. The width and height of the image file must match those of the
  12196. video stream being processed.
  12197. @end table
  12198. Pixels in the provided bitmap image with a value of zero are not
  12199. considered part of the logo, non-zero pixels are considered part of
  12200. the logo. If you use white (255) for the logo and black (0) for the
  12201. rest, you will be safe. For making the filter bitmap, it is
  12202. recommended to take a screen capture of a black frame with the logo
  12203. visible, and then using a threshold filter followed by the erode
  12204. filter once or twice.
  12205. If needed, little splotches can be fixed manually. Remember that if
  12206. logo pixels are not covered, the filter quality will be much
  12207. reduced. Marking too many pixels as part of the logo does not hurt as
  12208. much, but it will increase the amount of blurring needed to cover over
  12209. the image and will destroy more information than necessary, and extra
  12210. pixels will slow things down on a large logo.
  12211. @section repeatfields
  12212. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12213. fields based on its value.
  12214. @section reverse
  12215. Reverse a video clip.
  12216. Warning: This filter requires memory to buffer the entire clip, so trimming
  12217. is suggested.
  12218. @subsection Examples
  12219. @itemize
  12220. @item
  12221. Take the first 5 seconds of a clip, and reverse it.
  12222. @example
  12223. trim=end=5,reverse
  12224. @end example
  12225. @end itemize
  12226. @section rgbashift
  12227. Shift R/G/B/A pixels horizontally and/or vertically.
  12228. The filter accepts the following options:
  12229. @table @option
  12230. @item rh
  12231. Set amount to shift red horizontally.
  12232. @item rv
  12233. Set amount to shift red vertically.
  12234. @item gh
  12235. Set amount to shift green horizontally.
  12236. @item gv
  12237. Set amount to shift green vertically.
  12238. @item bh
  12239. Set amount to shift blue horizontally.
  12240. @item bv
  12241. Set amount to shift blue vertically.
  12242. @item ah
  12243. Set amount to shift alpha horizontally.
  12244. @item av
  12245. Set amount to shift alpha vertically.
  12246. @item edge
  12247. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12248. @end table
  12249. @subsection Commands
  12250. This filter supports the all above options as @ref{commands}.
  12251. @section roberts
  12252. Apply roberts cross operator to input video stream.
  12253. The filter accepts the following option:
  12254. @table @option
  12255. @item planes
  12256. Set which planes will be processed, unprocessed planes will be copied.
  12257. By default value 0xf, all planes will be processed.
  12258. @item scale
  12259. Set value which will be multiplied with filtered result.
  12260. @item delta
  12261. Set value which will be added to filtered result.
  12262. @end table
  12263. @section rotate
  12264. Rotate video by an arbitrary angle expressed in radians.
  12265. The filter accepts the following options:
  12266. A description of the optional parameters follows.
  12267. @table @option
  12268. @item angle, a
  12269. Set an expression for the angle by which to rotate the input video
  12270. clockwise, expressed as a number of radians. A negative value will
  12271. result in a counter-clockwise rotation. By default it is set to "0".
  12272. This expression is evaluated for each frame.
  12273. @item out_w, ow
  12274. Set the output width expression, default value is "iw".
  12275. This expression is evaluated just once during configuration.
  12276. @item out_h, oh
  12277. Set the output height expression, default value is "ih".
  12278. This expression is evaluated just once during configuration.
  12279. @item bilinear
  12280. Enable bilinear interpolation if set to 1, a value of 0 disables
  12281. it. Default value is 1.
  12282. @item fillcolor, c
  12283. Set the color used to fill the output area not covered by the rotated
  12284. image. For the general syntax of this option, check the
  12285. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12286. If the special value "none" is selected then no
  12287. background is printed (useful for example if the background is never shown).
  12288. Default value is "black".
  12289. @end table
  12290. The expressions for the angle and the output size can contain the
  12291. following constants and functions:
  12292. @table @option
  12293. @item n
  12294. sequential number of the input frame, starting from 0. It is always NAN
  12295. before the first frame is filtered.
  12296. @item t
  12297. time in seconds of the input frame, it is set to 0 when the filter is
  12298. configured. It is always NAN before the first frame is filtered.
  12299. @item hsub
  12300. @item vsub
  12301. horizontal and vertical chroma subsample values. For example for the
  12302. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12303. @item in_w, iw
  12304. @item in_h, ih
  12305. the input video width and height
  12306. @item out_w, ow
  12307. @item out_h, oh
  12308. the output width and height, that is the size of the padded area as
  12309. specified by the @var{width} and @var{height} expressions
  12310. @item rotw(a)
  12311. @item roth(a)
  12312. the minimal width/height required for completely containing the input
  12313. video rotated by @var{a} radians.
  12314. These are only available when computing the @option{out_w} and
  12315. @option{out_h} expressions.
  12316. @end table
  12317. @subsection Examples
  12318. @itemize
  12319. @item
  12320. Rotate the input by PI/6 radians clockwise:
  12321. @example
  12322. rotate=PI/6
  12323. @end example
  12324. @item
  12325. Rotate the input by PI/6 radians counter-clockwise:
  12326. @example
  12327. rotate=-PI/6
  12328. @end example
  12329. @item
  12330. Rotate the input by 45 degrees clockwise:
  12331. @example
  12332. rotate=45*PI/180
  12333. @end example
  12334. @item
  12335. Apply a constant rotation with period T, starting from an angle of PI/3:
  12336. @example
  12337. rotate=PI/3+2*PI*t/T
  12338. @end example
  12339. @item
  12340. Make the input video rotation oscillating with a period of T
  12341. seconds and an amplitude of A radians:
  12342. @example
  12343. rotate=A*sin(2*PI/T*t)
  12344. @end example
  12345. @item
  12346. Rotate the video, output size is chosen so that the whole rotating
  12347. input video is always completely contained in the output:
  12348. @example
  12349. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12350. @end example
  12351. @item
  12352. Rotate the video, reduce the output size so that no background is ever
  12353. shown:
  12354. @example
  12355. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12356. @end example
  12357. @end itemize
  12358. @subsection Commands
  12359. The filter supports the following commands:
  12360. @table @option
  12361. @item a, angle
  12362. Set the angle expression.
  12363. The command accepts the same syntax of the corresponding option.
  12364. If the specified expression is not valid, it is kept at its current
  12365. value.
  12366. @end table
  12367. @section sab
  12368. Apply Shape Adaptive Blur.
  12369. The filter accepts the following options:
  12370. @table @option
  12371. @item luma_radius, lr
  12372. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12373. value is 1.0. A greater value will result in a more blurred image, and
  12374. in slower processing.
  12375. @item luma_pre_filter_radius, lpfr
  12376. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12377. value is 1.0.
  12378. @item luma_strength, ls
  12379. Set luma maximum difference between pixels to still be considered, must
  12380. be a value in the 0.1-100.0 range, default value is 1.0.
  12381. @item chroma_radius, cr
  12382. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12383. greater value will result in a more blurred image, and in slower
  12384. processing.
  12385. @item chroma_pre_filter_radius, cpfr
  12386. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12387. @item chroma_strength, cs
  12388. Set chroma maximum difference between pixels to still be considered,
  12389. must be a value in the -0.9-100.0 range.
  12390. @end table
  12391. Each chroma option value, if not explicitly specified, is set to the
  12392. corresponding luma option value.
  12393. @anchor{scale}
  12394. @section scale
  12395. Scale (resize) the input video, using the libswscale library.
  12396. The scale filter forces the output display aspect ratio to be the same
  12397. of the input, by changing the output sample aspect ratio.
  12398. If the input image format is different from the format requested by
  12399. the next filter, the scale filter will convert the input to the
  12400. requested format.
  12401. @subsection Options
  12402. The filter accepts the following options, or any of the options
  12403. supported by the libswscale scaler.
  12404. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12405. the complete list of scaler options.
  12406. @table @option
  12407. @item width, w
  12408. @item height, h
  12409. Set the output video dimension expression. Default value is the input
  12410. dimension.
  12411. If the @var{width} or @var{w} value is 0, the input width is used for
  12412. the output. If the @var{height} or @var{h} value is 0, the input height
  12413. is used for the output.
  12414. If one and only one of the values is -n with n >= 1, the scale filter
  12415. will use a value that maintains the aspect ratio of the input image,
  12416. calculated from the other specified dimension. After that it will,
  12417. however, make sure that the calculated dimension is divisible by n and
  12418. adjust the value if necessary.
  12419. If both values are -n with n >= 1, the behavior will be identical to
  12420. both values being set to 0 as previously detailed.
  12421. See below for the list of accepted constants for use in the dimension
  12422. expression.
  12423. @item eval
  12424. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12425. @table @samp
  12426. @item init
  12427. Only evaluate expressions once during the filter initialization or when a command is processed.
  12428. @item frame
  12429. Evaluate expressions for each incoming frame.
  12430. @end table
  12431. Default value is @samp{init}.
  12432. @item interl
  12433. Set the interlacing mode. It accepts the following values:
  12434. @table @samp
  12435. @item 1
  12436. Force interlaced aware scaling.
  12437. @item 0
  12438. Do not apply interlaced scaling.
  12439. @item -1
  12440. Select interlaced aware scaling depending on whether the source frames
  12441. are flagged as interlaced or not.
  12442. @end table
  12443. Default value is @samp{0}.
  12444. @item flags
  12445. Set libswscale scaling flags. See
  12446. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12447. complete list of values. If not explicitly specified the filter applies
  12448. the default flags.
  12449. @item param0, param1
  12450. Set libswscale input parameters for scaling algorithms that need them. See
  12451. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12452. complete documentation. If not explicitly specified the filter applies
  12453. empty parameters.
  12454. @item size, s
  12455. Set the video size. For the syntax of this option, check the
  12456. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12457. @item in_color_matrix
  12458. @item out_color_matrix
  12459. Set in/output YCbCr color space type.
  12460. This allows the autodetected value to be overridden as well as allows forcing
  12461. a specific value used for the output and encoder.
  12462. If not specified, the color space type depends on the pixel format.
  12463. Possible values:
  12464. @table @samp
  12465. @item auto
  12466. Choose automatically.
  12467. @item bt709
  12468. Format conforming to International Telecommunication Union (ITU)
  12469. Recommendation BT.709.
  12470. @item fcc
  12471. Set color space conforming to the United States Federal Communications
  12472. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12473. @item bt601
  12474. @item bt470
  12475. @item smpte170m
  12476. Set color space conforming to:
  12477. @itemize
  12478. @item
  12479. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12480. @item
  12481. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12482. @item
  12483. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12484. @end itemize
  12485. @item smpte240m
  12486. Set color space conforming to SMPTE ST 240:1999.
  12487. @item bt2020
  12488. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12489. @end table
  12490. @item in_range
  12491. @item out_range
  12492. Set in/output YCbCr sample range.
  12493. This allows the autodetected value to be overridden as well as allows forcing
  12494. a specific value used for the output and encoder. If not specified, the
  12495. range depends on the pixel format. Possible values:
  12496. @table @samp
  12497. @item auto/unknown
  12498. Choose automatically.
  12499. @item jpeg/full/pc
  12500. Set full range (0-255 in case of 8-bit luma).
  12501. @item mpeg/limited/tv
  12502. Set "MPEG" range (16-235 in case of 8-bit luma).
  12503. @end table
  12504. @item force_original_aspect_ratio
  12505. Enable decreasing or increasing output video width or height if necessary to
  12506. keep the original aspect ratio. Possible values:
  12507. @table @samp
  12508. @item disable
  12509. Scale the video as specified and disable this feature.
  12510. @item decrease
  12511. The output video dimensions will automatically be decreased if needed.
  12512. @item increase
  12513. The output video dimensions will automatically be increased if needed.
  12514. @end table
  12515. One useful instance of this option is that when you know a specific device's
  12516. maximum allowed resolution, you can use this to limit the output video to
  12517. that, while retaining the aspect ratio. For example, device A allows
  12518. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12519. decrease) and specifying 1280x720 to the command line makes the output
  12520. 1280x533.
  12521. Please note that this is a different thing than specifying -1 for @option{w}
  12522. or @option{h}, you still need to specify the output resolution for this option
  12523. to work.
  12524. @item force_divisible_by
  12525. Ensures that both the output dimensions, width and height, are divisible by the
  12526. given integer when used together with @option{force_original_aspect_ratio}. This
  12527. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12528. This option respects the value set for @option{force_original_aspect_ratio},
  12529. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12530. may be slightly modified.
  12531. This option can be handy if you need to have a video fit within or exceed
  12532. a defined resolution using @option{force_original_aspect_ratio} but also have
  12533. encoder restrictions on width or height divisibility.
  12534. @end table
  12535. The values of the @option{w} and @option{h} options are expressions
  12536. containing the following constants:
  12537. @table @var
  12538. @item in_w
  12539. @item in_h
  12540. The input width and height
  12541. @item iw
  12542. @item ih
  12543. These are the same as @var{in_w} and @var{in_h}.
  12544. @item out_w
  12545. @item out_h
  12546. The output (scaled) width and height
  12547. @item ow
  12548. @item oh
  12549. These are the same as @var{out_w} and @var{out_h}
  12550. @item a
  12551. The same as @var{iw} / @var{ih}
  12552. @item sar
  12553. input sample aspect ratio
  12554. @item dar
  12555. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12556. @item hsub
  12557. @item vsub
  12558. horizontal and vertical input chroma subsample values. For example for the
  12559. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12560. @item ohsub
  12561. @item ovsub
  12562. horizontal and vertical output chroma subsample values. For example for the
  12563. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12564. @item n
  12565. The (sequential) number of the input frame, starting from 0.
  12566. Only available with @code{eval=frame}.
  12567. @item t
  12568. The presentation timestamp of the input frame, expressed as a number of
  12569. seconds. Only available with @code{eval=frame}.
  12570. @item pos
  12571. The position (byte offset) of the frame in the input stream, or NaN if
  12572. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12573. Only available with @code{eval=frame}.
  12574. @end table
  12575. @subsection Examples
  12576. @itemize
  12577. @item
  12578. Scale the input video to a size of 200x100
  12579. @example
  12580. scale=w=200:h=100
  12581. @end example
  12582. This is equivalent to:
  12583. @example
  12584. scale=200:100
  12585. @end example
  12586. or:
  12587. @example
  12588. scale=200x100
  12589. @end example
  12590. @item
  12591. Specify a size abbreviation for the output size:
  12592. @example
  12593. scale=qcif
  12594. @end example
  12595. which can also be written as:
  12596. @example
  12597. scale=size=qcif
  12598. @end example
  12599. @item
  12600. Scale the input to 2x:
  12601. @example
  12602. scale=w=2*iw:h=2*ih
  12603. @end example
  12604. @item
  12605. The above is the same as:
  12606. @example
  12607. scale=2*in_w:2*in_h
  12608. @end example
  12609. @item
  12610. Scale the input to 2x with forced interlaced scaling:
  12611. @example
  12612. scale=2*iw:2*ih:interl=1
  12613. @end example
  12614. @item
  12615. Scale the input to half size:
  12616. @example
  12617. scale=w=iw/2:h=ih/2
  12618. @end example
  12619. @item
  12620. Increase the width, and set the height to the same size:
  12621. @example
  12622. scale=3/2*iw:ow
  12623. @end example
  12624. @item
  12625. Seek Greek harmony:
  12626. @example
  12627. scale=iw:1/PHI*iw
  12628. scale=ih*PHI:ih
  12629. @end example
  12630. @item
  12631. Increase the height, and set the width to 3/2 of the height:
  12632. @example
  12633. scale=w=3/2*oh:h=3/5*ih
  12634. @end example
  12635. @item
  12636. Increase the size, making the size a multiple of the chroma
  12637. subsample values:
  12638. @example
  12639. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12640. @end example
  12641. @item
  12642. Increase the width to a maximum of 500 pixels,
  12643. keeping the same aspect ratio as the input:
  12644. @example
  12645. scale=w='min(500\, iw*3/2):h=-1'
  12646. @end example
  12647. @item
  12648. Make pixels square by combining scale and setsar:
  12649. @example
  12650. scale='trunc(ih*dar):ih',setsar=1/1
  12651. @end example
  12652. @item
  12653. Make pixels square by combining scale and setsar,
  12654. making sure the resulting resolution is even (required by some codecs):
  12655. @example
  12656. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12657. @end example
  12658. @end itemize
  12659. @subsection Commands
  12660. This filter supports the following commands:
  12661. @table @option
  12662. @item width, w
  12663. @item height, h
  12664. Set the output video dimension expression.
  12665. The command accepts the same syntax of the corresponding option.
  12666. If the specified expression is not valid, it is kept at its current
  12667. value.
  12668. @end table
  12669. @section scale_npp
  12670. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12671. format conversion on CUDA video frames. Setting the output width and height
  12672. works in the same way as for the @var{scale} filter.
  12673. The following additional options are accepted:
  12674. @table @option
  12675. @item format
  12676. The pixel format of the output CUDA frames. If set to the string "same" (the
  12677. default), the input format will be kept. Note that automatic format negotiation
  12678. and conversion is not yet supported for hardware frames
  12679. @item interp_algo
  12680. The interpolation algorithm used for resizing. One of the following:
  12681. @table @option
  12682. @item nn
  12683. Nearest neighbour.
  12684. @item linear
  12685. @item cubic
  12686. @item cubic2p_bspline
  12687. 2-parameter cubic (B=1, C=0)
  12688. @item cubic2p_catmullrom
  12689. 2-parameter cubic (B=0, C=1/2)
  12690. @item cubic2p_b05c03
  12691. 2-parameter cubic (B=1/2, C=3/10)
  12692. @item super
  12693. Supersampling
  12694. @item lanczos
  12695. @end table
  12696. @item force_original_aspect_ratio
  12697. Enable decreasing or increasing output video width or height if necessary to
  12698. keep the original aspect ratio. Possible values:
  12699. @table @samp
  12700. @item disable
  12701. Scale the video as specified and disable this feature.
  12702. @item decrease
  12703. The output video dimensions will automatically be decreased if needed.
  12704. @item increase
  12705. The output video dimensions will automatically be increased if needed.
  12706. @end table
  12707. One useful instance of this option is that when you know a specific device's
  12708. maximum allowed resolution, you can use this to limit the output video to
  12709. that, while retaining the aspect ratio. For example, device A allows
  12710. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12711. decrease) and specifying 1280x720 to the command line makes the output
  12712. 1280x533.
  12713. Please note that this is a different thing than specifying -1 for @option{w}
  12714. or @option{h}, you still need to specify the output resolution for this option
  12715. to work.
  12716. @item force_divisible_by
  12717. Ensures that both the output dimensions, width and height, are divisible by the
  12718. given integer when used together with @option{force_original_aspect_ratio}. This
  12719. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12720. This option respects the value set for @option{force_original_aspect_ratio},
  12721. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12722. may be slightly modified.
  12723. This option can be handy if you need to have a video fit within or exceed
  12724. a defined resolution using @option{force_original_aspect_ratio} but also have
  12725. encoder restrictions on width or height divisibility.
  12726. @end table
  12727. @section scale2ref
  12728. Scale (resize) the input video, based on a reference video.
  12729. See the scale filter for available options, scale2ref supports the same but
  12730. uses the reference video instead of the main input as basis. scale2ref also
  12731. supports the following additional constants for the @option{w} and
  12732. @option{h} options:
  12733. @table @var
  12734. @item main_w
  12735. @item main_h
  12736. The main input video's width and height
  12737. @item main_a
  12738. The same as @var{main_w} / @var{main_h}
  12739. @item main_sar
  12740. The main input video's sample aspect ratio
  12741. @item main_dar, mdar
  12742. The main input video's display aspect ratio. Calculated from
  12743. @code{(main_w / main_h) * main_sar}.
  12744. @item main_hsub
  12745. @item main_vsub
  12746. The main input video's horizontal and vertical chroma subsample values.
  12747. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12748. is 1.
  12749. @item main_n
  12750. The (sequential) number of the main input frame, starting from 0.
  12751. Only available with @code{eval=frame}.
  12752. @item main_t
  12753. The presentation timestamp of the main input frame, expressed as a number of
  12754. seconds. Only available with @code{eval=frame}.
  12755. @item main_pos
  12756. The position (byte offset) of the frame in the main input stream, or NaN if
  12757. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12758. Only available with @code{eval=frame}.
  12759. @end table
  12760. @subsection Examples
  12761. @itemize
  12762. @item
  12763. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12764. @example
  12765. 'scale2ref[b][a];[a][b]overlay'
  12766. @end example
  12767. @item
  12768. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12769. @example
  12770. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12771. @end example
  12772. @end itemize
  12773. @subsection Commands
  12774. This filter supports the following commands:
  12775. @table @option
  12776. @item width, w
  12777. @item height, h
  12778. Set the output video dimension expression.
  12779. The command accepts the same syntax of the corresponding option.
  12780. If the specified expression is not valid, it is kept at its current
  12781. value.
  12782. @end table
  12783. @section scroll
  12784. Scroll input video horizontally and/or vertically by constant speed.
  12785. The filter accepts the following options:
  12786. @table @option
  12787. @item horizontal, h
  12788. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12789. Negative values changes scrolling direction.
  12790. @item vertical, v
  12791. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12792. Negative values changes scrolling direction.
  12793. @item hpos
  12794. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12795. @item vpos
  12796. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12797. @end table
  12798. @subsection Commands
  12799. This filter supports the following @ref{commands}:
  12800. @table @option
  12801. @item horizontal, h
  12802. Set the horizontal scrolling speed.
  12803. @item vertical, v
  12804. Set the vertical scrolling speed.
  12805. @end table
  12806. @anchor{scdet}
  12807. @section scdet
  12808. Detect video scene change.
  12809. This filter sets frame metadata with mafd between frame, the scene score, and
  12810. forward the frame to the next filter, so they can use these metadata to detect
  12811. scene change or others.
  12812. In addition, this filter logs a message and sets frame metadata when it detects
  12813. a scene change by @option{threshold}.
  12814. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12815. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12816. to detect scene change.
  12817. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12818. detect scene change with @option{threshold}.
  12819. The filter accepts the following options:
  12820. @table @option
  12821. @item threshold, t
  12822. Set the scene change detection threshold as a percentage of maximum change. Good
  12823. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12824. @code{[0., 100.]}.
  12825. Default value is @code{10.}.
  12826. @item sc_pass, s
  12827. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12828. You can enable it if you want to get snapshot of scene change frames only.
  12829. @end table
  12830. @anchor{selectivecolor}
  12831. @section selectivecolor
  12832. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12833. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12834. by the "purity" of the color (that is, how saturated it already is).
  12835. This filter is similar to the Adobe Photoshop Selective Color tool.
  12836. The filter accepts the following options:
  12837. @table @option
  12838. @item correction_method
  12839. Select color correction method.
  12840. Available values are:
  12841. @table @samp
  12842. @item absolute
  12843. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12844. component value).
  12845. @item relative
  12846. Specified adjustments are relative to the original component value.
  12847. @end table
  12848. Default is @code{absolute}.
  12849. @item reds
  12850. Adjustments for red pixels (pixels where the red component is the maximum)
  12851. @item yellows
  12852. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12853. @item greens
  12854. Adjustments for green pixels (pixels where the green component is the maximum)
  12855. @item cyans
  12856. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12857. @item blues
  12858. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12859. @item magentas
  12860. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12861. @item whites
  12862. Adjustments for white pixels (pixels where all components are greater than 128)
  12863. @item neutrals
  12864. Adjustments for all pixels except pure black and pure white
  12865. @item blacks
  12866. Adjustments for black pixels (pixels where all components are lesser than 128)
  12867. @item psfile
  12868. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12869. @end table
  12870. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12871. 4 space separated floating point adjustment values in the [-1,1] range,
  12872. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12873. pixels of its range.
  12874. @subsection Examples
  12875. @itemize
  12876. @item
  12877. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12878. increase magenta by 27% in blue areas:
  12879. @example
  12880. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12881. @end example
  12882. @item
  12883. Use a Photoshop selective color preset:
  12884. @example
  12885. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12886. @end example
  12887. @end itemize
  12888. @anchor{separatefields}
  12889. @section separatefields
  12890. The @code{separatefields} takes a frame-based video input and splits
  12891. each frame into its components fields, producing a new half height clip
  12892. with twice the frame rate and twice the frame count.
  12893. This filter use field-dominance information in frame to decide which
  12894. of each pair of fields to place first in the output.
  12895. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12896. @section setdar, setsar
  12897. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12898. output video.
  12899. This is done by changing the specified Sample (aka Pixel) Aspect
  12900. Ratio, according to the following equation:
  12901. @example
  12902. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12903. @end example
  12904. Keep in mind that the @code{setdar} filter does not modify the pixel
  12905. dimensions of the video frame. Also, the display aspect ratio set by
  12906. this filter may be changed by later filters in the filterchain,
  12907. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12908. applied.
  12909. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12910. the filter output video.
  12911. Note that as a consequence of the application of this filter, the
  12912. output display aspect ratio will change according to the equation
  12913. above.
  12914. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12915. filter may be changed by later filters in the filterchain, e.g. if
  12916. another "setsar" or a "setdar" filter is applied.
  12917. It accepts the following parameters:
  12918. @table @option
  12919. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12920. Set the aspect ratio used by the filter.
  12921. The parameter can be a floating point number string, an expression, or
  12922. a string of the form @var{num}:@var{den}, where @var{num} and
  12923. @var{den} are the numerator and denominator of the aspect ratio. If
  12924. the parameter is not specified, it is assumed the value "0".
  12925. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12926. should be escaped.
  12927. @item max
  12928. Set the maximum integer value to use for expressing numerator and
  12929. denominator when reducing the expressed aspect ratio to a rational.
  12930. Default value is @code{100}.
  12931. @end table
  12932. The parameter @var{sar} is an expression containing
  12933. the following constants:
  12934. @table @option
  12935. @item E, PI, PHI
  12936. These are approximated values for the mathematical constants e
  12937. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12938. @item w, h
  12939. The input width and height.
  12940. @item a
  12941. These are the same as @var{w} / @var{h}.
  12942. @item sar
  12943. The input sample aspect ratio.
  12944. @item dar
  12945. The input display aspect ratio. It is the same as
  12946. (@var{w} / @var{h}) * @var{sar}.
  12947. @item hsub, vsub
  12948. Horizontal and vertical chroma subsample values. For example, for the
  12949. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12950. @end table
  12951. @subsection Examples
  12952. @itemize
  12953. @item
  12954. To change the display aspect ratio to 16:9, specify one of the following:
  12955. @example
  12956. setdar=dar=1.77777
  12957. setdar=dar=16/9
  12958. @end example
  12959. @item
  12960. To change the sample aspect ratio to 10:11, specify:
  12961. @example
  12962. setsar=sar=10/11
  12963. @end example
  12964. @item
  12965. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12966. 1000 in the aspect ratio reduction, use the command:
  12967. @example
  12968. setdar=ratio=16/9:max=1000
  12969. @end example
  12970. @end itemize
  12971. @anchor{setfield}
  12972. @section setfield
  12973. Force field for the output video frame.
  12974. The @code{setfield} filter marks the interlace type field for the
  12975. output frames. It does not change the input frame, but only sets the
  12976. corresponding property, which affects how the frame is treated by
  12977. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12978. The filter accepts the following options:
  12979. @table @option
  12980. @item mode
  12981. Available values are:
  12982. @table @samp
  12983. @item auto
  12984. Keep the same field property.
  12985. @item bff
  12986. Mark the frame as bottom-field-first.
  12987. @item tff
  12988. Mark the frame as top-field-first.
  12989. @item prog
  12990. Mark the frame as progressive.
  12991. @end table
  12992. @end table
  12993. @anchor{setparams}
  12994. @section setparams
  12995. Force frame parameter for the output video frame.
  12996. The @code{setparams} filter marks interlace and color range for the
  12997. output frames. It does not change the input frame, but only sets the
  12998. corresponding property, which affects how the frame is treated by
  12999. filters/encoders.
  13000. @table @option
  13001. @item field_mode
  13002. Available values are:
  13003. @table @samp
  13004. @item auto
  13005. Keep the same field property (default).
  13006. @item bff
  13007. Mark the frame as bottom-field-first.
  13008. @item tff
  13009. Mark the frame as top-field-first.
  13010. @item prog
  13011. Mark the frame as progressive.
  13012. @end table
  13013. @item range
  13014. Available values are:
  13015. @table @samp
  13016. @item auto
  13017. Keep the same color range property (default).
  13018. @item unspecified, unknown
  13019. Mark the frame as unspecified color range.
  13020. @item limited, tv, mpeg
  13021. Mark the frame as limited range.
  13022. @item full, pc, jpeg
  13023. Mark the frame as full range.
  13024. @end table
  13025. @item color_primaries
  13026. Set the color primaries.
  13027. Available values are:
  13028. @table @samp
  13029. @item auto
  13030. Keep the same color primaries property (default).
  13031. @item bt709
  13032. @item unknown
  13033. @item bt470m
  13034. @item bt470bg
  13035. @item smpte170m
  13036. @item smpte240m
  13037. @item film
  13038. @item bt2020
  13039. @item smpte428
  13040. @item smpte431
  13041. @item smpte432
  13042. @item jedec-p22
  13043. @end table
  13044. @item color_trc
  13045. Set the color transfer.
  13046. Available values are:
  13047. @table @samp
  13048. @item auto
  13049. Keep the same color trc property (default).
  13050. @item bt709
  13051. @item unknown
  13052. @item bt470m
  13053. @item bt470bg
  13054. @item smpte170m
  13055. @item smpte240m
  13056. @item linear
  13057. @item log100
  13058. @item log316
  13059. @item iec61966-2-4
  13060. @item bt1361e
  13061. @item iec61966-2-1
  13062. @item bt2020-10
  13063. @item bt2020-12
  13064. @item smpte2084
  13065. @item smpte428
  13066. @item arib-std-b67
  13067. @end table
  13068. @item colorspace
  13069. Set the colorspace.
  13070. Available values are:
  13071. @table @samp
  13072. @item auto
  13073. Keep the same colorspace property (default).
  13074. @item gbr
  13075. @item bt709
  13076. @item unknown
  13077. @item fcc
  13078. @item bt470bg
  13079. @item smpte170m
  13080. @item smpte240m
  13081. @item ycgco
  13082. @item bt2020nc
  13083. @item bt2020c
  13084. @item smpte2085
  13085. @item chroma-derived-nc
  13086. @item chroma-derived-c
  13087. @item ictcp
  13088. @end table
  13089. @end table
  13090. @section showinfo
  13091. Show a line containing various information for each input video frame.
  13092. The input video is not modified.
  13093. This filter supports the following options:
  13094. @table @option
  13095. @item checksum
  13096. Calculate checksums of each plane. By default enabled.
  13097. @end table
  13098. The shown line contains a sequence of key/value pairs of the form
  13099. @var{key}:@var{value}.
  13100. The following values are shown in the output:
  13101. @table @option
  13102. @item n
  13103. The (sequential) number of the input frame, starting from 0.
  13104. @item pts
  13105. The Presentation TimeStamp of the input frame, expressed as a number of
  13106. time base units. The time base unit depends on the filter input pad.
  13107. @item pts_time
  13108. The Presentation TimeStamp of the input frame, expressed as a number of
  13109. seconds.
  13110. @item pos
  13111. The position of the frame in the input stream, or -1 if this information is
  13112. unavailable and/or meaningless (for example in case of synthetic video).
  13113. @item fmt
  13114. The pixel format name.
  13115. @item sar
  13116. The sample aspect ratio of the input frame, expressed in the form
  13117. @var{num}/@var{den}.
  13118. @item s
  13119. The size of the input frame. For the syntax of this option, check the
  13120. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13121. @item i
  13122. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13123. for bottom field first).
  13124. @item iskey
  13125. This is 1 if the frame is a key frame, 0 otherwise.
  13126. @item type
  13127. The picture type of the input frame ("I" for an I-frame, "P" for a
  13128. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13129. Also refer to the documentation of the @code{AVPictureType} enum and of
  13130. the @code{av_get_picture_type_char} function defined in
  13131. @file{libavutil/avutil.h}.
  13132. @item checksum
  13133. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13134. @item plane_checksum
  13135. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13136. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13137. @item mean
  13138. The mean value of pixels in each plane of the input frame, expressed in the form
  13139. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13140. @item stdev
  13141. The standard deviation of pixel values in each plane of the input frame, expressed
  13142. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13143. @end table
  13144. @section showpalette
  13145. Displays the 256 colors palette of each frame. This filter is only relevant for
  13146. @var{pal8} pixel format frames.
  13147. It accepts the following option:
  13148. @table @option
  13149. @item s
  13150. Set the size of the box used to represent one palette color entry. Default is
  13151. @code{30} (for a @code{30x30} pixel box).
  13152. @end table
  13153. @section shuffleframes
  13154. Reorder and/or duplicate and/or drop video frames.
  13155. It accepts the following parameters:
  13156. @table @option
  13157. @item mapping
  13158. Set the destination indexes of input frames.
  13159. This is space or '|' separated list of indexes that maps input frames to output
  13160. frames. Number of indexes also sets maximal value that each index may have.
  13161. '-1' index have special meaning and that is to drop frame.
  13162. @end table
  13163. The first frame has the index 0. The default is to keep the input unchanged.
  13164. @subsection Examples
  13165. @itemize
  13166. @item
  13167. Swap second and third frame of every three frames of the input:
  13168. @example
  13169. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13170. @end example
  13171. @item
  13172. Swap 10th and 1st frame of every ten frames of the input:
  13173. @example
  13174. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13175. @end example
  13176. @end itemize
  13177. @section shuffleplanes
  13178. Reorder and/or duplicate video planes.
  13179. It accepts the following parameters:
  13180. @table @option
  13181. @item map0
  13182. The index of the input plane to be used as the first output plane.
  13183. @item map1
  13184. The index of the input plane to be used as the second output plane.
  13185. @item map2
  13186. The index of the input plane to be used as the third output plane.
  13187. @item map3
  13188. The index of the input plane to be used as the fourth output plane.
  13189. @end table
  13190. The first plane has the index 0. The default is to keep the input unchanged.
  13191. @subsection Examples
  13192. @itemize
  13193. @item
  13194. Swap the second and third planes of the input:
  13195. @example
  13196. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13197. @end example
  13198. @end itemize
  13199. @anchor{signalstats}
  13200. @section signalstats
  13201. Evaluate various visual metrics that assist in determining issues associated
  13202. with the digitization of analog video media.
  13203. By default the filter will log these metadata values:
  13204. @table @option
  13205. @item YMIN
  13206. Display the minimal Y value contained within the input frame. Expressed in
  13207. range of [0-255].
  13208. @item YLOW
  13209. Display the Y value at the 10% percentile within the input frame. Expressed in
  13210. range of [0-255].
  13211. @item YAVG
  13212. Display the average Y value within the input frame. Expressed in range of
  13213. [0-255].
  13214. @item YHIGH
  13215. Display the Y value at the 90% percentile within the input frame. Expressed in
  13216. range of [0-255].
  13217. @item YMAX
  13218. Display the maximum Y value contained within the input frame. Expressed in
  13219. range of [0-255].
  13220. @item UMIN
  13221. Display the minimal U value contained within the input frame. Expressed in
  13222. range of [0-255].
  13223. @item ULOW
  13224. Display the U value at the 10% percentile within the input frame. Expressed in
  13225. range of [0-255].
  13226. @item UAVG
  13227. Display the average U value within the input frame. Expressed in range of
  13228. [0-255].
  13229. @item UHIGH
  13230. Display the U value at the 90% percentile within the input frame. Expressed in
  13231. range of [0-255].
  13232. @item UMAX
  13233. Display the maximum U value contained within the input frame. Expressed in
  13234. range of [0-255].
  13235. @item VMIN
  13236. Display the minimal V value contained within the input frame. Expressed in
  13237. range of [0-255].
  13238. @item VLOW
  13239. Display the V value at the 10% percentile within the input frame. Expressed in
  13240. range of [0-255].
  13241. @item VAVG
  13242. Display the average V value within the input frame. Expressed in range of
  13243. [0-255].
  13244. @item VHIGH
  13245. Display the V value at the 90% percentile within the input frame. Expressed in
  13246. range of [0-255].
  13247. @item VMAX
  13248. Display the maximum V value contained within the input frame. Expressed in
  13249. range of [0-255].
  13250. @item SATMIN
  13251. Display the minimal saturation value contained within the input frame.
  13252. Expressed in range of [0-~181.02].
  13253. @item SATLOW
  13254. Display the saturation value at the 10% percentile within the input frame.
  13255. Expressed in range of [0-~181.02].
  13256. @item SATAVG
  13257. Display the average saturation value within the input frame. Expressed in range
  13258. of [0-~181.02].
  13259. @item SATHIGH
  13260. Display the saturation value at the 90% percentile within the input frame.
  13261. Expressed in range of [0-~181.02].
  13262. @item SATMAX
  13263. Display the maximum saturation value contained within the input frame.
  13264. Expressed in range of [0-~181.02].
  13265. @item HUEMED
  13266. Display the median value for hue within the input frame. Expressed in range of
  13267. [0-360].
  13268. @item HUEAVG
  13269. Display the average value for hue within the input frame. Expressed in range of
  13270. [0-360].
  13271. @item YDIF
  13272. Display the average of sample value difference between all values of the Y
  13273. plane in the current frame and corresponding values of the previous input frame.
  13274. Expressed in range of [0-255].
  13275. @item UDIF
  13276. Display the average of sample value difference between all values of the U
  13277. plane in the current frame and corresponding values of the previous input frame.
  13278. Expressed in range of [0-255].
  13279. @item VDIF
  13280. Display the average of sample value difference between all values of the V
  13281. plane in the current frame and corresponding values of the previous input frame.
  13282. Expressed in range of [0-255].
  13283. @item YBITDEPTH
  13284. Display bit depth of Y plane in current frame.
  13285. Expressed in range of [0-16].
  13286. @item UBITDEPTH
  13287. Display bit depth of U plane in current frame.
  13288. Expressed in range of [0-16].
  13289. @item VBITDEPTH
  13290. Display bit depth of V plane in current frame.
  13291. Expressed in range of [0-16].
  13292. @end table
  13293. The filter accepts the following options:
  13294. @table @option
  13295. @item stat
  13296. @item out
  13297. @option{stat} specify an additional form of image analysis.
  13298. @option{out} output video with the specified type of pixel highlighted.
  13299. Both options accept the following values:
  13300. @table @samp
  13301. @item tout
  13302. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13303. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13304. include the results of video dropouts, head clogs, or tape tracking issues.
  13305. @item vrep
  13306. Identify @var{vertical line repetition}. Vertical line repetition includes
  13307. similar rows of pixels within a frame. In born-digital video vertical line
  13308. repetition is common, but this pattern is uncommon in video digitized from an
  13309. analog source. When it occurs in video that results from the digitization of an
  13310. analog source it can indicate concealment from a dropout compensator.
  13311. @item brng
  13312. Identify pixels that fall outside of legal broadcast range.
  13313. @end table
  13314. @item color, c
  13315. Set the highlight color for the @option{out} option. The default color is
  13316. yellow.
  13317. @end table
  13318. @subsection Examples
  13319. @itemize
  13320. @item
  13321. Output data of various video metrics:
  13322. @example
  13323. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13324. @end example
  13325. @item
  13326. Output specific data about the minimum and maximum values of the Y plane per frame:
  13327. @example
  13328. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13329. @end example
  13330. @item
  13331. Playback video while highlighting pixels that are outside of broadcast range in red.
  13332. @example
  13333. ffplay example.mov -vf signalstats="out=brng:color=red"
  13334. @end example
  13335. @item
  13336. Playback video with signalstats metadata drawn over the frame.
  13337. @example
  13338. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13339. @end example
  13340. The contents of signalstat_drawtext.txt used in the command are:
  13341. @example
  13342. time %@{pts:hms@}
  13343. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13344. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13345. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13346. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13347. @end example
  13348. @end itemize
  13349. @anchor{signature}
  13350. @section signature
  13351. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13352. input. In this case the matching between the inputs can be calculated additionally.
  13353. The filter always passes through the first input. The signature of each stream can
  13354. be written into a file.
  13355. It accepts the following options:
  13356. @table @option
  13357. @item detectmode
  13358. Enable or disable the matching process.
  13359. Available values are:
  13360. @table @samp
  13361. @item off
  13362. Disable the calculation of a matching (default).
  13363. @item full
  13364. Calculate the matching for the whole video and output whether the whole video
  13365. matches or only parts.
  13366. @item fast
  13367. Calculate only until a matching is found or the video ends. Should be faster in
  13368. some cases.
  13369. @end table
  13370. @item nb_inputs
  13371. Set the number of inputs. The option value must be a non negative integer.
  13372. Default value is 1.
  13373. @item filename
  13374. Set the path to which the output is written. If there is more than one input,
  13375. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13376. integer), that will be replaced with the input number. If no filename is
  13377. specified, no output will be written. This is the default.
  13378. @item format
  13379. Choose the output format.
  13380. Available values are:
  13381. @table @samp
  13382. @item binary
  13383. Use the specified binary representation (default).
  13384. @item xml
  13385. Use the specified xml representation.
  13386. @end table
  13387. @item th_d
  13388. Set threshold to detect one word as similar. The option value must be an integer
  13389. greater than zero. The default value is 9000.
  13390. @item th_dc
  13391. Set threshold to detect all words as similar. The option value must be an integer
  13392. greater than zero. The default value is 60000.
  13393. @item th_xh
  13394. Set threshold to detect frames as similar. The option value must be an integer
  13395. greater than zero. The default value is 116.
  13396. @item th_di
  13397. Set the minimum length of a sequence in frames to recognize it as matching
  13398. sequence. The option value must be a non negative integer value.
  13399. The default value is 0.
  13400. @item th_it
  13401. Set the minimum relation, that matching frames to all frames must have.
  13402. The option value must be a double value between 0 and 1. The default value is 0.5.
  13403. @end table
  13404. @subsection Examples
  13405. @itemize
  13406. @item
  13407. To calculate the signature of an input video and store it in signature.bin:
  13408. @example
  13409. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13410. @end example
  13411. @item
  13412. To detect whether two videos match and store the signatures in XML format in
  13413. signature0.xml and signature1.xml:
  13414. @example
  13415. 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 -
  13416. @end example
  13417. @end itemize
  13418. @anchor{smartblur}
  13419. @section smartblur
  13420. Blur the input video without impacting the outlines.
  13421. It accepts the following options:
  13422. @table @option
  13423. @item luma_radius, lr
  13424. Set the luma radius. The option value must be a float number in
  13425. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13426. used to blur the image (slower if larger). Default value is 1.0.
  13427. @item luma_strength, ls
  13428. Set the luma strength. The option value must be a float number
  13429. in the range [-1.0,1.0] that configures the blurring. A value included
  13430. in [0.0,1.0] will blur the image whereas a value included in
  13431. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13432. @item luma_threshold, lt
  13433. Set the luma threshold used as a coefficient to determine
  13434. whether a pixel should be blurred or not. The option value must be an
  13435. integer in the range [-30,30]. A value of 0 will filter all the image,
  13436. a value included in [0,30] will filter flat areas and a value included
  13437. in [-30,0] will filter edges. Default value is 0.
  13438. @item chroma_radius, cr
  13439. Set the chroma radius. The option value must be a float number in
  13440. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13441. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13442. @item chroma_strength, cs
  13443. Set the chroma strength. The option value must be a float number
  13444. in the range [-1.0,1.0] that configures the blurring. A value included
  13445. in [0.0,1.0] will blur the image whereas a value included in
  13446. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13447. @item chroma_threshold, ct
  13448. Set the chroma threshold used as a coefficient to determine
  13449. whether a pixel should be blurred or not. The option value must be an
  13450. integer in the range [-30,30]. A value of 0 will filter all the image,
  13451. a value included in [0,30] will filter flat areas and a value included
  13452. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13453. @end table
  13454. If a chroma option is not explicitly set, the corresponding luma value
  13455. is set.
  13456. @section sobel
  13457. Apply sobel operator to input video stream.
  13458. The filter accepts the following option:
  13459. @table @option
  13460. @item planes
  13461. Set which planes will be processed, unprocessed planes will be copied.
  13462. By default value 0xf, all planes will be processed.
  13463. @item scale
  13464. Set value which will be multiplied with filtered result.
  13465. @item delta
  13466. Set value which will be added to filtered result.
  13467. @end table
  13468. @anchor{spp}
  13469. @section spp
  13470. Apply a simple postprocessing filter that compresses and decompresses the image
  13471. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13472. and average the results.
  13473. The filter accepts the following options:
  13474. @table @option
  13475. @item quality
  13476. Set quality. This option defines the number of levels for averaging. It accepts
  13477. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13478. effect. A value of @code{6} means the higher quality. For each increment of
  13479. that value the speed drops by a factor of approximately 2. Default value is
  13480. @code{3}.
  13481. @item qp
  13482. Force a constant quantization parameter. If not set, the filter will use the QP
  13483. from the video stream (if available).
  13484. @item mode
  13485. Set thresholding mode. Available modes are:
  13486. @table @samp
  13487. @item hard
  13488. Set hard thresholding (default).
  13489. @item soft
  13490. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13491. @end table
  13492. @item use_bframe_qp
  13493. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13494. option may cause flicker since the B-Frames have often larger QP. Default is
  13495. @code{0} (not enabled).
  13496. @end table
  13497. @subsection Commands
  13498. This filter supports the following commands:
  13499. @table @option
  13500. @item quality, level
  13501. Set quality level. The value @code{max} can be used to set the maximum level,
  13502. currently @code{6}.
  13503. @end table
  13504. @anchor{sr}
  13505. @section sr
  13506. Scale the input by applying one of the super-resolution methods based on
  13507. convolutional neural networks. Supported models:
  13508. @itemize
  13509. @item
  13510. Super-Resolution Convolutional Neural Network model (SRCNN).
  13511. See @url{https://arxiv.org/abs/1501.00092}.
  13512. @item
  13513. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13514. See @url{https://arxiv.org/abs/1609.05158}.
  13515. @end itemize
  13516. Training scripts as well as scripts for model file (.pb) saving can be found at
  13517. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13518. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13519. Native model files (.model) can be generated from TensorFlow model
  13520. files (.pb) by using tools/python/convert.py
  13521. The filter accepts the following options:
  13522. @table @option
  13523. @item dnn_backend
  13524. Specify which DNN backend to use for model loading and execution. This option accepts
  13525. the following values:
  13526. @table @samp
  13527. @item native
  13528. Native implementation of DNN loading and execution.
  13529. @item tensorflow
  13530. TensorFlow backend. To enable this backend you
  13531. need to install the TensorFlow for C library (see
  13532. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13533. @code{--enable-libtensorflow}
  13534. @end table
  13535. Default value is @samp{native}.
  13536. @item model
  13537. Set path to model file specifying network architecture and its parameters.
  13538. Note that different backends use different file formats. TensorFlow backend
  13539. can load files for both formats, while native backend can load files for only
  13540. its format.
  13541. @item scale_factor
  13542. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13543. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13544. input upscaled using bicubic upscaling with proper scale factor.
  13545. @end table
  13546. This feature can also be finished with @ref{dnn_processing} filter.
  13547. @section ssim
  13548. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13549. This filter takes in input two input videos, the first input is
  13550. considered the "main" source and is passed unchanged to the
  13551. output. The second input is used as a "reference" video for computing
  13552. the SSIM.
  13553. Both video inputs must have the same resolution and pixel format for
  13554. this filter to work correctly. Also it assumes that both inputs
  13555. have the same number of frames, which are compared one by one.
  13556. The filter stores the calculated SSIM of each frame.
  13557. The description of the accepted parameters follows.
  13558. @table @option
  13559. @item stats_file, f
  13560. If specified the filter will use the named file to save the SSIM of
  13561. each individual frame. When filename equals "-" the data is sent to
  13562. standard output.
  13563. @end table
  13564. The file printed if @var{stats_file} is selected, contains a sequence of
  13565. key/value pairs of the form @var{key}:@var{value} for each compared
  13566. couple of frames.
  13567. A description of each shown parameter follows:
  13568. @table @option
  13569. @item n
  13570. sequential number of the input frame, starting from 1
  13571. @item Y, U, V, R, G, B
  13572. SSIM of the compared frames for the component specified by the suffix.
  13573. @item All
  13574. SSIM of the compared frames for the whole frame.
  13575. @item dB
  13576. Same as above but in dB representation.
  13577. @end table
  13578. This filter also supports the @ref{framesync} options.
  13579. @subsection Examples
  13580. @itemize
  13581. @item
  13582. For example:
  13583. @example
  13584. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13585. [main][ref] ssim="stats_file=stats.log" [out]
  13586. @end example
  13587. On this example the input file being processed is compared with the
  13588. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13589. is stored in @file{stats.log}.
  13590. @item
  13591. Another example with both psnr and ssim at same time:
  13592. @example
  13593. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13594. @end example
  13595. @item
  13596. Another example with different containers:
  13597. @example
  13598. 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 -
  13599. @end example
  13600. @end itemize
  13601. @section stereo3d
  13602. Convert between different stereoscopic image formats.
  13603. The filters accept the following options:
  13604. @table @option
  13605. @item in
  13606. Set stereoscopic image format of input.
  13607. Available values for input image formats are:
  13608. @table @samp
  13609. @item sbsl
  13610. side by side parallel (left eye left, right eye right)
  13611. @item sbsr
  13612. side by side crosseye (right eye left, left eye right)
  13613. @item sbs2l
  13614. side by side parallel with half width resolution
  13615. (left eye left, right eye right)
  13616. @item sbs2r
  13617. side by side crosseye with half width resolution
  13618. (right eye left, left eye right)
  13619. @item abl
  13620. @item tbl
  13621. above-below (left eye above, right eye below)
  13622. @item abr
  13623. @item tbr
  13624. above-below (right eye above, left eye below)
  13625. @item ab2l
  13626. @item tb2l
  13627. above-below with half height resolution
  13628. (left eye above, right eye below)
  13629. @item ab2r
  13630. @item tb2r
  13631. above-below with half height resolution
  13632. (right eye above, left eye below)
  13633. @item al
  13634. alternating frames (left eye first, right eye second)
  13635. @item ar
  13636. alternating frames (right eye first, left eye second)
  13637. @item irl
  13638. interleaved rows (left eye has top row, right eye starts on next row)
  13639. @item irr
  13640. interleaved rows (right eye has top row, left eye starts on next row)
  13641. @item icl
  13642. interleaved columns, left eye first
  13643. @item icr
  13644. interleaved columns, right eye first
  13645. Default value is @samp{sbsl}.
  13646. @end table
  13647. @item out
  13648. Set stereoscopic image format of output.
  13649. @table @samp
  13650. @item sbsl
  13651. side by side parallel (left eye left, right eye right)
  13652. @item sbsr
  13653. side by side crosseye (right eye left, left eye right)
  13654. @item sbs2l
  13655. side by side parallel with half width resolution
  13656. (left eye left, right eye right)
  13657. @item sbs2r
  13658. side by side crosseye with half width resolution
  13659. (right eye left, left eye right)
  13660. @item abl
  13661. @item tbl
  13662. above-below (left eye above, right eye below)
  13663. @item abr
  13664. @item tbr
  13665. above-below (right eye above, left eye below)
  13666. @item ab2l
  13667. @item tb2l
  13668. above-below with half height resolution
  13669. (left eye above, right eye below)
  13670. @item ab2r
  13671. @item tb2r
  13672. above-below with half height resolution
  13673. (right eye above, left eye below)
  13674. @item al
  13675. alternating frames (left eye first, right eye second)
  13676. @item ar
  13677. alternating frames (right eye first, left eye second)
  13678. @item irl
  13679. interleaved rows (left eye has top row, right eye starts on next row)
  13680. @item irr
  13681. interleaved rows (right eye has top row, left eye starts on next row)
  13682. @item arbg
  13683. anaglyph red/blue gray
  13684. (red filter on left eye, blue filter on right eye)
  13685. @item argg
  13686. anaglyph red/green gray
  13687. (red filter on left eye, green filter on right eye)
  13688. @item arcg
  13689. anaglyph red/cyan gray
  13690. (red filter on left eye, cyan filter on right eye)
  13691. @item arch
  13692. anaglyph red/cyan half colored
  13693. (red filter on left eye, cyan filter on right eye)
  13694. @item arcc
  13695. anaglyph red/cyan color
  13696. (red filter on left eye, cyan filter on right eye)
  13697. @item arcd
  13698. anaglyph red/cyan color optimized with the least squares projection of dubois
  13699. (red filter on left eye, cyan filter on right eye)
  13700. @item agmg
  13701. anaglyph green/magenta gray
  13702. (green filter on left eye, magenta filter on right eye)
  13703. @item agmh
  13704. anaglyph green/magenta half colored
  13705. (green filter on left eye, magenta filter on right eye)
  13706. @item agmc
  13707. anaglyph green/magenta colored
  13708. (green filter on left eye, magenta filter on right eye)
  13709. @item agmd
  13710. anaglyph green/magenta color optimized with the least squares projection of dubois
  13711. (green filter on left eye, magenta filter on right eye)
  13712. @item aybg
  13713. anaglyph yellow/blue gray
  13714. (yellow filter on left eye, blue filter on right eye)
  13715. @item aybh
  13716. anaglyph yellow/blue half colored
  13717. (yellow filter on left eye, blue filter on right eye)
  13718. @item aybc
  13719. anaglyph yellow/blue colored
  13720. (yellow filter on left eye, blue filter on right eye)
  13721. @item aybd
  13722. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13723. (yellow filter on left eye, blue filter on right eye)
  13724. @item ml
  13725. mono output (left eye only)
  13726. @item mr
  13727. mono output (right eye only)
  13728. @item chl
  13729. checkerboard, left eye first
  13730. @item chr
  13731. checkerboard, right eye first
  13732. @item icl
  13733. interleaved columns, left eye first
  13734. @item icr
  13735. interleaved columns, right eye first
  13736. @item hdmi
  13737. HDMI frame pack
  13738. @end table
  13739. Default value is @samp{arcd}.
  13740. @end table
  13741. @subsection Examples
  13742. @itemize
  13743. @item
  13744. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13745. @example
  13746. stereo3d=sbsl:aybd
  13747. @end example
  13748. @item
  13749. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13750. @example
  13751. stereo3d=abl:sbsr
  13752. @end example
  13753. @end itemize
  13754. @section streamselect, astreamselect
  13755. Select video or audio streams.
  13756. The filter accepts the following options:
  13757. @table @option
  13758. @item inputs
  13759. Set number of inputs. Default is 2.
  13760. @item map
  13761. Set input indexes to remap to outputs.
  13762. @end table
  13763. @subsection Commands
  13764. The @code{streamselect} and @code{astreamselect} filter supports the following
  13765. commands:
  13766. @table @option
  13767. @item map
  13768. Set input indexes to remap to outputs.
  13769. @end table
  13770. @subsection Examples
  13771. @itemize
  13772. @item
  13773. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13774. @example
  13775. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13776. @end example
  13777. @item
  13778. Same as above, but for audio:
  13779. @example
  13780. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13781. @end example
  13782. @end itemize
  13783. @anchor{subtitles}
  13784. @section subtitles
  13785. Draw subtitles on top of input video using the libass library.
  13786. To enable compilation of this filter you need to configure FFmpeg with
  13787. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13788. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13789. Alpha) subtitles format.
  13790. The filter accepts the following options:
  13791. @table @option
  13792. @item filename, f
  13793. Set the filename of the subtitle file to read. It must be specified.
  13794. @item original_size
  13795. Specify the size of the original video, the video for which the ASS file
  13796. was composed. For the syntax of this option, check the
  13797. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13798. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13799. correctly scale the fonts if the aspect ratio has been changed.
  13800. @item fontsdir
  13801. Set a directory path containing fonts that can be used by the filter.
  13802. These fonts will be used in addition to whatever the font provider uses.
  13803. @item alpha
  13804. Process alpha channel, by default alpha channel is untouched.
  13805. @item charenc
  13806. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13807. useful if not UTF-8.
  13808. @item stream_index, si
  13809. Set subtitles stream index. @code{subtitles} filter only.
  13810. @item force_style
  13811. Override default style or script info parameters of the subtitles. It accepts a
  13812. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13813. @end table
  13814. If the first key is not specified, it is assumed that the first value
  13815. specifies the @option{filename}.
  13816. For example, to render the file @file{sub.srt} on top of the input
  13817. video, use the command:
  13818. @example
  13819. subtitles=sub.srt
  13820. @end example
  13821. which is equivalent to:
  13822. @example
  13823. subtitles=filename=sub.srt
  13824. @end example
  13825. To render the default subtitles stream from file @file{video.mkv}, use:
  13826. @example
  13827. subtitles=video.mkv
  13828. @end example
  13829. To render the second subtitles stream from that file, use:
  13830. @example
  13831. subtitles=video.mkv:si=1
  13832. @end example
  13833. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13834. @code{DejaVu Serif}, use:
  13835. @example
  13836. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13837. @end example
  13838. @section super2xsai
  13839. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13840. Interpolate) pixel art scaling algorithm.
  13841. Useful for enlarging pixel art images without reducing sharpness.
  13842. @section swaprect
  13843. Swap two rectangular objects in video.
  13844. This filter accepts the following options:
  13845. @table @option
  13846. @item w
  13847. Set object width.
  13848. @item h
  13849. Set object height.
  13850. @item x1
  13851. Set 1st rect x coordinate.
  13852. @item y1
  13853. Set 1st rect y coordinate.
  13854. @item x2
  13855. Set 2nd rect x coordinate.
  13856. @item y2
  13857. Set 2nd rect y coordinate.
  13858. All expressions are evaluated once for each frame.
  13859. @end table
  13860. The all options are expressions containing the following constants:
  13861. @table @option
  13862. @item w
  13863. @item h
  13864. The input width and height.
  13865. @item a
  13866. same as @var{w} / @var{h}
  13867. @item sar
  13868. input sample aspect ratio
  13869. @item dar
  13870. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13871. @item n
  13872. The number of the input frame, starting from 0.
  13873. @item t
  13874. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13875. @item pos
  13876. the position in the file of the input frame, NAN if unknown
  13877. @end table
  13878. @section swapuv
  13879. Swap U & V plane.
  13880. @section tblend
  13881. Blend successive video frames.
  13882. See @ref{blend}
  13883. @section telecine
  13884. Apply telecine process to the video.
  13885. This filter accepts the following options:
  13886. @table @option
  13887. @item first_field
  13888. @table @samp
  13889. @item top, t
  13890. top field first
  13891. @item bottom, b
  13892. bottom field first
  13893. The default value is @code{top}.
  13894. @end table
  13895. @item pattern
  13896. A string of numbers representing the pulldown pattern you wish to apply.
  13897. The default value is @code{23}.
  13898. @end table
  13899. @example
  13900. Some typical patterns:
  13901. NTSC output (30i):
  13902. 27.5p: 32222
  13903. 24p: 23 (classic)
  13904. 24p: 2332 (preferred)
  13905. 20p: 33
  13906. 18p: 334
  13907. 16p: 3444
  13908. PAL output (25i):
  13909. 27.5p: 12222
  13910. 24p: 222222222223 ("Euro pulldown")
  13911. 16.67p: 33
  13912. 16p: 33333334
  13913. @end example
  13914. @section thistogram
  13915. Compute and draw a color distribution histogram for the input video across time.
  13916. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13917. at certain time, this filter shows also past histograms of number of frames defined
  13918. by @code{width} option.
  13919. The computed histogram is a representation of the color component
  13920. distribution in an image.
  13921. The filter accepts the following options:
  13922. @table @option
  13923. @item width, w
  13924. Set width of single color component output. Default value is @code{0}.
  13925. Value of @code{0} means width will be picked from input video.
  13926. This also set number of passed histograms to keep.
  13927. Allowed range is [0, 8192].
  13928. @item display_mode, d
  13929. Set display mode.
  13930. It accepts the following values:
  13931. @table @samp
  13932. @item stack
  13933. Per color component graphs are placed below each other.
  13934. @item parade
  13935. Per color component graphs are placed side by side.
  13936. @item overlay
  13937. Presents information identical to that in the @code{parade}, except
  13938. that the graphs representing color components are superimposed directly
  13939. over one another.
  13940. @end table
  13941. Default is @code{stack}.
  13942. @item levels_mode, m
  13943. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13944. Default is @code{linear}.
  13945. @item components, c
  13946. Set what color components to display.
  13947. Default is @code{7}.
  13948. @item bgopacity, b
  13949. Set background opacity. Default is @code{0.9}.
  13950. @item envelope, e
  13951. Show envelope. Default is disabled.
  13952. @item ecolor, ec
  13953. Set envelope color. Default is @code{gold}.
  13954. @item slide
  13955. Set slide mode.
  13956. Available values for slide is:
  13957. @table @samp
  13958. @item frame
  13959. Draw new frame when right border is reached.
  13960. @item replace
  13961. Replace old columns with new ones.
  13962. @item scroll
  13963. Scroll from right to left.
  13964. @item rscroll
  13965. Scroll from left to right.
  13966. @item picture
  13967. Draw single picture.
  13968. @end table
  13969. Default is @code{replace}.
  13970. @end table
  13971. @section threshold
  13972. Apply threshold effect to video stream.
  13973. This filter needs four video streams to perform thresholding.
  13974. First stream is stream we are filtering.
  13975. Second stream is holding threshold values, third stream is holding min values,
  13976. and last, fourth stream is holding max values.
  13977. The filter accepts the following option:
  13978. @table @option
  13979. @item planes
  13980. Set which planes will be processed, unprocessed planes will be copied.
  13981. By default value 0xf, all planes will be processed.
  13982. @end table
  13983. For example if first stream pixel's component value is less then threshold value
  13984. of pixel component from 2nd threshold stream, third stream value will picked,
  13985. otherwise fourth stream pixel component value will be picked.
  13986. Using color source filter one can perform various types of thresholding:
  13987. @subsection Examples
  13988. @itemize
  13989. @item
  13990. Binary threshold, using gray color as threshold:
  13991. @example
  13992. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13993. @end example
  13994. @item
  13995. Inverted binary threshold, using gray color as threshold:
  13996. @example
  13997. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13998. @end example
  13999. @item
  14000. Truncate binary threshold, using gray color as threshold:
  14001. @example
  14002. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14003. @end example
  14004. @item
  14005. Threshold to zero, using gray color as threshold:
  14006. @example
  14007. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14008. @end example
  14009. @item
  14010. Inverted threshold to zero, using gray color as threshold:
  14011. @example
  14012. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14013. @end example
  14014. @end itemize
  14015. @section thumbnail
  14016. Select the most representative frame in a given sequence of consecutive frames.
  14017. The filter accepts the following options:
  14018. @table @option
  14019. @item n
  14020. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14021. will pick one of them, and then handle the next batch of @var{n} frames until
  14022. the end. Default is @code{100}.
  14023. @end table
  14024. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14025. value will result in a higher memory usage, so a high value is not recommended.
  14026. @subsection Examples
  14027. @itemize
  14028. @item
  14029. Extract one picture each 50 frames:
  14030. @example
  14031. thumbnail=50
  14032. @end example
  14033. @item
  14034. Complete example of a thumbnail creation with @command{ffmpeg}:
  14035. @example
  14036. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14037. @end example
  14038. @end itemize
  14039. @anchor{tile}
  14040. @section tile
  14041. Tile several successive frames together.
  14042. The @ref{untile} filter can do the reverse.
  14043. The filter accepts the following options:
  14044. @table @option
  14045. @item layout
  14046. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14047. this option, check the
  14048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14049. @item nb_frames
  14050. Set the maximum number of frames to render in the given area. It must be less
  14051. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14052. the area will be used.
  14053. @item margin
  14054. Set the outer border margin in pixels.
  14055. @item padding
  14056. Set the inner border thickness (i.e. the number of pixels between frames). For
  14057. more advanced padding options (such as having different values for the edges),
  14058. refer to the pad video filter.
  14059. @item color
  14060. Specify the color of the unused area. For the syntax of this option, check the
  14061. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14062. The default value of @var{color} is "black".
  14063. @item overlap
  14064. Set the number of frames to overlap when tiling several successive frames together.
  14065. The value must be between @code{0} and @var{nb_frames - 1}.
  14066. @item init_padding
  14067. Set the number of frames to initially be empty before displaying first output frame.
  14068. This controls how soon will one get first output frame.
  14069. The value must be between @code{0} and @var{nb_frames - 1}.
  14070. @end table
  14071. @subsection Examples
  14072. @itemize
  14073. @item
  14074. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14075. @example
  14076. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14077. @end example
  14078. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14079. duplicating each output frame to accommodate the originally detected frame
  14080. rate.
  14081. @item
  14082. Display @code{5} pictures in an area of @code{3x2} frames,
  14083. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14084. mixed flat and named options:
  14085. @example
  14086. tile=3x2:nb_frames=5:padding=7:margin=2
  14087. @end example
  14088. @end itemize
  14089. @section tinterlace
  14090. Perform various types of temporal field interlacing.
  14091. Frames are counted starting from 1, so the first input frame is
  14092. considered odd.
  14093. The filter accepts the following options:
  14094. @table @option
  14095. @item mode
  14096. Specify the mode of the interlacing. This option can also be specified
  14097. as a value alone. See below for a list of values for this option.
  14098. Available values are:
  14099. @table @samp
  14100. @item merge, 0
  14101. Move odd frames into the upper field, even into the lower field,
  14102. generating a double height frame at half frame rate.
  14103. @example
  14104. ------> time
  14105. Input:
  14106. Frame 1 Frame 2 Frame 3 Frame 4
  14107. 11111 22222 33333 44444
  14108. 11111 22222 33333 44444
  14109. 11111 22222 33333 44444
  14110. 11111 22222 33333 44444
  14111. Output:
  14112. 11111 33333
  14113. 22222 44444
  14114. 11111 33333
  14115. 22222 44444
  14116. 11111 33333
  14117. 22222 44444
  14118. 11111 33333
  14119. 22222 44444
  14120. @end example
  14121. @item drop_even, 1
  14122. Only output odd frames, even frames are dropped, generating a frame with
  14123. unchanged height at half frame rate.
  14124. @example
  14125. ------> time
  14126. Input:
  14127. Frame 1 Frame 2 Frame 3 Frame 4
  14128. 11111 22222 33333 44444
  14129. 11111 22222 33333 44444
  14130. 11111 22222 33333 44444
  14131. 11111 22222 33333 44444
  14132. Output:
  14133. 11111 33333
  14134. 11111 33333
  14135. 11111 33333
  14136. 11111 33333
  14137. @end example
  14138. @item drop_odd, 2
  14139. Only output even frames, odd frames are dropped, generating a frame with
  14140. unchanged height at half frame rate.
  14141. @example
  14142. ------> time
  14143. Input:
  14144. Frame 1 Frame 2 Frame 3 Frame 4
  14145. 11111 22222 33333 44444
  14146. 11111 22222 33333 44444
  14147. 11111 22222 33333 44444
  14148. 11111 22222 33333 44444
  14149. Output:
  14150. 22222 44444
  14151. 22222 44444
  14152. 22222 44444
  14153. 22222 44444
  14154. @end example
  14155. @item pad, 3
  14156. Expand each frame to full height, but pad alternate lines with black,
  14157. generating a frame with double height at the same input frame rate.
  14158. @example
  14159. ------> time
  14160. Input:
  14161. Frame 1 Frame 2 Frame 3 Frame 4
  14162. 11111 22222 33333 44444
  14163. 11111 22222 33333 44444
  14164. 11111 22222 33333 44444
  14165. 11111 22222 33333 44444
  14166. Output:
  14167. 11111 ..... 33333 .....
  14168. ..... 22222 ..... 44444
  14169. 11111 ..... 33333 .....
  14170. ..... 22222 ..... 44444
  14171. 11111 ..... 33333 .....
  14172. ..... 22222 ..... 44444
  14173. 11111 ..... 33333 .....
  14174. ..... 22222 ..... 44444
  14175. @end example
  14176. @item interleave_top, 4
  14177. Interleave the upper field from odd frames with the lower field from
  14178. even frames, generating a frame with unchanged height at half frame rate.
  14179. @example
  14180. ------> time
  14181. Input:
  14182. Frame 1 Frame 2 Frame 3 Frame 4
  14183. 11111<- 22222 33333<- 44444
  14184. 11111 22222<- 33333 44444<-
  14185. 11111<- 22222 33333<- 44444
  14186. 11111 22222<- 33333 44444<-
  14187. Output:
  14188. 11111 33333
  14189. 22222 44444
  14190. 11111 33333
  14191. 22222 44444
  14192. @end example
  14193. @item interleave_bottom, 5
  14194. Interleave the lower field from odd frames with the upper field from
  14195. even frames, generating a frame with unchanged height at half frame rate.
  14196. @example
  14197. ------> time
  14198. Input:
  14199. Frame 1 Frame 2 Frame 3 Frame 4
  14200. 11111 22222<- 33333 44444<-
  14201. 11111<- 22222 33333<- 44444
  14202. 11111 22222<- 33333 44444<-
  14203. 11111<- 22222 33333<- 44444
  14204. Output:
  14205. 22222 44444
  14206. 11111 33333
  14207. 22222 44444
  14208. 11111 33333
  14209. @end example
  14210. @item interlacex2, 6
  14211. Double frame rate with unchanged height. Frames are inserted each
  14212. containing the second temporal field from the previous input frame and
  14213. the first temporal field from the next input frame. This mode relies on
  14214. the top_field_first flag. Useful for interlaced video displays with no
  14215. field synchronisation.
  14216. @example
  14217. ------> time
  14218. Input:
  14219. Frame 1 Frame 2 Frame 3 Frame 4
  14220. 11111 22222 33333 44444
  14221. 11111 22222 33333 44444
  14222. 11111 22222 33333 44444
  14223. 11111 22222 33333 44444
  14224. Output:
  14225. 11111 22222 22222 33333 33333 44444 44444
  14226. 11111 11111 22222 22222 33333 33333 44444
  14227. 11111 22222 22222 33333 33333 44444 44444
  14228. 11111 11111 22222 22222 33333 33333 44444
  14229. @end example
  14230. @item mergex2, 7
  14231. Move odd frames into the upper field, even into the lower field,
  14232. generating a double height frame at same frame rate.
  14233. @example
  14234. ------> time
  14235. Input:
  14236. Frame 1 Frame 2 Frame 3 Frame 4
  14237. 11111 22222 33333 44444
  14238. 11111 22222 33333 44444
  14239. 11111 22222 33333 44444
  14240. 11111 22222 33333 44444
  14241. Output:
  14242. 11111 33333 33333 55555
  14243. 22222 22222 44444 44444
  14244. 11111 33333 33333 55555
  14245. 22222 22222 44444 44444
  14246. 11111 33333 33333 55555
  14247. 22222 22222 44444 44444
  14248. 11111 33333 33333 55555
  14249. 22222 22222 44444 44444
  14250. @end example
  14251. @end table
  14252. Numeric values are deprecated but are accepted for backward
  14253. compatibility reasons.
  14254. Default mode is @code{merge}.
  14255. @item flags
  14256. Specify flags influencing the filter process.
  14257. Available value for @var{flags} is:
  14258. @table @option
  14259. @item low_pass_filter, vlpf
  14260. Enable linear vertical low-pass filtering in the filter.
  14261. Vertical low-pass filtering is required when creating an interlaced
  14262. destination from a progressive source which contains high-frequency
  14263. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14264. patterning.
  14265. @item complex_filter, cvlpf
  14266. Enable complex vertical low-pass filtering.
  14267. This will slightly less reduce interlace 'twitter' and Moire
  14268. patterning but better retain detail and subjective sharpness impression.
  14269. @item bypass_il
  14270. Bypass already interlaced frames, only adjust the frame rate.
  14271. @end table
  14272. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14273. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14274. @end table
  14275. @section tmedian
  14276. Pick median pixels from several successive input video frames.
  14277. The filter accepts the following options:
  14278. @table @option
  14279. @item radius
  14280. Set radius of median filter.
  14281. Default is 1. Allowed range is from 1 to 127.
  14282. @item planes
  14283. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14284. @item percentile
  14285. Set median percentile. Default value is @code{0.5}.
  14286. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14287. minimum values, and @code{1} maximum values.
  14288. @end table
  14289. @section tmix
  14290. Mix successive video frames.
  14291. A description of the accepted options follows.
  14292. @table @option
  14293. @item frames
  14294. The number of successive frames to mix. If unspecified, it defaults to 3.
  14295. @item weights
  14296. Specify weight of each input video frame.
  14297. Each weight is separated by space. If number of weights is smaller than
  14298. number of @var{frames} last specified weight will be used for all remaining
  14299. unset weights.
  14300. @item scale
  14301. Specify scale, if it is set it will be multiplied with sum
  14302. of each weight multiplied with pixel values to give final destination
  14303. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14304. @end table
  14305. @subsection Examples
  14306. @itemize
  14307. @item
  14308. Average 7 successive frames:
  14309. @example
  14310. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14311. @end example
  14312. @item
  14313. Apply simple temporal convolution:
  14314. @example
  14315. tmix=frames=3:weights="-1 3 -1"
  14316. @end example
  14317. @item
  14318. Similar as above but only showing temporal differences:
  14319. @example
  14320. tmix=frames=3:weights="-1 2 -1":scale=1
  14321. @end example
  14322. @end itemize
  14323. @anchor{tonemap}
  14324. @section tonemap
  14325. Tone map colors from different dynamic ranges.
  14326. This filter expects data in single precision floating point, as it needs to
  14327. operate on (and can output) out-of-range values. Another filter, such as
  14328. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14329. The tonemapping algorithms implemented only work on linear light, so input
  14330. data should be linearized beforehand (and possibly correctly tagged).
  14331. @example
  14332. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14333. @end example
  14334. @subsection Options
  14335. The filter accepts the following options.
  14336. @table @option
  14337. @item tonemap
  14338. Set the tone map algorithm to use.
  14339. Possible values are:
  14340. @table @var
  14341. @item none
  14342. Do not apply any tone map, only desaturate overbright pixels.
  14343. @item clip
  14344. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14345. in-range values, while distorting out-of-range values.
  14346. @item linear
  14347. Stretch the entire reference gamut to a linear multiple of the display.
  14348. @item gamma
  14349. Fit a logarithmic transfer between the tone curves.
  14350. @item reinhard
  14351. Preserve overall image brightness with a simple curve, using nonlinear
  14352. contrast, which results in flattening details and degrading color accuracy.
  14353. @item hable
  14354. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14355. of slightly darkening everything. Use it when detail preservation is more
  14356. important than color and brightness accuracy.
  14357. @item mobius
  14358. Smoothly map out-of-range values, while retaining contrast and colors for
  14359. in-range material as much as possible. Use it when color accuracy is more
  14360. important than detail preservation.
  14361. @end table
  14362. Default is none.
  14363. @item param
  14364. Tune the tone mapping algorithm.
  14365. This affects the following algorithms:
  14366. @table @var
  14367. @item none
  14368. Ignored.
  14369. @item linear
  14370. Specifies the scale factor to use while stretching.
  14371. Default to 1.0.
  14372. @item gamma
  14373. Specifies the exponent of the function.
  14374. Default to 1.8.
  14375. @item clip
  14376. Specify an extra linear coefficient to multiply into the signal before clipping.
  14377. Default to 1.0.
  14378. @item reinhard
  14379. Specify the local contrast coefficient at the display peak.
  14380. Default to 0.5, which means that in-gamut values will be about half as bright
  14381. as when clipping.
  14382. @item hable
  14383. Ignored.
  14384. @item mobius
  14385. Specify the transition point from linear to mobius transform. Every value
  14386. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14387. more accurate the result will be, at the cost of losing bright details.
  14388. Default to 0.3, which due to the steep initial slope still preserves in-range
  14389. colors fairly accurately.
  14390. @end table
  14391. @item desat
  14392. Apply desaturation for highlights that exceed this level of brightness. The
  14393. higher the parameter, the more color information will be preserved. This
  14394. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14395. (smoothly) turning into white instead. This makes images feel more natural,
  14396. at the cost of reducing information about out-of-range colors.
  14397. The default of 2.0 is somewhat conservative and will mostly just apply to
  14398. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14399. This option works only if the input frame has a supported color tag.
  14400. @item peak
  14401. Override signal/nominal/reference peak with this value. Useful when the
  14402. embedded peak information in display metadata is not reliable or when tone
  14403. mapping from a lower range to a higher range.
  14404. @end table
  14405. @section tpad
  14406. Temporarily pad video frames.
  14407. The filter accepts the following options:
  14408. @table @option
  14409. @item start
  14410. Specify number of delay frames before input video stream. Default is 0.
  14411. @item stop
  14412. Specify number of padding frames after input video stream.
  14413. Set to -1 to pad indefinitely. Default is 0.
  14414. @item start_mode
  14415. Set kind of frames added to beginning of stream.
  14416. Can be either @var{add} or @var{clone}.
  14417. With @var{add} frames of solid-color are added.
  14418. With @var{clone} frames are clones of first frame.
  14419. Default is @var{add}.
  14420. @item stop_mode
  14421. Set kind of frames added to end of stream.
  14422. Can be either @var{add} or @var{clone}.
  14423. With @var{add} frames of solid-color are added.
  14424. With @var{clone} frames are clones of last frame.
  14425. Default is @var{add}.
  14426. @item start_duration, stop_duration
  14427. Specify the duration of the start/stop delay. See
  14428. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14429. for the accepted syntax.
  14430. These options override @var{start} and @var{stop}. Default is 0.
  14431. @item color
  14432. Specify the color of the padded area. For the syntax of this option,
  14433. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14434. manual,ffmpeg-utils}.
  14435. The default value of @var{color} is "black".
  14436. @end table
  14437. @anchor{transpose}
  14438. @section transpose
  14439. Transpose rows with columns in the input video and optionally flip it.
  14440. It accepts the following parameters:
  14441. @table @option
  14442. @item dir
  14443. Specify the transposition direction.
  14444. Can assume the following values:
  14445. @table @samp
  14446. @item 0, 4, cclock_flip
  14447. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14448. @example
  14449. L.R L.l
  14450. . . -> . .
  14451. l.r R.r
  14452. @end example
  14453. @item 1, 5, clock
  14454. Rotate by 90 degrees clockwise, that is:
  14455. @example
  14456. L.R l.L
  14457. . . -> . .
  14458. l.r r.R
  14459. @end example
  14460. @item 2, 6, cclock
  14461. Rotate by 90 degrees counterclockwise, that is:
  14462. @example
  14463. L.R R.r
  14464. . . -> . .
  14465. l.r L.l
  14466. @end example
  14467. @item 3, 7, clock_flip
  14468. Rotate by 90 degrees clockwise and vertically flip, that is:
  14469. @example
  14470. L.R r.R
  14471. . . -> . .
  14472. l.r l.L
  14473. @end example
  14474. @end table
  14475. For values between 4-7, the transposition is only done if the input
  14476. video geometry is portrait and not landscape. These values are
  14477. deprecated, the @code{passthrough} option should be used instead.
  14478. Numerical values are deprecated, and should be dropped in favor of
  14479. symbolic constants.
  14480. @item passthrough
  14481. Do not apply the transposition if the input geometry matches the one
  14482. specified by the specified value. It accepts the following values:
  14483. @table @samp
  14484. @item none
  14485. Always apply transposition.
  14486. @item portrait
  14487. Preserve portrait geometry (when @var{height} >= @var{width}).
  14488. @item landscape
  14489. Preserve landscape geometry (when @var{width} >= @var{height}).
  14490. @end table
  14491. Default value is @code{none}.
  14492. @end table
  14493. For example to rotate by 90 degrees clockwise and preserve portrait
  14494. layout:
  14495. @example
  14496. transpose=dir=1:passthrough=portrait
  14497. @end example
  14498. The command above can also be specified as:
  14499. @example
  14500. transpose=1:portrait
  14501. @end example
  14502. @section transpose_npp
  14503. Transpose rows with columns in the input video and optionally flip it.
  14504. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14505. It accepts the following parameters:
  14506. @table @option
  14507. @item dir
  14508. Specify the transposition direction.
  14509. Can assume the following values:
  14510. @table @samp
  14511. @item cclock_flip
  14512. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14513. @item clock
  14514. Rotate by 90 degrees clockwise.
  14515. @item cclock
  14516. Rotate by 90 degrees counterclockwise.
  14517. @item clock_flip
  14518. Rotate by 90 degrees clockwise and vertically flip.
  14519. @end table
  14520. @item passthrough
  14521. Do not apply the transposition if the input geometry matches the one
  14522. specified by the specified value. It accepts the following values:
  14523. @table @samp
  14524. @item none
  14525. Always apply transposition. (default)
  14526. @item portrait
  14527. Preserve portrait geometry (when @var{height} >= @var{width}).
  14528. @item landscape
  14529. Preserve landscape geometry (when @var{width} >= @var{height}).
  14530. @end table
  14531. @end table
  14532. @section trim
  14533. Trim the input so that the output contains one continuous subpart of the input.
  14534. It accepts the following parameters:
  14535. @table @option
  14536. @item start
  14537. Specify the time of the start of the kept section, i.e. the frame with the
  14538. timestamp @var{start} will be the first frame in the output.
  14539. @item end
  14540. Specify the time of the first frame that will be dropped, i.e. the frame
  14541. immediately preceding the one with the timestamp @var{end} will be the last
  14542. frame in the output.
  14543. @item start_pts
  14544. This is the same as @var{start}, except this option sets the start timestamp
  14545. in timebase units instead of seconds.
  14546. @item end_pts
  14547. This is the same as @var{end}, except this option sets the end timestamp
  14548. in timebase units instead of seconds.
  14549. @item duration
  14550. The maximum duration of the output in seconds.
  14551. @item start_frame
  14552. The number of the first frame that should be passed to the output.
  14553. @item end_frame
  14554. The number of the first frame that should be dropped.
  14555. @end table
  14556. @option{start}, @option{end}, and @option{duration} are expressed as time
  14557. duration specifications; see
  14558. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14559. for the accepted syntax.
  14560. Note that the first two sets of the start/end options and the @option{duration}
  14561. option look at the frame timestamp, while the _frame variants simply count the
  14562. frames that pass through the filter. Also note that this filter does not modify
  14563. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14564. setpts filter after the trim filter.
  14565. If multiple start or end options are set, this filter tries to be greedy and
  14566. keep all the frames that match at least one of the specified constraints. To keep
  14567. only the part that matches all the constraints at once, chain multiple trim
  14568. filters.
  14569. The defaults are such that all the input is kept. So it is possible to set e.g.
  14570. just the end values to keep everything before the specified time.
  14571. Examples:
  14572. @itemize
  14573. @item
  14574. Drop everything except the second minute of input:
  14575. @example
  14576. ffmpeg -i INPUT -vf trim=60:120
  14577. @end example
  14578. @item
  14579. Keep only the first second:
  14580. @example
  14581. ffmpeg -i INPUT -vf trim=duration=1
  14582. @end example
  14583. @end itemize
  14584. @section unpremultiply
  14585. Apply alpha unpremultiply effect to input video stream using first plane
  14586. of second stream as alpha.
  14587. Both streams must have same dimensions and same pixel format.
  14588. The filter accepts the following option:
  14589. @table @option
  14590. @item planes
  14591. Set which planes will be processed, unprocessed planes will be copied.
  14592. By default value 0xf, all planes will be processed.
  14593. If the format has 1 or 2 components, then luma is bit 0.
  14594. If the format has 3 or 4 components:
  14595. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14596. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14597. If present, the alpha channel is always the last bit.
  14598. @item inplace
  14599. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14600. @end table
  14601. @anchor{unsharp}
  14602. @section unsharp
  14603. Sharpen or blur the input video.
  14604. It accepts the following parameters:
  14605. @table @option
  14606. @item luma_msize_x, lx
  14607. Set the luma matrix horizontal size. It must be an odd integer between
  14608. 3 and 23. The default value is 5.
  14609. @item luma_msize_y, ly
  14610. Set the luma matrix vertical size. It must be an odd integer between 3
  14611. and 23. The default value is 5.
  14612. @item luma_amount, la
  14613. Set the luma effect strength. It must be a floating point number, reasonable
  14614. values lay between -1.5 and 1.5.
  14615. Negative values will blur the input video, while positive values will
  14616. sharpen it, a value of zero will disable the effect.
  14617. Default value is 1.0.
  14618. @item chroma_msize_x, cx
  14619. Set the chroma matrix horizontal size. It must be an odd integer
  14620. between 3 and 23. The default value is 5.
  14621. @item chroma_msize_y, cy
  14622. Set the chroma matrix vertical size. It must be an odd integer
  14623. between 3 and 23. The default value is 5.
  14624. @item chroma_amount, ca
  14625. Set the chroma effect strength. It must be a floating point number, reasonable
  14626. values lay between -1.5 and 1.5.
  14627. Negative values will blur the input video, while positive values will
  14628. sharpen it, a value of zero will disable the effect.
  14629. Default value is 0.0.
  14630. @end table
  14631. All parameters are optional and default to the equivalent of the
  14632. string '5:5:1.0:5:5:0.0'.
  14633. @subsection Examples
  14634. @itemize
  14635. @item
  14636. Apply strong luma sharpen effect:
  14637. @example
  14638. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14639. @end example
  14640. @item
  14641. Apply a strong blur of both luma and chroma parameters:
  14642. @example
  14643. unsharp=7:7:-2:7:7:-2
  14644. @end example
  14645. @end itemize
  14646. @anchor{untile}
  14647. @section untile
  14648. Decompose a video made of tiled images into the individual images.
  14649. The frame rate of the output video is the frame rate of the input video
  14650. multiplied by the number of tiles.
  14651. This filter does the reverse of @ref{tile}.
  14652. The filter accepts the following options:
  14653. @table @option
  14654. @item layout
  14655. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14656. this option, check the
  14657. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14658. @end table
  14659. @subsection Examples
  14660. @itemize
  14661. @item
  14662. Produce a 1-second video from a still image file made of 25 frames stacked
  14663. vertically, like an analogic film reel:
  14664. @example
  14665. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14666. @end example
  14667. @end itemize
  14668. @section uspp
  14669. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14670. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14671. shifts and average the results.
  14672. The way this differs from the behavior of spp is that uspp actually encodes &
  14673. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14674. DCT similar to MJPEG.
  14675. The filter accepts the following options:
  14676. @table @option
  14677. @item quality
  14678. Set quality. This option defines the number of levels for averaging. It accepts
  14679. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14680. effect. A value of @code{8} means the higher quality. For each increment of
  14681. that value the speed drops by a factor of approximately 2. Default value is
  14682. @code{3}.
  14683. @item qp
  14684. Force a constant quantization parameter. If not set, the filter will use the QP
  14685. from the video stream (if available).
  14686. @end table
  14687. @section v360
  14688. Convert 360 videos between various formats.
  14689. The filter accepts the following options:
  14690. @table @option
  14691. @item input
  14692. @item output
  14693. Set format of the input/output video.
  14694. Available formats:
  14695. @table @samp
  14696. @item e
  14697. @item equirect
  14698. Equirectangular projection.
  14699. @item c3x2
  14700. @item c6x1
  14701. @item c1x6
  14702. Cubemap with 3x2/6x1/1x6 layout.
  14703. Format specific options:
  14704. @table @option
  14705. @item in_pad
  14706. @item out_pad
  14707. Set padding proportion for the input/output cubemap. Values in decimals.
  14708. Example values:
  14709. @table @samp
  14710. @item 0
  14711. No padding.
  14712. @item 0.01
  14713. 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)
  14714. @end table
  14715. Default value is @b{@samp{0}}.
  14716. Maximum value is @b{@samp{0.1}}.
  14717. @item fin_pad
  14718. @item fout_pad
  14719. Set fixed padding for the input/output cubemap. Values in pixels.
  14720. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14721. @item in_forder
  14722. @item out_forder
  14723. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14724. Designation of directions:
  14725. @table @samp
  14726. @item r
  14727. right
  14728. @item l
  14729. left
  14730. @item u
  14731. up
  14732. @item d
  14733. down
  14734. @item f
  14735. forward
  14736. @item b
  14737. back
  14738. @end table
  14739. Default value is @b{@samp{rludfb}}.
  14740. @item in_frot
  14741. @item out_frot
  14742. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14743. Designation of angles:
  14744. @table @samp
  14745. @item 0
  14746. 0 degrees clockwise
  14747. @item 1
  14748. 90 degrees clockwise
  14749. @item 2
  14750. 180 degrees clockwise
  14751. @item 3
  14752. 270 degrees clockwise
  14753. @end table
  14754. Default value is @b{@samp{000000}}.
  14755. @end table
  14756. @item eac
  14757. Equi-Angular Cubemap.
  14758. @item flat
  14759. @item gnomonic
  14760. @item rectilinear
  14761. Regular video.
  14762. Format specific options:
  14763. @table @option
  14764. @item h_fov
  14765. @item v_fov
  14766. @item d_fov
  14767. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14768. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14769. @item ih_fov
  14770. @item iv_fov
  14771. @item id_fov
  14772. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14773. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14774. @end table
  14775. @item dfisheye
  14776. Dual fisheye.
  14777. Format specific options:
  14778. @table @option
  14779. @item h_fov
  14780. @item v_fov
  14781. @item d_fov
  14782. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14783. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14784. @item ih_fov
  14785. @item iv_fov
  14786. @item id_fov
  14787. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14788. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14789. @end table
  14790. @item barrel
  14791. @item fb
  14792. @item barrelsplit
  14793. Facebook's 360 formats.
  14794. @item sg
  14795. Stereographic format.
  14796. Format specific options:
  14797. @table @option
  14798. @item h_fov
  14799. @item v_fov
  14800. @item d_fov
  14801. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14802. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14803. @item ih_fov
  14804. @item iv_fov
  14805. @item id_fov
  14806. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14807. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14808. @end table
  14809. @item mercator
  14810. Mercator format.
  14811. @item ball
  14812. Ball format, gives significant distortion toward the back.
  14813. @item hammer
  14814. Hammer-Aitoff map projection format.
  14815. @item sinusoidal
  14816. Sinusoidal map projection format.
  14817. @item fisheye
  14818. Fisheye projection.
  14819. Format specific options:
  14820. @table @option
  14821. @item h_fov
  14822. @item v_fov
  14823. @item d_fov
  14824. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14825. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14826. @item ih_fov
  14827. @item iv_fov
  14828. @item id_fov
  14829. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14830. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14831. @end table
  14832. @item pannini
  14833. Pannini projection.
  14834. Format specific options:
  14835. @table @option
  14836. @item h_fov
  14837. Set output pannini parameter.
  14838. @item ih_fov
  14839. Set input pannini parameter.
  14840. @end table
  14841. @item cylindrical
  14842. Cylindrical projection.
  14843. Format specific options:
  14844. @table @option
  14845. @item h_fov
  14846. @item v_fov
  14847. @item d_fov
  14848. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14849. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14850. @item ih_fov
  14851. @item iv_fov
  14852. @item id_fov
  14853. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14854. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14855. @end table
  14856. @item perspective
  14857. Perspective projection. @i{(output only)}
  14858. Format specific options:
  14859. @table @option
  14860. @item v_fov
  14861. Set perspective parameter.
  14862. @end table
  14863. @item tetrahedron
  14864. Tetrahedron projection.
  14865. @item tsp
  14866. Truncated square pyramid projection.
  14867. @item he
  14868. @item hequirect
  14869. Half equirectangular projection.
  14870. @item equisolid
  14871. Equisolid format.
  14872. Format specific options:
  14873. @table @option
  14874. @item h_fov
  14875. @item v_fov
  14876. @item d_fov
  14877. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14878. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14879. @item ih_fov
  14880. @item iv_fov
  14881. @item id_fov
  14882. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14883. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14884. @end table
  14885. @item og
  14886. Orthographic format.
  14887. Format specific options:
  14888. @table @option
  14889. @item h_fov
  14890. @item v_fov
  14891. @item d_fov
  14892. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14893. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14894. @item ih_fov
  14895. @item iv_fov
  14896. @item id_fov
  14897. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14898. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14899. @end table
  14900. @item octahedron
  14901. Octahedron projection.
  14902. @end table
  14903. @item interp
  14904. Set interpolation method.@*
  14905. @i{Note: more complex interpolation methods require much more memory to run.}
  14906. Available methods:
  14907. @table @samp
  14908. @item near
  14909. @item nearest
  14910. Nearest neighbour.
  14911. @item line
  14912. @item linear
  14913. Bilinear interpolation.
  14914. @item lagrange9
  14915. Lagrange9 interpolation.
  14916. @item cube
  14917. @item cubic
  14918. Bicubic interpolation.
  14919. @item lanc
  14920. @item lanczos
  14921. Lanczos interpolation.
  14922. @item sp16
  14923. @item spline16
  14924. Spline16 interpolation.
  14925. @item gauss
  14926. @item gaussian
  14927. Gaussian interpolation.
  14928. @item mitchell
  14929. Mitchell interpolation.
  14930. @end table
  14931. Default value is @b{@samp{line}}.
  14932. @item w
  14933. @item h
  14934. Set the output video resolution.
  14935. Default resolution depends on formats.
  14936. @item in_stereo
  14937. @item out_stereo
  14938. Set the input/output stereo format.
  14939. @table @samp
  14940. @item 2d
  14941. 2D mono
  14942. @item sbs
  14943. Side by side
  14944. @item tb
  14945. Top bottom
  14946. @end table
  14947. Default value is @b{@samp{2d}} for input and output format.
  14948. @item yaw
  14949. @item pitch
  14950. @item roll
  14951. Set rotation for the output video. Values in degrees.
  14952. @item rorder
  14953. Set rotation order for the output video. Choose one item for each position.
  14954. @table @samp
  14955. @item y, Y
  14956. yaw
  14957. @item p, P
  14958. pitch
  14959. @item r, R
  14960. roll
  14961. @end table
  14962. Default value is @b{@samp{ypr}}.
  14963. @item h_flip
  14964. @item v_flip
  14965. @item d_flip
  14966. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14967. @item ih_flip
  14968. @item iv_flip
  14969. Set if input video is flipped horizontally/vertically. Boolean values.
  14970. @item in_trans
  14971. Set if input video is transposed. Boolean value, by default disabled.
  14972. @item out_trans
  14973. Set if output video needs to be transposed. Boolean value, by default disabled.
  14974. @item alpha_mask
  14975. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14976. @end table
  14977. @subsection Examples
  14978. @itemize
  14979. @item
  14980. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14981. @example
  14982. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14983. @end example
  14984. @item
  14985. Extract back view of Equi-Angular Cubemap:
  14986. @example
  14987. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14988. @end example
  14989. @item
  14990. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14991. @example
  14992. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14993. @end example
  14994. @end itemize
  14995. @subsection Commands
  14996. This filter supports subset of above options as @ref{commands}.
  14997. @section vaguedenoiser
  14998. Apply a wavelet based denoiser.
  14999. It transforms each frame from the video input into the wavelet domain,
  15000. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15001. the obtained coefficients. It does an inverse wavelet transform after.
  15002. Due to wavelet properties, it should give a nice smoothed result, and
  15003. reduced noise, without blurring picture features.
  15004. This filter accepts the following options:
  15005. @table @option
  15006. @item threshold
  15007. The filtering strength. The higher, the more filtered the video will be.
  15008. Hard thresholding can use a higher threshold than soft thresholding
  15009. before the video looks overfiltered. Default value is 2.
  15010. @item method
  15011. The filtering method the filter will use.
  15012. It accepts the following values:
  15013. @table @samp
  15014. @item hard
  15015. All values under the threshold will be zeroed.
  15016. @item soft
  15017. All values under the threshold will be zeroed. All values above will be
  15018. reduced by the threshold.
  15019. @item garrote
  15020. Scales or nullifies coefficients - intermediary between (more) soft and
  15021. (less) hard thresholding.
  15022. @end table
  15023. Default is garrote.
  15024. @item nsteps
  15025. Number of times, the wavelet will decompose the picture. Picture can't
  15026. be decomposed beyond a particular point (typically, 8 for a 640x480
  15027. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15028. @item percent
  15029. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15030. @item planes
  15031. A list of the planes to process. By default all planes are processed.
  15032. @item type
  15033. The threshold type the filter will use.
  15034. It accepts the following values:
  15035. @table @samp
  15036. @item universal
  15037. Threshold used is same for all decompositions.
  15038. @item bayes
  15039. Threshold used depends also on each decomposition coefficients.
  15040. @end table
  15041. Default is universal.
  15042. @end table
  15043. @section vectorscope
  15044. Display 2 color component values in the two dimensional graph (which is called
  15045. a vectorscope).
  15046. This filter accepts the following options:
  15047. @table @option
  15048. @item mode, m
  15049. Set vectorscope mode.
  15050. It accepts the following values:
  15051. @table @samp
  15052. @item gray
  15053. @item tint
  15054. Gray values are displayed on graph, higher brightness means more pixels have
  15055. same component color value on location in graph. This is the default mode.
  15056. @item color
  15057. Gray values are displayed on graph. Surrounding pixels values which are not
  15058. present in video frame are drawn in gradient of 2 color components which are
  15059. set by option @code{x} and @code{y}. The 3rd color component is static.
  15060. @item color2
  15061. Actual color components values present in video frame are displayed on graph.
  15062. @item color3
  15063. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15064. on graph increases value of another color component, which is luminance by
  15065. default values of @code{x} and @code{y}.
  15066. @item color4
  15067. Actual colors present in video frame are displayed on graph. If two different
  15068. colors map to same position on graph then color with higher value of component
  15069. not present in graph is picked.
  15070. @item color5
  15071. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15072. component picked from radial gradient.
  15073. @end table
  15074. @item x
  15075. Set which color component will be represented on X-axis. Default is @code{1}.
  15076. @item y
  15077. Set which color component will be represented on Y-axis. Default is @code{2}.
  15078. @item intensity, i
  15079. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15080. of color component which represents frequency of (X, Y) location in graph.
  15081. @item envelope, e
  15082. @table @samp
  15083. @item none
  15084. No envelope, this is default.
  15085. @item instant
  15086. Instant envelope, even darkest single pixel will be clearly highlighted.
  15087. @item peak
  15088. Hold maximum and minimum values presented in graph over time. This way you
  15089. can still spot out of range values without constantly looking at vectorscope.
  15090. @item peak+instant
  15091. Peak and instant envelope combined together.
  15092. @end table
  15093. @item graticule, g
  15094. Set what kind of graticule to draw.
  15095. @table @samp
  15096. @item none
  15097. @item green
  15098. @item color
  15099. @item invert
  15100. @end table
  15101. @item opacity, o
  15102. Set graticule opacity.
  15103. @item flags, f
  15104. Set graticule flags.
  15105. @table @samp
  15106. @item white
  15107. Draw graticule for white point.
  15108. @item black
  15109. Draw graticule for black point.
  15110. @item name
  15111. Draw color points short names.
  15112. @end table
  15113. @item bgopacity, b
  15114. Set background opacity.
  15115. @item lthreshold, l
  15116. Set low threshold for color component not represented on X or Y axis.
  15117. Values lower than this value will be ignored. Default is 0.
  15118. Note this value is multiplied with actual max possible value one pixel component
  15119. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15120. is 0.1 * 255 = 25.
  15121. @item hthreshold, h
  15122. Set high threshold for color component not represented on X or Y axis.
  15123. Values higher than this value will be ignored. Default is 1.
  15124. Note this value is multiplied with actual max possible value one pixel component
  15125. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15126. is 0.9 * 255 = 230.
  15127. @item colorspace, c
  15128. Set what kind of colorspace to use when drawing graticule.
  15129. @table @samp
  15130. @item auto
  15131. @item 601
  15132. @item 709
  15133. @end table
  15134. Default is auto.
  15135. @item tint0, t0
  15136. @item tint1, t1
  15137. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15138. This means no tint, and output will remain gray.
  15139. @end table
  15140. @anchor{vidstabdetect}
  15141. @section vidstabdetect
  15142. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15143. @ref{vidstabtransform} for pass 2.
  15144. This filter generates a file with relative translation and rotation
  15145. transform information about subsequent frames, which is then used by
  15146. the @ref{vidstabtransform} filter.
  15147. To enable compilation of this filter you need to configure FFmpeg with
  15148. @code{--enable-libvidstab}.
  15149. This filter accepts the following options:
  15150. @table @option
  15151. @item result
  15152. Set the path to the file used to write the transforms information.
  15153. Default value is @file{transforms.trf}.
  15154. @item shakiness
  15155. Set how shaky the video is and how quick the camera is. It accepts an
  15156. integer in the range 1-10, a value of 1 means little shakiness, a
  15157. value of 10 means strong shakiness. Default value is 5.
  15158. @item accuracy
  15159. Set the accuracy of the detection process. It must be a value in the
  15160. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15161. accuracy. Default value is 15.
  15162. @item stepsize
  15163. Set stepsize of the search process. The region around minimum is
  15164. scanned with 1 pixel resolution. Default value is 6.
  15165. @item mincontrast
  15166. Set minimum contrast. Below this value a local measurement field is
  15167. discarded. Must be a floating point value in the range 0-1. Default
  15168. value is 0.3.
  15169. @item tripod
  15170. Set reference frame number for tripod mode.
  15171. If enabled, the motion of the frames is compared to a reference frame
  15172. in the filtered stream, identified by the specified number. The idea
  15173. is to compensate all movements in a more-or-less static scene and keep
  15174. the camera view absolutely still.
  15175. If set to 0, it is disabled. The frames are counted starting from 1.
  15176. @item show
  15177. Show fields and transforms in the resulting frames. It accepts an
  15178. integer in the range 0-2. Default value is 0, which disables any
  15179. visualization.
  15180. @end table
  15181. @subsection Examples
  15182. @itemize
  15183. @item
  15184. Use default values:
  15185. @example
  15186. vidstabdetect
  15187. @end example
  15188. @item
  15189. Analyze strongly shaky movie and put the results in file
  15190. @file{mytransforms.trf}:
  15191. @example
  15192. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15193. @end example
  15194. @item
  15195. Visualize the result of internal transformations in the resulting
  15196. video:
  15197. @example
  15198. vidstabdetect=show=1
  15199. @end example
  15200. @item
  15201. Analyze a video with medium shakiness using @command{ffmpeg}:
  15202. @example
  15203. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15204. @end example
  15205. @end itemize
  15206. @anchor{vidstabtransform}
  15207. @section vidstabtransform
  15208. Video stabilization/deshaking: pass 2 of 2,
  15209. see @ref{vidstabdetect} for pass 1.
  15210. Read a file with transform information for each frame and
  15211. apply/compensate them. Together with the @ref{vidstabdetect}
  15212. filter this can be used to deshake videos. See also
  15213. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15214. the @ref{unsharp} filter, see below.
  15215. To enable compilation of this filter you need to configure FFmpeg with
  15216. @code{--enable-libvidstab}.
  15217. @subsection Options
  15218. @table @option
  15219. @item input
  15220. Set path to the file used to read the transforms. Default value is
  15221. @file{transforms.trf}.
  15222. @item smoothing
  15223. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15224. camera movements. Default value is 10.
  15225. For example a number of 10 means that 21 frames are used (10 in the
  15226. past and 10 in the future) to smoothen the motion in the video. A
  15227. larger value leads to a smoother video, but limits the acceleration of
  15228. the camera (pan/tilt movements). 0 is a special case where a static
  15229. camera is simulated.
  15230. @item optalgo
  15231. Set the camera path optimization algorithm.
  15232. Accepted values are:
  15233. @table @samp
  15234. @item gauss
  15235. gaussian kernel low-pass filter on camera motion (default)
  15236. @item avg
  15237. averaging on transformations
  15238. @end table
  15239. @item maxshift
  15240. Set maximal number of pixels to translate frames. Default value is -1,
  15241. meaning no limit.
  15242. @item maxangle
  15243. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15244. value is -1, meaning no limit.
  15245. @item crop
  15246. Specify how to deal with borders that may be visible due to movement
  15247. compensation.
  15248. Available values are:
  15249. @table @samp
  15250. @item keep
  15251. keep image information from previous frame (default)
  15252. @item black
  15253. fill the border black
  15254. @end table
  15255. @item invert
  15256. Invert transforms if set to 1. Default value is 0.
  15257. @item relative
  15258. Consider transforms as relative to previous frame if set to 1,
  15259. absolute if set to 0. Default value is 0.
  15260. @item zoom
  15261. Set percentage to zoom. A positive value will result in a zoom-in
  15262. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15263. zoom).
  15264. @item optzoom
  15265. Set optimal zooming to avoid borders.
  15266. Accepted values are:
  15267. @table @samp
  15268. @item 0
  15269. disabled
  15270. @item 1
  15271. optimal static zoom value is determined (only very strong movements
  15272. will lead to visible borders) (default)
  15273. @item 2
  15274. optimal adaptive zoom value is determined (no borders will be
  15275. visible), see @option{zoomspeed}
  15276. @end table
  15277. Note that the value given at zoom is added to the one calculated here.
  15278. @item zoomspeed
  15279. Set percent to zoom maximally each frame (enabled when
  15280. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15281. 0.25.
  15282. @item interpol
  15283. Specify type of interpolation.
  15284. Available values are:
  15285. @table @samp
  15286. @item no
  15287. no interpolation
  15288. @item linear
  15289. linear only horizontal
  15290. @item bilinear
  15291. linear in both directions (default)
  15292. @item bicubic
  15293. cubic in both directions (slow)
  15294. @end table
  15295. @item tripod
  15296. Enable virtual tripod mode if set to 1, which is equivalent to
  15297. @code{relative=0:smoothing=0}. Default value is 0.
  15298. Use also @code{tripod} option of @ref{vidstabdetect}.
  15299. @item debug
  15300. Increase log verbosity if set to 1. Also the detected global motions
  15301. are written to the temporary file @file{global_motions.trf}. Default
  15302. value is 0.
  15303. @end table
  15304. @subsection Examples
  15305. @itemize
  15306. @item
  15307. Use @command{ffmpeg} for a typical stabilization with default values:
  15308. @example
  15309. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15310. @end example
  15311. Note the use of the @ref{unsharp} filter which is always recommended.
  15312. @item
  15313. Zoom in a bit more and load transform data from a given file:
  15314. @example
  15315. vidstabtransform=zoom=5:input="mytransforms.trf"
  15316. @end example
  15317. @item
  15318. Smoothen the video even more:
  15319. @example
  15320. vidstabtransform=smoothing=30
  15321. @end example
  15322. @end itemize
  15323. @section vflip
  15324. Flip the input video vertically.
  15325. For example, to vertically flip a video with @command{ffmpeg}:
  15326. @example
  15327. ffmpeg -i in.avi -vf "vflip" out.avi
  15328. @end example
  15329. @section vfrdet
  15330. Detect variable frame rate video.
  15331. This filter tries to detect if the input is variable or constant frame rate.
  15332. At end it will output number of frames detected as having variable delta pts,
  15333. and ones with constant delta pts.
  15334. If there was frames with variable delta, than it will also show min, max and
  15335. average delta encountered.
  15336. @section vibrance
  15337. Boost or alter saturation.
  15338. The filter accepts the following options:
  15339. @table @option
  15340. @item intensity
  15341. Set strength of boost if positive value or strength of alter if negative value.
  15342. Default is 0. Allowed range is from -2 to 2.
  15343. @item rbal
  15344. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15345. @item gbal
  15346. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15347. @item bbal
  15348. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15349. @item rlum
  15350. Set the red luma coefficient.
  15351. @item glum
  15352. Set the green luma coefficient.
  15353. @item blum
  15354. Set the blue luma coefficient.
  15355. @item alternate
  15356. If @code{intensity} is negative and this is set to 1, colors will change,
  15357. otherwise colors will be less saturated, more towards gray.
  15358. @end table
  15359. @subsection Commands
  15360. This filter supports the all above options as @ref{commands}.
  15361. @anchor{vignette}
  15362. @section vignette
  15363. Make or reverse a natural vignetting effect.
  15364. The filter accepts the following options:
  15365. @table @option
  15366. @item angle, a
  15367. Set lens angle expression as a number of radians.
  15368. The value is clipped in the @code{[0,PI/2]} range.
  15369. Default value: @code{"PI/5"}
  15370. @item x0
  15371. @item y0
  15372. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15373. by default.
  15374. @item mode
  15375. Set forward/backward mode.
  15376. Available modes are:
  15377. @table @samp
  15378. @item forward
  15379. The larger the distance from the central point, the darker the image becomes.
  15380. @item backward
  15381. The larger the distance from the central point, the brighter the image becomes.
  15382. This can be used to reverse a vignette effect, though there is no automatic
  15383. detection to extract the lens @option{angle} and other settings (yet). It can
  15384. also be used to create a burning effect.
  15385. @end table
  15386. Default value is @samp{forward}.
  15387. @item eval
  15388. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15389. It accepts the following values:
  15390. @table @samp
  15391. @item init
  15392. Evaluate expressions only once during the filter initialization.
  15393. @item frame
  15394. Evaluate expressions for each incoming frame. This is way slower than the
  15395. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15396. allows advanced dynamic expressions.
  15397. @end table
  15398. Default value is @samp{init}.
  15399. @item dither
  15400. Set dithering to reduce the circular banding effects. Default is @code{1}
  15401. (enabled).
  15402. @item aspect
  15403. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15404. Setting this value to the SAR of the input will make a rectangular vignetting
  15405. following the dimensions of the video.
  15406. Default is @code{1/1}.
  15407. @end table
  15408. @subsection Expressions
  15409. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15410. following parameters.
  15411. @table @option
  15412. @item w
  15413. @item h
  15414. input width and height
  15415. @item n
  15416. the number of input frame, starting from 0
  15417. @item pts
  15418. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15419. @var{TB} units, NAN if undefined
  15420. @item r
  15421. frame rate of the input video, NAN if the input frame rate is unknown
  15422. @item t
  15423. the PTS (Presentation TimeStamp) of the filtered video frame,
  15424. expressed in seconds, NAN if undefined
  15425. @item tb
  15426. time base of the input video
  15427. @end table
  15428. @subsection Examples
  15429. @itemize
  15430. @item
  15431. Apply simple strong vignetting effect:
  15432. @example
  15433. vignette=PI/4
  15434. @end example
  15435. @item
  15436. Make a flickering vignetting:
  15437. @example
  15438. vignette='PI/4+random(1)*PI/50':eval=frame
  15439. @end example
  15440. @end itemize
  15441. @section vmafmotion
  15442. Obtain the average VMAF motion score of a video.
  15443. It is one of the component metrics of VMAF.
  15444. The obtained average motion score is printed through the logging system.
  15445. The filter accepts the following options:
  15446. @table @option
  15447. @item stats_file
  15448. If specified, the filter will use the named file to save the motion score of
  15449. each frame with respect to the previous frame.
  15450. When filename equals "-" the data is sent to standard output.
  15451. @end table
  15452. Example:
  15453. @example
  15454. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15455. @end example
  15456. @section vstack
  15457. Stack input videos vertically.
  15458. All streams must be of same pixel format and of same width.
  15459. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15460. to create same output.
  15461. The filter accepts the following options:
  15462. @table @option
  15463. @item inputs
  15464. Set number of input streams. Default is 2.
  15465. @item shortest
  15466. If set to 1, force the output to terminate when the shortest input
  15467. terminates. Default value is 0.
  15468. @end table
  15469. @section w3fdif
  15470. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15471. Deinterlacing Filter").
  15472. Based on the process described by Martin Weston for BBC R&D, and
  15473. implemented based on the de-interlace algorithm written by Jim
  15474. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15475. uses filter coefficients calculated by BBC R&D.
  15476. This filter uses field-dominance information in frame to decide which
  15477. of each pair of fields to place first in the output.
  15478. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15479. There are two sets of filter coefficients, so called "simple"
  15480. and "complex". Which set of filter coefficients is used can
  15481. be set by passing an optional parameter:
  15482. @table @option
  15483. @item filter
  15484. Set the interlacing filter coefficients. Accepts one of the following values:
  15485. @table @samp
  15486. @item simple
  15487. Simple filter coefficient set.
  15488. @item complex
  15489. More-complex filter coefficient set.
  15490. @end table
  15491. Default value is @samp{complex}.
  15492. @item deint
  15493. Specify which frames to deinterlace. Accepts one of the following values:
  15494. @table @samp
  15495. @item all
  15496. Deinterlace all frames,
  15497. @item interlaced
  15498. Only deinterlace frames marked as interlaced.
  15499. @end table
  15500. Default value is @samp{all}.
  15501. @end table
  15502. @section waveform
  15503. Video waveform monitor.
  15504. The waveform monitor plots color component intensity. By default luminance
  15505. only. Each column of the waveform corresponds to a column of pixels in the
  15506. source video.
  15507. It accepts the following options:
  15508. @table @option
  15509. @item mode, m
  15510. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15511. In row mode, the graph on the left side represents color component value 0 and
  15512. the right side represents value = 255. In column mode, the top side represents
  15513. color component value = 0 and bottom side represents value = 255.
  15514. @item intensity, i
  15515. Set intensity. Smaller values are useful to find out how many values of the same
  15516. luminance are distributed across input rows/columns.
  15517. Default value is @code{0.04}. Allowed range is [0, 1].
  15518. @item mirror, r
  15519. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15520. In mirrored mode, higher values will be represented on the left
  15521. side for @code{row} mode and at the top for @code{column} mode. Default is
  15522. @code{1} (mirrored).
  15523. @item display, d
  15524. Set display mode.
  15525. It accepts the following values:
  15526. @table @samp
  15527. @item overlay
  15528. Presents information identical to that in the @code{parade}, except
  15529. that the graphs representing color components are superimposed directly
  15530. over one another.
  15531. This display mode makes it easier to spot relative differences or similarities
  15532. in overlapping areas of the color components that are supposed to be identical,
  15533. such as neutral whites, grays, or blacks.
  15534. @item stack
  15535. Display separate graph for the color components side by side in
  15536. @code{row} mode or one below the other in @code{column} mode.
  15537. @item parade
  15538. Display separate graph for the color components side by side in
  15539. @code{column} mode or one below the other in @code{row} mode.
  15540. Using this display mode makes it easy to spot color casts in the highlights
  15541. and shadows of an image, by comparing the contours of the top and the bottom
  15542. graphs of each waveform. Since whites, grays, and blacks are characterized
  15543. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15544. should display three waveforms of roughly equal width/height. If not, the
  15545. correction is easy to perform by making level adjustments the three waveforms.
  15546. @end table
  15547. Default is @code{stack}.
  15548. @item components, c
  15549. Set which color components to display. Default is 1, which means only luminance
  15550. or red color component if input is in RGB colorspace. If is set for example to
  15551. 7 it will display all 3 (if) available color components.
  15552. @item envelope, e
  15553. @table @samp
  15554. @item none
  15555. No envelope, this is default.
  15556. @item instant
  15557. Instant envelope, minimum and maximum values presented in graph will be easily
  15558. visible even with small @code{step} value.
  15559. @item peak
  15560. Hold minimum and maximum values presented in graph across time. This way you
  15561. can still spot out of range values without constantly looking at waveforms.
  15562. @item peak+instant
  15563. Peak and instant envelope combined together.
  15564. @end table
  15565. @item filter, f
  15566. @table @samp
  15567. @item lowpass
  15568. No filtering, this is default.
  15569. @item flat
  15570. Luma and chroma combined together.
  15571. @item aflat
  15572. Similar as above, but shows difference between blue and red chroma.
  15573. @item xflat
  15574. Similar as above, but use different colors.
  15575. @item yflat
  15576. Similar as above, but again with different colors.
  15577. @item chroma
  15578. Displays only chroma.
  15579. @item color
  15580. Displays actual color value on waveform.
  15581. @item acolor
  15582. Similar as above, but with luma showing frequency of chroma values.
  15583. @end table
  15584. @item graticule, g
  15585. Set which graticule to display.
  15586. @table @samp
  15587. @item none
  15588. Do not display graticule.
  15589. @item green
  15590. Display green graticule showing legal broadcast ranges.
  15591. @item orange
  15592. Display orange graticule showing legal broadcast ranges.
  15593. @item invert
  15594. Display invert graticule showing legal broadcast ranges.
  15595. @end table
  15596. @item opacity, o
  15597. Set graticule opacity.
  15598. @item flags, fl
  15599. Set graticule flags.
  15600. @table @samp
  15601. @item numbers
  15602. Draw numbers above lines. By default enabled.
  15603. @item dots
  15604. Draw dots instead of lines.
  15605. @end table
  15606. @item scale, s
  15607. Set scale used for displaying graticule.
  15608. @table @samp
  15609. @item digital
  15610. @item millivolts
  15611. @item ire
  15612. @end table
  15613. Default is digital.
  15614. @item bgopacity, b
  15615. Set background opacity.
  15616. @item tint0, t0
  15617. @item tint1, t1
  15618. Set tint for output.
  15619. Only used with lowpass filter and when display is not overlay and input
  15620. pixel formats are not RGB.
  15621. @end table
  15622. @section weave, doubleweave
  15623. The @code{weave} takes a field-based video input and join
  15624. each two sequential fields into single frame, producing a new double
  15625. height clip with half the frame rate and half the frame count.
  15626. The @code{doubleweave} works same as @code{weave} but without
  15627. halving frame rate and frame count.
  15628. It accepts the following option:
  15629. @table @option
  15630. @item first_field
  15631. Set first field. Available values are:
  15632. @table @samp
  15633. @item top, t
  15634. Set the frame as top-field-first.
  15635. @item bottom, b
  15636. Set the frame as bottom-field-first.
  15637. @end table
  15638. @end table
  15639. @subsection Examples
  15640. @itemize
  15641. @item
  15642. Interlace video using @ref{select} and @ref{separatefields} filter:
  15643. @example
  15644. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15645. @end example
  15646. @end itemize
  15647. @section xbr
  15648. Apply the xBR high-quality magnification filter which is designed for pixel
  15649. art. It follows a set of edge-detection rules, see
  15650. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15651. It accepts the following option:
  15652. @table @option
  15653. @item n
  15654. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15655. @code{3xBR} and @code{4} for @code{4xBR}.
  15656. Default is @code{3}.
  15657. @end table
  15658. @section xfade
  15659. Apply cross fade from one input video stream to another input video stream.
  15660. The cross fade is applied for specified duration.
  15661. The filter accepts the following options:
  15662. @table @option
  15663. @item transition
  15664. Set one of available transition effects:
  15665. @table @samp
  15666. @item custom
  15667. @item fade
  15668. @item wipeleft
  15669. @item wiperight
  15670. @item wipeup
  15671. @item wipedown
  15672. @item slideleft
  15673. @item slideright
  15674. @item slideup
  15675. @item slidedown
  15676. @item circlecrop
  15677. @item rectcrop
  15678. @item distance
  15679. @item fadeblack
  15680. @item fadewhite
  15681. @item radial
  15682. @item smoothleft
  15683. @item smoothright
  15684. @item smoothup
  15685. @item smoothdown
  15686. @item circleopen
  15687. @item circleclose
  15688. @item vertopen
  15689. @item vertclose
  15690. @item horzopen
  15691. @item horzclose
  15692. @item dissolve
  15693. @item pixelize
  15694. @item diagtl
  15695. @item diagtr
  15696. @item diagbl
  15697. @item diagbr
  15698. @item hlslice
  15699. @item hrslice
  15700. @item vuslice
  15701. @item vdslice
  15702. @item hblur
  15703. @item fadegrays
  15704. @item wipetl
  15705. @item wipetr
  15706. @item wipebl
  15707. @item wipebr
  15708. @end table
  15709. Default transition effect is fade.
  15710. @item duration
  15711. Set cross fade duration in seconds.
  15712. Default duration is 1 second.
  15713. @item offset
  15714. Set cross fade start relative to first input stream in seconds.
  15715. Default offset is 0.
  15716. @item expr
  15717. Set expression for custom transition effect.
  15718. The expressions can use the following variables and functions:
  15719. @table @option
  15720. @item X
  15721. @item Y
  15722. The coordinates of the current sample.
  15723. @item W
  15724. @item H
  15725. The width and height of the image.
  15726. @item P
  15727. Progress of transition effect.
  15728. @item PLANE
  15729. Currently processed plane.
  15730. @item A
  15731. Return value of first input at current location and plane.
  15732. @item B
  15733. Return value of second input at current location and plane.
  15734. @item a0(x, y)
  15735. @item a1(x, y)
  15736. @item a2(x, y)
  15737. @item a3(x, y)
  15738. Return the value of the pixel at location (@var{x},@var{y}) of the
  15739. first/second/third/fourth component of first input.
  15740. @item b0(x, y)
  15741. @item b1(x, y)
  15742. @item b2(x, y)
  15743. @item b3(x, y)
  15744. Return the value of the pixel at location (@var{x},@var{y}) of the
  15745. first/second/third/fourth component of second input.
  15746. @end table
  15747. @end table
  15748. @subsection Examples
  15749. @itemize
  15750. @item
  15751. Cross fade from one input video to another input video, with fade transition and duration of transition
  15752. of 2 seconds starting at offset of 5 seconds:
  15753. @example
  15754. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15755. @end example
  15756. @end itemize
  15757. @section xmedian
  15758. Pick median pixels from several input videos.
  15759. The filter accepts the following options:
  15760. @table @option
  15761. @item inputs
  15762. Set number of inputs.
  15763. Default is 3. Allowed range is from 3 to 255.
  15764. If number of inputs is even number, than result will be mean value between two median values.
  15765. @item planes
  15766. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15767. @item percentile
  15768. Set median percentile. Default value is @code{0.5}.
  15769. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15770. minimum values, and @code{1} maximum values.
  15771. @end table
  15772. @section xstack
  15773. Stack video inputs into custom layout.
  15774. All streams must be of same pixel format.
  15775. The filter accepts the following options:
  15776. @table @option
  15777. @item inputs
  15778. Set number of input streams. Default is 2.
  15779. @item layout
  15780. Specify layout of inputs.
  15781. This option requires the desired layout configuration to be explicitly set by the user.
  15782. This sets position of each video input in output. Each input
  15783. is separated by '|'.
  15784. The first number represents the column, and the second number represents the row.
  15785. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15786. where X is video input from which to take width or height.
  15787. Multiple values can be used when separated by '+'. In such
  15788. case values are summed together.
  15789. Note that if inputs are of different sizes gaps may appear, as not all of
  15790. the output video frame will be filled. Similarly, videos can overlap each
  15791. other if their position doesn't leave enough space for the full frame of
  15792. adjoining videos.
  15793. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15794. a layout must be set by the user.
  15795. @item shortest
  15796. If set to 1, force the output to terminate when the shortest input
  15797. terminates. Default value is 0.
  15798. @item fill
  15799. If set to valid color, all unused pixels will be filled with that color.
  15800. By default fill is set to none, so it is disabled.
  15801. @end table
  15802. @subsection Examples
  15803. @itemize
  15804. @item
  15805. Display 4 inputs into 2x2 grid.
  15806. Layout:
  15807. @example
  15808. input1(0, 0) | input3(w0, 0)
  15809. input2(0, h0) | input4(w0, h0)
  15810. @end example
  15811. @example
  15812. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15813. @end example
  15814. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15815. @item
  15816. Display 4 inputs into 1x4 grid.
  15817. Layout:
  15818. @example
  15819. input1(0, 0)
  15820. input2(0, h0)
  15821. input3(0, h0+h1)
  15822. input4(0, h0+h1+h2)
  15823. @end example
  15824. @example
  15825. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15826. @end example
  15827. Note that if inputs are of different widths, unused space will appear.
  15828. @item
  15829. Display 9 inputs into 3x3 grid.
  15830. Layout:
  15831. @example
  15832. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15833. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15834. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15835. @end example
  15836. @example
  15837. 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
  15838. @end example
  15839. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15840. @item
  15841. Display 16 inputs into 4x4 grid.
  15842. Layout:
  15843. @example
  15844. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15845. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15846. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15847. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15848. @end example
  15849. @example
  15850. 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|
  15851. 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
  15852. @end example
  15853. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15854. @end itemize
  15855. @anchor{yadif}
  15856. @section yadif
  15857. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15858. filter").
  15859. It accepts the following parameters:
  15860. @table @option
  15861. @item mode
  15862. The interlacing mode to adopt. It accepts one of the following values:
  15863. @table @option
  15864. @item 0, send_frame
  15865. Output one frame for each frame.
  15866. @item 1, send_field
  15867. Output one frame for each field.
  15868. @item 2, send_frame_nospatial
  15869. Like @code{send_frame}, but it skips the spatial interlacing check.
  15870. @item 3, send_field_nospatial
  15871. Like @code{send_field}, but it skips the spatial interlacing check.
  15872. @end table
  15873. The default value is @code{send_frame}.
  15874. @item parity
  15875. The picture field parity assumed for the input interlaced video. It accepts one
  15876. of the following values:
  15877. @table @option
  15878. @item 0, tff
  15879. Assume the top field is first.
  15880. @item 1, bff
  15881. Assume the bottom field is first.
  15882. @item -1, auto
  15883. Enable automatic detection of field parity.
  15884. @end table
  15885. The default value is @code{auto}.
  15886. If the interlacing is unknown or the decoder does not export this information,
  15887. top field first will be assumed.
  15888. @item deint
  15889. Specify which frames to deinterlace. Accepts one of the following
  15890. values:
  15891. @table @option
  15892. @item 0, all
  15893. Deinterlace all frames.
  15894. @item 1, interlaced
  15895. Only deinterlace frames marked as interlaced.
  15896. @end table
  15897. The default value is @code{all}.
  15898. @end table
  15899. @section yadif_cuda
  15900. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15901. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15902. and/or nvenc.
  15903. It accepts the following parameters:
  15904. @table @option
  15905. @item mode
  15906. The interlacing mode to adopt. It accepts one of the following values:
  15907. @table @option
  15908. @item 0, send_frame
  15909. Output one frame for each frame.
  15910. @item 1, send_field
  15911. Output one frame for each field.
  15912. @item 2, send_frame_nospatial
  15913. Like @code{send_frame}, but it skips the spatial interlacing check.
  15914. @item 3, send_field_nospatial
  15915. Like @code{send_field}, but it skips the spatial interlacing check.
  15916. @end table
  15917. The default value is @code{send_frame}.
  15918. @item parity
  15919. The picture field parity assumed for the input interlaced video. It accepts one
  15920. of the following values:
  15921. @table @option
  15922. @item 0, tff
  15923. Assume the top field is first.
  15924. @item 1, bff
  15925. Assume the bottom field is first.
  15926. @item -1, auto
  15927. Enable automatic detection of field parity.
  15928. @end table
  15929. The default value is @code{auto}.
  15930. If the interlacing is unknown or the decoder does not export this information,
  15931. top field first will be assumed.
  15932. @item deint
  15933. Specify which frames to deinterlace. Accepts one of the following
  15934. values:
  15935. @table @option
  15936. @item 0, all
  15937. Deinterlace all frames.
  15938. @item 1, interlaced
  15939. Only deinterlace frames marked as interlaced.
  15940. @end table
  15941. The default value is @code{all}.
  15942. @end table
  15943. @section yaepblur
  15944. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15945. The algorithm is described in
  15946. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15947. It accepts the following parameters:
  15948. @table @option
  15949. @item radius, r
  15950. Set the window radius. Default value is 3.
  15951. @item planes, p
  15952. Set which planes to filter. Default is only the first plane.
  15953. @item sigma, s
  15954. Set blur strength. Default value is 128.
  15955. @end table
  15956. @subsection Commands
  15957. This filter supports same @ref{commands} as options.
  15958. @section zoompan
  15959. Apply Zoom & Pan effect.
  15960. This filter accepts the following options:
  15961. @table @option
  15962. @item zoom, z
  15963. Set the zoom expression. Range is 1-10. Default is 1.
  15964. @item x
  15965. @item y
  15966. Set the x and y expression. Default is 0.
  15967. @item d
  15968. Set the duration expression in number of frames.
  15969. This sets for how many number of frames effect will last for
  15970. single input image.
  15971. @item s
  15972. Set the output image size, default is 'hd720'.
  15973. @item fps
  15974. Set the output frame rate, default is '25'.
  15975. @end table
  15976. Each expression can contain the following constants:
  15977. @table @option
  15978. @item in_w, iw
  15979. Input width.
  15980. @item in_h, ih
  15981. Input height.
  15982. @item out_w, ow
  15983. Output width.
  15984. @item out_h, oh
  15985. Output height.
  15986. @item in
  15987. Input frame count.
  15988. @item on
  15989. Output frame count.
  15990. @item in_time, it
  15991. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  15992. @item out_time, time, ot
  15993. The output timestamp expressed in seconds.
  15994. @item x
  15995. @item y
  15996. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15997. for current input frame.
  15998. @item px
  15999. @item py
  16000. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16001. not yet such frame (first input frame).
  16002. @item zoom
  16003. Last calculated zoom from 'z' expression for current input frame.
  16004. @item pzoom
  16005. Last calculated zoom of last output frame of previous input frame.
  16006. @item duration
  16007. Number of output frames for current input frame. Calculated from 'd' expression
  16008. for each input frame.
  16009. @item pduration
  16010. number of output frames created for previous input frame
  16011. @item a
  16012. Rational number: input width / input height
  16013. @item sar
  16014. sample aspect ratio
  16015. @item dar
  16016. display aspect ratio
  16017. @end table
  16018. @subsection Examples
  16019. @itemize
  16020. @item
  16021. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16022. @example
  16023. 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
  16024. @end example
  16025. @item
  16026. Zoom in up to 1.5x and pan always at center of picture:
  16027. @example
  16028. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16029. @end example
  16030. @item
  16031. Same as above but without pausing:
  16032. @example
  16033. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16034. @end example
  16035. @item
  16036. Zoom in 2x into center of picture only for the first second of the input video:
  16037. @example
  16038. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16039. @end example
  16040. @end itemize
  16041. @anchor{zscale}
  16042. @section zscale
  16043. Scale (resize) the input video, using the z.lib library:
  16044. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16045. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16046. The zscale filter forces the output display aspect ratio to be the same
  16047. as the input, by changing the output sample aspect ratio.
  16048. If the input image format is different from the format requested by
  16049. the next filter, the zscale filter will convert the input to the
  16050. requested format.
  16051. @subsection Options
  16052. The filter accepts the following options.
  16053. @table @option
  16054. @item width, w
  16055. @item height, h
  16056. Set the output video dimension expression. Default value is the input
  16057. dimension.
  16058. If the @var{width} or @var{w} value is 0, the input width is used for
  16059. the output. If the @var{height} or @var{h} value is 0, the input height
  16060. is used for the output.
  16061. If one and only one of the values is -n with n >= 1, the zscale filter
  16062. will use a value that maintains the aspect ratio of the input image,
  16063. calculated from the other specified dimension. After that it will,
  16064. however, make sure that the calculated dimension is divisible by n and
  16065. adjust the value if necessary.
  16066. If both values are -n with n >= 1, the behavior will be identical to
  16067. both values being set to 0 as previously detailed.
  16068. See below for the list of accepted constants for use in the dimension
  16069. expression.
  16070. @item size, s
  16071. Set the video size. For the syntax of this option, check the
  16072. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16073. @item dither, d
  16074. Set the dither type.
  16075. Possible values are:
  16076. @table @var
  16077. @item none
  16078. @item ordered
  16079. @item random
  16080. @item error_diffusion
  16081. @end table
  16082. Default is none.
  16083. @item filter, f
  16084. Set the resize filter type.
  16085. Possible values are:
  16086. @table @var
  16087. @item point
  16088. @item bilinear
  16089. @item bicubic
  16090. @item spline16
  16091. @item spline36
  16092. @item lanczos
  16093. @end table
  16094. Default is bilinear.
  16095. @item range, r
  16096. Set the color range.
  16097. Possible values are:
  16098. @table @var
  16099. @item input
  16100. @item limited
  16101. @item full
  16102. @end table
  16103. Default is same as input.
  16104. @item primaries, p
  16105. Set the color primaries.
  16106. Possible values are:
  16107. @table @var
  16108. @item input
  16109. @item 709
  16110. @item unspecified
  16111. @item 170m
  16112. @item 240m
  16113. @item 2020
  16114. @end table
  16115. Default is same as input.
  16116. @item transfer, t
  16117. Set the transfer characteristics.
  16118. Possible values are:
  16119. @table @var
  16120. @item input
  16121. @item 709
  16122. @item unspecified
  16123. @item 601
  16124. @item linear
  16125. @item 2020_10
  16126. @item 2020_12
  16127. @item smpte2084
  16128. @item iec61966-2-1
  16129. @item arib-std-b67
  16130. @end table
  16131. Default is same as input.
  16132. @item matrix, m
  16133. Set the colorspace matrix.
  16134. Possible value are:
  16135. @table @var
  16136. @item input
  16137. @item 709
  16138. @item unspecified
  16139. @item 470bg
  16140. @item 170m
  16141. @item 2020_ncl
  16142. @item 2020_cl
  16143. @end table
  16144. Default is same as input.
  16145. @item rangein, rin
  16146. Set the input color range.
  16147. Possible values are:
  16148. @table @var
  16149. @item input
  16150. @item limited
  16151. @item full
  16152. @end table
  16153. Default is same as input.
  16154. @item primariesin, pin
  16155. Set the input color primaries.
  16156. Possible values are:
  16157. @table @var
  16158. @item input
  16159. @item 709
  16160. @item unspecified
  16161. @item 170m
  16162. @item 240m
  16163. @item 2020
  16164. @end table
  16165. Default is same as input.
  16166. @item transferin, tin
  16167. Set the input transfer characteristics.
  16168. Possible values are:
  16169. @table @var
  16170. @item input
  16171. @item 709
  16172. @item unspecified
  16173. @item 601
  16174. @item linear
  16175. @item 2020_10
  16176. @item 2020_12
  16177. @end table
  16178. Default is same as input.
  16179. @item matrixin, min
  16180. Set the input colorspace matrix.
  16181. Possible value are:
  16182. @table @var
  16183. @item input
  16184. @item 709
  16185. @item unspecified
  16186. @item 470bg
  16187. @item 170m
  16188. @item 2020_ncl
  16189. @item 2020_cl
  16190. @end table
  16191. @item chromal, c
  16192. Set the output chroma location.
  16193. Possible values are:
  16194. @table @var
  16195. @item input
  16196. @item left
  16197. @item center
  16198. @item topleft
  16199. @item top
  16200. @item bottomleft
  16201. @item bottom
  16202. @end table
  16203. @item chromalin, cin
  16204. Set the input chroma location.
  16205. Possible values are:
  16206. @table @var
  16207. @item input
  16208. @item left
  16209. @item center
  16210. @item topleft
  16211. @item top
  16212. @item bottomleft
  16213. @item bottom
  16214. @end table
  16215. @item npl
  16216. Set the nominal peak luminance.
  16217. @end table
  16218. The values of the @option{w} and @option{h} options are expressions
  16219. containing the following constants:
  16220. @table @var
  16221. @item in_w
  16222. @item in_h
  16223. The input width and height
  16224. @item iw
  16225. @item ih
  16226. These are the same as @var{in_w} and @var{in_h}.
  16227. @item out_w
  16228. @item out_h
  16229. The output (scaled) width and height
  16230. @item ow
  16231. @item oh
  16232. These are the same as @var{out_w} and @var{out_h}
  16233. @item a
  16234. The same as @var{iw} / @var{ih}
  16235. @item sar
  16236. input sample aspect ratio
  16237. @item dar
  16238. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16239. @item hsub
  16240. @item vsub
  16241. horizontal and vertical input chroma subsample values. For example for the
  16242. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16243. @item ohsub
  16244. @item ovsub
  16245. horizontal and vertical output chroma subsample values. For example for the
  16246. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16247. @end table
  16248. @subsection Commands
  16249. This filter supports the following commands:
  16250. @table @option
  16251. @item width, w
  16252. @item height, h
  16253. Set the output video dimension expression.
  16254. The command accepts the same syntax of the corresponding option.
  16255. If the specified expression is not valid, it is kept at its current
  16256. value.
  16257. @end table
  16258. @c man end VIDEO FILTERS
  16259. @chapter OpenCL Video Filters
  16260. @c man begin OPENCL VIDEO FILTERS
  16261. Below is a description of the currently available OpenCL video filters.
  16262. To enable compilation of these filters you need to configure FFmpeg with
  16263. @code{--enable-opencl}.
  16264. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16265. @table @option
  16266. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16267. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16268. given device parameters.
  16269. @item -filter_hw_device @var{name}
  16270. Pass the hardware device called @var{name} to all filters in any filter graph.
  16271. @end table
  16272. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16273. @itemize
  16274. @item
  16275. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16276. @example
  16277. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16278. @end example
  16279. @end itemize
  16280. 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.
  16281. @section avgblur_opencl
  16282. Apply average blur filter.
  16283. The filter accepts the following options:
  16284. @table @option
  16285. @item sizeX
  16286. Set horizontal radius size.
  16287. Range is @code{[1, 1024]} and default value is @code{1}.
  16288. @item planes
  16289. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16290. @item sizeY
  16291. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16292. @end table
  16293. @subsection Example
  16294. @itemize
  16295. @item
  16296. 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.
  16297. @example
  16298. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16299. @end example
  16300. @end itemize
  16301. @section boxblur_opencl
  16302. Apply a boxblur algorithm to the input video.
  16303. It accepts the following parameters:
  16304. @table @option
  16305. @item luma_radius, lr
  16306. @item luma_power, lp
  16307. @item chroma_radius, cr
  16308. @item chroma_power, cp
  16309. @item alpha_radius, ar
  16310. @item alpha_power, ap
  16311. @end table
  16312. A description of the accepted options follows.
  16313. @table @option
  16314. @item luma_radius, lr
  16315. @item chroma_radius, cr
  16316. @item alpha_radius, ar
  16317. Set an expression for the box radius in pixels used for blurring the
  16318. corresponding input plane.
  16319. The radius value must be a non-negative number, and must not be
  16320. greater than the value of the expression @code{min(w,h)/2} for the
  16321. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16322. planes.
  16323. Default value for @option{luma_radius} is "2". If not specified,
  16324. @option{chroma_radius} and @option{alpha_radius} default to the
  16325. corresponding value set for @option{luma_radius}.
  16326. The expressions can contain the following constants:
  16327. @table @option
  16328. @item w
  16329. @item h
  16330. The input width and height in pixels.
  16331. @item cw
  16332. @item ch
  16333. The input chroma image width and height in pixels.
  16334. @item hsub
  16335. @item vsub
  16336. The horizontal and vertical chroma subsample values. For example, for the
  16337. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16338. @end table
  16339. @item luma_power, lp
  16340. @item chroma_power, cp
  16341. @item alpha_power, ap
  16342. Specify how many times the boxblur filter is applied to the
  16343. corresponding plane.
  16344. Default value for @option{luma_power} is 2. If not specified,
  16345. @option{chroma_power} and @option{alpha_power} default to the
  16346. corresponding value set for @option{luma_power}.
  16347. A value of 0 will disable the effect.
  16348. @end table
  16349. @subsection Examples
  16350. 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.
  16351. @itemize
  16352. @item
  16353. Apply a boxblur filter with the luma, chroma, and alpha radius
  16354. 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.
  16355. @example
  16356. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16357. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16358. @end example
  16359. @item
  16360. 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.
  16361. For the luma plane, a 2x2 box radius will be run once.
  16362. For the chroma plane, a 4x4 box radius will be run 5 times.
  16363. For the alpha plane, a 3x3 box radius will be run 7 times.
  16364. @example
  16365. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16366. @end example
  16367. @end itemize
  16368. @section colorkey_opencl
  16369. RGB colorspace color keying.
  16370. The filter accepts the following options:
  16371. @table @option
  16372. @item color
  16373. The color which will be replaced with transparency.
  16374. @item similarity
  16375. Similarity percentage with the key color.
  16376. 0.01 matches only the exact key color, while 1.0 matches everything.
  16377. @item blend
  16378. Blend percentage.
  16379. 0.0 makes pixels either fully transparent, or not transparent at all.
  16380. Higher values result in semi-transparent pixels, with a higher transparency
  16381. the more similar the pixels color is to the key color.
  16382. @end table
  16383. @subsection Examples
  16384. @itemize
  16385. @item
  16386. Make every semi-green pixel in the input transparent with some slight blending:
  16387. @example
  16388. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16389. @end example
  16390. @end itemize
  16391. @section convolution_opencl
  16392. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16393. The filter accepts the following options:
  16394. @table @option
  16395. @item 0m
  16396. @item 1m
  16397. @item 2m
  16398. @item 3m
  16399. Set matrix for each plane.
  16400. Matrix is sequence of 9, 25 or 49 signed numbers.
  16401. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16402. @item 0rdiv
  16403. @item 1rdiv
  16404. @item 2rdiv
  16405. @item 3rdiv
  16406. Set multiplier for calculated value for each plane.
  16407. If unset or 0, it will be sum of all matrix elements.
  16408. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16409. @item 0bias
  16410. @item 1bias
  16411. @item 2bias
  16412. @item 3bias
  16413. Set bias for each plane. This value is added to the result of the multiplication.
  16414. Useful for making the overall image brighter or darker.
  16415. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16416. @end table
  16417. @subsection Examples
  16418. @itemize
  16419. @item
  16420. Apply sharpen:
  16421. @example
  16422. -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
  16423. @end example
  16424. @item
  16425. Apply blur:
  16426. @example
  16427. -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
  16428. @end example
  16429. @item
  16430. Apply edge enhance:
  16431. @example
  16432. -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
  16433. @end example
  16434. @item
  16435. Apply edge detect:
  16436. @example
  16437. -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
  16438. @end example
  16439. @item
  16440. Apply laplacian edge detector which includes diagonals:
  16441. @example
  16442. -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
  16443. @end example
  16444. @item
  16445. Apply emboss:
  16446. @example
  16447. -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
  16448. @end example
  16449. @end itemize
  16450. @section erosion_opencl
  16451. Apply erosion effect to the video.
  16452. This filter replaces the pixel by the local(3x3) minimum.
  16453. It accepts the following options:
  16454. @table @option
  16455. @item threshold0
  16456. @item threshold1
  16457. @item threshold2
  16458. @item threshold3
  16459. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16460. If @code{0}, plane will remain unchanged.
  16461. @item coordinates
  16462. Flag which specifies the pixel to refer to.
  16463. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16464. Flags to local 3x3 coordinates region centered on @code{x}:
  16465. 1 2 3
  16466. 4 x 5
  16467. 6 7 8
  16468. @end table
  16469. @subsection Example
  16470. @itemize
  16471. @item
  16472. 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.
  16473. @example
  16474. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16475. @end example
  16476. @end itemize
  16477. @section deshake_opencl
  16478. Feature-point based video stabilization filter.
  16479. The filter accepts the following options:
  16480. @table @option
  16481. @item tripod
  16482. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16483. @item debug
  16484. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16485. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16486. Viewing point matches in the output video is only supported for RGB input.
  16487. Defaults to @code{0}.
  16488. @item adaptive_crop
  16489. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16490. Defaults to @code{1}.
  16491. @item refine_features
  16492. Whether or not feature points should be refined at a sub-pixel level.
  16493. This can be turned off for a slight performance gain at the cost of precision.
  16494. Defaults to @code{1}.
  16495. @item smooth_strength
  16496. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16497. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16498. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16499. Defaults to @code{0.0}.
  16500. @item smooth_window_multiplier
  16501. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16502. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16503. Acceptable values range from @code{0.1} to @code{10.0}.
  16504. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16505. potentially improving smoothness, but also increase latency and memory usage.
  16506. Defaults to @code{2.0}.
  16507. @end table
  16508. @subsection Examples
  16509. @itemize
  16510. @item
  16511. Stabilize a video with a fixed, medium smoothing strength:
  16512. @example
  16513. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16514. @end example
  16515. @item
  16516. Stabilize a video with debugging (both in console and in rendered video):
  16517. @example
  16518. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16519. @end example
  16520. @end itemize
  16521. @section dilation_opencl
  16522. Apply dilation effect to the video.
  16523. This filter replaces the pixel by the local(3x3) maximum.
  16524. It accepts the following options:
  16525. @table @option
  16526. @item threshold0
  16527. @item threshold1
  16528. @item threshold2
  16529. @item threshold3
  16530. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16531. If @code{0}, plane will remain unchanged.
  16532. @item coordinates
  16533. Flag which specifies the pixel to refer to.
  16534. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16535. Flags to local 3x3 coordinates region centered on @code{x}:
  16536. 1 2 3
  16537. 4 x 5
  16538. 6 7 8
  16539. @end table
  16540. @subsection Example
  16541. @itemize
  16542. @item
  16543. 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.
  16544. @example
  16545. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16546. @end example
  16547. @end itemize
  16548. @section nlmeans_opencl
  16549. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16550. @section overlay_opencl
  16551. Overlay one video on top of another.
  16552. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16553. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16554. The filter accepts the following options:
  16555. @table @option
  16556. @item x
  16557. Set the x coordinate of the overlaid video on the main video.
  16558. Default value is @code{0}.
  16559. @item y
  16560. Set the y coordinate of the overlaid video on the main video.
  16561. Default value is @code{0}.
  16562. @end table
  16563. @subsection Examples
  16564. @itemize
  16565. @item
  16566. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16567. @example
  16568. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16569. @end example
  16570. @item
  16571. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16572. @example
  16573. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16574. @end example
  16575. @end itemize
  16576. @section pad_opencl
  16577. Add paddings to the input image, and place the original input at the
  16578. provided @var{x}, @var{y} coordinates.
  16579. It accepts the following options:
  16580. @table @option
  16581. @item width, w
  16582. @item height, h
  16583. Specify an expression for the size of the output image with the
  16584. paddings added. If the value for @var{width} or @var{height} is 0, the
  16585. corresponding input size is used for the output.
  16586. The @var{width} expression can reference the value set by the
  16587. @var{height} expression, and vice versa.
  16588. The default value of @var{width} and @var{height} is 0.
  16589. @item x
  16590. @item y
  16591. Specify the offsets to place the input image at within the padded area,
  16592. with respect to the top/left border of the output image.
  16593. The @var{x} expression can reference the value set by the @var{y}
  16594. expression, and vice versa.
  16595. The default value of @var{x} and @var{y} is 0.
  16596. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16597. so the input image is centered on the padded area.
  16598. @item color
  16599. Specify the color of the padded area. For the syntax of this option,
  16600. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16601. manual,ffmpeg-utils}.
  16602. @item aspect
  16603. Pad to an aspect instead to a resolution.
  16604. @end table
  16605. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16606. options are expressions containing the following constants:
  16607. @table @option
  16608. @item in_w
  16609. @item in_h
  16610. The input video width and height.
  16611. @item iw
  16612. @item ih
  16613. These are the same as @var{in_w} and @var{in_h}.
  16614. @item out_w
  16615. @item out_h
  16616. The output width and height (the size of the padded area), as
  16617. specified by the @var{width} and @var{height} expressions.
  16618. @item ow
  16619. @item oh
  16620. These are the same as @var{out_w} and @var{out_h}.
  16621. @item x
  16622. @item y
  16623. The x and y offsets as specified by the @var{x} and @var{y}
  16624. expressions, or NAN if not yet specified.
  16625. @item a
  16626. same as @var{iw} / @var{ih}
  16627. @item sar
  16628. input sample aspect ratio
  16629. @item dar
  16630. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16631. @end table
  16632. @section prewitt_opencl
  16633. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16634. The filter accepts the following option:
  16635. @table @option
  16636. @item planes
  16637. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16638. @item scale
  16639. Set value which will be multiplied with filtered result.
  16640. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16641. @item delta
  16642. Set value which will be added to filtered result.
  16643. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16644. @end table
  16645. @subsection Example
  16646. @itemize
  16647. @item
  16648. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16649. @example
  16650. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16651. @end example
  16652. @end itemize
  16653. @anchor{program_opencl}
  16654. @section program_opencl
  16655. Filter video using an OpenCL program.
  16656. @table @option
  16657. @item source
  16658. OpenCL program source file.
  16659. @item kernel
  16660. Kernel name in program.
  16661. @item inputs
  16662. Number of inputs to the filter. Defaults to 1.
  16663. @item size, s
  16664. Size of output frames. Defaults to the same as the first input.
  16665. @end table
  16666. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16667. The program source file must contain a kernel function with the given name,
  16668. which will be run once for each plane of the output. Each run on a plane
  16669. gets enqueued as a separate 2D global NDRange with one work-item for each
  16670. pixel to be generated. The global ID offset for each work-item is therefore
  16671. the coordinates of a pixel in the destination image.
  16672. The kernel function needs to take the following arguments:
  16673. @itemize
  16674. @item
  16675. Destination image, @var{__write_only image2d_t}.
  16676. This image will become the output; the kernel should write all of it.
  16677. @item
  16678. Frame index, @var{unsigned int}.
  16679. This is a counter starting from zero and increasing by one for each frame.
  16680. @item
  16681. Source images, @var{__read_only image2d_t}.
  16682. These are the most recent images on each input. The kernel may read from
  16683. them to generate the output, but they can't be written to.
  16684. @end itemize
  16685. Example programs:
  16686. @itemize
  16687. @item
  16688. Copy the input to the output (output must be the same size as the input).
  16689. @verbatim
  16690. __kernel void copy(__write_only image2d_t destination,
  16691. unsigned int index,
  16692. __read_only image2d_t source)
  16693. {
  16694. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16695. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16696. float4 value = read_imagef(source, sampler, location);
  16697. write_imagef(destination, location, value);
  16698. }
  16699. @end verbatim
  16700. @item
  16701. Apply a simple transformation, rotating the input by an amount increasing
  16702. with the index counter. Pixel values are linearly interpolated by the
  16703. sampler, and the output need not have the same dimensions as the input.
  16704. @verbatim
  16705. __kernel void rotate_image(__write_only image2d_t dst,
  16706. unsigned int index,
  16707. __read_only image2d_t src)
  16708. {
  16709. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16710. CLK_FILTER_LINEAR);
  16711. float angle = (float)index / 100.0f;
  16712. float2 dst_dim = convert_float2(get_image_dim(dst));
  16713. float2 src_dim = convert_float2(get_image_dim(src));
  16714. float2 dst_cen = dst_dim / 2.0f;
  16715. float2 src_cen = src_dim / 2.0f;
  16716. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16717. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16718. float2 src_pos = {
  16719. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16720. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16721. };
  16722. src_pos = src_pos * src_dim / dst_dim;
  16723. float2 src_loc = src_pos + src_cen;
  16724. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16725. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16726. write_imagef(dst, dst_loc, 0.5f);
  16727. else
  16728. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16729. }
  16730. @end verbatim
  16731. @item
  16732. Blend two inputs together, with the amount of each input used varying
  16733. with the index counter.
  16734. @verbatim
  16735. __kernel void blend_images(__write_only image2d_t dst,
  16736. unsigned int index,
  16737. __read_only image2d_t src1,
  16738. __read_only image2d_t src2)
  16739. {
  16740. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16741. CLK_FILTER_LINEAR);
  16742. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16743. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16744. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16745. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16746. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16747. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16748. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16749. }
  16750. @end verbatim
  16751. @end itemize
  16752. @section roberts_opencl
  16753. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16754. The filter accepts the following option:
  16755. @table @option
  16756. @item planes
  16757. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16758. @item scale
  16759. Set value which will be multiplied with filtered result.
  16760. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16761. @item delta
  16762. Set value which will be added to filtered result.
  16763. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16764. @end table
  16765. @subsection Example
  16766. @itemize
  16767. @item
  16768. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16769. @example
  16770. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16771. @end example
  16772. @end itemize
  16773. @section sobel_opencl
  16774. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16775. The filter accepts the following option:
  16776. @table @option
  16777. @item planes
  16778. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16779. @item scale
  16780. Set value which will be multiplied with filtered result.
  16781. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16782. @item delta
  16783. Set value which will be added to filtered result.
  16784. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16785. @end table
  16786. @subsection Example
  16787. @itemize
  16788. @item
  16789. Apply sobel operator with scale set to 2 and delta set to 10
  16790. @example
  16791. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16792. @end example
  16793. @end itemize
  16794. @section tonemap_opencl
  16795. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16796. It accepts the following parameters:
  16797. @table @option
  16798. @item tonemap
  16799. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16800. @item param
  16801. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16802. @item desat
  16803. Apply desaturation for highlights that exceed this level of brightness. The
  16804. higher the parameter, the more color information will be preserved. This
  16805. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16806. (smoothly) turning into white instead. This makes images feel more natural,
  16807. at the cost of reducing information about out-of-range colors.
  16808. The default value is 0.5, and the algorithm here is a little different from
  16809. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16810. @item threshold
  16811. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16812. is used to detect whether the scene has changed or not. If the distance between
  16813. the current frame average brightness and the current running average exceeds
  16814. a threshold value, we would re-calculate scene average and peak brightness.
  16815. The default value is 0.2.
  16816. @item format
  16817. Specify the output pixel format.
  16818. Currently supported formats are:
  16819. @table @var
  16820. @item p010
  16821. @item nv12
  16822. @end table
  16823. @item range, r
  16824. Set the output color range.
  16825. Possible values are:
  16826. @table @var
  16827. @item tv/mpeg
  16828. @item pc/jpeg
  16829. @end table
  16830. Default is same as input.
  16831. @item primaries, p
  16832. Set the output color primaries.
  16833. Possible values are:
  16834. @table @var
  16835. @item bt709
  16836. @item bt2020
  16837. @end table
  16838. Default is same as input.
  16839. @item transfer, t
  16840. Set the output transfer characteristics.
  16841. Possible values are:
  16842. @table @var
  16843. @item bt709
  16844. @item bt2020
  16845. @end table
  16846. Default is bt709.
  16847. @item matrix, m
  16848. Set the output colorspace matrix.
  16849. Possible value are:
  16850. @table @var
  16851. @item bt709
  16852. @item bt2020
  16853. @end table
  16854. Default is same as input.
  16855. @end table
  16856. @subsection Example
  16857. @itemize
  16858. @item
  16859. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16860. @example
  16861. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16862. @end example
  16863. @end itemize
  16864. @section unsharp_opencl
  16865. Sharpen or blur the input video.
  16866. It accepts the following parameters:
  16867. @table @option
  16868. @item luma_msize_x, lx
  16869. Set the luma matrix horizontal size.
  16870. Range is @code{[1, 23]} and default value is @code{5}.
  16871. @item luma_msize_y, ly
  16872. Set the luma matrix vertical size.
  16873. Range is @code{[1, 23]} and default value is @code{5}.
  16874. @item luma_amount, la
  16875. Set the luma effect strength.
  16876. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16877. Negative values will blur the input video, while positive values will
  16878. sharpen it, a value of zero will disable the effect.
  16879. @item chroma_msize_x, cx
  16880. Set the chroma matrix horizontal size.
  16881. Range is @code{[1, 23]} and default value is @code{5}.
  16882. @item chroma_msize_y, cy
  16883. Set the chroma matrix vertical size.
  16884. Range is @code{[1, 23]} and default value is @code{5}.
  16885. @item chroma_amount, ca
  16886. Set the chroma effect strength.
  16887. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16888. Negative values will blur the input video, while positive values will
  16889. sharpen it, a value of zero will disable the effect.
  16890. @end table
  16891. All parameters are optional and default to the equivalent of the
  16892. string '5:5:1.0:5:5:0.0'.
  16893. @subsection Examples
  16894. @itemize
  16895. @item
  16896. Apply strong luma sharpen effect:
  16897. @example
  16898. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16899. @end example
  16900. @item
  16901. Apply a strong blur of both luma and chroma parameters:
  16902. @example
  16903. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16904. @end example
  16905. @end itemize
  16906. @section xfade_opencl
  16907. Cross fade two videos with custom transition effect by using OpenCL.
  16908. It accepts the following options:
  16909. @table @option
  16910. @item transition
  16911. Set one of possible transition effects.
  16912. @table @option
  16913. @item custom
  16914. Select custom transition effect, the actual transition description
  16915. will be picked from source and kernel options.
  16916. @item fade
  16917. @item wipeleft
  16918. @item wiperight
  16919. @item wipeup
  16920. @item wipedown
  16921. @item slideleft
  16922. @item slideright
  16923. @item slideup
  16924. @item slidedown
  16925. Default transition is fade.
  16926. @end table
  16927. @item source
  16928. OpenCL program source file for custom transition.
  16929. @item kernel
  16930. Set name of kernel to use for custom transition from program source file.
  16931. @item duration
  16932. Set duration of video transition.
  16933. @item offset
  16934. Set time of start of transition relative to first video.
  16935. @end table
  16936. The program source file must contain a kernel function with the given name,
  16937. which will be run once for each plane of the output. Each run on a plane
  16938. gets enqueued as a separate 2D global NDRange with one work-item for each
  16939. pixel to be generated. The global ID offset for each work-item is therefore
  16940. the coordinates of a pixel in the destination image.
  16941. The kernel function needs to take the following arguments:
  16942. @itemize
  16943. @item
  16944. Destination image, @var{__write_only image2d_t}.
  16945. This image will become the output; the kernel should write all of it.
  16946. @item
  16947. First Source image, @var{__read_only image2d_t}.
  16948. Second Source image, @var{__read_only image2d_t}.
  16949. These are the most recent images on each input. The kernel may read from
  16950. them to generate the output, but they can't be written to.
  16951. @item
  16952. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16953. @end itemize
  16954. Example programs:
  16955. @itemize
  16956. @item
  16957. Apply dots curtain transition effect:
  16958. @verbatim
  16959. __kernel void blend_images(__write_only image2d_t dst,
  16960. __read_only image2d_t src1,
  16961. __read_only image2d_t src2,
  16962. float progress)
  16963. {
  16964. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16965. CLK_FILTER_LINEAR);
  16966. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16967. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16968. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16969. rp = rp / dim;
  16970. float2 dots = (float2)(20.0, 20.0);
  16971. float2 center = (float2)(0,0);
  16972. float2 unused;
  16973. float4 val1 = read_imagef(src1, sampler, p);
  16974. float4 val2 = read_imagef(src2, sampler, p);
  16975. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16976. write_imagef(dst, p, next ? val1 : val2);
  16977. }
  16978. @end verbatim
  16979. @end itemize
  16980. @c man end OPENCL VIDEO FILTERS
  16981. @chapter VAAPI Video Filters
  16982. @c man begin VAAPI VIDEO FILTERS
  16983. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16984. To enable compilation of these filters you need to configure FFmpeg with
  16985. @code{--enable-vaapi}.
  16986. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  16987. @section tonemap_vaapi
  16988. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16989. It maps the dynamic range of HDR10 content to the SDR content.
  16990. It currently only accepts HDR10 as input.
  16991. It accepts the following parameters:
  16992. @table @option
  16993. @item format
  16994. Specify the output pixel format.
  16995. Currently supported formats are:
  16996. @table @var
  16997. @item p010
  16998. @item nv12
  16999. @end table
  17000. Default is nv12.
  17001. @item primaries, p
  17002. Set the output color primaries.
  17003. Default is same as input.
  17004. @item transfer, t
  17005. Set the output transfer characteristics.
  17006. Default is bt709.
  17007. @item matrix, m
  17008. Set the output colorspace matrix.
  17009. Default is same as input.
  17010. @end table
  17011. @subsection Example
  17012. @itemize
  17013. @item
  17014. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17015. @example
  17016. tonemap_vaapi=format=p010:t=bt2020-10
  17017. @end example
  17018. @end itemize
  17019. @c man end VAAPI VIDEO FILTERS
  17020. @chapter Video Sources
  17021. @c man begin VIDEO SOURCES
  17022. Below is a description of the currently available video sources.
  17023. @section buffer
  17024. Buffer video frames, and make them available to the filter chain.
  17025. This source is mainly intended for a programmatic use, in particular
  17026. through the interface defined in @file{libavfilter/buffersrc.h}.
  17027. It accepts the following parameters:
  17028. @table @option
  17029. @item video_size
  17030. Specify the size (width and height) of the buffered video frames. For the
  17031. syntax of this option, check the
  17032. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17033. @item width
  17034. The input video width.
  17035. @item height
  17036. The input video height.
  17037. @item pix_fmt
  17038. A string representing the pixel format of the buffered video frames.
  17039. It may be a number corresponding to a pixel format, or a pixel format
  17040. name.
  17041. @item time_base
  17042. Specify the timebase assumed by the timestamps of the buffered frames.
  17043. @item frame_rate
  17044. Specify the frame rate expected for the video stream.
  17045. @item pixel_aspect, sar
  17046. The sample (pixel) aspect ratio of the input video.
  17047. @item sws_param
  17048. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17049. to the filtergraph description to specify swscale flags for automatically
  17050. inserted scalers. See @ref{Filtergraph syntax}.
  17051. @item hw_frames_ctx
  17052. When using a hardware pixel format, this should be a reference to an
  17053. AVHWFramesContext describing input frames.
  17054. @end table
  17055. For example:
  17056. @example
  17057. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17058. @end example
  17059. will instruct the source to accept video frames with size 320x240 and
  17060. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17061. square pixels (1:1 sample aspect ratio).
  17062. Since the pixel format with name "yuv410p" corresponds to the number 6
  17063. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17064. this example corresponds to:
  17065. @example
  17066. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17067. @end example
  17068. Alternatively, the options can be specified as a flat string, but this
  17069. syntax is deprecated:
  17070. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17071. @section cellauto
  17072. Create a pattern generated by an elementary cellular automaton.
  17073. The initial state of the cellular automaton can be defined through the
  17074. @option{filename} and @option{pattern} options. If such options are
  17075. not specified an initial state is created randomly.
  17076. At each new frame a new row in the video is filled with the result of
  17077. the cellular automaton next generation. The behavior when the whole
  17078. frame is filled is defined by the @option{scroll} option.
  17079. This source accepts the following options:
  17080. @table @option
  17081. @item filename, f
  17082. Read the initial cellular automaton state, i.e. the starting row, from
  17083. the specified file.
  17084. In the file, each non-whitespace character is considered an alive
  17085. cell, a newline will terminate the row, and further characters in the
  17086. file will be ignored.
  17087. @item pattern, p
  17088. Read the initial cellular automaton state, i.e. the starting row, from
  17089. the specified string.
  17090. Each non-whitespace character in the string is considered an alive
  17091. cell, a newline will terminate the row, and further characters in the
  17092. string will be ignored.
  17093. @item rate, r
  17094. Set the video rate, that is the number of frames generated per second.
  17095. Default is 25.
  17096. @item random_fill_ratio, ratio
  17097. Set the random fill ratio for the initial cellular automaton row. It
  17098. is a floating point number value ranging from 0 to 1, defaults to
  17099. 1/PHI.
  17100. This option is ignored when a file or a pattern is specified.
  17101. @item random_seed, seed
  17102. Set the seed for filling randomly the initial row, must be an integer
  17103. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17104. set to -1, the filter will try to use a good random seed on a best
  17105. effort basis.
  17106. @item rule
  17107. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17108. Default value is 110.
  17109. @item size, s
  17110. Set the size of the output video. For the syntax of this option, check the
  17111. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17112. If @option{filename} or @option{pattern} is specified, the size is set
  17113. by default to the width of the specified initial state row, and the
  17114. height is set to @var{width} * PHI.
  17115. If @option{size} is set, it must contain the width of the specified
  17116. pattern string, and the specified pattern will be centered in the
  17117. larger row.
  17118. If a filename or a pattern string is not specified, the size value
  17119. defaults to "320x518" (used for a randomly generated initial state).
  17120. @item scroll
  17121. If set to 1, scroll the output upward when all the rows in the output
  17122. have been already filled. If set to 0, the new generated row will be
  17123. written over the top row just after the bottom row is filled.
  17124. Defaults to 1.
  17125. @item start_full, full
  17126. If set to 1, completely fill the output with generated rows before
  17127. outputting the first frame.
  17128. This is the default behavior, for disabling set the value to 0.
  17129. @item stitch
  17130. If set to 1, stitch the left and right row edges together.
  17131. This is the default behavior, for disabling set the value to 0.
  17132. @end table
  17133. @subsection Examples
  17134. @itemize
  17135. @item
  17136. Read the initial state from @file{pattern}, and specify an output of
  17137. size 200x400.
  17138. @example
  17139. cellauto=f=pattern:s=200x400
  17140. @end example
  17141. @item
  17142. Generate a random initial row with a width of 200 cells, with a fill
  17143. ratio of 2/3:
  17144. @example
  17145. cellauto=ratio=2/3:s=200x200
  17146. @end example
  17147. @item
  17148. Create a pattern generated by rule 18 starting by a single alive cell
  17149. centered on an initial row with width 100:
  17150. @example
  17151. cellauto=p=@@:s=100x400:full=0:rule=18
  17152. @end example
  17153. @item
  17154. Specify a more elaborated initial pattern:
  17155. @example
  17156. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17157. @end example
  17158. @end itemize
  17159. @anchor{coreimagesrc}
  17160. @section coreimagesrc
  17161. Video source generated on GPU using Apple's CoreImage API on OSX.
  17162. This video source is a specialized version of the @ref{coreimage} video filter.
  17163. Use a core image generator at the beginning of the applied filterchain to
  17164. generate the content.
  17165. The coreimagesrc video source accepts the following options:
  17166. @table @option
  17167. @item list_generators
  17168. List all available generators along with all their respective options as well as
  17169. possible minimum and maximum values along with the default values.
  17170. @example
  17171. list_generators=true
  17172. @end example
  17173. @item size, s
  17174. Specify the size of the sourced video. For the syntax of this option, check the
  17175. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17176. The default value is @code{320x240}.
  17177. @item rate, r
  17178. Specify the frame rate of the sourced video, as the number of frames
  17179. generated per second. It has to be a string in the format
  17180. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17181. number or a valid video frame rate abbreviation. The default value is
  17182. "25".
  17183. @item sar
  17184. Set the sample aspect ratio of the sourced video.
  17185. @item duration, d
  17186. Set the duration of the sourced video. See
  17187. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17188. for the accepted syntax.
  17189. If not specified, or the expressed duration is negative, the video is
  17190. supposed to be generated forever.
  17191. @end table
  17192. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17193. A complete filterchain can be used for further processing of the
  17194. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17195. and examples for details.
  17196. @subsection Examples
  17197. @itemize
  17198. @item
  17199. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17200. given as complete and escaped command-line for Apple's standard bash shell:
  17201. @example
  17202. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17203. @end example
  17204. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17205. need for a nullsrc video source.
  17206. @end itemize
  17207. @section gradients
  17208. Generate several gradients.
  17209. @table @option
  17210. @item size, s
  17211. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17212. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17213. @item rate, r
  17214. Set frame rate, expressed as number of frames per second. Default
  17215. value is "25".
  17216. @item c0, c1, c2, c3, c4, c5, c6, c7
  17217. Set 8 colors. Default values for colors is to pick random one.
  17218. @item x0, y0, y0, y1
  17219. Set gradient line source and destination points. If negative or out of range, random ones
  17220. are picked.
  17221. @item nb_colors, n
  17222. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17223. @item seed
  17224. Set seed for picking gradient line points.
  17225. @item duration, d
  17226. Set the duration of the sourced video. See
  17227. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17228. for the accepted syntax.
  17229. If not specified, or the expressed duration is negative, the video is
  17230. supposed to be generated forever.
  17231. @item speed
  17232. Set speed of gradients rotation.
  17233. @end table
  17234. @section mandelbrot
  17235. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17236. point specified with @var{start_x} and @var{start_y}.
  17237. This source accepts the following options:
  17238. @table @option
  17239. @item end_pts
  17240. Set the terminal pts value. Default value is 400.
  17241. @item end_scale
  17242. Set the terminal scale value.
  17243. Must be a floating point value. Default value is 0.3.
  17244. @item inner
  17245. Set the inner coloring mode, that is the algorithm used to draw the
  17246. Mandelbrot fractal internal region.
  17247. It shall assume one of the following values:
  17248. @table @option
  17249. @item black
  17250. Set black mode.
  17251. @item convergence
  17252. Show time until convergence.
  17253. @item mincol
  17254. Set color based on point closest to the origin of the iterations.
  17255. @item period
  17256. Set period mode.
  17257. @end table
  17258. Default value is @var{mincol}.
  17259. @item bailout
  17260. Set the bailout value. Default value is 10.0.
  17261. @item maxiter
  17262. Set the maximum of iterations performed by the rendering
  17263. algorithm. Default value is 7189.
  17264. @item outer
  17265. Set outer coloring mode.
  17266. It shall assume one of following values:
  17267. @table @option
  17268. @item iteration_count
  17269. Set iteration count mode.
  17270. @item normalized_iteration_count
  17271. set normalized iteration count mode.
  17272. @end table
  17273. Default value is @var{normalized_iteration_count}.
  17274. @item rate, r
  17275. Set frame rate, expressed as number of frames per second. Default
  17276. value is "25".
  17277. @item size, s
  17278. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17279. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17280. @item start_scale
  17281. Set the initial scale value. Default value is 3.0.
  17282. @item start_x
  17283. Set the initial x position. Must be a floating point value between
  17284. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17285. @item start_y
  17286. Set the initial y position. Must be a floating point value between
  17287. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17288. @end table
  17289. @section mptestsrc
  17290. Generate various test patterns, as generated by the MPlayer test filter.
  17291. The size of the generated video is fixed, and is 256x256.
  17292. This source is useful in particular for testing encoding features.
  17293. This source accepts the following options:
  17294. @table @option
  17295. @item rate, r
  17296. Specify the frame rate of the sourced video, as the number of frames
  17297. generated per second. It has to be a string in the format
  17298. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17299. number or a valid video frame rate abbreviation. The default value is
  17300. "25".
  17301. @item duration, d
  17302. Set the duration of the sourced video. See
  17303. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17304. for the accepted syntax.
  17305. If not specified, or the expressed duration is negative, the video is
  17306. supposed to be generated forever.
  17307. @item test, t
  17308. Set the number or the name of the test to perform. Supported tests are:
  17309. @table @option
  17310. @item dc_luma
  17311. @item dc_chroma
  17312. @item freq_luma
  17313. @item freq_chroma
  17314. @item amp_luma
  17315. @item amp_chroma
  17316. @item cbp
  17317. @item mv
  17318. @item ring1
  17319. @item ring2
  17320. @item all
  17321. @item max_frames, m
  17322. Set the maximum number of frames generated for each test, default value is 30.
  17323. @end table
  17324. Default value is "all", which will cycle through the list of all tests.
  17325. @end table
  17326. Some examples:
  17327. @example
  17328. mptestsrc=t=dc_luma
  17329. @end example
  17330. will generate a "dc_luma" test pattern.
  17331. @section frei0r_src
  17332. Provide a frei0r source.
  17333. To enable compilation of this filter you need to install the frei0r
  17334. header and configure FFmpeg with @code{--enable-frei0r}.
  17335. This source accepts the following parameters:
  17336. @table @option
  17337. @item size
  17338. The size of the video to generate. For the syntax of this option, check the
  17339. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17340. @item framerate
  17341. The framerate of the generated video. It may be a string of the form
  17342. @var{num}/@var{den} or a frame rate abbreviation.
  17343. @item filter_name
  17344. The name to the frei0r source to load. For more information regarding frei0r and
  17345. how to set the parameters, read the @ref{frei0r} section in the video filters
  17346. documentation.
  17347. @item filter_params
  17348. A '|'-separated list of parameters to pass to the frei0r source.
  17349. @end table
  17350. For example, to generate a frei0r partik0l source with size 200x200
  17351. and frame rate 10 which is overlaid on the overlay filter main input:
  17352. @example
  17353. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17354. @end example
  17355. @section life
  17356. Generate a life pattern.
  17357. This source is based on a generalization of John Conway's life game.
  17358. The sourced input represents a life grid, each pixel represents a cell
  17359. which can be in one of two possible states, alive or dead. Every cell
  17360. interacts with its eight neighbours, which are the cells that are
  17361. horizontally, vertically, or diagonally adjacent.
  17362. At each interaction the grid evolves according to the adopted rule,
  17363. which specifies the number of neighbor alive cells which will make a
  17364. cell stay alive or born. The @option{rule} option allows one to specify
  17365. the rule to adopt.
  17366. This source accepts the following options:
  17367. @table @option
  17368. @item filename, f
  17369. Set the file from which to read the initial grid state. In the file,
  17370. each non-whitespace character is considered an alive cell, and newline
  17371. is used to delimit the end of each row.
  17372. If this option is not specified, the initial grid is generated
  17373. randomly.
  17374. @item rate, r
  17375. Set the video rate, that is the number of frames generated per second.
  17376. Default is 25.
  17377. @item random_fill_ratio, ratio
  17378. Set the random fill ratio for the initial random grid. It is a
  17379. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17380. It is ignored when a file is specified.
  17381. @item random_seed, seed
  17382. Set the seed for filling the initial random grid, must be an integer
  17383. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17384. set to -1, the filter will try to use a good random seed on a best
  17385. effort basis.
  17386. @item rule
  17387. Set the life rule.
  17388. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17389. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17390. @var{NS} specifies the number of alive neighbor cells which make a
  17391. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17392. which make a dead cell to become alive (i.e. to "born").
  17393. "s" and "b" can be used in place of "S" and "B", respectively.
  17394. Alternatively a rule can be specified by an 18-bits integer. The 9
  17395. high order bits are used to encode the next cell state if it is alive
  17396. for each number of neighbor alive cells, the low order bits specify
  17397. the rule for "borning" new cells. Higher order bits encode for an
  17398. higher number of neighbor cells.
  17399. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17400. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17401. Default value is "S23/B3", which is the original Conway's game of life
  17402. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17403. cells, and will born a new cell if there are three alive cells around
  17404. a dead cell.
  17405. @item size, s
  17406. Set the size of the output video. For the syntax of this option, check the
  17407. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17408. If @option{filename} is specified, the size is set by default to the
  17409. same size of the input file. If @option{size} is set, it must contain
  17410. the size specified in the input file, and the initial grid defined in
  17411. that file is centered in the larger resulting area.
  17412. If a filename is not specified, the size value defaults to "320x240"
  17413. (used for a randomly generated initial grid).
  17414. @item stitch
  17415. If set to 1, stitch the left and right grid edges together, and the
  17416. top and bottom edges also. Defaults to 1.
  17417. @item mold
  17418. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17419. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17420. value from 0 to 255.
  17421. @item life_color
  17422. Set the color of living (or new born) cells.
  17423. @item death_color
  17424. Set the color of dead cells. If @option{mold} is set, this is the first color
  17425. used to represent a dead cell.
  17426. @item mold_color
  17427. Set mold color, for definitely dead and moldy cells.
  17428. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17429. ffmpeg-utils manual,ffmpeg-utils}.
  17430. @end table
  17431. @subsection Examples
  17432. @itemize
  17433. @item
  17434. Read a grid from @file{pattern}, and center it on a grid of size
  17435. 300x300 pixels:
  17436. @example
  17437. life=f=pattern:s=300x300
  17438. @end example
  17439. @item
  17440. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17441. @example
  17442. life=ratio=2/3:s=200x200
  17443. @end example
  17444. @item
  17445. Specify a custom rule for evolving a randomly generated grid:
  17446. @example
  17447. life=rule=S14/B34
  17448. @end example
  17449. @item
  17450. Full example with slow death effect (mold) using @command{ffplay}:
  17451. @example
  17452. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17453. @end example
  17454. @end itemize
  17455. @anchor{allrgb}
  17456. @anchor{allyuv}
  17457. @anchor{color}
  17458. @anchor{haldclutsrc}
  17459. @anchor{nullsrc}
  17460. @anchor{pal75bars}
  17461. @anchor{pal100bars}
  17462. @anchor{rgbtestsrc}
  17463. @anchor{smptebars}
  17464. @anchor{smptehdbars}
  17465. @anchor{testsrc}
  17466. @anchor{testsrc2}
  17467. @anchor{yuvtestsrc}
  17468. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17469. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17470. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17471. The @code{color} source provides an uniformly colored input.
  17472. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17473. @ref{haldclut} filter.
  17474. The @code{nullsrc} source returns unprocessed video frames. It is
  17475. mainly useful to be employed in analysis / debugging tools, or as the
  17476. source for filters which ignore the input data.
  17477. The @code{pal75bars} source generates a color bars pattern, based on
  17478. EBU PAL recommendations with 75% color levels.
  17479. The @code{pal100bars} source generates a color bars pattern, based on
  17480. EBU PAL recommendations with 100% color levels.
  17481. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17482. detecting RGB vs BGR issues. You should see a red, green and blue
  17483. stripe from top to bottom.
  17484. The @code{smptebars} source generates a color bars pattern, based on
  17485. the SMPTE Engineering Guideline EG 1-1990.
  17486. The @code{smptehdbars} source generates a color bars pattern, based on
  17487. the SMPTE RP 219-2002.
  17488. The @code{testsrc} source generates a test video pattern, showing a
  17489. color pattern, a scrolling gradient and a timestamp. This is mainly
  17490. intended for testing purposes.
  17491. The @code{testsrc2} source is similar to testsrc, but supports more
  17492. pixel formats instead of just @code{rgb24}. This allows using it as an
  17493. input for other tests without requiring a format conversion.
  17494. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17495. see a y, cb and cr stripe from top to bottom.
  17496. The sources accept the following parameters:
  17497. @table @option
  17498. @item level
  17499. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17500. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17501. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17502. coded on a @code{1/(N*N)} scale.
  17503. @item color, c
  17504. Specify the color of the source, only available in the @code{color}
  17505. source. For the syntax of this option, check the
  17506. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17507. @item size, s
  17508. Specify the size of the sourced video. For the syntax of this option, check the
  17509. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17510. The default value is @code{320x240}.
  17511. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17512. @code{haldclutsrc} filters.
  17513. @item rate, r
  17514. Specify the frame rate of the sourced video, as the number of frames
  17515. generated per second. It has to be a string in the format
  17516. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17517. number or a valid video frame rate abbreviation. The default value is
  17518. "25".
  17519. @item duration, d
  17520. Set the duration of the sourced video. See
  17521. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17522. for the accepted syntax.
  17523. If not specified, or the expressed duration is negative, the video is
  17524. supposed to be generated forever.
  17525. Since the frame rate is used as time base, all frames including the last one
  17526. will have their full duration. If the specified duration is not a multiple
  17527. of the frame duration, it will be rounded up.
  17528. @item sar
  17529. Set the sample aspect ratio of the sourced video.
  17530. @item alpha
  17531. Specify the alpha (opacity) of the background, only available in the
  17532. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17533. 255 (fully opaque, the default).
  17534. @item decimals, n
  17535. Set the number of decimals to show in the timestamp, only available in the
  17536. @code{testsrc} source.
  17537. The displayed timestamp value will correspond to the original
  17538. timestamp value multiplied by the power of 10 of the specified
  17539. value. Default value is 0.
  17540. @end table
  17541. @subsection Examples
  17542. @itemize
  17543. @item
  17544. Generate a video with a duration of 5.3 seconds, with size
  17545. 176x144 and a frame rate of 10 frames per second:
  17546. @example
  17547. testsrc=duration=5.3:size=qcif:rate=10
  17548. @end example
  17549. @item
  17550. The following graph description will generate a red source
  17551. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17552. frames per second:
  17553. @example
  17554. color=c=red@@0.2:s=qcif:r=10
  17555. @end example
  17556. @item
  17557. If the input content is to be ignored, @code{nullsrc} can be used. The
  17558. following command generates noise in the luminance plane by employing
  17559. the @code{geq} filter:
  17560. @example
  17561. nullsrc=s=256x256, geq=random(1)*255:128:128
  17562. @end example
  17563. @end itemize
  17564. @subsection Commands
  17565. The @code{color} source supports the following commands:
  17566. @table @option
  17567. @item c, color
  17568. Set the color of the created image. Accepts the same syntax of the
  17569. corresponding @option{color} option.
  17570. @end table
  17571. @section openclsrc
  17572. Generate video using an OpenCL program.
  17573. @table @option
  17574. @item source
  17575. OpenCL program source file.
  17576. @item kernel
  17577. Kernel name in program.
  17578. @item size, s
  17579. Size of frames to generate. This must be set.
  17580. @item format
  17581. Pixel format to use for the generated frames. This must be set.
  17582. @item rate, r
  17583. Number of frames generated every second. Default value is '25'.
  17584. @end table
  17585. For details of how the program loading works, see the @ref{program_opencl}
  17586. filter.
  17587. Example programs:
  17588. @itemize
  17589. @item
  17590. Generate a colour ramp by setting pixel values from the position of the pixel
  17591. in the output image. (Note that this will work with all pixel formats, but
  17592. the generated output will not be the same.)
  17593. @verbatim
  17594. __kernel void ramp(__write_only image2d_t dst,
  17595. unsigned int index)
  17596. {
  17597. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17598. float4 val;
  17599. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17600. write_imagef(dst, loc, val);
  17601. }
  17602. @end verbatim
  17603. @item
  17604. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17605. @verbatim
  17606. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17607. unsigned int index)
  17608. {
  17609. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17610. float4 value = 0.0f;
  17611. int x = loc.x + index;
  17612. int y = loc.y + index;
  17613. while (x > 0 || y > 0) {
  17614. if (x % 3 == 1 && y % 3 == 1) {
  17615. value = 1.0f;
  17616. break;
  17617. }
  17618. x /= 3;
  17619. y /= 3;
  17620. }
  17621. write_imagef(dst, loc, value);
  17622. }
  17623. @end verbatim
  17624. @end itemize
  17625. @section sierpinski
  17626. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17627. This source accepts the following options:
  17628. @table @option
  17629. @item size, s
  17630. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17631. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17632. @item rate, r
  17633. Set frame rate, expressed as number of frames per second. Default
  17634. value is "25".
  17635. @item seed
  17636. Set seed which is used for random panning.
  17637. @item jump
  17638. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17639. @item type
  17640. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17641. @end table
  17642. @c man end VIDEO SOURCES
  17643. @chapter Video Sinks
  17644. @c man begin VIDEO SINKS
  17645. Below is a description of the currently available video sinks.
  17646. @section buffersink
  17647. Buffer video frames, and make them available to the end of the filter
  17648. graph.
  17649. This sink is mainly intended for programmatic use, in particular
  17650. through the interface defined in @file{libavfilter/buffersink.h}
  17651. or the options system.
  17652. It accepts a pointer to an AVBufferSinkContext structure, which
  17653. defines the incoming buffers' formats, to be passed as the opaque
  17654. parameter to @code{avfilter_init_filter} for initialization.
  17655. @section nullsink
  17656. Null video sink: do absolutely nothing with the input video. It is
  17657. mainly useful as a template and for use in analysis / debugging
  17658. tools.
  17659. @c man end VIDEO SINKS
  17660. @chapter Multimedia Filters
  17661. @c man begin MULTIMEDIA FILTERS
  17662. Below is a description of the currently available multimedia filters.
  17663. @section abitscope
  17664. Convert input audio to a video output, displaying the audio bit scope.
  17665. The filter accepts the following options:
  17666. @table @option
  17667. @item rate, r
  17668. Set frame rate, expressed as number of frames per second. Default
  17669. value is "25".
  17670. @item size, s
  17671. Specify the video size for the output. For the syntax of this option, check the
  17672. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17673. Default value is @code{1024x256}.
  17674. @item colors
  17675. Specify list of colors separated by space or by '|' which will be used to
  17676. draw channels. Unrecognized or missing colors will be replaced
  17677. by white color.
  17678. @end table
  17679. @section adrawgraph
  17680. Draw a graph using input audio metadata.
  17681. See @ref{drawgraph}
  17682. @section agraphmonitor
  17683. See @ref{graphmonitor}.
  17684. @section ahistogram
  17685. Convert input audio to a video output, displaying the volume histogram.
  17686. The filter accepts the following options:
  17687. @table @option
  17688. @item dmode
  17689. Specify how histogram is calculated.
  17690. It accepts the following values:
  17691. @table @samp
  17692. @item single
  17693. Use single histogram for all channels.
  17694. @item separate
  17695. Use separate histogram for each channel.
  17696. @end table
  17697. Default is @code{single}.
  17698. @item rate, r
  17699. Set frame rate, expressed as number of frames per second. Default
  17700. value is "25".
  17701. @item size, s
  17702. Specify the video size for the output. For the syntax of this option, check the
  17703. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17704. Default value is @code{hd720}.
  17705. @item scale
  17706. Set display scale.
  17707. It accepts the following values:
  17708. @table @samp
  17709. @item log
  17710. logarithmic
  17711. @item sqrt
  17712. square root
  17713. @item cbrt
  17714. cubic root
  17715. @item lin
  17716. linear
  17717. @item rlog
  17718. reverse logarithmic
  17719. @end table
  17720. Default is @code{log}.
  17721. @item ascale
  17722. Set amplitude scale.
  17723. It accepts the following values:
  17724. @table @samp
  17725. @item log
  17726. logarithmic
  17727. @item lin
  17728. linear
  17729. @end table
  17730. Default is @code{log}.
  17731. @item acount
  17732. Set how much frames to accumulate in histogram.
  17733. Default is 1. Setting this to -1 accumulates all frames.
  17734. @item rheight
  17735. Set histogram ratio of window height.
  17736. @item slide
  17737. Set sonogram sliding.
  17738. It accepts the following values:
  17739. @table @samp
  17740. @item replace
  17741. replace old rows with new ones.
  17742. @item scroll
  17743. scroll from top to bottom.
  17744. @end table
  17745. Default is @code{replace}.
  17746. @end table
  17747. @section aphasemeter
  17748. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17749. representing mean phase of current audio frame. A video output can also be produced and is
  17750. enabled by default. The audio is passed through as first output.
  17751. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17752. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17753. and @code{1} means channels are in phase.
  17754. The filter accepts the following options, all related to its video output:
  17755. @table @option
  17756. @item rate, r
  17757. Set the output frame rate. Default value is @code{25}.
  17758. @item size, s
  17759. Set the video size for the output. For the syntax of this option, check the
  17760. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17761. Default value is @code{800x400}.
  17762. @item rc
  17763. @item gc
  17764. @item bc
  17765. Specify the red, green, blue contrast. Default values are @code{2},
  17766. @code{7} and @code{1}.
  17767. Allowed range is @code{[0, 255]}.
  17768. @item mpc
  17769. Set color which will be used for drawing median phase. If color is
  17770. @code{none} which is default, no median phase value will be drawn.
  17771. @item video
  17772. Enable video output. Default is enabled.
  17773. @end table
  17774. @subsection phasing detection
  17775. The filter also detects out of phase and mono sequences in stereo streams.
  17776. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  17777. The filter accepts the following options for this detection:
  17778. @table @option
  17779. @item phasing
  17780. Enable mono and out of phase detection. Default is disabled.
  17781. @item tolerance, t
  17782. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  17783. Allowed range is @code{[0, 1]}.
  17784. @item angle, a
  17785. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  17786. Allowed range is @code{[90, 180]}.
  17787. @item duration, d
  17788. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  17789. @end table
  17790. @subsection Examples
  17791. @itemize
  17792. @item
  17793. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  17794. @example
  17795. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  17796. @end example
  17797. @end itemize
  17798. @section avectorscope
  17799. Convert input audio to a video output, representing the audio vector
  17800. scope.
  17801. The filter is used to measure the difference between channels of stereo
  17802. audio stream. A monaural signal, consisting of identical left and right
  17803. signal, results in straight vertical line. Any stereo separation is visible
  17804. as a deviation from this line, creating a Lissajous figure.
  17805. If the straight (or deviation from it) but horizontal line appears this
  17806. indicates that the left and right channels are out of phase.
  17807. The filter accepts the following options:
  17808. @table @option
  17809. @item mode, m
  17810. Set the vectorscope mode.
  17811. Available values are:
  17812. @table @samp
  17813. @item lissajous
  17814. Lissajous rotated by 45 degrees.
  17815. @item lissajous_xy
  17816. Same as above but not rotated.
  17817. @item polar
  17818. Shape resembling half of circle.
  17819. @end table
  17820. Default value is @samp{lissajous}.
  17821. @item size, s
  17822. Set the video size for the output. For the syntax of this option, check the
  17823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17824. Default value is @code{400x400}.
  17825. @item rate, r
  17826. Set the output frame rate. Default value is @code{25}.
  17827. @item rc
  17828. @item gc
  17829. @item bc
  17830. @item ac
  17831. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17832. @code{160}, @code{80} and @code{255}.
  17833. Allowed range is @code{[0, 255]}.
  17834. @item rf
  17835. @item gf
  17836. @item bf
  17837. @item af
  17838. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17839. @code{10}, @code{5} and @code{5}.
  17840. Allowed range is @code{[0, 255]}.
  17841. @item zoom
  17842. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17843. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17844. @item draw
  17845. Set the vectorscope drawing mode.
  17846. Available values are:
  17847. @table @samp
  17848. @item dot
  17849. Draw dot for each sample.
  17850. @item line
  17851. Draw line between previous and current sample.
  17852. @end table
  17853. Default value is @samp{dot}.
  17854. @item scale
  17855. Specify amplitude scale of audio samples.
  17856. Available values are:
  17857. @table @samp
  17858. @item lin
  17859. Linear.
  17860. @item sqrt
  17861. Square root.
  17862. @item cbrt
  17863. Cubic root.
  17864. @item log
  17865. Logarithmic.
  17866. @end table
  17867. @item swap
  17868. Swap left channel axis with right channel axis.
  17869. @item mirror
  17870. Mirror axis.
  17871. @table @samp
  17872. @item none
  17873. No mirror.
  17874. @item x
  17875. Mirror only x axis.
  17876. @item y
  17877. Mirror only y axis.
  17878. @item xy
  17879. Mirror both axis.
  17880. @end table
  17881. @end table
  17882. @subsection Examples
  17883. @itemize
  17884. @item
  17885. Complete example using @command{ffplay}:
  17886. @example
  17887. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17888. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17889. @end example
  17890. @end itemize
  17891. @section bench, abench
  17892. Benchmark part of a filtergraph.
  17893. The filter accepts the following options:
  17894. @table @option
  17895. @item action
  17896. Start or stop a timer.
  17897. Available values are:
  17898. @table @samp
  17899. @item start
  17900. Get the current time, set it as frame metadata (using the key
  17901. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17902. @item stop
  17903. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17904. the input frame metadata to get the time difference. Time difference, average,
  17905. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17906. @code{min}) are then printed. The timestamps are expressed in seconds.
  17907. @end table
  17908. @end table
  17909. @subsection Examples
  17910. @itemize
  17911. @item
  17912. Benchmark @ref{selectivecolor} filter:
  17913. @example
  17914. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17915. @end example
  17916. @end itemize
  17917. @section concat
  17918. Concatenate audio and video streams, joining them together one after the
  17919. other.
  17920. The filter works on segments of synchronized video and audio streams. All
  17921. segments must have the same number of streams of each type, and that will
  17922. also be the number of streams at output.
  17923. The filter accepts the following options:
  17924. @table @option
  17925. @item n
  17926. Set the number of segments. Default is 2.
  17927. @item v
  17928. Set the number of output video streams, that is also the number of video
  17929. streams in each segment. Default is 1.
  17930. @item a
  17931. Set the number of output audio streams, that is also the number of audio
  17932. streams in each segment. Default is 0.
  17933. @item unsafe
  17934. Activate unsafe mode: do not fail if segments have a different format.
  17935. @end table
  17936. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17937. @var{a} audio outputs.
  17938. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17939. segment, in the same order as the outputs, then the inputs for the second
  17940. segment, etc.
  17941. Related streams do not always have exactly the same duration, for various
  17942. reasons including codec frame size or sloppy authoring. For that reason,
  17943. related synchronized streams (e.g. a video and its audio track) should be
  17944. concatenated at once. The concat filter will use the duration of the longest
  17945. stream in each segment (except the last one), and if necessary pad shorter
  17946. audio streams with silence.
  17947. For this filter to work correctly, all segments must start at timestamp 0.
  17948. All corresponding streams must have the same parameters in all segments; the
  17949. filtering system will automatically select a common pixel format for video
  17950. streams, and a common sample format, sample rate and channel layout for
  17951. audio streams, but other settings, such as resolution, must be converted
  17952. explicitly by the user.
  17953. Different frame rates are acceptable but will result in variable frame rate
  17954. at output; be sure to configure the output file to handle it.
  17955. @subsection Examples
  17956. @itemize
  17957. @item
  17958. Concatenate an opening, an episode and an ending, all in bilingual version
  17959. (video in stream 0, audio in streams 1 and 2):
  17960. @example
  17961. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17962. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17963. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17964. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17965. @end example
  17966. @item
  17967. Concatenate two parts, handling audio and video separately, using the
  17968. (a)movie sources, and adjusting the resolution:
  17969. @example
  17970. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17971. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17972. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17973. @end example
  17974. Note that a desync will happen at the stitch if the audio and video streams
  17975. do not have exactly the same duration in the first file.
  17976. @end itemize
  17977. @subsection Commands
  17978. This filter supports the following commands:
  17979. @table @option
  17980. @item next
  17981. Close the current segment and step to the next one
  17982. @end table
  17983. @anchor{ebur128}
  17984. @section ebur128
  17985. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17986. level. By default, it logs a message at a frequency of 10Hz with the
  17987. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17988. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17989. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17990. sample format is double-precision floating point. The input stream will be converted to
  17991. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17992. after this filter to obtain the original parameters.
  17993. The filter also has a video output (see the @var{video} option) with a real
  17994. time graph to observe the loudness evolution. The graphic contains the logged
  17995. message mentioned above, so it is not printed anymore when this option is set,
  17996. unless the verbose logging is set. The main graphing area contains the
  17997. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17998. the momentary loudness (400 milliseconds), but can optionally be configured
  17999. to instead display short-term loudness (see @var{gauge}).
  18000. The green area marks a +/- 1LU target range around the target loudness
  18001. (-23LUFS by default, unless modified through @var{target}).
  18002. More information about the Loudness Recommendation EBU R128 on
  18003. @url{http://tech.ebu.ch/loudness}.
  18004. The filter accepts the following options:
  18005. @table @option
  18006. @item video
  18007. Activate the video output. The audio stream is passed unchanged whether this
  18008. option is set or no. The video stream will be the first output stream if
  18009. activated. Default is @code{0}.
  18010. @item size
  18011. Set the video size. This option is for video only. For the syntax of this
  18012. option, check the
  18013. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18014. Default and minimum resolution is @code{640x480}.
  18015. @item meter
  18016. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18017. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18018. other integer value between this range is allowed.
  18019. @item metadata
  18020. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18021. into 100ms output frames, each of them containing various loudness information
  18022. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18023. Default is @code{0}.
  18024. @item framelog
  18025. Force the frame logging level.
  18026. Available values are:
  18027. @table @samp
  18028. @item info
  18029. information logging level
  18030. @item verbose
  18031. verbose logging level
  18032. @end table
  18033. By default, the logging level is set to @var{info}. If the @option{video} or
  18034. the @option{metadata} options are set, it switches to @var{verbose}.
  18035. @item peak
  18036. Set peak mode(s).
  18037. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18038. values are:
  18039. @table @samp
  18040. @item none
  18041. Disable any peak mode (default).
  18042. @item sample
  18043. Enable sample-peak mode.
  18044. Simple peak mode looking for the higher sample value. It logs a message
  18045. for sample-peak (identified by @code{SPK}).
  18046. @item true
  18047. Enable true-peak mode.
  18048. If enabled, the peak lookup is done on an over-sampled version of the input
  18049. stream for better peak accuracy. It logs a message for true-peak.
  18050. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18051. This mode requires a build with @code{libswresample}.
  18052. @end table
  18053. @item dualmono
  18054. Treat mono input files as "dual mono". If a mono file is intended for playback
  18055. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18056. If set to @code{true}, this option will compensate for this effect.
  18057. Multi-channel input files are not affected by this option.
  18058. @item panlaw
  18059. Set a specific pan law to be used for the measurement of dual mono files.
  18060. This parameter is optional, and has a default value of -3.01dB.
  18061. @item target
  18062. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18063. This parameter is optional and has a default value of -23LUFS as specified
  18064. by EBU R128. However, material published online may prefer a level of -16LUFS
  18065. (e.g. for use with podcasts or video platforms).
  18066. @item gauge
  18067. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18068. @code{shortterm}. By default the momentary value will be used, but in certain
  18069. scenarios it may be more useful to observe the short term value instead (e.g.
  18070. live mixing).
  18071. @item scale
  18072. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18073. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18074. video output, not the summary or continuous log output.
  18075. @end table
  18076. @subsection Examples
  18077. @itemize
  18078. @item
  18079. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18080. @example
  18081. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18082. @end example
  18083. @item
  18084. Run an analysis with @command{ffmpeg}:
  18085. @example
  18086. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18087. @end example
  18088. @end itemize
  18089. @section interleave, ainterleave
  18090. Temporally interleave frames from several inputs.
  18091. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18092. These filters read frames from several inputs and send the oldest
  18093. queued frame to the output.
  18094. Input streams must have well defined, monotonically increasing frame
  18095. timestamp values.
  18096. In order to submit one frame to output, these filters need to enqueue
  18097. at least one frame for each input, so they cannot work in case one
  18098. input is not yet terminated and will not receive incoming frames.
  18099. For example consider the case when one input is a @code{select} filter
  18100. which always drops input frames. The @code{interleave} filter will keep
  18101. reading from that input, but it will never be able to send new frames
  18102. to output until the input sends an end-of-stream signal.
  18103. Also, depending on inputs synchronization, the filters will drop
  18104. frames in case one input receives more frames than the other ones, and
  18105. the queue is already filled.
  18106. These filters accept the following options:
  18107. @table @option
  18108. @item nb_inputs, n
  18109. Set the number of different inputs, it is 2 by default.
  18110. @item duration
  18111. How to determine the end-of-stream.
  18112. @table @option
  18113. @item longest
  18114. The duration of the longest input. (default)
  18115. @item shortest
  18116. The duration of the shortest input.
  18117. @item first
  18118. The duration of the first input.
  18119. @end table
  18120. @end table
  18121. @subsection Examples
  18122. @itemize
  18123. @item
  18124. Interleave frames belonging to different streams using @command{ffmpeg}:
  18125. @example
  18126. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18127. @end example
  18128. @item
  18129. Add flickering blur effect:
  18130. @example
  18131. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18132. @end example
  18133. @end itemize
  18134. @section metadata, ametadata
  18135. Manipulate frame metadata.
  18136. This filter accepts the following options:
  18137. @table @option
  18138. @item mode
  18139. Set mode of operation of the filter.
  18140. Can be one of the following:
  18141. @table @samp
  18142. @item select
  18143. If both @code{value} and @code{key} is set, select frames
  18144. which have such metadata. If only @code{key} is set, select
  18145. every frame that has such key in metadata.
  18146. @item add
  18147. Add new metadata @code{key} and @code{value}. If key is already available
  18148. do nothing.
  18149. @item modify
  18150. Modify value of already present key.
  18151. @item delete
  18152. If @code{value} is set, delete only keys that have such value.
  18153. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18154. the frame.
  18155. @item print
  18156. Print key and its value if metadata was found. If @code{key} is not set print all
  18157. metadata values available in frame.
  18158. @end table
  18159. @item key
  18160. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18161. @item value
  18162. Set metadata value which will be used. This option is mandatory for
  18163. @code{modify} and @code{add} mode.
  18164. @item function
  18165. Which function to use when comparing metadata value and @code{value}.
  18166. Can be one of following:
  18167. @table @samp
  18168. @item same_str
  18169. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18170. @item starts_with
  18171. Values are interpreted as strings, returns true if metadata value starts with
  18172. the @code{value} option string.
  18173. @item less
  18174. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18175. @item equal
  18176. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18177. @item greater
  18178. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18179. @item expr
  18180. Values are interpreted as floats, returns true if expression from option @code{expr}
  18181. evaluates to true.
  18182. @item ends_with
  18183. Values are interpreted as strings, returns true if metadata value ends with
  18184. the @code{value} option string.
  18185. @end table
  18186. @item expr
  18187. Set expression which is used when @code{function} is set to @code{expr}.
  18188. The expression is evaluated through the eval API and can contain the following
  18189. constants:
  18190. @table @option
  18191. @item VALUE1
  18192. Float representation of @code{value} from metadata key.
  18193. @item VALUE2
  18194. Float representation of @code{value} as supplied by user in @code{value} option.
  18195. @end table
  18196. @item file
  18197. If specified in @code{print} mode, output is written to the named file. Instead of
  18198. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18199. for standard output. If @code{file} option is not set, output is written to the log
  18200. with AV_LOG_INFO loglevel.
  18201. @item direct
  18202. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18203. @end table
  18204. @subsection Examples
  18205. @itemize
  18206. @item
  18207. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18208. between 0 and 1.
  18209. @example
  18210. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18211. @end example
  18212. @item
  18213. Print silencedetect output to file @file{metadata.txt}.
  18214. @example
  18215. silencedetect,ametadata=mode=print:file=metadata.txt
  18216. @end example
  18217. @item
  18218. Direct all metadata to a pipe with file descriptor 4.
  18219. @example
  18220. metadata=mode=print:file='pipe\:4'
  18221. @end example
  18222. @end itemize
  18223. @section perms, aperms
  18224. Set read/write permissions for the output frames.
  18225. These filters are mainly aimed at developers to test direct path in the
  18226. following filter in the filtergraph.
  18227. The filters accept the following options:
  18228. @table @option
  18229. @item mode
  18230. Select the permissions mode.
  18231. It accepts the following values:
  18232. @table @samp
  18233. @item none
  18234. Do nothing. This is the default.
  18235. @item ro
  18236. Set all the output frames read-only.
  18237. @item rw
  18238. Set all the output frames directly writable.
  18239. @item toggle
  18240. Make the frame read-only if writable, and writable if read-only.
  18241. @item random
  18242. Set each output frame read-only or writable randomly.
  18243. @end table
  18244. @item seed
  18245. Set the seed for the @var{random} mode, must be an integer included between
  18246. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18247. @code{-1}, the filter will try to use a good random seed on a best effort
  18248. basis.
  18249. @end table
  18250. Note: in case of auto-inserted filter between the permission filter and the
  18251. following one, the permission might not be received as expected in that
  18252. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18253. perms/aperms filter can avoid this problem.
  18254. @section realtime, arealtime
  18255. Slow down filtering to match real time approximately.
  18256. These filters will pause the filtering for a variable amount of time to
  18257. match the output rate with the input timestamps.
  18258. They are similar to the @option{re} option to @code{ffmpeg}.
  18259. They accept the following options:
  18260. @table @option
  18261. @item limit
  18262. Time limit for the pauses. Any pause longer than that will be considered
  18263. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18264. @item speed
  18265. Speed factor for processing. The value must be a float larger than zero.
  18266. Values larger than 1.0 will result in faster than realtime processing,
  18267. smaller will slow processing down. The @var{limit} is automatically adapted
  18268. accordingly. Default is 1.0.
  18269. A processing speed faster than what is possible without these filters cannot
  18270. be achieved.
  18271. @end table
  18272. @anchor{select}
  18273. @section select, aselect
  18274. Select frames to pass in output.
  18275. This filter accepts the following options:
  18276. @table @option
  18277. @item expr, e
  18278. Set expression, which is evaluated for each input frame.
  18279. If the expression is evaluated to zero, the frame is discarded.
  18280. If the evaluation result is negative or NaN, the frame is sent to the
  18281. first output; otherwise it is sent to the output with index
  18282. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18283. For example a value of @code{1.2} corresponds to the output with index
  18284. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18285. @item outputs, n
  18286. Set the number of outputs. The output to which to send the selected
  18287. frame is based on the result of the evaluation. Default value is 1.
  18288. @end table
  18289. The expression can contain the following constants:
  18290. @table @option
  18291. @item n
  18292. The (sequential) number of the filtered frame, starting from 0.
  18293. @item selected_n
  18294. The (sequential) number of the selected frame, starting from 0.
  18295. @item prev_selected_n
  18296. The sequential number of the last selected frame. It's NAN if undefined.
  18297. @item TB
  18298. The timebase of the input timestamps.
  18299. @item pts
  18300. The PTS (Presentation TimeStamp) of the filtered video frame,
  18301. expressed in @var{TB} units. It's NAN if undefined.
  18302. @item t
  18303. The PTS of the filtered video frame,
  18304. expressed in seconds. It's NAN if undefined.
  18305. @item prev_pts
  18306. The PTS of the previously filtered video frame. It's NAN if undefined.
  18307. @item prev_selected_pts
  18308. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18309. @item prev_selected_t
  18310. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18311. @item start_pts
  18312. The PTS of the first video frame in the video. It's NAN if undefined.
  18313. @item start_t
  18314. The time of the first video frame in the video. It's NAN if undefined.
  18315. @item pict_type @emph{(video only)}
  18316. The type of the filtered frame. It can assume one of the following
  18317. values:
  18318. @table @option
  18319. @item I
  18320. @item P
  18321. @item B
  18322. @item S
  18323. @item SI
  18324. @item SP
  18325. @item BI
  18326. @end table
  18327. @item interlace_type @emph{(video only)}
  18328. The frame interlace type. It can assume one of the following values:
  18329. @table @option
  18330. @item PROGRESSIVE
  18331. The frame is progressive (not interlaced).
  18332. @item TOPFIRST
  18333. The frame is top-field-first.
  18334. @item BOTTOMFIRST
  18335. The frame is bottom-field-first.
  18336. @end table
  18337. @item consumed_sample_n @emph{(audio only)}
  18338. the number of selected samples before the current frame
  18339. @item samples_n @emph{(audio only)}
  18340. the number of samples in the current frame
  18341. @item sample_rate @emph{(audio only)}
  18342. the input sample rate
  18343. @item key
  18344. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18345. @item pos
  18346. the position in the file of the filtered frame, -1 if the information
  18347. is not available (e.g. for synthetic video)
  18348. @item scene @emph{(video only)}
  18349. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18350. probability for the current frame to introduce a new scene, while a higher
  18351. value means the current frame is more likely to be one (see the example below)
  18352. @item concatdec_select
  18353. The concat demuxer can select only part of a concat input file by setting an
  18354. inpoint and an outpoint, but the output packets may not be entirely contained
  18355. in the selected interval. By using this variable, it is possible to skip frames
  18356. generated by the concat demuxer which are not exactly contained in the selected
  18357. interval.
  18358. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18359. and the @var{lavf.concat.duration} packet metadata values which are also
  18360. present in the decoded frames.
  18361. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18362. start_time and either the duration metadata is missing or the frame pts is less
  18363. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18364. missing.
  18365. That basically means that an input frame is selected if its pts is within the
  18366. interval set by the concat demuxer.
  18367. @end table
  18368. The default value of the select expression is "1".
  18369. @subsection Examples
  18370. @itemize
  18371. @item
  18372. Select all frames in input:
  18373. @example
  18374. select
  18375. @end example
  18376. The example above is the same as:
  18377. @example
  18378. select=1
  18379. @end example
  18380. @item
  18381. Skip all frames:
  18382. @example
  18383. select=0
  18384. @end example
  18385. @item
  18386. Select only I-frames:
  18387. @example
  18388. select='eq(pict_type\,I)'
  18389. @end example
  18390. @item
  18391. Select one frame every 100:
  18392. @example
  18393. select='not(mod(n\,100))'
  18394. @end example
  18395. @item
  18396. Select only frames contained in the 10-20 time interval:
  18397. @example
  18398. select=between(t\,10\,20)
  18399. @end example
  18400. @item
  18401. Select only I-frames contained in the 10-20 time interval:
  18402. @example
  18403. select=between(t\,10\,20)*eq(pict_type\,I)
  18404. @end example
  18405. @item
  18406. Select frames with a minimum distance of 10 seconds:
  18407. @example
  18408. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18409. @end example
  18410. @item
  18411. Use aselect to select only audio frames with samples number > 100:
  18412. @example
  18413. aselect='gt(samples_n\,100)'
  18414. @end example
  18415. @item
  18416. Create a mosaic of the first scenes:
  18417. @example
  18418. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18419. @end example
  18420. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18421. choice.
  18422. @item
  18423. Send even and odd frames to separate outputs, and compose them:
  18424. @example
  18425. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18426. @end example
  18427. @item
  18428. Select useful frames from an ffconcat file which is using inpoints and
  18429. outpoints but where the source files are not intra frame only.
  18430. @example
  18431. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18432. @end example
  18433. @end itemize
  18434. @section sendcmd, asendcmd
  18435. Send commands to filters in the filtergraph.
  18436. These filters read commands to be sent to other filters in the
  18437. filtergraph.
  18438. @code{sendcmd} must be inserted between two video filters,
  18439. @code{asendcmd} must be inserted between two audio filters, but apart
  18440. from that they act the same way.
  18441. The specification of commands can be provided in the filter arguments
  18442. with the @var{commands} option, or in a file specified by the
  18443. @var{filename} option.
  18444. These filters accept the following options:
  18445. @table @option
  18446. @item commands, c
  18447. Set the commands to be read and sent to the other filters.
  18448. @item filename, f
  18449. Set the filename of the commands to be read and sent to the other
  18450. filters.
  18451. @end table
  18452. @subsection Commands syntax
  18453. A commands description consists of a sequence of interval
  18454. specifications, comprising a list of commands to be executed when a
  18455. particular event related to that interval occurs. The occurring event
  18456. is typically the current frame time entering or leaving a given time
  18457. interval.
  18458. An interval is specified by the following syntax:
  18459. @example
  18460. @var{START}[-@var{END}] @var{COMMANDS};
  18461. @end example
  18462. The time interval is specified by the @var{START} and @var{END} times.
  18463. @var{END} is optional and defaults to the maximum time.
  18464. The current frame time is considered within the specified interval if
  18465. it is included in the interval [@var{START}, @var{END}), that is when
  18466. the time is greater or equal to @var{START} and is lesser than
  18467. @var{END}.
  18468. @var{COMMANDS} consists of a sequence of one or more command
  18469. specifications, separated by ",", relating to that interval. The
  18470. syntax of a command specification is given by:
  18471. @example
  18472. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18473. @end example
  18474. @var{FLAGS} is optional and specifies the type of events relating to
  18475. the time interval which enable sending the specified command, and must
  18476. be a non-null sequence of identifier flags separated by "+" or "|" and
  18477. enclosed between "[" and "]".
  18478. The following flags are recognized:
  18479. @table @option
  18480. @item enter
  18481. The command is sent when the current frame timestamp enters the
  18482. specified interval. In other words, the command is sent when the
  18483. previous frame timestamp was not in the given interval, and the
  18484. current is.
  18485. @item leave
  18486. The command is sent when the current frame timestamp leaves the
  18487. specified interval. In other words, the command is sent when the
  18488. previous frame timestamp was in the given interval, and the
  18489. current is not.
  18490. @item expr
  18491. The command @var{ARG} is interpreted as expression and result of
  18492. expression is passed as @var{ARG}.
  18493. The expression is evaluated through the eval API and can contain the following
  18494. constants:
  18495. @table @option
  18496. @item POS
  18497. Original position in the file of the frame, or undefined if undefined
  18498. for the current frame.
  18499. @item PTS
  18500. The presentation timestamp in input.
  18501. @item N
  18502. The count of the input frame for video or audio, starting from 0.
  18503. @item T
  18504. The time in seconds of the current frame.
  18505. @item TS
  18506. The start time in seconds of the current command interval.
  18507. @item TE
  18508. The end time in seconds of the current command interval.
  18509. @item TI
  18510. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18511. @end table
  18512. @end table
  18513. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18514. assumed.
  18515. @var{TARGET} specifies the target of the command, usually the name of
  18516. the filter class or a specific filter instance name.
  18517. @var{COMMAND} specifies the name of the command for the target filter.
  18518. @var{ARG} is optional and specifies the optional list of argument for
  18519. the given @var{COMMAND}.
  18520. Between one interval specification and another, whitespaces, or
  18521. sequences of characters starting with @code{#} until the end of line,
  18522. are ignored and can be used to annotate comments.
  18523. A simplified BNF description of the commands specification syntax
  18524. follows:
  18525. @example
  18526. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18527. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18528. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18529. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18530. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18531. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18532. @end example
  18533. @subsection Examples
  18534. @itemize
  18535. @item
  18536. Specify audio tempo change at second 4:
  18537. @example
  18538. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18539. @end example
  18540. @item
  18541. Target a specific filter instance:
  18542. @example
  18543. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18544. @end example
  18545. @item
  18546. Specify a list of drawtext and hue commands in a file.
  18547. @example
  18548. # show text in the interval 5-10
  18549. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18550. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18551. # desaturate the image in the interval 15-20
  18552. 15.0-20.0 [enter] hue s 0,
  18553. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18554. [leave] hue s 1,
  18555. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18556. # apply an exponential saturation fade-out effect, starting from time 25
  18557. 25 [enter] hue s exp(25-t)
  18558. @end example
  18559. A filtergraph allowing to read and process the above command list
  18560. stored in a file @file{test.cmd}, can be specified with:
  18561. @example
  18562. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18563. @end example
  18564. @end itemize
  18565. @anchor{setpts}
  18566. @section setpts, asetpts
  18567. Change the PTS (presentation timestamp) of the input frames.
  18568. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18569. This filter accepts the following options:
  18570. @table @option
  18571. @item expr
  18572. The expression which is evaluated for each frame to construct its timestamp.
  18573. @end table
  18574. The expression is evaluated through the eval API and can contain the following
  18575. constants:
  18576. @table @option
  18577. @item FRAME_RATE, FR
  18578. frame rate, only defined for constant frame-rate video
  18579. @item PTS
  18580. The presentation timestamp in input
  18581. @item N
  18582. The count of the input frame for video or the number of consumed samples,
  18583. not including the current frame for audio, starting from 0.
  18584. @item NB_CONSUMED_SAMPLES
  18585. The number of consumed samples, not including the current frame (only
  18586. audio)
  18587. @item NB_SAMPLES, S
  18588. The number of samples in the current frame (only audio)
  18589. @item SAMPLE_RATE, SR
  18590. The audio sample rate.
  18591. @item STARTPTS
  18592. The PTS of the first frame.
  18593. @item STARTT
  18594. the time in seconds of the first frame
  18595. @item INTERLACED
  18596. State whether the current frame is interlaced.
  18597. @item T
  18598. the time in seconds of the current frame
  18599. @item POS
  18600. original position in the file of the frame, or undefined if undefined
  18601. for the current frame
  18602. @item PREV_INPTS
  18603. The previous input PTS.
  18604. @item PREV_INT
  18605. previous input time in seconds
  18606. @item PREV_OUTPTS
  18607. The previous output PTS.
  18608. @item PREV_OUTT
  18609. previous output time in seconds
  18610. @item RTCTIME
  18611. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18612. instead.
  18613. @item RTCSTART
  18614. The wallclock (RTC) time at the start of the movie in microseconds.
  18615. @item TB
  18616. The timebase of the input timestamps.
  18617. @end table
  18618. @subsection Examples
  18619. @itemize
  18620. @item
  18621. Start counting PTS from zero
  18622. @example
  18623. setpts=PTS-STARTPTS
  18624. @end example
  18625. @item
  18626. Apply fast motion effect:
  18627. @example
  18628. setpts=0.5*PTS
  18629. @end example
  18630. @item
  18631. Apply slow motion effect:
  18632. @example
  18633. setpts=2.0*PTS
  18634. @end example
  18635. @item
  18636. Set fixed rate of 25 frames per second:
  18637. @example
  18638. setpts=N/(25*TB)
  18639. @end example
  18640. @item
  18641. Set fixed rate 25 fps with some jitter:
  18642. @example
  18643. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18644. @end example
  18645. @item
  18646. Apply an offset of 10 seconds to the input PTS:
  18647. @example
  18648. setpts=PTS+10/TB
  18649. @end example
  18650. @item
  18651. Generate timestamps from a "live source" and rebase onto the current timebase:
  18652. @example
  18653. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18654. @end example
  18655. @item
  18656. Generate timestamps by counting samples:
  18657. @example
  18658. asetpts=N/SR/TB
  18659. @end example
  18660. @end itemize
  18661. @section setrange
  18662. Force color range for the output video frame.
  18663. The @code{setrange} filter marks the color range property for the
  18664. output frames. It does not change the input frame, but only sets the
  18665. corresponding property, which affects how the frame is treated by
  18666. following filters.
  18667. The filter accepts the following options:
  18668. @table @option
  18669. @item range
  18670. Available values are:
  18671. @table @samp
  18672. @item auto
  18673. Keep the same color range property.
  18674. @item unspecified, unknown
  18675. Set the color range as unspecified.
  18676. @item limited, tv, mpeg
  18677. Set the color range as limited.
  18678. @item full, pc, jpeg
  18679. Set the color range as full.
  18680. @end table
  18681. @end table
  18682. @section settb, asettb
  18683. Set the timebase to use for the output frames timestamps.
  18684. It is mainly useful for testing timebase configuration.
  18685. It accepts the following parameters:
  18686. @table @option
  18687. @item expr, tb
  18688. The expression which is evaluated into the output timebase.
  18689. @end table
  18690. The value for @option{tb} is an arithmetic expression representing a
  18691. rational. The expression can contain the constants "AVTB" (the default
  18692. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18693. audio only). Default value is "intb".
  18694. @subsection Examples
  18695. @itemize
  18696. @item
  18697. Set the timebase to 1/25:
  18698. @example
  18699. settb=expr=1/25
  18700. @end example
  18701. @item
  18702. Set the timebase to 1/10:
  18703. @example
  18704. settb=expr=0.1
  18705. @end example
  18706. @item
  18707. Set the timebase to 1001/1000:
  18708. @example
  18709. settb=1+0.001
  18710. @end example
  18711. @item
  18712. Set the timebase to 2*intb:
  18713. @example
  18714. settb=2*intb
  18715. @end example
  18716. @item
  18717. Set the default timebase value:
  18718. @example
  18719. settb=AVTB
  18720. @end example
  18721. @end itemize
  18722. @section showcqt
  18723. Convert input audio to a video output representing frequency spectrum
  18724. logarithmically using Brown-Puckette constant Q transform algorithm with
  18725. direct frequency domain coefficient calculation (but the transform itself
  18726. is not really constant Q, instead the Q factor is actually variable/clamped),
  18727. with musical tone scale, from E0 to D#10.
  18728. The filter accepts the following options:
  18729. @table @option
  18730. @item size, s
  18731. Specify the video size for the output. It must be even. For the syntax of this option,
  18732. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18733. Default value is @code{1920x1080}.
  18734. @item fps, rate, r
  18735. Set the output frame rate. Default value is @code{25}.
  18736. @item bar_h
  18737. Set the bargraph height. It must be even. Default value is @code{-1} which
  18738. computes the bargraph height automatically.
  18739. @item axis_h
  18740. Set the axis height. It must be even. Default value is @code{-1} which computes
  18741. the axis height automatically.
  18742. @item sono_h
  18743. Set the sonogram height. It must be even. Default value is @code{-1} which
  18744. computes the sonogram height automatically.
  18745. @item fullhd
  18746. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18747. instead. Default value is @code{1}.
  18748. @item sono_v, volume
  18749. Specify the sonogram volume expression. It can contain variables:
  18750. @table @option
  18751. @item bar_v
  18752. the @var{bar_v} evaluated expression
  18753. @item frequency, freq, f
  18754. the frequency where it is evaluated
  18755. @item timeclamp, tc
  18756. the value of @var{timeclamp} option
  18757. @end table
  18758. and functions:
  18759. @table @option
  18760. @item a_weighting(f)
  18761. A-weighting of equal loudness
  18762. @item b_weighting(f)
  18763. B-weighting of equal loudness
  18764. @item c_weighting(f)
  18765. C-weighting of equal loudness.
  18766. @end table
  18767. Default value is @code{16}.
  18768. @item bar_v, volume2
  18769. Specify the bargraph volume expression. It can contain variables:
  18770. @table @option
  18771. @item sono_v
  18772. the @var{sono_v} evaluated expression
  18773. @item frequency, freq, f
  18774. the frequency where it is evaluated
  18775. @item timeclamp, tc
  18776. the value of @var{timeclamp} option
  18777. @end table
  18778. and functions:
  18779. @table @option
  18780. @item a_weighting(f)
  18781. A-weighting of equal loudness
  18782. @item b_weighting(f)
  18783. B-weighting of equal loudness
  18784. @item c_weighting(f)
  18785. C-weighting of equal loudness.
  18786. @end table
  18787. Default value is @code{sono_v}.
  18788. @item sono_g, gamma
  18789. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18790. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18791. Acceptable range is @code{[1, 7]}.
  18792. @item bar_g, gamma2
  18793. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18794. @code{[1, 7]}.
  18795. @item bar_t
  18796. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18797. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18798. @item timeclamp, tc
  18799. Specify the transform timeclamp. At low frequency, there is trade-off between
  18800. accuracy in time domain and frequency domain. If timeclamp is lower,
  18801. event in time domain is represented more accurately (such as fast bass drum),
  18802. otherwise event in frequency domain is represented more accurately
  18803. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18804. @item attack
  18805. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18806. limits future samples by applying asymmetric windowing in time domain, useful
  18807. when low latency is required. Accepted range is @code{[0, 1]}.
  18808. @item basefreq
  18809. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18810. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18811. @item endfreq
  18812. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18813. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18814. @item coeffclamp
  18815. This option is deprecated and ignored.
  18816. @item tlength
  18817. Specify the transform length in time domain. Use this option to control accuracy
  18818. trade-off between time domain and frequency domain at every frequency sample.
  18819. It can contain variables:
  18820. @table @option
  18821. @item frequency, freq, f
  18822. the frequency where it is evaluated
  18823. @item timeclamp, tc
  18824. the value of @var{timeclamp} option.
  18825. @end table
  18826. Default value is @code{384*tc/(384+tc*f)}.
  18827. @item count
  18828. Specify the transform count for every video frame. Default value is @code{6}.
  18829. Acceptable range is @code{[1, 30]}.
  18830. @item fcount
  18831. Specify the transform count for every single pixel. Default value is @code{0},
  18832. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18833. @item fontfile
  18834. Specify font file for use with freetype to draw the axis. If not specified,
  18835. use embedded font. Note that drawing with font file or embedded font is not
  18836. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18837. option instead.
  18838. @item font
  18839. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18840. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18841. escaping.
  18842. @item fontcolor
  18843. Specify font color expression. This is arithmetic expression that should return
  18844. integer value 0xRRGGBB. It can contain variables:
  18845. @table @option
  18846. @item frequency, freq, f
  18847. the frequency where it is evaluated
  18848. @item timeclamp, tc
  18849. the value of @var{timeclamp} option
  18850. @end table
  18851. and functions:
  18852. @table @option
  18853. @item midi(f)
  18854. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18855. @item r(x), g(x), b(x)
  18856. red, green, and blue value of intensity x.
  18857. @end table
  18858. Default value is @code{st(0, (midi(f)-59.5)/12);
  18859. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18860. r(1-ld(1)) + b(ld(1))}.
  18861. @item axisfile
  18862. Specify image file to draw the axis. This option override @var{fontfile} and
  18863. @var{fontcolor} option.
  18864. @item axis, text
  18865. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18866. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18867. Default value is @code{1}.
  18868. @item csp
  18869. Set colorspace. The accepted values are:
  18870. @table @samp
  18871. @item unspecified
  18872. Unspecified (default)
  18873. @item bt709
  18874. BT.709
  18875. @item fcc
  18876. FCC
  18877. @item bt470bg
  18878. BT.470BG or BT.601-6 625
  18879. @item smpte170m
  18880. SMPTE-170M or BT.601-6 525
  18881. @item smpte240m
  18882. SMPTE-240M
  18883. @item bt2020ncl
  18884. BT.2020 with non-constant luminance
  18885. @end table
  18886. @item cscheme
  18887. Set spectrogram color scheme. This is list of floating point values with format
  18888. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18889. The default is @code{1|0.5|0|0|0.5|1}.
  18890. @end table
  18891. @subsection Examples
  18892. @itemize
  18893. @item
  18894. Playing audio while showing the spectrum:
  18895. @example
  18896. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18897. @end example
  18898. @item
  18899. Same as above, but with frame rate 30 fps:
  18900. @example
  18901. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18902. @end example
  18903. @item
  18904. Playing at 1280x720:
  18905. @example
  18906. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18907. @end example
  18908. @item
  18909. Disable sonogram display:
  18910. @example
  18911. sono_h=0
  18912. @end example
  18913. @item
  18914. A1 and its harmonics: A1, A2, (near)E3, A3:
  18915. @example
  18916. 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),
  18917. asplit[a][out1]; [a] showcqt [out0]'
  18918. @end example
  18919. @item
  18920. Same as above, but with more accuracy in frequency domain:
  18921. @example
  18922. 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),
  18923. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18924. @end example
  18925. @item
  18926. Custom volume:
  18927. @example
  18928. bar_v=10:sono_v=bar_v*a_weighting(f)
  18929. @end example
  18930. @item
  18931. Custom gamma, now spectrum is linear to the amplitude.
  18932. @example
  18933. bar_g=2:sono_g=2
  18934. @end example
  18935. @item
  18936. Custom tlength equation:
  18937. @example
  18938. 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)))'
  18939. @end example
  18940. @item
  18941. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18942. @example
  18943. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18944. @end example
  18945. @item
  18946. Custom font using fontconfig:
  18947. @example
  18948. font='Courier New,Monospace,mono|bold'
  18949. @end example
  18950. @item
  18951. Custom frequency range with custom axis using image file:
  18952. @example
  18953. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18954. @end example
  18955. @end itemize
  18956. @section showfreqs
  18957. Convert input audio to video output representing the audio power spectrum.
  18958. Audio amplitude is on Y-axis while frequency is on X-axis.
  18959. The filter accepts the following options:
  18960. @table @option
  18961. @item size, s
  18962. Specify size of video. For the syntax of this option, check the
  18963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18964. Default is @code{1024x512}.
  18965. @item mode
  18966. Set display mode.
  18967. This set how each frequency bin will be represented.
  18968. It accepts the following values:
  18969. @table @samp
  18970. @item line
  18971. @item bar
  18972. @item dot
  18973. @end table
  18974. Default is @code{bar}.
  18975. @item ascale
  18976. Set amplitude scale.
  18977. It accepts the following values:
  18978. @table @samp
  18979. @item lin
  18980. Linear scale.
  18981. @item sqrt
  18982. Square root scale.
  18983. @item cbrt
  18984. Cubic root scale.
  18985. @item log
  18986. Logarithmic scale.
  18987. @end table
  18988. Default is @code{log}.
  18989. @item fscale
  18990. Set frequency scale.
  18991. It accepts the following values:
  18992. @table @samp
  18993. @item lin
  18994. Linear scale.
  18995. @item log
  18996. Logarithmic scale.
  18997. @item rlog
  18998. Reverse logarithmic scale.
  18999. @end table
  19000. Default is @code{lin}.
  19001. @item win_size
  19002. Set window size. Allowed range is from 16 to 65536.
  19003. Default is @code{2048}
  19004. @item win_func
  19005. Set windowing function.
  19006. It accepts the following values:
  19007. @table @samp
  19008. @item rect
  19009. @item bartlett
  19010. @item hanning
  19011. @item hamming
  19012. @item blackman
  19013. @item welch
  19014. @item flattop
  19015. @item bharris
  19016. @item bnuttall
  19017. @item bhann
  19018. @item sine
  19019. @item nuttall
  19020. @item lanczos
  19021. @item gauss
  19022. @item tukey
  19023. @item dolph
  19024. @item cauchy
  19025. @item parzen
  19026. @item poisson
  19027. @item bohman
  19028. @end table
  19029. Default is @code{hanning}.
  19030. @item overlap
  19031. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19032. which means optimal overlap for selected window function will be picked.
  19033. @item averaging
  19034. Set time averaging. Setting this to 0 will display current maximal peaks.
  19035. Default is @code{1}, which means time averaging is disabled.
  19036. @item colors
  19037. Specify list of colors separated by space or by '|' which will be used to
  19038. draw channel frequencies. Unrecognized or missing colors will be replaced
  19039. by white color.
  19040. @item cmode
  19041. Set channel display mode.
  19042. It accepts the following values:
  19043. @table @samp
  19044. @item combined
  19045. @item separate
  19046. @end table
  19047. Default is @code{combined}.
  19048. @item minamp
  19049. Set minimum amplitude used in @code{log} amplitude scaler.
  19050. @end table
  19051. @section showspatial
  19052. Convert stereo input audio to a video output, representing the spatial relationship
  19053. between two channels.
  19054. The filter accepts the following options:
  19055. @table @option
  19056. @item size, s
  19057. Specify the video size for the output. For the syntax of this option, check the
  19058. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19059. Default value is @code{512x512}.
  19060. @item win_size
  19061. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19062. @item win_func
  19063. Set window function.
  19064. It accepts the following values:
  19065. @table @samp
  19066. @item rect
  19067. @item bartlett
  19068. @item hann
  19069. @item hanning
  19070. @item hamming
  19071. @item blackman
  19072. @item welch
  19073. @item flattop
  19074. @item bharris
  19075. @item bnuttall
  19076. @item bhann
  19077. @item sine
  19078. @item nuttall
  19079. @item lanczos
  19080. @item gauss
  19081. @item tukey
  19082. @item dolph
  19083. @item cauchy
  19084. @item parzen
  19085. @item poisson
  19086. @item bohman
  19087. @end table
  19088. Default value is @code{hann}.
  19089. @item overlap
  19090. Set ratio of overlap window. Default value is @code{0.5}.
  19091. When value is @code{1} overlap is set to recommended size for specific
  19092. window function currently used.
  19093. @end table
  19094. @anchor{showspectrum}
  19095. @section showspectrum
  19096. Convert input audio to a video output, representing the audio frequency
  19097. spectrum.
  19098. The filter accepts the following options:
  19099. @table @option
  19100. @item size, s
  19101. Specify the video size for the output. For the syntax of this option, check the
  19102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19103. Default value is @code{640x512}.
  19104. @item slide
  19105. Specify how the spectrum should slide along the window.
  19106. It accepts the following values:
  19107. @table @samp
  19108. @item replace
  19109. the samples start again on the left when they reach the right
  19110. @item scroll
  19111. the samples scroll from right to left
  19112. @item fullframe
  19113. frames are only produced when the samples reach the right
  19114. @item rscroll
  19115. the samples scroll from left to right
  19116. @end table
  19117. Default value is @code{replace}.
  19118. @item mode
  19119. Specify display mode.
  19120. It accepts the following values:
  19121. @table @samp
  19122. @item combined
  19123. all channels are displayed in the same row
  19124. @item separate
  19125. all channels are displayed in separate rows
  19126. @end table
  19127. Default value is @samp{combined}.
  19128. @item color
  19129. Specify display color mode.
  19130. It accepts the following values:
  19131. @table @samp
  19132. @item channel
  19133. each channel is displayed in a separate color
  19134. @item intensity
  19135. each channel is displayed using the same color scheme
  19136. @item rainbow
  19137. each channel is displayed using the rainbow color scheme
  19138. @item moreland
  19139. each channel is displayed using the moreland color scheme
  19140. @item nebulae
  19141. each channel is displayed using the nebulae color scheme
  19142. @item fire
  19143. each channel is displayed using the fire color scheme
  19144. @item fiery
  19145. each channel is displayed using the fiery color scheme
  19146. @item fruit
  19147. each channel is displayed using the fruit color scheme
  19148. @item cool
  19149. each channel is displayed using the cool color scheme
  19150. @item magma
  19151. each channel is displayed using the magma color scheme
  19152. @item green
  19153. each channel is displayed using the green color scheme
  19154. @item viridis
  19155. each channel is displayed using the viridis color scheme
  19156. @item plasma
  19157. each channel is displayed using the plasma color scheme
  19158. @item cividis
  19159. each channel is displayed using the cividis color scheme
  19160. @item terrain
  19161. each channel is displayed using the terrain color scheme
  19162. @end table
  19163. Default value is @samp{channel}.
  19164. @item scale
  19165. Specify scale used for calculating intensity color values.
  19166. It accepts the following values:
  19167. @table @samp
  19168. @item lin
  19169. linear
  19170. @item sqrt
  19171. square root, default
  19172. @item cbrt
  19173. cubic root
  19174. @item log
  19175. logarithmic
  19176. @item 4thrt
  19177. 4th root
  19178. @item 5thrt
  19179. 5th root
  19180. @end table
  19181. Default value is @samp{sqrt}.
  19182. @item fscale
  19183. Specify frequency scale.
  19184. It accepts the following values:
  19185. @table @samp
  19186. @item lin
  19187. linear
  19188. @item log
  19189. logarithmic
  19190. @end table
  19191. Default value is @samp{lin}.
  19192. @item saturation
  19193. Set saturation modifier for displayed colors. Negative values provide
  19194. alternative color scheme. @code{0} is no saturation at all.
  19195. Saturation must be in [-10.0, 10.0] range.
  19196. Default value is @code{1}.
  19197. @item win_func
  19198. Set window function.
  19199. It accepts the following values:
  19200. @table @samp
  19201. @item rect
  19202. @item bartlett
  19203. @item hann
  19204. @item hanning
  19205. @item hamming
  19206. @item blackman
  19207. @item welch
  19208. @item flattop
  19209. @item bharris
  19210. @item bnuttall
  19211. @item bhann
  19212. @item sine
  19213. @item nuttall
  19214. @item lanczos
  19215. @item gauss
  19216. @item tukey
  19217. @item dolph
  19218. @item cauchy
  19219. @item parzen
  19220. @item poisson
  19221. @item bohman
  19222. @end table
  19223. Default value is @code{hann}.
  19224. @item orientation
  19225. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19226. @code{horizontal}. Default is @code{vertical}.
  19227. @item overlap
  19228. Set ratio of overlap window. Default value is @code{0}.
  19229. When value is @code{1} overlap is set to recommended size for specific
  19230. window function currently used.
  19231. @item gain
  19232. Set scale gain for calculating intensity color values.
  19233. Default value is @code{1}.
  19234. @item data
  19235. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19236. @item rotation
  19237. Set color rotation, must be in [-1.0, 1.0] range.
  19238. Default value is @code{0}.
  19239. @item start
  19240. Set start frequency from which to display spectrogram. Default is @code{0}.
  19241. @item stop
  19242. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19243. @item fps
  19244. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19245. @item legend
  19246. Draw time and frequency axes and legends. Default is disabled.
  19247. @end table
  19248. The usage is very similar to the showwaves filter; see the examples in that
  19249. section.
  19250. @subsection Examples
  19251. @itemize
  19252. @item
  19253. Large window with logarithmic color scaling:
  19254. @example
  19255. showspectrum=s=1280x480:scale=log
  19256. @end example
  19257. @item
  19258. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19259. @example
  19260. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19261. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19262. @end example
  19263. @end itemize
  19264. @section showspectrumpic
  19265. Convert input audio to a single video frame, representing the audio frequency
  19266. spectrum.
  19267. The filter accepts the following options:
  19268. @table @option
  19269. @item size, s
  19270. Specify the video size for the output. For the syntax of this option, check the
  19271. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19272. Default value is @code{4096x2048}.
  19273. @item mode
  19274. Specify display mode.
  19275. It accepts the following values:
  19276. @table @samp
  19277. @item combined
  19278. all channels are displayed in the same row
  19279. @item separate
  19280. all channels are displayed in separate rows
  19281. @end table
  19282. Default value is @samp{combined}.
  19283. @item color
  19284. Specify display color mode.
  19285. It accepts the following values:
  19286. @table @samp
  19287. @item channel
  19288. each channel is displayed in a separate color
  19289. @item intensity
  19290. each channel is displayed using the same color scheme
  19291. @item rainbow
  19292. each channel is displayed using the rainbow color scheme
  19293. @item moreland
  19294. each channel is displayed using the moreland color scheme
  19295. @item nebulae
  19296. each channel is displayed using the nebulae color scheme
  19297. @item fire
  19298. each channel is displayed using the fire color scheme
  19299. @item fiery
  19300. each channel is displayed using the fiery color scheme
  19301. @item fruit
  19302. each channel is displayed using the fruit color scheme
  19303. @item cool
  19304. each channel is displayed using the cool color scheme
  19305. @item magma
  19306. each channel is displayed using the magma color scheme
  19307. @item green
  19308. each channel is displayed using the green color scheme
  19309. @item viridis
  19310. each channel is displayed using the viridis color scheme
  19311. @item plasma
  19312. each channel is displayed using the plasma color scheme
  19313. @item cividis
  19314. each channel is displayed using the cividis color scheme
  19315. @item terrain
  19316. each channel is displayed using the terrain color scheme
  19317. @end table
  19318. Default value is @samp{intensity}.
  19319. @item scale
  19320. Specify scale used for calculating intensity color values.
  19321. It accepts the following values:
  19322. @table @samp
  19323. @item lin
  19324. linear
  19325. @item sqrt
  19326. square root, default
  19327. @item cbrt
  19328. cubic root
  19329. @item log
  19330. logarithmic
  19331. @item 4thrt
  19332. 4th root
  19333. @item 5thrt
  19334. 5th root
  19335. @end table
  19336. Default value is @samp{log}.
  19337. @item fscale
  19338. Specify frequency scale.
  19339. It accepts the following values:
  19340. @table @samp
  19341. @item lin
  19342. linear
  19343. @item log
  19344. logarithmic
  19345. @end table
  19346. Default value is @samp{lin}.
  19347. @item saturation
  19348. Set saturation modifier for displayed colors. Negative values provide
  19349. alternative color scheme. @code{0} is no saturation at all.
  19350. Saturation must be in [-10.0, 10.0] range.
  19351. Default value is @code{1}.
  19352. @item win_func
  19353. Set window function.
  19354. It accepts the following values:
  19355. @table @samp
  19356. @item rect
  19357. @item bartlett
  19358. @item hann
  19359. @item hanning
  19360. @item hamming
  19361. @item blackman
  19362. @item welch
  19363. @item flattop
  19364. @item bharris
  19365. @item bnuttall
  19366. @item bhann
  19367. @item sine
  19368. @item nuttall
  19369. @item lanczos
  19370. @item gauss
  19371. @item tukey
  19372. @item dolph
  19373. @item cauchy
  19374. @item parzen
  19375. @item poisson
  19376. @item bohman
  19377. @end table
  19378. Default value is @code{hann}.
  19379. @item orientation
  19380. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19381. @code{horizontal}. Default is @code{vertical}.
  19382. @item gain
  19383. Set scale gain for calculating intensity color values.
  19384. Default value is @code{1}.
  19385. @item legend
  19386. Draw time and frequency axes and legends. Default is enabled.
  19387. @item rotation
  19388. Set color rotation, must be in [-1.0, 1.0] range.
  19389. Default value is @code{0}.
  19390. @item start
  19391. Set start frequency from which to display spectrogram. Default is @code{0}.
  19392. @item stop
  19393. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19394. @end table
  19395. @subsection Examples
  19396. @itemize
  19397. @item
  19398. Extract an audio spectrogram of a whole audio track
  19399. in a 1024x1024 picture using @command{ffmpeg}:
  19400. @example
  19401. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19402. @end example
  19403. @end itemize
  19404. @section showvolume
  19405. Convert input audio volume to a video output.
  19406. The filter accepts the following options:
  19407. @table @option
  19408. @item rate, r
  19409. Set video rate.
  19410. @item b
  19411. Set border width, allowed range is [0, 5]. Default is 1.
  19412. @item w
  19413. Set channel width, allowed range is [80, 8192]. Default is 400.
  19414. @item h
  19415. Set channel height, allowed range is [1, 900]. Default is 20.
  19416. @item f
  19417. Set fade, allowed range is [0, 1]. Default is 0.95.
  19418. @item c
  19419. Set volume color expression.
  19420. The expression can use the following variables:
  19421. @table @option
  19422. @item VOLUME
  19423. Current max volume of channel in dB.
  19424. @item PEAK
  19425. Current peak.
  19426. @item CHANNEL
  19427. Current channel number, starting from 0.
  19428. @end table
  19429. @item t
  19430. If set, displays channel names. Default is enabled.
  19431. @item v
  19432. If set, displays volume values. Default is enabled.
  19433. @item o
  19434. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19435. default is @code{h}.
  19436. @item s
  19437. Set step size, allowed range is [0, 5]. Default is 0, which means
  19438. step is disabled.
  19439. @item p
  19440. Set background opacity, allowed range is [0, 1]. Default is 0.
  19441. @item m
  19442. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19443. default is @code{p}.
  19444. @item ds
  19445. Set display scale, can be linear: @code{lin} or log: @code{log},
  19446. default is @code{lin}.
  19447. @item dm
  19448. In second.
  19449. If set to > 0., display a line for the max level
  19450. in the previous seconds.
  19451. default is disabled: @code{0.}
  19452. @item dmc
  19453. The color of the max line. Use when @code{dm} option is set to > 0.
  19454. default is: @code{orange}
  19455. @end table
  19456. @section showwaves
  19457. Convert input audio to a video output, representing the samples waves.
  19458. The filter accepts the following options:
  19459. @table @option
  19460. @item size, s
  19461. Specify the video size for the output. For the syntax of this option, check the
  19462. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19463. Default value is @code{600x240}.
  19464. @item mode
  19465. Set display mode.
  19466. Available values are:
  19467. @table @samp
  19468. @item point
  19469. Draw a point for each sample.
  19470. @item line
  19471. Draw a vertical line for each sample.
  19472. @item p2p
  19473. Draw a point for each sample and a line between them.
  19474. @item cline
  19475. Draw a centered vertical line for each sample.
  19476. @end table
  19477. Default value is @code{point}.
  19478. @item n
  19479. Set the number of samples which are printed on the same column. A
  19480. larger value will decrease the frame rate. Must be a positive
  19481. integer. This option can be set only if the value for @var{rate}
  19482. is not explicitly specified.
  19483. @item rate, r
  19484. Set the (approximate) output frame rate. This is done by setting the
  19485. option @var{n}. Default value is "25".
  19486. @item split_channels
  19487. Set if channels should be drawn separately or overlap. Default value is 0.
  19488. @item colors
  19489. Set colors separated by '|' which are going to be used for drawing of each channel.
  19490. @item scale
  19491. Set amplitude scale.
  19492. Available values are:
  19493. @table @samp
  19494. @item lin
  19495. Linear.
  19496. @item log
  19497. Logarithmic.
  19498. @item sqrt
  19499. Square root.
  19500. @item cbrt
  19501. Cubic root.
  19502. @end table
  19503. Default is linear.
  19504. @item draw
  19505. Set the draw mode. This is mostly useful to set for high @var{n}.
  19506. Available values are:
  19507. @table @samp
  19508. @item scale
  19509. Scale pixel values for each drawn sample.
  19510. @item full
  19511. Draw every sample directly.
  19512. @end table
  19513. Default value is @code{scale}.
  19514. @end table
  19515. @subsection Examples
  19516. @itemize
  19517. @item
  19518. Output the input file audio and the corresponding video representation
  19519. at the same time:
  19520. @example
  19521. amovie=a.mp3,asplit[out0],showwaves[out1]
  19522. @end example
  19523. @item
  19524. Create a synthetic signal and show it with showwaves, forcing a
  19525. frame rate of 30 frames per second:
  19526. @example
  19527. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19528. @end example
  19529. @end itemize
  19530. @section showwavespic
  19531. Convert input audio to a single video frame, representing the samples waves.
  19532. The filter accepts the following options:
  19533. @table @option
  19534. @item size, s
  19535. Specify the video size for the output. For the syntax of this option, check the
  19536. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19537. Default value is @code{600x240}.
  19538. @item split_channels
  19539. Set if channels should be drawn separately or overlap. Default value is 0.
  19540. @item colors
  19541. Set colors separated by '|' which are going to be used for drawing of each channel.
  19542. @item scale
  19543. Set amplitude scale.
  19544. Available values are:
  19545. @table @samp
  19546. @item lin
  19547. Linear.
  19548. @item log
  19549. Logarithmic.
  19550. @item sqrt
  19551. Square root.
  19552. @item cbrt
  19553. Cubic root.
  19554. @end table
  19555. Default is linear.
  19556. @item draw
  19557. Set the draw mode.
  19558. Available values are:
  19559. @table @samp
  19560. @item scale
  19561. Scale pixel values for each drawn sample.
  19562. @item full
  19563. Draw every sample directly.
  19564. @end table
  19565. Default value is @code{scale}.
  19566. @item filter
  19567. Set the filter mode.
  19568. Available values are:
  19569. @table @samp
  19570. @item average
  19571. Use average samples values for each drawn sample.
  19572. @item peak
  19573. Use peak samples values for each drawn sample.
  19574. @end table
  19575. Default value is @code{average}.
  19576. @end table
  19577. @subsection Examples
  19578. @itemize
  19579. @item
  19580. Extract a channel split representation of the wave form of a whole audio track
  19581. in a 1024x800 picture using @command{ffmpeg}:
  19582. @example
  19583. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19584. @end example
  19585. @end itemize
  19586. @section sidedata, asidedata
  19587. Delete frame side data, or select frames based on it.
  19588. This filter accepts the following options:
  19589. @table @option
  19590. @item mode
  19591. Set mode of operation of the filter.
  19592. Can be one of the following:
  19593. @table @samp
  19594. @item select
  19595. Select every frame with side data of @code{type}.
  19596. @item delete
  19597. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19598. data in the frame.
  19599. @end table
  19600. @item type
  19601. Set side data type used with all modes. Must be set for @code{select} mode. For
  19602. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19603. in @file{libavutil/frame.h}. For example, to choose
  19604. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19605. @end table
  19606. @section spectrumsynth
  19607. Synthesize audio from 2 input video spectrums, first input stream represents
  19608. magnitude across time and second represents phase across time.
  19609. The filter will transform from frequency domain as displayed in videos back
  19610. to time domain as presented in audio output.
  19611. This filter is primarily created for reversing processed @ref{showspectrum}
  19612. filter outputs, but can synthesize sound from other spectrograms too.
  19613. But in such case results are going to be poor if the phase data is not
  19614. available, because in such cases phase data need to be recreated, usually
  19615. it's just recreated from random noise.
  19616. For best results use gray only output (@code{channel} color mode in
  19617. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19618. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19619. @code{data} option. Inputs videos should generally use @code{fullframe}
  19620. slide mode as that saves resources needed for decoding video.
  19621. The filter accepts the following options:
  19622. @table @option
  19623. @item sample_rate
  19624. Specify sample rate of output audio, the sample rate of audio from which
  19625. spectrum was generated may differ.
  19626. @item channels
  19627. Set number of channels represented in input video spectrums.
  19628. @item scale
  19629. Set scale which was used when generating magnitude input spectrum.
  19630. Can be @code{lin} or @code{log}. Default is @code{log}.
  19631. @item slide
  19632. Set slide which was used when generating inputs spectrums.
  19633. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19634. Default is @code{fullframe}.
  19635. @item win_func
  19636. Set window function used for resynthesis.
  19637. @item overlap
  19638. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19639. which means optimal overlap for selected window function will be picked.
  19640. @item orientation
  19641. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19642. Default is @code{vertical}.
  19643. @end table
  19644. @subsection Examples
  19645. @itemize
  19646. @item
  19647. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19648. then resynthesize videos back to audio with spectrumsynth:
  19649. @example
  19650. 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
  19651. 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
  19652. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19653. @end example
  19654. @end itemize
  19655. @section split, asplit
  19656. Split input into several identical outputs.
  19657. @code{asplit} works with audio input, @code{split} with video.
  19658. The filter accepts a single parameter which specifies the number of outputs. If
  19659. unspecified, it defaults to 2.
  19660. @subsection Examples
  19661. @itemize
  19662. @item
  19663. Create two separate outputs from the same input:
  19664. @example
  19665. [in] split [out0][out1]
  19666. @end example
  19667. @item
  19668. To create 3 or more outputs, you need to specify the number of
  19669. outputs, like in:
  19670. @example
  19671. [in] asplit=3 [out0][out1][out2]
  19672. @end example
  19673. @item
  19674. Create two separate outputs from the same input, one cropped and
  19675. one padded:
  19676. @example
  19677. [in] split [splitout1][splitout2];
  19678. [splitout1] crop=100:100:0:0 [cropout];
  19679. [splitout2] pad=200:200:100:100 [padout];
  19680. @end example
  19681. @item
  19682. Create 5 copies of the input audio with @command{ffmpeg}:
  19683. @example
  19684. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19685. @end example
  19686. @end itemize
  19687. @section zmq, azmq
  19688. Receive commands sent through a libzmq client, and forward them to
  19689. filters in the filtergraph.
  19690. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19691. must be inserted between two video filters, @code{azmq} between two
  19692. audio filters. Both are capable to send messages to any filter type.
  19693. To enable these filters you need to install the libzmq library and
  19694. headers and configure FFmpeg with @code{--enable-libzmq}.
  19695. For more information about libzmq see:
  19696. @url{http://www.zeromq.org/}
  19697. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19698. receives messages sent through a network interface defined by the
  19699. @option{bind_address} (or the abbreviation "@option{b}") option.
  19700. Default value of this option is @file{tcp://localhost:5555}. You may
  19701. want to alter this value to your needs, but do not forget to escape any
  19702. ':' signs (see @ref{filtergraph escaping}).
  19703. The received message must be in the form:
  19704. @example
  19705. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19706. @end example
  19707. @var{TARGET} specifies the target of the command, usually the name of
  19708. the filter class or a specific filter instance name. The default
  19709. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19710. but you can override this by using the @samp{filter_name@@id} syntax
  19711. (see @ref{Filtergraph syntax}).
  19712. @var{COMMAND} specifies the name of the command for the target filter.
  19713. @var{ARG} is optional and specifies the optional argument list for the
  19714. given @var{COMMAND}.
  19715. Upon reception, the message is processed and the corresponding command
  19716. is injected into the filtergraph. Depending on the result, the filter
  19717. will send a reply to the client, adopting the format:
  19718. @example
  19719. @var{ERROR_CODE} @var{ERROR_REASON}
  19720. @var{MESSAGE}
  19721. @end example
  19722. @var{MESSAGE} is optional.
  19723. @subsection Examples
  19724. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19725. be used to send commands processed by these filters.
  19726. Consider the following filtergraph generated by @command{ffplay}.
  19727. In this example the last overlay filter has an instance name. All other
  19728. filters will have default instance names.
  19729. @example
  19730. ffplay -dumpgraph 1 -f lavfi "
  19731. color=s=100x100:c=red [l];
  19732. color=s=100x100:c=blue [r];
  19733. nullsrc=s=200x100, zmq [bg];
  19734. [bg][l] overlay [bg+l];
  19735. [bg+l][r] overlay@@my=x=100 "
  19736. @end example
  19737. To change the color of the left side of the video, the following
  19738. command can be used:
  19739. @example
  19740. echo Parsed_color_0 c yellow | tools/zmqsend
  19741. @end example
  19742. To change the right side:
  19743. @example
  19744. echo Parsed_color_1 c pink | tools/zmqsend
  19745. @end example
  19746. To change the position of the right side:
  19747. @example
  19748. echo overlay@@my x 150 | tools/zmqsend
  19749. @end example
  19750. @c man end MULTIMEDIA FILTERS
  19751. @chapter Multimedia Sources
  19752. @c man begin MULTIMEDIA SOURCES
  19753. Below is a description of the currently available multimedia sources.
  19754. @section amovie
  19755. This is the same as @ref{movie} source, except it selects an audio
  19756. stream by default.
  19757. @anchor{movie}
  19758. @section movie
  19759. Read audio and/or video stream(s) from a movie container.
  19760. It accepts the following parameters:
  19761. @table @option
  19762. @item filename
  19763. The name of the resource to read (not necessarily a file; it can also be a
  19764. device or a stream accessed through some protocol).
  19765. @item format_name, f
  19766. Specifies the format assumed for the movie to read, and can be either
  19767. the name of a container or an input device. If not specified, the
  19768. format is guessed from @var{movie_name} or by probing.
  19769. @item seek_point, sp
  19770. Specifies the seek point in seconds. The frames will be output
  19771. starting from this seek point. The parameter is evaluated with
  19772. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19773. postfix. The default value is "0".
  19774. @item streams, s
  19775. Specifies the streams to read. Several streams can be specified,
  19776. separated by "+". The source will then have as many outputs, in the
  19777. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19778. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19779. respectively the default (best suited) video and audio stream. Default
  19780. is "dv", or "da" if the filter is called as "amovie".
  19781. @item stream_index, si
  19782. Specifies the index of the video stream to read. If the value is -1,
  19783. the most suitable video stream will be automatically selected. The default
  19784. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19785. audio instead of video.
  19786. @item loop
  19787. Specifies how many times to read the stream in sequence.
  19788. If the value is 0, the stream will be looped infinitely.
  19789. Default value is "1".
  19790. Note that when the movie is looped the source timestamps are not
  19791. changed, so it will generate non monotonically increasing timestamps.
  19792. @item discontinuity
  19793. Specifies the time difference between frames above which the point is
  19794. considered a timestamp discontinuity which is removed by adjusting the later
  19795. timestamps.
  19796. @end table
  19797. It allows overlaying a second video on top of the main input of
  19798. a filtergraph, as shown in this graph:
  19799. @example
  19800. input -----------> deltapts0 --> overlay --> output
  19801. ^
  19802. |
  19803. movie --> scale--> deltapts1 -------+
  19804. @end example
  19805. @subsection Examples
  19806. @itemize
  19807. @item
  19808. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19809. on top of the input labelled "in":
  19810. @example
  19811. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19812. [in] setpts=PTS-STARTPTS [main];
  19813. [main][over] overlay=16:16 [out]
  19814. @end example
  19815. @item
  19816. Read from a video4linux2 device, and overlay it on top of the input
  19817. labelled "in":
  19818. @example
  19819. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19820. [in] setpts=PTS-STARTPTS [main];
  19821. [main][over] overlay=16:16 [out]
  19822. @end example
  19823. @item
  19824. Read the first video stream and the audio stream with id 0x81 from
  19825. dvd.vob; the video is connected to the pad named "video" and the audio is
  19826. connected to the pad named "audio":
  19827. @example
  19828. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19829. @end example
  19830. @end itemize
  19831. @subsection Commands
  19832. Both movie and amovie support the following commands:
  19833. @table @option
  19834. @item seek
  19835. Perform seek using "av_seek_frame".
  19836. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19837. @itemize
  19838. @item
  19839. @var{stream_index}: If stream_index is -1, a default
  19840. stream is selected, and @var{timestamp} is automatically converted
  19841. from AV_TIME_BASE units to the stream specific time_base.
  19842. @item
  19843. @var{timestamp}: Timestamp in AVStream.time_base units
  19844. or, if no stream is specified, in AV_TIME_BASE units.
  19845. @item
  19846. @var{flags}: Flags which select direction and seeking mode.
  19847. @end itemize
  19848. @item get_duration
  19849. Get movie duration in AV_TIME_BASE units.
  19850. @end table
  19851. @c man end MULTIMEDIA SOURCES