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.

23783 lines
632KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size. Allowed range is from 16 to 131072.
  878. Default is @code{4096}
  879. @item win_func
  880. Set window function. Default is @code{hann}.
  881. @item overlap
  882. Set window overlap. If set to 1, the recommended overlap for selected
  883. window function will be picked. Default is @code{0.75}.
  884. @end table
  885. @subsection Examples
  886. @itemize
  887. @item
  888. Leave almost only low frequencies in audio:
  889. @example
  890. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  891. @end example
  892. @end itemize
  893. @anchor{afir}
  894. @section afir
  895. Apply an arbitrary Frequency Impulse Response filter.
  896. This filter is designed for applying long FIR filters,
  897. up to 60 seconds long.
  898. It can be used as component for digital crossover filters,
  899. room equalization, cross talk cancellation, wavefield synthesis,
  900. auralization, ambiophonics, ambisonics and spatialization.
  901. This filter uses second stream as FIR coefficients.
  902. If second stream holds single channel, it will be used
  903. for all input channels in first stream, otherwise
  904. number of channels in second stream must be same as
  905. number of channels in first stream.
  906. It accepts the following parameters:
  907. @table @option
  908. @item dry
  909. Set dry gain. This sets input gain.
  910. @item wet
  911. Set wet gain. This sets final output gain.
  912. @item length
  913. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  914. @item gtype
  915. Enable applying gain measured from power of IR.
  916. Set which approach to use for auto gain measurement.
  917. @table @option
  918. @item none
  919. Do not apply any gain.
  920. @item peak
  921. select peak gain, very conservative approach. This is default value.
  922. @item dc
  923. select DC gain, limited application.
  924. @item gn
  925. select gain to noise approach, this is most popular one.
  926. @end table
  927. @item irgain
  928. Set gain to be applied to IR coefficients before filtering.
  929. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  930. @item irfmt
  931. Set format of IR stream. Can be @code{mono} or @code{input}.
  932. Default is @code{input}.
  933. @item maxir
  934. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  935. Allowed range is 0.1 to 60 seconds.
  936. @item response
  937. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  938. By default it is disabled.
  939. @item channel
  940. Set for which IR channel to display frequency response. By default is first channel
  941. displayed. This option is used only when @var{response} is enabled.
  942. @item size
  943. Set video stream size. This option is used only when @var{response} is enabled.
  944. @item rate
  945. Set video stream frame rate. This option is used only when @var{response} is enabled.
  946. @item minp
  947. Set minimal partition size used for convolution. Default is @var{8192}.
  948. Allowed range is from @var{8} to @var{32768}.
  949. Lower values decreases latency at cost of higher CPU usage.
  950. @item maxp
  951. Set maximal partition size used for convolution. Default is @var{8192}.
  952. Allowed range is from @var{8} to @var{32768}.
  953. Lower values may increase CPU usage.
  954. @end table
  955. @subsection Examples
  956. @itemize
  957. @item
  958. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  959. @example
  960. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  961. @end example
  962. @end itemize
  963. @anchor{aformat}
  964. @section aformat
  965. Set output format constraints for the input audio. The framework will
  966. negotiate the most appropriate format to minimize conversions.
  967. It accepts the following parameters:
  968. @table @option
  969. @item sample_fmts
  970. A '|'-separated list of requested sample formats.
  971. @item sample_rates
  972. A '|'-separated list of requested sample rates.
  973. @item channel_layouts
  974. A '|'-separated list of requested channel layouts.
  975. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  976. for the required syntax.
  977. @end table
  978. If a parameter is omitted, all values are allowed.
  979. Force the output to either unsigned 8-bit or signed 16-bit stereo
  980. @example
  981. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  982. @end example
  983. @section agate
  984. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  985. processing reduces disturbing noise between useful signals.
  986. Gating is done by detecting the volume below a chosen level @var{threshold}
  987. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  988. floor is set via @var{range}. Because an exact manipulation of the signal
  989. would cause distortion of the waveform the reduction can be levelled over
  990. time. This is done by setting @var{attack} and @var{release}.
  991. @var{attack} determines how long the signal has to fall below the threshold
  992. before any reduction will occur and @var{release} sets the time the signal
  993. has to rise above the threshold to reduce the reduction again.
  994. Shorter signals than the chosen attack time will be left untouched.
  995. @table @option
  996. @item level_in
  997. Set input level before filtering.
  998. Default is 1. Allowed range is from 0.015625 to 64.
  999. @item mode
  1000. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1001. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1002. will be amplified, expanding dynamic range in upward direction.
  1003. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1004. @item range
  1005. Set the level of gain reduction when the signal is below the threshold.
  1006. Default is 0.06125. Allowed range is from 0 to 1.
  1007. Setting this to 0 disables reduction and then filter behaves like expander.
  1008. @item threshold
  1009. If a signal rises above this level the gain reduction is released.
  1010. Default is 0.125. Allowed range is from 0 to 1.
  1011. @item ratio
  1012. Set a ratio by which the signal is reduced.
  1013. Default is 2. Allowed range is from 1 to 9000.
  1014. @item attack
  1015. Amount of milliseconds the signal has to rise above the threshold before gain
  1016. reduction stops.
  1017. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1018. @item release
  1019. Amount of milliseconds the signal has to fall below the threshold before the
  1020. reduction is increased again. Default is 250 milliseconds.
  1021. Allowed range is from 0.01 to 9000.
  1022. @item makeup
  1023. Set amount of amplification of signal after processing.
  1024. Default is 1. Allowed range is from 1 to 64.
  1025. @item knee
  1026. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1027. Default is 2.828427125. Allowed range is from 1 to 8.
  1028. @item detection
  1029. Choose if exact signal should be taken for detection or an RMS like one.
  1030. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1031. @item link
  1032. Choose if the average level between all channels or the louder channel affects
  1033. the reduction.
  1034. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1035. @end table
  1036. @section aiir
  1037. Apply an arbitrary Infinite Impulse Response filter.
  1038. It accepts the following parameters:
  1039. @table @option
  1040. @item z
  1041. Set numerator/zeros coefficients.
  1042. @item p
  1043. Set denominator/poles coefficients.
  1044. @item k
  1045. Set channels gains.
  1046. @item dry_gain
  1047. Set input gain.
  1048. @item wet_gain
  1049. Set output gain.
  1050. @item f
  1051. Set coefficients format.
  1052. @table @samp
  1053. @item tf
  1054. transfer function
  1055. @item zp
  1056. Z-plane zeros/poles, cartesian (default)
  1057. @item pr
  1058. Z-plane zeros/poles, polar radians
  1059. @item pd
  1060. Z-plane zeros/poles, polar degrees
  1061. @end table
  1062. @item r
  1063. Set kind of processing.
  1064. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1065. @item e
  1066. Set filtering precision.
  1067. @table @samp
  1068. @item dbl
  1069. double-precision floating-point (default)
  1070. @item flt
  1071. single-precision floating-point
  1072. @item i32
  1073. 32-bit integers
  1074. @item i16
  1075. 16-bit integers
  1076. @end table
  1077. @item mix
  1078. How much to use filtered signal in output. Default is 1.
  1079. Range is between 0 and 1.
  1080. @item response
  1081. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1082. By default it is disabled.
  1083. @item channel
  1084. Set for which IR channel to display frequency response. By default is first channel
  1085. displayed. This option is used only when @var{response} is enabled.
  1086. @item size
  1087. Set video stream size. This option is used only when @var{response} is enabled.
  1088. @end table
  1089. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1090. order.
  1091. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1092. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1093. imaginary unit.
  1094. Different coefficients and gains can be provided for every channel, in such case
  1095. use '|' to separate coefficients or gains. Last provided coefficients will be
  1096. used for all remaining channels.
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1101. @example
  1102. 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
  1103. @end example
  1104. @item
  1105. Same as above but in @code{zp} format:
  1106. @example
  1107. 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
  1108. @end example
  1109. @end itemize
  1110. @section alimiter
  1111. The limiter prevents an input signal from rising over a desired threshold.
  1112. This limiter uses lookahead technology to prevent your signal from distorting.
  1113. It means that there is a small delay after the signal is processed. Keep in mind
  1114. that the delay it produces is the attack time you set.
  1115. The filter accepts the following options:
  1116. @table @option
  1117. @item level_in
  1118. Set input gain. Default is 1.
  1119. @item level_out
  1120. Set output gain. Default is 1.
  1121. @item limit
  1122. Don't let signals above this level pass the limiter. Default is 1.
  1123. @item attack
  1124. The limiter will reach its attenuation level in this amount of time in
  1125. milliseconds. Default is 5 milliseconds.
  1126. @item release
  1127. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1128. Default is 50 milliseconds.
  1129. @item asc
  1130. When gain reduction is always needed ASC takes care of releasing to an
  1131. average reduction level rather than reaching a reduction of 0 in the release
  1132. time.
  1133. @item asc_level
  1134. Select how much the release time is affected by ASC, 0 means nearly no changes
  1135. in release time while 1 produces higher release times.
  1136. @item level
  1137. Auto level output signal. Default is enabled.
  1138. This normalizes audio back to 0dB if enabled.
  1139. @end table
  1140. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1141. with @ref{aresample} before applying this filter.
  1142. @section allpass
  1143. Apply a two-pole all-pass filter with central frequency (in Hz)
  1144. @var{frequency}, and filter-width @var{width}.
  1145. An all-pass filter changes the audio's frequency to phase relationship
  1146. without changing its frequency to amplitude relationship.
  1147. The filter accepts the following options:
  1148. @table @option
  1149. @item frequency, f
  1150. Set frequency in Hz.
  1151. @item width_type, t
  1152. Set method to specify band-width of filter.
  1153. @table @option
  1154. @item h
  1155. Hz
  1156. @item q
  1157. Q-Factor
  1158. @item o
  1159. octave
  1160. @item s
  1161. slope
  1162. @item k
  1163. kHz
  1164. @end table
  1165. @item width, w
  1166. Specify the band-width of a filter in width_type units.
  1167. @item mix, m
  1168. How much to use filtered signal in output. Default is 1.
  1169. Range is between 0 and 1.
  1170. @item channels, c
  1171. Specify which channels to filter, by default all available are filtered.
  1172. @end table
  1173. @subsection Commands
  1174. This filter supports the following commands:
  1175. @table @option
  1176. @item frequency, f
  1177. Change allpass frequency.
  1178. Syntax for the command is : "@var{frequency}"
  1179. @item width_type, t
  1180. Change allpass width_type.
  1181. Syntax for the command is : "@var{width_type}"
  1182. @item width, w
  1183. Change allpass width.
  1184. Syntax for the command is : "@var{width}"
  1185. @item mix, m
  1186. Change allpass mix.
  1187. Syntax for the command is : "@var{mix}"
  1188. @end table
  1189. @section aloop
  1190. Loop audio samples.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item loop
  1194. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1195. Default is 0.
  1196. @item size
  1197. Set maximal number of samples. Default is 0.
  1198. @item start
  1199. Set first sample of loop. Default is 0.
  1200. @end table
  1201. @anchor{amerge}
  1202. @section amerge
  1203. Merge two or more audio streams into a single multi-channel stream.
  1204. The filter accepts the following options:
  1205. @table @option
  1206. @item inputs
  1207. Set the number of inputs. Default is 2.
  1208. @end table
  1209. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1210. the channel layout of the output will be set accordingly and the channels
  1211. will be reordered as necessary. If the channel layouts of the inputs are not
  1212. disjoint, the output will have all the channels of the first input then all
  1213. the channels of the second input, in that order, and the channel layout of
  1214. the output will be the default value corresponding to the total number of
  1215. channels.
  1216. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1217. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1218. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1219. first input, b1 is the first channel of the second input).
  1220. On the other hand, if both input are in stereo, the output channels will be
  1221. in the default order: a1, a2, b1, b2, and the channel layout will be
  1222. arbitrarily set to 4.0, which may or may not be the expected value.
  1223. All inputs must have the same sample rate, and format.
  1224. If inputs do not have the same duration, the output will stop with the
  1225. shortest.
  1226. @subsection Examples
  1227. @itemize
  1228. @item
  1229. Merge two mono files into a stereo stream:
  1230. @example
  1231. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1232. @end example
  1233. @item
  1234. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1235. @example
  1236. 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
  1237. @end example
  1238. @end itemize
  1239. @section amix
  1240. Mixes multiple audio inputs into a single output.
  1241. Note that this filter only supports float samples (the @var{amerge}
  1242. and @var{pan} audio filters support many formats). If the @var{amix}
  1243. input has integer samples then @ref{aresample} will be automatically
  1244. inserted to perform the conversion to float samples.
  1245. For example
  1246. @example
  1247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1248. @end example
  1249. will mix 3 input audio streams to a single output with the same duration as the
  1250. first input and a dropout transition time of 3 seconds.
  1251. It accepts the following parameters:
  1252. @table @option
  1253. @item inputs
  1254. The number of inputs. If unspecified, it defaults to 2.
  1255. @item duration
  1256. How to determine the end-of-stream.
  1257. @table @option
  1258. @item longest
  1259. The duration of the longest input. (default)
  1260. @item shortest
  1261. The duration of the shortest input.
  1262. @item first
  1263. The duration of the first input.
  1264. @end table
  1265. @item dropout_transition
  1266. The transition time, in seconds, for volume renormalization when an input
  1267. stream ends. The default value is 2 seconds.
  1268. @item weights
  1269. Specify weight of each input audio stream as sequence.
  1270. Each weight is separated by space. By default all inputs have same weight.
  1271. @end table
  1272. @section amultiply
  1273. Multiply first audio stream with second audio stream and store result
  1274. in output audio stream. Multiplication is done by multiplying each
  1275. sample from first stream with sample at same position from second stream.
  1276. With this element-wise multiplication one can create amplitude fades and
  1277. amplitude modulations.
  1278. @section anequalizer
  1279. High-order parametric multiband equalizer for each channel.
  1280. It accepts the following parameters:
  1281. @table @option
  1282. @item params
  1283. This option string is in format:
  1284. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1285. Each equalizer band is separated by '|'.
  1286. @table @option
  1287. @item chn
  1288. Set channel number to which equalization will be applied.
  1289. If input doesn't have that channel the entry is ignored.
  1290. @item f
  1291. Set central frequency for band.
  1292. If input doesn't have that frequency the entry is ignored.
  1293. @item w
  1294. Set band width in hertz.
  1295. @item g
  1296. Set band gain in dB.
  1297. @item t
  1298. Set filter type for band, optional, can be:
  1299. @table @samp
  1300. @item 0
  1301. Butterworth, this is default.
  1302. @item 1
  1303. Chebyshev type 1.
  1304. @item 2
  1305. Chebyshev type 2.
  1306. @end table
  1307. @end table
  1308. @item curves
  1309. With this option activated frequency response of anequalizer is displayed
  1310. in video stream.
  1311. @item size
  1312. Set video stream size. Only useful if curves option is activated.
  1313. @item mgain
  1314. Set max gain that will be displayed. Only useful if curves option is activated.
  1315. Setting this to a reasonable value makes it possible to display gain which is derived from
  1316. neighbour bands which are too close to each other and thus produce higher gain
  1317. when both are activated.
  1318. @item fscale
  1319. Set frequency scale used to draw frequency response in video output.
  1320. Can be linear or logarithmic. Default is logarithmic.
  1321. @item colors
  1322. Set color for each channel curve which is going to be displayed in video stream.
  1323. This is list of color names separated by space or by '|'.
  1324. Unrecognised or missing colors will be replaced by white color.
  1325. @end table
  1326. @subsection Examples
  1327. @itemize
  1328. @item
  1329. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1330. for first 2 channels using Chebyshev type 1 filter:
  1331. @example
  1332. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1333. @end example
  1334. @end itemize
  1335. @subsection Commands
  1336. This filter supports the following commands:
  1337. @table @option
  1338. @item change
  1339. Alter existing filter parameters.
  1340. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1341. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1342. error is returned.
  1343. @var{freq} set new frequency parameter.
  1344. @var{width} set new width parameter in herz.
  1345. @var{gain} set new gain parameter in dB.
  1346. Full filter invocation with asendcmd may look like this:
  1347. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1348. @end table
  1349. @section anlmdn
  1350. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1351. Each sample is adjusted by looking for other samples with similar contexts. This
  1352. context similarity is defined by comparing their surrounding patches of size
  1353. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1354. The filter accepts the following options.
  1355. @table @option
  1356. @item s
  1357. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1358. @item p
  1359. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1360. Default value is 2 milliseconds.
  1361. @item r
  1362. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1363. Default value is 6 milliseconds.
  1364. @item o
  1365. Set the output mode.
  1366. It accepts the following values:
  1367. @table @option
  1368. @item i
  1369. Pass input unchanged.
  1370. @item o
  1371. Pass noise filtered out.
  1372. @item n
  1373. Pass only noise.
  1374. Default value is @var{o}.
  1375. @end table
  1376. @item m
  1377. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1378. @end table
  1379. @subsection Commands
  1380. This filter supports the following commands:
  1381. @table @option
  1382. @item s
  1383. Change denoise strength. Argument is single float number.
  1384. Syntax for the command is : "@var{s}"
  1385. @item o
  1386. Change output mode.
  1387. Syntax for the command is : "i", "o" or "n" string.
  1388. @end table
  1389. @section anull
  1390. Pass the audio source unchanged to the output.
  1391. @section apad
  1392. Pad the end of an audio stream with silence.
  1393. This can be used together with @command{ffmpeg} @option{-shortest} to
  1394. extend audio streams to the same length as the video stream.
  1395. A description of the accepted options follows.
  1396. @table @option
  1397. @item packet_size
  1398. Set silence packet size. Default value is 4096.
  1399. @item pad_len
  1400. Set the number of samples of silence to add to the end. After the
  1401. value is reached, the stream is terminated. This option is mutually
  1402. exclusive with @option{whole_len}.
  1403. @item whole_len
  1404. Set the minimum total number of samples in the output audio stream. If
  1405. the value is longer than the input audio length, silence is added to
  1406. the end, until the value is reached. This option is mutually exclusive
  1407. with @option{pad_len}.
  1408. @item pad_dur
  1409. Specify the duration of samples of silence to add. See
  1410. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1411. for the accepted syntax. Used only if set to non-zero value.
  1412. @item whole_dur
  1413. Specify the minimum total duration in the output audio stream. See
  1414. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1415. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1416. the input audio length, silence is added to the end, until the value is reached.
  1417. This option is mutually exclusive with @option{pad_dur}
  1418. @end table
  1419. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1420. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1421. the input stream indefinitely.
  1422. @subsection Examples
  1423. @itemize
  1424. @item
  1425. Add 1024 samples of silence to the end of the input:
  1426. @example
  1427. apad=pad_len=1024
  1428. @end example
  1429. @item
  1430. Make sure the audio output will contain at least 10000 samples, pad
  1431. the input with silence if required:
  1432. @example
  1433. apad=whole_len=10000
  1434. @end example
  1435. @item
  1436. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1437. video stream will always result the shortest and will be converted
  1438. until the end in the output file when using the @option{shortest}
  1439. option:
  1440. @example
  1441. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1442. @end example
  1443. @end itemize
  1444. @section aphaser
  1445. Add a phasing effect to the input audio.
  1446. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1447. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1448. A description of the accepted parameters follows.
  1449. @table @option
  1450. @item in_gain
  1451. Set input gain. Default is 0.4.
  1452. @item out_gain
  1453. Set output gain. Default is 0.74
  1454. @item delay
  1455. Set delay in milliseconds. Default is 3.0.
  1456. @item decay
  1457. Set decay. Default is 0.4.
  1458. @item speed
  1459. Set modulation speed in Hz. Default is 0.5.
  1460. @item type
  1461. Set modulation type. Default is triangular.
  1462. It accepts the following values:
  1463. @table @samp
  1464. @item triangular, t
  1465. @item sinusoidal, s
  1466. @end table
  1467. @end table
  1468. @section apulsator
  1469. Audio pulsator is something between an autopanner and a tremolo.
  1470. But it can produce funny stereo effects as well. Pulsator changes the volume
  1471. of the left and right channel based on a LFO (low frequency oscillator) with
  1472. different waveforms and shifted phases.
  1473. This filter have the ability to define an offset between left and right
  1474. channel. An offset of 0 means that both LFO shapes match each other.
  1475. The left and right channel are altered equally - a conventional tremolo.
  1476. An offset of 50% means that the shape of the right channel is exactly shifted
  1477. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1478. an autopanner. At 1 both curves match again. Every setting in between moves the
  1479. phase shift gapless between all stages and produces some "bypassing" sounds with
  1480. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1481. the 0.5) the faster the signal passes from the left to the right speaker.
  1482. The filter accepts the following options:
  1483. @table @option
  1484. @item level_in
  1485. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1486. @item level_out
  1487. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1488. @item mode
  1489. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1490. sawup or sawdown. Default is sine.
  1491. @item amount
  1492. Set modulation. Define how much of original signal is affected by the LFO.
  1493. @item offset_l
  1494. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1495. @item offset_r
  1496. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1497. @item width
  1498. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1499. @item timing
  1500. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1501. @item bpm
  1502. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1503. is set to bpm.
  1504. @item ms
  1505. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1506. is set to ms.
  1507. @item hz
  1508. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1509. if timing is set to hz.
  1510. @end table
  1511. @anchor{aresample}
  1512. @section aresample
  1513. Resample the input audio to the specified parameters, using the
  1514. libswresample library. If none are specified then the filter will
  1515. automatically convert between its input and output.
  1516. This filter is also able to stretch/squeeze the audio data to make it match
  1517. the timestamps or to inject silence / cut out audio to make it match the
  1518. timestamps, do a combination of both or do neither.
  1519. The filter accepts the syntax
  1520. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1521. expresses a sample rate and @var{resampler_options} is a list of
  1522. @var{key}=@var{value} pairs, separated by ":". See the
  1523. @ref{Resampler Options,,"Resampler Options" section in the
  1524. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1525. for the complete list of supported options.
  1526. @subsection Examples
  1527. @itemize
  1528. @item
  1529. Resample the input audio to 44100Hz:
  1530. @example
  1531. aresample=44100
  1532. @end example
  1533. @item
  1534. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1535. samples per second compensation:
  1536. @example
  1537. aresample=async=1000
  1538. @end example
  1539. @end itemize
  1540. @section areverse
  1541. Reverse an audio clip.
  1542. Warning: This filter requires memory to buffer the entire clip, so trimming
  1543. is suggested.
  1544. @subsection Examples
  1545. @itemize
  1546. @item
  1547. Take the first 5 seconds of a clip, and reverse it.
  1548. @example
  1549. atrim=end=5,areverse
  1550. @end example
  1551. @end itemize
  1552. @section asetnsamples
  1553. Set the number of samples per each output audio frame.
  1554. The last output packet may contain a different number of samples, as
  1555. the filter will flush all the remaining samples when the input audio
  1556. signals its end.
  1557. The filter accepts the following options:
  1558. @table @option
  1559. @item nb_out_samples, n
  1560. Set the number of frames per each output audio frame. The number is
  1561. intended as the number of samples @emph{per each channel}.
  1562. Default value is 1024.
  1563. @item pad, p
  1564. If set to 1, the filter will pad the last audio frame with zeroes, so
  1565. that the last frame will contain the same number of samples as the
  1566. previous ones. Default value is 1.
  1567. @end table
  1568. For example, to set the number of per-frame samples to 1234 and
  1569. disable padding for the last frame, use:
  1570. @example
  1571. asetnsamples=n=1234:p=0
  1572. @end example
  1573. @section asetrate
  1574. Set the sample rate without altering the PCM data.
  1575. This will result in a change of speed and pitch.
  1576. The filter accepts the following options:
  1577. @table @option
  1578. @item sample_rate, r
  1579. Set the output sample rate. Default is 44100 Hz.
  1580. @end table
  1581. @section ashowinfo
  1582. Show a line containing various information for each input audio frame.
  1583. The input audio is not modified.
  1584. The shown line contains a sequence of key/value pairs of the form
  1585. @var{key}:@var{value}.
  1586. The following values are shown in the output:
  1587. @table @option
  1588. @item n
  1589. The (sequential) number of the input frame, starting from 0.
  1590. @item pts
  1591. The presentation timestamp of the input frame, in time base units; the time base
  1592. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1593. @item pts_time
  1594. The presentation timestamp of the input frame in seconds.
  1595. @item pos
  1596. position of the frame in the input stream, -1 if this information in
  1597. unavailable and/or meaningless (for example in case of synthetic audio)
  1598. @item fmt
  1599. The sample format.
  1600. @item chlayout
  1601. The channel layout.
  1602. @item rate
  1603. The sample rate for the audio frame.
  1604. @item nb_samples
  1605. The number of samples (per channel) in the frame.
  1606. @item checksum
  1607. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1608. audio, the data is treated as if all the planes were concatenated.
  1609. @item plane_checksums
  1610. A list of Adler-32 checksums for each data plane.
  1611. @end table
  1612. @section asoftclip
  1613. Apply audio soft clipping.
  1614. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1615. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1616. This filter accepts the following options:
  1617. @table @option
  1618. @item type
  1619. Set type of soft-clipping.
  1620. It accepts the following values:
  1621. @table @option
  1622. @item tanh
  1623. @item atan
  1624. @item cubic
  1625. @item exp
  1626. @item alg
  1627. @item quintic
  1628. @item sin
  1629. @end table
  1630. @item param
  1631. Set additional parameter which controls sigmoid function.
  1632. @end table
  1633. @section asr
  1634. Automatic Speech Recognition
  1635. This filter uses PocketSphinx for speech recognition. To enable
  1636. compilation of this filter, you need to configure FFmpeg with
  1637. @code{--enable-pocketsphinx}.
  1638. It accepts the following options:
  1639. @table @option
  1640. @item rate
  1641. Set sampling rate of input audio. Defaults is @code{16000}.
  1642. This need to match speech models, otherwise one will get poor results.
  1643. @item hmm
  1644. Set dictionary containing acoustic model files.
  1645. @item dict
  1646. Set pronunciation dictionary.
  1647. @item lm
  1648. Set language model file.
  1649. @item lmctl
  1650. Set language model set.
  1651. @item lmname
  1652. Set which language model to use.
  1653. @item logfn
  1654. Set output for log messages.
  1655. @end table
  1656. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1657. @anchor{astats}
  1658. @section astats
  1659. Display time domain statistical information about the audio channels.
  1660. Statistics are calculated and displayed for each audio channel and,
  1661. where applicable, an overall figure is also given.
  1662. It accepts the following option:
  1663. @table @option
  1664. @item length
  1665. Short window length in seconds, used for peak and trough RMS measurement.
  1666. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1667. @item metadata
  1668. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1669. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1670. disabled.
  1671. Available keys for each channel are:
  1672. DC_offset
  1673. Min_level
  1674. Max_level
  1675. Min_difference
  1676. Max_difference
  1677. Mean_difference
  1678. RMS_difference
  1679. Peak_level
  1680. RMS_peak
  1681. RMS_trough
  1682. Crest_factor
  1683. Flat_factor
  1684. Peak_count
  1685. Bit_depth
  1686. Dynamic_range
  1687. Zero_crossings
  1688. Zero_crossings_rate
  1689. Number_of_NaNs
  1690. Number_of_Infs
  1691. Number_of_denormals
  1692. and for Overall:
  1693. DC_offset
  1694. Min_level
  1695. Max_level
  1696. Min_difference
  1697. Max_difference
  1698. Mean_difference
  1699. RMS_difference
  1700. Peak_level
  1701. RMS_level
  1702. RMS_peak
  1703. RMS_trough
  1704. Flat_factor
  1705. Peak_count
  1706. Bit_depth
  1707. Number_of_samples
  1708. Number_of_NaNs
  1709. Number_of_Infs
  1710. Number_of_denormals
  1711. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1712. this @code{lavfi.astats.Overall.Peak_count}.
  1713. For description what each key means read below.
  1714. @item reset
  1715. Set number of frame after which stats are going to be recalculated.
  1716. Default is disabled.
  1717. @item measure_perchannel
  1718. Select the entries which need to be measured per channel. The metadata keys can
  1719. be used as flags, default is @option{all} which measures everything.
  1720. @option{none} disables all per channel measurement.
  1721. @item measure_overall
  1722. Select the entries which need to be measured overall. The metadata keys can
  1723. be used as flags, default is @option{all} which measures everything.
  1724. @option{none} disables all overall measurement.
  1725. @end table
  1726. A description of each shown parameter follows:
  1727. @table @option
  1728. @item DC offset
  1729. Mean amplitude displacement from zero.
  1730. @item Min level
  1731. Minimal sample level.
  1732. @item Max level
  1733. Maximal sample level.
  1734. @item Min difference
  1735. Minimal difference between two consecutive samples.
  1736. @item Max difference
  1737. Maximal difference between two consecutive samples.
  1738. @item Mean difference
  1739. Mean difference between two consecutive samples.
  1740. The average of each difference between two consecutive samples.
  1741. @item RMS difference
  1742. Root Mean Square difference between two consecutive samples.
  1743. @item Peak level dB
  1744. @item RMS level dB
  1745. Standard peak and RMS level measured in dBFS.
  1746. @item RMS peak dB
  1747. @item RMS trough dB
  1748. Peak and trough values for RMS level measured over a short window.
  1749. @item Crest factor
  1750. Standard ratio of peak to RMS level (note: not in dB).
  1751. @item Flat factor
  1752. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1753. (i.e. either @var{Min level} or @var{Max level}).
  1754. @item Peak count
  1755. Number of occasions (not the number of samples) that the signal attained either
  1756. @var{Min level} or @var{Max level}.
  1757. @item Bit depth
  1758. Overall bit depth of audio. Number of bits used for each sample.
  1759. @item Dynamic range
  1760. Measured dynamic range of audio in dB.
  1761. @item Zero crossings
  1762. Number of points where the waveform crosses the zero level axis.
  1763. @item Zero crossings rate
  1764. Rate of Zero crossings and number of audio samples.
  1765. @end table
  1766. @section atempo
  1767. Adjust audio tempo.
  1768. The filter accepts exactly one parameter, the audio tempo. If not
  1769. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1770. be in the [0.5, 100.0] range.
  1771. Note that tempo greater than 2 will skip some samples rather than
  1772. blend them in. If for any reason this is a concern it is always
  1773. possible to daisy-chain several instances of atempo to achieve the
  1774. desired product tempo.
  1775. @subsection Examples
  1776. @itemize
  1777. @item
  1778. Slow down audio to 80% tempo:
  1779. @example
  1780. atempo=0.8
  1781. @end example
  1782. @item
  1783. To speed up audio to 300% tempo:
  1784. @example
  1785. atempo=3
  1786. @end example
  1787. @item
  1788. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1789. @example
  1790. atempo=sqrt(3),atempo=sqrt(3)
  1791. @end example
  1792. @end itemize
  1793. @section atrim
  1794. Trim the input so that the output contains one continuous subpart of the input.
  1795. It accepts the following parameters:
  1796. @table @option
  1797. @item start
  1798. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1799. sample with the timestamp @var{start} will be the first sample in the output.
  1800. @item end
  1801. Specify time of the first audio sample that will be dropped, i.e. the
  1802. audio sample immediately preceding the one with the timestamp @var{end} will be
  1803. the last sample in the output.
  1804. @item start_pts
  1805. Same as @var{start}, except this option sets the start timestamp in samples
  1806. instead of seconds.
  1807. @item end_pts
  1808. Same as @var{end}, except this option sets the end timestamp in samples instead
  1809. of seconds.
  1810. @item duration
  1811. The maximum duration of the output in seconds.
  1812. @item start_sample
  1813. The number of the first sample that should be output.
  1814. @item end_sample
  1815. The number of the first sample that should be dropped.
  1816. @end table
  1817. @option{start}, @option{end}, and @option{duration} are expressed as time
  1818. duration specifications; see
  1819. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1820. Note that the first two sets of the start/end options and the @option{duration}
  1821. option look at the frame timestamp, while the _sample options simply count the
  1822. samples that pass through the filter. So start/end_pts and start/end_sample will
  1823. give different results when the timestamps are wrong, inexact or do not start at
  1824. zero. Also note that this filter does not modify the timestamps. If you wish
  1825. to have the output timestamps start at zero, insert the asetpts filter after the
  1826. atrim filter.
  1827. If multiple start or end options are set, this filter tries to be greedy and
  1828. keep all samples that match at least one of the specified constraints. To keep
  1829. only the part that matches all the constraints at once, chain multiple atrim
  1830. filters.
  1831. The defaults are such that all the input is kept. So it is possible to set e.g.
  1832. just the end values to keep everything before the specified time.
  1833. Examples:
  1834. @itemize
  1835. @item
  1836. Drop everything except the second minute of input:
  1837. @example
  1838. ffmpeg -i INPUT -af atrim=60:120
  1839. @end example
  1840. @item
  1841. Keep only the first 1000 samples:
  1842. @example
  1843. ffmpeg -i INPUT -af atrim=end_sample=1000
  1844. @end example
  1845. @end itemize
  1846. @section bandpass
  1847. Apply a two-pole Butterworth band-pass filter with central
  1848. frequency @var{frequency}, and (3dB-point) band-width width.
  1849. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1850. instead of the default: constant 0dB peak gain.
  1851. The filter roll off at 6dB per octave (20dB per decade).
  1852. The filter accepts the following options:
  1853. @table @option
  1854. @item frequency, f
  1855. Set the filter's central frequency. Default is @code{3000}.
  1856. @item csg
  1857. Constant skirt gain if set to 1. Defaults to 0.
  1858. @item width_type, t
  1859. Set method to specify band-width of filter.
  1860. @table @option
  1861. @item h
  1862. Hz
  1863. @item q
  1864. Q-Factor
  1865. @item o
  1866. octave
  1867. @item s
  1868. slope
  1869. @item k
  1870. kHz
  1871. @end table
  1872. @item width, w
  1873. Specify the band-width of a filter in width_type units.
  1874. @item mix, m
  1875. How much to use filtered signal in output. Default is 1.
  1876. Range is between 0 and 1.
  1877. @item channels, c
  1878. Specify which channels to filter, by default all available are filtered.
  1879. @end table
  1880. @subsection Commands
  1881. This filter supports the following commands:
  1882. @table @option
  1883. @item frequency, f
  1884. Change bandpass frequency.
  1885. Syntax for the command is : "@var{frequency}"
  1886. @item width_type, t
  1887. Change bandpass width_type.
  1888. Syntax for the command is : "@var{width_type}"
  1889. @item width, w
  1890. Change bandpass width.
  1891. Syntax for the command is : "@var{width}"
  1892. @item mix, m
  1893. Change bandpass mix.
  1894. Syntax for the command is : "@var{mix}"
  1895. @end table
  1896. @section bandreject
  1897. Apply a two-pole Butterworth band-reject filter with central
  1898. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1899. The filter roll off at 6dB per octave (20dB per decade).
  1900. The filter accepts the following options:
  1901. @table @option
  1902. @item frequency, f
  1903. Set the filter's central frequency. Default is @code{3000}.
  1904. @item width_type, t
  1905. Set method to specify band-width of filter.
  1906. @table @option
  1907. @item h
  1908. Hz
  1909. @item q
  1910. Q-Factor
  1911. @item o
  1912. octave
  1913. @item s
  1914. slope
  1915. @item k
  1916. kHz
  1917. @end table
  1918. @item width, w
  1919. Specify the band-width of a filter in width_type units.
  1920. @item mix, m
  1921. How much to use filtered signal in output. Default is 1.
  1922. Range is between 0 and 1.
  1923. @item channels, c
  1924. Specify which channels to filter, by default all available are filtered.
  1925. @end table
  1926. @subsection Commands
  1927. This filter supports the following commands:
  1928. @table @option
  1929. @item frequency, f
  1930. Change bandreject frequency.
  1931. Syntax for the command is : "@var{frequency}"
  1932. @item width_type, t
  1933. Change bandreject width_type.
  1934. Syntax for the command is : "@var{width_type}"
  1935. @item width, w
  1936. Change bandreject width.
  1937. Syntax for the command is : "@var{width}"
  1938. @item mix, m
  1939. Change bandreject mix.
  1940. Syntax for the command is : "@var{mix}"
  1941. @end table
  1942. @section bass, lowshelf
  1943. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1944. shelving filter with a response similar to that of a standard
  1945. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1946. The filter accepts the following options:
  1947. @table @option
  1948. @item gain, g
  1949. Give the gain at 0 Hz. Its useful range is about -20
  1950. (for a large cut) to +20 (for a large boost).
  1951. Beware of clipping when using a positive gain.
  1952. @item frequency, f
  1953. Set the filter's central frequency and so can be used
  1954. to extend or reduce the frequency range to be boosted or cut.
  1955. The default value is @code{100} Hz.
  1956. @item width_type, t
  1957. Set method to specify band-width of filter.
  1958. @table @option
  1959. @item h
  1960. Hz
  1961. @item q
  1962. Q-Factor
  1963. @item o
  1964. octave
  1965. @item s
  1966. slope
  1967. @item k
  1968. kHz
  1969. @end table
  1970. @item width, w
  1971. Determine how steep is the filter's shelf transition.
  1972. @item mix, m
  1973. How much to use filtered signal in output. Default is 1.
  1974. Range is between 0 and 1.
  1975. @item channels, c
  1976. Specify which channels to filter, by default all available are filtered.
  1977. @end table
  1978. @subsection Commands
  1979. This filter supports the following commands:
  1980. @table @option
  1981. @item frequency, f
  1982. Change bass frequency.
  1983. Syntax for the command is : "@var{frequency}"
  1984. @item width_type, t
  1985. Change bass width_type.
  1986. Syntax for the command is : "@var{width_type}"
  1987. @item width, w
  1988. Change bass width.
  1989. Syntax for the command is : "@var{width}"
  1990. @item gain, g
  1991. Change bass gain.
  1992. Syntax for the command is : "@var{gain}"
  1993. @item mix, m
  1994. Change bass mix.
  1995. Syntax for the command is : "@var{mix}"
  1996. @end table
  1997. @section biquad
  1998. Apply a biquad IIR filter with the given coefficients.
  1999. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2000. are the numerator and denominator coefficients respectively.
  2001. and @var{channels}, @var{c} specify which channels to filter, by default all
  2002. available are filtered.
  2003. @subsection Commands
  2004. This filter supports the following commands:
  2005. @table @option
  2006. @item a0
  2007. @item a1
  2008. @item a2
  2009. @item b0
  2010. @item b1
  2011. @item b2
  2012. Change biquad parameter.
  2013. Syntax for the command is : "@var{value}"
  2014. @item mix, m
  2015. How much to use filtered signal in output. Default is 1.
  2016. Range is between 0 and 1.
  2017. @end table
  2018. @section bs2b
  2019. Bauer stereo to binaural transformation, which improves headphone listening of
  2020. stereo audio records.
  2021. To enable compilation of this filter you need to configure FFmpeg with
  2022. @code{--enable-libbs2b}.
  2023. It accepts the following parameters:
  2024. @table @option
  2025. @item profile
  2026. Pre-defined crossfeed level.
  2027. @table @option
  2028. @item default
  2029. Default level (fcut=700, feed=50).
  2030. @item cmoy
  2031. Chu Moy circuit (fcut=700, feed=60).
  2032. @item jmeier
  2033. Jan Meier circuit (fcut=650, feed=95).
  2034. @end table
  2035. @item fcut
  2036. Cut frequency (in Hz).
  2037. @item feed
  2038. Feed level (in Hz).
  2039. @end table
  2040. @section channelmap
  2041. Remap input channels to new locations.
  2042. It accepts the following parameters:
  2043. @table @option
  2044. @item map
  2045. Map channels from input to output. The argument is a '|'-separated list of
  2046. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2047. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2048. channel (e.g. FL for front left) or its index in the input channel layout.
  2049. @var{out_channel} is the name of the output channel or its index in the output
  2050. channel layout. If @var{out_channel} is not given then it is implicitly an
  2051. index, starting with zero and increasing by one for each mapping.
  2052. @item channel_layout
  2053. The channel layout of the output stream.
  2054. @end table
  2055. If no mapping is present, the filter will implicitly map input channels to
  2056. output channels, preserving indices.
  2057. @subsection Examples
  2058. @itemize
  2059. @item
  2060. For example, assuming a 5.1+downmix input MOV file,
  2061. @example
  2062. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2063. @end example
  2064. will create an output WAV file tagged as stereo from the downmix channels of
  2065. the input.
  2066. @item
  2067. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2068. @example
  2069. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2070. @end example
  2071. @end itemize
  2072. @section channelsplit
  2073. Split each channel from an input audio stream into a separate output stream.
  2074. It accepts the following parameters:
  2075. @table @option
  2076. @item channel_layout
  2077. The channel layout of the input stream. The default is "stereo".
  2078. @item channels
  2079. A channel layout describing the channels to be extracted as separate output streams
  2080. or "all" to extract each input channel as a separate stream. The default is "all".
  2081. Choosing channels not present in channel layout in the input will result in an error.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. For example, assuming a stereo input MP3 file,
  2087. @example
  2088. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2089. @end example
  2090. will create an output Matroska file with two audio streams, one containing only
  2091. the left channel and the other the right channel.
  2092. @item
  2093. Split a 5.1 WAV file into per-channel files:
  2094. @example
  2095. ffmpeg -i in.wav -filter_complex
  2096. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2097. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2098. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2099. side_right.wav
  2100. @end example
  2101. @item
  2102. Extract only LFE from a 5.1 WAV file:
  2103. @example
  2104. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2105. -map '[LFE]' lfe.wav
  2106. @end example
  2107. @end itemize
  2108. @section chorus
  2109. Add a chorus effect to the audio.
  2110. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2111. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2112. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2113. The modulation depth defines the range the modulated delay is played before or after
  2114. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2115. sound tuned around the original one, like in a chorus where some vocals are slightly
  2116. off key.
  2117. It accepts the following parameters:
  2118. @table @option
  2119. @item in_gain
  2120. Set input gain. Default is 0.4.
  2121. @item out_gain
  2122. Set output gain. Default is 0.4.
  2123. @item delays
  2124. Set delays. A typical delay is around 40ms to 60ms.
  2125. @item decays
  2126. Set decays.
  2127. @item speeds
  2128. Set speeds.
  2129. @item depths
  2130. Set depths.
  2131. @end table
  2132. @subsection Examples
  2133. @itemize
  2134. @item
  2135. A single delay:
  2136. @example
  2137. chorus=0.7:0.9:55:0.4:0.25:2
  2138. @end example
  2139. @item
  2140. Two delays:
  2141. @example
  2142. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2143. @end example
  2144. @item
  2145. Fuller sounding chorus with three delays:
  2146. @example
  2147. 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
  2148. @end example
  2149. @end itemize
  2150. @section compand
  2151. Compress or expand the audio's dynamic range.
  2152. It accepts the following parameters:
  2153. @table @option
  2154. @item attacks
  2155. @item decays
  2156. A list of times in seconds for each channel over which the instantaneous level
  2157. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2158. increase of volume and @var{decays} refers to decrease of volume. For most
  2159. situations, the attack time (response to the audio getting louder) should be
  2160. shorter than the decay time, because the human ear is more sensitive to sudden
  2161. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2162. a typical value for decay is 0.8 seconds.
  2163. If specified number of attacks & decays is lower than number of channels, the last
  2164. set attack/decay will be used for all remaining channels.
  2165. @item points
  2166. A list of points for the transfer function, specified in dB relative to the
  2167. maximum possible signal amplitude. Each key points list must be defined using
  2168. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2169. @code{x0/y0 x1/y1 x2/y2 ....}
  2170. The input values must be in strictly increasing order but the transfer function
  2171. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2172. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2173. function are @code{-70/-70|-60/-20|1/0}.
  2174. @item soft-knee
  2175. Set the curve radius in dB for all joints. It defaults to 0.01.
  2176. @item gain
  2177. Set the additional gain in dB to be applied at all points on the transfer
  2178. function. This allows for easy adjustment of the overall gain.
  2179. It defaults to 0.
  2180. @item volume
  2181. Set an initial volume, in dB, to be assumed for each channel when filtering
  2182. starts. This permits the user to supply a nominal level initially, so that, for
  2183. example, a very large gain is not applied to initial signal levels before the
  2184. companding has begun to operate. A typical value for audio which is initially
  2185. quiet is -90 dB. It defaults to 0.
  2186. @item delay
  2187. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2188. delayed before being fed to the volume adjuster. Specifying a delay
  2189. approximately equal to the attack/decay times allows the filter to effectively
  2190. operate in predictive rather than reactive mode. It defaults to 0.
  2191. @end table
  2192. @subsection Examples
  2193. @itemize
  2194. @item
  2195. Make music with both quiet and loud passages suitable for listening to in a
  2196. noisy environment:
  2197. @example
  2198. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2199. @end example
  2200. Another example for audio with whisper and explosion parts:
  2201. @example
  2202. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2203. @end example
  2204. @item
  2205. A noise gate for when the noise is at a lower level than the signal:
  2206. @example
  2207. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2208. @end example
  2209. @item
  2210. Here is another noise gate, this time for when the noise is at a higher level
  2211. than the signal (making it, in some ways, similar to squelch):
  2212. @example
  2213. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2214. @end example
  2215. @item
  2216. 2:1 compression starting at -6dB:
  2217. @example
  2218. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2219. @end example
  2220. @item
  2221. 2:1 compression starting at -9dB:
  2222. @example
  2223. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2224. @end example
  2225. @item
  2226. 2:1 compression starting at -12dB:
  2227. @example
  2228. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2229. @end example
  2230. @item
  2231. 2:1 compression starting at -18dB:
  2232. @example
  2233. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2234. @end example
  2235. @item
  2236. 3:1 compression starting at -15dB:
  2237. @example
  2238. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2239. @end example
  2240. @item
  2241. Compressor/Gate:
  2242. @example
  2243. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2244. @end example
  2245. @item
  2246. Expander:
  2247. @example
  2248. 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
  2249. @end example
  2250. @item
  2251. Hard limiter at -6dB:
  2252. @example
  2253. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2254. @end example
  2255. @item
  2256. Hard limiter at -12dB:
  2257. @example
  2258. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2259. @end example
  2260. @item
  2261. Hard noise gate at -35 dB:
  2262. @example
  2263. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2264. @end example
  2265. @item
  2266. Soft limiter:
  2267. @example
  2268. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2269. @end example
  2270. @end itemize
  2271. @section compensationdelay
  2272. Compensation Delay Line is a metric based delay to compensate differing
  2273. positions of microphones or speakers.
  2274. For example, you have recorded guitar with two microphones placed in
  2275. different location. Because the front of sound wave has fixed speed in
  2276. normal conditions, the phasing of microphones can vary and depends on
  2277. their location and interposition. The best sound mix can be achieved when
  2278. these microphones are in phase (synchronized). Note that distance of
  2279. ~30 cm between microphones makes one microphone to capture signal in
  2280. antiphase to another microphone. That makes the final mix sounding moody.
  2281. This filter helps to solve phasing problems by adding different delays
  2282. to each microphone track and make them synchronized.
  2283. The best result can be reached when you take one track as base and
  2284. synchronize other tracks one by one with it.
  2285. Remember that synchronization/delay tolerance depends on sample rate, too.
  2286. Higher sample rates will give more tolerance.
  2287. It accepts the following parameters:
  2288. @table @option
  2289. @item mm
  2290. Set millimeters distance. This is compensation distance for fine tuning.
  2291. Default is 0.
  2292. @item cm
  2293. Set cm distance. This is compensation distance for tightening distance setup.
  2294. Default is 0.
  2295. @item m
  2296. Set meters distance. This is compensation distance for hard distance setup.
  2297. Default is 0.
  2298. @item dry
  2299. Set dry amount. Amount of unprocessed (dry) signal.
  2300. Default is 0.
  2301. @item wet
  2302. Set wet amount. Amount of processed (wet) signal.
  2303. Default is 1.
  2304. @item temp
  2305. Set temperature degree in Celsius. This is the temperature of the environment.
  2306. Default is 20.
  2307. @end table
  2308. @section crossfeed
  2309. Apply headphone crossfeed filter.
  2310. Crossfeed is the process of blending the left and right channels of stereo
  2311. audio recording.
  2312. It is mainly used to reduce extreme stereo separation of low frequencies.
  2313. The intent is to produce more speaker like sound to the listener.
  2314. The filter accepts the following options:
  2315. @table @option
  2316. @item strength
  2317. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2318. This sets gain of low shelf filter for side part of stereo image.
  2319. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2320. @item range
  2321. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2322. This sets cut off frequency of low shelf filter. Default is cut off near
  2323. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2324. @item level_in
  2325. Set input gain. Default is 0.9.
  2326. @item level_out
  2327. Set output gain. Default is 1.
  2328. @end table
  2329. @section crystalizer
  2330. Simple algorithm to expand audio dynamic range.
  2331. The filter accepts the following options:
  2332. @table @option
  2333. @item i
  2334. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2335. (unchanged sound) to 10.0 (maximum effect).
  2336. @item c
  2337. Enable clipping. By default is enabled.
  2338. @end table
  2339. @section dcshift
  2340. Apply a DC shift to the audio.
  2341. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2342. in the recording chain) from the audio. The effect of a DC offset is reduced
  2343. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2344. a signal has a DC offset.
  2345. @table @option
  2346. @item shift
  2347. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2348. the audio.
  2349. @item limitergain
  2350. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2351. used to prevent clipping.
  2352. @end table
  2353. @section deesser
  2354. Apply de-essing to the audio samples.
  2355. @table @option
  2356. @item i
  2357. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2358. Default is 0.
  2359. @item m
  2360. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2361. Default is 0.5.
  2362. @item f
  2363. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2364. Default is 0.5.
  2365. @item s
  2366. Set the output mode.
  2367. It accepts the following values:
  2368. @table @option
  2369. @item i
  2370. Pass input unchanged.
  2371. @item o
  2372. Pass ess filtered out.
  2373. @item e
  2374. Pass only ess.
  2375. Default value is @var{o}.
  2376. @end table
  2377. @end table
  2378. @section drmeter
  2379. Measure audio dynamic range.
  2380. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2381. is found in transition material. And anything less that 8 have very poor dynamics
  2382. and is very compressed.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item length
  2386. Set window length in seconds used to split audio into segments of equal length.
  2387. Default is 3 seconds.
  2388. @end table
  2389. @section dynaudnorm
  2390. Dynamic Audio Normalizer.
  2391. This filter applies a certain amount of gain to the input audio in order
  2392. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2393. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2394. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2395. This allows for applying extra gain to the "quiet" sections of the audio
  2396. while avoiding distortions or clipping the "loud" sections. In other words:
  2397. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2398. sections, in the sense that the volume of each section is brought to the
  2399. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2400. this goal *without* applying "dynamic range compressing". It will retain 100%
  2401. of the dynamic range *within* each section of the audio file.
  2402. @table @option
  2403. @item framelen, f
  2404. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2405. Default is 500 milliseconds.
  2406. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2407. referred to as frames. This is required, because a peak magnitude has no
  2408. meaning for just a single sample value. Instead, we need to determine the
  2409. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2410. normalizer would simply use the peak magnitude of the complete file, the
  2411. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2412. frame. The length of a frame is specified in milliseconds. By default, the
  2413. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2414. been found to give good results with most files.
  2415. Note that the exact frame length, in number of samples, will be determined
  2416. automatically, based on the sampling rate of the individual input audio file.
  2417. @item gausssize, g
  2418. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2419. number. Default is 31.
  2420. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2421. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2422. is specified in frames, centered around the current frame. For the sake of
  2423. simplicity, this must be an odd number. Consequently, the default value of 31
  2424. takes into account the current frame, as well as the 15 preceding frames and
  2425. the 15 subsequent frames. Using a larger window results in a stronger
  2426. smoothing effect and thus in less gain variation, i.e. slower gain
  2427. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2428. effect and thus in more gain variation, i.e. faster gain adaptation.
  2429. In other words, the more you increase this value, the more the Dynamic Audio
  2430. Normalizer will behave like a "traditional" normalization filter. On the
  2431. contrary, the more you decrease this value, the more the Dynamic Audio
  2432. Normalizer will behave like a dynamic range compressor.
  2433. @item peak, p
  2434. Set the target peak value. This specifies the highest permissible magnitude
  2435. level for the normalized audio input. This filter will try to approach the
  2436. target peak magnitude as closely as possible, but at the same time it also
  2437. makes sure that the normalized signal will never exceed the peak magnitude.
  2438. A frame's maximum local gain factor is imposed directly by the target peak
  2439. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2440. It is not recommended to go above this value.
  2441. @item maxgain, m
  2442. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2443. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2444. factor for each input frame, i.e. the maximum gain factor that does not
  2445. result in clipping or distortion. The maximum gain factor is determined by
  2446. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2447. additionally bounds the frame's maximum gain factor by a predetermined
  2448. (global) maximum gain factor. This is done in order to avoid excessive gain
  2449. factors in "silent" or almost silent frames. By default, the maximum gain
  2450. factor is 10.0, For most inputs the default value should be sufficient and
  2451. it usually is not recommended to increase this value. Though, for input
  2452. with an extremely low overall volume level, it may be necessary to allow even
  2453. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2454. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2455. Instead, a "sigmoid" threshold function will be applied. This way, the
  2456. gain factors will smoothly approach the threshold value, but never exceed that
  2457. value.
  2458. @item targetrms, r
  2459. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2460. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2461. This means that the maximum local gain factor for each frame is defined
  2462. (only) by the frame's highest magnitude sample. This way, the samples can
  2463. be amplified as much as possible without exceeding the maximum signal
  2464. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2465. Normalizer can also take into account the frame's root mean square,
  2466. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2467. determine the power of a time-varying signal. It is therefore considered
  2468. that the RMS is a better approximation of the "perceived loudness" than
  2469. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2470. frames to a constant RMS value, a uniform "perceived loudness" can be
  2471. established. If a target RMS value has been specified, a frame's local gain
  2472. factor is defined as the factor that would result in exactly that RMS value.
  2473. Note, however, that the maximum local gain factor is still restricted by the
  2474. frame's highest magnitude sample, in order to prevent clipping.
  2475. @item coupling, n
  2476. Enable channels coupling. By default is enabled.
  2477. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2478. amount. This means the same gain factor will be applied to all channels, i.e.
  2479. the maximum possible gain factor is determined by the "loudest" channel.
  2480. However, in some recordings, it may happen that the volume of the different
  2481. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2482. In this case, this option can be used to disable the channel coupling. This way,
  2483. the gain factor will be determined independently for each channel, depending
  2484. only on the individual channel's highest magnitude sample. This allows for
  2485. harmonizing the volume of the different channels.
  2486. @item correctdc, c
  2487. Enable DC bias correction. By default is disabled.
  2488. An audio signal (in the time domain) is a sequence of sample values.
  2489. In the Dynamic Audio Normalizer these sample values are represented in the
  2490. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2491. audio signal, or "waveform", should be centered around the zero point.
  2492. That means if we calculate the mean value of all samples in a file, or in a
  2493. single frame, then the result should be 0.0 or at least very close to that
  2494. value. If, however, there is a significant deviation of the mean value from
  2495. 0.0, in either positive or negative direction, this is referred to as a
  2496. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2497. Audio Normalizer provides optional DC bias correction.
  2498. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2499. the mean value, or "DC correction" offset, of each input frame and subtract
  2500. that value from all of the frame's sample values which ensures those samples
  2501. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2502. boundaries, the DC correction offset values will be interpolated smoothly
  2503. between neighbouring frames.
  2504. @item altboundary, b
  2505. Enable alternative boundary mode. By default is disabled.
  2506. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2507. around each frame. This includes the preceding frames as well as the
  2508. subsequent frames. However, for the "boundary" frames, located at the very
  2509. beginning and at the very end of the audio file, not all neighbouring
  2510. frames are available. In particular, for the first few frames in the audio
  2511. file, the preceding frames are not known. And, similarly, for the last few
  2512. frames in the audio file, the subsequent frames are not known. Thus, the
  2513. question arises which gain factors should be assumed for the missing frames
  2514. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2515. to deal with this situation. The default boundary mode assumes a gain factor
  2516. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2517. "fade out" at the beginning and at the end of the input, respectively.
  2518. @item compress, s
  2519. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2520. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2521. compression. This means that signal peaks will not be pruned and thus the
  2522. full dynamic range will be retained within each local neighbourhood. However,
  2523. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2524. normalization algorithm with a more "traditional" compression.
  2525. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2526. (thresholding) function. If (and only if) the compression feature is enabled,
  2527. all input frames will be processed by a soft knee thresholding function prior
  2528. to the actual normalization process. Put simply, the thresholding function is
  2529. going to prune all samples whose magnitude exceeds a certain threshold value.
  2530. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2531. value. Instead, the threshold value will be adjusted for each individual
  2532. frame.
  2533. In general, smaller parameters result in stronger compression, and vice versa.
  2534. Values below 3.0 are not recommended, because audible distortion may appear.
  2535. @end table
  2536. @section earwax
  2537. Make audio easier to listen to on headphones.
  2538. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2539. so that when listened to on headphones the stereo image is moved from
  2540. inside your head (standard for headphones) to outside and in front of
  2541. the listener (standard for speakers).
  2542. Ported from SoX.
  2543. @section equalizer
  2544. Apply a two-pole peaking equalisation (EQ) filter. With this
  2545. filter, the signal-level at and around a selected frequency can
  2546. be increased or decreased, whilst (unlike bandpass and bandreject
  2547. filters) that at all other frequencies is unchanged.
  2548. In order to produce complex equalisation curves, this filter can
  2549. be given several times, each with a different central frequency.
  2550. The filter accepts the following options:
  2551. @table @option
  2552. @item frequency, f
  2553. Set the filter's central frequency in Hz.
  2554. @item width_type, t
  2555. Set method to specify band-width of filter.
  2556. @table @option
  2557. @item h
  2558. Hz
  2559. @item q
  2560. Q-Factor
  2561. @item o
  2562. octave
  2563. @item s
  2564. slope
  2565. @item k
  2566. kHz
  2567. @end table
  2568. @item width, w
  2569. Specify the band-width of a filter in width_type units.
  2570. @item gain, g
  2571. Set the required gain or attenuation in dB.
  2572. Beware of clipping when using a positive gain.
  2573. @item mix, m
  2574. How much to use filtered signal in output. Default is 1.
  2575. Range is between 0 and 1.
  2576. @item channels, c
  2577. Specify which channels to filter, by default all available are filtered.
  2578. @end table
  2579. @subsection Examples
  2580. @itemize
  2581. @item
  2582. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2583. @example
  2584. equalizer=f=1000:t=h:width=200:g=-10
  2585. @end example
  2586. @item
  2587. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2588. @example
  2589. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2590. @end example
  2591. @end itemize
  2592. @subsection Commands
  2593. This filter supports the following commands:
  2594. @table @option
  2595. @item frequency, f
  2596. Change equalizer frequency.
  2597. Syntax for the command is : "@var{frequency}"
  2598. @item width_type, t
  2599. Change equalizer width_type.
  2600. Syntax for the command is : "@var{width_type}"
  2601. @item width, w
  2602. Change equalizer width.
  2603. Syntax for the command is : "@var{width}"
  2604. @item gain, g
  2605. Change equalizer gain.
  2606. Syntax for the command is : "@var{gain}"
  2607. @item mix, m
  2608. Change equalizer mix.
  2609. Syntax for the command is : "@var{mix}"
  2610. @end table
  2611. @section extrastereo
  2612. Linearly increases the difference between left and right channels which
  2613. adds some sort of "live" effect to playback.
  2614. The filter accepts the following options:
  2615. @table @option
  2616. @item m
  2617. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2618. (average of both channels), with 1.0 sound will be unchanged, with
  2619. -1.0 left and right channels will be swapped.
  2620. @item c
  2621. Enable clipping. By default is enabled.
  2622. @end table
  2623. @section firequalizer
  2624. Apply FIR Equalization using arbitrary frequency response.
  2625. The filter accepts the following option:
  2626. @table @option
  2627. @item gain
  2628. Set gain curve equation (in dB). The expression can contain variables:
  2629. @table @option
  2630. @item f
  2631. the evaluated frequency
  2632. @item sr
  2633. sample rate
  2634. @item ch
  2635. channel number, set to 0 when multichannels evaluation is disabled
  2636. @item chid
  2637. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2638. multichannels evaluation is disabled
  2639. @item chs
  2640. number of channels
  2641. @item chlayout
  2642. channel_layout, see libavutil/channel_layout.h
  2643. @end table
  2644. and functions:
  2645. @table @option
  2646. @item gain_interpolate(f)
  2647. interpolate gain on frequency f based on gain_entry
  2648. @item cubic_interpolate(f)
  2649. same as gain_interpolate, but smoother
  2650. @end table
  2651. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2652. @item gain_entry
  2653. Set gain entry for gain_interpolate function. The expression can
  2654. contain functions:
  2655. @table @option
  2656. @item entry(f, g)
  2657. store gain entry at frequency f with value g
  2658. @end table
  2659. This option is also available as command.
  2660. @item delay
  2661. Set filter delay in seconds. Higher value means more accurate.
  2662. Default is @code{0.01}.
  2663. @item accuracy
  2664. Set filter accuracy in Hz. Lower value means more accurate.
  2665. Default is @code{5}.
  2666. @item wfunc
  2667. Set window function. Acceptable values are:
  2668. @table @option
  2669. @item rectangular
  2670. rectangular window, useful when gain curve is already smooth
  2671. @item hann
  2672. hann window (default)
  2673. @item hamming
  2674. hamming window
  2675. @item blackman
  2676. blackman window
  2677. @item nuttall3
  2678. 3-terms continuous 1st derivative nuttall window
  2679. @item mnuttall3
  2680. minimum 3-terms discontinuous nuttall window
  2681. @item nuttall
  2682. 4-terms continuous 1st derivative nuttall window
  2683. @item bnuttall
  2684. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2685. @item bharris
  2686. blackman-harris window
  2687. @item tukey
  2688. tukey window
  2689. @end table
  2690. @item fixed
  2691. If enabled, use fixed number of audio samples. This improves speed when
  2692. filtering with large delay. Default is disabled.
  2693. @item multi
  2694. Enable multichannels evaluation on gain. Default is disabled.
  2695. @item zero_phase
  2696. Enable zero phase mode by subtracting timestamp to compensate delay.
  2697. Default is disabled.
  2698. @item scale
  2699. Set scale used by gain. Acceptable values are:
  2700. @table @option
  2701. @item linlin
  2702. linear frequency, linear gain
  2703. @item linlog
  2704. linear frequency, logarithmic (in dB) gain (default)
  2705. @item loglin
  2706. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2707. @item loglog
  2708. logarithmic frequency, logarithmic gain
  2709. @end table
  2710. @item dumpfile
  2711. Set file for dumping, suitable for gnuplot.
  2712. @item dumpscale
  2713. Set scale for dumpfile. Acceptable values are same with scale option.
  2714. Default is linlog.
  2715. @item fft2
  2716. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2717. Default is disabled.
  2718. @item min_phase
  2719. Enable minimum phase impulse response. Default is disabled.
  2720. @end table
  2721. @subsection Examples
  2722. @itemize
  2723. @item
  2724. lowpass at 1000 Hz:
  2725. @example
  2726. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2727. @end example
  2728. @item
  2729. lowpass at 1000 Hz with gain_entry:
  2730. @example
  2731. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2732. @end example
  2733. @item
  2734. custom equalization:
  2735. @example
  2736. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2737. @end example
  2738. @item
  2739. higher delay with zero phase to compensate delay:
  2740. @example
  2741. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2742. @end example
  2743. @item
  2744. lowpass on left channel, highpass on right channel:
  2745. @example
  2746. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2747. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2748. @end example
  2749. @end itemize
  2750. @section flanger
  2751. Apply a flanging effect to the audio.
  2752. The filter accepts the following options:
  2753. @table @option
  2754. @item delay
  2755. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2756. @item depth
  2757. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2758. @item regen
  2759. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2760. Default value is 0.
  2761. @item width
  2762. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2763. Default value is 71.
  2764. @item speed
  2765. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2766. @item shape
  2767. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2768. Default value is @var{sinusoidal}.
  2769. @item phase
  2770. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2771. Default value is 25.
  2772. @item interp
  2773. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2774. Default is @var{linear}.
  2775. @end table
  2776. @section haas
  2777. Apply Haas effect to audio.
  2778. Note that this makes most sense to apply on mono signals.
  2779. With this filter applied to mono signals it give some directionality and
  2780. stretches its stereo image.
  2781. The filter accepts the following options:
  2782. @table @option
  2783. @item level_in
  2784. Set input level. By default is @var{1}, or 0dB
  2785. @item level_out
  2786. Set output level. By default is @var{1}, or 0dB.
  2787. @item side_gain
  2788. Set gain applied to side part of signal. By default is @var{1}.
  2789. @item middle_source
  2790. Set kind of middle source. Can be one of the following:
  2791. @table @samp
  2792. @item left
  2793. Pick left channel.
  2794. @item right
  2795. Pick right channel.
  2796. @item mid
  2797. Pick middle part signal of stereo image.
  2798. @item side
  2799. Pick side part signal of stereo image.
  2800. @end table
  2801. @item middle_phase
  2802. Change middle phase. By default is disabled.
  2803. @item left_delay
  2804. Set left channel delay. By default is @var{2.05} milliseconds.
  2805. @item left_balance
  2806. Set left channel balance. By default is @var{-1}.
  2807. @item left_gain
  2808. Set left channel gain. By default is @var{1}.
  2809. @item left_phase
  2810. Change left phase. By default is disabled.
  2811. @item right_delay
  2812. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2813. @item right_balance
  2814. Set right channel balance. By default is @var{1}.
  2815. @item right_gain
  2816. Set right channel gain. By default is @var{1}.
  2817. @item right_phase
  2818. Change right phase. By default is enabled.
  2819. @end table
  2820. @section hdcd
  2821. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2822. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2823. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2824. of HDCD, and detects the Transient Filter flag.
  2825. @example
  2826. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2827. @end example
  2828. When using the filter with wav, note the default encoding for wav is 16-bit,
  2829. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2830. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2831. @example
  2832. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2833. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2834. @end example
  2835. The filter accepts the following options:
  2836. @table @option
  2837. @item disable_autoconvert
  2838. Disable any automatic format conversion or resampling in the filter graph.
  2839. @item process_stereo
  2840. Process the stereo channels together. If target_gain does not match between
  2841. channels, consider it invalid and use the last valid target_gain.
  2842. @item cdt_ms
  2843. Set the code detect timer period in ms.
  2844. @item force_pe
  2845. Always extend peaks above -3dBFS even if PE isn't signaled.
  2846. @item analyze_mode
  2847. Replace audio with a solid tone and adjust the amplitude to signal some
  2848. specific aspect of the decoding process. The output file can be loaded in
  2849. an audio editor alongside the original to aid analysis.
  2850. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2851. Modes are:
  2852. @table @samp
  2853. @item 0, off
  2854. Disabled
  2855. @item 1, lle
  2856. Gain adjustment level at each sample
  2857. @item 2, pe
  2858. Samples where peak extend occurs
  2859. @item 3, cdt
  2860. Samples where the code detect timer is active
  2861. @item 4, tgm
  2862. Samples where the target gain does not match between channels
  2863. @end table
  2864. @end table
  2865. @section headphone
  2866. Apply head-related transfer functions (HRTFs) to create virtual
  2867. loudspeakers around the user for binaural listening via headphones.
  2868. The HRIRs are provided via additional streams, for each channel
  2869. one stereo input stream is needed.
  2870. The filter accepts the following options:
  2871. @table @option
  2872. @item map
  2873. Set mapping of input streams for convolution.
  2874. The argument is a '|'-separated list of channel names in order as they
  2875. are given as additional stream inputs for filter.
  2876. This also specify number of input streams. Number of input streams
  2877. must be not less than number of channels in first stream plus one.
  2878. @item gain
  2879. Set gain applied to audio. Value is in dB. Default is 0.
  2880. @item type
  2881. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2882. processing audio in time domain which is slow.
  2883. @var{freq} is processing audio in frequency domain which is fast.
  2884. Default is @var{freq}.
  2885. @item lfe
  2886. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2887. @item size
  2888. Set size of frame in number of samples which will be processed at once.
  2889. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2890. @item hrir
  2891. Set format of hrir stream.
  2892. Default value is @var{stereo}. Alternative value is @var{multich}.
  2893. If value is set to @var{stereo}, number of additional streams should
  2894. be greater or equal to number of input channels in first input stream.
  2895. Also each additional stream should have stereo number of channels.
  2896. If value is set to @var{multich}, number of additional streams should
  2897. be exactly one. Also number of input channels of additional stream
  2898. should be equal or greater than twice number of channels of first input
  2899. stream.
  2900. @end table
  2901. @subsection Examples
  2902. @itemize
  2903. @item
  2904. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2905. each amovie filter use stereo file with IR coefficients as input.
  2906. The files give coefficients for each position of virtual loudspeaker:
  2907. @example
  2908. ffmpeg -i input.wav
  2909. -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"
  2910. output.wav
  2911. @end example
  2912. @item
  2913. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2914. but now in @var{multich} @var{hrir} format.
  2915. @example
  2916. 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"
  2917. output.wav
  2918. @end example
  2919. @end itemize
  2920. @section highpass
  2921. Apply a high-pass filter with 3dB point frequency.
  2922. The filter can be either single-pole, or double-pole (the default).
  2923. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2924. The filter accepts the following options:
  2925. @table @option
  2926. @item frequency, f
  2927. Set frequency in Hz. Default is 3000.
  2928. @item poles, p
  2929. Set number of poles. Default is 2.
  2930. @item width_type, t
  2931. Set method to specify band-width of filter.
  2932. @table @option
  2933. @item h
  2934. Hz
  2935. @item q
  2936. Q-Factor
  2937. @item o
  2938. octave
  2939. @item s
  2940. slope
  2941. @item k
  2942. kHz
  2943. @end table
  2944. @item width, w
  2945. Specify the band-width of a filter in width_type units.
  2946. Applies only to double-pole filter.
  2947. The default is 0.707q and gives a Butterworth response.
  2948. @item mix, m
  2949. How much to use filtered signal in output. Default is 1.
  2950. Range is between 0 and 1.
  2951. @item channels, c
  2952. Specify which channels to filter, by default all available are filtered.
  2953. @end table
  2954. @subsection Commands
  2955. This filter supports the following commands:
  2956. @table @option
  2957. @item frequency, f
  2958. Change highpass frequency.
  2959. Syntax for the command is : "@var{frequency}"
  2960. @item width_type, t
  2961. Change highpass width_type.
  2962. Syntax for the command is : "@var{width_type}"
  2963. @item width, w
  2964. Change highpass width.
  2965. Syntax for the command is : "@var{width}"
  2966. @item mix, m
  2967. Change highpass mix.
  2968. Syntax for the command is : "@var{mix}"
  2969. @end table
  2970. @section join
  2971. Join multiple input streams into one multi-channel stream.
  2972. It accepts the following parameters:
  2973. @table @option
  2974. @item inputs
  2975. The number of input streams. It defaults to 2.
  2976. @item channel_layout
  2977. The desired output channel layout. It defaults to stereo.
  2978. @item map
  2979. Map channels from inputs to output. The argument is a '|'-separated list of
  2980. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2981. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2982. can be either the name of the input channel (e.g. FL for front left) or its
  2983. index in the specified input stream. @var{out_channel} is the name of the output
  2984. channel.
  2985. @end table
  2986. The filter will attempt to guess the mappings when they are not specified
  2987. explicitly. It does so by first trying to find an unused matching input channel
  2988. and if that fails it picks the first unused input channel.
  2989. Join 3 inputs (with properly set channel layouts):
  2990. @example
  2991. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2992. @end example
  2993. Build a 5.1 output from 6 single-channel streams:
  2994. @example
  2995. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2996. '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'
  2997. out
  2998. @end example
  2999. @section ladspa
  3000. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3001. To enable compilation of this filter you need to configure FFmpeg with
  3002. @code{--enable-ladspa}.
  3003. @table @option
  3004. @item file, f
  3005. Specifies the name of LADSPA plugin library to load. If the environment
  3006. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3007. each one of the directories specified by the colon separated list in
  3008. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3009. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3010. @file{/usr/lib/ladspa/}.
  3011. @item plugin, p
  3012. Specifies the plugin within the library. Some libraries contain only
  3013. one plugin, but others contain many of them. If this is not set filter
  3014. will list all available plugins within the specified library.
  3015. @item controls, c
  3016. Set the '|' separated list of controls which are zero or more floating point
  3017. values that determine the behavior of the loaded plugin (for example delay,
  3018. threshold or gain).
  3019. Controls need to be defined using the following syntax:
  3020. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3021. @var{valuei} is the value set on the @var{i}-th control.
  3022. Alternatively they can be also defined using the following syntax:
  3023. @var{value0}|@var{value1}|@var{value2}|..., where
  3024. @var{valuei} is the value set on the @var{i}-th control.
  3025. If @option{controls} is set to @code{help}, all available controls and
  3026. their valid ranges are printed.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100. Only used if plugin have
  3029. zero inputs.
  3030. @item nb_samples, n
  3031. Set the number of samples per channel per each output frame, default
  3032. is 1024. Only used if plugin have zero inputs.
  3033. @item duration, d
  3034. Set the minimum duration of the sourced audio. See
  3035. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3036. for the accepted syntax.
  3037. Note that the resulting duration may be greater than the specified duration,
  3038. as the generated audio is always cut at the end of a complete frame.
  3039. If not specified, or the expressed duration is negative, the audio is
  3040. supposed to be generated forever.
  3041. Only used if plugin have zero inputs.
  3042. @end table
  3043. @subsection Examples
  3044. @itemize
  3045. @item
  3046. List all available plugins within amp (LADSPA example plugin) library:
  3047. @example
  3048. ladspa=file=amp
  3049. @end example
  3050. @item
  3051. List all available controls and their valid ranges for @code{vcf_notch}
  3052. plugin from @code{VCF} library:
  3053. @example
  3054. ladspa=f=vcf:p=vcf_notch:c=help
  3055. @end example
  3056. @item
  3057. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3058. plugin library:
  3059. @example
  3060. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3061. @end example
  3062. @item
  3063. Add reverberation to the audio using TAP-plugins
  3064. (Tom's Audio Processing plugins):
  3065. @example
  3066. ladspa=file=tap_reverb:tap_reverb
  3067. @end example
  3068. @item
  3069. Generate white noise, with 0.2 amplitude:
  3070. @example
  3071. ladspa=file=cmt:noise_source_white:c=c0=.2
  3072. @end example
  3073. @item
  3074. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3075. @code{C* Audio Plugin Suite} (CAPS) library:
  3076. @example
  3077. ladspa=file=caps:Click:c=c1=20'
  3078. @end example
  3079. @item
  3080. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3081. @example
  3082. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3083. @end example
  3084. @item
  3085. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3086. @code{SWH Plugins} collection:
  3087. @example
  3088. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3089. @end example
  3090. @item
  3091. Attenuate low frequencies using Multiband EQ from Steve Harris
  3092. @code{SWH Plugins} collection:
  3093. @example
  3094. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3095. @end example
  3096. @item
  3097. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3098. (CAPS) library:
  3099. @example
  3100. ladspa=caps:Narrower
  3101. @end example
  3102. @item
  3103. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3104. @example
  3105. ladspa=caps:White:.2
  3106. @end example
  3107. @item
  3108. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3109. @example
  3110. ladspa=caps:Fractal:c=c1=1
  3111. @end example
  3112. @item
  3113. Dynamic volume normalization using @code{VLevel} plugin:
  3114. @example
  3115. ladspa=vlevel-ladspa:vlevel_mono
  3116. @end example
  3117. @end itemize
  3118. @subsection Commands
  3119. This filter supports the following commands:
  3120. @table @option
  3121. @item cN
  3122. Modify the @var{N}-th control value.
  3123. If the specified value is not valid, it is ignored and prior one is kept.
  3124. @end table
  3125. @section loudnorm
  3126. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3127. Support for both single pass (livestreams, files) and double pass (files) modes.
  3128. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3129. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3130. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3131. The filter accepts the following options:
  3132. @table @option
  3133. @item I, i
  3134. Set integrated loudness target.
  3135. Range is -70.0 - -5.0. Default value is -24.0.
  3136. @item LRA, lra
  3137. Set loudness range target.
  3138. Range is 1.0 - 20.0. Default value is 7.0.
  3139. @item TP, tp
  3140. Set maximum true peak.
  3141. Range is -9.0 - +0.0. Default value is -2.0.
  3142. @item measured_I, measured_i
  3143. Measured IL of input file.
  3144. Range is -99.0 - +0.0.
  3145. @item measured_LRA, measured_lra
  3146. Measured LRA of input file.
  3147. Range is 0.0 - 99.0.
  3148. @item measured_TP, measured_tp
  3149. Measured true peak of input file.
  3150. Range is -99.0 - +99.0.
  3151. @item measured_thresh
  3152. Measured threshold of input file.
  3153. Range is -99.0 - +0.0.
  3154. @item offset
  3155. Set offset gain. Gain is applied before the true-peak limiter.
  3156. Range is -99.0 - +99.0. Default is +0.0.
  3157. @item linear
  3158. Normalize linearly if possible.
  3159. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3160. to be specified in order to use this mode.
  3161. Options are true or false. Default is true.
  3162. @item dual_mono
  3163. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3164. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3165. If set to @code{true}, this option will compensate for this effect.
  3166. Multi-channel input files are not affected by this option.
  3167. Options are true or false. Default is false.
  3168. @item print_format
  3169. Set print format for stats. Options are summary, json, or none.
  3170. Default value is none.
  3171. @end table
  3172. @section lowpass
  3173. Apply a low-pass filter with 3dB point frequency.
  3174. The filter can be either single-pole or double-pole (the default).
  3175. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item frequency, f
  3179. Set frequency in Hz. Default is 500.
  3180. @item poles, p
  3181. Set number of poles. Default is 2.
  3182. @item width_type, t
  3183. Set method to specify band-width of filter.
  3184. @table @option
  3185. @item h
  3186. Hz
  3187. @item q
  3188. Q-Factor
  3189. @item o
  3190. octave
  3191. @item s
  3192. slope
  3193. @item k
  3194. kHz
  3195. @end table
  3196. @item width, w
  3197. Specify the band-width of a filter in width_type units.
  3198. Applies only to double-pole filter.
  3199. The default is 0.707q and gives a Butterworth response.
  3200. @item mix, m
  3201. How much to use filtered signal in output. Default is 1.
  3202. Range is between 0 and 1.
  3203. @item channels, c
  3204. Specify which channels to filter, by default all available are filtered.
  3205. @end table
  3206. @subsection Examples
  3207. @itemize
  3208. @item
  3209. Lowpass only LFE channel, it LFE is not present it does nothing:
  3210. @example
  3211. lowpass=c=LFE
  3212. @end example
  3213. @end itemize
  3214. @subsection Commands
  3215. This filter supports the following commands:
  3216. @table @option
  3217. @item frequency, f
  3218. Change lowpass frequency.
  3219. Syntax for the command is : "@var{frequency}"
  3220. @item width_type, t
  3221. Change lowpass width_type.
  3222. Syntax for the command is : "@var{width_type}"
  3223. @item width, w
  3224. Change lowpass width.
  3225. Syntax for the command is : "@var{width}"
  3226. @item mix, m
  3227. Change lowpass mix.
  3228. Syntax for the command is : "@var{mix}"
  3229. @end table
  3230. @section lv2
  3231. Load a LV2 (LADSPA Version 2) plugin.
  3232. To enable compilation of this filter you need to configure FFmpeg with
  3233. @code{--enable-lv2}.
  3234. @table @option
  3235. @item plugin, p
  3236. Specifies the plugin URI. You may need to escape ':'.
  3237. @item controls, c
  3238. Set the '|' separated list of controls which are zero or more floating point
  3239. values that determine the behavior of the loaded plugin (for example delay,
  3240. threshold or gain).
  3241. If @option{controls} is set to @code{help}, all available controls and
  3242. their valid ranges are printed.
  3243. @item sample_rate, s
  3244. Specify the sample rate, default to 44100. Only used if plugin have
  3245. zero inputs.
  3246. @item nb_samples, n
  3247. Set the number of samples per channel per each output frame, default
  3248. is 1024. Only used if plugin have zero inputs.
  3249. @item duration, d
  3250. Set the minimum duration of the sourced audio. See
  3251. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3252. for the accepted syntax.
  3253. Note that the resulting duration may be greater than the specified duration,
  3254. as the generated audio is always cut at the end of a complete frame.
  3255. If not specified, or the expressed duration is negative, the audio is
  3256. supposed to be generated forever.
  3257. Only used if plugin have zero inputs.
  3258. @end table
  3259. @subsection Examples
  3260. @itemize
  3261. @item
  3262. Apply bass enhancer plugin from Calf:
  3263. @example
  3264. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3265. @end example
  3266. @item
  3267. Apply vinyl plugin from Calf:
  3268. @example
  3269. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3270. @end example
  3271. @item
  3272. Apply bit crusher plugin from ArtyFX:
  3273. @example
  3274. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3275. @end example
  3276. @end itemize
  3277. @section mcompand
  3278. Multiband Compress or expand the audio's dynamic range.
  3279. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3280. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3281. response when absent compander action.
  3282. It accepts the following parameters:
  3283. @table @option
  3284. @item args
  3285. This option syntax is:
  3286. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3287. For explanation of each item refer to compand filter documentation.
  3288. @end table
  3289. @anchor{pan}
  3290. @section pan
  3291. Mix channels with specific gain levels. The filter accepts the output
  3292. channel layout followed by a set of channels definitions.
  3293. This filter is also designed to efficiently remap the channels of an audio
  3294. stream.
  3295. The filter accepts parameters of the form:
  3296. "@var{l}|@var{outdef}|@var{outdef}|..."
  3297. @table @option
  3298. @item l
  3299. output channel layout or number of channels
  3300. @item outdef
  3301. output channel specification, of the form:
  3302. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3303. @item out_name
  3304. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3305. number (c0, c1, etc.)
  3306. @item gain
  3307. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3308. @item in_name
  3309. input channel to use, see out_name for details; it is not possible to mix
  3310. named and numbered input channels
  3311. @end table
  3312. If the `=' in a channel specification is replaced by `<', then the gains for
  3313. that specification will be renormalized so that the total is 1, thus
  3314. avoiding clipping noise.
  3315. @subsection Mixing examples
  3316. For example, if you want to down-mix from stereo to mono, but with a bigger
  3317. factor for the left channel:
  3318. @example
  3319. pan=1c|c0=0.9*c0+0.1*c1
  3320. @end example
  3321. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3322. 7-channels surround:
  3323. @example
  3324. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3325. @end example
  3326. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3327. that should be preferred (see "-ac" option) unless you have very specific
  3328. needs.
  3329. @subsection Remapping examples
  3330. The channel remapping will be effective if, and only if:
  3331. @itemize
  3332. @item gain coefficients are zeroes or ones,
  3333. @item only one input per channel output,
  3334. @end itemize
  3335. If all these conditions are satisfied, the filter will notify the user ("Pure
  3336. channel mapping detected"), and use an optimized and lossless method to do the
  3337. remapping.
  3338. For example, if you have a 5.1 source and want a stereo audio stream by
  3339. dropping the extra channels:
  3340. @example
  3341. pan="stereo| c0=FL | c1=FR"
  3342. @end example
  3343. Given the same source, you can also switch front left and front right channels
  3344. and keep the input channel layout:
  3345. @example
  3346. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3347. @end example
  3348. If the input is a stereo audio stream, you can mute the front left channel (and
  3349. still keep the stereo channel layout) with:
  3350. @example
  3351. pan="stereo|c1=c1"
  3352. @end example
  3353. Still with a stereo audio stream input, you can copy the right channel in both
  3354. front left and right:
  3355. @example
  3356. pan="stereo| c0=FR | c1=FR"
  3357. @end example
  3358. @section replaygain
  3359. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3360. outputs it unchanged.
  3361. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3362. @section resample
  3363. Convert the audio sample format, sample rate and channel layout. It is
  3364. not meant to be used directly.
  3365. @section rubberband
  3366. Apply time-stretching and pitch-shifting with librubberband.
  3367. To enable compilation of this filter, you need to configure FFmpeg with
  3368. @code{--enable-librubberband}.
  3369. The filter accepts the following options:
  3370. @table @option
  3371. @item tempo
  3372. Set tempo scale factor.
  3373. @item pitch
  3374. Set pitch scale factor.
  3375. @item transients
  3376. Set transients detector.
  3377. Possible values are:
  3378. @table @var
  3379. @item crisp
  3380. @item mixed
  3381. @item smooth
  3382. @end table
  3383. @item detector
  3384. Set detector.
  3385. Possible values are:
  3386. @table @var
  3387. @item compound
  3388. @item percussive
  3389. @item soft
  3390. @end table
  3391. @item phase
  3392. Set phase.
  3393. Possible values are:
  3394. @table @var
  3395. @item laminar
  3396. @item independent
  3397. @end table
  3398. @item window
  3399. Set processing window size.
  3400. Possible values are:
  3401. @table @var
  3402. @item standard
  3403. @item short
  3404. @item long
  3405. @end table
  3406. @item smoothing
  3407. Set smoothing.
  3408. Possible values are:
  3409. @table @var
  3410. @item off
  3411. @item on
  3412. @end table
  3413. @item formant
  3414. Enable formant preservation when shift pitching.
  3415. Possible values are:
  3416. @table @var
  3417. @item shifted
  3418. @item preserved
  3419. @end table
  3420. @item pitchq
  3421. Set pitch quality.
  3422. Possible values are:
  3423. @table @var
  3424. @item quality
  3425. @item speed
  3426. @item consistency
  3427. @end table
  3428. @item channels
  3429. Set channels.
  3430. Possible values are:
  3431. @table @var
  3432. @item apart
  3433. @item together
  3434. @end table
  3435. @end table
  3436. @section sidechaincompress
  3437. This filter acts like normal compressor but has the ability to compress
  3438. detected signal using second input signal.
  3439. It needs two input streams and returns one output stream.
  3440. First input stream will be processed depending on second stream signal.
  3441. The filtered signal then can be filtered with other filters in later stages of
  3442. processing. See @ref{pan} and @ref{amerge} filter.
  3443. The filter accepts the following options:
  3444. @table @option
  3445. @item level_in
  3446. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3447. @item mode
  3448. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3449. Default is @code{downward}.
  3450. @item threshold
  3451. If a signal of second stream raises above this level it will affect the gain
  3452. reduction of first stream.
  3453. By default is 0.125. Range is between 0.00097563 and 1.
  3454. @item ratio
  3455. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3456. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3457. Default is 2. Range is between 1 and 20.
  3458. @item attack
  3459. Amount of milliseconds the signal has to rise above the threshold before gain
  3460. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3461. @item release
  3462. Amount of milliseconds the signal has to fall below the threshold before
  3463. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3464. @item makeup
  3465. Set the amount by how much signal will be amplified after processing.
  3466. Default is 1. Range is from 1 to 64.
  3467. @item knee
  3468. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3469. Default is 2.82843. Range is between 1 and 8.
  3470. @item link
  3471. Choose if the @code{average} level between all channels of side-chain stream
  3472. or the louder(@code{maximum}) channel of side-chain stream affects the
  3473. reduction. Default is @code{average}.
  3474. @item detection
  3475. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3476. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3477. @item level_sc
  3478. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3479. @item mix
  3480. How much to use compressed signal in output. Default is 1.
  3481. Range is between 0 and 1.
  3482. @end table
  3483. @subsection Examples
  3484. @itemize
  3485. @item
  3486. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3487. depending on the signal of 2nd input and later compressed signal to be
  3488. merged with 2nd input:
  3489. @example
  3490. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3491. @end example
  3492. @end itemize
  3493. @section sidechaingate
  3494. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3495. filter the detected signal before sending it to the gain reduction stage.
  3496. Normally a gate uses the full range signal to detect a level above the
  3497. threshold.
  3498. For example: If you cut all lower frequencies from your sidechain signal
  3499. the gate will decrease the volume of your track only if not enough highs
  3500. appear. With this technique you are able to reduce the resonation of a
  3501. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3502. guitar.
  3503. It needs two input streams and returns one output stream.
  3504. First input stream will be processed depending on second stream signal.
  3505. The filter accepts the following options:
  3506. @table @option
  3507. @item level_in
  3508. Set input level before filtering.
  3509. Default is 1. Allowed range is from 0.015625 to 64.
  3510. @item mode
  3511. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3512. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3513. will be amplified, expanding dynamic range in upward direction.
  3514. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3515. @item range
  3516. Set the level of gain reduction when the signal is below the threshold.
  3517. Default is 0.06125. Allowed range is from 0 to 1.
  3518. Setting this to 0 disables reduction and then filter behaves like expander.
  3519. @item threshold
  3520. If a signal rises above this level the gain reduction is released.
  3521. Default is 0.125. Allowed range is from 0 to 1.
  3522. @item ratio
  3523. Set a ratio about which the signal is reduced.
  3524. Default is 2. Allowed range is from 1 to 9000.
  3525. @item attack
  3526. Amount of milliseconds the signal has to rise above the threshold before gain
  3527. reduction stops.
  3528. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3529. @item release
  3530. Amount of milliseconds the signal has to fall below the threshold before the
  3531. reduction is increased again. Default is 250 milliseconds.
  3532. Allowed range is from 0.01 to 9000.
  3533. @item makeup
  3534. Set amount of amplification of signal after processing.
  3535. Default is 1. Allowed range is from 1 to 64.
  3536. @item knee
  3537. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3538. Default is 2.828427125. Allowed range is from 1 to 8.
  3539. @item detection
  3540. Choose if exact signal should be taken for detection or an RMS like one.
  3541. Default is rms. Can be peak or rms.
  3542. @item link
  3543. Choose if the average level between all channels or the louder channel affects
  3544. the reduction.
  3545. Default is average. Can be average or maximum.
  3546. @item level_sc
  3547. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3548. @end table
  3549. @section silencedetect
  3550. Detect silence in an audio stream.
  3551. This filter logs a message when it detects that the input audio volume is less
  3552. or equal to a noise tolerance value for a duration greater or equal to the
  3553. minimum detected noise duration.
  3554. The printed times and duration are expressed in seconds.
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item noise, n
  3558. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3559. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3560. @item duration, d
  3561. Set silence duration until notification (default is 2 seconds).
  3562. @item mono, m
  3563. Process each channel separately, instead of combined. By default is disabled.
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Detect 5 seconds of silence with -50dB noise tolerance:
  3569. @example
  3570. silencedetect=n=-50dB:d=5
  3571. @end example
  3572. @item
  3573. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3574. tolerance in @file{silence.mp3}:
  3575. @example
  3576. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3577. @end example
  3578. @end itemize
  3579. @section silenceremove
  3580. Remove silence from the beginning, middle or end of the audio.
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item start_periods
  3584. This value is used to indicate if audio should be trimmed at beginning of
  3585. the audio. A value of zero indicates no silence should be trimmed from the
  3586. beginning. When specifying a non-zero value, it trims audio up until it
  3587. finds non-silence. Normally, when trimming silence from beginning of audio
  3588. the @var{start_periods} will be @code{1} but it can be increased to higher
  3589. values to trim all audio up to specific count of non-silence periods.
  3590. Default value is @code{0}.
  3591. @item start_duration
  3592. Specify the amount of time that non-silence must be detected before it stops
  3593. trimming audio. By increasing the duration, bursts of noises can be treated
  3594. as silence and trimmed off. Default value is @code{0}.
  3595. @item start_threshold
  3596. This indicates what sample value should be treated as silence. For digital
  3597. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3598. you may wish to increase the value to account for background noise.
  3599. Can be specified in dB (in case "dB" is appended to the specified value)
  3600. or amplitude ratio. Default value is @code{0}.
  3601. @item start_silence
  3602. Specify max duration of silence at beginning that will be kept after
  3603. trimming. Default is 0, which is equal to trimming all samples detected
  3604. as silence.
  3605. @item start_mode
  3606. Specify mode of detection of silence end in start of multi-channel audio.
  3607. Can be @var{any} or @var{all}. Default is @var{any}.
  3608. With @var{any}, any sample that is detected as non-silence will cause
  3609. stopped trimming of silence.
  3610. With @var{all}, only if all channels are detected as non-silence will cause
  3611. stopped trimming of silence.
  3612. @item stop_periods
  3613. Set the count for trimming silence from the end of audio.
  3614. To remove silence from the middle of a file, specify a @var{stop_periods}
  3615. that is negative. This value is then treated as a positive value and is
  3616. used to indicate the effect should restart processing as specified by
  3617. @var{start_periods}, making it suitable for removing periods of silence
  3618. in the middle of the audio.
  3619. Default value is @code{0}.
  3620. @item stop_duration
  3621. Specify a duration of silence that must exist before audio is not copied any
  3622. more. By specifying a higher duration, silence that is wanted can be left in
  3623. the audio.
  3624. Default value is @code{0}.
  3625. @item stop_threshold
  3626. This is the same as @option{start_threshold} but for trimming silence from
  3627. the end of audio.
  3628. Can be specified in dB (in case "dB" is appended to the specified value)
  3629. or amplitude ratio. Default value is @code{0}.
  3630. @item stop_silence
  3631. Specify max duration of silence at end that will be kept after
  3632. trimming. Default is 0, which is equal to trimming all samples detected
  3633. as silence.
  3634. @item stop_mode
  3635. Specify mode of detection of silence start in end of multi-channel audio.
  3636. Can be @var{any} or @var{all}. Default is @var{any}.
  3637. With @var{any}, any sample that is detected as non-silence will cause
  3638. stopped trimming of silence.
  3639. With @var{all}, only if all channels are detected as non-silence will cause
  3640. stopped trimming of silence.
  3641. @item detection
  3642. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3643. and works better with digital silence which is exactly 0.
  3644. Default value is @code{rms}.
  3645. @item window
  3646. Set duration in number of seconds used to calculate size of window in number
  3647. of samples for detecting silence.
  3648. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3649. @end table
  3650. @subsection Examples
  3651. @itemize
  3652. @item
  3653. The following example shows how this filter can be used to start a recording
  3654. that does not contain the delay at the start which usually occurs between
  3655. pressing the record button and the start of the performance:
  3656. @example
  3657. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3658. @end example
  3659. @item
  3660. Trim all silence encountered from beginning to end where there is more than 1
  3661. second of silence in audio:
  3662. @example
  3663. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3664. @end example
  3665. @end itemize
  3666. @section sofalizer
  3667. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3668. loudspeakers around the user for binaural listening via headphones (audio
  3669. formats up to 9 channels supported).
  3670. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3671. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3672. Austrian Academy of Sciences.
  3673. To enable compilation of this filter you need to configure FFmpeg with
  3674. @code{--enable-libmysofa}.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item sofa
  3678. Set the SOFA file used for rendering.
  3679. @item gain
  3680. Set gain applied to audio. Value is in dB. Default is 0.
  3681. @item rotation
  3682. Set rotation of virtual loudspeakers in deg. Default is 0.
  3683. @item elevation
  3684. Set elevation of virtual speakers in deg. Default is 0.
  3685. @item radius
  3686. Set distance in meters between loudspeakers and the listener with near-field
  3687. HRTFs. Default is 1.
  3688. @item type
  3689. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3690. processing audio in time domain which is slow.
  3691. @var{freq} is processing audio in frequency domain which is fast.
  3692. Default is @var{freq}.
  3693. @item speakers
  3694. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3695. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3696. Each virtual loudspeaker is described with short channel name following with
  3697. azimuth and elevation in degrees.
  3698. Each virtual loudspeaker description is separated by '|'.
  3699. For example to override front left and front right channel positions use:
  3700. 'speakers=FL 45 15|FR 345 15'.
  3701. Descriptions with unrecognised channel names are ignored.
  3702. @item lfegain
  3703. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3704. @item framesize
  3705. Set custom frame size in number of samples. Default is 1024.
  3706. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3707. is set to @var{freq}.
  3708. @item normalize
  3709. Should all IRs be normalized upon importing SOFA file.
  3710. By default is enabled.
  3711. @item interpolate
  3712. Should nearest IRs be interpolated with neighbor IRs if exact position
  3713. does not match. By default is disabled.
  3714. @item minphase
  3715. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3716. @item anglestep
  3717. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3718. @item radstep
  3719. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3720. @end table
  3721. @subsection Examples
  3722. @itemize
  3723. @item
  3724. Using ClubFritz6 sofa file:
  3725. @example
  3726. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3727. @end example
  3728. @item
  3729. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3730. @example
  3731. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3732. @end example
  3733. @item
  3734. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3735. and also with custom gain:
  3736. @example
  3737. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3738. @end example
  3739. @end itemize
  3740. @section stereotools
  3741. This filter has some handy utilities to manage stereo signals, for converting
  3742. M/S stereo recordings to L/R signal while having control over the parameters
  3743. or spreading the stereo image of master track.
  3744. The filter accepts the following options:
  3745. @table @option
  3746. @item level_in
  3747. Set input level before filtering for both channels. Defaults is 1.
  3748. Allowed range is from 0.015625 to 64.
  3749. @item level_out
  3750. Set output level after filtering for both channels. Defaults is 1.
  3751. Allowed range is from 0.015625 to 64.
  3752. @item balance_in
  3753. Set input balance between both channels. Default is 0.
  3754. Allowed range is from -1 to 1.
  3755. @item balance_out
  3756. Set output balance between both channels. Default is 0.
  3757. Allowed range is from -1 to 1.
  3758. @item softclip
  3759. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3760. clipping. Disabled by default.
  3761. @item mutel
  3762. Mute the left channel. Disabled by default.
  3763. @item muter
  3764. Mute the right channel. Disabled by default.
  3765. @item phasel
  3766. Change the phase of the left channel. Disabled by default.
  3767. @item phaser
  3768. Change the phase of the right channel. Disabled by default.
  3769. @item mode
  3770. Set stereo mode. Available values are:
  3771. @table @samp
  3772. @item lr>lr
  3773. Left/Right to Left/Right, this is default.
  3774. @item lr>ms
  3775. Left/Right to Mid/Side.
  3776. @item ms>lr
  3777. Mid/Side to Left/Right.
  3778. @item lr>ll
  3779. Left/Right to Left/Left.
  3780. @item lr>rr
  3781. Left/Right to Right/Right.
  3782. @item lr>l+r
  3783. Left/Right to Left + Right.
  3784. @item lr>rl
  3785. Left/Right to Right/Left.
  3786. @item ms>ll
  3787. Mid/Side to Left/Left.
  3788. @item ms>rr
  3789. Mid/Side to Right/Right.
  3790. @end table
  3791. @item slev
  3792. Set level of side signal. Default is 1.
  3793. Allowed range is from 0.015625 to 64.
  3794. @item sbal
  3795. Set balance of side signal. Default is 0.
  3796. Allowed range is from -1 to 1.
  3797. @item mlev
  3798. Set level of the middle signal. Default is 1.
  3799. Allowed range is from 0.015625 to 64.
  3800. @item mpan
  3801. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3802. @item base
  3803. Set stereo base between mono and inversed channels. Default is 0.
  3804. Allowed range is from -1 to 1.
  3805. @item delay
  3806. Set delay in milliseconds how much to delay left from right channel and
  3807. vice versa. Default is 0. Allowed range is from -20 to 20.
  3808. @item sclevel
  3809. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3810. @item phase
  3811. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3812. @item bmode_in, bmode_out
  3813. Set balance mode for balance_in/balance_out option.
  3814. Can be one of the following:
  3815. @table @samp
  3816. @item balance
  3817. Classic balance mode. Attenuate one channel at time.
  3818. Gain is raised up to 1.
  3819. @item amplitude
  3820. Similar as classic mode above but gain is raised up to 2.
  3821. @item power
  3822. Equal power distribution, from -6dB to +6dB range.
  3823. @end table
  3824. @end table
  3825. @subsection Examples
  3826. @itemize
  3827. @item
  3828. Apply karaoke like effect:
  3829. @example
  3830. stereotools=mlev=0.015625
  3831. @end example
  3832. @item
  3833. Convert M/S signal to L/R:
  3834. @example
  3835. "stereotools=mode=ms>lr"
  3836. @end example
  3837. @end itemize
  3838. @section stereowiden
  3839. This filter enhance the stereo effect by suppressing signal common to both
  3840. channels and by delaying the signal of left into right and vice versa,
  3841. thereby widening the stereo effect.
  3842. The filter accepts the following options:
  3843. @table @option
  3844. @item delay
  3845. Time in milliseconds of the delay of left signal into right and vice versa.
  3846. Default is 20 milliseconds.
  3847. @item feedback
  3848. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3849. effect of left signal in right output and vice versa which gives widening
  3850. effect. Default is 0.3.
  3851. @item crossfeed
  3852. Cross feed of left into right with inverted phase. This helps in suppressing
  3853. the mono. If the value is 1 it will cancel all the signal common to both
  3854. channels. Default is 0.3.
  3855. @item drymix
  3856. Set level of input signal of original channel. Default is 0.8.
  3857. @end table
  3858. @section superequalizer
  3859. Apply 18 band equalizer.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item 1b
  3863. Set 65Hz band gain.
  3864. @item 2b
  3865. Set 92Hz band gain.
  3866. @item 3b
  3867. Set 131Hz band gain.
  3868. @item 4b
  3869. Set 185Hz band gain.
  3870. @item 5b
  3871. Set 262Hz band gain.
  3872. @item 6b
  3873. Set 370Hz band gain.
  3874. @item 7b
  3875. Set 523Hz band gain.
  3876. @item 8b
  3877. Set 740Hz band gain.
  3878. @item 9b
  3879. Set 1047Hz band gain.
  3880. @item 10b
  3881. Set 1480Hz band gain.
  3882. @item 11b
  3883. Set 2093Hz band gain.
  3884. @item 12b
  3885. Set 2960Hz band gain.
  3886. @item 13b
  3887. Set 4186Hz band gain.
  3888. @item 14b
  3889. Set 5920Hz band gain.
  3890. @item 15b
  3891. Set 8372Hz band gain.
  3892. @item 16b
  3893. Set 11840Hz band gain.
  3894. @item 17b
  3895. Set 16744Hz band gain.
  3896. @item 18b
  3897. Set 20000Hz band gain.
  3898. @end table
  3899. @section surround
  3900. Apply audio surround upmix filter.
  3901. This filter allows to produce multichannel output from audio stream.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item chl_out
  3905. Set output channel layout. By default, this is @var{5.1}.
  3906. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3907. for the required syntax.
  3908. @item chl_in
  3909. Set input channel layout. By default, this is @var{stereo}.
  3910. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3911. for the required syntax.
  3912. @item level_in
  3913. Set input volume level. By default, this is @var{1}.
  3914. @item level_out
  3915. Set output volume level. By default, this is @var{1}.
  3916. @item lfe
  3917. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3918. @item lfe_low
  3919. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3920. @item lfe_high
  3921. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3922. @item lfe_mode
  3923. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3924. In @var{add} mode, LFE channel is created from input audio and added to output.
  3925. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3926. also all non-LFE output channels are subtracted with output LFE channel.
  3927. @item angle
  3928. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3929. Default is @var{90}.
  3930. @item fc_in
  3931. Set front center input volume. By default, this is @var{1}.
  3932. @item fc_out
  3933. Set front center output volume. By default, this is @var{1}.
  3934. @item fl_in
  3935. Set front left input volume. By default, this is @var{1}.
  3936. @item fl_out
  3937. Set front left output volume. By default, this is @var{1}.
  3938. @item fr_in
  3939. Set front right input volume. By default, this is @var{1}.
  3940. @item fr_out
  3941. Set front right output volume. By default, this is @var{1}.
  3942. @item sl_in
  3943. Set side left input volume. By default, this is @var{1}.
  3944. @item sl_out
  3945. Set side left output volume. By default, this is @var{1}.
  3946. @item sr_in
  3947. Set side right input volume. By default, this is @var{1}.
  3948. @item sr_out
  3949. Set side right output volume. By default, this is @var{1}.
  3950. @item bl_in
  3951. Set back left input volume. By default, this is @var{1}.
  3952. @item bl_out
  3953. Set back left output volume. By default, this is @var{1}.
  3954. @item br_in
  3955. Set back right input volume. By default, this is @var{1}.
  3956. @item br_out
  3957. Set back right output volume. By default, this is @var{1}.
  3958. @item bc_in
  3959. Set back center input volume. By default, this is @var{1}.
  3960. @item bc_out
  3961. Set back center output volume. By default, this is @var{1}.
  3962. @item lfe_in
  3963. Set LFE input volume. By default, this is @var{1}.
  3964. @item lfe_out
  3965. Set LFE output volume. By default, this is @var{1}.
  3966. @item allx
  3967. Set spread usage of stereo image across X axis for all channels.
  3968. @item ally
  3969. Set spread usage of stereo image across Y axis for all channels.
  3970. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3971. Set spread usage of stereo image across X axis for each channel.
  3972. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3973. Set spread usage of stereo image across Y axis for each channel.
  3974. @item win_size
  3975. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3976. @item win_func
  3977. Set window function.
  3978. It accepts the following values:
  3979. @table @samp
  3980. @item rect
  3981. @item bartlett
  3982. @item hann, hanning
  3983. @item hamming
  3984. @item blackman
  3985. @item welch
  3986. @item flattop
  3987. @item bharris
  3988. @item bnuttall
  3989. @item bhann
  3990. @item sine
  3991. @item nuttall
  3992. @item lanczos
  3993. @item gauss
  3994. @item tukey
  3995. @item dolph
  3996. @item cauchy
  3997. @item parzen
  3998. @item poisson
  3999. @item bohman
  4000. @end table
  4001. Default is @code{hann}.
  4002. @item overlap
  4003. Set window overlap. If set to 1, the recommended overlap for selected
  4004. window function will be picked. Default is @code{0.5}.
  4005. @end table
  4006. @section treble, highshelf
  4007. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4008. shelving filter with a response similar to that of a standard
  4009. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4010. The filter accepts the following options:
  4011. @table @option
  4012. @item gain, g
  4013. Give the gain at whichever is the lower of ~22 kHz and the
  4014. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4015. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4016. @item frequency, f
  4017. Set the filter's central frequency and so can be used
  4018. to extend or reduce the frequency range to be boosted or cut.
  4019. The default value is @code{3000} Hz.
  4020. @item width_type, t
  4021. Set method to specify band-width of filter.
  4022. @table @option
  4023. @item h
  4024. Hz
  4025. @item q
  4026. Q-Factor
  4027. @item o
  4028. octave
  4029. @item s
  4030. slope
  4031. @item k
  4032. kHz
  4033. @end table
  4034. @item width, w
  4035. Determine how steep is the filter's shelf transition.
  4036. @item mix, m
  4037. How much to use filtered signal in output. Default is 1.
  4038. Range is between 0 and 1.
  4039. @item channels, c
  4040. Specify which channels to filter, by default all available are filtered.
  4041. @end table
  4042. @subsection Commands
  4043. This filter supports the following commands:
  4044. @table @option
  4045. @item frequency, f
  4046. Change treble frequency.
  4047. Syntax for the command is : "@var{frequency}"
  4048. @item width_type, t
  4049. Change treble width_type.
  4050. Syntax for the command is : "@var{width_type}"
  4051. @item width, w
  4052. Change treble width.
  4053. Syntax for the command is : "@var{width}"
  4054. @item gain, g
  4055. Change treble gain.
  4056. Syntax for the command is : "@var{gain}"
  4057. @item mix, m
  4058. Change treble mix.
  4059. Syntax for the command is : "@var{mix}"
  4060. @end table
  4061. @section tremolo
  4062. Sinusoidal amplitude modulation.
  4063. The filter accepts the following options:
  4064. @table @option
  4065. @item f
  4066. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4067. (20 Hz or lower) will result in a tremolo effect.
  4068. This filter may also be used as a ring modulator by specifying
  4069. a modulation frequency higher than 20 Hz.
  4070. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4071. @item d
  4072. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4073. Default value is 0.5.
  4074. @end table
  4075. @section vibrato
  4076. Sinusoidal phase modulation.
  4077. The filter accepts the following options:
  4078. @table @option
  4079. @item f
  4080. Modulation frequency in Hertz.
  4081. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4082. @item d
  4083. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4084. Default value is 0.5.
  4085. @end table
  4086. @section volume
  4087. Adjust the input audio volume.
  4088. It accepts the following parameters:
  4089. @table @option
  4090. @item volume
  4091. Set audio volume expression.
  4092. Output values are clipped to the maximum value.
  4093. The output audio volume is given by the relation:
  4094. @example
  4095. @var{output_volume} = @var{volume} * @var{input_volume}
  4096. @end example
  4097. The default value for @var{volume} is "1.0".
  4098. @item precision
  4099. This parameter represents the mathematical precision.
  4100. It determines which input sample formats will be allowed, which affects the
  4101. precision of the volume scaling.
  4102. @table @option
  4103. @item fixed
  4104. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4105. @item float
  4106. 32-bit floating-point; this limits input sample format to FLT. (default)
  4107. @item double
  4108. 64-bit floating-point; this limits input sample format to DBL.
  4109. @end table
  4110. @item replaygain
  4111. Choose the behaviour on encountering ReplayGain side data in input frames.
  4112. @table @option
  4113. @item drop
  4114. Remove ReplayGain side data, ignoring its contents (the default).
  4115. @item ignore
  4116. Ignore ReplayGain side data, but leave it in the frame.
  4117. @item track
  4118. Prefer the track gain, if present.
  4119. @item album
  4120. Prefer the album gain, if present.
  4121. @end table
  4122. @item replaygain_preamp
  4123. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4124. Default value for @var{replaygain_preamp} is 0.0.
  4125. @item eval
  4126. Set when the volume expression is evaluated.
  4127. It accepts the following values:
  4128. @table @samp
  4129. @item once
  4130. only evaluate expression once during the filter initialization, or
  4131. when the @samp{volume} command is sent
  4132. @item frame
  4133. evaluate expression for each incoming frame
  4134. @end table
  4135. Default value is @samp{once}.
  4136. @end table
  4137. The volume expression can contain the following parameters.
  4138. @table @option
  4139. @item n
  4140. frame number (starting at zero)
  4141. @item nb_channels
  4142. number of channels
  4143. @item nb_consumed_samples
  4144. number of samples consumed by the filter
  4145. @item nb_samples
  4146. number of samples in the current frame
  4147. @item pos
  4148. original frame position in the file
  4149. @item pts
  4150. frame PTS
  4151. @item sample_rate
  4152. sample rate
  4153. @item startpts
  4154. PTS at start of stream
  4155. @item startt
  4156. time at start of stream
  4157. @item t
  4158. frame time
  4159. @item tb
  4160. timestamp timebase
  4161. @item volume
  4162. last set volume value
  4163. @end table
  4164. Note that when @option{eval} is set to @samp{once} only the
  4165. @var{sample_rate} and @var{tb} variables are available, all other
  4166. variables will evaluate to NAN.
  4167. @subsection Commands
  4168. This filter supports the following commands:
  4169. @table @option
  4170. @item volume
  4171. Modify the volume expression.
  4172. The command accepts the same syntax of the corresponding option.
  4173. If the specified expression is not valid, it is kept at its current
  4174. value.
  4175. @item replaygain_noclip
  4176. Prevent clipping by limiting the gain applied.
  4177. Default value for @var{replaygain_noclip} is 1.
  4178. @end table
  4179. @subsection Examples
  4180. @itemize
  4181. @item
  4182. Halve the input audio volume:
  4183. @example
  4184. volume=volume=0.5
  4185. volume=volume=1/2
  4186. volume=volume=-6.0206dB
  4187. @end example
  4188. In all the above example the named key for @option{volume} can be
  4189. omitted, for example like in:
  4190. @example
  4191. volume=0.5
  4192. @end example
  4193. @item
  4194. Increase input audio power by 6 decibels using fixed-point precision:
  4195. @example
  4196. volume=volume=6dB:precision=fixed
  4197. @end example
  4198. @item
  4199. Fade volume after time 10 with an annihilation period of 5 seconds:
  4200. @example
  4201. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4202. @end example
  4203. @end itemize
  4204. @section volumedetect
  4205. Detect the volume of the input video.
  4206. The filter has no parameters. The input is not modified. Statistics about
  4207. the volume will be printed in the log when the input stream end is reached.
  4208. In particular it will show the mean volume (root mean square), maximum
  4209. volume (on a per-sample basis), and the beginning of a histogram of the
  4210. registered volume values (from the maximum value to a cumulated 1/1000 of
  4211. the samples).
  4212. All volumes are in decibels relative to the maximum PCM value.
  4213. @subsection Examples
  4214. Here is an excerpt of the output:
  4215. @example
  4216. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4217. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4218. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4219. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4220. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4221. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4222. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4223. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4224. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4225. @end example
  4226. It means that:
  4227. @itemize
  4228. @item
  4229. The mean square energy is approximately -27 dB, or 10^-2.7.
  4230. @item
  4231. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4232. @item
  4233. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4234. @end itemize
  4235. In other words, raising the volume by +4 dB does not cause any clipping,
  4236. raising it by +5 dB causes clipping for 6 samples, etc.
  4237. @c man end AUDIO FILTERS
  4238. @chapter Audio Sources
  4239. @c man begin AUDIO SOURCES
  4240. Below is a description of the currently available audio sources.
  4241. @section abuffer
  4242. Buffer audio frames, and make them available to the filter chain.
  4243. This source is mainly intended for a programmatic use, in particular
  4244. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4245. It accepts the following parameters:
  4246. @table @option
  4247. @item time_base
  4248. The timebase which will be used for timestamps of submitted frames. It must be
  4249. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4250. @item sample_rate
  4251. The sample rate of the incoming audio buffers.
  4252. @item sample_fmt
  4253. The sample format of the incoming audio buffers.
  4254. Either a sample format name or its corresponding integer representation from
  4255. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4256. @item channel_layout
  4257. The channel layout of the incoming audio buffers.
  4258. Either a channel layout name from channel_layout_map in
  4259. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4260. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4261. @item channels
  4262. The number of channels of the incoming audio buffers.
  4263. If both @var{channels} and @var{channel_layout} are specified, then they
  4264. must be consistent.
  4265. @end table
  4266. @subsection Examples
  4267. @example
  4268. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4269. @end example
  4270. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4271. Since the sample format with name "s16p" corresponds to the number
  4272. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4273. equivalent to:
  4274. @example
  4275. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4276. @end example
  4277. @section aevalsrc
  4278. Generate an audio signal specified by an expression.
  4279. This source accepts in input one or more expressions (one for each
  4280. channel), which are evaluated and used to generate a corresponding
  4281. audio signal.
  4282. This source accepts the following options:
  4283. @table @option
  4284. @item exprs
  4285. Set the '|'-separated expressions list for each separate channel. In case the
  4286. @option{channel_layout} option is not specified, the selected channel layout
  4287. depends on the number of provided expressions. Otherwise the last
  4288. specified expression is applied to the remaining output channels.
  4289. @item channel_layout, c
  4290. Set the channel layout. The number of channels in the specified layout
  4291. must be equal to the number of specified expressions.
  4292. @item duration, d
  4293. Set the minimum duration of the sourced audio. See
  4294. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4295. for the accepted syntax.
  4296. Note that the resulting duration may be greater than the specified
  4297. duration, as the generated audio is always cut at the end of a
  4298. complete frame.
  4299. If not specified, or the expressed duration is negative, the audio is
  4300. supposed to be generated forever.
  4301. @item nb_samples, n
  4302. Set the number of samples per channel per each output frame,
  4303. default to 1024.
  4304. @item sample_rate, s
  4305. Specify the sample rate, default to 44100.
  4306. @end table
  4307. Each expression in @var{exprs} can contain the following constants:
  4308. @table @option
  4309. @item n
  4310. number of the evaluated sample, starting from 0
  4311. @item t
  4312. time of the evaluated sample expressed in seconds, starting from 0
  4313. @item s
  4314. sample rate
  4315. @end table
  4316. @subsection Examples
  4317. @itemize
  4318. @item
  4319. Generate silence:
  4320. @example
  4321. aevalsrc=0
  4322. @end example
  4323. @item
  4324. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4325. 8000 Hz:
  4326. @example
  4327. aevalsrc="sin(440*2*PI*t):s=8000"
  4328. @end example
  4329. @item
  4330. Generate a two channels signal, specify the channel layout (Front
  4331. Center + Back Center) explicitly:
  4332. @example
  4333. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4334. @end example
  4335. @item
  4336. Generate white noise:
  4337. @example
  4338. aevalsrc="-2+random(0)"
  4339. @end example
  4340. @item
  4341. Generate an amplitude modulated signal:
  4342. @example
  4343. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4344. @end example
  4345. @item
  4346. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4347. @example
  4348. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4349. @end example
  4350. @end itemize
  4351. @section anullsrc
  4352. The null audio source, return unprocessed audio frames. It is mainly useful
  4353. as a template and to be employed in analysis / debugging tools, or as
  4354. the source for filters which ignore the input data (for example the sox
  4355. synth filter).
  4356. This source accepts the following options:
  4357. @table @option
  4358. @item channel_layout, cl
  4359. Specifies the channel layout, and can be either an integer or a string
  4360. representing a channel layout. The default value of @var{channel_layout}
  4361. is "stereo".
  4362. Check the channel_layout_map definition in
  4363. @file{libavutil/channel_layout.c} for the mapping between strings and
  4364. channel layout values.
  4365. @item sample_rate, r
  4366. Specifies the sample rate, and defaults to 44100.
  4367. @item nb_samples, n
  4368. Set the number of samples per requested frames.
  4369. @end table
  4370. @subsection Examples
  4371. @itemize
  4372. @item
  4373. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4374. @example
  4375. anullsrc=r=48000:cl=4
  4376. @end example
  4377. @item
  4378. Do the same operation with a more obvious syntax:
  4379. @example
  4380. anullsrc=r=48000:cl=mono
  4381. @end example
  4382. @end itemize
  4383. All the parameters need to be explicitly defined.
  4384. @section flite
  4385. Synthesize a voice utterance using the libflite library.
  4386. To enable compilation of this filter you need to configure FFmpeg with
  4387. @code{--enable-libflite}.
  4388. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4389. The filter accepts the following options:
  4390. @table @option
  4391. @item list_voices
  4392. If set to 1, list the names of the available voices and exit
  4393. immediately. Default value is 0.
  4394. @item nb_samples, n
  4395. Set the maximum number of samples per frame. Default value is 512.
  4396. @item textfile
  4397. Set the filename containing the text to speak.
  4398. @item text
  4399. Set the text to speak.
  4400. @item voice, v
  4401. Set the voice to use for the speech synthesis. Default value is
  4402. @code{kal}. See also the @var{list_voices} option.
  4403. @end table
  4404. @subsection Examples
  4405. @itemize
  4406. @item
  4407. Read from file @file{speech.txt}, and synthesize the text using the
  4408. standard flite voice:
  4409. @example
  4410. flite=textfile=speech.txt
  4411. @end example
  4412. @item
  4413. Read the specified text selecting the @code{slt} voice:
  4414. @example
  4415. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4416. @end example
  4417. @item
  4418. Input text to ffmpeg:
  4419. @example
  4420. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4421. @end example
  4422. @item
  4423. Make @file{ffplay} speak the specified text, using @code{flite} and
  4424. the @code{lavfi} device:
  4425. @example
  4426. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4427. @end example
  4428. @end itemize
  4429. For more information about libflite, check:
  4430. @url{http://www.festvox.org/flite/}
  4431. @section anoisesrc
  4432. Generate a noise audio signal.
  4433. The filter accepts the following options:
  4434. @table @option
  4435. @item sample_rate, r
  4436. Specify the sample rate. Default value is 48000 Hz.
  4437. @item amplitude, a
  4438. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4439. is 1.0.
  4440. @item duration, d
  4441. Specify the duration of the generated audio stream. Not specifying this option
  4442. results in noise with an infinite length.
  4443. @item color, colour, c
  4444. Specify the color of noise. Available noise colors are white, pink, brown,
  4445. blue and violet. Default color is white.
  4446. @item seed, s
  4447. Specify a value used to seed the PRNG.
  4448. @item nb_samples, n
  4449. Set the number of samples per each output frame, default is 1024.
  4450. @end table
  4451. @subsection Examples
  4452. @itemize
  4453. @item
  4454. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4455. @example
  4456. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4457. @end example
  4458. @end itemize
  4459. @section hilbert
  4460. Generate odd-tap Hilbert transform FIR coefficients.
  4461. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4462. the signal by 90 degrees.
  4463. This is used in many matrix coding schemes and for analytic signal generation.
  4464. The process is often written as a multiplication by i (or j), the imaginary unit.
  4465. The filter accepts the following options:
  4466. @table @option
  4467. @item sample_rate, s
  4468. Set sample rate, default is 44100.
  4469. @item taps, t
  4470. Set length of FIR filter, default is 22051.
  4471. @item nb_samples, n
  4472. Set number of samples per each frame.
  4473. @item win_func, w
  4474. Set window function to be used when generating FIR coefficients.
  4475. @end table
  4476. @section sinc
  4477. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4478. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4479. The filter accepts the following options:
  4480. @table @option
  4481. @item sample_rate, r
  4482. Set sample rate, default is 44100.
  4483. @item nb_samples, n
  4484. Set number of samples per each frame. Default is 1024.
  4485. @item hp
  4486. Set high-pass frequency. Default is 0.
  4487. @item lp
  4488. Set low-pass frequency. Default is 0.
  4489. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4490. is higher than 0 then filter will create band-pass filter coefficients,
  4491. otherwise band-reject filter coefficients.
  4492. @item phase
  4493. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4494. @item beta
  4495. Set Kaiser window beta.
  4496. @item att
  4497. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4498. @item round
  4499. Enable rounding, by default is disabled.
  4500. @item hptaps
  4501. Set number of taps for high-pass filter.
  4502. @item lptaps
  4503. Set number of taps for low-pass filter.
  4504. @end table
  4505. @section sine
  4506. Generate an audio signal made of a sine wave with amplitude 1/8.
  4507. The audio signal is bit-exact.
  4508. The filter accepts the following options:
  4509. @table @option
  4510. @item frequency, f
  4511. Set the carrier frequency. Default is 440 Hz.
  4512. @item beep_factor, b
  4513. Enable a periodic beep every second with frequency @var{beep_factor} times
  4514. the carrier frequency. Default is 0, meaning the beep is disabled.
  4515. @item sample_rate, r
  4516. Specify the sample rate, default is 44100.
  4517. @item duration, d
  4518. Specify the duration of the generated audio stream.
  4519. @item samples_per_frame
  4520. Set the number of samples per output frame.
  4521. The expression can contain the following constants:
  4522. @table @option
  4523. @item n
  4524. The (sequential) number of the output audio frame, starting from 0.
  4525. @item pts
  4526. The PTS (Presentation TimeStamp) of the output audio frame,
  4527. expressed in @var{TB} units.
  4528. @item t
  4529. The PTS of the output audio frame, expressed in seconds.
  4530. @item TB
  4531. The timebase of the output audio frames.
  4532. @end table
  4533. Default is @code{1024}.
  4534. @end table
  4535. @subsection Examples
  4536. @itemize
  4537. @item
  4538. Generate a simple 440 Hz sine wave:
  4539. @example
  4540. sine
  4541. @end example
  4542. @item
  4543. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4544. @example
  4545. sine=220:4:d=5
  4546. sine=f=220:b=4:d=5
  4547. sine=frequency=220:beep_factor=4:duration=5
  4548. @end example
  4549. @item
  4550. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4551. pattern:
  4552. @example
  4553. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4554. @end example
  4555. @end itemize
  4556. @c man end AUDIO SOURCES
  4557. @chapter Audio Sinks
  4558. @c man begin AUDIO SINKS
  4559. Below is a description of the currently available audio sinks.
  4560. @section abuffersink
  4561. Buffer audio frames, and make them available to the end of filter chain.
  4562. This sink is mainly intended for programmatic use, in particular
  4563. through the interface defined in @file{libavfilter/buffersink.h}
  4564. or the options system.
  4565. It accepts a pointer to an AVABufferSinkContext structure, which
  4566. defines the incoming buffers' formats, to be passed as the opaque
  4567. parameter to @code{avfilter_init_filter} for initialization.
  4568. @section anullsink
  4569. Null audio sink; do absolutely nothing with the input audio. It is
  4570. mainly useful as a template and for use in analysis / debugging
  4571. tools.
  4572. @c man end AUDIO SINKS
  4573. @chapter Video Filters
  4574. @c man begin VIDEO FILTERS
  4575. When you configure your FFmpeg build, you can disable any of the
  4576. existing filters using @code{--disable-filters}.
  4577. The configure output will show the video filters included in your
  4578. build.
  4579. Below is a description of the currently available video filters.
  4580. @section addroi
  4581. Mark a region of interest in a video frame.
  4582. The frame data is passed through unchanged, but metadata is attached
  4583. to the frame indicating regions of interest which can affect the
  4584. behaviour of later encoding. Multiple regions can be marked by
  4585. applying the filter multiple times.
  4586. @table @option
  4587. @item x
  4588. Region distance in pixels from the left edge of the frame.
  4589. @item y
  4590. Region distance in pixels from the top edge of the frame.
  4591. @item w
  4592. Region width in pixels.
  4593. @item h
  4594. Region height in pixels.
  4595. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4596. and may contain the following variables:
  4597. @table @option
  4598. @item iw
  4599. Width of the input frame.
  4600. @item ih
  4601. Height of the input frame.
  4602. @end table
  4603. @item qoffset
  4604. Quantisation offset to apply within the region.
  4605. This must be a real value in the range -1 to +1. A value of zero
  4606. indicates no quality change. A negative value asks for better quality
  4607. (less quantisation), while a positive value asks for worse quality
  4608. (greater quantisation).
  4609. The range is calibrated so that the extreme values indicate the
  4610. largest possible offset - if the rest of the frame is encoded with the
  4611. worst possible quality, an offset of -1 indicates that this region
  4612. should be encoded with the best possible quality anyway. Intermediate
  4613. values are then interpolated in some codec-dependent way.
  4614. For example, in 10-bit H.264 the quantisation parameter varies between
  4615. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4616. this region should be encoded with a QP around one-tenth of the full
  4617. range better than the rest of the frame. So, if most of the frame
  4618. were to be encoded with a QP of around 30, this region would get a QP
  4619. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4620. An extreme value of -1 would indicate that this region should be
  4621. encoded with the best possible quality regardless of the treatment of
  4622. the rest of the frame - that is, should be encoded at a QP of -12.
  4623. @item clear
  4624. If set to true, remove any existing regions of interest marked on the
  4625. frame before adding the new one.
  4626. @end table
  4627. @subsection Examples
  4628. @itemize
  4629. @item
  4630. Mark the centre quarter of the frame as interesting.
  4631. @example
  4632. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4633. @end example
  4634. @item
  4635. Mark the 100-pixel-wide region on the left edge of the frame as very
  4636. uninteresting (to be encoded at much lower quality than the rest of
  4637. the frame).
  4638. @example
  4639. addroi=0:0:100:ih:+1/5
  4640. @end example
  4641. @end itemize
  4642. @section alphaextract
  4643. Extract the alpha component from the input as a grayscale video. This
  4644. is especially useful with the @var{alphamerge} filter.
  4645. @section alphamerge
  4646. Add or replace the alpha component of the primary input with the
  4647. grayscale value of a second input. This is intended for use with
  4648. @var{alphaextract} to allow the transmission or storage of frame
  4649. sequences that have alpha in a format that doesn't support an alpha
  4650. channel.
  4651. For example, to reconstruct full frames from a normal YUV-encoded video
  4652. and a separate video created with @var{alphaextract}, you might use:
  4653. @example
  4654. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4655. @end example
  4656. Since this filter is designed for reconstruction, it operates on frame
  4657. sequences without considering timestamps, and terminates when either
  4658. input reaches end of stream. This will cause problems if your encoding
  4659. pipeline drops frames. If you're trying to apply an image as an
  4660. overlay to a video stream, consider the @var{overlay} filter instead.
  4661. @section amplify
  4662. Amplify differences between current pixel and pixels of adjacent frames in
  4663. same pixel location.
  4664. This filter accepts the following options:
  4665. @table @option
  4666. @item radius
  4667. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4668. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4669. @item factor
  4670. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4671. @item threshold
  4672. Set threshold for difference amplification. Any difference greater or equal to
  4673. this value will not alter source pixel. Default is 10.
  4674. Allowed range is from 0 to 65535.
  4675. @item tolerance
  4676. Set tolerance for difference amplification. Any difference lower to
  4677. this value will not alter source pixel. Default is 0.
  4678. Allowed range is from 0 to 65535.
  4679. @item low
  4680. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4681. This option controls maximum possible value that will decrease source pixel value.
  4682. @item high
  4683. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4684. This option controls maximum possible value that will increase source pixel value.
  4685. @item planes
  4686. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4687. @end table
  4688. @section ass
  4689. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4690. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4691. Substation Alpha) subtitles files.
  4692. This filter accepts the following option in addition to the common options from
  4693. the @ref{subtitles} filter:
  4694. @table @option
  4695. @item shaping
  4696. Set the shaping engine
  4697. Available values are:
  4698. @table @samp
  4699. @item auto
  4700. The default libass shaping engine, which is the best available.
  4701. @item simple
  4702. Fast, font-agnostic shaper that can do only substitutions
  4703. @item complex
  4704. Slower shaper using OpenType for substitutions and positioning
  4705. @end table
  4706. The default is @code{auto}.
  4707. @end table
  4708. @section atadenoise
  4709. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4710. The filter accepts the following options:
  4711. @table @option
  4712. @item 0a
  4713. Set threshold A for 1st plane. Default is 0.02.
  4714. Valid range is 0 to 0.3.
  4715. @item 0b
  4716. Set threshold B for 1st plane. Default is 0.04.
  4717. Valid range is 0 to 5.
  4718. @item 1a
  4719. Set threshold A for 2nd plane. Default is 0.02.
  4720. Valid range is 0 to 0.3.
  4721. @item 1b
  4722. Set threshold B for 2nd plane. Default is 0.04.
  4723. Valid range is 0 to 5.
  4724. @item 2a
  4725. Set threshold A for 3rd plane. Default is 0.02.
  4726. Valid range is 0 to 0.3.
  4727. @item 2b
  4728. Set threshold B for 3rd plane. Default is 0.04.
  4729. Valid range is 0 to 5.
  4730. Threshold A is designed to react on abrupt changes in the input signal and
  4731. threshold B is designed to react on continuous changes in the input signal.
  4732. @item s
  4733. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4734. number in range [5, 129].
  4735. @item p
  4736. Set what planes of frame filter will use for averaging. Default is all.
  4737. @end table
  4738. @section avgblur
  4739. Apply average blur filter.
  4740. The filter accepts the following options:
  4741. @table @option
  4742. @item sizeX
  4743. Set horizontal radius size.
  4744. @item planes
  4745. Set which planes to filter. By default all planes are filtered.
  4746. @item sizeY
  4747. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4748. Default is @code{0}.
  4749. @end table
  4750. @section bbox
  4751. Compute the bounding box for the non-black pixels in the input frame
  4752. luminance plane.
  4753. This filter computes the bounding box containing all the pixels with a
  4754. luminance value greater than the minimum allowed value.
  4755. The parameters describing the bounding box are printed on the filter
  4756. log.
  4757. The filter accepts the following option:
  4758. @table @option
  4759. @item min_val
  4760. Set the minimal luminance value. Default is @code{16}.
  4761. @end table
  4762. @section bitplanenoise
  4763. Show and measure bit plane noise.
  4764. The filter accepts the following options:
  4765. @table @option
  4766. @item bitplane
  4767. Set which plane to analyze. Default is @code{1}.
  4768. @item filter
  4769. Filter out noisy pixels from @code{bitplane} set above.
  4770. Default is disabled.
  4771. @end table
  4772. @section blackdetect
  4773. Detect video intervals that are (almost) completely black. Can be
  4774. useful to detect chapter transitions, commercials, or invalid
  4775. recordings. Output lines contains the time for the start, end and
  4776. duration of the detected black interval expressed in seconds.
  4777. In order to display the output lines, you need to set the loglevel at
  4778. least to the AV_LOG_INFO value.
  4779. The filter accepts the following options:
  4780. @table @option
  4781. @item black_min_duration, d
  4782. Set the minimum detected black duration expressed in seconds. It must
  4783. be a non-negative floating point number.
  4784. Default value is 2.0.
  4785. @item picture_black_ratio_th, pic_th
  4786. Set the threshold for considering a picture "black".
  4787. Express the minimum value for the ratio:
  4788. @example
  4789. @var{nb_black_pixels} / @var{nb_pixels}
  4790. @end example
  4791. for which a picture is considered black.
  4792. Default value is 0.98.
  4793. @item pixel_black_th, pix_th
  4794. Set the threshold for considering a pixel "black".
  4795. The threshold expresses the maximum pixel luminance value for which a
  4796. pixel is considered "black". The provided value is scaled according to
  4797. the following equation:
  4798. @example
  4799. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4800. @end example
  4801. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4802. the input video format, the range is [0-255] for YUV full-range
  4803. formats and [16-235] for YUV non full-range formats.
  4804. Default value is 0.10.
  4805. @end table
  4806. The following example sets the maximum pixel threshold to the minimum
  4807. value, and detects only black intervals of 2 or more seconds:
  4808. @example
  4809. blackdetect=d=2:pix_th=0.00
  4810. @end example
  4811. @section blackframe
  4812. Detect frames that are (almost) completely black. Can be useful to
  4813. detect chapter transitions or commercials. Output lines consist of
  4814. the frame number of the detected frame, the percentage of blackness,
  4815. the position in the file if known or -1 and the timestamp in seconds.
  4816. In order to display the output lines, you need to set the loglevel at
  4817. least to the AV_LOG_INFO value.
  4818. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4819. The value represents the percentage of pixels in the picture that
  4820. are below the threshold value.
  4821. It accepts the following parameters:
  4822. @table @option
  4823. @item amount
  4824. The percentage of the pixels that have to be below the threshold; it defaults to
  4825. @code{98}.
  4826. @item threshold, thresh
  4827. The threshold below which a pixel value is considered black; it defaults to
  4828. @code{32}.
  4829. @end table
  4830. @section blend, tblend
  4831. Blend two video frames into each other.
  4832. The @code{blend} filter takes two input streams and outputs one
  4833. stream, the first input is the "top" layer and second input is
  4834. "bottom" layer. By default, the output terminates when the longest input terminates.
  4835. The @code{tblend} (time blend) filter takes two consecutive frames
  4836. from one single stream, and outputs the result obtained by blending
  4837. the new frame on top of the old frame.
  4838. A description of the accepted options follows.
  4839. @table @option
  4840. @item c0_mode
  4841. @item c1_mode
  4842. @item c2_mode
  4843. @item c3_mode
  4844. @item all_mode
  4845. Set blend mode for specific pixel component or all pixel components in case
  4846. of @var{all_mode}. Default value is @code{normal}.
  4847. Available values for component modes are:
  4848. @table @samp
  4849. @item addition
  4850. @item grainmerge
  4851. @item and
  4852. @item average
  4853. @item burn
  4854. @item darken
  4855. @item difference
  4856. @item grainextract
  4857. @item divide
  4858. @item dodge
  4859. @item freeze
  4860. @item exclusion
  4861. @item extremity
  4862. @item glow
  4863. @item hardlight
  4864. @item hardmix
  4865. @item heat
  4866. @item lighten
  4867. @item linearlight
  4868. @item multiply
  4869. @item multiply128
  4870. @item negation
  4871. @item normal
  4872. @item or
  4873. @item overlay
  4874. @item phoenix
  4875. @item pinlight
  4876. @item reflect
  4877. @item screen
  4878. @item softlight
  4879. @item subtract
  4880. @item vividlight
  4881. @item xor
  4882. @end table
  4883. @item c0_opacity
  4884. @item c1_opacity
  4885. @item c2_opacity
  4886. @item c3_opacity
  4887. @item all_opacity
  4888. Set blend opacity for specific pixel component or all pixel components in case
  4889. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4890. @item c0_expr
  4891. @item c1_expr
  4892. @item c2_expr
  4893. @item c3_expr
  4894. @item all_expr
  4895. Set blend expression for specific pixel component or all pixel components in case
  4896. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4897. The expressions can use the following variables:
  4898. @table @option
  4899. @item N
  4900. The sequential number of the filtered frame, starting from @code{0}.
  4901. @item X
  4902. @item Y
  4903. the coordinates of the current sample
  4904. @item W
  4905. @item H
  4906. the width and height of currently filtered plane
  4907. @item SW
  4908. @item SH
  4909. Width and height scale for the plane being filtered. It is the
  4910. ratio between the dimensions of the current plane to the luma plane,
  4911. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4912. the luma plane and @code{0.5,0.5} for the chroma planes.
  4913. @item T
  4914. Time of the current frame, expressed in seconds.
  4915. @item TOP, A
  4916. Value of pixel component at current location for first video frame (top layer).
  4917. @item BOTTOM, B
  4918. Value of pixel component at current location for second video frame (bottom layer).
  4919. @end table
  4920. @end table
  4921. The @code{blend} filter also supports the @ref{framesync} options.
  4922. @subsection Examples
  4923. @itemize
  4924. @item
  4925. Apply transition from bottom layer to top layer in first 10 seconds:
  4926. @example
  4927. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4928. @end example
  4929. @item
  4930. Apply linear horizontal transition from top layer to bottom layer:
  4931. @example
  4932. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4933. @end example
  4934. @item
  4935. Apply 1x1 checkerboard effect:
  4936. @example
  4937. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4938. @end example
  4939. @item
  4940. Apply uncover left effect:
  4941. @example
  4942. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4943. @end example
  4944. @item
  4945. Apply uncover down effect:
  4946. @example
  4947. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4948. @end example
  4949. @item
  4950. Apply uncover up-left effect:
  4951. @example
  4952. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4953. @end example
  4954. @item
  4955. Split diagonally video and shows top and bottom layer on each side:
  4956. @example
  4957. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4958. @end example
  4959. @item
  4960. Display differences between the current and the previous frame:
  4961. @example
  4962. tblend=all_mode=grainextract
  4963. @end example
  4964. @end itemize
  4965. @section bm3d
  4966. Denoise frames using Block-Matching 3D algorithm.
  4967. The filter accepts the following options.
  4968. @table @option
  4969. @item sigma
  4970. Set denoising strength. Default value is 1.
  4971. Allowed range is from 0 to 999.9.
  4972. The denoising algorithm is very sensitive to sigma, so adjust it
  4973. according to the source.
  4974. @item block
  4975. Set local patch size. This sets dimensions in 2D.
  4976. @item bstep
  4977. Set sliding step for processing blocks. Default value is 4.
  4978. Allowed range is from 1 to 64.
  4979. Smaller values allows processing more reference blocks and is slower.
  4980. @item group
  4981. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4982. When set to 1, no block matching is done. Larger values allows more blocks
  4983. in single group.
  4984. Allowed range is from 1 to 256.
  4985. @item range
  4986. Set radius for search block matching. Default is 9.
  4987. Allowed range is from 1 to INT32_MAX.
  4988. @item mstep
  4989. Set step between two search locations for block matching. Default is 1.
  4990. Allowed range is from 1 to 64. Smaller is slower.
  4991. @item thmse
  4992. Set threshold of mean square error for block matching. Valid range is 0 to
  4993. INT32_MAX.
  4994. @item hdthr
  4995. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4996. Larger values results in stronger hard-thresholding filtering in frequency
  4997. domain.
  4998. @item estim
  4999. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5000. Default is @code{basic}.
  5001. @item ref
  5002. If enabled, filter will use 2nd stream for block matching.
  5003. Default is disabled for @code{basic} value of @var{estim} option,
  5004. and always enabled if value of @var{estim} is @code{final}.
  5005. @item planes
  5006. Set planes to filter. Default is all available except alpha.
  5007. @end table
  5008. @subsection Examples
  5009. @itemize
  5010. @item
  5011. Basic filtering with bm3d:
  5012. @example
  5013. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5014. @end example
  5015. @item
  5016. Same as above, but filtering only luma:
  5017. @example
  5018. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5019. @end example
  5020. @item
  5021. Same as above, but with both estimation modes:
  5022. @example
  5023. 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
  5024. @end example
  5025. @item
  5026. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5027. @example
  5028. 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
  5029. @end example
  5030. @end itemize
  5031. @section boxblur
  5032. Apply a boxblur algorithm to the input video.
  5033. It accepts the following parameters:
  5034. @table @option
  5035. @item luma_radius, lr
  5036. @item luma_power, lp
  5037. @item chroma_radius, cr
  5038. @item chroma_power, cp
  5039. @item alpha_radius, ar
  5040. @item alpha_power, ap
  5041. @end table
  5042. A description of the accepted options follows.
  5043. @table @option
  5044. @item luma_radius, lr
  5045. @item chroma_radius, cr
  5046. @item alpha_radius, ar
  5047. Set an expression for the box radius in pixels used for blurring the
  5048. corresponding input plane.
  5049. The radius value must be a non-negative number, and must not be
  5050. greater than the value of the expression @code{min(w,h)/2} for the
  5051. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5052. planes.
  5053. Default value for @option{luma_radius} is "2". If not specified,
  5054. @option{chroma_radius} and @option{alpha_radius} default to the
  5055. corresponding value set for @option{luma_radius}.
  5056. The expressions can contain the following constants:
  5057. @table @option
  5058. @item w
  5059. @item h
  5060. The input width and height in pixels.
  5061. @item cw
  5062. @item ch
  5063. The input chroma image width and height in pixels.
  5064. @item hsub
  5065. @item vsub
  5066. The horizontal and vertical chroma subsample values. For example, for the
  5067. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5068. @end table
  5069. @item luma_power, lp
  5070. @item chroma_power, cp
  5071. @item alpha_power, ap
  5072. Specify how many times the boxblur filter is applied to the
  5073. corresponding plane.
  5074. Default value for @option{luma_power} is 2. If not specified,
  5075. @option{chroma_power} and @option{alpha_power} default to the
  5076. corresponding value set for @option{luma_power}.
  5077. A value of 0 will disable the effect.
  5078. @end table
  5079. @subsection Examples
  5080. @itemize
  5081. @item
  5082. Apply a boxblur filter with the luma, chroma, and alpha radii
  5083. set to 2:
  5084. @example
  5085. boxblur=luma_radius=2:luma_power=1
  5086. boxblur=2:1
  5087. @end example
  5088. @item
  5089. Set the luma radius to 2, and alpha and chroma radius to 0:
  5090. @example
  5091. boxblur=2:1:cr=0:ar=0
  5092. @end example
  5093. @item
  5094. Set the luma and chroma radii to a fraction of the video dimension:
  5095. @example
  5096. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5097. @end example
  5098. @end itemize
  5099. @section bwdif
  5100. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5101. Deinterlacing Filter").
  5102. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5103. interpolation algorithms.
  5104. It accepts the following parameters:
  5105. @table @option
  5106. @item mode
  5107. The interlacing mode to adopt. It accepts one of the following values:
  5108. @table @option
  5109. @item 0, send_frame
  5110. Output one frame for each frame.
  5111. @item 1, send_field
  5112. Output one frame for each field.
  5113. @end table
  5114. The default value is @code{send_field}.
  5115. @item parity
  5116. The picture field parity assumed for the input interlaced video. It accepts one
  5117. of the following values:
  5118. @table @option
  5119. @item 0, tff
  5120. Assume the top field is first.
  5121. @item 1, bff
  5122. Assume the bottom field is first.
  5123. @item -1, auto
  5124. Enable automatic detection of field parity.
  5125. @end table
  5126. The default value is @code{auto}.
  5127. If the interlacing is unknown or the decoder does not export this information,
  5128. top field first will be assumed.
  5129. @item deint
  5130. Specify which frames to deinterlace. Accept one of the following
  5131. values:
  5132. @table @option
  5133. @item 0, all
  5134. Deinterlace all frames.
  5135. @item 1, interlaced
  5136. Only deinterlace frames marked as interlaced.
  5137. @end table
  5138. The default value is @code{all}.
  5139. @end table
  5140. @section chromahold
  5141. Remove all color information for all colors except for certain one.
  5142. The filter accepts the following options:
  5143. @table @option
  5144. @item color
  5145. The color which will not be replaced with neutral chroma.
  5146. @item similarity
  5147. Similarity percentage with the above color.
  5148. 0.01 matches only the exact key color, while 1.0 matches everything.
  5149. @item blend
  5150. Blend percentage.
  5151. 0.0 makes pixels either fully gray, or not gray at all.
  5152. Higher values result in more preserved color.
  5153. @item yuv
  5154. Signals that the color passed is already in YUV instead of RGB.
  5155. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5156. This can be used to pass exact YUV values as hexadecimal numbers.
  5157. @end table
  5158. @section chromakey
  5159. YUV colorspace color/chroma keying.
  5160. The filter accepts the following options:
  5161. @table @option
  5162. @item color
  5163. The color which will be replaced with transparency.
  5164. @item similarity
  5165. Similarity percentage with the key color.
  5166. 0.01 matches only the exact key color, while 1.0 matches everything.
  5167. @item blend
  5168. Blend percentage.
  5169. 0.0 makes pixels either fully transparent, or not transparent at all.
  5170. Higher values result in semi-transparent pixels, with a higher transparency
  5171. the more similar the pixels color is to the key color.
  5172. @item yuv
  5173. Signals that the color passed is already in YUV instead of RGB.
  5174. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5175. This can be used to pass exact YUV values as hexadecimal numbers.
  5176. @end table
  5177. @subsection Examples
  5178. @itemize
  5179. @item
  5180. Make every green pixel in the input image transparent:
  5181. @example
  5182. ffmpeg -i input.png -vf chromakey=green out.png
  5183. @end example
  5184. @item
  5185. Overlay a greenscreen-video on top of a static black background.
  5186. @example
  5187. 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
  5188. @end example
  5189. @end itemize
  5190. @section chromashift
  5191. Shift chroma pixels horizontally and/or vertically.
  5192. The filter accepts the following options:
  5193. @table @option
  5194. @item cbh
  5195. Set amount to shift chroma-blue horizontally.
  5196. @item cbv
  5197. Set amount to shift chroma-blue vertically.
  5198. @item crh
  5199. Set amount to shift chroma-red horizontally.
  5200. @item crv
  5201. Set amount to shift chroma-red vertically.
  5202. @item edge
  5203. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5204. @end table
  5205. @section ciescope
  5206. Display CIE color diagram with pixels overlaid onto it.
  5207. The filter accepts the following options:
  5208. @table @option
  5209. @item system
  5210. Set color system.
  5211. @table @samp
  5212. @item ntsc, 470m
  5213. @item ebu, 470bg
  5214. @item smpte
  5215. @item 240m
  5216. @item apple
  5217. @item widergb
  5218. @item cie1931
  5219. @item rec709, hdtv
  5220. @item uhdtv, rec2020
  5221. @item dcip3
  5222. @end table
  5223. @item cie
  5224. Set CIE system.
  5225. @table @samp
  5226. @item xyy
  5227. @item ucs
  5228. @item luv
  5229. @end table
  5230. @item gamuts
  5231. Set what gamuts to draw.
  5232. See @code{system} option for available values.
  5233. @item size, s
  5234. Set ciescope size, by default set to 512.
  5235. @item intensity, i
  5236. Set intensity used to map input pixel values to CIE diagram.
  5237. @item contrast
  5238. Set contrast used to draw tongue colors that are out of active color system gamut.
  5239. @item corrgamma
  5240. Correct gamma displayed on scope, by default enabled.
  5241. @item showwhite
  5242. Show white point on CIE diagram, by default disabled.
  5243. @item gamma
  5244. Set input gamma. Used only with XYZ input color space.
  5245. @end table
  5246. @section codecview
  5247. Visualize information exported by some codecs.
  5248. Some codecs can export information through frames using side-data or other
  5249. means. For example, some MPEG based codecs export motion vectors through the
  5250. @var{export_mvs} flag in the codec @option{flags2} option.
  5251. The filter accepts the following option:
  5252. @table @option
  5253. @item mv
  5254. Set motion vectors to visualize.
  5255. Available flags for @var{mv} are:
  5256. @table @samp
  5257. @item pf
  5258. forward predicted MVs of P-frames
  5259. @item bf
  5260. forward predicted MVs of B-frames
  5261. @item bb
  5262. backward predicted MVs of B-frames
  5263. @end table
  5264. @item qp
  5265. Display quantization parameters using the chroma planes.
  5266. @item mv_type, mvt
  5267. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5268. Available flags for @var{mv_type} are:
  5269. @table @samp
  5270. @item fp
  5271. forward predicted MVs
  5272. @item bp
  5273. backward predicted MVs
  5274. @end table
  5275. @item frame_type, ft
  5276. Set frame type to visualize motion vectors of.
  5277. Available flags for @var{frame_type} are:
  5278. @table @samp
  5279. @item if
  5280. intra-coded frames (I-frames)
  5281. @item pf
  5282. predicted frames (P-frames)
  5283. @item bf
  5284. bi-directionally predicted frames (B-frames)
  5285. @end table
  5286. @end table
  5287. @subsection Examples
  5288. @itemize
  5289. @item
  5290. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5291. @example
  5292. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5293. @end example
  5294. @item
  5295. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5296. @example
  5297. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5298. @end example
  5299. @end itemize
  5300. @section colorbalance
  5301. Modify intensity of primary colors (red, green and blue) of input frames.
  5302. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5303. regions for the red-cyan, green-magenta or blue-yellow balance.
  5304. A positive adjustment value shifts the balance towards the primary color, a negative
  5305. value towards the complementary color.
  5306. The filter accepts the following options:
  5307. @table @option
  5308. @item rs
  5309. @item gs
  5310. @item bs
  5311. Adjust red, green and blue shadows (darkest pixels).
  5312. @item rm
  5313. @item gm
  5314. @item bm
  5315. Adjust red, green and blue midtones (medium pixels).
  5316. @item rh
  5317. @item gh
  5318. @item bh
  5319. Adjust red, green and blue highlights (brightest pixels).
  5320. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5321. @end table
  5322. @subsection Examples
  5323. @itemize
  5324. @item
  5325. Add red color cast to shadows:
  5326. @example
  5327. colorbalance=rs=.3
  5328. @end example
  5329. @end itemize
  5330. @section colorchannelmixer
  5331. Adjust video input frames by re-mixing color channels.
  5332. This filter modifies a color channel by adding the values associated to
  5333. the other channels of the same pixels. For example if the value to
  5334. modify is red, the output value will be:
  5335. @example
  5336. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5337. @end example
  5338. The filter accepts the following options:
  5339. @table @option
  5340. @item rr
  5341. @item rg
  5342. @item rb
  5343. @item ra
  5344. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5345. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5346. @item gr
  5347. @item gg
  5348. @item gb
  5349. @item ga
  5350. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5351. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5352. @item br
  5353. @item bg
  5354. @item bb
  5355. @item ba
  5356. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5357. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5358. @item ar
  5359. @item ag
  5360. @item ab
  5361. @item aa
  5362. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5363. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5364. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5365. @end table
  5366. @subsection Examples
  5367. @itemize
  5368. @item
  5369. Convert source to grayscale:
  5370. @example
  5371. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5372. @end example
  5373. @item
  5374. Simulate sepia tones:
  5375. @example
  5376. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5377. @end example
  5378. @end itemize
  5379. @section colorkey
  5380. RGB colorspace color keying.
  5381. The filter accepts the following options:
  5382. @table @option
  5383. @item color
  5384. The color which will be replaced with transparency.
  5385. @item similarity
  5386. Similarity percentage with the key color.
  5387. 0.01 matches only the exact key color, while 1.0 matches everything.
  5388. @item blend
  5389. Blend percentage.
  5390. 0.0 makes pixels either fully transparent, or not transparent at all.
  5391. Higher values result in semi-transparent pixels, with a higher transparency
  5392. the more similar the pixels color is to the key color.
  5393. @end table
  5394. @subsection Examples
  5395. @itemize
  5396. @item
  5397. Make every green pixel in the input image transparent:
  5398. @example
  5399. ffmpeg -i input.png -vf colorkey=green out.png
  5400. @end example
  5401. @item
  5402. Overlay a greenscreen-video on top of a static background image.
  5403. @example
  5404. 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
  5405. @end example
  5406. @end itemize
  5407. @section colorhold
  5408. Remove all color information for all RGB colors except for certain one.
  5409. The filter accepts the following options:
  5410. @table @option
  5411. @item color
  5412. The color which will not be replaced with neutral gray.
  5413. @item similarity
  5414. Similarity percentage with the above color.
  5415. 0.01 matches only the exact key color, while 1.0 matches everything.
  5416. @item blend
  5417. Blend percentage. 0.0 makes pixels fully gray.
  5418. Higher values result in more preserved color.
  5419. @end table
  5420. @section colorlevels
  5421. Adjust video input frames using levels.
  5422. The filter accepts the following options:
  5423. @table @option
  5424. @item rimin
  5425. @item gimin
  5426. @item bimin
  5427. @item aimin
  5428. Adjust red, green, blue and alpha input black point.
  5429. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5430. @item rimax
  5431. @item gimax
  5432. @item bimax
  5433. @item aimax
  5434. Adjust red, green, blue and alpha input white point.
  5435. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5436. Input levels are used to lighten highlights (bright tones), darken shadows
  5437. (dark tones), change the balance of bright and dark tones.
  5438. @item romin
  5439. @item gomin
  5440. @item bomin
  5441. @item aomin
  5442. Adjust red, green, blue and alpha output black point.
  5443. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5444. @item romax
  5445. @item gomax
  5446. @item bomax
  5447. @item aomax
  5448. Adjust red, green, blue and alpha output white point.
  5449. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5450. Output levels allows manual selection of a constrained output level range.
  5451. @end table
  5452. @subsection Examples
  5453. @itemize
  5454. @item
  5455. Make video output darker:
  5456. @example
  5457. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5458. @end example
  5459. @item
  5460. Increase contrast:
  5461. @example
  5462. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5463. @end example
  5464. @item
  5465. Make video output lighter:
  5466. @example
  5467. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5468. @end example
  5469. @item
  5470. Increase brightness:
  5471. @example
  5472. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5473. @end example
  5474. @end itemize
  5475. @section colormatrix
  5476. Convert color matrix.
  5477. The filter accepts the following options:
  5478. @table @option
  5479. @item src
  5480. @item dst
  5481. Specify the source and destination color matrix. Both values must be
  5482. specified.
  5483. The accepted values are:
  5484. @table @samp
  5485. @item bt709
  5486. BT.709
  5487. @item fcc
  5488. FCC
  5489. @item bt601
  5490. BT.601
  5491. @item bt470
  5492. BT.470
  5493. @item bt470bg
  5494. BT.470BG
  5495. @item smpte170m
  5496. SMPTE-170M
  5497. @item smpte240m
  5498. SMPTE-240M
  5499. @item bt2020
  5500. BT.2020
  5501. @end table
  5502. @end table
  5503. For example to convert from BT.601 to SMPTE-240M, use the command:
  5504. @example
  5505. colormatrix=bt601:smpte240m
  5506. @end example
  5507. @section colorspace
  5508. Convert colorspace, transfer characteristics or color primaries.
  5509. Input video needs to have an even size.
  5510. The filter accepts the following options:
  5511. @table @option
  5512. @anchor{all}
  5513. @item all
  5514. Specify all color properties at once.
  5515. The accepted values are:
  5516. @table @samp
  5517. @item bt470m
  5518. BT.470M
  5519. @item bt470bg
  5520. BT.470BG
  5521. @item bt601-6-525
  5522. BT.601-6 525
  5523. @item bt601-6-625
  5524. BT.601-6 625
  5525. @item bt709
  5526. BT.709
  5527. @item smpte170m
  5528. SMPTE-170M
  5529. @item smpte240m
  5530. SMPTE-240M
  5531. @item bt2020
  5532. BT.2020
  5533. @end table
  5534. @anchor{space}
  5535. @item space
  5536. Specify output colorspace.
  5537. The accepted values are:
  5538. @table @samp
  5539. @item bt709
  5540. BT.709
  5541. @item fcc
  5542. FCC
  5543. @item bt470bg
  5544. BT.470BG or BT.601-6 625
  5545. @item smpte170m
  5546. SMPTE-170M or BT.601-6 525
  5547. @item smpte240m
  5548. SMPTE-240M
  5549. @item ycgco
  5550. YCgCo
  5551. @item bt2020ncl
  5552. BT.2020 with non-constant luminance
  5553. @end table
  5554. @anchor{trc}
  5555. @item trc
  5556. Specify output transfer characteristics.
  5557. The accepted values are:
  5558. @table @samp
  5559. @item bt709
  5560. BT.709
  5561. @item bt470m
  5562. BT.470M
  5563. @item bt470bg
  5564. BT.470BG
  5565. @item gamma22
  5566. Constant gamma of 2.2
  5567. @item gamma28
  5568. Constant gamma of 2.8
  5569. @item smpte170m
  5570. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5571. @item smpte240m
  5572. SMPTE-240M
  5573. @item srgb
  5574. SRGB
  5575. @item iec61966-2-1
  5576. iec61966-2-1
  5577. @item iec61966-2-4
  5578. iec61966-2-4
  5579. @item xvycc
  5580. xvycc
  5581. @item bt2020-10
  5582. BT.2020 for 10-bits content
  5583. @item bt2020-12
  5584. BT.2020 for 12-bits content
  5585. @end table
  5586. @anchor{primaries}
  5587. @item primaries
  5588. Specify output color primaries.
  5589. The accepted values are:
  5590. @table @samp
  5591. @item bt709
  5592. BT.709
  5593. @item bt470m
  5594. BT.470M
  5595. @item bt470bg
  5596. BT.470BG or BT.601-6 625
  5597. @item smpte170m
  5598. SMPTE-170M or BT.601-6 525
  5599. @item smpte240m
  5600. SMPTE-240M
  5601. @item film
  5602. film
  5603. @item smpte431
  5604. SMPTE-431
  5605. @item smpte432
  5606. SMPTE-432
  5607. @item bt2020
  5608. BT.2020
  5609. @item jedec-p22
  5610. JEDEC P22 phosphors
  5611. @end table
  5612. @anchor{range}
  5613. @item range
  5614. Specify output color range.
  5615. The accepted values are:
  5616. @table @samp
  5617. @item tv
  5618. TV (restricted) range
  5619. @item mpeg
  5620. MPEG (restricted) range
  5621. @item pc
  5622. PC (full) range
  5623. @item jpeg
  5624. JPEG (full) range
  5625. @end table
  5626. @item format
  5627. Specify output color format.
  5628. The accepted values are:
  5629. @table @samp
  5630. @item yuv420p
  5631. YUV 4:2:0 planar 8-bits
  5632. @item yuv420p10
  5633. YUV 4:2:0 planar 10-bits
  5634. @item yuv420p12
  5635. YUV 4:2:0 planar 12-bits
  5636. @item yuv422p
  5637. YUV 4:2:2 planar 8-bits
  5638. @item yuv422p10
  5639. YUV 4:2:2 planar 10-bits
  5640. @item yuv422p12
  5641. YUV 4:2:2 planar 12-bits
  5642. @item yuv444p
  5643. YUV 4:4:4 planar 8-bits
  5644. @item yuv444p10
  5645. YUV 4:4:4 planar 10-bits
  5646. @item yuv444p12
  5647. YUV 4:4:4 planar 12-bits
  5648. @end table
  5649. @item fast
  5650. Do a fast conversion, which skips gamma/primary correction. This will take
  5651. significantly less CPU, but will be mathematically incorrect. To get output
  5652. compatible with that produced by the colormatrix filter, use fast=1.
  5653. @item dither
  5654. Specify dithering mode.
  5655. The accepted values are:
  5656. @table @samp
  5657. @item none
  5658. No dithering
  5659. @item fsb
  5660. Floyd-Steinberg dithering
  5661. @end table
  5662. @item wpadapt
  5663. Whitepoint adaptation mode.
  5664. The accepted values are:
  5665. @table @samp
  5666. @item bradford
  5667. Bradford whitepoint adaptation
  5668. @item vonkries
  5669. von Kries whitepoint adaptation
  5670. @item identity
  5671. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5672. @end table
  5673. @item iall
  5674. Override all input properties at once. Same accepted values as @ref{all}.
  5675. @item ispace
  5676. Override input colorspace. Same accepted values as @ref{space}.
  5677. @item iprimaries
  5678. Override input color primaries. Same accepted values as @ref{primaries}.
  5679. @item itrc
  5680. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5681. @item irange
  5682. Override input color range. Same accepted values as @ref{range}.
  5683. @end table
  5684. The filter converts the transfer characteristics, color space and color
  5685. primaries to the specified user values. The output value, if not specified,
  5686. is set to a default value based on the "all" property. If that property is
  5687. also not specified, the filter will log an error. The output color range and
  5688. format default to the same value as the input color range and format. The
  5689. input transfer characteristics, color space, color primaries and color range
  5690. should be set on the input data. If any of these are missing, the filter will
  5691. log an error and no conversion will take place.
  5692. For example to convert the input to SMPTE-240M, use the command:
  5693. @example
  5694. colorspace=smpte240m
  5695. @end example
  5696. @section convolution
  5697. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5698. The filter accepts the following options:
  5699. @table @option
  5700. @item 0m
  5701. @item 1m
  5702. @item 2m
  5703. @item 3m
  5704. Set matrix for each plane.
  5705. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5706. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5707. @item 0rdiv
  5708. @item 1rdiv
  5709. @item 2rdiv
  5710. @item 3rdiv
  5711. Set multiplier for calculated value for each plane.
  5712. If unset or 0, it will be sum of all matrix elements.
  5713. @item 0bias
  5714. @item 1bias
  5715. @item 2bias
  5716. @item 3bias
  5717. Set bias for each plane. This value is added to the result of the multiplication.
  5718. Useful for making the overall image brighter or darker. Default is 0.0.
  5719. @item 0mode
  5720. @item 1mode
  5721. @item 2mode
  5722. @item 3mode
  5723. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5724. Default is @var{square}.
  5725. @end table
  5726. @subsection Examples
  5727. @itemize
  5728. @item
  5729. Apply sharpen:
  5730. @example
  5731. 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"
  5732. @end example
  5733. @item
  5734. Apply blur:
  5735. @example
  5736. 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"
  5737. @end example
  5738. @item
  5739. Apply edge enhance:
  5740. @example
  5741. 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"
  5742. @end example
  5743. @item
  5744. Apply edge detect:
  5745. @example
  5746. 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"
  5747. @end example
  5748. @item
  5749. Apply laplacian edge detector which includes diagonals:
  5750. @example
  5751. 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"
  5752. @end example
  5753. @item
  5754. Apply emboss:
  5755. @example
  5756. 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"
  5757. @end example
  5758. @end itemize
  5759. @section convolve
  5760. Apply 2D convolution of video stream in frequency domain using second stream
  5761. as impulse.
  5762. The filter accepts the following options:
  5763. @table @option
  5764. @item planes
  5765. Set which planes to process.
  5766. @item impulse
  5767. Set which impulse video frames will be processed, can be @var{first}
  5768. or @var{all}. Default is @var{all}.
  5769. @end table
  5770. The @code{convolve} filter also supports the @ref{framesync} options.
  5771. @section copy
  5772. Copy the input video source unchanged to the output. This is mainly useful for
  5773. testing purposes.
  5774. @anchor{coreimage}
  5775. @section coreimage
  5776. Video filtering on GPU using Apple's CoreImage API on OSX.
  5777. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5778. processed by video hardware. However, software-based OpenGL implementations
  5779. exist which means there is no guarantee for hardware processing. It depends on
  5780. the respective OSX.
  5781. There are many filters and image generators provided by Apple that come with a
  5782. large variety of options. The filter has to be referenced by its name along
  5783. with its options.
  5784. The coreimage filter accepts the following options:
  5785. @table @option
  5786. @item list_filters
  5787. List all available filters and generators along with all their respective
  5788. options as well as possible minimum and maximum values along with the default
  5789. values.
  5790. @example
  5791. list_filters=true
  5792. @end example
  5793. @item filter
  5794. Specify all filters by their respective name and options.
  5795. Use @var{list_filters} to determine all valid filter names and options.
  5796. Numerical options are specified by a float value and are automatically clamped
  5797. to their respective value range. Vector and color options have to be specified
  5798. by a list of space separated float values. Character escaping has to be done.
  5799. A special option name @code{default} is available to use default options for a
  5800. filter.
  5801. It is required to specify either @code{default} or at least one of the filter options.
  5802. All omitted options are used with their default values.
  5803. The syntax of the filter string is as follows:
  5804. @example
  5805. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5806. @end example
  5807. @item output_rect
  5808. Specify a rectangle where the output of the filter chain is copied into the
  5809. input image. It is given by a list of space separated float values:
  5810. @example
  5811. output_rect=x\ y\ width\ height
  5812. @end example
  5813. If not given, the output rectangle equals the dimensions of the input image.
  5814. The output rectangle is automatically cropped at the borders of the input
  5815. image. Negative values are valid for each component.
  5816. @example
  5817. output_rect=25\ 25\ 100\ 100
  5818. @end example
  5819. @end table
  5820. Several filters can be chained for successive processing without GPU-HOST
  5821. transfers allowing for fast processing of complex filter chains.
  5822. Currently, only filters with zero (generators) or exactly one (filters) input
  5823. image and one output image are supported. Also, transition filters are not yet
  5824. usable as intended.
  5825. Some filters generate output images with additional padding depending on the
  5826. respective filter kernel. The padding is automatically removed to ensure the
  5827. filter output has the same size as the input image.
  5828. For image generators, the size of the output image is determined by the
  5829. previous output image of the filter chain or the input image of the whole
  5830. filterchain, respectively. The generators do not use the pixel information of
  5831. this image to generate their output. However, the generated output is
  5832. blended onto this image, resulting in partial or complete coverage of the
  5833. output image.
  5834. The @ref{coreimagesrc} video source can be used for generating input images
  5835. which are directly fed into the filter chain. By using it, providing input
  5836. images by another video source or an input video is not required.
  5837. @subsection Examples
  5838. @itemize
  5839. @item
  5840. List all filters available:
  5841. @example
  5842. coreimage=list_filters=true
  5843. @end example
  5844. @item
  5845. Use the CIBoxBlur filter with default options to blur an image:
  5846. @example
  5847. coreimage=filter=CIBoxBlur@@default
  5848. @end example
  5849. @item
  5850. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5851. its center at 100x100 and a radius of 50 pixels:
  5852. @example
  5853. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5854. @end example
  5855. @item
  5856. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5857. given as complete and escaped command-line for Apple's standard bash shell:
  5858. @example
  5859. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5860. @end example
  5861. @end itemize
  5862. @section cover_rect
  5863. Cover a rectangular object
  5864. It accepts the following options:
  5865. @table @option
  5866. @item cover
  5867. Filepath of the optional cover image, needs to be in yuv420.
  5868. @item mode
  5869. Set covering mode.
  5870. It accepts the following values:
  5871. @table @samp
  5872. @item cover
  5873. cover it by the supplied image
  5874. @item blur
  5875. cover it by interpolating the surrounding pixels
  5876. @end table
  5877. Default value is @var{blur}.
  5878. @end table
  5879. @subsection Examples
  5880. @itemize
  5881. @item
  5882. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  5883. @example
  5884. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5885. @end example
  5886. @end itemize
  5887. @section crop
  5888. Crop the input video to given dimensions.
  5889. It accepts the following parameters:
  5890. @table @option
  5891. @item w, out_w
  5892. The width of the output video. It defaults to @code{iw}.
  5893. This expression is evaluated only once during the filter
  5894. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5895. @item h, out_h
  5896. The height of the output video. It defaults to @code{ih}.
  5897. This expression is evaluated only once during the filter
  5898. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5899. @item x
  5900. The horizontal position, in the input video, of the left edge of the output
  5901. video. It defaults to @code{(in_w-out_w)/2}.
  5902. This expression is evaluated per-frame.
  5903. @item y
  5904. The vertical position, in the input video, of the top edge of the output video.
  5905. It defaults to @code{(in_h-out_h)/2}.
  5906. This expression is evaluated per-frame.
  5907. @item keep_aspect
  5908. If set to 1 will force the output display aspect ratio
  5909. to be the same of the input, by changing the output sample aspect
  5910. ratio. It defaults to 0.
  5911. @item exact
  5912. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5913. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5914. It defaults to 0.
  5915. @end table
  5916. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5917. expressions containing the following constants:
  5918. @table @option
  5919. @item x
  5920. @item y
  5921. The computed values for @var{x} and @var{y}. They are evaluated for
  5922. each new frame.
  5923. @item in_w
  5924. @item in_h
  5925. The input width and height.
  5926. @item iw
  5927. @item ih
  5928. These are the same as @var{in_w} and @var{in_h}.
  5929. @item out_w
  5930. @item out_h
  5931. The output (cropped) width and height.
  5932. @item ow
  5933. @item oh
  5934. These are the same as @var{out_w} and @var{out_h}.
  5935. @item a
  5936. same as @var{iw} / @var{ih}
  5937. @item sar
  5938. input sample aspect ratio
  5939. @item dar
  5940. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5941. @item hsub
  5942. @item vsub
  5943. horizontal and vertical chroma subsample values. For example for the
  5944. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5945. @item n
  5946. The number of the input frame, starting from 0.
  5947. @item pos
  5948. the position in the file of the input frame, NAN if unknown
  5949. @item t
  5950. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5951. @end table
  5952. The expression for @var{out_w} may depend on the value of @var{out_h},
  5953. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5954. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5955. evaluated after @var{out_w} and @var{out_h}.
  5956. The @var{x} and @var{y} parameters specify the expressions for the
  5957. position of the top-left corner of the output (non-cropped) area. They
  5958. are evaluated for each frame. If the evaluated value is not valid, it
  5959. is approximated to the nearest valid value.
  5960. The expression for @var{x} may depend on @var{y}, and the expression
  5961. for @var{y} may depend on @var{x}.
  5962. @subsection Examples
  5963. @itemize
  5964. @item
  5965. Crop area with size 100x100 at position (12,34).
  5966. @example
  5967. crop=100:100:12:34
  5968. @end example
  5969. Using named options, the example above becomes:
  5970. @example
  5971. crop=w=100:h=100:x=12:y=34
  5972. @end example
  5973. @item
  5974. Crop the central input area with size 100x100:
  5975. @example
  5976. crop=100:100
  5977. @end example
  5978. @item
  5979. Crop the central input area with size 2/3 of the input video:
  5980. @example
  5981. crop=2/3*in_w:2/3*in_h
  5982. @end example
  5983. @item
  5984. Crop the input video central square:
  5985. @example
  5986. crop=out_w=in_h
  5987. crop=in_h
  5988. @end example
  5989. @item
  5990. Delimit the rectangle with the top-left corner placed at position
  5991. 100:100 and the right-bottom corner corresponding to the right-bottom
  5992. corner of the input image.
  5993. @example
  5994. crop=in_w-100:in_h-100:100:100
  5995. @end example
  5996. @item
  5997. Crop 10 pixels from the left and right borders, and 20 pixels from
  5998. the top and bottom borders
  5999. @example
  6000. crop=in_w-2*10:in_h-2*20
  6001. @end example
  6002. @item
  6003. Keep only the bottom right quarter of the input image:
  6004. @example
  6005. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6006. @end example
  6007. @item
  6008. Crop height for getting Greek harmony:
  6009. @example
  6010. crop=in_w:1/PHI*in_w
  6011. @end example
  6012. @item
  6013. Apply trembling effect:
  6014. @example
  6015. 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)
  6016. @end example
  6017. @item
  6018. Apply erratic camera effect depending on timestamp:
  6019. @example
  6020. 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)"
  6021. @end example
  6022. @item
  6023. Set x depending on the value of y:
  6024. @example
  6025. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6026. @end example
  6027. @end itemize
  6028. @subsection Commands
  6029. This filter supports the following commands:
  6030. @table @option
  6031. @item w, out_w
  6032. @item h, out_h
  6033. @item x
  6034. @item y
  6035. Set width/height of the output video and the horizontal/vertical position
  6036. in the input video.
  6037. The command accepts the same syntax of the corresponding option.
  6038. If the specified expression is not valid, it is kept at its current
  6039. value.
  6040. @end table
  6041. @section cropdetect
  6042. Auto-detect the crop size.
  6043. It calculates the necessary cropping parameters and prints the
  6044. recommended parameters via the logging system. The detected dimensions
  6045. correspond to the non-black area of the input video.
  6046. It accepts the following parameters:
  6047. @table @option
  6048. @item limit
  6049. Set higher black value threshold, which can be optionally specified
  6050. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6051. value greater to the set value is considered non-black. It defaults to 24.
  6052. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6053. on the bitdepth of the pixel format.
  6054. @item round
  6055. The value which the width/height should be divisible by. It defaults to
  6056. 16. The offset is automatically adjusted to center the video. Use 2 to
  6057. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6058. encoding to most video codecs.
  6059. @item reset_count, reset
  6060. Set the counter that determines after how many frames cropdetect will
  6061. reset the previously detected largest video area and start over to
  6062. detect the current optimal crop area. Default value is 0.
  6063. This can be useful when channel logos distort the video area. 0
  6064. indicates 'never reset', and returns the largest area encountered during
  6065. playback.
  6066. @end table
  6067. @anchor{cue}
  6068. @section cue
  6069. Delay video filtering until a given wallclock timestamp. The filter first
  6070. passes on @option{preroll} amount of frames, then it buffers at most
  6071. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6072. it forwards the buffered frames and also any subsequent frames coming in its
  6073. input.
  6074. The filter can be used synchronize the output of multiple ffmpeg processes for
  6075. realtime output devices like decklink. By putting the delay in the filtering
  6076. chain and pre-buffering frames the process can pass on data to output almost
  6077. immediately after the target wallclock timestamp is reached.
  6078. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6079. some use cases.
  6080. @table @option
  6081. @item cue
  6082. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6083. @item preroll
  6084. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6085. @item buffer
  6086. The maximum duration of content to buffer before waiting for the cue expressed
  6087. in seconds. Default is 0.
  6088. @end table
  6089. @anchor{curves}
  6090. @section curves
  6091. Apply color adjustments using curves.
  6092. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6093. component (red, green and blue) has its values defined by @var{N} key points
  6094. tied from each other using a smooth curve. The x-axis represents the pixel
  6095. values from the input frame, and the y-axis the new pixel values to be set for
  6096. the output frame.
  6097. By default, a component curve is defined by the two points @var{(0;0)} and
  6098. @var{(1;1)}. This creates a straight line where each original pixel value is
  6099. "adjusted" to its own value, which means no change to the image.
  6100. The filter allows you to redefine these two points and add some more. A new
  6101. curve (using a natural cubic spline interpolation) will be define to pass
  6102. smoothly through all these new coordinates. The new defined points needs to be
  6103. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6104. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6105. the vector spaces, the values will be clipped accordingly.
  6106. The filter accepts the following options:
  6107. @table @option
  6108. @item preset
  6109. Select one of the available color presets. This option can be used in addition
  6110. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6111. options takes priority on the preset values.
  6112. Available presets are:
  6113. @table @samp
  6114. @item none
  6115. @item color_negative
  6116. @item cross_process
  6117. @item darker
  6118. @item increase_contrast
  6119. @item lighter
  6120. @item linear_contrast
  6121. @item medium_contrast
  6122. @item negative
  6123. @item strong_contrast
  6124. @item vintage
  6125. @end table
  6126. Default is @code{none}.
  6127. @item master, m
  6128. Set the master key points. These points will define a second pass mapping. It
  6129. is sometimes called a "luminance" or "value" mapping. It can be used with
  6130. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6131. post-processing LUT.
  6132. @item red, r
  6133. Set the key points for the red component.
  6134. @item green, g
  6135. Set the key points for the green component.
  6136. @item blue, b
  6137. Set the key points for the blue component.
  6138. @item all
  6139. Set the key points for all components (not including master).
  6140. Can be used in addition to the other key points component
  6141. options. In this case, the unset component(s) will fallback on this
  6142. @option{all} setting.
  6143. @item psfile
  6144. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6145. @item plot
  6146. Save Gnuplot script of the curves in specified file.
  6147. @end table
  6148. To avoid some filtergraph syntax conflicts, each key points list need to be
  6149. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6150. @subsection Examples
  6151. @itemize
  6152. @item
  6153. Increase slightly the middle level of blue:
  6154. @example
  6155. curves=blue='0/0 0.5/0.58 1/1'
  6156. @end example
  6157. @item
  6158. Vintage effect:
  6159. @example
  6160. 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'
  6161. @end example
  6162. Here we obtain the following coordinates for each components:
  6163. @table @var
  6164. @item red
  6165. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6166. @item green
  6167. @code{(0;0) (0.50;0.48) (1;1)}
  6168. @item blue
  6169. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6170. @end table
  6171. @item
  6172. The previous example can also be achieved with the associated built-in preset:
  6173. @example
  6174. curves=preset=vintage
  6175. @end example
  6176. @item
  6177. Or simply:
  6178. @example
  6179. curves=vintage
  6180. @end example
  6181. @item
  6182. Use a Photoshop preset and redefine the points of the green component:
  6183. @example
  6184. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6185. @end example
  6186. @item
  6187. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6188. and @command{gnuplot}:
  6189. @example
  6190. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6191. gnuplot -p /tmp/curves.plt
  6192. @end example
  6193. @end itemize
  6194. @section datascope
  6195. Video data analysis filter.
  6196. This filter shows hexadecimal pixel values of part of video.
  6197. The filter accepts the following options:
  6198. @table @option
  6199. @item size, s
  6200. Set output video size.
  6201. @item x
  6202. Set x offset from where to pick pixels.
  6203. @item y
  6204. Set y offset from where to pick pixels.
  6205. @item mode
  6206. Set scope mode, can be one of the following:
  6207. @table @samp
  6208. @item mono
  6209. Draw hexadecimal pixel values with white color on black background.
  6210. @item color
  6211. Draw hexadecimal pixel values with input video pixel color on black
  6212. background.
  6213. @item color2
  6214. Draw hexadecimal pixel values on color background picked from input video,
  6215. the text color is picked in such way so its always visible.
  6216. @end table
  6217. @item axis
  6218. Draw rows and columns numbers on left and top of video.
  6219. @item opacity
  6220. Set background opacity.
  6221. @end table
  6222. @section dctdnoiz
  6223. Denoise frames using 2D DCT (frequency domain filtering).
  6224. This filter is not designed for real time.
  6225. The filter accepts the following options:
  6226. @table @option
  6227. @item sigma, s
  6228. Set the noise sigma constant.
  6229. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6230. coefficient (absolute value) below this threshold with be dropped.
  6231. If you need a more advanced filtering, see @option{expr}.
  6232. Default is @code{0}.
  6233. @item overlap
  6234. Set number overlapping pixels for each block. Since the filter can be slow, you
  6235. may want to reduce this value, at the cost of a less effective filter and the
  6236. risk of various artefacts.
  6237. If the overlapping value doesn't permit processing the whole input width or
  6238. height, a warning will be displayed and according borders won't be denoised.
  6239. Default value is @var{blocksize}-1, which is the best possible setting.
  6240. @item expr, e
  6241. Set the coefficient factor expression.
  6242. For each coefficient of a DCT block, this expression will be evaluated as a
  6243. multiplier value for the coefficient.
  6244. If this is option is set, the @option{sigma} option will be ignored.
  6245. The absolute value of the coefficient can be accessed through the @var{c}
  6246. variable.
  6247. @item n
  6248. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6249. @var{blocksize}, which is the width and height of the processed blocks.
  6250. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6251. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6252. on the speed processing. Also, a larger block size does not necessarily means a
  6253. better de-noising.
  6254. @end table
  6255. @subsection Examples
  6256. Apply a denoise with a @option{sigma} of @code{4.5}:
  6257. @example
  6258. dctdnoiz=4.5
  6259. @end example
  6260. The same operation can be achieved using the expression system:
  6261. @example
  6262. dctdnoiz=e='gte(c, 4.5*3)'
  6263. @end example
  6264. Violent denoise using a block size of @code{16x16}:
  6265. @example
  6266. dctdnoiz=15:n=4
  6267. @end example
  6268. @section deband
  6269. Remove banding artifacts from input video.
  6270. It works by replacing banded pixels with average value of referenced pixels.
  6271. The filter accepts the following options:
  6272. @table @option
  6273. @item 1thr
  6274. @item 2thr
  6275. @item 3thr
  6276. @item 4thr
  6277. Set banding detection threshold for each plane. Default is 0.02.
  6278. Valid range is 0.00003 to 0.5.
  6279. If difference between current pixel and reference pixel is less than threshold,
  6280. it will be considered as banded.
  6281. @item range, r
  6282. Banding detection range in pixels. Default is 16. If positive, random number
  6283. in range 0 to set value will be used. If negative, exact absolute value
  6284. will be used.
  6285. The range defines square of four pixels around current pixel.
  6286. @item direction, d
  6287. Set direction in radians from which four pixel will be compared. If positive,
  6288. random direction from 0 to set direction will be picked. If negative, exact of
  6289. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6290. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6291. column.
  6292. @item blur, b
  6293. If enabled, current pixel is compared with average value of all four
  6294. surrounding pixels. The default is enabled. If disabled current pixel is
  6295. compared with all four surrounding pixels. The pixel is considered banded
  6296. if only all four differences with surrounding pixels are less than threshold.
  6297. @item coupling, c
  6298. If enabled, current pixel is changed if and only if all pixel components are banded,
  6299. e.g. banding detection threshold is triggered for all color components.
  6300. The default is disabled.
  6301. @end table
  6302. @section deblock
  6303. Remove blocking artifacts from input video.
  6304. The filter accepts the following options:
  6305. @table @option
  6306. @item filter
  6307. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6308. This controls what kind of deblocking is applied.
  6309. @item block
  6310. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6311. @item alpha
  6312. @item beta
  6313. @item gamma
  6314. @item delta
  6315. Set blocking detection thresholds. Allowed range is 0 to 1.
  6316. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6317. Using higher threshold gives more deblocking strength.
  6318. Setting @var{alpha} controls threshold detection at exact edge of block.
  6319. Remaining options controls threshold detection near the edge. Each one for
  6320. below/above or left/right. Setting any of those to @var{0} disables
  6321. deblocking.
  6322. @item planes
  6323. Set planes to filter. Default is to filter all available planes.
  6324. @end table
  6325. @subsection Examples
  6326. @itemize
  6327. @item
  6328. Deblock using weak filter and block size of 4 pixels.
  6329. @example
  6330. deblock=filter=weak:block=4
  6331. @end example
  6332. @item
  6333. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6334. deblocking more edges.
  6335. @example
  6336. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6337. @end example
  6338. @item
  6339. Similar as above, but filter only first plane.
  6340. @example
  6341. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6342. @end example
  6343. @item
  6344. Similar as above, but filter only second and third plane.
  6345. @example
  6346. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6347. @end example
  6348. @end itemize
  6349. @anchor{decimate}
  6350. @section decimate
  6351. Drop duplicated frames at regular intervals.
  6352. The filter accepts the following options:
  6353. @table @option
  6354. @item cycle
  6355. Set the number of frames from which one will be dropped. Setting this to
  6356. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6357. Default is @code{5}.
  6358. @item dupthresh
  6359. Set the threshold for duplicate detection. If the difference metric for a frame
  6360. is less than or equal to this value, then it is declared as duplicate. Default
  6361. is @code{1.1}
  6362. @item scthresh
  6363. Set scene change threshold. Default is @code{15}.
  6364. @item blockx
  6365. @item blocky
  6366. Set the size of the x and y-axis blocks used during metric calculations.
  6367. Larger blocks give better noise suppression, but also give worse detection of
  6368. small movements. Must be a power of two. Default is @code{32}.
  6369. @item ppsrc
  6370. Mark main input as a pre-processed input and activate clean source input
  6371. stream. This allows the input to be pre-processed with various filters to help
  6372. the metrics calculation while keeping the frame selection lossless. When set to
  6373. @code{1}, the first stream is for the pre-processed input, and the second
  6374. stream is the clean source from where the kept frames are chosen. Default is
  6375. @code{0}.
  6376. @item chroma
  6377. Set whether or not chroma is considered in the metric calculations. Default is
  6378. @code{1}.
  6379. @end table
  6380. @section deconvolve
  6381. Apply 2D deconvolution of video stream in frequency domain using second stream
  6382. as impulse.
  6383. The filter accepts the following options:
  6384. @table @option
  6385. @item planes
  6386. Set which planes to process.
  6387. @item impulse
  6388. Set which impulse video frames will be processed, can be @var{first}
  6389. or @var{all}. Default is @var{all}.
  6390. @item noise
  6391. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6392. and height are not same and not power of 2 or if stream prior to convolving
  6393. had noise.
  6394. @end table
  6395. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6396. @section dedot
  6397. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6398. It accepts the following options:
  6399. @table @option
  6400. @item m
  6401. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6402. @var{rainbows} for cross-color reduction.
  6403. @item lt
  6404. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6405. @item tl
  6406. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6407. @item tc
  6408. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6409. @item ct
  6410. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6411. @end table
  6412. @section deflate
  6413. Apply deflate effect to the video.
  6414. This filter replaces the pixel by the local(3x3) average by taking into account
  6415. only values lower than the pixel.
  6416. It accepts the following options:
  6417. @table @option
  6418. @item threshold0
  6419. @item threshold1
  6420. @item threshold2
  6421. @item threshold3
  6422. Limit the maximum change for each plane, default is 65535.
  6423. If 0, plane will remain unchanged.
  6424. @end table
  6425. @section deflicker
  6426. Remove temporal frame luminance variations.
  6427. It accepts the following options:
  6428. @table @option
  6429. @item size, s
  6430. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6431. @item mode, m
  6432. Set averaging mode to smooth temporal luminance variations.
  6433. Available values are:
  6434. @table @samp
  6435. @item am
  6436. Arithmetic mean
  6437. @item gm
  6438. Geometric mean
  6439. @item hm
  6440. Harmonic mean
  6441. @item qm
  6442. Quadratic mean
  6443. @item cm
  6444. Cubic mean
  6445. @item pm
  6446. Power mean
  6447. @item median
  6448. Median
  6449. @end table
  6450. @item bypass
  6451. Do not actually modify frame. Useful when one only wants metadata.
  6452. @end table
  6453. @section dejudder
  6454. Remove judder produced by partially interlaced telecined content.
  6455. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6456. source was partially telecined content then the output of @code{pullup,dejudder}
  6457. will have a variable frame rate. May change the recorded frame rate of the
  6458. container. Aside from that change, this filter will not affect constant frame
  6459. rate video.
  6460. The option available in this filter is:
  6461. @table @option
  6462. @item cycle
  6463. Specify the length of the window over which the judder repeats.
  6464. Accepts any integer greater than 1. Useful values are:
  6465. @table @samp
  6466. @item 4
  6467. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6468. @item 5
  6469. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6470. @item 20
  6471. If a mixture of the two.
  6472. @end table
  6473. The default is @samp{4}.
  6474. @end table
  6475. @section delogo
  6476. Suppress a TV station logo by a simple interpolation of the surrounding
  6477. pixels. Just set a rectangle covering the logo and watch it disappear
  6478. (and sometimes something even uglier appear - your mileage may vary).
  6479. It accepts the following parameters:
  6480. @table @option
  6481. @item x
  6482. @item y
  6483. Specify the top left corner coordinates of the logo. They must be
  6484. specified.
  6485. @item w
  6486. @item h
  6487. Specify the width and height of the logo to clear. They must be
  6488. specified.
  6489. @item band, t
  6490. Specify the thickness of the fuzzy edge of the rectangle (added to
  6491. @var{w} and @var{h}). The default value is 1. This option is
  6492. deprecated, setting higher values should no longer be necessary and
  6493. is not recommended.
  6494. @item show
  6495. When set to 1, a green rectangle is drawn on the screen to simplify
  6496. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6497. The default value is 0.
  6498. The rectangle is drawn on the outermost pixels which will be (partly)
  6499. replaced with interpolated values. The values of the next pixels
  6500. immediately outside this rectangle in each direction will be used to
  6501. compute the interpolated pixel values inside the rectangle.
  6502. @end table
  6503. @subsection Examples
  6504. @itemize
  6505. @item
  6506. Set a rectangle covering the area with top left corner coordinates 0,0
  6507. and size 100x77, and a band of size 10:
  6508. @example
  6509. delogo=x=0:y=0:w=100:h=77:band=10
  6510. @end example
  6511. @end itemize
  6512. @section derain
  6513. Remove the rain in the input image/video by applying the derain methods based on
  6514. convolutional neural networks. Supported models:
  6515. @itemize
  6516. @item
  6517. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6518. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6519. @end itemize
  6520. Training as well as model generation scripts are provided in
  6521. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6522. Native model files (.model) can be generated from TensorFlow model
  6523. files (.pb) by using tools/python/convert.py
  6524. The filter accepts the following options:
  6525. @table @option
  6526. @item filter_type
  6527. Specify which filter to use. This option accepts the following values:
  6528. @table @samp
  6529. @item derain
  6530. Derain filter. To conduct derain filter, you need to use a derain model.
  6531. @item dehaze
  6532. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6533. @end table
  6534. Default value is @samp{derain}.
  6535. @item dnn_backend
  6536. Specify which DNN backend to use for model loading and execution. This option accepts
  6537. the following values:
  6538. @table @samp
  6539. @item native
  6540. Native implementation of DNN loading and execution.
  6541. @item tensorflow
  6542. TensorFlow backend. To enable this backend you
  6543. need to install the TensorFlow for C library (see
  6544. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6545. @code{--enable-libtensorflow}
  6546. @end table
  6547. Default value is @samp{native}.
  6548. @item model
  6549. Set path to model file specifying network architecture and its parameters.
  6550. Note that different backends use different file formats. TensorFlow and native
  6551. backend can load files for only its format.
  6552. @end table
  6553. @section deshake
  6554. Attempt to fix small changes in horizontal and/or vertical shift. This
  6555. filter helps remove camera shake from hand-holding a camera, bumping a
  6556. tripod, moving on a vehicle, etc.
  6557. The filter accepts the following options:
  6558. @table @option
  6559. @item x
  6560. @item y
  6561. @item w
  6562. @item h
  6563. Specify a rectangular area where to limit the search for motion
  6564. vectors.
  6565. If desired the search for motion vectors can be limited to a
  6566. rectangular area of the frame defined by its top left corner, width
  6567. and height. These parameters have the same meaning as the drawbox
  6568. filter which can be used to visualise the position of the bounding
  6569. box.
  6570. This is useful when simultaneous movement of subjects within the frame
  6571. might be confused for camera motion by the motion vector search.
  6572. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6573. then the full frame is used. This allows later options to be set
  6574. without specifying the bounding box for the motion vector search.
  6575. Default - search the whole frame.
  6576. @item rx
  6577. @item ry
  6578. Specify the maximum extent of movement in x and y directions in the
  6579. range 0-64 pixels. Default 16.
  6580. @item edge
  6581. Specify how to generate pixels to fill blanks at the edge of the
  6582. frame. Available values are:
  6583. @table @samp
  6584. @item blank, 0
  6585. Fill zeroes at blank locations
  6586. @item original, 1
  6587. Original image at blank locations
  6588. @item clamp, 2
  6589. Extruded edge value at blank locations
  6590. @item mirror, 3
  6591. Mirrored edge at blank locations
  6592. @end table
  6593. Default value is @samp{mirror}.
  6594. @item blocksize
  6595. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6596. default 8.
  6597. @item contrast
  6598. Specify the contrast threshold for blocks. Only blocks with more than
  6599. the specified contrast (difference between darkest and lightest
  6600. pixels) will be considered. Range 1-255, default 125.
  6601. @item search
  6602. Specify the search strategy. Available values are:
  6603. @table @samp
  6604. @item exhaustive, 0
  6605. Set exhaustive search
  6606. @item less, 1
  6607. Set less exhaustive search.
  6608. @end table
  6609. Default value is @samp{exhaustive}.
  6610. @item filename
  6611. If set then a detailed log of the motion search is written to the
  6612. specified file.
  6613. @end table
  6614. @section despill
  6615. Remove unwanted contamination of foreground colors, caused by reflected color of
  6616. greenscreen or bluescreen.
  6617. This filter accepts the following options:
  6618. @table @option
  6619. @item type
  6620. Set what type of despill to use.
  6621. @item mix
  6622. Set how spillmap will be generated.
  6623. @item expand
  6624. Set how much to get rid of still remaining spill.
  6625. @item red
  6626. Controls amount of red in spill area.
  6627. @item green
  6628. Controls amount of green in spill area.
  6629. Should be -1 for greenscreen.
  6630. @item blue
  6631. Controls amount of blue in spill area.
  6632. Should be -1 for bluescreen.
  6633. @item brightness
  6634. Controls brightness of spill area, preserving colors.
  6635. @item alpha
  6636. Modify alpha from generated spillmap.
  6637. @end table
  6638. @section detelecine
  6639. Apply an exact inverse of the telecine operation. It requires a predefined
  6640. pattern specified using the pattern option which must be the same as that passed
  6641. to the telecine filter.
  6642. This filter accepts the following options:
  6643. @table @option
  6644. @item first_field
  6645. @table @samp
  6646. @item top, t
  6647. top field first
  6648. @item bottom, b
  6649. bottom field first
  6650. The default value is @code{top}.
  6651. @end table
  6652. @item pattern
  6653. A string of numbers representing the pulldown pattern you wish to apply.
  6654. The default value is @code{23}.
  6655. @item start_frame
  6656. A number representing position of the first frame with respect to the telecine
  6657. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6658. @end table
  6659. @section dilation
  6660. Apply dilation effect to the video.
  6661. This filter replaces the pixel by the local(3x3) maximum.
  6662. It accepts the following options:
  6663. @table @option
  6664. @item threshold0
  6665. @item threshold1
  6666. @item threshold2
  6667. @item threshold3
  6668. Limit the maximum change for each plane, default is 65535.
  6669. If 0, plane will remain unchanged.
  6670. @item coordinates
  6671. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6672. pixels are used.
  6673. Flags to local 3x3 coordinates maps like this:
  6674. 1 2 3
  6675. 4 5
  6676. 6 7 8
  6677. @end table
  6678. @section displace
  6679. Displace pixels as indicated by second and third input stream.
  6680. It takes three input streams and outputs one stream, the first input is the
  6681. source, and second and third input are displacement maps.
  6682. The second input specifies how much to displace pixels along the
  6683. x-axis, while the third input specifies how much to displace pixels
  6684. along the y-axis.
  6685. If one of displacement map streams terminates, last frame from that
  6686. displacement map will be used.
  6687. Note that once generated, displacements maps can be reused over and over again.
  6688. A description of the accepted options follows.
  6689. @table @option
  6690. @item edge
  6691. Set displace behavior for pixels that are out of range.
  6692. Available values are:
  6693. @table @samp
  6694. @item blank
  6695. Missing pixels are replaced by black pixels.
  6696. @item smear
  6697. Adjacent pixels will spread out to replace missing pixels.
  6698. @item wrap
  6699. Out of range pixels are wrapped so they point to pixels of other side.
  6700. @item mirror
  6701. Out of range pixels will be replaced with mirrored pixels.
  6702. @end table
  6703. Default is @samp{smear}.
  6704. @end table
  6705. @subsection Examples
  6706. @itemize
  6707. @item
  6708. Add ripple effect to rgb input of video size hd720:
  6709. @example
  6710. 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
  6711. @end example
  6712. @item
  6713. Add wave effect to rgb input of video size hd720:
  6714. @example
  6715. 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
  6716. @end example
  6717. @end itemize
  6718. @section drawbox
  6719. Draw a colored box on the input image.
  6720. It accepts the following parameters:
  6721. @table @option
  6722. @item x
  6723. @item y
  6724. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6725. @item width, w
  6726. @item height, h
  6727. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6728. the input width and height. It defaults to 0.
  6729. @item color, c
  6730. Specify the color of the box to write. For the general syntax of this option,
  6731. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6732. value @code{invert} is used, the box edge color is the same as the
  6733. video with inverted luma.
  6734. @item thickness, t
  6735. The expression which sets the thickness of the box edge.
  6736. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6737. See below for the list of accepted constants.
  6738. @item replace
  6739. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6740. will overwrite the video's color and alpha pixels.
  6741. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6742. @end table
  6743. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6744. following constants:
  6745. @table @option
  6746. @item dar
  6747. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6748. @item hsub
  6749. @item vsub
  6750. horizontal and vertical chroma subsample values. For example for the
  6751. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6752. @item in_h, ih
  6753. @item in_w, iw
  6754. The input width and height.
  6755. @item sar
  6756. The input sample aspect ratio.
  6757. @item x
  6758. @item y
  6759. The x and y offset coordinates where the box is drawn.
  6760. @item w
  6761. @item h
  6762. The width and height of the drawn box.
  6763. @item t
  6764. The thickness of the drawn box.
  6765. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6766. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6767. @end table
  6768. @subsection Examples
  6769. @itemize
  6770. @item
  6771. Draw a black box around the edge of the input image:
  6772. @example
  6773. drawbox
  6774. @end example
  6775. @item
  6776. Draw a box with color red and an opacity of 50%:
  6777. @example
  6778. drawbox=10:20:200:60:red@@0.5
  6779. @end example
  6780. The previous example can be specified as:
  6781. @example
  6782. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6783. @end example
  6784. @item
  6785. Fill the box with pink color:
  6786. @example
  6787. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6788. @end example
  6789. @item
  6790. Draw a 2-pixel red 2.40:1 mask:
  6791. @example
  6792. 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
  6793. @end example
  6794. @end itemize
  6795. @section drawgrid
  6796. Draw a grid on the input image.
  6797. It accepts the following parameters:
  6798. @table @option
  6799. @item x
  6800. @item y
  6801. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6802. @item width, w
  6803. @item height, h
  6804. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6805. input width and height, respectively, minus @code{thickness}, so image gets
  6806. framed. Default to 0.
  6807. @item color, c
  6808. Specify the color of the grid. For the general syntax of this option,
  6809. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6810. value @code{invert} is used, the grid color is the same as the
  6811. video with inverted luma.
  6812. @item thickness, t
  6813. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6814. See below for the list of accepted constants.
  6815. @item replace
  6816. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6817. will overwrite the video's color and alpha pixels.
  6818. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6819. @end table
  6820. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6821. following constants:
  6822. @table @option
  6823. @item dar
  6824. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6825. @item hsub
  6826. @item vsub
  6827. horizontal and vertical chroma subsample values. For example for the
  6828. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6829. @item in_h, ih
  6830. @item in_w, iw
  6831. The input grid cell width and height.
  6832. @item sar
  6833. The input sample aspect ratio.
  6834. @item x
  6835. @item y
  6836. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6837. @item w
  6838. @item h
  6839. The width and height of the drawn cell.
  6840. @item t
  6841. The thickness of the drawn cell.
  6842. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6843. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6844. @end table
  6845. @subsection Examples
  6846. @itemize
  6847. @item
  6848. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6849. @example
  6850. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6851. @end example
  6852. @item
  6853. Draw a white 3x3 grid with an opacity of 50%:
  6854. @example
  6855. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6856. @end example
  6857. @end itemize
  6858. @anchor{drawtext}
  6859. @section drawtext
  6860. Draw a text string or text from a specified file on top of a video, using the
  6861. libfreetype library.
  6862. To enable compilation of this filter, you need to configure FFmpeg with
  6863. @code{--enable-libfreetype}.
  6864. To enable default font fallback and the @var{font} option you need to
  6865. configure FFmpeg with @code{--enable-libfontconfig}.
  6866. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6867. @code{--enable-libfribidi}.
  6868. @subsection Syntax
  6869. It accepts the following parameters:
  6870. @table @option
  6871. @item box
  6872. Used to draw a box around text using the background color.
  6873. The value must be either 1 (enable) or 0 (disable).
  6874. The default value of @var{box} is 0.
  6875. @item boxborderw
  6876. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6877. The default value of @var{boxborderw} is 0.
  6878. @item boxcolor
  6879. The color to be used for drawing box around text. For the syntax of this
  6880. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6881. The default value of @var{boxcolor} is "white".
  6882. @item line_spacing
  6883. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6884. The default value of @var{line_spacing} is 0.
  6885. @item borderw
  6886. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6887. The default value of @var{borderw} is 0.
  6888. @item bordercolor
  6889. Set the color to be used for drawing border around text. For the syntax of this
  6890. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6891. The default value of @var{bordercolor} is "black".
  6892. @item expansion
  6893. Select how the @var{text} is expanded. Can be either @code{none},
  6894. @code{strftime} (deprecated) or
  6895. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6896. below for details.
  6897. @item basetime
  6898. Set a start time for the count. Value is in microseconds. Only applied
  6899. in the deprecated strftime expansion mode. To emulate in normal expansion
  6900. mode use the @code{pts} function, supplying the start time (in seconds)
  6901. as the second argument.
  6902. @item fix_bounds
  6903. If true, check and fix text coords to avoid clipping.
  6904. @item fontcolor
  6905. The color to be used for drawing fonts. For the syntax of this option, check
  6906. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6907. The default value of @var{fontcolor} is "black".
  6908. @item fontcolor_expr
  6909. String which is expanded the same way as @var{text} to obtain dynamic
  6910. @var{fontcolor} value. By default this option has empty value and is not
  6911. processed. When this option is set, it overrides @var{fontcolor} option.
  6912. @item font
  6913. The font family to be used for drawing text. By default Sans.
  6914. @item fontfile
  6915. The font file to be used for drawing text. The path must be included.
  6916. This parameter is mandatory if the fontconfig support is disabled.
  6917. @item alpha
  6918. Draw the text applying alpha blending. The value can
  6919. be a number between 0.0 and 1.0.
  6920. The expression accepts the same variables @var{x, y} as well.
  6921. The default value is 1.
  6922. Please see @var{fontcolor_expr}.
  6923. @item fontsize
  6924. The font size to be used for drawing text.
  6925. The default value of @var{fontsize} is 16.
  6926. @item text_shaping
  6927. If set to 1, attempt to shape the text (for example, reverse the order of
  6928. right-to-left text and join Arabic characters) before drawing it.
  6929. Otherwise, just draw the text exactly as given.
  6930. By default 1 (if supported).
  6931. @item ft_load_flags
  6932. The flags to be used for loading the fonts.
  6933. The flags map the corresponding flags supported by libfreetype, and are
  6934. a combination of the following values:
  6935. @table @var
  6936. @item default
  6937. @item no_scale
  6938. @item no_hinting
  6939. @item render
  6940. @item no_bitmap
  6941. @item vertical_layout
  6942. @item force_autohint
  6943. @item crop_bitmap
  6944. @item pedantic
  6945. @item ignore_global_advance_width
  6946. @item no_recurse
  6947. @item ignore_transform
  6948. @item monochrome
  6949. @item linear_design
  6950. @item no_autohint
  6951. @end table
  6952. Default value is "default".
  6953. For more information consult the documentation for the FT_LOAD_*
  6954. libfreetype flags.
  6955. @item shadowcolor
  6956. The color to be used for drawing a shadow behind the drawn text. For the
  6957. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6958. ffmpeg-utils manual,ffmpeg-utils}.
  6959. The default value of @var{shadowcolor} is "black".
  6960. @item shadowx
  6961. @item shadowy
  6962. The x and y offsets for the text shadow position with respect to the
  6963. position of the text. They can be either positive or negative
  6964. values. The default value for both is "0".
  6965. @item start_number
  6966. The starting frame number for the n/frame_num variable. The default value
  6967. is "0".
  6968. @item tabsize
  6969. The size in number of spaces to use for rendering the tab.
  6970. Default value is 4.
  6971. @item timecode
  6972. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6973. format. It can be used with or without text parameter. @var{timecode_rate}
  6974. option must be specified.
  6975. @item timecode_rate, rate, r
  6976. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6977. integer. Minimum value is "1".
  6978. Drop-frame timecode is supported for frame rates 30 & 60.
  6979. @item tc24hmax
  6980. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6981. Default is 0 (disabled).
  6982. @item text
  6983. The text string to be drawn. The text must be a sequence of UTF-8
  6984. encoded characters.
  6985. This parameter is mandatory if no file is specified with the parameter
  6986. @var{textfile}.
  6987. @item textfile
  6988. A text file containing text to be drawn. The text must be a sequence
  6989. of UTF-8 encoded characters.
  6990. This parameter is mandatory if no text string is specified with the
  6991. parameter @var{text}.
  6992. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6993. @item reload
  6994. If set to 1, the @var{textfile} will be reloaded before each frame.
  6995. Be sure to update it atomically, or it may be read partially, or even fail.
  6996. @item x
  6997. @item y
  6998. The expressions which specify the offsets where text will be drawn
  6999. within the video frame. They are relative to the top/left border of the
  7000. output image.
  7001. The default value of @var{x} and @var{y} is "0".
  7002. See below for the list of accepted constants and functions.
  7003. @end table
  7004. The parameters for @var{x} and @var{y} are expressions containing the
  7005. following constants and functions:
  7006. @table @option
  7007. @item dar
  7008. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7009. @item hsub
  7010. @item vsub
  7011. horizontal and vertical chroma subsample values. For example for the
  7012. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7013. @item line_h, lh
  7014. the height of each text line
  7015. @item main_h, h, H
  7016. the input height
  7017. @item main_w, w, W
  7018. the input width
  7019. @item max_glyph_a, ascent
  7020. the maximum distance from the baseline to the highest/upper grid
  7021. coordinate used to place a glyph outline point, for all the rendered
  7022. glyphs.
  7023. It is a positive value, due to the grid's orientation with the Y axis
  7024. upwards.
  7025. @item max_glyph_d, descent
  7026. the maximum distance from the baseline to the lowest grid coordinate
  7027. used to place a glyph outline point, for all the rendered glyphs.
  7028. This is a negative value, due to the grid's orientation, with the Y axis
  7029. upwards.
  7030. @item max_glyph_h
  7031. maximum glyph height, that is the maximum height for all the glyphs
  7032. contained in the rendered text, it is equivalent to @var{ascent} -
  7033. @var{descent}.
  7034. @item max_glyph_w
  7035. maximum glyph width, that is the maximum width for all the glyphs
  7036. contained in the rendered text
  7037. @item n
  7038. the number of input frame, starting from 0
  7039. @item rand(min, max)
  7040. return a random number included between @var{min} and @var{max}
  7041. @item sar
  7042. The input sample aspect ratio.
  7043. @item t
  7044. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7045. @item text_h, th
  7046. the height of the rendered text
  7047. @item text_w, tw
  7048. the width of the rendered text
  7049. @item x
  7050. @item y
  7051. the x and y offset coordinates where the text is drawn.
  7052. These parameters allow the @var{x} and @var{y} expressions to refer
  7053. to each other, so you can for example specify @code{y=x/dar}.
  7054. @item pict_type
  7055. A one character description of the current frame's picture type.
  7056. @item pkt_pos
  7057. The current packet's position in the input file or stream
  7058. (in bytes, from the start of the input). A value of -1 indicates
  7059. this info is not available.
  7060. @item pkt_duration
  7061. The current packet's duration, in seconds.
  7062. @item pkt_size
  7063. The current packet's size (in bytes).
  7064. @end table
  7065. @anchor{drawtext_expansion}
  7066. @subsection Text expansion
  7067. If @option{expansion} is set to @code{strftime},
  7068. the filter recognizes strftime() sequences in the provided text and
  7069. expands them accordingly. Check the documentation of strftime(). This
  7070. feature is deprecated.
  7071. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7072. If @option{expansion} is set to @code{normal} (which is the default),
  7073. the following expansion mechanism is used.
  7074. The backslash character @samp{\}, followed by any character, always expands to
  7075. the second character.
  7076. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7077. braces is a function name, possibly followed by arguments separated by ':'.
  7078. If the arguments contain special characters or delimiters (':' or '@}'),
  7079. they should be escaped.
  7080. Note that they probably must also be escaped as the value for the
  7081. @option{text} option in the filter argument string and as the filter
  7082. argument in the filtergraph description, and possibly also for the shell,
  7083. that makes up to four levels of escaping; using a text file avoids these
  7084. problems.
  7085. The following functions are available:
  7086. @table @command
  7087. @item expr, e
  7088. The expression evaluation result.
  7089. It must take one argument specifying the expression to be evaluated,
  7090. which accepts the same constants and functions as the @var{x} and
  7091. @var{y} values. Note that not all constants should be used, for
  7092. example the text size is not known when evaluating the expression, so
  7093. the constants @var{text_w} and @var{text_h} will have an undefined
  7094. value.
  7095. @item expr_int_format, eif
  7096. Evaluate the expression's value and output as formatted integer.
  7097. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7098. The second argument specifies the output format. Allowed values are @samp{x},
  7099. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7100. @code{printf} function.
  7101. The third parameter is optional and sets the number of positions taken by the output.
  7102. It can be used to add padding with zeros from the left.
  7103. @item gmtime
  7104. The time at which the filter is running, expressed in UTC.
  7105. It can accept an argument: a strftime() format string.
  7106. @item localtime
  7107. The time at which the filter is running, expressed in the local time zone.
  7108. It can accept an argument: a strftime() format string.
  7109. @item metadata
  7110. Frame metadata. Takes one or two arguments.
  7111. The first argument is mandatory and specifies the metadata key.
  7112. The second argument is optional and specifies a default value, used when the
  7113. metadata key is not found or empty.
  7114. Available metadata can be identified by inspecting entries
  7115. starting with TAG included within each frame section
  7116. printed by running @code{ffprobe -show_frames}.
  7117. String metadata generated in filters leading to
  7118. the drawtext filter are also available.
  7119. @item n, frame_num
  7120. The frame number, starting from 0.
  7121. @item pict_type
  7122. A one character description of the current picture type.
  7123. @item pts
  7124. The timestamp of the current frame.
  7125. It can take up to three arguments.
  7126. The first argument is the format of the timestamp; it defaults to @code{flt}
  7127. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7128. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7129. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7130. @code{localtime} stands for the timestamp of the frame formatted as
  7131. local time zone time.
  7132. The second argument is an offset added to the timestamp.
  7133. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7134. supplied to present the hour part of the formatted timestamp in 24h format
  7135. (00-23).
  7136. If the format is set to @code{localtime} or @code{gmtime},
  7137. a third argument may be supplied: a strftime() format string.
  7138. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7139. @end table
  7140. @subsection Commands
  7141. This filter supports altering parameters via commands:
  7142. @table @option
  7143. @item reinit
  7144. Alter existing filter parameters.
  7145. Syntax for the argument is the same as for filter invocation, e.g.
  7146. @example
  7147. fontsize=56:fontcolor=green:text='Hello World'
  7148. @end example
  7149. Full filter invocation with sendcmd would look like this:
  7150. @example
  7151. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7152. @end example
  7153. @end table
  7154. If the entire argument can't be parsed or applied as valid values then the filter will
  7155. continue with its existing parameters.
  7156. @subsection Examples
  7157. @itemize
  7158. @item
  7159. Draw "Test Text" with font FreeSerif, using the default values for the
  7160. optional parameters.
  7161. @example
  7162. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7163. @end example
  7164. @item
  7165. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7166. and y=50 (counting from the top-left corner of the screen), text is
  7167. yellow with a red box around it. Both the text and the box have an
  7168. opacity of 20%.
  7169. @example
  7170. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7171. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7172. @end example
  7173. Note that the double quotes are not necessary if spaces are not used
  7174. within the parameter list.
  7175. @item
  7176. Show the text at the center of the video frame:
  7177. @example
  7178. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7179. @end example
  7180. @item
  7181. Show the text at a random position, switching to a new position every 30 seconds:
  7182. @example
  7183. 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)"
  7184. @end example
  7185. @item
  7186. Show a text line sliding from right to left in the last row of the video
  7187. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7188. with no newlines.
  7189. @example
  7190. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7191. @end example
  7192. @item
  7193. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7194. @example
  7195. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7196. @end example
  7197. @item
  7198. Draw a single green letter "g", at the center of the input video.
  7199. The glyph baseline is placed at half screen height.
  7200. @example
  7201. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7202. @end example
  7203. @item
  7204. Show text for 1 second every 3 seconds:
  7205. @example
  7206. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7207. @end example
  7208. @item
  7209. Use fontconfig to set the font. Note that the colons need to be escaped.
  7210. @example
  7211. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7212. @end example
  7213. @item
  7214. Print the date of a real-time encoding (see strftime(3)):
  7215. @example
  7216. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7217. @end example
  7218. @item
  7219. Show text fading in and out (appearing/disappearing):
  7220. @example
  7221. #!/bin/sh
  7222. DS=1.0 # display start
  7223. DE=10.0 # display end
  7224. FID=1.5 # fade in duration
  7225. FOD=5 # fade out duration
  7226. 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 @}"
  7227. @end example
  7228. @item
  7229. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7230. and the @option{fontsize} value are included in the @option{y} offset.
  7231. @example
  7232. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7233. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7234. @end example
  7235. @end itemize
  7236. For more information about libfreetype, check:
  7237. @url{http://www.freetype.org/}.
  7238. For more information about fontconfig, check:
  7239. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7240. For more information about libfribidi, check:
  7241. @url{http://fribidi.org/}.
  7242. @section edgedetect
  7243. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7244. The filter accepts the following options:
  7245. @table @option
  7246. @item low
  7247. @item high
  7248. Set low and high threshold values used by the Canny thresholding
  7249. algorithm.
  7250. The high threshold selects the "strong" edge pixels, which are then
  7251. connected through 8-connectivity with the "weak" edge pixels selected
  7252. by the low threshold.
  7253. @var{low} and @var{high} threshold values must be chosen in the range
  7254. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7255. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7256. is @code{50/255}.
  7257. @item mode
  7258. Define the drawing mode.
  7259. @table @samp
  7260. @item wires
  7261. Draw white/gray wires on black background.
  7262. @item colormix
  7263. Mix the colors to create a paint/cartoon effect.
  7264. @item canny
  7265. Apply Canny edge detector on all selected planes.
  7266. @end table
  7267. Default value is @var{wires}.
  7268. @item planes
  7269. Select planes for filtering. By default all available planes are filtered.
  7270. @end table
  7271. @subsection Examples
  7272. @itemize
  7273. @item
  7274. Standard edge detection with custom values for the hysteresis thresholding:
  7275. @example
  7276. edgedetect=low=0.1:high=0.4
  7277. @end example
  7278. @item
  7279. Painting effect without thresholding:
  7280. @example
  7281. edgedetect=mode=colormix:high=0
  7282. @end example
  7283. @end itemize
  7284. @section elbg
  7285. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7286. For each input image, the filter will compute the optimal mapping from
  7287. the input to the output given the codebook length, that is the number
  7288. of distinct output colors.
  7289. This filter accepts the following options.
  7290. @table @option
  7291. @item codebook_length, l
  7292. Set codebook length. The value must be a positive integer, and
  7293. represents the number of distinct output colors. Default value is 256.
  7294. @item nb_steps, n
  7295. Set the maximum number of iterations to apply for computing the optimal
  7296. mapping. The higher the value the better the result and the higher the
  7297. computation time. Default value is 1.
  7298. @item seed, s
  7299. Set a random seed, must be an integer included between 0 and
  7300. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7301. will try to use a good random seed on a best effort basis.
  7302. @item pal8
  7303. Set pal8 output pixel format. This option does not work with codebook
  7304. length greater than 256.
  7305. @end table
  7306. @section entropy
  7307. Measure graylevel entropy in histogram of color channels of video frames.
  7308. It accepts the following parameters:
  7309. @table @option
  7310. @item mode
  7311. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7312. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7313. between neighbour histogram values.
  7314. @end table
  7315. @section eq
  7316. Set brightness, contrast, saturation and approximate gamma adjustment.
  7317. The filter accepts the following options:
  7318. @table @option
  7319. @item contrast
  7320. Set the contrast expression. The value must be a float value in range
  7321. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7322. @item brightness
  7323. Set the brightness expression. The value must be a float value in
  7324. range @code{-1.0} to @code{1.0}. The default value is "0".
  7325. @item saturation
  7326. Set the saturation expression. The value must be a float in
  7327. range @code{0.0} to @code{3.0}. The default value is "1".
  7328. @item gamma
  7329. Set the gamma expression. The value must be a float in range
  7330. @code{0.1} to @code{10.0}. The default value is "1".
  7331. @item gamma_r
  7332. Set the gamma expression for red. The value must be a float in
  7333. range @code{0.1} to @code{10.0}. The default value is "1".
  7334. @item gamma_g
  7335. Set the gamma expression for green. The value must be a float in range
  7336. @code{0.1} to @code{10.0}. The default value is "1".
  7337. @item gamma_b
  7338. Set the gamma expression for blue. The value must be a float in range
  7339. @code{0.1} to @code{10.0}. The default value is "1".
  7340. @item gamma_weight
  7341. Set the gamma weight expression. It can be used to reduce the effect
  7342. of a high gamma value on bright image areas, e.g. keep them from
  7343. getting overamplified and just plain white. The value must be a float
  7344. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7345. gamma correction all the way down while @code{1.0} leaves it at its
  7346. full strength. Default is "1".
  7347. @item eval
  7348. Set when the expressions for brightness, contrast, saturation and
  7349. gamma expressions are evaluated.
  7350. It accepts the following values:
  7351. @table @samp
  7352. @item init
  7353. only evaluate expressions once during the filter initialization or
  7354. when a command is processed
  7355. @item frame
  7356. evaluate expressions for each incoming frame
  7357. @end table
  7358. Default value is @samp{init}.
  7359. @end table
  7360. The expressions accept the following parameters:
  7361. @table @option
  7362. @item n
  7363. frame count of the input frame starting from 0
  7364. @item pos
  7365. byte position of the corresponding packet in the input file, NAN if
  7366. unspecified
  7367. @item r
  7368. frame rate of the input video, NAN if the input frame rate is unknown
  7369. @item t
  7370. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7371. @end table
  7372. @subsection Commands
  7373. The filter supports the following commands:
  7374. @table @option
  7375. @item contrast
  7376. Set the contrast expression.
  7377. @item brightness
  7378. Set the brightness expression.
  7379. @item saturation
  7380. Set the saturation expression.
  7381. @item gamma
  7382. Set the gamma expression.
  7383. @item gamma_r
  7384. Set the gamma_r expression.
  7385. @item gamma_g
  7386. Set gamma_g expression.
  7387. @item gamma_b
  7388. Set gamma_b expression.
  7389. @item gamma_weight
  7390. Set gamma_weight expression.
  7391. The command accepts the same syntax of the corresponding option.
  7392. If the specified expression is not valid, it is kept at its current
  7393. value.
  7394. @end table
  7395. @section erosion
  7396. Apply erosion effect to the video.
  7397. This filter replaces the pixel by the local(3x3) minimum.
  7398. It accepts the following options:
  7399. @table @option
  7400. @item threshold0
  7401. @item threshold1
  7402. @item threshold2
  7403. @item threshold3
  7404. Limit the maximum change for each plane, default is 65535.
  7405. If 0, plane will remain unchanged.
  7406. @item coordinates
  7407. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7408. pixels are used.
  7409. Flags to local 3x3 coordinates maps like this:
  7410. 1 2 3
  7411. 4 5
  7412. 6 7 8
  7413. @end table
  7414. @section extractplanes
  7415. Extract color channel components from input video stream into
  7416. separate grayscale video streams.
  7417. The filter accepts the following option:
  7418. @table @option
  7419. @item planes
  7420. Set plane(s) to extract.
  7421. Available values for planes are:
  7422. @table @samp
  7423. @item y
  7424. @item u
  7425. @item v
  7426. @item a
  7427. @item r
  7428. @item g
  7429. @item b
  7430. @end table
  7431. Choosing planes not available in the input will result in an error.
  7432. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7433. with @code{y}, @code{u}, @code{v} planes at same time.
  7434. @end table
  7435. @subsection Examples
  7436. @itemize
  7437. @item
  7438. Extract luma, u and v color channel component from input video frame
  7439. into 3 grayscale outputs:
  7440. @example
  7441. 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
  7442. @end example
  7443. @end itemize
  7444. @section fade
  7445. Apply a fade-in/out effect to the input video.
  7446. It accepts the following parameters:
  7447. @table @option
  7448. @item type, t
  7449. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7450. effect.
  7451. Default is @code{in}.
  7452. @item start_frame, s
  7453. Specify the number of the frame to start applying the fade
  7454. effect at. Default is 0.
  7455. @item nb_frames, n
  7456. The number of frames that the fade effect lasts. At the end of the
  7457. fade-in effect, the output video will have the same intensity as the input video.
  7458. At the end of the fade-out transition, the output video will be filled with the
  7459. selected @option{color}.
  7460. Default is 25.
  7461. @item alpha
  7462. If set to 1, fade only alpha channel, if one exists on the input.
  7463. Default value is 0.
  7464. @item start_time, st
  7465. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7466. effect. If both start_frame and start_time are specified, the fade will start at
  7467. whichever comes last. Default is 0.
  7468. @item duration, d
  7469. The number of seconds for which the fade effect has to last. At the end of the
  7470. fade-in effect the output video will have the same intensity as the input video,
  7471. at the end of the fade-out transition the output video will be filled with the
  7472. selected @option{color}.
  7473. If both duration and nb_frames are specified, duration is used. Default is 0
  7474. (nb_frames is used by default).
  7475. @item color, c
  7476. Specify the color of the fade. Default is "black".
  7477. @end table
  7478. @subsection Examples
  7479. @itemize
  7480. @item
  7481. Fade in the first 30 frames of video:
  7482. @example
  7483. fade=in:0:30
  7484. @end example
  7485. The command above is equivalent to:
  7486. @example
  7487. fade=t=in:s=0:n=30
  7488. @end example
  7489. @item
  7490. Fade out the last 45 frames of a 200-frame video:
  7491. @example
  7492. fade=out:155:45
  7493. fade=type=out:start_frame=155:nb_frames=45
  7494. @end example
  7495. @item
  7496. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7497. @example
  7498. fade=in:0:25, fade=out:975:25
  7499. @end example
  7500. @item
  7501. Make the first 5 frames yellow, then fade in from frame 5-24:
  7502. @example
  7503. fade=in:5:20:color=yellow
  7504. @end example
  7505. @item
  7506. Fade in alpha over first 25 frames of video:
  7507. @example
  7508. fade=in:0:25:alpha=1
  7509. @end example
  7510. @item
  7511. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7512. @example
  7513. fade=t=in:st=5.5:d=0.5
  7514. @end example
  7515. @end itemize
  7516. @section fftdnoiz
  7517. Denoise frames using 3D FFT (frequency domain filtering).
  7518. The filter accepts the following options:
  7519. @table @option
  7520. @item sigma
  7521. Set the noise sigma constant. This sets denoising strength.
  7522. Default value is 1. Allowed range is from 0 to 30.
  7523. Using very high sigma with low overlap may give blocking artifacts.
  7524. @item amount
  7525. Set amount of denoising. By default all detected noise is reduced.
  7526. Default value is 1. Allowed range is from 0 to 1.
  7527. @item block
  7528. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7529. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7530. block size in pixels is 2^4 which is 16.
  7531. @item overlap
  7532. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7533. @item prev
  7534. Set number of previous frames to use for denoising. By default is set to 0.
  7535. @item next
  7536. Set number of next frames to to use for denoising. By default is set to 0.
  7537. @item planes
  7538. Set planes which will be filtered, by default are all available filtered
  7539. except alpha.
  7540. @end table
  7541. @section fftfilt
  7542. Apply arbitrary expressions to samples in frequency domain
  7543. @table @option
  7544. @item dc_Y
  7545. Adjust the dc value (gain) of the luma plane of the image. The filter
  7546. accepts an integer value in range @code{0} to @code{1000}. The default
  7547. value is set to @code{0}.
  7548. @item dc_U
  7549. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7550. filter accepts an integer value in range @code{0} to @code{1000}. The
  7551. default value is set to @code{0}.
  7552. @item dc_V
  7553. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7554. filter accepts an integer value in range @code{0} to @code{1000}. The
  7555. default value is set to @code{0}.
  7556. @item weight_Y
  7557. Set the frequency domain weight expression for the luma plane.
  7558. @item weight_U
  7559. Set the frequency domain weight expression for the 1st chroma plane.
  7560. @item weight_V
  7561. Set the frequency domain weight expression for the 2nd chroma plane.
  7562. @item eval
  7563. Set when the expressions are evaluated.
  7564. It accepts the following values:
  7565. @table @samp
  7566. @item init
  7567. Only evaluate expressions once during the filter initialization.
  7568. @item frame
  7569. Evaluate expressions for each incoming frame.
  7570. @end table
  7571. Default value is @samp{init}.
  7572. The filter accepts the following variables:
  7573. @item X
  7574. @item Y
  7575. The coordinates of the current sample.
  7576. @item W
  7577. @item H
  7578. The width and height of the image.
  7579. @item N
  7580. The number of input frame, starting from 0.
  7581. @end table
  7582. @subsection Examples
  7583. @itemize
  7584. @item
  7585. High-pass:
  7586. @example
  7587. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7588. @end example
  7589. @item
  7590. Low-pass:
  7591. @example
  7592. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7593. @end example
  7594. @item
  7595. Sharpen:
  7596. @example
  7597. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7598. @end example
  7599. @item
  7600. Blur:
  7601. @example
  7602. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7603. @end example
  7604. @end itemize
  7605. @section field
  7606. Extract a single field from an interlaced image using stride
  7607. arithmetic to avoid wasting CPU time. The output frames are marked as
  7608. non-interlaced.
  7609. The filter accepts the following options:
  7610. @table @option
  7611. @item type
  7612. Specify whether to extract the top (if the value is @code{0} or
  7613. @code{top}) or the bottom field (if the value is @code{1} or
  7614. @code{bottom}).
  7615. @end table
  7616. @section fieldhint
  7617. Create new frames by copying the top and bottom fields from surrounding frames
  7618. supplied as numbers by the hint file.
  7619. @table @option
  7620. @item hint
  7621. Set file containing hints: absolute/relative frame numbers.
  7622. There must be one line for each frame in a clip. Each line must contain two
  7623. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7624. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7625. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7626. for @code{relative} mode. First number tells from which frame to pick up top
  7627. field and second number tells from which frame to pick up bottom field.
  7628. If optionally followed by @code{+} output frame will be marked as interlaced,
  7629. else if followed by @code{-} output frame will be marked as progressive, else
  7630. it will be marked same as input frame.
  7631. If line starts with @code{#} or @code{;} that line is skipped.
  7632. @item mode
  7633. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7634. @end table
  7635. Example of first several lines of @code{hint} file for @code{relative} mode:
  7636. @example
  7637. 0,0 - # first frame
  7638. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7639. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7640. 1,0 -
  7641. 0,0 -
  7642. 0,0 -
  7643. 1,0 -
  7644. 1,0 -
  7645. 1,0 -
  7646. 0,0 -
  7647. 0,0 -
  7648. 1,0 -
  7649. 1,0 -
  7650. 1,0 -
  7651. 0,0 -
  7652. @end example
  7653. @section fieldmatch
  7654. Field matching filter for inverse telecine. It is meant to reconstruct the
  7655. progressive frames from a telecined stream. The filter does not drop duplicated
  7656. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7657. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7658. The separation of the field matching and the decimation is notably motivated by
  7659. the possibility of inserting a de-interlacing filter fallback between the two.
  7660. If the source has mixed telecined and real interlaced content,
  7661. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7662. But these remaining combed frames will be marked as interlaced, and thus can be
  7663. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7664. In addition to the various configuration options, @code{fieldmatch} can take an
  7665. optional second stream, activated through the @option{ppsrc} option. If
  7666. enabled, the frames reconstruction will be based on the fields and frames from
  7667. this second stream. This allows the first input to be pre-processed in order to
  7668. help the various algorithms of the filter, while keeping the output lossless
  7669. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7670. or brightness/contrast adjustments can help.
  7671. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7672. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7673. which @code{fieldmatch} is based on. While the semantic and usage are very
  7674. close, some behaviour and options names can differ.
  7675. The @ref{decimate} filter currently only works for constant frame rate input.
  7676. If your input has mixed telecined (30fps) and progressive content with a lower
  7677. framerate like 24fps use the following filterchain to produce the necessary cfr
  7678. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7679. The filter accepts the following options:
  7680. @table @option
  7681. @item order
  7682. Specify the assumed field order of the input stream. Available values are:
  7683. @table @samp
  7684. @item auto
  7685. Auto detect parity (use FFmpeg's internal parity value).
  7686. @item bff
  7687. Assume bottom field first.
  7688. @item tff
  7689. Assume top field first.
  7690. @end table
  7691. Note that it is sometimes recommended not to trust the parity announced by the
  7692. stream.
  7693. Default value is @var{auto}.
  7694. @item mode
  7695. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7696. sense that it won't risk creating jerkiness due to duplicate frames when
  7697. possible, but if there are bad edits or blended fields it will end up
  7698. outputting combed frames when a good match might actually exist. On the other
  7699. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7700. but will almost always find a good frame if there is one. The other values are
  7701. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7702. jerkiness and creating duplicate frames versus finding good matches in sections
  7703. with bad edits, orphaned fields, blended fields, etc.
  7704. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7705. Available values are:
  7706. @table @samp
  7707. @item pc
  7708. 2-way matching (p/c)
  7709. @item pc_n
  7710. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7711. @item pc_u
  7712. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7713. @item pc_n_ub
  7714. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7715. still combed (p/c + n + u/b)
  7716. @item pcn
  7717. 3-way matching (p/c/n)
  7718. @item pcn_ub
  7719. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7720. detected as combed (p/c/n + u/b)
  7721. @end table
  7722. The parenthesis at the end indicate the matches that would be used for that
  7723. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7724. @var{top}).
  7725. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7726. the slowest.
  7727. Default value is @var{pc_n}.
  7728. @item ppsrc
  7729. Mark the main input stream as a pre-processed input, and enable the secondary
  7730. input stream as the clean source to pick the fields from. See the filter
  7731. introduction for more details. It is similar to the @option{clip2} feature from
  7732. VFM/TFM.
  7733. Default value is @code{0} (disabled).
  7734. @item field
  7735. Set the field to match from. It is recommended to set this to the same value as
  7736. @option{order} unless you experience matching failures with that setting. In
  7737. certain circumstances changing the field that is used to match from can have a
  7738. large impact on matching performance. Available values are:
  7739. @table @samp
  7740. @item auto
  7741. Automatic (same value as @option{order}).
  7742. @item bottom
  7743. Match from the bottom field.
  7744. @item top
  7745. Match from the top field.
  7746. @end table
  7747. Default value is @var{auto}.
  7748. @item mchroma
  7749. Set whether or not chroma is included during the match comparisons. In most
  7750. cases it is recommended to leave this enabled. You should set this to @code{0}
  7751. only if your clip has bad chroma problems such as heavy rainbowing or other
  7752. artifacts. Setting this to @code{0} could also be used to speed things up at
  7753. the cost of some accuracy.
  7754. Default value is @code{1}.
  7755. @item y0
  7756. @item y1
  7757. These define an exclusion band which excludes the lines between @option{y0} and
  7758. @option{y1} from being included in the field matching decision. An exclusion
  7759. band can be used to ignore subtitles, a logo, or other things that may
  7760. interfere with the matching. @option{y0} sets the starting scan line and
  7761. @option{y1} sets the ending line; all lines in between @option{y0} and
  7762. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7763. @option{y0} and @option{y1} to the same value will disable the feature.
  7764. @option{y0} and @option{y1} defaults to @code{0}.
  7765. @item scthresh
  7766. Set the scene change detection threshold as a percentage of maximum change on
  7767. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7768. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7769. @option{scthresh} is @code{[0.0, 100.0]}.
  7770. Default value is @code{12.0}.
  7771. @item combmatch
  7772. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7773. account the combed scores of matches when deciding what match to use as the
  7774. final match. Available values are:
  7775. @table @samp
  7776. @item none
  7777. No final matching based on combed scores.
  7778. @item sc
  7779. Combed scores are only used when a scene change is detected.
  7780. @item full
  7781. Use combed scores all the time.
  7782. @end table
  7783. Default is @var{sc}.
  7784. @item combdbg
  7785. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7786. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7787. Available values are:
  7788. @table @samp
  7789. @item none
  7790. No forced calculation.
  7791. @item pcn
  7792. Force p/c/n calculations.
  7793. @item pcnub
  7794. Force p/c/n/u/b calculations.
  7795. @end table
  7796. Default value is @var{none}.
  7797. @item cthresh
  7798. This is the area combing threshold used for combed frame detection. This
  7799. essentially controls how "strong" or "visible" combing must be to be detected.
  7800. Larger values mean combing must be more visible and smaller values mean combing
  7801. can be less visible or strong and still be detected. Valid settings are from
  7802. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7803. be detected as combed). This is basically a pixel difference value. A good
  7804. range is @code{[8, 12]}.
  7805. Default value is @code{9}.
  7806. @item chroma
  7807. Sets whether or not chroma is considered in the combed frame decision. Only
  7808. disable this if your source has chroma problems (rainbowing, etc.) that are
  7809. causing problems for the combed frame detection with chroma enabled. Actually,
  7810. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7811. where there is chroma only combing in the source.
  7812. Default value is @code{0}.
  7813. @item blockx
  7814. @item blocky
  7815. Respectively set the x-axis and y-axis size of the window used during combed
  7816. frame detection. This has to do with the size of the area in which
  7817. @option{combpel} pixels are required to be detected as combed for a frame to be
  7818. declared combed. See the @option{combpel} parameter description for more info.
  7819. Possible values are any number that is a power of 2 starting at 4 and going up
  7820. to 512.
  7821. Default value is @code{16}.
  7822. @item combpel
  7823. The number of combed pixels inside any of the @option{blocky} by
  7824. @option{blockx} size blocks on the frame for the frame to be detected as
  7825. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7826. setting controls "how much" combing there must be in any localized area (a
  7827. window defined by the @option{blockx} and @option{blocky} settings) on the
  7828. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7829. which point no frames will ever be detected as combed). This setting is known
  7830. as @option{MI} in TFM/VFM vocabulary.
  7831. Default value is @code{80}.
  7832. @end table
  7833. @anchor{p/c/n/u/b meaning}
  7834. @subsection p/c/n/u/b meaning
  7835. @subsubsection p/c/n
  7836. We assume the following telecined stream:
  7837. @example
  7838. Top fields: 1 2 2 3 4
  7839. Bottom fields: 1 2 3 4 4
  7840. @end example
  7841. The numbers correspond to the progressive frame the fields relate to. Here, the
  7842. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7843. When @code{fieldmatch} is configured to run a matching from bottom
  7844. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7845. @example
  7846. Input stream:
  7847. T 1 2 2 3 4
  7848. B 1 2 3 4 4 <-- matching reference
  7849. Matches: c c n n c
  7850. Output stream:
  7851. T 1 2 3 4 4
  7852. B 1 2 3 4 4
  7853. @end example
  7854. As a result of the field matching, we can see that some frames get duplicated.
  7855. To perform a complete inverse telecine, you need to rely on a decimation filter
  7856. after this operation. See for instance the @ref{decimate} filter.
  7857. The same operation now matching from top fields (@option{field}=@var{top})
  7858. looks like this:
  7859. @example
  7860. Input stream:
  7861. T 1 2 2 3 4 <-- matching reference
  7862. B 1 2 3 4 4
  7863. Matches: c c p p c
  7864. Output stream:
  7865. T 1 2 2 3 4
  7866. B 1 2 2 3 4
  7867. @end example
  7868. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7869. basically, they refer to the frame and field of the opposite parity:
  7870. @itemize
  7871. @item @var{p} matches the field of the opposite parity in the previous frame
  7872. @item @var{c} matches the field of the opposite parity in the current frame
  7873. @item @var{n} matches the field of the opposite parity in the next frame
  7874. @end itemize
  7875. @subsubsection u/b
  7876. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7877. from the opposite parity flag. In the following examples, we assume that we are
  7878. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7879. 'x' is placed above and below each matched fields.
  7880. With bottom matching (@option{field}=@var{bottom}):
  7881. @example
  7882. Match: c p n b u
  7883. x x x x x
  7884. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7885. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7886. x x x x x
  7887. Output frames:
  7888. 2 1 2 2 2
  7889. 2 2 2 1 3
  7890. @end example
  7891. With top matching (@option{field}=@var{top}):
  7892. @example
  7893. Match: c p n b u
  7894. x x x x x
  7895. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7896. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7897. x x x x x
  7898. Output frames:
  7899. 2 2 2 1 2
  7900. 2 1 3 2 2
  7901. @end example
  7902. @subsection Examples
  7903. Simple IVTC of a top field first telecined stream:
  7904. @example
  7905. fieldmatch=order=tff:combmatch=none, decimate
  7906. @end example
  7907. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7908. @example
  7909. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7910. @end example
  7911. @section fieldorder
  7912. Transform the field order of the input video.
  7913. It accepts the following parameters:
  7914. @table @option
  7915. @item order
  7916. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7917. for bottom field first.
  7918. @end table
  7919. The default value is @samp{tff}.
  7920. The transformation is done by shifting the picture content up or down
  7921. by one line, and filling the remaining line with appropriate picture content.
  7922. This method is consistent with most broadcast field order converters.
  7923. If the input video is not flagged as being interlaced, or it is already
  7924. flagged as being of the required output field order, then this filter does
  7925. not alter the incoming video.
  7926. It is very useful when converting to or from PAL DV material,
  7927. which is bottom field first.
  7928. For example:
  7929. @example
  7930. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7931. @end example
  7932. @section fifo, afifo
  7933. Buffer input images and send them when they are requested.
  7934. It is mainly useful when auto-inserted by the libavfilter
  7935. framework.
  7936. It does not take parameters.
  7937. @section fillborders
  7938. Fill borders of the input video, without changing video stream dimensions.
  7939. Sometimes video can have garbage at the four edges and you may not want to
  7940. crop video input to keep size multiple of some number.
  7941. This filter accepts the following options:
  7942. @table @option
  7943. @item left
  7944. Number of pixels to fill from left border.
  7945. @item right
  7946. Number of pixels to fill from right border.
  7947. @item top
  7948. Number of pixels to fill from top border.
  7949. @item bottom
  7950. Number of pixels to fill from bottom border.
  7951. @item mode
  7952. Set fill mode.
  7953. It accepts the following values:
  7954. @table @samp
  7955. @item smear
  7956. fill pixels using outermost pixels
  7957. @item mirror
  7958. fill pixels using mirroring
  7959. @item fixed
  7960. fill pixels with constant value
  7961. @end table
  7962. Default is @var{smear}.
  7963. @item color
  7964. Set color for pixels in fixed mode. Default is @var{black}.
  7965. @end table
  7966. @section find_rect
  7967. Find a rectangular object
  7968. It accepts the following options:
  7969. @table @option
  7970. @item object
  7971. Filepath of the object image, needs to be in gray8.
  7972. @item threshold
  7973. Detection threshold, default is 0.5.
  7974. @item mipmaps
  7975. Number of mipmaps, default is 3.
  7976. @item xmin, ymin, xmax, ymax
  7977. Specifies the rectangle in which to search.
  7978. @end table
  7979. @subsection Examples
  7980. @itemize
  7981. @item
  7982. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7983. @example
  7984. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7985. @end example
  7986. @end itemize
  7987. @section floodfill
  7988. Flood area with values of same pixel components with another values.
  7989. It accepts the following options:
  7990. @table @option
  7991. @item x
  7992. Set pixel x coordinate.
  7993. @item y
  7994. Set pixel y coordinate.
  7995. @item s0
  7996. Set source #0 component value.
  7997. @item s1
  7998. Set source #1 component value.
  7999. @item s2
  8000. Set source #2 component value.
  8001. @item s3
  8002. Set source #3 component value.
  8003. @item d0
  8004. Set destination #0 component value.
  8005. @item d1
  8006. Set destination #1 component value.
  8007. @item d2
  8008. Set destination #2 component value.
  8009. @item d3
  8010. Set destination #3 component value.
  8011. @end table
  8012. @anchor{format}
  8013. @section format
  8014. Convert the input video to one of the specified pixel formats.
  8015. Libavfilter will try to pick one that is suitable as input to
  8016. the next filter.
  8017. It accepts the following parameters:
  8018. @table @option
  8019. @item pix_fmts
  8020. A '|'-separated list of pixel format names, such as
  8021. "pix_fmts=yuv420p|monow|rgb24".
  8022. @end table
  8023. @subsection Examples
  8024. @itemize
  8025. @item
  8026. Convert the input video to the @var{yuv420p} format
  8027. @example
  8028. format=pix_fmts=yuv420p
  8029. @end example
  8030. Convert the input video to any of the formats in the list
  8031. @example
  8032. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8033. @end example
  8034. @end itemize
  8035. @anchor{fps}
  8036. @section fps
  8037. Convert the video to specified constant frame rate by duplicating or dropping
  8038. frames as necessary.
  8039. It accepts the following parameters:
  8040. @table @option
  8041. @item fps
  8042. The desired output frame rate. The default is @code{25}.
  8043. @item start_time
  8044. Assume the first PTS should be the given value, in seconds. This allows for
  8045. padding/trimming at the start of stream. By default, no assumption is made
  8046. about the first frame's expected PTS, so no padding or trimming is done.
  8047. For example, this could be set to 0 to pad the beginning with duplicates of
  8048. the first frame if a video stream starts after the audio stream or to trim any
  8049. frames with a negative PTS.
  8050. @item round
  8051. Timestamp (PTS) rounding method.
  8052. Possible values are:
  8053. @table @option
  8054. @item zero
  8055. round towards 0
  8056. @item inf
  8057. round away from 0
  8058. @item down
  8059. round towards -infinity
  8060. @item up
  8061. round towards +infinity
  8062. @item near
  8063. round to nearest
  8064. @end table
  8065. The default is @code{near}.
  8066. @item eof_action
  8067. Action performed when reading the last frame.
  8068. Possible values are:
  8069. @table @option
  8070. @item round
  8071. Use same timestamp rounding method as used for other frames.
  8072. @item pass
  8073. Pass through last frame if input duration has not been reached yet.
  8074. @end table
  8075. The default is @code{round}.
  8076. @end table
  8077. Alternatively, the options can be specified as a flat string:
  8078. @var{fps}[:@var{start_time}[:@var{round}]].
  8079. See also the @ref{setpts} filter.
  8080. @subsection Examples
  8081. @itemize
  8082. @item
  8083. A typical usage in order to set the fps to 25:
  8084. @example
  8085. fps=fps=25
  8086. @end example
  8087. @item
  8088. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8089. @example
  8090. fps=fps=film:round=near
  8091. @end example
  8092. @end itemize
  8093. @section framepack
  8094. Pack two different video streams into a stereoscopic video, setting proper
  8095. metadata on supported codecs. The two views should have the same size and
  8096. framerate and processing will stop when the shorter video ends. Please note
  8097. that you may conveniently adjust view properties with the @ref{scale} and
  8098. @ref{fps} filters.
  8099. It accepts the following parameters:
  8100. @table @option
  8101. @item format
  8102. The desired packing format. Supported values are:
  8103. @table @option
  8104. @item sbs
  8105. The views are next to each other (default).
  8106. @item tab
  8107. The views are on top of each other.
  8108. @item lines
  8109. The views are packed by line.
  8110. @item columns
  8111. The views are packed by column.
  8112. @item frameseq
  8113. The views are temporally interleaved.
  8114. @end table
  8115. @end table
  8116. Some examples:
  8117. @example
  8118. # Convert left and right views into a frame-sequential video
  8119. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8120. # Convert views into a side-by-side video with the same output resolution as the input
  8121. 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
  8122. @end example
  8123. @section framerate
  8124. Change the frame rate by interpolating new video output frames from the source
  8125. frames.
  8126. This filter is not designed to function correctly with interlaced media. If
  8127. you wish to change the frame rate of interlaced media then you are required
  8128. to deinterlace before this filter and re-interlace after this filter.
  8129. A description of the accepted options follows.
  8130. @table @option
  8131. @item fps
  8132. Specify the output frames per second. This option can also be specified
  8133. as a value alone. The default is @code{50}.
  8134. @item interp_start
  8135. Specify the start of a range where the output frame will be created as a
  8136. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8137. the default is @code{15}.
  8138. @item interp_end
  8139. Specify the end of a range where the output frame will be created as a
  8140. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8141. the default is @code{240}.
  8142. @item scene
  8143. Specify the level at which a scene change is detected as a value between
  8144. 0 and 100 to indicate a new scene; a low value reflects a low
  8145. probability for the current frame to introduce a new scene, while a higher
  8146. value means the current frame is more likely to be one.
  8147. The default is @code{8.2}.
  8148. @item flags
  8149. Specify flags influencing the filter process.
  8150. Available value for @var{flags} is:
  8151. @table @option
  8152. @item scene_change_detect, scd
  8153. Enable scene change detection using the value of the option @var{scene}.
  8154. This flag is enabled by default.
  8155. @end table
  8156. @end table
  8157. @section framestep
  8158. Select one frame every N-th frame.
  8159. This filter accepts the following option:
  8160. @table @option
  8161. @item step
  8162. Select frame after every @code{step} frames.
  8163. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8164. @end table
  8165. @section freezedetect
  8166. Detect frozen video.
  8167. This filter logs a message and sets frame metadata when it detects that the
  8168. input video has no significant change in content during a specified duration.
  8169. Video freeze detection calculates the mean average absolute difference of all
  8170. the components of video frames and compares it to a noise floor.
  8171. The printed times and duration are expressed in seconds. The
  8172. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8173. whose timestamp equals or exceeds the detection duration and it contains the
  8174. timestamp of the first frame of the freeze. The
  8175. @code{lavfi.freezedetect.freeze_duration} and
  8176. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8177. after the freeze.
  8178. The filter accepts the following options:
  8179. @table @option
  8180. @item noise, n
  8181. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8182. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8183. 0.001.
  8184. @item duration, d
  8185. Set freeze duration until notification (default is 2 seconds).
  8186. @end table
  8187. @anchor{frei0r}
  8188. @section frei0r
  8189. Apply a frei0r effect to the input video.
  8190. To enable the compilation of this filter, you need to install the frei0r
  8191. header and configure FFmpeg with @code{--enable-frei0r}.
  8192. It accepts the following parameters:
  8193. @table @option
  8194. @item filter_name
  8195. The name of the frei0r effect to load. If the environment variable
  8196. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8197. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8198. Otherwise, the standard frei0r paths are searched, in this order:
  8199. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8200. @file{/usr/lib/frei0r-1/}.
  8201. @item filter_params
  8202. A '|'-separated list of parameters to pass to the frei0r effect.
  8203. @end table
  8204. A frei0r effect parameter can be a boolean (its value is either
  8205. "y" or "n"), a double, a color (specified as
  8206. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8207. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8208. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8209. a position (specified as @var{X}/@var{Y}, where
  8210. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8211. The number and types of parameters depend on the loaded effect. If an
  8212. effect parameter is not specified, the default value is set.
  8213. @subsection Examples
  8214. @itemize
  8215. @item
  8216. Apply the distort0r effect, setting the first two double parameters:
  8217. @example
  8218. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8219. @end example
  8220. @item
  8221. Apply the colordistance effect, taking a color as the first parameter:
  8222. @example
  8223. frei0r=colordistance:0.2/0.3/0.4
  8224. frei0r=colordistance:violet
  8225. frei0r=colordistance:0x112233
  8226. @end example
  8227. @item
  8228. Apply the perspective effect, specifying the top left and top right image
  8229. positions:
  8230. @example
  8231. frei0r=perspective:0.2/0.2|0.8/0.2
  8232. @end example
  8233. @end itemize
  8234. For more information, see
  8235. @url{http://frei0r.dyne.org}
  8236. @section fspp
  8237. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8238. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8239. processing filter, one of them is performed once per block, not per pixel.
  8240. This allows for much higher speed.
  8241. The filter accepts the following options:
  8242. @table @option
  8243. @item quality
  8244. Set quality. This option defines the number of levels for averaging. It accepts
  8245. an integer in the range 4-5. Default value is @code{4}.
  8246. @item qp
  8247. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8248. If not set, the filter will use the QP from the video stream (if available).
  8249. @item strength
  8250. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8251. more details but also more artifacts, while higher values make the image smoother
  8252. but also blurrier. Default value is @code{0} − PSNR optimal.
  8253. @item use_bframe_qp
  8254. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8255. option may cause flicker since the B-Frames have often larger QP. Default is
  8256. @code{0} (not enabled).
  8257. @end table
  8258. @section gblur
  8259. Apply Gaussian blur filter.
  8260. The filter accepts the following options:
  8261. @table @option
  8262. @item sigma
  8263. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8264. @item steps
  8265. Set number of steps for Gaussian approximation. Default is @code{1}.
  8266. @item planes
  8267. Set which planes to filter. By default all planes are filtered.
  8268. @item sigmaV
  8269. Set vertical sigma, if negative it will be same as @code{sigma}.
  8270. Default is @code{-1}.
  8271. @end table
  8272. @section geq
  8273. Apply generic equation to each pixel.
  8274. The filter accepts the following options:
  8275. @table @option
  8276. @item lum_expr, lum
  8277. Set the luminance expression.
  8278. @item cb_expr, cb
  8279. Set the chrominance blue expression.
  8280. @item cr_expr, cr
  8281. Set the chrominance red expression.
  8282. @item alpha_expr, a
  8283. Set the alpha expression.
  8284. @item red_expr, r
  8285. Set the red expression.
  8286. @item green_expr, g
  8287. Set the green expression.
  8288. @item blue_expr, b
  8289. Set the blue expression.
  8290. @end table
  8291. The colorspace is selected according to the specified options. If one
  8292. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8293. options is specified, the filter will automatically select a YCbCr
  8294. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8295. @option{blue_expr} options is specified, it will select an RGB
  8296. colorspace.
  8297. If one of the chrominance expression is not defined, it falls back on the other
  8298. one. If no alpha expression is specified it will evaluate to opaque value.
  8299. If none of chrominance expressions are specified, they will evaluate
  8300. to the luminance expression.
  8301. The expressions can use the following variables and functions:
  8302. @table @option
  8303. @item N
  8304. The sequential number of the filtered frame, starting from @code{0}.
  8305. @item X
  8306. @item Y
  8307. The coordinates of the current sample.
  8308. @item W
  8309. @item H
  8310. The width and height of the image.
  8311. @item SW
  8312. @item SH
  8313. Width and height scale depending on the currently filtered plane. It is the
  8314. ratio between the corresponding luma plane number of pixels and the current
  8315. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8316. @code{0.5,0.5} for chroma planes.
  8317. @item T
  8318. Time of the current frame, expressed in seconds.
  8319. @item p(x, y)
  8320. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8321. plane.
  8322. @item lum(x, y)
  8323. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8324. plane.
  8325. @item cb(x, y)
  8326. Return the value of the pixel at location (@var{x},@var{y}) of the
  8327. blue-difference chroma plane. Return 0 if there is no such plane.
  8328. @item cr(x, y)
  8329. Return the value of the pixel at location (@var{x},@var{y}) of the
  8330. red-difference chroma plane. Return 0 if there is no such plane.
  8331. @item r(x, y)
  8332. @item g(x, y)
  8333. @item b(x, y)
  8334. Return the value of the pixel at location (@var{x},@var{y}) of the
  8335. red/green/blue component. Return 0 if there is no such component.
  8336. @item alpha(x, y)
  8337. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8338. plane. Return 0 if there is no such plane.
  8339. @end table
  8340. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8341. automatically clipped to the closer edge.
  8342. @subsection Examples
  8343. @itemize
  8344. @item
  8345. Flip the image horizontally:
  8346. @example
  8347. geq=p(W-X\,Y)
  8348. @end example
  8349. @item
  8350. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8351. wavelength of 100 pixels:
  8352. @example
  8353. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8354. @end example
  8355. @item
  8356. Generate a fancy enigmatic moving light:
  8357. @example
  8358. 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
  8359. @end example
  8360. @item
  8361. Generate a quick emboss effect:
  8362. @example
  8363. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8364. @end example
  8365. @item
  8366. Modify RGB components depending on pixel position:
  8367. @example
  8368. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8369. @end example
  8370. @item
  8371. Create a radial gradient that is the same size as the input (also see
  8372. the @ref{vignette} filter):
  8373. @example
  8374. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8375. @end example
  8376. @end itemize
  8377. @section gradfun
  8378. Fix the banding artifacts that are sometimes introduced into nearly flat
  8379. regions by truncation to 8-bit color depth.
  8380. Interpolate the gradients that should go where the bands are, and
  8381. dither them.
  8382. It is designed for playback only. Do not use it prior to
  8383. lossy compression, because compression tends to lose the dither and
  8384. bring back the bands.
  8385. It accepts the following parameters:
  8386. @table @option
  8387. @item strength
  8388. The maximum amount by which the filter will change any one pixel. This is also
  8389. the threshold for detecting nearly flat regions. Acceptable values range from
  8390. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8391. valid range.
  8392. @item radius
  8393. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8394. gradients, but also prevents the filter from modifying the pixels near detailed
  8395. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8396. values will be clipped to the valid range.
  8397. @end table
  8398. Alternatively, the options can be specified as a flat string:
  8399. @var{strength}[:@var{radius}]
  8400. @subsection Examples
  8401. @itemize
  8402. @item
  8403. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8404. @example
  8405. gradfun=3.5:8
  8406. @end example
  8407. @item
  8408. Specify radius, omitting the strength (which will fall-back to the default
  8409. value):
  8410. @example
  8411. gradfun=radius=8
  8412. @end example
  8413. @end itemize
  8414. @section graphmonitor, agraphmonitor
  8415. Show various filtergraph stats.
  8416. With this filter one can debug complete filtergraph.
  8417. Especially issues with links filling with queued frames.
  8418. The filter accepts the following options:
  8419. @table @option
  8420. @item size, s
  8421. Set video output size. Default is @var{hd720}.
  8422. @item opacity, o
  8423. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8424. @item mode, m
  8425. Set output mode, can be @var{fulll} or @var{compact}.
  8426. In @var{compact} mode only filters with some queued frames have displayed stats.
  8427. @item flags, f
  8428. Set flags which enable which stats are shown in video.
  8429. Available values for flags are:
  8430. @table @samp
  8431. @item queue
  8432. Display number of queued frames in each link.
  8433. @item frame_count_in
  8434. Display number of frames taken from filter.
  8435. @item frame_count_out
  8436. Display number of frames given out from filter.
  8437. @item pts
  8438. Display current filtered frame pts.
  8439. @item time
  8440. Display current filtered frame time.
  8441. @item timebase
  8442. Display time base for filter link.
  8443. @item format
  8444. Display used format for filter link.
  8445. @item size
  8446. Display video size or number of audio channels in case of audio used by filter link.
  8447. @item rate
  8448. Display video frame rate or sample rate in case of audio used by filter link.
  8449. @end table
  8450. @item rate, r
  8451. Set upper limit for video rate of output stream, Default value is @var{25}.
  8452. This guarantee that output video frame rate will not be higher than this value.
  8453. @end table
  8454. @section greyedge
  8455. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8456. and corrects the scene colors accordingly.
  8457. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8458. The filter accepts the following options:
  8459. @table @option
  8460. @item difford
  8461. The order of differentiation to be applied on the scene. Must be chosen in the range
  8462. [0,2] and default value is 1.
  8463. @item minknorm
  8464. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8465. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8466. max value instead of calculating Minkowski distance.
  8467. @item sigma
  8468. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8469. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8470. can't be equal to 0 if @var{difford} is greater than 0.
  8471. @end table
  8472. @subsection Examples
  8473. @itemize
  8474. @item
  8475. Grey Edge:
  8476. @example
  8477. greyedge=difford=1:minknorm=5:sigma=2
  8478. @end example
  8479. @item
  8480. Max Edge:
  8481. @example
  8482. greyedge=difford=1:minknorm=0:sigma=2
  8483. @end example
  8484. @end itemize
  8485. @anchor{haldclut}
  8486. @section haldclut
  8487. Apply a Hald CLUT to a video stream.
  8488. First input is the video stream to process, and second one is the Hald CLUT.
  8489. The Hald CLUT input can be a simple picture or a complete video stream.
  8490. The filter accepts the following options:
  8491. @table @option
  8492. @item shortest
  8493. Force termination when the shortest input terminates. Default is @code{0}.
  8494. @item repeatlast
  8495. Continue applying the last CLUT after the end of the stream. A value of
  8496. @code{0} disable the filter after the last frame of the CLUT is reached.
  8497. Default is @code{1}.
  8498. @end table
  8499. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8500. filters share the same internals).
  8501. This filter also supports the @ref{framesync} options.
  8502. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8503. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8504. @subsection Workflow examples
  8505. @subsubsection Hald CLUT video stream
  8506. Generate an identity Hald CLUT stream altered with various effects:
  8507. @example
  8508. 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
  8509. @end example
  8510. Note: make sure you use a lossless codec.
  8511. Then use it with @code{haldclut} to apply it on some random stream:
  8512. @example
  8513. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8514. @end example
  8515. The Hald CLUT will be applied to the 10 first seconds (duration of
  8516. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8517. to the remaining frames of the @code{mandelbrot} stream.
  8518. @subsubsection Hald CLUT with preview
  8519. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8520. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8521. biggest possible square starting at the top left of the picture. The remaining
  8522. padding pixels (bottom or right) will be ignored. This area can be used to add
  8523. a preview of the Hald CLUT.
  8524. Typically, the following generated Hald CLUT will be supported by the
  8525. @code{haldclut} filter:
  8526. @example
  8527. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8528. pad=iw+320 [padded_clut];
  8529. smptebars=s=320x256, split [a][b];
  8530. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8531. [main][b] overlay=W-320" -frames:v 1 clut.png
  8532. @end example
  8533. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8534. bars are displayed on the right-top, and below the same color bars processed by
  8535. the color changes.
  8536. Then, the effect of this Hald CLUT can be visualized with:
  8537. @example
  8538. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8539. @end example
  8540. @section hflip
  8541. Flip the input video horizontally.
  8542. For example, to horizontally flip the input video with @command{ffmpeg}:
  8543. @example
  8544. ffmpeg -i in.avi -vf "hflip" out.avi
  8545. @end example
  8546. @section histeq
  8547. This filter applies a global color histogram equalization on a
  8548. per-frame basis.
  8549. It can be used to correct video that has a compressed range of pixel
  8550. intensities. The filter redistributes the pixel intensities to
  8551. equalize their distribution across the intensity range. It may be
  8552. viewed as an "automatically adjusting contrast filter". This filter is
  8553. useful only for correcting degraded or poorly captured source
  8554. video.
  8555. The filter accepts the following options:
  8556. @table @option
  8557. @item strength
  8558. Determine the amount of equalization to be applied. As the strength
  8559. is reduced, the distribution of pixel intensities more-and-more
  8560. approaches that of the input frame. The value must be a float number
  8561. in the range [0,1] and defaults to 0.200.
  8562. @item intensity
  8563. Set the maximum intensity that can generated and scale the output
  8564. values appropriately. The strength should be set as desired and then
  8565. the intensity can be limited if needed to avoid washing-out. The value
  8566. must be a float number in the range [0,1] and defaults to 0.210.
  8567. @item antibanding
  8568. Set the antibanding level. If enabled the filter will randomly vary
  8569. the luminance of output pixels by a small amount to avoid banding of
  8570. the histogram. Possible values are @code{none}, @code{weak} or
  8571. @code{strong}. It defaults to @code{none}.
  8572. @end table
  8573. @section histogram
  8574. Compute and draw a color distribution histogram for the input video.
  8575. The computed histogram is a representation of the color component
  8576. distribution in an image.
  8577. Standard histogram displays the color components distribution in an image.
  8578. Displays color graph for each color component. Shows distribution of
  8579. the Y, U, V, A or R, G, B components, depending on input format, in the
  8580. current frame. Below each graph a color component scale meter is shown.
  8581. The filter accepts the following options:
  8582. @table @option
  8583. @item level_height
  8584. Set height of level. Default value is @code{200}.
  8585. Allowed range is [50, 2048].
  8586. @item scale_height
  8587. Set height of color scale. Default value is @code{12}.
  8588. Allowed range is [0, 40].
  8589. @item display_mode
  8590. Set display mode.
  8591. It accepts the following values:
  8592. @table @samp
  8593. @item stack
  8594. Per color component graphs are placed below each other.
  8595. @item parade
  8596. Per color component graphs are placed side by side.
  8597. @item overlay
  8598. Presents information identical to that in the @code{parade}, except
  8599. that the graphs representing color components are superimposed directly
  8600. over one another.
  8601. @end table
  8602. Default is @code{stack}.
  8603. @item levels_mode
  8604. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8605. Default is @code{linear}.
  8606. @item components
  8607. Set what color components to display.
  8608. Default is @code{7}.
  8609. @item fgopacity
  8610. Set foreground opacity. Default is @code{0.7}.
  8611. @item bgopacity
  8612. Set background opacity. Default is @code{0.5}.
  8613. @end table
  8614. @subsection Examples
  8615. @itemize
  8616. @item
  8617. Calculate and draw histogram:
  8618. @example
  8619. ffplay -i input -vf histogram
  8620. @end example
  8621. @end itemize
  8622. @anchor{hqdn3d}
  8623. @section hqdn3d
  8624. This is a high precision/quality 3d denoise filter. It aims to reduce
  8625. image noise, producing smooth images and making still images really
  8626. still. It should enhance compressibility.
  8627. It accepts the following optional parameters:
  8628. @table @option
  8629. @item luma_spatial
  8630. A non-negative floating point number which specifies spatial luma strength.
  8631. It defaults to 4.0.
  8632. @item chroma_spatial
  8633. A non-negative floating point number which specifies spatial chroma strength.
  8634. It defaults to 3.0*@var{luma_spatial}/4.0.
  8635. @item luma_tmp
  8636. A floating point number which specifies luma temporal strength. It defaults to
  8637. 6.0*@var{luma_spatial}/4.0.
  8638. @item chroma_tmp
  8639. A floating point number which specifies chroma temporal strength. It defaults to
  8640. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8641. @end table
  8642. @anchor{hwdownload}
  8643. @section hwdownload
  8644. Download hardware frames to system memory.
  8645. The input must be in hardware frames, and the output a non-hardware format.
  8646. Not all formats will be supported on the output - it may be necessary to insert
  8647. an additional @option{format} filter immediately following in the graph to get
  8648. the output in a supported format.
  8649. @section hwmap
  8650. Map hardware frames to system memory or to another device.
  8651. This filter has several different modes of operation; which one is used depends
  8652. on the input and output formats:
  8653. @itemize
  8654. @item
  8655. Hardware frame input, normal frame output
  8656. Map the input frames to system memory and pass them to the output. If the
  8657. original hardware frame is later required (for example, after overlaying
  8658. something else on part of it), the @option{hwmap} filter can be used again
  8659. in the next mode to retrieve it.
  8660. @item
  8661. Normal frame input, hardware frame output
  8662. If the input is actually a software-mapped hardware frame, then unmap it -
  8663. that is, return the original hardware frame.
  8664. Otherwise, a device must be provided. Create new hardware surfaces on that
  8665. device for the output, then map them back to the software format at the input
  8666. and give those frames to the preceding filter. This will then act like the
  8667. @option{hwupload} filter, but may be able to avoid an additional copy when
  8668. the input is already in a compatible format.
  8669. @item
  8670. Hardware frame input and output
  8671. A device must be supplied for the output, either directly or with the
  8672. @option{derive_device} option. The input and output devices must be of
  8673. different types and compatible - the exact meaning of this is
  8674. system-dependent, but typically it means that they must refer to the same
  8675. underlying hardware context (for example, refer to the same graphics card).
  8676. If the input frames were originally created on the output device, then unmap
  8677. to retrieve the original frames.
  8678. Otherwise, map the frames to the output device - create new hardware frames
  8679. on the output corresponding to the frames on the input.
  8680. @end itemize
  8681. The following additional parameters are accepted:
  8682. @table @option
  8683. @item mode
  8684. Set the frame mapping mode. Some combination of:
  8685. @table @var
  8686. @item read
  8687. The mapped frame should be readable.
  8688. @item write
  8689. The mapped frame should be writeable.
  8690. @item overwrite
  8691. The mapping will always overwrite the entire frame.
  8692. This may improve performance in some cases, as the original contents of the
  8693. frame need not be loaded.
  8694. @item direct
  8695. The mapping must not involve any copying.
  8696. Indirect mappings to copies of frames are created in some cases where either
  8697. direct mapping is not possible or it would have unexpected properties.
  8698. Setting this flag ensures that the mapping is direct and will fail if that is
  8699. not possible.
  8700. @end table
  8701. Defaults to @var{read+write} if not specified.
  8702. @item derive_device @var{type}
  8703. Rather than using the device supplied at initialisation, instead derive a new
  8704. device of type @var{type} from the device the input frames exist on.
  8705. @item reverse
  8706. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8707. and map them back to the source. This may be necessary in some cases where
  8708. a mapping in one direction is required but only the opposite direction is
  8709. supported by the devices being used.
  8710. This option is dangerous - it may break the preceding filter in undefined
  8711. ways if there are any additional constraints on that filter's output.
  8712. Do not use it without fully understanding the implications of its use.
  8713. @end table
  8714. @anchor{hwupload}
  8715. @section hwupload
  8716. Upload system memory frames to hardware surfaces.
  8717. The device to upload to must be supplied when the filter is initialised. If
  8718. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8719. option.
  8720. @anchor{hwupload_cuda}
  8721. @section hwupload_cuda
  8722. Upload system memory frames to a CUDA device.
  8723. It accepts the following optional parameters:
  8724. @table @option
  8725. @item device
  8726. The number of the CUDA device to use
  8727. @end table
  8728. @section hqx
  8729. Apply a high-quality magnification filter designed for pixel art. This filter
  8730. was originally created by Maxim Stepin.
  8731. It accepts the following option:
  8732. @table @option
  8733. @item n
  8734. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8735. @code{hq3x} and @code{4} for @code{hq4x}.
  8736. Default is @code{3}.
  8737. @end table
  8738. @section hstack
  8739. Stack input videos horizontally.
  8740. All streams must be of same pixel format and of same height.
  8741. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8742. to create same output.
  8743. The filter accept the following option:
  8744. @table @option
  8745. @item inputs
  8746. Set number of input streams. Default is 2.
  8747. @item shortest
  8748. If set to 1, force the output to terminate when the shortest input
  8749. terminates. Default value is 0.
  8750. @end table
  8751. @section hue
  8752. Modify the hue and/or the saturation of the input.
  8753. It accepts the following parameters:
  8754. @table @option
  8755. @item h
  8756. Specify the hue angle as a number of degrees. It accepts an expression,
  8757. and defaults to "0".
  8758. @item s
  8759. Specify the saturation in the [-10,10] range. It accepts an expression and
  8760. defaults to "1".
  8761. @item H
  8762. Specify the hue angle as a number of radians. It accepts an
  8763. expression, and defaults to "0".
  8764. @item b
  8765. Specify the brightness in the [-10,10] range. It accepts an expression and
  8766. defaults to "0".
  8767. @end table
  8768. @option{h} and @option{H} are mutually exclusive, and can't be
  8769. specified at the same time.
  8770. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8771. expressions containing the following constants:
  8772. @table @option
  8773. @item n
  8774. frame count of the input frame starting from 0
  8775. @item pts
  8776. presentation timestamp of the input frame expressed in time base units
  8777. @item r
  8778. frame rate of the input video, NAN if the input frame rate is unknown
  8779. @item t
  8780. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8781. @item tb
  8782. time base of the input video
  8783. @end table
  8784. @subsection Examples
  8785. @itemize
  8786. @item
  8787. Set the hue to 90 degrees and the saturation to 1.0:
  8788. @example
  8789. hue=h=90:s=1
  8790. @end example
  8791. @item
  8792. Same command but expressing the hue in radians:
  8793. @example
  8794. hue=H=PI/2:s=1
  8795. @end example
  8796. @item
  8797. Rotate hue and make the saturation swing between 0
  8798. and 2 over a period of 1 second:
  8799. @example
  8800. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8801. @end example
  8802. @item
  8803. Apply a 3 seconds saturation fade-in effect starting at 0:
  8804. @example
  8805. hue="s=min(t/3\,1)"
  8806. @end example
  8807. The general fade-in expression can be written as:
  8808. @example
  8809. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8810. @end example
  8811. @item
  8812. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8813. @example
  8814. hue="s=max(0\, min(1\, (8-t)/3))"
  8815. @end example
  8816. The general fade-out expression can be written as:
  8817. @example
  8818. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8819. @end example
  8820. @end itemize
  8821. @subsection Commands
  8822. This filter supports the following commands:
  8823. @table @option
  8824. @item b
  8825. @item s
  8826. @item h
  8827. @item H
  8828. Modify the hue and/or the saturation and/or brightness of the input video.
  8829. The command accepts the same syntax of the corresponding option.
  8830. If the specified expression is not valid, it is kept at its current
  8831. value.
  8832. @end table
  8833. @section hysteresis
  8834. Grow first stream into second stream by connecting components.
  8835. This makes it possible to build more robust edge masks.
  8836. This filter accepts the following options:
  8837. @table @option
  8838. @item planes
  8839. Set which planes will be processed as bitmap, unprocessed planes will be
  8840. copied from first stream.
  8841. By default value 0xf, all planes will be processed.
  8842. @item threshold
  8843. Set threshold which is used in filtering. If pixel component value is higher than
  8844. this value filter algorithm for connecting components is activated.
  8845. By default value is 0.
  8846. @end table
  8847. @section idet
  8848. Detect video interlacing type.
  8849. This filter tries to detect if the input frames are interlaced, progressive,
  8850. top or bottom field first. It will also try to detect fields that are
  8851. repeated between adjacent frames (a sign of telecine).
  8852. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8853. Multiple frame detection incorporates the classification history of previous frames.
  8854. The filter will log these metadata values:
  8855. @table @option
  8856. @item single.current_frame
  8857. Detected type of current frame using single-frame detection. One of:
  8858. ``tff'' (top field first), ``bff'' (bottom field first),
  8859. ``progressive'', or ``undetermined''
  8860. @item single.tff
  8861. Cumulative number of frames detected as top field first using single-frame detection.
  8862. @item multiple.tff
  8863. Cumulative number of frames detected as top field first using multiple-frame detection.
  8864. @item single.bff
  8865. Cumulative number of frames detected as bottom field first using single-frame detection.
  8866. @item multiple.current_frame
  8867. Detected type of current frame using multiple-frame detection. One of:
  8868. ``tff'' (top field first), ``bff'' (bottom field first),
  8869. ``progressive'', or ``undetermined''
  8870. @item multiple.bff
  8871. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8872. @item single.progressive
  8873. Cumulative number of frames detected as progressive using single-frame detection.
  8874. @item multiple.progressive
  8875. Cumulative number of frames detected as progressive using multiple-frame detection.
  8876. @item single.undetermined
  8877. Cumulative number of frames that could not be classified using single-frame detection.
  8878. @item multiple.undetermined
  8879. Cumulative number of frames that could not be classified using multiple-frame detection.
  8880. @item repeated.current_frame
  8881. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8882. @item repeated.neither
  8883. Cumulative number of frames with no repeated field.
  8884. @item repeated.top
  8885. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8886. @item repeated.bottom
  8887. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8888. @end table
  8889. The filter accepts the following options:
  8890. @table @option
  8891. @item intl_thres
  8892. Set interlacing threshold.
  8893. @item prog_thres
  8894. Set progressive threshold.
  8895. @item rep_thres
  8896. Threshold for repeated field detection.
  8897. @item half_life
  8898. Number of frames after which a given frame's contribution to the
  8899. statistics is halved (i.e., it contributes only 0.5 to its
  8900. classification). The default of 0 means that all frames seen are given
  8901. full weight of 1.0 forever.
  8902. @item analyze_interlaced_flag
  8903. When this is not 0 then idet will use the specified number of frames to determine
  8904. if the interlaced flag is accurate, it will not count undetermined frames.
  8905. If the flag is found to be accurate it will be used without any further
  8906. computations, if it is found to be inaccurate it will be cleared without any
  8907. further computations. This allows inserting the idet filter as a low computational
  8908. method to clean up the interlaced flag
  8909. @end table
  8910. @section il
  8911. Deinterleave or interleave fields.
  8912. This filter allows one to process interlaced images fields without
  8913. deinterlacing them. Deinterleaving splits the input frame into 2
  8914. fields (so called half pictures). Odd lines are moved to the top
  8915. half of the output image, even lines to the bottom half.
  8916. You can process (filter) them independently and then re-interleave them.
  8917. The filter accepts the following options:
  8918. @table @option
  8919. @item luma_mode, l
  8920. @item chroma_mode, c
  8921. @item alpha_mode, a
  8922. Available values for @var{luma_mode}, @var{chroma_mode} and
  8923. @var{alpha_mode} are:
  8924. @table @samp
  8925. @item none
  8926. Do nothing.
  8927. @item deinterleave, d
  8928. Deinterleave fields, placing one above the other.
  8929. @item interleave, i
  8930. Interleave fields. Reverse the effect of deinterleaving.
  8931. @end table
  8932. Default value is @code{none}.
  8933. @item luma_swap, ls
  8934. @item chroma_swap, cs
  8935. @item alpha_swap, as
  8936. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8937. @end table
  8938. @section inflate
  8939. Apply inflate effect to the video.
  8940. This filter replaces the pixel by the local(3x3) average by taking into account
  8941. only values higher than the pixel.
  8942. It accepts the following options:
  8943. @table @option
  8944. @item threshold0
  8945. @item threshold1
  8946. @item threshold2
  8947. @item threshold3
  8948. Limit the maximum change for each plane, default is 65535.
  8949. If 0, plane will remain unchanged.
  8950. @end table
  8951. @section interlace
  8952. Simple interlacing filter from progressive contents. This interleaves upper (or
  8953. lower) lines from odd frames with lower (or upper) lines from even frames,
  8954. halving the frame rate and preserving image height.
  8955. @example
  8956. Original Original New Frame
  8957. Frame 'j' Frame 'j+1' (tff)
  8958. ========== =========== ==================
  8959. Line 0 --------------------> Frame 'j' Line 0
  8960. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8961. Line 2 ---------------------> Frame 'j' Line 2
  8962. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8963. ... ... ...
  8964. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8965. @end example
  8966. It accepts the following optional parameters:
  8967. @table @option
  8968. @item scan
  8969. This determines whether the interlaced frame is taken from the even
  8970. (tff - default) or odd (bff) lines of the progressive frame.
  8971. @item lowpass
  8972. Vertical lowpass filter to avoid twitter interlacing and
  8973. reduce moire patterns.
  8974. @table @samp
  8975. @item 0, off
  8976. Disable vertical lowpass filter
  8977. @item 1, linear
  8978. Enable linear filter (default)
  8979. @item 2, complex
  8980. Enable complex filter. This will slightly less reduce twitter and moire
  8981. but better retain detail and subjective sharpness impression.
  8982. @end table
  8983. @end table
  8984. @section kerndeint
  8985. Deinterlace input video by applying Donald Graft's adaptive kernel
  8986. deinterling. Work on interlaced parts of a video to produce
  8987. progressive frames.
  8988. The description of the accepted parameters follows.
  8989. @table @option
  8990. @item thresh
  8991. Set the threshold which affects the filter's tolerance when
  8992. determining if a pixel line must be processed. It must be an integer
  8993. in the range [0,255] and defaults to 10. A value of 0 will result in
  8994. applying the process on every pixels.
  8995. @item map
  8996. Paint pixels exceeding the threshold value to white if set to 1.
  8997. Default is 0.
  8998. @item order
  8999. Set the fields order. Swap fields if set to 1, leave fields alone if
  9000. 0. Default is 0.
  9001. @item sharp
  9002. Enable additional sharpening if set to 1. Default is 0.
  9003. @item twoway
  9004. Enable twoway sharpening if set to 1. Default is 0.
  9005. @end table
  9006. @subsection Examples
  9007. @itemize
  9008. @item
  9009. Apply default values:
  9010. @example
  9011. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9012. @end example
  9013. @item
  9014. Enable additional sharpening:
  9015. @example
  9016. kerndeint=sharp=1
  9017. @end example
  9018. @item
  9019. Paint processed pixels in white:
  9020. @example
  9021. kerndeint=map=1
  9022. @end example
  9023. @end itemize
  9024. @section lagfun
  9025. Slowly update darker pixels.
  9026. This filter makes short flashes of light appear longer.
  9027. This filter accepts the following options:
  9028. @table @option
  9029. @item decay
  9030. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9031. @item planes
  9032. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9033. @end table
  9034. @section lenscorrection
  9035. Correct radial lens distortion
  9036. This filter can be used to correct for radial distortion as can result from the use
  9037. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9038. one can use tools available for example as part of opencv or simply trial-and-error.
  9039. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9040. and extract the k1 and k2 coefficients from the resulting matrix.
  9041. Note that effectively the same filter is available in the open-source tools Krita and
  9042. Digikam from the KDE project.
  9043. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9044. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9045. brightness distribution, so you may want to use both filters together in certain
  9046. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9047. be applied before or after lens correction.
  9048. @subsection Options
  9049. The filter accepts the following options:
  9050. @table @option
  9051. @item cx
  9052. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9053. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9054. width. Default is 0.5.
  9055. @item cy
  9056. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9057. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9058. height. Default is 0.5.
  9059. @item k1
  9060. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9061. no correction. Default is 0.
  9062. @item k2
  9063. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9064. 0 means no correction. Default is 0.
  9065. @end table
  9066. The formula that generates the correction is:
  9067. @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)
  9068. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9069. distances from the focal point in the source and target images, respectively.
  9070. @section lensfun
  9071. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9072. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9073. to apply the lens correction. The filter will load the lensfun database and
  9074. query it to find the corresponding camera and lens entries in the database. As
  9075. long as these entries can be found with the given options, the filter can
  9076. perform corrections on frames. Note that incomplete strings will result in the
  9077. filter choosing the best match with the given options, and the filter will
  9078. output the chosen camera and lens models (logged with level "info"). You must
  9079. provide the make, camera model, and lens model as they are required.
  9080. The filter accepts the following options:
  9081. @table @option
  9082. @item make
  9083. The make of the camera (for example, "Canon"). This option is required.
  9084. @item model
  9085. The model of the camera (for example, "Canon EOS 100D"). This option is
  9086. required.
  9087. @item lens_model
  9088. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9089. option is required.
  9090. @item mode
  9091. The type of correction to apply. The following values are valid options:
  9092. @table @samp
  9093. @item vignetting
  9094. Enables fixing lens vignetting.
  9095. @item geometry
  9096. Enables fixing lens geometry. This is the default.
  9097. @item subpixel
  9098. Enables fixing chromatic aberrations.
  9099. @item vig_geo
  9100. Enables fixing lens vignetting and lens geometry.
  9101. @item vig_subpixel
  9102. Enables fixing lens vignetting and chromatic aberrations.
  9103. @item distortion
  9104. Enables fixing both lens geometry and chromatic aberrations.
  9105. @item all
  9106. Enables all possible corrections.
  9107. @end table
  9108. @item focal_length
  9109. The focal length of the image/video (zoom; expected constant for video). For
  9110. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9111. range should be chosen when using that lens. Default 18.
  9112. @item aperture
  9113. The aperture of the image/video (expected constant for video). Note that
  9114. aperture is only used for vignetting correction. Default 3.5.
  9115. @item focus_distance
  9116. The focus distance of the image/video (expected constant for video). Note that
  9117. focus distance is only used for vignetting and only slightly affects the
  9118. vignetting correction process. If unknown, leave it at the default value (which
  9119. is 1000).
  9120. @item scale
  9121. The scale factor which is applied after transformation. After correction the
  9122. video is no longer necessarily rectangular. This parameter controls how much of
  9123. the resulting image is visible. The value 0 means that a value will be chosen
  9124. automatically such that there is little or no unmapped area in the output
  9125. image. 1.0 means that no additional scaling is done. Lower values may result
  9126. in more of the corrected image being visible, while higher values may avoid
  9127. unmapped areas in the output.
  9128. @item target_geometry
  9129. The target geometry of the output image/video. The following values are valid
  9130. options:
  9131. @table @samp
  9132. @item rectilinear (default)
  9133. @item fisheye
  9134. @item panoramic
  9135. @item equirectangular
  9136. @item fisheye_orthographic
  9137. @item fisheye_stereographic
  9138. @item fisheye_equisolid
  9139. @item fisheye_thoby
  9140. @end table
  9141. @item reverse
  9142. Apply the reverse of image correction (instead of correcting distortion, apply
  9143. it).
  9144. @item interpolation
  9145. The type of interpolation used when correcting distortion. The following values
  9146. are valid options:
  9147. @table @samp
  9148. @item nearest
  9149. @item linear (default)
  9150. @item lanczos
  9151. @end table
  9152. @end table
  9153. @subsection Examples
  9154. @itemize
  9155. @item
  9156. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9157. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9158. aperture of "8.0".
  9159. @example
  9160. 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
  9161. @end example
  9162. @item
  9163. Apply the same as before, but only for the first 5 seconds of video.
  9164. @example
  9165. 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
  9166. @end example
  9167. @end itemize
  9168. @section libvmaf
  9169. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9170. score between two input videos.
  9171. The obtained VMAF score is printed through the logging system.
  9172. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9173. After installing the library it can be enabled using:
  9174. @code{./configure --enable-libvmaf --enable-version3}.
  9175. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9176. The filter has following options:
  9177. @table @option
  9178. @item model_path
  9179. Set the model path which is to be used for SVM.
  9180. Default value: @code{"vmaf_v0.6.1.pkl"}
  9181. @item log_path
  9182. Set the file path to be used to store logs.
  9183. @item log_fmt
  9184. Set the format of the log file (xml or json).
  9185. @item enable_transform
  9186. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9187. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9188. Default value: @code{false}
  9189. @item phone_model
  9190. Invokes the phone model which will generate VMAF scores higher than in the
  9191. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9192. @item psnr
  9193. Enables computing psnr along with vmaf.
  9194. @item ssim
  9195. Enables computing ssim along with vmaf.
  9196. @item ms_ssim
  9197. Enables computing ms_ssim along with vmaf.
  9198. @item pool
  9199. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9200. @item n_threads
  9201. Set number of threads to be used when computing vmaf.
  9202. @item n_subsample
  9203. Set interval for frame subsampling used when computing vmaf.
  9204. @item enable_conf_interval
  9205. Enables confidence interval.
  9206. @end table
  9207. This filter also supports the @ref{framesync} options.
  9208. On the below examples the input file @file{main.mpg} being processed is
  9209. compared with the reference file @file{ref.mpg}.
  9210. @example
  9211. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9212. @end example
  9213. Example with options:
  9214. @example
  9215. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9216. @end example
  9217. @section limiter
  9218. Limits the pixel components values to the specified range [min, max].
  9219. The filter accepts the following options:
  9220. @table @option
  9221. @item min
  9222. Lower bound. Defaults to the lowest allowed value for the input.
  9223. @item max
  9224. Upper bound. Defaults to the highest allowed value for the input.
  9225. @item planes
  9226. Specify which planes will be processed. Defaults to all available.
  9227. @end table
  9228. @section loop
  9229. Loop video frames.
  9230. The filter accepts the following options:
  9231. @table @option
  9232. @item loop
  9233. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9234. Default is 0.
  9235. @item size
  9236. Set maximal size in number of frames. Default is 0.
  9237. @item start
  9238. Set first frame of loop. Default is 0.
  9239. @end table
  9240. @subsection Examples
  9241. @itemize
  9242. @item
  9243. Loop single first frame infinitely:
  9244. @example
  9245. loop=loop=-1:size=1:start=0
  9246. @end example
  9247. @item
  9248. Loop single first frame 10 times:
  9249. @example
  9250. loop=loop=10:size=1:start=0
  9251. @end example
  9252. @item
  9253. Loop 10 first frames 5 times:
  9254. @example
  9255. loop=loop=5:size=10:start=0
  9256. @end example
  9257. @end itemize
  9258. @section lut1d
  9259. Apply a 1D LUT to an input video.
  9260. The filter accepts the following options:
  9261. @table @option
  9262. @item file
  9263. Set the 1D LUT file name.
  9264. Currently supported formats:
  9265. @table @samp
  9266. @item cube
  9267. Iridas
  9268. @item csp
  9269. cineSpace
  9270. @end table
  9271. @item interp
  9272. Select interpolation mode.
  9273. Available values are:
  9274. @table @samp
  9275. @item nearest
  9276. Use values from the nearest defined point.
  9277. @item linear
  9278. Interpolate values using the linear interpolation.
  9279. @item cosine
  9280. Interpolate values using the cosine interpolation.
  9281. @item cubic
  9282. Interpolate values using the cubic interpolation.
  9283. @item spline
  9284. Interpolate values using the spline interpolation.
  9285. @end table
  9286. @end table
  9287. @anchor{lut3d}
  9288. @section lut3d
  9289. Apply a 3D LUT to an input video.
  9290. The filter accepts the following options:
  9291. @table @option
  9292. @item file
  9293. Set the 3D LUT file name.
  9294. Currently supported formats:
  9295. @table @samp
  9296. @item 3dl
  9297. AfterEffects
  9298. @item cube
  9299. Iridas
  9300. @item dat
  9301. DaVinci
  9302. @item m3d
  9303. Pandora
  9304. @item csp
  9305. cineSpace
  9306. @end table
  9307. @item interp
  9308. Select interpolation mode.
  9309. Available values are:
  9310. @table @samp
  9311. @item nearest
  9312. Use values from the nearest defined point.
  9313. @item trilinear
  9314. Interpolate values using the 8 points defining a cube.
  9315. @item tetrahedral
  9316. Interpolate values using a tetrahedron.
  9317. @end table
  9318. @end table
  9319. @section lumakey
  9320. Turn certain luma values into transparency.
  9321. The filter accepts the following options:
  9322. @table @option
  9323. @item threshold
  9324. Set the luma which will be used as base for transparency.
  9325. Default value is @code{0}.
  9326. @item tolerance
  9327. Set the range of luma values to be keyed out.
  9328. Default value is @code{0}.
  9329. @item softness
  9330. Set the range of softness. Default value is @code{0}.
  9331. Use this to control gradual transition from zero to full transparency.
  9332. @end table
  9333. @section lut, lutrgb, lutyuv
  9334. Compute a look-up table for binding each pixel component input value
  9335. to an output value, and apply it to the input video.
  9336. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9337. to an RGB input video.
  9338. These filters accept the following parameters:
  9339. @table @option
  9340. @item c0
  9341. set first pixel component expression
  9342. @item c1
  9343. set second pixel component expression
  9344. @item c2
  9345. set third pixel component expression
  9346. @item c3
  9347. set fourth pixel component expression, corresponds to the alpha component
  9348. @item r
  9349. set red component expression
  9350. @item g
  9351. set green component expression
  9352. @item b
  9353. set blue component expression
  9354. @item a
  9355. alpha component expression
  9356. @item y
  9357. set Y/luminance component expression
  9358. @item u
  9359. set U/Cb component expression
  9360. @item v
  9361. set V/Cr component expression
  9362. @end table
  9363. Each of them specifies the expression to use for computing the lookup table for
  9364. the corresponding pixel component values.
  9365. The exact component associated to each of the @var{c*} options depends on the
  9366. format in input.
  9367. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9368. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9369. The expressions can contain the following constants and functions:
  9370. @table @option
  9371. @item w
  9372. @item h
  9373. The input width and height.
  9374. @item val
  9375. The input value for the pixel component.
  9376. @item clipval
  9377. The input value, clipped to the @var{minval}-@var{maxval} range.
  9378. @item maxval
  9379. The maximum value for the pixel component.
  9380. @item minval
  9381. The minimum value for the pixel component.
  9382. @item negval
  9383. The negated value for the pixel component value, clipped to the
  9384. @var{minval}-@var{maxval} range; it corresponds to the expression
  9385. "maxval-clipval+minval".
  9386. @item clip(val)
  9387. The computed value in @var{val}, clipped to the
  9388. @var{minval}-@var{maxval} range.
  9389. @item gammaval(gamma)
  9390. The computed gamma correction value of the pixel component value,
  9391. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9392. expression
  9393. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9394. @end table
  9395. All expressions default to "val".
  9396. @subsection Examples
  9397. @itemize
  9398. @item
  9399. Negate input video:
  9400. @example
  9401. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9402. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9403. @end example
  9404. The above is the same as:
  9405. @example
  9406. lutrgb="r=negval:g=negval:b=negval"
  9407. lutyuv="y=negval:u=negval:v=negval"
  9408. @end example
  9409. @item
  9410. Negate luminance:
  9411. @example
  9412. lutyuv=y=negval
  9413. @end example
  9414. @item
  9415. Remove chroma components, turning the video into a graytone image:
  9416. @example
  9417. lutyuv="u=128:v=128"
  9418. @end example
  9419. @item
  9420. Apply a luma burning effect:
  9421. @example
  9422. lutyuv="y=2*val"
  9423. @end example
  9424. @item
  9425. Remove green and blue components:
  9426. @example
  9427. lutrgb="g=0:b=0"
  9428. @end example
  9429. @item
  9430. Set a constant alpha channel value on input:
  9431. @example
  9432. format=rgba,lutrgb=a="maxval-minval/2"
  9433. @end example
  9434. @item
  9435. Correct luminance gamma by a factor of 0.5:
  9436. @example
  9437. lutyuv=y=gammaval(0.5)
  9438. @end example
  9439. @item
  9440. Discard least significant bits of luma:
  9441. @example
  9442. lutyuv=y='bitand(val, 128+64+32)'
  9443. @end example
  9444. @item
  9445. Technicolor like effect:
  9446. @example
  9447. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9448. @end example
  9449. @end itemize
  9450. @section lut2, tlut2
  9451. The @code{lut2} filter takes two input streams and outputs one
  9452. stream.
  9453. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9454. from one single stream.
  9455. This filter accepts the following parameters:
  9456. @table @option
  9457. @item c0
  9458. set first pixel component expression
  9459. @item c1
  9460. set second pixel component expression
  9461. @item c2
  9462. set third pixel component expression
  9463. @item c3
  9464. set fourth pixel component expression, corresponds to the alpha component
  9465. @item d
  9466. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9467. which means bit depth is automatically picked from first input format.
  9468. @end table
  9469. Each of them specifies the expression to use for computing the lookup table for
  9470. the corresponding pixel component values.
  9471. The exact component associated to each of the @var{c*} options depends on the
  9472. format in inputs.
  9473. The expressions can contain the following constants:
  9474. @table @option
  9475. @item w
  9476. @item h
  9477. The input width and height.
  9478. @item x
  9479. The first input value for the pixel component.
  9480. @item y
  9481. The second input value for the pixel component.
  9482. @item bdx
  9483. The first input video bit depth.
  9484. @item bdy
  9485. The second input video bit depth.
  9486. @end table
  9487. All expressions default to "x".
  9488. @subsection Examples
  9489. @itemize
  9490. @item
  9491. Highlight differences between two RGB video streams:
  9492. @example
  9493. 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)'
  9494. @end example
  9495. @item
  9496. Highlight differences between two YUV video streams:
  9497. @example
  9498. 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)'
  9499. @end example
  9500. @item
  9501. Show max difference between two video streams:
  9502. @example
  9503. 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)))'
  9504. @end example
  9505. @end itemize
  9506. @section maskedclamp
  9507. Clamp the first input stream with the second input and third input stream.
  9508. Returns the value of first stream to be between second input
  9509. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9510. This filter accepts the following options:
  9511. @table @option
  9512. @item undershoot
  9513. Default value is @code{0}.
  9514. @item overshoot
  9515. Default value is @code{0}.
  9516. @item planes
  9517. Set which planes will be processed as bitmap, unprocessed planes will be
  9518. copied from first stream.
  9519. By default value 0xf, all planes will be processed.
  9520. @end table
  9521. @section maskedmerge
  9522. Merge the first input stream with the second input stream using per pixel
  9523. weights in the third input stream.
  9524. A value of 0 in the third stream pixel component means that pixel component
  9525. from first stream is returned unchanged, while maximum value (eg. 255 for
  9526. 8-bit videos) means that pixel component from second stream is returned
  9527. unchanged. Intermediate values define the amount of merging between both
  9528. input stream's pixel components.
  9529. This filter accepts the following options:
  9530. @table @option
  9531. @item planes
  9532. Set which planes will be processed as bitmap, unprocessed planes will be
  9533. copied from first stream.
  9534. By default value 0xf, all planes will be processed.
  9535. @end table
  9536. @section maskfun
  9537. Create mask from input video.
  9538. For example it is useful to create motion masks after @code{tblend} filter.
  9539. This filter accepts the following options:
  9540. @table @option
  9541. @item low
  9542. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9543. @item high
  9544. Set high threshold. Any pixel component higher than this value will be set to max value
  9545. allowed for current pixel format.
  9546. @item planes
  9547. Set planes to filter, by default all available planes are filtered.
  9548. @item fill
  9549. Fill all frame pixels with this value.
  9550. @item sum
  9551. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9552. average, output frame will be completely filled with value set by @var{fill} option.
  9553. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9554. @end table
  9555. @section mcdeint
  9556. Apply motion-compensation deinterlacing.
  9557. It needs one field per frame as input and must thus be used together
  9558. with yadif=1/3 or equivalent.
  9559. This filter accepts the following options:
  9560. @table @option
  9561. @item mode
  9562. Set the deinterlacing mode.
  9563. It accepts one of the following values:
  9564. @table @samp
  9565. @item fast
  9566. @item medium
  9567. @item slow
  9568. use iterative motion estimation
  9569. @item extra_slow
  9570. like @samp{slow}, but use multiple reference frames.
  9571. @end table
  9572. Default value is @samp{fast}.
  9573. @item parity
  9574. Set the picture field parity assumed for the input video. It must be
  9575. one of the following values:
  9576. @table @samp
  9577. @item 0, tff
  9578. assume top field first
  9579. @item 1, bff
  9580. assume bottom field first
  9581. @end table
  9582. Default value is @samp{bff}.
  9583. @item qp
  9584. Set per-block quantization parameter (QP) used by the internal
  9585. encoder.
  9586. Higher values should result in a smoother motion vector field but less
  9587. optimal individual vectors. Default value is 1.
  9588. @end table
  9589. @section mergeplanes
  9590. Merge color channel components from several video streams.
  9591. The filter accepts up to 4 input streams, and merge selected input
  9592. planes to the output video.
  9593. This filter accepts the following options:
  9594. @table @option
  9595. @item mapping
  9596. Set input to output plane mapping. Default is @code{0}.
  9597. The mappings is specified as a bitmap. It should be specified as a
  9598. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9599. mapping for the first plane of the output stream. 'A' sets the number of
  9600. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9601. corresponding input to use (from 0 to 3). The rest of the mappings is
  9602. similar, 'Bb' describes the mapping for the output stream second
  9603. plane, 'Cc' describes the mapping for the output stream third plane and
  9604. 'Dd' describes the mapping for the output stream fourth plane.
  9605. @item format
  9606. Set output pixel format. Default is @code{yuva444p}.
  9607. @end table
  9608. @subsection Examples
  9609. @itemize
  9610. @item
  9611. Merge three gray video streams of same width and height into single video stream:
  9612. @example
  9613. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9614. @end example
  9615. @item
  9616. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9617. @example
  9618. [a0][a1]mergeplanes=0x00010210:yuva444p
  9619. @end example
  9620. @item
  9621. Swap Y and A plane in yuva444p stream:
  9622. @example
  9623. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9624. @end example
  9625. @item
  9626. Swap U and V plane in yuv420p stream:
  9627. @example
  9628. format=yuv420p,mergeplanes=0x000201:yuv420p
  9629. @end example
  9630. @item
  9631. Cast a rgb24 clip to yuv444p:
  9632. @example
  9633. format=rgb24,mergeplanes=0x000102:yuv444p
  9634. @end example
  9635. @end itemize
  9636. @section mestimate
  9637. Estimate and export motion vectors using block matching algorithms.
  9638. Motion vectors are stored in frame side data to be used by other filters.
  9639. This filter accepts the following options:
  9640. @table @option
  9641. @item method
  9642. Specify the motion estimation method. Accepts one of the following values:
  9643. @table @samp
  9644. @item esa
  9645. Exhaustive search algorithm.
  9646. @item tss
  9647. Three step search algorithm.
  9648. @item tdls
  9649. Two dimensional logarithmic search algorithm.
  9650. @item ntss
  9651. New three step search algorithm.
  9652. @item fss
  9653. Four step search algorithm.
  9654. @item ds
  9655. Diamond search algorithm.
  9656. @item hexbs
  9657. Hexagon-based search algorithm.
  9658. @item epzs
  9659. Enhanced predictive zonal search algorithm.
  9660. @item umh
  9661. Uneven multi-hexagon search algorithm.
  9662. @end table
  9663. Default value is @samp{esa}.
  9664. @item mb_size
  9665. Macroblock size. Default @code{16}.
  9666. @item search_param
  9667. Search parameter. Default @code{7}.
  9668. @end table
  9669. @section midequalizer
  9670. Apply Midway Image Equalization effect using two video streams.
  9671. Midway Image Equalization adjusts a pair of images to have the same
  9672. histogram, while maintaining their dynamics as much as possible. It's
  9673. useful for e.g. matching exposures from a pair of stereo cameras.
  9674. This filter has two inputs and one output, which must be of same pixel format, but
  9675. may be of different sizes. The output of filter is first input adjusted with
  9676. midway histogram of both inputs.
  9677. This filter accepts the following option:
  9678. @table @option
  9679. @item planes
  9680. Set which planes to process. Default is @code{15}, which is all available planes.
  9681. @end table
  9682. @section minterpolate
  9683. Convert the video to specified frame rate using motion interpolation.
  9684. This filter accepts the following options:
  9685. @table @option
  9686. @item fps
  9687. 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}.
  9688. @item mi_mode
  9689. Motion interpolation mode. Following values are accepted:
  9690. @table @samp
  9691. @item dup
  9692. Duplicate previous or next frame for interpolating new ones.
  9693. @item blend
  9694. Blend source frames. Interpolated frame is mean of previous and next frames.
  9695. @item mci
  9696. Motion compensated interpolation. Following options are effective when this mode is selected:
  9697. @table @samp
  9698. @item mc_mode
  9699. Motion compensation mode. Following values are accepted:
  9700. @table @samp
  9701. @item obmc
  9702. Overlapped block motion compensation.
  9703. @item aobmc
  9704. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9705. @end table
  9706. Default mode is @samp{obmc}.
  9707. @item me_mode
  9708. Motion estimation mode. Following values are accepted:
  9709. @table @samp
  9710. @item bidir
  9711. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9712. @item bilat
  9713. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9714. @end table
  9715. Default mode is @samp{bilat}.
  9716. @item me
  9717. The algorithm to be used for motion estimation. Following values are accepted:
  9718. @table @samp
  9719. @item esa
  9720. Exhaustive search algorithm.
  9721. @item tss
  9722. Three step search algorithm.
  9723. @item tdls
  9724. Two dimensional logarithmic search algorithm.
  9725. @item ntss
  9726. New three step search algorithm.
  9727. @item fss
  9728. Four step search algorithm.
  9729. @item ds
  9730. Diamond search algorithm.
  9731. @item hexbs
  9732. Hexagon-based search algorithm.
  9733. @item epzs
  9734. Enhanced predictive zonal search algorithm.
  9735. @item umh
  9736. Uneven multi-hexagon search algorithm.
  9737. @end table
  9738. Default algorithm is @samp{epzs}.
  9739. @item mb_size
  9740. Macroblock size. Default @code{16}.
  9741. @item search_param
  9742. Motion estimation search parameter. Default @code{32}.
  9743. @item vsbmc
  9744. 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).
  9745. @end table
  9746. @end table
  9747. @item scd
  9748. 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:
  9749. @table @samp
  9750. @item none
  9751. Disable scene change detection.
  9752. @item fdiff
  9753. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9754. @end table
  9755. Default method is @samp{fdiff}.
  9756. @item scd_threshold
  9757. Scene change detection threshold. Default is @code{5.0}.
  9758. @end table
  9759. @section mix
  9760. Mix several video input streams into one video stream.
  9761. A description of the accepted options follows.
  9762. @table @option
  9763. @item nb_inputs
  9764. The number of inputs. If unspecified, it defaults to 2.
  9765. @item weights
  9766. Specify weight of each input video stream as sequence.
  9767. Each weight is separated by space. If number of weights
  9768. is smaller than number of @var{frames} last specified
  9769. weight will be used for all remaining unset weights.
  9770. @item scale
  9771. Specify scale, if it is set it will be multiplied with sum
  9772. of each weight multiplied with pixel values to give final destination
  9773. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9774. @item duration
  9775. Specify how end of stream is determined.
  9776. @table @samp
  9777. @item longest
  9778. The duration of the longest input. (default)
  9779. @item shortest
  9780. The duration of the shortest input.
  9781. @item first
  9782. The duration of the first input.
  9783. @end table
  9784. @end table
  9785. @section mpdecimate
  9786. Drop frames that do not differ greatly from the previous frame in
  9787. order to reduce frame rate.
  9788. The main use of this filter is for very-low-bitrate encoding
  9789. (e.g. streaming over dialup modem), but it could in theory be used for
  9790. fixing movies that were inverse-telecined incorrectly.
  9791. A description of the accepted options follows.
  9792. @table @option
  9793. @item max
  9794. Set the maximum number of consecutive frames which can be dropped (if
  9795. positive), or the minimum interval between dropped frames (if
  9796. negative). If the value is 0, the frame is dropped disregarding the
  9797. number of previous sequentially dropped frames.
  9798. Default value is 0.
  9799. @item hi
  9800. @item lo
  9801. @item frac
  9802. Set the dropping threshold values.
  9803. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9804. represent actual pixel value differences, so a threshold of 64
  9805. corresponds to 1 unit of difference for each pixel, or the same spread
  9806. out differently over the block.
  9807. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9808. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9809. meaning the whole image) differ by more than a threshold of @option{lo}.
  9810. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9811. 64*5, and default value for @option{frac} is 0.33.
  9812. @end table
  9813. @section negate
  9814. Negate (invert) the input video.
  9815. It accepts the following option:
  9816. @table @option
  9817. @item negate_alpha
  9818. With value 1, it negates the alpha component, if present. Default value is 0.
  9819. @end table
  9820. @anchor{nlmeans}
  9821. @section nlmeans
  9822. Denoise frames using Non-Local Means algorithm.
  9823. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9824. context similarity is defined by comparing their surrounding patches of size
  9825. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9826. around the pixel.
  9827. Note that the research area defines centers for patches, which means some
  9828. patches will be made of pixels outside that research area.
  9829. The filter accepts the following options.
  9830. @table @option
  9831. @item s
  9832. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9833. @item p
  9834. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9835. @item pc
  9836. Same as @option{p} but for chroma planes.
  9837. The default value is @var{0} and means automatic.
  9838. @item r
  9839. Set research size. Default is 15. Must be odd number in range [0, 99].
  9840. @item rc
  9841. Same as @option{r} but for chroma planes.
  9842. The default value is @var{0} and means automatic.
  9843. @end table
  9844. @section nnedi
  9845. Deinterlace video using neural network edge directed interpolation.
  9846. This filter accepts the following options:
  9847. @table @option
  9848. @item weights
  9849. Mandatory option, without binary file filter can not work.
  9850. Currently file can be found here:
  9851. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9852. @item deint
  9853. Set which frames to deinterlace, by default it is @code{all}.
  9854. Can be @code{all} or @code{interlaced}.
  9855. @item field
  9856. Set mode of operation.
  9857. Can be one of the following:
  9858. @table @samp
  9859. @item af
  9860. Use frame flags, both fields.
  9861. @item a
  9862. Use frame flags, single field.
  9863. @item t
  9864. Use top field only.
  9865. @item b
  9866. Use bottom field only.
  9867. @item tf
  9868. Use both fields, top first.
  9869. @item bf
  9870. Use both fields, bottom first.
  9871. @end table
  9872. @item planes
  9873. Set which planes to process, by default filter process all frames.
  9874. @item nsize
  9875. Set size of local neighborhood around each pixel, used by the predictor neural
  9876. network.
  9877. Can be one of the following:
  9878. @table @samp
  9879. @item s8x6
  9880. @item s16x6
  9881. @item s32x6
  9882. @item s48x6
  9883. @item s8x4
  9884. @item s16x4
  9885. @item s32x4
  9886. @end table
  9887. @item nns
  9888. Set the number of neurons in predictor neural network.
  9889. Can be one of the following:
  9890. @table @samp
  9891. @item n16
  9892. @item n32
  9893. @item n64
  9894. @item n128
  9895. @item n256
  9896. @end table
  9897. @item qual
  9898. Controls the number of different neural network predictions that are blended
  9899. together to compute the final output value. Can be @code{fast}, default or
  9900. @code{slow}.
  9901. @item etype
  9902. Set which set of weights to use in the predictor.
  9903. Can be one of the following:
  9904. @table @samp
  9905. @item a
  9906. weights trained to minimize absolute error
  9907. @item s
  9908. weights trained to minimize squared error
  9909. @end table
  9910. @item pscrn
  9911. Controls whether or not the prescreener neural network is used to decide
  9912. which pixels should be processed by the predictor neural network and which
  9913. can be handled by simple cubic interpolation.
  9914. The prescreener is trained to know whether cubic interpolation will be
  9915. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9916. The computational complexity of the prescreener nn is much less than that of
  9917. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9918. using the prescreener generally results in much faster processing.
  9919. The prescreener is pretty accurate, so the difference between using it and not
  9920. using it is almost always unnoticeable.
  9921. Can be one of the following:
  9922. @table @samp
  9923. @item none
  9924. @item original
  9925. @item new
  9926. @end table
  9927. Default is @code{new}.
  9928. @item fapprox
  9929. Set various debugging flags.
  9930. @end table
  9931. @section noformat
  9932. Force libavfilter not to use any of the specified pixel formats for the
  9933. input to the next filter.
  9934. It accepts the following parameters:
  9935. @table @option
  9936. @item pix_fmts
  9937. A '|'-separated list of pixel format names, such as
  9938. pix_fmts=yuv420p|monow|rgb24".
  9939. @end table
  9940. @subsection Examples
  9941. @itemize
  9942. @item
  9943. Force libavfilter to use a format different from @var{yuv420p} for the
  9944. input to the vflip filter:
  9945. @example
  9946. noformat=pix_fmts=yuv420p,vflip
  9947. @end example
  9948. @item
  9949. Convert the input video to any of the formats not contained in the list:
  9950. @example
  9951. noformat=yuv420p|yuv444p|yuv410p
  9952. @end example
  9953. @end itemize
  9954. @section noise
  9955. Add noise on video input frame.
  9956. The filter accepts the following options:
  9957. @table @option
  9958. @item all_seed
  9959. @item c0_seed
  9960. @item c1_seed
  9961. @item c2_seed
  9962. @item c3_seed
  9963. Set noise seed for specific pixel component or all pixel components in case
  9964. of @var{all_seed}. Default value is @code{123457}.
  9965. @item all_strength, alls
  9966. @item c0_strength, c0s
  9967. @item c1_strength, c1s
  9968. @item c2_strength, c2s
  9969. @item c3_strength, c3s
  9970. Set noise strength for specific pixel component or all pixel components in case
  9971. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9972. @item all_flags, allf
  9973. @item c0_flags, c0f
  9974. @item c1_flags, c1f
  9975. @item c2_flags, c2f
  9976. @item c3_flags, c3f
  9977. Set pixel component flags or set flags for all components if @var{all_flags}.
  9978. Available values for component flags are:
  9979. @table @samp
  9980. @item a
  9981. averaged temporal noise (smoother)
  9982. @item p
  9983. mix random noise with a (semi)regular pattern
  9984. @item t
  9985. temporal noise (noise pattern changes between frames)
  9986. @item u
  9987. uniform noise (gaussian otherwise)
  9988. @end table
  9989. @end table
  9990. @subsection Examples
  9991. Add temporal and uniform noise to input video:
  9992. @example
  9993. noise=alls=20:allf=t+u
  9994. @end example
  9995. @section normalize
  9996. Normalize RGB video (aka histogram stretching, contrast stretching).
  9997. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9998. For each channel of each frame, the filter computes the input range and maps
  9999. it linearly to the user-specified output range. The output range defaults
  10000. to the full dynamic range from pure black to pure white.
  10001. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10002. changes in brightness) caused when small dark or bright objects enter or leave
  10003. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10004. video camera, and, like a video camera, it may cause a period of over- or
  10005. under-exposure of the video.
  10006. The R,G,B channels can be normalized independently, which may cause some
  10007. color shifting, or linked together as a single channel, which prevents
  10008. color shifting. Linked normalization preserves hue. Independent normalization
  10009. does not, so it can be used to remove some color casts. Independent and linked
  10010. normalization can be combined in any ratio.
  10011. The normalize filter accepts the following options:
  10012. @table @option
  10013. @item blackpt
  10014. @item whitept
  10015. Colors which define the output range. The minimum input value is mapped to
  10016. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10017. The defaults are black and white respectively. Specifying white for
  10018. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10019. normalized video. Shades of grey can be used to reduce the dynamic range
  10020. (contrast). Specifying saturated colors here can create some interesting
  10021. effects.
  10022. @item smoothing
  10023. The number of previous frames to use for temporal smoothing. The input range
  10024. of each channel is smoothed using a rolling average over the current frame
  10025. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10026. smoothing).
  10027. @item independence
  10028. Controls the ratio of independent (color shifting) channel normalization to
  10029. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10030. independent. Defaults to 1.0 (fully independent).
  10031. @item strength
  10032. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10033. expensive no-op. Defaults to 1.0 (full strength).
  10034. @end table
  10035. @subsection Examples
  10036. Stretch video contrast to use the full dynamic range, with no temporal
  10037. smoothing; may flicker depending on the source content:
  10038. @example
  10039. normalize=blackpt=black:whitept=white:smoothing=0
  10040. @end example
  10041. As above, but with 50 frames of temporal smoothing; flicker should be
  10042. reduced, depending on the source content:
  10043. @example
  10044. normalize=blackpt=black:whitept=white:smoothing=50
  10045. @end example
  10046. As above, but with hue-preserving linked channel normalization:
  10047. @example
  10048. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10049. @end example
  10050. As above, but with half strength:
  10051. @example
  10052. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10053. @end example
  10054. Map the darkest input color to red, the brightest input color to cyan:
  10055. @example
  10056. normalize=blackpt=red:whitept=cyan
  10057. @end example
  10058. @section null
  10059. Pass the video source unchanged to the output.
  10060. @section ocr
  10061. Optical Character Recognition
  10062. This filter uses Tesseract for optical character recognition. To enable
  10063. compilation of this filter, you need to configure FFmpeg with
  10064. @code{--enable-libtesseract}.
  10065. It accepts the following options:
  10066. @table @option
  10067. @item datapath
  10068. Set datapath to tesseract data. Default is to use whatever was
  10069. set at installation.
  10070. @item language
  10071. Set language, default is "eng".
  10072. @item whitelist
  10073. Set character whitelist.
  10074. @item blacklist
  10075. Set character blacklist.
  10076. @end table
  10077. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10078. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10079. @section ocv
  10080. Apply a video transform using libopencv.
  10081. To enable this filter, install the libopencv library and headers and
  10082. configure FFmpeg with @code{--enable-libopencv}.
  10083. It accepts the following parameters:
  10084. @table @option
  10085. @item filter_name
  10086. The name of the libopencv filter to apply.
  10087. @item filter_params
  10088. The parameters to pass to the libopencv filter. If not specified, the default
  10089. values are assumed.
  10090. @end table
  10091. Refer to the official libopencv documentation for more precise
  10092. information:
  10093. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10094. Several libopencv filters are supported; see the following subsections.
  10095. @anchor{dilate}
  10096. @subsection dilate
  10097. Dilate an image by using a specific structuring element.
  10098. It corresponds to the libopencv function @code{cvDilate}.
  10099. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10100. @var{struct_el} represents a structuring element, and has the syntax:
  10101. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10102. @var{cols} and @var{rows} represent the number of columns and rows of
  10103. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10104. point, and @var{shape} the shape for the structuring element. @var{shape}
  10105. must be "rect", "cross", "ellipse", or "custom".
  10106. If the value for @var{shape} is "custom", it must be followed by a
  10107. string of the form "=@var{filename}". The file with name
  10108. @var{filename} is assumed to represent a binary image, with each
  10109. printable character corresponding to a bright pixel. When a custom
  10110. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10111. or columns and rows of the read file are assumed instead.
  10112. The default value for @var{struct_el} is "3x3+0x0/rect".
  10113. @var{nb_iterations} specifies the number of times the transform is
  10114. applied to the image, and defaults to 1.
  10115. Some examples:
  10116. @example
  10117. # Use the default values
  10118. ocv=dilate
  10119. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10120. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10121. # Read the shape from the file diamond.shape, iterating two times.
  10122. # The file diamond.shape may contain a pattern of characters like this
  10123. # *
  10124. # ***
  10125. # *****
  10126. # ***
  10127. # *
  10128. # The specified columns and rows are ignored
  10129. # but the anchor point coordinates are not
  10130. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10131. @end example
  10132. @subsection erode
  10133. Erode an image by using a specific structuring element.
  10134. It corresponds to the libopencv function @code{cvErode}.
  10135. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10136. with the same syntax and semantics as the @ref{dilate} filter.
  10137. @subsection smooth
  10138. Smooth the input video.
  10139. The filter takes the following parameters:
  10140. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10141. @var{type} is the type of smooth filter to apply, and must be one of
  10142. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10143. or "bilateral". The default value is "gaussian".
  10144. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10145. depend on the smooth type. @var{param1} and
  10146. @var{param2} accept integer positive values or 0. @var{param3} and
  10147. @var{param4} accept floating point values.
  10148. The default value for @var{param1} is 3. The default value for the
  10149. other parameters is 0.
  10150. These parameters correspond to the parameters assigned to the
  10151. libopencv function @code{cvSmooth}.
  10152. @section oscilloscope
  10153. 2D Video Oscilloscope.
  10154. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10155. It accepts the following parameters:
  10156. @table @option
  10157. @item x
  10158. Set scope center x position.
  10159. @item y
  10160. Set scope center y position.
  10161. @item s
  10162. Set scope size, relative to frame diagonal.
  10163. @item t
  10164. Set scope tilt/rotation.
  10165. @item o
  10166. Set trace opacity.
  10167. @item tx
  10168. Set trace center x position.
  10169. @item ty
  10170. Set trace center y position.
  10171. @item tw
  10172. Set trace width, relative to width of frame.
  10173. @item th
  10174. Set trace height, relative to height of frame.
  10175. @item c
  10176. Set which components to trace. By default it traces first three components.
  10177. @item g
  10178. Draw trace grid. By default is enabled.
  10179. @item st
  10180. Draw some statistics. By default is enabled.
  10181. @item sc
  10182. Draw scope. By default is enabled.
  10183. @end table
  10184. @subsection Examples
  10185. @itemize
  10186. @item
  10187. Inspect full first row of video frame.
  10188. @example
  10189. oscilloscope=x=0.5:y=0:s=1
  10190. @end example
  10191. @item
  10192. Inspect full last row of video frame.
  10193. @example
  10194. oscilloscope=x=0.5:y=1:s=1
  10195. @end example
  10196. @item
  10197. Inspect full 5th line of video frame of height 1080.
  10198. @example
  10199. oscilloscope=x=0.5:y=5/1080:s=1
  10200. @end example
  10201. @item
  10202. Inspect full last column of video frame.
  10203. @example
  10204. oscilloscope=x=1:y=0.5:s=1:t=1
  10205. @end example
  10206. @end itemize
  10207. @anchor{overlay}
  10208. @section overlay
  10209. Overlay one video on top of another.
  10210. It takes two inputs and has one output. The first input is the "main"
  10211. video on which the second input is overlaid.
  10212. It accepts the following parameters:
  10213. A description of the accepted options follows.
  10214. @table @option
  10215. @item x
  10216. @item y
  10217. Set the expression for the x and y coordinates of the overlaid video
  10218. on the main video. Default value is "0" for both expressions. In case
  10219. the expression is invalid, it is set to a huge value (meaning that the
  10220. overlay will not be displayed within the output visible area).
  10221. @item eof_action
  10222. See @ref{framesync}.
  10223. @item eval
  10224. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10225. It accepts the following values:
  10226. @table @samp
  10227. @item init
  10228. only evaluate expressions once during the filter initialization or
  10229. when a command is processed
  10230. @item frame
  10231. evaluate expressions for each incoming frame
  10232. @end table
  10233. Default value is @samp{frame}.
  10234. @item shortest
  10235. See @ref{framesync}.
  10236. @item format
  10237. Set the format for the output video.
  10238. It accepts the following values:
  10239. @table @samp
  10240. @item yuv420
  10241. force YUV420 output
  10242. @item yuv422
  10243. force YUV422 output
  10244. @item yuv444
  10245. force YUV444 output
  10246. @item rgb
  10247. force packed RGB output
  10248. @item gbrp
  10249. force planar RGB output
  10250. @item auto
  10251. automatically pick format
  10252. @end table
  10253. Default value is @samp{yuv420}.
  10254. @item repeatlast
  10255. See @ref{framesync}.
  10256. @item alpha
  10257. Set format of alpha of the overlaid video, it can be @var{straight} or
  10258. @var{premultiplied}. Default is @var{straight}.
  10259. @end table
  10260. The @option{x}, and @option{y} expressions can contain the following
  10261. parameters.
  10262. @table @option
  10263. @item main_w, W
  10264. @item main_h, H
  10265. The main input width and height.
  10266. @item overlay_w, w
  10267. @item overlay_h, h
  10268. The overlay input width and height.
  10269. @item x
  10270. @item y
  10271. The computed values for @var{x} and @var{y}. They are evaluated for
  10272. each new frame.
  10273. @item hsub
  10274. @item vsub
  10275. horizontal and vertical chroma subsample values of the output
  10276. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10277. @var{vsub} is 1.
  10278. @item n
  10279. the number of input frame, starting from 0
  10280. @item pos
  10281. the position in the file of the input frame, NAN if unknown
  10282. @item t
  10283. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10284. @end table
  10285. This filter also supports the @ref{framesync} options.
  10286. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10287. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10288. when @option{eval} is set to @samp{init}.
  10289. Be aware that frames are taken from each input video in timestamp
  10290. order, hence, if their initial timestamps differ, it is a good idea
  10291. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10292. have them begin in the same zero timestamp, as the example for
  10293. the @var{movie} filter does.
  10294. You can chain together more overlays but you should test the
  10295. efficiency of such approach.
  10296. @subsection Commands
  10297. This filter supports the following commands:
  10298. @table @option
  10299. @item x
  10300. @item y
  10301. Modify the x and y of the overlay input.
  10302. The command accepts the same syntax of the corresponding option.
  10303. If the specified expression is not valid, it is kept at its current
  10304. value.
  10305. @end table
  10306. @subsection Examples
  10307. @itemize
  10308. @item
  10309. Draw the overlay at 10 pixels from the bottom right corner of the main
  10310. video:
  10311. @example
  10312. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10313. @end example
  10314. Using named options the example above becomes:
  10315. @example
  10316. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10317. @end example
  10318. @item
  10319. Insert a transparent PNG logo in the bottom left corner of the input,
  10320. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10321. @example
  10322. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10323. @end example
  10324. @item
  10325. Insert 2 different transparent PNG logos (second logo on bottom
  10326. right corner) using the @command{ffmpeg} tool:
  10327. @example
  10328. 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
  10329. @end example
  10330. @item
  10331. Add a transparent color layer on top of the main video; @code{WxH}
  10332. must specify the size of the main input to the overlay filter:
  10333. @example
  10334. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10335. @end example
  10336. @item
  10337. Play an original video and a filtered version (here with the deshake
  10338. filter) side by side using the @command{ffplay} tool:
  10339. @example
  10340. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10341. @end example
  10342. The above command is the same as:
  10343. @example
  10344. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10345. @end example
  10346. @item
  10347. Make a sliding overlay appearing from the left to the right top part of the
  10348. screen starting since time 2:
  10349. @example
  10350. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10351. @end example
  10352. @item
  10353. Compose output by putting two input videos side to side:
  10354. @example
  10355. ffmpeg -i left.avi -i right.avi -filter_complex "
  10356. nullsrc=size=200x100 [background];
  10357. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10358. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10359. [background][left] overlay=shortest=1 [background+left];
  10360. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10361. "
  10362. @end example
  10363. @item
  10364. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10365. @example
  10366. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10367. -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]'
  10368. masked.avi
  10369. @end example
  10370. @item
  10371. Chain several overlays in cascade:
  10372. @example
  10373. nullsrc=s=200x200 [bg];
  10374. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10375. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10376. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10377. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10378. [in3] null, [mid2] overlay=100:100 [out0]
  10379. @end example
  10380. @end itemize
  10381. @section owdenoise
  10382. Apply Overcomplete Wavelet denoiser.
  10383. The filter accepts the following options:
  10384. @table @option
  10385. @item depth
  10386. Set depth.
  10387. Larger depth values will denoise lower frequency components more, but
  10388. slow down filtering.
  10389. Must be an int in the range 8-16, default is @code{8}.
  10390. @item luma_strength, ls
  10391. Set luma strength.
  10392. Must be a double value in the range 0-1000, default is @code{1.0}.
  10393. @item chroma_strength, cs
  10394. Set chroma strength.
  10395. Must be a double value in the range 0-1000, default is @code{1.0}.
  10396. @end table
  10397. @anchor{pad}
  10398. @section pad
  10399. Add paddings to the input image, and place the original input at the
  10400. provided @var{x}, @var{y} coordinates.
  10401. It accepts the following parameters:
  10402. @table @option
  10403. @item width, w
  10404. @item height, h
  10405. Specify an expression for the size of the output image with the
  10406. paddings added. If the value for @var{width} or @var{height} is 0, the
  10407. corresponding input size is used for the output.
  10408. The @var{width} expression can reference the value set by the
  10409. @var{height} expression, and vice versa.
  10410. The default value of @var{width} and @var{height} is 0.
  10411. @item x
  10412. @item y
  10413. Specify the offsets to place the input image at within the padded area,
  10414. with respect to the top/left border of the output image.
  10415. The @var{x} expression can reference the value set by the @var{y}
  10416. expression, and vice versa.
  10417. The default value of @var{x} and @var{y} is 0.
  10418. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10419. so the input image is centered on the padded area.
  10420. @item color
  10421. Specify the color of the padded area. For the syntax of this option,
  10422. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10423. manual,ffmpeg-utils}.
  10424. The default value of @var{color} is "black".
  10425. @item eval
  10426. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10427. It accepts the following values:
  10428. @table @samp
  10429. @item init
  10430. Only evaluate expressions once during the filter initialization or when
  10431. a command is processed.
  10432. @item frame
  10433. Evaluate expressions for each incoming frame.
  10434. @end table
  10435. Default value is @samp{init}.
  10436. @item aspect
  10437. Pad to aspect instead to a resolution.
  10438. @end table
  10439. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10440. options are expressions containing the following constants:
  10441. @table @option
  10442. @item in_w
  10443. @item in_h
  10444. The input video width and height.
  10445. @item iw
  10446. @item ih
  10447. These are the same as @var{in_w} and @var{in_h}.
  10448. @item out_w
  10449. @item out_h
  10450. The output width and height (the size of the padded area), as
  10451. specified by the @var{width} and @var{height} expressions.
  10452. @item ow
  10453. @item oh
  10454. These are the same as @var{out_w} and @var{out_h}.
  10455. @item x
  10456. @item y
  10457. The x and y offsets as specified by the @var{x} and @var{y}
  10458. expressions, or NAN if not yet specified.
  10459. @item a
  10460. same as @var{iw} / @var{ih}
  10461. @item sar
  10462. input sample aspect ratio
  10463. @item dar
  10464. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10465. @item hsub
  10466. @item vsub
  10467. The horizontal and vertical chroma subsample values. For example for the
  10468. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10469. @end table
  10470. @subsection Examples
  10471. @itemize
  10472. @item
  10473. Add paddings with the color "violet" to the input video. The output video
  10474. size is 640x480, and the top-left corner of the input video is placed at
  10475. column 0, row 40
  10476. @example
  10477. pad=640:480:0:40:violet
  10478. @end example
  10479. The example above is equivalent to the following command:
  10480. @example
  10481. pad=width=640:height=480:x=0:y=40:color=violet
  10482. @end example
  10483. @item
  10484. Pad the input to get an output with dimensions increased by 3/2,
  10485. and put the input video at the center of the padded area:
  10486. @example
  10487. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10488. @end example
  10489. @item
  10490. Pad the input to get a squared output with size equal to the maximum
  10491. value between the input width and height, and put the input video at
  10492. the center of the padded area:
  10493. @example
  10494. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10495. @end example
  10496. @item
  10497. Pad the input to get a final w/h ratio of 16:9:
  10498. @example
  10499. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10500. @end example
  10501. @item
  10502. In case of anamorphic video, in order to set the output display aspect
  10503. correctly, it is necessary to use @var{sar} in the expression,
  10504. according to the relation:
  10505. @example
  10506. (ih * X / ih) * sar = output_dar
  10507. X = output_dar / sar
  10508. @end example
  10509. Thus the previous example needs to be modified to:
  10510. @example
  10511. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10512. @end example
  10513. @item
  10514. Double the output size and put the input video in the bottom-right
  10515. corner of the output padded area:
  10516. @example
  10517. pad="2*iw:2*ih:ow-iw:oh-ih"
  10518. @end example
  10519. @end itemize
  10520. @anchor{palettegen}
  10521. @section palettegen
  10522. Generate one palette for a whole video stream.
  10523. It accepts the following options:
  10524. @table @option
  10525. @item max_colors
  10526. Set the maximum number of colors to quantize in the palette.
  10527. Note: the palette will still contain 256 colors; the unused palette entries
  10528. will be black.
  10529. @item reserve_transparent
  10530. Create a palette of 255 colors maximum and reserve the last one for
  10531. transparency. Reserving the transparency color is useful for GIF optimization.
  10532. If not set, the maximum of colors in the palette will be 256. You probably want
  10533. to disable this option for a standalone image.
  10534. Set by default.
  10535. @item transparency_color
  10536. Set the color that will be used as background for transparency.
  10537. @item stats_mode
  10538. Set statistics mode.
  10539. It accepts the following values:
  10540. @table @samp
  10541. @item full
  10542. Compute full frame histograms.
  10543. @item diff
  10544. Compute histograms only for the part that differs from previous frame. This
  10545. might be relevant to give more importance to the moving part of your input if
  10546. the background is static.
  10547. @item single
  10548. Compute new histogram for each frame.
  10549. @end table
  10550. Default value is @var{full}.
  10551. @end table
  10552. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10553. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10554. color quantization of the palette. This information is also visible at
  10555. @var{info} logging level.
  10556. @subsection Examples
  10557. @itemize
  10558. @item
  10559. Generate a representative palette of a given video using @command{ffmpeg}:
  10560. @example
  10561. ffmpeg -i input.mkv -vf palettegen palette.png
  10562. @end example
  10563. @end itemize
  10564. @section paletteuse
  10565. Use a palette to downsample an input video stream.
  10566. The filter takes two inputs: one video stream and a palette. The palette must
  10567. be a 256 pixels image.
  10568. It accepts the following options:
  10569. @table @option
  10570. @item dither
  10571. Select dithering mode. Available algorithms are:
  10572. @table @samp
  10573. @item bayer
  10574. Ordered 8x8 bayer dithering (deterministic)
  10575. @item heckbert
  10576. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10577. Note: this dithering is sometimes considered "wrong" and is included as a
  10578. reference.
  10579. @item floyd_steinberg
  10580. Floyd and Steingberg dithering (error diffusion)
  10581. @item sierra2
  10582. Frankie Sierra dithering v2 (error diffusion)
  10583. @item sierra2_4a
  10584. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10585. @end table
  10586. Default is @var{sierra2_4a}.
  10587. @item bayer_scale
  10588. When @var{bayer} dithering is selected, this option defines the scale of the
  10589. pattern (how much the crosshatch pattern is visible). A low value means more
  10590. visible pattern for less banding, and higher value means less visible pattern
  10591. at the cost of more banding.
  10592. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10593. @item diff_mode
  10594. If set, define the zone to process
  10595. @table @samp
  10596. @item rectangle
  10597. Only the changing rectangle will be reprocessed. This is similar to GIF
  10598. cropping/offsetting compression mechanism. This option can be useful for speed
  10599. if only a part of the image is changing, and has use cases such as limiting the
  10600. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10601. moving scene (it leads to more deterministic output if the scene doesn't change
  10602. much, and as a result less moving noise and better GIF compression).
  10603. @end table
  10604. Default is @var{none}.
  10605. @item new
  10606. Take new palette for each output frame.
  10607. @item alpha_threshold
  10608. Sets the alpha threshold for transparency. Alpha values above this threshold
  10609. will be treated as completely opaque, and values below this threshold will be
  10610. treated as completely transparent.
  10611. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10612. @end table
  10613. @subsection Examples
  10614. @itemize
  10615. @item
  10616. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10617. using @command{ffmpeg}:
  10618. @example
  10619. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10620. @end example
  10621. @end itemize
  10622. @section perspective
  10623. Correct perspective of video not recorded perpendicular to the screen.
  10624. A description of the accepted parameters follows.
  10625. @table @option
  10626. @item x0
  10627. @item y0
  10628. @item x1
  10629. @item y1
  10630. @item x2
  10631. @item y2
  10632. @item x3
  10633. @item y3
  10634. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10635. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10636. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10637. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10638. then the corners of the source will be sent to the specified coordinates.
  10639. The expressions can use the following variables:
  10640. @table @option
  10641. @item W
  10642. @item H
  10643. the width and height of video frame.
  10644. @item in
  10645. Input frame count.
  10646. @item on
  10647. Output frame count.
  10648. @end table
  10649. @item interpolation
  10650. Set interpolation for perspective correction.
  10651. It accepts the following values:
  10652. @table @samp
  10653. @item linear
  10654. @item cubic
  10655. @end table
  10656. Default value is @samp{linear}.
  10657. @item sense
  10658. Set interpretation of coordinate options.
  10659. It accepts the following values:
  10660. @table @samp
  10661. @item 0, source
  10662. Send point in the source specified by the given coordinates to
  10663. the corners of the destination.
  10664. @item 1, destination
  10665. Send the corners of the source to the point in the destination specified
  10666. by the given coordinates.
  10667. Default value is @samp{source}.
  10668. @end table
  10669. @item eval
  10670. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10671. It accepts the following values:
  10672. @table @samp
  10673. @item init
  10674. only evaluate expressions once during the filter initialization or
  10675. when a command is processed
  10676. @item frame
  10677. evaluate expressions for each incoming frame
  10678. @end table
  10679. Default value is @samp{init}.
  10680. @end table
  10681. @section phase
  10682. Delay interlaced video by one field time so that the field order changes.
  10683. The intended use is to fix PAL movies that have been captured with the
  10684. opposite field order to the film-to-video transfer.
  10685. A description of the accepted parameters follows.
  10686. @table @option
  10687. @item mode
  10688. Set phase mode.
  10689. It accepts the following values:
  10690. @table @samp
  10691. @item t
  10692. Capture field order top-first, transfer bottom-first.
  10693. Filter will delay the bottom field.
  10694. @item b
  10695. Capture field order bottom-first, transfer top-first.
  10696. Filter will delay the top field.
  10697. @item p
  10698. Capture and transfer with the same field order. This mode only exists
  10699. for the documentation of the other options to refer to, but if you
  10700. actually select it, the filter will faithfully do nothing.
  10701. @item a
  10702. Capture field order determined automatically by field flags, transfer
  10703. opposite.
  10704. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10705. basis using field flags. If no field information is available,
  10706. then this works just like @samp{u}.
  10707. @item u
  10708. Capture unknown or varying, transfer opposite.
  10709. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10710. analyzing the images and selecting the alternative that produces best
  10711. match between the fields.
  10712. @item T
  10713. Capture top-first, transfer unknown or varying.
  10714. Filter selects among @samp{t} and @samp{p} using image analysis.
  10715. @item B
  10716. Capture bottom-first, transfer unknown or varying.
  10717. Filter selects among @samp{b} and @samp{p} using image analysis.
  10718. @item A
  10719. Capture determined by field flags, transfer unknown or varying.
  10720. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10721. image analysis. If no field information is available, then this works just
  10722. like @samp{U}. This is the default mode.
  10723. @item U
  10724. Both capture and transfer unknown or varying.
  10725. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10726. @end table
  10727. @end table
  10728. @section pixdesctest
  10729. Pixel format descriptor test filter, mainly useful for internal
  10730. testing. The output video should be equal to the input video.
  10731. For example:
  10732. @example
  10733. format=monow, pixdesctest
  10734. @end example
  10735. can be used to test the monowhite pixel format descriptor definition.
  10736. @section pixscope
  10737. Display sample values of color channels. Mainly useful for checking color
  10738. and levels. Minimum supported resolution is 640x480.
  10739. The filters accept the following options:
  10740. @table @option
  10741. @item x
  10742. Set scope X position, relative offset on X axis.
  10743. @item y
  10744. Set scope Y position, relative offset on Y axis.
  10745. @item w
  10746. Set scope width.
  10747. @item h
  10748. Set scope height.
  10749. @item o
  10750. Set window opacity. This window also holds statistics about pixel area.
  10751. @item wx
  10752. Set window X position, relative offset on X axis.
  10753. @item wy
  10754. Set window Y position, relative offset on Y axis.
  10755. @end table
  10756. @section pp
  10757. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10758. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10759. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10760. Each subfilter and some options have a short and a long name that can be used
  10761. interchangeably, i.e. dr/dering are the same.
  10762. The filters accept the following options:
  10763. @table @option
  10764. @item subfilters
  10765. Set postprocessing subfilters string.
  10766. @end table
  10767. All subfilters share common options to determine their scope:
  10768. @table @option
  10769. @item a/autoq
  10770. Honor the quality commands for this subfilter.
  10771. @item c/chrom
  10772. Do chrominance filtering, too (default).
  10773. @item y/nochrom
  10774. Do luminance filtering only (no chrominance).
  10775. @item n/noluma
  10776. Do chrominance filtering only (no luminance).
  10777. @end table
  10778. These options can be appended after the subfilter name, separated by a '|'.
  10779. Available subfilters are:
  10780. @table @option
  10781. @item hb/hdeblock[|difference[|flatness]]
  10782. Horizontal deblocking filter
  10783. @table @option
  10784. @item difference
  10785. Difference factor where higher values mean more deblocking (default: @code{32}).
  10786. @item flatness
  10787. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10788. @end table
  10789. @item vb/vdeblock[|difference[|flatness]]
  10790. Vertical deblocking filter
  10791. @table @option
  10792. @item difference
  10793. Difference factor where higher values mean more deblocking (default: @code{32}).
  10794. @item flatness
  10795. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10796. @end table
  10797. @item ha/hadeblock[|difference[|flatness]]
  10798. Accurate horizontal deblocking filter
  10799. @table @option
  10800. @item difference
  10801. Difference factor where higher values mean more deblocking (default: @code{32}).
  10802. @item flatness
  10803. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10804. @end table
  10805. @item va/vadeblock[|difference[|flatness]]
  10806. Accurate vertical deblocking filter
  10807. @table @option
  10808. @item difference
  10809. Difference factor where higher values mean more deblocking (default: @code{32}).
  10810. @item flatness
  10811. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10812. @end table
  10813. @end table
  10814. The horizontal and vertical deblocking filters share the difference and
  10815. flatness values so you cannot set different horizontal and vertical
  10816. thresholds.
  10817. @table @option
  10818. @item h1/x1hdeblock
  10819. Experimental horizontal deblocking filter
  10820. @item v1/x1vdeblock
  10821. Experimental vertical deblocking filter
  10822. @item dr/dering
  10823. Deringing filter
  10824. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10825. @table @option
  10826. @item threshold1
  10827. larger -> stronger filtering
  10828. @item threshold2
  10829. larger -> stronger filtering
  10830. @item threshold3
  10831. larger -> stronger filtering
  10832. @end table
  10833. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10834. @table @option
  10835. @item f/fullyrange
  10836. Stretch luminance to @code{0-255}.
  10837. @end table
  10838. @item lb/linblenddeint
  10839. Linear blend deinterlacing filter that deinterlaces the given block by
  10840. filtering all lines with a @code{(1 2 1)} filter.
  10841. @item li/linipoldeint
  10842. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10843. linearly interpolating every second line.
  10844. @item ci/cubicipoldeint
  10845. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10846. cubically interpolating every second line.
  10847. @item md/mediandeint
  10848. Median deinterlacing filter that deinterlaces the given block by applying a
  10849. median filter to every second line.
  10850. @item fd/ffmpegdeint
  10851. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10852. second line with a @code{(-1 4 2 4 -1)} filter.
  10853. @item l5/lowpass5
  10854. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10855. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10856. @item fq/forceQuant[|quantizer]
  10857. Overrides the quantizer table from the input with the constant quantizer you
  10858. specify.
  10859. @table @option
  10860. @item quantizer
  10861. Quantizer to use
  10862. @end table
  10863. @item de/default
  10864. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10865. @item fa/fast
  10866. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10867. @item ac
  10868. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10869. @end table
  10870. @subsection Examples
  10871. @itemize
  10872. @item
  10873. Apply horizontal and vertical deblocking, deringing and automatic
  10874. brightness/contrast:
  10875. @example
  10876. pp=hb/vb/dr/al
  10877. @end example
  10878. @item
  10879. Apply default filters without brightness/contrast correction:
  10880. @example
  10881. pp=de/-al
  10882. @end example
  10883. @item
  10884. Apply default filters and temporal denoiser:
  10885. @example
  10886. pp=default/tmpnoise|1|2|3
  10887. @end example
  10888. @item
  10889. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10890. automatically depending on available CPU time:
  10891. @example
  10892. pp=hb|y/vb|a
  10893. @end example
  10894. @end itemize
  10895. @section pp7
  10896. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10897. similar to spp = 6 with 7 point DCT, where only the center sample is
  10898. used after IDCT.
  10899. The filter accepts the following options:
  10900. @table @option
  10901. @item qp
  10902. Force a constant quantization parameter. It accepts an integer in range
  10903. 0 to 63. If not set, the filter will use the QP from the video stream
  10904. (if available).
  10905. @item mode
  10906. Set thresholding mode. Available modes are:
  10907. @table @samp
  10908. @item hard
  10909. Set hard thresholding.
  10910. @item soft
  10911. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10912. @item medium
  10913. Set medium thresholding (good results, default).
  10914. @end table
  10915. @end table
  10916. @section premultiply
  10917. Apply alpha premultiply effect to input video stream using first plane
  10918. of second stream as alpha.
  10919. Both streams must have same dimensions and same pixel format.
  10920. The filter accepts the following option:
  10921. @table @option
  10922. @item planes
  10923. Set which planes will be processed, unprocessed planes will be copied.
  10924. By default value 0xf, all planes will be processed.
  10925. @item inplace
  10926. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10927. @end table
  10928. @section prewitt
  10929. Apply prewitt operator to input video stream.
  10930. The filter accepts the following option:
  10931. @table @option
  10932. @item planes
  10933. Set which planes will be processed, unprocessed planes will be copied.
  10934. By default value 0xf, all planes will be processed.
  10935. @item scale
  10936. Set value which will be multiplied with filtered result.
  10937. @item delta
  10938. Set value which will be added to filtered result.
  10939. @end table
  10940. @anchor{program_opencl}
  10941. @section program_opencl
  10942. Filter video using an OpenCL program.
  10943. @table @option
  10944. @item source
  10945. OpenCL program source file.
  10946. @item kernel
  10947. Kernel name in program.
  10948. @item inputs
  10949. Number of inputs to the filter. Defaults to 1.
  10950. @item size, s
  10951. Size of output frames. Defaults to the same as the first input.
  10952. @end table
  10953. The program source file must contain a kernel function with the given name,
  10954. which will be run once for each plane of the output. Each run on a plane
  10955. gets enqueued as a separate 2D global NDRange with one work-item for each
  10956. pixel to be generated. The global ID offset for each work-item is therefore
  10957. the coordinates of a pixel in the destination image.
  10958. The kernel function needs to take the following arguments:
  10959. @itemize
  10960. @item
  10961. Destination image, @var{__write_only image2d_t}.
  10962. This image will become the output; the kernel should write all of it.
  10963. @item
  10964. Frame index, @var{unsigned int}.
  10965. This is a counter starting from zero and increasing by one for each frame.
  10966. @item
  10967. Source images, @var{__read_only image2d_t}.
  10968. These are the most recent images on each input. The kernel may read from
  10969. them to generate the output, but they can't be written to.
  10970. @end itemize
  10971. Example programs:
  10972. @itemize
  10973. @item
  10974. Copy the input to the output (output must be the same size as the input).
  10975. @verbatim
  10976. __kernel void copy(__write_only image2d_t destination,
  10977. unsigned int index,
  10978. __read_only image2d_t source)
  10979. {
  10980. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10981. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10982. float4 value = read_imagef(source, sampler, location);
  10983. write_imagef(destination, location, value);
  10984. }
  10985. @end verbatim
  10986. @item
  10987. Apply a simple transformation, rotating the input by an amount increasing
  10988. with the index counter. Pixel values are linearly interpolated by the
  10989. sampler, and the output need not have the same dimensions as the input.
  10990. @verbatim
  10991. __kernel void rotate_image(__write_only image2d_t dst,
  10992. unsigned int index,
  10993. __read_only image2d_t src)
  10994. {
  10995. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10996. CLK_FILTER_LINEAR);
  10997. float angle = (float)index / 100.0f;
  10998. float2 dst_dim = convert_float2(get_image_dim(dst));
  10999. float2 src_dim = convert_float2(get_image_dim(src));
  11000. float2 dst_cen = dst_dim / 2.0f;
  11001. float2 src_cen = src_dim / 2.0f;
  11002. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11003. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11004. float2 src_pos = {
  11005. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11006. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11007. };
  11008. src_pos = src_pos * src_dim / dst_dim;
  11009. float2 src_loc = src_pos + src_cen;
  11010. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11011. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11012. write_imagef(dst, dst_loc, 0.5f);
  11013. else
  11014. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11015. }
  11016. @end verbatim
  11017. @item
  11018. Blend two inputs together, with the amount of each input used varying
  11019. with the index counter.
  11020. @verbatim
  11021. __kernel void blend_images(__write_only image2d_t dst,
  11022. unsigned int index,
  11023. __read_only image2d_t src1,
  11024. __read_only image2d_t src2)
  11025. {
  11026. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11027. CLK_FILTER_LINEAR);
  11028. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11029. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11030. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11031. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11032. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11033. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11034. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11035. }
  11036. @end verbatim
  11037. @end itemize
  11038. @section pseudocolor
  11039. Alter frame colors in video with pseudocolors.
  11040. This filter accept the following options:
  11041. @table @option
  11042. @item c0
  11043. set pixel first component expression
  11044. @item c1
  11045. set pixel second component expression
  11046. @item c2
  11047. set pixel third component expression
  11048. @item c3
  11049. set pixel fourth component expression, corresponds to the alpha component
  11050. @item i
  11051. set component to use as base for altering colors
  11052. @end table
  11053. Each of them specifies the expression to use for computing the lookup table for
  11054. the corresponding pixel component values.
  11055. The expressions can contain the following constants and functions:
  11056. @table @option
  11057. @item w
  11058. @item h
  11059. The input width and height.
  11060. @item val
  11061. The input value for the pixel component.
  11062. @item ymin, umin, vmin, amin
  11063. The minimum allowed component value.
  11064. @item ymax, umax, vmax, amax
  11065. The maximum allowed component value.
  11066. @end table
  11067. All expressions default to "val".
  11068. @subsection Examples
  11069. @itemize
  11070. @item
  11071. Change too high luma values to gradient:
  11072. @example
  11073. 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'"
  11074. @end example
  11075. @end itemize
  11076. @section psnr
  11077. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11078. Ratio) between two input videos.
  11079. This filter takes in input two input videos, the first input is
  11080. considered the "main" source and is passed unchanged to the
  11081. output. The second input is used as a "reference" video for computing
  11082. the PSNR.
  11083. Both video inputs must have the same resolution and pixel format for
  11084. this filter to work correctly. Also it assumes that both inputs
  11085. have the same number of frames, which are compared one by one.
  11086. The obtained average PSNR is printed through the logging system.
  11087. The filter stores the accumulated MSE (mean squared error) of each
  11088. frame, and at the end of the processing it is averaged across all frames
  11089. equally, and the following formula is applied to obtain the PSNR:
  11090. @example
  11091. PSNR = 10*log10(MAX^2/MSE)
  11092. @end example
  11093. Where MAX is the average of the maximum values of each component of the
  11094. image.
  11095. The description of the accepted parameters follows.
  11096. @table @option
  11097. @item stats_file, f
  11098. If specified the filter will use the named file to save the PSNR of
  11099. each individual frame. When filename equals "-" the data is sent to
  11100. standard output.
  11101. @item stats_version
  11102. Specifies which version of the stats file format to use. Details of
  11103. each format are written below.
  11104. Default value is 1.
  11105. @item stats_add_max
  11106. Determines whether the max value is output to the stats log.
  11107. Default value is 0.
  11108. Requires stats_version >= 2. If this is set and stats_version < 2,
  11109. the filter will return an error.
  11110. @end table
  11111. This filter also supports the @ref{framesync} options.
  11112. The file printed if @var{stats_file} is selected, contains a sequence of
  11113. key/value pairs of the form @var{key}:@var{value} for each compared
  11114. couple of frames.
  11115. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11116. the list of per-frame-pair stats, with key value pairs following the frame
  11117. format with the following parameters:
  11118. @table @option
  11119. @item psnr_log_version
  11120. The version of the log file format. Will match @var{stats_version}.
  11121. @item fields
  11122. A comma separated list of the per-frame-pair parameters included in
  11123. the log.
  11124. @end table
  11125. A description of each shown per-frame-pair parameter follows:
  11126. @table @option
  11127. @item n
  11128. sequential number of the input frame, starting from 1
  11129. @item mse_avg
  11130. Mean Square Error pixel-by-pixel average difference of the compared
  11131. frames, averaged over all the image components.
  11132. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11133. Mean Square Error pixel-by-pixel average difference of the compared
  11134. frames for the component specified by the suffix.
  11135. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11136. Peak Signal to Noise ratio of the compared frames for the component
  11137. specified by the suffix.
  11138. @item max_avg, max_y, max_u, max_v
  11139. Maximum allowed value for each channel, and average over all
  11140. channels.
  11141. @end table
  11142. For example:
  11143. @example
  11144. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11145. [main][ref] psnr="stats_file=stats.log" [out]
  11146. @end example
  11147. On this example the input file being processed is compared with the
  11148. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11149. is stored in @file{stats.log}.
  11150. @anchor{pullup}
  11151. @section pullup
  11152. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11153. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11154. content.
  11155. The pullup filter is designed to take advantage of future context in making
  11156. its decisions. This filter is stateless in the sense that it does not lock
  11157. onto a pattern to follow, but it instead looks forward to the following
  11158. fields in order to identify matches and rebuild progressive frames.
  11159. To produce content with an even framerate, insert the fps filter after
  11160. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11161. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11162. The filter accepts the following options:
  11163. @table @option
  11164. @item jl
  11165. @item jr
  11166. @item jt
  11167. @item jb
  11168. These options set the amount of "junk" to ignore at the left, right, top, and
  11169. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11170. while top and bottom are in units of 2 lines.
  11171. The default is 8 pixels on each side.
  11172. @item sb
  11173. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11174. filter generating an occasional mismatched frame, but it may also cause an
  11175. excessive number of frames to be dropped during high motion sequences.
  11176. Conversely, setting it to -1 will make filter match fields more easily.
  11177. This may help processing of video where there is slight blurring between
  11178. the fields, but may also cause there to be interlaced frames in the output.
  11179. Default value is @code{0}.
  11180. @item mp
  11181. Set the metric plane to use. It accepts the following values:
  11182. @table @samp
  11183. @item l
  11184. Use luma plane.
  11185. @item u
  11186. Use chroma blue plane.
  11187. @item v
  11188. Use chroma red plane.
  11189. @end table
  11190. This option may be set to use chroma plane instead of the default luma plane
  11191. for doing filter's computations. This may improve accuracy on very clean
  11192. source material, but more likely will decrease accuracy, especially if there
  11193. is chroma noise (rainbow effect) or any grayscale video.
  11194. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11195. load and make pullup usable in realtime on slow machines.
  11196. @end table
  11197. For best results (without duplicated frames in the output file) it is
  11198. necessary to change the output frame rate. For example, to inverse
  11199. telecine NTSC input:
  11200. @example
  11201. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11202. @end example
  11203. @section qp
  11204. Change video quantization parameters (QP).
  11205. The filter accepts the following option:
  11206. @table @option
  11207. @item qp
  11208. Set expression for quantization parameter.
  11209. @end table
  11210. The expression is evaluated through the eval API and can contain, among others,
  11211. the following constants:
  11212. @table @var
  11213. @item known
  11214. 1 if index is not 129, 0 otherwise.
  11215. @item qp
  11216. Sequential index starting from -129 to 128.
  11217. @end table
  11218. @subsection Examples
  11219. @itemize
  11220. @item
  11221. Some equation like:
  11222. @example
  11223. qp=2+2*sin(PI*qp)
  11224. @end example
  11225. @end itemize
  11226. @section random
  11227. Flush video frames from internal cache of frames into a random order.
  11228. No frame is discarded.
  11229. Inspired by @ref{frei0r} nervous filter.
  11230. @table @option
  11231. @item frames
  11232. Set size in number of frames of internal cache, in range from @code{2} to
  11233. @code{512}. Default is @code{30}.
  11234. @item seed
  11235. Set seed for random number generator, must be an integer included between
  11236. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11237. less than @code{0}, the filter will try to use a good random seed on a
  11238. best effort basis.
  11239. @end table
  11240. @section readeia608
  11241. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11242. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11243. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11244. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11245. @table @option
  11246. @item lavfi.readeia608.X.cc
  11247. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11248. @item lavfi.readeia608.X.line
  11249. The number of the line on which the EIA-608 data was identified and read.
  11250. @end table
  11251. This filter accepts the following options:
  11252. @table @option
  11253. @item scan_min
  11254. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11255. @item scan_max
  11256. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11257. @item mac
  11258. Set minimal acceptable amplitude change for sync codes detection.
  11259. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11260. @item spw
  11261. Set the ratio of width reserved for sync code detection.
  11262. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11263. @item mhd
  11264. Set the max peaks height difference for sync code detection.
  11265. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11266. @item mpd
  11267. Set max peaks period difference for sync code detection.
  11268. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11269. @item msd
  11270. Set the first two max start code bits differences.
  11271. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11272. @item bhd
  11273. Set the minimum ratio of bits height compared to 3rd start code bit.
  11274. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11275. @item th_w
  11276. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11277. @item th_b
  11278. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11279. @item chp
  11280. Enable checking the parity bit. In the event of a parity error, the filter will output
  11281. @code{0x00} for that character. Default is false.
  11282. @item lp
  11283. Lowpass lines prior further proccessing. Default is disabled.
  11284. @end table
  11285. @subsection Examples
  11286. @itemize
  11287. @item
  11288. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11289. @example
  11290. 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
  11291. @end example
  11292. @end itemize
  11293. @section readvitc
  11294. Read vertical interval timecode (VITC) information from the top lines of a
  11295. video frame.
  11296. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11297. timecode value, if a valid timecode has been detected. Further metadata key
  11298. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11299. timecode data has been found or not.
  11300. This filter accepts the following options:
  11301. @table @option
  11302. @item scan_max
  11303. Set the maximum number of lines to scan for VITC data. If the value is set to
  11304. @code{-1} the full video frame is scanned. Default is @code{45}.
  11305. @item thr_b
  11306. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11307. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11308. @item thr_w
  11309. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11310. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11311. @end table
  11312. @subsection Examples
  11313. @itemize
  11314. @item
  11315. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11316. draw @code{--:--:--:--} as a placeholder:
  11317. @example
  11318. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11319. @end example
  11320. @end itemize
  11321. @section remap
  11322. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11323. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11324. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11325. value for pixel will be used for destination pixel.
  11326. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11327. will have Xmap/Ymap video stream dimensions.
  11328. Xmap and Ymap input video streams are 16bit depth, single channel.
  11329. @table @option
  11330. @item format
  11331. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11332. Default is @code{color}.
  11333. @end table
  11334. @section removegrain
  11335. The removegrain filter is a spatial denoiser for progressive video.
  11336. @table @option
  11337. @item m0
  11338. Set mode for the first plane.
  11339. @item m1
  11340. Set mode for the second plane.
  11341. @item m2
  11342. Set mode for the third plane.
  11343. @item m3
  11344. Set mode for the fourth plane.
  11345. @end table
  11346. Range of mode is from 0 to 24. Description of each mode follows:
  11347. @table @var
  11348. @item 0
  11349. Leave input plane unchanged. Default.
  11350. @item 1
  11351. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11352. @item 2
  11353. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11354. @item 3
  11355. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11356. @item 4
  11357. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11358. This is equivalent to a median filter.
  11359. @item 5
  11360. Line-sensitive clipping giving the minimal change.
  11361. @item 6
  11362. Line-sensitive clipping, intermediate.
  11363. @item 7
  11364. Line-sensitive clipping, intermediate.
  11365. @item 8
  11366. Line-sensitive clipping, intermediate.
  11367. @item 9
  11368. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11369. @item 10
  11370. Replaces the target pixel with the closest neighbour.
  11371. @item 11
  11372. [1 2 1] horizontal and vertical kernel blur.
  11373. @item 12
  11374. Same as mode 11.
  11375. @item 13
  11376. Bob mode, interpolates top field from the line where the neighbours
  11377. pixels are the closest.
  11378. @item 14
  11379. Bob mode, interpolates bottom field from the line where the neighbours
  11380. pixels are the closest.
  11381. @item 15
  11382. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11383. interpolation formula.
  11384. @item 16
  11385. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11386. interpolation formula.
  11387. @item 17
  11388. Clips the pixel with the minimum and maximum of respectively the maximum and
  11389. minimum of each pair of opposite neighbour pixels.
  11390. @item 18
  11391. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11392. the current pixel is minimal.
  11393. @item 19
  11394. Replaces the pixel with the average of its 8 neighbours.
  11395. @item 20
  11396. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11397. @item 21
  11398. Clips pixels using the averages of opposite neighbour.
  11399. @item 22
  11400. Same as mode 21 but simpler and faster.
  11401. @item 23
  11402. Small edge and halo removal, but reputed useless.
  11403. @item 24
  11404. Similar as 23.
  11405. @end table
  11406. @section removelogo
  11407. Suppress a TV station logo, using an image file to determine which
  11408. pixels comprise the logo. It works by filling in the pixels that
  11409. comprise the logo with neighboring pixels.
  11410. The filter accepts the following options:
  11411. @table @option
  11412. @item filename, f
  11413. Set the filter bitmap file, which can be any image format supported by
  11414. libavformat. The width and height of the image file must match those of the
  11415. video stream being processed.
  11416. @end table
  11417. Pixels in the provided bitmap image with a value of zero are not
  11418. considered part of the logo, non-zero pixels are considered part of
  11419. the logo. If you use white (255) for the logo and black (0) for the
  11420. rest, you will be safe. For making the filter bitmap, it is
  11421. recommended to take a screen capture of a black frame with the logo
  11422. visible, and then using a threshold filter followed by the erode
  11423. filter once or twice.
  11424. If needed, little splotches can be fixed manually. Remember that if
  11425. logo pixels are not covered, the filter quality will be much
  11426. reduced. Marking too many pixels as part of the logo does not hurt as
  11427. much, but it will increase the amount of blurring needed to cover over
  11428. the image and will destroy more information than necessary, and extra
  11429. pixels will slow things down on a large logo.
  11430. @section repeatfields
  11431. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11432. fields based on its value.
  11433. @section reverse
  11434. Reverse a video clip.
  11435. Warning: This filter requires memory to buffer the entire clip, so trimming
  11436. is suggested.
  11437. @subsection Examples
  11438. @itemize
  11439. @item
  11440. Take the first 5 seconds of a clip, and reverse it.
  11441. @example
  11442. trim=end=5,reverse
  11443. @end example
  11444. @end itemize
  11445. @section rgbashift
  11446. Shift R/G/B/A pixels horizontally and/or vertically.
  11447. The filter accepts the following options:
  11448. @table @option
  11449. @item rh
  11450. Set amount to shift red horizontally.
  11451. @item rv
  11452. Set amount to shift red vertically.
  11453. @item gh
  11454. Set amount to shift green horizontally.
  11455. @item gv
  11456. Set amount to shift green vertically.
  11457. @item bh
  11458. Set amount to shift blue horizontally.
  11459. @item bv
  11460. Set amount to shift blue vertically.
  11461. @item ah
  11462. Set amount to shift alpha horizontally.
  11463. @item av
  11464. Set amount to shift alpha vertically.
  11465. @item edge
  11466. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11467. @end table
  11468. @section roberts
  11469. Apply roberts cross operator to input video stream.
  11470. The filter accepts the following option:
  11471. @table @option
  11472. @item planes
  11473. Set which planes will be processed, unprocessed planes will be copied.
  11474. By default value 0xf, all planes will be processed.
  11475. @item scale
  11476. Set value which will be multiplied with filtered result.
  11477. @item delta
  11478. Set value which will be added to filtered result.
  11479. @end table
  11480. @section rotate
  11481. Rotate video by an arbitrary angle expressed in radians.
  11482. The filter accepts the following options:
  11483. A description of the optional parameters follows.
  11484. @table @option
  11485. @item angle, a
  11486. Set an expression for the angle by which to rotate the input video
  11487. clockwise, expressed as a number of radians. A negative value will
  11488. result in a counter-clockwise rotation. By default it is set to "0".
  11489. This expression is evaluated for each frame.
  11490. @item out_w, ow
  11491. Set the output width expression, default value is "iw".
  11492. This expression is evaluated just once during configuration.
  11493. @item out_h, oh
  11494. Set the output height expression, default value is "ih".
  11495. This expression is evaluated just once during configuration.
  11496. @item bilinear
  11497. Enable bilinear interpolation if set to 1, a value of 0 disables
  11498. it. Default value is 1.
  11499. @item fillcolor, c
  11500. Set the color used to fill the output area not covered by the rotated
  11501. image. For the general syntax of this option, check the
  11502. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11503. If the special value "none" is selected then no
  11504. background is printed (useful for example if the background is never shown).
  11505. Default value is "black".
  11506. @end table
  11507. The expressions for the angle and the output size can contain the
  11508. following constants and functions:
  11509. @table @option
  11510. @item n
  11511. sequential number of the input frame, starting from 0. It is always NAN
  11512. before the first frame is filtered.
  11513. @item t
  11514. time in seconds of the input frame, it is set to 0 when the filter is
  11515. configured. It is always NAN before the first frame is filtered.
  11516. @item hsub
  11517. @item vsub
  11518. horizontal and vertical chroma subsample values. For example for the
  11519. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11520. @item in_w, iw
  11521. @item in_h, ih
  11522. the input video width and height
  11523. @item out_w, ow
  11524. @item out_h, oh
  11525. the output width and height, that is the size of the padded area as
  11526. specified by the @var{width} and @var{height} expressions
  11527. @item rotw(a)
  11528. @item roth(a)
  11529. the minimal width/height required for completely containing the input
  11530. video rotated by @var{a} radians.
  11531. These are only available when computing the @option{out_w} and
  11532. @option{out_h} expressions.
  11533. @end table
  11534. @subsection Examples
  11535. @itemize
  11536. @item
  11537. Rotate the input by PI/6 radians clockwise:
  11538. @example
  11539. rotate=PI/6
  11540. @end example
  11541. @item
  11542. Rotate the input by PI/6 radians counter-clockwise:
  11543. @example
  11544. rotate=-PI/6
  11545. @end example
  11546. @item
  11547. Rotate the input by 45 degrees clockwise:
  11548. @example
  11549. rotate=45*PI/180
  11550. @end example
  11551. @item
  11552. Apply a constant rotation with period T, starting from an angle of PI/3:
  11553. @example
  11554. rotate=PI/3+2*PI*t/T
  11555. @end example
  11556. @item
  11557. Make the input video rotation oscillating with a period of T
  11558. seconds and an amplitude of A radians:
  11559. @example
  11560. rotate=A*sin(2*PI/T*t)
  11561. @end example
  11562. @item
  11563. Rotate the video, output size is chosen so that the whole rotating
  11564. input video is always completely contained in the output:
  11565. @example
  11566. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11567. @end example
  11568. @item
  11569. Rotate the video, reduce the output size so that no background is ever
  11570. shown:
  11571. @example
  11572. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11573. @end example
  11574. @end itemize
  11575. @subsection Commands
  11576. The filter supports the following commands:
  11577. @table @option
  11578. @item a, angle
  11579. Set the angle expression.
  11580. The command accepts the same syntax of the corresponding option.
  11581. If the specified expression is not valid, it is kept at its current
  11582. value.
  11583. @end table
  11584. @section sab
  11585. Apply Shape Adaptive Blur.
  11586. The filter accepts the following options:
  11587. @table @option
  11588. @item luma_radius, lr
  11589. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11590. value is 1.0. A greater value will result in a more blurred image, and
  11591. in slower processing.
  11592. @item luma_pre_filter_radius, lpfr
  11593. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11594. value is 1.0.
  11595. @item luma_strength, ls
  11596. Set luma maximum difference between pixels to still be considered, must
  11597. be a value in the 0.1-100.0 range, default value is 1.0.
  11598. @item chroma_radius, cr
  11599. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11600. greater value will result in a more blurred image, and in slower
  11601. processing.
  11602. @item chroma_pre_filter_radius, cpfr
  11603. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11604. @item chroma_strength, cs
  11605. Set chroma maximum difference between pixels to still be considered,
  11606. must be a value in the -0.9-100.0 range.
  11607. @end table
  11608. Each chroma option value, if not explicitly specified, is set to the
  11609. corresponding luma option value.
  11610. @anchor{scale}
  11611. @section scale
  11612. Scale (resize) the input video, using the libswscale library.
  11613. The scale filter forces the output display aspect ratio to be the same
  11614. of the input, by changing the output sample aspect ratio.
  11615. If the input image format is different from the format requested by
  11616. the next filter, the scale filter will convert the input to the
  11617. requested format.
  11618. @subsection Options
  11619. The filter accepts the following options, or any of the options
  11620. supported by the libswscale scaler.
  11621. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11622. the complete list of scaler options.
  11623. @table @option
  11624. @item width, w
  11625. @item height, h
  11626. Set the output video dimension expression. Default value is the input
  11627. dimension.
  11628. If the @var{width} or @var{w} value is 0, the input width is used for
  11629. the output. If the @var{height} or @var{h} value is 0, the input height
  11630. is used for the output.
  11631. If one and only one of the values is -n with n >= 1, the scale filter
  11632. will use a value that maintains the aspect ratio of the input image,
  11633. calculated from the other specified dimension. After that it will,
  11634. however, make sure that the calculated dimension is divisible by n and
  11635. adjust the value if necessary.
  11636. If both values are -n with n >= 1, the behavior will be identical to
  11637. both values being set to 0 as previously detailed.
  11638. See below for the list of accepted constants for use in the dimension
  11639. expression.
  11640. @item eval
  11641. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11642. @table @samp
  11643. @item init
  11644. Only evaluate expressions once during the filter initialization or when a command is processed.
  11645. @item frame
  11646. Evaluate expressions for each incoming frame.
  11647. @end table
  11648. Default value is @samp{init}.
  11649. @item interl
  11650. Set the interlacing mode. It accepts the following values:
  11651. @table @samp
  11652. @item 1
  11653. Force interlaced aware scaling.
  11654. @item 0
  11655. Do not apply interlaced scaling.
  11656. @item -1
  11657. Select interlaced aware scaling depending on whether the source frames
  11658. are flagged as interlaced or not.
  11659. @end table
  11660. Default value is @samp{0}.
  11661. @item flags
  11662. Set libswscale scaling flags. See
  11663. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11664. complete list of values. If not explicitly specified the filter applies
  11665. the default flags.
  11666. @item param0, param1
  11667. Set libswscale input parameters for scaling algorithms that need them. See
  11668. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11669. complete documentation. If not explicitly specified the filter applies
  11670. empty parameters.
  11671. @item size, s
  11672. Set the video size. For the syntax of this option, check the
  11673. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11674. @item in_color_matrix
  11675. @item out_color_matrix
  11676. Set in/output YCbCr color space type.
  11677. This allows the autodetected value to be overridden as well as allows forcing
  11678. a specific value used for the output and encoder.
  11679. If not specified, the color space type depends on the pixel format.
  11680. Possible values:
  11681. @table @samp
  11682. @item auto
  11683. Choose automatically.
  11684. @item bt709
  11685. Format conforming to International Telecommunication Union (ITU)
  11686. Recommendation BT.709.
  11687. @item fcc
  11688. Set color space conforming to the United States Federal Communications
  11689. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11690. @item bt601
  11691. @item bt470
  11692. @item smpte170m
  11693. Set color space conforming to:
  11694. @itemize
  11695. @item
  11696. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11697. @item
  11698. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11699. @item
  11700. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11701. @end itemize
  11702. @item smpte240m
  11703. Set color space conforming to SMPTE ST 240:1999.
  11704. @item bt2020
  11705. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11706. @end table
  11707. @item in_range
  11708. @item out_range
  11709. Set in/output YCbCr sample range.
  11710. This allows the autodetected value to be overridden as well as allows forcing
  11711. a specific value used for the output and encoder. If not specified, the
  11712. range depends on the pixel format. Possible values:
  11713. @table @samp
  11714. @item auto/unknown
  11715. Choose automatically.
  11716. @item jpeg/full/pc
  11717. Set full range (0-255 in case of 8-bit luma).
  11718. @item mpeg/limited/tv
  11719. Set "MPEG" range (16-235 in case of 8-bit luma).
  11720. @end table
  11721. @item force_original_aspect_ratio
  11722. Enable decreasing or increasing output video width or height if necessary to
  11723. keep the original aspect ratio. Possible values:
  11724. @table @samp
  11725. @item disable
  11726. Scale the video as specified and disable this feature.
  11727. @item decrease
  11728. The output video dimensions will automatically be decreased if needed.
  11729. @item increase
  11730. The output video dimensions will automatically be increased if needed.
  11731. @end table
  11732. One useful instance of this option is that when you know a specific device's
  11733. maximum allowed resolution, you can use this to limit the output video to
  11734. that, while retaining the aspect ratio. For example, device A allows
  11735. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11736. decrease) and specifying 1280x720 to the command line makes the output
  11737. 1280x533.
  11738. Please note that this is a different thing than specifying -1 for @option{w}
  11739. or @option{h}, you still need to specify the output resolution for this option
  11740. to work.
  11741. @item force_divisible_by Ensures that the output resolution is divisible by the
  11742. given integer when used together with @option{force_original_aspect_ratio}. This
  11743. works similar to using -n in the @option{w} and @option{h} options.
  11744. This option respects the value set for @option{force_original_aspect_ratio},
  11745. increasing or decreasing the resolution accordingly. This may slightly modify
  11746. the video's aspect ration.
  11747. This can be handy, for example, if you want to have a video fit within a defined
  11748. resolution using the @option{force_original_aspect_ratio} option but have
  11749. encoder restrictions when it comes to width or height.
  11750. @end table
  11751. The values of the @option{w} and @option{h} options are expressions
  11752. containing the following constants:
  11753. @table @var
  11754. @item in_w
  11755. @item in_h
  11756. The input width and height
  11757. @item iw
  11758. @item ih
  11759. These are the same as @var{in_w} and @var{in_h}.
  11760. @item out_w
  11761. @item out_h
  11762. The output (scaled) width and height
  11763. @item ow
  11764. @item oh
  11765. These are the same as @var{out_w} and @var{out_h}
  11766. @item a
  11767. The same as @var{iw} / @var{ih}
  11768. @item sar
  11769. input sample aspect ratio
  11770. @item dar
  11771. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11772. @item hsub
  11773. @item vsub
  11774. horizontal and vertical input chroma subsample values. For example for the
  11775. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11776. @item ohsub
  11777. @item ovsub
  11778. horizontal and vertical output chroma subsample values. For example for the
  11779. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11780. @end table
  11781. @subsection Examples
  11782. @itemize
  11783. @item
  11784. Scale the input video to a size of 200x100
  11785. @example
  11786. scale=w=200:h=100
  11787. @end example
  11788. This is equivalent to:
  11789. @example
  11790. scale=200:100
  11791. @end example
  11792. or:
  11793. @example
  11794. scale=200x100
  11795. @end example
  11796. @item
  11797. Specify a size abbreviation for the output size:
  11798. @example
  11799. scale=qcif
  11800. @end example
  11801. which can also be written as:
  11802. @example
  11803. scale=size=qcif
  11804. @end example
  11805. @item
  11806. Scale the input to 2x:
  11807. @example
  11808. scale=w=2*iw:h=2*ih
  11809. @end example
  11810. @item
  11811. The above is the same as:
  11812. @example
  11813. scale=2*in_w:2*in_h
  11814. @end example
  11815. @item
  11816. Scale the input to 2x with forced interlaced scaling:
  11817. @example
  11818. scale=2*iw:2*ih:interl=1
  11819. @end example
  11820. @item
  11821. Scale the input to half size:
  11822. @example
  11823. scale=w=iw/2:h=ih/2
  11824. @end example
  11825. @item
  11826. Increase the width, and set the height to the same size:
  11827. @example
  11828. scale=3/2*iw:ow
  11829. @end example
  11830. @item
  11831. Seek Greek harmony:
  11832. @example
  11833. scale=iw:1/PHI*iw
  11834. scale=ih*PHI:ih
  11835. @end example
  11836. @item
  11837. Increase the height, and set the width to 3/2 of the height:
  11838. @example
  11839. scale=w=3/2*oh:h=3/5*ih
  11840. @end example
  11841. @item
  11842. Increase the size, making the size a multiple of the chroma
  11843. subsample values:
  11844. @example
  11845. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11846. @end example
  11847. @item
  11848. Increase the width to a maximum of 500 pixels,
  11849. keeping the same aspect ratio as the input:
  11850. @example
  11851. scale=w='min(500\, iw*3/2):h=-1'
  11852. @end example
  11853. @item
  11854. Make pixels square by combining scale and setsar:
  11855. @example
  11856. scale='trunc(ih*dar):ih',setsar=1/1
  11857. @end example
  11858. @item
  11859. Make pixels square by combining scale and setsar,
  11860. making sure the resulting resolution is even (required by some codecs):
  11861. @example
  11862. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11863. @end example
  11864. @end itemize
  11865. @subsection Commands
  11866. This filter supports the following commands:
  11867. @table @option
  11868. @item width, w
  11869. @item height, h
  11870. Set the output video dimension expression.
  11871. The command accepts the same syntax of the corresponding option.
  11872. If the specified expression is not valid, it is kept at its current
  11873. value.
  11874. @end table
  11875. @section scale_npp
  11876. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11877. format conversion on CUDA video frames. Setting the output width and height
  11878. works in the same way as for the @var{scale} filter.
  11879. The following additional options are accepted:
  11880. @table @option
  11881. @item format
  11882. The pixel format of the output CUDA frames. If set to the string "same" (the
  11883. default), the input format will be kept. Note that automatic format negotiation
  11884. and conversion is not yet supported for hardware frames
  11885. @item interp_algo
  11886. The interpolation algorithm used for resizing. One of the following:
  11887. @table @option
  11888. @item nn
  11889. Nearest neighbour.
  11890. @item linear
  11891. @item cubic
  11892. @item cubic2p_bspline
  11893. 2-parameter cubic (B=1, C=0)
  11894. @item cubic2p_catmullrom
  11895. 2-parameter cubic (B=0, C=1/2)
  11896. @item cubic2p_b05c03
  11897. 2-parameter cubic (B=1/2, C=3/10)
  11898. @item super
  11899. Supersampling
  11900. @item lanczos
  11901. @end table
  11902. @end table
  11903. @section scale2ref
  11904. Scale (resize) the input video, based on a reference video.
  11905. See the scale filter for available options, scale2ref supports the same but
  11906. uses the reference video instead of the main input as basis. scale2ref also
  11907. supports the following additional constants for the @option{w} and
  11908. @option{h} options:
  11909. @table @var
  11910. @item main_w
  11911. @item main_h
  11912. The main input video's width and height
  11913. @item main_a
  11914. The same as @var{main_w} / @var{main_h}
  11915. @item main_sar
  11916. The main input video's sample aspect ratio
  11917. @item main_dar, mdar
  11918. The main input video's display aspect ratio. Calculated from
  11919. @code{(main_w / main_h) * main_sar}.
  11920. @item main_hsub
  11921. @item main_vsub
  11922. The main input video's horizontal and vertical chroma subsample values.
  11923. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11924. is 1.
  11925. @end table
  11926. @subsection Examples
  11927. @itemize
  11928. @item
  11929. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11930. @example
  11931. 'scale2ref[b][a];[a][b]overlay'
  11932. @end example
  11933. @item
  11934. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11935. @example
  11936. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11937. @end example
  11938. @end itemize
  11939. @anchor{selectivecolor}
  11940. @section selectivecolor
  11941. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11942. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11943. by the "purity" of the color (that is, how saturated it already is).
  11944. This filter is similar to the Adobe Photoshop Selective Color tool.
  11945. The filter accepts the following options:
  11946. @table @option
  11947. @item correction_method
  11948. Select color correction method.
  11949. Available values are:
  11950. @table @samp
  11951. @item absolute
  11952. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11953. component value).
  11954. @item relative
  11955. Specified adjustments are relative to the original component value.
  11956. @end table
  11957. Default is @code{absolute}.
  11958. @item reds
  11959. Adjustments for red pixels (pixels where the red component is the maximum)
  11960. @item yellows
  11961. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11962. @item greens
  11963. Adjustments for green pixels (pixels where the green component is the maximum)
  11964. @item cyans
  11965. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11966. @item blues
  11967. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11968. @item magentas
  11969. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11970. @item whites
  11971. Adjustments for white pixels (pixels where all components are greater than 128)
  11972. @item neutrals
  11973. Adjustments for all pixels except pure black and pure white
  11974. @item blacks
  11975. Adjustments for black pixels (pixels where all components are lesser than 128)
  11976. @item psfile
  11977. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11978. @end table
  11979. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11980. 4 space separated floating point adjustment values in the [-1,1] range,
  11981. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11982. pixels of its range.
  11983. @subsection Examples
  11984. @itemize
  11985. @item
  11986. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11987. increase magenta by 27% in blue areas:
  11988. @example
  11989. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11990. @end example
  11991. @item
  11992. Use a Photoshop selective color preset:
  11993. @example
  11994. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11995. @end example
  11996. @end itemize
  11997. @anchor{separatefields}
  11998. @section separatefields
  11999. The @code{separatefields} takes a frame-based video input and splits
  12000. each frame into its components fields, producing a new half height clip
  12001. with twice the frame rate and twice the frame count.
  12002. This filter use field-dominance information in frame to decide which
  12003. of each pair of fields to place first in the output.
  12004. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12005. @section setdar, setsar
  12006. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12007. output video.
  12008. This is done by changing the specified Sample (aka Pixel) Aspect
  12009. Ratio, according to the following equation:
  12010. @example
  12011. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12012. @end example
  12013. Keep in mind that the @code{setdar} filter does not modify the pixel
  12014. dimensions of the video frame. Also, the display aspect ratio set by
  12015. this filter may be changed by later filters in the filterchain,
  12016. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12017. applied.
  12018. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12019. the filter output video.
  12020. Note that as a consequence of the application of this filter, the
  12021. output display aspect ratio will change according to the equation
  12022. above.
  12023. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12024. filter may be changed by later filters in the filterchain, e.g. if
  12025. another "setsar" or a "setdar" filter is applied.
  12026. It accepts the following parameters:
  12027. @table @option
  12028. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12029. Set the aspect ratio used by the filter.
  12030. The parameter can be a floating point number string, an expression, or
  12031. a string of the form @var{num}:@var{den}, where @var{num} and
  12032. @var{den} are the numerator and denominator of the aspect ratio. If
  12033. the parameter is not specified, it is assumed the value "0".
  12034. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12035. should be escaped.
  12036. @item max
  12037. Set the maximum integer value to use for expressing numerator and
  12038. denominator when reducing the expressed aspect ratio to a rational.
  12039. Default value is @code{100}.
  12040. @end table
  12041. The parameter @var{sar} is an expression containing
  12042. the following constants:
  12043. @table @option
  12044. @item E, PI, PHI
  12045. These are approximated values for the mathematical constants e
  12046. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12047. @item w, h
  12048. The input width and height.
  12049. @item a
  12050. These are the same as @var{w} / @var{h}.
  12051. @item sar
  12052. The input sample aspect ratio.
  12053. @item dar
  12054. The input display aspect ratio. It is the same as
  12055. (@var{w} / @var{h}) * @var{sar}.
  12056. @item hsub, vsub
  12057. Horizontal and vertical chroma subsample values. For example, for the
  12058. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12059. @end table
  12060. @subsection Examples
  12061. @itemize
  12062. @item
  12063. To change the display aspect ratio to 16:9, specify one of the following:
  12064. @example
  12065. setdar=dar=1.77777
  12066. setdar=dar=16/9
  12067. @end example
  12068. @item
  12069. To change the sample aspect ratio to 10:11, specify:
  12070. @example
  12071. setsar=sar=10/11
  12072. @end example
  12073. @item
  12074. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12075. 1000 in the aspect ratio reduction, use the command:
  12076. @example
  12077. setdar=ratio=16/9:max=1000
  12078. @end example
  12079. @end itemize
  12080. @anchor{setfield}
  12081. @section setfield
  12082. Force field for the output video frame.
  12083. The @code{setfield} filter marks the interlace type field for the
  12084. output frames. It does not change the input frame, but only sets the
  12085. corresponding property, which affects how the frame is treated by
  12086. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12087. The filter accepts the following options:
  12088. @table @option
  12089. @item mode
  12090. Available values are:
  12091. @table @samp
  12092. @item auto
  12093. Keep the same field property.
  12094. @item bff
  12095. Mark the frame as bottom-field-first.
  12096. @item tff
  12097. Mark the frame as top-field-first.
  12098. @item prog
  12099. Mark the frame as progressive.
  12100. @end table
  12101. @end table
  12102. @anchor{setparams}
  12103. @section setparams
  12104. Force frame parameter for the output video frame.
  12105. The @code{setparams} filter marks interlace and color range for the
  12106. output frames. It does not change the input frame, but only sets the
  12107. corresponding property, which affects how the frame is treated by
  12108. filters/encoders.
  12109. @table @option
  12110. @item field_mode
  12111. Available values are:
  12112. @table @samp
  12113. @item auto
  12114. Keep the same field property (default).
  12115. @item bff
  12116. Mark the frame as bottom-field-first.
  12117. @item tff
  12118. Mark the frame as top-field-first.
  12119. @item prog
  12120. Mark the frame as progressive.
  12121. @end table
  12122. @item range
  12123. Available values are:
  12124. @table @samp
  12125. @item auto
  12126. Keep the same color range property (default).
  12127. @item unspecified, unknown
  12128. Mark the frame as unspecified color range.
  12129. @item limited, tv, mpeg
  12130. Mark the frame as limited range.
  12131. @item full, pc, jpeg
  12132. Mark the frame as full range.
  12133. @end table
  12134. @item color_primaries
  12135. Set the color primaries.
  12136. Available values are:
  12137. @table @samp
  12138. @item auto
  12139. Keep the same color primaries property (default).
  12140. @item bt709
  12141. @item unknown
  12142. @item bt470m
  12143. @item bt470bg
  12144. @item smpte170m
  12145. @item smpte240m
  12146. @item film
  12147. @item bt2020
  12148. @item smpte428
  12149. @item smpte431
  12150. @item smpte432
  12151. @item jedec-p22
  12152. @end table
  12153. @item color_trc
  12154. Set the color transfer.
  12155. Available values are:
  12156. @table @samp
  12157. @item auto
  12158. Keep the same color trc property (default).
  12159. @item bt709
  12160. @item unknown
  12161. @item bt470m
  12162. @item bt470bg
  12163. @item smpte170m
  12164. @item smpte240m
  12165. @item linear
  12166. @item log100
  12167. @item log316
  12168. @item iec61966-2-4
  12169. @item bt1361e
  12170. @item iec61966-2-1
  12171. @item bt2020-10
  12172. @item bt2020-12
  12173. @item smpte2084
  12174. @item smpte428
  12175. @item arib-std-b67
  12176. @end table
  12177. @item colorspace
  12178. Set the colorspace.
  12179. Available values are:
  12180. @table @samp
  12181. @item auto
  12182. Keep the same colorspace property (default).
  12183. @item gbr
  12184. @item bt709
  12185. @item unknown
  12186. @item fcc
  12187. @item bt470bg
  12188. @item smpte170m
  12189. @item smpte240m
  12190. @item ycgco
  12191. @item bt2020nc
  12192. @item bt2020c
  12193. @item smpte2085
  12194. @item chroma-derived-nc
  12195. @item chroma-derived-c
  12196. @item ictcp
  12197. @end table
  12198. @end table
  12199. @section showinfo
  12200. Show a line containing various information for each input video frame.
  12201. The input video is not modified.
  12202. This filter supports the following options:
  12203. @table @option
  12204. @item checksum
  12205. Calculate checksums of each plane. By default enabled.
  12206. @end table
  12207. The shown line contains a sequence of key/value pairs of the form
  12208. @var{key}:@var{value}.
  12209. The following values are shown in the output:
  12210. @table @option
  12211. @item n
  12212. The (sequential) number of the input frame, starting from 0.
  12213. @item pts
  12214. The Presentation TimeStamp of the input frame, expressed as a number of
  12215. time base units. The time base unit depends on the filter input pad.
  12216. @item pts_time
  12217. The Presentation TimeStamp of the input frame, expressed as a number of
  12218. seconds.
  12219. @item pos
  12220. The position of the frame in the input stream, or -1 if this information is
  12221. unavailable and/or meaningless (for example in case of synthetic video).
  12222. @item fmt
  12223. The pixel format name.
  12224. @item sar
  12225. The sample aspect ratio of the input frame, expressed in the form
  12226. @var{num}/@var{den}.
  12227. @item s
  12228. The size of the input frame. For the syntax of this option, check the
  12229. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12230. @item i
  12231. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12232. for bottom field first).
  12233. @item iskey
  12234. This is 1 if the frame is a key frame, 0 otherwise.
  12235. @item type
  12236. The picture type of the input frame ("I" for an I-frame, "P" for a
  12237. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12238. Also refer to the documentation of the @code{AVPictureType} enum and of
  12239. the @code{av_get_picture_type_char} function defined in
  12240. @file{libavutil/avutil.h}.
  12241. @item checksum
  12242. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12243. @item plane_checksum
  12244. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12245. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12246. @end table
  12247. @section showpalette
  12248. Displays the 256 colors palette of each frame. This filter is only relevant for
  12249. @var{pal8} pixel format frames.
  12250. It accepts the following option:
  12251. @table @option
  12252. @item s
  12253. Set the size of the box used to represent one palette color entry. Default is
  12254. @code{30} (for a @code{30x30} pixel box).
  12255. @end table
  12256. @section shuffleframes
  12257. Reorder and/or duplicate and/or drop video frames.
  12258. It accepts the following parameters:
  12259. @table @option
  12260. @item mapping
  12261. Set the destination indexes of input frames.
  12262. This is space or '|' separated list of indexes that maps input frames to output
  12263. frames. Number of indexes also sets maximal value that each index may have.
  12264. '-1' index have special meaning and that is to drop frame.
  12265. @end table
  12266. The first frame has the index 0. The default is to keep the input unchanged.
  12267. @subsection Examples
  12268. @itemize
  12269. @item
  12270. Swap second and third frame of every three frames of the input:
  12271. @example
  12272. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12273. @end example
  12274. @item
  12275. Swap 10th and 1st frame of every ten frames of the input:
  12276. @example
  12277. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12278. @end example
  12279. @end itemize
  12280. @section shuffleplanes
  12281. Reorder and/or duplicate video planes.
  12282. It accepts the following parameters:
  12283. @table @option
  12284. @item map0
  12285. The index of the input plane to be used as the first output plane.
  12286. @item map1
  12287. The index of the input plane to be used as the second output plane.
  12288. @item map2
  12289. The index of the input plane to be used as the third output plane.
  12290. @item map3
  12291. The index of the input plane to be used as the fourth output plane.
  12292. @end table
  12293. The first plane has the index 0. The default is to keep the input unchanged.
  12294. @subsection Examples
  12295. @itemize
  12296. @item
  12297. Swap the second and third planes of the input:
  12298. @example
  12299. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12300. @end example
  12301. @end itemize
  12302. @anchor{signalstats}
  12303. @section signalstats
  12304. Evaluate various visual metrics that assist in determining issues associated
  12305. with the digitization of analog video media.
  12306. By default the filter will log these metadata values:
  12307. @table @option
  12308. @item YMIN
  12309. Display the minimal Y value contained within the input frame. Expressed in
  12310. range of [0-255].
  12311. @item YLOW
  12312. Display the Y value at the 10% percentile within the input frame. Expressed in
  12313. range of [0-255].
  12314. @item YAVG
  12315. Display the average Y value within the input frame. Expressed in range of
  12316. [0-255].
  12317. @item YHIGH
  12318. Display the Y value at the 90% percentile within the input frame. Expressed in
  12319. range of [0-255].
  12320. @item YMAX
  12321. Display the maximum Y value contained within the input frame. Expressed in
  12322. range of [0-255].
  12323. @item UMIN
  12324. Display the minimal U value contained within the input frame. Expressed in
  12325. range of [0-255].
  12326. @item ULOW
  12327. Display the U value at the 10% percentile within the input frame. Expressed in
  12328. range of [0-255].
  12329. @item UAVG
  12330. Display the average U value within the input frame. Expressed in range of
  12331. [0-255].
  12332. @item UHIGH
  12333. Display the U value at the 90% percentile within the input frame. Expressed in
  12334. range of [0-255].
  12335. @item UMAX
  12336. Display the maximum U value contained within the input frame. Expressed in
  12337. range of [0-255].
  12338. @item VMIN
  12339. Display the minimal V value contained within the input frame. Expressed in
  12340. range of [0-255].
  12341. @item VLOW
  12342. Display the V value at the 10% percentile within the input frame. Expressed in
  12343. range of [0-255].
  12344. @item VAVG
  12345. Display the average V value within the input frame. Expressed in range of
  12346. [0-255].
  12347. @item VHIGH
  12348. Display the V value at the 90% percentile within the input frame. Expressed in
  12349. range of [0-255].
  12350. @item VMAX
  12351. Display the maximum V value contained within the input frame. Expressed in
  12352. range of [0-255].
  12353. @item SATMIN
  12354. Display the minimal saturation value contained within the input frame.
  12355. Expressed in range of [0-~181.02].
  12356. @item SATLOW
  12357. Display the saturation value at the 10% percentile within the input frame.
  12358. Expressed in range of [0-~181.02].
  12359. @item SATAVG
  12360. Display the average saturation value within the input frame. Expressed in range
  12361. of [0-~181.02].
  12362. @item SATHIGH
  12363. Display the saturation value at the 90% percentile within the input frame.
  12364. Expressed in range of [0-~181.02].
  12365. @item SATMAX
  12366. Display the maximum saturation value contained within the input frame.
  12367. Expressed in range of [0-~181.02].
  12368. @item HUEMED
  12369. Display the median value for hue within the input frame. Expressed in range of
  12370. [0-360].
  12371. @item HUEAVG
  12372. Display the average value for hue within the input frame. Expressed in range of
  12373. [0-360].
  12374. @item YDIF
  12375. Display the average of sample value difference between all values of the Y
  12376. plane in the current frame and corresponding values of the previous input frame.
  12377. Expressed in range of [0-255].
  12378. @item UDIF
  12379. Display the average of sample value difference between all values of the U
  12380. plane in the current frame and corresponding values of the previous input frame.
  12381. Expressed in range of [0-255].
  12382. @item VDIF
  12383. Display the average of sample value difference between all values of the V
  12384. plane in the current frame and corresponding values of the previous input frame.
  12385. Expressed in range of [0-255].
  12386. @item YBITDEPTH
  12387. Display bit depth of Y plane in current frame.
  12388. Expressed in range of [0-16].
  12389. @item UBITDEPTH
  12390. Display bit depth of U plane in current frame.
  12391. Expressed in range of [0-16].
  12392. @item VBITDEPTH
  12393. Display bit depth of V plane in current frame.
  12394. Expressed in range of [0-16].
  12395. @end table
  12396. The filter accepts the following options:
  12397. @table @option
  12398. @item stat
  12399. @item out
  12400. @option{stat} specify an additional form of image analysis.
  12401. @option{out} output video with the specified type of pixel highlighted.
  12402. Both options accept the following values:
  12403. @table @samp
  12404. @item tout
  12405. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12406. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12407. include the results of video dropouts, head clogs, or tape tracking issues.
  12408. @item vrep
  12409. Identify @var{vertical line repetition}. Vertical line repetition includes
  12410. similar rows of pixels within a frame. In born-digital video vertical line
  12411. repetition is common, but this pattern is uncommon in video digitized from an
  12412. analog source. When it occurs in video that results from the digitization of an
  12413. analog source it can indicate concealment from a dropout compensator.
  12414. @item brng
  12415. Identify pixels that fall outside of legal broadcast range.
  12416. @end table
  12417. @item color, c
  12418. Set the highlight color for the @option{out} option. The default color is
  12419. yellow.
  12420. @end table
  12421. @subsection Examples
  12422. @itemize
  12423. @item
  12424. Output data of various video metrics:
  12425. @example
  12426. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12427. @end example
  12428. @item
  12429. Output specific data about the minimum and maximum values of the Y plane per frame:
  12430. @example
  12431. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12432. @end example
  12433. @item
  12434. Playback video while highlighting pixels that are outside of broadcast range in red.
  12435. @example
  12436. ffplay example.mov -vf signalstats="out=brng:color=red"
  12437. @end example
  12438. @item
  12439. Playback video with signalstats metadata drawn over the frame.
  12440. @example
  12441. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12442. @end example
  12443. The contents of signalstat_drawtext.txt used in the command are:
  12444. @example
  12445. time %@{pts:hms@}
  12446. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12447. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12448. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12449. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12450. @end example
  12451. @end itemize
  12452. @anchor{signature}
  12453. @section signature
  12454. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12455. input. In this case the matching between the inputs can be calculated additionally.
  12456. The filter always passes through the first input. The signature of each stream can
  12457. be written into a file.
  12458. It accepts the following options:
  12459. @table @option
  12460. @item detectmode
  12461. Enable or disable the matching process.
  12462. Available values are:
  12463. @table @samp
  12464. @item off
  12465. Disable the calculation of a matching (default).
  12466. @item full
  12467. Calculate the matching for the whole video and output whether the whole video
  12468. matches or only parts.
  12469. @item fast
  12470. Calculate only until a matching is found or the video ends. Should be faster in
  12471. some cases.
  12472. @end table
  12473. @item nb_inputs
  12474. Set the number of inputs. The option value must be a non negative integer.
  12475. Default value is 1.
  12476. @item filename
  12477. Set the path to which the output is written. If there is more than one input,
  12478. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12479. integer), that will be replaced with the input number. If no filename is
  12480. specified, no output will be written. This is the default.
  12481. @item format
  12482. Choose the output format.
  12483. Available values are:
  12484. @table @samp
  12485. @item binary
  12486. Use the specified binary representation (default).
  12487. @item xml
  12488. Use the specified xml representation.
  12489. @end table
  12490. @item th_d
  12491. Set threshold to detect one word as similar. The option value must be an integer
  12492. greater than zero. The default value is 9000.
  12493. @item th_dc
  12494. Set threshold to detect all words as similar. The option value must be an integer
  12495. greater than zero. The default value is 60000.
  12496. @item th_xh
  12497. Set threshold to detect frames as similar. The option value must be an integer
  12498. greater than zero. The default value is 116.
  12499. @item th_di
  12500. Set the minimum length of a sequence in frames to recognize it as matching
  12501. sequence. The option value must be a non negative integer value.
  12502. The default value is 0.
  12503. @item th_it
  12504. Set the minimum relation, that matching frames to all frames must have.
  12505. The option value must be a double value between 0 and 1. The default value is 0.5.
  12506. @end table
  12507. @subsection Examples
  12508. @itemize
  12509. @item
  12510. To calculate the signature of an input video and store it in signature.bin:
  12511. @example
  12512. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12513. @end example
  12514. @item
  12515. To detect whether two videos match and store the signatures in XML format in
  12516. signature0.xml and signature1.xml:
  12517. @example
  12518. 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 -
  12519. @end example
  12520. @end itemize
  12521. @anchor{smartblur}
  12522. @section smartblur
  12523. Blur the input video without impacting the outlines.
  12524. It accepts the following options:
  12525. @table @option
  12526. @item luma_radius, lr
  12527. Set the luma radius. The option value must be a float number in
  12528. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12529. used to blur the image (slower if larger). Default value is 1.0.
  12530. @item luma_strength, ls
  12531. Set the luma strength. The option value must be a float number
  12532. in the range [-1.0,1.0] that configures the blurring. A value included
  12533. in [0.0,1.0] will blur the image whereas a value included in
  12534. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12535. @item luma_threshold, lt
  12536. Set the luma threshold used as a coefficient to determine
  12537. whether a pixel should be blurred or not. The option value must be an
  12538. integer in the range [-30,30]. A value of 0 will filter all the image,
  12539. a value included in [0,30] will filter flat areas and a value included
  12540. in [-30,0] will filter edges. Default value is 0.
  12541. @item chroma_radius, cr
  12542. Set the chroma radius. The option value must be a float number in
  12543. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12544. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12545. @item chroma_strength, cs
  12546. Set the chroma strength. The option value must be a float number
  12547. in the range [-1.0,1.0] that configures the blurring. A value included
  12548. in [0.0,1.0] will blur the image whereas a value included in
  12549. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12550. @item chroma_threshold, ct
  12551. Set the chroma threshold used as a coefficient to determine
  12552. whether a pixel should be blurred or not. The option value must be an
  12553. integer in the range [-30,30]. A value of 0 will filter all the image,
  12554. a value included in [0,30] will filter flat areas and a value included
  12555. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12556. @end table
  12557. If a chroma option is not explicitly set, the corresponding luma value
  12558. is set.
  12559. @section sobel
  12560. Apply sobel operator to input video stream.
  12561. The filter accepts the following option:
  12562. @table @option
  12563. @item planes
  12564. Set which planes will be processed, unprocessed planes will be copied.
  12565. By default value 0xf, all planes will be processed.
  12566. @item scale
  12567. Set value which will be multiplied with filtered result.
  12568. @item delta
  12569. Set value which will be added to filtered result.
  12570. @end table
  12571. @anchor{spp}
  12572. @section spp
  12573. Apply a simple postprocessing filter that compresses and decompresses the image
  12574. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12575. and average the results.
  12576. The filter accepts the following options:
  12577. @table @option
  12578. @item quality
  12579. Set quality. This option defines the number of levels for averaging. It accepts
  12580. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12581. effect. A value of @code{6} means the higher quality. For each increment of
  12582. that value the speed drops by a factor of approximately 2. Default value is
  12583. @code{3}.
  12584. @item qp
  12585. Force a constant quantization parameter. If not set, the filter will use the QP
  12586. from the video stream (if available).
  12587. @item mode
  12588. Set thresholding mode. Available modes are:
  12589. @table @samp
  12590. @item hard
  12591. Set hard thresholding (default).
  12592. @item soft
  12593. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12594. @end table
  12595. @item use_bframe_qp
  12596. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12597. option may cause flicker since the B-Frames have often larger QP. Default is
  12598. @code{0} (not enabled).
  12599. @end table
  12600. @section sr
  12601. Scale the input by applying one of the super-resolution methods based on
  12602. convolutional neural networks. Supported models:
  12603. @itemize
  12604. @item
  12605. Super-Resolution Convolutional Neural Network model (SRCNN).
  12606. See @url{https://arxiv.org/abs/1501.00092}.
  12607. @item
  12608. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12609. See @url{https://arxiv.org/abs/1609.05158}.
  12610. @end itemize
  12611. Training scripts as well as scripts for model file (.pb) saving can be found at
  12612. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12613. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12614. Native model files (.model) can be generated from TensorFlow model
  12615. files (.pb) by using tools/python/convert.py
  12616. The filter accepts the following options:
  12617. @table @option
  12618. @item dnn_backend
  12619. Specify which DNN backend to use for model loading and execution. This option accepts
  12620. the following values:
  12621. @table @samp
  12622. @item native
  12623. Native implementation of DNN loading and execution.
  12624. @item tensorflow
  12625. TensorFlow backend. To enable this backend you
  12626. need to install the TensorFlow for C library (see
  12627. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12628. @code{--enable-libtensorflow}
  12629. @end table
  12630. Default value is @samp{native}.
  12631. @item model
  12632. Set path to model file specifying network architecture and its parameters.
  12633. Note that different backends use different file formats. TensorFlow backend
  12634. can load files for both formats, while native backend can load files for only
  12635. its format.
  12636. @item scale_factor
  12637. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12638. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12639. input upscaled using bicubic upscaling with proper scale factor.
  12640. @end table
  12641. @section ssim
  12642. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12643. This filter takes in input two input videos, the first input is
  12644. considered the "main" source and is passed unchanged to the
  12645. output. The second input is used as a "reference" video for computing
  12646. the SSIM.
  12647. Both video inputs must have the same resolution and pixel format for
  12648. this filter to work correctly. Also it assumes that both inputs
  12649. have the same number of frames, which are compared one by one.
  12650. The filter stores the calculated SSIM of each frame.
  12651. The description of the accepted parameters follows.
  12652. @table @option
  12653. @item stats_file, f
  12654. If specified the filter will use the named file to save the SSIM of
  12655. each individual frame. When filename equals "-" the data is sent to
  12656. standard output.
  12657. @end table
  12658. The file printed if @var{stats_file} is selected, contains a sequence of
  12659. key/value pairs of the form @var{key}:@var{value} for each compared
  12660. couple of frames.
  12661. A description of each shown parameter follows:
  12662. @table @option
  12663. @item n
  12664. sequential number of the input frame, starting from 1
  12665. @item Y, U, V, R, G, B
  12666. SSIM of the compared frames for the component specified by the suffix.
  12667. @item All
  12668. SSIM of the compared frames for the whole frame.
  12669. @item dB
  12670. Same as above but in dB representation.
  12671. @end table
  12672. This filter also supports the @ref{framesync} options.
  12673. For example:
  12674. @example
  12675. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12676. [main][ref] ssim="stats_file=stats.log" [out]
  12677. @end example
  12678. On this example the input file being processed is compared with the
  12679. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12680. is stored in @file{stats.log}.
  12681. Another example with both psnr and ssim at same time:
  12682. @example
  12683. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12684. @end example
  12685. @section stereo3d
  12686. Convert between different stereoscopic image formats.
  12687. The filters accept the following options:
  12688. @table @option
  12689. @item in
  12690. Set stereoscopic image format of input.
  12691. Available values for input image formats are:
  12692. @table @samp
  12693. @item sbsl
  12694. side by side parallel (left eye left, right eye right)
  12695. @item sbsr
  12696. side by side crosseye (right eye left, left eye right)
  12697. @item sbs2l
  12698. side by side parallel with half width resolution
  12699. (left eye left, right eye right)
  12700. @item sbs2r
  12701. side by side crosseye with half width resolution
  12702. (right eye left, left eye right)
  12703. @item abl
  12704. above-below (left eye above, right eye below)
  12705. @item abr
  12706. above-below (right eye above, left eye below)
  12707. @item ab2l
  12708. above-below with half height resolution
  12709. (left eye above, right eye below)
  12710. @item ab2r
  12711. above-below with half height resolution
  12712. (right eye above, left eye below)
  12713. @item al
  12714. alternating frames (left eye first, right eye second)
  12715. @item ar
  12716. alternating frames (right eye first, left eye second)
  12717. @item irl
  12718. interleaved rows (left eye has top row, right eye starts on next row)
  12719. @item irr
  12720. interleaved rows (right eye has top row, left eye starts on next row)
  12721. @item icl
  12722. interleaved columns, left eye first
  12723. @item icr
  12724. interleaved columns, right eye first
  12725. Default value is @samp{sbsl}.
  12726. @end table
  12727. @item out
  12728. Set stereoscopic image format of output.
  12729. @table @samp
  12730. @item sbsl
  12731. side by side parallel (left eye left, right eye right)
  12732. @item sbsr
  12733. side by side crosseye (right eye left, left eye right)
  12734. @item sbs2l
  12735. side by side parallel with half width resolution
  12736. (left eye left, right eye right)
  12737. @item sbs2r
  12738. side by side crosseye with half width resolution
  12739. (right eye left, left eye right)
  12740. @item abl
  12741. above-below (left eye above, right eye below)
  12742. @item abr
  12743. above-below (right eye above, left eye below)
  12744. @item ab2l
  12745. above-below with half height resolution
  12746. (left eye above, right eye below)
  12747. @item ab2r
  12748. above-below with half height resolution
  12749. (right eye above, left eye below)
  12750. @item al
  12751. alternating frames (left eye first, right eye second)
  12752. @item ar
  12753. alternating frames (right eye first, left eye second)
  12754. @item irl
  12755. interleaved rows (left eye has top row, right eye starts on next row)
  12756. @item irr
  12757. interleaved rows (right eye has top row, left eye starts on next row)
  12758. @item arbg
  12759. anaglyph red/blue gray
  12760. (red filter on left eye, blue filter on right eye)
  12761. @item argg
  12762. anaglyph red/green gray
  12763. (red filter on left eye, green filter on right eye)
  12764. @item arcg
  12765. anaglyph red/cyan gray
  12766. (red filter on left eye, cyan filter on right eye)
  12767. @item arch
  12768. anaglyph red/cyan half colored
  12769. (red filter on left eye, cyan filter on right eye)
  12770. @item arcc
  12771. anaglyph red/cyan color
  12772. (red filter on left eye, cyan filter on right eye)
  12773. @item arcd
  12774. anaglyph red/cyan color optimized with the least squares projection of dubois
  12775. (red filter on left eye, cyan filter on right eye)
  12776. @item agmg
  12777. anaglyph green/magenta gray
  12778. (green filter on left eye, magenta filter on right eye)
  12779. @item agmh
  12780. anaglyph green/magenta half colored
  12781. (green filter on left eye, magenta filter on right eye)
  12782. @item agmc
  12783. anaglyph green/magenta colored
  12784. (green filter on left eye, magenta filter on right eye)
  12785. @item agmd
  12786. anaglyph green/magenta color optimized with the least squares projection of dubois
  12787. (green filter on left eye, magenta filter on right eye)
  12788. @item aybg
  12789. anaglyph yellow/blue gray
  12790. (yellow filter on left eye, blue filter on right eye)
  12791. @item aybh
  12792. anaglyph yellow/blue half colored
  12793. (yellow filter on left eye, blue filter on right eye)
  12794. @item aybc
  12795. anaglyph yellow/blue colored
  12796. (yellow filter on left eye, blue filter on right eye)
  12797. @item aybd
  12798. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12799. (yellow filter on left eye, blue filter on right eye)
  12800. @item ml
  12801. mono output (left eye only)
  12802. @item mr
  12803. mono output (right eye only)
  12804. @item chl
  12805. checkerboard, left eye first
  12806. @item chr
  12807. checkerboard, right eye first
  12808. @item icl
  12809. interleaved columns, left eye first
  12810. @item icr
  12811. interleaved columns, right eye first
  12812. @item hdmi
  12813. HDMI frame pack
  12814. @end table
  12815. Default value is @samp{arcd}.
  12816. @end table
  12817. @subsection Examples
  12818. @itemize
  12819. @item
  12820. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12821. @example
  12822. stereo3d=sbsl:aybd
  12823. @end example
  12824. @item
  12825. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12826. @example
  12827. stereo3d=abl:sbsr
  12828. @end example
  12829. @end itemize
  12830. @section streamselect, astreamselect
  12831. Select video or audio streams.
  12832. The filter accepts the following options:
  12833. @table @option
  12834. @item inputs
  12835. Set number of inputs. Default is 2.
  12836. @item map
  12837. Set input indexes to remap to outputs.
  12838. @end table
  12839. @subsection Commands
  12840. The @code{streamselect} and @code{astreamselect} filter supports the following
  12841. commands:
  12842. @table @option
  12843. @item map
  12844. Set input indexes to remap to outputs.
  12845. @end table
  12846. @subsection Examples
  12847. @itemize
  12848. @item
  12849. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12850. @example
  12851. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12852. @end example
  12853. @item
  12854. Same as above, but for audio:
  12855. @example
  12856. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12857. @end example
  12858. @end itemize
  12859. @anchor{subtitles}
  12860. @section subtitles
  12861. Draw subtitles on top of input video using the libass library.
  12862. To enable compilation of this filter you need to configure FFmpeg with
  12863. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12864. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12865. Alpha) subtitles format.
  12866. The filter accepts the following options:
  12867. @table @option
  12868. @item filename, f
  12869. Set the filename of the subtitle file to read. It must be specified.
  12870. @item original_size
  12871. Specify the size of the original video, the video for which the ASS file
  12872. was composed. For the syntax of this option, check the
  12873. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12874. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12875. correctly scale the fonts if the aspect ratio has been changed.
  12876. @item fontsdir
  12877. Set a directory path containing fonts that can be used by the filter.
  12878. These fonts will be used in addition to whatever the font provider uses.
  12879. @item alpha
  12880. Process alpha channel, by default alpha channel is untouched.
  12881. @item charenc
  12882. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12883. useful if not UTF-8.
  12884. @item stream_index, si
  12885. Set subtitles stream index. @code{subtitles} filter only.
  12886. @item force_style
  12887. Override default style or script info parameters of the subtitles. It accepts a
  12888. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12889. @end table
  12890. If the first key is not specified, it is assumed that the first value
  12891. specifies the @option{filename}.
  12892. For example, to render the file @file{sub.srt} on top of the input
  12893. video, use the command:
  12894. @example
  12895. subtitles=sub.srt
  12896. @end example
  12897. which is equivalent to:
  12898. @example
  12899. subtitles=filename=sub.srt
  12900. @end example
  12901. To render the default subtitles stream from file @file{video.mkv}, use:
  12902. @example
  12903. subtitles=video.mkv
  12904. @end example
  12905. To render the second subtitles stream from that file, use:
  12906. @example
  12907. subtitles=video.mkv:si=1
  12908. @end example
  12909. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12910. @code{DejaVu Serif}, use:
  12911. @example
  12912. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12913. @end example
  12914. @section super2xsai
  12915. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12916. Interpolate) pixel art scaling algorithm.
  12917. Useful for enlarging pixel art images without reducing sharpness.
  12918. @section swaprect
  12919. Swap two rectangular objects in video.
  12920. This filter accepts the following options:
  12921. @table @option
  12922. @item w
  12923. Set object width.
  12924. @item h
  12925. Set object height.
  12926. @item x1
  12927. Set 1st rect x coordinate.
  12928. @item y1
  12929. Set 1st rect y coordinate.
  12930. @item x2
  12931. Set 2nd rect x coordinate.
  12932. @item y2
  12933. Set 2nd rect y coordinate.
  12934. All expressions are evaluated once for each frame.
  12935. @end table
  12936. The all options are expressions containing the following constants:
  12937. @table @option
  12938. @item w
  12939. @item h
  12940. The input width and height.
  12941. @item a
  12942. same as @var{w} / @var{h}
  12943. @item sar
  12944. input sample aspect ratio
  12945. @item dar
  12946. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12947. @item n
  12948. The number of the input frame, starting from 0.
  12949. @item t
  12950. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12951. @item pos
  12952. the position in the file of the input frame, NAN if unknown
  12953. @end table
  12954. @section swapuv
  12955. Swap U & V plane.
  12956. @section telecine
  12957. Apply telecine process to the video.
  12958. This filter accepts the following options:
  12959. @table @option
  12960. @item first_field
  12961. @table @samp
  12962. @item top, t
  12963. top field first
  12964. @item bottom, b
  12965. bottom field first
  12966. The default value is @code{top}.
  12967. @end table
  12968. @item pattern
  12969. A string of numbers representing the pulldown pattern you wish to apply.
  12970. The default value is @code{23}.
  12971. @end table
  12972. @example
  12973. Some typical patterns:
  12974. NTSC output (30i):
  12975. 27.5p: 32222
  12976. 24p: 23 (classic)
  12977. 24p: 2332 (preferred)
  12978. 20p: 33
  12979. 18p: 334
  12980. 16p: 3444
  12981. PAL output (25i):
  12982. 27.5p: 12222
  12983. 24p: 222222222223 ("Euro pulldown")
  12984. 16.67p: 33
  12985. 16p: 33333334
  12986. @end example
  12987. @section threshold
  12988. Apply threshold effect to video stream.
  12989. This filter needs four video streams to perform thresholding.
  12990. First stream is stream we are filtering.
  12991. Second stream is holding threshold values, third stream is holding min values,
  12992. and last, fourth stream is holding max values.
  12993. The filter accepts the following option:
  12994. @table @option
  12995. @item planes
  12996. Set which planes will be processed, unprocessed planes will be copied.
  12997. By default value 0xf, all planes will be processed.
  12998. @end table
  12999. For example if first stream pixel's component value is less then threshold value
  13000. of pixel component from 2nd threshold stream, third stream value will picked,
  13001. otherwise fourth stream pixel component value will be picked.
  13002. Using color source filter one can perform various types of thresholding:
  13003. @subsection Examples
  13004. @itemize
  13005. @item
  13006. Binary threshold, using gray color as threshold:
  13007. @example
  13008. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13009. @end example
  13010. @item
  13011. Inverted binary threshold, using gray color as threshold:
  13012. @example
  13013. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13014. @end example
  13015. @item
  13016. Truncate binary threshold, using gray color as threshold:
  13017. @example
  13018. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13019. @end example
  13020. @item
  13021. Threshold to zero, using gray color as threshold:
  13022. @example
  13023. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13024. @end example
  13025. @item
  13026. Inverted threshold to zero, using gray color as threshold:
  13027. @example
  13028. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13029. @end example
  13030. @end itemize
  13031. @section thumbnail
  13032. Select the most representative frame in a given sequence of consecutive frames.
  13033. The filter accepts the following options:
  13034. @table @option
  13035. @item n
  13036. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13037. will pick one of them, and then handle the next batch of @var{n} frames until
  13038. the end. Default is @code{100}.
  13039. @end table
  13040. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13041. value will result in a higher memory usage, so a high value is not recommended.
  13042. @subsection Examples
  13043. @itemize
  13044. @item
  13045. Extract one picture each 50 frames:
  13046. @example
  13047. thumbnail=50
  13048. @end example
  13049. @item
  13050. Complete example of a thumbnail creation with @command{ffmpeg}:
  13051. @example
  13052. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13053. @end example
  13054. @end itemize
  13055. @section tile
  13056. Tile several successive frames together.
  13057. The filter accepts the following options:
  13058. @table @option
  13059. @item layout
  13060. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13061. this option, check the
  13062. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13063. @item nb_frames
  13064. Set the maximum number of frames to render in the given area. It must be less
  13065. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13066. the area will be used.
  13067. @item margin
  13068. Set the outer border margin in pixels.
  13069. @item padding
  13070. Set the inner border thickness (i.e. the number of pixels between frames). For
  13071. more advanced padding options (such as having different values for the edges),
  13072. refer to the pad video filter.
  13073. @item color
  13074. Specify the color of the unused area. For the syntax of this option, check the
  13075. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13076. The default value of @var{color} is "black".
  13077. @item overlap
  13078. Set the number of frames to overlap when tiling several successive frames together.
  13079. The value must be between @code{0} and @var{nb_frames - 1}.
  13080. @item init_padding
  13081. Set the number of frames to initially be empty before displaying first output frame.
  13082. This controls how soon will one get first output frame.
  13083. The value must be between @code{0} and @var{nb_frames - 1}.
  13084. @end table
  13085. @subsection Examples
  13086. @itemize
  13087. @item
  13088. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13089. @example
  13090. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13091. @end example
  13092. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13093. duplicating each output frame to accommodate the originally detected frame
  13094. rate.
  13095. @item
  13096. Display @code{5} pictures in an area of @code{3x2} frames,
  13097. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13098. mixed flat and named options:
  13099. @example
  13100. tile=3x2:nb_frames=5:padding=7:margin=2
  13101. @end example
  13102. @end itemize
  13103. @section tinterlace
  13104. Perform various types of temporal field interlacing.
  13105. Frames are counted starting from 1, so the first input frame is
  13106. considered odd.
  13107. The filter accepts the following options:
  13108. @table @option
  13109. @item mode
  13110. Specify the mode of the interlacing. This option can also be specified
  13111. as a value alone. See below for a list of values for this option.
  13112. Available values are:
  13113. @table @samp
  13114. @item merge, 0
  13115. Move odd frames into the upper field, even into the lower field,
  13116. generating a double height frame at half frame rate.
  13117. @example
  13118. ------> time
  13119. Input:
  13120. Frame 1 Frame 2 Frame 3 Frame 4
  13121. 11111 22222 33333 44444
  13122. 11111 22222 33333 44444
  13123. 11111 22222 33333 44444
  13124. 11111 22222 33333 44444
  13125. Output:
  13126. 11111 33333
  13127. 22222 44444
  13128. 11111 33333
  13129. 22222 44444
  13130. 11111 33333
  13131. 22222 44444
  13132. 11111 33333
  13133. 22222 44444
  13134. @end example
  13135. @item drop_even, 1
  13136. Only output odd frames, even frames are dropped, generating a frame with
  13137. unchanged height at half frame rate.
  13138. @example
  13139. ------> time
  13140. Input:
  13141. Frame 1 Frame 2 Frame 3 Frame 4
  13142. 11111 22222 33333 44444
  13143. 11111 22222 33333 44444
  13144. 11111 22222 33333 44444
  13145. 11111 22222 33333 44444
  13146. Output:
  13147. 11111 33333
  13148. 11111 33333
  13149. 11111 33333
  13150. 11111 33333
  13151. @end example
  13152. @item drop_odd, 2
  13153. Only output even frames, odd frames are dropped, generating a frame with
  13154. unchanged height at half frame rate.
  13155. @example
  13156. ------> time
  13157. Input:
  13158. Frame 1 Frame 2 Frame 3 Frame 4
  13159. 11111 22222 33333 44444
  13160. 11111 22222 33333 44444
  13161. 11111 22222 33333 44444
  13162. 11111 22222 33333 44444
  13163. Output:
  13164. 22222 44444
  13165. 22222 44444
  13166. 22222 44444
  13167. 22222 44444
  13168. @end example
  13169. @item pad, 3
  13170. Expand each frame to full height, but pad alternate lines with black,
  13171. generating a frame with double height at the same input frame rate.
  13172. @example
  13173. ------> time
  13174. Input:
  13175. Frame 1 Frame 2 Frame 3 Frame 4
  13176. 11111 22222 33333 44444
  13177. 11111 22222 33333 44444
  13178. 11111 22222 33333 44444
  13179. 11111 22222 33333 44444
  13180. Output:
  13181. 11111 ..... 33333 .....
  13182. ..... 22222 ..... 44444
  13183. 11111 ..... 33333 .....
  13184. ..... 22222 ..... 44444
  13185. 11111 ..... 33333 .....
  13186. ..... 22222 ..... 44444
  13187. 11111 ..... 33333 .....
  13188. ..... 22222 ..... 44444
  13189. @end example
  13190. @item interleave_top, 4
  13191. Interleave the upper field from odd frames with the lower field from
  13192. even frames, generating a frame with unchanged height at half frame rate.
  13193. @example
  13194. ------> time
  13195. Input:
  13196. Frame 1 Frame 2 Frame 3 Frame 4
  13197. 11111<- 22222 33333<- 44444
  13198. 11111 22222<- 33333 44444<-
  13199. 11111<- 22222 33333<- 44444
  13200. 11111 22222<- 33333 44444<-
  13201. Output:
  13202. 11111 33333
  13203. 22222 44444
  13204. 11111 33333
  13205. 22222 44444
  13206. @end example
  13207. @item interleave_bottom, 5
  13208. Interleave the lower field from odd frames with the upper field from
  13209. even frames, generating a frame with unchanged height at half frame rate.
  13210. @example
  13211. ------> time
  13212. Input:
  13213. Frame 1 Frame 2 Frame 3 Frame 4
  13214. 11111 22222<- 33333 44444<-
  13215. 11111<- 22222 33333<- 44444
  13216. 11111 22222<- 33333 44444<-
  13217. 11111<- 22222 33333<- 44444
  13218. Output:
  13219. 22222 44444
  13220. 11111 33333
  13221. 22222 44444
  13222. 11111 33333
  13223. @end example
  13224. @item interlacex2, 6
  13225. Double frame rate with unchanged height. Frames are inserted each
  13226. containing the second temporal field from the previous input frame and
  13227. the first temporal field from the next input frame. This mode relies on
  13228. the top_field_first flag. Useful for interlaced video displays with no
  13229. field synchronisation.
  13230. @example
  13231. ------> time
  13232. Input:
  13233. Frame 1 Frame 2 Frame 3 Frame 4
  13234. 11111 22222 33333 44444
  13235. 11111 22222 33333 44444
  13236. 11111 22222 33333 44444
  13237. 11111 22222 33333 44444
  13238. Output:
  13239. 11111 22222 22222 33333 33333 44444 44444
  13240. 11111 11111 22222 22222 33333 33333 44444
  13241. 11111 22222 22222 33333 33333 44444 44444
  13242. 11111 11111 22222 22222 33333 33333 44444
  13243. @end example
  13244. @item mergex2, 7
  13245. Move odd frames into the upper field, even into the lower field,
  13246. generating a double height frame at same frame rate.
  13247. @example
  13248. ------> time
  13249. Input:
  13250. Frame 1 Frame 2 Frame 3 Frame 4
  13251. 11111 22222 33333 44444
  13252. 11111 22222 33333 44444
  13253. 11111 22222 33333 44444
  13254. 11111 22222 33333 44444
  13255. Output:
  13256. 11111 33333 33333 55555
  13257. 22222 22222 44444 44444
  13258. 11111 33333 33333 55555
  13259. 22222 22222 44444 44444
  13260. 11111 33333 33333 55555
  13261. 22222 22222 44444 44444
  13262. 11111 33333 33333 55555
  13263. 22222 22222 44444 44444
  13264. @end example
  13265. @end table
  13266. Numeric values are deprecated but are accepted for backward
  13267. compatibility reasons.
  13268. Default mode is @code{merge}.
  13269. @item flags
  13270. Specify flags influencing the filter process.
  13271. Available value for @var{flags} is:
  13272. @table @option
  13273. @item low_pass_filter, vlpf
  13274. Enable linear vertical low-pass filtering in the filter.
  13275. Vertical low-pass filtering is required when creating an interlaced
  13276. destination from a progressive source which contains high-frequency
  13277. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13278. patterning.
  13279. @item complex_filter, cvlpf
  13280. Enable complex vertical low-pass filtering.
  13281. This will slightly less reduce interlace 'twitter' and Moire
  13282. patterning but better retain detail and subjective sharpness impression.
  13283. @end table
  13284. Vertical low-pass filtering can only be enabled for @option{mode}
  13285. @var{interleave_top} and @var{interleave_bottom}.
  13286. @end table
  13287. @section tmix
  13288. Mix successive video frames.
  13289. A description of the accepted options follows.
  13290. @table @option
  13291. @item frames
  13292. The number of successive frames to mix. If unspecified, it defaults to 3.
  13293. @item weights
  13294. Specify weight of each input video frame.
  13295. Each weight is separated by space. If number of weights is smaller than
  13296. number of @var{frames} last specified weight will be used for all remaining
  13297. unset weights.
  13298. @item scale
  13299. Specify scale, if it is set it will be multiplied with sum
  13300. of each weight multiplied with pixel values to give final destination
  13301. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13302. @end table
  13303. @subsection Examples
  13304. @itemize
  13305. @item
  13306. Average 7 successive frames:
  13307. @example
  13308. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13309. @end example
  13310. @item
  13311. Apply simple temporal convolution:
  13312. @example
  13313. tmix=frames=3:weights="-1 3 -1"
  13314. @end example
  13315. @item
  13316. Similar as above but only showing temporal differences:
  13317. @example
  13318. tmix=frames=3:weights="-1 2 -1":scale=1
  13319. @end example
  13320. @end itemize
  13321. @anchor{tonemap}
  13322. @section tonemap
  13323. Tone map colors from different dynamic ranges.
  13324. This filter expects data in single precision floating point, as it needs to
  13325. operate on (and can output) out-of-range values. Another filter, such as
  13326. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13327. The tonemapping algorithms implemented only work on linear light, so input
  13328. data should be linearized beforehand (and possibly correctly tagged).
  13329. @example
  13330. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13331. @end example
  13332. @subsection Options
  13333. The filter accepts the following options.
  13334. @table @option
  13335. @item tonemap
  13336. Set the tone map algorithm to use.
  13337. Possible values are:
  13338. @table @var
  13339. @item none
  13340. Do not apply any tone map, only desaturate overbright pixels.
  13341. @item clip
  13342. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13343. in-range values, while distorting out-of-range values.
  13344. @item linear
  13345. Stretch the entire reference gamut to a linear multiple of the display.
  13346. @item gamma
  13347. Fit a logarithmic transfer between the tone curves.
  13348. @item reinhard
  13349. Preserve overall image brightness with a simple curve, using nonlinear
  13350. contrast, which results in flattening details and degrading color accuracy.
  13351. @item hable
  13352. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13353. of slightly darkening everything. Use it when detail preservation is more
  13354. important than color and brightness accuracy.
  13355. @item mobius
  13356. Smoothly map out-of-range values, while retaining contrast and colors for
  13357. in-range material as much as possible. Use it when color accuracy is more
  13358. important than detail preservation.
  13359. @end table
  13360. Default is none.
  13361. @item param
  13362. Tune the tone mapping algorithm.
  13363. This affects the following algorithms:
  13364. @table @var
  13365. @item none
  13366. Ignored.
  13367. @item linear
  13368. Specifies the scale factor to use while stretching.
  13369. Default to 1.0.
  13370. @item gamma
  13371. Specifies the exponent of the function.
  13372. Default to 1.8.
  13373. @item clip
  13374. Specify an extra linear coefficient to multiply into the signal before clipping.
  13375. Default to 1.0.
  13376. @item reinhard
  13377. Specify the local contrast coefficient at the display peak.
  13378. Default to 0.5, which means that in-gamut values will be about half as bright
  13379. as when clipping.
  13380. @item hable
  13381. Ignored.
  13382. @item mobius
  13383. Specify the transition point from linear to mobius transform. Every value
  13384. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13385. more accurate the result will be, at the cost of losing bright details.
  13386. Default to 0.3, which due to the steep initial slope still preserves in-range
  13387. colors fairly accurately.
  13388. @end table
  13389. @item desat
  13390. Apply desaturation for highlights that exceed this level of brightness. The
  13391. higher the parameter, the more color information will be preserved. This
  13392. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13393. (smoothly) turning into white instead. This makes images feel more natural,
  13394. at the cost of reducing information about out-of-range colors.
  13395. The default of 2.0 is somewhat conservative and will mostly just apply to
  13396. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13397. This option works only if the input frame has a supported color tag.
  13398. @item peak
  13399. Override signal/nominal/reference peak with this value. Useful when the
  13400. embedded peak information in display metadata is not reliable or when tone
  13401. mapping from a lower range to a higher range.
  13402. @end table
  13403. @section tpad
  13404. Temporarily pad video frames.
  13405. The filter accepts the following options:
  13406. @table @option
  13407. @item start
  13408. Specify number of delay frames before input video stream.
  13409. @item stop
  13410. Specify number of padding frames after input video stream.
  13411. Set to -1 to pad indefinitely.
  13412. @item start_mode
  13413. Set kind of frames added to beginning of stream.
  13414. Can be either @var{add} or @var{clone}.
  13415. With @var{add} frames of solid-color are added.
  13416. With @var{clone} frames are clones of first frame.
  13417. @item stop_mode
  13418. Set kind of frames added to end of stream.
  13419. Can be either @var{add} or @var{clone}.
  13420. With @var{add} frames of solid-color are added.
  13421. With @var{clone} frames are clones of last frame.
  13422. @item start_duration, stop_duration
  13423. Specify the duration of the start/stop delay. See
  13424. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13425. for the accepted syntax.
  13426. These options override @var{start} and @var{stop}.
  13427. @item color
  13428. Specify the color of the padded area. For the syntax of this option,
  13429. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13430. manual,ffmpeg-utils}.
  13431. The default value of @var{color} is "black".
  13432. @end table
  13433. @anchor{transpose}
  13434. @section transpose
  13435. Transpose rows with columns in the input video and optionally flip it.
  13436. It accepts the following parameters:
  13437. @table @option
  13438. @item dir
  13439. Specify the transposition direction.
  13440. Can assume the following values:
  13441. @table @samp
  13442. @item 0, 4, cclock_flip
  13443. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13444. @example
  13445. L.R L.l
  13446. . . -> . .
  13447. l.r R.r
  13448. @end example
  13449. @item 1, 5, clock
  13450. Rotate by 90 degrees clockwise, that is:
  13451. @example
  13452. L.R l.L
  13453. . . -> . .
  13454. l.r r.R
  13455. @end example
  13456. @item 2, 6, cclock
  13457. Rotate by 90 degrees counterclockwise, that is:
  13458. @example
  13459. L.R R.r
  13460. . . -> . .
  13461. l.r L.l
  13462. @end example
  13463. @item 3, 7, clock_flip
  13464. Rotate by 90 degrees clockwise and vertically flip, that is:
  13465. @example
  13466. L.R r.R
  13467. . . -> . .
  13468. l.r l.L
  13469. @end example
  13470. @end table
  13471. For values between 4-7, the transposition is only done if the input
  13472. video geometry is portrait and not landscape. These values are
  13473. deprecated, the @code{passthrough} option should be used instead.
  13474. Numerical values are deprecated, and should be dropped in favor of
  13475. symbolic constants.
  13476. @item passthrough
  13477. Do not apply the transposition if the input geometry matches the one
  13478. specified by the specified value. It accepts the following values:
  13479. @table @samp
  13480. @item none
  13481. Always apply transposition.
  13482. @item portrait
  13483. Preserve portrait geometry (when @var{height} >= @var{width}).
  13484. @item landscape
  13485. Preserve landscape geometry (when @var{width} >= @var{height}).
  13486. @end table
  13487. Default value is @code{none}.
  13488. @end table
  13489. For example to rotate by 90 degrees clockwise and preserve portrait
  13490. layout:
  13491. @example
  13492. transpose=dir=1:passthrough=portrait
  13493. @end example
  13494. The command above can also be specified as:
  13495. @example
  13496. transpose=1:portrait
  13497. @end example
  13498. @section transpose_npp
  13499. Transpose rows with columns in the input video and optionally flip it.
  13500. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13501. It accepts the following parameters:
  13502. @table @option
  13503. @item dir
  13504. Specify the transposition direction.
  13505. Can assume the following values:
  13506. @table @samp
  13507. @item cclock_flip
  13508. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13509. @item clock
  13510. Rotate by 90 degrees clockwise.
  13511. @item cclock
  13512. Rotate by 90 degrees counterclockwise.
  13513. @item clock_flip
  13514. Rotate by 90 degrees clockwise and vertically flip.
  13515. @end table
  13516. @item passthrough
  13517. Do not apply the transposition if the input geometry matches the one
  13518. specified by the specified value. It accepts the following values:
  13519. @table @samp
  13520. @item none
  13521. Always apply transposition. (default)
  13522. @item portrait
  13523. Preserve portrait geometry (when @var{height} >= @var{width}).
  13524. @item landscape
  13525. Preserve landscape geometry (when @var{width} >= @var{height}).
  13526. @end table
  13527. @end table
  13528. @section trim
  13529. Trim the input so that the output contains one continuous subpart of the input.
  13530. It accepts the following parameters:
  13531. @table @option
  13532. @item start
  13533. Specify the time of the start of the kept section, i.e. the frame with the
  13534. timestamp @var{start} will be the first frame in the output.
  13535. @item end
  13536. Specify the time of the first frame that will be dropped, i.e. the frame
  13537. immediately preceding the one with the timestamp @var{end} will be the last
  13538. frame in the output.
  13539. @item start_pts
  13540. This is the same as @var{start}, except this option sets the start timestamp
  13541. in timebase units instead of seconds.
  13542. @item end_pts
  13543. This is the same as @var{end}, except this option sets the end timestamp
  13544. in timebase units instead of seconds.
  13545. @item duration
  13546. The maximum duration of the output in seconds.
  13547. @item start_frame
  13548. The number of the first frame that should be passed to the output.
  13549. @item end_frame
  13550. The number of the first frame that should be dropped.
  13551. @end table
  13552. @option{start}, @option{end}, and @option{duration} are expressed as time
  13553. duration specifications; see
  13554. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13555. for the accepted syntax.
  13556. Note that the first two sets of the start/end options and the @option{duration}
  13557. option look at the frame timestamp, while the _frame variants simply count the
  13558. frames that pass through the filter. Also note that this filter does not modify
  13559. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13560. setpts filter after the trim filter.
  13561. If multiple start or end options are set, this filter tries to be greedy and
  13562. keep all the frames that match at least one of the specified constraints. To keep
  13563. only the part that matches all the constraints at once, chain multiple trim
  13564. filters.
  13565. The defaults are such that all the input is kept. So it is possible to set e.g.
  13566. just the end values to keep everything before the specified time.
  13567. Examples:
  13568. @itemize
  13569. @item
  13570. Drop everything except the second minute of input:
  13571. @example
  13572. ffmpeg -i INPUT -vf trim=60:120
  13573. @end example
  13574. @item
  13575. Keep only the first second:
  13576. @example
  13577. ffmpeg -i INPUT -vf trim=duration=1
  13578. @end example
  13579. @end itemize
  13580. @section unpremultiply
  13581. Apply alpha unpremultiply effect to input video stream using first plane
  13582. of second stream as alpha.
  13583. Both streams must have same dimensions and same pixel format.
  13584. The filter accepts the following option:
  13585. @table @option
  13586. @item planes
  13587. Set which planes will be processed, unprocessed planes will be copied.
  13588. By default value 0xf, all planes will be processed.
  13589. If the format has 1 or 2 components, then luma is bit 0.
  13590. If the format has 3 or 4 components:
  13591. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13592. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13593. If present, the alpha channel is always the last bit.
  13594. @item inplace
  13595. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13596. @end table
  13597. @anchor{unsharp}
  13598. @section unsharp
  13599. Sharpen or blur the input video.
  13600. It accepts the following parameters:
  13601. @table @option
  13602. @item luma_msize_x, lx
  13603. Set the luma matrix horizontal size. It must be an odd integer between
  13604. 3 and 23. The default value is 5.
  13605. @item luma_msize_y, ly
  13606. Set the luma matrix vertical size. It must be an odd integer between 3
  13607. and 23. The default value is 5.
  13608. @item luma_amount, la
  13609. Set the luma effect strength. It must be a floating point number, reasonable
  13610. values lay between -1.5 and 1.5.
  13611. Negative values will blur the input video, while positive values will
  13612. sharpen it, a value of zero will disable the effect.
  13613. Default value is 1.0.
  13614. @item chroma_msize_x, cx
  13615. Set the chroma matrix horizontal size. It must be an odd integer
  13616. between 3 and 23. The default value is 5.
  13617. @item chroma_msize_y, cy
  13618. Set the chroma matrix vertical size. It must be an odd integer
  13619. between 3 and 23. The default value is 5.
  13620. @item chroma_amount, ca
  13621. Set the chroma effect strength. It must be a floating point number, reasonable
  13622. values lay between -1.5 and 1.5.
  13623. Negative values will blur the input video, while positive values will
  13624. sharpen it, a value of zero will disable the effect.
  13625. Default value is 0.0.
  13626. @end table
  13627. All parameters are optional and default to the equivalent of the
  13628. string '5:5:1.0:5:5:0.0'.
  13629. @subsection Examples
  13630. @itemize
  13631. @item
  13632. Apply strong luma sharpen effect:
  13633. @example
  13634. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13635. @end example
  13636. @item
  13637. Apply a strong blur of both luma and chroma parameters:
  13638. @example
  13639. unsharp=7:7:-2:7:7:-2
  13640. @end example
  13641. @end itemize
  13642. @section uspp
  13643. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13644. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13645. shifts and average the results.
  13646. The way this differs from the behavior of spp is that uspp actually encodes &
  13647. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13648. DCT similar to MJPEG.
  13649. The filter accepts the following options:
  13650. @table @option
  13651. @item quality
  13652. Set quality. This option defines the number of levels for averaging. It accepts
  13653. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13654. effect. A value of @code{8} means the higher quality. For each increment of
  13655. that value the speed drops by a factor of approximately 2. Default value is
  13656. @code{3}.
  13657. @item qp
  13658. Force a constant quantization parameter. If not set, the filter will use the QP
  13659. from the video stream (if available).
  13660. @end table
  13661. @section v360
  13662. Convert 360 videos between various formats.
  13663. The filter accepts the following options:
  13664. @table @option
  13665. @item input
  13666. @item output
  13667. Set format of the input/output video.
  13668. Available formats:
  13669. @table @samp
  13670. @item e
  13671. Equirectangular projection.
  13672. @item c3x2
  13673. @item c6x1
  13674. @item c1x6
  13675. Cubemap with 3x2/6x1/1x6 layout.
  13676. Format specific options:
  13677. @table @option
  13678. @item in_pad
  13679. @item out_pad
  13680. Set padding proportion for the input/output cubemap. Values in decimals.
  13681. Example values:
  13682. @table @samp
  13683. @item 0
  13684. No padding.
  13685. @item 0.01
  13686. 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)
  13687. @end table
  13688. Default value is @b{@samp{0}}.
  13689. @item in_forder
  13690. @item out_forder
  13691. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13692. Designation of directions:
  13693. @table @samp
  13694. @item r
  13695. right
  13696. @item l
  13697. left
  13698. @item u
  13699. up
  13700. @item d
  13701. down
  13702. @item f
  13703. forward
  13704. @item b
  13705. back
  13706. @end table
  13707. Default value is @b{@samp{rludfb}}.
  13708. @item in_frot
  13709. @item out_frot
  13710. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13711. Designation of angles:
  13712. @table @samp
  13713. @item 0
  13714. 0 degrees clockwise
  13715. @item 1
  13716. 90 degrees clockwise
  13717. @item 2
  13718. 180 degrees clockwise
  13719. @item 4
  13720. 270 degrees clockwise
  13721. @end table
  13722. Default value is @b{@samp{000000}}.
  13723. @end table
  13724. @item eac
  13725. Equi-Angular Cubemap.
  13726. @item flat
  13727. Regular video. @i{(output only)}
  13728. Format specific options:
  13729. @table @option
  13730. @item h_fov
  13731. @item v_fov
  13732. Set horizontal/vertical field of view. Values in degrees.
  13733. @end table
  13734. @item dfisheye
  13735. Dual fisheye. @i{(input only)}
  13736. Format specific options:
  13737. @table @option
  13738. @item in_pad
  13739. Set padding proportion. Values in decimals.
  13740. Example values:
  13741. @table @samp
  13742. @item 0
  13743. No padding.
  13744. @item 0.01
  13745. 1% padding.
  13746. @end table
  13747. Default value is @b{@samp{0}}.
  13748. @end table
  13749. @item barrel
  13750. @item fb
  13751. Facebook's 360 format.
  13752. @end table
  13753. @item interp
  13754. Set interpolation method.@*
  13755. @i{Note: more complex interpolation methods require much more memory to run.}
  13756. Available methods:
  13757. @table @samp
  13758. @item near
  13759. @item nearest
  13760. Nearest neighbour.
  13761. @item line
  13762. @item linear
  13763. Bilinear interpolation.
  13764. @item cube
  13765. @item cubic
  13766. Bicubic interpolation.
  13767. @item lanc
  13768. @item lanczos
  13769. Lanczos interpolation.
  13770. @end table
  13771. Default value is @b{@samp{line}}.
  13772. @item w
  13773. @item h
  13774. Set the output video resolution.
  13775. Default resolution depends on formats.
  13776. @item yaw
  13777. @item pitch
  13778. @item roll
  13779. Set rotation for the output video. Values in degrees.
  13780. @item rorder
  13781. Set rotation order for the output video. Choose one item for each position.
  13782. @table @samp
  13783. @item y, Y
  13784. yaw
  13785. @item p, P
  13786. pitch
  13787. @item r, R
  13788. roll
  13789. @end table
  13790. Default value is @b{@samp{ypr}}.
  13791. @item h_flip
  13792. @item v_flip
  13793. @item d_flip
  13794. Flip the output video horizontally/vertically/in-depth. Boolean values.
  13795. @end table
  13796. @subsection Examples
  13797. @itemize
  13798. @item
  13799. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  13800. @example
  13801. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  13802. @end example
  13803. @item
  13804. Extract back view of Equi-Angular Cubemap:
  13805. @example
  13806. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  13807. @end example
  13808. @end itemize
  13809. @section vaguedenoiser
  13810. Apply a wavelet based denoiser.
  13811. It transforms each frame from the video input into the wavelet domain,
  13812. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13813. the obtained coefficients. It does an inverse wavelet transform after.
  13814. Due to wavelet properties, it should give a nice smoothed result, and
  13815. reduced noise, without blurring picture features.
  13816. This filter accepts the following options:
  13817. @table @option
  13818. @item threshold
  13819. The filtering strength. The higher, the more filtered the video will be.
  13820. Hard thresholding can use a higher threshold than soft thresholding
  13821. before the video looks overfiltered. Default value is 2.
  13822. @item method
  13823. The filtering method the filter will use.
  13824. It accepts the following values:
  13825. @table @samp
  13826. @item hard
  13827. All values under the threshold will be zeroed.
  13828. @item soft
  13829. All values under the threshold will be zeroed. All values above will be
  13830. reduced by the threshold.
  13831. @item garrote
  13832. Scales or nullifies coefficients - intermediary between (more) soft and
  13833. (less) hard thresholding.
  13834. @end table
  13835. Default is garrote.
  13836. @item nsteps
  13837. Number of times, the wavelet will decompose the picture. Picture can't
  13838. be decomposed beyond a particular point (typically, 8 for a 640x480
  13839. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13840. @item percent
  13841. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13842. @item planes
  13843. A list of the planes to process. By default all planes are processed.
  13844. @end table
  13845. @section vectorscope
  13846. Display 2 color component values in the two dimensional graph (which is called
  13847. a vectorscope).
  13848. This filter accepts the following options:
  13849. @table @option
  13850. @item mode, m
  13851. Set vectorscope mode.
  13852. It accepts the following values:
  13853. @table @samp
  13854. @item gray
  13855. Gray values are displayed on graph, higher brightness means more pixels have
  13856. same component color value on location in graph. This is the default mode.
  13857. @item color
  13858. Gray values are displayed on graph. Surrounding pixels values which are not
  13859. present in video frame are drawn in gradient of 2 color components which are
  13860. set by option @code{x} and @code{y}. The 3rd color component is static.
  13861. @item color2
  13862. Actual color components values present in video frame are displayed on graph.
  13863. @item color3
  13864. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13865. on graph increases value of another color component, which is luminance by
  13866. default values of @code{x} and @code{y}.
  13867. @item color4
  13868. Actual colors present in video frame are displayed on graph. If two different
  13869. colors map to same position on graph then color with higher value of component
  13870. not present in graph is picked.
  13871. @item color5
  13872. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13873. component picked from radial gradient.
  13874. @end table
  13875. @item x
  13876. Set which color component will be represented on X-axis. Default is @code{1}.
  13877. @item y
  13878. Set which color component will be represented on Y-axis. Default is @code{2}.
  13879. @item intensity, i
  13880. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13881. of color component which represents frequency of (X, Y) location in graph.
  13882. @item envelope, e
  13883. @table @samp
  13884. @item none
  13885. No envelope, this is default.
  13886. @item instant
  13887. Instant envelope, even darkest single pixel will be clearly highlighted.
  13888. @item peak
  13889. Hold maximum and minimum values presented in graph over time. This way you
  13890. can still spot out of range values without constantly looking at vectorscope.
  13891. @item peak+instant
  13892. Peak and instant envelope combined together.
  13893. @end table
  13894. @item graticule, g
  13895. Set what kind of graticule to draw.
  13896. @table @samp
  13897. @item none
  13898. @item green
  13899. @item color
  13900. @end table
  13901. @item opacity, o
  13902. Set graticule opacity.
  13903. @item flags, f
  13904. Set graticule flags.
  13905. @table @samp
  13906. @item white
  13907. Draw graticule for white point.
  13908. @item black
  13909. Draw graticule for black point.
  13910. @item name
  13911. Draw color points short names.
  13912. @end table
  13913. @item bgopacity, b
  13914. Set background opacity.
  13915. @item lthreshold, l
  13916. Set low threshold for color component not represented on X or Y axis.
  13917. Values lower than this value will be ignored. Default is 0.
  13918. Note this value is multiplied with actual max possible value one pixel component
  13919. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13920. is 0.1 * 255 = 25.
  13921. @item hthreshold, h
  13922. Set high threshold for color component not represented on X or Y axis.
  13923. Values higher than this value will be ignored. Default is 1.
  13924. Note this value is multiplied with actual max possible value one pixel component
  13925. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13926. is 0.9 * 255 = 230.
  13927. @item colorspace, c
  13928. Set what kind of colorspace to use when drawing graticule.
  13929. @table @samp
  13930. @item auto
  13931. @item 601
  13932. @item 709
  13933. @end table
  13934. Default is auto.
  13935. @end table
  13936. @anchor{vidstabdetect}
  13937. @section vidstabdetect
  13938. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13939. @ref{vidstabtransform} for pass 2.
  13940. This filter generates a file with relative translation and rotation
  13941. transform information about subsequent frames, which is then used by
  13942. the @ref{vidstabtransform} filter.
  13943. To enable compilation of this filter you need to configure FFmpeg with
  13944. @code{--enable-libvidstab}.
  13945. This filter accepts the following options:
  13946. @table @option
  13947. @item result
  13948. Set the path to the file used to write the transforms information.
  13949. Default value is @file{transforms.trf}.
  13950. @item shakiness
  13951. Set how shaky the video is and how quick the camera is. It accepts an
  13952. integer in the range 1-10, a value of 1 means little shakiness, a
  13953. value of 10 means strong shakiness. Default value is 5.
  13954. @item accuracy
  13955. Set the accuracy of the detection process. It must be a value in the
  13956. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13957. accuracy. Default value is 15.
  13958. @item stepsize
  13959. Set stepsize of the search process. The region around minimum is
  13960. scanned with 1 pixel resolution. Default value is 6.
  13961. @item mincontrast
  13962. Set minimum contrast. Below this value a local measurement field is
  13963. discarded. Must be a floating point value in the range 0-1. Default
  13964. value is 0.3.
  13965. @item tripod
  13966. Set reference frame number for tripod mode.
  13967. If enabled, the motion of the frames is compared to a reference frame
  13968. in the filtered stream, identified by the specified number. The idea
  13969. is to compensate all movements in a more-or-less static scene and keep
  13970. the camera view absolutely still.
  13971. If set to 0, it is disabled. The frames are counted starting from 1.
  13972. @item show
  13973. Show fields and transforms in the resulting frames. It accepts an
  13974. integer in the range 0-2. Default value is 0, which disables any
  13975. visualization.
  13976. @end table
  13977. @subsection Examples
  13978. @itemize
  13979. @item
  13980. Use default values:
  13981. @example
  13982. vidstabdetect
  13983. @end example
  13984. @item
  13985. Analyze strongly shaky movie and put the results in file
  13986. @file{mytransforms.trf}:
  13987. @example
  13988. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13989. @end example
  13990. @item
  13991. Visualize the result of internal transformations in the resulting
  13992. video:
  13993. @example
  13994. vidstabdetect=show=1
  13995. @end example
  13996. @item
  13997. Analyze a video with medium shakiness using @command{ffmpeg}:
  13998. @example
  13999. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14000. @end example
  14001. @end itemize
  14002. @anchor{vidstabtransform}
  14003. @section vidstabtransform
  14004. Video stabilization/deshaking: pass 2 of 2,
  14005. see @ref{vidstabdetect} for pass 1.
  14006. Read a file with transform information for each frame and
  14007. apply/compensate them. Together with the @ref{vidstabdetect}
  14008. filter this can be used to deshake videos. See also
  14009. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14010. the @ref{unsharp} filter, see below.
  14011. To enable compilation of this filter you need to configure FFmpeg with
  14012. @code{--enable-libvidstab}.
  14013. @subsection Options
  14014. @table @option
  14015. @item input
  14016. Set path to the file used to read the transforms. Default value is
  14017. @file{transforms.trf}.
  14018. @item smoothing
  14019. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14020. camera movements. Default value is 10.
  14021. For example a number of 10 means that 21 frames are used (10 in the
  14022. past and 10 in the future) to smoothen the motion in the video. A
  14023. larger value leads to a smoother video, but limits the acceleration of
  14024. the camera (pan/tilt movements). 0 is a special case where a static
  14025. camera is simulated.
  14026. @item optalgo
  14027. Set the camera path optimization algorithm.
  14028. Accepted values are:
  14029. @table @samp
  14030. @item gauss
  14031. gaussian kernel low-pass filter on camera motion (default)
  14032. @item avg
  14033. averaging on transformations
  14034. @end table
  14035. @item maxshift
  14036. Set maximal number of pixels to translate frames. Default value is -1,
  14037. meaning no limit.
  14038. @item maxangle
  14039. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14040. value is -1, meaning no limit.
  14041. @item crop
  14042. Specify how to deal with borders that may be visible due to movement
  14043. compensation.
  14044. Available values are:
  14045. @table @samp
  14046. @item keep
  14047. keep image information from previous frame (default)
  14048. @item black
  14049. fill the border black
  14050. @end table
  14051. @item invert
  14052. Invert transforms if set to 1. Default value is 0.
  14053. @item relative
  14054. Consider transforms as relative to previous frame if set to 1,
  14055. absolute if set to 0. Default value is 0.
  14056. @item zoom
  14057. Set percentage to zoom. A positive value will result in a zoom-in
  14058. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14059. zoom).
  14060. @item optzoom
  14061. Set optimal zooming to avoid borders.
  14062. Accepted values are:
  14063. @table @samp
  14064. @item 0
  14065. disabled
  14066. @item 1
  14067. optimal static zoom value is determined (only very strong movements
  14068. will lead to visible borders) (default)
  14069. @item 2
  14070. optimal adaptive zoom value is determined (no borders will be
  14071. visible), see @option{zoomspeed}
  14072. @end table
  14073. Note that the value given at zoom is added to the one calculated here.
  14074. @item zoomspeed
  14075. Set percent to zoom maximally each frame (enabled when
  14076. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14077. 0.25.
  14078. @item interpol
  14079. Specify type of interpolation.
  14080. Available values are:
  14081. @table @samp
  14082. @item no
  14083. no interpolation
  14084. @item linear
  14085. linear only horizontal
  14086. @item bilinear
  14087. linear in both directions (default)
  14088. @item bicubic
  14089. cubic in both directions (slow)
  14090. @end table
  14091. @item tripod
  14092. Enable virtual tripod mode if set to 1, which is equivalent to
  14093. @code{relative=0:smoothing=0}. Default value is 0.
  14094. Use also @code{tripod} option of @ref{vidstabdetect}.
  14095. @item debug
  14096. Increase log verbosity if set to 1. Also the detected global motions
  14097. are written to the temporary file @file{global_motions.trf}. Default
  14098. value is 0.
  14099. @end table
  14100. @subsection Examples
  14101. @itemize
  14102. @item
  14103. Use @command{ffmpeg} for a typical stabilization with default values:
  14104. @example
  14105. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14106. @end example
  14107. Note the use of the @ref{unsharp} filter which is always recommended.
  14108. @item
  14109. Zoom in a bit more and load transform data from a given file:
  14110. @example
  14111. vidstabtransform=zoom=5:input="mytransforms.trf"
  14112. @end example
  14113. @item
  14114. Smoothen the video even more:
  14115. @example
  14116. vidstabtransform=smoothing=30
  14117. @end example
  14118. @end itemize
  14119. @section vflip
  14120. Flip the input video vertically.
  14121. For example, to vertically flip a video with @command{ffmpeg}:
  14122. @example
  14123. ffmpeg -i in.avi -vf "vflip" out.avi
  14124. @end example
  14125. @section vfrdet
  14126. Detect variable frame rate video.
  14127. This filter tries to detect if the input is variable or constant frame rate.
  14128. At end it will output number of frames detected as having variable delta pts,
  14129. and ones with constant delta pts.
  14130. If there was frames with variable delta, than it will also show min and max delta
  14131. encountered.
  14132. @section vibrance
  14133. Boost or alter saturation.
  14134. The filter accepts the following options:
  14135. @table @option
  14136. @item intensity
  14137. Set strength of boost if positive value or strength of alter if negative value.
  14138. Default is 0. Allowed range is from -2 to 2.
  14139. @item rbal
  14140. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14141. @item gbal
  14142. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14143. @item bbal
  14144. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14145. @item rlum
  14146. Set the red luma coefficient.
  14147. @item glum
  14148. Set the green luma coefficient.
  14149. @item blum
  14150. Set the blue luma coefficient.
  14151. @item alternate
  14152. If @code{intensity} is negative and this is set to 1, colors will change,
  14153. otherwise colors will be less saturated, more towards gray.
  14154. @end table
  14155. @anchor{vignette}
  14156. @section vignette
  14157. Make or reverse a natural vignetting effect.
  14158. The filter accepts the following options:
  14159. @table @option
  14160. @item angle, a
  14161. Set lens angle expression as a number of radians.
  14162. The value is clipped in the @code{[0,PI/2]} range.
  14163. Default value: @code{"PI/5"}
  14164. @item x0
  14165. @item y0
  14166. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14167. by default.
  14168. @item mode
  14169. Set forward/backward mode.
  14170. Available modes are:
  14171. @table @samp
  14172. @item forward
  14173. The larger the distance from the central point, the darker the image becomes.
  14174. @item backward
  14175. The larger the distance from the central point, the brighter the image becomes.
  14176. This can be used to reverse a vignette effect, though there is no automatic
  14177. detection to extract the lens @option{angle} and other settings (yet). It can
  14178. also be used to create a burning effect.
  14179. @end table
  14180. Default value is @samp{forward}.
  14181. @item eval
  14182. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14183. It accepts the following values:
  14184. @table @samp
  14185. @item init
  14186. Evaluate expressions only once during the filter initialization.
  14187. @item frame
  14188. Evaluate expressions for each incoming frame. This is way slower than the
  14189. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14190. allows advanced dynamic expressions.
  14191. @end table
  14192. Default value is @samp{init}.
  14193. @item dither
  14194. Set dithering to reduce the circular banding effects. Default is @code{1}
  14195. (enabled).
  14196. @item aspect
  14197. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14198. Setting this value to the SAR of the input will make a rectangular vignetting
  14199. following the dimensions of the video.
  14200. Default is @code{1/1}.
  14201. @end table
  14202. @subsection Expressions
  14203. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14204. following parameters.
  14205. @table @option
  14206. @item w
  14207. @item h
  14208. input width and height
  14209. @item n
  14210. the number of input frame, starting from 0
  14211. @item pts
  14212. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14213. @var{TB} units, NAN if undefined
  14214. @item r
  14215. frame rate of the input video, NAN if the input frame rate is unknown
  14216. @item t
  14217. the PTS (Presentation TimeStamp) of the filtered video frame,
  14218. expressed in seconds, NAN if undefined
  14219. @item tb
  14220. time base of the input video
  14221. @end table
  14222. @subsection Examples
  14223. @itemize
  14224. @item
  14225. Apply simple strong vignetting effect:
  14226. @example
  14227. vignette=PI/4
  14228. @end example
  14229. @item
  14230. Make a flickering vignetting:
  14231. @example
  14232. vignette='PI/4+random(1)*PI/50':eval=frame
  14233. @end example
  14234. @end itemize
  14235. @section vmafmotion
  14236. Obtain the average vmaf motion score of a video.
  14237. It is one of the component filters of VMAF.
  14238. The obtained average motion score is printed through the logging system.
  14239. In the below example the input file @file{ref.mpg} is being processed and score
  14240. is computed.
  14241. @example
  14242. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14243. @end example
  14244. @section vstack
  14245. Stack input videos vertically.
  14246. All streams must be of same pixel format and of same width.
  14247. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14248. to create same output.
  14249. The filter accept the following option:
  14250. @table @option
  14251. @item inputs
  14252. Set number of input streams. Default is 2.
  14253. @item shortest
  14254. If set to 1, force the output to terminate when the shortest input
  14255. terminates. Default value is 0.
  14256. @end table
  14257. @section w3fdif
  14258. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14259. Deinterlacing Filter").
  14260. Based on the process described by Martin Weston for BBC R&D, and
  14261. implemented based on the de-interlace algorithm written by Jim
  14262. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14263. uses filter coefficients calculated by BBC R&D.
  14264. This filter use field-dominance information in frame to decide which
  14265. of each pair of fields to place first in the output.
  14266. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14267. There are two sets of filter coefficients, so called "simple":
  14268. and "complex". Which set of filter coefficients is used can
  14269. be set by passing an optional parameter:
  14270. @table @option
  14271. @item filter
  14272. Set the interlacing filter coefficients. Accepts one of the following values:
  14273. @table @samp
  14274. @item simple
  14275. Simple filter coefficient set.
  14276. @item complex
  14277. More-complex filter coefficient set.
  14278. @end table
  14279. Default value is @samp{complex}.
  14280. @item deint
  14281. Specify which frames to deinterlace. Accept one of the following values:
  14282. @table @samp
  14283. @item all
  14284. Deinterlace all frames,
  14285. @item interlaced
  14286. Only deinterlace frames marked as interlaced.
  14287. @end table
  14288. Default value is @samp{all}.
  14289. @end table
  14290. @section waveform
  14291. Video waveform monitor.
  14292. The waveform monitor plots color component intensity. By default luminance
  14293. only. Each column of the waveform corresponds to a column of pixels in the
  14294. source video.
  14295. It accepts the following options:
  14296. @table @option
  14297. @item mode, m
  14298. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14299. In row mode, the graph on the left side represents color component value 0 and
  14300. the right side represents value = 255. In column mode, the top side represents
  14301. color component value = 0 and bottom side represents value = 255.
  14302. @item intensity, i
  14303. Set intensity. Smaller values are useful to find out how many values of the same
  14304. luminance are distributed across input rows/columns.
  14305. Default value is @code{0.04}. Allowed range is [0, 1].
  14306. @item mirror, r
  14307. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14308. In mirrored mode, higher values will be represented on the left
  14309. side for @code{row} mode and at the top for @code{column} mode. Default is
  14310. @code{1} (mirrored).
  14311. @item display, d
  14312. Set display mode.
  14313. It accepts the following values:
  14314. @table @samp
  14315. @item overlay
  14316. Presents information identical to that in the @code{parade}, except
  14317. that the graphs representing color components are superimposed directly
  14318. over one another.
  14319. This display mode makes it easier to spot relative differences or similarities
  14320. in overlapping areas of the color components that are supposed to be identical,
  14321. such as neutral whites, grays, or blacks.
  14322. @item stack
  14323. Display separate graph for the color components side by side in
  14324. @code{row} mode or one below the other in @code{column} mode.
  14325. @item parade
  14326. Display separate graph for the color components side by side in
  14327. @code{column} mode or one below the other in @code{row} mode.
  14328. Using this display mode makes it easy to spot color casts in the highlights
  14329. and shadows of an image, by comparing the contours of the top and the bottom
  14330. graphs of each waveform. Since whites, grays, and blacks are characterized
  14331. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14332. should display three waveforms of roughly equal width/height. If not, the
  14333. correction is easy to perform by making level adjustments the three waveforms.
  14334. @end table
  14335. Default is @code{stack}.
  14336. @item components, c
  14337. Set which color components to display. Default is 1, which means only luminance
  14338. or red color component if input is in RGB colorspace. If is set for example to
  14339. 7 it will display all 3 (if) available color components.
  14340. @item envelope, e
  14341. @table @samp
  14342. @item none
  14343. No envelope, this is default.
  14344. @item instant
  14345. Instant envelope, minimum and maximum values presented in graph will be easily
  14346. visible even with small @code{step} value.
  14347. @item peak
  14348. Hold minimum and maximum values presented in graph across time. This way you
  14349. can still spot out of range values without constantly looking at waveforms.
  14350. @item peak+instant
  14351. Peak and instant envelope combined together.
  14352. @end table
  14353. @item filter, f
  14354. @table @samp
  14355. @item lowpass
  14356. No filtering, this is default.
  14357. @item flat
  14358. Luma and chroma combined together.
  14359. @item aflat
  14360. Similar as above, but shows difference between blue and red chroma.
  14361. @item xflat
  14362. Similar as above, but use different colors.
  14363. @item chroma
  14364. Displays only chroma.
  14365. @item color
  14366. Displays actual color value on waveform.
  14367. @item acolor
  14368. Similar as above, but with luma showing frequency of chroma values.
  14369. @end table
  14370. @item graticule, g
  14371. Set which graticule to display.
  14372. @table @samp
  14373. @item none
  14374. Do not display graticule.
  14375. @item green
  14376. Display green graticule showing legal broadcast ranges.
  14377. @item orange
  14378. Display orange graticule showing legal broadcast ranges.
  14379. @end table
  14380. @item opacity, o
  14381. Set graticule opacity.
  14382. @item flags, fl
  14383. Set graticule flags.
  14384. @table @samp
  14385. @item numbers
  14386. Draw numbers above lines. By default enabled.
  14387. @item dots
  14388. Draw dots instead of lines.
  14389. @end table
  14390. @item scale, s
  14391. Set scale used for displaying graticule.
  14392. @table @samp
  14393. @item digital
  14394. @item millivolts
  14395. @item ire
  14396. @end table
  14397. Default is digital.
  14398. @item bgopacity, b
  14399. Set background opacity.
  14400. @end table
  14401. @section weave, doubleweave
  14402. The @code{weave} takes a field-based video input and join
  14403. each two sequential fields into single frame, producing a new double
  14404. height clip with half the frame rate and half the frame count.
  14405. The @code{doubleweave} works same as @code{weave} but without
  14406. halving frame rate and frame count.
  14407. It accepts the following option:
  14408. @table @option
  14409. @item first_field
  14410. Set first field. Available values are:
  14411. @table @samp
  14412. @item top, t
  14413. Set the frame as top-field-first.
  14414. @item bottom, b
  14415. Set the frame as bottom-field-first.
  14416. @end table
  14417. @end table
  14418. @subsection Examples
  14419. @itemize
  14420. @item
  14421. Interlace video using @ref{select} and @ref{separatefields} filter:
  14422. @example
  14423. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14424. @end example
  14425. @end itemize
  14426. @section xbr
  14427. Apply the xBR high-quality magnification filter which is designed for pixel
  14428. art. It follows a set of edge-detection rules, see
  14429. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14430. It accepts the following option:
  14431. @table @option
  14432. @item n
  14433. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14434. @code{3xBR} and @code{4} for @code{4xBR}.
  14435. Default is @code{3}.
  14436. @end table
  14437. @section xmedian
  14438. Pick median pixels from several input videos.
  14439. The filter accept the following options:
  14440. @table @option
  14441. @item inputs
  14442. Set number of inputs.
  14443. Default is 3. Allowed range is from 3 to 255.
  14444. If number of inputs is even number, than result will be mean value between two median values.
  14445. @item planes
  14446. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14447. @end table
  14448. @section xstack
  14449. Stack video inputs into custom layout.
  14450. All streams must be of same pixel format.
  14451. The filter accept the following option:
  14452. @table @option
  14453. @item inputs
  14454. Set number of input streams. Default is 2.
  14455. @item layout
  14456. Specify layout of inputs.
  14457. This option requires the desired layout configuration to be explicitly set by the user.
  14458. This sets position of each video input in output. Each input
  14459. is separated by '|'.
  14460. The first number represents the column, and the second number represents the row.
  14461. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14462. where X is video input from which to take width or height.
  14463. Multiple values can be used when separated by '+'. In such
  14464. case values are summed together.
  14465. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14466. a layout must be set by the user.
  14467. @item shortest
  14468. If set to 1, force the output to terminate when the shortest input
  14469. terminates. Default value is 0.
  14470. @end table
  14471. @subsection Examples
  14472. @itemize
  14473. @item
  14474. Display 4 inputs into 2x2 grid,
  14475. note that if inputs are of different sizes unused gaps might appear,
  14476. as not all of output video is used.
  14477. @example
  14478. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14479. @end example
  14480. @item
  14481. Display 4 inputs into 1x4 grid,
  14482. note that if inputs are of different sizes unused gaps might appear,
  14483. as not all of output video is used.
  14484. @example
  14485. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14486. @end example
  14487. @item
  14488. Display 9 inputs into 3x3 grid,
  14489. note that if inputs are of different sizes unused gaps might appear,
  14490. as not all of output video is used.
  14491. @example
  14492. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14493. @end example
  14494. @end itemize
  14495. @anchor{yadif}
  14496. @section yadif
  14497. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14498. filter").
  14499. It accepts the following parameters:
  14500. @table @option
  14501. @item mode
  14502. The interlacing mode to adopt. It accepts one of the following values:
  14503. @table @option
  14504. @item 0, send_frame
  14505. Output one frame for each frame.
  14506. @item 1, send_field
  14507. Output one frame for each field.
  14508. @item 2, send_frame_nospatial
  14509. Like @code{send_frame}, but it skips the spatial interlacing check.
  14510. @item 3, send_field_nospatial
  14511. Like @code{send_field}, but it skips the spatial interlacing check.
  14512. @end table
  14513. The default value is @code{send_frame}.
  14514. @item parity
  14515. The picture field parity assumed for the input interlaced video. It accepts one
  14516. of the following values:
  14517. @table @option
  14518. @item 0, tff
  14519. Assume the top field is first.
  14520. @item 1, bff
  14521. Assume the bottom field is first.
  14522. @item -1, auto
  14523. Enable automatic detection of field parity.
  14524. @end table
  14525. The default value is @code{auto}.
  14526. If the interlacing is unknown or the decoder does not export this information,
  14527. top field first will be assumed.
  14528. @item deint
  14529. Specify which frames to deinterlace. Accept one of the following
  14530. values:
  14531. @table @option
  14532. @item 0, all
  14533. Deinterlace all frames.
  14534. @item 1, interlaced
  14535. Only deinterlace frames marked as interlaced.
  14536. @end table
  14537. The default value is @code{all}.
  14538. @end table
  14539. @section yadif_cuda
  14540. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14541. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14542. and/or nvenc.
  14543. It accepts the following parameters:
  14544. @table @option
  14545. @item mode
  14546. The interlacing mode to adopt. It accepts one of the following values:
  14547. @table @option
  14548. @item 0, send_frame
  14549. Output one frame for each frame.
  14550. @item 1, send_field
  14551. Output one frame for each field.
  14552. @item 2, send_frame_nospatial
  14553. Like @code{send_frame}, but it skips the spatial interlacing check.
  14554. @item 3, send_field_nospatial
  14555. Like @code{send_field}, but it skips the spatial interlacing check.
  14556. @end table
  14557. The default value is @code{send_frame}.
  14558. @item parity
  14559. The picture field parity assumed for the input interlaced video. It accepts one
  14560. of the following values:
  14561. @table @option
  14562. @item 0, tff
  14563. Assume the top field is first.
  14564. @item 1, bff
  14565. Assume the bottom field is first.
  14566. @item -1, auto
  14567. Enable automatic detection of field parity.
  14568. @end table
  14569. The default value is @code{auto}.
  14570. If the interlacing is unknown or the decoder does not export this information,
  14571. top field first will be assumed.
  14572. @item deint
  14573. Specify which frames to deinterlace. Accept one of the following
  14574. values:
  14575. @table @option
  14576. @item 0, all
  14577. Deinterlace all frames.
  14578. @item 1, interlaced
  14579. Only deinterlace frames marked as interlaced.
  14580. @end table
  14581. The default value is @code{all}.
  14582. @end table
  14583. @section zoompan
  14584. Apply Zoom & Pan effect.
  14585. This filter accepts the following options:
  14586. @table @option
  14587. @item zoom, z
  14588. Set the zoom expression. Range is 1-10. Default is 1.
  14589. @item x
  14590. @item y
  14591. Set the x and y expression. Default is 0.
  14592. @item d
  14593. Set the duration expression in number of frames.
  14594. This sets for how many number of frames effect will last for
  14595. single input image.
  14596. @item s
  14597. Set the output image size, default is 'hd720'.
  14598. @item fps
  14599. Set the output frame rate, default is '25'.
  14600. @end table
  14601. Each expression can contain the following constants:
  14602. @table @option
  14603. @item in_w, iw
  14604. Input width.
  14605. @item in_h, ih
  14606. Input height.
  14607. @item out_w, ow
  14608. Output width.
  14609. @item out_h, oh
  14610. Output height.
  14611. @item in
  14612. Input frame count.
  14613. @item on
  14614. Output frame count.
  14615. @item x
  14616. @item y
  14617. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14618. for current input frame.
  14619. @item px
  14620. @item py
  14621. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14622. not yet such frame (first input frame).
  14623. @item zoom
  14624. Last calculated zoom from 'z' expression for current input frame.
  14625. @item pzoom
  14626. Last calculated zoom of last output frame of previous input frame.
  14627. @item duration
  14628. Number of output frames for current input frame. Calculated from 'd' expression
  14629. for each input frame.
  14630. @item pduration
  14631. number of output frames created for previous input frame
  14632. @item a
  14633. Rational number: input width / input height
  14634. @item sar
  14635. sample aspect ratio
  14636. @item dar
  14637. display aspect ratio
  14638. @end table
  14639. @subsection Examples
  14640. @itemize
  14641. @item
  14642. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14643. @example
  14644. 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
  14645. @end example
  14646. @item
  14647. Zoom-in up to 1.5 and pan always at center of picture:
  14648. @example
  14649. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14650. @end example
  14651. @item
  14652. Same as above but without pausing:
  14653. @example
  14654. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14655. @end example
  14656. @end itemize
  14657. @anchor{zscale}
  14658. @section zscale
  14659. Scale (resize) the input video, using the z.lib library:
  14660. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14661. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14662. The zscale filter forces the output display aspect ratio to be the same
  14663. as the input, by changing the output sample aspect ratio.
  14664. If the input image format is different from the format requested by
  14665. the next filter, the zscale filter will convert the input to the
  14666. requested format.
  14667. @subsection Options
  14668. The filter accepts the following options.
  14669. @table @option
  14670. @item width, w
  14671. @item height, h
  14672. Set the output video dimension expression. Default value is the input
  14673. dimension.
  14674. If the @var{width} or @var{w} value is 0, the input width is used for
  14675. the output. If the @var{height} or @var{h} value is 0, the input height
  14676. is used for the output.
  14677. If one and only one of the values is -n with n >= 1, the zscale filter
  14678. will use a value that maintains the aspect ratio of the input image,
  14679. calculated from the other specified dimension. After that it will,
  14680. however, make sure that the calculated dimension is divisible by n and
  14681. adjust the value if necessary.
  14682. If both values are -n with n >= 1, the behavior will be identical to
  14683. both values being set to 0 as previously detailed.
  14684. See below for the list of accepted constants for use in the dimension
  14685. expression.
  14686. @item size, s
  14687. Set the video size. For the syntax of this option, check the
  14688. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14689. @item dither, d
  14690. Set the dither type.
  14691. Possible values are:
  14692. @table @var
  14693. @item none
  14694. @item ordered
  14695. @item random
  14696. @item error_diffusion
  14697. @end table
  14698. Default is none.
  14699. @item filter, f
  14700. Set the resize filter type.
  14701. Possible values are:
  14702. @table @var
  14703. @item point
  14704. @item bilinear
  14705. @item bicubic
  14706. @item spline16
  14707. @item spline36
  14708. @item lanczos
  14709. @end table
  14710. Default is bilinear.
  14711. @item range, r
  14712. Set the color range.
  14713. Possible values are:
  14714. @table @var
  14715. @item input
  14716. @item limited
  14717. @item full
  14718. @end table
  14719. Default is same as input.
  14720. @item primaries, p
  14721. Set the color primaries.
  14722. Possible values are:
  14723. @table @var
  14724. @item input
  14725. @item 709
  14726. @item unspecified
  14727. @item 170m
  14728. @item 240m
  14729. @item 2020
  14730. @end table
  14731. Default is same as input.
  14732. @item transfer, t
  14733. Set the transfer characteristics.
  14734. Possible values are:
  14735. @table @var
  14736. @item input
  14737. @item 709
  14738. @item unspecified
  14739. @item 601
  14740. @item linear
  14741. @item 2020_10
  14742. @item 2020_12
  14743. @item smpte2084
  14744. @item iec61966-2-1
  14745. @item arib-std-b67
  14746. @end table
  14747. Default is same as input.
  14748. @item matrix, m
  14749. Set the colorspace matrix.
  14750. Possible value are:
  14751. @table @var
  14752. @item input
  14753. @item 709
  14754. @item unspecified
  14755. @item 470bg
  14756. @item 170m
  14757. @item 2020_ncl
  14758. @item 2020_cl
  14759. @end table
  14760. Default is same as input.
  14761. @item rangein, rin
  14762. Set the input color range.
  14763. Possible values are:
  14764. @table @var
  14765. @item input
  14766. @item limited
  14767. @item full
  14768. @end table
  14769. Default is same as input.
  14770. @item primariesin, pin
  14771. Set the input color primaries.
  14772. Possible values are:
  14773. @table @var
  14774. @item input
  14775. @item 709
  14776. @item unspecified
  14777. @item 170m
  14778. @item 240m
  14779. @item 2020
  14780. @end table
  14781. Default is same as input.
  14782. @item transferin, tin
  14783. Set the input transfer characteristics.
  14784. Possible values are:
  14785. @table @var
  14786. @item input
  14787. @item 709
  14788. @item unspecified
  14789. @item 601
  14790. @item linear
  14791. @item 2020_10
  14792. @item 2020_12
  14793. @end table
  14794. Default is same as input.
  14795. @item matrixin, min
  14796. Set the input colorspace matrix.
  14797. Possible value are:
  14798. @table @var
  14799. @item input
  14800. @item 709
  14801. @item unspecified
  14802. @item 470bg
  14803. @item 170m
  14804. @item 2020_ncl
  14805. @item 2020_cl
  14806. @end table
  14807. @item chromal, c
  14808. Set the output chroma location.
  14809. Possible values are:
  14810. @table @var
  14811. @item input
  14812. @item left
  14813. @item center
  14814. @item topleft
  14815. @item top
  14816. @item bottomleft
  14817. @item bottom
  14818. @end table
  14819. @item chromalin, cin
  14820. Set the input chroma location.
  14821. Possible values are:
  14822. @table @var
  14823. @item input
  14824. @item left
  14825. @item center
  14826. @item topleft
  14827. @item top
  14828. @item bottomleft
  14829. @item bottom
  14830. @end table
  14831. @item npl
  14832. Set the nominal peak luminance.
  14833. @end table
  14834. The values of the @option{w} and @option{h} options are expressions
  14835. containing the following constants:
  14836. @table @var
  14837. @item in_w
  14838. @item in_h
  14839. The input width and height
  14840. @item iw
  14841. @item ih
  14842. These are the same as @var{in_w} and @var{in_h}.
  14843. @item out_w
  14844. @item out_h
  14845. The output (scaled) width and height
  14846. @item ow
  14847. @item oh
  14848. These are the same as @var{out_w} and @var{out_h}
  14849. @item a
  14850. The same as @var{iw} / @var{ih}
  14851. @item sar
  14852. input sample aspect ratio
  14853. @item dar
  14854. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14855. @item hsub
  14856. @item vsub
  14857. horizontal and vertical input chroma subsample values. For example for the
  14858. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14859. @item ohsub
  14860. @item ovsub
  14861. horizontal and vertical output chroma subsample values. For example for the
  14862. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14863. @end table
  14864. @table @option
  14865. @end table
  14866. @c man end VIDEO FILTERS
  14867. @chapter OpenCL Video Filters
  14868. @c man begin OPENCL VIDEO FILTERS
  14869. Below is a description of the currently available OpenCL video filters.
  14870. To enable compilation of these filters you need to configure FFmpeg with
  14871. @code{--enable-opencl}.
  14872. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14873. @table @option
  14874. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14875. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14876. given device parameters.
  14877. @item -filter_hw_device @var{name}
  14878. Pass the hardware device called @var{name} to all filters in any filter graph.
  14879. @end table
  14880. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14881. @itemize
  14882. @item
  14883. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14884. @example
  14885. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14886. @end example
  14887. @end itemize
  14888. 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.
  14889. @section avgblur_opencl
  14890. Apply average blur filter.
  14891. The filter accepts the following options:
  14892. @table @option
  14893. @item sizeX
  14894. Set horizontal radius size.
  14895. Range is @code{[1, 1024]} and default value is @code{1}.
  14896. @item planes
  14897. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14898. @item sizeY
  14899. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14900. @end table
  14901. @subsection Example
  14902. @itemize
  14903. @item
  14904. 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.
  14905. @example
  14906. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14907. @end example
  14908. @end itemize
  14909. @section boxblur_opencl
  14910. Apply a boxblur algorithm to the input video.
  14911. It accepts the following parameters:
  14912. @table @option
  14913. @item luma_radius, lr
  14914. @item luma_power, lp
  14915. @item chroma_radius, cr
  14916. @item chroma_power, cp
  14917. @item alpha_radius, ar
  14918. @item alpha_power, ap
  14919. @end table
  14920. A description of the accepted options follows.
  14921. @table @option
  14922. @item luma_radius, lr
  14923. @item chroma_radius, cr
  14924. @item alpha_radius, ar
  14925. Set an expression for the box radius in pixels used for blurring the
  14926. corresponding input plane.
  14927. The radius value must be a non-negative number, and must not be
  14928. greater than the value of the expression @code{min(w,h)/2} for the
  14929. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14930. planes.
  14931. Default value for @option{luma_radius} is "2". If not specified,
  14932. @option{chroma_radius} and @option{alpha_radius} default to the
  14933. corresponding value set for @option{luma_radius}.
  14934. The expressions can contain the following constants:
  14935. @table @option
  14936. @item w
  14937. @item h
  14938. The input width and height in pixels.
  14939. @item cw
  14940. @item ch
  14941. The input chroma image width and height in pixels.
  14942. @item hsub
  14943. @item vsub
  14944. The horizontal and vertical chroma subsample values. For example, for the
  14945. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14946. @end table
  14947. @item luma_power, lp
  14948. @item chroma_power, cp
  14949. @item alpha_power, ap
  14950. Specify how many times the boxblur filter is applied to the
  14951. corresponding plane.
  14952. Default value for @option{luma_power} is 2. If not specified,
  14953. @option{chroma_power} and @option{alpha_power} default to the
  14954. corresponding value set for @option{luma_power}.
  14955. A value of 0 will disable the effect.
  14956. @end table
  14957. @subsection Examples
  14958. 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.
  14959. @itemize
  14960. @item
  14961. Apply a boxblur filter with the luma, chroma, and alpha radius
  14962. 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.
  14963. @example
  14964. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14965. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14966. @end example
  14967. @item
  14968. 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.
  14969. For the luma plane, a 2x2 box radius will be run once.
  14970. For the chroma plane, a 4x4 box radius will be run 5 times.
  14971. For the alpha plane, a 3x3 box radius will be run 7 times.
  14972. @example
  14973. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14974. @end example
  14975. @end itemize
  14976. @section convolution_opencl
  14977. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14978. The filter accepts the following options:
  14979. @table @option
  14980. @item 0m
  14981. @item 1m
  14982. @item 2m
  14983. @item 3m
  14984. Set matrix for each plane.
  14985. Matrix is sequence of 9, 25 or 49 signed numbers.
  14986. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14987. @item 0rdiv
  14988. @item 1rdiv
  14989. @item 2rdiv
  14990. @item 3rdiv
  14991. Set multiplier for calculated value for each plane.
  14992. If unset or 0, it will be sum of all matrix elements.
  14993. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14994. @item 0bias
  14995. @item 1bias
  14996. @item 2bias
  14997. @item 3bias
  14998. Set bias for each plane. This value is added to the result of the multiplication.
  14999. Useful for making the overall image brighter or darker.
  15000. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15001. @end table
  15002. @subsection Examples
  15003. @itemize
  15004. @item
  15005. Apply sharpen:
  15006. @example
  15007. -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
  15008. @end example
  15009. @item
  15010. Apply blur:
  15011. @example
  15012. -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
  15013. @end example
  15014. @item
  15015. Apply edge enhance:
  15016. @example
  15017. -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
  15018. @end example
  15019. @item
  15020. Apply edge detect:
  15021. @example
  15022. -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
  15023. @end example
  15024. @item
  15025. Apply laplacian edge detector which includes diagonals:
  15026. @example
  15027. -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
  15028. @end example
  15029. @item
  15030. Apply emboss:
  15031. @example
  15032. -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
  15033. @end example
  15034. @end itemize
  15035. @section dilation_opencl
  15036. Apply dilation effect to the video.
  15037. This filter replaces the pixel by the local(3x3) maximum.
  15038. It accepts the following options:
  15039. @table @option
  15040. @item threshold0
  15041. @item threshold1
  15042. @item threshold2
  15043. @item threshold3
  15044. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15045. If @code{0}, plane will remain unchanged.
  15046. @item coordinates
  15047. Flag which specifies the pixel to refer to.
  15048. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15049. Flags to local 3x3 coordinates region centered on @code{x}:
  15050. 1 2 3
  15051. 4 x 5
  15052. 6 7 8
  15053. @end table
  15054. @subsection Example
  15055. @itemize
  15056. @item
  15057. 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.
  15058. @example
  15059. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15060. @end example
  15061. @end itemize
  15062. @section erosion_opencl
  15063. Apply erosion effect to the video.
  15064. This filter replaces the pixel by the local(3x3) minimum.
  15065. It accepts the following options:
  15066. @table @option
  15067. @item threshold0
  15068. @item threshold1
  15069. @item threshold2
  15070. @item threshold3
  15071. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15072. If @code{0}, plane will remain unchanged.
  15073. @item coordinates
  15074. Flag which specifies the pixel to refer to.
  15075. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15076. Flags to local 3x3 coordinates region centered on @code{x}:
  15077. 1 2 3
  15078. 4 x 5
  15079. 6 7 8
  15080. @end table
  15081. @subsection Example
  15082. @itemize
  15083. @item
  15084. 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.
  15085. @example
  15086. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15087. @end example
  15088. @end itemize
  15089. @section colorkey_opencl
  15090. RGB colorspace color keying.
  15091. The filter accepts the following options:
  15092. @table @option
  15093. @item color
  15094. The color which will be replaced with transparency.
  15095. @item similarity
  15096. Similarity percentage with the key color.
  15097. 0.01 matches only the exact key color, while 1.0 matches everything.
  15098. @item blend
  15099. Blend percentage.
  15100. 0.0 makes pixels either fully transparent, or not transparent at all.
  15101. Higher values result in semi-transparent pixels, with a higher transparency
  15102. the more similar the pixels color is to the key color.
  15103. @end table
  15104. @subsection Examples
  15105. @itemize
  15106. @item
  15107. Make every semi-green pixel in the input transparent with some slight blending:
  15108. @example
  15109. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15110. @end example
  15111. @end itemize
  15112. @section deshake_opencl
  15113. Feature-point based video stabilization filter.
  15114. The filter accepts the following options:
  15115. @table @option
  15116. @item tripod
  15117. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15118. @item debug
  15119. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15120. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15121. Viewing point matches in the output video is only supported for RGB input.
  15122. Defaults to @code{0}.
  15123. @item adaptive_crop
  15124. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15125. Defaults to @code{1}.
  15126. @item refine_features
  15127. Whether or not feature points should be refined at a sub-pixel level.
  15128. This can be turned off for a slight performance gain at the cost of precision.
  15129. Defaults to @code{1}.
  15130. @item smooth_strength
  15131. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15132. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15133. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15134. Defaults to @code{0.0}.
  15135. @item smooth_window_multiplier
  15136. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15137. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15138. Acceptable values range from @code{0.1} to @code{10.0}.
  15139. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15140. potentially improving smoothness, but also increase latency and memory usage.
  15141. Defaults to @code{2.0}.
  15142. @end table
  15143. @subsection Examples
  15144. @itemize
  15145. @item
  15146. Stabilize a video with a fixed, medium smoothing strength:
  15147. @example
  15148. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15149. @end example
  15150. @item
  15151. Stabilize a video with debugging (both in console and in rendered video):
  15152. @example
  15153. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15154. @end example
  15155. @end itemize
  15156. @section nlmeans_opencl
  15157. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15158. @section overlay_opencl
  15159. Overlay one video on top of another.
  15160. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15161. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15162. The filter accepts the following options:
  15163. @table @option
  15164. @item x
  15165. Set the x coordinate of the overlaid video on the main video.
  15166. Default value is @code{0}.
  15167. @item y
  15168. Set the x coordinate of the overlaid video on the main video.
  15169. Default value is @code{0}.
  15170. @end table
  15171. @subsection Examples
  15172. @itemize
  15173. @item
  15174. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15175. @example
  15176. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15177. @end example
  15178. @item
  15179. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15180. @example
  15181. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15182. @end example
  15183. @end itemize
  15184. @section prewitt_opencl
  15185. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15186. The filter accepts the following option:
  15187. @table @option
  15188. @item planes
  15189. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15190. @item scale
  15191. Set value which will be multiplied with filtered result.
  15192. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15193. @item delta
  15194. Set value which will be added to filtered result.
  15195. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15196. @end table
  15197. @subsection Example
  15198. @itemize
  15199. @item
  15200. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15201. @example
  15202. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15203. @end example
  15204. @end itemize
  15205. @section roberts_opencl
  15206. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15207. The filter accepts the following option:
  15208. @table @option
  15209. @item planes
  15210. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15211. @item scale
  15212. Set value which will be multiplied with filtered result.
  15213. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15214. @item delta
  15215. Set value which will be added to filtered result.
  15216. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15217. @end table
  15218. @subsection Example
  15219. @itemize
  15220. @item
  15221. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15222. @example
  15223. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15224. @end example
  15225. @end itemize
  15226. @section sobel_opencl
  15227. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15228. The filter accepts the following option:
  15229. @table @option
  15230. @item planes
  15231. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15232. @item scale
  15233. Set value which will be multiplied with filtered result.
  15234. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15235. @item delta
  15236. Set value which will be added to filtered result.
  15237. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15238. @end table
  15239. @subsection Example
  15240. @itemize
  15241. @item
  15242. Apply sobel operator with scale set to 2 and delta set to 10
  15243. @example
  15244. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15245. @end example
  15246. @end itemize
  15247. @section tonemap_opencl
  15248. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15249. It accepts the following parameters:
  15250. @table @option
  15251. @item tonemap
  15252. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15253. @item param
  15254. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15255. @item desat
  15256. Apply desaturation for highlights that exceed this level of brightness. The
  15257. higher the parameter, the more color information will be preserved. This
  15258. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15259. (smoothly) turning into white instead. This makes images feel more natural,
  15260. at the cost of reducing information about out-of-range colors.
  15261. The default value is 0.5, and the algorithm here is a little different from
  15262. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15263. @item threshold
  15264. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15265. is used to detect whether the scene has changed or not. If the distance between
  15266. the current frame average brightness and the current running average exceeds
  15267. a threshold value, we would re-calculate scene average and peak brightness.
  15268. The default value is 0.2.
  15269. @item format
  15270. Specify the output pixel format.
  15271. Currently supported formats are:
  15272. @table @var
  15273. @item p010
  15274. @item nv12
  15275. @end table
  15276. @item range, r
  15277. Set the output color range.
  15278. Possible values are:
  15279. @table @var
  15280. @item tv/mpeg
  15281. @item pc/jpeg
  15282. @end table
  15283. Default is same as input.
  15284. @item primaries, p
  15285. Set the output color primaries.
  15286. Possible values are:
  15287. @table @var
  15288. @item bt709
  15289. @item bt2020
  15290. @end table
  15291. Default is same as input.
  15292. @item transfer, t
  15293. Set the output transfer characteristics.
  15294. Possible values are:
  15295. @table @var
  15296. @item bt709
  15297. @item bt2020
  15298. @end table
  15299. Default is bt709.
  15300. @item matrix, m
  15301. Set the output colorspace matrix.
  15302. Possible value are:
  15303. @table @var
  15304. @item bt709
  15305. @item bt2020
  15306. @end table
  15307. Default is same as input.
  15308. @end table
  15309. @subsection Example
  15310. @itemize
  15311. @item
  15312. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15313. @example
  15314. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15315. @end example
  15316. @end itemize
  15317. @section unsharp_opencl
  15318. Sharpen or blur the input video.
  15319. It accepts the following parameters:
  15320. @table @option
  15321. @item luma_msize_x, lx
  15322. Set the luma matrix horizontal size.
  15323. Range is @code{[1, 23]} and default value is @code{5}.
  15324. @item luma_msize_y, ly
  15325. Set the luma matrix vertical size.
  15326. Range is @code{[1, 23]} and default value is @code{5}.
  15327. @item luma_amount, la
  15328. Set the luma effect strength.
  15329. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15330. Negative values will blur the input video, while positive values will
  15331. sharpen it, a value of zero will disable the effect.
  15332. @item chroma_msize_x, cx
  15333. Set the chroma matrix horizontal size.
  15334. Range is @code{[1, 23]} and default value is @code{5}.
  15335. @item chroma_msize_y, cy
  15336. Set the chroma matrix vertical size.
  15337. Range is @code{[1, 23]} and default value is @code{5}.
  15338. @item chroma_amount, ca
  15339. Set the chroma effect strength.
  15340. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15341. Negative values will blur the input video, while positive values will
  15342. sharpen it, a value of zero will disable the effect.
  15343. @end table
  15344. All parameters are optional and default to the equivalent of the
  15345. string '5:5:1.0:5:5:0.0'.
  15346. @subsection Examples
  15347. @itemize
  15348. @item
  15349. Apply strong luma sharpen effect:
  15350. @example
  15351. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15352. @end example
  15353. @item
  15354. Apply a strong blur of both luma and chroma parameters:
  15355. @example
  15356. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15357. @end example
  15358. @end itemize
  15359. @c man end OPENCL VIDEO FILTERS
  15360. @chapter Video Sources
  15361. @c man begin VIDEO SOURCES
  15362. Below is a description of the currently available video sources.
  15363. @section buffer
  15364. Buffer video frames, and make them available to the filter chain.
  15365. This source is mainly intended for a programmatic use, in particular
  15366. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15367. It accepts the following parameters:
  15368. @table @option
  15369. @item video_size
  15370. Specify the size (width and height) of the buffered video frames. For the
  15371. syntax of this option, check the
  15372. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15373. @item width
  15374. The input video width.
  15375. @item height
  15376. The input video height.
  15377. @item pix_fmt
  15378. A string representing the pixel format of the buffered video frames.
  15379. It may be a number corresponding to a pixel format, or a pixel format
  15380. name.
  15381. @item time_base
  15382. Specify the timebase assumed by the timestamps of the buffered frames.
  15383. @item frame_rate
  15384. Specify the frame rate expected for the video stream.
  15385. @item pixel_aspect, sar
  15386. The sample (pixel) aspect ratio of the input video.
  15387. @item sws_param
  15388. Specify the optional parameters to be used for the scale filter which
  15389. is automatically inserted when an input change is detected in the
  15390. input size or format.
  15391. @item hw_frames_ctx
  15392. When using a hardware pixel format, this should be a reference to an
  15393. AVHWFramesContext describing input frames.
  15394. @end table
  15395. For example:
  15396. @example
  15397. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15398. @end example
  15399. will instruct the source to accept video frames with size 320x240 and
  15400. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15401. square pixels (1:1 sample aspect ratio).
  15402. Since the pixel format with name "yuv410p" corresponds to the number 6
  15403. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15404. this example corresponds to:
  15405. @example
  15406. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15407. @end example
  15408. Alternatively, the options can be specified as a flat string, but this
  15409. syntax is deprecated:
  15410. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15411. @section cellauto
  15412. Create a pattern generated by an elementary cellular automaton.
  15413. The initial state of the cellular automaton can be defined through the
  15414. @option{filename} and @option{pattern} options. If such options are
  15415. not specified an initial state is created randomly.
  15416. At each new frame a new row in the video is filled with the result of
  15417. the cellular automaton next generation. The behavior when the whole
  15418. frame is filled is defined by the @option{scroll} option.
  15419. This source accepts the following options:
  15420. @table @option
  15421. @item filename, f
  15422. Read the initial cellular automaton state, i.e. the starting row, from
  15423. the specified file.
  15424. In the file, each non-whitespace character is considered an alive
  15425. cell, a newline will terminate the row, and further characters in the
  15426. file will be ignored.
  15427. @item pattern, p
  15428. Read the initial cellular automaton state, i.e. the starting row, from
  15429. the specified string.
  15430. Each non-whitespace character in the string is considered an alive
  15431. cell, a newline will terminate the row, and further characters in the
  15432. string will be ignored.
  15433. @item rate, r
  15434. Set the video rate, that is the number of frames generated per second.
  15435. Default is 25.
  15436. @item random_fill_ratio, ratio
  15437. Set the random fill ratio for the initial cellular automaton row. It
  15438. is a floating point number value ranging from 0 to 1, defaults to
  15439. 1/PHI.
  15440. This option is ignored when a file or a pattern is specified.
  15441. @item random_seed, seed
  15442. Set the seed for filling randomly the initial row, must be an integer
  15443. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15444. set to -1, the filter will try to use a good random seed on a best
  15445. effort basis.
  15446. @item rule
  15447. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15448. Default value is 110.
  15449. @item size, s
  15450. Set the size of the output video. For the syntax of this option, check the
  15451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15452. If @option{filename} or @option{pattern} is specified, the size is set
  15453. by default to the width of the specified initial state row, and the
  15454. height is set to @var{width} * PHI.
  15455. If @option{size} is set, it must contain the width of the specified
  15456. pattern string, and the specified pattern will be centered in the
  15457. larger row.
  15458. If a filename or a pattern string is not specified, the size value
  15459. defaults to "320x518" (used for a randomly generated initial state).
  15460. @item scroll
  15461. If set to 1, scroll the output upward when all the rows in the output
  15462. have been already filled. If set to 0, the new generated row will be
  15463. written over the top row just after the bottom row is filled.
  15464. Defaults to 1.
  15465. @item start_full, full
  15466. If set to 1, completely fill the output with generated rows before
  15467. outputting the first frame.
  15468. This is the default behavior, for disabling set the value to 0.
  15469. @item stitch
  15470. If set to 1, stitch the left and right row edges together.
  15471. This is the default behavior, for disabling set the value to 0.
  15472. @end table
  15473. @subsection Examples
  15474. @itemize
  15475. @item
  15476. Read the initial state from @file{pattern}, and specify an output of
  15477. size 200x400.
  15478. @example
  15479. cellauto=f=pattern:s=200x400
  15480. @end example
  15481. @item
  15482. Generate a random initial row with a width of 200 cells, with a fill
  15483. ratio of 2/3:
  15484. @example
  15485. cellauto=ratio=2/3:s=200x200
  15486. @end example
  15487. @item
  15488. Create a pattern generated by rule 18 starting by a single alive cell
  15489. centered on an initial row with width 100:
  15490. @example
  15491. cellauto=p=@@:s=100x400:full=0:rule=18
  15492. @end example
  15493. @item
  15494. Specify a more elaborated initial pattern:
  15495. @example
  15496. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15497. @end example
  15498. @end itemize
  15499. @anchor{coreimagesrc}
  15500. @section coreimagesrc
  15501. Video source generated on GPU using Apple's CoreImage API on OSX.
  15502. This video source is a specialized version of the @ref{coreimage} video filter.
  15503. Use a core image generator at the beginning of the applied filterchain to
  15504. generate the content.
  15505. The coreimagesrc video source accepts the following options:
  15506. @table @option
  15507. @item list_generators
  15508. List all available generators along with all their respective options as well as
  15509. possible minimum and maximum values along with the default values.
  15510. @example
  15511. list_generators=true
  15512. @end example
  15513. @item size, s
  15514. Specify the size of the sourced video. For the syntax of this option, check the
  15515. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15516. The default value is @code{320x240}.
  15517. @item rate, r
  15518. Specify the frame rate of the sourced video, as the number of frames
  15519. generated per second. It has to be a string in the format
  15520. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15521. number or a valid video frame rate abbreviation. The default value is
  15522. "25".
  15523. @item sar
  15524. Set the sample aspect ratio of the sourced video.
  15525. @item duration, d
  15526. Set the duration of the sourced video. See
  15527. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15528. for the accepted syntax.
  15529. If not specified, or the expressed duration is negative, the video is
  15530. supposed to be generated forever.
  15531. @end table
  15532. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15533. A complete filterchain can be used for further processing of the
  15534. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15535. and examples for details.
  15536. @subsection Examples
  15537. @itemize
  15538. @item
  15539. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15540. given as complete and escaped command-line for Apple's standard bash shell:
  15541. @example
  15542. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15543. @end example
  15544. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15545. need for a nullsrc video source.
  15546. @end itemize
  15547. @section mandelbrot
  15548. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15549. point specified with @var{start_x} and @var{start_y}.
  15550. This source accepts the following options:
  15551. @table @option
  15552. @item end_pts
  15553. Set the terminal pts value. Default value is 400.
  15554. @item end_scale
  15555. Set the terminal scale value.
  15556. Must be a floating point value. Default value is 0.3.
  15557. @item inner
  15558. Set the inner coloring mode, that is the algorithm used to draw the
  15559. Mandelbrot fractal internal region.
  15560. It shall assume one of the following values:
  15561. @table @option
  15562. @item black
  15563. Set black mode.
  15564. @item convergence
  15565. Show time until convergence.
  15566. @item mincol
  15567. Set color based on point closest to the origin of the iterations.
  15568. @item period
  15569. Set period mode.
  15570. @end table
  15571. Default value is @var{mincol}.
  15572. @item bailout
  15573. Set the bailout value. Default value is 10.0.
  15574. @item maxiter
  15575. Set the maximum of iterations performed by the rendering
  15576. algorithm. Default value is 7189.
  15577. @item outer
  15578. Set outer coloring mode.
  15579. It shall assume one of following values:
  15580. @table @option
  15581. @item iteration_count
  15582. Set iteration count mode.
  15583. @item normalized_iteration_count
  15584. set normalized iteration count mode.
  15585. @end table
  15586. Default value is @var{normalized_iteration_count}.
  15587. @item rate, r
  15588. Set frame rate, expressed as number of frames per second. Default
  15589. value is "25".
  15590. @item size, s
  15591. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15592. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15593. @item start_scale
  15594. Set the initial scale value. Default value is 3.0.
  15595. @item start_x
  15596. Set the initial x position. Must be a floating point value between
  15597. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15598. @item start_y
  15599. Set the initial y position. Must be a floating point value between
  15600. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15601. @end table
  15602. @section mptestsrc
  15603. Generate various test patterns, as generated by the MPlayer test filter.
  15604. The size of the generated video is fixed, and is 256x256.
  15605. This source is useful in particular for testing encoding features.
  15606. This source accepts the following options:
  15607. @table @option
  15608. @item rate, r
  15609. Specify the frame rate of the sourced video, as the number of frames
  15610. generated per second. It has to be a string in the format
  15611. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15612. number or a valid video frame rate abbreviation. The default value is
  15613. "25".
  15614. @item duration, d
  15615. Set the duration of the sourced video. See
  15616. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15617. for the accepted syntax.
  15618. If not specified, or the expressed duration is negative, the video is
  15619. supposed to be generated forever.
  15620. @item test, t
  15621. Set the number or the name of the test to perform. Supported tests are:
  15622. @table @option
  15623. @item dc_luma
  15624. @item dc_chroma
  15625. @item freq_luma
  15626. @item freq_chroma
  15627. @item amp_luma
  15628. @item amp_chroma
  15629. @item cbp
  15630. @item mv
  15631. @item ring1
  15632. @item ring2
  15633. @item all
  15634. @end table
  15635. Default value is "all", which will cycle through the list of all tests.
  15636. @end table
  15637. Some examples:
  15638. @example
  15639. mptestsrc=t=dc_luma
  15640. @end example
  15641. will generate a "dc_luma" test pattern.
  15642. @section frei0r_src
  15643. Provide a frei0r source.
  15644. To enable compilation of this filter you need to install the frei0r
  15645. header and configure FFmpeg with @code{--enable-frei0r}.
  15646. This source accepts the following parameters:
  15647. @table @option
  15648. @item size
  15649. The size of the video to generate. For the syntax of this option, check the
  15650. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15651. @item framerate
  15652. The framerate of the generated video. It may be a string of the form
  15653. @var{num}/@var{den} or a frame rate abbreviation.
  15654. @item filter_name
  15655. The name to the frei0r source to load. For more information regarding frei0r and
  15656. how to set the parameters, read the @ref{frei0r} section in the video filters
  15657. documentation.
  15658. @item filter_params
  15659. A '|'-separated list of parameters to pass to the frei0r source.
  15660. @end table
  15661. For example, to generate a frei0r partik0l source with size 200x200
  15662. and frame rate 10 which is overlaid on the overlay filter main input:
  15663. @example
  15664. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15665. @end example
  15666. @section life
  15667. Generate a life pattern.
  15668. This source is based on a generalization of John Conway's life game.
  15669. The sourced input represents a life grid, each pixel represents a cell
  15670. which can be in one of two possible states, alive or dead. Every cell
  15671. interacts with its eight neighbours, which are the cells that are
  15672. horizontally, vertically, or diagonally adjacent.
  15673. At each interaction the grid evolves according to the adopted rule,
  15674. which specifies the number of neighbor alive cells which will make a
  15675. cell stay alive or born. The @option{rule} option allows one to specify
  15676. the rule to adopt.
  15677. This source accepts the following options:
  15678. @table @option
  15679. @item filename, f
  15680. Set the file from which to read the initial grid state. In the file,
  15681. each non-whitespace character is considered an alive cell, and newline
  15682. is used to delimit the end of each row.
  15683. If this option is not specified, the initial grid is generated
  15684. randomly.
  15685. @item rate, r
  15686. Set the video rate, that is the number of frames generated per second.
  15687. Default is 25.
  15688. @item random_fill_ratio, ratio
  15689. Set the random fill ratio for the initial random grid. It is a
  15690. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15691. It is ignored when a file is specified.
  15692. @item random_seed, seed
  15693. Set the seed for filling the initial random grid, must be an integer
  15694. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15695. set to -1, the filter will try to use a good random seed on a best
  15696. effort basis.
  15697. @item rule
  15698. Set the life rule.
  15699. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15700. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15701. @var{NS} specifies the number of alive neighbor cells which make a
  15702. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15703. which make a dead cell to become alive (i.e. to "born").
  15704. "s" and "b" can be used in place of "S" and "B", respectively.
  15705. Alternatively a rule can be specified by an 18-bits integer. The 9
  15706. high order bits are used to encode the next cell state if it is alive
  15707. for each number of neighbor alive cells, the low order bits specify
  15708. the rule for "borning" new cells. Higher order bits encode for an
  15709. higher number of neighbor cells.
  15710. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15711. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15712. Default value is "S23/B3", which is the original Conway's game of life
  15713. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15714. cells, and will born a new cell if there are three alive cells around
  15715. a dead cell.
  15716. @item size, s
  15717. Set the size of the output video. For the syntax of this option, check the
  15718. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15719. If @option{filename} is specified, the size is set by default to the
  15720. same size of the input file. If @option{size} is set, it must contain
  15721. the size specified in the input file, and the initial grid defined in
  15722. that file is centered in the larger resulting area.
  15723. If a filename is not specified, the size value defaults to "320x240"
  15724. (used for a randomly generated initial grid).
  15725. @item stitch
  15726. If set to 1, stitch the left and right grid edges together, and the
  15727. top and bottom edges also. Defaults to 1.
  15728. @item mold
  15729. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15730. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15731. value from 0 to 255.
  15732. @item life_color
  15733. Set the color of living (or new born) cells.
  15734. @item death_color
  15735. Set the color of dead cells. If @option{mold} is set, this is the first color
  15736. used to represent a dead cell.
  15737. @item mold_color
  15738. Set mold color, for definitely dead and moldy cells.
  15739. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15740. ffmpeg-utils manual,ffmpeg-utils}.
  15741. @end table
  15742. @subsection Examples
  15743. @itemize
  15744. @item
  15745. Read a grid from @file{pattern}, and center it on a grid of size
  15746. 300x300 pixels:
  15747. @example
  15748. life=f=pattern:s=300x300
  15749. @end example
  15750. @item
  15751. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15752. @example
  15753. life=ratio=2/3:s=200x200
  15754. @end example
  15755. @item
  15756. Specify a custom rule for evolving a randomly generated grid:
  15757. @example
  15758. life=rule=S14/B34
  15759. @end example
  15760. @item
  15761. Full example with slow death effect (mold) using @command{ffplay}:
  15762. @example
  15763. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15764. @end example
  15765. @end itemize
  15766. @anchor{allrgb}
  15767. @anchor{allyuv}
  15768. @anchor{color}
  15769. @anchor{haldclutsrc}
  15770. @anchor{nullsrc}
  15771. @anchor{pal75bars}
  15772. @anchor{pal100bars}
  15773. @anchor{rgbtestsrc}
  15774. @anchor{smptebars}
  15775. @anchor{smptehdbars}
  15776. @anchor{testsrc}
  15777. @anchor{testsrc2}
  15778. @anchor{yuvtestsrc}
  15779. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15780. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15781. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15782. The @code{color} source provides an uniformly colored input.
  15783. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15784. @ref{haldclut} filter.
  15785. The @code{nullsrc} source returns unprocessed video frames. It is
  15786. mainly useful to be employed in analysis / debugging tools, or as the
  15787. source for filters which ignore the input data.
  15788. The @code{pal75bars} source generates a color bars pattern, based on
  15789. EBU PAL recommendations with 75% color levels.
  15790. The @code{pal100bars} source generates a color bars pattern, based on
  15791. EBU PAL recommendations with 100% color levels.
  15792. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15793. detecting RGB vs BGR issues. You should see a red, green and blue
  15794. stripe from top to bottom.
  15795. The @code{smptebars} source generates a color bars pattern, based on
  15796. the SMPTE Engineering Guideline EG 1-1990.
  15797. The @code{smptehdbars} source generates a color bars pattern, based on
  15798. the SMPTE RP 219-2002.
  15799. The @code{testsrc} source generates a test video pattern, showing a
  15800. color pattern, a scrolling gradient and a timestamp. This is mainly
  15801. intended for testing purposes.
  15802. The @code{testsrc2} source is similar to testsrc, but supports more
  15803. pixel formats instead of just @code{rgb24}. This allows using it as an
  15804. input for other tests without requiring a format conversion.
  15805. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15806. see a y, cb and cr stripe from top to bottom.
  15807. The sources accept the following parameters:
  15808. @table @option
  15809. @item level
  15810. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15811. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15812. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15813. coded on a @code{1/(N*N)} scale.
  15814. @item color, c
  15815. Specify the color of the source, only available in the @code{color}
  15816. source. For the syntax of this option, check the
  15817. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15818. @item size, s
  15819. Specify the size of the sourced video. For the syntax of this option, check the
  15820. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15821. The default value is @code{320x240}.
  15822. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15823. @code{haldclutsrc} filters.
  15824. @item rate, r
  15825. Specify the frame rate of the sourced video, as the number of frames
  15826. generated per second. It has to be a string in the format
  15827. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15828. number or a valid video frame rate abbreviation. The default value is
  15829. "25".
  15830. @item duration, d
  15831. Set the duration of the sourced video. See
  15832. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15833. for the accepted syntax.
  15834. If not specified, or the expressed duration is negative, the video is
  15835. supposed to be generated forever.
  15836. @item sar
  15837. Set the sample aspect ratio of the sourced video.
  15838. @item alpha
  15839. Specify the alpha (opacity) of the background, only available in the
  15840. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15841. 255 (fully opaque, the default).
  15842. @item decimals, n
  15843. Set the number of decimals to show in the timestamp, only available in the
  15844. @code{testsrc} source.
  15845. The displayed timestamp value will correspond to the original
  15846. timestamp value multiplied by the power of 10 of the specified
  15847. value. Default value is 0.
  15848. @end table
  15849. @subsection Examples
  15850. @itemize
  15851. @item
  15852. Generate a video with a duration of 5.3 seconds, with size
  15853. 176x144 and a frame rate of 10 frames per second:
  15854. @example
  15855. testsrc=duration=5.3:size=qcif:rate=10
  15856. @end example
  15857. @item
  15858. The following graph description will generate a red source
  15859. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15860. frames per second:
  15861. @example
  15862. color=c=red@@0.2:s=qcif:r=10
  15863. @end example
  15864. @item
  15865. If the input content is to be ignored, @code{nullsrc} can be used. The
  15866. following command generates noise in the luminance plane by employing
  15867. the @code{geq} filter:
  15868. @example
  15869. nullsrc=s=256x256, geq=random(1)*255:128:128
  15870. @end example
  15871. @end itemize
  15872. @subsection Commands
  15873. The @code{color} source supports the following commands:
  15874. @table @option
  15875. @item c, color
  15876. Set the color of the created image. Accepts the same syntax of the
  15877. corresponding @option{color} option.
  15878. @end table
  15879. @section openclsrc
  15880. Generate video using an OpenCL program.
  15881. @table @option
  15882. @item source
  15883. OpenCL program source file.
  15884. @item kernel
  15885. Kernel name in program.
  15886. @item size, s
  15887. Size of frames to generate. This must be set.
  15888. @item format
  15889. Pixel format to use for the generated frames. This must be set.
  15890. @item rate, r
  15891. Number of frames generated every second. Default value is '25'.
  15892. @end table
  15893. For details of how the program loading works, see the @ref{program_opencl}
  15894. filter.
  15895. Example programs:
  15896. @itemize
  15897. @item
  15898. Generate a colour ramp by setting pixel values from the position of the pixel
  15899. in the output image. (Note that this will work with all pixel formats, but
  15900. the generated output will not be the same.)
  15901. @verbatim
  15902. __kernel void ramp(__write_only image2d_t dst,
  15903. unsigned int index)
  15904. {
  15905. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15906. float4 val;
  15907. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15908. write_imagef(dst, loc, val);
  15909. }
  15910. @end verbatim
  15911. @item
  15912. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15913. @verbatim
  15914. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15915. unsigned int index)
  15916. {
  15917. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15918. float4 value = 0.0f;
  15919. int x = loc.x + index;
  15920. int y = loc.y + index;
  15921. while (x > 0 || y > 0) {
  15922. if (x % 3 == 1 && y % 3 == 1) {
  15923. value = 1.0f;
  15924. break;
  15925. }
  15926. x /= 3;
  15927. y /= 3;
  15928. }
  15929. write_imagef(dst, loc, value);
  15930. }
  15931. @end verbatim
  15932. @end itemize
  15933. @c man end VIDEO SOURCES
  15934. @chapter Video Sinks
  15935. @c man begin VIDEO SINKS
  15936. Below is a description of the currently available video sinks.
  15937. @section buffersink
  15938. Buffer video frames, and make them available to the end of the filter
  15939. graph.
  15940. This sink is mainly intended for programmatic use, in particular
  15941. through the interface defined in @file{libavfilter/buffersink.h}
  15942. or the options system.
  15943. It accepts a pointer to an AVBufferSinkContext structure, which
  15944. defines the incoming buffers' formats, to be passed as the opaque
  15945. parameter to @code{avfilter_init_filter} for initialization.
  15946. @section nullsink
  15947. Null video sink: do absolutely nothing with the input video. It is
  15948. mainly useful as a template and for use in analysis / debugging
  15949. tools.
  15950. @c man end VIDEO SINKS
  15951. @chapter Multimedia Filters
  15952. @c man begin MULTIMEDIA FILTERS
  15953. Below is a description of the currently available multimedia filters.
  15954. @section abitscope
  15955. Convert input audio to a video output, displaying the audio bit scope.
  15956. The filter accepts the following options:
  15957. @table @option
  15958. @item rate, r
  15959. Set frame rate, expressed as number of frames per second. Default
  15960. value is "25".
  15961. @item size, s
  15962. Specify the video size for the output. For the syntax of this option, check the
  15963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15964. Default value is @code{1024x256}.
  15965. @item colors
  15966. Specify list of colors separated by space or by '|' which will be used to
  15967. draw channels. Unrecognized or missing colors will be replaced
  15968. by white color.
  15969. @end table
  15970. @section ahistogram
  15971. Convert input audio to a video output, displaying the volume histogram.
  15972. The filter accepts the following options:
  15973. @table @option
  15974. @item dmode
  15975. Specify how histogram is calculated.
  15976. It accepts the following values:
  15977. @table @samp
  15978. @item single
  15979. Use single histogram for all channels.
  15980. @item separate
  15981. Use separate histogram for each channel.
  15982. @end table
  15983. Default is @code{single}.
  15984. @item rate, r
  15985. Set frame rate, expressed as number of frames per second. Default
  15986. value is "25".
  15987. @item size, s
  15988. Specify the video size for the output. For the syntax of this option, check the
  15989. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15990. Default value is @code{hd720}.
  15991. @item scale
  15992. Set display scale.
  15993. It accepts the following values:
  15994. @table @samp
  15995. @item log
  15996. logarithmic
  15997. @item sqrt
  15998. square root
  15999. @item cbrt
  16000. cubic root
  16001. @item lin
  16002. linear
  16003. @item rlog
  16004. reverse logarithmic
  16005. @end table
  16006. Default is @code{log}.
  16007. @item ascale
  16008. Set amplitude scale.
  16009. It accepts the following values:
  16010. @table @samp
  16011. @item log
  16012. logarithmic
  16013. @item lin
  16014. linear
  16015. @end table
  16016. Default is @code{log}.
  16017. @item acount
  16018. Set how much frames to accumulate in histogram.
  16019. Default is 1. Setting this to -1 accumulates all frames.
  16020. @item rheight
  16021. Set histogram ratio of window height.
  16022. @item slide
  16023. Set sonogram sliding.
  16024. It accepts the following values:
  16025. @table @samp
  16026. @item replace
  16027. replace old rows with new ones.
  16028. @item scroll
  16029. scroll from top to bottom.
  16030. @end table
  16031. Default is @code{replace}.
  16032. @end table
  16033. @section aphasemeter
  16034. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16035. representing mean phase of current audio frame. A video output can also be produced and is
  16036. enabled by default. The audio is passed through as first output.
  16037. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16038. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16039. and @code{1} means channels are in phase.
  16040. The filter accepts the following options, all related to its video output:
  16041. @table @option
  16042. @item rate, r
  16043. Set the output frame rate. Default value is @code{25}.
  16044. @item size, s
  16045. Set the video size for the output. For the syntax of this option, check the
  16046. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16047. Default value is @code{800x400}.
  16048. @item rc
  16049. @item gc
  16050. @item bc
  16051. Specify the red, green, blue contrast. Default values are @code{2},
  16052. @code{7} and @code{1}.
  16053. Allowed range is @code{[0, 255]}.
  16054. @item mpc
  16055. Set color which will be used for drawing median phase. If color is
  16056. @code{none} which is default, no median phase value will be drawn.
  16057. @item video
  16058. Enable video output. Default is enabled.
  16059. @end table
  16060. @section avectorscope
  16061. Convert input audio to a video output, representing the audio vector
  16062. scope.
  16063. The filter is used to measure the difference between channels of stereo
  16064. audio stream. A monoaural signal, consisting of identical left and right
  16065. signal, results in straight vertical line. Any stereo separation is visible
  16066. as a deviation from this line, creating a Lissajous figure.
  16067. If the straight (or deviation from it) but horizontal line appears this
  16068. indicates that the left and right channels are out of phase.
  16069. The filter accepts the following options:
  16070. @table @option
  16071. @item mode, m
  16072. Set the vectorscope mode.
  16073. Available values are:
  16074. @table @samp
  16075. @item lissajous
  16076. Lissajous rotated by 45 degrees.
  16077. @item lissajous_xy
  16078. Same as above but not rotated.
  16079. @item polar
  16080. Shape resembling half of circle.
  16081. @end table
  16082. Default value is @samp{lissajous}.
  16083. @item size, s
  16084. Set the video size for the output. For the syntax of this option, check the
  16085. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16086. Default value is @code{400x400}.
  16087. @item rate, r
  16088. Set the output frame rate. Default value is @code{25}.
  16089. @item rc
  16090. @item gc
  16091. @item bc
  16092. @item ac
  16093. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16094. @code{160}, @code{80} and @code{255}.
  16095. Allowed range is @code{[0, 255]}.
  16096. @item rf
  16097. @item gf
  16098. @item bf
  16099. @item af
  16100. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16101. @code{10}, @code{5} and @code{5}.
  16102. Allowed range is @code{[0, 255]}.
  16103. @item zoom
  16104. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16105. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16106. @item draw
  16107. Set the vectorscope drawing mode.
  16108. Available values are:
  16109. @table @samp
  16110. @item dot
  16111. Draw dot for each sample.
  16112. @item line
  16113. Draw line between previous and current sample.
  16114. @end table
  16115. Default value is @samp{dot}.
  16116. @item scale
  16117. Specify amplitude scale of audio samples.
  16118. Available values are:
  16119. @table @samp
  16120. @item lin
  16121. Linear.
  16122. @item sqrt
  16123. Square root.
  16124. @item cbrt
  16125. Cubic root.
  16126. @item log
  16127. Logarithmic.
  16128. @end table
  16129. @item swap
  16130. Swap left channel axis with right channel axis.
  16131. @item mirror
  16132. Mirror axis.
  16133. @table @samp
  16134. @item none
  16135. No mirror.
  16136. @item x
  16137. Mirror only x axis.
  16138. @item y
  16139. Mirror only y axis.
  16140. @item xy
  16141. Mirror both axis.
  16142. @end table
  16143. @end table
  16144. @subsection Examples
  16145. @itemize
  16146. @item
  16147. Complete example using @command{ffplay}:
  16148. @example
  16149. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16150. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16151. @end example
  16152. @end itemize
  16153. @section bench, abench
  16154. Benchmark part of a filtergraph.
  16155. The filter accepts the following options:
  16156. @table @option
  16157. @item action
  16158. Start or stop a timer.
  16159. Available values are:
  16160. @table @samp
  16161. @item start
  16162. Get the current time, set it as frame metadata (using the key
  16163. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16164. @item stop
  16165. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16166. the input frame metadata to get the time difference. Time difference, average,
  16167. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16168. @code{min}) are then printed. The timestamps are expressed in seconds.
  16169. @end table
  16170. @end table
  16171. @subsection Examples
  16172. @itemize
  16173. @item
  16174. Benchmark @ref{selectivecolor} filter:
  16175. @example
  16176. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16177. @end example
  16178. @end itemize
  16179. @section concat
  16180. Concatenate audio and video streams, joining them together one after the
  16181. other.
  16182. The filter works on segments of synchronized video and audio streams. All
  16183. segments must have the same number of streams of each type, and that will
  16184. also be the number of streams at output.
  16185. The filter accepts the following options:
  16186. @table @option
  16187. @item n
  16188. Set the number of segments. Default is 2.
  16189. @item v
  16190. Set the number of output video streams, that is also the number of video
  16191. streams in each segment. Default is 1.
  16192. @item a
  16193. Set the number of output audio streams, that is also the number of audio
  16194. streams in each segment. Default is 0.
  16195. @item unsafe
  16196. Activate unsafe mode: do not fail if segments have a different format.
  16197. @end table
  16198. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16199. @var{a} audio outputs.
  16200. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16201. segment, in the same order as the outputs, then the inputs for the second
  16202. segment, etc.
  16203. Related streams do not always have exactly the same duration, for various
  16204. reasons including codec frame size or sloppy authoring. For that reason,
  16205. related synchronized streams (e.g. a video and its audio track) should be
  16206. concatenated at once. The concat filter will use the duration of the longest
  16207. stream in each segment (except the last one), and if necessary pad shorter
  16208. audio streams with silence.
  16209. For this filter to work correctly, all segments must start at timestamp 0.
  16210. All corresponding streams must have the same parameters in all segments; the
  16211. filtering system will automatically select a common pixel format for video
  16212. streams, and a common sample format, sample rate and channel layout for
  16213. audio streams, but other settings, such as resolution, must be converted
  16214. explicitly by the user.
  16215. Different frame rates are acceptable but will result in variable frame rate
  16216. at output; be sure to configure the output file to handle it.
  16217. @subsection Examples
  16218. @itemize
  16219. @item
  16220. Concatenate an opening, an episode and an ending, all in bilingual version
  16221. (video in stream 0, audio in streams 1 and 2):
  16222. @example
  16223. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16224. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16225. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16226. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16227. @end example
  16228. @item
  16229. Concatenate two parts, handling audio and video separately, using the
  16230. (a)movie sources, and adjusting the resolution:
  16231. @example
  16232. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16233. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16234. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16235. @end example
  16236. Note that a desync will happen at the stitch if the audio and video streams
  16237. do not have exactly the same duration in the first file.
  16238. @end itemize
  16239. @subsection Commands
  16240. This filter supports the following commands:
  16241. @table @option
  16242. @item next
  16243. Close the current segment and step to the next one
  16244. @end table
  16245. @section drawgraph, adrawgraph
  16246. Draw a graph using input video or audio metadata.
  16247. It accepts the following parameters:
  16248. @table @option
  16249. @item m1
  16250. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16251. @item fg1
  16252. Set 1st foreground color expression.
  16253. @item m2
  16254. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16255. @item fg2
  16256. Set 2nd foreground color expression.
  16257. @item m3
  16258. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16259. @item fg3
  16260. Set 3rd foreground color expression.
  16261. @item m4
  16262. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16263. @item fg4
  16264. Set 4th foreground color expression.
  16265. @item min
  16266. Set minimal value of metadata value.
  16267. @item max
  16268. Set maximal value of metadata value.
  16269. @item bg
  16270. Set graph background color. Default is white.
  16271. @item mode
  16272. Set graph mode.
  16273. Available values for mode is:
  16274. @table @samp
  16275. @item bar
  16276. @item dot
  16277. @item line
  16278. @end table
  16279. Default is @code{line}.
  16280. @item slide
  16281. Set slide mode.
  16282. Available values for slide is:
  16283. @table @samp
  16284. @item frame
  16285. Draw new frame when right border is reached.
  16286. @item replace
  16287. Replace old columns with new ones.
  16288. @item scroll
  16289. Scroll from right to left.
  16290. @item rscroll
  16291. Scroll from left to right.
  16292. @item picture
  16293. Draw single picture.
  16294. @end table
  16295. Default is @code{frame}.
  16296. @item size
  16297. Set size of graph video. For the syntax of this option, check the
  16298. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16299. The default value is @code{900x256}.
  16300. The foreground color expressions can use the following variables:
  16301. @table @option
  16302. @item MIN
  16303. Minimal value of metadata value.
  16304. @item MAX
  16305. Maximal value of metadata value.
  16306. @item VAL
  16307. Current metadata key value.
  16308. @end table
  16309. The color is defined as 0xAABBGGRR.
  16310. @end table
  16311. Example using metadata from @ref{signalstats} filter:
  16312. @example
  16313. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16314. @end example
  16315. Example using metadata from @ref{ebur128} filter:
  16316. @example
  16317. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16318. @end example
  16319. @anchor{ebur128}
  16320. @section ebur128
  16321. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16322. level. By default, it logs a message at a frequency of 10Hz with the
  16323. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16324. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16325. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16326. sample format is double-precision floating point. The input stream will be converted to
  16327. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16328. after this filter to obtain the original parameters.
  16329. The filter also has a video output (see the @var{video} option) with a real
  16330. time graph to observe the loudness evolution. The graphic contains the logged
  16331. message mentioned above, so it is not printed anymore when this option is set,
  16332. unless the verbose logging is set. The main graphing area contains the
  16333. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16334. the momentary loudness (400 milliseconds), but can optionally be configured
  16335. to instead display short-term loudness (see @var{gauge}).
  16336. The green area marks a +/- 1LU target range around the target loudness
  16337. (-23LUFS by default, unless modified through @var{target}).
  16338. More information about the Loudness Recommendation EBU R128 on
  16339. @url{http://tech.ebu.ch/loudness}.
  16340. The filter accepts the following options:
  16341. @table @option
  16342. @item video
  16343. Activate the video output. The audio stream is passed unchanged whether this
  16344. option is set or no. The video stream will be the first output stream if
  16345. activated. Default is @code{0}.
  16346. @item size
  16347. Set the video size. This option is for video only. For the syntax of this
  16348. option, check the
  16349. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16350. Default and minimum resolution is @code{640x480}.
  16351. @item meter
  16352. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16353. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16354. other integer value between this range is allowed.
  16355. @item metadata
  16356. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16357. into 100ms output frames, each of them containing various loudness information
  16358. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16359. Default is @code{0}.
  16360. @item framelog
  16361. Force the frame logging level.
  16362. Available values are:
  16363. @table @samp
  16364. @item info
  16365. information logging level
  16366. @item verbose
  16367. verbose logging level
  16368. @end table
  16369. By default, the logging level is set to @var{info}. If the @option{video} or
  16370. the @option{metadata} options are set, it switches to @var{verbose}.
  16371. @item peak
  16372. Set peak mode(s).
  16373. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16374. values are:
  16375. @table @samp
  16376. @item none
  16377. Disable any peak mode (default).
  16378. @item sample
  16379. Enable sample-peak mode.
  16380. Simple peak mode looking for the higher sample value. It logs a message
  16381. for sample-peak (identified by @code{SPK}).
  16382. @item true
  16383. Enable true-peak mode.
  16384. If enabled, the peak lookup is done on an over-sampled version of the input
  16385. stream for better peak accuracy. It logs a message for true-peak.
  16386. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16387. This mode requires a build with @code{libswresample}.
  16388. @end table
  16389. @item dualmono
  16390. Treat mono input files as "dual mono". If a mono file is intended for playback
  16391. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16392. If set to @code{true}, this option will compensate for this effect.
  16393. Multi-channel input files are not affected by this option.
  16394. @item panlaw
  16395. Set a specific pan law to be used for the measurement of dual mono files.
  16396. This parameter is optional, and has a default value of -3.01dB.
  16397. @item target
  16398. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16399. This parameter is optional and has a default value of -23LUFS as specified
  16400. by EBU R128. However, material published online may prefer a level of -16LUFS
  16401. (e.g. for use with podcasts or video platforms).
  16402. @item gauge
  16403. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16404. @code{shortterm}. By default the momentary value will be used, but in certain
  16405. scenarios it may be more useful to observe the short term value instead (e.g.
  16406. live mixing).
  16407. @item scale
  16408. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16409. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16410. video output, not the summary or continuous log output.
  16411. @end table
  16412. @subsection Examples
  16413. @itemize
  16414. @item
  16415. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16416. @example
  16417. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16418. @end example
  16419. @item
  16420. Run an analysis with @command{ffmpeg}:
  16421. @example
  16422. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16423. @end example
  16424. @end itemize
  16425. @section interleave, ainterleave
  16426. Temporally interleave frames from several inputs.
  16427. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16428. These filters read frames from several inputs and send the oldest
  16429. queued frame to the output.
  16430. Input streams must have well defined, monotonically increasing frame
  16431. timestamp values.
  16432. In order to submit one frame to output, these filters need to enqueue
  16433. at least one frame for each input, so they cannot work in case one
  16434. input is not yet terminated and will not receive incoming frames.
  16435. For example consider the case when one input is a @code{select} filter
  16436. which always drops input frames. The @code{interleave} filter will keep
  16437. reading from that input, but it will never be able to send new frames
  16438. to output until the input sends an end-of-stream signal.
  16439. Also, depending on inputs synchronization, the filters will drop
  16440. frames in case one input receives more frames than the other ones, and
  16441. the queue is already filled.
  16442. These filters accept the following options:
  16443. @table @option
  16444. @item nb_inputs, n
  16445. Set the number of different inputs, it is 2 by default.
  16446. @end table
  16447. @subsection Examples
  16448. @itemize
  16449. @item
  16450. Interleave frames belonging to different streams using @command{ffmpeg}:
  16451. @example
  16452. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16453. @end example
  16454. @item
  16455. Add flickering blur effect:
  16456. @example
  16457. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16458. @end example
  16459. @end itemize
  16460. @section metadata, ametadata
  16461. Manipulate frame metadata.
  16462. This filter accepts the following options:
  16463. @table @option
  16464. @item mode
  16465. Set mode of operation of the filter.
  16466. Can be one of the following:
  16467. @table @samp
  16468. @item select
  16469. If both @code{value} and @code{key} is set, select frames
  16470. which have such metadata. If only @code{key} is set, select
  16471. every frame that has such key in metadata.
  16472. @item add
  16473. Add new metadata @code{key} and @code{value}. If key is already available
  16474. do nothing.
  16475. @item modify
  16476. Modify value of already present key.
  16477. @item delete
  16478. If @code{value} is set, delete only keys that have such value.
  16479. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16480. the frame.
  16481. @item print
  16482. Print key and its value if metadata was found. If @code{key} is not set print all
  16483. metadata values available in frame.
  16484. @end table
  16485. @item key
  16486. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16487. @item value
  16488. Set metadata value which will be used. This option is mandatory for
  16489. @code{modify} and @code{add} mode.
  16490. @item function
  16491. Which function to use when comparing metadata value and @code{value}.
  16492. Can be one of following:
  16493. @table @samp
  16494. @item same_str
  16495. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16496. @item starts_with
  16497. Values are interpreted as strings, returns true if metadata value starts with
  16498. the @code{value} option string.
  16499. @item less
  16500. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16501. @item equal
  16502. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16503. @item greater
  16504. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16505. @item expr
  16506. Values are interpreted as floats, returns true if expression from option @code{expr}
  16507. evaluates to true.
  16508. @end table
  16509. @item expr
  16510. Set expression which is used when @code{function} is set to @code{expr}.
  16511. The expression is evaluated through the eval API and can contain the following
  16512. constants:
  16513. @table @option
  16514. @item VALUE1
  16515. Float representation of @code{value} from metadata key.
  16516. @item VALUE2
  16517. Float representation of @code{value} as supplied by user in @code{value} option.
  16518. @end table
  16519. @item file
  16520. If specified in @code{print} mode, output is written to the named file. Instead of
  16521. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16522. for standard output. If @code{file} option is not set, output is written to the log
  16523. with AV_LOG_INFO loglevel.
  16524. @end table
  16525. @subsection Examples
  16526. @itemize
  16527. @item
  16528. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16529. between 0 and 1.
  16530. @example
  16531. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16532. @end example
  16533. @item
  16534. Print silencedetect output to file @file{metadata.txt}.
  16535. @example
  16536. silencedetect,ametadata=mode=print:file=metadata.txt
  16537. @end example
  16538. @item
  16539. Direct all metadata to a pipe with file descriptor 4.
  16540. @example
  16541. metadata=mode=print:file='pipe\:4'
  16542. @end example
  16543. @end itemize
  16544. @section perms, aperms
  16545. Set read/write permissions for the output frames.
  16546. These filters are mainly aimed at developers to test direct path in the
  16547. following filter in the filtergraph.
  16548. The filters accept the following options:
  16549. @table @option
  16550. @item mode
  16551. Select the permissions mode.
  16552. It accepts the following values:
  16553. @table @samp
  16554. @item none
  16555. Do nothing. This is the default.
  16556. @item ro
  16557. Set all the output frames read-only.
  16558. @item rw
  16559. Set all the output frames directly writable.
  16560. @item toggle
  16561. Make the frame read-only if writable, and writable if read-only.
  16562. @item random
  16563. Set each output frame read-only or writable randomly.
  16564. @end table
  16565. @item seed
  16566. Set the seed for the @var{random} mode, must be an integer included between
  16567. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16568. @code{-1}, the filter will try to use a good random seed on a best effort
  16569. basis.
  16570. @end table
  16571. Note: in case of auto-inserted filter between the permission filter and the
  16572. following one, the permission might not be received as expected in that
  16573. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16574. perms/aperms filter can avoid this problem.
  16575. @section realtime, arealtime
  16576. Slow down filtering to match real time approximately.
  16577. These filters will pause the filtering for a variable amount of time to
  16578. match the output rate with the input timestamps.
  16579. They are similar to the @option{re} option to @code{ffmpeg}.
  16580. They accept the following options:
  16581. @table @option
  16582. @item limit
  16583. Time limit for the pauses. Any pause longer than that will be considered
  16584. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16585. @item speed
  16586. Speed factor for processing. The value must be a float larger than zero.
  16587. Values larger than 1.0 will result in faster than realtime processing,
  16588. smaller will slow processing down. The @var{limit} is automatically adapted
  16589. accordingly. Default is 1.0.
  16590. A processing speed faster than what is possible without these filters cannot
  16591. be achieved.
  16592. @end table
  16593. @anchor{select}
  16594. @section select, aselect
  16595. Select frames to pass in output.
  16596. This filter accepts the following options:
  16597. @table @option
  16598. @item expr, e
  16599. Set expression, which is evaluated for each input frame.
  16600. If the expression is evaluated to zero, the frame is discarded.
  16601. If the evaluation result is negative or NaN, the frame is sent to the
  16602. first output; otherwise it is sent to the output with index
  16603. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16604. For example a value of @code{1.2} corresponds to the output with index
  16605. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16606. @item outputs, n
  16607. Set the number of outputs. The output to which to send the selected
  16608. frame is based on the result of the evaluation. Default value is 1.
  16609. @end table
  16610. The expression can contain the following constants:
  16611. @table @option
  16612. @item n
  16613. The (sequential) number of the filtered frame, starting from 0.
  16614. @item selected_n
  16615. The (sequential) number of the selected frame, starting from 0.
  16616. @item prev_selected_n
  16617. The sequential number of the last selected frame. It's NAN if undefined.
  16618. @item TB
  16619. The timebase of the input timestamps.
  16620. @item pts
  16621. The PTS (Presentation TimeStamp) of the filtered video frame,
  16622. expressed in @var{TB} units. It's NAN if undefined.
  16623. @item t
  16624. The PTS of the filtered video frame,
  16625. expressed in seconds. It's NAN if undefined.
  16626. @item prev_pts
  16627. The PTS of the previously filtered video frame. It's NAN if undefined.
  16628. @item prev_selected_pts
  16629. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16630. @item prev_selected_t
  16631. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16632. @item start_pts
  16633. The PTS of the first video frame in the video. It's NAN if undefined.
  16634. @item start_t
  16635. The time of the first video frame in the video. It's NAN if undefined.
  16636. @item pict_type @emph{(video only)}
  16637. The type of the filtered frame. It can assume one of the following
  16638. values:
  16639. @table @option
  16640. @item I
  16641. @item P
  16642. @item B
  16643. @item S
  16644. @item SI
  16645. @item SP
  16646. @item BI
  16647. @end table
  16648. @item interlace_type @emph{(video only)}
  16649. The frame interlace type. It can assume one of the following values:
  16650. @table @option
  16651. @item PROGRESSIVE
  16652. The frame is progressive (not interlaced).
  16653. @item TOPFIRST
  16654. The frame is top-field-first.
  16655. @item BOTTOMFIRST
  16656. The frame is bottom-field-first.
  16657. @end table
  16658. @item consumed_sample_n @emph{(audio only)}
  16659. the number of selected samples before the current frame
  16660. @item samples_n @emph{(audio only)}
  16661. the number of samples in the current frame
  16662. @item sample_rate @emph{(audio only)}
  16663. the input sample rate
  16664. @item key
  16665. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16666. @item pos
  16667. the position in the file of the filtered frame, -1 if the information
  16668. is not available (e.g. for synthetic video)
  16669. @item scene @emph{(video only)}
  16670. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16671. probability for the current frame to introduce a new scene, while a higher
  16672. value means the current frame is more likely to be one (see the example below)
  16673. @item concatdec_select
  16674. The concat demuxer can select only part of a concat input file by setting an
  16675. inpoint and an outpoint, but the output packets may not be entirely contained
  16676. in the selected interval. By using this variable, it is possible to skip frames
  16677. generated by the concat demuxer which are not exactly contained in the selected
  16678. interval.
  16679. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16680. and the @var{lavf.concat.duration} packet metadata values which are also
  16681. present in the decoded frames.
  16682. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16683. start_time and either the duration metadata is missing or the frame pts is less
  16684. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16685. missing.
  16686. That basically means that an input frame is selected if its pts is within the
  16687. interval set by the concat demuxer.
  16688. @end table
  16689. The default value of the select expression is "1".
  16690. @subsection Examples
  16691. @itemize
  16692. @item
  16693. Select all frames in input:
  16694. @example
  16695. select
  16696. @end example
  16697. The example above is the same as:
  16698. @example
  16699. select=1
  16700. @end example
  16701. @item
  16702. Skip all frames:
  16703. @example
  16704. select=0
  16705. @end example
  16706. @item
  16707. Select only I-frames:
  16708. @example
  16709. select='eq(pict_type\,I)'
  16710. @end example
  16711. @item
  16712. Select one frame every 100:
  16713. @example
  16714. select='not(mod(n\,100))'
  16715. @end example
  16716. @item
  16717. Select only frames contained in the 10-20 time interval:
  16718. @example
  16719. select=between(t\,10\,20)
  16720. @end example
  16721. @item
  16722. Select only I-frames contained in the 10-20 time interval:
  16723. @example
  16724. select=between(t\,10\,20)*eq(pict_type\,I)
  16725. @end example
  16726. @item
  16727. Select frames with a minimum distance of 10 seconds:
  16728. @example
  16729. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16730. @end example
  16731. @item
  16732. Use aselect to select only audio frames with samples number > 100:
  16733. @example
  16734. aselect='gt(samples_n\,100)'
  16735. @end example
  16736. @item
  16737. Create a mosaic of the first scenes:
  16738. @example
  16739. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16740. @end example
  16741. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16742. choice.
  16743. @item
  16744. Send even and odd frames to separate outputs, and compose them:
  16745. @example
  16746. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16747. @end example
  16748. @item
  16749. Select useful frames from an ffconcat file which is using inpoints and
  16750. outpoints but where the source files are not intra frame only.
  16751. @example
  16752. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16753. @end example
  16754. @end itemize
  16755. @section sendcmd, asendcmd
  16756. Send commands to filters in the filtergraph.
  16757. These filters read commands to be sent to other filters in the
  16758. filtergraph.
  16759. @code{sendcmd} must be inserted between two video filters,
  16760. @code{asendcmd} must be inserted between two audio filters, but apart
  16761. from that they act the same way.
  16762. The specification of commands can be provided in the filter arguments
  16763. with the @var{commands} option, or in a file specified by the
  16764. @var{filename} option.
  16765. These filters accept the following options:
  16766. @table @option
  16767. @item commands, c
  16768. Set the commands to be read and sent to the other filters.
  16769. @item filename, f
  16770. Set the filename of the commands to be read and sent to the other
  16771. filters.
  16772. @end table
  16773. @subsection Commands syntax
  16774. A commands description consists of a sequence of interval
  16775. specifications, comprising a list of commands to be executed when a
  16776. particular event related to that interval occurs. The occurring event
  16777. is typically the current frame time entering or leaving a given time
  16778. interval.
  16779. An interval is specified by the following syntax:
  16780. @example
  16781. @var{START}[-@var{END}] @var{COMMANDS};
  16782. @end example
  16783. The time interval is specified by the @var{START} and @var{END} times.
  16784. @var{END} is optional and defaults to the maximum time.
  16785. The current frame time is considered within the specified interval if
  16786. it is included in the interval [@var{START}, @var{END}), that is when
  16787. the time is greater or equal to @var{START} and is lesser than
  16788. @var{END}.
  16789. @var{COMMANDS} consists of a sequence of one or more command
  16790. specifications, separated by ",", relating to that interval. The
  16791. syntax of a command specification is given by:
  16792. @example
  16793. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16794. @end example
  16795. @var{FLAGS} is optional and specifies the type of events relating to
  16796. the time interval which enable sending the specified command, and must
  16797. be a non-null sequence of identifier flags separated by "+" or "|" and
  16798. enclosed between "[" and "]".
  16799. The following flags are recognized:
  16800. @table @option
  16801. @item enter
  16802. The command is sent when the current frame timestamp enters the
  16803. specified interval. In other words, the command is sent when the
  16804. previous frame timestamp was not in the given interval, and the
  16805. current is.
  16806. @item leave
  16807. The command is sent when the current frame timestamp leaves the
  16808. specified interval. In other words, the command is sent when the
  16809. previous frame timestamp was in the given interval, and the
  16810. current is not.
  16811. @end table
  16812. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16813. assumed.
  16814. @var{TARGET} specifies the target of the command, usually the name of
  16815. the filter class or a specific filter instance name.
  16816. @var{COMMAND} specifies the name of the command for the target filter.
  16817. @var{ARG} is optional and specifies the optional list of argument for
  16818. the given @var{COMMAND}.
  16819. Between one interval specification and another, whitespaces, or
  16820. sequences of characters starting with @code{#} until the end of line,
  16821. are ignored and can be used to annotate comments.
  16822. A simplified BNF description of the commands specification syntax
  16823. follows:
  16824. @example
  16825. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16826. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16827. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16828. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16829. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16830. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16831. @end example
  16832. @subsection Examples
  16833. @itemize
  16834. @item
  16835. Specify audio tempo change at second 4:
  16836. @example
  16837. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16838. @end example
  16839. @item
  16840. Target a specific filter instance:
  16841. @example
  16842. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16843. @end example
  16844. @item
  16845. Specify a list of drawtext and hue commands in a file.
  16846. @example
  16847. # show text in the interval 5-10
  16848. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16849. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16850. # desaturate the image in the interval 15-20
  16851. 15.0-20.0 [enter] hue s 0,
  16852. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16853. [leave] hue s 1,
  16854. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16855. # apply an exponential saturation fade-out effect, starting from time 25
  16856. 25 [enter] hue s exp(25-t)
  16857. @end example
  16858. A filtergraph allowing to read and process the above command list
  16859. stored in a file @file{test.cmd}, can be specified with:
  16860. @example
  16861. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16862. @end example
  16863. @end itemize
  16864. @anchor{setpts}
  16865. @section setpts, asetpts
  16866. Change the PTS (presentation timestamp) of the input frames.
  16867. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16868. This filter accepts the following options:
  16869. @table @option
  16870. @item expr
  16871. The expression which is evaluated for each frame to construct its timestamp.
  16872. @end table
  16873. The expression is evaluated through the eval API and can contain the following
  16874. constants:
  16875. @table @option
  16876. @item FRAME_RATE, FR
  16877. frame rate, only defined for constant frame-rate video
  16878. @item PTS
  16879. The presentation timestamp in input
  16880. @item N
  16881. The count of the input frame for video or the number of consumed samples,
  16882. not including the current frame for audio, starting from 0.
  16883. @item NB_CONSUMED_SAMPLES
  16884. The number of consumed samples, not including the current frame (only
  16885. audio)
  16886. @item NB_SAMPLES, S
  16887. The number of samples in the current frame (only audio)
  16888. @item SAMPLE_RATE, SR
  16889. The audio sample rate.
  16890. @item STARTPTS
  16891. The PTS of the first frame.
  16892. @item STARTT
  16893. the time in seconds of the first frame
  16894. @item INTERLACED
  16895. State whether the current frame is interlaced.
  16896. @item T
  16897. the time in seconds of the current frame
  16898. @item POS
  16899. original position in the file of the frame, or undefined if undefined
  16900. for the current frame
  16901. @item PREV_INPTS
  16902. The previous input PTS.
  16903. @item PREV_INT
  16904. previous input time in seconds
  16905. @item PREV_OUTPTS
  16906. The previous output PTS.
  16907. @item PREV_OUTT
  16908. previous output time in seconds
  16909. @item RTCTIME
  16910. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16911. instead.
  16912. @item RTCSTART
  16913. The wallclock (RTC) time at the start of the movie in microseconds.
  16914. @item TB
  16915. The timebase of the input timestamps.
  16916. @end table
  16917. @subsection Examples
  16918. @itemize
  16919. @item
  16920. Start counting PTS from zero
  16921. @example
  16922. setpts=PTS-STARTPTS
  16923. @end example
  16924. @item
  16925. Apply fast motion effect:
  16926. @example
  16927. setpts=0.5*PTS
  16928. @end example
  16929. @item
  16930. Apply slow motion effect:
  16931. @example
  16932. setpts=2.0*PTS
  16933. @end example
  16934. @item
  16935. Set fixed rate of 25 frames per second:
  16936. @example
  16937. setpts=N/(25*TB)
  16938. @end example
  16939. @item
  16940. Set fixed rate 25 fps with some jitter:
  16941. @example
  16942. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16943. @end example
  16944. @item
  16945. Apply an offset of 10 seconds to the input PTS:
  16946. @example
  16947. setpts=PTS+10/TB
  16948. @end example
  16949. @item
  16950. Generate timestamps from a "live source" and rebase onto the current timebase:
  16951. @example
  16952. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16953. @end example
  16954. @item
  16955. Generate timestamps by counting samples:
  16956. @example
  16957. asetpts=N/SR/TB
  16958. @end example
  16959. @end itemize
  16960. @section setrange
  16961. Force color range for the output video frame.
  16962. The @code{setrange} filter marks the color range property for the
  16963. output frames. It does not change the input frame, but only sets the
  16964. corresponding property, which affects how the frame is treated by
  16965. following filters.
  16966. The filter accepts the following options:
  16967. @table @option
  16968. @item range
  16969. Available values are:
  16970. @table @samp
  16971. @item auto
  16972. Keep the same color range property.
  16973. @item unspecified, unknown
  16974. Set the color range as unspecified.
  16975. @item limited, tv, mpeg
  16976. Set the color range as limited.
  16977. @item full, pc, jpeg
  16978. Set the color range as full.
  16979. @end table
  16980. @end table
  16981. @section settb, asettb
  16982. Set the timebase to use for the output frames timestamps.
  16983. It is mainly useful for testing timebase configuration.
  16984. It accepts the following parameters:
  16985. @table @option
  16986. @item expr, tb
  16987. The expression which is evaluated into the output timebase.
  16988. @end table
  16989. The value for @option{tb} is an arithmetic expression representing a
  16990. rational. The expression can contain the constants "AVTB" (the default
  16991. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16992. audio only). Default value is "intb".
  16993. @subsection Examples
  16994. @itemize
  16995. @item
  16996. Set the timebase to 1/25:
  16997. @example
  16998. settb=expr=1/25
  16999. @end example
  17000. @item
  17001. Set the timebase to 1/10:
  17002. @example
  17003. settb=expr=0.1
  17004. @end example
  17005. @item
  17006. Set the timebase to 1001/1000:
  17007. @example
  17008. settb=1+0.001
  17009. @end example
  17010. @item
  17011. Set the timebase to 2*intb:
  17012. @example
  17013. settb=2*intb
  17014. @end example
  17015. @item
  17016. Set the default timebase value:
  17017. @example
  17018. settb=AVTB
  17019. @end example
  17020. @end itemize
  17021. @section showcqt
  17022. Convert input audio to a video output representing frequency spectrum
  17023. logarithmically using Brown-Puckette constant Q transform algorithm with
  17024. direct frequency domain coefficient calculation (but the transform itself
  17025. is not really constant Q, instead the Q factor is actually variable/clamped),
  17026. with musical tone scale, from E0 to D#10.
  17027. The filter accepts the following options:
  17028. @table @option
  17029. @item size, s
  17030. Specify the video size for the output. It must be even. For the syntax of this option,
  17031. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17032. Default value is @code{1920x1080}.
  17033. @item fps, rate, r
  17034. Set the output frame rate. Default value is @code{25}.
  17035. @item bar_h
  17036. Set the bargraph height. It must be even. Default value is @code{-1} which
  17037. computes the bargraph height automatically.
  17038. @item axis_h
  17039. Set the axis height. It must be even. Default value is @code{-1} which computes
  17040. the axis height automatically.
  17041. @item sono_h
  17042. Set the sonogram height. It must be even. Default value is @code{-1} which
  17043. computes the sonogram height automatically.
  17044. @item fullhd
  17045. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17046. instead. Default value is @code{1}.
  17047. @item sono_v, volume
  17048. Specify the sonogram volume expression. It can contain variables:
  17049. @table @option
  17050. @item bar_v
  17051. the @var{bar_v} evaluated expression
  17052. @item frequency, freq, f
  17053. the frequency where it is evaluated
  17054. @item timeclamp, tc
  17055. the value of @var{timeclamp} option
  17056. @end table
  17057. and functions:
  17058. @table @option
  17059. @item a_weighting(f)
  17060. A-weighting of equal loudness
  17061. @item b_weighting(f)
  17062. B-weighting of equal loudness
  17063. @item c_weighting(f)
  17064. C-weighting of equal loudness.
  17065. @end table
  17066. Default value is @code{16}.
  17067. @item bar_v, volume2
  17068. Specify the bargraph volume expression. It can contain variables:
  17069. @table @option
  17070. @item sono_v
  17071. the @var{sono_v} evaluated expression
  17072. @item frequency, freq, f
  17073. the frequency where it is evaluated
  17074. @item timeclamp, tc
  17075. the value of @var{timeclamp} option
  17076. @end table
  17077. and functions:
  17078. @table @option
  17079. @item a_weighting(f)
  17080. A-weighting of equal loudness
  17081. @item b_weighting(f)
  17082. B-weighting of equal loudness
  17083. @item c_weighting(f)
  17084. C-weighting of equal loudness.
  17085. @end table
  17086. Default value is @code{sono_v}.
  17087. @item sono_g, gamma
  17088. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17089. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17090. Acceptable range is @code{[1, 7]}.
  17091. @item bar_g, gamma2
  17092. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17093. @code{[1, 7]}.
  17094. @item bar_t
  17095. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17096. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17097. @item timeclamp, tc
  17098. Specify the transform timeclamp. At low frequency, there is trade-off between
  17099. accuracy in time domain and frequency domain. If timeclamp is lower,
  17100. event in time domain is represented more accurately (such as fast bass drum),
  17101. otherwise event in frequency domain is represented more accurately
  17102. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17103. @item attack
  17104. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17105. limits future samples by applying asymmetric windowing in time domain, useful
  17106. when low latency is required. Accepted range is @code{[0, 1]}.
  17107. @item basefreq
  17108. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17109. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17110. @item endfreq
  17111. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17112. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17113. @item coeffclamp
  17114. This option is deprecated and ignored.
  17115. @item tlength
  17116. Specify the transform length in time domain. Use this option to control accuracy
  17117. trade-off between time domain and frequency domain at every frequency sample.
  17118. It can contain variables:
  17119. @table @option
  17120. @item frequency, freq, f
  17121. the frequency where it is evaluated
  17122. @item timeclamp, tc
  17123. the value of @var{timeclamp} option.
  17124. @end table
  17125. Default value is @code{384*tc/(384+tc*f)}.
  17126. @item count
  17127. Specify the transform count for every video frame. Default value is @code{6}.
  17128. Acceptable range is @code{[1, 30]}.
  17129. @item fcount
  17130. Specify the transform count for every single pixel. Default value is @code{0},
  17131. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17132. @item fontfile
  17133. Specify font file for use with freetype to draw the axis. If not specified,
  17134. use embedded font. Note that drawing with font file or embedded font is not
  17135. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17136. option instead.
  17137. @item font
  17138. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  17139. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  17140. @item fontcolor
  17141. Specify font color expression. This is arithmetic expression that should return
  17142. integer value 0xRRGGBB. It can contain variables:
  17143. @table @option
  17144. @item frequency, freq, f
  17145. the frequency where it is evaluated
  17146. @item timeclamp, tc
  17147. the value of @var{timeclamp} option
  17148. @end table
  17149. and functions:
  17150. @table @option
  17151. @item midi(f)
  17152. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17153. @item r(x), g(x), b(x)
  17154. red, green, and blue value of intensity x.
  17155. @end table
  17156. Default value is @code{st(0, (midi(f)-59.5)/12);
  17157. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17158. r(1-ld(1)) + b(ld(1))}.
  17159. @item axisfile
  17160. Specify image file to draw the axis. This option override @var{fontfile} and
  17161. @var{fontcolor} option.
  17162. @item axis, text
  17163. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17164. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17165. Default value is @code{1}.
  17166. @item csp
  17167. Set colorspace. The accepted values are:
  17168. @table @samp
  17169. @item unspecified
  17170. Unspecified (default)
  17171. @item bt709
  17172. BT.709
  17173. @item fcc
  17174. FCC
  17175. @item bt470bg
  17176. BT.470BG or BT.601-6 625
  17177. @item smpte170m
  17178. SMPTE-170M or BT.601-6 525
  17179. @item smpte240m
  17180. SMPTE-240M
  17181. @item bt2020ncl
  17182. BT.2020 with non-constant luminance
  17183. @end table
  17184. @item cscheme
  17185. Set spectrogram color scheme. This is list of floating point values with format
  17186. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17187. The default is @code{1|0.5|0|0|0.5|1}.
  17188. @end table
  17189. @subsection Examples
  17190. @itemize
  17191. @item
  17192. Playing audio while showing the spectrum:
  17193. @example
  17194. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17195. @end example
  17196. @item
  17197. Same as above, but with frame rate 30 fps:
  17198. @example
  17199. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17200. @end example
  17201. @item
  17202. Playing at 1280x720:
  17203. @example
  17204. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17205. @end example
  17206. @item
  17207. Disable sonogram display:
  17208. @example
  17209. sono_h=0
  17210. @end example
  17211. @item
  17212. A1 and its harmonics: A1, A2, (near)E3, A3:
  17213. @example
  17214. 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),
  17215. asplit[a][out1]; [a] showcqt [out0]'
  17216. @end example
  17217. @item
  17218. Same as above, but with more accuracy in frequency domain:
  17219. @example
  17220. 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),
  17221. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17222. @end example
  17223. @item
  17224. Custom volume:
  17225. @example
  17226. bar_v=10:sono_v=bar_v*a_weighting(f)
  17227. @end example
  17228. @item
  17229. Custom gamma, now spectrum is linear to the amplitude.
  17230. @example
  17231. bar_g=2:sono_g=2
  17232. @end example
  17233. @item
  17234. Custom tlength equation:
  17235. @example
  17236. 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)))'
  17237. @end example
  17238. @item
  17239. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17240. @example
  17241. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17242. @end example
  17243. @item
  17244. Custom font using fontconfig:
  17245. @example
  17246. font='Courier New,Monospace,mono|bold'
  17247. @end example
  17248. @item
  17249. Custom frequency range with custom axis using image file:
  17250. @example
  17251. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17252. @end example
  17253. @end itemize
  17254. @section showfreqs
  17255. Convert input audio to video output representing the audio power spectrum.
  17256. Audio amplitude is on Y-axis while frequency is on X-axis.
  17257. The filter accepts the following options:
  17258. @table @option
  17259. @item size, s
  17260. Specify size of video. For the syntax of this option, check the
  17261. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17262. Default is @code{1024x512}.
  17263. @item mode
  17264. Set display mode.
  17265. This set how each frequency bin will be represented.
  17266. It accepts the following values:
  17267. @table @samp
  17268. @item line
  17269. @item bar
  17270. @item dot
  17271. @end table
  17272. Default is @code{bar}.
  17273. @item ascale
  17274. Set amplitude scale.
  17275. It accepts the following values:
  17276. @table @samp
  17277. @item lin
  17278. Linear scale.
  17279. @item sqrt
  17280. Square root scale.
  17281. @item cbrt
  17282. Cubic root scale.
  17283. @item log
  17284. Logarithmic scale.
  17285. @end table
  17286. Default is @code{log}.
  17287. @item fscale
  17288. Set frequency scale.
  17289. It accepts the following values:
  17290. @table @samp
  17291. @item lin
  17292. Linear scale.
  17293. @item log
  17294. Logarithmic scale.
  17295. @item rlog
  17296. Reverse logarithmic scale.
  17297. @end table
  17298. Default is @code{lin}.
  17299. @item win_size
  17300. Set window size. Allowed range is from 16 to 65536.
  17301. Default is @code{2048}
  17302. @item win_func
  17303. Set windowing function.
  17304. It accepts the following values:
  17305. @table @samp
  17306. @item rect
  17307. @item bartlett
  17308. @item hanning
  17309. @item hamming
  17310. @item blackman
  17311. @item welch
  17312. @item flattop
  17313. @item bharris
  17314. @item bnuttall
  17315. @item bhann
  17316. @item sine
  17317. @item nuttall
  17318. @item lanczos
  17319. @item gauss
  17320. @item tukey
  17321. @item dolph
  17322. @item cauchy
  17323. @item parzen
  17324. @item poisson
  17325. @item bohman
  17326. @end table
  17327. Default is @code{hanning}.
  17328. @item overlap
  17329. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17330. which means optimal overlap for selected window function will be picked.
  17331. @item averaging
  17332. Set time averaging. Setting this to 0 will display current maximal peaks.
  17333. Default is @code{1}, which means time averaging is disabled.
  17334. @item colors
  17335. Specify list of colors separated by space or by '|' which will be used to
  17336. draw channel frequencies. Unrecognized or missing colors will be replaced
  17337. by white color.
  17338. @item cmode
  17339. Set channel display mode.
  17340. It accepts the following values:
  17341. @table @samp
  17342. @item combined
  17343. @item separate
  17344. @end table
  17345. Default is @code{combined}.
  17346. @item minamp
  17347. Set minimum amplitude used in @code{log} amplitude scaler.
  17348. @end table
  17349. @section showspatial
  17350. Convert stereo input audio to a video output, representing the spatial relationship
  17351. between two channels.
  17352. The filter accepts the following options:
  17353. @table @option
  17354. @item size, s
  17355. Specify the video size for the output. For the syntax of this option, check the
  17356. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17357. Default value is @code{512x512}.
  17358. @item win_size
  17359. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17360. @item win_func
  17361. Set window function.
  17362. It accepts the following values:
  17363. @table @samp
  17364. @item rect
  17365. @item bartlett
  17366. @item hann
  17367. @item hanning
  17368. @item hamming
  17369. @item blackman
  17370. @item welch
  17371. @item flattop
  17372. @item bharris
  17373. @item bnuttall
  17374. @item bhann
  17375. @item sine
  17376. @item nuttall
  17377. @item lanczos
  17378. @item gauss
  17379. @item tukey
  17380. @item dolph
  17381. @item cauchy
  17382. @item parzen
  17383. @item poisson
  17384. @item bohman
  17385. @end table
  17386. Default value is @code{hann}.
  17387. @item overlap
  17388. Set ratio of overlap window. Default value is @code{0.5}.
  17389. When value is @code{1} overlap is set to recommended size for specific
  17390. window function currently used.
  17391. @end table
  17392. @anchor{showspectrum}
  17393. @section showspectrum
  17394. Convert input audio to a video output, representing the audio frequency
  17395. spectrum.
  17396. The filter accepts the following options:
  17397. @table @option
  17398. @item size, s
  17399. Specify the video size for the output. For the syntax of this option, check the
  17400. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17401. Default value is @code{640x512}.
  17402. @item slide
  17403. Specify how the spectrum should slide along the window.
  17404. It accepts the following values:
  17405. @table @samp
  17406. @item replace
  17407. the samples start again on the left when they reach the right
  17408. @item scroll
  17409. the samples scroll from right to left
  17410. @item fullframe
  17411. frames are only produced when the samples reach the right
  17412. @item rscroll
  17413. the samples scroll from left to right
  17414. @end table
  17415. Default value is @code{replace}.
  17416. @item mode
  17417. Specify display mode.
  17418. It accepts the following values:
  17419. @table @samp
  17420. @item combined
  17421. all channels are displayed in the same row
  17422. @item separate
  17423. all channels are displayed in separate rows
  17424. @end table
  17425. Default value is @samp{combined}.
  17426. @item color
  17427. Specify display color mode.
  17428. It accepts the following values:
  17429. @table @samp
  17430. @item channel
  17431. each channel is displayed in a separate color
  17432. @item intensity
  17433. each channel is displayed using the same color scheme
  17434. @item rainbow
  17435. each channel is displayed using the rainbow color scheme
  17436. @item moreland
  17437. each channel is displayed using the moreland color scheme
  17438. @item nebulae
  17439. each channel is displayed using the nebulae color scheme
  17440. @item fire
  17441. each channel is displayed using the fire color scheme
  17442. @item fiery
  17443. each channel is displayed using the fiery color scheme
  17444. @item fruit
  17445. each channel is displayed using the fruit color scheme
  17446. @item cool
  17447. each channel is displayed using the cool color scheme
  17448. @item magma
  17449. each channel is displayed using the magma color scheme
  17450. @item green
  17451. each channel is displayed using the green color scheme
  17452. @item viridis
  17453. each channel is displayed using the viridis color scheme
  17454. @item plasma
  17455. each channel is displayed using the plasma color scheme
  17456. @item cividis
  17457. each channel is displayed using the cividis color scheme
  17458. @item terrain
  17459. each channel is displayed using the terrain color scheme
  17460. @end table
  17461. Default value is @samp{channel}.
  17462. @item scale
  17463. Specify scale used for calculating intensity color values.
  17464. It accepts the following values:
  17465. @table @samp
  17466. @item lin
  17467. linear
  17468. @item sqrt
  17469. square root, default
  17470. @item cbrt
  17471. cubic root
  17472. @item log
  17473. logarithmic
  17474. @item 4thrt
  17475. 4th root
  17476. @item 5thrt
  17477. 5th root
  17478. @end table
  17479. Default value is @samp{sqrt}.
  17480. @item fscale
  17481. Specify frequency scale.
  17482. It accepts the following values:
  17483. @table @samp
  17484. @item lin
  17485. linear
  17486. @item log
  17487. logarithmic
  17488. @end table
  17489. Default value is @samp{lin}.
  17490. @item saturation
  17491. Set saturation modifier for displayed colors. Negative values provide
  17492. alternative color scheme. @code{0} is no saturation at all.
  17493. Saturation must be in [-10.0, 10.0] range.
  17494. Default value is @code{1}.
  17495. @item win_func
  17496. Set window function.
  17497. It accepts the following values:
  17498. @table @samp
  17499. @item rect
  17500. @item bartlett
  17501. @item hann
  17502. @item hanning
  17503. @item hamming
  17504. @item blackman
  17505. @item welch
  17506. @item flattop
  17507. @item bharris
  17508. @item bnuttall
  17509. @item bhann
  17510. @item sine
  17511. @item nuttall
  17512. @item lanczos
  17513. @item gauss
  17514. @item tukey
  17515. @item dolph
  17516. @item cauchy
  17517. @item parzen
  17518. @item poisson
  17519. @item bohman
  17520. @end table
  17521. Default value is @code{hann}.
  17522. @item orientation
  17523. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17524. @code{horizontal}. Default is @code{vertical}.
  17525. @item overlap
  17526. Set ratio of overlap window. Default value is @code{0}.
  17527. When value is @code{1} overlap is set to recommended size for specific
  17528. window function currently used.
  17529. @item gain
  17530. Set scale gain for calculating intensity color values.
  17531. Default value is @code{1}.
  17532. @item data
  17533. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17534. @item rotation
  17535. Set color rotation, must be in [-1.0, 1.0] range.
  17536. Default value is @code{0}.
  17537. @item start
  17538. Set start frequency from which to display spectrogram. Default is @code{0}.
  17539. @item stop
  17540. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17541. @item fps
  17542. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17543. @item legend
  17544. Draw time and frequency axes and legends. Default is disabled.
  17545. @end table
  17546. The usage is very similar to the showwaves filter; see the examples in that
  17547. section.
  17548. @subsection Examples
  17549. @itemize
  17550. @item
  17551. Large window with logarithmic color scaling:
  17552. @example
  17553. showspectrum=s=1280x480:scale=log
  17554. @end example
  17555. @item
  17556. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17557. @example
  17558. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17559. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17560. @end example
  17561. @end itemize
  17562. @section showspectrumpic
  17563. Convert input audio to a single video frame, representing the audio frequency
  17564. spectrum.
  17565. The filter accepts the following options:
  17566. @table @option
  17567. @item size, s
  17568. Specify the video size for the output. For the syntax of this option, check the
  17569. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17570. Default value is @code{4096x2048}.
  17571. @item mode
  17572. Specify display mode.
  17573. It accepts the following values:
  17574. @table @samp
  17575. @item combined
  17576. all channels are displayed in the same row
  17577. @item separate
  17578. all channels are displayed in separate rows
  17579. @end table
  17580. Default value is @samp{combined}.
  17581. @item color
  17582. Specify display color mode.
  17583. It accepts the following values:
  17584. @table @samp
  17585. @item channel
  17586. each channel is displayed in a separate color
  17587. @item intensity
  17588. each channel is displayed using the same color scheme
  17589. @item rainbow
  17590. each channel is displayed using the rainbow color scheme
  17591. @item moreland
  17592. each channel is displayed using the moreland color scheme
  17593. @item nebulae
  17594. each channel is displayed using the nebulae color scheme
  17595. @item fire
  17596. each channel is displayed using the fire color scheme
  17597. @item fiery
  17598. each channel is displayed using the fiery color scheme
  17599. @item fruit
  17600. each channel is displayed using the fruit color scheme
  17601. @item cool
  17602. each channel is displayed using the cool color scheme
  17603. @item magma
  17604. each channel is displayed using the magma color scheme
  17605. @item green
  17606. each channel is displayed using the green color scheme
  17607. @item viridis
  17608. each channel is displayed using the viridis color scheme
  17609. @item plasma
  17610. each channel is displayed using the plasma color scheme
  17611. @item cividis
  17612. each channel is displayed using the cividis color scheme
  17613. @item terrain
  17614. each channel is displayed using the terrain color scheme
  17615. @end table
  17616. Default value is @samp{intensity}.
  17617. @item scale
  17618. Specify scale used for calculating intensity color values.
  17619. It accepts the following values:
  17620. @table @samp
  17621. @item lin
  17622. linear
  17623. @item sqrt
  17624. square root, default
  17625. @item cbrt
  17626. cubic root
  17627. @item log
  17628. logarithmic
  17629. @item 4thrt
  17630. 4th root
  17631. @item 5thrt
  17632. 5th root
  17633. @end table
  17634. Default value is @samp{log}.
  17635. @item fscale
  17636. Specify frequency scale.
  17637. It accepts the following values:
  17638. @table @samp
  17639. @item lin
  17640. linear
  17641. @item log
  17642. logarithmic
  17643. @end table
  17644. Default value is @samp{lin}.
  17645. @item saturation
  17646. Set saturation modifier for displayed colors. Negative values provide
  17647. alternative color scheme. @code{0} is no saturation at all.
  17648. Saturation must be in [-10.0, 10.0] range.
  17649. Default value is @code{1}.
  17650. @item win_func
  17651. Set window function.
  17652. It accepts the following values:
  17653. @table @samp
  17654. @item rect
  17655. @item bartlett
  17656. @item hann
  17657. @item hanning
  17658. @item hamming
  17659. @item blackman
  17660. @item welch
  17661. @item flattop
  17662. @item bharris
  17663. @item bnuttall
  17664. @item bhann
  17665. @item sine
  17666. @item nuttall
  17667. @item lanczos
  17668. @item gauss
  17669. @item tukey
  17670. @item dolph
  17671. @item cauchy
  17672. @item parzen
  17673. @item poisson
  17674. @item bohman
  17675. @end table
  17676. Default value is @code{hann}.
  17677. @item orientation
  17678. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17679. @code{horizontal}. Default is @code{vertical}.
  17680. @item gain
  17681. Set scale gain for calculating intensity color values.
  17682. Default value is @code{1}.
  17683. @item legend
  17684. Draw time and frequency axes and legends. Default is enabled.
  17685. @item rotation
  17686. Set color rotation, must be in [-1.0, 1.0] range.
  17687. Default value is @code{0}.
  17688. @item start
  17689. Set start frequency from which to display spectrogram. Default is @code{0}.
  17690. @item stop
  17691. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17692. @end table
  17693. @subsection Examples
  17694. @itemize
  17695. @item
  17696. Extract an audio spectrogram of a whole audio track
  17697. in a 1024x1024 picture using @command{ffmpeg}:
  17698. @example
  17699. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17700. @end example
  17701. @end itemize
  17702. @section showvolume
  17703. Convert input audio volume to a video output.
  17704. The filter accepts the following options:
  17705. @table @option
  17706. @item rate, r
  17707. Set video rate.
  17708. @item b
  17709. Set border width, allowed range is [0, 5]. Default is 1.
  17710. @item w
  17711. Set channel width, allowed range is [80, 8192]. Default is 400.
  17712. @item h
  17713. Set channel height, allowed range is [1, 900]. Default is 20.
  17714. @item f
  17715. Set fade, allowed range is [0, 1]. Default is 0.95.
  17716. @item c
  17717. Set volume color expression.
  17718. The expression can use the following variables:
  17719. @table @option
  17720. @item VOLUME
  17721. Current max volume of channel in dB.
  17722. @item PEAK
  17723. Current peak.
  17724. @item CHANNEL
  17725. Current channel number, starting from 0.
  17726. @end table
  17727. @item t
  17728. If set, displays channel names. Default is enabled.
  17729. @item v
  17730. If set, displays volume values. Default is enabled.
  17731. @item o
  17732. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17733. default is @code{h}.
  17734. @item s
  17735. Set step size, allowed range is [0, 5]. Default is 0, which means
  17736. step is disabled.
  17737. @item p
  17738. Set background opacity, allowed range is [0, 1]. Default is 0.
  17739. @item m
  17740. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17741. default is @code{p}.
  17742. @item ds
  17743. Set display scale, can be linear: @code{lin} or log: @code{log},
  17744. default is @code{lin}.
  17745. @item dm
  17746. In second.
  17747. If set to > 0., display a line for the max level
  17748. in the previous seconds.
  17749. default is disabled: @code{0.}
  17750. @item dmc
  17751. The color of the max line. Use when @code{dm} option is set to > 0.
  17752. default is: @code{orange}
  17753. @end table
  17754. @section showwaves
  17755. Convert input audio to a video output, representing the samples waves.
  17756. The filter accepts the following options:
  17757. @table @option
  17758. @item size, s
  17759. Specify 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{600x240}.
  17762. @item mode
  17763. Set display mode.
  17764. Available values are:
  17765. @table @samp
  17766. @item point
  17767. Draw a point for each sample.
  17768. @item line
  17769. Draw a vertical line for each sample.
  17770. @item p2p
  17771. Draw a point for each sample and a line between them.
  17772. @item cline
  17773. Draw a centered vertical line for each sample.
  17774. @end table
  17775. Default value is @code{point}.
  17776. @item n
  17777. Set the number of samples which are printed on the same column. A
  17778. larger value will decrease the frame rate. Must be a positive
  17779. integer. This option can be set only if the value for @var{rate}
  17780. is not explicitly specified.
  17781. @item rate, r
  17782. Set the (approximate) output frame rate. This is done by setting the
  17783. option @var{n}. Default value is "25".
  17784. @item split_channels
  17785. Set if channels should be drawn separately or overlap. Default value is 0.
  17786. @item colors
  17787. Set colors separated by '|' which are going to be used for drawing of each channel.
  17788. @item scale
  17789. Set amplitude scale.
  17790. Available values are:
  17791. @table @samp
  17792. @item lin
  17793. Linear.
  17794. @item log
  17795. Logarithmic.
  17796. @item sqrt
  17797. Square root.
  17798. @item cbrt
  17799. Cubic root.
  17800. @end table
  17801. Default is linear.
  17802. @item draw
  17803. Set the draw mode. This is mostly useful to set for high @var{n}.
  17804. Available values are:
  17805. @table @samp
  17806. @item scale
  17807. Scale pixel values for each drawn sample.
  17808. @item full
  17809. Draw every sample directly.
  17810. @end table
  17811. Default value is @code{scale}.
  17812. @end table
  17813. @subsection Examples
  17814. @itemize
  17815. @item
  17816. Output the input file audio and the corresponding video representation
  17817. at the same time:
  17818. @example
  17819. amovie=a.mp3,asplit[out0],showwaves[out1]
  17820. @end example
  17821. @item
  17822. Create a synthetic signal and show it with showwaves, forcing a
  17823. frame rate of 30 frames per second:
  17824. @example
  17825. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17826. @end example
  17827. @end itemize
  17828. @section showwavespic
  17829. Convert input audio to a single video frame, representing the samples waves.
  17830. The filter accepts the following options:
  17831. @table @option
  17832. @item size, s
  17833. Specify the video size for the output. For the syntax of this option, check the
  17834. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17835. Default value is @code{600x240}.
  17836. @item split_channels
  17837. Set if channels should be drawn separately or overlap. Default value is 0.
  17838. @item colors
  17839. Set colors separated by '|' which are going to be used for drawing of each channel.
  17840. @item scale
  17841. Set amplitude scale.
  17842. Available values are:
  17843. @table @samp
  17844. @item lin
  17845. Linear.
  17846. @item log
  17847. Logarithmic.
  17848. @item sqrt
  17849. Square root.
  17850. @item cbrt
  17851. Cubic root.
  17852. @end table
  17853. Default is linear.
  17854. @item draw
  17855. Set the draw mode.
  17856. Available values are:
  17857. @table @samp
  17858. @item scale
  17859. Scale pixel values for each drawn sample.
  17860. @item full
  17861. Draw every sample directly.
  17862. @end table
  17863. Default value is @code{scale}.
  17864. @end table
  17865. @subsection Examples
  17866. @itemize
  17867. @item
  17868. Extract a channel split representation of the wave form of a whole audio track
  17869. in a 1024x800 picture using @command{ffmpeg}:
  17870. @example
  17871. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17872. @end example
  17873. @end itemize
  17874. @section sidedata, asidedata
  17875. Delete frame side data, or select frames based on it.
  17876. This filter accepts the following options:
  17877. @table @option
  17878. @item mode
  17879. Set mode of operation of the filter.
  17880. Can be one of the following:
  17881. @table @samp
  17882. @item select
  17883. Select every frame with side data of @code{type}.
  17884. @item delete
  17885. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17886. data in the frame.
  17887. @end table
  17888. @item type
  17889. Set side data type used with all modes. Must be set for @code{select} mode. For
  17890. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17891. in @file{libavutil/frame.h}. For example, to choose
  17892. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17893. @end table
  17894. @section spectrumsynth
  17895. Sythesize audio from 2 input video spectrums, first input stream represents
  17896. magnitude across time and second represents phase across time.
  17897. The filter will transform from frequency domain as displayed in videos back
  17898. to time domain as presented in audio output.
  17899. This filter is primarily created for reversing processed @ref{showspectrum}
  17900. filter outputs, but can synthesize sound from other spectrograms too.
  17901. But in such case results are going to be poor if the phase data is not
  17902. available, because in such cases phase data need to be recreated, usually
  17903. it's just recreated from random noise.
  17904. For best results use gray only output (@code{channel} color mode in
  17905. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17906. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17907. @code{data} option. Inputs videos should generally use @code{fullframe}
  17908. slide mode as that saves resources needed for decoding video.
  17909. The filter accepts the following options:
  17910. @table @option
  17911. @item sample_rate
  17912. Specify sample rate of output audio, the sample rate of audio from which
  17913. spectrum was generated may differ.
  17914. @item channels
  17915. Set number of channels represented in input video spectrums.
  17916. @item scale
  17917. Set scale which was used when generating magnitude input spectrum.
  17918. Can be @code{lin} or @code{log}. Default is @code{log}.
  17919. @item slide
  17920. Set slide which was used when generating inputs spectrums.
  17921. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17922. Default is @code{fullframe}.
  17923. @item win_func
  17924. Set window function used for resynthesis.
  17925. @item overlap
  17926. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17927. which means optimal overlap for selected window function will be picked.
  17928. @item orientation
  17929. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17930. Default is @code{vertical}.
  17931. @end table
  17932. @subsection Examples
  17933. @itemize
  17934. @item
  17935. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17936. then resynthesize videos back to audio with spectrumsynth:
  17937. @example
  17938. 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
  17939. 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
  17940. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17941. @end example
  17942. @end itemize
  17943. @section split, asplit
  17944. Split input into several identical outputs.
  17945. @code{asplit} works with audio input, @code{split} with video.
  17946. The filter accepts a single parameter which specifies the number of outputs. If
  17947. unspecified, it defaults to 2.
  17948. @subsection Examples
  17949. @itemize
  17950. @item
  17951. Create two separate outputs from the same input:
  17952. @example
  17953. [in] split [out0][out1]
  17954. @end example
  17955. @item
  17956. To create 3 or more outputs, you need to specify the number of
  17957. outputs, like in:
  17958. @example
  17959. [in] asplit=3 [out0][out1][out2]
  17960. @end example
  17961. @item
  17962. Create two separate outputs from the same input, one cropped and
  17963. one padded:
  17964. @example
  17965. [in] split [splitout1][splitout2];
  17966. [splitout1] crop=100:100:0:0 [cropout];
  17967. [splitout2] pad=200:200:100:100 [padout];
  17968. @end example
  17969. @item
  17970. Create 5 copies of the input audio with @command{ffmpeg}:
  17971. @example
  17972. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17973. @end example
  17974. @end itemize
  17975. @section zmq, azmq
  17976. Receive commands sent through a libzmq client, and forward them to
  17977. filters in the filtergraph.
  17978. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17979. must be inserted between two video filters, @code{azmq} between two
  17980. audio filters. Both are capable to send messages to any filter type.
  17981. To enable these filters you need to install the libzmq library and
  17982. headers and configure FFmpeg with @code{--enable-libzmq}.
  17983. For more information about libzmq see:
  17984. @url{http://www.zeromq.org/}
  17985. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17986. receives messages sent through a network interface defined by the
  17987. @option{bind_address} (or the abbreviation "@option{b}") option.
  17988. Default value of this option is @file{tcp://localhost:5555}. You may
  17989. want to alter this value to your needs, but do not forget to escape any
  17990. ':' signs (see @ref{filtergraph escaping}).
  17991. The received message must be in the form:
  17992. @example
  17993. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17994. @end example
  17995. @var{TARGET} specifies the target of the command, usually the name of
  17996. the filter class or a specific filter instance name. The default
  17997. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17998. but you can override this by using the @samp{filter_name@@id} syntax
  17999. (see @ref{Filtergraph syntax}).
  18000. @var{COMMAND} specifies the name of the command for the target filter.
  18001. @var{ARG} is optional and specifies the optional argument list for the
  18002. given @var{COMMAND}.
  18003. Upon reception, the message is processed and the corresponding command
  18004. is injected into the filtergraph. Depending on the result, the filter
  18005. will send a reply to the client, adopting the format:
  18006. @example
  18007. @var{ERROR_CODE} @var{ERROR_REASON}
  18008. @var{MESSAGE}
  18009. @end example
  18010. @var{MESSAGE} is optional.
  18011. @subsection Examples
  18012. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18013. be used to send commands processed by these filters.
  18014. Consider the following filtergraph generated by @command{ffplay}.
  18015. In this example the last overlay filter has an instance name. All other
  18016. filters will have default instance names.
  18017. @example
  18018. ffplay -dumpgraph 1 -f lavfi "
  18019. color=s=100x100:c=red [l];
  18020. color=s=100x100:c=blue [r];
  18021. nullsrc=s=200x100, zmq [bg];
  18022. [bg][l] overlay [bg+l];
  18023. [bg+l][r] overlay@@my=x=100 "
  18024. @end example
  18025. To change the color of the left side of the video, the following
  18026. command can be used:
  18027. @example
  18028. echo Parsed_color_0 c yellow | tools/zmqsend
  18029. @end example
  18030. To change the right side:
  18031. @example
  18032. echo Parsed_color_1 c pink | tools/zmqsend
  18033. @end example
  18034. To change the position of the right side:
  18035. @example
  18036. echo overlay@@my x 150 | tools/zmqsend
  18037. @end example
  18038. @c man end MULTIMEDIA FILTERS
  18039. @chapter Multimedia Sources
  18040. @c man begin MULTIMEDIA SOURCES
  18041. Below is a description of the currently available multimedia sources.
  18042. @section amovie
  18043. This is the same as @ref{movie} source, except it selects an audio
  18044. stream by default.
  18045. @anchor{movie}
  18046. @section movie
  18047. Read audio and/or video stream(s) from a movie container.
  18048. It accepts the following parameters:
  18049. @table @option
  18050. @item filename
  18051. The name of the resource to read (not necessarily a file; it can also be a
  18052. device or a stream accessed through some protocol).
  18053. @item format_name, f
  18054. Specifies the format assumed for the movie to read, and can be either
  18055. the name of a container or an input device. If not specified, the
  18056. format is guessed from @var{movie_name} or by probing.
  18057. @item seek_point, sp
  18058. Specifies the seek point in seconds. The frames will be output
  18059. starting from this seek point. The parameter is evaluated with
  18060. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18061. postfix. The default value is "0".
  18062. @item streams, s
  18063. Specifies the streams to read. Several streams can be specified,
  18064. separated by "+". The source will then have as many outputs, in the
  18065. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18066. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18067. respectively the default (best suited) video and audio stream. Default
  18068. is "dv", or "da" if the filter is called as "amovie".
  18069. @item stream_index, si
  18070. Specifies the index of the video stream to read. If the value is -1,
  18071. the most suitable video stream will be automatically selected. The default
  18072. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18073. audio instead of video.
  18074. @item loop
  18075. Specifies how many times to read the stream in sequence.
  18076. If the value is 0, the stream will be looped infinitely.
  18077. Default value is "1".
  18078. Note that when the movie is looped the source timestamps are not
  18079. changed, so it will generate non monotonically increasing timestamps.
  18080. @item discontinuity
  18081. Specifies the time difference between frames above which the point is
  18082. considered a timestamp discontinuity which is removed by adjusting the later
  18083. timestamps.
  18084. @end table
  18085. It allows overlaying a second video on top of the main input of
  18086. a filtergraph, as shown in this graph:
  18087. @example
  18088. input -----------> deltapts0 --> overlay --> output
  18089. ^
  18090. |
  18091. movie --> scale--> deltapts1 -------+
  18092. @end example
  18093. @subsection Examples
  18094. @itemize
  18095. @item
  18096. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18097. on top of the input labelled "in":
  18098. @example
  18099. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18100. [in] setpts=PTS-STARTPTS [main];
  18101. [main][over] overlay=16:16 [out]
  18102. @end example
  18103. @item
  18104. Read from a video4linux2 device, and overlay it on top of the input
  18105. labelled "in":
  18106. @example
  18107. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18108. [in] setpts=PTS-STARTPTS [main];
  18109. [main][over] overlay=16:16 [out]
  18110. @end example
  18111. @item
  18112. Read the first video stream and the audio stream with id 0x81 from
  18113. dvd.vob; the video is connected to the pad named "video" and the audio is
  18114. connected to the pad named "audio":
  18115. @example
  18116. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18117. @end example
  18118. @end itemize
  18119. @subsection Commands
  18120. Both movie and amovie support the following commands:
  18121. @table @option
  18122. @item seek
  18123. Perform seek using "av_seek_frame".
  18124. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18125. @itemize
  18126. @item
  18127. @var{stream_index}: If stream_index is -1, a default
  18128. stream is selected, and @var{timestamp} is automatically converted
  18129. from AV_TIME_BASE units to the stream specific time_base.
  18130. @item
  18131. @var{timestamp}: Timestamp in AVStream.time_base units
  18132. or, if no stream is specified, in AV_TIME_BASE units.
  18133. @item
  18134. @var{flags}: Flags which select direction and seeking mode.
  18135. @end itemize
  18136. @item get_duration
  18137. Get movie duration in AV_TIME_BASE units.
  18138. @end table
  18139. @c man end MULTIMEDIA SOURCES