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.

22825 lines
608KB

  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 threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range compression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples detected as noise are spaced less than this value then any
  475. sample between those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. If you want instead to delay in seconds, append 's' to number.
  533. @end table
  534. @subsection Examples
  535. @itemize
  536. @item
  537. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  538. the second channel (and any other channels that may be present) unchanged.
  539. @example
  540. adelay=1500|0|500
  541. @end example
  542. @item
  543. Delay second channel by 500 samples, the third channel by 700 samples and leave
  544. the first channel (and any other channels that may be present) unchanged.
  545. @example
  546. adelay=0|500S|700S
  547. @end example
  548. @end itemize
  549. @section aderivative, aintegral
  550. Compute derivative/integral of audio stream.
  551. Applying both filters one after another produces original audio.
  552. @section aecho
  553. Apply echoing to the input audio.
  554. Echoes are reflected sound and can occur naturally amongst mountains
  555. (and sometimes large buildings) when talking or shouting; digital echo
  556. effects emulate this behaviour and are often used to help fill out the
  557. sound of a single instrument or vocal. The time difference between the
  558. original signal and the reflection is the @code{delay}, and the
  559. loudness of the reflected signal is the @code{decay}.
  560. Multiple echoes can have different delays and decays.
  561. A description of the accepted parameters follows.
  562. @table @option
  563. @item in_gain
  564. Set input gain of reflected signal. Default is @code{0.6}.
  565. @item out_gain
  566. Set output gain of reflected signal. Default is @code{0.3}.
  567. @item delays
  568. Set list of time intervals in milliseconds between original signal and reflections
  569. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  570. Default is @code{1000}.
  571. @item decays
  572. Set list of loudness of reflected signals separated by '|'.
  573. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  574. Default is @code{0.5}.
  575. @end table
  576. @subsection Examples
  577. @itemize
  578. @item
  579. Make it sound as if there are twice as many instruments as are actually playing:
  580. @example
  581. aecho=0.8:0.88:60:0.4
  582. @end example
  583. @item
  584. If delay is very short, then it sound like a (metallic) robot playing music:
  585. @example
  586. aecho=0.8:0.88:6:0.4
  587. @end example
  588. @item
  589. A longer delay will sound like an open air concert in the mountains:
  590. @example
  591. aecho=0.8:0.9:1000:0.3
  592. @end example
  593. @item
  594. Same as above but with one more mountain:
  595. @example
  596. aecho=0.8:0.9:1000|1800:0.3|0.25
  597. @end example
  598. @end itemize
  599. @section aemphasis
  600. Audio emphasis filter creates or restores material directly taken from LPs or
  601. emphased CDs with different filter curves. E.g. to store music on vinyl the
  602. signal has to be altered by a filter first to even out the disadvantages of
  603. this recording medium.
  604. Once the material is played back the inverse filter has to be applied to
  605. restore the distortion of the frequency response.
  606. The filter accepts the following options:
  607. @table @option
  608. @item level_in
  609. Set input gain.
  610. @item level_out
  611. Set output gain.
  612. @item mode
  613. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  614. use @code{production} mode. Default is @code{reproduction} mode.
  615. @item type
  616. Set filter type. Selects medium. Can be one of the following:
  617. @table @option
  618. @item col
  619. select Columbia.
  620. @item emi
  621. select EMI.
  622. @item bsi
  623. select BSI (78RPM).
  624. @item riaa
  625. select RIAA.
  626. @item cd
  627. select Compact Disc (CD).
  628. @item 50fm
  629. select 50µs (FM).
  630. @item 75fm
  631. select 75µs (FM).
  632. @item 50kf
  633. select 50µs (FM-KF).
  634. @item 75kf
  635. select 75µs (FM-KF).
  636. @end table
  637. @end table
  638. @section aeval
  639. Modify an audio signal according to the specified expressions.
  640. This filter accepts one or more expressions (one for each channel),
  641. which are evaluated and used to modify a corresponding audio signal.
  642. It accepts the following parameters:
  643. @table @option
  644. @item exprs
  645. Set the '|'-separated expressions list for each separate channel. If
  646. the number of input channels is greater than the number of
  647. expressions, the last specified expression is used for the remaining
  648. output channels.
  649. @item channel_layout, c
  650. Set output channel layout. If not specified, the channel layout is
  651. specified by the number of expressions. If set to @samp{same}, it will
  652. use by default the same input channel layout.
  653. @end table
  654. Each expression in @var{exprs} can contain the following constants and functions:
  655. @table @option
  656. @item ch
  657. channel number of the current expression
  658. @item n
  659. number of the evaluated sample, starting from 0
  660. @item s
  661. sample rate
  662. @item t
  663. time of the evaluated sample expressed in seconds
  664. @item nb_in_channels
  665. @item nb_out_channels
  666. input and output number of channels
  667. @item val(CH)
  668. the value of input channel with number @var{CH}
  669. @end table
  670. Note: this filter is slow. For faster processing you should use a
  671. dedicated filter.
  672. @subsection Examples
  673. @itemize
  674. @item
  675. Half volume:
  676. @example
  677. aeval=val(ch)/2:c=same
  678. @end example
  679. @item
  680. Invert phase of the second channel:
  681. @example
  682. aeval=val(0)|-val(1)
  683. @end example
  684. @end itemize
  685. @anchor{afade}
  686. @section afade
  687. Apply fade-in/out effect to input audio.
  688. A description of the accepted parameters follows.
  689. @table @option
  690. @item type, t
  691. Specify the effect type, can be either @code{in} for fade-in, or
  692. @code{out} for a fade-out effect. Default is @code{in}.
  693. @item start_sample, ss
  694. Specify the number of the start sample for starting to apply the fade
  695. effect. Default is 0.
  696. @item nb_samples, ns
  697. Specify the number of samples for which the fade effect has to last. At
  698. the end of the fade-in effect the output audio will have the same
  699. volume as the input audio, at the end of the fade-out transition
  700. the output audio will be silence. Default is 44100.
  701. @item start_time, st
  702. Specify the start time of the fade effect. Default is 0.
  703. The value must be specified as a time duration; see
  704. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  705. for the accepted syntax.
  706. If set this option is used instead of @var{start_sample}.
  707. @item duration, d
  708. Specify the duration of the fade effect. See
  709. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the accepted syntax.
  711. At the end of the fade-in effect the output audio will have the same
  712. volume as the input audio, at the end of the fade-out transition
  713. the output audio will be silence.
  714. By default the duration is determined by @var{nb_samples}.
  715. If set this option is used instead of @var{nb_samples}.
  716. @item curve
  717. Set curve for fade transition.
  718. It accepts the following values:
  719. @table @option
  720. @item tri
  721. select triangular, linear slope (default)
  722. @item qsin
  723. select quarter of sine wave
  724. @item hsin
  725. select half of sine wave
  726. @item esin
  727. select exponential sine wave
  728. @item log
  729. select logarithmic
  730. @item ipar
  731. select inverted parabola
  732. @item qua
  733. select quadratic
  734. @item cub
  735. select cubic
  736. @item squ
  737. select square root
  738. @item cbr
  739. select cubic root
  740. @item par
  741. select parabola
  742. @item exp
  743. select exponential
  744. @item iqsin
  745. select inverted quarter of sine wave
  746. @item ihsin
  747. select inverted half of sine wave
  748. @item dese
  749. select double-exponential seat
  750. @item desi
  751. select double-exponential sigmoid
  752. @item losi
  753. select logistic sigmoid
  754. @item nofade
  755. no fade applied
  756. @end table
  757. @end table
  758. @subsection Examples
  759. @itemize
  760. @item
  761. Fade in first 15 seconds of audio:
  762. @example
  763. afade=t=in:ss=0:d=15
  764. @end example
  765. @item
  766. Fade out last 25 seconds of a 900 seconds audio:
  767. @example
  768. afade=t=out:st=875:d=25
  769. @end example
  770. @end itemize
  771. @section afftdn
  772. Denoise audio samples with FFT.
  773. A description of the accepted parameters follows.
  774. @table @option
  775. @item nr
  776. Set the noise reduction in dB, allowed range is 0.01 to 97.
  777. Default value is 12 dB.
  778. @item nf
  779. Set the noise floor in dB, allowed range is -80 to -20.
  780. Default value is -50 dB.
  781. @item nt
  782. Set the noise type.
  783. It accepts the following values:
  784. @table @option
  785. @item w
  786. Select white noise.
  787. @item v
  788. Select vinyl noise.
  789. @item s
  790. Select shellac noise.
  791. @item c
  792. Select custom noise, defined in @code{bn} option.
  793. Default value is white noise.
  794. @end table
  795. @item bn
  796. Set custom band noise for every one of 15 bands.
  797. Bands are separated by ' ' or '|'.
  798. @item rf
  799. Set the residual floor in dB, allowed range is -80 to -20.
  800. Default value is -38 dB.
  801. @item tn
  802. Enable noise tracking. By default is disabled.
  803. With this enabled, noise floor is automatically adjusted.
  804. @item tr
  805. Enable residual tracking. By default is disabled.
  806. @item om
  807. Set the output mode.
  808. It accepts the following values:
  809. @table @option
  810. @item i
  811. Pass input unchanged.
  812. @item o
  813. Pass noise filtered out.
  814. @item n
  815. Pass only noise.
  816. Default value is @var{o}.
  817. @end table
  818. @end table
  819. @subsection Commands
  820. This filter supports the following commands:
  821. @table @option
  822. @item sample_noise, sn
  823. Start or stop measuring noise profile.
  824. Syntax for the command is : "start" or "stop" string.
  825. After measuring noise profile is stopped it will be
  826. automatically applied in filtering.
  827. @item noise_reduction, nr
  828. Change noise reduction. Argument is single float number.
  829. Syntax for the command is : "@var{noise_reduction}"
  830. @item noise_floor, nf
  831. Change noise floor. Argument is single float number.
  832. Syntax for the command is : "@var{noise_floor}"
  833. @item output_mode, om
  834. Change output mode operation.
  835. Syntax for the command is : "i", "o" or "n" string.
  836. @end table
  837. @section afftfilt
  838. Apply arbitrary expressions to samples in frequency domain.
  839. @table @option
  840. @item real
  841. Set frequency domain real expression for each separate channel separated
  842. by '|'. Default is "re".
  843. If the number of input channels is greater than the number of
  844. expressions, the last specified expression is used for the remaining
  845. output channels.
  846. @item imag
  847. Set frequency domain imaginary expression for each separate channel
  848. separated by '|'. Default is "im".
  849. Each expression in @var{real} and @var{imag} can contain the following
  850. constants and functions:
  851. @table @option
  852. @item sr
  853. sample rate
  854. @item b
  855. current frequency bin number
  856. @item nb
  857. number of available bins
  858. @item ch
  859. channel number of the current expression
  860. @item chs
  861. number of channels
  862. @item pts
  863. current frame pts
  864. @item re
  865. current real part of frequency bin of current channel
  866. @item im
  867. current imaginary part of frequency bin of current channel
  868. @item real(b, ch)
  869. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  870. @item imag(b, ch)
  871. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  872. @end table
  873. @item win_size
  874. Set window size.
  875. It accepts the following values:
  876. @table @samp
  877. @item w16
  878. @item w32
  879. @item w64
  880. @item w128
  881. @item w256
  882. @item w512
  883. @item w1024
  884. @item w2048
  885. @item w4096
  886. @item w8192
  887. @item w16384
  888. @item w32768
  889. @item w65536
  890. @end table
  891. Default is @code{w4096}
  892. @item win_func
  893. Set window function. Default is @code{hann}.
  894. @item overlap
  895. Set window overlap. If set to 1, the recommended overlap for selected
  896. window function will be picked. Default is @code{0.75}.
  897. @end table
  898. @subsection Examples
  899. @itemize
  900. @item
  901. Leave almost only low frequencies in audio:
  902. @example
  903. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  904. @end example
  905. @end itemize
  906. @anchor{afir}
  907. @section afir
  908. Apply an arbitrary Frequency Impulse Response filter.
  909. This filter is designed for applying long FIR filters,
  910. up to 60 seconds long.
  911. It can be used as component for digital crossover filters,
  912. room equalization, cross talk cancellation, wavefield synthesis,
  913. auralization, ambiophonics, ambisonics and spatialization.
  914. This filter uses second stream as FIR coefficients.
  915. If second stream holds single channel, it will be used
  916. for all input channels in first stream, otherwise
  917. number of channels in second stream must be same as
  918. number of channels in first stream.
  919. It accepts the following parameters:
  920. @table @option
  921. @item dry
  922. Set dry gain. This sets input gain.
  923. @item wet
  924. Set wet gain. This sets final output gain.
  925. @item length
  926. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  927. @item gtype
  928. Enable applying gain measured from power of IR.
  929. Set which approach to use for auto gain measurement.
  930. @table @option
  931. @item none
  932. Do not apply any gain.
  933. @item peak
  934. select peak gain, very conservative approach. This is default value.
  935. @item dc
  936. select DC gain, limited application.
  937. @item gn
  938. select gain to noise approach, this is most popular one.
  939. @end table
  940. @item irgain
  941. Set gain to be applied to IR coefficients before filtering.
  942. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  943. @item irfmt
  944. Set format of IR stream. Can be @code{mono} or @code{input}.
  945. Default is @code{input}.
  946. @item maxir
  947. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  948. Allowed range is 0.1 to 60 seconds.
  949. @item response
  950. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  951. By default it is disabled.
  952. @item channel
  953. Set for which IR channel to display frequency response. By default is first channel
  954. displayed. This option is used only when @var{response} is enabled.
  955. @item size
  956. Set video stream size. This option is used only when @var{response} is enabled.
  957. @item rate
  958. Set video stream frame rate. This option is used only when @var{response} is enabled.
  959. @item minp
  960. Set minimal partition size used for convolution. Default is @var{8192}.
  961. Allowed range is from @var{8} to @var{32768}.
  962. Lower values decreases latency at cost of higher CPU usage.
  963. @item maxp
  964. Set maximal partition size used for convolution. Default is @var{8192}.
  965. Allowed range is from @var{8} to @var{32768}.
  966. Lower values may increase CPU usage.
  967. @end table
  968. @subsection Examples
  969. @itemize
  970. @item
  971. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  972. @example
  973. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  974. @end example
  975. @end itemize
  976. @anchor{aformat}
  977. @section aformat
  978. Set output format constraints for the input audio. The framework will
  979. negotiate the most appropriate format to minimize conversions.
  980. It accepts the following parameters:
  981. @table @option
  982. @item sample_fmts
  983. A '|'-separated list of requested sample formats.
  984. @item sample_rates
  985. A '|'-separated list of requested sample rates.
  986. @item channel_layouts
  987. A '|'-separated list of requested channel layouts.
  988. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  989. for the required syntax.
  990. @end table
  991. If a parameter is omitted, all values are allowed.
  992. Force the output to either unsigned 8-bit or signed 16-bit stereo
  993. @example
  994. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  995. @end example
  996. @section agate
  997. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  998. processing reduces disturbing noise between useful signals.
  999. Gating is done by detecting the volume below a chosen level @var{threshold}
  1000. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1001. floor is set via @var{range}. Because an exact manipulation of the signal
  1002. would cause distortion of the waveform the reduction can be levelled over
  1003. time. This is done by setting @var{attack} and @var{release}.
  1004. @var{attack} determines how long the signal has to fall below the threshold
  1005. before any reduction will occur and @var{release} sets the time the signal
  1006. has to rise above the threshold to reduce the reduction again.
  1007. Shorter signals than the chosen attack time will be left untouched.
  1008. @table @option
  1009. @item level_in
  1010. Set input level before filtering.
  1011. Default is 1. Allowed range is from 0.015625 to 64.
  1012. @item range
  1013. Set the level of gain reduction when the signal is below the threshold.
  1014. Default is 0.06125. Allowed range is from 0 to 1.
  1015. @item threshold
  1016. If a signal rises above this level the gain reduction is released.
  1017. Default is 0.125. Allowed range is from 0 to 1.
  1018. @item ratio
  1019. Set a ratio by which the signal is reduced.
  1020. Default is 2. Allowed range is from 1 to 9000.
  1021. @item attack
  1022. Amount of milliseconds the signal has to rise above the threshold before gain
  1023. reduction stops.
  1024. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1025. @item release
  1026. Amount of milliseconds the signal has to fall below the threshold before the
  1027. reduction is increased again. Default is 250 milliseconds.
  1028. Allowed range is from 0.01 to 9000.
  1029. @item makeup
  1030. Set amount of amplification of signal after processing.
  1031. Default is 1. Allowed range is from 1 to 64.
  1032. @item knee
  1033. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1034. Default is 2.828427125. Allowed range is from 1 to 8.
  1035. @item detection
  1036. Choose if exact signal should be taken for detection or an RMS like one.
  1037. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1038. @item link
  1039. Choose if the average level between all channels or the louder channel affects
  1040. the reduction.
  1041. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1042. @end table
  1043. @section aiir
  1044. Apply an arbitrary Infinite Impulse Response filter.
  1045. It accepts the following parameters:
  1046. @table @option
  1047. @item z
  1048. Set numerator/zeros coefficients.
  1049. @item p
  1050. Set denominator/poles coefficients.
  1051. @item k
  1052. Set channels gains.
  1053. @item dry_gain
  1054. Set input gain.
  1055. @item wet_gain
  1056. Set output gain.
  1057. @item f
  1058. Set coefficients format.
  1059. @table @samp
  1060. @item tf
  1061. transfer function
  1062. @item zp
  1063. Z-plane zeros/poles, cartesian (default)
  1064. @item pr
  1065. Z-plane zeros/poles, polar radians
  1066. @item pd
  1067. Z-plane zeros/poles, polar degrees
  1068. @end table
  1069. @item r
  1070. Set kind of processing.
  1071. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1072. @item e
  1073. Set filtering precision.
  1074. @table @samp
  1075. @item dbl
  1076. double-precision floating-point (default)
  1077. @item flt
  1078. single-precision floating-point
  1079. @item i32
  1080. 32-bit integers
  1081. @item i16
  1082. 16-bit integers
  1083. @end table
  1084. @item response
  1085. Show IR frequency response, magnitude and phase in additional video stream.
  1086. By default it is disabled.
  1087. @item channel
  1088. Set for which IR channel to display frequency response. By default is first channel
  1089. displayed. This option is used only when @var{response} is enabled.
  1090. @item size
  1091. Set video stream size. This option is used only when @var{response} is enabled.
  1092. @end table
  1093. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1094. order.
  1095. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1096. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1097. imaginary unit.
  1098. Different coefficients and gains can be provided for every channel, in such case
  1099. use '|' to separate coefficients or gains. Last provided coefficients will be
  1100. used for all remaining channels.
  1101. @subsection Examples
  1102. @itemize
  1103. @item
  1104. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1105. @example
  1106. 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
  1107. @end example
  1108. @item
  1109. Same as above but in @code{zp} format:
  1110. @example
  1111. 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
  1112. @end example
  1113. @end itemize
  1114. @section alimiter
  1115. The limiter prevents an input signal from rising over a desired threshold.
  1116. This limiter uses lookahead technology to prevent your signal from distorting.
  1117. It means that there is a small delay after the signal is processed. Keep in mind
  1118. that the delay it produces is the attack time you set.
  1119. The filter accepts the following options:
  1120. @table @option
  1121. @item level_in
  1122. Set input gain. Default is 1.
  1123. @item level_out
  1124. Set output gain. Default is 1.
  1125. @item limit
  1126. Don't let signals above this level pass the limiter. Default is 1.
  1127. @item attack
  1128. The limiter will reach its attenuation level in this amount of time in
  1129. milliseconds. Default is 5 milliseconds.
  1130. @item release
  1131. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1132. Default is 50 milliseconds.
  1133. @item asc
  1134. When gain reduction is always needed ASC takes care of releasing to an
  1135. average reduction level rather than reaching a reduction of 0 in the release
  1136. time.
  1137. @item asc_level
  1138. Select how much the release time is affected by ASC, 0 means nearly no changes
  1139. in release time while 1 produces higher release times.
  1140. @item level
  1141. Auto level output signal. Default is enabled.
  1142. This normalizes audio back to 0dB if enabled.
  1143. @end table
  1144. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1145. with @ref{aresample} before applying this filter.
  1146. @section allpass
  1147. Apply a two-pole all-pass filter with central frequency (in Hz)
  1148. @var{frequency}, and filter-width @var{width}.
  1149. An all-pass filter changes the audio's frequency to phase relationship
  1150. without changing its frequency to amplitude relationship.
  1151. The filter accepts the following options:
  1152. @table @option
  1153. @item frequency, f
  1154. Set frequency in Hz.
  1155. @item width_type, t
  1156. Set method to specify band-width of filter.
  1157. @table @option
  1158. @item h
  1159. Hz
  1160. @item q
  1161. Q-Factor
  1162. @item o
  1163. octave
  1164. @item s
  1165. slope
  1166. @item k
  1167. kHz
  1168. @end table
  1169. @item width, w
  1170. Specify the band-width of a filter in width_type units.
  1171. @item channels, c
  1172. Specify which channels to filter, by default all available are filtered.
  1173. @end table
  1174. @subsection Commands
  1175. This filter supports the following commands:
  1176. @table @option
  1177. @item frequency, f
  1178. Change allpass frequency.
  1179. Syntax for the command is : "@var{frequency}"
  1180. @item width_type, t
  1181. Change allpass width_type.
  1182. Syntax for the command is : "@var{width_type}"
  1183. @item width, w
  1184. Change allpass width.
  1185. Syntax for the command is : "@var{width}"
  1186. @end table
  1187. @section aloop
  1188. Loop audio samples.
  1189. The filter accepts the following options:
  1190. @table @option
  1191. @item loop
  1192. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1193. Default is 0.
  1194. @item size
  1195. Set maximal number of samples. Default is 0.
  1196. @item start
  1197. Set first sample of loop. Default is 0.
  1198. @end table
  1199. @anchor{amerge}
  1200. @section amerge
  1201. Merge two or more audio streams into a single multi-channel stream.
  1202. The filter accepts the following options:
  1203. @table @option
  1204. @item inputs
  1205. Set the number of inputs. Default is 2.
  1206. @end table
  1207. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1208. the channel layout of the output will be set accordingly and the channels
  1209. will be reordered as necessary. If the channel layouts of the inputs are not
  1210. disjoint, the output will have all the channels of the first input then all
  1211. the channels of the second input, in that order, and the channel layout of
  1212. the output will be the default value corresponding to the total number of
  1213. channels.
  1214. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1215. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1216. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1217. first input, b1 is the first channel of the second input).
  1218. On the other hand, if both input are in stereo, the output channels will be
  1219. in the default order: a1, a2, b1, b2, and the channel layout will be
  1220. arbitrarily set to 4.0, which may or may not be the expected value.
  1221. All inputs must have the same sample rate, and format.
  1222. If inputs do not have the same duration, the output will stop with the
  1223. shortest.
  1224. @subsection Examples
  1225. @itemize
  1226. @item
  1227. Merge two mono files into a stereo stream:
  1228. @example
  1229. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1230. @end example
  1231. @item
  1232. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1233. @example
  1234. 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
  1235. @end example
  1236. @end itemize
  1237. @section amix
  1238. Mixes multiple audio inputs into a single output.
  1239. Note that this filter only supports float samples (the @var{amerge}
  1240. and @var{pan} audio filters support many formats). If the @var{amix}
  1241. input has integer samples then @ref{aresample} will be automatically
  1242. inserted to perform the conversion to float samples.
  1243. For example
  1244. @example
  1245. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1246. @end example
  1247. will mix 3 input audio streams to a single output with the same duration as the
  1248. first input and a dropout transition time of 3 seconds.
  1249. It accepts the following parameters:
  1250. @table @option
  1251. @item inputs
  1252. The number of inputs. If unspecified, it defaults to 2.
  1253. @item duration
  1254. How to determine the end-of-stream.
  1255. @table @option
  1256. @item longest
  1257. The duration of the longest input. (default)
  1258. @item shortest
  1259. The duration of the shortest input.
  1260. @item first
  1261. The duration of the first input.
  1262. @end table
  1263. @item dropout_transition
  1264. The transition time, in seconds, for volume renormalization when an input
  1265. stream ends. The default value is 2 seconds.
  1266. @item weights
  1267. Specify weight of each input audio stream as sequence.
  1268. Each weight is separated by space. By default all inputs have same weight.
  1269. @end table
  1270. @section amultiply
  1271. Multiply first audio stream with second audio stream and store result
  1272. in output audio stream. Multiplication is done by multiplying each
  1273. sample from first stream with sample at same position from second stream.
  1274. With this element-wise multiplication one can create amplitude fades and
  1275. amplitude modulations.
  1276. @section anequalizer
  1277. High-order parametric multiband equalizer for each channel.
  1278. It accepts the following parameters:
  1279. @table @option
  1280. @item params
  1281. This option string is in format:
  1282. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1283. Each equalizer band is separated by '|'.
  1284. @table @option
  1285. @item chn
  1286. Set channel number to which equalization will be applied.
  1287. If input doesn't have that channel the entry is ignored.
  1288. @item f
  1289. Set central frequency for band.
  1290. If input doesn't have that frequency the entry is ignored.
  1291. @item w
  1292. Set band width in hertz.
  1293. @item g
  1294. Set band gain in dB.
  1295. @item t
  1296. Set filter type for band, optional, can be:
  1297. @table @samp
  1298. @item 0
  1299. Butterworth, this is default.
  1300. @item 1
  1301. Chebyshev type 1.
  1302. @item 2
  1303. Chebyshev type 2.
  1304. @end table
  1305. @end table
  1306. @item curves
  1307. With this option activated frequency response of anequalizer is displayed
  1308. in video stream.
  1309. @item size
  1310. Set video stream size. Only useful if curves option is activated.
  1311. @item mgain
  1312. Set max gain that will be displayed. Only useful if curves option is activated.
  1313. Setting this to a reasonable value makes it possible to display gain which is derived from
  1314. neighbour bands which are too close to each other and thus produce higher gain
  1315. when both are activated.
  1316. @item fscale
  1317. Set frequency scale used to draw frequency response in video output.
  1318. Can be linear or logarithmic. Default is logarithmic.
  1319. @item colors
  1320. Set color for each channel curve which is going to be displayed in video stream.
  1321. This is list of color names separated by space or by '|'.
  1322. Unrecognised or missing colors will be replaced by white color.
  1323. @end table
  1324. @subsection Examples
  1325. @itemize
  1326. @item
  1327. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1328. for first 2 channels using Chebyshev type 1 filter:
  1329. @example
  1330. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1331. @end example
  1332. @end itemize
  1333. @subsection Commands
  1334. This filter supports the following commands:
  1335. @table @option
  1336. @item change
  1337. Alter existing filter parameters.
  1338. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1339. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1340. error is returned.
  1341. @var{freq} set new frequency parameter.
  1342. @var{width} set new width parameter in herz.
  1343. @var{gain} set new gain parameter in dB.
  1344. Full filter invocation with asendcmd may look like this:
  1345. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1346. @end table
  1347. @section anlmdn
  1348. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1349. Each sample is adjusted by looking for other samples with similar contexts. This
  1350. context similarity is defined by comparing their surrounding patches of size
  1351. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1352. The filter accepts the following options.
  1353. @table @option
  1354. @item s
  1355. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1356. @item p
  1357. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1358. Default value is 2 milliseconds.
  1359. @item r
  1360. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1361. Default value is 6 milliseconds.
  1362. @item o
  1363. Set the output mode.
  1364. It accepts the following values:
  1365. @table @option
  1366. @item i
  1367. Pass input unchanged.
  1368. @item o
  1369. Pass noise filtered out.
  1370. @item n
  1371. Pass only noise.
  1372. Default value is @var{o}.
  1373. @end table
  1374. @end table
  1375. @section anull
  1376. Pass the audio source unchanged to the output.
  1377. @section apad
  1378. Pad the end of an audio stream with silence.
  1379. This can be used together with @command{ffmpeg} @option{-shortest} to
  1380. extend audio streams to the same length as the video stream.
  1381. A description of the accepted options follows.
  1382. @table @option
  1383. @item packet_size
  1384. Set silence packet size. Default value is 4096.
  1385. @item pad_len
  1386. Set the number of samples of silence to add to the end. After the
  1387. value is reached, the stream is terminated. This option is mutually
  1388. exclusive with @option{whole_len}.
  1389. @item whole_len
  1390. Set the minimum total number of samples in the output audio stream. If
  1391. the value is longer than the input audio length, silence is added to
  1392. the end, until the value is reached. This option is mutually exclusive
  1393. with @option{pad_len}.
  1394. @item pad_dur
  1395. Specify the duration of samples of silence to add. See
  1396. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1397. for the accepted syntax. Used only if set to non-zero value.
  1398. @item whole_dur
  1399. Specify the minimum total duration in the output audio stream. See
  1400. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1401. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1402. the input audio length, silence is added to the end, until the value is reached.
  1403. This option is mutually exclusive with @option{pad_dur}
  1404. @end table
  1405. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1406. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1407. the input stream indefinitely.
  1408. @subsection Examples
  1409. @itemize
  1410. @item
  1411. Add 1024 samples of silence to the end of the input:
  1412. @example
  1413. apad=pad_len=1024
  1414. @end example
  1415. @item
  1416. Make sure the audio output will contain at least 10000 samples, pad
  1417. the input with silence if required:
  1418. @example
  1419. apad=whole_len=10000
  1420. @end example
  1421. @item
  1422. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1423. video stream will always result the shortest and will be converted
  1424. until the end in the output file when using the @option{shortest}
  1425. option:
  1426. @example
  1427. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1428. @end example
  1429. @end itemize
  1430. @section aphaser
  1431. Add a phasing effect to the input audio.
  1432. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1433. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1434. A description of the accepted parameters follows.
  1435. @table @option
  1436. @item in_gain
  1437. Set input gain. Default is 0.4.
  1438. @item out_gain
  1439. Set output gain. Default is 0.74
  1440. @item delay
  1441. Set delay in milliseconds. Default is 3.0.
  1442. @item decay
  1443. Set decay. Default is 0.4.
  1444. @item speed
  1445. Set modulation speed in Hz. Default is 0.5.
  1446. @item type
  1447. Set modulation type. Default is triangular.
  1448. It accepts the following values:
  1449. @table @samp
  1450. @item triangular, t
  1451. @item sinusoidal, s
  1452. @end table
  1453. @end table
  1454. @section apulsator
  1455. Audio pulsator is something between an autopanner and a tremolo.
  1456. But it can produce funny stereo effects as well. Pulsator changes the volume
  1457. of the left and right channel based on a LFO (low frequency oscillator) with
  1458. different waveforms and shifted phases.
  1459. This filter have the ability to define an offset between left and right
  1460. channel. An offset of 0 means that both LFO shapes match each other.
  1461. The left and right channel are altered equally - a conventional tremolo.
  1462. An offset of 50% means that the shape of the right channel is exactly shifted
  1463. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1464. an autopanner. At 1 both curves match again. Every setting in between moves the
  1465. phase shift gapless between all stages and produces some "bypassing" sounds with
  1466. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1467. the 0.5) the faster the signal passes from the left to the right speaker.
  1468. The filter accepts the following options:
  1469. @table @option
  1470. @item level_in
  1471. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1472. @item level_out
  1473. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1474. @item mode
  1475. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1476. sawup or sawdown. Default is sine.
  1477. @item amount
  1478. Set modulation. Define how much of original signal is affected by the LFO.
  1479. @item offset_l
  1480. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1481. @item offset_r
  1482. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1483. @item width
  1484. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1485. @item timing
  1486. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1487. @item bpm
  1488. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1489. is set to bpm.
  1490. @item ms
  1491. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1492. is set to ms.
  1493. @item hz
  1494. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1495. if timing is set to hz.
  1496. @end table
  1497. @anchor{aresample}
  1498. @section aresample
  1499. Resample the input audio to the specified parameters, using the
  1500. libswresample library. If none are specified then the filter will
  1501. automatically convert between its input and output.
  1502. This filter is also able to stretch/squeeze the audio data to make it match
  1503. the timestamps or to inject silence / cut out audio to make it match the
  1504. timestamps, do a combination of both or do neither.
  1505. The filter accepts the syntax
  1506. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1507. expresses a sample rate and @var{resampler_options} is a list of
  1508. @var{key}=@var{value} pairs, separated by ":". See the
  1509. @ref{Resampler Options,,"Resampler Options" section in the
  1510. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1511. for the complete list of supported options.
  1512. @subsection Examples
  1513. @itemize
  1514. @item
  1515. Resample the input audio to 44100Hz:
  1516. @example
  1517. aresample=44100
  1518. @end example
  1519. @item
  1520. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1521. samples per second compensation:
  1522. @example
  1523. aresample=async=1000
  1524. @end example
  1525. @end itemize
  1526. @section areverse
  1527. Reverse an audio clip.
  1528. Warning: This filter requires memory to buffer the entire clip, so trimming
  1529. is suggested.
  1530. @subsection Examples
  1531. @itemize
  1532. @item
  1533. Take the first 5 seconds of a clip, and reverse it.
  1534. @example
  1535. atrim=end=5,areverse
  1536. @end example
  1537. @end itemize
  1538. @section asetnsamples
  1539. Set the number of samples per each output audio frame.
  1540. The last output packet may contain a different number of samples, as
  1541. the filter will flush all the remaining samples when the input audio
  1542. signals its end.
  1543. The filter accepts the following options:
  1544. @table @option
  1545. @item nb_out_samples, n
  1546. Set the number of frames per each output audio frame. The number is
  1547. intended as the number of samples @emph{per each channel}.
  1548. Default value is 1024.
  1549. @item pad, p
  1550. If set to 1, the filter will pad the last audio frame with zeroes, so
  1551. that the last frame will contain the same number of samples as the
  1552. previous ones. Default value is 1.
  1553. @end table
  1554. For example, to set the number of per-frame samples to 1234 and
  1555. disable padding for the last frame, use:
  1556. @example
  1557. asetnsamples=n=1234:p=0
  1558. @end example
  1559. @section asetrate
  1560. Set the sample rate without altering the PCM data.
  1561. This will result in a change of speed and pitch.
  1562. The filter accepts the following options:
  1563. @table @option
  1564. @item sample_rate, r
  1565. Set the output sample rate. Default is 44100 Hz.
  1566. @end table
  1567. @section ashowinfo
  1568. Show a line containing various information for each input audio frame.
  1569. The input audio is not modified.
  1570. The shown line contains a sequence of key/value pairs of the form
  1571. @var{key}:@var{value}.
  1572. The following values are shown in the output:
  1573. @table @option
  1574. @item n
  1575. The (sequential) number of the input frame, starting from 0.
  1576. @item pts
  1577. The presentation timestamp of the input frame, in time base units; the time base
  1578. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1579. @item pts_time
  1580. The presentation timestamp of the input frame in seconds.
  1581. @item pos
  1582. position of the frame in the input stream, -1 if this information in
  1583. unavailable and/or meaningless (for example in case of synthetic audio)
  1584. @item fmt
  1585. The sample format.
  1586. @item chlayout
  1587. The channel layout.
  1588. @item rate
  1589. The sample rate for the audio frame.
  1590. @item nb_samples
  1591. The number of samples (per channel) in the frame.
  1592. @item checksum
  1593. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1594. audio, the data is treated as if all the planes were concatenated.
  1595. @item plane_checksums
  1596. A list of Adler-32 checksums for each data plane.
  1597. @end table
  1598. @anchor{astats}
  1599. @section astats
  1600. Display time domain statistical information about the audio channels.
  1601. Statistics are calculated and displayed for each audio channel and,
  1602. where applicable, an overall figure is also given.
  1603. It accepts the following option:
  1604. @table @option
  1605. @item length
  1606. Short window length in seconds, used for peak and trough RMS measurement.
  1607. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1608. @item metadata
  1609. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1610. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1611. disabled.
  1612. Available keys for each channel are:
  1613. DC_offset
  1614. Min_level
  1615. Max_level
  1616. Min_difference
  1617. Max_difference
  1618. Mean_difference
  1619. RMS_difference
  1620. Peak_level
  1621. RMS_peak
  1622. RMS_trough
  1623. Crest_factor
  1624. Flat_factor
  1625. Peak_count
  1626. Bit_depth
  1627. Dynamic_range
  1628. Zero_crossings
  1629. Zero_crossings_rate
  1630. and for Overall:
  1631. DC_offset
  1632. Min_level
  1633. Max_level
  1634. Min_difference
  1635. Max_difference
  1636. Mean_difference
  1637. RMS_difference
  1638. Peak_level
  1639. RMS_level
  1640. RMS_peak
  1641. RMS_trough
  1642. Flat_factor
  1643. Peak_count
  1644. Bit_depth
  1645. Number_of_samples
  1646. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1647. this @code{lavfi.astats.Overall.Peak_count}.
  1648. For description what each key means read below.
  1649. @item reset
  1650. Set number of frame after which stats are going to be recalculated.
  1651. Default is disabled.
  1652. @item measure_perchannel
  1653. Select the entries which need to be measured per channel. The metadata keys can
  1654. be used as flags, default is @option{all} which measures everything.
  1655. @option{none} disables all per channel measurement.
  1656. @item measure_overall
  1657. Select the entries which need to be measured overall. The metadata keys can
  1658. be used as flags, default is @option{all} which measures everything.
  1659. @option{none} disables all overall measurement.
  1660. @end table
  1661. A description of each shown parameter follows:
  1662. @table @option
  1663. @item DC offset
  1664. Mean amplitude displacement from zero.
  1665. @item Min level
  1666. Minimal sample level.
  1667. @item Max level
  1668. Maximal sample level.
  1669. @item Min difference
  1670. Minimal difference between two consecutive samples.
  1671. @item Max difference
  1672. Maximal difference between two consecutive samples.
  1673. @item Mean difference
  1674. Mean difference between two consecutive samples.
  1675. The average of each difference between two consecutive samples.
  1676. @item RMS difference
  1677. Root Mean Square difference between two consecutive samples.
  1678. @item Peak level dB
  1679. @item RMS level dB
  1680. Standard peak and RMS level measured in dBFS.
  1681. @item RMS peak dB
  1682. @item RMS trough dB
  1683. Peak and trough values for RMS level measured over a short window.
  1684. @item Crest factor
  1685. Standard ratio of peak to RMS level (note: not in dB).
  1686. @item Flat factor
  1687. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1688. (i.e. either @var{Min level} or @var{Max level}).
  1689. @item Peak count
  1690. Number of occasions (not the number of samples) that the signal attained either
  1691. @var{Min level} or @var{Max level}.
  1692. @item Bit depth
  1693. Overall bit depth of audio. Number of bits used for each sample.
  1694. @item Dynamic range
  1695. Measured dynamic range of audio in dB.
  1696. @item Zero crossings
  1697. Number of points where the waveform crosses the zero level axis.
  1698. @item Zero crossings rate
  1699. Rate of Zero crossings and number of audio samples.
  1700. @end table
  1701. @section atempo
  1702. Adjust audio tempo.
  1703. The filter accepts exactly one parameter, the audio tempo. If not
  1704. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1705. be in the [0.5, 100.0] range.
  1706. Note that tempo greater than 2 will skip some samples rather than
  1707. blend them in. If for any reason this is a concern it is always
  1708. possible to daisy-chain several instances of atempo to achieve the
  1709. desired product tempo.
  1710. @subsection Examples
  1711. @itemize
  1712. @item
  1713. Slow down audio to 80% tempo:
  1714. @example
  1715. atempo=0.8
  1716. @end example
  1717. @item
  1718. To speed up audio to 300% tempo:
  1719. @example
  1720. atempo=3
  1721. @end example
  1722. @item
  1723. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1724. @example
  1725. atempo=sqrt(3),atempo=sqrt(3)
  1726. @end example
  1727. @end itemize
  1728. @section atrim
  1729. Trim the input so that the output contains one continuous subpart of the input.
  1730. It accepts the following parameters:
  1731. @table @option
  1732. @item start
  1733. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1734. sample with the timestamp @var{start} will be the first sample in the output.
  1735. @item end
  1736. Specify time of the first audio sample that will be dropped, i.e. the
  1737. audio sample immediately preceding the one with the timestamp @var{end} will be
  1738. the last sample in the output.
  1739. @item start_pts
  1740. Same as @var{start}, except this option sets the start timestamp in samples
  1741. instead of seconds.
  1742. @item end_pts
  1743. Same as @var{end}, except this option sets the end timestamp in samples instead
  1744. of seconds.
  1745. @item duration
  1746. The maximum duration of the output in seconds.
  1747. @item start_sample
  1748. The number of the first sample that should be output.
  1749. @item end_sample
  1750. The number of the first sample that should be dropped.
  1751. @end table
  1752. @option{start}, @option{end}, and @option{duration} are expressed as time
  1753. duration specifications; see
  1754. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1755. Note that the first two sets of the start/end options and the @option{duration}
  1756. option look at the frame timestamp, while the _sample options simply count the
  1757. samples that pass through the filter. So start/end_pts and start/end_sample will
  1758. give different results when the timestamps are wrong, inexact or do not start at
  1759. zero. Also note that this filter does not modify the timestamps. If you wish
  1760. to have the output timestamps start at zero, insert the asetpts filter after the
  1761. atrim filter.
  1762. If multiple start or end options are set, this filter tries to be greedy and
  1763. keep all samples that match at least one of the specified constraints. To keep
  1764. only the part that matches all the constraints at once, chain multiple atrim
  1765. filters.
  1766. The defaults are such that all the input is kept. So it is possible to set e.g.
  1767. just the end values to keep everything before the specified time.
  1768. Examples:
  1769. @itemize
  1770. @item
  1771. Drop everything except the second minute of input:
  1772. @example
  1773. ffmpeg -i INPUT -af atrim=60:120
  1774. @end example
  1775. @item
  1776. Keep only the first 1000 samples:
  1777. @example
  1778. ffmpeg -i INPUT -af atrim=end_sample=1000
  1779. @end example
  1780. @end itemize
  1781. @section bandpass
  1782. Apply a two-pole Butterworth band-pass filter with central
  1783. frequency @var{frequency}, and (3dB-point) band-width width.
  1784. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1785. instead of the default: constant 0dB peak gain.
  1786. The filter roll off at 6dB per octave (20dB per decade).
  1787. The filter accepts the following options:
  1788. @table @option
  1789. @item frequency, f
  1790. Set the filter's central frequency. Default is @code{3000}.
  1791. @item csg
  1792. Constant skirt gain if set to 1. Defaults to 0.
  1793. @item width_type, t
  1794. Set method to specify band-width of filter.
  1795. @table @option
  1796. @item h
  1797. Hz
  1798. @item q
  1799. Q-Factor
  1800. @item o
  1801. octave
  1802. @item s
  1803. slope
  1804. @item k
  1805. kHz
  1806. @end table
  1807. @item width, w
  1808. Specify the band-width of a filter in width_type units.
  1809. @item channels, c
  1810. Specify which channels to filter, by default all available are filtered.
  1811. @end table
  1812. @subsection Commands
  1813. This filter supports the following commands:
  1814. @table @option
  1815. @item frequency, f
  1816. Change bandpass frequency.
  1817. Syntax for the command is : "@var{frequency}"
  1818. @item width_type, t
  1819. Change bandpass width_type.
  1820. Syntax for the command is : "@var{width_type}"
  1821. @item width, w
  1822. Change bandpass width.
  1823. Syntax for the command is : "@var{width}"
  1824. @end table
  1825. @section bandreject
  1826. Apply a two-pole Butterworth band-reject filter with central
  1827. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1828. The filter roll off at 6dB per octave (20dB per decade).
  1829. The filter accepts the following options:
  1830. @table @option
  1831. @item frequency, f
  1832. Set the filter's central frequency. Default is @code{3000}.
  1833. @item width_type, t
  1834. Set method to specify band-width of filter.
  1835. @table @option
  1836. @item h
  1837. Hz
  1838. @item q
  1839. Q-Factor
  1840. @item o
  1841. octave
  1842. @item s
  1843. slope
  1844. @item k
  1845. kHz
  1846. @end table
  1847. @item width, w
  1848. Specify the band-width of a filter in width_type units.
  1849. @item channels, c
  1850. Specify which channels to filter, by default all available are filtered.
  1851. @end table
  1852. @subsection Commands
  1853. This filter supports the following commands:
  1854. @table @option
  1855. @item frequency, f
  1856. Change bandreject frequency.
  1857. Syntax for the command is : "@var{frequency}"
  1858. @item width_type, t
  1859. Change bandreject width_type.
  1860. Syntax for the command is : "@var{width_type}"
  1861. @item width, w
  1862. Change bandreject width.
  1863. Syntax for the command is : "@var{width}"
  1864. @end table
  1865. @section bass, lowshelf
  1866. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1867. shelving filter with a response similar to that of a standard
  1868. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1869. The filter accepts the following options:
  1870. @table @option
  1871. @item gain, g
  1872. Give the gain at 0 Hz. Its useful range is about -20
  1873. (for a large cut) to +20 (for a large boost).
  1874. Beware of clipping when using a positive gain.
  1875. @item frequency, f
  1876. Set the filter's central frequency and so can be used
  1877. to extend or reduce the frequency range to be boosted or cut.
  1878. The default value is @code{100} Hz.
  1879. @item width_type, t
  1880. Set method to specify band-width of filter.
  1881. @table @option
  1882. @item h
  1883. Hz
  1884. @item q
  1885. Q-Factor
  1886. @item o
  1887. octave
  1888. @item s
  1889. slope
  1890. @item k
  1891. kHz
  1892. @end table
  1893. @item width, w
  1894. Determine how steep is the filter's shelf transition.
  1895. @item channels, c
  1896. Specify which channels to filter, by default all available are filtered.
  1897. @end table
  1898. @subsection Commands
  1899. This filter supports the following commands:
  1900. @table @option
  1901. @item frequency, f
  1902. Change bass frequency.
  1903. Syntax for the command is : "@var{frequency}"
  1904. @item width_type, t
  1905. Change bass width_type.
  1906. Syntax for the command is : "@var{width_type}"
  1907. @item width, w
  1908. Change bass width.
  1909. Syntax for the command is : "@var{width}"
  1910. @item gain, g
  1911. Change bass gain.
  1912. Syntax for the command is : "@var{gain}"
  1913. @end table
  1914. @section biquad
  1915. Apply a biquad IIR filter with the given coefficients.
  1916. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1917. are the numerator and denominator coefficients respectively.
  1918. and @var{channels}, @var{c} specify which channels to filter, by default all
  1919. available are filtered.
  1920. @subsection Commands
  1921. This filter supports the following commands:
  1922. @table @option
  1923. @item a0
  1924. @item a1
  1925. @item a2
  1926. @item b0
  1927. @item b1
  1928. @item b2
  1929. Change biquad parameter.
  1930. Syntax for the command is : "@var{value}"
  1931. @end table
  1932. @section bs2b
  1933. Bauer stereo to binaural transformation, which improves headphone listening of
  1934. stereo audio records.
  1935. To enable compilation of this filter you need to configure FFmpeg with
  1936. @code{--enable-libbs2b}.
  1937. It accepts the following parameters:
  1938. @table @option
  1939. @item profile
  1940. Pre-defined crossfeed level.
  1941. @table @option
  1942. @item default
  1943. Default level (fcut=700, feed=50).
  1944. @item cmoy
  1945. Chu Moy circuit (fcut=700, feed=60).
  1946. @item jmeier
  1947. Jan Meier circuit (fcut=650, feed=95).
  1948. @end table
  1949. @item fcut
  1950. Cut frequency (in Hz).
  1951. @item feed
  1952. Feed level (in Hz).
  1953. @end table
  1954. @section channelmap
  1955. Remap input channels to new locations.
  1956. It accepts the following parameters:
  1957. @table @option
  1958. @item map
  1959. Map channels from input to output. The argument is a '|'-separated list of
  1960. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1961. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1962. channel (e.g. FL for front left) or its index in the input channel layout.
  1963. @var{out_channel} is the name of the output channel or its index in the output
  1964. channel layout. If @var{out_channel} is not given then it is implicitly an
  1965. index, starting with zero and increasing by one for each mapping.
  1966. @item channel_layout
  1967. The channel layout of the output stream.
  1968. @end table
  1969. If no mapping is present, the filter will implicitly map input channels to
  1970. output channels, preserving indices.
  1971. @subsection Examples
  1972. @itemize
  1973. @item
  1974. For example, assuming a 5.1+downmix input MOV file,
  1975. @example
  1976. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1977. @end example
  1978. will create an output WAV file tagged as stereo from the downmix channels of
  1979. the input.
  1980. @item
  1981. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1982. @example
  1983. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1984. @end example
  1985. @end itemize
  1986. @section channelsplit
  1987. Split each channel from an input audio stream into a separate output stream.
  1988. It accepts the following parameters:
  1989. @table @option
  1990. @item channel_layout
  1991. The channel layout of the input stream. The default is "stereo".
  1992. @item channels
  1993. A channel layout describing the channels to be extracted as separate output streams
  1994. or "all" to extract each input channel as a separate stream. The default is "all".
  1995. Choosing channels not present in channel layout in the input will result in an error.
  1996. @end table
  1997. @subsection Examples
  1998. @itemize
  1999. @item
  2000. For example, assuming a stereo input MP3 file,
  2001. @example
  2002. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2003. @end example
  2004. will create an output Matroska file with two audio streams, one containing only
  2005. the left channel and the other the right channel.
  2006. @item
  2007. Split a 5.1 WAV file into per-channel files:
  2008. @example
  2009. ffmpeg -i in.wav -filter_complex
  2010. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2011. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2012. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2013. side_right.wav
  2014. @end example
  2015. @item
  2016. Extract only LFE from a 5.1 WAV file:
  2017. @example
  2018. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2019. -map '[LFE]' lfe.wav
  2020. @end example
  2021. @end itemize
  2022. @section chorus
  2023. Add a chorus effect to the audio.
  2024. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2025. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2026. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2027. The modulation depth defines the range the modulated delay is played before or after
  2028. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2029. sound tuned around the original one, like in a chorus where some vocals are slightly
  2030. off key.
  2031. It accepts the following parameters:
  2032. @table @option
  2033. @item in_gain
  2034. Set input gain. Default is 0.4.
  2035. @item out_gain
  2036. Set output gain. Default is 0.4.
  2037. @item delays
  2038. Set delays. A typical delay is around 40ms to 60ms.
  2039. @item decays
  2040. Set decays.
  2041. @item speeds
  2042. Set speeds.
  2043. @item depths
  2044. Set depths.
  2045. @end table
  2046. @subsection Examples
  2047. @itemize
  2048. @item
  2049. A single delay:
  2050. @example
  2051. chorus=0.7:0.9:55:0.4:0.25:2
  2052. @end example
  2053. @item
  2054. Two delays:
  2055. @example
  2056. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2057. @end example
  2058. @item
  2059. Fuller sounding chorus with three delays:
  2060. @example
  2061. 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
  2062. @end example
  2063. @end itemize
  2064. @section compand
  2065. Compress or expand the audio's dynamic range.
  2066. It accepts the following parameters:
  2067. @table @option
  2068. @item attacks
  2069. @item decays
  2070. A list of times in seconds for each channel over which the instantaneous level
  2071. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2072. increase of volume and @var{decays} refers to decrease of volume. For most
  2073. situations, the attack time (response to the audio getting louder) should be
  2074. shorter than the decay time, because the human ear is more sensitive to sudden
  2075. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2076. a typical value for decay is 0.8 seconds.
  2077. If specified number of attacks & decays is lower than number of channels, the last
  2078. set attack/decay will be used for all remaining channels.
  2079. @item points
  2080. A list of points for the transfer function, specified in dB relative to the
  2081. maximum possible signal amplitude. Each key points list must be defined using
  2082. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2083. @code{x0/y0 x1/y1 x2/y2 ....}
  2084. The input values must be in strictly increasing order but the transfer function
  2085. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2086. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2087. function are @code{-70/-70|-60/-20|1/0}.
  2088. @item soft-knee
  2089. Set the curve radius in dB for all joints. It defaults to 0.01.
  2090. @item gain
  2091. Set the additional gain in dB to be applied at all points on the transfer
  2092. function. This allows for easy adjustment of the overall gain.
  2093. It defaults to 0.
  2094. @item volume
  2095. Set an initial volume, in dB, to be assumed for each channel when filtering
  2096. starts. This permits the user to supply a nominal level initially, so that, for
  2097. example, a very large gain is not applied to initial signal levels before the
  2098. companding has begun to operate. A typical value for audio which is initially
  2099. quiet is -90 dB. It defaults to 0.
  2100. @item delay
  2101. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2102. delayed before being fed to the volume adjuster. Specifying a delay
  2103. approximately equal to the attack/decay times allows the filter to effectively
  2104. operate in predictive rather than reactive mode. It defaults to 0.
  2105. @end table
  2106. @subsection Examples
  2107. @itemize
  2108. @item
  2109. Make music with both quiet and loud passages suitable for listening to in a
  2110. noisy environment:
  2111. @example
  2112. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2113. @end example
  2114. Another example for audio with whisper and explosion parts:
  2115. @example
  2116. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2117. @end example
  2118. @item
  2119. A noise gate for when the noise is at a lower level than the signal:
  2120. @example
  2121. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2122. @end example
  2123. @item
  2124. Here is another noise gate, this time for when the noise is at a higher level
  2125. than the signal (making it, in some ways, similar to squelch):
  2126. @example
  2127. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2128. @end example
  2129. @item
  2130. 2:1 compression starting at -6dB:
  2131. @example
  2132. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2133. @end example
  2134. @item
  2135. 2:1 compression starting at -9dB:
  2136. @example
  2137. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2138. @end example
  2139. @item
  2140. 2:1 compression starting at -12dB:
  2141. @example
  2142. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2143. @end example
  2144. @item
  2145. 2:1 compression starting at -18dB:
  2146. @example
  2147. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2148. @end example
  2149. @item
  2150. 3:1 compression starting at -15dB:
  2151. @example
  2152. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2153. @end example
  2154. @item
  2155. Compressor/Gate:
  2156. @example
  2157. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2158. @end example
  2159. @item
  2160. Expander:
  2161. @example
  2162. 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
  2163. @end example
  2164. @item
  2165. Hard limiter at -6dB:
  2166. @example
  2167. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2168. @end example
  2169. @item
  2170. Hard limiter at -12dB:
  2171. @example
  2172. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2173. @end example
  2174. @item
  2175. Hard noise gate at -35 dB:
  2176. @example
  2177. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2178. @end example
  2179. @item
  2180. Soft limiter:
  2181. @example
  2182. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2183. @end example
  2184. @end itemize
  2185. @section compensationdelay
  2186. Compensation Delay Line is a metric based delay to compensate differing
  2187. positions of microphones or speakers.
  2188. For example, you have recorded guitar with two microphones placed in
  2189. different location. Because the front of sound wave has fixed speed in
  2190. normal conditions, the phasing of microphones can vary and depends on
  2191. their location and interposition. The best sound mix can be achieved when
  2192. these microphones are in phase (synchronized). Note that distance of
  2193. ~30 cm between microphones makes one microphone to capture signal in
  2194. antiphase to another microphone. That makes the final mix sounding moody.
  2195. This filter helps to solve phasing problems by adding different delays
  2196. to each microphone track and make them synchronized.
  2197. The best result can be reached when you take one track as base and
  2198. synchronize other tracks one by one with it.
  2199. Remember that synchronization/delay tolerance depends on sample rate, too.
  2200. Higher sample rates will give more tolerance.
  2201. It accepts the following parameters:
  2202. @table @option
  2203. @item mm
  2204. Set millimeters distance. This is compensation distance for fine tuning.
  2205. Default is 0.
  2206. @item cm
  2207. Set cm distance. This is compensation distance for tightening distance setup.
  2208. Default is 0.
  2209. @item m
  2210. Set meters distance. This is compensation distance for hard distance setup.
  2211. Default is 0.
  2212. @item dry
  2213. Set dry amount. Amount of unprocessed (dry) signal.
  2214. Default is 0.
  2215. @item wet
  2216. Set wet amount. Amount of processed (wet) signal.
  2217. Default is 1.
  2218. @item temp
  2219. Set temperature degree in Celsius. This is the temperature of the environment.
  2220. Default is 20.
  2221. @end table
  2222. @section crossfeed
  2223. Apply headphone crossfeed filter.
  2224. Crossfeed is the process of blending the left and right channels of stereo
  2225. audio recording.
  2226. It is mainly used to reduce extreme stereo separation of low frequencies.
  2227. The intent is to produce more speaker like sound to the listener.
  2228. The filter accepts the following options:
  2229. @table @option
  2230. @item strength
  2231. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2232. This sets gain of low shelf filter for side part of stereo image.
  2233. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2234. @item range
  2235. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2236. This sets cut off frequency of low shelf filter. Default is cut off near
  2237. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2238. @item level_in
  2239. Set input gain. Default is 0.9.
  2240. @item level_out
  2241. Set output gain. Default is 1.
  2242. @end table
  2243. @section crystalizer
  2244. Simple algorithm to expand audio dynamic range.
  2245. The filter accepts the following options:
  2246. @table @option
  2247. @item i
  2248. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2249. (unchanged sound) to 10.0 (maximum effect).
  2250. @item c
  2251. Enable clipping. By default is enabled.
  2252. @end table
  2253. @section dcshift
  2254. Apply a DC shift to the audio.
  2255. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2256. in the recording chain) from the audio. The effect of a DC offset is reduced
  2257. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2258. a signal has a DC offset.
  2259. @table @option
  2260. @item shift
  2261. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2262. the audio.
  2263. @item limitergain
  2264. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2265. used to prevent clipping.
  2266. @end table
  2267. @section drmeter
  2268. Measure audio dynamic range.
  2269. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2270. is found in transition material. And anything less that 8 have very poor dynamics
  2271. and is very compressed.
  2272. The filter accepts the following options:
  2273. @table @option
  2274. @item length
  2275. Set window length in seconds used to split audio into segments of equal length.
  2276. Default is 3 seconds.
  2277. @end table
  2278. @section dynaudnorm
  2279. Dynamic Audio Normalizer.
  2280. This filter applies a certain amount of gain to the input audio in order
  2281. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2282. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2283. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2284. This allows for applying extra gain to the "quiet" sections of the audio
  2285. while avoiding distortions or clipping the "loud" sections. In other words:
  2286. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2287. sections, in the sense that the volume of each section is brought to the
  2288. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2289. this goal *without* applying "dynamic range compressing". It will retain 100%
  2290. of the dynamic range *within* each section of the audio file.
  2291. @table @option
  2292. @item f
  2293. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2294. Default is 500 milliseconds.
  2295. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2296. referred to as frames. This is required, because a peak magnitude has no
  2297. meaning for just a single sample value. Instead, we need to determine the
  2298. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2299. normalizer would simply use the peak magnitude of the complete file, the
  2300. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2301. frame. The length of a frame is specified in milliseconds. By default, the
  2302. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2303. been found to give good results with most files.
  2304. Note that the exact frame length, in number of samples, will be determined
  2305. automatically, based on the sampling rate of the individual input audio file.
  2306. @item g
  2307. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2308. number. Default is 31.
  2309. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2310. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2311. is specified in frames, centered around the current frame. For the sake of
  2312. simplicity, this must be an odd number. Consequently, the default value of 31
  2313. takes into account the current frame, as well as the 15 preceding frames and
  2314. the 15 subsequent frames. Using a larger window results in a stronger
  2315. smoothing effect and thus in less gain variation, i.e. slower gain
  2316. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2317. effect and thus in more gain variation, i.e. faster gain adaptation.
  2318. In other words, the more you increase this value, the more the Dynamic Audio
  2319. Normalizer will behave like a "traditional" normalization filter. On the
  2320. contrary, the more you decrease this value, the more the Dynamic Audio
  2321. Normalizer will behave like a dynamic range compressor.
  2322. @item p
  2323. Set the target peak value. This specifies the highest permissible magnitude
  2324. level for the normalized audio input. This filter will try to approach the
  2325. target peak magnitude as closely as possible, but at the same time it also
  2326. makes sure that the normalized signal will never exceed the peak magnitude.
  2327. A frame's maximum local gain factor is imposed directly by the target peak
  2328. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2329. It is not recommended to go above this value.
  2330. @item m
  2331. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2332. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2333. factor for each input frame, i.e. the maximum gain factor that does not
  2334. result in clipping or distortion. The maximum gain factor is determined by
  2335. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2336. additionally bounds the frame's maximum gain factor by a predetermined
  2337. (global) maximum gain factor. This is done in order to avoid excessive gain
  2338. factors in "silent" or almost silent frames. By default, the maximum gain
  2339. factor is 10.0, For most inputs the default value should be sufficient and
  2340. it usually is not recommended to increase this value. Though, for input
  2341. with an extremely low overall volume level, it may be necessary to allow even
  2342. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2343. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2344. Instead, a "sigmoid" threshold function will be applied. This way, the
  2345. gain factors will smoothly approach the threshold value, but never exceed that
  2346. value.
  2347. @item r
  2348. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2349. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2350. This means that the maximum local gain factor for each frame is defined
  2351. (only) by the frame's highest magnitude sample. This way, the samples can
  2352. be amplified as much as possible without exceeding the maximum signal
  2353. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2354. Normalizer can also take into account the frame's root mean square,
  2355. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2356. determine the power of a time-varying signal. It is therefore considered
  2357. that the RMS is a better approximation of the "perceived loudness" than
  2358. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2359. frames to a constant RMS value, a uniform "perceived loudness" can be
  2360. established. If a target RMS value has been specified, a frame's local gain
  2361. factor is defined as the factor that would result in exactly that RMS value.
  2362. Note, however, that the maximum local gain factor is still restricted by the
  2363. frame's highest magnitude sample, in order to prevent clipping.
  2364. @item n
  2365. Enable channels coupling. By default is enabled.
  2366. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2367. amount. This means the same gain factor will be applied to all channels, i.e.
  2368. the maximum possible gain factor is determined by the "loudest" channel.
  2369. However, in some recordings, it may happen that the volume of the different
  2370. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2371. In this case, this option can be used to disable the channel coupling. This way,
  2372. the gain factor will be determined independently for each channel, depending
  2373. only on the individual channel's highest magnitude sample. This allows for
  2374. harmonizing the volume of the different channels.
  2375. @item c
  2376. Enable DC bias correction. By default is disabled.
  2377. An audio signal (in the time domain) is a sequence of sample values.
  2378. In the Dynamic Audio Normalizer these sample values are represented in the
  2379. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2380. audio signal, or "waveform", should be centered around the zero point.
  2381. That means if we calculate the mean value of all samples in a file, or in a
  2382. single frame, then the result should be 0.0 or at least very close to that
  2383. value. If, however, there is a significant deviation of the mean value from
  2384. 0.0, in either positive or negative direction, this is referred to as a
  2385. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2386. Audio Normalizer provides optional DC bias correction.
  2387. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2388. the mean value, or "DC correction" offset, of each input frame and subtract
  2389. that value from all of the frame's sample values which ensures those samples
  2390. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2391. boundaries, the DC correction offset values will be interpolated smoothly
  2392. between neighbouring frames.
  2393. @item b
  2394. Enable alternative boundary mode. By default is disabled.
  2395. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2396. around each frame. This includes the preceding frames as well as the
  2397. subsequent frames. However, for the "boundary" frames, located at the very
  2398. beginning and at the very end of the audio file, not all neighbouring
  2399. frames are available. In particular, for the first few frames in the audio
  2400. file, the preceding frames are not known. And, similarly, for the last few
  2401. frames in the audio file, the subsequent frames are not known. Thus, the
  2402. question arises which gain factors should be assumed for the missing frames
  2403. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2404. to deal with this situation. The default boundary mode assumes a gain factor
  2405. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2406. "fade out" at the beginning and at the end of the input, respectively.
  2407. @item s
  2408. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2409. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2410. compression. This means that signal peaks will not be pruned and thus the
  2411. full dynamic range will be retained within each local neighbourhood. However,
  2412. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2413. normalization algorithm with a more "traditional" compression.
  2414. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2415. (thresholding) function. If (and only if) the compression feature is enabled,
  2416. all input frames will be processed by a soft knee thresholding function prior
  2417. to the actual normalization process. Put simply, the thresholding function is
  2418. going to prune all samples whose magnitude exceeds a certain threshold value.
  2419. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2420. value. Instead, the threshold value will be adjusted for each individual
  2421. frame.
  2422. In general, smaller parameters result in stronger compression, and vice versa.
  2423. Values below 3.0 are not recommended, because audible distortion may appear.
  2424. @end table
  2425. @section earwax
  2426. Make audio easier to listen to on headphones.
  2427. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2428. so that when listened to on headphones the stereo image is moved from
  2429. inside your head (standard for headphones) to outside and in front of
  2430. the listener (standard for speakers).
  2431. Ported from SoX.
  2432. @section equalizer
  2433. Apply a two-pole peaking equalisation (EQ) filter. With this
  2434. filter, the signal-level at and around a selected frequency can
  2435. be increased or decreased, whilst (unlike bandpass and bandreject
  2436. filters) that at all other frequencies is unchanged.
  2437. In order to produce complex equalisation curves, this filter can
  2438. be given several times, each with a different central frequency.
  2439. The filter accepts the following options:
  2440. @table @option
  2441. @item frequency, f
  2442. Set the filter's central frequency in Hz.
  2443. @item width_type, t
  2444. Set method to specify band-width of filter.
  2445. @table @option
  2446. @item h
  2447. Hz
  2448. @item q
  2449. Q-Factor
  2450. @item o
  2451. octave
  2452. @item s
  2453. slope
  2454. @item k
  2455. kHz
  2456. @end table
  2457. @item width, w
  2458. Specify the band-width of a filter in width_type units.
  2459. @item gain, g
  2460. Set the required gain or attenuation in dB.
  2461. Beware of clipping when using a positive gain.
  2462. @item channels, c
  2463. Specify which channels to filter, by default all available are filtered.
  2464. @end table
  2465. @subsection Examples
  2466. @itemize
  2467. @item
  2468. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2469. @example
  2470. equalizer=f=1000:t=h:width=200:g=-10
  2471. @end example
  2472. @item
  2473. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2474. @example
  2475. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2476. @end example
  2477. @end itemize
  2478. @subsection Commands
  2479. This filter supports the following commands:
  2480. @table @option
  2481. @item frequency, f
  2482. Change equalizer frequency.
  2483. Syntax for the command is : "@var{frequency}"
  2484. @item width_type, t
  2485. Change equalizer width_type.
  2486. Syntax for the command is : "@var{width_type}"
  2487. @item width, w
  2488. Change equalizer width.
  2489. Syntax for the command is : "@var{width}"
  2490. @item gain, g
  2491. Change equalizer gain.
  2492. Syntax for the command is : "@var{gain}"
  2493. @end table
  2494. @section extrastereo
  2495. Linearly increases the difference between left and right channels which
  2496. adds some sort of "live" effect to playback.
  2497. The filter accepts the following options:
  2498. @table @option
  2499. @item m
  2500. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2501. (average of both channels), with 1.0 sound will be unchanged, with
  2502. -1.0 left and right channels will be swapped.
  2503. @item c
  2504. Enable clipping. By default is enabled.
  2505. @end table
  2506. @section firequalizer
  2507. Apply FIR Equalization using arbitrary frequency response.
  2508. The filter accepts the following option:
  2509. @table @option
  2510. @item gain
  2511. Set gain curve equation (in dB). The expression can contain variables:
  2512. @table @option
  2513. @item f
  2514. the evaluated frequency
  2515. @item sr
  2516. sample rate
  2517. @item ch
  2518. channel number, set to 0 when multichannels evaluation is disabled
  2519. @item chid
  2520. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2521. multichannels evaluation is disabled
  2522. @item chs
  2523. number of channels
  2524. @item chlayout
  2525. channel_layout, see libavutil/channel_layout.h
  2526. @end table
  2527. and functions:
  2528. @table @option
  2529. @item gain_interpolate(f)
  2530. interpolate gain on frequency f based on gain_entry
  2531. @item cubic_interpolate(f)
  2532. same as gain_interpolate, but smoother
  2533. @end table
  2534. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2535. @item gain_entry
  2536. Set gain entry for gain_interpolate function. The expression can
  2537. contain functions:
  2538. @table @option
  2539. @item entry(f, g)
  2540. store gain entry at frequency f with value g
  2541. @end table
  2542. This option is also available as command.
  2543. @item delay
  2544. Set filter delay in seconds. Higher value means more accurate.
  2545. Default is @code{0.01}.
  2546. @item accuracy
  2547. Set filter accuracy in Hz. Lower value means more accurate.
  2548. Default is @code{5}.
  2549. @item wfunc
  2550. Set window function. Acceptable values are:
  2551. @table @option
  2552. @item rectangular
  2553. rectangular window, useful when gain curve is already smooth
  2554. @item hann
  2555. hann window (default)
  2556. @item hamming
  2557. hamming window
  2558. @item blackman
  2559. blackman window
  2560. @item nuttall3
  2561. 3-terms continuous 1st derivative nuttall window
  2562. @item mnuttall3
  2563. minimum 3-terms discontinuous nuttall window
  2564. @item nuttall
  2565. 4-terms continuous 1st derivative nuttall window
  2566. @item bnuttall
  2567. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2568. @item bharris
  2569. blackman-harris window
  2570. @item tukey
  2571. tukey window
  2572. @end table
  2573. @item fixed
  2574. If enabled, use fixed number of audio samples. This improves speed when
  2575. filtering with large delay. Default is disabled.
  2576. @item multi
  2577. Enable multichannels evaluation on gain. Default is disabled.
  2578. @item zero_phase
  2579. Enable zero phase mode by subtracting timestamp to compensate delay.
  2580. Default is disabled.
  2581. @item scale
  2582. Set scale used by gain. Acceptable values are:
  2583. @table @option
  2584. @item linlin
  2585. linear frequency, linear gain
  2586. @item linlog
  2587. linear frequency, logarithmic (in dB) gain (default)
  2588. @item loglin
  2589. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2590. @item loglog
  2591. logarithmic frequency, logarithmic gain
  2592. @end table
  2593. @item dumpfile
  2594. Set file for dumping, suitable for gnuplot.
  2595. @item dumpscale
  2596. Set scale for dumpfile. Acceptable values are same with scale option.
  2597. Default is linlog.
  2598. @item fft2
  2599. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2600. Default is disabled.
  2601. @item min_phase
  2602. Enable minimum phase impulse response. Default is disabled.
  2603. @end table
  2604. @subsection Examples
  2605. @itemize
  2606. @item
  2607. lowpass at 1000 Hz:
  2608. @example
  2609. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2610. @end example
  2611. @item
  2612. lowpass at 1000 Hz with gain_entry:
  2613. @example
  2614. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2615. @end example
  2616. @item
  2617. custom equalization:
  2618. @example
  2619. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2620. @end example
  2621. @item
  2622. higher delay with zero phase to compensate delay:
  2623. @example
  2624. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2625. @end example
  2626. @item
  2627. lowpass on left channel, highpass on right channel:
  2628. @example
  2629. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2630. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2631. @end example
  2632. @end itemize
  2633. @section flanger
  2634. Apply a flanging effect to the audio.
  2635. The filter accepts the following options:
  2636. @table @option
  2637. @item delay
  2638. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2639. @item depth
  2640. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2641. @item regen
  2642. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2643. Default value is 0.
  2644. @item width
  2645. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2646. Default value is 71.
  2647. @item speed
  2648. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2649. @item shape
  2650. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2651. Default value is @var{sinusoidal}.
  2652. @item phase
  2653. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2654. Default value is 25.
  2655. @item interp
  2656. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2657. Default is @var{linear}.
  2658. @end table
  2659. @section haas
  2660. Apply Haas effect to audio.
  2661. Note that this makes most sense to apply on mono signals.
  2662. With this filter applied to mono signals it give some directionality and
  2663. stretches its stereo image.
  2664. The filter accepts the following options:
  2665. @table @option
  2666. @item level_in
  2667. Set input level. By default is @var{1}, or 0dB
  2668. @item level_out
  2669. Set output level. By default is @var{1}, or 0dB.
  2670. @item side_gain
  2671. Set gain applied to side part of signal. By default is @var{1}.
  2672. @item middle_source
  2673. Set kind of middle source. Can be one of the following:
  2674. @table @samp
  2675. @item left
  2676. Pick left channel.
  2677. @item right
  2678. Pick right channel.
  2679. @item mid
  2680. Pick middle part signal of stereo image.
  2681. @item side
  2682. Pick side part signal of stereo image.
  2683. @end table
  2684. @item middle_phase
  2685. Change middle phase. By default is disabled.
  2686. @item left_delay
  2687. Set left channel delay. By default is @var{2.05} milliseconds.
  2688. @item left_balance
  2689. Set left channel balance. By default is @var{-1}.
  2690. @item left_gain
  2691. Set left channel gain. By default is @var{1}.
  2692. @item left_phase
  2693. Change left phase. By default is disabled.
  2694. @item right_delay
  2695. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2696. @item right_balance
  2697. Set right channel balance. By default is @var{1}.
  2698. @item right_gain
  2699. Set right channel gain. By default is @var{1}.
  2700. @item right_phase
  2701. Change right phase. By default is enabled.
  2702. @end table
  2703. @section hdcd
  2704. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2705. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2706. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2707. of HDCD, and detects the Transient Filter flag.
  2708. @example
  2709. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2710. @end example
  2711. When using the filter with wav, note the default encoding for wav is 16-bit,
  2712. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2713. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2714. @example
  2715. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2716. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2717. @end example
  2718. The filter accepts the following options:
  2719. @table @option
  2720. @item disable_autoconvert
  2721. Disable any automatic format conversion or resampling in the filter graph.
  2722. @item process_stereo
  2723. Process the stereo channels together. If target_gain does not match between
  2724. channels, consider it invalid and use the last valid target_gain.
  2725. @item cdt_ms
  2726. Set the code detect timer period in ms.
  2727. @item force_pe
  2728. Always extend peaks above -3dBFS even if PE isn't signaled.
  2729. @item analyze_mode
  2730. Replace audio with a solid tone and adjust the amplitude to signal some
  2731. specific aspect of the decoding process. The output file can be loaded in
  2732. an audio editor alongside the original to aid analysis.
  2733. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2734. Modes are:
  2735. @table @samp
  2736. @item 0, off
  2737. Disabled
  2738. @item 1, lle
  2739. Gain adjustment level at each sample
  2740. @item 2, pe
  2741. Samples where peak extend occurs
  2742. @item 3, cdt
  2743. Samples where the code detect timer is active
  2744. @item 4, tgm
  2745. Samples where the target gain does not match between channels
  2746. @end table
  2747. @end table
  2748. @section headphone
  2749. Apply head-related transfer functions (HRTFs) to create virtual
  2750. loudspeakers around the user for binaural listening via headphones.
  2751. The HRIRs are provided via additional streams, for each channel
  2752. one stereo input stream is needed.
  2753. The filter accepts the following options:
  2754. @table @option
  2755. @item map
  2756. Set mapping of input streams for convolution.
  2757. The argument is a '|'-separated list of channel names in order as they
  2758. are given as additional stream inputs for filter.
  2759. This also specify number of input streams. Number of input streams
  2760. must be not less than number of channels in first stream plus one.
  2761. @item gain
  2762. Set gain applied to audio. Value is in dB. Default is 0.
  2763. @item type
  2764. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2765. processing audio in time domain which is slow.
  2766. @var{freq} is processing audio in frequency domain which is fast.
  2767. Default is @var{freq}.
  2768. @item lfe
  2769. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2770. @item size
  2771. Set size of frame in number of samples which will be processed at once.
  2772. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2773. @item hrir
  2774. Set format of hrir stream.
  2775. Default value is @var{stereo}. Alternative value is @var{multich}.
  2776. If value is set to @var{stereo}, number of additional streams should
  2777. be greater or equal to number of input channels in first input stream.
  2778. Also each additional stream should have stereo number of channels.
  2779. If value is set to @var{multich}, number of additional streams should
  2780. be exactly one. Also number of input channels of additional stream
  2781. should be equal or greater than twice number of channels of first input
  2782. stream.
  2783. @end table
  2784. @subsection Examples
  2785. @itemize
  2786. @item
  2787. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2788. each amovie filter use stereo file with IR coefficients as input.
  2789. The files give coefficients for each position of virtual loudspeaker:
  2790. @example
  2791. ffmpeg -i input.wav
  2792. -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"
  2793. output.wav
  2794. @end example
  2795. @item
  2796. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2797. but now in @var{multich} @var{hrir} format.
  2798. @example
  2799. 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"
  2800. output.wav
  2801. @end example
  2802. @end itemize
  2803. @section highpass
  2804. Apply a high-pass filter with 3dB point frequency.
  2805. The filter can be either single-pole, or double-pole (the default).
  2806. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2807. The filter accepts the following options:
  2808. @table @option
  2809. @item frequency, f
  2810. Set frequency in Hz. Default is 3000.
  2811. @item poles, p
  2812. Set number of poles. Default is 2.
  2813. @item width_type, t
  2814. Set method to specify band-width of filter.
  2815. @table @option
  2816. @item h
  2817. Hz
  2818. @item q
  2819. Q-Factor
  2820. @item o
  2821. octave
  2822. @item s
  2823. slope
  2824. @item k
  2825. kHz
  2826. @end table
  2827. @item width, w
  2828. Specify the band-width of a filter in width_type units.
  2829. Applies only to double-pole filter.
  2830. The default is 0.707q and gives a Butterworth response.
  2831. @item channels, c
  2832. Specify which channels to filter, by default all available are filtered.
  2833. @end table
  2834. @subsection Commands
  2835. This filter supports the following commands:
  2836. @table @option
  2837. @item frequency, f
  2838. Change highpass frequency.
  2839. Syntax for the command is : "@var{frequency}"
  2840. @item width_type, t
  2841. Change highpass width_type.
  2842. Syntax for the command is : "@var{width_type}"
  2843. @item width, w
  2844. Change highpass width.
  2845. Syntax for the command is : "@var{width}"
  2846. @end table
  2847. @section join
  2848. Join multiple input streams into one multi-channel stream.
  2849. It accepts the following parameters:
  2850. @table @option
  2851. @item inputs
  2852. The number of input streams. It defaults to 2.
  2853. @item channel_layout
  2854. The desired output channel layout. It defaults to stereo.
  2855. @item map
  2856. Map channels from inputs to output. The argument is a '|'-separated list of
  2857. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2858. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2859. can be either the name of the input channel (e.g. FL for front left) or its
  2860. index in the specified input stream. @var{out_channel} is the name of the output
  2861. channel.
  2862. @end table
  2863. The filter will attempt to guess the mappings when they are not specified
  2864. explicitly. It does so by first trying to find an unused matching input channel
  2865. and if that fails it picks the first unused input channel.
  2866. Join 3 inputs (with properly set channel layouts):
  2867. @example
  2868. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2869. @end example
  2870. Build a 5.1 output from 6 single-channel streams:
  2871. @example
  2872. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2873. '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'
  2874. out
  2875. @end example
  2876. @section ladspa
  2877. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2878. To enable compilation of this filter you need to configure FFmpeg with
  2879. @code{--enable-ladspa}.
  2880. @table @option
  2881. @item file, f
  2882. Specifies the name of LADSPA plugin library to load. If the environment
  2883. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2884. each one of the directories specified by the colon separated list in
  2885. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2886. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2887. @file{/usr/lib/ladspa/}.
  2888. @item plugin, p
  2889. Specifies the plugin within the library. Some libraries contain only
  2890. one plugin, but others contain many of them. If this is not set filter
  2891. will list all available plugins within the specified library.
  2892. @item controls, c
  2893. Set the '|' separated list of controls which are zero or more floating point
  2894. values that determine the behavior of the loaded plugin (for example delay,
  2895. threshold or gain).
  2896. Controls need to be defined using the following syntax:
  2897. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2898. @var{valuei} is the value set on the @var{i}-th control.
  2899. Alternatively they can be also defined using the following syntax:
  2900. @var{value0}|@var{value1}|@var{value2}|..., where
  2901. @var{valuei} is the value set on the @var{i}-th control.
  2902. If @option{controls} is set to @code{help}, all available controls and
  2903. their valid ranges are printed.
  2904. @item sample_rate, s
  2905. Specify the sample rate, default to 44100. Only used if plugin have
  2906. zero inputs.
  2907. @item nb_samples, n
  2908. Set the number of samples per channel per each output frame, default
  2909. is 1024. Only used if plugin have zero inputs.
  2910. @item duration, d
  2911. Set the minimum duration of the sourced audio. See
  2912. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2913. for the accepted syntax.
  2914. Note that the resulting duration may be greater than the specified duration,
  2915. as the generated audio is always cut at the end of a complete frame.
  2916. If not specified, or the expressed duration is negative, the audio is
  2917. supposed to be generated forever.
  2918. Only used if plugin have zero inputs.
  2919. @end table
  2920. @subsection Examples
  2921. @itemize
  2922. @item
  2923. List all available plugins within amp (LADSPA example plugin) library:
  2924. @example
  2925. ladspa=file=amp
  2926. @end example
  2927. @item
  2928. List all available controls and their valid ranges for @code{vcf_notch}
  2929. plugin from @code{VCF} library:
  2930. @example
  2931. ladspa=f=vcf:p=vcf_notch:c=help
  2932. @end example
  2933. @item
  2934. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2935. plugin library:
  2936. @example
  2937. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2938. @end example
  2939. @item
  2940. Add reverberation to the audio using TAP-plugins
  2941. (Tom's Audio Processing plugins):
  2942. @example
  2943. ladspa=file=tap_reverb:tap_reverb
  2944. @end example
  2945. @item
  2946. Generate white noise, with 0.2 amplitude:
  2947. @example
  2948. ladspa=file=cmt:noise_source_white:c=c0=.2
  2949. @end example
  2950. @item
  2951. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2952. @code{C* Audio Plugin Suite} (CAPS) library:
  2953. @example
  2954. ladspa=file=caps:Click:c=c1=20'
  2955. @end example
  2956. @item
  2957. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2958. @example
  2959. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2960. @end example
  2961. @item
  2962. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2963. @code{SWH Plugins} collection:
  2964. @example
  2965. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2966. @end example
  2967. @item
  2968. Attenuate low frequencies using Multiband EQ from Steve Harris
  2969. @code{SWH Plugins} collection:
  2970. @example
  2971. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2972. @end example
  2973. @item
  2974. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2975. (CAPS) library:
  2976. @example
  2977. ladspa=caps:Narrower
  2978. @end example
  2979. @item
  2980. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2981. @example
  2982. ladspa=caps:White:.2
  2983. @end example
  2984. @item
  2985. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2986. @example
  2987. ladspa=caps:Fractal:c=c1=1
  2988. @end example
  2989. @item
  2990. Dynamic volume normalization using @code{VLevel} plugin:
  2991. @example
  2992. ladspa=vlevel-ladspa:vlevel_mono
  2993. @end example
  2994. @end itemize
  2995. @subsection Commands
  2996. This filter supports the following commands:
  2997. @table @option
  2998. @item cN
  2999. Modify the @var{N}-th control value.
  3000. If the specified value is not valid, it is ignored and prior one is kept.
  3001. @end table
  3002. @section loudnorm
  3003. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3004. Support for both single pass (livestreams, files) and double pass (files) modes.
  3005. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3006. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3007. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3008. The filter accepts the following options:
  3009. @table @option
  3010. @item I, i
  3011. Set integrated loudness target.
  3012. Range is -70.0 - -5.0. Default value is -24.0.
  3013. @item LRA, lra
  3014. Set loudness range target.
  3015. Range is 1.0 - 20.0. Default value is 7.0.
  3016. @item TP, tp
  3017. Set maximum true peak.
  3018. Range is -9.0 - +0.0. Default value is -2.0.
  3019. @item measured_I, measured_i
  3020. Measured IL of input file.
  3021. Range is -99.0 - +0.0.
  3022. @item measured_LRA, measured_lra
  3023. Measured LRA of input file.
  3024. Range is 0.0 - 99.0.
  3025. @item measured_TP, measured_tp
  3026. Measured true peak of input file.
  3027. Range is -99.0 - +99.0.
  3028. @item measured_thresh
  3029. Measured threshold of input file.
  3030. Range is -99.0 - +0.0.
  3031. @item offset
  3032. Set offset gain. Gain is applied before the true-peak limiter.
  3033. Range is -99.0 - +99.0. Default is +0.0.
  3034. @item linear
  3035. Normalize linearly if possible.
  3036. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3037. to be specified in order to use this mode.
  3038. Options are true or false. Default is true.
  3039. @item dual_mono
  3040. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3041. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3042. If set to @code{true}, this option will compensate for this effect.
  3043. Multi-channel input files are not affected by this option.
  3044. Options are true or false. Default is false.
  3045. @item print_format
  3046. Set print format for stats. Options are summary, json, or none.
  3047. Default value is none.
  3048. @end table
  3049. @section lowpass
  3050. Apply a low-pass filter with 3dB point frequency.
  3051. The filter can be either single-pole or double-pole (the default).
  3052. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3053. The filter accepts the following options:
  3054. @table @option
  3055. @item frequency, f
  3056. Set frequency in Hz. Default is 500.
  3057. @item poles, p
  3058. Set number of poles. Default is 2.
  3059. @item width_type, t
  3060. Set method to specify band-width of filter.
  3061. @table @option
  3062. @item h
  3063. Hz
  3064. @item q
  3065. Q-Factor
  3066. @item o
  3067. octave
  3068. @item s
  3069. slope
  3070. @item k
  3071. kHz
  3072. @end table
  3073. @item width, w
  3074. Specify the band-width of a filter in width_type units.
  3075. Applies only to double-pole filter.
  3076. The default is 0.707q and gives a Butterworth response.
  3077. @item channels, c
  3078. Specify which channels to filter, by default all available are filtered.
  3079. @end table
  3080. @subsection Examples
  3081. @itemize
  3082. @item
  3083. Lowpass only LFE channel, it LFE is not present it does nothing:
  3084. @example
  3085. lowpass=c=LFE
  3086. @end example
  3087. @end itemize
  3088. @subsection Commands
  3089. This filter supports the following commands:
  3090. @table @option
  3091. @item frequency, f
  3092. Change lowpass frequency.
  3093. Syntax for the command is : "@var{frequency}"
  3094. @item width_type, t
  3095. Change lowpass width_type.
  3096. Syntax for the command is : "@var{width_type}"
  3097. @item width, w
  3098. Change lowpass width.
  3099. Syntax for the command is : "@var{width}"
  3100. @end table
  3101. @section lv2
  3102. Load a LV2 (LADSPA Version 2) plugin.
  3103. To enable compilation of this filter you need to configure FFmpeg with
  3104. @code{--enable-lv2}.
  3105. @table @option
  3106. @item plugin, p
  3107. Specifies the plugin URI. You may need to escape ':'.
  3108. @item controls, c
  3109. Set the '|' separated list of controls which are zero or more floating point
  3110. values that determine the behavior of the loaded plugin (for example delay,
  3111. threshold or gain).
  3112. If @option{controls} is set to @code{help}, all available controls and
  3113. their valid ranges are printed.
  3114. @item sample_rate, s
  3115. Specify the sample rate, default to 44100. Only used if plugin have
  3116. zero inputs.
  3117. @item nb_samples, n
  3118. Set the number of samples per channel per each output frame, default
  3119. is 1024. Only used if plugin have zero inputs.
  3120. @item duration, d
  3121. Set the minimum duration of the sourced audio. See
  3122. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3123. for the accepted syntax.
  3124. Note that the resulting duration may be greater than the specified duration,
  3125. as the generated audio is always cut at the end of a complete frame.
  3126. If not specified, or the expressed duration is negative, the audio is
  3127. supposed to be generated forever.
  3128. Only used if plugin have zero inputs.
  3129. @end table
  3130. @subsection Examples
  3131. @itemize
  3132. @item
  3133. Apply bass enhancer plugin from Calf:
  3134. @example
  3135. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3136. @end example
  3137. @item
  3138. Apply vinyl plugin from Calf:
  3139. @example
  3140. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3141. @end example
  3142. @item
  3143. Apply bit crusher plugin from ArtyFX:
  3144. @example
  3145. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3146. @end example
  3147. @end itemize
  3148. @section mcompand
  3149. Multiband Compress or expand the audio's dynamic range.
  3150. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3151. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3152. response when absent compander action.
  3153. It accepts the following parameters:
  3154. @table @option
  3155. @item args
  3156. This option syntax is:
  3157. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3158. For explanation of each item refer to compand filter documentation.
  3159. @end table
  3160. @anchor{pan}
  3161. @section pan
  3162. Mix channels with specific gain levels. The filter accepts the output
  3163. channel layout followed by a set of channels definitions.
  3164. This filter is also designed to efficiently remap the channels of an audio
  3165. stream.
  3166. The filter accepts parameters of the form:
  3167. "@var{l}|@var{outdef}|@var{outdef}|..."
  3168. @table @option
  3169. @item l
  3170. output channel layout or number of channels
  3171. @item outdef
  3172. output channel specification, of the form:
  3173. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3174. @item out_name
  3175. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3176. number (c0, c1, etc.)
  3177. @item gain
  3178. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3179. @item in_name
  3180. input channel to use, see out_name for details; it is not possible to mix
  3181. named and numbered input channels
  3182. @end table
  3183. If the `=' in a channel specification is replaced by `<', then the gains for
  3184. that specification will be renormalized so that the total is 1, thus
  3185. avoiding clipping noise.
  3186. @subsection Mixing examples
  3187. For example, if you want to down-mix from stereo to mono, but with a bigger
  3188. factor for the left channel:
  3189. @example
  3190. pan=1c|c0=0.9*c0+0.1*c1
  3191. @end example
  3192. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3193. 7-channels surround:
  3194. @example
  3195. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3196. @end example
  3197. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3198. that should be preferred (see "-ac" option) unless you have very specific
  3199. needs.
  3200. @subsection Remapping examples
  3201. The channel remapping will be effective if, and only if:
  3202. @itemize
  3203. @item gain coefficients are zeroes or ones,
  3204. @item only one input per channel output,
  3205. @end itemize
  3206. If all these conditions are satisfied, the filter will notify the user ("Pure
  3207. channel mapping detected"), and use an optimized and lossless method to do the
  3208. remapping.
  3209. For example, if you have a 5.1 source and want a stereo audio stream by
  3210. dropping the extra channels:
  3211. @example
  3212. pan="stereo| c0=FL | c1=FR"
  3213. @end example
  3214. Given the same source, you can also switch front left and front right channels
  3215. and keep the input channel layout:
  3216. @example
  3217. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3218. @end example
  3219. If the input is a stereo audio stream, you can mute the front left channel (and
  3220. still keep the stereo channel layout) with:
  3221. @example
  3222. pan="stereo|c1=c1"
  3223. @end example
  3224. Still with a stereo audio stream input, you can copy the right channel in both
  3225. front left and right:
  3226. @example
  3227. pan="stereo| c0=FR | c1=FR"
  3228. @end example
  3229. @section replaygain
  3230. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3231. outputs it unchanged.
  3232. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3233. @section resample
  3234. Convert the audio sample format, sample rate and channel layout. It is
  3235. not meant to be used directly.
  3236. @section rubberband
  3237. Apply time-stretching and pitch-shifting with librubberband.
  3238. To enable compilation of this filter, you need to configure FFmpeg with
  3239. @code{--enable-librubberband}.
  3240. The filter accepts the following options:
  3241. @table @option
  3242. @item tempo
  3243. Set tempo scale factor.
  3244. @item pitch
  3245. Set pitch scale factor.
  3246. @item transients
  3247. Set transients detector.
  3248. Possible values are:
  3249. @table @var
  3250. @item crisp
  3251. @item mixed
  3252. @item smooth
  3253. @end table
  3254. @item detector
  3255. Set detector.
  3256. Possible values are:
  3257. @table @var
  3258. @item compound
  3259. @item percussive
  3260. @item soft
  3261. @end table
  3262. @item phase
  3263. Set phase.
  3264. Possible values are:
  3265. @table @var
  3266. @item laminar
  3267. @item independent
  3268. @end table
  3269. @item window
  3270. Set processing window size.
  3271. Possible values are:
  3272. @table @var
  3273. @item standard
  3274. @item short
  3275. @item long
  3276. @end table
  3277. @item smoothing
  3278. Set smoothing.
  3279. Possible values are:
  3280. @table @var
  3281. @item off
  3282. @item on
  3283. @end table
  3284. @item formant
  3285. Enable formant preservation when shift pitching.
  3286. Possible values are:
  3287. @table @var
  3288. @item shifted
  3289. @item preserved
  3290. @end table
  3291. @item pitchq
  3292. Set pitch quality.
  3293. Possible values are:
  3294. @table @var
  3295. @item quality
  3296. @item speed
  3297. @item consistency
  3298. @end table
  3299. @item channels
  3300. Set channels.
  3301. Possible values are:
  3302. @table @var
  3303. @item apart
  3304. @item together
  3305. @end table
  3306. @end table
  3307. @section sidechaincompress
  3308. This filter acts like normal compressor but has the ability to compress
  3309. detected signal using second input signal.
  3310. It needs two input streams and returns one output stream.
  3311. First input stream will be processed depending on second stream signal.
  3312. The filtered signal then can be filtered with other filters in later stages of
  3313. processing. See @ref{pan} and @ref{amerge} filter.
  3314. The filter accepts the following options:
  3315. @table @option
  3316. @item level_in
  3317. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3318. @item threshold
  3319. If a signal of second stream raises above this level it will affect the gain
  3320. reduction of first stream.
  3321. By default is 0.125. Range is between 0.00097563 and 1.
  3322. @item ratio
  3323. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3324. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3325. Default is 2. Range is between 1 and 20.
  3326. @item attack
  3327. Amount of milliseconds the signal has to rise above the threshold before gain
  3328. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3329. @item release
  3330. Amount of milliseconds the signal has to fall below the threshold before
  3331. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3332. @item makeup
  3333. Set the amount by how much signal will be amplified after processing.
  3334. Default is 1. Range is from 1 to 64.
  3335. @item knee
  3336. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3337. Default is 2.82843. Range is between 1 and 8.
  3338. @item link
  3339. Choose if the @code{average} level between all channels of side-chain stream
  3340. or the louder(@code{maximum}) channel of side-chain stream affects the
  3341. reduction. Default is @code{average}.
  3342. @item detection
  3343. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3344. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3345. @item level_sc
  3346. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3347. @item mix
  3348. How much to use compressed signal in output. Default is 1.
  3349. Range is between 0 and 1.
  3350. @end table
  3351. @subsection Examples
  3352. @itemize
  3353. @item
  3354. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3355. depending on the signal of 2nd input and later compressed signal to be
  3356. merged with 2nd input:
  3357. @example
  3358. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3359. @end example
  3360. @end itemize
  3361. @section sidechaingate
  3362. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3363. filter the detected signal before sending it to the gain reduction stage.
  3364. Normally a gate uses the full range signal to detect a level above the
  3365. threshold.
  3366. For example: If you cut all lower frequencies from your sidechain signal
  3367. the gate will decrease the volume of your track only if not enough highs
  3368. appear. With this technique you are able to reduce the resonation of a
  3369. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3370. guitar.
  3371. It needs two input streams and returns one output stream.
  3372. First input stream will be processed depending on second stream signal.
  3373. The filter accepts the following options:
  3374. @table @option
  3375. @item level_in
  3376. Set input level before filtering.
  3377. Default is 1. Allowed range is from 0.015625 to 64.
  3378. @item range
  3379. Set the level of gain reduction when the signal is below the threshold.
  3380. Default is 0.06125. Allowed range is from 0 to 1.
  3381. @item threshold
  3382. If a signal rises above this level the gain reduction is released.
  3383. Default is 0.125. Allowed range is from 0 to 1.
  3384. @item ratio
  3385. Set a ratio about which the signal is reduced.
  3386. Default is 2. Allowed range is from 1 to 9000.
  3387. @item attack
  3388. Amount of milliseconds the signal has to rise above the threshold before gain
  3389. reduction stops.
  3390. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3391. @item release
  3392. Amount of milliseconds the signal has to fall below the threshold before the
  3393. reduction is increased again. Default is 250 milliseconds.
  3394. Allowed range is from 0.01 to 9000.
  3395. @item makeup
  3396. Set amount of amplification of signal after processing.
  3397. Default is 1. Allowed range is from 1 to 64.
  3398. @item knee
  3399. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3400. Default is 2.828427125. Allowed range is from 1 to 8.
  3401. @item detection
  3402. Choose if exact signal should be taken for detection or an RMS like one.
  3403. Default is rms. Can be peak or rms.
  3404. @item link
  3405. Choose if the average level between all channels or the louder channel affects
  3406. the reduction.
  3407. Default is average. Can be average or maximum.
  3408. @item level_sc
  3409. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3410. @end table
  3411. @section silencedetect
  3412. Detect silence in an audio stream.
  3413. This filter logs a message when it detects that the input audio volume is less
  3414. or equal to a noise tolerance value for a duration greater or equal to the
  3415. minimum detected noise duration.
  3416. The printed times and duration are expressed in seconds.
  3417. The filter accepts the following options:
  3418. @table @option
  3419. @item noise, n
  3420. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3421. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3422. @item duration, d
  3423. Set silence duration until notification (default is 2 seconds).
  3424. @item mono, m
  3425. Process each channel separately, instead of combined. By default is disabled.
  3426. @end table
  3427. @subsection Examples
  3428. @itemize
  3429. @item
  3430. Detect 5 seconds of silence with -50dB noise tolerance:
  3431. @example
  3432. silencedetect=n=-50dB:d=5
  3433. @end example
  3434. @item
  3435. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3436. tolerance in @file{silence.mp3}:
  3437. @example
  3438. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3439. @end example
  3440. @end itemize
  3441. @section silenceremove
  3442. Remove silence from the beginning, middle or end of the audio.
  3443. The filter accepts the following options:
  3444. @table @option
  3445. @item start_periods
  3446. This value is used to indicate if audio should be trimmed at beginning of
  3447. the audio. A value of zero indicates no silence should be trimmed from the
  3448. beginning. When specifying a non-zero value, it trims audio up until it
  3449. finds non-silence. Normally, when trimming silence from beginning of audio
  3450. the @var{start_periods} will be @code{1} but it can be increased to higher
  3451. values to trim all audio up to specific count of non-silence periods.
  3452. Default value is @code{0}.
  3453. @item start_duration
  3454. Specify the amount of time that non-silence must be detected before it stops
  3455. trimming audio. By increasing the duration, bursts of noises can be treated
  3456. as silence and trimmed off. Default value is @code{0}.
  3457. @item start_threshold
  3458. This indicates what sample value should be treated as silence. For digital
  3459. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3460. you may wish to increase the value to account for background noise.
  3461. Can be specified in dB (in case "dB" is appended to the specified value)
  3462. or amplitude ratio. Default value is @code{0}.
  3463. @item start_silence
  3464. Specify max duration of silence at beginning that will be kept after
  3465. trimming. Default is 0, which is equal to trimming all samples detected
  3466. as silence.
  3467. @item start_mode
  3468. Specify mode of detection of silence end in start of multi-channel audio.
  3469. Can be @var{any} or @var{all}. Default is @var{any}.
  3470. With @var{any}, any sample that is detected as non-silence will cause
  3471. stopped trimming of silence.
  3472. With @var{all}, only if all channels are detected as non-silence will cause
  3473. stopped trimming of silence.
  3474. @item stop_periods
  3475. Set the count for trimming silence from the end of audio.
  3476. To remove silence from the middle of a file, specify a @var{stop_periods}
  3477. that is negative. This value is then treated as a positive value and is
  3478. used to indicate the effect should restart processing as specified by
  3479. @var{start_periods}, making it suitable for removing periods of silence
  3480. in the middle of the audio.
  3481. Default value is @code{0}.
  3482. @item stop_duration
  3483. Specify a duration of silence that must exist before audio is not copied any
  3484. more. By specifying a higher duration, silence that is wanted can be left in
  3485. the audio.
  3486. Default value is @code{0}.
  3487. @item stop_threshold
  3488. This is the same as @option{start_threshold} but for trimming silence from
  3489. the end of audio.
  3490. Can be specified in dB (in case "dB" is appended to the specified value)
  3491. or amplitude ratio. Default value is @code{0}.
  3492. @item stop_silence
  3493. Specify max duration of silence at end that will be kept after
  3494. trimming. Default is 0, which is equal to trimming all samples detected
  3495. as silence.
  3496. @item stop_mode
  3497. Specify mode of detection of silence start in end of multi-channel audio.
  3498. Can be @var{any} or @var{all}. Default is @var{any}.
  3499. With @var{any}, any sample that is detected as non-silence will cause
  3500. stopped trimming of silence.
  3501. With @var{all}, only if all channels are detected as non-silence will cause
  3502. stopped trimming of silence.
  3503. @item detection
  3504. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3505. and works better with digital silence which is exactly 0.
  3506. Default value is @code{rms}.
  3507. @item window
  3508. Set duration in number of seconds used to calculate size of window in number
  3509. of samples for detecting silence.
  3510. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3511. @end table
  3512. @subsection Examples
  3513. @itemize
  3514. @item
  3515. The following example shows how this filter can be used to start a recording
  3516. that does not contain the delay at the start which usually occurs between
  3517. pressing the record button and the start of the performance:
  3518. @example
  3519. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3520. @end example
  3521. @item
  3522. Trim all silence encountered from beginning to end where there is more than 1
  3523. second of silence in audio:
  3524. @example
  3525. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3526. @end example
  3527. @end itemize
  3528. @section sofalizer
  3529. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3530. loudspeakers around the user for binaural listening via headphones (audio
  3531. formats up to 9 channels supported).
  3532. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3533. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3534. Austrian Academy of Sciences.
  3535. To enable compilation of this filter you need to configure FFmpeg with
  3536. @code{--enable-libmysofa}.
  3537. The filter accepts the following options:
  3538. @table @option
  3539. @item sofa
  3540. Set the SOFA file used for rendering.
  3541. @item gain
  3542. Set gain applied to audio. Value is in dB. Default is 0.
  3543. @item rotation
  3544. Set rotation of virtual loudspeakers in deg. Default is 0.
  3545. @item elevation
  3546. Set elevation of virtual speakers in deg. Default is 0.
  3547. @item radius
  3548. Set distance in meters between loudspeakers and the listener with near-field
  3549. HRTFs. Default is 1.
  3550. @item type
  3551. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3552. processing audio in time domain which is slow.
  3553. @var{freq} is processing audio in frequency domain which is fast.
  3554. Default is @var{freq}.
  3555. @item speakers
  3556. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3557. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3558. Each virtual loudspeaker is described with short channel name following with
  3559. azimuth and elevation in degrees.
  3560. Each virtual loudspeaker description is separated by '|'.
  3561. For example to override front left and front right channel positions use:
  3562. 'speakers=FL 45 15|FR 345 15'.
  3563. Descriptions with unrecognised channel names are ignored.
  3564. @item lfegain
  3565. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3566. @item framesize
  3567. Set custom frame size in number of samples. Default is 1024.
  3568. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3569. is set to @var{freq}.
  3570. @item normalize
  3571. Should all IRs be normalized upon importing SOFA file.
  3572. By default is enabled.
  3573. @item interpolate
  3574. Should nearest IRs be interpolated with neighbor IRs if exact position
  3575. does not match. By default is disabled.
  3576. @item minphase
  3577. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3578. @item anglestep
  3579. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3580. @item radstep
  3581. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3582. @end table
  3583. @subsection Examples
  3584. @itemize
  3585. @item
  3586. Using ClubFritz6 sofa file:
  3587. @example
  3588. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3589. @end example
  3590. @item
  3591. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3592. @example
  3593. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3594. @end example
  3595. @item
  3596. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3597. and also with custom gain:
  3598. @example
  3599. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3600. @end example
  3601. @end itemize
  3602. @section stereotools
  3603. This filter has some handy utilities to manage stereo signals, for converting
  3604. M/S stereo recordings to L/R signal while having control over the parameters
  3605. or spreading the stereo image of master track.
  3606. The filter accepts the following options:
  3607. @table @option
  3608. @item level_in
  3609. Set input level before filtering for both channels. Defaults is 1.
  3610. Allowed range is from 0.015625 to 64.
  3611. @item level_out
  3612. Set output level after filtering for both channels. Defaults is 1.
  3613. Allowed range is from 0.015625 to 64.
  3614. @item balance_in
  3615. Set input balance between both channels. Default is 0.
  3616. Allowed range is from -1 to 1.
  3617. @item balance_out
  3618. Set output balance between both channels. Default is 0.
  3619. Allowed range is from -1 to 1.
  3620. @item softclip
  3621. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3622. clipping. Disabled by default.
  3623. @item mutel
  3624. Mute the left channel. Disabled by default.
  3625. @item muter
  3626. Mute the right channel. Disabled by default.
  3627. @item phasel
  3628. Change the phase of the left channel. Disabled by default.
  3629. @item phaser
  3630. Change the phase of the right channel. Disabled by default.
  3631. @item mode
  3632. Set stereo mode. Available values are:
  3633. @table @samp
  3634. @item lr>lr
  3635. Left/Right to Left/Right, this is default.
  3636. @item lr>ms
  3637. Left/Right to Mid/Side.
  3638. @item ms>lr
  3639. Mid/Side to Left/Right.
  3640. @item lr>ll
  3641. Left/Right to Left/Left.
  3642. @item lr>rr
  3643. Left/Right to Right/Right.
  3644. @item lr>l+r
  3645. Left/Right to Left + Right.
  3646. @item lr>rl
  3647. Left/Right to Right/Left.
  3648. @item ms>ll
  3649. Mid/Side to Left/Left.
  3650. @item ms>rr
  3651. Mid/Side to Right/Right.
  3652. @end table
  3653. @item slev
  3654. Set level of side signal. Default is 1.
  3655. Allowed range is from 0.015625 to 64.
  3656. @item sbal
  3657. Set balance of side signal. Default is 0.
  3658. Allowed range is from -1 to 1.
  3659. @item mlev
  3660. Set level of the middle signal. Default is 1.
  3661. Allowed range is from 0.015625 to 64.
  3662. @item mpan
  3663. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3664. @item base
  3665. Set stereo base between mono and inversed channels. Default is 0.
  3666. Allowed range is from -1 to 1.
  3667. @item delay
  3668. Set delay in milliseconds how much to delay left from right channel and
  3669. vice versa. Default is 0. Allowed range is from -20 to 20.
  3670. @item sclevel
  3671. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3672. @item phase
  3673. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3674. @item bmode_in, bmode_out
  3675. Set balance mode for balance_in/balance_out option.
  3676. Can be one of the following:
  3677. @table @samp
  3678. @item balance
  3679. Classic balance mode. Attenuate one channel at time.
  3680. Gain is raised up to 1.
  3681. @item amplitude
  3682. Similar as classic mode above but gain is raised up to 2.
  3683. @item power
  3684. Equal power distribution, from -6dB to +6dB range.
  3685. @end table
  3686. @end table
  3687. @subsection Examples
  3688. @itemize
  3689. @item
  3690. Apply karaoke like effect:
  3691. @example
  3692. stereotools=mlev=0.015625
  3693. @end example
  3694. @item
  3695. Convert M/S signal to L/R:
  3696. @example
  3697. "stereotools=mode=ms>lr"
  3698. @end example
  3699. @end itemize
  3700. @section stereowiden
  3701. This filter enhance the stereo effect by suppressing signal common to both
  3702. channels and by delaying the signal of left into right and vice versa,
  3703. thereby widening the stereo effect.
  3704. The filter accepts the following options:
  3705. @table @option
  3706. @item delay
  3707. Time in milliseconds of the delay of left signal into right and vice versa.
  3708. Default is 20 milliseconds.
  3709. @item feedback
  3710. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3711. effect of left signal in right output and vice versa which gives widening
  3712. effect. Default is 0.3.
  3713. @item crossfeed
  3714. Cross feed of left into right with inverted phase. This helps in suppressing
  3715. the mono. If the value is 1 it will cancel all the signal common to both
  3716. channels. Default is 0.3.
  3717. @item drymix
  3718. Set level of input signal of original channel. Default is 0.8.
  3719. @end table
  3720. @section superequalizer
  3721. Apply 18 band equalizer.
  3722. The filter accepts the following options:
  3723. @table @option
  3724. @item 1b
  3725. Set 65Hz band gain.
  3726. @item 2b
  3727. Set 92Hz band gain.
  3728. @item 3b
  3729. Set 131Hz band gain.
  3730. @item 4b
  3731. Set 185Hz band gain.
  3732. @item 5b
  3733. Set 262Hz band gain.
  3734. @item 6b
  3735. Set 370Hz band gain.
  3736. @item 7b
  3737. Set 523Hz band gain.
  3738. @item 8b
  3739. Set 740Hz band gain.
  3740. @item 9b
  3741. Set 1047Hz band gain.
  3742. @item 10b
  3743. Set 1480Hz band gain.
  3744. @item 11b
  3745. Set 2093Hz band gain.
  3746. @item 12b
  3747. Set 2960Hz band gain.
  3748. @item 13b
  3749. Set 4186Hz band gain.
  3750. @item 14b
  3751. Set 5920Hz band gain.
  3752. @item 15b
  3753. Set 8372Hz band gain.
  3754. @item 16b
  3755. Set 11840Hz band gain.
  3756. @item 17b
  3757. Set 16744Hz band gain.
  3758. @item 18b
  3759. Set 20000Hz band gain.
  3760. @end table
  3761. @section surround
  3762. Apply audio surround upmix filter.
  3763. This filter allows to produce multichannel output from audio stream.
  3764. The filter accepts the following options:
  3765. @table @option
  3766. @item chl_out
  3767. Set output channel layout. By default, this is @var{5.1}.
  3768. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3769. for the required syntax.
  3770. @item chl_in
  3771. Set input channel layout. By default, this is @var{stereo}.
  3772. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3773. for the required syntax.
  3774. @item level_in
  3775. Set input volume level. By default, this is @var{1}.
  3776. @item level_out
  3777. Set output volume level. By default, this is @var{1}.
  3778. @item lfe
  3779. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3780. @item lfe_low
  3781. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3782. @item lfe_high
  3783. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3784. @item fc_in
  3785. Set front center input volume. By default, this is @var{1}.
  3786. @item fc_out
  3787. Set front center output volume. By default, this is @var{1}.
  3788. @item lfe_in
  3789. Set LFE input volume. By default, this is @var{1}.
  3790. @item lfe_out
  3791. Set LFE output volume. By default, this is @var{1}.
  3792. @end table
  3793. @section treble, highshelf
  3794. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3795. shelving filter with a response similar to that of a standard
  3796. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3797. The filter accepts the following options:
  3798. @table @option
  3799. @item gain, g
  3800. Give the gain at whichever is the lower of ~22 kHz and the
  3801. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3802. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3803. @item frequency, f
  3804. Set the filter's central frequency and so can be used
  3805. to extend or reduce the frequency range to be boosted or cut.
  3806. The default value is @code{3000} Hz.
  3807. @item width_type, t
  3808. Set method to specify band-width of filter.
  3809. @table @option
  3810. @item h
  3811. Hz
  3812. @item q
  3813. Q-Factor
  3814. @item o
  3815. octave
  3816. @item s
  3817. slope
  3818. @item k
  3819. kHz
  3820. @end table
  3821. @item width, w
  3822. Determine how steep is the filter's shelf transition.
  3823. @item channels, c
  3824. Specify which channels to filter, by default all available are filtered.
  3825. @end table
  3826. @subsection Commands
  3827. This filter supports the following commands:
  3828. @table @option
  3829. @item frequency, f
  3830. Change treble frequency.
  3831. Syntax for the command is : "@var{frequency}"
  3832. @item width_type, t
  3833. Change treble width_type.
  3834. Syntax for the command is : "@var{width_type}"
  3835. @item width, w
  3836. Change treble width.
  3837. Syntax for the command is : "@var{width}"
  3838. @item gain, g
  3839. Change treble gain.
  3840. Syntax for the command is : "@var{gain}"
  3841. @end table
  3842. @section tremolo
  3843. Sinusoidal amplitude modulation.
  3844. The filter accepts the following options:
  3845. @table @option
  3846. @item f
  3847. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3848. (20 Hz or lower) will result in a tremolo effect.
  3849. This filter may also be used as a ring modulator by specifying
  3850. a modulation frequency higher than 20 Hz.
  3851. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3852. @item d
  3853. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3854. Default value is 0.5.
  3855. @end table
  3856. @section vibrato
  3857. Sinusoidal phase modulation.
  3858. The filter accepts the following options:
  3859. @table @option
  3860. @item f
  3861. Modulation frequency in Hertz.
  3862. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3863. @item d
  3864. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3865. Default value is 0.5.
  3866. @end table
  3867. @section volume
  3868. Adjust the input audio volume.
  3869. It accepts the following parameters:
  3870. @table @option
  3871. @item volume
  3872. Set audio volume expression.
  3873. Output values are clipped to the maximum value.
  3874. The output audio volume is given by the relation:
  3875. @example
  3876. @var{output_volume} = @var{volume} * @var{input_volume}
  3877. @end example
  3878. The default value for @var{volume} is "1.0".
  3879. @item precision
  3880. This parameter represents the mathematical precision.
  3881. It determines which input sample formats will be allowed, which affects the
  3882. precision of the volume scaling.
  3883. @table @option
  3884. @item fixed
  3885. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3886. @item float
  3887. 32-bit floating-point; this limits input sample format to FLT. (default)
  3888. @item double
  3889. 64-bit floating-point; this limits input sample format to DBL.
  3890. @end table
  3891. @item replaygain
  3892. Choose the behaviour on encountering ReplayGain side data in input frames.
  3893. @table @option
  3894. @item drop
  3895. Remove ReplayGain side data, ignoring its contents (the default).
  3896. @item ignore
  3897. Ignore ReplayGain side data, but leave it in the frame.
  3898. @item track
  3899. Prefer the track gain, if present.
  3900. @item album
  3901. Prefer the album gain, if present.
  3902. @end table
  3903. @item replaygain_preamp
  3904. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3905. Default value for @var{replaygain_preamp} is 0.0.
  3906. @item eval
  3907. Set when the volume expression is evaluated.
  3908. It accepts the following values:
  3909. @table @samp
  3910. @item once
  3911. only evaluate expression once during the filter initialization, or
  3912. when the @samp{volume} command is sent
  3913. @item frame
  3914. evaluate expression for each incoming frame
  3915. @end table
  3916. Default value is @samp{once}.
  3917. @end table
  3918. The volume expression can contain the following parameters.
  3919. @table @option
  3920. @item n
  3921. frame number (starting at zero)
  3922. @item nb_channels
  3923. number of channels
  3924. @item nb_consumed_samples
  3925. number of samples consumed by the filter
  3926. @item nb_samples
  3927. number of samples in the current frame
  3928. @item pos
  3929. original frame position in the file
  3930. @item pts
  3931. frame PTS
  3932. @item sample_rate
  3933. sample rate
  3934. @item startpts
  3935. PTS at start of stream
  3936. @item startt
  3937. time at start of stream
  3938. @item t
  3939. frame time
  3940. @item tb
  3941. timestamp timebase
  3942. @item volume
  3943. last set volume value
  3944. @end table
  3945. Note that when @option{eval} is set to @samp{once} only the
  3946. @var{sample_rate} and @var{tb} variables are available, all other
  3947. variables will evaluate to NAN.
  3948. @subsection Commands
  3949. This filter supports the following commands:
  3950. @table @option
  3951. @item volume
  3952. Modify the volume expression.
  3953. The command accepts the same syntax of the corresponding option.
  3954. If the specified expression is not valid, it is kept at its current
  3955. value.
  3956. @item replaygain_noclip
  3957. Prevent clipping by limiting the gain applied.
  3958. Default value for @var{replaygain_noclip} is 1.
  3959. @end table
  3960. @subsection Examples
  3961. @itemize
  3962. @item
  3963. Halve the input audio volume:
  3964. @example
  3965. volume=volume=0.5
  3966. volume=volume=1/2
  3967. volume=volume=-6.0206dB
  3968. @end example
  3969. In all the above example the named key for @option{volume} can be
  3970. omitted, for example like in:
  3971. @example
  3972. volume=0.5
  3973. @end example
  3974. @item
  3975. Increase input audio power by 6 decibels using fixed-point precision:
  3976. @example
  3977. volume=volume=6dB:precision=fixed
  3978. @end example
  3979. @item
  3980. Fade volume after time 10 with an annihilation period of 5 seconds:
  3981. @example
  3982. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3983. @end example
  3984. @end itemize
  3985. @section volumedetect
  3986. Detect the volume of the input video.
  3987. The filter has no parameters. The input is not modified. Statistics about
  3988. the volume will be printed in the log when the input stream end is reached.
  3989. In particular it will show the mean volume (root mean square), maximum
  3990. volume (on a per-sample basis), and the beginning of a histogram of the
  3991. registered volume values (from the maximum value to a cumulated 1/1000 of
  3992. the samples).
  3993. All volumes are in decibels relative to the maximum PCM value.
  3994. @subsection Examples
  3995. Here is an excerpt of the output:
  3996. @example
  3997. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3998. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3999. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4000. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4001. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4002. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4003. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4004. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4005. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4006. @end example
  4007. It means that:
  4008. @itemize
  4009. @item
  4010. The mean square energy is approximately -27 dB, or 10^-2.7.
  4011. @item
  4012. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4013. @item
  4014. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4015. @end itemize
  4016. In other words, raising the volume by +4 dB does not cause any clipping,
  4017. raising it by +5 dB causes clipping for 6 samples, etc.
  4018. @c man end AUDIO FILTERS
  4019. @chapter Audio Sources
  4020. @c man begin AUDIO SOURCES
  4021. Below is a description of the currently available audio sources.
  4022. @section abuffer
  4023. Buffer audio frames, and make them available to the filter chain.
  4024. This source is mainly intended for a programmatic use, in particular
  4025. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4026. It accepts the following parameters:
  4027. @table @option
  4028. @item time_base
  4029. The timebase which will be used for timestamps of submitted frames. It must be
  4030. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4031. @item sample_rate
  4032. The sample rate of the incoming audio buffers.
  4033. @item sample_fmt
  4034. The sample format of the incoming audio buffers.
  4035. Either a sample format name or its corresponding integer representation from
  4036. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4037. @item channel_layout
  4038. The channel layout of the incoming audio buffers.
  4039. Either a channel layout name from channel_layout_map in
  4040. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4041. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4042. @item channels
  4043. The number of channels of the incoming audio buffers.
  4044. If both @var{channels} and @var{channel_layout} are specified, then they
  4045. must be consistent.
  4046. @end table
  4047. @subsection Examples
  4048. @example
  4049. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4050. @end example
  4051. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4052. Since the sample format with name "s16p" corresponds to the number
  4053. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4054. equivalent to:
  4055. @example
  4056. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4057. @end example
  4058. @section aevalsrc
  4059. Generate an audio signal specified by an expression.
  4060. This source accepts in input one or more expressions (one for each
  4061. channel), which are evaluated and used to generate a corresponding
  4062. audio signal.
  4063. This source accepts the following options:
  4064. @table @option
  4065. @item exprs
  4066. Set the '|'-separated expressions list for each separate channel. In case the
  4067. @option{channel_layout} option is not specified, the selected channel layout
  4068. depends on the number of provided expressions. Otherwise the last
  4069. specified expression is applied to the remaining output channels.
  4070. @item channel_layout, c
  4071. Set the channel layout. The number of channels in the specified layout
  4072. must be equal to the number of specified expressions.
  4073. @item duration, d
  4074. Set the minimum duration of the sourced audio. See
  4075. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4076. for the accepted syntax.
  4077. Note that the resulting duration may be greater than the specified
  4078. duration, as the generated audio is always cut at the end of a
  4079. complete frame.
  4080. If not specified, or the expressed duration is negative, the audio is
  4081. supposed to be generated forever.
  4082. @item nb_samples, n
  4083. Set the number of samples per channel per each output frame,
  4084. default to 1024.
  4085. @item sample_rate, s
  4086. Specify the sample rate, default to 44100.
  4087. @end table
  4088. Each expression in @var{exprs} can contain the following constants:
  4089. @table @option
  4090. @item n
  4091. number of the evaluated sample, starting from 0
  4092. @item t
  4093. time of the evaluated sample expressed in seconds, starting from 0
  4094. @item s
  4095. sample rate
  4096. @end table
  4097. @subsection Examples
  4098. @itemize
  4099. @item
  4100. Generate silence:
  4101. @example
  4102. aevalsrc=0
  4103. @end example
  4104. @item
  4105. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4106. 8000 Hz:
  4107. @example
  4108. aevalsrc="sin(440*2*PI*t):s=8000"
  4109. @end example
  4110. @item
  4111. Generate a two channels signal, specify the channel layout (Front
  4112. Center + Back Center) explicitly:
  4113. @example
  4114. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4115. @end example
  4116. @item
  4117. Generate white noise:
  4118. @example
  4119. aevalsrc="-2+random(0)"
  4120. @end example
  4121. @item
  4122. Generate an amplitude modulated signal:
  4123. @example
  4124. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4125. @end example
  4126. @item
  4127. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4128. @example
  4129. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4130. @end example
  4131. @end itemize
  4132. @section anullsrc
  4133. The null audio source, return unprocessed audio frames. It is mainly useful
  4134. as a template and to be employed in analysis / debugging tools, or as
  4135. the source for filters which ignore the input data (for example the sox
  4136. synth filter).
  4137. This source accepts the following options:
  4138. @table @option
  4139. @item channel_layout, cl
  4140. Specifies the channel layout, and can be either an integer or a string
  4141. representing a channel layout. The default value of @var{channel_layout}
  4142. is "stereo".
  4143. Check the channel_layout_map definition in
  4144. @file{libavutil/channel_layout.c} for the mapping between strings and
  4145. channel layout values.
  4146. @item sample_rate, r
  4147. Specifies the sample rate, and defaults to 44100.
  4148. @item nb_samples, n
  4149. Set the number of samples per requested frames.
  4150. @end table
  4151. @subsection Examples
  4152. @itemize
  4153. @item
  4154. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4155. @example
  4156. anullsrc=r=48000:cl=4
  4157. @end example
  4158. @item
  4159. Do the same operation with a more obvious syntax:
  4160. @example
  4161. anullsrc=r=48000:cl=mono
  4162. @end example
  4163. @end itemize
  4164. All the parameters need to be explicitly defined.
  4165. @section flite
  4166. Synthesize a voice utterance using the libflite library.
  4167. To enable compilation of this filter you need to configure FFmpeg with
  4168. @code{--enable-libflite}.
  4169. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4170. The filter accepts the following options:
  4171. @table @option
  4172. @item list_voices
  4173. If set to 1, list the names of the available voices and exit
  4174. immediately. Default value is 0.
  4175. @item nb_samples, n
  4176. Set the maximum number of samples per frame. Default value is 512.
  4177. @item textfile
  4178. Set the filename containing the text to speak.
  4179. @item text
  4180. Set the text to speak.
  4181. @item voice, v
  4182. Set the voice to use for the speech synthesis. Default value is
  4183. @code{kal}. See also the @var{list_voices} option.
  4184. @end table
  4185. @subsection Examples
  4186. @itemize
  4187. @item
  4188. Read from file @file{speech.txt}, and synthesize the text using the
  4189. standard flite voice:
  4190. @example
  4191. flite=textfile=speech.txt
  4192. @end example
  4193. @item
  4194. Read the specified text selecting the @code{slt} voice:
  4195. @example
  4196. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4197. @end example
  4198. @item
  4199. Input text to ffmpeg:
  4200. @example
  4201. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4202. @end example
  4203. @item
  4204. Make @file{ffplay} speak the specified text, using @code{flite} and
  4205. the @code{lavfi} device:
  4206. @example
  4207. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4208. @end example
  4209. @end itemize
  4210. For more information about libflite, check:
  4211. @url{http://www.festvox.org/flite/}
  4212. @section anoisesrc
  4213. Generate a noise audio signal.
  4214. The filter accepts the following options:
  4215. @table @option
  4216. @item sample_rate, r
  4217. Specify the sample rate. Default value is 48000 Hz.
  4218. @item amplitude, a
  4219. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4220. is 1.0.
  4221. @item duration, d
  4222. Specify the duration of the generated audio stream. Not specifying this option
  4223. results in noise with an infinite length.
  4224. @item color, colour, c
  4225. Specify the color of noise. Available noise colors are white, pink, brown,
  4226. blue and violet. Default color is white.
  4227. @item seed, s
  4228. Specify a value used to seed the PRNG.
  4229. @item nb_samples, n
  4230. Set the number of samples per each output frame, default is 1024.
  4231. @end table
  4232. @subsection Examples
  4233. @itemize
  4234. @item
  4235. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4236. @example
  4237. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4238. @end example
  4239. @end itemize
  4240. @section hilbert
  4241. Generate odd-tap Hilbert transform FIR coefficients.
  4242. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4243. the signal by 90 degrees.
  4244. This is used in many matrix coding schemes and for analytic signal generation.
  4245. The process is often written as a multiplication by i (or j), the imaginary unit.
  4246. The filter accepts the following options:
  4247. @table @option
  4248. @item sample_rate, s
  4249. Set sample rate, default is 44100.
  4250. @item taps, t
  4251. Set length of FIR filter, default is 22051.
  4252. @item nb_samples, n
  4253. Set number of samples per each frame.
  4254. @item win_func, w
  4255. Set window function to be used when generating FIR coefficients.
  4256. @end table
  4257. @section sinc
  4258. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4259. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4260. The filter accepts the following options:
  4261. @table @option
  4262. @item sample_rate, r
  4263. Set sample rate, default is 44100.
  4264. @item nb_samples, n
  4265. Set number of samples per each frame. Default is 1024.
  4266. @item hp
  4267. Set high-pass frequency. Default is 0.
  4268. @item lp
  4269. Set low-pass frequency. Default is 0.
  4270. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4271. is higher than 0 then filter will create band-pass filter coefficients,
  4272. otherwise band-reject filter coefficients.
  4273. @item phase
  4274. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4275. @item beta
  4276. Set Kaiser window beta.
  4277. @item att
  4278. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4279. @item round
  4280. Enable rounding, by default is disabled.
  4281. @item hptaps
  4282. Set number of taps for high-pass filter.
  4283. @item lptaps
  4284. Set number of taps for low-pass filter.
  4285. @end table
  4286. @section sine
  4287. Generate an audio signal made of a sine wave with amplitude 1/8.
  4288. The audio signal is bit-exact.
  4289. The filter accepts the following options:
  4290. @table @option
  4291. @item frequency, f
  4292. Set the carrier frequency. Default is 440 Hz.
  4293. @item beep_factor, b
  4294. Enable a periodic beep every second with frequency @var{beep_factor} times
  4295. the carrier frequency. Default is 0, meaning the beep is disabled.
  4296. @item sample_rate, r
  4297. Specify the sample rate, default is 44100.
  4298. @item duration, d
  4299. Specify the duration of the generated audio stream.
  4300. @item samples_per_frame
  4301. Set the number of samples per output frame.
  4302. The expression can contain the following constants:
  4303. @table @option
  4304. @item n
  4305. The (sequential) number of the output audio frame, starting from 0.
  4306. @item pts
  4307. The PTS (Presentation TimeStamp) of the output audio frame,
  4308. expressed in @var{TB} units.
  4309. @item t
  4310. The PTS of the output audio frame, expressed in seconds.
  4311. @item TB
  4312. The timebase of the output audio frames.
  4313. @end table
  4314. Default is @code{1024}.
  4315. @end table
  4316. @subsection Examples
  4317. @itemize
  4318. @item
  4319. Generate a simple 440 Hz sine wave:
  4320. @example
  4321. sine
  4322. @end example
  4323. @item
  4324. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4325. @example
  4326. sine=220:4:d=5
  4327. sine=f=220:b=4:d=5
  4328. sine=frequency=220:beep_factor=4:duration=5
  4329. @end example
  4330. @item
  4331. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4332. pattern:
  4333. @example
  4334. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4335. @end example
  4336. @end itemize
  4337. @c man end AUDIO SOURCES
  4338. @chapter Audio Sinks
  4339. @c man begin AUDIO SINKS
  4340. Below is a description of the currently available audio sinks.
  4341. @section abuffersink
  4342. Buffer audio frames, and make them available to the end of filter chain.
  4343. This sink is mainly intended for programmatic use, in particular
  4344. through the interface defined in @file{libavfilter/buffersink.h}
  4345. or the options system.
  4346. It accepts a pointer to an AVABufferSinkContext structure, which
  4347. defines the incoming buffers' formats, to be passed as the opaque
  4348. parameter to @code{avfilter_init_filter} for initialization.
  4349. @section anullsink
  4350. Null audio sink; do absolutely nothing with the input audio. It is
  4351. mainly useful as a template and for use in analysis / debugging
  4352. tools.
  4353. @c man end AUDIO SINKS
  4354. @chapter Video Filters
  4355. @c man begin VIDEO FILTERS
  4356. When you configure your FFmpeg build, you can disable any of the
  4357. existing filters using @code{--disable-filters}.
  4358. The configure output will show the video filters included in your
  4359. build.
  4360. Below is a description of the currently available video filters.
  4361. @section alphaextract
  4362. Extract the alpha component from the input as a grayscale video. This
  4363. is especially useful with the @var{alphamerge} filter.
  4364. @section alphamerge
  4365. Add or replace the alpha component of the primary input with the
  4366. grayscale value of a second input. This is intended for use with
  4367. @var{alphaextract} to allow the transmission or storage of frame
  4368. sequences that have alpha in a format that doesn't support an alpha
  4369. channel.
  4370. For example, to reconstruct full frames from a normal YUV-encoded video
  4371. and a separate video created with @var{alphaextract}, you might use:
  4372. @example
  4373. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4374. @end example
  4375. Since this filter is designed for reconstruction, it operates on frame
  4376. sequences without considering timestamps, and terminates when either
  4377. input reaches end of stream. This will cause problems if your encoding
  4378. pipeline drops frames. If you're trying to apply an image as an
  4379. overlay to a video stream, consider the @var{overlay} filter instead.
  4380. @section amplify
  4381. Amplify differences between current pixel and pixels of adjacent frames in
  4382. same pixel location.
  4383. This filter accepts the following options:
  4384. @table @option
  4385. @item radius
  4386. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4387. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4388. @item factor
  4389. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4390. @item threshold
  4391. Set threshold for difference amplification. Any difference greater or equal to
  4392. this value will not alter source pixel. Default is 10.
  4393. Allowed range is from 0 to 65535.
  4394. @item tolerance
  4395. Set tolerance for difference amplification. Any difference lower to
  4396. this value will not alter source pixel. Default is 0.
  4397. Allowed range is from 0 to 65535.
  4398. @item low
  4399. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4400. This option controls maximum possible value that will decrease source pixel value.
  4401. @item high
  4402. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4403. This option controls maximum possible value that will increase source pixel value.
  4404. @item planes
  4405. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4406. @end table
  4407. @section ass
  4408. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4409. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4410. Substation Alpha) subtitles files.
  4411. This filter accepts the following option in addition to the common options from
  4412. the @ref{subtitles} filter:
  4413. @table @option
  4414. @item shaping
  4415. Set the shaping engine
  4416. Available values are:
  4417. @table @samp
  4418. @item auto
  4419. The default libass shaping engine, which is the best available.
  4420. @item simple
  4421. Fast, font-agnostic shaper that can do only substitutions
  4422. @item complex
  4423. Slower shaper using OpenType for substitutions and positioning
  4424. @end table
  4425. The default is @code{auto}.
  4426. @end table
  4427. @section atadenoise
  4428. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4429. The filter accepts the following options:
  4430. @table @option
  4431. @item 0a
  4432. Set threshold A for 1st plane. Default is 0.02.
  4433. Valid range is 0 to 0.3.
  4434. @item 0b
  4435. Set threshold B for 1st plane. Default is 0.04.
  4436. Valid range is 0 to 5.
  4437. @item 1a
  4438. Set threshold A for 2nd plane. Default is 0.02.
  4439. Valid range is 0 to 0.3.
  4440. @item 1b
  4441. Set threshold B for 2nd plane. Default is 0.04.
  4442. Valid range is 0 to 5.
  4443. @item 2a
  4444. Set threshold A for 3rd plane. Default is 0.02.
  4445. Valid range is 0 to 0.3.
  4446. @item 2b
  4447. Set threshold B for 3rd plane. Default is 0.04.
  4448. Valid range is 0 to 5.
  4449. Threshold A is designed to react on abrupt changes in the input signal and
  4450. threshold B is designed to react on continuous changes in the input signal.
  4451. @item s
  4452. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4453. number in range [5, 129].
  4454. @item p
  4455. Set what planes of frame filter will use for averaging. Default is all.
  4456. @end table
  4457. @section avgblur
  4458. Apply average blur filter.
  4459. The filter accepts the following options:
  4460. @table @option
  4461. @item sizeX
  4462. Set horizontal radius size.
  4463. @item planes
  4464. Set which planes to filter. By default all planes are filtered.
  4465. @item sizeY
  4466. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4467. Default is @code{0}.
  4468. @end table
  4469. @section bbox
  4470. Compute the bounding box for the non-black pixels in the input frame
  4471. luminance plane.
  4472. This filter computes the bounding box containing all the pixels with a
  4473. luminance value greater than the minimum allowed value.
  4474. The parameters describing the bounding box are printed on the filter
  4475. log.
  4476. The filter accepts the following option:
  4477. @table @option
  4478. @item min_val
  4479. Set the minimal luminance value. Default is @code{16}.
  4480. @end table
  4481. @section bitplanenoise
  4482. Show and measure bit plane noise.
  4483. The filter accepts the following options:
  4484. @table @option
  4485. @item bitplane
  4486. Set which plane to analyze. Default is @code{1}.
  4487. @item filter
  4488. Filter out noisy pixels from @code{bitplane} set above.
  4489. Default is disabled.
  4490. @end table
  4491. @section blackdetect
  4492. Detect video intervals that are (almost) completely black. Can be
  4493. useful to detect chapter transitions, commercials, or invalid
  4494. recordings. Output lines contains the time for the start, end and
  4495. duration of the detected black interval expressed in seconds.
  4496. In order to display the output lines, you need to set the loglevel at
  4497. least to the AV_LOG_INFO value.
  4498. The filter accepts the following options:
  4499. @table @option
  4500. @item black_min_duration, d
  4501. Set the minimum detected black duration expressed in seconds. It must
  4502. be a non-negative floating point number.
  4503. Default value is 2.0.
  4504. @item picture_black_ratio_th, pic_th
  4505. Set the threshold for considering a picture "black".
  4506. Express the minimum value for the ratio:
  4507. @example
  4508. @var{nb_black_pixels} / @var{nb_pixels}
  4509. @end example
  4510. for which a picture is considered black.
  4511. Default value is 0.98.
  4512. @item pixel_black_th, pix_th
  4513. Set the threshold for considering a pixel "black".
  4514. The threshold expresses the maximum pixel luminance value for which a
  4515. pixel is considered "black". The provided value is scaled according to
  4516. the following equation:
  4517. @example
  4518. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4519. @end example
  4520. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4521. the input video format, the range is [0-255] for YUV full-range
  4522. formats and [16-235] for YUV non full-range formats.
  4523. Default value is 0.10.
  4524. @end table
  4525. The following example sets the maximum pixel threshold to the minimum
  4526. value, and detects only black intervals of 2 or more seconds:
  4527. @example
  4528. blackdetect=d=2:pix_th=0.00
  4529. @end example
  4530. @section blackframe
  4531. Detect frames that are (almost) completely black. Can be useful to
  4532. detect chapter transitions or commercials. Output lines consist of
  4533. the frame number of the detected frame, the percentage of blackness,
  4534. the position in the file if known or -1 and the timestamp in seconds.
  4535. In order to display the output lines, you need to set the loglevel at
  4536. least to the AV_LOG_INFO value.
  4537. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4538. The value represents the percentage of pixels in the picture that
  4539. are below the threshold value.
  4540. It accepts the following parameters:
  4541. @table @option
  4542. @item amount
  4543. The percentage of the pixels that have to be below the threshold; it defaults to
  4544. @code{98}.
  4545. @item threshold, thresh
  4546. The threshold below which a pixel value is considered black; it defaults to
  4547. @code{32}.
  4548. @end table
  4549. @section blend, tblend
  4550. Blend two video frames into each other.
  4551. The @code{blend} filter takes two input streams and outputs one
  4552. stream, the first input is the "top" layer and second input is
  4553. "bottom" layer. By default, the output terminates when the longest input terminates.
  4554. The @code{tblend} (time blend) filter takes two consecutive frames
  4555. from one single stream, and outputs the result obtained by blending
  4556. the new frame on top of the old frame.
  4557. A description of the accepted options follows.
  4558. @table @option
  4559. @item c0_mode
  4560. @item c1_mode
  4561. @item c2_mode
  4562. @item c3_mode
  4563. @item all_mode
  4564. Set blend mode for specific pixel component or all pixel components in case
  4565. of @var{all_mode}. Default value is @code{normal}.
  4566. Available values for component modes are:
  4567. @table @samp
  4568. @item addition
  4569. @item grainmerge
  4570. @item and
  4571. @item average
  4572. @item burn
  4573. @item darken
  4574. @item difference
  4575. @item grainextract
  4576. @item divide
  4577. @item dodge
  4578. @item freeze
  4579. @item exclusion
  4580. @item extremity
  4581. @item glow
  4582. @item hardlight
  4583. @item hardmix
  4584. @item heat
  4585. @item lighten
  4586. @item linearlight
  4587. @item multiply
  4588. @item multiply128
  4589. @item negation
  4590. @item normal
  4591. @item or
  4592. @item overlay
  4593. @item phoenix
  4594. @item pinlight
  4595. @item reflect
  4596. @item screen
  4597. @item softlight
  4598. @item subtract
  4599. @item vividlight
  4600. @item xor
  4601. @end table
  4602. @item c0_opacity
  4603. @item c1_opacity
  4604. @item c2_opacity
  4605. @item c3_opacity
  4606. @item all_opacity
  4607. Set blend opacity for specific pixel component or all pixel components in case
  4608. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4609. @item c0_expr
  4610. @item c1_expr
  4611. @item c2_expr
  4612. @item c3_expr
  4613. @item all_expr
  4614. Set blend expression for specific pixel component or all pixel components in case
  4615. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4616. The expressions can use the following variables:
  4617. @table @option
  4618. @item N
  4619. The sequential number of the filtered frame, starting from @code{0}.
  4620. @item X
  4621. @item Y
  4622. the coordinates of the current sample
  4623. @item W
  4624. @item H
  4625. the width and height of currently filtered plane
  4626. @item SW
  4627. @item SH
  4628. Width and height scale for the plane being filtered. It is the
  4629. ratio between the dimensions of the current plane to the luma plane,
  4630. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4631. the luma plane and @code{0.5,0.5} for the chroma planes.
  4632. @item T
  4633. Time of the current frame, expressed in seconds.
  4634. @item TOP, A
  4635. Value of pixel component at current location for first video frame (top layer).
  4636. @item BOTTOM, B
  4637. Value of pixel component at current location for second video frame (bottom layer).
  4638. @end table
  4639. @end table
  4640. The @code{blend} filter also supports the @ref{framesync} options.
  4641. @subsection Examples
  4642. @itemize
  4643. @item
  4644. Apply transition from bottom layer to top layer in first 10 seconds:
  4645. @example
  4646. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4647. @end example
  4648. @item
  4649. Apply linear horizontal transition from top layer to bottom layer:
  4650. @example
  4651. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4652. @end example
  4653. @item
  4654. Apply 1x1 checkerboard effect:
  4655. @example
  4656. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4657. @end example
  4658. @item
  4659. Apply uncover left effect:
  4660. @example
  4661. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4662. @end example
  4663. @item
  4664. Apply uncover down effect:
  4665. @example
  4666. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4667. @end example
  4668. @item
  4669. Apply uncover up-left effect:
  4670. @example
  4671. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4672. @end example
  4673. @item
  4674. Split diagonally video and shows top and bottom layer on each side:
  4675. @example
  4676. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4677. @end example
  4678. @item
  4679. Display differences between the current and the previous frame:
  4680. @example
  4681. tblend=all_mode=grainextract
  4682. @end example
  4683. @end itemize
  4684. @section bm3d
  4685. Denoise frames using Block-Matching 3D algorithm.
  4686. The filter accepts the following options.
  4687. @table @option
  4688. @item sigma
  4689. Set denoising strength. Default value is 1.
  4690. Allowed range is from 0 to 999.9.
  4691. The denoising algorithm is very sensitive to sigma, so adjust it
  4692. according to the source.
  4693. @item block
  4694. Set local patch size. This sets dimensions in 2D.
  4695. @item bstep
  4696. Set sliding step for processing blocks. Default value is 4.
  4697. Allowed range is from 1 to 64.
  4698. Smaller values allows processing more reference blocks and is slower.
  4699. @item group
  4700. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4701. When set to 1, no block matching is done. Larger values allows more blocks
  4702. in single group.
  4703. Allowed range is from 1 to 256.
  4704. @item range
  4705. Set radius for search block matching. Default is 9.
  4706. Allowed range is from 1 to INT32_MAX.
  4707. @item mstep
  4708. Set step between two search locations for block matching. Default is 1.
  4709. Allowed range is from 1 to 64. Smaller is slower.
  4710. @item thmse
  4711. Set threshold of mean square error for block matching. Valid range is 0 to
  4712. INT32_MAX.
  4713. @item hdthr
  4714. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4715. Larger values results in stronger hard-thresholding filtering in frequency
  4716. domain.
  4717. @item estim
  4718. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4719. Default is @code{basic}.
  4720. @item ref
  4721. If enabled, filter will use 2nd stream for block matching.
  4722. Default is disabled for @code{basic} value of @var{estim} option,
  4723. and always enabled if value of @var{estim} is @code{final}.
  4724. @item planes
  4725. Set planes to filter. Default is all available except alpha.
  4726. @end table
  4727. @subsection Examples
  4728. @itemize
  4729. @item
  4730. Basic filtering with bm3d:
  4731. @example
  4732. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4733. @end example
  4734. @item
  4735. Same as above, but filtering only luma:
  4736. @example
  4737. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4738. @end example
  4739. @item
  4740. Same as above, but with both estimation modes:
  4741. @example
  4742. 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
  4743. @end example
  4744. @item
  4745. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4746. @example
  4747. 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
  4748. @end example
  4749. @end itemize
  4750. @section boxblur
  4751. Apply a boxblur algorithm to the input video.
  4752. It accepts the following parameters:
  4753. @table @option
  4754. @item luma_radius, lr
  4755. @item luma_power, lp
  4756. @item chroma_radius, cr
  4757. @item chroma_power, cp
  4758. @item alpha_radius, ar
  4759. @item alpha_power, ap
  4760. @end table
  4761. A description of the accepted options follows.
  4762. @table @option
  4763. @item luma_radius, lr
  4764. @item chroma_radius, cr
  4765. @item alpha_radius, ar
  4766. Set an expression for the box radius in pixels used for blurring the
  4767. corresponding input plane.
  4768. The radius value must be a non-negative number, and must not be
  4769. greater than the value of the expression @code{min(w,h)/2} for the
  4770. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4771. planes.
  4772. Default value for @option{luma_radius} is "2". If not specified,
  4773. @option{chroma_radius} and @option{alpha_radius} default to the
  4774. corresponding value set for @option{luma_radius}.
  4775. The expressions can contain the following constants:
  4776. @table @option
  4777. @item w
  4778. @item h
  4779. The input width and height in pixels.
  4780. @item cw
  4781. @item ch
  4782. The input chroma image width and height in pixels.
  4783. @item hsub
  4784. @item vsub
  4785. The horizontal and vertical chroma subsample values. For example, for the
  4786. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4787. @end table
  4788. @item luma_power, lp
  4789. @item chroma_power, cp
  4790. @item alpha_power, ap
  4791. Specify how many times the boxblur filter is applied to the
  4792. corresponding plane.
  4793. Default value for @option{luma_power} is 2. If not specified,
  4794. @option{chroma_power} and @option{alpha_power} default to the
  4795. corresponding value set for @option{luma_power}.
  4796. A value of 0 will disable the effect.
  4797. @end table
  4798. @subsection Examples
  4799. @itemize
  4800. @item
  4801. Apply a boxblur filter with the luma, chroma, and alpha radii
  4802. set to 2:
  4803. @example
  4804. boxblur=luma_radius=2:luma_power=1
  4805. boxblur=2:1
  4806. @end example
  4807. @item
  4808. Set the luma radius to 2, and alpha and chroma radius to 0:
  4809. @example
  4810. boxblur=2:1:cr=0:ar=0
  4811. @end example
  4812. @item
  4813. Set the luma and chroma radii to a fraction of the video dimension:
  4814. @example
  4815. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4816. @end example
  4817. @end itemize
  4818. @section bwdif
  4819. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4820. Deinterlacing Filter").
  4821. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4822. interpolation algorithms.
  4823. It accepts the following parameters:
  4824. @table @option
  4825. @item mode
  4826. The interlacing mode to adopt. It accepts one of the following values:
  4827. @table @option
  4828. @item 0, send_frame
  4829. Output one frame for each frame.
  4830. @item 1, send_field
  4831. Output one frame for each field.
  4832. @end table
  4833. The default value is @code{send_field}.
  4834. @item parity
  4835. The picture field parity assumed for the input interlaced video. It accepts one
  4836. of the following values:
  4837. @table @option
  4838. @item 0, tff
  4839. Assume the top field is first.
  4840. @item 1, bff
  4841. Assume the bottom field is first.
  4842. @item -1, auto
  4843. Enable automatic detection of field parity.
  4844. @end table
  4845. The default value is @code{auto}.
  4846. If the interlacing is unknown or the decoder does not export this information,
  4847. top field first will be assumed.
  4848. @item deint
  4849. Specify which frames to deinterlace. Accept one of the following
  4850. values:
  4851. @table @option
  4852. @item 0, all
  4853. Deinterlace all frames.
  4854. @item 1, interlaced
  4855. Only deinterlace frames marked as interlaced.
  4856. @end table
  4857. The default value is @code{all}.
  4858. @end table
  4859. @section chromahold
  4860. Remove all color information for all colors except for certain one.
  4861. The filter accepts the following options:
  4862. @table @option
  4863. @item color
  4864. The color which will not be replaced with neutral chroma.
  4865. @item similarity
  4866. Similarity percentage with the above color.
  4867. 0.01 matches only the exact key color, while 1.0 matches everything.
  4868. @item yuv
  4869. Signals that the color passed is already in YUV instead of RGB.
  4870. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4871. This can be used to pass exact YUV values as hexadecimal numbers.
  4872. @end table
  4873. @section chromakey
  4874. YUV colorspace color/chroma keying.
  4875. The filter accepts the following options:
  4876. @table @option
  4877. @item color
  4878. The color which will be replaced with transparency.
  4879. @item similarity
  4880. Similarity percentage with the key color.
  4881. 0.01 matches only the exact key color, while 1.0 matches everything.
  4882. @item blend
  4883. Blend percentage.
  4884. 0.0 makes pixels either fully transparent, or not transparent at all.
  4885. Higher values result in semi-transparent pixels, with a higher transparency
  4886. the more similar the pixels color is to the key color.
  4887. @item yuv
  4888. Signals that the color passed is already in YUV instead of RGB.
  4889. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4890. This can be used to pass exact YUV values as hexadecimal numbers.
  4891. @end table
  4892. @subsection Examples
  4893. @itemize
  4894. @item
  4895. Make every green pixel in the input image transparent:
  4896. @example
  4897. ffmpeg -i input.png -vf chromakey=green out.png
  4898. @end example
  4899. @item
  4900. Overlay a greenscreen-video on top of a static black background.
  4901. @example
  4902. 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
  4903. @end example
  4904. @end itemize
  4905. @section chromashift
  4906. Shift chroma pixels horizontally and/or vertically.
  4907. The filter accepts the following options:
  4908. @table @option
  4909. @item cbh
  4910. Set amount to shift chroma-blue horizontally.
  4911. @item cbv
  4912. Set amount to shift chroma-blue vertically.
  4913. @item crh
  4914. Set amount to shift chroma-red horizontally.
  4915. @item crv
  4916. Set amount to shift chroma-red vertically.
  4917. @item edge
  4918. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4919. @end table
  4920. @section ciescope
  4921. Display CIE color diagram with pixels overlaid onto it.
  4922. The filter accepts the following options:
  4923. @table @option
  4924. @item system
  4925. Set color system.
  4926. @table @samp
  4927. @item ntsc, 470m
  4928. @item ebu, 470bg
  4929. @item smpte
  4930. @item 240m
  4931. @item apple
  4932. @item widergb
  4933. @item cie1931
  4934. @item rec709, hdtv
  4935. @item uhdtv, rec2020
  4936. @end table
  4937. @item cie
  4938. Set CIE system.
  4939. @table @samp
  4940. @item xyy
  4941. @item ucs
  4942. @item luv
  4943. @end table
  4944. @item gamuts
  4945. Set what gamuts to draw.
  4946. See @code{system} option for available values.
  4947. @item size, s
  4948. Set ciescope size, by default set to 512.
  4949. @item intensity, i
  4950. Set intensity used to map input pixel values to CIE diagram.
  4951. @item contrast
  4952. Set contrast used to draw tongue colors that are out of active color system gamut.
  4953. @item corrgamma
  4954. Correct gamma displayed on scope, by default enabled.
  4955. @item showwhite
  4956. Show white point on CIE diagram, by default disabled.
  4957. @item gamma
  4958. Set input gamma. Used only with XYZ input color space.
  4959. @end table
  4960. @section codecview
  4961. Visualize information exported by some codecs.
  4962. Some codecs can export information through frames using side-data or other
  4963. means. For example, some MPEG based codecs export motion vectors through the
  4964. @var{export_mvs} flag in the codec @option{flags2} option.
  4965. The filter accepts the following option:
  4966. @table @option
  4967. @item mv
  4968. Set motion vectors to visualize.
  4969. Available flags for @var{mv} are:
  4970. @table @samp
  4971. @item pf
  4972. forward predicted MVs of P-frames
  4973. @item bf
  4974. forward predicted MVs of B-frames
  4975. @item bb
  4976. backward predicted MVs of B-frames
  4977. @end table
  4978. @item qp
  4979. Display quantization parameters using the chroma planes.
  4980. @item mv_type, mvt
  4981. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4982. Available flags for @var{mv_type} are:
  4983. @table @samp
  4984. @item fp
  4985. forward predicted MVs
  4986. @item bp
  4987. backward predicted MVs
  4988. @end table
  4989. @item frame_type, ft
  4990. Set frame type to visualize motion vectors of.
  4991. Available flags for @var{frame_type} are:
  4992. @table @samp
  4993. @item if
  4994. intra-coded frames (I-frames)
  4995. @item pf
  4996. predicted frames (P-frames)
  4997. @item bf
  4998. bi-directionally predicted frames (B-frames)
  4999. @end table
  5000. @end table
  5001. @subsection Examples
  5002. @itemize
  5003. @item
  5004. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5005. @example
  5006. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5007. @end example
  5008. @item
  5009. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5010. @example
  5011. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5012. @end example
  5013. @end itemize
  5014. @section colorbalance
  5015. Modify intensity of primary colors (red, green and blue) of input frames.
  5016. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5017. regions for the red-cyan, green-magenta or blue-yellow balance.
  5018. A positive adjustment value shifts the balance towards the primary color, a negative
  5019. value towards the complementary color.
  5020. The filter accepts the following options:
  5021. @table @option
  5022. @item rs
  5023. @item gs
  5024. @item bs
  5025. Adjust red, green and blue shadows (darkest pixels).
  5026. @item rm
  5027. @item gm
  5028. @item bm
  5029. Adjust red, green and blue midtones (medium pixels).
  5030. @item rh
  5031. @item gh
  5032. @item bh
  5033. Adjust red, green and blue highlights (brightest pixels).
  5034. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5035. @end table
  5036. @subsection Examples
  5037. @itemize
  5038. @item
  5039. Add red color cast to shadows:
  5040. @example
  5041. colorbalance=rs=.3
  5042. @end example
  5043. @end itemize
  5044. @section colorkey
  5045. RGB colorspace color keying.
  5046. The filter accepts the following options:
  5047. @table @option
  5048. @item color
  5049. The color which will be replaced with transparency.
  5050. @item similarity
  5051. Similarity percentage with the key color.
  5052. 0.01 matches only the exact key color, while 1.0 matches everything.
  5053. @item blend
  5054. Blend percentage.
  5055. 0.0 makes pixels either fully transparent, or not transparent at all.
  5056. Higher values result in semi-transparent pixels, with a higher transparency
  5057. the more similar the pixels color is to the key color.
  5058. @end table
  5059. @subsection Examples
  5060. @itemize
  5061. @item
  5062. Make every green pixel in the input image transparent:
  5063. @example
  5064. ffmpeg -i input.png -vf colorkey=green out.png
  5065. @end example
  5066. @item
  5067. Overlay a greenscreen-video on top of a static background image.
  5068. @example
  5069. 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
  5070. @end example
  5071. @end itemize
  5072. @section colorlevels
  5073. Adjust video input frames using levels.
  5074. The filter accepts the following options:
  5075. @table @option
  5076. @item rimin
  5077. @item gimin
  5078. @item bimin
  5079. @item aimin
  5080. Adjust red, green, blue and alpha input black point.
  5081. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5082. @item rimax
  5083. @item gimax
  5084. @item bimax
  5085. @item aimax
  5086. Adjust red, green, blue and alpha input white point.
  5087. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5088. Input levels are used to lighten highlights (bright tones), darken shadows
  5089. (dark tones), change the balance of bright and dark tones.
  5090. @item romin
  5091. @item gomin
  5092. @item bomin
  5093. @item aomin
  5094. Adjust red, green, blue and alpha output black point.
  5095. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5096. @item romax
  5097. @item gomax
  5098. @item bomax
  5099. @item aomax
  5100. Adjust red, green, blue and alpha output white point.
  5101. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5102. Output levels allows manual selection of a constrained output level range.
  5103. @end table
  5104. @subsection Examples
  5105. @itemize
  5106. @item
  5107. Make video output darker:
  5108. @example
  5109. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5110. @end example
  5111. @item
  5112. Increase contrast:
  5113. @example
  5114. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5115. @end example
  5116. @item
  5117. Make video output lighter:
  5118. @example
  5119. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5120. @end example
  5121. @item
  5122. Increase brightness:
  5123. @example
  5124. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5125. @end example
  5126. @end itemize
  5127. @section colorchannelmixer
  5128. Adjust video input frames by re-mixing color channels.
  5129. This filter modifies a color channel by adding the values associated to
  5130. the other channels of the same pixels. For example if the value to
  5131. modify is red, the output value will be:
  5132. @example
  5133. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5134. @end example
  5135. The filter accepts the following options:
  5136. @table @option
  5137. @item rr
  5138. @item rg
  5139. @item rb
  5140. @item ra
  5141. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5142. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5143. @item gr
  5144. @item gg
  5145. @item gb
  5146. @item ga
  5147. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5148. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5149. @item br
  5150. @item bg
  5151. @item bb
  5152. @item ba
  5153. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5154. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5155. @item ar
  5156. @item ag
  5157. @item ab
  5158. @item aa
  5159. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5160. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5161. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5162. @end table
  5163. @subsection Examples
  5164. @itemize
  5165. @item
  5166. Convert source to grayscale:
  5167. @example
  5168. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5169. @end example
  5170. @item
  5171. Simulate sepia tones:
  5172. @example
  5173. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5174. @end example
  5175. @end itemize
  5176. @section colormatrix
  5177. Convert color matrix.
  5178. The filter accepts the following options:
  5179. @table @option
  5180. @item src
  5181. @item dst
  5182. Specify the source and destination color matrix. Both values must be
  5183. specified.
  5184. The accepted values are:
  5185. @table @samp
  5186. @item bt709
  5187. BT.709
  5188. @item fcc
  5189. FCC
  5190. @item bt601
  5191. BT.601
  5192. @item bt470
  5193. BT.470
  5194. @item bt470bg
  5195. BT.470BG
  5196. @item smpte170m
  5197. SMPTE-170M
  5198. @item smpte240m
  5199. SMPTE-240M
  5200. @item bt2020
  5201. BT.2020
  5202. @end table
  5203. @end table
  5204. For example to convert from BT.601 to SMPTE-240M, use the command:
  5205. @example
  5206. colormatrix=bt601:smpte240m
  5207. @end example
  5208. @section colorspace
  5209. Convert colorspace, transfer characteristics or color primaries.
  5210. Input video needs to have an even size.
  5211. The filter accepts the following options:
  5212. @table @option
  5213. @anchor{all}
  5214. @item all
  5215. Specify all color properties at once.
  5216. The accepted values are:
  5217. @table @samp
  5218. @item bt470m
  5219. BT.470M
  5220. @item bt470bg
  5221. BT.470BG
  5222. @item bt601-6-525
  5223. BT.601-6 525
  5224. @item bt601-6-625
  5225. BT.601-6 625
  5226. @item bt709
  5227. BT.709
  5228. @item smpte170m
  5229. SMPTE-170M
  5230. @item smpte240m
  5231. SMPTE-240M
  5232. @item bt2020
  5233. BT.2020
  5234. @end table
  5235. @anchor{space}
  5236. @item space
  5237. Specify output colorspace.
  5238. The accepted values are:
  5239. @table @samp
  5240. @item bt709
  5241. BT.709
  5242. @item fcc
  5243. FCC
  5244. @item bt470bg
  5245. BT.470BG or BT.601-6 625
  5246. @item smpte170m
  5247. SMPTE-170M or BT.601-6 525
  5248. @item smpte240m
  5249. SMPTE-240M
  5250. @item ycgco
  5251. YCgCo
  5252. @item bt2020ncl
  5253. BT.2020 with non-constant luminance
  5254. @end table
  5255. @anchor{trc}
  5256. @item trc
  5257. Specify output transfer characteristics.
  5258. The accepted values are:
  5259. @table @samp
  5260. @item bt709
  5261. BT.709
  5262. @item bt470m
  5263. BT.470M
  5264. @item bt470bg
  5265. BT.470BG
  5266. @item gamma22
  5267. Constant gamma of 2.2
  5268. @item gamma28
  5269. Constant gamma of 2.8
  5270. @item smpte170m
  5271. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5272. @item smpte240m
  5273. SMPTE-240M
  5274. @item srgb
  5275. SRGB
  5276. @item iec61966-2-1
  5277. iec61966-2-1
  5278. @item iec61966-2-4
  5279. iec61966-2-4
  5280. @item xvycc
  5281. xvycc
  5282. @item bt2020-10
  5283. BT.2020 for 10-bits content
  5284. @item bt2020-12
  5285. BT.2020 for 12-bits content
  5286. @end table
  5287. @anchor{primaries}
  5288. @item primaries
  5289. Specify output color primaries.
  5290. The accepted values are:
  5291. @table @samp
  5292. @item bt709
  5293. BT.709
  5294. @item bt470m
  5295. BT.470M
  5296. @item bt470bg
  5297. BT.470BG or BT.601-6 625
  5298. @item smpte170m
  5299. SMPTE-170M or BT.601-6 525
  5300. @item smpte240m
  5301. SMPTE-240M
  5302. @item film
  5303. film
  5304. @item smpte431
  5305. SMPTE-431
  5306. @item smpte432
  5307. SMPTE-432
  5308. @item bt2020
  5309. BT.2020
  5310. @item jedec-p22
  5311. JEDEC P22 phosphors
  5312. @end table
  5313. @anchor{range}
  5314. @item range
  5315. Specify output color range.
  5316. The accepted values are:
  5317. @table @samp
  5318. @item tv
  5319. TV (restricted) range
  5320. @item mpeg
  5321. MPEG (restricted) range
  5322. @item pc
  5323. PC (full) range
  5324. @item jpeg
  5325. JPEG (full) range
  5326. @end table
  5327. @item format
  5328. Specify output color format.
  5329. The accepted values are:
  5330. @table @samp
  5331. @item yuv420p
  5332. YUV 4:2:0 planar 8-bits
  5333. @item yuv420p10
  5334. YUV 4:2:0 planar 10-bits
  5335. @item yuv420p12
  5336. YUV 4:2:0 planar 12-bits
  5337. @item yuv422p
  5338. YUV 4:2:2 planar 8-bits
  5339. @item yuv422p10
  5340. YUV 4:2:2 planar 10-bits
  5341. @item yuv422p12
  5342. YUV 4:2:2 planar 12-bits
  5343. @item yuv444p
  5344. YUV 4:4:4 planar 8-bits
  5345. @item yuv444p10
  5346. YUV 4:4:4 planar 10-bits
  5347. @item yuv444p12
  5348. YUV 4:4:4 planar 12-bits
  5349. @end table
  5350. @item fast
  5351. Do a fast conversion, which skips gamma/primary correction. This will take
  5352. significantly less CPU, but will be mathematically incorrect. To get output
  5353. compatible with that produced by the colormatrix filter, use fast=1.
  5354. @item dither
  5355. Specify dithering mode.
  5356. The accepted values are:
  5357. @table @samp
  5358. @item none
  5359. No dithering
  5360. @item fsb
  5361. Floyd-Steinberg dithering
  5362. @end table
  5363. @item wpadapt
  5364. Whitepoint adaptation mode.
  5365. The accepted values are:
  5366. @table @samp
  5367. @item bradford
  5368. Bradford whitepoint adaptation
  5369. @item vonkries
  5370. von Kries whitepoint adaptation
  5371. @item identity
  5372. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5373. @end table
  5374. @item iall
  5375. Override all input properties at once. Same accepted values as @ref{all}.
  5376. @item ispace
  5377. Override input colorspace. Same accepted values as @ref{space}.
  5378. @item iprimaries
  5379. Override input color primaries. Same accepted values as @ref{primaries}.
  5380. @item itrc
  5381. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5382. @item irange
  5383. Override input color range. Same accepted values as @ref{range}.
  5384. @end table
  5385. The filter converts the transfer characteristics, color space and color
  5386. primaries to the specified user values. The output value, if not specified,
  5387. is set to a default value based on the "all" property. If that property is
  5388. also not specified, the filter will log an error. The output color range and
  5389. format default to the same value as the input color range and format. The
  5390. input transfer characteristics, color space, color primaries and color range
  5391. should be set on the input data. If any of these are missing, the filter will
  5392. log an error and no conversion will take place.
  5393. For example to convert the input to SMPTE-240M, use the command:
  5394. @example
  5395. colorspace=smpte240m
  5396. @end example
  5397. @section convolution
  5398. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5399. The filter accepts the following options:
  5400. @table @option
  5401. @item 0m
  5402. @item 1m
  5403. @item 2m
  5404. @item 3m
  5405. Set matrix for each plane.
  5406. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5407. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5408. @item 0rdiv
  5409. @item 1rdiv
  5410. @item 2rdiv
  5411. @item 3rdiv
  5412. Set multiplier for calculated value for each plane.
  5413. If unset or 0, it will be sum of all matrix elements.
  5414. @item 0bias
  5415. @item 1bias
  5416. @item 2bias
  5417. @item 3bias
  5418. Set bias for each plane. This value is added to the result of the multiplication.
  5419. Useful for making the overall image brighter or darker. Default is 0.0.
  5420. @item 0mode
  5421. @item 1mode
  5422. @item 2mode
  5423. @item 3mode
  5424. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5425. Default is @var{square}.
  5426. @end table
  5427. @subsection Examples
  5428. @itemize
  5429. @item
  5430. Apply sharpen:
  5431. @example
  5432. 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"
  5433. @end example
  5434. @item
  5435. Apply blur:
  5436. @example
  5437. 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"
  5438. @end example
  5439. @item
  5440. Apply edge enhance:
  5441. @example
  5442. 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"
  5443. @end example
  5444. @item
  5445. Apply edge detect:
  5446. @example
  5447. 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"
  5448. @end example
  5449. @item
  5450. Apply laplacian edge detector which includes diagonals:
  5451. @example
  5452. 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"
  5453. @end example
  5454. @item
  5455. Apply emboss:
  5456. @example
  5457. 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"
  5458. @end example
  5459. @end itemize
  5460. @section convolve
  5461. Apply 2D convolution of video stream in frequency domain using second stream
  5462. as impulse.
  5463. The filter accepts the following options:
  5464. @table @option
  5465. @item planes
  5466. Set which planes to process.
  5467. @item impulse
  5468. Set which impulse video frames will be processed, can be @var{first}
  5469. or @var{all}. Default is @var{all}.
  5470. @end table
  5471. The @code{convolve} filter also supports the @ref{framesync} options.
  5472. @section copy
  5473. Copy the input video source unchanged to the output. This is mainly useful for
  5474. testing purposes.
  5475. @anchor{coreimage}
  5476. @section coreimage
  5477. Video filtering on GPU using Apple's CoreImage API on OSX.
  5478. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5479. processed by video hardware. However, software-based OpenGL implementations
  5480. exist which means there is no guarantee for hardware processing. It depends on
  5481. the respective OSX.
  5482. There are many filters and image generators provided by Apple that come with a
  5483. large variety of options. The filter has to be referenced by its name along
  5484. with its options.
  5485. The coreimage filter accepts the following options:
  5486. @table @option
  5487. @item list_filters
  5488. List all available filters and generators along with all their respective
  5489. options as well as possible minimum and maximum values along with the default
  5490. values.
  5491. @example
  5492. list_filters=true
  5493. @end example
  5494. @item filter
  5495. Specify all filters by their respective name and options.
  5496. Use @var{list_filters} to determine all valid filter names and options.
  5497. Numerical options are specified by a float value and are automatically clamped
  5498. to their respective value range. Vector and color options have to be specified
  5499. by a list of space separated float values. Character escaping has to be done.
  5500. A special option name @code{default} is available to use default options for a
  5501. filter.
  5502. It is required to specify either @code{default} or at least one of the filter options.
  5503. All omitted options are used with their default values.
  5504. The syntax of the filter string is as follows:
  5505. @example
  5506. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5507. @end example
  5508. @item output_rect
  5509. Specify a rectangle where the output of the filter chain is copied into the
  5510. input image. It is given by a list of space separated float values:
  5511. @example
  5512. output_rect=x\ y\ width\ height
  5513. @end example
  5514. If not given, the output rectangle equals the dimensions of the input image.
  5515. The output rectangle is automatically cropped at the borders of the input
  5516. image. Negative values are valid for each component.
  5517. @example
  5518. output_rect=25\ 25\ 100\ 100
  5519. @end example
  5520. @end table
  5521. Several filters can be chained for successive processing without GPU-HOST
  5522. transfers allowing for fast processing of complex filter chains.
  5523. Currently, only filters with zero (generators) or exactly one (filters) input
  5524. image and one output image are supported. Also, transition filters are not yet
  5525. usable as intended.
  5526. Some filters generate output images with additional padding depending on the
  5527. respective filter kernel. The padding is automatically removed to ensure the
  5528. filter output has the same size as the input image.
  5529. For image generators, the size of the output image is determined by the
  5530. previous output image of the filter chain or the input image of the whole
  5531. filterchain, respectively. The generators do not use the pixel information of
  5532. this image to generate their output. However, the generated output is
  5533. blended onto this image, resulting in partial or complete coverage of the
  5534. output image.
  5535. The @ref{coreimagesrc} video source can be used for generating input images
  5536. which are directly fed into the filter chain. By using it, providing input
  5537. images by another video source or an input video is not required.
  5538. @subsection Examples
  5539. @itemize
  5540. @item
  5541. List all filters available:
  5542. @example
  5543. coreimage=list_filters=true
  5544. @end example
  5545. @item
  5546. Use the CIBoxBlur filter with default options to blur an image:
  5547. @example
  5548. coreimage=filter=CIBoxBlur@@default
  5549. @end example
  5550. @item
  5551. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5552. its center at 100x100 and a radius of 50 pixels:
  5553. @example
  5554. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5555. @end example
  5556. @item
  5557. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5558. given as complete and escaped command-line for Apple's standard bash shell:
  5559. @example
  5560. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5561. @end example
  5562. @end itemize
  5563. @section crop
  5564. Crop the input video to given dimensions.
  5565. It accepts the following parameters:
  5566. @table @option
  5567. @item w, out_w
  5568. The width of the output video. It defaults to @code{iw}.
  5569. This expression is evaluated only once during the filter
  5570. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5571. @item h, out_h
  5572. The height of the output video. It defaults to @code{ih}.
  5573. This expression is evaluated only once during the filter
  5574. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5575. @item x
  5576. The horizontal position, in the input video, of the left edge of the output
  5577. video. It defaults to @code{(in_w-out_w)/2}.
  5578. This expression is evaluated per-frame.
  5579. @item y
  5580. The vertical position, in the input video, of the top edge of the output video.
  5581. It defaults to @code{(in_h-out_h)/2}.
  5582. This expression is evaluated per-frame.
  5583. @item keep_aspect
  5584. If set to 1 will force the output display aspect ratio
  5585. to be the same of the input, by changing the output sample aspect
  5586. ratio. It defaults to 0.
  5587. @item exact
  5588. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5589. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5590. It defaults to 0.
  5591. @end table
  5592. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5593. expressions containing the following constants:
  5594. @table @option
  5595. @item x
  5596. @item y
  5597. The computed values for @var{x} and @var{y}. They are evaluated for
  5598. each new frame.
  5599. @item in_w
  5600. @item in_h
  5601. The input width and height.
  5602. @item iw
  5603. @item ih
  5604. These are the same as @var{in_w} and @var{in_h}.
  5605. @item out_w
  5606. @item out_h
  5607. The output (cropped) width and height.
  5608. @item ow
  5609. @item oh
  5610. These are the same as @var{out_w} and @var{out_h}.
  5611. @item a
  5612. same as @var{iw} / @var{ih}
  5613. @item sar
  5614. input sample aspect ratio
  5615. @item dar
  5616. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5617. @item hsub
  5618. @item vsub
  5619. horizontal and vertical chroma subsample values. For example for the
  5620. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5621. @item n
  5622. The number of the input frame, starting from 0.
  5623. @item pos
  5624. the position in the file of the input frame, NAN if unknown
  5625. @item t
  5626. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5627. @end table
  5628. The expression for @var{out_w} may depend on the value of @var{out_h},
  5629. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5630. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5631. evaluated after @var{out_w} and @var{out_h}.
  5632. The @var{x} and @var{y} parameters specify the expressions for the
  5633. position of the top-left corner of the output (non-cropped) area. They
  5634. are evaluated for each frame. If the evaluated value is not valid, it
  5635. is approximated to the nearest valid value.
  5636. The expression for @var{x} may depend on @var{y}, and the expression
  5637. for @var{y} may depend on @var{x}.
  5638. @subsection Examples
  5639. @itemize
  5640. @item
  5641. Crop area with size 100x100 at position (12,34).
  5642. @example
  5643. crop=100:100:12:34
  5644. @end example
  5645. Using named options, the example above becomes:
  5646. @example
  5647. crop=w=100:h=100:x=12:y=34
  5648. @end example
  5649. @item
  5650. Crop the central input area with size 100x100:
  5651. @example
  5652. crop=100:100
  5653. @end example
  5654. @item
  5655. Crop the central input area with size 2/3 of the input video:
  5656. @example
  5657. crop=2/3*in_w:2/3*in_h
  5658. @end example
  5659. @item
  5660. Crop the input video central square:
  5661. @example
  5662. crop=out_w=in_h
  5663. crop=in_h
  5664. @end example
  5665. @item
  5666. Delimit the rectangle with the top-left corner placed at position
  5667. 100:100 and the right-bottom corner corresponding to the right-bottom
  5668. corner of the input image.
  5669. @example
  5670. crop=in_w-100:in_h-100:100:100
  5671. @end example
  5672. @item
  5673. Crop 10 pixels from the left and right borders, and 20 pixels from
  5674. the top and bottom borders
  5675. @example
  5676. crop=in_w-2*10:in_h-2*20
  5677. @end example
  5678. @item
  5679. Keep only the bottom right quarter of the input image:
  5680. @example
  5681. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5682. @end example
  5683. @item
  5684. Crop height for getting Greek harmony:
  5685. @example
  5686. crop=in_w:1/PHI*in_w
  5687. @end example
  5688. @item
  5689. Apply trembling effect:
  5690. @example
  5691. 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)
  5692. @end example
  5693. @item
  5694. Apply erratic camera effect depending on timestamp:
  5695. @example
  5696. 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)"
  5697. @end example
  5698. @item
  5699. Set x depending on the value of y:
  5700. @example
  5701. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5702. @end example
  5703. @end itemize
  5704. @subsection Commands
  5705. This filter supports the following commands:
  5706. @table @option
  5707. @item w, out_w
  5708. @item h, out_h
  5709. @item x
  5710. @item y
  5711. Set width/height of the output video and the horizontal/vertical position
  5712. in the input video.
  5713. The command accepts the same syntax of the corresponding option.
  5714. If the specified expression is not valid, it is kept at its current
  5715. value.
  5716. @end table
  5717. @section cropdetect
  5718. Auto-detect the crop size.
  5719. It calculates the necessary cropping parameters and prints the
  5720. recommended parameters via the logging system. The detected dimensions
  5721. correspond to the non-black area of the input video.
  5722. It accepts the following parameters:
  5723. @table @option
  5724. @item limit
  5725. Set higher black value threshold, which can be optionally specified
  5726. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5727. value greater to the set value is considered non-black. It defaults to 24.
  5728. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5729. on the bitdepth of the pixel format.
  5730. @item round
  5731. The value which the width/height should be divisible by. It defaults to
  5732. 16. The offset is automatically adjusted to center the video. Use 2 to
  5733. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5734. encoding to most video codecs.
  5735. @item reset_count, reset
  5736. Set the counter that determines after how many frames cropdetect will
  5737. reset the previously detected largest video area and start over to
  5738. detect the current optimal crop area. Default value is 0.
  5739. This can be useful when channel logos distort the video area. 0
  5740. indicates 'never reset', and returns the largest area encountered during
  5741. playback.
  5742. @end table
  5743. @anchor{cue}
  5744. @section cue
  5745. Delay video filtering until a given wallclock timestamp. The filter first
  5746. passes on @option{preroll} amount of frames, then it buffers at most
  5747. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5748. it forwards the buffered frames and also any subsequent frames coming in its
  5749. input.
  5750. The filter can be used synchronize the output of multiple ffmpeg processes for
  5751. realtime output devices like decklink. By putting the delay in the filtering
  5752. chain and pre-buffering frames the process can pass on data to output almost
  5753. immediately after the target wallclock timestamp is reached.
  5754. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5755. some use cases.
  5756. @table @option
  5757. @item cue
  5758. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5759. @item preroll
  5760. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5761. @item buffer
  5762. The maximum duration of content to buffer before waiting for the cue expressed
  5763. in seconds. Default is 0.
  5764. @end table
  5765. @anchor{curves}
  5766. @section curves
  5767. Apply color adjustments using curves.
  5768. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5769. component (red, green and blue) has its values defined by @var{N} key points
  5770. tied from each other using a smooth curve. The x-axis represents the pixel
  5771. values from the input frame, and the y-axis the new pixel values to be set for
  5772. the output frame.
  5773. By default, a component curve is defined by the two points @var{(0;0)} and
  5774. @var{(1;1)}. This creates a straight line where each original pixel value is
  5775. "adjusted" to its own value, which means no change to the image.
  5776. The filter allows you to redefine these two points and add some more. A new
  5777. curve (using a natural cubic spline interpolation) will be define to pass
  5778. smoothly through all these new coordinates. The new defined points needs to be
  5779. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5780. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5781. the vector spaces, the values will be clipped accordingly.
  5782. The filter accepts the following options:
  5783. @table @option
  5784. @item preset
  5785. Select one of the available color presets. This option can be used in addition
  5786. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5787. options takes priority on the preset values.
  5788. Available presets are:
  5789. @table @samp
  5790. @item none
  5791. @item color_negative
  5792. @item cross_process
  5793. @item darker
  5794. @item increase_contrast
  5795. @item lighter
  5796. @item linear_contrast
  5797. @item medium_contrast
  5798. @item negative
  5799. @item strong_contrast
  5800. @item vintage
  5801. @end table
  5802. Default is @code{none}.
  5803. @item master, m
  5804. Set the master key points. These points will define a second pass mapping. It
  5805. is sometimes called a "luminance" or "value" mapping. It can be used with
  5806. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5807. post-processing LUT.
  5808. @item red, r
  5809. Set the key points for the red component.
  5810. @item green, g
  5811. Set the key points for the green component.
  5812. @item blue, b
  5813. Set the key points for the blue component.
  5814. @item all
  5815. Set the key points for all components (not including master).
  5816. Can be used in addition to the other key points component
  5817. options. In this case, the unset component(s) will fallback on this
  5818. @option{all} setting.
  5819. @item psfile
  5820. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5821. @item plot
  5822. Save Gnuplot script of the curves in specified file.
  5823. @end table
  5824. To avoid some filtergraph syntax conflicts, each key points list need to be
  5825. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5826. @subsection Examples
  5827. @itemize
  5828. @item
  5829. Increase slightly the middle level of blue:
  5830. @example
  5831. curves=blue='0/0 0.5/0.58 1/1'
  5832. @end example
  5833. @item
  5834. Vintage effect:
  5835. @example
  5836. 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'
  5837. @end example
  5838. Here we obtain the following coordinates for each components:
  5839. @table @var
  5840. @item red
  5841. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5842. @item green
  5843. @code{(0;0) (0.50;0.48) (1;1)}
  5844. @item blue
  5845. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5846. @end table
  5847. @item
  5848. The previous example can also be achieved with the associated built-in preset:
  5849. @example
  5850. curves=preset=vintage
  5851. @end example
  5852. @item
  5853. Or simply:
  5854. @example
  5855. curves=vintage
  5856. @end example
  5857. @item
  5858. Use a Photoshop preset and redefine the points of the green component:
  5859. @example
  5860. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5861. @end example
  5862. @item
  5863. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5864. and @command{gnuplot}:
  5865. @example
  5866. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5867. gnuplot -p /tmp/curves.plt
  5868. @end example
  5869. @end itemize
  5870. @section datascope
  5871. Video data analysis filter.
  5872. This filter shows hexadecimal pixel values of part of video.
  5873. The filter accepts the following options:
  5874. @table @option
  5875. @item size, s
  5876. Set output video size.
  5877. @item x
  5878. Set x offset from where to pick pixels.
  5879. @item y
  5880. Set y offset from where to pick pixels.
  5881. @item mode
  5882. Set scope mode, can be one of the following:
  5883. @table @samp
  5884. @item mono
  5885. Draw hexadecimal pixel values with white color on black background.
  5886. @item color
  5887. Draw hexadecimal pixel values with input video pixel color on black
  5888. background.
  5889. @item color2
  5890. Draw hexadecimal pixel values on color background picked from input video,
  5891. the text color is picked in such way so its always visible.
  5892. @end table
  5893. @item axis
  5894. Draw rows and columns numbers on left and top of video.
  5895. @item opacity
  5896. Set background opacity.
  5897. @end table
  5898. @section dctdnoiz
  5899. Denoise frames using 2D DCT (frequency domain filtering).
  5900. This filter is not designed for real time.
  5901. The filter accepts the following options:
  5902. @table @option
  5903. @item sigma, s
  5904. Set the noise sigma constant.
  5905. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5906. coefficient (absolute value) below this threshold with be dropped.
  5907. If you need a more advanced filtering, see @option{expr}.
  5908. Default is @code{0}.
  5909. @item overlap
  5910. Set number overlapping pixels for each block. Since the filter can be slow, you
  5911. may want to reduce this value, at the cost of a less effective filter and the
  5912. risk of various artefacts.
  5913. If the overlapping value doesn't permit processing the whole input width or
  5914. height, a warning will be displayed and according borders won't be denoised.
  5915. Default value is @var{blocksize}-1, which is the best possible setting.
  5916. @item expr, e
  5917. Set the coefficient factor expression.
  5918. For each coefficient of a DCT block, this expression will be evaluated as a
  5919. multiplier value for the coefficient.
  5920. If this is option is set, the @option{sigma} option will be ignored.
  5921. The absolute value of the coefficient can be accessed through the @var{c}
  5922. variable.
  5923. @item n
  5924. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5925. @var{blocksize}, which is the width and height of the processed blocks.
  5926. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5927. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5928. on the speed processing. Also, a larger block size does not necessarily means a
  5929. better de-noising.
  5930. @end table
  5931. @subsection Examples
  5932. Apply a denoise with a @option{sigma} of @code{4.5}:
  5933. @example
  5934. dctdnoiz=4.5
  5935. @end example
  5936. The same operation can be achieved using the expression system:
  5937. @example
  5938. dctdnoiz=e='gte(c, 4.5*3)'
  5939. @end example
  5940. Violent denoise using a block size of @code{16x16}:
  5941. @example
  5942. dctdnoiz=15:n=4
  5943. @end example
  5944. @section deband
  5945. Remove banding artifacts from input video.
  5946. It works by replacing banded pixels with average value of referenced pixels.
  5947. The filter accepts the following options:
  5948. @table @option
  5949. @item 1thr
  5950. @item 2thr
  5951. @item 3thr
  5952. @item 4thr
  5953. Set banding detection threshold for each plane. Default is 0.02.
  5954. Valid range is 0.00003 to 0.5.
  5955. If difference between current pixel and reference pixel is less than threshold,
  5956. it will be considered as banded.
  5957. @item range, r
  5958. Banding detection range in pixels. Default is 16. If positive, random number
  5959. in range 0 to set value will be used. If negative, exact absolute value
  5960. will be used.
  5961. The range defines square of four pixels around current pixel.
  5962. @item direction, d
  5963. Set direction in radians from which four pixel will be compared. If positive,
  5964. random direction from 0 to set direction will be picked. If negative, exact of
  5965. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5966. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5967. column.
  5968. @item blur, b
  5969. If enabled, current pixel is compared with average value of all four
  5970. surrounding pixels. The default is enabled. If disabled current pixel is
  5971. compared with all four surrounding pixels. The pixel is considered banded
  5972. if only all four differences with surrounding pixels are less than threshold.
  5973. @item coupling, c
  5974. If enabled, current pixel is changed if and only if all pixel components are banded,
  5975. e.g. banding detection threshold is triggered for all color components.
  5976. The default is disabled.
  5977. @end table
  5978. @section deblock
  5979. Remove blocking artifacts from input video.
  5980. The filter accepts the following options:
  5981. @table @option
  5982. @item filter
  5983. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5984. This controls what kind of deblocking is applied.
  5985. @item block
  5986. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5987. @item alpha
  5988. @item beta
  5989. @item gamma
  5990. @item delta
  5991. Set blocking detection thresholds. Allowed range is 0 to 1.
  5992. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5993. Using higher threshold gives more deblocking strength.
  5994. Setting @var{alpha} controls threshold detection at exact edge of block.
  5995. Remaining options controls threshold detection near the edge. Each one for
  5996. below/above or left/right. Setting any of those to @var{0} disables
  5997. deblocking.
  5998. @item planes
  5999. Set planes to filter. Default is to filter all available planes.
  6000. @end table
  6001. @subsection Examples
  6002. @itemize
  6003. @item
  6004. Deblock using weak filter and block size of 4 pixels.
  6005. @example
  6006. deblock=filter=weak:block=4
  6007. @end example
  6008. @item
  6009. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6010. deblocking more edges.
  6011. @example
  6012. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6013. @end example
  6014. @item
  6015. Similar as above, but filter only first plane.
  6016. @example
  6017. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6018. @end example
  6019. @item
  6020. Similar as above, but filter only second and third plane.
  6021. @example
  6022. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6023. @end example
  6024. @end itemize
  6025. @anchor{decimate}
  6026. @section decimate
  6027. Drop duplicated frames at regular intervals.
  6028. The filter accepts the following options:
  6029. @table @option
  6030. @item cycle
  6031. Set the number of frames from which one will be dropped. Setting this to
  6032. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6033. Default is @code{5}.
  6034. @item dupthresh
  6035. Set the threshold for duplicate detection. If the difference metric for a frame
  6036. is less than or equal to this value, then it is declared as duplicate. Default
  6037. is @code{1.1}
  6038. @item scthresh
  6039. Set scene change threshold. Default is @code{15}.
  6040. @item blockx
  6041. @item blocky
  6042. Set the size of the x and y-axis blocks used during metric calculations.
  6043. Larger blocks give better noise suppression, but also give worse detection of
  6044. small movements. Must be a power of two. Default is @code{32}.
  6045. @item ppsrc
  6046. Mark main input as a pre-processed input and activate clean source input
  6047. stream. This allows the input to be pre-processed with various filters to help
  6048. the metrics calculation while keeping the frame selection lossless. When set to
  6049. @code{1}, the first stream is for the pre-processed input, and the second
  6050. stream is the clean source from where the kept frames are chosen. Default is
  6051. @code{0}.
  6052. @item chroma
  6053. Set whether or not chroma is considered in the metric calculations. Default is
  6054. @code{1}.
  6055. @end table
  6056. @section deconvolve
  6057. Apply 2D deconvolution of video stream in frequency domain using second stream
  6058. as impulse.
  6059. The filter accepts the following options:
  6060. @table @option
  6061. @item planes
  6062. Set which planes to process.
  6063. @item impulse
  6064. Set which impulse video frames will be processed, can be @var{first}
  6065. or @var{all}. Default is @var{all}.
  6066. @item noise
  6067. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6068. and height are not same and not power of 2 or if stream prior to convolving
  6069. had noise.
  6070. @end table
  6071. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6072. @section dedot
  6073. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6074. It accepts the following options:
  6075. @table @option
  6076. @item m
  6077. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6078. @var{rainbows} for cross-color reduction.
  6079. @item lt
  6080. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6081. @item tl
  6082. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6083. @item tc
  6084. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6085. @item ct
  6086. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6087. @end table
  6088. @section deflate
  6089. Apply deflate effect to the video.
  6090. This filter replaces the pixel by the local(3x3) average by taking into account
  6091. only values lower than the pixel.
  6092. It accepts the following options:
  6093. @table @option
  6094. @item threshold0
  6095. @item threshold1
  6096. @item threshold2
  6097. @item threshold3
  6098. Limit the maximum change for each plane, default is 65535.
  6099. If 0, plane will remain unchanged.
  6100. @end table
  6101. @section deflicker
  6102. Remove temporal frame luminance variations.
  6103. It accepts the following options:
  6104. @table @option
  6105. @item size, s
  6106. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6107. @item mode, m
  6108. Set averaging mode to smooth temporal luminance variations.
  6109. Available values are:
  6110. @table @samp
  6111. @item am
  6112. Arithmetic mean
  6113. @item gm
  6114. Geometric mean
  6115. @item hm
  6116. Harmonic mean
  6117. @item qm
  6118. Quadratic mean
  6119. @item cm
  6120. Cubic mean
  6121. @item pm
  6122. Power mean
  6123. @item median
  6124. Median
  6125. @end table
  6126. @item bypass
  6127. Do not actually modify frame. Useful when one only wants metadata.
  6128. @end table
  6129. @section dejudder
  6130. Remove judder produced by partially interlaced telecined content.
  6131. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6132. source was partially telecined content then the output of @code{pullup,dejudder}
  6133. will have a variable frame rate. May change the recorded frame rate of the
  6134. container. Aside from that change, this filter will not affect constant frame
  6135. rate video.
  6136. The option available in this filter is:
  6137. @table @option
  6138. @item cycle
  6139. Specify the length of the window over which the judder repeats.
  6140. Accepts any integer greater than 1. Useful values are:
  6141. @table @samp
  6142. @item 4
  6143. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6144. @item 5
  6145. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6146. @item 20
  6147. If a mixture of the two.
  6148. @end table
  6149. The default is @samp{4}.
  6150. @end table
  6151. @section delogo
  6152. Suppress a TV station logo by a simple interpolation of the surrounding
  6153. pixels. Just set a rectangle covering the logo and watch it disappear
  6154. (and sometimes something even uglier appear - your mileage may vary).
  6155. It accepts the following parameters:
  6156. @table @option
  6157. @item x
  6158. @item y
  6159. Specify the top left corner coordinates of the logo. They must be
  6160. specified.
  6161. @item w
  6162. @item h
  6163. Specify the width and height of the logo to clear. They must be
  6164. specified.
  6165. @item band, t
  6166. Specify the thickness of the fuzzy edge of the rectangle (added to
  6167. @var{w} and @var{h}). The default value is 1. This option is
  6168. deprecated, setting higher values should no longer be necessary and
  6169. is not recommended.
  6170. @item show
  6171. When set to 1, a green rectangle is drawn on the screen to simplify
  6172. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6173. The default value is 0.
  6174. The rectangle is drawn on the outermost pixels which will be (partly)
  6175. replaced with interpolated values. The values of the next pixels
  6176. immediately outside this rectangle in each direction will be used to
  6177. compute the interpolated pixel values inside the rectangle.
  6178. @end table
  6179. @subsection Examples
  6180. @itemize
  6181. @item
  6182. Set a rectangle covering the area with top left corner coordinates 0,0
  6183. and size 100x77, and a band of size 10:
  6184. @example
  6185. delogo=x=0:y=0:w=100:h=77:band=10
  6186. @end example
  6187. @end itemize
  6188. @section deshake
  6189. Attempt to fix small changes in horizontal and/or vertical shift. This
  6190. filter helps remove camera shake from hand-holding a camera, bumping a
  6191. tripod, moving on a vehicle, etc.
  6192. The filter accepts the following options:
  6193. @table @option
  6194. @item x
  6195. @item y
  6196. @item w
  6197. @item h
  6198. Specify a rectangular area where to limit the search for motion
  6199. vectors.
  6200. If desired the search for motion vectors can be limited to a
  6201. rectangular area of the frame defined by its top left corner, width
  6202. and height. These parameters have the same meaning as the drawbox
  6203. filter which can be used to visualise the position of the bounding
  6204. box.
  6205. This is useful when simultaneous movement of subjects within the frame
  6206. might be confused for camera motion by the motion vector search.
  6207. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6208. then the full frame is used. This allows later options to be set
  6209. without specifying the bounding box for the motion vector search.
  6210. Default - search the whole frame.
  6211. @item rx
  6212. @item ry
  6213. Specify the maximum extent of movement in x and y directions in the
  6214. range 0-64 pixels. Default 16.
  6215. @item edge
  6216. Specify how to generate pixels to fill blanks at the edge of the
  6217. frame. Available values are:
  6218. @table @samp
  6219. @item blank, 0
  6220. Fill zeroes at blank locations
  6221. @item original, 1
  6222. Original image at blank locations
  6223. @item clamp, 2
  6224. Extruded edge value at blank locations
  6225. @item mirror, 3
  6226. Mirrored edge at blank locations
  6227. @end table
  6228. Default value is @samp{mirror}.
  6229. @item blocksize
  6230. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6231. default 8.
  6232. @item contrast
  6233. Specify the contrast threshold for blocks. Only blocks with more than
  6234. the specified contrast (difference between darkest and lightest
  6235. pixels) will be considered. Range 1-255, default 125.
  6236. @item search
  6237. Specify the search strategy. Available values are:
  6238. @table @samp
  6239. @item exhaustive, 0
  6240. Set exhaustive search
  6241. @item less, 1
  6242. Set less exhaustive search.
  6243. @end table
  6244. Default value is @samp{exhaustive}.
  6245. @item filename
  6246. If set then a detailed log of the motion search is written to the
  6247. specified file.
  6248. @end table
  6249. @section despill
  6250. Remove unwanted contamination of foreground colors, caused by reflected color of
  6251. greenscreen or bluescreen.
  6252. This filter accepts the following options:
  6253. @table @option
  6254. @item type
  6255. Set what type of despill to use.
  6256. @item mix
  6257. Set how spillmap will be generated.
  6258. @item expand
  6259. Set how much to get rid of still remaining spill.
  6260. @item red
  6261. Controls amount of red in spill area.
  6262. @item green
  6263. Controls amount of green in spill area.
  6264. Should be -1 for greenscreen.
  6265. @item blue
  6266. Controls amount of blue in spill area.
  6267. Should be -1 for bluescreen.
  6268. @item brightness
  6269. Controls brightness of spill area, preserving colors.
  6270. @item alpha
  6271. Modify alpha from generated spillmap.
  6272. @end table
  6273. @section detelecine
  6274. Apply an exact inverse of the telecine operation. It requires a predefined
  6275. pattern specified using the pattern option which must be the same as that passed
  6276. to the telecine filter.
  6277. This filter accepts the following options:
  6278. @table @option
  6279. @item first_field
  6280. @table @samp
  6281. @item top, t
  6282. top field first
  6283. @item bottom, b
  6284. bottom field first
  6285. The default value is @code{top}.
  6286. @end table
  6287. @item pattern
  6288. A string of numbers representing the pulldown pattern you wish to apply.
  6289. The default value is @code{23}.
  6290. @item start_frame
  6291. A number representing position of the first frame with respect to the telecine
  6292. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6293. @end table
  6294. @section dilation
  6295. Apply dilation effect to the video.
  6296. This filter replaces the pixel by the local(3x3) maximum.
  6297. It accepts the following options:
  6298. @table @option
  6299. @item threshold0
  6300. @item threshold1
  6301. @item threshold2
  6302. @item threshold3
  6303. Limit the maximum change for each plane, default is 65535.
  6304. If 0, plane will remain unchanged.
  6305. @item coordinates
  6306. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6307. pixels are used.
  6308. Flags to local 3x3 coordinates maps like this:
  6309. 1 2 3
  6310. 4 5
  6311. 6 7 8
  6312. @end table
  6313. @section displace
  6314. Displace pixels as indicated by second and third input stream.
  6315. It takes three input streams and outputs one stream, the first input is the
  6316. source, and second and third input are displacement maps.
  6317. The second input specifies how much to displace pixels along the
  6318. x-axis, while the third input specifies how much to displace pixels
  6319. along the y-axis.
  6320. If one of displacement map streams terminates, last frame from that
  6321. displacement map will be used.
  6322. Note that once generated, displacements maps can be reused over and over again.
  6323. A description of the accepted options follows.
  6324. @table @option
  6325. @item edge
  6326. Set displace behavior for pixels that are out of range.
  6327. Available values are:
  6328. @table @samp
  6329. @item blank
  6330. Missing pixels are replaced by black pixels.
  6331. @item smear
  6332. Adjacent pixels will spread out to replace missing pixels.
  6333. @item wrap
  6334. Out of range pixels are wrapped so they point to pixels of other side.
  6335. @item mirror
  6336. Out of range pixels will be replaced with mirrored pixels.
  6337. @end table
  6338. Default is @samp{smear}.
  6339. @end table
  6340. @subsection Examples
  6341. @itemize
  6342. @item
  6343. Add ripple effect to rgb input of video size hd720:
  6344. @example
  6345. 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
  6346. @end example
  6347. @item
  6348. Add wave effect to rgb input of video size hd720:
  6349. @example
  6350. 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
  6351. @end example
  6352. @end itemize
  6353. @section drawbox
  6354. Draw a colored box on the input image.
  6355. It accepts the following parameters:
  6356. @table @option
  6357. @item x
  6358. @item y
  6359. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6360. @item width, w
  6361. @item height, h
  6362. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6363. the input width and height. It defaults to 0.
  6364. @item color, c
  6365. Specify the color of the box to write. For the general syntax of this option,
  6366. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6367. value @code{invert} is used, the box edge color is the same as the
  6368. video with inverted luma.
  6369. @item thickness, t
  6370. The expression which sets the thickness of the box edge.
  6371. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6372. See below for the list of accepted constants.
  6373. @item replace
  6374. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6375. will overwrite the video's color and alpha pixels.
  6376. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6377. @end table
  6378. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6379. following constants:
  6380. @table @option
  6381. @item dar
  6382. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6383. @item hsub
  6384. @item vsub
  6385. horizontal and vertical chroma subsample values. For example for the
  6386. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6387. @item in_h, ih
  6388. @item in_w, iw
  6389. The input width and height.
  6390. @item sar
  6391. The input sample aspect ratio.
  6392. @item x
  6393. @item y
  6394. The x and y offset coordinates where the box is drawn.
  6395. @item w
  6396. @item h
  6397. The width and height of the drawn box.
  6398. @item t
  6399. The thickness of the drawn box.
  6400. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6401. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6402. @end table
  6403. @subsection Examples
  6404. @itemize
  6405. @item
  6406. Draw a black box around the edge of the input image:
  6407. @example
  6408. drawbox
  6409. @end example
  6410. @item
  6411. Draw a box with color red and an opacity of 50%:
  6412. @example
  6413. drawbox=10:20:200:60:red@@0.5
  6414. @end example
  6415. The previous example can be specified as:
  6416. @example
  6417. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6418. @end example
  6419. @item
  6420. Fill the box with pink color:
  6421. @example
  6422. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6423. @end example
  6424. @item
  6425. Draw a 2-pixel red 2.40:1 mask:
  6426. @example
  6427. 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
  6428. @end example
  6429. @end itemize
  6430. @section drawgrid
  6431. Draw a grid on the input image.
  6432. It accepts the following parameters:
  6433. @table @option
  6434. @item x
  6435. @item y
  6436. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6437. @item width, w
  6438. @item height, h
  6439. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6440. input width and height, respectively, minus @code{thickness}, so image gets
  6441. framed. Default to 0.
  6442. @item color, c
  6443. Specify the color of the grid. For the general syntax of this option,
  6444. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6445. value @code{invert} is used, the grid color is the same as the
  6446. video with inverted luma.
  6447. @item thickness, t
  6448. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6449. See below for the list of accepted constants.
  6450. @item replace
  6451. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6452. will overwrite the video's color and alpha pixels.
  6453. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6454. @end table
  6455. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6456. following constants:
  6457. @table @option
  6458. @item dar
  6459. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6460. @item hsub
  6461. @item vsub
  6462. horizontal and vertical chroma subsample values. For example for the
  6463. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6464. @item in_h, ih
  6465. @item in_w, iw
  6466. The input grid cell width and height.
  6467. @item sar
  6468. The input sample aspect ratio.
  6469. @item x
  6470. @item y
  6471. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6472. @item w
  6473. @item h
  6474. The width and height of the drawn cell.
  6475. @item t
  6476. The thickness of the drawn cell.
  6477. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6478. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6479. @end table
  6480. @subsection Examples
  6481. @itemize
  6482. @item
  6483. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6484. @example
  6485. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6486. @end example
  6487. @item
  6488. Draw a white 3x3 grid with an opacity of 50%:
  6489. @example
  6490. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6491. @end example
  6492. @end itemize
  6493. @anchor{drawtext}
  6494. @section drawtext
  6495. Draw a text string or text from a specified file on top of a video, using the
  6496. libfreetype library.
  6497. To enable compilation of this filter, you need to configure FFmpeg with
  6498. @code{--enable-libfreetype}.
  6499. To enable default font fallback and the @var{font} option you need to
  6500. configure FFmpeg with @code{--enable-libfontconfig}.
  6501. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6502. @code{--enable-libfribidi}.
  6503. @subsection Syntax
  6504. It accepts the following parameters:
  6505. @table @option
  6506. @item box
  6507. Used to draw a box around text using the background color.
  6508. The value must be either 1 (enable) or 0 (disable).
  6509. The default value of @var{box} is 0.
  6510. @item boxborderw
  6511. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6512. The default value of @var{boxborderw} is 0.
  6513. @item boxcolor
  6514. The color to be used for drawing box around text. For the syntax of this
  6515. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6516. The default value of @var{boxcolor} is "white".
  6517. @item line_spacing
  6518. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6519. The default value of @var{line_spacing} is 0.
  6520. @item borderw
  6521. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6522. The default value of @var{borderw} is 0.
  6523. @item bordercolor
  6524. Set the color to be used for drawing border around text. For the syntax of this
  6525. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6526. The default value of @var{bordercolor} is "black".
  6527. @item expansion
  6528. Select how the @var{text} is expanded. Can be either @code{none},
  6529. @code{strftime} (deprecated) or
  6530. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6531. below for details.
  6532. @item basetime
  6533. Set a start time for the count. Value is in microseconds. Only applied
  6534. in the deprecated strftime expansion mode. To emulate in normal expansion
  6535. mode use the @code{pts} function, supplying the start time (in seconds)
  6536. as the second argument.
  6537. @item fix_bounds
  6538. If true, check and fix text coords to avoid clipping.
  6539. @item fontcolor
  6540. The color to be used for drawing fonts. For the syntax of this option, check
  6541. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6542. The default value of @var{fontcolor} is "black".
  6543. @item fontcolor_expr
  6544. String which is expanded the same way as @var{text} to obtain dynamic
  6545. @var{fontcolor} value. By default this option has empty value and is not
  6546. processed. When this option is set, it overrides @var{fontcolor} option.
  6547. @item font
  6548. The font family to be used for drawing text. By default Sans.
  6549. @item fontfile
  6550. The font file to be used for drawing text. The path must be included.
  6551. This parameter is mandatory if the fontconfig support is disabled.
  6552. @item alpha
  6553. Draw the text applying alpha blending. The value can
  6554. be a number between 0.0 and 1.0.
  6555. The expression accepts the same variables @var{x, y} as well.
  6556. The default value is 1.
  6557. Please see @var{fontcolor_expr}.
  6558. @item fontsize
  6559. The font size to be used for drawing text.
  6560. The default value of @var{fontsize} is 16.
  6561. @item text_shaping
  6562. If set to 1, attempt to shape the text (for example, reverse the order of
  6563. right-to-left text and join Arabic characters) before drawing it.
  6564. Otherwise, just draw the text exactly as given.
  6565. By default 1 (if supported).
  6566. @item ft_load_flags
  6567. The flags to be used for loading the fonts.
  6568. The flags map the corresponding flags supported by libfreetype, and are
  6569. a combination of the following values:
  6570. @table @var
  6571. @item default
  6572. @item no_scale
  6573. @item no_hinting
  6574. @item render
  6575. @item no_bitmap
  6576. @item vertical_layout
  6577. @item force_autohint
  6578. @item crop_bitmap
  6579. @item pedantic
  6580. @item ignore_global_advance_width
  6581. @item no_recurse
  6582. @item ignore_transform
  6583. @item monochrome
  6584. @item linear_design
  6585. @item no_autohint
  6586. @end table
  6587. Default value is "default".
  6588. For more information consult the documentation for the FT_LOAD_*
  6589. libfreetype flags.
  6590. @item shadowcolor
  6591. The color to be used for drawing a shadow behind the drawn text. For the
  6592. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6593. ffmpeg-utils manual,ffmpeg-utils}.
  6594. The default value of @var{shadowcolor} is "black".
  6595. @item shadowx
  6596. @item shadowy
  6597. The x and y offsets for the text shadow position with respect to the
  6598. position of the text. They can be either positive or negative
  6599. values. The default value for both is "0".
  6600. @item start_number
  6601. The starting frame number for the n/frame_num variable. The default value
  6602. is "0".
  6603. @item tabsize
  6604. The size in number of spaces to use for rendering the tab.
  6605. Default value is 4.
  6606. @item timecode
  6607. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6608. format. It can be used with or without text parameter. @var{timecode_rate}
  6609. option must be specified.
  6610. @item timecode_rate, rate, r
  6611. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6612. integer. Minimum value is "1".
  6613. Drop-frame timecode is supported for frame rates 30 & 60.
  6614. @item tc24hmax
  6615. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6616. Default is 0 (disabled).
  6617. @item text
  6618. The text string to be drawn. The text must be a sequence of UTF-8
  6619. encoded characters.
  6620. This parameter is mandatory if no file is specified with the parameter
  6621. @var{textfile}.
  6622. @item textfile
  6623. A text file containing text to be drawn. The text must be a sequence
  6624. of UTF-8 encoded characters.
  6625. This parameter is mandatory if no text string is specified with the
  6626. parameter @var{text}.
  6627. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6628. @item reload
  6629. If set to 1, the @var{textfile} will be reloaded before each frame.
  6630. Be sure to update it atomically, or it may be read partially, or even fail.
  6631. @item x
  6632. @item y
  6633. The expressions which specify the offsets where text will be drawn
  6634. within the video frame. They are relative to the top/left border of the
  6635. output image.
  6636. The default value of @var{x} and @var{y} is "0".
  6637. See below for the list of accepted constants and functions.
  6638. @end table
  6639. The parameters for @var{x} and @var{y} are expressions containing the
  6640. following constants and functions:
  6641. @table @option
  6642. @item dar
  6643. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6644. @item hsub
  6645. @item vsub
  6646. horizontal and vertical chroma subsample values. For example for the
  6647. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6648. @item line_h, lh
  6649. the height of each text line
  6650. @item main_h, h, H
  6651. the input height
  6652. @item main_w, w, W
  6653. the input width
  6654. @item max_glyph_a, ascent
  6655. the maximum distance from the baseline to the highest/upper grid
  6656. coordinate used to place a glyph outline point, for all the rendered
  6657. glyphs.
  6658. It is a positive value, due to the grid's orientation with the Y axis
  6659. upwards.
  6660. @item max_glyph_d, descent
  6661. the maximum distance from the baseline to the lowest grid coordinate
  6662. used to place a glyph outline point, for all the rendered glyphs.
  6663. This is a negative value, due to the grid's orientation, with the Y axis
  6664. upwards.
  6665. @item max_glyph_h
  6666. maximum glyph height, that is the maximum height for all the glyphs
  6667. contained in the rendered text, it is equivalent to @var{ascent} -
  6668. @var{descent}.
  6669. @item max_glyph_w
  6670. maximum glyph width, that is the maximum width for all the glyphs
  6671. contained in the rendered text
  6672. @item n
  6673. the number of input frame, starting from 0
  6674. @item rand(min, max)
  6675. return a random number included between @var{min} and @var{max}
  6676. @item sar
  6677. The input sample aspect ratio.
  6678. @item t
  6679. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6680. @item text_h, th
  6681. the height of the rendered text
  6682. @item text_w, tw
  6683. the width of the rendered text
  6684. @item x
  6685. @item y
  6686. the x and y offset coordinates where the text is drawn.
  6687. These parameters allow the @var{x} and @var{y} expressions to refer
  6688. each other, so you can for example specify @code{y=x/dar}.
  6689. @end table
  6690. @anchor{drawtext_expansion}
  6691. @subsection Text expansion
  6692. If @option{expansion} is set to @code{strftime},
  6693. the filter recognizes strftime() sequences in the provided text and
  6694. expands them accordingly. Check the documentation of strftime(). This
  6695. feature is deprecated.
  6696. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6697. If @option{expansion} is set to @code{normal} (which is the default),
  6698. the following expansion mechanism is used.
  6699. The backslash character @samp{\}, followed by any character, always expands to
  6700. the second character.
  6701. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6702. braces is a function name, possibly followed by arguments separated by ':'.
  6703. If the arguments contain special characters or delimiters (':' or '@}'),
  6704. they should be escaped.
  6705. Note that they probably must also be escaped as the value for the
  6706. @option{text} option in the filter argument string and as the filter
  6707. argument in the filtergraph description, and possibly also for the shell,
  6708. that makes up to four levels of escaping; using a text file avoids these
  6709. problems.
  6710. The following functions are available:
  6711. @table @command
  6712. @item expr, e
  6713. The expression evaluation result.
  6714. It must take one argument specifying the expression to be evaluated,
  6715. which accepts the same constants and functions as the @var{x} and
  6716. @var{y} values. Note that not all constants should be used, for
  6717. example the text size is not known when evaluating the expression, so
  6718. the constants @var{text_w} and @var{text_h} will have an undefined
  6719. value.
  6720. @item expr_int_format, eif
  6721. Evaluate the expression's value and output as formatted integer.
  6722. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6723. The second argument specifies the output format. Allowed values are @samp{x},
  6724. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6725. @code{printf} function.
  6726. The third parameter is optional and sets the number of positions taken by the output.
  6727. It can be used to add padding with zeros from the left.
  6728. @item gmtime
  6729. The time at which the filter is running, expressed in UTC.
  6730. It can accept an argument: a strftime() format string.
  6731. @item localtime
  6732. The time at which the filter is running, expressed in the local time zone.
  6733. It can accept an argument: a strftime() format string.
  6734. @item metadata
  6735. Frame metadata. Takes one or two arguments.
  6736. The first argument is mandatory and specifies the metadata key.
  6737. The second argument is optional and specifies a default value, used when the
  6738. metadata key is not found or empty.
  6739. @item n, frame_num
  6740. The frame number, starting from 0.
  6741. @item pict_type
  6742. A 1 character description of the current picture type.
  6743. @item pts
  6744. The timestamp of the current frame.
  6745. It can take up to three arguments.
  6746. The first argument is the format of the timestamp; it defaults to @code{flt}
  6747. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6748. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6749. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6750. @code{localtime} stands for the timestamp of the frame formatted as
  6751. local time zone time.
  6752. The second argument is an offset added to the timestamp.
  6753. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6754. supplied to present the hour part of the formatted timestamp in 24h format
  6755. (00-23).
  6756. If the format is set to @code{localtime} or @code{gmtime},
  6757. a third argument may be supplied: a strftime() format string.
  6758. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6759. @end table
  6760. @subsection Examples
  6761. @itemize
  6762. @item
  6763. Draw "Test Text" with font FreeSerif, using the default values for the
  6764. optional parameters.
  6765. @example
  6766. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6767. @end example
  6768. @item
  6769. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6770. and y=50 (counting from the top-left corner of the screen), text is
  6771. yellow with a red box around it. Both the text and the box have an
  6772. opacity of 20%.
  6773. @example
  6774. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6775. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6776. @end example
  6777. Note that the double quotes are not necessary if spaces are not used
  6778. within the parameter list.
  6779. @item
  6780. Show the text at the center of the video frame:
  6781. @example
  6782. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6783. @end example
  6784. @item
  6785. Show the text at a random position, switching to a new position every 30 seconds:
  6786. @example
  6787. 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)"
  6788. @end example
  6789. @item
  6790. Show a text line sliding from right to left in the last row of the video
  6791. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6792. with no newlines.
  6793. @example
  6794. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6795. @end example
  6796. @item
  6797. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6798. @example
  6799. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6800. @end example
  6801. @item
  6802. Draw a single green letter "g", at the center of the input video.
  6803. The glyph baseline is placed at half screen height.
  6804. @example
  6805. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6806. @end example
  6807. @item
  6808. Show text for 1 second every 3 seconds:
  6809. @example
  6810. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6811. @end example
  6812. @item
  6813. Use fontconfig to set the font. Note that the colons need to be escaped.
  6814. @example
  6815. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6816. @end example
  6817. @item
  6818. Print the date of a real-time encoding (see strftime(3)):
  6819. @example
  6820. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6821. @end example
  6822. @item
  6823. Show text fading in and out (appearing/disappearing):
  6824. @example
  6825. #!/bin/sh
  6826. DS=1.0 # display start
  6827. DE=10.0 # display end
  6828. FID=1.5 # fade in duration
  6829. FOD=5 # fade out duration
  6830. 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 @}"
  6831. @end example
  6832. @item
  6833. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6834. and the @option{fontsize} value are included in the @option{y} offset.
  6835. @example
  6836. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6837. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6838. @end example
  6839. @end itemize
  6840. For more information about libfreetype, check:
  6841. @url{http://www.freetype.org/}.
  6842. For more information about fontconfig, check:
  6843. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6844. For more information about libfribidi, check:
  6845. @url{http://fribidi.org/}.
  6846. @section edgedetect
  6847. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6848. The filter accepts the following options:
  6849. @table @option
  6850. @item low
  6851. @item high
  6852. Set low and high threshold values used by the Canny thresholding
  6853. algorithm.
  6854. The high threshold selects the "strong" edge pixels, which are then
  6855. connected through 8-connectivity with the "weak" edge pixels selected
  6856. by the low threshold.
  6857. @var{low} and @var{high} threshold values must be chosen in the range
  6858. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6859. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6860. is @code{50/255}.
  6861. @item mode
  6862. Define the drawing mode.
  6863. @table @samp
  6864. @item wires
  6865. Draw white/gray wires on black background.
  6866. @item colormix
  6867. Mix the colors to create a paint/cartoon effect.
  6868. @item canny
  6869. Apply Canny edge detector on all selected planes.
  6870. @end table
  6871. Default value is @var{wires}.
  6872. @item planes
  6873. Select planes for filtering. By default all available planes are filtered.
  6874. @end table
  6875. @subsection Examples
  6876. @itemize
  6877. @item
  6878. Standard edge detection with custom values for the hysteresis thresholding:
  6879. @example
  6880. edgedetect=low=0.1:high=0.4
  6881. @end example
  6882. @item
  6883. Painting effect without thresholding:
  6884. @example
  6885. edgedetect=mode=colormix:high=0
  6886. @end example
  6887. @end itemize
  6888. @section eq
  6889. Set brightness, contrast, saturation and approximate gamma adjustment.
  6890. The filter accepts the following options:
  6891. @table @option
  6892. @item contrast
  6893. Set the contrast expression. The value must be a float value in range
  6894. @code{-2.0} to @code{2.0}. The default value is "1".
  6895. @item brightness
  6896. Set the brightness expression. The value must be a float value in
  6897. range @code{-1.0} to @code{1.0}. The default value is "0".
  6898. @item saturation
  6899. Set the saturation expression. The value must be a float in
  6900. range @code{0.0} to @code{3.0}. The default value is "1".
  6901. @item gamma
  6902. Set the gamma expression. The value must be a float in range
  6903. @code{0.1} to @code{10.0}. The default value is "1".
  6904. @item gamma_r
  6905. Set the gamma expression for red. The value must be a float in
  6906. range @code{0.1} to @code{10.0}. The default value is "1".
  6907. @item gamma_g
  6908. Set the gamma expression for green. The value must be a float in range
  6909. @code{0.1} to @code{10.0}. The default value is "1".
  6910. @item gamma_b
  6911. Set the gamma expression for blue. The value must be a float in range
  6912. @code{0.1} to @code{10.0}. The default value is "1".
  6913. @item gamma_weight
  6914. Set the gamma weight expression. It can be used to reduce the effect
  6915. of a high gamma value on bright image areas, e.g. keep them from
  6916. getting overamplified and just plain white. The value must be a float
  6917. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6918. gamma correction all the way down while @code{1.0} leaves it at its
  6919. full strength. Default is "1".
  6920. @item eval
  6921. Set when the expressions for brightness, contrast, saturation and
  6922. gamma expressions are evaluated.
  6923. It accepts the following values:
  6924. @table @samp
  6925. @item init
  6926. only evaluate expressions once during the filter initialization or
  6927. when a command is processed
  6928. @item frame
  6929. evaluate expressions for each incoming frame
  6930. @end table
  6931. Default value is @samp{init}.
  6932. @end table
  6933. The expressions accept the following parameters:
  6934. @table @option
  6935. @item n
  6936. frame count of the input frame starting from 0
  6937. @item pos
  6938. byte position of the corresponding packet in the input file, NAN if
  6939. unspecified
  6940. @item r
  6941. frame rate of the input video, NAN if the input frame rate is unknown
  6942. @item t
  6943. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6944. @end table
  6945. @subsection Commands
  6946. The filter supports the following commands:
  6947. @table @option
  6948. @item contrast
  6949. Set the contrast expression.
  6950. @item brightness
  6951. Set the brightness expression.
  6952. @item saturation
  6953. Set the saturation expression.
  6954. @item gamma
  6955. Set the gamma expression.
  6956. @item gamma_r
  6957. Set the gamma_r expression.
  6958. @item gamma_g
  6959. Set gamma_g expression.
  6960. @item gamma_b
  6961. Set gamma_b expression.
  6962. @item gamma_weight
  6963. Set gamma_weight expression.
  6964. The command accepts the same syntax of the corresponding option.
  6965. If the specified expression is not valid, it is kept at its current
  6966. value.
  6967. @end table
  6968. @section erosion
  6969. Apply erosion effect to the video.
  6970. This filter replaces the pixel by the local(3x3) minimum.
  6971. It accepts the following options:
  6972. @table @option
  6973. @item threshold0
  6974. @item threshold1
  6975. @item threshold2
  6976. @item threshold3
  6977. Limit the maximum change for each plane, default is 65535.
  6978. If 0, plane will remain unchanged.
  6979. @item coordinates
  6980. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6981. pixels are used.
  6982. Flags to local 3x3 coordinates maps like this:
  6983. 1 2 3
  6984. 4 5
  6985. 6 7 8
  6986. @end table
  6987. @section extractplanes
  6988. Extract color channel components from input video stream into
  6989. separate grayscale video streams.
  6990. The filter accepts the following option:
  6991. @table @option
  6992. @item planes
  6993. Set plane(s) to extract.
  6994. Available values for planes are:
  6995. @table @samp
  6996. @item y
  6997. @item u
  6998. @item v
  6999. @item a
  7000. @item r
  7001. @item g
  7002. @item b
  7003. @end table
  7004. Choosing planes not available in the input will result in an error.
  7005. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7006. with @code{y}, @code{u}, @code{v} planes at same time.
  7007. @end table
  7008. @subsection Examples
  7009. @itemize
  7010. @item
  7011. Extract luma, u and v color channel component from input video frame
  7012. into 3 grayscale outputs:
  7013. @example
  7014. 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
  7015. @end example
  7016. @end itemize
  7017. @section elbg
  7018. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7019. For each input image, the filter will compute the optimal mapping from
  7020. the input to the output given the codebook length, that is the number
  7021. of distinct output colors.
  7022. This filter accepts the following options.
  7023. @table @option
  7024. @item codebook_length, l
  7025. Set codebook length. The value must be a positive integer, and
  7026. represents the number of distinct output colors. Default value is 256.
  7027. @item nb_steps, n
  7028. Set the maximum number of iterations to apply for computing the optimal
  7029. mapping. The higher the value the better the result and the higher the
  7030. computation time. Default value is 1.
  7031. @item seed, s
  7032. Set a random seed, must be an integer included between 0 and
  7033. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7034. will try to use a good random seed on a best effort basis.
  7035. @item pal8
  7036. Set pal8 output pixel format. This option does not work with codebook
  7037. length greater than 256.
  7038. @end table
  7039. @section entropy
  7040. Measure graylevel entropy in histogram of color channels of video frames.
  7041. It accepts the following parameters:
  7042. @table @option
  7043. @item mode
  7044. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7045. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7046. between neighbour histogram values.
  7047. @end table
  7048. @section fade
  7049. Apply a fade-in/out effect to the input video.
  7050. It accepts the following parameters:
  7051. @table @option
  7052. @item type, t
  7053. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7054. effect.
  7055. Default is @code{in}.
  7056. @item start_frame, s
  7057. Specify the number of the frame to start applying the fade
  7058. effect at. Default is 0.
  7059. @item nb_frames, n
  7060. The number of frames that the fade effect lasts. At the end of the
  7061. fade-in effect, the output video will have the same intensity as the input video.
  7062. At the end of the fade-out transition, the output video will be filled with the
  7063. selected @option{color}.
  7064. Default is 25.
  7065. @item alpha
  7066. If set to 1, fade only alpha channel, if one exists on the input.
  7067. Default value is 0.
  7068. @item start_time, st
  7069. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7070. effect. If both start_frame and start_time are specified, the fade will start at
  7071. whichever comes last. Default is 0.
  7072. @item duration, d
  7073. The number of seconds for which the fade effect has to last. At the end of the
  7074. fade-in effect the output video will have the same intensity as the input video,
  7075. at the end of the fade-out transition the output video will be filled with the
  7076. selected @option{color}.
  7077. If both duration and nb_frames are specified, duration is used. Default is 0
  7078. (nb_frames is used by default).
  7079. @item color, c
  7080. Specify the color of the fade. Default is "black".
  7081. @end table
  7082. @subsection Examples
  7083. @itemize
  7084. @item
  7085. Fade in the first 30 frames of video:
  7086. @example
  7087. fade=in:0:30
  7088. @end example
  7089. The command above is equivalent to:
  7090. @example
  7091. fade=t=in:s=0:n=30
  7092. @end example
  7093. @item
  7094. Fade out the last 45 frames of a 200-frame video:
  7095. @example
  7096. fade=out:155:45
  7097. fade=type=out:start_frame=155:nb_frames=45
  7098. @end example
  7099. @item
  7100. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7101. @example
  7102. fade=in:0:25, fade=out:975:25
  7103. @end example
  7104. @item
  7105. Make the first 5 frames yellow, then fade in from frame 5-24:
  7106. @example
  7107. fade=in:5:20:color=yellow
  7108. @end example
  7109. @item
  7110. Fade in alpha over first 25 frames of video:
  7111. @example
  7112. fade=in:0:25:alpha=1
  7113. @end example
  7114. @item
  7115. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7116. @example
  7117. fade=t=in:st=5.5:d=0.5
  7118. @end example
  7119. @end itemize
  7120. @section fftfilt
  7121. Apply arbitrary expressions to samples in frequency domain
  7122. @table @option
  7123. @item dc_Y
  7124. Adjust the dc value (gain) of the luma plane of the image. The filter
  7125. accepts an integer value in range @code{0} to @code{1000}. The default
  7126. value is set to @code{0}.
  7127. @item dc_U
  7128. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7129. filter accepts an integer value in range @code{0} to @code{1000}. The
  7130. default value is set to @code{0}.
  7131. @item dc_V
  7132. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7133. filter accepts an integer value in range @code{0} to @code{1000}. The
  7134. default value is set to @code{0}.
  7135. @item weight_Y
  7136. Set the frequency domain weight expression for the luma plane.
  7137. @item weight_U
  7138. Set the frequency domain weight expression for the 1st chroma plane.
  7139. @item weight_V
  7140. Set the frequency domain weight expression for the 2nd chroma plane.
  7141. @item eval
  7142. Set when the expressions are evaluated.
  7143. It accepts the following values:
  7144. @table @samp
  7145. @item init
  7146. Only evaluate expressions once during the filter initialization.
  7147. @item frame
  7148. Evaluate expressions for each incoming frame.
  7149. @end table
  7150. Default value is @samp{init}.
  7151. The filter accepts the following variables:
  7152. @item X
  7153. @item Y
  7154. The coordinates of the current sample.
  7155. @item W
  7156. @item H
  7157. The width and height of the image.
  7158. @item N
  7159. The number of input frame, starting from 0.
  7160. @end table
  7161. @subsection Examples
  7162. @itemize
  7163. @item
  7164. High-pass:
  7165. @example
  7166. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7167. @end example
  7168. @item
  7169. Low-pass:
  7170. @example
  7171. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7172. @end example
  7173. @item
  7174. Sharpen:
  7175. @example
  7176. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7177. @end example
  7178. @item
  7179. Blur:
  7180. @example
  7181. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7182. @end example
  7183. @end itemize
  7184. @section fftdnoiz
  7185. Denoise frames using 3D FFT (frequency domain filtering).
  7186. The filter accepts the following options:
  7187. @table @option
  7188. @item sigma
  7189. Set the noise sigma constant. This sets denoising strength.
  7190. Default value is 1. Allowed range is from 0 to 30.
  7191. Using very high sigma with low overlap may give blocking artifacts.
  7192. @item amount
  7193. Set amount of denoising. By default all detected noise is reduced.
  7194. Default value is 1. Allowed range is from 0 to 1.
  7195. @item block
  7196. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7197. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7198. block size in pixels is 2^4 which is 16.
  7199. @item overlap
  7200. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7201. @item prev
  7202. Set number of previous frames to use for denoising. By default is set to 0.
  7203. @item next
  7204. Set number of next frames to to use for denoising. By default is set to 0.
  7205. @item planes
  7206. Set planes which will be filtered, by default are all available filtered
  7207. except alpha.
  7208. @end table
  7209. @section field
  7210. Extract a single field from an interlaced image using stride
  7211. arithmetic to avoid wasting CPU time. The output frames are marked as
  7212. non-interlaced.
  7213. The filter accepts the following options:
  7214. @table @option
  7215. @item type
  7216. Specify whether to extract the top (if the value is @code{0} or
  7217. @code{top}) or the bottom field (if the value is @code{1} or
  7218. @code{bottom}).
  7219. @end table
  7220. @section fieldhint
  7221. Create new frames by copying the top and bottom fields from surrounding frames
  7222. supplied as numbers by the hint file.
  7223. @table @option
  7224. @item hint
  7225. Set file containing hints: absolute/relative frame numbers.
  7226. There must be one line for each frame in a clip. Each line must contain two
  7227. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7228. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7229. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7230. for @code{relative} mode. First number tells from which frame to pick up top
  7231. field and second number tells from which frame to pick up bottom field.
  7232. If optionally followed by @code{+} output frame will be marked as interlaced,
  7233. else if followed by @code{-} output frame will be marked as progressive, else
  7234. it will be marked same as input frame.
  7235. If line starts with @code{#} or @code{;} that line is skipped.
  7236. @item mode
  7237. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7238. @end table
  7239. Example of first several lines of @code{hint} file for @code{relative} mode:
  7240. @example
  7241. 0,0 - # first frame
  7242. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7243. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7244. 1,0 -
  7245. 0,0 -
  7246. 0,0 -
  7247. 1,0 -
  7248. 1,0 -
  7249. 1,0 -
  7250. 0,0 -
  7251. 0,0 -
  7252. 1,0 -
  7253. 1,0 -
  7254. 1,0 -
  7255. 0,0 -
  7256. @end example
  7257. @section fieldmatch
  7258. Field matching filter for inverse telecine. It is meant to reconstruct the
  7259. progressive frames from a telecined stream. The filter does not drop duplicated
  7260. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7261. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7262. The separation of the field matching and the decimation is notably motivated by
  7263. the possibility of inserting a de-interlacing filter fallback between the two.
  7264. If the source has mixed telecined and real interlaced content,
  7265. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7266. But these remaining combed frames will be marked as interlaced, and thus can be
  7267. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7268. In addition to the various configuration options, @code{fieldmatch} can take an
  7269. optional second stream, activated through the @option{ppsrc} option. If
  7270. enabled, the frames reconstruction will be based on the fields and frames from
  7271. this second stream. This allows the first input to be pre-processed in order to
  7272. help the various algorithms of the filter, while keeping the output lossless
  7273. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7274. or brightness/contrast adjustments can help.
  7275. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7276. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7277. which @code{fieldmatch} is based on. While the semantic and usage are very
  7278. close, some behaviour and options names can differ.
  7279. The @ref{decimate} filter currently only works for constant frame rate input.
  7280. If your input has mixed telecined (30fps) and progressive content with a lower
  7281. framerate like 24fps use the following filterchain to produce the necessary cfr
  7282. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7283. The filter accepts the following options:
  7284. @table @option
  7285. @item order
  7286. Specify the assumed field order of the input stream. Available values are:
  7287. @table @samp
  7288. @item auto
  7289. Auto detect parity (use FFmpeg's internal parity value).
  7290. @item bff
  7291. Assume bottom field first.
  7292. @item tff
  7293. Assume top field first.
  7294. @end table
  7295. Note that it is sometimes recommended not to trust the parity announced by the
  7296. stream.
  7297. Default value is @var{auto}.
  7298. @item mode
  7299. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7300. sense that it won't risk creating jerkiness due to duplicate frames when
  7301. possible, but if there are bad edits or blended fields it will end up
  7302. outputting combed frames when a good match might actually exist. On the other
  7303. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7304. but will almost always find a good frame if there is one. The other values are
  7305. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7306. jerkiness and creating duplicate frames versus finding good matches in sections
  7307. with bad edits, orphaned fields, blended fields, etc.
  7308. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7309. Available values are:
  7310. @table @samp
  7311. @item pc
  7312. 2-way matching (p/c)
  7313. @item pc_n
  7314. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7315. @item pc_u
  7316. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7317. @item pc_n_ub
  7318. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7319. still combed (p/c + n + u/b)
  7320. @item pcn
  7321. 3-way matching (p/c/n)
  7322. @item pcn_ub
  7323. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7324. detected as combed (p/c/n + u/b)
  7325. @end table
  7326. The parenthesis at the end indicate the matches that would be used for that
  7327. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7328. @var{top}).
  7329. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7330. the slowest.
  7331. Default value is @var{pc_n}.
  7332. @item ppsrc
  7333. Mark the main input stream as a pre-processed input, and enable the secondary
  7334. input stream as the clean source to pick the fields from. See the filter
  7335. introduction for more details. It is similar to the @option{clip2} feature from
  7336. VFM/TFM.
  7337. Default value is @code{0} (disabled).
  7338. @item field
  7339. Set the field to match from. It is recommended to set this to the same value as
  7340. @option{order} unless you experience matching failures with that setting. In
  7341. certain circumstances changing the field that is used to match from can have a
  7342. large impact on matching performance. Available values are:
  7343. @table @samp
  7344. @item auto
  7345. Automatic (same value as @option{order}).
  7346. @item bottom
  7347. Match from the bottom field.
  7348. @item top
  7349. Match from the top field.
  7350. @end table
  7351. Default value is @var{auto}.
  7352. @item mchroma
  7353. Set whether or not chroma is included during the match comparisons. In most
  7354. cases it is recommended to leave this enabled. You should set this to @code{0}
  7355. only if your clip has bad chroma problems such as heavy rainbowing or other
  7356. artifacts. Setting this to @code{0} could also be used to speed things up at
  7357. the cost of some accuracy.
  7358. Default value is @code{1}.
  7359. @item y0
  7360. @item y1
  7361. These define an exclusion band which excludes the lines between @option{y0} and
  7362. @option{y1} from being included in the field matching decision. An exclusion
  7363. band can be used to ignore subtitles, a logo, or other things that may
  7364. interfere with the matching. @option{y0} sets the starting scan line and
  7365. @option{y1} sets the ending line; all lines in between @option{y0} and
  7366. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7367. @option{y0} and @option{y1} to the same value will disable the feature.
  7368. @option{y0} and @option{y1} defaults to @code{0}.
  7369. @item scthresh
  7370. Set the scene change detection threshold as a percentage of maximum change on
  7371. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7372. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7373. @option{scthresh} is @code{[0.0, 100.0]}.
  7374. Default value is @code{12.0}.
  7375. @item combmatch
  7376. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7377. account the combed scores of matches when deciding what match to use as the
  7378. final match. Available values are:
  7379. @table @samp
  7380. @item none
  7381. No final matching based on combed scores.
  7382. @item sc
  7383. Combed scores are only used when a scene change is detected.
  7384. @item full
  7385. Use combed scores all the time.
  7386. @end table
  7387. Default is @var{sc}.
  7388. @item combdbg
  7389. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7390. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7391. Available values are:
  7392. @table @samp
  7393. @item none
  7394. No forced calculation.
  7395. @item pcn
  7396. Force p/c/n calculations.
  7397. @item pcnub
  7398. Force p/c/n/u/b calculations.
  7399. @end table
  7400. Default value is @var{none}.
  7401. @item cthresh
  7402. This is the area combing threshold used for combed frame detection. This
  7403. essentially controls how "strong" or "visible" combing must be to be detected.
  7404. Larger values mean combing must be more visible and smaller values mean combing
  7405. can be less visible or strong and still be detected. Valid settings are from
  7406. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7407. be detected as combed). This is basically a pixel difference value. A good
  7408. range is @code{[8, 12]}.
  7409. Default value is @code{9}.
  7410. @item chroma
  7411. Sets whether or not chroma is considered in the combed frame decision. Only
  7412. disable this if your source has chroma problems (rainbowing, etc.) that are
  7413. causing problems for the combed frame detection with chroma enabled. Actually,
  7414. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7415. where there is chroma only combing in the source.
  7416. Default value is @code{0}.
  7417. @item blockx
  7418. @item blocky
  7419. Respectively set the x-axis and y-axis size of the window used during combed
  7420. frame detection. This has to do with the size of the area in which
  7421. @option{combpel} pixels are required to be detected as combed for a frame to be
  7422. declared combed. See the @option{combpel} parameter description for more info.
  7423. Possible values are any number that is a power of 2 starting at 4 and going up
  7424. to 512.
  7425. Default value is @code{16}.
  7426. @item combpel
  7427. The number of combed pixels inside any of the @option{blocky} by
  7428. @option{blockx} size blocks on the frame for the frame to be detected as
  7429. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7430. setting controls "how much" combing there must be in any localized area (a
  7431. window defined by the @option{blockx} and @option{blocky} settings) on the
  7432. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7433. which point no frames will ever be detected as combed). This setting is known
  7434. as @option{MI} in TFM/VFM vocabulary.
  7435. Default value is @code{80}.
  7436. @end table
  7437. @anchor{p/c/n/u/b meaning}
  7438. @subsection p/c/n/u/b meaning
  7439. @subsubsection p/c/n
  7440. We assume the following telecined stream:
  7441. @example
  7442. Top fields: 1 2 2 3 4
  7443. Bottom fields: 1 2 3 4 4
  7444. @end example
  7445. The numbers correspond to the progressive frame the fields relate to. Here, the
  7446. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7447. When @code{fieldmatch} is configured to run a matching from bottom
  7448. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7449. @example
  7450. Input stream:
  7451. T 1 2 2 3 4
  7452. B 1 2 3 4 4 <-- matching reference
  7453. Matches: c c n n c
  7454. Output stream:
  7455. T 1 2 3 4 4
  7456. B 1 2 3 4 4
  7457. @end example
  7458. As a result of the field matching, we can see that some frames get duplicated.
  7459. To perform a complete inverse telecine, you need to rely on a decimation filter
  7460. after this operation. See for instance the @ref{decimate} filter.
  7461. The same operation now matching from top fields (@option{field}=@var{top})
  7462. looks like this:
  7463. @example
  7464. Input stream:
  7465. T 1 2 2 3 4 <-- matching reference
  7466. B 1 2 3 4 4
  7467. Matches: c c p p c
  7468. Output stream:
  7469. T 1 2 2 3 4
  7470. B 1 2 2 3 4
  7471. @end example
  7472. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7473. basically, they refer to the frame and field of the opposite parity:
  7474. @itemize
  7475. @item @var{p} matches the field of the opposite parity in the previous frame
  7476. @item @var{c} matches the field of the opposite parity in the current frame
  7477. @item @var{n} matches the field of the opposite parity in the next frame
  7478. @end itemize
  7479. @subsubsection u/b
  7480. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7481. from the opposite parity flag. In the following examples, we assume that we are
  7482. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7483. 'x' is placed above and below each matched fields.
  7484. With bottom matching (@option{field}=@var{bottom}):
  7485. @example
  7486. Match: c p n b u
  7487. x x x x x
  7488. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7489. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7490. x x x x x
  7491. Output frames:
  7492. 2 1 2 2 2
  7493. 2 2 2 1 3
  7494. @end example
  7495. With top matching (@option{field}=@var{top}):
  7496. @example
  7497. Match: c p n b u
  7498. x x x x x
  7499. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7500. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7501. x x x x x
  7502. Output frames:
  7503. 2 2 2 1 2
  7504. 2 1 3 2 2
  7505. @end example
  7506. @subsection Examples
  7507. Simple IVTC of a top field first telecined stream:
  7508. @example
  7509. fieldmatch=order=tff:combmatch=none, decimate
  7510. @end example
  7511. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7512. @example
  7513. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7514. @end example
  7515. @section fieldorder
  7516. Transform the field order of the input video.
  7517. It accepts the following parameters:
  7518. @table @option
  7519. @item order
  7520. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7521. for bottom field first.
  7522. @end table
  7523. The default value is @samp{tff}.
  7524. The transformation is done by shifting the picture content up or down
  7525. by one line, and filling the remaining line with appropriate picture content.
  7526. This method is consistent with most broadcast field order converters.
  7527. If the input video is not flagged as being interlaced, or it is already
  7528. flagged as being of the required output field order, then this filter does
  7529. not alter the incoming video.
  7530. It is very useful when converting to or from PAL DV material,
  7531. which is bottom field first.
  7532. For example:
  7533. @example
  7534. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7535. @end example
  7536. @section fifo, afifo
  7537. Buffer input images and send them when they are requested.
  7538. It is mainly useful when auto-inserted by the libavfilter
  7539. framework.
  7540. It does not take parameters.
  7541. @section fillborders
  7542. Fill borders of the input video, without changing video stream dimensions.
  7543. Sometimes video can have garbage at the four edges and you may not want to
  7544. crop video input to keep size multiple of some number.
  7545. This filter accepts the following options:
  7546. @table @option
  7547. @item left
  7548. Number of pixels to fill from left border.
  7549. @item right
  7550. Number of pixels to fill from right border.
  7551. @item top
  7552. Number of pixels to fill from top border.
  7553. @item bottom
  7554. Number of pixels to fill from bottom border.
  7555. @item mode
  7556. Set fill mode.
  7557. It accepts the following values:
  7558. @table @samp
  7559. @item smear
  7560. fill pixels using outermost pixels
  7561. @item mirror
  7562. fill pixels using mirroring
  7563. @item fixed
  7564. fill pixels with constant value
  7565. @end table
  7566. Default is @var{smear}.
  7567. @item color
  7568. Set color for pixels in fixed mode. Default is @var{black}.
  7569. @end table
  7570. @section find_rect
  7571. Find a rectangular object
  7572. It accepts the following options:
  7573. @table @option
  7574. @item object
  7575. Filepath of the object image, needs to be in gray8.
  7576. @item threshold
  7577. Detection threshold, default is 0.5.
  7578. @item mipmaps
  7579. Number of mipmaps, default is 3.
  7580. @item xmin, ymin, xmax, ymax
  7581. Specifies the rectangle in which to search.
  7582. @end table
  7583. @subsection Examples
  7584. @itemize
  7585. @item
  7586. Generate a representative palette of a given video using @command{ffmpeg}:
  7587. @example
  7588. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7589. @end example
  7590. @end itemize
  7591. @section cover_rect
  7592. Cover a rectangular object
  7593. It accepts the following options:
  7594. @table @option
  7595. @item cover
  7596. Filepath of the optional cover image, needs to be in yuv420.
  7597. @item mode
  7598. Set covering mode.
  7599. It accepts the following values:
  7600. @table @samp
  7601. @item cover
  7602. cover it by the supplied image
  7603. @item blur
  7604. cover it by interpolating the surrounding pixels
  7605. @end table
  7606. Default value is @var{blur}.
  7607. @end table
  7608. @subsection Examples
  7609. @itemize
  7610. @item
  7611. Generate a representative palette of a given video using @command{ffmpeg}:
  7612. @example
  7613. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7614. @end example
  7615. @end itemize
  7616. @section floodfill
  7617. Flood area with values of same pixel components with another values.
  7618. It accepts the following options:
  7619. @table @option
  7620. @item x
  7621. Set pixel x coordinate.
  7622. @item y
  7623. Set pixel y coordinate.
  7624. @item s0
  7625. Set source #0 component value.
  7626. @item s1
  7627. Set source #1 component value.
  7628. @item s2
  7629. Set source #2 component value.
  7630. @item s3
  7631. Set source #3 component value.
  7632. @item d0
  7633. Set destination #0 component value.
  7634. @item d1
  7635. Set destination #1 component value.
  7636. @item d2
  7637. Set destination #2 component value.
  7638. @item d3
  7639. Set destination #3 component value.
  7640. @end table
  7641. @anchor{format}
  7642. @section format
  7643. Convert the input video to one of the specified pixel formats.
  7644. Libavfilter will try to pick one that is suitable as input to
  7645. the next filter.
  7646. It accepts the following parameters:
  7647. @table @option
  7648. @item pix_fmts
  7649. A '|'-separated list of pixel format names, such as
  7650. "pix_fmts=yuv420p|monow|rgb24".
  7651. @end table
  7652. @subsection Examples
  7653. @itemize
  7654. @item
  7655. Convert the input video to the @var{yuv420p} format
  7656. @example
  7657. format=pix_fmts=yuv420p
  7658. @end example
  7659. Convert the input video to any of the formats in the list
  7660. @example
  7661. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7662. @end example
  7663. @end itemize
  7664. @anchor{fps}
  7665. @section fps
  7666. Convert the video to specified constant frame rate by duplicating or dropping
  7667. frames as necessary.
  7668. It accepts the following parameters:
  7669. @table @option
  7670. @item fps
  7671. The desired output frame rate. The default is @code{25}.
  7672. @item start_time
  7673. Assume the first PTS should be the given value, in seconds. This allows for
  7674. padding/trimming at the start of stream. By default, no assumption is made
  7675. about the first frame's expected PTS, so no padding or trimming is done.
  7676. For example, this could be set to 0 to pad the beginning with duplicates of
  7677. the first frame if a video stream starts after the audio stream or to trim any
  7678. frames with a negative PTS.
  7679. @item round
  7680. Timestamp (PTS) rounding method.
  7681. Possible values are:
  7682. @table @option
  7683. @item zero
  7684. round towards 0
  7685. @item inf
  7686. round away from 0
  7687. @item down
  7688. round towards -infinity
  7689. @item up
  7690. round towards +infinity
  7691. @item near
  7692. round to nearest
  7693. @end table
  7694. The default is @code{near}.
  7695. @item eof_action
  7696. Action performed when reading the last frame.
  7697. Possible values are:
  7698. @table @option
  7699. @item round
  7700. Use same timestamp rounding method as used for other frames.
  7701. @item pass
  7702. Pass through last frame if input duration has not been reached yet.
  7703. @end table
  7704. The default is @code{round}.
  7705. @end table
  7706. Alternatively, the options can be specified as a flat string:
  7707. @var{fps}[:@var{start_time}[:@var{round}]].
  7708. See also the @ref{setpts} filter.
  7709. @subsection Examples
  7710. @itemize
  7711. @item
  7712. A typical usage in order to set the fps to 25:
  7713. @example
  7714. fps=fps=25
  7715. @end example
  7716. @item
  7717. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7718. @example
  7719. fps=fps=film:round=near
  7720. @end example
  7721. @end itemize
  7722. @section framepack
  7723. Pack two different video streams into a stereoscopic video, setting proper
  7724. metadata on supported codecs. The two views should have the same size and
  7725. framerate and processing will stop when the shorter video ends. Please note
  7726. that you may conveniently adjust view properties with the @ref{scale} and
  7727. @ref{fps} filters.
  7728. It accepts the following parameters:
  7729. @table @option
  7730. @item format
  7731. The desired packing format. Supported values are:
  7732. @table @option
  7733. @item sbs
  7734. The views are next to each other (default).
  7735. @item tab
  7736. The views are on top of each other.
  7737. @item lines
  7738. The views are packed by line.
  7739. @item columns
  7740. The views are packed by column.
  7741. @item frameseq
  7742. The views are temporally interleaved.
  7743. @end table
  7744. @end table
  7745. Some examples:
  7746. @example
  7747. # Convert left and right views into a frame-sequential video
  7748. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7749. # Convert views into a side-by-side video with the same output resolution as the input
  7750. 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
  7751. @end example
  7752. @section framerate
  7753. Change the frame rate by interpolating new video output frames from the source
  7754. frames.
  7755. This filter is not designed to function correctly with interlaced media. If
  7756. you wish to change the frame rate of interlaced media then you are required
  7757. to deinterlace before this filter and re-interlace after this filter.
  7758. A description of the accepted options follows.
  7759. @table @option
  7760. @item fps
  7761. Specify the output frames per second. This option can also be specified
  7762. as a value alone. The default is @code{50}.
  7763. @item interp_start
  7764. Specify the start of a range where the output frame will be created as a
  7765. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7766. the default is @code{15}.
  7767. @item interp_end
  7768. Specify the end of a range where the output frame will be created as a
  7769. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7770. the default is @code{240}.
  7771. @item scene
  7772. Specify the level at which a scene change is detected as a value between
  7773. 0 and 100 to indicate a new scene; a low value reflects a low
  7774. probability for the current frame to introduce a new scene, while a higher
  7775. value means the current frame is more likely to be one.
  7776. The default is @code{8.2}.
  7777. @item flags
  7778. Specify flags influencing the filter process.
  7779. Available value for @var{flags} is:
  7780. @table @option
  7781. @item scene_change_detect, scd
  7782. Enable scene change detection using the value of the option @var{scene}.
  7783. This flag is enabled by default.
  7784. @end table
  7785. @end table
  7786. @section framestep
  7787. Select one frame every N-th frame.
  7788. This filter accepts the following option:
  7789. @table @option
  7790. @item step
  7791. Select frame after every @code{step} frames.
  7792. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7793. @end table
  7794. @section freezedetect
  7795. Detect frozen video.
  7796. This filter logs a message and sets frame metadata when it detects that the
  7797. input video has no significant change in content during a specified duration.
  7798. Video freeze detection calculates the mean average absolute difference of all
  7799. the components of video frames and compares it to a noise floor.
  7800. The printed times and duration are expressed in seconds. The
  7801. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7802. whose timestamp equals or exceeds the detection duration and it contains the
  7803. timestamp of the first frame of the freeze. The
  7804. @code{lavfi.freezedetect.freeze_duration} and
  7805. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7806. after the freeze.
  7807. The filter accepts the following options:
  7808. @table @option
  7809. @item noise, n
  7810. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7811. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7812. 0.001.
  7813. @item duration, d
  7814. Set freeze duration until notification (default is 2 seconds).
  7815. @end table
  7816. @anchor{frei0r}
  7817. @section frei0r
  7818. Apply a frei0r effect to the input video.
  7819. To enable the compilation of this filter, you need to install the frei0r
  7820. header and configure FFmpeg with @code{--enable-frei0r}.
  7821. It accepts the following parameters:
  7822. @table @option
  7823. @item filter_name
  7824. The name of the frei0r effect to load. If the environment variable
  7825. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7826. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7827. Otherwise, the standard frei0r paths are searched, in this order:
  7828. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7829. @file{/usr/lib/frei0r-1/}.
  7830. @item filter_params
  7831. A '|'-separated list of parameters to pass to the frei0r effect.
  7832. @end table
  7833. A frei0r effect parameter can be a boolean (its value is either
  7834. "y" or "n"), a double, a color (specified as
  7835. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7836. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7837. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7838. a position (specified as @var{X}/@var{Y}, where
  7839. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7840. The number and types of parameters depend on the loaded effect. If an
  7841. effect parameter is not specified, the default value is set.
  7842. @subsection Examples
  7843. @itemize
  7844. @item
  7845. Apply the distort0r effect, setting the first two double parameters:
  7846. @example
  7847. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7848. @end example
  7849. @item
  7850. Apply the colordistance effect, taking a color as the first parameter:
  7851. @example
  7852. frei0r=colordistance:0.2/0.3/0.4
  7853. frei0r=colordistance:violet
  7854. frei0r=colordistance:0x112233
  7855. @end example
  7856. @item
  7857. Apply the perspective effect, specifying the top left and top right image
  7858. positions:
  7859. @example
  7860. frei0r=perspective:0.2/0.2|0.8/0.2
  7861. @end example
  7862. @end itemize
  7863. For more information, see
  7864. @url{http://frei0r.dyne.org}
  7865. @section fspp
  7866. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7867. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7868. processing filter, one of them is performed once per block, not per pixel.
  7869. This allows for much higher speed.
  7870. The filter accepts the following options:
  7871. @table @option
  7872. @item quality
  7873. Set quality. This option defines the number of levels for averaging. It accepts
  7874. an integer in the range 4-5. Default value is @code{4}.
  7875. @item qp
  7876. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7877. If not set, the filter will use the QP from the video stream (if available).
  7878. @item strength
  7879. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7880. more details but also more artifacts, while higher values make the image smoother
  7881. but also blurrier. Default value is @code{0} − PSNR optimal.
  7882. @item use_bframe_qp
  7883. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7884. option may cause flicker since the B-Frames have often larger QP. Default is
  7885. @code{0} (not enabled).
  7886. @end table
  7887. @section gblur
  7888. Apply Gaussian blur filter.
  7889. The filter accepts the following options:
  7890. @table @option
  7891. @item sigma
  7892. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7893. @item steps
  7894. Set number of steps for Gaussian approximation. Default is @code{1}.
  7895. @item planes
  7896. Set which planes to filter. By default all planes are filtered.
  7897. @item sigmaV
  7898. Set vertical sigma, if negative it will be same as @code{sigma}.
  7899. Default is @code{-1}.
  7900. @end table
  7901. @section geq
  7902. Apply generic equation to each pixel.
  7903. The filter accepts the following options:
  7904. @table @option
  7905. @item lum_expr, lum
  7906. Set the luminance expression.
  7907. @item cb_expr, cb
  7908. Set the chrominance blue expression.
  7909. @item cr_expr, cr
  7910. Set the chrominance red expression.
  7911. @item alpha_expr, a
  7912. Set the alpha expression.
  7913. @item red_expr, r
  7914. Set the red expression.
  7915. @item green_expr, g
  7916. Set the green expression.
  7917. @item blue_expr, b
  7918. Set the blue expression.
  7919. @end table
  7920. The colorspace is selected according to the specified options. If one
  7921. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7922. options is specified, the filter will automatically select a YCbCr
  7923. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7924. @option{blue_expr} options is specified, it will select an RGB
  7925. colorspace.
  7926. If one of the chrominance expression is not defined, it falls back on the other
  7927. one. If no alpha expression is specified it will evaluate to opaque value.
  7928. If none of chrominance expressions are specified, they will evaluate
  7929. to the luminance expression.
  7930. The expressions can use the following variables and functions:
  7931. @table @option
  7932. @item N
  7933. The sequential number of the filtered frame, starting from @code{0}.
  7934. @item X
  7935. @item Y
  7936. The coordinates of the current sample.
  7937. @item W
  7938. @item H
  7939. The width and height of the image.
  7940. @item SW
  7941. @item SH
  7942. Width and height scale depending on the currently filtered plane. It is the
  7943. ratio between the corresponding luma plane number of pixels and the current
  7944. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7945. @code{0.5,0.5} for chroma planes.
  7946. @item T
  7947. Time of the current frame, expressed in seconds.
  7948. @item p(x, y)
  7949. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7950. plane.
  7951. @item lum(x, y)
  7952. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7953. plane.
  7954. @item cb(x, y)
  7955. Return the value of the pixel at location (@var{x},@var{y}) of the
  7956. blue-difference chroma plane. Return 0 if there is no such plane.
  7957. @item cr(x, y)
  7958. Return the value of the pixel at location (@var{x},@var{y}) of the
  7959. red-difference chroma plane. Return 0 if there is no such plane.
  7960. @item r(x, y)
  7961. @item g(x, y)
  7962. @item b(x, y)
  7963. Return the value of the pixel at location (@var{x},@var{y}) of the
  7964. red/green/blue component. Return 0 if there is no such component.
  7965. @item alpha(x, y)
  7966. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7967. plane. Return 0 if there is no such plane.
  7968. @end table
  7969. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7970. automatically clipped to the closer edge.
  7971. @subsection Examples
  7972. @itemize
  7973. @item
  7974. Flip the image horizontally:
  7975. @example
  7976. geq=p(W-X\,Y)
  7977. @end example
  7978. @item
  7979. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7980. wavelength of 100 pixels:
  7981. @example
  7982. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7983. @end example
  7984. @item
  7985. Generate a fancy enigmatic moving light:
  7986. @example
  7987. 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
  7988. @end example
  7989. @item
  7990. Generate a quick emboss effect:
  7991. @example
  7992. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7993. @end example
  7994. @item
  7995. Modify RGB components depending on pixel position:
  7996. @example
  7997. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7998. @end example
  7999. @item
  8000. Create a radial gradient that is the same size as the input (also see
  8001. the @ref{vignette} filter):
  8002. @example
  8003. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8004. @end example
  8005. @end itemize
  8006. @section gradfun
  8007. Fix the banding artifacts that are sometimes introduced into nearly flat
  8008. regions by truncation to 8-bit color depth.
  8009. Interpolate the gradients that should go where the bands are, and
  8010. dither them.
  8011. It is designed for playback only. Do not use it prior to
  8012. lossy compression, because compression tends to lose the dither and
  8013. bring back the bands.
  8014. It accepts the following parameters:
  8015. @table @option
  8016. @item strength
  8017. The maximum amount by which the filter will change any one pixel. This is also
  8018. the threshold for detecting nearly flat regions. Acceptable values range from
  8019. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8020. valid range.
  8021. @item radius
  8022. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8023. gradients, but also prevents the filter from modifying the pixels near detailed
  8024. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8025. values will be clipped to the valid range.
  8026. @end table
  8027. Alternatively, the options can be specified as a flat string:
  8028. @var{strength}[:@var{radius}]
  8029. @subsection Examples
  8030. @itemize
  8031. @item
  8032. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8033. @example
  8034. gradfun=3.5:8
  8035. @end example
  8036. @item
  8037. Specify radius, omitting the strength (which will fall-back to the default
  8038. value):
  8039. @example
  8040. gradfun=radius=8
  8041. @end example
  8042. @end itemize
  8043. @section graphmonitor, agraphmonitor
  8044. Show various filtergraph stats.
  8045. With this filter one can debug complete filtergraph.
  8046. Especially issues with links filling with queued frames.
  8047. The filter accepts the following options:
  8048. @table @option
  8049. @item size, s
  8050. Set video output size. Default is @var{hd720}.
  8051. @item opacity, o
  8052. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8053. @item mode, m
  8054. Set output mode, can be @var{fulll} or @var{compact}.
  8055. In @var{compact} mode only filters with some queued frames have displayed stats.
  8056. @item flags, f
  8057. Set flags which enable which stats are shown in video.
  8058. Available values for flags are:
  8059. @table @samp
  8060. @item queue
  8061. Display number of queued frames in each link.
  8062. @item frame_count_in
  8063. Display number of frames taken from filter.
  8064. @item frame_count_out
  8065. Display number of frames given out from filter.
  8066. @item pts
  8067. Display current filtered frame pts.
  8068. @item time
  8069. Display current filtered frame time.
  8070. @item timebase
  8071. Display time base for filter link.
  8072. @item format
  8073. Display used format for filter link.
  8074. @item size
  8075. Display video size or number of audio channels in case of audio used by filter link.
  8076. @item rate
  8077. Display video frame rate or sample rate in case of audio used by filter link.
  8078. @end table
  8079. @item rate, r
  8080. Set upper limit for video rate of output stream, Default value is @var{25}.
  8081. This guarantee that output video frame rate will not be higher than this value.
  8082. @end table
  8083. @section greyedge
  8084. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8085. and corrects the scene colors accordingly.
  8086. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8087. The filter accepts the following options:
  8088. @table @option
  8089. @item difford
  8090. The order of differentiation to be applied on the scene. Must be chosen in the range
  8091. [0,2] and default value is 1.
  8092. @item minknorm
  8093. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8094. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8095. max value instead of calculating Minkowski distance.
  8096. @item sigma
  8097. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8098. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8099. can't be equal to 0 if @var{difford} is greater than 0.
  8100. @end table
  8101. @subsection Examples
  8102. @itemize
  8103. @item
  8104. Grey Edge:
  8105. @example
  8106. greyedge=difford=1:minknorm=5:sigma=2
  8107. @end example
  8108. @item
  8109. Max Edge:
  8110. @example
  8111. greyedge=difford=1:minknorm=0:sigma=2
  8112. @end example
  8113. @end itemize
  8114. @anchor{haldclut}
  8115. @section haldclut
  8116. Apply a Hald CLUT to a video stream.
  8117. First input is the video stream to process, and second one is the Hald CLUT.
  8118. The Hald CLUT input can be a simple picture or a complete video stream.
  8119. The filter accepts the following options:
  8120. @table @option
  8121. @item shortest
  8122. Force termination when the shortest input terminates. Default is @code{0}.
  8123. @item repeatlast
  8124. Continue applying the last CLUT after the end of the stream. A value of
  8125. @code{0} disable the filter after the last frame of the CLUT is reached.
  8126. Default is @code{1}.
  8127. @end table
  8128. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8129. filters share the same internals).
  8130. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8131. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8132. @subsection Workflow examples
  8133. @subsubsection Hald CLUT video stream
  8134. Generate an identity Hald CLUT stream altered with various effects:
  8135. @example
  8136. 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
  8137. @end example
  8138. Note: make sure you use a lossless codec.
  8139. Then use it with @code{haldclut} to apply it on some random stream:
  8140. @example
  8141. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8142. @end example
  8143. The Hald CLUT will be applied to the 10 first seconds (duration of
  8144. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8145. to the remaining frames of the @code{mandelbrot} stream.
  8146. @subsubsection Hald CLUT with preview
  8147. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8148. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8149. biggest possible square starting at the top left of the picture. The remaining
  8150. padding pixels (bottom or right) will be ignored. This area can be used to add
  8151. a preview of the Hald CLUT.
  8152. Typically, the following generated Hald CLUT will be supported by the
  8153. @code{haldclut} filter:
  8154. @example
  8155. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8156. pad=iw+320 [padded_clut];
  8157. smptebars=s=320x256, split [a][b];
  8158. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8159. [main][b] overlay=W-320" -frames:v 1 clut.png
  8160. @end example
  8161. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8162. bars are displayed on the right-top, and below the same color bars processed by
  8163. the color changes.
  8164. Then, the effect of this Hald CLUT can be visualized with:
  8165. @example
  8166. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8167. @end example
  8168. @section hflip
  8169. Flip the input video horizontally.
  8170. For example, to horizontally flip the input video with @command{ffmpeg}:
  8171. @example
  8172. ffmpeg -i in.avi -vf "hflip" out.avi
  8173. @end example
  8174. @section histeq
  8175. This filter applies a global color histogram equalization on a
  8176. per-frame basis.
  8177. It can be used to correct video that has a compressed range of pixel
  8178. intensities. The filter redistributes the pixel intensities to
  8179. equalize their distribution across the intensity range. It may be
  8180. viewed as an "automatically adjusting contrast filter". This filter is
  8181. useful only for correcting degraded or poorly captured source
  8182. video.
  8183. The filter accepts the following options:
  8184. @table @option
  8185. @item strength
  8186. Determine the amount of equalization to be applied. As the strength
  8187. is reduced, the distribution of pixel intensities more-and-more
  8188. approaches that of the input frame. The value must be a float number
  8189. in the range [0,1] and defaults to 0.200.
  8190. @item intensity
  8191. Set the maximum intensity that can generated and scale the output
  8192. values appropriately. The strength should be set as desired and then
  8193. the intensity can be limited if needed to avoid washing-out. The value
  8194. must be a float number in the range [0,1] and defaults to 0.210.
  8195. @item antibanding
  8196. Set the antibanding level. If enabled the filter will randomly vary
  8197. the luminance of output pixels by a small amount to avoid banding of
  8198. the histogram. Possible values are @code{none}, @code{weak} or
  8199. @code{strong}. It defaults to @code{none}.
  8200. @end table
  8201. @section histogram
  8202. Compute and draw a color distribution histogram for the input video.
  8203. The computed histogram is a representation of the color component
  8204. distribution in an image.
  8205. Standard histogram displays the color components distribution in an image.
  8206. Displays color graph for each color component. Shows distribution of
  8207. the Y, U, V, A or R, G, B components, depending on input format, in the
  8208. current frame. Below each graph a color component scale meter is shown.
  8209. The filter accepts the following options:
  8210. @table @option
  8211. @item level_height
  8212. Set height of level. Default value is @code{200}.
  8213. Allowed range is [50, 2048].
  8214. @item scale_height
  8215. Set height of color scale. Default value is @code{12}.
  8216. Allowed range is [0, 40].
  8217. @item display_mode
  8218. Set display mode.
  8219. It accepts the following values:
  8220. @table @samp
  8221. @item stack
  8222. Per color component graphs are placed below each other.
  8223. @item parade
  8224. Per color component graphs are placed side by side.
  8225. @item overlay
  8226. Presents information identical to that in the @code{parade}, except
  8227. that the graphs representing color components are superimposed directly
  8228. over one another.
  8229. @end table
  8230. Default is @code{stack}.
  8231. @item levels_mode
  8232. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8233. Default is @code{linear}.
  8234. @item components
  8235. Set what color components to display.
  8236. Default is @code{7}.
  8237. @item fgopacity
  8238. Set foreground opacity. Default is @code{0.7}.
  8239. @item bgopacity
  8240. Set background opacity. Default is @code{0.5}.
  8241. @end table
  8242. @subsection Examples
  8243. @itemize
  8244. @item
  8245. Calculate and draw histogram:
  8246. @example
  8247. ffplay -i input -vf histogram
  8248. @end example
  8249. @end itemize
  8250. @anchor{hqdn3d}
  8251. @section hqdn3d
  8252. This is a high precision/quality 3d denoise filter. It aims to reduce
  8253. image noise, producing smooth images and making still images really
  8254. still. It should enhance compressibility.
  8255. It accepts the following optional parameters:
  8256. @table @option
  8257. @item luma_spatial
  8258. A non-negative floating point number which specifies spatial luma strength.
  8259. It defaults to 4.0.
  8260. @item chroma_spatial
  8261. A non-negative floating point number which specifies spatial chroma strength.
  8262. It defaults to 3.0*@var{luma_spatial}/4.0.
  8263. @item luma_tmp
  8264. A floating point number which specifies luma temporal strength. It defaults to
  8265. 6.0*@var{luma_spatial}/4.0.
  8266. @item chroma_tmp
  8267. A floating point number which specifies chroma temporal strength. It defaults to
  8268. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8269. @end table
  8270. @anchor{hwdownload}
  8271. @section hwdownload
  8272. Download hardware frames to system memory.
  8273. The input must be in hardware frames, and the output a non-hardware format.
  8274. Not all formats will be supported on the output - it may be necessary to insert
  8275. an additional @option{format} filter immediately following in the graph to get
  8276. the output in a supported format.
  8277. @section hwmap
  8278. Map hardware frames to system memory or to another device.
  8279. This filter has several different modes of operation; which one is used depends
  8280. on the input and output formats:
  8281. @itemize
  8282. @item
  8283. Hardware frame input, normal frame output
  8284. Map the input frames to system memory and pass them to the output. If the
  8285. original hardware frame is later required (for example, after overlaying
  8286. something else on part of it), the @option{hwmap} filter can be used again
  8287. in the next mode to retrieve it.
  8288. @item
  8289. Normal frame input, hardware frame output
  8290. If the input is actually a software-mapped hardware frame, then unmap it -
  8291. that is, return the original hardware frame.
  8292. Otherwise, a device must be provided. Create new hardware surfaces on that
  8293. device for the output, then map them back to the software format at the input
  8294. and give those frames to the preceding filter. This will then act like the
  8295. @option{hwupload} filter, but may be able to avoid an additional copy when
  8296. the input is already in a compatible format.
  8297. @item
  8298. Hardware frame input and output
  8299. A device must be supplied for the output, either directly or with the
  8300. @option{derive_device} option. The input and output devices must be of
  8301. different types and compatible - the exact meaning of this is
  8302. system-dependent, but typically it means that they must refer to the same
  8303. underlying hardware context (for example, refer to the same graphics card).
  8304. If the input frames were originally created on the output device, then unmap
  8305. to retrieve the original frames.
  8306. Otherwise, map the frames to the output device - create new hardware frames
  8307. on the output corresponding to the frames on the input.
  8308. @end itemize
  8309. The following additional parameters are accepted:
  8310. @table @option
  8311. @item mode
  8312. Set the frame mapping mode. Some combination of:
  8313. @table @var
  8314. @item read
  8315. The mapped frame should be readable.
  8316. @item write
  8317. The mapped frame should be writeable.
  8318. @item overwrite
  8319. The mapping will always overwrite the entire frame.
  8320. This may improve performance in some cases, as the original contents of the
  8321. frame need not be loaded.
  8322. @item direct
  8323. The mapping must not involve any copying.
  8324. Indirect mappings to copies of frames are created in some cases where either
  8325. direct mapping is not possible or it would have unexpected properties.
  8326. Setting this flag ensures that the mapping is direct and will fail if that is
  8327. not possible.
  8328. @end table
  8329. Defaults to @var{read+write} if not specified.
  8330. @item derive_device @var{type}
  8331. Rather than using the device supplied at initialisation, instead derive a new
  8332. device of type @var{type} from the device the input frames exist on.
  8333. @item reverse
  8334. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8335. and map them back to the source. This may be necessary in some cases where
  8336. a mapping in one direction is required but only the opposite direction is
  8337. supported by the devices being used.
  8338. This option is dangerous - it may break the preceding filter in undefined
  8339. ways if there are any additional constraints on that filter's output.
  8340. Do not use it without fully understanding the implications of its use.
  8341. @end table
  8342. @anchor{hwupload}
  8343. @section hwupload
  8344. Upload system memory frames to hardware surfaces.
  8345. The device to upload to must be supplied when the filter is initialised. If
  8346. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8347. option.
  8348. @anchor{hwupload_cuda}
  8349. @section hwupload_cuda
  8350. Upload system memory frames to a CUDA device.
  8351. It accepts the following optional parameters:
  8352. @table @option
  8353. @item device
  8354. The number of the CUDA device to use
  8355. @end table
  8356. @section hqx
  8357. Apply a high-quality magnification filter designed for pixel art. This filter
  8358. was originally created by Maxim Stepin.
  8359. It accepts the following option:
  8360. @table @option
  8361. @item n
  8362. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8363. @code{hq3x} and @code{4} for @code{hq4x}.
  8364. Default is @code{3}.
  8365. @end table
  8366. @section hstack
  8367. Stack input videos horizontally.
  8368. All streams must be of same pixel format and of same height.
  8369. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8370. to create same output.
  8371. The filter accept the following option:
  8372. @table @option
  8373. @item inputs
  8374. Set number of input streams. Default is 2.
  8375. @item shortest
  8376. If set to 1, force the output to terminate when the shortest input
  8377. terminates. Default value is 0.
  8378. @end table
  8379. @section hue
  8380. Modify the hue and/or the saturation of the input.
  8381. It accepts the following parameters:
  8382. @table @option
  8383. @item h
  8384. Specify the hue angle as a number of degrees. It accepts an expression,
  8385. and defaults to "0".
  8386. @item s
  8387. Specify the saturation in the [-10,10] range. It accepts an expression and
  8388. defaults to "1".
  8389. @item H
  8390. Specify the hue angle as a number of radians. It accepts an
  8391. expression, and defaults to "0".
  8392. @item b
  8393. Specify the brightness in the [-10,10] range. It accepts an expression and
  8394. defaults to "0".
  8395. @end table
  8396. @option{h} and @option{H} are mutually exclusive, and can't be
  8397. specified at the same time.
  8398. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8399. expressions containing the following constants:
  8400. @table @option
  8401. @item n
  8402. frame count of the input frame starting from 0
  8403. @item pts
  8404. presentation timestamp of the input frame expressed in time base units
  8405. @item r
  8406. frame rate of the input video, NAN if the input frame rate is unknown
  8407. @item t
  8408. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8409. @item tb
  8410. time base of the input video
  8411. @end table
  8412. @subsection Examples
  8413. @itemize
  8414. @item
  8415. Set the hue to 90 degrees and the saturation to 1.0:
  8416. @example
  8417. hue=h=90:s=1
  8418. @end example
  8419. @item
  8420. Same command but expressing the hue in radians:
  8421. @example
  8422. hue=H=PI/2:s=1
  8423. @end example
  8424. @item
  8425. Rotate hue and make the saturation swing between 0
  8426. and 2 over a period of 1 second:
  8427. @example
  8428. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8429. @end example
  8430. @item
  8431. Apply a 3 seconds saturation fade-in effect starting at 0:
  8432. @example
  8433. hue="s=min(t/3\,1)"
  8434. @end example
  8435. The general fade-in expression can be written as:
  8436. @example
  8437. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8438. @end example
  8439. @item
  8440. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8441. @example
  8442. hue="s=max(0\, min(1\, (8-t)/3))"
  8443. @end example
  8444. The general fade-out expression can be written as:
  8445. @example
  8446. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8447. @end example
  8448. @end itemize
  8449. @subsection Commands
  8450. This filter supports the following commands:
  8451. @table @option
  8452. @item b
  8453. @item s
  8454. @item h
  8455. @item H
  8456. Modify the hue and/or the saturation and/or brightness of the input video.
  8457. The command accepts the same syntax of the corresponding option.
  8458. If the specified expression is not valid, it is kept at its current
  8459. value.
  8460. @end table
  8461. @section hysteresis
  8462. Grow first stream into second stream by connecting components.
  8463. This makes it possible to build more robust edge masks.
  8464. This filter accepts the following options:
  8465. @table @option
  8466. @item planes
  8467. Set which planes will be processed as bitmap, unprocessed planes will be
  8468. copied from first stream.
  8469. By default value 0xf, all planes will be processed.
  8470. @item threshold
  8471. Set threshold which is used in filtering. If pixel component value is higher than
  8472. this value filter algorithm for connecting components is activated.
  8473. By default value is 0.
  8474. @end table
  8475. @section idet
  8476. Detect video interlacing type.
  8477. This filter tries to detect if the input frames are interlaced, progressive,
  8478. top or bottom field first. It will also try to detect fields that are
  8479. repeated between adjacent frames (a sign of telecine).
  8480. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8481. Multiple frame detection incorporates the classification history of previous frames.
  8482. The filter will log these metadata values:
  8483. @table @option
  8484. @item single.current_frame
  8485. Detected type of current frame using single-frame detection. One of:
  8486. ``tff'' (top field first), ``bff'' (bottom field first),
  8487. ``progressive'', or ``undetermined''
  8488. @item single.tff
  8489. Cumulative number of frames detected as top field first using single-frame detection.
  8490. @item multiple.tff
  8491. Cumulative number of frames detected as top field first using multiple-frame detection.
  8492. @item single.bff
  8493. Cumulative number of frames detected as bottom field first using single-frame detection.
  8494. @item multiple.current_frame
  8495. Detected type of current frame using multiple-frame detection. One of:
  8496. ``tff'' (top field first), ``bff'' (bottom field first),
  8497. ``progressive'', or ``undetermined''
  8498. @item multiple.bff
  8499. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8500. @item single.progressive
  8501. Cumulative number of frames detected as progressive using single-frame detection.
  8502. @item multiple.progressive
  8503. Cumulative number of frames detected as progressive using multiple-frame detection.
  8504. @item single.undetermined
  8505. Cumulative number of frames that could not be classified using single-frame detection.
  8506. @item multiple.undetermined
  8507. Cumulative number of frames that could not be classified using multiple-frame detection.
  8508. @item repeated.current_frame
  8509. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8510. @item repeated.neither
  8511. Cumulative number of frames with no repeated field.
  8512. @item repeated.top
  8513. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8514. @item repeated.bottom
  8515. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8516. @end table
  8517. The filter accepts the following options:
  8518. @table @option
  8519. @item intl_thres
  8520. Set interlacing threshold.
  8521. @item prog_thres
  8522. Set progressive threshold.
  8523. @item rep_thres
  8524. Threshold for repeated field detection.
  8525. @item half_life
  8526. Number of frames after which a given frame's contribution to the
  8527. statistics is halved (i.e., it contributes only 0.5 to its
  8528. classification). The default of 0 means that all frames seen are given
  8529. full weight of 1.0 forever.
  8530. @item analyze_interlaced_flag
  8531. When this is not 0 then idet will use the specified number of frames to determine
  8532. if the interlaced flag is accurate, it will not count undetermined frames.
  8533. If the flag is found to be accurate it will be used without any further
  8534. computations, if it is found to be inaccurate it will be cleared without any
  8535. further computations. This allows inserting the idet filter as a low computational
  8536. method to clean up the interlaced flag
  8537. @end table
  8538. @section il
  8539. Deinterleave or interleave fields.
  8540. This filter allows one to process interlaced images fields without
  8541. deinterlacing them. Deinterleaving splits the input frame into 2
  8542. fields (so called half pictures). Odd lines are moved to the top
  8543. half of the output image, even lines to the bottom half.
  8544. You can process (filter) them independently and then re-interleave them.
  8545. The filter accepts the following options:
  8546. @table @option
  8547. @item luma_mode, l
  8548. @item chroma_mode, c
  8549. @item alpha_mode, a
  8550. Available values for @var{luma_mode}, @var{chroma_mode} and
  8551. @var{alpha_mode} are:
  8552. @table @samp
  8553. @item none
  8554. Do nothing.
  8555. @item deinterleave, d
  8556. Deinterleave fields, placing one above the other.
  8557. @item interleave, i
  8558. Interleave fields. Reverse the effect of deinterleaving.
  8559. @end table
  8560. Default value is @code{none}.
  8561. @item luma_swap, ls
  8562. @item chroma_swap, cs
  8563. @item alpha_swap, as
  8564. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8565. @end table
  8566. @section inflate
  8567. Apply inflate effect to the video.
  8568. This filter replaces the pixel by the local(3x3) average by taking into account
  8569. only values higher than the pixel.
  8570. It accepts the following options:
  8571. @table @option
  8572. @item threshold0
  8573. @item threshold1
  8574. @item threshold2
  8575. @item threshold3
  8576. Limit the maximum change for each plane, default is 65535.
  8577. If 0, plane will remain unchanged.
  8578. @end table
  8579. @section interlace
  8580. Simple interlacing filter from progressive contents. This interleaves upper (or
  8581. lower) lines from odd frames with lower (or upper) lines from even frames,
  8582. halving the frame rate and preserving image height.
  8583. @example
  8584. Original Original New Frame
  8585. Frame 'j' Frame 'j+1' (tff)
  8586. ========== =========== ==================
  8587. Line 0 --------------------> Frame 'j' Line 0
  8588. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8589. Line 2 ---------------------> Frame 'j' Line 2
  8590. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8591. ... ... ...
  8592. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8593. @end example
  8594. It accepts the following optional parameters:
  8595. @table @option
  8596. @item scan
  8597. This determines whether the interlaced frame is taken from the even
  8598. (tff - default) or odd (bff) lines of the progressive frame.
  8599. @item lowpass
  8600. Vertical lowpass filter to avoid twitter interlacing and
  8601. reduce moire patterns.
  8602. @table @samp
  8603. @item 0, off
  8604. Disable vertical lowpass filter
  8605. @item 1, linear
  8606. Enable linear filter (default)
  8607. @item 2, complex
  8608. Enable complex filter. This will slightly less reduce twitter and moire
  8609. but better retain detail and subjective sharpness impression.
  8610. @end table
  8611. @end table
  8612. @section kerndeint
  8613. Deinterlace input video by applying Donald Graft's adaptive kernel
  8614. deinterling. Work on interlaced parts of a video to produce
  8615. progressive frames.
  8616. The description of the accepted parameters follows.
  8617. @table @option
  8618. @item thresh
  8619. Set the threshold which affects the filter's tolerance when
  8620. determining if a pixel line must be processed. It must be an integer
  8621. in the range [0,255] and defaults to 10. A value of 0 will result in
  8622. applying the process on every pixels.
  8623. @item map
  8624. Paint pixels exceeding the threshold value to white if set to 1.
  8625. Default is 0.
  8626. @item order
  8627. Set the fields order. Swap fields if set to 1, leave fields alone if
  8628. 0. Default is 0.
  8629. @item sharp
  8630. Enable additional sharpening if set to 1. Default is 0.
  8631. @item twoway
  8632. Enable twoway sharpening if set to 1. Default is 0.
  8633. @end table
  8634. @subsection Examples
  8635. @itemize
  8636. @item
  8637. Apply default values:
  8638. @example
  8639. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8640. @end example
  8641. @item
  8642. Enable additional sharpening:
  8643. @example
  8644. kerndeint=sharp=1
  8645. @end example
  8646. @item
  8647. Paint processed pixels in white:
  8648. @example
  8649. kerndeint=map=1
  8650. @end example
  8651. @end itemize
  8652. @section lenscorrection
  8653. Correct radial lens distortion
  8654. This filter can be used to correct for radial distortion as can result from the use
  8655. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8656. one can use tools available for example as part of opencv or simply trial-and-error.
  8657. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8658. and extract the k1 and k2 coefficients from the resulting matrix.
  8659. Note that effectively the same filter is available in the open-source tools Krita and
  8660. Digikam from the KDE project.
  8661. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8662. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8663. brightness distribution, so you may want to use both filters together in certain
  8664. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8665. be applied before or after lens correction.
  8666. @subsection Options
  8667. The filter accepts the following options:
  8668. @table @option
  8669. @item cx
  8670. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8671. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8672. width. Default is 0.5.
  8673. @item cy
  8674. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8675. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8676. height. Default is 0.5.
  8677. @item k1
  8678. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8679. no correction. Default is 0.
  8680. @item k2
  8681. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8682. 0 means no correction. Default is 0.
  8683. @end table
  8684. The formula that generates the correction is:
  8685. @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)
  8686. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8687. distances from the focal point in the source and target images, respectively.
  8688. @section lensfun
  8689. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8690. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8691. to apply the lens correction. The filter will load the lensfun database and
  8692. query it to find the corresponding camera and lens entries in the database. As
  8693. long as these entries can be found with the given options, the filter can
  8694. perform corrections on frames. Note that incomplete strings will result in the
  8695. filter choosing the best match with the given options, and the filter will
  8696. output the chosen camera and lens models (logged with level "info"). You must
  8697. provide the make, camera model, and lens model as they are required.
  8698. The filter accepts the following options:
  8699. @table @option
  8700. @item make
  8701. The make of the camera (for example, "Canon"). This option is required.
  8702. @item model
  8703. The model of the camera (for example, "Canon EOS 100D"). This option is
  8704. required.
  8705. @item lens_model
  8706. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8707. option is required.
  8708. @item mode
  8709. The type of correction to apply. The following values are valid options:
  8710. @table @samp
  8711. @item vignetting
  8712. Enables fixing lens vignetting.
  8713. @item geometry
  8714. Enables fixing lens geometry. This is the default.
  8715. @item subpixel
  8716. Enables fixing chromatic aberrations.
  8717. @item vig_geo
  8718. Enables fixing lens vignetting and lens geometry.
  8719. @item vig_subpixel
  8720. Enables fixing lens vignetting and chromatic aberrations.
  8721. @item distortion
  8722. Enables fixing both lens geometry and chromatic aberrations.
  8723. @item all
  8724. Enables all possible corrections.
  8725. @end table
  8726. @item focal_length
  8727. The focal length of the image/video (zoom; expected constant for video). For
  8728. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8729. range should be chosen when using that lens. Default 18.
  8730. @item aperture
  8731. The aperture of the image/video (expected constant for video). Note that
  8732. aperture is only used for vignetting correction. Default 3.5.
  8733. @item focus_distance
  8734. The focus distance of the image/video (expected constant for video). Note that
  8735. focus distance is only used for vignetting and only slightly affects the
  8736. vignetting correction process. If unknown, leave it at the default value (which
  8737. is 1000).
  8738. @item scale
  8739. The scale factor which is applied after transformation. After correction the
  8740. video is no longer necessarily rectangular. This parameter controls how much of
  8741. the resulting image is visible. The value 0 means that a value will be chosen
  8742. automatically such that there is little or no unmapped area in the output
  8743. image. 1.0 means that no additional scaling is done. Lower values may result
  8744. in more of the corrected image being visible, while higher values may avoid
  8745. unmapped areas in the output.
  8746. @item target_geometry
  8747. The target geometry of the output image/video. The following values are valid
  8748. options:
  8749. @table @samp
  8750. @item rectilinear (default)
  8751. @item fisheye
  8752. @item panoramic
  8753. @item equirectangular
  8754. @item fisheye_orthographic
  8755. @item fisheye_stereographic
  8756. @item fisheye_equisolid
  8757. @item fisheye_thoby
  8758. @end table
  8759. @item reverse
  8760. Apply the reverse of image correction (instead of correcting distortion, apply
  8761. it).
  8762. @item interpolation
  8763. The type of interpolation used when correcting distortion. The following values
  8764. are valid options:
  8765. @table @samp
  8766. @item nearest
  8767. @item linear (default)
  8768. @item lanczos
  8769. @end table
  8770. @end table
  8771. @subsection Examples
  8772. @itemize
  8773. @item
  8774. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8775. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8776. aperture of "8.0".
  8777. @example
  8778. 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
  8779. @end example
  8780. @item
  8781. Apply the same as before, but only for the first 5 seconds of video.
  8782. @example
  8783. 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
  8784. @end example
  8785. @end itemize
  8786. @section libvmaf
  8787. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8788. score between two input videos.
  8789. The obtained VMAF score is printed through the logging system.
  8790. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8791. After installing the library it can be enabled using:
  8792. @code{./configure --enable-libvmaf --enable-version3}.
  8793. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8794. The filter has following options:
  8795. @table @option
  8796. @item model_path
  8797. Set the model path which is to be used for SVM.
  8798. Default value: @code{"vmaf_v0.6.1.pkl"}
  8799. @item log_path
  8800. Set the file path to be used to store logs.
  8801. @item log_fmt
  8802. Set the format of the log file (xml or json).
  8803. @item enable_transform
  8804. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8805. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8806. Default value: @code{false}
  8807. @item phone_model
  8808. Invokes the phone model which will generate VMAF scores higher than in the
  8809. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8810. @item psnr
  8811. Enables computing psnr along with vmaf.
  8812. @item ssim
  8813. Enables computing ssim along with vmaf.
  8814. @item ms_ssim
  8815. Enables computing ms_ssim along with vmaf.
  8816. @item pool
  8817. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8818. @item n_threads
  8819. Set number of threads to be used when computing vmaf.
  8820. @item n_subsample
  8821. Set interval for frame subsampling used when computing vmaf.
  8822. @item enable_conf_interval
  8823. Enables confidence interval.
  8824. @end table
  8825. This filter also supports the @ref{framesync} options.
  8826. On the below examples the input file @file{main.mpg} being processed is
  8827. compared with the reference file @file{ref.mpg}.
  8828. @example
  8829. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8830. @end example
  8831. Example with options:
  8832. @example
  8833. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8834. @end example
  8835. @section limiter
  8836. Limits the pixel components values to the specified range [min, max].
  8837. The filter accepts the following options:
  8838. @table @option
  8839. @item min
  8840. Lower bound. Defaults to the lowest allowed value for the input.
  8841. @item max
  8842. Upper bound. Defaults to the highest allowed value for the input.
  8843. @item planes
  8844. Specify which planes will be processed. Defaults to all available.
  8845. @end table
  8846. @section loop
  8847. Loop video frames.
  8848. The filter accepts the following options:
  8849. @table @option
  8850. @item loop
  8851. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8852. Default is 0.
  8853. @item size
  8854. Set maximal size in number of frames. Default is 0.
  8855. @item start
  8856. Set first frame of loop. Default is 0.
  8857. @end table
  8858. @subsection Examples
  8859. @itemize
  8860. @item
  8861. Loop single first frame infinitely:
  8862. @example
  8863. loop=loop=-1:size=1:start=0
  8864. @end example
  8865. @item
  8866. Loop single first frame 10 times:
  8867. @example
  8868. loop=loop=10:size=1:start=0
  8869. @end example
  8870. @item
  8871. Loop 10 first frames 5 times:
  8872. @example
  8873. loop=loop=5:size=10:start=0
  8874. @end example
  8875. @end itemize
  8876. @section lut1d
  8877. Apply a 1D LUT to an input video.
  8878. The filter accepts the following options:
  8879. @table @option
  8880. @item file
  8881. Set the 1D LUT file name.
  8882. Currently supported formats:
  8883. @table @samp
  8884. @item cube
  8885. Iridas
  8886. @end table
  8887. @item interp
  8888. Select interpolation mode.
  8889. Available values are:
  8890. @table @samp
  8891. @item nearest
  8892. Use values from the nearest defined point.
  8893. @item linear
  8894. Interpolate values using the linear interpolation.
  8895. @item cosine
  8896. Interpolate values using the cosine interpolation.
  8897. @item cubic
  8898. Interpolate values using the cubic interpolation.
  8899. @item spline
  8900. Interpolate values using the spline interpolation.
  8901. @end table
  8902. @end table
  8903. @anchor{lut3d}
  8904. @section lut3d
  8905. Apply a 3D LUT to an input video.
  8906. The filter accepts the following options:
  8907. @table @option
  8908. @item file
  8909. Set the 3D LUT file name.
  8910. Currently supported formats:
  8911. @table @samp
  8912. @item 3dl
  8913. AfterEffects
  8914. @item cube
  8915. Iridas
  8916. @item dat
  8917. DaVinci
  8918. @item m3d
  8919. Pandora
  8920. @end table
  8921. @item interp
  8922. Select interpolation mode.
  8923. Available values are:
  8924. @table @samp
  8925. @item nearest
  8926. Use values from the nearest defined point.
  8927. @item trilinear
  8928. Interpolate values using the 8 points defining a cube.
  8929. @item tetrahedral
  8930. Interpolate values using a tetrahedron.
  8931. @end table
  8932. @end table
  8933. This filter also supports the @ref{framesync} options.
  8934. @section lumakey
  8935. Turn certain luma values into transparency.
  8936. The filter accepts the following options:
  8937. @table @option
  8938. @item threshold
  8939. Set the luma which will be used as base for transparency.
  8940. Default value is @code{0}.
  8941. @item tolerance
  8942. Set the range of luma values to be keyed out.
  8943. Default value is @code{0}.
  8944. @item softness
  8945. Set the range of softness. Default value is @code{0}.
  8946. Use this to control gradual transition from zero to full transparency.
  8947. @end table
  8948. @section lut, lutrgb, lutyuv
  8949. Compute a look-up table for binding each pixel component input value
  8950. to an output value, and apply it to the input video.
  8951. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8952. to an RGB input video.
  8953. These filters accept the following parameters:
  8954. @table @option
  8955. @item c0
  8956. set first pixel component expression
  8957. @item c1
  8958. set second pixel component expression
  8959. @item c2
  8960. set third pixel component expression
  8961. @item c3
  8962. set fourth pixel component expression, corresponds to the alpha component
  8963. @item r
  8964. set red component expression
  8965. @item g
  8966. set green component expression
  8967. @item b
  8968. set blue component expression
  8969. @item a
  8970. alpha component expression
  8971. @item y
  8972. set Y/luminance component expression
  8973. @item u
  8974. set U/Cb component expression
  8975. @item v
  8976. set V/Cr component expression
  8977. @end table
  8978. Each of them specifies the expression to use for computing the lookup table for
  8979. the corresponding pixel component values.
  8980. The exact component associated to each of the @var{c*} options depends on the
  8981. format in input.
  8982. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8983. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8984. The expressions can contain the following constants and functions:
  8985. @table @option
  8986. @item w
  8987. @item h
  8988. The input width and height.
  8989. @item val
  8990. The input value for the pixel component.
  8991. @item clipval
  8992. The input value, clipped to the @var{minval}-@var{maxval} range.
  8993. @item maxval
  8994. The maximum value for the pixel component.
  8995. @item minval
  8996. The minimum value for the pixel component.
  8997. @item negval
  8998. The negated value for the pixel component value, clipped to the
  8999. @var{minval}-@var{maxval} range; it corresponds to the expression
  9000. "maxval-clipval+minval".
  9001. @item clip(val)
  9002. The computed value in @var{val}, clipped to the
  9003. @var{minval}-@var{maxval} range.
  9004. @item gammaval(gamma)
  9005. The computed gamma correction value of the pixel component value,
  9006. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9007. expression
  9008. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9009. @end table
  9010. All expressions default to "val".
  9011. @subsection Examples
  9012. @itemize
  9013. @item
  9014. Negate input video:
  9015. @example
  9016. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9017. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9018. @end example
  9019. The above is the same as:
  9020. @example
  9021. lutrgb="r=negval:g=negval:b=negval"
  9022. lutyuv="y=negval:u=negval:v=negval"
  9023. @end example
  9024. @item
  9025. Negate luminance:
  9026. @example
  9027. lutyuv=y=negval
  9028. @end example
  9029. @item
  9030. Remove chroma components, turning the video into a graytone image:
  9031. @example
  9032. lutyuv="u=128:v=128"
  9033. @end example
  9034. @item
  9035. Apply a luma burning effect:
  9036. @example
  9037. lutyuv="y=2*val"
  9038. @end example
  9039. @item
  9040. Remove green and blue components:
  9041. @example
  9042. lutrgb="g=0:b=0"
  9043. @end example
  9044. @item
  9045. Set a constant alpha channel value on input:
  9046. @example
  9047. format=rgba,lutrgb=a="maxval-minval/2"
  9048. @end example
  9049. @item
  9050. Correct luminance gamma by a factor of 0.5:
  9051. @example
  9052. lutyuv=y=gammaval(0.5)
  9053. @end example
  9054. @item
  9055. Discard least significant bits of luma:
  9056. @example
  9057. lutyuv=y='bitand(val, 128+64+32)'
  9058. @end example
  9059. @item
  9060. Technicolor like effect:
  9061. @example
  9062. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9063. @end example
  9064. @end itemize
  9065. @section lut2, tlut2
  9066. The @code{lut2} filter takes two input streams and outputs one
  9067. stream.
  9068. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9069. from one single stream.
  9070. This filter accepts the following parameters:
  9071. @table @option
  9072. @item c0
  9073. set first pixel component expression
  9074. @item c1
  9075. set second pixel component expression
  9076. @item c2
  9077. set third pixel component expression
  9078. @item c3
  9079. set fourth pixel component expression, corresponds to the alpha component
  9080. @item d
  9081. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9082. which means bit depth is automatically picked from first input format.
  9083. @end table
  9084. Each of them specifies the expression to use for computing the lookup table for
  9085. the corresponding pixel component values.
  9086. The exact component associated to each of the @var{c*} options depends on the
  9087. format in inputs.
  9088. The expressions can contain the following constants:
  9089. @table @option
  9090. @item w
  9091. @item h
  9092. The input width and height.
  9093. @item x
  9094. The first input value for the pixel component.
  9095. @item y
  9096. The second input value for the pixel component.
  9097. @item bdx
  9098. The first input video bit depth.
  9099. @item bdy
  9100. The second input video bit depth.
  9101. @end table
  9102. All expressions default to "x".
  9103. @subsection Examples
  9104. @itemize
  9105. @item
  9106. Highlight differences between two RGB video streams:
  9107. @example
  9108. 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)'
  9109. @end example
  9110. @item
  9111. Highlight differences between two YUV video streams:
  9112. @example
  9113. 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)'
  9114. @end example
  9115. @item
  9116. Show max difference between two video streams:
  9117. @example
  9118. 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)))'
  9119. @end example
  9120. @end itemize
  9121. @section maskedclamp
  9122. Clamp the first input stream with the second input and third input stream.
  9123. Returns the value of first stream to be between second input
  9124. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9125. This filter accepts the following options:
  9126. @table @option
  9127. @item undershoot
  9128. Default value is @code{0}.
  9129. @item overshoot
  9130. Default value is @code{0}.
  9131. @item planes
  9132. Set which planes will be processed as bitmap, unprocessed planes will be
  9133. copied from first stream.
  9134. By default value 0xf, all planes will be processed.
  9135. @end table
  9136. @section maskedmerge
  9137. Merge the first input stream with the second input stream using per pixel
  9138. weights in the third input stream.
  9139. A value of 0 in the third stream pixel component means that pixel component
  9140. from first stream is returned unchanged, while maximum value (eg. 255 for
  9141. 8-bit videos) means that pixel component from second stream is returned
  9142. unchanged. Intermediate values define the amount of merging between both
  9143. input stream's pixel components.
  9144. This filter accepts the following options:
  9145. @table @option
  9146. @item planes
  9147. Set which planes will be processed as bitmap, unprocessed planes will be
  9148. copied from first stream.
  9149. By default value 0xf, all planes will be processed.
  9150. @end table
  9151. @section maskfun
  9152. Create mask from input video.
  9153. For example it is useful to create motion masks after @code{tblend} filter.
  9154. This filter accepts the following options:
  9155. @table @option
  9156. @item low
  9157. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9158. @item high
  9159. Set high threshold. Any pixel component higher than this value will be set to max value
  9160. allowed for current pixel format.
  9161. @item planes
  9162. Set planes to filter, by default all available planes are filtered.
  9163. @item fill
  9164. Fill all frame pixels with this value.
  9165. @item sum
  9166. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9167. average, output frame will be completely filled with value set by @var{fill} option.
  9168. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9169. @end table
  9170. @section mcdeint
  9171. Apply motion-compensation deinterlacing.
  9172. It needs one field per frame as input and must thus be used together
  9173. with yadif=1/3 or equivalent.
  9174. This filter accepts the following options:
  9175. @table @option
  9176. @item mode
  9177. Set the deinterlacing mode.
  9178. It accepts one of the following values:
  9179. @table @samp
  9180. @item fast
  9181. @item medium
  9182. @item slow
  9183. use iterative motion estimation
  9184. @item extra_slow
  9185. like @samp{slow}, but use multiple reference frames.
  9186. @end table
  9187. Default value is @samp{fast}.
  9188. @item parity
  9189. Set the picture field parity assumed for the input video. It must be
  9190. one of the following values:
  9191. @table @samp
  9192. @item 0, tff
  9193. assume top field first
  9194. @item 1, bff
  9195. assume bottom field first
  9196. @end table
  9197. Default value is @samp{bff}.
  9198. @item qp
  9199. Set per-block quantization parameter (QP) used by the internal
  9200. encoder.
  9201. Higher values should result in a smoother motion vector field but less
  9202. optimal individual vectors. Default value is 1.
  9203. @end table
  9204. @section mergeplanes
  9205. Merge color channel components from several video streams.
  9206. The filter accepts up to 4 input streams, and merge selected input
  9207. planes to the output video.
  9208. This filter accepts the following options:
  9209. @table @option
  9210. @item mapping
  9211. Set input to output plane mapping. Default is @code{0}.
  9212. The mappings is specified as a bitmap. It should be specified as a
  9213. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9214. mapping for the first plane of the output stream. 'A' sets the number of
  9215. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9216. corresponding input to use (from 0 to 3). The rest of the mappings is
  9217. similar, 'Bb' describes the mapping for the output stream second
  9218. plane, 'Cc' describes the mapping for the output stream third plane and
  9219. 'Dd' describes the mapping for the output stream fourth plane.
  9220. @item format
  9221. Set output pixel format. Default is @code{yuva444p}.
  9222. @end table
  9223. @subsection Examples
  9224. @itemize
  9225. @item
  9226. Merge three gray video streams of same width and height into single video stream:
  9227. @example
  9228. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9229. @end example
  9230. @item
  9231. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9232. @example
  9233. [a0][a1]mergeplanes=0x00010210:yuva444p
  9234. @end example
  9235. @item
  9236. Swap Y and A plane in yuva444p stream:
  9237. @example
  9238. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9239. @end example
  9240. @item
  9241. Swap U and V plane in yuv420p stream:
  9242. @example
  9243. format=yuv420p,mergeplanes=0x000201:yuv420p
  9244. @end example
  9245. @item
  9246. Cast a rgb24 clip to yuv444p:
  9247. @example
  9248. format=rgb24,mergeplanes=0x000102:yuv444p
  9249. @end example
  9250. @end itemize
  9251. @section mestimate
  9252. Estimate and export motion vectors using block matching algorithms.
  9253. Motion vectors are stored in frame side data to be used by other filters.
  9254. This filter accepts the following options:
  9255. @table @option
  9256. @item method
  9257. Specify the motion estimation method. Accepts one of the following values:
  9258. @table @samp
  9259. @item esa
  9260. Exhaustive search algorithm.
  9261. @item tss
  9262. Three step search algorithm.
  9263. @item tdls
  9264. Two dimensional logarithmic search algorithm.
  9265. @item ntss
  9266. New three step search algorithm.
  9267. @item fss
  9268. Four step search algorithm.
  9269. @item ds
  9270. Diamond search algorithm.
  9271. @item hexbs
  9272. Hexagon-based search algorithm.
  9273. @item epzs
  9274. Enhanced predictive zonal search algorithm.
  9275. @item umh
  9276. Uneven multi-hexagon search algorithm.
  9277. @end table
  9278. Default value is @samp{esa}.
  9279. @item mb_size
  9280. Macroblock size. Default @code{16}.
  9281. @item search_param
  9282. Search parameter. Default @code{7}.
  9283. @end table
  9284. @section midequalizer
  9285. Apply Midway Image Equalization effect using two video streams.
  9286. Midway Image Equalization adjusts a pair of images to have the same
  9287. histogram, while maintaining their dynamics as much as possible. It's
  9288. useful for e.g. matching exposures from a pair of stereo cameras.
  9289. This filter has two inputs and one output, which must be of same pixel format, but
  9290. may be of different sizes. The output of filter is first input adjusted with
  9291. midway histogram of both inputs.
  9292. This filter accepts the following option:
  9293. @table @option
  9294. @item planes
  9295. Set which planes to process. Default is @code{15}, which is all available planes.
  9296. @end table
  9297. @section minterpolate
  9298. Convert the video to specified frame rate using motion interpolation.
  9299. This filter accepts the following options:
  9300. @table @option
  9301. @item fps
  9302. 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}.
  9303. @item mi_mode
  9304. Motion interpolation mode. Following values are accepted:
  9305. @table @samp
  9306. @item dup
  9307. Duplicate previous or next frame for interpolating new ones.
  9308. @item blend
  9309. Blend source frames. Interpolated frame is mean of previous and next frames.
  9310. @item mci
  9311. Motion compensated interpolation. Following options are effective when this mode is selected:
  9312. @table @samp
  9313. @item mc_mode
  9314. Motion compensation mode. Following values are accepted:
  9315. @table @samp
  9316. @item obmc
  9317. Overlapped block motion compensation.
  9318. @item aobmc
  9319. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9320. @end table
  9321. Default mode is @samp{obmc}.
  9322. @item me_mode
  9323. Motion estimation mode. Following values are accepted:
  9324. @table @samp
  9325. @item bidir
  9326. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9327. @item bilat
  9328. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9329. @end table
  9330. Default mode is @samp{bilat}.
  9331. @item me
  9332. The algorithm to be used for motion estimation. Following values are accepted:
  9333. @table @samp
  9334. @item esa
  9335. Exhaustive search algorithm.
  9336. @item tss
  9337. Three step search algorithm.
  9338. @item tdls
  9339. Two dimensional logarithmic search algorithm.
  9340. @item ntss
  9341. New three step search algorithm.
  9342. @item fss
  9343. Four step search algorithm.
  9344. @item ds
  9345. Diamond search algorithm.
  9346. @item hexbs
  9347. Hexagon-based search algorithm.
  9348. @item epzs
  9349. Enhanced predictive zonal search algorithm.
  9350. @item umh
  9351. Uneven multi-hexagon search algorithm.
  9352. @end table
  9353. Default algorithm is @samp{epzs}.
  9354. @item mb_size
  9355. Macroblock size. Default @code{16}.
  9356. @item search_param
  9357. Motion estimation search parameter. Default @code{32}.
  9358. @item vsbmc
  9359. 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).
  9360. @end table
  9361. @end table
  9362. @item scd
  9363. 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:
  9364. @table @samp
  9365. @item none
  9366. Disable scene change detection.
  9367. @item fdiff
  9368. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9369. @end table
  9370. Default method is @samp{fdiff}.
  9371. @item scd_threshold
  9372. Scene change detection threshold. Default is @code{5.0}.
  9373. @end table
  9374. @section mix
  9375. Mix several video input streams into one video stream.
  9376. A description of the accepted options follows.
  9377. @table @option
  9378. @item nb_inputs
  9379. The number of inputs. If unspecified, it defaults to 2.
  9380. @item weights
  9381. Specify weight of each input video stream as sequence.
  9382. Each weight is separated by space. If number of weights
  9383. is smaller than number of @var{frames} last specified
  9384. weight will be used for all remaining unset weights.
  9385. @item scale
  9386. Specify scale, if it is set it will be multiplied with sum
  9387. of each weight multiplied with pixel values to give final destination
  9388. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9389. @item duration
  9390. Specify how end of stream is determined.
  9391. @table @samp
  9392. @item longest
  9393. The duration of the longest input. (default)
  9394. @item shortest
  9395. The duration of the shortest input.
  9396. @item first
  9397. The duration of the first input.
  9398. @end table
  9399. @end table
  9400. @section mpdecimate
  9401. Drop frames that do not differ greatly from the previous frame in
  9402. order to reduce frame rate.
  9403. The main use of this filter is for very-low-bitrate encoding
  9404. (e.g. streaming over dialup modem), but it could in theory be used for
  9405. fixing movies that were inverse-telecined incorrectly.
  9406. A description of the accepted options follows.
  9407. @table @option
  9408. @item max
  9409. Set the maximum number of consecutive frames which can be dropped (if
  9410. positive), or the minimum interval between dropped frames (if
  9411. negative). If the value is 0, the frame is dropped disregarding the
  9412. number of previous sequentially dropped frames.
  9413. Default value is 0.
  9414. @item hi
  9415. @item lo
  9416. @item frac
  9417. Set the dropping threshold values.
  9418. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9419. represent actual pixel value differences, so a threshold of 64
  9420. corresponds to 1 unit of difference for each pixel, or the same spread
  9421. out differently over the block.
  9422. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9423. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9424. meaning the whole image) differ by more than a threshold of @option{lo}.
  9425. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9426. 64*5, and default value for @option{frac} is 0.33.
  9427. @end table
  9428. @section negate
  9429. Negate (invert) the input video.
  9430. It accepts the following option:
  9431. @table @option
  9432. @item negate_alpha
  9433. With value 1, it negates the alpha component, if present. Default value is 0.
  9434. @end table
  9435. @anchor{nlmeans}
  9436. @section nlmeans
  9437. Denoise frames using Non-Local Means algorithm.
  9438. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9439. context similarity is defined by comparing their surrounding patches of size
  9440. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9441. around the pixel.
  9442. Note that the research area defines centers for patches, which means some
  9443. patches will be made of pixels outside that research area.
  9444. The filter accepts the following options.
  9445. @table @option
  9446. @item s
  9447. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9448. @item p
  9449. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9450. @item pc
  9451. Same as @option{p} but for chroma planes.
  9452. The default value is @var{0} and means automatic.
  9453. @item r
  9454. Set research size. Default is 15. Must be odd number in range [0, 99].
  9455. @item rc
  9456. Same as @option{r} but for chroma planes.
  9457. The default value is @var{0} and means automatic.
  9458. @end table
  9459. @section nnedi
  9460. Deinterlace video using neural network edge directed interpolation.
  9461. This filter accepts the following options:
  9462. @table @option
  9463. @item weights
  9464. Mandatory option, without binary file filter can not work.
  9465. Currently file can be found here:
  9466. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9467. @item deint
  9468. Set which frames to deinterlace, by default it is @code{all}.
  9469. Can be @code{all} or @code{interlaced}.
  9470. @item field
  9471. Set mode of operation.
  9472. Can be one of the following:
  9473. @table @samp
  9474. @item af
  9475. Use frame flags, both fields.
  9476. @item a
  9477. Use frame flags, single field.
  9478. @item t
  9479. Use top field only.
  9480. @item b
  9481. Use bottom field only.
  9482. @item tf
  9483. Use both fields, top first.
  9484. @item bf
  9485. Use both fields, bottom first.
  9486. @end table
  9487. @item planes
  9488. Set which planes to process, by default filter process all frames.
  9489. @item nsize
  9490. Set size of local neighborhood around each pixel, used by the predictor neural
  9491. network.
  9492. Can be one of the following:
  9493. @table @samp
  9494. @item s8x6
  9495. @item s16x6
  9496. @item s32x6
  9497. @item s48x6
  9498. @item s8x4
  9499. @item s16x4
  9500. @item s32x4
  9501. @end table
  9502. @item nns
  9503. Set the number of neurons in predictor neural network.
  9504. Can be one of the following:
  9505. @table @samp
  9506. @item n16
  9507. @item n32
  9508. @item n64
  9509. @item n128
  9510. @item n256
  9511. @end table
  9512. @item qual
  9513. Controls the number of different neural network predictions that are blended
  9514. together to compute the final output value. Can be @code{fast}, default or
  9515. @code{slow}.
  9516. @item etype
  9517. Set which set of weights to use in the predictor.
  9518. Can be one of the following:
  9519. @table @samp
  9520. @item a
  9521. weights trained to minimize absolute error
  9522. @item s
  9523. weights trained to minimize squared error
  9524. @end table
  9525. @item pscrn
  9526. Controls whether or not the prescreener neural network is used to decide
  9527. which pixels should be processed by the predictor neural network and which
  9528. can be handled by simple cubic interpolation.
  9529. The prescreener is trained to know whether cubic interpolation will be
  9530. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9531. The computational complexity of the prescreener nn is much less than that of
  9532. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9533. using the prescreener generally results in much faster processing.
  9534. The prescreener is pretty accurate, so the difference between using it and not
  9535. using it is almost always unnoticeable.
  9536. Can be one of the following:
  9537. @table @samp
  9538. @item none
  9539. @item original
  9540. @item new
  9541. @end table
  9542. Default is @code{new}.
  9543. @item fapprox
  9544. Set various debugging flags.
  9545. @end table
  9546. @section noformat
  9547. Force libavfilter not to use any of the specified pixel formats for the
  9548. input to the next filter.
  9549. It accepts the following parameters:
  9550. @table @option
  9551. @item pix_fmts
  9552. A '|'-separated list of pixel format names, such as
  9553. pix_fmts=yuv420p|monow|rgb24".
  9554. @end table
  9555. @subsection Examples
  9556. @itemize
  9557. @item
  9558. Force libavfilter to use a format different from @var{yuv420p} for the
  9559. input to the vflip filter:
  9560. @example
  9561. noformat=pix_fmts=yuv420p,vflip
  9562. @end example
  9563. @item
  9564. Convert the input video to any of the formats not contained in the list:
  9565. @example
  9566. noformat=yuv420p|yuv444p|yuv410p
  9567. @end example
  9568. @end itemize
  9569. @section noise
  9570. Add noise on video input frame.
  9571. The filter accepts the following options:
  9572. @table @option
  9573. @item all_seed
  9574. @item c0_seed
  9575. @item c1_seed
  9576. @item c2_seed
  9577. @item c3_seed
  9578. Set noise seed for specific pixel component or all pixel components in case
  9579. of @var{all_seed}. Default value is @code{123457}.
  9580. @item all_strength, alls
  9581. @item c0_strength, c0s
  9582. @item c1_strength, c1s
  9583. @item c2_strength, c2s
  9584. @item c3_strength, c3s
  9585. Set noise strength for specific pixel component or all pixel components in case
  9586. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9587. @item all_flags, allf
  9588. @item c0_flags, c0f
  9589. @item c1_flags, c1f
  9590. @item c2_flags, c2f
  9591. @item c3_flags, c3f
  9592. Set pixel component flags or set flags for all components if @var{all_flags}.
  9593. Available values for component flags are:
  9594. @table @samp
  9595. @item a
  9596. averaged temporal noise (smoother)
  9597. @item p
  9598. mix random noise with a (semi)regular pattern
  9599. @item t
  9600. temporal noise (noise pattern changes between frames)
  9601. @item u
  9602. uniform noise (gaussian otherwise)
  9603. @end table
  9604. @end table
  9605. @subsection Examples
  9606. Add temporal and uniform noise to input video:
  9607. @example
  9608. noise=alls=20:allf=t+u
  9609. @end example
  9610. @section normalize
  9611. Normalize RGB video (aka histogram stretching, contrast stretching).
  9612. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9613. For each channel of each frame, the filter computes the input range and maps
  9614. it linearly to the user-specified output range. The output range defaults
  9615. to the full dynamic range from pure black to pure white.
  9616. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9617. changes in brightness) caused when small dark or bright objects enter or leave
  9618. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9619. video camera, and, like a video camera, it may cause a period of over- or
  9620. under-exposure of the video.
  9621. The R,G,B channels can be normalized independently, which may cause some
  9622. color shifting, or linked together as a single channel, which prevents
  9623. color shifting. Linked normalization preserves hue. Independent normalization
  9624. does not, so it can be used to remove some color casts. Independent and linked
  9625. normalization can be combined in any ratio.
  9626. The normalize filter accepts the following options:
  9627. @table @option
  9628. @item blackpt
  9629. @item whitept
  9630. Colors which define the output range. The minimum input value is mapped to
  9631. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9632. The defaults are black and white respectively. Specifying white for
  9633. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9634. normalized video. Shades of grey can be used to reduce the dynamic range
  9635. (contrast). Specifying saturated colors here can create some interesting
  9636. effects.
  9637. @item smoothing
  9638. The number of previous frames to use for temporal smoothing. The input range
  9639. of each channel is smoothed using a rolling average over the current frame
  9640. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9641. smoothing).
  9642. @item independence
  9643. Controls the ratio of independent (color shifting) channel normalization to
  9644. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9645. independent. Defaults to 1.0 (fully independent).
  9646. @item strength
  9647. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9648. expensive no-op. Defaults to 1.0 (full strength).
  9649. @end table
  9650. @subsection Examples
  9651. Stretch video contrast to use the full dynamic range, with no temporal
  9652. smoothing; may flicker depending on the source content:
  9653. @example
  9654. normalize=blackpt=black:whitept=white:smoothing=0
  9655. @end example
  9656. As above, but with 50 frames of temporal smoothing; flicker should be
  9657. reduced, depending on the source content:
  9658. @example
  9659. normalize=blackpt=black:whitept=white:smoothing=50
  9660. @end example
  9661. As above, but with hue-preserving linked channel normalization:
  9662. @example
  9663. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9664. @end example
  9665. As above, but with half strength:
  9666. @example
  9667. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9668. @end example
  9669. Map the darkest input color to red, the brightest input color to cyan:
  9670. @example
  9671. normalize=blackpt=red:whitept=cyan
  9672. @end example
  9673. @section null
  9674. Pass the video source unchanged to the output.
  9675. @section ocr
  9676. Optical Character Recognition
  9677. This filter uses Tesseract for optical character recognition. To enable
  9678. compilation of this filter, you need to configure FFmpeg with
  9679. @code{--enable-libtesseract}.
  9680. It accepts the following options:
  9681. @table @option
  9682. @item datapath
  9683. Set datapath to tesseract data. Default is to use whatever was
  9684. set at installation.
  9685. @item language
  9686. Set language, default is "eng".
  9687. @item whitelist
  9688. Set character whitelist.
  9689. @item blacklist
  9690. Set character blacklist.
  9691. @end table
  9692. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9693. @section ocv
  9694. Apply a video transform using libopencv.
  9695. To enable this filter, install the libopencv library and headers and
  9696. configure FFmpeg with @code{--enable-libopencv}.
  9697. It accepts the following parameters:
  9698. @table @option
  9699. @item filter_name
  9700. The name of the libopencv filter to apply.
  9701. @item filter_params
  9702. The parameters to pass to the libopencv filter. If not specified, the default
  9703. values are assumed.
  9704. @end table
  9705. Refer to the official libopencv documentation for more precise
  9706. information:
  9707. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9708. Several libopencv filters are supported; see the following subsections.
  9709. @anchor{dilate}
  9710. @subsection dilate
  9711. Dilate an image by using a specific structuring element.
  9712. It corresponds to the libopencv function @code{cvDilate}.
  9713. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9714. @var{struct_el} represents a structuring element, and has the syntax:
  9715. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9716. @var{cols} and @var{rows} represent the number of columns and rows of
  9717. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9718. point, and @var{shape} the shape for the structuring element. @var{shape}
  9719. must be "rect", "cross", "ellipse", or "custom".
  9720. If the value for @var{shape} is "custom", it must be followed by a
  9721. string of the form "=@var{filename}". The file with name
  9722. @var{filename} is assumed to represent a binary image, with each
  9723. printable character corresponding to a bright pixel. When a custom
  9724. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9725. or columns and rows of the read file are assumed instead.
  9726. The default value for @var{struct_el} is "3x3+0x0/rect".
  9727. @var{nb_iterations} specifies the number of times the transform is
  9728. applied to the image, and defaults to 1.
  9729. Some examples:
  9730. @example
  9731. # Use the default values
  9732. ocv=dilate
  9733. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9734. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9735. # Read the shape from the file diamond.shape, iterating two times.
  9736. # The file diamond.shape may contain a pattern of characters like this
  9737. # *
  9738. # ***
  9739. # *****
  9740. # ***
  9741. # *
  9742. # The specified columns and rows are ignored
  9743. # but the anchor point coordinates are not
  9744. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9745. @end example
  9746. @subsection erode
  9747. Erode an image by using a specific structuring element.
  9748. It corresponds to the libopencv function @code{cvErode}.
  9749. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9750. with the same syntax and semantics as the @ref{dilate} filter.
  9751. @subsection smooth
  9752. Smooth the input video.
  9753. The filter takes the following parameters:
  9754. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9755. @var{type} is the type of smooth filter to apply, and must be one of
  9756. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9757. or "bilateral". The default value is "gaussian".
  9758. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9759. depend on the smooth type. @var{param1} and
  9760. @var{param2} accept integer positive values or 0. @var{param3} and
  9761. @var{param4} accept floating point values.
  9762. The default value for @var{param1} is 3. The default value for the
  9763. other parameters is 0.
  9764. These parameters correspond to the parameters assigned to the
  9765. libopencv function @code{cvSmooth}.
  9766. @section oscilloscope
  9767. 2D Video Oscilloscope.
  9768. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9769. It accepts the following parameters:
  9770. @table @option
  9771. @item x
  9772. Set scope center x position.
  9773. @item y
  9774. Set scope center y position.
  9775. @item s
  9776. Set scope size, relative to frame diagonal.
  9777. @item t
  9778. Set scope tilt/rotation.
  9779. @item o
  9780. Set trace opacity.
  9781. @item tx
  9782. Set trace center x position.
  9783. @item ty
  9784. Set trace center y position.
  9785. @item tw
  9786. Set trace width, relative to width of frame.
  9787. @item th
  9788. Set trace height, relative to height of frame.
  9789. @item c
  9790. Set which components to trace. By default it traces first three components.
  9791. @item g
  9792. Draw trace grid. By default is enabled.
  9793. @item st
  9794. Draw some statistics. By default is enabled.
  9795. @item sc
  9796. Draw scope. By default is enabled.
  9797. @end table
  9798. @subsection Examples
  9799. @itemize
  9800. @item
  9801. Inspect full first row of video frame.
  9802. @example
  9803. oscilloscope=x=0.5:y=0:s=1
  9804. @end example
  9805. @item
  9806. Inspect full last row of video frame.
  9807. @example
  9808. oscilloscope=x=0.5:y=1:s=1
  9809. @end example
  9810. @item
  9811. Inspect full 5th line of video frame of height 1080.
  9812. @example
  9813. oscilloscope=x=0.5:y=5/1080:s=1
  9814. @end example
  9815. @item
  9816. Inspect full last column of video frame.
  9817. @example
  9818. oscilloscope=x=1:y=0.5:s=1:t=1
  9819. @end example
  9820. @end itemize
  9821. @anchor{overlay}
  9822. @section overlay
  9823. Overlay one video on top of another.
  9824. It takes two inputs and has one output. The first input is the "main"
  9825. video on which the second input is overlaid.
  9826. It accepts the following parameters:
  9827. A description of the accepted options follows.
  9828. @table @option
  9829. @item x
  9830. @item y
  9831. Set the expression for the x and y coordinates of the overlaid video
  9832. on the main video. Default value is "0" for both expressions. In case
  9833. the expression is invalid, it is set to a huge value (meaning that the
  9834. overlay will not be displayed within the output visible area).
  9835. @item eof_action
  9836. See @ref{framesync}.
  9837. @item eval
  9838. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9839. It accepts the following values:
  9840. @table @samp
  9841. @item init
  9842. only evaluate expressions once during the filter initialization or
  9843. when a command is processed
  9844. @item frame
  9845. evaluate expressions for each incoming frame
  9846. @end table
  9847. Default value is @samp{frame}.
  9848. @item shortest
  9849. See @ref{framesync}.
  9850. @item format
  9851. Set the format for the output video.
  9852. It accepts the following values:
  9853. @table @samp
  9854. @item yuv420
  9855. force YUV420 output
  9856. @item yuv422
  9857. force YUV422 output
  9858. @item yuv444
  9859. force YUV444 output
  9860. @item rgb
  9861. force packed RGB output
  9862. @item gbrp
  9863. force planar RGB output
  9864. @item auto
  9865. automatically pick format
  9866. @end table
  9867. Default value is @samp{yuv420}.
  9868. @item repeatlast
  9869. See @ref{framesync}.
  9870. @item alpha
  9871. Set format of alpha of the overlaid video, it can be @var{straight} or
  9872. @var{premultiplied}. Default is @var{straight}.
  9873. @end table
  9874. The @option{x}, and @option{y} expressions can contain the following
  9875. parameters.
  9876. @table @option
  9877. @item main_w, W
  9878. @item main_h, H
  9879. The main input width and height.
  9880. @item overlay_w, w
  9881. @item overlay_h, h
  9882. The overlay input width and height.
  9883. @item x
  9884. @item y
  9885. The computed values for @var{x} and @var{y}. They are evaluated for
  9886. each new frame.
  9887. @item hsub
  9888. @item vsub
  9889. horizontal and vertical chroma subsample values of the output
  9890. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9891. @var{vsub} is 1.
  9892. @item n
  9893. the number of input frame, starting from 0
  9894. @item pos
  9895. the position in the file of the input frame, NAN if unknown
  9896. @item t
  9897. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9898. @end table
  9899. This filter also supports the @ref{framesync} options.
  9900. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9901. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9902. when @option{eval} is set to @samp{init}.
  9903. Be aware that frames are taken from each input video in timestamp
  9904. order, hence, if their initial timestamps differ, it is a good idea
  9905. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9906. have them begin in the same zero timestamp, as the example for
  9907. the @var{movie} filter does.
  9908. You can chain together more overlays but you should test the
  9909. efficiency of such approach.
  9910. @subsection Commands
  9911. This filter supports the following commands:
  9912. @table @option
  9913. @item x
  9914. @item y
  9915. Modify the x and y of the overlay input.
  9916. The command accepts the same syntax of the corresponding option.
  9917. If the specified expression is not valid, it is kept at its current
  9918. value.
  9919. @end table
  9920. @subsection Examples
  9921. @itemize
  9922. @item
  9923. Draw the overlay at 10 pixels from the bottom right corner of the main
  9924. video:
  9925. @example
  9926. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9927. @end example
  9928. Using named options the example above becomes:
  9929. @example
  9930. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9931. @end example
  9932. @item
  9933. Insert a transparent PNG logo in the bottom left corner of the input,
  9934. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9935. @example
  9936. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9937. @end example
  9938. @item
  9939. Insert 2 different transparent PNG logos (second logo on bottom
  9940. right corner) using the @command{ffmpeg} tool:
  9941. @example
  9942. 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
  9943. @end example
  9944. @item
  9945. Add a transparent color layer on top of the main video; @code{WxH}
  9946. must specify the size of the main input to the overlay filter:
  9947. @example
  9948. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9949. @end example
  9950. @item
  9951. Play an original video and a filtered version (here with the deshake
  9952. filter) side by side using the @command{ffplay} tool:
  9953. @example
  9954. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9955. @end example
  9956. The above command is the same as:
  9957. @example
  9958. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9959. @end example
  9960. @item
  9961. Make a sliding overlay appearing from the left to the right top part of the
  9962. screen starting since time 2:
  9963. @example
  9964. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9965. @end example
  9966. @item
  9967. Compose output by putting two input videos side to side:
  9968. @example
  9969. ffmpeg -i left.avi -i right.avi -filter_complex "
  9970. nullsrc=size=200x100 [background];
  9971. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9972. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9973. [background][left] overlay=shortest=1 [background+left];
  9974. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9975. "
  9976. @end example
  9977. @item
  9978. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9979. @example
  9980. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9981. -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]'
  9982. masked.avi
  9983. @end example
  9984. @item
  9985. Chain several overlays in cascade:
  9986. @example
  9987. nullsrc=s=200x200 [bg];
  9988. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9989. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9990. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9991. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9992. [in3] null, [mid2] overlay=100:100 [out0]
  9993. @end example
  9994. @end itemize
  9995. @section owdenoise
  9996. Apply Overcomplete Wavelet denoiser.
  9997. The filter accepts the following options:
  9998. @table @option
  9999. @item depth
  10000. Set depth.
  10001. Larger depth values will denoise lower frequency components more, but
  10002. slow down filtering.
  10003. Must be an int in the range 8-16, default is @code{8}.
  10004. @item luma_strength, ls
  10005. Set luma strength.
  10006. Must be a double value in the range 0-1000, default is @code{1.0}.
  10007. @item chroma_strength, cs
  10008. Set chroma strength.
  10009. Must be a double value in the range 0-1000, default is @code{1.0}.
  10010. @end table
  10011. @anchor{pad}
  10012. @section pad
  10013. Add paddings to the input image, and place the original input at the
  10014. provided @var{x}, @var{y} coordinates.
  10015. It accepts the following parameters:
  10016. @table @option
  10017. @item width, w
  10018. @item height, h
  10019. Specify an expression for the size of the output image with the
  10020. paddings added. If the value for @var{width} or @var{height} is 0, the
  10021. corresponding input size is used for the output.
  10022. The @var{width} expression can reference the value set by the
  10023. @var{height} expression, and vice versa.
  10024. The default value of @var{width} and @var{height} is 0.
  10025. @item x
  10026. @item y
  10027. Specify the offsets to place the input image at within the padded area,
  10028. with respect to the top/left border of the output image.
  10029. The @var{x} expression can reference the value set by the @var{y}
  10030. expression, and vice versa.
  10031. The default value of @var{x} and @var{y} is 0.
  10032. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10033. so the input image is centered on the padded area.
  10034. @item color
  10035. Specify the color of the padded area. For the syntax of this option,
  10036. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10037. manual,ffmpeg-utils}.
  10038. The default value of @var{color} is "black".
  10039. @item eval
  10040. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10041. It accepts the following values:
  10042. @table @samp
  10043. @item init
  10044. Only evaluate expressions once during the filter initialization or when
  10045. a command is processed.
  10046. @item frame
  10047. Evaluate expressions for each incoming frame.
  10048. @end table
  10049. Default value is @samp{init}.
  10050. @item aspect
  10051. Pad to aspect instead to a resolution.
  10052. @end table
  10053. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10054. options are expressions containing the following constants:
  10055. @table @option
  10056. @item in_w
  10057. @item in_h
  10058. The input video width and height.
  10059. @item iw
  10060. @item ih
  10061. These are the same as @var{in_w} and @var{in_h}.
  10062. @item out_w
  10063. @item out_h
  10064. The output width and height (the size of the padded area), as
  10065. specified by the @var{width} and @var{height} expressions.
  10066. @item ow
  10067. @item oh
  10068. These are the same as @var{out_w} and @var{out_h}.
  10069. @item x
  10070. @item y
  10071. The x and y offsets as specified by the @var{x} and @var{y}
  10072. expressions, or NAN if not yet specified.
  10073. @item a
  10074. same as @var{iw} / @var{ih}
  10075. @item sar
  10076. input sample aspect ratio
  10077. @item dar
  10078. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10079. @item hsub
  10080. @item vsub
  10081. The horizontal and vertical chroma subsample values. For example for the
  10082. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10083. @end table
  10084. @subsection Examples
  10085. @itemize
  10086. @item
  10087. Add paddings with the color "violet" to the input video. The output video
  10088. size is 640x480, and the top-left corner of the input video is placed at
  10089. column 0, row 40
  10090. @example
  10091. pad=640:480:0:40:violet
  10092. @end example
  10093. The example above is equivalent to the following command:
  10094. @example
  10095. pad=width=640:height=480:x=0:y=40:color=violet
  10096. @end example
  10097. @item
  10098. Pad the input to get an output with dimensions increased by 3/2,
  10099. and put the input video at the center of the padded area:
  10100. @example
  10101. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10102. @end example
  10103. @item
  10104. Pad the input to get a squared output with size equal to the maximum
  10105. value between the input width and height, and put the input video at
  10106. the center of the padded area:
  10107. @example
  10108. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10109. @end example
  10110. @item
  10111. Pad the input to get a final w/h ratio of 16:9:
  10112. @example
  10113. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10114. @end example
  10115. @item
  10116. In case of anamorphic video, in order to set the output display aspect
  10117. correctly, it is necessary to use @var{sar} in the expression,
  10118. according to the relation:
  10119. @example
  10120. (ih * X / ih) * sar = output_dar
  10121. X = output_dar / sar
  10122. @end example
  10123. Thus the previous example needs to be modified to:
  10124. @example
  10125. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10126. @end example
  10127. @item
  10128. Double the output size and put the input video in the bottom-right
  10129. corner of the output padded area:
  10130. @example
  10131. pad="2*iw:2*ih:ow-iw:oh-ih"
  10132. @end example
  10133. @end itemize
  10134. @anchor{palettegen}
  10135. @section palettegen
  10136. Generate one palette for a whole video stream.
  10137. It accepts the following options:
  10138. @table @option
  10139. @item max_colors
  10140. Set the maximum number of colors to quantize in the palette.
  10141. Note: the palette will still contain 256 colors; the unused palette entries
  10142. will be black.
  10143. @item reserve_transparent
  10144. Create a palette of 255 colors maximum and reserve the last one for
  10145. transparency. Reserving the transparency color is useful for GIF optimization.
  10146. If not set, the maximum of colors in the palette will be 256. You probably want
  10147. to disable this option for a standalone image.
  10148. Set by default.
  10149. @item transparency_color
  10150. Set the color that will be used as background for transparency.
  10151. @item stats_mode
  10152. Set statistics mode.
  10153. It accepts the following values:
  10154. @table @samp
  10155. @item full
  10156. Compute full frame histograms.
  10157. @item diff
  10158. Compute histograms only for the part that differs from previous frame. This
  10159. might be relevant to give more importance to the moving part of your input if
  10160. the background is static.
  10161. @item single
  10162. Compute new histogram for each frame.
  10163. @end table
  10164. Default value is @var{full}.
  10165. @end table
  10166. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10167. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10168. color quantization of the palette. This information is also visible at
  10169. @var{info} logging level.
  10170. @subsection Examples
  10171. @itemize
  10172. @item
  10173. Generate a representative palette of a given video using @command{ffmpeg}:
  10174. @example
  10175. ffmpeg -i input.mkv -vf palettegen palette.png
  10176. @end example
  10177. @end itemize
  10178. @section paletteuse
  10179. Use a palette to downsample an input video stream.
  10180. The filter takes two inputs: one video stream and a palette. The palette must
  10181. be a 256 pixels image.
  10182. It accepts the following options:
  10183. @table @option
  10184. @item dither
  10185. Select dithering mode. Available algorithms are:
  10186. @table @samp
  10187. @item bayer
  10188. Ordered 8x8 bayer dithering (deterministic)
  10189. @item heckbert
  10190. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10191. Note: this dithering is sometimes considered "wrong" and is included as a
  10192. reference.
  10193. @item floyd_steinberg
  10194. Floyd and Steingberg dithering (error diffusion)
  10195. @item sierra2
  10196. Frankie Sierra dithering v2 (error diffusion)
  10197. @item sierra2_4a
  10198. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10199. @end table
  10200. Default is @var{sierra2_4a}.
  10201. @item bayer_scale
  10202. When @var{bayer} dithering is selected, this option defines the scale of the
  10203. pattern (how much the crosshatch pattern is visible). A low value means more
  10204. visible pattern for less banding, and higher value means less visible pattern
  10205. at the cost of more banding.
  10206. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10207. @item diff_mode
  10208. If set, define the zone to process
  10209. @table @samp
  10210. @item rectangle
  10211. Only the changing rectangle will be reprocessed. This is similar to GIF
  10212. cropping/offsetting compression mechanism. This option can be useful for speed
  10213. if only a part of the image is changing, and has use cases such as limiting the
  10214. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10215. moving scene (it leads to more deterministic output if the scene doesn't change
  10216. much, and as a result less moving noise and better GIF compression).
  10217. @end table
  10218. Default is @var{none}.
  10219. @item new
  10220. Take new palette for each output frame.
  10221. @item alpha_threshold
  10222. Sets the alpha threshold for transparency. Alpha values above this threshold
  10223. will be treated as completely opaque, and values below this threshold will be
  10224. treated as completely transparent.
  10225. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10226. @end table
  10227. @subsection Examples
  10228. @itemize
  10229. @item
  10230. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10231. using @command{ffmpeg}:
  10232. @example
  10233. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10234. @end example
  10235. @end itemize
  10236. @section perspective
  10237. Correct perspective of video not recorded perpendicular to the screen.
  10238. A description of the accepted parameters follows.
  10239. @table @option
  10240. @item x0
  10241. @item y0
  10242. @item x1
  10243. @item y1
  10244. @item x2
  10245. @item y2
  10246. @item x3
  10247. @item y3
  10248. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10249. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10250. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10251. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10252. then the corners of the source will be sent to the specified coordinates.
  10253. The expressions can use the following variables:
  10254. @table @option
  10255. @item W
  10256. @item H
  10257. the width and height of video frame.
  10258. @item in
  10259. Input frame count.
  10260. @item on
  10261. Output frame count.
  10262. @end table
  10263. @item interpolation
  10264. Set interpolation for perspective correction.
  10265. It accepts the following values:
  10266. @table @samp
  10267. @item linear
  10268. @item cubic
  10269. @end table
  10270. Default value is @samp{linear}.
  10271. @item sense
  10272. Set interpretation of coordinate options.
  10273. It accepts the following values:
  10274. @table @samp
  10275. @item 0, source
  10276. Send point in the source specified by the given coordinates to
  10277. the corners of the destination.
  10278. @item 1, destination
  10279. Send the corners of the source to the point in the destination specified
  10280. by the given coordinates.
  10281. Default value is @samp{source}.
  10282. @end table
  10283. @item eval
  10284. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10285. It accepts the following values:
  10286. @table @samp
  10287. @item init
  10288. only evaluate expressions once during the filter initialization or
  10289. when a command is processed
  10290. @item frame
  10291. evaluate expressions for each incoming frame
  10292. @end table
  10293. Default value is @samp{init}.
  10294. @end table
  10295. @section phase
  10296. Delay interlaced video by one field time so that the field order changes.
  10297. The intended use is to fix PAL movies that have been captured with the
  10298. opposite field order to the film-to-video transfer.
  10299. A description of the accepted parameters follows.
  10300. @table @option
  10301. @item mode
  10302. Set phase mode.
  10303. It accepts the following values:
  10304. @table @samp
  10305. @item t
  10306. Capture field order top-first, transfer bottom-first.
  10307. Filter will delay the bottom field.
  10308. @item b
  10309. Capture field order bottom-first, transfer top-first.
  10310. Filter will delay the top field.
  10311. @item p
  10312. Capture and transfer with the same field order. This mode only exists
  10313. for the documentation of the other options to refer to, but if you
  10314. actually select it, the filter will faithfully do nothing.
  10315. @item a
  10316. Capture field order determined automatically by field flags, transfer
  10317. opposite.
  10318. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10319. basis using field flags. If no field information is available,
  10320. then this works just like @samp{u}.
  10321. @item u
  10322. Capture unknown or varying, transfer opposite.
  10323. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10324. analyzing the images and selecting the alternative that produces best
  10325. match between the fields.
  10326. @item T
  10327. Capture top-first, transfer unknown or varying.
  10328. Filter selects among @samp{t} and @samp{p} using image analysis.
  10329. @item B
  10330. Capture bottom-first, transfer unknown or varying.
  10331. Filter selects among @samp{b} and @samp{p} using image analysis.
  10332. @item A
  10333. Capture determined by field flags, transfer unknown or varying.
  10334. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10335. image analysis. If no field information is available, then this works just
  10336. like @samp{U}. This is the default mode.
  10337. @item U
  10338. Both capture and transfer unknown or varying.
  10339. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10340. @end table
  10341. @end table
  10342. @section pixdesctest
  10343. Pixel format descriptor test filter, mainly useful for internal
  10344. testing. The output video should be equal to the input video.
  10345. For example:
  10346. @example
  10347. format=monow, pixdesctest
  10348. @end example
  10349. can be used to test the monowhite pixel format descriptor definition.
  10350. @section pixscope
  10351. Display sample values of color channels. Mainly useful for checking color
  10352. and levels. Minimum supported resolution is 640x480.
  10353. The filters accept the following options:
  10354. @table @option
  10355. @item x
  10356. Set scope X position, relative offset on X axis.
  10357. @item y
  10358. Set scope Y position, relative offset on Y axis.
  10359. @item w
  10360. Set scope width.
  10361. @item h
  10362. Set scope height.
  10363. @item o
  10364. Set window opacity. This window also holds statistics about pixel area.
  10365. @item wx
  10366. Set window X position, relative offset on X axis.
  10367. @item wy
  10368. Set window Y position, relative offset on Y axis.
  10369. @end table
  10370. @section pp
  10371. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10372. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10373. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10374. Each subfilter and some options have a short and a long name that can be used
  10375. interchangeably, i.e. dr/dering are the same.
  10376. The filters accept the following options:
  10377. @table @option
  10378. @item subfilters
  10379. Set postprocessing subfilters string.
  10380. @end table
  10381. All subfilters share common options to determine their scope:
  10382. @table @option
  10383. @item a/autoq
  10384. Honor the quality commands for this subfilter.
  10385. @item c/chrom
  10386. Do chrominance filtering, too (default).
  10387. @item y/nochrom
  10388. Do luminance filtering only (no chrominance).
  10389. @item n/noluma
  10390. Do chrominance filtering only (no luminance).
  10391. @end table
  10392. These options can be appended after the subfilter name, separated by a '|'.
  10393. Available subfilters are:
  10394. @table @option
  10395. @item hb/hdeblock[|difference[|flatness]]
  10396. Horizontal deblocking filter
  10397. @table @option
  10398. @item difference
  10399. Difference factor where higher values mean more deblocking (default: @code{32}).
  10400. @item flatness
  10401. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10402. @end table
  10403. @item vb/vdeblock[|difference[|flatness]]
  10404. Vertical deblocking filter
  10405. @table @option
  10406. @item difference
  10407. Difference factor where higher values mean more deblocking (default: @code{32}).
  10408. @item flatness
  10409. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10410. @end table
  10411. @item ha/hadeblock[|difference[|flatness]]
  10412. Accurate horizontal deblocking filter
  10413. @table @option
  10414. @item difference
  10415. Difference factor where higher values mean more deblocking (default: @code{32}).
  10416. @item flatness
  10417. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10418. @end table
  10419. @item va/vadeblock[|difference[|flatness]]
  10420. Accurate vertical deblocking filter
  10421. @table @option
  10422. @item difference
  10423. Difference factor where higher values mean more deblocking (default: @code{32}).
  10424. @item flatness
  10425. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10426. @end table
  10427. @end table
  10428. The horizontal and vertical deblocking filters share the difference and
  10429. flatness values so you cannot set different horizontal and vertical
  10430. thresholds.
  10431. @table @option
  10432. @item h1/x1hdeblock
  10433. Experimental horizontal deblocking filter
  10434. @item v1/x1vdeblock
  10435. Experimental vertical deblocking filter
  10436. @item dr/dering
  10437. Deringing filter
  10438. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10439. @table @option
  10440. @item threshold1
  10441. larger -> stronger filtering
  10442. @item threshold2
  10443. larger -> stronger filtering
  10444. @item threshold3
  10445. larger -> stronger filtering
  10446. @end table
  10447. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10448. @table @option
  10449. @item f/fullyrange
  10450. Stretch luminance to @code{0-255}.
  10451. @end table
  10452. @item lb/linblenddeint
  10453. Linear blend deinterlacing filter that deinterlaces the given block by
  10454. filtering all lines with a @code{(1 2 1)} filter.
  10455. @item li/linipoldeint
  10456. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10457. linearly interpolating every second line.
  10458. @item ci/cubicipoldeint
  10459. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10460. cubically interpolating every second line.
  10461. @item md/mediandeint
  10462. Median deinterlacing filter that deinterlaces the given block by applying a
  10463. median filter to every second line.
  10464. @item fd/ffmpegdeint
  10465. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10466. second line with a @code{(-1 4 2 4 -1)} filter.
  10467. @item l5/lowpass5
  10468. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10469. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10470. @item fq/forceQuant[|quantizer]
  10471. Overrides the quantizer table from the input with the constant quantizer you
  10472. specify.
  10473. @table @option
  10474. @item quantizer
  10475. Quantizer to use
  10476. @end table
  10477. @item de/default
  10478. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10479. @item fa/fast
  10480. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10481. @item ac
  10482. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10483. @end table
  10484. @subsection Examples
  10485. @itemize
  10486. @item
  10487. Apply horizontal and vertical deblocking, deringing and automatic
  10488. brightness/contrast:
  10489. @example
  10490. pp=hb/vb/dr/al
  10491. @end example
  10492. @item
  10493. Apply default filters without brightness/contrast correction:
  10494. @example
  10495. pp=de/-al
  10496. @end example
  10497. @item
  10498. Apply default filters and temporal denoiser:
  10499. @example
  10500. pp=default/tmpnoise|1|2|3
  10501. @end example
  10502. @item
  10503. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10504. automatically depending on available CPU time:
  10505. @example
  10506. pp=hb|y/vb|a
  10507. @end example
  10508. @end itemize
  10509. @section pp7
  10510. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10511. similar to spp = 6 with 7 point DCT, where only the center sample is
  10512. used after IDCT.
  10513. The filter accepts the following options:
  10514. @table @option
  10515. @item qp
  10516. Force a constant quantization parameter. It accepts an integer in range
  10517. 0 to 63. If not set, the filter will use the QP from the video stream
  10518. (if available).
  10519. @item mode
  10520. Set thresholding mode. Available modes are:
  10521. @table @samp
  10522. @item hard
  10523. Set hard thresholding.
  10524. @item soft
  10525. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10526. @item medium
  10527. Set medium thresholding (good results, default).
  10528. @end table
  10529. @end table
  10530. @section premultiply
  10531. Apply alpha premultiply effect to input video stream using first plane
  10532. of second stream as alpha.
  10533. Both streams must have same dimensions and same pixel format.
  10534. The filter accepts the following option:
  10535. @table @option
  10536. @item planes
  10537. Set which planes will be processed, unprocessed planes will be copied.
  10538. By default value 0xf, all planes will be processed.
  10539. @item inplace
  10540. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10541. @end table
  10542. @section prewitt
  10543. Apply prewitt operator to input video stream.
  10544. The filter accepts the following option:
  10545. @table @option
  10546. @item planes
  10547. Set which planes will be processed, unprocessed planes will be copied.
  10548. By default value 0xf, all planes will be processed.
  10549. @item scale
  10550. Set value which will be multiplied with filtered result.
  10551. @item delta
  10552. Set value which will be added to filtered result.
  10553. @end table
  10554. @anchor{program_opencl}
  10555. @section program_opencl
  10556. Filter video using an OpenCL program.
  10557. @table @option
  10558. @item source
  10559. OpenCL program source file.
  10560. @item kernel
  10561. Kernel name in program.
  10562. @item inputs
  10563. Number of inputs to the filter. Defaults to 1.
  10564. @item size, s
  10565. Size of output frames. Defaults to the same as the first input.
  10566. @end table
  10567. The program source file must contain a kernel function with the given name,
  10568. which will be run once for each plane of the output. Each run on a plane
  10569. gets enqueued as a separate 2D global NDRange with one work-item for each
  10570. pixel to be generated. The global ID offset for each work-item is therefore
  10571. the coordinates of a pixel in the destination image.
  10572. The kernel function needs to take the following arguments:
  10573. @itemize
  10574. @item
  10575. Destination image, @var{__write_only image2d_t}.
  10576. This image will become the output; the kernel should write all of it.
  10577. @item
  10578. Frame index, @var{unsigned int}.
  10579. This is a counter starting from zero and increasing by one for each frame.
  10580. @item
  10581. Source images, @var{__read_only image2d_t}.
  10582. These are the most recent images on each input. The kernel may read from
  10583. them to generate the output, but they can't be written to.
  10584. @end itemize
  10585. Example programs:
  10586. @itemize
  10587. @item
  10588. Copy the input to the output (output must be the same size as the input).
  10589. @verbatim
  10590. __kernel void copy(__write_only image2d_t destination,
  10591. unsigned int index,
  10592. __read_only image2d_t source)
  10593. {
  10594. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10595. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10596. float4 value = read_imagef(source, sampler, location);
  10597. write_imagef(destination, location, value);
  10598. }
  10599. @end verbatim
  10600. @item
  10601. Apply a simple transformation, rotating the input by an amount increasing
  10602. with the index counter. Pixel values are linearly interpolated by the
  10603. sampler, and the output need not have the same dimensions as the input.
  10604. @verbatim
  10605. __kernel void rotate_image(__write_only image2d_t dst,
  10606. unsigned int index,
  10607. __read_only image2d_t src)
  10608. {
  10609. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10610. CLK_FILTER_LINEAR);
  10611. float angle = (float)index / 100.0f;
  10612. float2 dst_dim = convert_float2(get_image_dim(dst));
  10613. float2 src_dim = convert_float2(get_image_dim(src));
  10614. float2 dst_cen = dst_dim / 2.0f;
  10615. float2 src_cen = src_dim / 2.0f;
  10616. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10617. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10618. float2 src_pos = {
  10619. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10620. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10621. };
  10622. src_pos = src_pos * src_dim / dst_dim;
  10623. float2 src_loc = src_pos + src_cen;
  10624. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10625. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10626. write_imagef(dst, dst_loc, 0.5f);
  10627. else
  10628. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10629. }
  10630. @end verbatim
  10631. @item
  10632. Blend two inputs together, with the amount of each input used varying
  10633. with the index counter.
  10634. @verbatim
  10635. __kernel void blend_images(__write_only image2d_t dst,
  10636. unsigned int index,
  10637. __read_only image2d_t src1,
  10638. __read_only image2d_t src2)
  10639. {
  10640. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10641. CLK_FILTER_LINEAR);
  10642. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10643. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10644. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10645. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10646. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10647. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10648. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10649. }
  10650. @end verbatim
  10651. @end itemize
  10652. @section pseudocolor
  10653. Alter frame colors in video with pseudocolors.
  10654. This filter accept the following options:
  10655. @table @option
  10656. @item c0
  10657. set pixel first component expression
  10658. @item c1
  10659. set pixel second component expression
  10660. @item c2
  10661. set pixel third component expression
  10662. @item c3
  10663. set pixel fourth component expression, corresponds to the alpha component
  10664. @item i
  10665. set component to use as base for altering colors
  10666. @end table
  10667. Each of them specifies the expression to use for computing the lookup table for
  10668. the corresponding pixel component values.
  10669. The expressions can contain the following constants and functions:
  10670. @table @option
  10671. @item w
  10672. @item h
  10673. The input width and height.
  10674. @item val
  10675. The input value for the pixel component.
  10676. @item ymin, umin, vmin, amin
  10677. The minimum allowed component value.
  10678. @item ymax, umax, vmax, amax
  10679. The maximum allowed component value.
  10680. @end table
  10681. All expressions default to "val".
  10682. @subsection Examples
  10683. @itemize
  10684. @item
  10685. Change too high luma values to gradient:
  10686. @example
  10687. 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'"
  10688. @end example
  10689. @end itemize
  10690. @section psnr
  10691. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10692. Ratio) between two input videos.
  10693. This filter takes in input two input videos, the first input is
  10694. considered the "main" source and is passed unchanged to the
  10695. output. The second input is used as a "reference" video for computing
  10696. the PSNR.
  10697. Both video inputs must have the same resolution and pixel format for
  10698. this filter to work correctly. Also it assumes that both inputs
  10699. have the same number of frames, which are compared one by one.
  10700. The obtained average PSNR is printed through the logging system.
  10701. The filter stores the accumulated MSE (mean squared error) of each
  10702. frame, and at the end of the processing it is averaged across all frames
  10703. equally, and the following formula is applied to obtain the PSNR:
  10704. @example
  10705. PSNR = 10*log10(MAX^2/MSE)
  10706. @end example
  10707. Where MAX is the average of the maximum values of each component of the
  10708. image.
  10709. The description of the accepted parameters follows.
  10710. @table @option
  10711. @item stats_file, f
  10712. If specified the filter will use the named file to save the PSNR of
  10713. each individual frame. When filename equals "-" the data is sent to
  10714. standard output.
  10715. @item stats_version
  10716. Specifies which version of the stats file format to use. Details of
  10717. each format are written below.
  10718. Default value is 1.
  10719. @item stats_add_max
  10720. Determines whether the max value is output to the stats log.
  10721. Default value is 0.
  10722. Requires stats_version >= 2. If this is set and stats_version < 2,
  10723. the filter will return an error.
  10724. @end table
  10725. This filter also supports the @ref{framesync} options.
  10726. The file printed if @var{stats_file} is selected, contains a sequence of
  10727. key/value pairs of the form @var{key}:@var{value} for each compared
  10728. couple of frames.
  10729. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10730. the list of per-frame-pair stats, with key value pairs following the frame
  10731. format with the following parameters:
  10732. @table @option
  10733. @item psnr_log_version
  10734. The version of the log file format. Will match @var{stats_version}.
  10735. @item fields
  10736. A comma separated list of the per-frame-pair parameters included in
  10737. the log.
  10738. @end table
  10739. A description of each shown per-frame-pair parameter follows:
  10740. @table @option
  10741. @item n
  10742. sequential number of the input frame, starting from 1
  10743. @item mse_avg
  10744. Mean Square Error pixel-by-pixel average difference of the compared
  10745. frames, averaged over all the image components.
  10746. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10747. Mean Square Error pixel-by-pixel average difference of the compared
  10748. frames for the component specified by the suffix.
  10749. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10750. Peak Signal to Noise ratio of the compared frames for the component
  10751. specified by the suffix.
  10752. @item max_avg, max_y, max_u, max_v
  10753. Maximum allowed value for each channel, and average over all
  10754. channels.
  10755. @end table
  10756. For example:
  10757. @example
  10758. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10759. [main][ref] psnr="stats_file=stats.log" [out]
  10760. @end example
  10761. On this example the input file being processed is compared with the
  10762. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10763. is stored in @file{stats.log}.
  10764. @anchor{pullup}
  10765. @section pullup
  10766. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10767. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10768. content.
  10769. The pullup filter is designed to take advantage of future context in making
  10770. its decisions. This filter is stateless in the sense that it does not lock
  10771. onto a pattern to follow, but it instead looks forward to the following
  10772. fields in order to identify matches and rebuild progressive frames.
  10773. To produce content with an even framerate, insert the fps filter after
  10774. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10775. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10776. The filter accepts the following options:
  10777. @table @option
  10778. @item jl
  10779. @item jr
  10780. @item jt
  10781. @item jb
  10782. These options set the amount of "junk" to ignore at the left, right, top, and
  10783. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10784. while top and bottom are in units of 2 lines.
  10785. The default is 8 pixels on each side.
  10786. @item sb
  10787. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10788. filter generating an occasional mismatched frame, but it may also cause an
  10789. excessive number of frames to be dropped during high motion sequences.
  10790. Conversely, setting it to -1 will make filter match fields more easily.
  10791. This may help processing of video where there is slight blurring between
  10792. the fields, but may also cause there to be interlaced frames in the output.
  10793. Default value is @code{0}.
  10794. @item mp
  10795. Set the metric plane to use. It accepts the following values:
  10796. @table @samp
  10797. @item l
  10798. Use luma plane.
  10799. @item u
  10800. Use chroma blue plane.
  10801. @item v
  10802. Use chroma red plane.
  10803. @end table
  10804. This option may be set to use chroma plane instead of the default luma plane
  10805. for doing filter's computations. This may improve accuracy on very clean
  10806. source material, but more likely will decrease accuracy, especially if there
  10807. is chroma noise (rainbow effect) or any grayscale video.
  10808. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10809. load and make pullup usable in realtime on slow machines.
  10810. @end table
  10811. For best results (without duplicated frames in the output file) it is
  10812. necessary to change the output frame rate. For example, to inverse
  10813. telecine NTSC input:
  10814. @example
  10815. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10816. @end example
  10817. @section qp
  10818. Change video quantization parameters (QP).
  10819. The filter accepts the following option:
  10820. @table @option
  10821. @item qp
  10822. Set expression for quantization parameter.
  10823. @end table
  10824. The expression is evaluated through the eval API and can contain, among others,
  10825. the following constants:
  10826. @table @var
  10827. @item known
  10828. 1 if index is not 129, 0 otherwise.
  10829. @item qp
  10830. Sequential index starting from -129 to 128.
  10831. @end table
  10832. @subsection Examples
  10833. @itemize
  10834. @item
  10835. Some equation like:
  10836. @example
  10837. qp=2+2*sin(PI*qp)
  10838. @end example
  10839. @end itemize
  10840. @section random
  10841. Flush video frames from internal cache of frames into a random order.
  10842. No frame is discarded.
  10843. Inspired by @ref{frei0r} nervous filter.
  10844. @table @option
  10845. @item frames
  10846. Set size in number of frames of internal cache, in range from @code{2} to
  10847. @code{512}. Default is @code{30}.
  10848. @item seed
  10849. Set seed for random number generator, must be an integer included between
  10850. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10851. less than @code{0}, the filter will try to use a good random seed on a
  10852. best effort basis.
  10853. @end table
  10854. @section readeia608
  10855. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10856. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10857. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10858. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10859. @table @option
  10860. @item lavfi.readeia608.X.cc
  10861. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10862. @item lavfi.readeia608.X.line
  10863. The number of the line on which the EIA-608 data was identified and read.
  10864. @end table
  10865. This filter accepts the following options:
  10866. @table @option
  10867. @item scan_min
  10868. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10869. @item scan_max
  10870. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10871. @item mac
  10872. Set minimal acceptable amplitude change for sync codes detection.
  10873. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10874. @item spw
  10875. Set the ratio of width reserved for sync code detection.
  10876. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10877. @item mhd
  10878. Set the max peaks height difference for sync code detection.
  10879. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10880. @item mpd
  10881. Set max peaks period difference for sync code detection.
  10882. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10883. @item msd
  10884. Set the first two max start code bits differences.
  10885. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10886. @item bhd
  10887. Set the minimum ratio of bits height compared to 3rd start code bit.
  10888. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10889. @item th_w
  10890. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10891. @item th_b
  10892. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10893. @item chp
  10894. Enable checking the parity bit. In the event of a parity error, the filter will output
  10895. @code{0x00} for that character. Default is false.
  10896. @end table
  10897. @subsection Examples
  10898. @itemize
  10899. @item
  10900. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10901. @example
  10902. 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
  10903. @end example
  10904. @end itemize
  10905. @section readvitc
  10906. Read vertical interval timecode (VITC) information from the top lines of a
  10907. video frame.
  10908. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10909. timecode value, if a valid timecode has been detected. Further metadata key
  10910. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10911. timecode data has been found or not.
  10912. This filter accepts the following options:
  10913. @table @option
  10914. @item scan_max
  10915. Set the maximum number of lines to scan for VITC data. If the value is set to
  10916. @code{-1} the full video frame is scanned. Default is @code{45}.
  10917. @item thr_b
  10918. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10919. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10920. @item thr_w
  10921. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10922. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10923. @end table
  10924. @subsection Examples
  10925. @itemize
  10926. @item
  10927. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10928. draw @code{--:--:--:--} as a placeholder:
  10929. @example
  10930. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10931. @end example
  10932. @end itemize
  10933. @section remap
  10934. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10935. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10936. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10937. value for pixel will be used for destination pixel.
  10938. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10939. will have Xmap/Ymap video stream dimensions.
  10940. Xmap and Ymap input video streams are 16bit depth, single channel.
  10941. @section removegrain
  10942. The removegrain filter is a spatial denoiser for progressive video.
  10943. @table @option
  10944. @item m0
  10945. Set mode for the first plane.
  10946. @item m1
  10947. Set mode for the second plane.
  10948. @item m2
  10949. Set mode for the third plane.
  10950. @item m3
  10951. Set mode for the fourth plane.
  10952. @end table
  10953. Range of mode is from 0 to 24. Description of each mode follows:
  10954. @table @var
  10955. @item 0
  10956. Leave input plane unchanged. Default.
  10957. @item 1
  10958. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10959. @item 2
  10960. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10961. @item 3
  10962. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10963. @item 4
  10964. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10965. This is equivalent to a median filter.
  10966. @item 5
  10967. Line-sensitive clipping giving the minimal change.
  10968. @item 6
  10969. Line-sensitive clipping, intermediate.
  10970. @item 7
  10971. Line-sensitive clipping, intermediate.
  10972. @item 8
  10973. Line-sensitive clipping, intermediate.
  10974. @item 9
  10975. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10976. @item 10
  10977. Replaces the target pixel with the closest neighbour.
  10978. @item 11
  10979. [1 2 1] horizontal and vertical kernel blur.
  10980. @item 12
  10981. Same as mode 11.
  10982. @item 13
  10983. Bob mode, interpolates top field from the line where the neighbours
  10984. pixels are the closest.
  10985. @item 14
  10986. Bob mode, interpolates bottom field from the line where the neighbours
  10987. pixels are the closest.
  10988. @item 15
  10989. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10990. interpolation formula.
  10991. @item 16
  10992. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10993. interpolation formula.
  10994. @item 17
  10995. Clips the pixel with the minimum and maximum of respectively the maximum and
  10996. minimum of each pair of opposite neighbour pixels.
  10997. @item 18
  10998. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10999. the current pixel is minimal.
  11000. @item 19
  11001. Replaces the pixel with the average of its 8 neighbours.
  11002. @item 20
  11003. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11004. @item 21
  11005. Clips pixels using the averages of opposite neighbour.
  11006. @item 22
  11007. Same as mode 21 but simpler and faster.
  11008. @item 23
  11009. Small edge and halo removal, but reputed useless.
  11010. @item 24
  11011. Similar as 23.
  11012. @end table
  11013. @section removelogo
  11014. Suppress a TV station logo, using an image file to determine which
  11015. pixels comprise the logo. It works by filling in the pixels that
  11016. comprise the logo with neighboring pixels.
  11017. The filter accepts the following options:
  11018. @table @option
  11019. @item filename, f
  11020. Set the filter bitmap file, which can be any image format supported by
  11021. libavformat. The width and height of the image file must match those of the
  11022. video stream being processed.
  11023. @end table
  11024. Pixels in the provided bitmap image with a value of zero are not
  11025. considered part of the logo, non-zero pixels are considered part of
  11026. the logo. If you use white (255) for the logo and black (0) for the
  11027. rest, you will be safe. For making the filter bitmap, it is
  11028. recommended to take a screen capture of a black frame with the logo
  11029. visible, and then using a threshold filter followed by the erode
  11030. filter once or twice.
  11031. If needed, little splotches can be fixed manually. Remember that if
  11032. logo pixels are not covered, the filter quality will be much
  11033. reduced. Marking too many pixels as part of the logo does not hurt as
  11034. much, but it will increase the amount of blurring needed to cover over
  11035. the image and will destroy more information than necessary, and extra
  11036. pixels will slow things down on a large logo.
  11037. @section repeatfields
  11038. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11039. fields based on its value.
  11040. @section reverse
  11041. Reverse a video clip.
  11042. Warning: This filter requires memory to buffer the entire clip, so trimming
  11043. is suggested.
  11044. @subsection Examples
  11045. @itemize
  11046. @item
  11047. Take the first 5 seconds of a clip, and reverse it.
  11048. @example
  11049. trim=end=5,reverse
  11050. @end example
  11051. @end itemize
  11052. @section rgbashift
  11053. Shift R/G/B/A pixels horizontally and/or vertically.
  11054. The filter accepts the following options:
  11055. @table @option
  11056. @item rh
  11057. Set amount to shift red horizontally.
  11058. @item rv
  11059. Set amount to shift red vertically.
  11060. @item gh
  11061. Set amount to shift green horizontally.
  11062. @item gv
  11063. Set amount to shift green vertically.
  11064. @item bh
  11065. Set amount to shift blue horizontally.
  11066. @item bv
  11067. Set amount to shift blue vertically.
  11068. @item ah
  11069. Set amount to shift alpha horizontally.
  11070. @item av
  11071. Set amount to shift alpha vertically.
  11072. @item edge
  11073. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11074. @end table
  11075. @section roberts
  11076. Apply roberts cross operator to input video stream.
  11077. The filter accepts the following option:
  11078. @table @option
  11079. @item planes
  11080. Set which planes will be processed, unprocessed planes will be copied.
  11081. By default value 0xf, all planes will be processed.
  11082. @item scale
  11083. Set value which will be multiplied with filtered result.
  11084. @item delta
  11085. Set value which will be added to filtered result.
  11086. @end table
  11087. @section rotate
  11088. Rotate video by an arbitrary angle expressed in radians.
  11089. The filter accepts the following options:
  11090. A description of the optional parameters follows.
  11091. @table @option
  11092. @item angle, a
  11093. Set an expression for the angle by which to rotate the input video
  11094. clockwise, expressed as a number of radians. A negative value will
  11095. result in a counter-clockwise rotation. By default it is set to "0".
  11096. This expression is evaluated for each frame.
  11097. @item out_w, ow
  11098. Set the output width expression, default value is "iw".
  11099. This expression is evaluated just once during configuration.
  11100. @item out_h, oh
  11101. Set the output height expression, default value is "ih".
  11102. This expression is evaluated just once during configuration.
  11103. @item bilinear
  11104. Enable bilinear interpolation if set to 1, a value of 0 disables
  11105. it. Default value is 1.
  11106. @item fillcolor, c
  11107. Set the color used to fill the output area not covered by the rotated
  11108. image. For the general syntax of this option, check the
  11109. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11110. If the special value "none" is selected then no
  11111. background is printed (useful for example if the background is never shown).
  11112. Default value is "black".
  11113. @end table
  11114. The expressions for the angle and the output size can contain the
  11115. following constants and functions:
  11116. @table @option
  11117. @item n
  11118. sequential number of the input frame, starting from 0. It is always NAN
  11119. before the first frame is filtered.
  11120. @item t
  11121. time in seconds of the input frame, it is set to 0 when the filter is
  11122. configured. It is always NAN before the first frame is filtered.
  11123. @item hsub
  11124. @item vsub
  11125. horizontal and vertical chroma subsample values. For example for the
  11126. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11127. @item in_w, iw
  11128. @item in_h, ih
  11129. the input video width and height
  11130. @item out_w, ow
  11131. @item out_h, oh
  11132. the output width and height, that is the size of the padded area as
  11133. specified by the @var{width} and @var{height} expressions
  11134. @item rotw(a)
  11135. @item roth(a)
  11136. the minimal width/height required for completely containing the input
  11137. video rotated by @var{a} radians.
  11138. These are only available when computing the @option{out_w} and
  11139. @option{out_h} expressions.
  11140. @end table
  11141. @subsection Examples
  11142. @itemize
  11143. @item
  11144. Rotate the input by PI/6 radians clockwise:
  11145. @example
  11146. rotate=PI/6
  11147. @end example
  11148. @item
  11149. Rotate the input by PI/6 radians counter-clockwise:
  11150. @example
  11151. rotate=-PI/6
  11152. @end example
  11153. @item
  11154. Rotate the input by 45 degrees clockwise:
  11155. @example
  11156. rotate=45*PI/180
  11157. @end example
  11158. @item
  11159. Apply a constant rotation with period T, starting from an angle of PI/3:
  11160. @example
  11161. rotate=PI/3+2*PI*t/T
  11162. @end example
  11163. @item
  11164. Make the input video rotation oscillating with a period of T
  11165. seconds and an amplitude of A radians:
  11166. @example
  11167. rotate=A*sin(2*PI/T*t)
  11168. @end example
  11169. @item
  11170. Rotate the video, output size is chosen so that the whole rotating
  11171. input video is always completely contained in the output:
  11172. @example
  11173. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11174. @end example
  11175. @item
  11176. Rotate the video, reduce the output size so that no background is ever
  11177. shown:
  11178. @example
  11179. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11180. @end example
  11181. @end itemize
  11182. @subsection Commands
  11183. The filter supports the following commands:
  11184. @table @option
  11185. @item a, angle
  11186. Set the angle expression.
  11187. The command accepts the same syntax of the corresponding option.
  11188. If the specified expression is not valid, it is kept at its current
  11189. value.
  11190. @end table
  11191. @section sab
  11192. Apply Shape Adaptive Blur.
  11193. The filter accepts the following options:
  11194. @table @option
  11195. @item luma_radius, lr
  11196. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11197. value is 1.0. A greater value will result in a more blurred image, and
  11198. in slower processing.
  11199. @item luma_pre_filter_radius, lpfr
  11200. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11201. value is 1.0.
  11202. @item luma_strength, ls
  11203. Set luma maximum difference between pixels to still be considered, must
  11204. be a value in the 0.1-100.0 range, default value is 1.0.
  11205. @item chroma_radius, cr
  11206. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11207. greater value will result in a more blurred image, and in slower
  11208. processing.
  11209. @item chroma_pre_filter_radius, cpfr
  11210. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11211. @item chroma_strength, cs
  11212. Set chroma maximum difference between pixels to still be considered,
  11213. must be a value in the -0.9-100.0 range.
  11214. @end table
  11215. Each chroma option value, if not explicitly specified, is set to the
  11216. corresponding luma option value.
  11217. @anchor{scale}
  11218. @section scale
  11219. Scale (resize) the input video, using the libswscale library.
  11220. The scale filter forces the output display aspect ratio to be the same
  11221. of the input, by changing the output sample aspect ratio.
  11222. If the input image format is different from the format requested by
  11223. the next filter, the scale filter will convert the input to the
  11224. requested format.
  11225. @subsection Options
  11226. The filter accepts the following options, or any of the options
  11227. supported by the libswscale scaler.
  11228. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11229. the complete list of scaler options.
  11230. @table @option
  11231. @item width, w
  11232. @item height, h
  11233. Set the output video dimension expression. Default value is the input
  11234. dimension.
  11235. If the @var{width} or @var{w} value is 0, the input width is used for
  11236. the output. If the @var{height} or @var{h} value is 0, the input height
  11237. is used for the output.
  11238. If one and only one of the values is -n with n >= 1, the scale filter
  11239. will use a value that maintains the aspect ratio of the input image,
  11240. calculated from the other specified dimension. After that it will,
  11241. however, make sure that the calculated dimension is divisible by n and
  11242. adjust the value if necessary.
  11243. If both values are -n with n >= 1, the behavior will be identical to
  11244. both values being set to 0 as previously detailed.
  11245. See below for the list of accepted constants for use in the dimension
  11246. expression.
  11247. @item eval
  11248. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11249. @table @samp
  11250. @item init
  11251. Only evaluate expressions once during the filter initialization or when a command is processed.
  11252. @item frame
  11253. Evaluate expressions for each incoming frame.
  11254. @end table
  11255. Default value is @samp{init}.
  11256. @item interl
  11257. Set the interlacing mode. It accepts the following values:
  11258. @table @samp
  11259. @item 1
  11260. Force interlaced aware scaling.
  11261. @item 0
  11262. Do not apply interlaced scaling.
  11263. @item -1
  11264. Select interlaced aware scaling depending on whether the source frames
  11265. are flagged as interlaced or not.
  11266. @end table
  11267. Default value is @samp{0}.
  11268. @item flags
  11269. Set libswscale scaling flags. See
  11270. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11271. complete list of values. If not explicitly specified the filter applies
  11272. the default flags.
  11273. @item param0, param1
  11274. Set libswscale input parameters for scaling algorithms that need them. See
  11275. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11276. complete documentation. If not explicitly specified the filter applies
  11277. empty parameters.
  11278. @item size, s
  11279. Set the video size. For the syntax of this option, check the
  11280. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11281. @item in_color_matrix
  11282. @item out_color_matrix
  11283. Set in/output YCbCr color space type.
  11284. This allows the autodetected value to be overridden as well as allows forcing
  11285. a specific value used for the output and encoder.
  11286. If not specified, the color space type depends on the pixel format.
  11287. Possible values:
  11288. @table @samp
  11289. @item auto
  11290. Choose automatically.
  11291. @item bt709
  11292. Format conforming to International Telecommunication Union (ITU)
  11293. Recommendation BT.709.
  11294. @item fcc
  11295. Set color space conforming to the United States Federal Communications
  11296. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11297. @item bt601
  11298. Set color space conforming to:
  11299. @itemize
  11300. @item
  11301. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11302. @item
  11303. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11304. @item
  11305. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11306. @end itemize
  11307. @item smpte240m
  11308. Set color space conforming to SMPTE ST 240:1999.
  11309. @end table
  11310. @item in_range
  11311. @item out_range
  11312. Set in/output YCbCr sample range.
  11313. This allows the autodetected value to be overridden as well as allows forcing
  11314. a specific value used for the output and encoder. If not specified, the
  11315. range depends on the pixel format. Possible values:
  11316. @table @samp
  11317. @item auto/unknown
  11318. Choose automatically.
  11319. @item jpeg/full/pc
  11320. Set full range (0-255 in case of 8-bit luma).
  11321. @item mpeg/limited/tv
  11322. Set "MPEG" range (16-235 in case of 8-bit luma).
  11323. @end table
  11324. @item force_original_aspect_ratio
  11325. Enable decreasing or increasing output video width or height if necessary to
  11326. keep the original aspect ratio. Possible values:
  11327. @table @samp
  11328. @item disable
  11329. Scale the video as specified and disable this feature.
  11330. @item decrease
  11331. The output video dimensions will automatically be decreased if needed.
  11332. @item increase
  11333. The output video dimensions will automatically be increased if needed.
  11334. @end table
  11335. One useful instance of this option is that when you know a specific device's
  11336. maximum allowed resolution, you can use this to limit the output video to
  11337. that, while retaining the aspect ratio. For example, device A allows
  11338. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11339. decrease) and specifying 1280x720 to the command line makes the output
  11340. 1280x533.
  11341. Please note that this is a different thing than specifying -1 for @option{w}
  11342. or @option{h}, you still need to specify the output resolution for this option
  11343. to work.
  11344. @end table
  11345. The values of the @option{w} and @option{h} options are expressions
  11346. containing the following constants:
  11347. @table @var
  11348. @item in_w
  11349. @item in_h
  11350. The input width and height
  11351. @item iw
  11352. @item ih
  11353. These are the same as @var{in_w} and @var{in_h}.
  11354. @item out_w
  11355. @item out_h
  11356. The output (scaled) width and height
  11357. @item ow
  11358. @item oh
  11359. These are the same as @var{out_w} and @var{out_h}
  11360. @item a
  11361. The same as @var{iw} / @var{ih}
  11362. @item sar
  11363. input sample aspect ratio
  11364. @item dar
  11365. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11366. @item hsub
  11367. @item vsub
  11368. horizontal and vertical input chroma subsample values. For example for the
  11369. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11370. @item ohsub
  11371. @item ovsub
  11372. horizontal and vertical output chroma subsample values. For example for the
  11373. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11374. @end table
  11375. @subsection Examples
  11376. @itemize
  11377. @item
  11378. Scale the input video to a size of 200x100
  11379. @example
  11380. scale=w=200:h=100
  11381. @end example
  11382. This is equivalent to:
  11383. @example
  11384. scale=200:100
  11385. @end example
  11386. or:
  11387. @example
  11388. scale=200x100
  11389. @end example
  11390. @item
  11391. Specify a size abbreviation for the output size:
  11392. @example
  11393. scale=qcif
  11394. @end example
  11395. which can also be written as:
  11396. @example
  11397. scale=size=qcif
  11398. @end example
  11399. @item
  11400. Scale the input to 2x:
  11401. @example
  11402. scale=w=2*iw:h=2*ih
  11403. @end example
  11404. @item
  11405. The above is the same as:
  11406. @example
  11407. scale=2*in_w:2*in_h
  11408. @end example
  11409. @item
  11410. Scale the input to 2x with forced interlaced scaling:
  11411. @example
  11412. scale=2*iw:2*ih:interl=1
  11413. @end example
  11414. @item
  11415. Scale the input to half size:
  11416. @example
  11417. scale=w=iw/2:h=ih/2
  11418. @end example
  11419. @item
  11420. Increase the width, and set the height to the same size:
  11421. @example
  11422. scale=3/2*iw:ow
  11423. @end example
  11424. @item
  11425. Seek Greek harmony:
  11426. @example
  11427. scale=iw:1/PHI*iw
  11428. scale=ih*PHI:ih
  11429. @end example
  11430. @item
  11431. Increase the height, and set the width to 3/2 of the height:
  11432. @example
  11433. scale=w=3/2*oh:h=3/5*ih
  11434. @end example
  11435. @item
  11436. Increase the size, making the size a multiple of the chroma
  11437. subsample values:
  11438. @example
  11439. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11440. @end example
  11441. @item
  11442. Increase the width to a maximum of 500 pixels,
  11443. keeping the same aspect ratio as the input:
  11444. @example
  11445. scale=w='min(500\, iw*3/2):h=-1'
  11446. @end example
  11447. @item
  11448. Make pixels square by combining scale and setsar:
  11449. @example
  11450. scale='trunc(ih*dar):ih',setsar=1/1
  11451. @end example
  11452. @item
  11453. Make pixels square by combining scale and setsar,
  11454. making sure the resulting resolution is even (required by some codecs):
  11455. @example
  11456. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11457. @end example
  11458. @end itemize
  11459. @subsection Commands
  11460. This filter supports the following commands:
  11461. @table @option
  11462. @item width, w
  11463. @item height, h
  11464. Set the output video dimension expression.
  11465. The command accepts the same syntax of the corresponding option.
  11466. If the specified expression is not valid, it is kept at its current
  11467. value.
  11468. @end table
  11469. @section scale_npp
  11470. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11471. format conversion on CUDA video frames. Setting the output width and height
  11472. works in the same way as for the @var{scale} filter.
  11473. The following additional options are accepted:
  11474. @table @option
  11475. @item format
  11476. The pixel format of the output CUDA frames. If set to the string "same" (the
  11477. default), the input format will be kept. Note that automatic format negotiation
  11478. and conversion is not yet supported for hardware frames
  11479. @item interp_algo
  11480. The interpolation algorithm used for resizing. One of the following:
  11481. @table @option
  11482. @item nn
  11483. Nearest neighbour.
  11484. @item linear
  11485. @item cubic
  11486. @item cubic2p_bspline
  11487. 2-parameter cubic (B=1, C=0)
  11488. @item cubic2p_catmullrom
  11489. 2-parameter cubic (B=0, C=1/2)
  11490. @item cubic2p_b05c03
  11491. 2-parameter cubic (B=1/2, C=3/10)
  11492. @item super
  11493. Supersampling
  11494. @item lanczos
  11495. @end table
  11496. @end table
  11497. @section scale2ref
  11498. Scale (resize) the input video, based on a reference video.
  11499. See the scale filter for available options, scale2ref supports the same but
  11500. uses the reference video instead of the main input as basis. scale2ref also
  11501. supports the following additional constants for the @option{w} and
  11502. @option{h} options:
  11503. @table @var
  11504. @item main_w
  11505. @item main_h
  11506. The main input video's width and height
  11507. @item main_a
  11508. The same as @var{main_w} / @var{main_h}
  11509. @item main_sar
  11510. The main input video's sample aspect ratio
  11511. @item main_dar, mdar
  11512. The main input video's display aspect ratio. Calculated from
  11513. @code{(main_w / main_h) * main_sar}.
  11514. @item main_hsub
  11515. @item main_vsub
  11516. The main input video's horizontal and vertical chroma subsample values.
  11517. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11518. is 1.
  11519. @end table
  11520. @subsection Examples
  11521. @itemize
  11522. @item
  11523. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11524. @example
  11525. 'scale2ref[b][a];[a][b]overlay'
  11526. @end example
  11527. @end itemize
  11528. @anchor{selectivecolor}
  11529. @section selectivecolor
  11530. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11531. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11532. by the "purity" of the color (that is, how saturated it already is).
  11533. This filter is similar to the Adobe Photoshop Selective Color tool.
  11534. The filter accepts the following options:
  11535. @table @option
  11536. @item correction_method
  11537. Select color correction method.
  11538. Available values are:
  11539. @table @samp
  11540. @item absolute
  11541. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11542. component value).
  11543. @item relative
  11544. Specified adjustments are relative to the original component value.
  11545. @end table
  11546. Default is @code{absolute}.
  11547. @item reds
  11548. Adjustments for red pixels (pixels where the red component is the maximum)
  11549. @item yellows
  11550. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11551. @item greens
  11552. Adjustments for green pixels (pixels where the green component is the maximum)
  11553. @item cyans
  11554. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11555. @item blues
  11556. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11557. @item magentas
  11558. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11559. @item whites
  11560. Adjustments for white pixels (pixels where all components are greater than 128)
  11561. @item neutrals
  11562. Adjustments for all pixels except pure black and pure white
  11563. @item blacks
  11564. Adjustments for black pixels (pixels where all components are lesser than 128)
  11565. @item psfile
  11566. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11567. @end table
  11568. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11569. 4 space separated floating point adjustment values in the [-1,1] range,
  11570. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11571. pixels of its range.
  11572. @subsection Examples
  11573. @itemize
  11574. @item
  11575. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11576. increase magenta by 27% in blue areas:
  11577. @example
  11578. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11579. @end example
  11580. @item
  11581. Use a Photoshop selective color preset:
  11582. @example
  11583. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11584. @end example
  11585. @end itemize
  11586. @anchor{separatefields}
  11587. @section separatefields
  11588. The @code{separatefields} takes a frame-based video input and splits
  11589. each frame into its components fields, producing a new half height clip
  11590. with twice the frame rate and twice the frame count.
  11591. This filter use field-dominance information in frame to decide which
  11592. of each pair of fields to place first in the output.
  11593. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11594. @section setdar, setsar
  11595. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11596. output video.
  11597. This is done by changing the specified Sample (aka Pixel) Aspect
  11598. Ratio, according to the following equation:
  11599. @example
  11600. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11601. @end example
  11602. Keep in mind that the @code{setdar} filter does not modify the pixel
  11603. dimensions of the video frame. Also, the display aspect ratio set by
  11604. this filter may be changed by later filters in the filterchain,
  11605. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11606. applied.
  11607. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11608. the filter output video.
  11609. Note that as a consequence of the application of this filter, the
  11610. output display aspect ratio will change according to the equation
  11611. above.
  11612. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11613. filter may be changed by later filters in the filterchain, e.g. if
  11614. another "setsar" or a "setdar" filter is applied.
  11615. It accepts the following parameters:
  11616. @table @option
  11617. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11618. Set the aspect ratio used by the filter.
  11619. The parameter can be a floating point number string, an expression, or
  11620. a string of the form @var{num}:@var{den}, where @var{num} and
  11621. @var{den} are the numerator and denominator of the aspect ratio. If
  11622. the parameter is not specified, it is assumed the value "0".
  11623. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11624. should be escaped.
  11625. @item max
  11626. Set the maximum integer value to use for expressing numerator and
  11627. denominator when reducing the expressed aspect ratio to a rational.
  11628. Default value is @code{100}.
  11629. @end table
  11630. The parameter @var{sar} is an expression containing
  11631. the following constants:
  11632. @table @option
  11633. @item E, PI, PHI
  11634. These are approximated values for the mathematical constants e
  11635. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11636. @item w, h
  11637. The input width and height.
  11638. @item a
  11639. These are the same as @var{w} / @var{h}.
  11640. @item sar
  11641. The input sample aspect ratio.
  11642. @item dar
  11643. The input display aspect ratio. It is the same as
  11644. (@var{w} / @var{h}) * @var{sar}.
  11645. @item hsub, vsub
  11646. Horizontal and vertical chroma subsample values. For example, for the
  11647. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11648. @end table
  11649. @subsection Examples
  11650. @itemize
  11651. @item
  11652. To change the display aspect ratio to 16:9, specify one of the following:
  11653. @example
  11654. setdar=dar=1.77777
  11655. setdar=dar=16/9
  11656. @end example
  11657. @item
  11658. To change the sample aspect ratio to 10:11, specify:
  11659. @example
  11660. setsar=sar=10/11
  11661. @end example
  11662. @item
  11663. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11664. 1000 in the aspect ratio reduction, use the command:
  11665. @example
  11666. setdar=ratio=16/9:max=1000
  11667. @end example
  11668. @end itemize
  11669. @anchor{setfield}
  11670. @section setfield
  11671. Force field for the output video frame.
  11672. The @code{setfield} filter marks the interlace type field for the
  11673. output frames. It does not change the input frame, but only sets the
  11674. corresponding property, which affects how the frame is treated by
  11675. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11676. The filter accepts the following options:
  11677. @table @option
  11678. @item mode
  11679. Available values are:
  11680. @table @samp
  11681. @item auto
  11682. Keep the same field property.
  11683. @item bff
  11684. Mark the frame as bottom-field-first.
  11685. @item tff
  11686. Mark the frame as top-field-first.
  11687. @item prog
  11688. Mark the frame as progressive.
  11689. @end table
  11690. @end table
  11691. @anchor{setparams}
  11692. @section setparams
  11693. Force frame parameter for the output video frame.
  11694. The @code{setparams} filter marks interlace and color range for the
  11695. output frames. It does not change the input frame, but only sets the
  11696. corresponding property, which affects how the frame is treated by
  11697. filters/encoders.
  11698. @table @option
  11699. @item field_mode
  11700. Available values are:
  11701. @table @samp
  11702. @item auto
  11703. Keep the same field property (default).
  11704. @item bff
  11705. Mark the frame as bottom-field-first.
  11706. @item tff
  11707. Mark the frame as top-field-first.
  11708. @item prog
  11709. Mark the frame as progressive.
  11710. @end table
  11711. @item range
  11712. Available values are:
  11713. @table @samp
  11714. @item auto
  11715. Keep the same color range property (default).
  11716. @item unspecified, unknown
  11717. Mark the frame as unspecified color range.
  11718. @item limited, tv, mpeg
  11719. Mark the frame as limited range.
  11720. @item full, pc, jpeg
  11721. Mark the frame as full range.
  11722. @end table
  11723. @item color_primaries
  11724. Set the color primaries.
  11725. Available values are:
  11726. @table @samp
  11727. @item auto
  11728. Keep the same color primaries property (default).
  11729. @item bt709
  11730. @item unknown
  11731. @item bt470m
  11732. @item bt470bg
  11733. @item smpte170m
  11734. @item smpte240m
  11735. @item film
  11736. @item bt2020
  11737. @item smpte428
  11738. @item smpte431
  11739. @item smpte432
  11740. @item jedec-p22
  11741. @end table
  11742. @item color_trc
  11743. Set the color transfer.
  11744. Available values are:
  11745. @table @samp
  11746. @item auto
  11747. Keep the same color trc property (default).
  11748. @item bt709
  11749. @item unknown
  11750. @item bt470m
  11751. @item bt470bg
  11752. @item smpte170m
  11753. @item smpte240m
  11754. @item linear
  11755. @item log100
  11756. @item log316
  11757. @item iec61966-2-4
  11758. @item bt1361e
  11759. @item iec61966-2-1
  11760. @item bt2020-10
  11761. @item bt2020-12
  11762. @item smpte2084
  11763. @item smpte428
  11764. @item arib-std-b67
  11765. @end table
  11766. @item colorspace
  11767. Set the colorspace.
  11768. Available values are:
  11769. @table @samp
  11770. @item auto
  11771. Keep the same colorspace property (default).
  11772. @item gbr
  11773. @item bt709
  11774. @item unknown
  11775. @item fcc
  11776. @item bt470bg
  11777. @item smpte170m
  11778. @item smpte240m
  11779. @item ycgco
  11780. @item bt2020nc
  11781. @item bt2020c
  11782. @item smpte2085
  11783. @item chroma-derived-nc
  11784. @item chroma-derived-c
  11785. @item ictcp
  11786. @end table
  11787. @end table
  11788. @section showinfo
  11789. Show a line containing various information for each input video frame.
  11790. The input video is not modified.
  11791. This filter supports the following options:
  11792. @table @option
  11793. @item checksum
  11794. Calculate checksums of each plane. By default enabled.
  11795. @end table
  11796. The shown line contains a sequence of key/value pairs of the form
  11797. @var{key}:@var{value}.
  11798. The following values are shown in the output:
  11799. @table @option
  11800. @item n
  11801. The (sequential) number of the input frame, starting from 0.
  11802. @item pts
  11803. The Presentation TimeStamp of the input frame, expressed as a number of
  11804. time base units. The time base unit depends on the filter input pad.
  11805. @item pts_time
  11806. The Presentation TimeStamp of the input frame, expressed as a number of
  11807. seconds.
  11808. @item pos
  11809. The position of the frame in the input stream, or -1 if this information is
  11810. unavailable and/or meaningless (for example in case of synthetic video).
  11811. @item fmt
  11812. The pixel format name.
  11813. @item sar
  11814. The sample aspect ratio of the input frame, expressed in the form
  11815. @var{num}/@var{den}.
  11816. @item s
  11817. The size of the input frame. For the syntax of this option, check the
  11818. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11819. @item i
  11820. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11821. for bottom field first).
  11822. @item iskey
  11823. This is 1 if the frame is a key frame, 0 otherwise.
  11824. @item type
  11825. The picture type of the input frame ("I" for an I-frame, "P" for a
  11826. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11827. Also refer to the documentation of the @code{AVPictureType} enum and of
  11828. the @code{av_get_picture_type_char} function defined in
  11829. @file{libavutil/avutil.h}.
  11830. @item checksum
  11831. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11832. @item plane_checksum
  11833. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11834. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11835. @end table
  11836. @section showpalette
  11837. Displays the 256 colors palette of each frame. This filter is only relevant for
  11838. @var{pal8} pixel format frames.
  11839. It accepts the following option:
  11840. @table @option
  11841. @item s
  11842. Set the size of the box used to represent one palette color entry. Default is
  11843. @code{30} (for a @code{30x30} pixel box).
  11844. @end table
  11845. @section shuffleframes
  11846. Reorder and/or duplicate and/or drop video frames.
  11847. It accepts the following parameters:
  11848. @table @option
  11849. @item mapping
  11850. Set the destination indexes of input frames.
  11851. This is space or '|' separated list of indexes that maps input frames to output
  11852. frames. Number of indexes also sets maximal value that each index may have.
  11853. '-1' index have special meaning and that is to drop frame.
  11854. @end table
  11855. The first frame has the index 0. The default is to keep the input unchanged.
  11856. @subsection Examples
  11857. @itemize
  11858. @item
  11859. Swap second and third frame of every three frames of the input:
  11860. @example
  11861. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11862. @end example
  11863. @item
  11864. Swap 10th and 1st frame of every ten frames of the input:
  11865. @example
  11866. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11867. @end example
  11868. @end itemize
  11869. @section shuffleplanes
  11870. Reorder and/or duplicate video planes.
  11871. It accepts the following parameters:
  11872. @table @option
  11873. @item map0
  11874. The index of the input plane to be used as the first output plane.
  11875. @item map1
  11876. The index of the input plane to be used as the second output plane.
  11877. @item map2
  11878. The index of the input plane to be used as the third output plane.
  11879. @item map3
  11880. The index of the input plane to be used as the fourth output plane.
  11881. @end table
  11882. The first plane has the index 0. The default is to keep the input unchanged.
  11883. @subsection Examples
  11884. @itemize
  11885. @item
  11886. Swap the second and third planes of the input:
  11887. @example
  11888. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11889. @end example
  11890. @end itemize
  11891. @anchor{signalstats}
  11892. @section signalstats
  11893. Evaluate various visual metrics that assist in determining issues associated
  11894. with the digitization of analog video media.
  11895. By default the filter will log these metadata values:
  11896. @table @option
  11897. @item YMIN
  11898. Display the minimal Y value contained within the input frame. Expressed in
  11899. range of [0-255].
  11900. @item YLOW
  11901. Display the Y value at the 10% percentile within the input frame. Expressed in
  11902. range of [0-255].
  11903. @item YAVG
  11904. Display the average Y value within the input frame. Expressed in range of
  11905. [0-255].
  11906. @item YHIGH
  11907. Display the Y value at the 90% percentile within the input frame. Expressed in
  11908. range of [0-255].
  11909. @item YMAX
  11910. Display the maximum Y value contained within the input frame. Expressed in
  11911. range of [0-255].
  11912. @item UMIN
  11913. Display the minimal U value contained within the input frame. Expressed in
  11914. range of [0-255].
  11915. @item ULOW
  11916. Display the U value at the 10% percentile within the input frame. Expressed in
  11917. range of [0-255].
  11918. @item UAVG
  11919. Display the average U value within the input frame. Expressed in range of
  11920. [0-255].
  11921. @item UHIGH
  11922. Display the U value at the 90% percentile within the input frame. Expressed in
  11923. range of [0-255].
  11924. @item UMAX
  11925. Display the maximum U value contained within the input frame. Expressed in
  11926. range of [0-255].
  11927. @item VMIN
  11928. Display the minimal V value contained within the input frame. Expressed in
  11929. range of [0-255].
  11930. @item VLOW
  11931. Display the V value at the 10% percentile within the input frame. Expressed in
  11932. range of [0-255].
  11933. @item VAVG
  11934. Display the average V value within the input frame. Expressed in range of
  11935. [0-255].
  11936. @item VHIGH
  11937. Display the V value at the 90% percentile within the input frame. Expressed in
  11938. range of [0-255].
  11939. @item VMAX
  11940. Display the maximum V value contained within the input frame. Expressed in
  11941. range of [0-255].
  11942. @item SATMIN
  11943. Display the minimal saturation value contained within the input frame.
  11944. Expressed in range of [0-~181.02].
  11945. @item SATLOW
  11946. Display the saturation value at the 10% percentile within the input frame.
  11947. Expressed in range of [0-~181.02].
  11948. @item SATAVG
  11949. Display the average saturation value within the input frame. Expressed in range
  11950. of [0-~181.02].
  11951. @item SATHIGH
  11952. Display the saturation value at the 90% percentile within the input frame.
  11953. Expressed in range of [0-~181.02].
  11954. @item SATMAX
  11955. Display the maximum saturation value contained within the input frame.
  11956. Expressed in range of [0-~181.02].
  11957. @item HUEMED
  11958. Display the median value for hue within the input frame. Expressed in range of
  11959. [0-360].
  11960. @item HUEAVG
  11961. Display the average value for hue within the input frame. Expressed in range of
  11962. [0-360].
  11963. @item YDIF
  11964. Display the average of sample value difference between all values of the Y
  11965. plane in the current frame and corresponding values of the previous input frame.
  11966. Expressed in range of [0-255].
  11967. @item UDIF
  11968. Display the average of sample value difference between all values of the U
  11969. plane in the current frame and corresponding values of the previous input frame.
  11970. Expressed in range of [0-255].
  11971. @item VDIF
  11972. Display the average of sample value difference between all values of the V
  11973. plane in the current frame and corresponding values of the previous input frame.
  11974. Expressed in range of [0-255].
  11975. @item YBITDEPTH
  11976. Display bit depth of Y plane in current frame.
  11977. Expressed in range of [0-16].
  11978. @item UBITDEPTH
  11979. Display bit depth of U plane in current frame.
  11980. Expressed in range of [0-16].
  11981. @item VBITDEPTH
  11982. Display bit depth of V plane in current frame.
  11983. Expressed in range of [0-16].
  11984. @end table
  11985. The filter accepts the following options:
  11986. @table @option
  11987. @item stat
  11988. @item out
  11989. @option{stat} specify an additional form of image analysis.
  11990. @option{out} output video with the specified type of pixel highlighted.
  11991. Both options accept the following values:
  11992. @table @samp
  11993. @item tout
  11994. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11995. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11996. include the results of video dropouts, head clogs, or tape tracking issues.
  11997. @item vrep
  11998. Identify @var{vertical line repetition}. Vertical line repetition includes
  11999. similar rows of pixels within a frame. In born-digital video vertical line
  12000. repetition is common, but this pattern is uncommon in video digitized from an
  12001. analog source. When it occurs in video that results from the digitization of an
  12002. analog source it can indicate concealment from a dropout compensator.
  12003. @item brng
  12004. Identify pixels that fall outside of legal broadcast range.
  12005. @end table
  12006. @item color, c
  12007. Set the highlight color for the @option{out} option. The default color is
  12008. yellow.
  12009. @end table
  12010. @subsection Examples
  12011. @itemize
  12012. @item
  12013. Output data of various video metrics:
  12014. @example
  12015. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12016. @end example
  12017. @item
  12018. Output specific data about the minimum and maximum values of the Y plane per frame:
  12019. @example
  12020. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12021. @end example
  12022. @item
  12023. Playback video while highlighting pixels that are outside of broadcast range in red.
  12024. @example
  12025. ffplay example.mov -vf signalstats="out=brng:color=red"
  12026. @end example
  12027. @item
  12028. Playback video with signalstats metadata drawn over the frame.
  12029. @example
  12030. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12031. @end example
  12032. The contents of signalstat_drawtext.txt used in the command are:
  12033. @example
  12034. time %@{pts:hms@}
  12035. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12036. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12037. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12038. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12039. @end example
  12040. @end itemize
  12041. @anchor{signature}
  12042. @section signature
  12043. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12044. input. In this case the matching between the inputs can be calculated additionally.
  12045. The filter always passes through the first input. The signature of each stream can
  12046. be written into a file.
  12047. It accepts the following options:
  12048. @table @option
  12049. @item detectmode
  12050. Enable or disable the matching process.
  12051. Available values are:
  12052. @table @samp
  12053. @item off
  12054. Disable the calculation of a matching (default).
  12055. @item full
  12056. Calculate the matching for the whole video and output whether the whole video
  12057. matches or only parts.
  12058. @item fast
  12059. Calculate only until a matching is found or the video ends. Should be faster in
  12060. some cases.
  12061. @end table
  12062. @item nb_inputs
  12063. Set the number of inputs. The option value must be a non negative integer.
  12064. Default value is 1.
  12065. @item filename
  12066. Set the path to which the output is written. If there is more than one input,
  12067. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12068. integer), that will be replaced with the input number. If no filename is
  12069. specified, no output will be written. This is the default.
  12070. @item format
  12071. Choose the output format.
  12072. Available values are:
  12073. @table @samp
  12074. @item binary
  12075. Use the specified binary representation (default).
  12076. @item xml
  12077. Use the specified xml representation.
  12078. @end table
  12079. @item th_d
  12080. Set threshold to detect one word as similar. The option value must be an integer
  12081. greater than zero. The default value is 9000.
  12082. @item th_dc
  12083. Set threshold to detect all words as similar. The option value must be an integer
  12084. greater than zero. The default value is 60000.
  12085. @item th_xh
  12086. Set threshold to detect frames as similar. The option value must be an integer
  12087. greater than zero. The default value is 116.
  12088. @item th_di
  12089. Set the minimum length of a sequence in frames to recognize it as matching
  12090. sequence. The option value must be a non negative integer value.
  12091. The default value is 0.
  12092. @item th_it
  12093. Set the minimum relation, that matching frames to all frames must have.
  12094. The option value must be a double value between 0 and 1. The default value is 0.5.
  12095. @end table
  12096. @subsection Examples
  12097. @itemize
  12098. @item
  12099. To calculate the signature of an input video and store it in signature.bin:
  12100. @example
  12101. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12102. @end example
  12103. @item
  12104. To detect whether two videos match and store the signatures in XML format in
  12105. signature0.xml and signature1.xml:
  12106. @example
  12107. 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 -
  12108. @end example
  12109. @end itemize
  12110. @anchor{smartblur}
  12111. @section smartblur
  12112. Blur the input video without impacting the outlines.
  12113. It accepts the following options:
  12114. @table @option
  12115. @item luma_radius, lr
  12116. Set the luma radius. The option value must be a float number in
  12117. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12118. used to blur the image (slower if larger). Default value is 1.0.
  12119. @item luma_strength, ls
  12120. Set the luma strength. The option value must be a float number
  12121. in the range [-1.0,1.0] that configures the blurring. A value included
  12122. in [0.0,1.0] will blur the image whereas a value included in
  12123. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12124. @item luma_threshold, lt
  12125. Set the luma threshold used as a coefficient to determine
  12126. whether a pixel should be blurred or not. The option value must be an
  12127. integer in the range [-30,30]. A value of 0 will filter all the image,
  12128. a value included in [0,30] will filter flat areas and a value included
  12129. in [-30,0] will filter edges. Default value is 0.
  12130. @item chroma_radius, cr
  12131. Set the chroma radius. The option value must be a float number in
  12132. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12133. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12134. @item chroma_strength, cs
  12135. Set the chroma strength. The option value must be a float number
  12136. in the range [-1.0,1.0] that configures the blurring. A value included
  12137. in [0.0,1.0] will blur the image whereas a value included in
  12138. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12139. @item chroma_threshold, ct
  12140. Set the chroma threshold used as a coefficient to determine
  12141. whether a pixel should be blurred or not. The option value must be an
  12142. integer in the range [-30,30]. A value of 0 will filter all the image,
  12143. a value included in [0,30] will filter flat areas and a value included
  12144. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12145. @end table
  12146. If a chroma option is not explicitly set, the corresponding luma value
  12147. is set.
  12148. @section ssim
  12149. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12150. This filter takes in input two input videos, the first input is
  12151. considered the "main" source and is passed unchanged to the
  12152. output. The second input is used as a "reference" video for computing
  12153. the SSIM.
  12154. Both video inputs must have the same resolution and pixel format for
  12155. this filter to work correctly. Also it assumes that both inputs
  12156. have the same number of frames, which are compared one by one.
  12157. The filter stores the calculated SSIM of each frame.
  12158. The description of the accepted parameters follows.
  12159. @table @option
  12160. @item stats_file, f
  12161. If specified the filter will use the named file to save the SSIM of
  12162. each individual frame. When filename equals "-" the data is sent to
  12163. standard output.
  12164. @end table
  12165. The file printed if @var{stats_file} is selected, contains a sequence of
  12166. key/value pairs of the form @var{key}:@var{value} for each compared
  12167. couple of frames.
  12168. A description of each shown parameter follows:
  12169. @table @option
  12170. @item n
  12171. sequential number of the input frame, starting from 1
  12172. @item Y, U, V, R, G, B
  12173. SSIM of the compared frames for the component specified by the suffix.
  12174. @item All
  12175. SSIM of the compared frames for the whole frame.
  12176. @item dB
  12177. Same as above but in dB representation.
  12178. @end table
  12179. This filter also supports the @ref{framesync} options.
  12180. For example:
  12181. @example
  12182. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12183. [main][ref] ssim="stats_file=stats.log" [out]
  12184. @end example
  12185. On this example the input file being processed is compared with the
  12186. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12187. is stored in @file{stats.log}.
  12188. Another example with both psnr and ssim at same time:
  12189. @example
  12190. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12191. @end example
  12192. @section stereo3d
  12193. Convert between different stereoscopic image formats.
  12194. The filters accept the following options:
  12195. @table @option
  12196. @item in
  12197. Set stereoscopic image format of input.
  12198. Available values for input image formats are:
  12199. @table @samp
  12200. @item sbsl
  12201. side by side parallel (left eye left, right eye right)
  12202. @item sbsr
  12203. side by side crosseye (right eye left, left eye right)
  12204. @item sbs2l
  12205. side by side parallel with half width resolution
  12206. (left eye left, right eye right)
  12207. @item sbs2r
  12208. side by side crosseye with half width resolution
  12209. (right eye left, left eye right)
  12210. @item abl
  12211. above-below (left eye above, right eye below)
  12212. @item abr
  12213. above-below (right eye above, left eye below)
  12214. @item ab2l
  12215. above-below with half height resolution
  12216. (left eye above, right eye below)
  12217. @item ab2r
  12218. above-below with half height resolution
  12219. (right eye above, left eye below)
  12220. @item al
  12221. alternating frames (left eye first, right eye second)
  12222. @item ar
  12223. alternating frames (right eye first, left eye second)
  12224. @item irl
  12225. interleaved rows (left eye has top row, right eye starts on next row)
  12226. @item irr
  12227. interleaved rows (right eye has top row, left eye starts on next row)
  12228. @item icl
  12229. interleaved columns, left eye first
  12230. @item icr
  12231. interleaved columns, right eye first
  12232. Default value is @samp{sbsl}.
  12233. @end table
  12234. @item out
  12235. Set stereoscopic image format of output.
  12236. @table @samp
  12237. @item sbsl
  12238. side by side parallel (left eye left, right eye right)
  12239. @item sbsr
  12240. side by side crosseye (right eye left, left eye right)
  12241. @item sbs2l
  12242. side by side parallel with half width resolution
  12243. (left eye left, right eye right)
  12244. @item sbs2r
  12245. side by side crosseye with half width resolution
  12246. (right eye left, left eye right)
  12247. @item abl
  12248. above-below (left eye above, right eye below)
  12249. @item abr
  12250. above-below (right eye above, left eye below)
  12251. @item ab2l
  12252. above-below with half height resolution
  12253. (left eye above, right eye below)
  12254. @item ab2r
  12255. above-below with half height resolution
  12256. (right eye above, left eye below)
  12257. @item al
  12258. alternating frames (left eye first, right eye second)
  12259. @item ar
  12260. alternating frames (right eye first, left eye second)
  12261. @item irl
  12262. interleaved rows (left eye has top row, right eye starts on next row)
  12263. @item irr
  12264. interleaved rows (right eye has top row, left eye starts on next row)
  12265. @item arbg
  12266. anaglyph red/blue gray
  12267. (red filter on left eye, blue filter on right eye)
  12268. @item argg
  12269. anaglyph red/green gray
  12270. (red filter on left eye, green filter on right eye)
  12271. @item arcg
  12272. anaglyph red/cyan gray
  12273. (red filter on left eye, cyan filter on right eye)
  12274. @item arch
  12275. anaglyph red/cyan half colored
  12276. (red filter on left eye, cyan filter on right eye)
  12277. @item arcc
  12278. anaglyph red/cyan color
  12279. (red filter on left eye, cyan filter on right eye)
  12280. @item arcd
  12281. anaglyph red/cyan color optimized with the least squares projection of dubois
  12282. (red filter on left eye, cyan filter on right eye)
  12283. @item agmg
  12284. anaglyph green/magenta gray
  12285. (green filter on left eye, magenta filter on right eye)
  12286. @item agmh
  12287. anaglyph green/magenta half colored
  12288. (green filter on left eye, magenta filter on right eye)
  12289. @item agmc
  12290. anaglyph green/magenta colored
  12291. (green filter on left eye, magenta filter on right eye)
  12292. @item agmd
  12293. anaglyph green/magenta color optimized with the least squares projection of dubois
  12294. (green filter on left eye, magenta filter on right eye)
  12295. @item aybg
  12296. anaglyph yellow/blue gray
  12297. (yellow filter on left eye, blue filter on right eye)
  12298. @item aybh
  12299. anaglyph yellow/blue half colored
  12300. (yellow filter on left eye, blue filter on right eye)
  12301. @item aybc
  12302. anaglyph yellow/blue colored
  12303. (yellow filter on left eye, blue filter on right eye)
  12304. @item aybd
  12305. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12306. (yellow filter on left eye, blue filter on right eye)
  12307. @item ml
  12308. mono output (left eye only)
  12309. @item mr
  12310. mono output (right eye only)
  12311. @item chl
  12312. checkerboard, left eye first
  12313. @item chr
  12314. checkerboard, right eye first
  12315. @item icl
  12316. interleaved columns, left eye first
  12317. @item icr
  12318. interleaved columns, right eye first
  12319. @item hdmi
  12320. HDMI frame pack
  12321. @end table
  12322. Default value is @samp{arcd}.
  12323. @end table
  12324. @subsection Examples
  12325. @itemize
  12326. @item
  12327. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12328. @example
  12329. stereo3d=sbsl:aybd
  12330. @end example
  12331. @item
  12332. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12333. @example
  12334. stereo3d=abl:sbsr
  12335. @end example
  12336. @end itemize
  12337. @section streamselect, astreamselect
  12338. Select video or audio streams.
  12339. The filter accepts the following options:
  12340. @table @option
  12341. @item inputs
  12342. Set number of inputs. Default is 2.
  12343. @item map
  12344. Set input indexes to remap to outputs.
  12345. @end table
  12346. @subsection Commands
  12347. The @code{streamselect} and @code{astreamselect} filter supports the following
  12348. commands:
  12349. @table @option
  12350. @item map
  12351. Set input indexes to remap to outputs.
  12352. @end table
  12353. @subsection Examples
  12354. @itemize
  12355. @item
  12356. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12357. @example
  12358. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12359. @end example
  12360. @item
  12361. Same as above, but for audio:
  12362. @example
  12363. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12364. @end example
  12365. @end itemize
  12366. @section sobel
  12367. Apply sobel operator to input video stream.
  12368. The filter accepts the following option:
  12369. @table @option
  12370. @item planes
  12371. Set which planes will be processed, unprocessed planes will be copied.
  12372. By default value 0xf, all planes will be processed.
  12373. @item scale
  12374. Set value which will be multiplied with filtered result.
  12375. @item delta
  12376. Set value which will be added to filtered result.
  12377. @end table
  12378. @anchor{spp}
  12379. @section spp
  12380. Apply a simple postprocessing filter that compresses and decompresses the image
  12381. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12382. and average the results.
  12383. The filter accepts the following options:
  12384. @table @option
  12385. @item quality
  12386. Set quality. This option defines the number of levels for averaging. It accepts
  12387. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12388. effect. A value of @code{6} means the higher quality. For each increment of
  12389. that value the speed drops by a factor of approximately 2. Default value is
  12390. @code{3}.
  12391. @item qp
  12392. Force a constant quantization parameter. If not set, the filter will use the QP
  12393. from the video stream (if available).
  12394. @item mode
  12395. Set thresholding mode. Available modes are:
  12396. @table @samp
  12397. @item hard
  12398. Set hard thresholding (default).
  12399. @item soft
  12400. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12401. @end table
  12402. @item use_bframe_qp
  12403. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12404. option may cause flicker since the B-Frames have often larger QP. Default is
  12405. @code{0} (not enabled).
  12406. @end table
  12407. @section sr
  12408. Scale the input by applying one of the super-resolution methods based on
  12409. convolutional neural networks. Supported models:
  12410. @itemize
  12411. @item
  12412. Super-Resolution Convolutional Neural Network model (SRCNN).
  12413. See @url{https://arxiv.org/abs/1501.00092}.
  12414. @item
  12415. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12416. See @url{https://arxiv.org/abs/1609.05158}.
  12417. @end itemize
  12418. Training scripts as well as scripts for model generation are provided in
  12419. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12420. The filter accepts the following options:
  12421. @table @option
  12422. @item dnn_backend
  12423. Specify which DNN backend to use for model loading and execution. This option accepts
  12424. the following values:
  12425. @table @samp
  12426. @item native
  12427. Native implementation of DNN loading and execution.
  12428. @item tensorflow
  12429. TensorFlow backend. To enable this backend you
  12430. need to install the TensorFlow for C library (see
  12431. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12432. @code{--enable-libtensorflow}
  12433. @end table
  12434. Default value is @samp{native}.
  12435. @item model
  12436. Set path to model file specifying network architecture and its parameters.
  12437. Note that different backends use different file formats. TensorFlow backend
  12438. can load files for both formats, while native backend can load files for only
  12439. its format.
  12440. @item scale_factor
  12441. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12442. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12443. input upscaled using bicubic upscaling with proper scale factor.
  12444. @end table
  12445. @anchor{subtitles}
  12446. @section subtitles
  12447. Draw subtitles on top of input video using the libass library.
  12448. To enable compilation of this filter you need to configure FFmpeg with
  12449. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12450. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12451. Alpha) subtitles format.
  12452. The filter accepts the following options:
  12453. @table @option
  12454. @item filename, f
  12455. Set the filename of the subtitle file to read. It must be specified.
  12456. @item original_size
  12457. Specify the size of the original video, the video for which the ASS file
  12458. was composed. For the syntax of this option, check the
  12459. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12460. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12461. correctly scale the fonts if the aspect ratio has been changed.
  12462. @item fontsdir
  12463. Set a directory path containing fonts that can be used by the filter.
  12464. These fonts will be used in addition to whatever the font provider uses.
  12465. @item alpha
  12466. Process alpha channel, by default alpha channel is untouched.
  12467. @item charenc
  12468. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12469. useful if not UTF-8.
  12470. @item stream_index, si
  12471. Set subtitles stream index. @code{subtitles} filter only.
  12472. @item force_style
  12473. Override default style or script info parameters of the subtitles. It accepts a
  12474. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12475. @end table
  12476. If the first key is not specified, it is assumed that the first value
  12477. specifies the @option{filename}.
  12478. For example, to render the file @file{sub.srt} on top of the input
  12479. video, use the command:
  12480. @example
  12481. subtitles=sub.srt
  12482. @end example
  12483. which is equivalent to:
  12484. @example
  12485. subtitles=filename=sub.srt
  12486. @end example
  12487. To render the default subtitles stream from file @file{video.mkv}, use:
  12488. @example
  12489. subtitles=video.mkv
  12490. @end example
  12491. To render the second subtitles stream from that file, use:
  12492. @example
  12493. subtitles=video.mkv:si=1
  12494. @end example
  12495. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12496. @code{DejaVu Serif}, use:
  12497. @example
  12498. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12499. @end example
  12500. @section super2xsai
  12501. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12502. Interpolate) pixel art scaling algorithm.
  12503. Useful for enlarging pixel art images without reducing sharpness.
  12504. @section swaprect
  12505. Swap two rectangular objects in video.
  12506. This filter accepts the following options:
  12507. @table @option
  12508. @item w
  12509. Set object width.
  12510. @item h
  12511. Set object height.
  12512. @item x1
  12513. Set 1st rect x coordinate.
  12514. @item y1
  12515. Set 1st rect y coordinate.
  12516. @item x2
  12517. Set 2nd rect x coordinate.
  12518. @item y2
  12519. Set 2nd rect y coordinate.
  12520. All expressions are evaluated once for each frame.
  12521. @end table
  12522. The all options are expressions containing the following constants:
  12523. @table @option
  12524. @item w
  12525. @item h
  12526. The input width and height.
  12527. @item a
  12528. same as @var{w} / @var{h}
  12529. @item sar
  12530. input sample aspect ratio
  12531. @item dar
  12532. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12533. @item n
  12534. The number of the input frame, starting from 0.
  12535. @item t
  12536. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12537. @item pos
  12538. the position in the file of the input frame, NAN if unknown
  12539. @end table
  12540. @section swapuv
  12541. Swap U & V plane.
  12542. @section telecine
  12543. Apply telecine process to the video.
  12544. This filter accepts the following options:
  12545. @table @option
  12546. @item first_field
  12547. @table @samp
  12548. @item top, t
  12549. top field first
  12550. @item bottom, b
  12551. bottom field first
  12552. The default value is @code{top}.
  12553. @end table
  12554. @item pattern
  12555. A string of numbers representing the pulldown pattern you wish to apply.
  12556. The default value is @code{23}.
  12557. @end table
  12558. @example
  12559. Some typical patterns:
  12560. NTSC output (30i):
  12561. 27.5p: 32222
  12562. 24p: 23 (classic)
  12563. 24p: 2332 (preferred)
  12564. 20p: 33
  12565. 18p: 334
  12566. 16p: 3444
  12567. PAL output (25i):
  12568. 27.5p: 12222
  12569. 24p: 222222222223 ("Euro pulldown")
  12570. 16.67p: 33
  12571. 16p: 33333334
  12572. @end example
  12573. @section threshold
  12574. Apply threshold effect to video stream.
  12575. This filter needs four video streams to perform thresholding.
  12576. First stream is stream we are filtering.
  12577. Second stream is holding threshold values, third stream is holding min values,
  12578. and last, fourth stream is holding max values.
  12579. The filter accepts the following option:
  12580. @table @option
  12581. @item planes
  12582. Set which planes will be processed, unprocessed planes will be copied.
  12583. By default value 0xf, all planes will be processed.
  12584. @end table
  12585. For example if first stream pixel's component value is less then threshold value
  12586. of pixel component from 2nd threshold stream, third stream value will picked,
  12587. otherwise fourth stream pixel component value will be picked.
  12588. Using color source filter one can perform various types of thresholding:
  12589. @subsection Examples
  12590. @itemize
  12591. @item
  12592. Binary threshold, using gray color as threshold:
  12593. @example
  12594. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12595. @end example
  12596. @item
  12597. Inverted binary threshold, using gray color as threshold:
  12598. @example
  12599. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12600. @end example
  12601. @item
  12602. Truncate binary threshold, using gray color as threshold:
  12603. @example
  12604. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12605. @end example
  12606. @item
  12607. Threshold to zero, using gray color as threshold:
  12608. @example
  12609. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12610. @end example
  12611. @item
  12612. Inverted threshold to zero, using gray color as threshold:
  12613. @example
  12614. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12615. @end example
  12616. @end itemize
  12617. @section thumbnail
  12618. Select the most representative frame in a given sequence of consecutive frames.
  12619. The filter accepts the following options:
  12620. @table @option
  12621. @item n
  12622. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12623. will pick one of them, and then handle the next batch of @var{n} frames until
  12624. the end. Default is @code{100}.
  12625. @end table
  12626. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12627. value will result in a higher memory usage, so a high value is not recommended.
  12628. @subsection Examples
  12629. @itemize
  12630. @item
  12631. Extract one picture each 50 frames:
  12632. @example
  12633. thumbnail=50
  12634. @end example
  12635. @item
  12636. Complete example of a thumbnail creation with @command{ffmpeg}:
  12637. @example
  12638. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12639. @end example
  12640. @end itemize
  12641. @section tile
  12642. Tile several successive frames together.
  12643. The filter accepts the following options:
  12644. @table @option
  12645. @item layout
  12646. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12647. this option, check the
  12648. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12649. @item nb_frames
  12650. Set the maximum number of frames to render in the given area. It must be less
  12651. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12652. the area will be used.
  12653. @item margin
  12654. Set the outer border margin in pixels.
  12655. @item padding
  12656. Set the inner border thickness (i.e. the number of pixels between frames). For
  12657. more advanced padding options (such as having different values for the edges),
  12658. refer to the pad video filter.
  12659. @item color
  12660. Specify the color of the unused area. For the syntax of this option, check the
  12661. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12662. The default value of @var{color} is "black".
  12663. @item overlap
  12664. Set the number of frames to overlap when tiling several successive frames together.
  12665. The value must be between @code{0} and @var{nb_frames - 1}.
  12666. @item init_padding
  12667. Set the number of frames to initially be empty before displaying first output frame.
  12668. This controls how soon will one get first output frame.
  12669. The value must be between @code{0} and @var{nb_frames - 1}.
  12670. @end table
  12671. @subsection Examples
  12672. @itemize
  12673. @item
  12674. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12675. @example
  12676. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12677. @end example
  12678. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12679. duplicating each output frame to accommodate the originally detected frame
  12680. rate.
  12681. @item
  12682. Display @code{5} pictures in an area of @code{3x2} frames,
  12683. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12684. mixed flat and named options:
  12685. @example
  12686. tile=3x2:nb_frames=5:padding=7:margin=2
  12687. @end example
  12688. @end itemize
  12689. @section tinterlace
  12690. Perform various types of temporal field interlacing.
  12691. Frames are counted starting from 1, so the first input frame is
  12692. considered odd.
  12693. The filter accepts the following options:
  12694. @table @option
  12695. @item mode
  12696. Specify the mode of the interlacing. This option can also be specified
  12697. as a value alone. See below for a list of values for this option.
  12698. Available values are:
  12699. @table @samp
  12700. @item merge, 0
  12701. Move odd frames into the upper field, even into the lower field,
  12702. generating a double height frame at half frame rate.
  12703. @example
  12704. ------> time
  12705. Input:
  12706. Frame 1 Frame 2 Frame 3 Frame 4
  12707. 11111 22222 33333 44444
  12708. 11111 22222 33333 44444
  12709. 11111 22222 33333 44444
  12710. 11111 22222 33333 44444
  12711. Output:
  12712. 11111 33333
  12713. 22222 44444
  12714. 11111 33333
  12715. 22222 44444
  12716. 11111 33333
  12717. 22222 44444
  12718. 11111 33333
  12719. 22222 44444
  12720. @end example
  12721. @item drop_even, 1
  12722. Only output odd frames, even frames are dropped, generating a frame with
  12723. unchanged height at half frame rate.
  12724. @example
  12725. ------> time
  12726. Input:
  12727. Frame 1 Frame 2 Frame 3 Frame 4
  12728. 11111 22222 33333 44444
  12729. 11111 22222 33333 44444
  12730. 11111 22222 33333 44444
  12731. 11111 22222 33333 44444
  12732. Output:
  12733. 11111 33333
  12734. 11111 33333
  12735. 11111 33333
  12736. 11111 33333
  12737. @end example
  12738. @item drop_odd, 2
  12739. Only output even frames, odd frames are dropped, generating a frame with
  12740. unchanged height at half frame rate.
  12741. @example
  12742. ------> time
  12743. Input:
  12744. Frame 1 Frame 2 Frame 3 Frame 4
  12745. 11111 22222 33333 44444
  12746. 11111 22222 33333 44444
  12747. 11111 22222 33333 44444
  12748. 11111 22222 33333 44444
  12749. Output:
  12750. 22222 44444
  12751. 22222 44444
  12752. 22222 44444
  12753. 22222 44444
  12754. @end example
  12755. @item pad, 3
  12756. Expand each frame to full height, but pad alternate lines with black,
  12757. generating a frame with double height at the same input frame rate.
  12758. @example
  12759. ------> time
  12760. Input:
  12761. Frame 1 Frame 2 Frame 3 Frame 4
  12762. 11111 22222 33333 44444
  12763. 11111 22222 33333 44444
  12764. 11111 22222 33333 44444
  12765. 11111 22222 33333 44444
  12766. Output:
  12767. 11111 ..... 33333 .....
  12768. ..... 22222 ..... 44444
  12769. 11111 ..... 33333 .....
  12770. ..... 22222 ..... 44444
  12771. 11111 ..... 33333 .....
  12772. ..... 22222 ..... 44444
  12773. 11111 ..... 33333 .....
  12774. ..... 22222 ..... 44444
  12775. @end example
  12776. @item interleave_top, 4
  12777. Interleave the upper field from odd frames with the lower field from
  12778. even frames, generating a frame with unchanged height at half frame rate.
  12779. @example
  12780. ------> time
  12781. Input:
  12782. Frame 1 Frame 2 Frame 3 Frame 4
  12783. 11111<- 22222 33333<- 44444
  12784. 11111 22222<- 33333 44444<-
  12785. 11111<- 22222 33333<- 44444
  12786. 11111 22222<- 33333 44444<-
  12787. Output:
  12788. 11111 33333
  12789. 22222 44444
  12790. 11111 33333
  12791. 22222 44444
  12792. @end example
  12793. @item interleave_bottom, 5
  12794. Interleave the lower field from odd frames with the upper field from
  12795. even frames, generating a frame with unchanged height at half frame rate.
  12796. @example
  12797. ------> time
  12798. Input:
  12799. Frame 1 Frame 2 Frame 3 Frame 4
  12800. 11111 22222<- 33333 44444<-
  12801. 11111<- 22222 33333<- 44444
  12802. 11111 22222<- 33333 44444<-
  12803. 11111<- 22222 33333<- 44444
  12804. Output:
  12805. 22222 44444
  12806. 11111 33333
  12807. 22222 44444
  12808. 11111 33333
  12809. @end example
  12810. @item interlacex2, 6
  12811. Double frame rate with unchanged height. Frames are inserted each
  12812. containing the second temporal field from the previous input frame and
  12813. the first temporal field from the next input frame. This mode relies on
  12814. the top_field_first flag. Useful for interlaced video displays with no
  12815. field synchronisation.
  12816. @example
  12817. ------> time
  12818. Input:
  12819. Frame 1 Frame 2 Frame 3 Frame 4
  12820. 11111 22222 33333 44444
  12821. 11111 22222 33333 44444
  12822. 11111 22222 33333 44444
  12823. 11111 22222 33333 44444
  12824. Output:
  12825. 11111 22222 22222 33333 33333 44444 44444
  12826. 11111 11111 22222 22222 33333 33333 44444
  12827. 11111 22222 22222 33333 33333 44444 44444
  12828. 11111 11111 22222 22222 33333 33333 44444
  12829. @end example
  12830. @item mergex2, 7
  12831. Move odd frames into the upper field, even into the lower field,
  12832. generating a double height frame at same frame rate.
  12833. @example
  12834. ------> time
  12835. Input:
  12836. Frame 1 Frame 2 Frame 3 Frame 4
  12837. 11111 22222 33333 44444
  12838. 11111 22222 33333 44444
  12839. 11111 22222 33333 44444
  12840. 11111 22222 33333 44444
  12841. Output:
  12842. 11111 33333 33333 55555
  12843. 22222 22222 44444 44444
  12844. 11111 33333 33333 55555
  12845. 22222 22222 44444 44444
  12846. 11111 33333 33333 55555
  12847. 22222 22222 44444 44444
  12848. 11111 33333 33333 55555
  12849. 22222 22222 44444 44444
  12850. @end example
  12851. @end table
  12852. Numeric values are deprecated but are accepted for backward
  12853. compatibility reasons.
  12854. Default mode is @code{merge}.
  12855. @item flags
  12856. Specify flags influencing the filter process.
  12857. Available value for @var{flags} is:
  12858. @table @option
  12859. @item low_pass_filter, vlfp
  12860. Enable linear vertical low-pass filtering in the filter.
  12861. Vertical low-pass filtering is required when creating an interlaced
  12862. destination from a progressive source which contains high-frequency
  12863. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12864. patterning.
  12865. @item complex_filter, cvlfp
  12866. Enable complex vertical low-pass filtering.
  12867. This will slightly less reduce interlace 'twitter' and Moire
  12868. patterning but better retain detail and subjective sharpness impression.
  12869. @end table
  12870. Vertical low-pass filtering can only be enabled for @option{mode}
  12871. @var{interleave_top} and @var{interleave_bottom}.
  12872. @end table
  12873. @section tmix
  12874. Mix successive video frames.
  12875. A description of the accepted options follows.
  12876. @table @option
  12877. @item frames
  12878. The number of successive frames to mix. If unspecified, it defaults to 3.
  12879. @item weights
  12880. Specify weight of each input video frame.
  12881. Each weight is separated by space. If number of weights is smaller than
  12882. number of @var{frames} last specified weight will be used for all remaining
  12883. unset weights.
  12884. @item scale
  12885. Specify scale, if it is set it will be multiplied with sum
  12886. of each weight multiplied with pixel values to give final destination
  12887. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12888. @end table
  12889. @subsection Examples
  12890. @itemize
  12891. @item
  12892. Average 7 successive frames:
  12893. @example
  12894. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12895. @end example
  12896. @item
  12897. Apply simple temporal convolution:
  12898. @example
  12899. tmix=frames=3:weights="-1 3 -1"
  12900. @end example
  12901. @item
  12902. Similar as above but only showing temporal differences:
  12903. @example
  12904. tmix=frames=3:weights="-1 2 -1":scale=1
  12905. @end example
  12906. @end itemize
  12907. @anchor{tonemap}
  12908. @section tonemap
  12909. Tone map colors from different dynamic ranges.
  12910. This filter expects data in single precision floating point, as it needs to
  12911. operate on (and can output) out-of-range values. Another filter, such as
  12912. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12913. The tonemapping algorithms implemented only work on linear light, so input
  12914. data should be linearized beforehand (and possibly correctly tagged).
  12915. @example
  12916. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12917. @end example
  12918. @subsection Options
  12919. The filter accepts the following options.
  12920. @table @option
  12921. @item tonemap
  12922. Set the tone map algorithm to use.
  12923. Possible values are:
  12924. @table @var
  12925. @item none
  12926. Do not apply any tone map, only desaturate overbright pixels.
  12927. @item clip
  12928. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12929. in-range values, while distorting out-of-range values.
  12930. @item linear
  12931. Stretch the entire reference gamut to a linear multiple of the display.
  12932. @item gamma
  12933. Fit a logarithmic transfer between the tone curves.
  12934. @item reinhard
  12935. Preserve overall image brightness with a simple curve, using nonlinear
  12936. contrast, which results in flattening details and degrading color accuracy.
  12937. @item hable
  12938. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12939. of slightly darkening everything. Use it when detail preservation is more
  12940. important than color and brightness accuracy.
  12941. @item mobius
  12942. Smoothly map out-of-range values, while retaining contrast and colors for
  12943. in-range material as much as possible. Use it when color accuracy is more
  12944. important than detail preservation.
  12945. @end table
  12946. Default is none.
  12947. @item param
  12948. Tune the tone mapping algorithm.
  12949. This affects the following algorithms:
  12950. @table @var
  12951. @item none
  12952. Ignored.
  12953. @item linear
  12954. Specifies the scale factor to use while stretching.
  12955. Default to 1.0.
  12956. @item gamma
  12957. Specifies the exponent of the function.
  12958. Default to 1.8.
  12959. @item clip
  12960. Specify an extra linear coefficient to multiply into the signal before clipping.
  12961. Default to 1.0.
  12962. @item reinhard
  12963. Specify the local contrast coefficient at the display peak.
  12964. Default to 0.5, which means that in-gamut values will be about half as bright
  12965. as when clipping.
  12966. @item hable
  12967. Ignored.
  12968. @item mobius
  12969. Specify the transition point from linear to mobius transform. Every value
  12970. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12971. more accurate the result will be, at the cost of losing bright details.
  12972. Default to 0.3, which due to the steep initial slope still preserves in-range
  12973. colors fairly accurately.
  12974. @end table
  12975. @item desat
  12976. Apply desaturation for highlights that exceed this level of brightness. The
  12977. higher the parameter, the more color information will be preserved. This
  12978. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12979. (smoothly) turning into white instead. This makes images feel more natural,
  12980. at the cost of reducing information about out-of-range colors.
  12981. The default of 2.0 is somewhat conservative and will mostly just apply to
  12982. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12983. This option works only if the input frame has a supported color tag.
  12984. @item peak
  12985. Override signal/nominal/reference peak with this value. Useful when the
  12986. embedded peak information in display metadata is not reliable or when tone
  12987. mapping from a lower range to a higher range.
  12988. @end table
  12989. @section tpad
  12990. Temporarily pad video frames.
  12991. The filter accepts the following options:
  12992. @table @option
  12993. @item start
  12994. Specify number of delay frames before input video stream.
  12995. @item stop
  12996. Specify number of padding frames after input video stream.
  12997. Set to -1 to pad indefinitely.
  12998. @item start_mode
  12999. Set kind of frames added to beginning of stream.
  13000. Can be either @var{add} or @var{clone}.
  13001. With @var{add} frames of solid-color are added.
  13002. With @var{clone} frames are clones of first frame.
  13003. @item stop_mode
  13004. Set kind of frames added to end of stream.
  13005. Can be either @var{add} or @var{clone}.
  13006. With @var{add} frames of solid-color are added.
  13007. With @var{clone} frames are clones of last frame.
  13008. @item start_duration, stop_duration
  13009. Specify the duration of the start/stop delay. See
  13010. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13011. for the accepted syntax.
  13012. These options override @var{start} and @var{stop}.
  13013. @item color
  13014. Specify the color of the padded area. For the syntax of this option,
  13015. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13016. manual,ffmpeg-utils}.
  13017. The default value of @var{color} is "black".
  13018. @end table
  13019. @anchor{transpose}
  13020. @section transpose
  13021. Transpose rows with columns in the input video and optionally flip it.
  13022. It accepts the following parameters:
  13023. @table @option
  13024. @item dir
  13025. Specify the transposition direction.
  13026. Can assume the following values:
  13027. @table @samp
  13028. @item 0, 4, cclock_flip
  13029. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13030. @example
  13031. L.R L.l
  13032. . . -> . .
  13033. l.r R.r
  13034. @end example
  13035. @item 1, 5, clock
  13036. Rotate by 90 degrees clockwise, that is:
  13037. @example
  13038. L.R l.L
  13039. . . -> . .
  13040. l.r r.R
  13041. @end example
  13042. @item 2, 6, cclock
  13043. Rotate by 90 degrees counterclockwise, that is:
  13044. @example
  13045. L.R R.r
  13046. . . -> . .
  13047. l.r L.l
  13048. @end example
  13049. @item 3, 7, clock_flip
  13050. Rotate by 90 degrees clockwise and vertically flip, that is:
  13051. @example
  13052. L.R r.R
  13053. . . -> . .
  13054. l.r l.L
  13055. @end example
  13056. @end table
  13057. For values between 4-7, the transposition is only done if the input
  13058. video geometry is portrait and not landscape. These values are
  13059. deprecated, the @code{passthrough} option should be used instead.
  13060. Numerical values are deprecated, and should be dropped in favor of
  13061. symbolic constants.
  13062. @item passthrough
  13063. Do not apply the transposition if the input geometry matches the one
  13064. specified by the specified value. It accepts the following values:
  13065. @table @samp
  13066. @item none
  13067. Always apply transposition.
  13068. @item portrait
  13069. Preserve portrait geometry (when @var{height} >= @var{width}).
  13070. @item landscape
  13071. Preserve landscape geometry (when @var{width} >= @var{height}).
  13072. @end table
  13073. Default value is @code{none}.
  13074. @end table
  13075. For example to rotate by 90 degrees clockwise and preserve portrait
  13076. layout:
  13077. @example
  13078. transpose=dir=1:passthrough=portrait
  13079. @end example
  13080. The command above can also be specified as:
  13081. @example
  13082. transpose=1:portrait
  13083. @end example
  13084. @section transpose_npp
  13085. Transpose rows with columns in the input video and optionally flip it.
  13086. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13087. It accepts the following parameters:
  13088. @table @option
  13089. @item dir
  13090. Specify the transposition direction.
  13091. Can assume the following values:
  13092. @table @samp
  13093. @item cclock_flip
  13094. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13095. @item clock
  13096. Rotate by 90 degrees clockwise.
  13097. @item cclock
  13098. Rotate by 90 degrees counterclockwise.
  13099. @item clock_flip
  13100. Rotate by 90 degrees clockwise and vertically flip.
  13101. @end table
  13102. @item passthrough
  13103. Do not apply the transposition if the input geometry matches the one
  13104. specified by the specified value. It accepts the following values:
  13105. @table @samp
  13106. @item none
  13107. Always apply transposition. (default)
  13108. @item portrait
  13109. Preserve portrait geometry (when @var{height} >= @var{width}).
  13110. @item landscape
  13111. Preserve landscape geometry (when @var{width} >= @var{height}).
  13112. @end table
  13113. @end table
  13114. @section trim
  13115. Trim the input so that the output contains one continuous subpart of the input.
  13116. It accepts the following parameters:
  13117. @table @option
  13118. @item start
  13119. Specify the time of the start of the kept section, i.e. the frame with the
  13120. timestamp @var{start} will be the first frame in the output.
  13121. @item end
  13122. Specify the time of the first frame that will be dropped, i.e. the frame
  13123. immediately preceding the one with the timestamp @var{end} will be the last
  13124. frame in the output.
  13125. @item start_pts
  13126. This is the same as @var{start}, except this option sets the start timestamp
  13127. in timebase units instead of seconds.
  13128. @item end_pts
  13129. This is the same as @var{end}, except this option sets the end timestamp
  13130. in timebase units instead of seconds.
  13131. @item duration
  13132. The maximum duration of the output in seconds.
  13133. @item start_frame
  13134. The number of the first frame that should be passed to the output.
  13135. @item end_frame
  13136. The number of the first frame that should be dropped.
  13137. @end table
  13138. @option{start}, @option{end}, and @option{duration} are expressed as time
  13139. duration specifications; see
  13140. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13141. for the accepted syntax.
  13142. Note that the first two sets of the start/end options and the @option{duration}
  13143. option look at the frame timestamp, while the _frame variants simply count the
  13144. frames that pass through the filter. Also note that this filter does not modify
  13145. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13146. setpts filter after the trim filter.
  13147. If multiple start or end options are set, this filter tries to be greedy and
  13148. keep all the frames that match at least one of the specified constraints. To keep
  13149. only the part that matches all the constraints at once, chain multiple trim
  13150. filters.
  13151. The defaults are such that all the input is kept. So it is possible to set e.g.
  13152. just the end values to keep everything before the specified time.
  13153. Examples:
  13154. @itemize
  13155. @item
  13156. Drop everything except the second minute of input:
  13157. @example
  13158. ffmpeg -i INPUT -vf trim=60:120
  13159. @end example
  13160. @item
  13161. Keep only the first second:
  13162. @example
  13163. ffmpeg -i INPUT -vf trim=duration=1
  13164. @end example
  13165. @end itemize
  13166. @section unpremultiply
  13167. Apply alpha unpremultiply effect to input video stream using first plane
  13168. of second stream as alpha.
  13169. Both streams must have same dimensions and same pixel format.
  13170. The filter accepts the following option:
  13171. @table @option
  13172. @item planes
  13173. Set which planes will be processed, unprocessed planes will be copied.
  13174. By default value 0xf, all planes will be processed.
  13175. If the format has 1 or 2 components, then luma is bit 0.
  13176. If the format has 3 or 4 components:
  13177. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13178. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13179. If present, the alpha channel is always the last bit.
  13180. @item inplace
  13181. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13182. @end table
  13183. @anchor{unsharp}
  13184. @section unsharp
  13185. Sharpen or blur the input video.
  13186. It accepts the following parameters:
  13187. @table @option
  13188. @item luma_msize_x, lx
  13189. Set the luma matrix horizontal size. It must be an odd integer between
  13190. 3 and 23. The default value is 5.
  13191. @item luma_msize_y, ly
  13192. Set the luma matrix vertical size. It must be an odd integer between 3
  13193. and 23. The default value is 5.
  13194. @item luma_amount, la
  13195. Set the luma effect strength. It must be a floating point number, reasonable
  13196. values lay between -1.5 and 1.5.
  13197. Negative values will blur the input video, while positive values will
  13198. sharpen it, a value of zero will disable the effect.
  13199. Default value is 1.0.
  13200. @item chroma_msize_x, cx
  13201. Set the chroma matrix horizontal size. It must be an odd integer
  13202. between 3 and 23. The default value is 5.
  13203. @item chroma_msize_y, cy
  13204. Set the chroma matrix vertical size. It must be an odd integer
  13205. between 3 and 23. The default value is 5.
  13206. @item chroma_amount, ca
  13207. Set the chroma effect strength. It must be a floating point number, reasonable
  13208. values lay between -1.5 and 1.5.
  13209. Negative values will blur the input video, while positive values will
  13210. sharpen it, a value of zero will disable the effect.
  13211. Default value is 0.0.
  13212. @end table
  13213. All parameters are optional and default to the equivalent of the
  13214. string '5:5:1.0:5:5:0.0'.
  13215. @subsection Examples
  13216. @itemize
  13217. @item
  13218. Apply strong luma sharpen effect:
  13219. @example
  13220. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13221. @end example
  13222. @item
  13223. Apply a strong blur of both luma and chroma parameters:
  13224. @example
  13225. unsharp=7:7:-2:7:7:-2
  13226. @end example
  13227. @end itemize
  13228. @section uspp
  13229. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13230. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13231. shifts and average the results.
  13232. The way this differs from the behavior of spp is that uspp actually encodes &
  13233. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13234. DCT similar to MJPEG.
  13235. The filter accepts the following options:
  13236. @table @option
  13237. @item quality
  13238. Set quality. This option defines the number of levels for averaging. It accepts
  13239. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13240. effect. A value of @code{8} means the higher quality. For each increment of
  13241. that value the speed drops by a factor of approximately 2. Default value is
  13242. @code{3}.
  13243. @item qp
  13244. Force a constant quantization parameter. If not set, the filter will use the QP
  13245. from the video stream (if available).
  13246. @end table
  13247. @section vaguedenoiser
  13248. Apply a wavelet based denoiser.
  13249. It transforms each frame from the video input into the wavelet domain,
  13250. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13251. the obtained coefficients. It does an inverse wavelet transform after.
  13252. Due to wavelet properties, it should give a nice smoothed result, and
  13253. reduced noise, without blurring picture features.
  13254. This filter accepts the following options:
  13255. @table @option
  13256. @item threshold
  13257. The filtering strength. The higher, the more filtered the video will be.
  13258. Hard thresholding can use a higher threshold than soft thresholding
  13259. before the video looks overfiltered. Default value is 2.
  13260. @item method
  13261. The filtering method the filter will use.
  13262. It accepts the following values:
  13263. @table @samp
  13264. @item hard
  13265. All values under the threshold will be zeroed.
  13266. @item soft
  13267. All values under the threshold will be zeroed. All values above will be
  13268. reduced by the threshold.
  13269. @item garrote
  13270. Scales or nullifies coefficients - intermediary between (more) soft and
  13271. (less) hard thresholding.
  13272. @end table
  13273. Default is garrote.
  13274. @item nsteps
  13275. Number of times, the wavelet will decompose the picture. Picture can't
  13276. be decomposed beyond a particular point (typically, 8 for a 640x480
  13277. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13278. @item percent
  13279. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13280. @item planes
  13281. A list of the planes to process. By default all planes are processed.
  13282. @end table
  13283. @section vectorscope
  13284. Display 2 color component values in the two dimensional graph (which is called
  13285. a vectorscope).
  13286. This filter accepts the following options:
  13287. @table @option
  13288. @item mode, m
  13289. Set vectorscope mode.
  13290. It accepts the following values:
  13291. @table @samp
  13292. @item gray
  13293. Gray values are displayed on graph, higher brightness means more pixels have
  13294. same component color value on location in graph. This is the default mode.
  13295. @item color
  13296. Gray values are displayed on graph. Surrounding pixels values which are not
  13297. present in video frame are drawn in gradient of 2 color components which are
  13298. set by option @code{x} and @code{y}. The 3rd color component is static.
  13299. @item color2
  13300. Actual color components values present in video frame are displayed on graph.
  13301. @item color3
  13302. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13303. on graph increases value of another color component, which is luminance by
  13304. default values of @code{x} and @code{y}.
  13305. @item color4
  13306. Actual colors present in video frame are displayed on graph. If two different
  13307. colors map to same position on graph then color with higher value of component
  13308. not present in graph is picked.
  13309. @item color5
  13310. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13311. component picked from radial gradient.
  13312. @end table
  13313. @item x
  13314. Set which color component will be represented on X-axis. Default is @code{1}.
  13315. @item y
  13316. Set which color component will be represented on Y-axis. Default is @code{2}.
  13317. @item intensity, i
  13318. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13319. of color component which represents frequency of (X, Y) location in graph.
  13320. @item envelope, e
  13321. @table @samp
  13322. @item none
  13323. No envelope, this is default.
  13324. @item instant
  13325. Instant envelope, even darkest single pixel will be clearly highlighted.
  13326. @item peak
  13327. Hold maximum and minimum values presented in graph over time. This way you
  13328. can still spot out of range values without constantly looking at vectorscope.
  13329. @item peak+instant
  13330. Peak and instant envelope combined together.
  13331. @end table
  13332. @item graticule, g
  13333. Set what kind of graticule to draw.
  13334. @table @samp
  13335. @item none
  13336. @item green
  13337. @item color
  13338. @end table
  13339. @item opacity, o
  13340. Set graticule opacity.
  13341. @item flags, f
  13342. Set graticule flags.
  13343. @table @samp
  13344. @item white
  13345. Draw graticule for white point.
  13346. @item black
  13347. Draw graticule for black point.
  13348. @item name
  13349. Draw color points short names.
  13350. @end table
  13351. @item bgopacity, b
  13352. Set background opacity.
  13353. @item lthreshold, l
  13354. Set low threshold for color component not represented on X or Y axis.
  13355. Values lower than this value will be ignored. Default is 0.
  13356. Note this value is multiplied with actual max possible value one pixel component
  13357. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13358. is 0.1 * 255 = 25.
  13359. @item hthreshold, h
  13360. Set high threshold for color component not represented on X or Y axis.
  13361. Values higher than this value will be ignored. Default is 1.
  13362. Note this value is multiplied with actual max possible value one pixel component
  13363. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13364. is 0.9 * 255 = 230.
  13365. @item colorspace, c
  13366. Set what kind of colorspace to use when drawing graticule.
  13367. @table @samp
  13368. @item auto
  13369. @item 601
  13370. @item 709
  13371. @end table
  13372. Default is auto.
  13373. @end table
  13374. @anchor{vidstabdetect}
  13375. @section vidstabdetect
  13376. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13377. @ref{vidstabtransform} for pass 2.
  13378. This filter generates a file with relative translation and rotation
  13379. transform information about subsequent frames, which is then used by
  13380. the @ref{vidstabtransform} filter.
  13381. To enable compilation of this filter you need to configure FFmpeg with
  13382. @code{--enable-libvidstab}.
  13383. This filter accepts the following options:
  13384. @table @option
  13385. @item result
  13386. Set the path to the file used to write the transforms information.
  13387. Default value is @file{transforms.trf}.
  13388. @item shakiness
  13389. Set how shaky the video is and how quick the camera is. It accepts an
  13390. integer in the range 1-10, a value of 1 means little shakiness, a
  13391. value of 10 means strong shakiness. Default value is 5.
  13392. @item accuracy
  13393. Set the accuracy of the detection process. It must be a value in the
  13394. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13395. accuracy. Default value is 15.
  13396. @item stepsize
  13397. Set stepsize of the search process. The region around minimum is
  13398. scanned with 1 pixel resolution. Default value is 6.
  13399. @item mincontrast
  13400. Set minimum contrast. Below this value a local measurement field is
  13401. discarded. Must be a floating point value in the range 0-1. Default
  13402. value is 0.3.
  13403. @item tripod
  13404. Set reference frame number for tripod mode.
  13405. If enabled, the motion of the frames is compared to a reference frame
  13406. in the filtered stream, identified by the specified number. The idea
  13407. is to compensate all movements in a more-or-less static scene and keep
  13408. the camera view absolutely still.
  13409. If set to 0, it is disabled. The frames are counted starting from 1.
  13410. @item show
  13411. Show fields and transforms in the resulting frames. It accepts an
  13412. integer in the range 0-2. Default value is 0, which disables any
  13413. visualization.
  13414. @end table
  13415. @subsection Examples
  13416. @itemize
  13417. @item
  13418. Use default values:
  13419. @example
  13420. vidstabdetect
  13421. @end example
  13422. @item
  13423. Analyze strongly shaky movie and put the results in file
  13424. @file{mytransforms.trf}:
  13425. @example
  13426. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13427. @end example
  13428. @item
  13429. Visualize the result of internal transformations in the resulting
  13430. video:
  13431. @example
  13432. vidstabdetect=show=1
  13433. @end example
  13434. @item
  13435. Analyze a video with medium shakiness using @command{ffmpeg}:
  13436. @example
  13437. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13438. @end example
  13439. @end itemize
  13440. @anchor{vidstabtransform}
  13441. @section vidstabtransform
  13442. Video stabilization/deshaking: pass 2 of 2,
  13443. see @ref{vidstabdetect} for pass 1.
  13444. Read a file with transform information for each frame and
  13445. apply/compensate them. Together with the @ref{vidstabdetect}
  13446. filter this can be used to deshake videos. See also
  13447. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13448. the @ref{unsharp} filter, see below.
  13449. To enable compilation of this filter you need to configure FFmpeg with
  13450. @code{--enable-libvidstab}.
  13451. @subsection Options
  13452. @table @option
  13453. @item input
  13454. Set path to the file used to read the transforms. Default value is
  13455. @file{transforms.trf}.
  13456. @item smoothing
  13457. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13458. camera movements. Default value is 10.
  13459. For example a number of 10 means that 21 frames are used (10 in the
  13460. past and 10 in the future) to smoothen the motion in the video. A
  13461. larger value leads to a smoother video, but limits the acceleration of
  13462. the camera (pan/tilt movements). 0 is a special case where a static
  13463. camera is simulated.
  13464. @item optalgo
  13465. Set the camera path optimization algorithm.
  13466. Accepted values are:
  13467. @table @samp
  13468. @item gauss
  13469. gaussian kernel low-pass filter on camera motion (default)
  13470. @item avg
  13471. averaging on transformations
  13472. @end table
  13473. @item maxshift
  13474. Set maximal number of pixels to translate frames. Default value is -1,
  13475. meaning no limit.
  13476. @item maxangle
  13477. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13478. value is -1, meaning no limit.
  13479. @item crop
  13480. Specify how to deal with borders that may be visible due to movement
  13481. compensation.
  13482. Available values are:
  13483. @table @samp
  13484. @item keep
  13485. keep image information from previous frame (default)
  13486. @item black
  13487. fill the border black
  13488. @end table
  13489. @item invert
  13490. Invert transforms if set to 1. Default value is 0.
  13491. @item relative
  13492. Consider transforms as relative to previous frame if set to 1,
  13493. absolute if set to 0. Default value is 0.
  13494. @item zoom
  13495. Set percentage to zoom. A positive value will result in a zoom-in
  13496. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13497. zoom).
  13498. @item optzoom
  13499. Set optimal zooming to avoid borders.
  13500. Accepted values are:
  13501. @table @samp
  13502. @item 0
  13503. disabled
  13504. @item 1
  13505. optimal static zoom value is determined (only very strong movements
  13506. will lead to visible borders) (default)
  13507. @item 2
  13508. optimal adaptive zoom value is determined (no borders will be
  13509. visible), see @option{zoomspeed}
  13510. @end table
  13511. Note that the value given at zoom is added to the one calculated here.
  13512. @item zoomspeed
  13513. Set percent to zoom maximally each frame (enabled when
  13514. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13515. 0.25.
  13516. @item interpol
  13517. Specify type of interpolation.
  13518. Available values are:
  13519. @table @samp
  13520. @item no
  13521. no interpolation
  13522. @item linear
  13523. linear only horizontal
  13524. @item bilinear
  13525. linear in both directions (default)
  13526. @item bicubic
  13527. cubic in both directions (slow)
  13528. @end table
  13529. @item tripod
  13530. Enable virtual tripod mode if set to 1, which is equivalent to
  13531. @code{relative=0:smoothing=0}. Default value is 0.
  13532. Use also @code{tripod} option of @ref{vidstabdetect}.
  13533. @item debug
  13534. Increase log verbosity if set to 1. Also the detected global motions
  13535. are written to the temporary file @file{global_motions.trf}. Default
  13536. value is 0.
  13537. @end table
  13538. @subsection Examples
  13539. @itemize
  13540. @item
  13541. Use @command{ffmpeg} for a typical stabilization with default values:
  13542. @example
  13543. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13544. @end example
  13545. Note the use of the @ref{unsharp} filter which is always recommended.
  13546. @item
  13547. Zoom in a bit more and load transform data from a given file:
  13548. @example
  13549. vidstabtransform=zoom=5:input="mytransforms.trf"
  13550. @end example
  13551. @item
  13552. Smoothen the video even more:
  13553. @example
  13554. vidstabtransform=smoothing=30
  13555. @end example
  13556. @end itemize
  13557. @section vflip
  13558. Flip the input video vertically.
  13559. For example, to vertically flip a video with @command{ffmpeg}:
  13560. @example
  13561. ffmpeg -i in.avi -vf "vflip" out.avi
  13562. @end example
  13563. @section vfrdet
  13564. Detect variable frame rate video.
  13565. This filter tries to detect if the input is variable or constant frame rate.
  13566. At end it will output number of frames detected as having variable delta pts,
  13567. and ones with constant delta pts.
  13568. If there was frames with variable delta, than it will also show min and max delta
  13569. encountered.
  13570. @section vibrance
  13571. Boost or alter saturation.
  13572. The filter accepts the following options:
  13573. @table @option
  13574. @item intensity
  13575. Set strength of boost if positive value or strength of alter if negative value.
  13576. Default is 0. Allowed range is from -2 to 2.
  13577. @item rbal
  13578. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13579. @item gbal
  13580. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13581. @item bbal
  13582. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13583. @item rlum
  13584. Set the red luma coefficient.
  13585. @item glum
  13586. Set the green luma coefficient.
  13587. @item blum
  13588. Set the blue luma coefficient.
  13589. @end table
  13590. @anchor{vignette}
  13591. @section vignette
  13592. Make or reverse a natural vignetting effect.
  13593. The filter accepts the following options:
  13594. @table @option
  13595. @item angle, a
  13596. Set lens angle expression as a number of radians.
  13597. The value is clipped in the @code{[0,PI/2]} range.
  13598. Default value: @code{"PI/5"}
  13599. @item x0
  13600. @item y0
  13601. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13602. by default.
  13603. @item mode
  13604. Set forward/backward mode.
  13605. Available modes are:
  13606. @table @samp
  13607. @item forward
  13608. The larger the distance from the central point, the darker the image becomes.
  13609. @item backward
  13610. The larger the distance from the central point, the brighter the image becomes.
  13611. This can be used to reverse a vignette effect, though there is no automatic
  13612. detection to extract the lens @option{angle} and other settings (yet). It can
  13613. also be used to create a burning effect.
  13614. @end table
  13615. Default value is @samp{forward}.
  13616. @item eval
  13617. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13618. It accepts the following values:
  13619. @table @samp
  13620. @item init
  13621. Evaluate expressions only once during the filter initialization.
  13622. @item frame
  13623. Evaluate expressions for each incoming frame. This is way slower than the
  13624. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13625. allows advanced dynamic expressions.
  13626. @end table
  13627. Default value is @samp{init}.
  13628. @item dither
  13629. Set dithering to reduce the circular banding effects. Default is @code{1}
  13630. (enabled).
  13631. @item aspect
  13632. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13633. Setting this value to the SAR of the input will make a rectangular vignetting
  13634. following the dimensions of the video.
  13635. Default is @code{1/1}.
  13636. @end table
  13637. @subsection Expressions
  13638. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13639. following parameters.
  13640. @table @option
  13641. @item w
  13642. @item h
  13643. input width and height
  13644. @item n
  13645. the number of input frame, starting from 0
  13646. @item pts
  13647. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13648. @var{TB} units, NAN if undefined
  13649. @item r
  13650. frame rate of the input video, NAN if the input frame rate is unknown
  13651. @item t
  13652. the PTS (Presentation TimeStamp) of the filtered video frame,
  13653. expressed in seconds, NAN if undefined
  13654. @item tb
  13655. time base of the input video
  13656. @end table
  13657. @subsection Examples
  13658. @itemize
  13659. @item
  13660. Apply simple strong vignetting effect:
  13661. @example
  13662. vignette=PI/4
  13663. @end example
  13664. @item
  13665. Make a flickering vignetting:
  13666. @example
  13667. vignette='PI/4+random(1)*PI/50':eval=frame
  13668. @end example
  13669. @end itemize
  13670. @section vmafmotion
  13671. Obtain the average vmaf motion score of a video.
  13672. It is one of the component filters of VMAF.
  13673. The obtained average motion score is printed through the logging system.
  13674. In the below example the input file @file{ref.mpg} is being processed and score
  13675. is computed.
  13676. @example
  13677. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13678. @end example
  13679. @section vstack
  13680. Stack input videos vertically.
  13681. All streams must be of same pixel format and of same width.
  13682. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13683. to create same output.
  13684. The filter accept the following option:
  13685. @table @option
  13686. @item inputs
  13687. Set number of input streams. Default is 2.
  13688. @item shortest
  13689. If set to 1, force the output to terminate when the shortest input
  13690. terminates. Default value is 0.
  13691. @end table
  13692. @section w3fdif
  13693. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13694. Deinterlacing Filter").
  13695. Based on the process described by Martin Weston for BBC R&D, and
  13696. implemented based on the de-interlace algorithm written by Jim
  13697. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13698. uses filter coefficients calculated by BBC R&D.
  13699. There are two sets of filter coefficients, so called "simple":
  13700. and "complex". Which set of filter coefficients is used can
  13701. be set by passing an optional parameter:
  13702. @table @option
  13703. @item filter
  13704. Set the interlacing filter coefficients. Accepts one of the following values:
  13705. @table @samp
  13706. @item simple
  13707. Simple filter coefficient set.
  13708. @item complex
  13709. More-complex filter coefficient set.
  13710. @end table
  13711. Default value is @samp{complex}.
  13712. @item deint
  13713. Specify which frames to deinterlace. Accept one of the following values:
  13714. @table @samp
  13715. @item all
  13716. Deinterlace all frames,
  13717. @item interlaced
  13718. Only deinterlace frames marked as interlaced.
  13719. @end table
  13720. Default value is @samp{all}.
  13721. @end table
  13722. @section waveform
  13723. Video waveform monitor.
  13724. The waveform monitor plots color component intensity. By default luminance
  13725. only. Each column of the waveform corresponds to a column of pixels in the
  13726. source video.
  13727. It accepts the following options:
  13728. @table @option
  13729. @item mode, m
  13730. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13731. In row mode, the graph on the left side represents color component value 0 and
  13732. the right side represents value = 255. In column mode, the top side represents
  13733. color component value = 0 and bottom side represents value = 255.
  13734. @item intensity, i
  13735. Set intensity. Smaller values are useful to find out how many values of the same
  13736. luminance are distributed across input rows/columns.
  13737. Default value is @code{0.04}. Allowed range is [0, 1].
  13738. @item mirror, r
  13739. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13740. In mirrored mode, higher values will be represented on the left
  13741. side for @code{row} mode and at the top for @code{column} mode. Default is
  13742. @code{1} (mirrored).
  13743. @item display, d
  13744. Set display mode.
  13745. It accepts the following values:
  13746. @table @samp
  13747. @item overlay
  13748. Presents information identical to that in the @code{parade}, except
  13749. that the graphs representing color components are superimposed directly
  13750. over one another.
  13751. This display mode makes it easier to spot relative differences or similarities
  13752. in overlapping areas of the color components that are supposed to be identical,
  13753. such as neutral whites, grays, or blacks.
  13754. @item stack
  13755. Display separate graph for the color components side by side in
  13756. @code{row} mode or one below the other in @code{column} mode.
  13757. @item parade
  13758. Display separate graph for the color components side by side in
  13759. @code{column} mode or one below the other in @code{row} mode.
  13760. Using this display mode makes it easy to spot color casts in the highlights
  13761. and shadows of an image, by comparing the contours of the top and the bottom
  13762. graphs of each waveform. Since whites, grays, and blacks are characterized
  13763. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13764. should display three waveforms of roughly equal width/height. If not, the
  13765. correction is easy to perform by making level adjustments the three waveforms.
  13766. @end table
  13767. Default is @code{stack}.
  13768. @item components, c
  13769. Set which color components to display. Default is 1, which means only luminance
  13770. or red color component if input is in RGB colorspace. If is set for example to
  13771. 7 it will display all 3 (if) available color components.
  13772. @item envelope, e
  13773. @table @samp
  13774. @item none
  13775. No envelope, this is default.
  13776. @item instant
  13777. Instant envelope, minimum and maximum values presented in graph will be easily
  13778. visible even with small @code{step} value.
  13779. @item peak
  13780. Hold minimum and maximum values presented in graph across time. This way you
  13781. can still spot out of range values without constantly looking at waveforms.
  13782. @item peak+instant
  13783. Peak and instant envelope combined together.
  13784. @end table
  13785. @item filter, f
  13786. @table @samp
  13787. @item lowpass
  13788. No filtering, this is default.
  13789. @item flat
  13790. Luma and chroma combined together.
  13791. @item aflat
  13792. Similar as above, but shows difference between blue and red chroma.
  13793. @item xflat
  13794. Similar as above, but use different colors.
  13795. @item chroma
  13796. Displays only chroma.
  13797. @item color
  13798. Displays actual color value on waveform.
  13799. @item acolor
  13800. Similar as above, but with luma showing frequency of chroma values.
  13801. @end table
  13802. @item graticule, g
  13803. Set which graticule to display.
  13804. @table @samp
  13805. @item none
  13806. Do not display graticule.
  13807. @item green
  13808. Display green graticule showing legal broadcast ranges.
  13809. @item orange
  13810. Display orange graticule showing legal broadcast ranges.
  13811. @end table
  13812. @item opacity, o
  13813. Set graticule opacity.
  13814. @item flags, fl
  13815. Set graticule flags.
  13816. @table @samp
  13817. @item numbers
  13818. Draw numbers above lines. By default enabled.
  13819. @item dots
  13820. Draw dots instead of lines.
  13821. @end table
  13822. @item scale, s
  13823. Set scale used for displaying graticule.
  13824. @table @samp
  13825. @item digital
  13826. @item millivolts
  13827. @item ire
  13828. @end table
  13829. Default is digital.
  13830. @item bgopacity, b
  13831. Set background opacity.
  13832. @end table
  13833. @section weave, doubleweave
  13834. The @code{weave} takes a field-based video input and join
  13835. each two sequential fields into single frame, producing a new double
  13836. height clip with half the frame rate and half the frame count.
  13837. The @code{doubleweave} works same as @code{weave} but without
  13838. halving frame rate and frame count.
  13839. It accepts the following option:
  13840. @table @option
  13841. @item first_field
  13842. Set first field. Available values are:
  13843. @table @samp
  13844. @item top, t
  13845. Set the frame as top-field-first.
  13846. @item bottom, b
  13847. Set the frame as bottom-field-first.
  13848. @end table
  13849. @end table
  13850. @subsection Examples
  13851. @itemize
  13852. @item
  13853. Interlace video using @ref{select} and @ref{separatefields} filter:
  13854. @example
  13855. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13856. @end example
  13857. @end itemize
  13858. @section xbr
  13859. Apply the xBR high-quality magnification filter which is designed for pixel
  13860. art. It follows a set of edge-detection rules, see
  13861. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13862. It accepts the following option:
  13863. @table @option
  13864. @item n
  13865. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13866. @code{3xBR} and @code{4} for @code{4xBR}.
  13867. Default is @code{3}.
  13868. @end table
  13869. @section xstack
  13870. Stack video inputs into custom layout.
  13871. All streams must be of same pixel format.
  13872. The filter accept the following option:
  13873. @table @option
  13874. @item inputs
  13875. Set number of input streams. Default is 2.
  13876. @item layout
  13877. Specify layout of inputs.
  13878. This option requires the desired layout configuration to be explicitly set by the user.
  13879. This sets position of each video input in output. Each input
  13880. is separated by '|'.
  13881. The first number represents the column, and the second number represents the row.
  13882. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13883. where X is video input from which to take width or height.
  13884. Multiple values can be used when separated by '+'. In such
  13885. case values are summed together.
  13886. @item shortest
  13887. If set to 1, force the output to terminate when the shortest input
  13888. terminates. Default value is 0.
  13889. @end table
  13890. @subsection Examples
  13891. @itemize
  13892. @item
  13893. Display 4 inputs into 2x2 grid,
  13894. note that if inputs are of different sizes unused gaps might appear,
  13895. as not all of output video is used.
  13896. @example
  13897. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13898. @end example
  13899. @item
  13900. Display 4 inputs into 1x4 grid,
  13901. note that if inputs are of different sizes unused gaps might appear,
  13902. as not all of output video is used.
  13903. @example
  13904. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13905. @end example
  13906. @item
  13907. Display 9 inputs into 3x3 grid,
  13908. note that if inputs are of different sizes unused gaps might appear,
  13909. as not all of output video is used.
  13910. @example
  13911. 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
  13912. @end example
  13913. @end itemize
  13914. @anchor{yadif}
  13915. @section yadif
  13916. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13917. filter").
  13918. It accepts the following parameters:
  13919. @table @option
  13920. @item mode
  13921. The interlacing mode to adopt. It accepts one of the following values:
  13922. @table @option
  13923. @item 0, send_frame
  13924. Output one frame for each frame.
  13925. @item 1, send_field
  13926. Output one frame for each field.
  13927. @item 2, send_frame_nospatial
  13928. Like @code{send_frame}, but it skips the spatial interlacing check.
  13929. @item 3, send_field_nospatial
  13930. Like @code{send_field}, but it skips the spatial interlacing check.
  13931. @end table
  13932. The default value is @code{send_frame}.
  13933. @item parity
  13934. The picture field parity assumed for the input interlaced video. It accepts one
  13935. of the following values:
  13936. @table @option
  13937. @item 0, tff
  13938. Assume the top field is first.
  13939. @item 1, bff
  13940. Assume the bottom field is first.
  13941. @item -1, auto
  13942. Enable automatic detection of field parity.
  13943. @end table
  13944. The default value is @code{auto}.
  13945. If the interlacing is unknown or the decoder does not export this information,
  13946. top field first will be assumed.
  13947. @item deint
  13948. Specify which frames to deinterlace. Accept one of the following
  13949. values:
  13950. @table @option
  13951. @item 0, all
  13952. Deinterlace all frames.
  13953. @item 1, interlaced
  13954. Only deinterlace frames marked as interlaced.
  13955. @end table
  13956. The default value is @code{all}.
  13957. @end table
  13958. @section yadif_cuda
  13959. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13960. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13961. and/or nvenc.
  13962. It accepts the following parameters:
  13963. @table @option
  13964. @item mode
  13965. The interlacing mode to adopt. It accepts one of the following values:
  13966. @table @option
  13967. @item 0, send_frame
  13968. Output one frame for each frame.
  13969. @item 1, send_field
  13970. Output one frame for each field.
  13971. @item 2, send_frame_nospatial
  13972. Like @code{send_frame}, but it skips the spatial interlacing check.
  13973. @item 3, send_field_nospatial
  13974. Like @code{send_field}, but it skips the spatial interlacing check.
  13975. @end table
  13976. The default value is @code{send_frame}.
  13977. @item parity
  13978. The picture field parity assumed for the input interlaced video. It accepts one
  13979. of the following values:
  13980. @table @option
  13981. @item 0, tff
  13982. Assume the top field is first.
  13983. @item 1, bff
  13984. Assume the bottom field is first.
  13985. @item -1, auto
  13986. Enable automatic detection of field parity.
  13987. @end table
  13988. The default value is @code{auto}.
  13989. If the interlacing is unknown or the decoder does not export this information,
  13990. top field first will be assumed.
  13991. @item deint
  13992. Specify which frames to deinterlace. Accept one of the following
  13993. values:
  13994. @table @option
  13995. @item 0, all
  13996. Deinterlace all frames.
  13997. @item 1, interlaced
  13998. Only deinterlace frames marked as interlaced.
  13999. @end table
  14000. The default value is @code{all}.
  14001. @end table
  14002. @section zoompan
  14003. Apply Zoom & Pan effect.
  14004. This filter accepts the following options:
  14005. @table @option
  14006. @item zoom, z
  14007. Set the zoom expression. Range is 1-10. Default is 1.
  14008. @item x
  14009. @item y
  14010. Set the x and y expression. Default is 0.
  14011. @item d
  14012. Set the duration expression in number of frames.
  14013. This sets for how many number of frames effect will last for
  14014. single input image.
  14015. @item s
  14016. Set the output image size, default is 'hd720'.
  14017. @item fps
  14018. Set the output frame rate, default is '25'.
  14019. @end table
  14020. Each expression can contain the following constants:
  14021. @table @option
  14022. @item in_w, iw
  14023. Input width.
  14024. @item in_h, ih
  14025. Input height.
  14026. @item out_w, ow
  14027. Output width.
  14028. @item out_h, oh
  14029. Output height.
  14030. @item in
  14031. Input frame count.
  14032. @item on
  14033. Output frame count.
  14034. @item x
  14035. @item y
  14036. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14037. for current input frame.
  14038. @item px
  14039. @item py
  14040. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14041. not yet such frame (first input frame).
  14042. @item zoom
  14043. Last calculated zoom from 'z' expression for current input frame.
  14044. @item pzoom
  14045. Last calculated zoom of last output frame of previous input frame.
  14046. @item duration
  14047. Number of output frames for current input frame. Calculated from 'd' expression
  14048. for each input frame.
  14049. @item pduration
  14050. number of output frames created for previous input frame
  14051. @item a
  14052. Rational number: input width / input height
  14053. @item sar
  14054. sample aspect ratio
  14055. @item dar
  14056. display aspect ratio
  14057. @end table
  14058. @subsection Examples
  14059. @itemize
  14060. @item
  14061. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14062. @example
  14063. 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
  14064. @end example
  14065. @item
  14066. Zoom-in up to 1.5 and pan always at center of picture:
  14067. @example
  14068. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14069. @end example
  14070. @item
  14071. Same as above but without pausing:
  14072. @example
  14073. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14074. @end example
  14075. @end itemize
  14076. @anchor{zscale}
  14077. @section zscale
  14078. Scale (resize) the input video, using the z.lib library:
  14079. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14080. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14081. The zscale filter forces the output display aspect ratio to be the same
  14082. as the input, by changing the output sample aspect ratio.
  14083. If the input image format is different from the format requested by
  14084. the next filter, the zscale filter will convert the input to the
  14085. requested format.
  14086. @subsection Options
  14087. The filter accepts the following options.
  14088. @table @option
  14089. @item width, w
  14090. @item height, h
  14091. Set the output video dimension expression. Default value is the input
  14092. dimension.
  14093. If the @var{width} or @var{w} value is 0, the input width is used for
  14094. the output. If the @var{height} or @var{h} value is 0, the input height
  14095. is used for the output.
  14096. If one and only one of the values is -n with n >= 1, the zscale filter
  14097. will use a value that maintains the aspect ratio of the input image,
  14098. calculated from the other specified dimension. After that it will,
  14099. however, make sure that the calculated dimension is divisible by n and
  14100. adjust the value if necessary.
  14101. If both values are -n with n >= 1, the behavior will be identical to
  14102. both values being set to 0 as previously detailed.
  14103. See below for the list of accepted constants for use in the dimension
  14104. expression.
  14105. @item size, s
  14106. Set the video size. For the syntax of this option, check the
  14107. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14108. @item dither, d
  14109. Set the dither type.
  14110. Possible values are:
  14111. @table @var
  14112. @item none
  14113. @item ordered
  14114. @item random
  14115. @item error_diffusion
  14116. @end table
  14117. Default is none.
  14118. @item filter, f
  14119. Set the resize filter type.
  14120. Possible values are:
  14121. @table @var
  14122. @item point
  14123. @item bilinear
  14124. @item bicubic
  14125. @item spline16
  14126. @item spline36
  14127. @item lanczos
  14128. @end table
  14129. Default is bilinear.
  14130. @item range, r
  14131. Set the color range.
  14132. Possible values are:
  14133. @table @var
  14134. @item input
  14135. @item limited
  14136. @item full
  14137. @end table
  14138. Default is same as input.
  14139. @item primaries, p
  14140. Set the color primaries.
  14141. Possible values are:
  14142. @table @var
  14143. @item input
  14144. @item 709
  14145. @item unspecified
  14146. @item 170m
  14147. @item 240m
  14148. @item 2020
  14149. @end table
  14150. Default is same as input.
  14151. @item transfer, t
  14152. Set the transfer characteristics.
  14153. Possible values are:
  14154. @table @var
  14155. @item input
  14156. @item 709
  14157. @item unspecified
  14158. @item 601
  14159. @item linear
  14160. @item 2020_10
  14161. @item 2020_12
  14162. @item smpte2084
  14163. @item iec61966-2-1
  14164. @item arib-std-b67
  14165. @end table
  14166. Default is same as input.
  14167. @item matrix, m
  14168. Set the colorspace matrix.
  14169. Possible value are:
  14170. @table @var
  14171. @item input
  14172. @item 709
  14173. @item unspecified
  14174. @item 470bg
  14175. @item 170m
  14176. @item 2020_ncl
  14177. @item 2020_cl
  14178. @end table
  14179. Default is same as input.
  14180. @item rangein, rin
  14181. Set the input color range.
  14182. Possible values are:
  14183. @table @var
  14184. @item input
  14185. @item limited
  14186. @item full
  14187. @end table
  14188. Default is same as input.
  14189. @item primariesin, pin
  14190. Set the input color primaries.
  14191. Possible values are:
  14192. @table @var
  14193. @item input
  14194. @item 709
  14195. @item unspecified
  14196. @item 170m
  14197. @item 240m
  14198. @item 2020
  14199. @end table
  14200. Default is same as input.
  14201. @item transferin, tin
  14202. Set the input transfer characteristics.
  14203. Possible values are:
  14204. @table @var
  14205. @item input
  14206. @item 709
  14207. @item unspecified
  14208. @item 601
  14209. @item linear
  14210. @item 2020_10
  14211. @item 2020_12
  14212. @end table
  14213. Default is same as input.
  14214. @item matrixin, min
  14215. Set the input colorspace matrix.
  14216. Possible value are:
  14217. @table @var
  14218. @item input
  14219. @item 709
  14220. @item unspecified
  14221. @item 470bg
  14222. @item 170m
  14223. @item 2020_ncl
  14224. @item 2020_cl
  14225. @end table
  14226. @item chromal, c
  14227. Set the output chroma location.
  14228. Possible values are:
  14229. @table @var
  14230. @item input
  14231. @item left
  14232. @item center
  14233. @item topleft
  14234. @item top
  14235. @item bottomleft
  14236. @item bottom
  14237. @end table
  14238. @item chromalin, cin
  14239. Set the input chroma location.
  14240. Possible values are:
  14241. @table @var
  14242. @item input
  14243. @item left
  14244. @item center
  14245. @item topleft
  14246. @item top
  14247. @item bottomleft
  14248. @item bottom
  14249. @end table
  14250. @item npl
  14251. Set the nominal peak luminance.
  14252. @end table
  14253. The values of the @option{w} and @option{h} options are expressions
  14254. containing the following constants:
  14255. @table @var
  14256. @item in_w
  14257. @item in_h
  14258. The input width and height
  14259. @item iw
  14260. @item ih
  14261. These are the same as @var{in_w} and @var{in_h}.
  14262. @item out_w
  14263. @item out_h
  14264. The output (scaled) width and height
  14265. @item ow
  14266. @item oh
  14267. These are the same as @var{out_w} and @var{out_h}
  14268. @item a
  14269. The same as @var{iw} / @var{ih}
  14270. @item sar
  14271. input sample aspect ratio
  14272. @item dar
  14273. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14274. @item hsub
  14275. @item vsub
  14276. horizontal and vertical input chroma subsample values. For example for the
  14277. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14278. @item ohsub
  14279. @item ovsub
  14280. horizontal and vertical output chroma subsample values. For example for the
  14281. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14282. @end table
  14283. @table @option
  14284. @end table
  14285. @c man end VIDEO FILTERS
  14286. @chapter OpenCL Video Filters
  14287. @c man begin OPENCL VIDEO FILTERS
  14288. Below is a description of the currently available OpenCL video filters.
  14289. To enable compilation of these filters you need to configure FFmpeg with
  14290. @code{--enable-opencl}.
  14291. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14292. @table @option
  14293. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14294. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14295. given device parameters.
  14296. @item -filter_hw_device @var{name}
  14297. Pass the hardware device called @var{name} to all filters in any filter graph.
  14298. @end table
  14299. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14300. @itemize
  14301. @item
  14302. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14303. @example
  14304. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14305. @end example
  14306. @end itemize
  14307. 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.
  14308. @section avgblur_opencl
  14309. Apply average blur filter.
  14310. The filter accepts the following options:
  14311. @table @option
  14312. @item sizeX
  14313. Set horizontal radius size.
  14314. Range is @code{[1, 1024]} and default value is @code{1}.
  14315. @item planes
  14316. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14317. @item sizeY
  14318. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14319. @end table
  14320. @subsection Example
  14321. @itemize
  14322. @item
  14323. 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.
  14324. @example
  14325. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14326. @end example
  14327. @end itemize
  14328. @section boxblur_opencl
  14329. Apply a boxblur algorithm to the input video.
  14330. It accepts the following parameters:
  14331. @table @option
  14332. @item luma_radius, lr
  14333. @item luma_power, lp
  14334. @item chroma_radius, cr
  14335. @item chroma_power, cp
  14336. @item alpha_radius, ar
  14337. @item alpha_power, ap
  14338. @end table
  14339. A description of the accepted options follows.
  14340. @table @option
  14341. @item luma_radius, lr
  14342. @item chroma_radius, cr
  14343. @item alpha_radius, ar
  14344. Set an expression for the box radius in pixels used for blurring the
  14345. corresponding input plane.
  14346. The radius value must be a non-negative number, and must not be
  14347. greater than the value of the expression @code{min(w,h)/2} for the
  14348. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14349. planes.
  14350. Default value for @option{luma_radius} is "2". If not specified,
  14351. @option{chroma_radius} and @option{alpha_radius} default to the
  14352. corresponding value set for @option{luma_radius}.
  14353. The expressions can contain the following constants:
  14354. @table @option
  14355. @item w
  14356. @item h
  14357. The input width and height in pixels.
  14358. @item cw
  14359. @item ch
  14360. The input chroma image width and height in pixels.
  14361. @item hsub
  14362. @item vsub
  14363. The horizontal and vertical chroma subsample values. For example, for the
  14364. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14365. @end table
  14366. @item luma_power, lp
  14367. @item chroma_power, cp
  14368. @item alpha_power, ap
  14369. Specify how many times the boxblur filter is applied to the
  14370. corresponding plane.
  14371. Default value for @option{luma_power} is 2. If not specified,
  14372. @option{chroma_power} and @option{alpha_power} default to the
  14373. corresponding value set for @option{luma_power}.
  14374. A value of 0 will disable the effect.
  14375. @end table
  14376. @subsection Examples
  14377. 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.
  14378. @itemize
  14379. @item
  14380. Apply a boxblur filter with the luma, chroma, and alpha radius
  14381. 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.
  14382. @example
  14383. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14384. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14385. @end example
  14386. @item
  14387. 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.
  14388. For the luma plane, a 2x2 box radius will be run once.
  14389. For the chroma plane, a 4x4 box radius will be run 5 times.
  14390. For the alpha plane, a 3x3 box radius will be run 7 times.
  14391. @example
  14392. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14393. @end example
  14394. @end itemize
  14395. @section convolution_opencl
  14396. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14397. The filter accepts the following options:
  14398. @table @option
  14399. @item 0m
  14400. @item 1m
  14401. @item 2m
  14402. @item 3m
  14403. Set matrix for each plane.
  14404. Matrix is sequence of 9, 25 or 49 signed numbers.
  14405. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14406. @item 0rdiv
  14407. @item 1rdiv
  14408. @item 2rdiv
  14409. @item 3rdiv
  14410. Set multiplier for calculated value for each plane.
  14411. If unset or 0, it will be sum of all matrix elements.
  14412. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14413. @item 0bias
  14414. @item 1bias
  14415. @item 2bias
  14416. @item 3bias
  14417. Set bias for each plane. This value is added to the result of the multiplication.
  14418. Useful for making the overall image brighter or darker.
  14419. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14420. @end table
  14421. @subsection Examples
  14422. @itemize
  14423. @item
  14424. Apply sharpen:
  14425. @example
  14426. -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
  14427. @end example
  14428. @item
  14429. Apply blur:
  14430. @example
  14431. -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
  14432. @end example
  14433. @item
  14434. Apply edge enhance:
  14435. @example
  14436. -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
  14437. @end example
  14438. @item
  14439. Apply edge detect:
  14440. @example
  14441. -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
  14442. @end example
  14443. @item
  14444. Apply laplacian edge detector which includes diagonals:
  14445. @example
  14446. -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
  14447. @end example
  14448. @item
  14449. Apply emboss:
  14450. @example
  14451. -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
  14452. @end example
  14453. @end itemize
  14454. @section dilation_opencl
  14455. Apply dilation effect to the video.
  14456. This filter replaces the pixel by the local(3x3) maximum.
  14457. It accepts the following options:
  14458. @table @option
  14459. @item threshold0
  14460. @item threshold1
  14461. @item threshold2
  14462. @item threshold3
  14463. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14464. If @code{0}, plane will remain unchanged.
  14465. @item coordinates
  14466. Flag which specifies the pixel to refer to.
  14467. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14468. Flags to local 3x3 coordinates region centered on @code{x}:
  14469. 1 2 3
  14470. 4 x 5
  14471. 6 7 8
  14472. @end table
  14473. @subsection Example
  14474. @itemize
  14475. @item
  14476. 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.
  14477. @example
  14478. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14479. @end example
  14480. @end itemize
  14481. @section erosion_opencl
  14482. Apply erosion effect to the video.
  14483. This filter replaces the pixel by the local(3x3) minimum.
  14484. It accepts the following options:
  14485. @table @option
  14486. @item threshold0
  14487. @item threshold1
  14488. @item threshold2
  14489. @item threshold3
  14490. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14491. If @code{0}, plane will remain unchanged.
  14492. @item coordinates
  14493. Flag which specifies the pixel to refer to.
  14494. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14495. Flags to local 3x3 coordinates region centered on @code{x}:
  14496. 1 2 3
  14497. 4 x 5
  14498. 6 7 8
  14499. @end table
  14500. @subsection Example
  14501. @itemize
  14502. @item
  14503. 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.
  14504. @example
  14505. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14506. @end example
  14507. @end itemize
  14508. @section overlay_opencl
  14509. Overlay one video on top of another.
  14510. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14511. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14512. The filter accepts the following options:
  14513. @table @option
  14514. @item x
  14515. Set the x coordinate of the overlaid video on the main video.
  14516. Default value is @code{0}.
  14517. @item y
  14518. Set the x coordinate of the overlaid video on the main video.
  14519. Default value is @code{0}.
  14520. @end table
  14521. @subsection Examples
  14522. @itemize
  14523. @item
  14524. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14525. @example
  14526. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14527. @end example
  14528. @item
  14529. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14530. @example
  14531. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14532. @end example
  14533. @end itemize
  14534. @section prewitt_opencl
  14535. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14536. The filter accepts the following option:
  14537. @table @option
  14538. @item planes
  14539. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14540. @item scale
  14541. Set value which will be multiplied with filtered result.
  14542. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14543. @item delta
  14544. Set value which will be added to filtered result.
  14545. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14546. @end table
  14547. @subsection Example
  14548. @itemize
  14549. @item
  14550. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14551. @example
  14552. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14553. @end example
  14554. @end itemize
  14555. @section roberts_opencl
  14556. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14557. The filter accepts the following option:
  14558. @table @option
  14559. @item planes
  14560. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14561. @item scale
  14562. Set value which will be multiplied with filtered result.
  14563. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14564. @item delta
  14565. Set value which will be added to filtered result.
  14566. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14567. @end table
  14568. @subsection Example
  14569. @itemize
  14570. @item
  14571. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14572. @example
  14573. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14574. @end example
  14575. @end itemize
  14576. @section sobel_opencl
  14577. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14578. The filter accepts the following option:
  14579. @table @option
  14580. @item planes
  14581. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14582. @item scale
  14583. Set value which will be multiplied with filtered result.
  14584. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14585. @item delta
  14586. Set value which will be added to filtered result.
  14587. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14588. @end table
  14589. @subsection Example
  14590. @itemize
  14591. @item
  14592. Apply sobel operator with scale set to 2 and delta set to 10
  14593. @example
  14594. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14595. @end example
  14596. @end itemize
  14597. @section tonemap_opencl
  14598. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14599. It accepts the following parameters:
  14600. @table @option
  14601. @item tonemap
  14602. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14603. @item param
  14604. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14605. @item desat
  14606. Apply desaturation for highlights that exceed this level of brightness. The
  14607. higher the parameter, the more color information will be preserved. This
  14608. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14609. (smoothly) turning into white instead. This makes images feel more natural,
  14610. at the cost of reducing information about out-of-range colors.
  14611. The default value is 0.5, and the algorithm here is a little different from
  14612. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14613. @item threshold
  14614. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14615. is used to detect whether the scene has changed or not. If the distance between
  14616. the current frame average brightness and the current running average exceeds
  14617. a threshold value, we would re-calculate scene average and peak brightness.
  14618. The default value is 0.2.
  14619. @item format
  14620. Specify the output pixel format.
  14621. Currently supported formats are:
  14622. @table @var
  14623. @item p010
  14624. @item nv12
  14625. @end table
  14626. @item range, r
  14627. Set the output color range.
  14628. Possible values are:
  14629. @table @var
  14630. @item tv/mpeg
  14631. @item pc/jpeg
  14632. @end table
  14633. Default is same as input.
  14634. @item primaries, p
  14635. Set the output color primaries.
  14636. Possible values are:
  14637. @table @var
  14638. @item bt709
  14639. @item bt2020
  14640. @end table
  14641. Default is same as input.
  14642. @item transfer, t
  14643. Set the output transfer characteristics.
  14644. Possible values are:
  14645. @table @var
  14646. @item bt709
  14647. @item bt2020
  14648. @end table
  14649. Default is bt709.
  14650. @item matrix, m
  14651. Set the output colorspace matrix.
  14652. Possible value are:
  14653. @table @var
  14654. @item bt709
  14655. @item bt2020
  14656. @end table
  14657. Default is same as input.
  14658. @end table
  14659. @subsection Example
  14660. @itemize
  14661. @item
  14662. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14663. @example
  14664. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14665. @end example
  14666. @end itemize
  14667. @section unsharp_opencl
  14668. Sharpen or blur the input video.
  14669. It accepts the following parameters:
  14670. @table @option
  14671. @item luma_msize_x, lx
  14672. Set the luma matrix horizontal size.
  14673. Range is @code{[1, 23]} and default value is @code{5}.
  14674. @item luma_msize_y, ly
  14675. Set the luma matrix vertical size.
  14676. Range is @code{[1, 23]} and default value is @code{5}.
  14677. @item luma_amount, la
  14678. Set the luma effect strength.
  14679. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14680. Negative values will blur the input video, while positive values will
  14681. sharpen it, a value of zero will disable the effect.
  14682. @item chroma_msize_x, cx
  14683. Set the chroma matrix horizontal size.
  14684. Range is @code{[1, 23]} and default value is @code{5}.
  14685. @item chroma_msize_y, cy
  14686. Set the chroma matrix vertical size.
  14687. Range is @code{[1, 23]} and default value is @code{5}.
  14688. @item chroma_amount, ca
  14689. Set the chroma effect strength.
  14690. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14691. Negative values will blur the input video, while positive values will
  14692. sharpen it, a value of zero will disable the effect.
  14693. @end table
  14694. All parameters are optional and default to the equivalent of the
  14695. string '5:5:1.0:5:5:0.0'.
  14696. @subsection Examples
  14697. @itemize
  14698. @item
  14699. Apply strong luma sharpen effect:
  14700. @example
  14701. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14702. @end example
  14703. @item
  14704. Apply a strong blur of both luma and chroma parameters:
  14705. @example
  14706. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14707. @end example
  14708. @end itemize
  14709. @c man end OPENCL VIDEO FILTERS
  14710. @chapter Video Sources
  14711. @c man begin VIDEO SOURCES
  14712. Below is a description of the currently available video sources.
  14713. @section buffer
  14714. Buffer video frames, and make them available to the filter chain.
  14715. This source is mainly intended for a programmatic use, in particular
  14716. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14717. It accepts the following parameters:
  14718. @table @option
  14719. @item video_size
  14720. Specify the size (width and height) of the buffered video frames. For the
  14721. syntax of this option, check the
  14722. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14723. @item width
  14724. The input video width.
  14725. @item height
  14726. The input video height.
  14727. @item pix_fmt
  14728. A string representing the pixel format of the buffered video frames.
  14729. It may be a number corresponding to a pixel format, or a pixel format
  14730. name.
  14731. @item time_base
  14732. Specify the timebase assumed by the timestamps of the buffered frames.
  14733. @item frame_rate
  14734. Specify the frame rate expected for the video stream.
  14735. @item pixel_aspect, sar
  14736. The sample (pixel) aspect ratio of the input video.
  14737. @item sws_param
  14738. Specify the optional parameters to be used for the scale filter which
  14739. is automatically inserted when an input change is detected in the
  14740. input size or format.
  14741. @item hw_frames_ctx
  14742. When using a hardware pixel format, this should be a reference to an
  14743. AVHWFramesContext describing input frames.
  14744. @end table
  14745. For example:
  14746. @example
  14747. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14748. @end example
  14749. will instruct the source to accept video frames with size 320x240 and
  14750. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14751. square pixels (1:1 sample aspect ratio).
  14752. Since the pixel format with name "yuv410p" corresponds to the number 6
  14753. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14754. this example corresponds to:
  14755. @example
  14756. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14757. @end example
  14758. Alternatively, the options can be specified as a flat string, but this
  14759. syntax is deprecated:
  14760. @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}]
  14761. @section cellauto
  14762. Create a pattern generated by an elementary cellular automaton.
  14763. The initial state of the cellular automaton can be defined through the
  14764. @option{filename} and @option{pattern} options. If such options are
  14765. not specified an initial state is created randomly.
  14766. At each new frame a new row in the video is filled with the result of
  14767. the cellular automaton next generation. The behavior when the whole
  14768. frame is filled is defined by the @option{scroll} option.
  14769. This source accepts the following options:
  14770. @table @option
  14771. @item filename, f
  14772. Read the initial cellular automaton state, i.e. the starting row, from
  14773. the specified file.
  14774. In the file, each non-whitespace character is considered an alive
  14775. cell, a newline will terminate the row, and further characters in the
  14776. file will be ignored.
  14777. @item pattern, p
  14778. Read the initial cellular automaton state, i.e. the starting row, from
  14779. the specified string.
  14780. Each non-whitespace character in the string is considered an alive
  14781. cell, a newline will terminate the row, and further characters in the
  14782. string will be ignored.
  14783. @item rate, r
  14784. Set the video rate, that is the number of frames generated per second.
  14785. Default is 25.
  14786. @item random_fill_ratio, ratio
  14787. Set the random fill ratio for the initial cellular automaton row. It
  14788. is a floating point number value ranging from 0 to 1, defaults to
  14789. 1/PHI.
  14790. This option is ignored when a file or a pattern is specified.
  14791. @item random_seed, seed
  14792. Set the seed for filling randomly the initial row, must be an integer
  14793. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14794. set to -1, the filter will try to use a good random seed on a best
  14795. effort basis.
  14796. @item rule
  14797. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14798. Default value is 110.
  14799. @item size, s
  14800. Set the size of the output video. For the syntax of this option, check the
  14801. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14802. If @option{filename} or @option{pattern} is specified, the size is set
  14803. by default to the width of the specified initial state row, and the
  14804. height is set to @var{width} * PHI.
  14805. If @option{size} is set, it must contain the width of the specified
  14806. pattern string, and the specified pattern will be centered in the
  14807. larger row.
  14808. If a filename or a pattern string is not specified, the size value
  14809. defaults to "320x518" (used for a randomly generated initial state).
  14810. @item scroll
  14811. If set to 1, scroll the output upward when all the rows in the output
  14812. have been already filled. If set to 0, the new generated row will be
  14813. written over the top row just after the bottom row is filled.
  14814. Defaults to 1.
  14815. @item start_full, full
  14816. If set to 1, completely fill the output with generated rows before
  14817. outputting the first frame.
  14818. This is the default behavior, for disabling set the value to 0.
  14819. @item stitch
  14820. If set to 1, stitch the left and right row edges together.
  14821. This is the default behavior, for disabling set the value to 0.
  14822. @end table
  14823. @subsection Examples
  14824. @itemize
  14825. @item
  14826. Read the initial state from @file{pattern}, and specify an output of
  14827. size 200x400.
  14828. @example
  14829. cellauto=f=pattern:s=200x400
  14830. @end example
  14831. @item
  14832. Generate a random initial row with a width of 200 cells, with a fill
  14833. ratio of 2/3:
  14834. @example
  14835. cellauto=ratio=2/3:s=200x200
  14836. @end example
  14837. @item
  14838. Create a pattern generated by rule 18 starting by a single alive cell
  14839. centered on an initial row with width 100:
  14840. @example
  14841. cellauto=p=@@:s=100x400:full=0:rule=18
  14842. @end example
  14843. @item
  14844. Specify a more elaborated initial pattern:
  14845. @example
  14846. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14847. @end example
  14848. @end itemize
  14849. @anchor{coreimagesrc}
  14850. @section coreimagesrc
  14851. Video source generated on GPU using Apple's CoreImage API on OSX.
  14852. This video source is a specialized version of the @ref{coreimage} video filter.
  14853. Use a core image generator at the beginning of the applied filterchain to
  14854. generate the content.
  14855. The coreimagesrc video source accepts the following options:
  14856. @table @option
  14857. @item list_generators
  14858. List all available generators along with all their respective options as well as
  14859. possible minimum and maximum values along with the default values.
  14860. @example
  14861. list_generators=true
  14862. @end example
  14863. @item size, s
  14864. Specify the size of the sourced video. For the syntax of this option, check the
  14865. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14866. The default value is @code{320x240}.
  14867. @item rate, r
  14868. Specify the frame rate of the sourced video, as the number of frames
  14869. generated per second. It has to be a string in the format
  14870. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14871. number or a valid video frame rate abbreviation. The default value is
  14872. "25".
  14873. @item sar
  14874. Set the sample aspect ratio of the sourced video.
  14875. @item duration, d
  14876. Set the duration of the sourced video. See
  14877. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14878. for the accepted syntax.
  14879. If not specified, or the expressed duration is negative, the video is
  14880. supposed to be generated forever.
  14881. @end table
  14882. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14883. A complete filterchain can be used for further processing of the
  14884. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14885. and examples for details.
  14886. @subsection Examples
  14887. @itemize
  14888. @item
  14889. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14890. given as complete and escaped command-line for Apple's standard bash shell:
  14891. @example
  14892. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14893. @end example
  14894. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14895. need for a nullsrc video source.
  14896. @end itemize
  14897. @section mandelbrot
  14898. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14899. point specified with @var{start_x} and @var{start_y}.
  14900. This source accepts the following options:
  14901. @table @option
  14902. @item end_pts
  14903. Set the terminal pts value. Default value is 400.
  14904. @item end_scale
  14905. Set the terminal scale value.
  14906. Must be a floating point value. Default value is 0.3.
  14907. @item inner
  14908. Set the inner coloring mode, that is the algorithm used to draw the
  14909. Mandelbrot fractal internal region.
  14910. It shall assume one of the following values:
  14911. @table @option
  14912. @item black
  14913. Set black mode.
  14914. @item convergence
  14915. Show time until convergence.
  14916. @item mincol
  14917. Set color based on point closest to the origin of the iterations.
  14918. @item period
  14919. Set period mode.
  14920. @end table
  14921. Default value is @var{mincol}.
  14922. @item bailout
  14923. Set the bailout value. Default value is 10.0.
  14924. @item maxiter
  14925. Set the maximum of iterations performed by the rendering
  14926. algorithm. Default value is 7189.
  14927. @item outer
  14928. Set outer coloring mode.
  14929. It shall assume one of following values:
  14930. @table @option
  14931. @item iteration_count
  14932. Set iteration count mode.
  14933. @item normalized_iteration_count
  14934. set normalized iteration count mode.
  14935. @end table
  14936. Default value is @var{normalized_iteration_count}.
  14937. @item rate, r
  14938. Set frame rate, expressed as number of frames per second. Default
  14939. value is "25".
  14940. @item size, s
  14941. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14942. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14943. @item start_scale
  14944. Set the initial scale value. Default value is 3.0.
  14945. @item start_x
  14946. Set the initial x position. Must be a floating point value between
  14947. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14948. @item start_y
  14949. Set the initial y position. Must be a floating point value between
  14950. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14951. @end table
  14952. @section mptestsrc
  14953. Generate various test patterns, as generated by the MPlayer test filter.
  14954. The size of the generated video is fixed, and is 256x256.
  14955. This source is useful in particular for testing encoding features.
  14956. This source accepts the following options:
  14957. @table @option
  14958. @item rate, r
  14959. Specify the frame rate of the sourced video, as the number of frames
  14960. generated per second. It has to be a string in the format
  14961. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14962. number or a valid video frame rate abbreviation. The default value is
  14963. "25".
  14964. @item duration, d
  14965. Set the duration of the sourced video. See
  14966. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14967. for the accepted syntax.
  14968. If not specified, or the expressed duration is negative, the video is
  14969. supposed to be generated forever.
  14970. @item test, t
  14971. Set the number or the name of the test to perform. Supported tests are:
  14972. @table @option
  14973. @item dc_luma
  14974. @item dc_chroma
  14975. @item freq_luma
  14976. @item freq_chroma
  14977. @item amp_luma
  14978. @item amp_chroma
  14979. @item cbp
  14980. @item mv
  14981. @item ring1
  14982. @item ring2
  14983. @item all
  14984. @end table
  14985. Default value is "all", which will cycle through the list of all tests.
  14986. @end table
  14987. Some examples:
  14988. @example
  14989. mptestsrc=t=dc_luma
  14990. @end example
  14991. will generate a "dc_luma" test pattern.
  14992. @section frei0r_src
  14993. Provide a frei0r source.
  14994. To enable compilation of this filter you need to install the frei0r
  14995. header and configure FFmpeg with @code{--enable-frei0r}.
  14996. This source accepts the following parameters:
  14997. @table @option
  14998. @item size
  14999. The size of the video to generate. For the syntax of this option, check the
  15000. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15001. @item framerate
  15002. The framerate of the generated video. It may be a string of the form
  15003. @var{num}/@var{den} or a frame rate abbreviation.
  15004. @item filter_name
  15005. The name to the frei0r source to load. For more information regarding frei0r and
  15006. how to set the parameters, read the @ref{frei0r} section in the video filters
  15007. documentation.
  15008. @item filter_params
  15009. A '|'-separated list of parameters to pass to the frei0r source.
  15010. @end table
  15011. For example, to generate a frei0r partik0l source with size 200x200
  15012. and frame rate 10 which is overlaid on the overlay filter main input:
  15013. @example
  15014. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15015. @end example
  15016. @section life
  15017. Generate a life pattern.
  15018. This source is based on a generalization of John Conway's life game.
  15019. The sourced input represents a life grid, each pixel represents a cell
  15020. which can be in one of two possible states, alive or dead. Every cell
  15021. interacts with its eight neighbours, which are the cells that are
  15022. horizontally, vertically, or diagonally adjacent.
  15023. At each interaction the grid evolves according to the adopted rule,
  15024. which specifies the number of neighbor alive cells which will make a
  15025. cell stay alive or born. The @option{rule} option allows one to specify
  15026. the rule to adopt.
  15027. This source accepts the following options:
  15028. @table @option
  15029. @item filename, f
  15030. Set the file from which to read the initial grid state. In the file,
  15031. each non-whitespace character is considered an alive cell, and newline
  15032. is used to delimit the end of each row.
  15033. If this option is not specified, the initial grid is generated
  15034. randomly.
  15035. @item rate, r
  15036. Set the video rate, that is the number of frames generated per second.
  15037. Default is 25.
  15038. @item random_fill_ratio, ratio
  15039. Set the random fill ratio for the initial random grid. It is a
  15040. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15041. It is ignored when a file is specified.
  15042. @item random_seed, seed
  15043. Set the seed for filling the initial random grid, must be an integer
  15044. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15045. set to -1, the filter will try to use a good random seed on a best
  15046. effort basis.
  15047. @item rule
  15048. Set the life rule.
  15049. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15050. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15051. @var{NS} specifies the number of alive neighbor cells which make a
  15052. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15053. which make a dead cell to become alive (i.e. to "born").
  15054. "s" and "b" can be used in place of "S" and "B", respectively.
  15055. Alternatively a rule can be specified by an 18-bits integer. The 9
  15056. high order bits are used to encode the next cell state if it is alive
  15057. for each number of neighbor alive cells, the low order bits specify
  15058. the rule for "borning" new cells. Higher order bits encode for an
  15059. higher number of neighbor cells.
  15060. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15061. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15062. Default value is "S23/B3", which is the original Conway's game of life
  15063. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15064. cells, and will born a new cell if there are three alive cells around
  15065. a dead cell.
  15066. @item size, s
  15067. Set the size of the output video. For the syntax of this option, check the
  15068. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15069. If @option{filename} is specified, the size is set by default to the
  15070. same size of the input file. If @option{size} is set, it must contain
  15071. the size specified in the input file, and the initial grid defined in
  15072. that file is centered in the larger resulting area.
  15073. If a filename is not specified, the size value defaults to "320x240"
  15074. (used for a randomly generated initial grid).
  15075. @item stitch
  15076. If set to 1, stitch the left and right grid edges together, and the
  15077. top and bottom edges also. Defaults to 1.
  15078. @item mold
  15079. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15080. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15081. value from 0 to 255.
  15082. @item life_color
  15083. Set the color of living (or new born) cells.
  15084. @item death_color
  15085. Set the color of dead cells. If @option{mold} is set, this is the first color
  15086. used to represent a dead cell.
  15087. @item mold_color
  15088. Set mold color, for definitely dead and moldy cells.
  15089. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15090. ffmpeg-utils manual,ffmpeg-utils}.
  15091. @end table
  15092. @subsection Examples
  15093. @itemize
  15094. @item
  15095. Read a grid from @file{pattern}, and center it on a grid of size
  15096. 300x300 pixels:
  15097. @example
  15098. life=f=pattern:s=300x300
  15099. @end example
  15100. @item
  15101. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15102. @example
  15103. life=ratio=2/3:s=200x200
  15104. @end example
  15105. @item
  15106. Specify a custom rule for evolving a randomly generated grid:
  15107. @example
  15108. life=rule=S14/B34
  15109. @end example
  15110. @item
  15111. Full example with slow death effect (mold) using @command{ffplay}:
  15112. @example
  15113. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15114. @end example
  15115. @end itemize
  15116. @anchor{allrgb}
  15117. @anchor{allyuv}
  15118. @anchor{color}
  15119. @anchor{haldclutsrc}
  15120. @anchor{nullsrc}
  15121. @anchor{pal75bars}
  15122. @anchor{pal100bars}
  15123. @anchor{rgbtestsrc}
  15124. @anchor{smptebars}
  15125. @anchor{smptehdbars}
  15126. @anchor{testsrc}
  15127. @anchor{testsrc2}
  15128. @anchor{yuvtestsrc}
  15129. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15130. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15131. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15132. The @code{color} source provides an uniformly colored input.
  15133. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15134. @ref{haldclut} filter.
  15135. The @code{nullsrc} source returns unprocessed video frames. It is
  15136. mainly useful to be employed in analysis / debugging tools, or as the
  15137. source for filters which ignore the input data.
  15138. The @code{pal75bars} source generates a color bars pattern, based on
  15139. EBU PAL recommendations with 75% color levels.
  15140. The @code{pal100bars} source generates a color bars pattern, based on
  15141. EBU PAL recommendations with 100% color levels.
  15142. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15143. detecting RGB vs BGR issues. You should see a red, green and blue
  15144. stripe from top to bottom.
  15145. The @code{smptebars} source generates a color bars pattern, based on
  15146. the SMPTE Engineering Guideline EG 1-1990.
  15147. The @code{smptehdbars} source generates a color bars pattern, based on
  15148. the SMPTE RP 219-2002.
  15149. The @code{testsrc} source generates a test video pattern, showing a
  15150. color pattern, a scrolling gradient and a timestamp. This is mainly
  15151. intended for testing purposes.
  15152. The @code{testsrc2} source is similar to testsrc, but supports more
  15153. pixel formats instead of just @code{rgb24}. This allows using it as an
  15154. input for other tests without requiring a format conversion.
  15155. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15156. see a y, cb and cr stripe from top to bottom.
  15157. The sources accept the following parameters:
  15158. @table @option
  15159. @item level
  15160. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15161. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15162. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15163. coded on a @code{1/(N*N)} scale.
  15164. @item color, c
  15165. Specify the color of the source, only available in the @code{color}
  15166. source. For the syntax of this option, check the
  15167. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15168. @item size, s
  15169. Specify the size of the sourced video. For the syntax of this option, check the
  15170. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15171. The default value is @code{320x240}.
  15172. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15173. @code{haldclutsrc} filters.
  15174. @item rate, r
  15175. Specify the frame rate of the sourced video, as the number of frames
  15176. generated per second. It has to be a string in the format
  15177. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15178. number or a valid video frame rate abbreviation. The default value is
  15179. "25".
  15180. @item duration, d
  15181. Set the duration of the sourced video. See
  15182. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15183. for the accepted syntax.
  15184. If not specified, or the expressed duration is negative, the video is
  15185. supposed to be generated forever.
  15186. @item sar
  15187. Set the sample aspect ratio of the sourced video.
  15188. @item alpha
  15189. Specify the alpha (opacity) of the background, only available in the
  15190. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15191. 255 (fully opaque, the default).
  15192. @item decimals, n
  15193. Set the number of decimals to show in the timestamp, only available in the
  15194. @code{testsrc} source.
  15195. The displayed timestamp value will correspond to the original
  15196. timestamp value multiplied by the power of 10 of the specified
  15197. value. Default value is 0.
  15198. @end table
  15199. @subsection Examples
  15200. @itemize
  15201. @item
  15202. Generate a video with a duration of 5.3 seconds, with size
  15203. 176x144 and a frame rate of 10 frames per second:
  15204. @example
  15205. testsrc=duration=5.3:size=qcif:rate=10
  15206. @end example
  15207. @item
  15208. The following graph description will generate a red source
  15209. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15210. frames per second:
  15211. @example
  15212. color=c=red@@0.2:s=qcif:r=10
  15213. @end example
  15214. @item
  15215. If the input content is to be ignored, @code{nullsrc} can be used. The
  15216. following command generates noise in the luminance plane by employing
  15217. the @code{geq} filter:
  15218. @example
  15219. nullsrc=s=256x256, geq=random(1)*255:128:128
  15220. @end example
  15221. @end itemize
  15222. @subsection Commands
  15223. The @code{color} source supports the following commands:
  15224. @table @option
  15225. @item c, color
  15226. Set the color of the created image. Accepts the same syntax of the
  15227. corresponding @option{color} option.
  15228. @end table
  15229. @section openclsrc
  15230. Generate video using an OpenCL program.
  15231. @table @option
  15232. @item source
  15233. OpenCL program source file.
  15234. @item kernel
  15235. Kernel name in program.
  15236. @item size, s
  15237. Size of frames to generate. This must be set.
  15238. @item format
  15239. Pixel format to use for the generated frames. This must be set.
  15240. @item rate, r
  15241. Number of frames generated every second. Default value is '25'.
  15242. @end table
  15243. For details of how the program loading works, see the @ref{program_opencl}
  15244. filter.
  15245. Example programs:
  15246. @itemize
  15247. @item
  15248. Generate a colour ramp by setting pixel values from the position of the pixel
  15249. in the output image. (Note that this will work with all pixel formats, but
  15250. the generated output will not be the same.)
  15251. @verbatim
  15252. __kernel void ramp(__write_only image2d_t dst,
  15253. unsigned int index)
  15254. {
  15255. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15256. float4 val;
  15257. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15258. write_imagef(dst, loc, val);
  15259. }
  15260. @end verbatim
  15261. @item
  15262. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15263. @verbatim
  15264. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15265. unsigned int index)
  15266. {
  15267. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15268. float4 value = 0.0f;
  15269. int x = loc.x + index;
  15270. int y = loc.y + index;
  15271. while (x > 0 || y > 0) {
  15272. if (x % 3 == 1 && y % 3 == 1) {
  15273. value = 1.0f;
  15274. break;
  15275. }
  15276. x /= 3;
  15277. y /= 3;
  15278. }
  15279. write_imagef(dst, loc, value);
  15280. }
  15281. @end verbatim
  15282. @end itemize
  15283. @c man end VIDEO SOURCES
  15284. @chapter Video Sinks
  15285. @c man begin VIDEO SINKS
  15286. Below is a description of the currently available video sinks.
  15287. @section buffersink
  15288. Buffer video frames, and make them available to the end of the filter
  15289. graph.
  15290. This sink is mainly intended for programmatic use, in particular
  15291. through the interface defined in @file{libavfilter/buffersink.h}
  15292. or the options system.
  15293. It accepts a pointer to an AVBufferSinkContext structure, which
  15294. defines the incoming buffers' formats, to be passed as the opaque
  15295. parameter to @code{avfilter_init_filter} for initialization.
  15296. @section nullsink
  15297. Null video sink: do absolutely nothing with the input video. It is
  15298. mainly useful as a template and for use in analysis / debugging
  15299. tools.
  15300. @c man end VIDEO SINKS
  15301. @chapter Multimedia Filters
  15302. @c man begin MULTIMEDIA FILTERS
  15303. Below is a description of the currently available multimedia filters.
  15304. @section abitscope
  15305. Convert input audio to a video output, displaying the audio bit scope.
  15306. The filter accepts the following options:
  15307. @table @option
  15308. @item rate, r
  15309. Set frame rate, expressed as number of frames per second. Default
  15310. value is "25".
  15311. @item size, s
  15312. Specify the video size for the output. For the syntax of this option, check the
  15313. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15314. Default value is @code{1024x256}.
  15315. @item colors
  15316. Specify list of colors separated by space or by '|' which will be used to
  15317. draw channels. Unrecognized or missing colors will be replaced
  15318. by white color.
  15319. @end table
  15320. @section ahistogram
  15321. Convert input audio to a video output, displaying the volume histogram.
  15322. The filter accepts the following options:
  15323. @table @option
  15324. @item dmode
  15325. Specify how histogram is calculated.
  15326. It accepts the following values:
  15327. @table @samp
  15328. @item single
  15329. Use single histogram for all channels.
  15330. @item separate
  15331. Use separate histogram for each channel.
  15332. @end table
  15333. Default is @code{single}.
  15334. @item rate, r
  15335. Set frame rate, expressed as number of frames per second. Default
  15336. value is "25".
  15337. @item size, s
  15338. Specify the video size for the output. For the syntax of this option, check the
  15339. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15340. Default value is @code{hd720}.
  15341. @item scale
  15342. Set display scale.
  15343. It accepts the following values:
  15344. @table @samp
  15345. @item log
  15346. logarithmic
  15347. @item sqrt
  15348. square root
  15349. @item cbrt
  15350. cubic root
  15351. @item lin
  15352. linear
  15353. @item rlog
  15354. reverse logarithmic
  15355. @end table
  15356. Default is @code{log}.
  15357. @item ascale
  15358. Set amplitude scale.
  15359. It accepts the following values:
  15360. @table @samp
  15361. @item log
  15362. logarithmic
  15363. @item lin
  15364. linear
  15365. @end table
  15366. Default is @code{log}.
  15367. @item acount
  15368. Set how much frames to accumulate in histogram.
  15369. Default is 1. Setting this to -1 accumulates all frames.
  15370. @item rheight
  15371. Set histogram ratio of window height.
  15372. @item slide
  15373. Set sonogram sliding.
  15374. It accepts the following values:
  15375. @table @samp
  15376. @item replace
  15377. replace old rows with new ones.
  15378. @item scroll
  15379. scroll from top to bottom.
  15380. @end table
  15381. Default is @code{replace}.
  15382. @end table
  15383. @section aphasemeter
  15384. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15385. representing mean phase of current audio frame. A video output can also be produced and is
  15386. enabled by default. The audio is passed through as first output.
  15387. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15388. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15389. and @code{1} means channels are in phase.
  15390. The filter accepts the following options, all related to its video output:
  15391. @table @option
  15392. @item rate, r
  15393. Set the output frame rate. Default value is @code{25}.
  15394. @item size, s
  15395. Set the video size for the output. For the syntax of this option, check the
  15396. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15397. Default value is @code{800x400}.
  15398. @item rc
  15399. @item gc
  15400. @item bc
  15401. Specify the red, green, blue contrast. Default values are @code{2},
  15402. @code{7} and @code{1}.
  15403. Allowed range is @code{[0, 255]}.
  15404. @item mpc
  15405. Set color which will be used for drawing median phase. If color is
  15406. @code{none} which is default, no median phase value will be drawn.
  15407. @item video
  15408. Enable video output. Default is enabled.
  15409. @end table
  15410. @section avectorscope
  15411. Convert input audio to a video output, representing the audio vector
  15412. scope.
  15413. The filter is used to measure the difference between channels of stereo
  15414. audio stream. A monoaural signal, consisting of identical left and right
  15415. signal, results in straight vertical line. Any stereo separation is visible
  15416. as a deviation from this line, creating a Lissajous figure.
  15417. If the straight (or deviation from it) but horizontal line appears this
  15418. indicates that the left and right channels are out of phase.
  15419. The filter accepts the following options:
  15420. @table @option
  15421. @item mode, m
  15422. Set the vectorscope mode.
  15423. Available values are:
  15424. @table @samp
  15425. @item lissajous
  15426. Lissajous rotated by 45 degrees.
  15427. @item lissajous_xy
  15428. Same as above but not rotated.
  15429. @item polar
  15430. Shape resembling half of circle.
  15431. @end table
  15432. Default value is @samp{lissajous}.
  15433. @item size, s
  15434. Set the video size for the output. For the syntax of this option, check the
  15435. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15436. Default value is @code{400x400}.
  15437. @item rate, r
  15438. Set the output frame rate. Default value is @code{25}.
  15439. @item rc
  15440. @item gc
  15441. @item bc
  15442. @item ac
  15443. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15444. @code{160}, @code{80} and @code{255}.
  15445. Allowed range is @code{[0, 255]}.
  15446. @item rf
  15447. @item gf
  15448. @item bf
  15449. @item af
  15450. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15451. @code{10}, @code{5} and @code{5}.
  15452. Allowed range is @code{[0, 255]}.
  15453. @item zoom
  15454. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15455. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15456. @item draw
  15457. Set the vectorscope drawing mode.
  15458. Available values are:
  15459. @table @samp
  15460. @item dot
  15461. Draw dot for each sample.
  15462. @item line
  15463. Draw line between previous and current sample.
  15464. @end table
  15465. Default value is @samp{dot}.
  15466. @item scale
  15467. Specify amplitude scale of audio samples.
  15468. Available values are:
  15469. @table @samp
  15470. @item lin
  15471. Linear.
  15472. @item sqrt
  15473. Square root.
  15474. @item cbrt
  15475. Cubic root.
  15476. @item log
  15477. Logarithmic.
  15478. @end table
  15479. @item swap
  15480. Swap left channel axis with right channel axis.
  15481. @item mirror
  15482. Mirror axis.
  15483. @table @samp
  15484. @item none
  15485. No mirror.
  15486. @item x
  15487. Mirror only x axis.
  15488. @item y
  15489. Mirror only y axis.
  15490. @item xy
  15491. Mirror both axis.
  15492. @end table
  15493. @end table
  15494. @subsection Examples
  15495. @itemize
  15496. @item
  15497. Complete example using @command{ffplay}:
  15498. @example
  15499. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15500. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15501. @end example
  15502. @end itemize
  15503. @section bench, abench
  15504. Benchmark part of a filtergraph.
  15505. The filter accepts the following options:
  15506. @table @option
  15507. @item action
  15508. Start or stop a timer.
  15509. Available values are:
  15510. @table @samp
  15511. @item start
  15512. Get the current time, set it as frame metadata (using the key
  15513. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15514. @item stop
  15515. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15516. the input frame metadata to get the time difference. Time difference, average,
  15517. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15518. @code{min}) are then printed. The timestamps are expressed in seconds.
  15519. @end table
  15520. @end table
  15521. @subsection Examples
  15522. @itemize
  15523. @item
  15524. Benchmark @ref{selectivecolor} filter:
  15525. @example
  15526. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15527. @end example
  15528. @end itemize
  15529. @section concat
  15530. Concatenate audio and video streams, joining them together one after the
  15531. other.
  15532. The filter works on segments of synchronized video and audio streams. All
  15533. segments must have the same number of streams of each type, and that will
  15534. also be the number of streams at output.
  15535. The filter accepts the following options:
  15536. @table @option
  15537. @item n
  15538. Set the number of segments. Default is 2.
  15539. @item v
  15540. Set the number of output video streams, that is also the number of video
  15541. streams in each segment. Default is 1.
  15542. @item a
  15543. Set the number of output audio streams, that is also the number of audio
  15544. streams in each segment. Default is 0.
  15545. @item unsafe
  15546. Activate unsafe mode: do not fail if segments have a different format.
  15547. @end table
  15548. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15549. @var{a} audio outputs.
  15550. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15551. segment, in the same order as the outputs, then the inputs for the second
  15552. segment, etc.
  15553. Related streams do not always have exactly the same duration, for various
  15554. reasons including codec frame size or sloppy authoring. For that reason,
  15555. related synchronized streams (e.g. a video and its audio track) should be
  15556. concatenated at once. The concat filter will use the duration of the longest
  15557. stream in each segment (except the last one), and if necessary pad shorter
  15558. audio streams with silence.
  15559. For this filter to work correctly, all segments must start at timestamp 0.
  15560. All corresponding streams must have the same parameters in all segments; the
  15561. filtering system will automatically select a common pixel format for video
  15562. streams, and a common sample format, sample rate and channel layout for
  15563. audio streams, but other settings, such as resolution, must be converted
  15564. explicitly by the user.
  15565. Different frame rates are acceptable but will result in variable frame rate
  15566. at output; be sure to configure the output file to handle it.
  15567. @subsection Examples
  15568. @itemize
  15569. @item
  15570. Concatenate an opening, an episode and an ending, all in bilingual version
  15571. (video in stream 0, audio in streams 1 and 2):
  15572. @example
  15573. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15574. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15575. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15576. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15577. @end example
  15578. @item
  15579. Concatenate two parts, handling audio and video separately, using the
  15580. (a)movie sources, and adjusting the resolution:
  15581. @example
  15582. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15583. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15584. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15585. @end example
  15586. Note that a desync will happen at the stitch if the audio and video streams
  15587. do not have exactly the same duration in the first file.
  15588. @end itemize
  15589. @subsection Commands
  15590. This filter supports the following commands:
  15591. @table @option
  15592. @item next
  15593. Close the current segment and step to the next one
  15594. @end table
  15595. @section drawgraph, adrawgraph
  15596. Draw a graph using input video or audio metadata.
  15597. It accepts the following parameters:
  15598. @table @option
  15599. @item m1
  15600. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15601. @item fg1
  15602. Set 1st foreground color expression.
  15603. @item m2
  15604. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15605. @item fg2
  15606. Set 2nd foreground color expression.
  15607. @item m3
  15608. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15609. @item fg3
  15610. Set 3rd foreground color expression.
  15611. @item m4
  15612. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15613. @item fg4
  15614. Set 4th foreground color expression.
  15615. @item min
  15616. Set minimal value of metadata value.
  15617. @item max
  15618. Set maximal value of metadata value.
  15619. @item bg
  15620. Set graph background color. Default is white.
  15621. @item mode
  15622. Set graph mode.
  15623. Available values for mode is:
  15624. @table @samp
  15625. @item bar
  15626. @item dot
  15627. @item line
  15628. @end table
  15629. Default is @code{line}.
  15630. @item slide
  15631. Set slide mode.
  15632. Available values for slide is:
  15633. @table @samp
  15634. @item frame
  15635. Draw new frame when right border is reached.
  15636. @item replace
  15637. Replace old columns with new ones.
  15638. @item scroll
  15639. Scroll from right to left.
  15640. @item rscroll
  15641. Scroll from left to right.
  15642. @item picture
  15643. Draw single picture.
  15644. @end table
  15645. Default is @code{frame}.
  15646. @item size
  15647. Set size of graph video. For the syntax of this option, check the
  15648. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15649. The default value is @code{900x256}.
  15650. The foreground color expressions can use the following variables:
  15651. @table @option
  15652. @item MIN
  15653. Minimal value of metadata value.
  15654. @item MAX
  15655. Maximal value of metadata value.
  15656. @item VAL
  15657. Current metadata key value.
  15658. @end table
  15659. The color is defined as 0xAABBGGRR.
  15660. @end table
  15661. Example using metadata from @ref{signalstats} filter:
  15662. @example
  15663. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15664. @end example
  15665. Example using metadata from @ref{ebur128} filter:
  15666. @example
  15667. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15668. @end example
  15669. @anchor{ebur128}
  15670. @section ebur128
  15671. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15672. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15673. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15674. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15675. The filter also has a video output (see the @var{video} option) with a real
  15676. time graph to observe the loudness evolution. The graphic contains the logged
  15677. message mentioned above, so it is not printed anymore when this option is set,
  15678. unless the verbose logging is set. The main graphing area contains the
  15679. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15680. the momentary loudness (400 milliseconds), but can optionally be configured
  15681. to instead display short-term loudness (see @var{gauge}).
  15682. The green area marks a +/- 1LU target range around the target loudness
  15683. (-23LUFS by default, unless modified through @var{target}).
  15684. More information about the Loudness Recommendation EBU R128 on
  15685. @url{http://tech.ebu.ch/loudness}.
  15686. The filter accepts the following options:
  15687. @table @option
  15688. @item video
  15689. Activate the video output. The audio stream is passed unchanged whether this
  15690. option is set or no. The video stream will be the first output stream if
  15691. activated. Default is @code{0}.
  15692. @item size
  15693. Set the video size. This option is for video only. For the syntax of this
  15694. option, check the
  15695. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15696. Default and minimum resolution is @code{640x480}.
  15697. @item meter
  15698. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15699. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15700. other integer value between this range is allowed.
  15701. @item metadata
  15702. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15703. into 100ms output frames, each of them containing various loudness information
  15704. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15705. Default is @code{0}.
  15706. @item framelog
  15707. Force the frame logging level.
  15708. Available values are:
  15709. @table @samp
  15710. @item info
  15711. information logging level
  15712. @item verbose
  15713. verbose logging level
  15714. @end table
  15715. By default, the logging level is set to @var{info}. If the @option{video} or
  15716. the @option{metadata} options are set, it switches to @var{verbose}.
  15717. @item peak
  15718. Set peak mode(s).
  15719. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15720. values are:
  15721. @table @samp
  15722. @item none
  15723. Disable any peak mode (default).
  15724. @item sample
  15725. Enable sample-peak mode.
  15726. Simple peak mode looking for the higher sample value. It logs a message
  15727. for sample-peak (identified by @code{SPK}).
  15728. @item true
  15729. Enable true-peak mode.
  15730. If enabled, the peak lookup is done on an over-sampled version of the input
  15731. stream for better peak accuracy. It logs a message for true-peak.
  15732. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15733. This mode requires a build with @code{libswresample}.
  15734. @end table
  15735. @item dualmono
  15736. Treat mono input files as "dual mono". If a mono file is intended for playback
  15737. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15738. If set to @code{true}, this option will compensate for this effect.
  15739. Multi-channel input files are not affected by this option.
  15740. @item panlaw
  15741. Set a specific pan law to be used for the measurement of dual mono files.
  15742. This parameter is optional, and has a default value of -3.01dB.
  15743. @item target
  15744. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15745. This parameter is optional and has a default value of -23LUFS as specified
  15746. by EBU R128. However, material published online may prefer a level of -16LUFS
  15747. (e.g. for use with podcasts or video platforms).
  15748. @item gauge
  15749. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15750. @code{shortterm}. By default the momentary value will be used, but in certain
  15751. scenarios it may be more useful to observe the short term value instead (e.g.
  15752. live mixing).
  15753. @item scale
  15754. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15755. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15756. video output, not the summary or continuous log output.
  15757. @end table
  15758. @subsection Examples
  15759. @itemize
  15760. @item
  15761. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15762. @example
  15763. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15764. @end example
  15765. @item
  15766. Run an analysis with @command{ffmpeg}:
  15767. @example
  15768. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15769. @end example
  15770. @end itemize
  15771. @section interleave, ainterleave
  15772. Temporally interleave frames from several inputs.
  15773. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15774. These filters read frames from several inputs and send the oldest
  15775. queued frame to the output.
  15776. Input streams must have well defined, monotonically increasing frame
  15777. timestamp values.
  15778. In order to submit one frame to output, these filters need to enqueue
  15779. at least one frame for each input, so they cannot work in case one
  15780. input is not yet terminated and will not receive incoming frames.
  15781. For example consider the case when one input is a @code{select} filter
  15782. which always drops input frames. The @code{interleave} filter will keep
  15783. reading from that input, but it will never be able to send new frames
  15784. to output until the input sends an end-of-stream signal.
  15785. Also, depending on inputs synchronization, the filters will drop
  15786. frames in case one input receives more frames than the other ones, and
  15787. the queue is already filled.
  15788. These filters accept the following options:
  15789. @table @option
  15790. @item nb_inputs, n
  15791. Set the number of different inputs, it is 2 by default.
  15792. @end table
  15793. @subsection Examples
  15794. @itemize
  15795. @item
  15796. Interleave frames belonging to different streams using @command{ffmpeg}:
  15797. @example
  15798. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15799. @end example
  15800. @item
  15801. Add flickering blur effect:
  15802. @example
  15803. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15804. @end example
  15805. @end itemize
  15806. @section metadata, ametadata
  15807. Manipulate frame metadata.
  15808. This filter accepts the following options:
  15809. @table @option
  15810. @item mode
  15811. Set mode of operation of the filter.
  15812. Can be one of the following:
  15813. @table @samp
  15814. @item select
  15815. If both @code{value} and @code{key} is set, select frames
  15816. which have such metadata. If only @code{key} is set, select
  15817. every frame that has such key in metadata.
  15818. @item add
  15819. Add new metadata @code{key} and @code{value}. If key is already available
  15820. do nothing.
  15821. @item modify
  15822. Modify value of already present key.
  15823. @item delete
  15824. If @code{value} is set, delete only keys that have such value.
  15825. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15826. the frame.
  15827. @item print
  15828. Print key and its value if metadata was found. If @code{key} is not set print all
  15829. metadata values available in frame.
  15830. @end table
  15831. @item key
  15832. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15833. @item value
  15834. Set metadata value which will be used. This option is mandatory for
  15835. @code{modify} and @code{add} mode.
  15836. @item function
  15837. Which function to use when comparing metadata value and @code{value}.
  15838. Can be one of following:
  15839. @table @samp
  15840. @item same_str
  15841. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15842. @item starts_with
  15843. Values are interpreted as strings, returns true if metadata value starts with
  15844. the @code{value} option string.
  15845. @item less
  15846. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15847. @item equal
  15848. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15849. @item greater
  15850. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15851. @item expr
  15852. Values are interpreted as floats, returns true if expression from option @code{expr}
  15853. evaluates to true.
  15854. @end table
  15855. @item expr
  15856. Set expression which is used when @code{function} is set to @code{expr}.
  15857. The expression is evaluated through the eval API and can contain the following
  15858. constants:
  15859. @table @option
  15860. @item VALUE1
  15861. Float representation of @code{value} from metadata key.
  15862. @item VALUE2
  15863. Float representation of @code{value} as supplied by user in @code{value} option.
  15864. @end table
  15865. @item file
  15866. If specified in @code{print} mode, output is written to the named file. Instead of
  15867. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15868. for standard output. If @code{file} option is not set, output is written to the log
  15869. with AV_LOG_INFO loglevel.
  15870. @end table
  15871. @subsection Examples
  15872. @itemize
  15873. @item
  15874. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15875. between 0 and 1.
  15876. @example
  15877. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15878. @end example
  15879. @item
  15880. Print silencedetect output to file @file{metadata.txt}.
  15881. @example
  15882. silencedetect,ametadata=mode=print:file=metadata.txt
  15883. @end example
  15884. @item
  15885. Direct all metadata to a pipe with file descriptor 4.
  15886. @example
  15887. metadata=mode=print:file='pipe\:4'
  15888. @end example
  15889. @end itemize
  15890. @section perms, aperms
  15891. Set read/write permissions for the output frames.
  15892. These filters are mainly aimed at developers to test direct path in the
  15893. following filter in the filtergraph.
  15894. The filters accept the following options:
  15895. @table @option
  15896. @item mode
  15897. Select the permissions mode.
  15898. It accepts the following values:
  15899. @table @samp
  15900. @item none
  15901. Do nothing. This is the default.
  15902. @item ro
  15903. Set all the output frames read-only.
  15904. @item rw
  15905. Set all the output frames directly writable.
  15906. @item toggle
  15907. Make the frame read-only if writable, and writable if read-only.
  15908. @item random
  15909. Set each output frame read-only or writable randomly.
  15910. @end table
  15911. @item seed
  15912. Set the seed for the @var{random} mode, must be an integer included between
  15913. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15914. @code{-1}, the filter will try to use a good random seed on a best effort
  15915. basis.
  15916. @end table
  15917. Note: in case of auto-inserted filter between the permission filter and the
  15918. following one, the permission might not be received as expected in that
  15919. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15920. perms/aperms filter can avoid this problem.
  15921. @section realtime, arealtime
  15922. Slow down filtering to match real time approximately.
  15923. These filters will pause the filtering for a variable amount of time to
  15924. match the output rate with the input timestamps.
  15925. They are similar to the @option{re} option to @code{ffmpeg}.
  15926. They accept the following options:
  15927. @table @option
  15928. @item limit
  15929. Time limit for the pauses. Any pause longer than that will be considered
  15930. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15931. @end table
  15932. @anchor{select}
  15933. @section select, aselect
  15934. Select frames to pass in output.
  15935. This filter accepts the following options:
  15936. @table @option
  15937. @item expr, e
  15938. Set expression, which is evaluated for each input frame.
  15939. If the expression is evaluated to zero, the frame is discarded.
  15940. If the evaluation result is negative or NaN, the frame is sent to the
  15941. first output; otherwise it is sent to the output with index
  15942. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15943. For example a value of @code{1.2} corresponds to the output with index
  15944. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15945. @item outputs, n
  15946. Set the number of outputs. The output to which to send the selected
  15947. frame is based on the result of the evaluation. Default value is 1.
  15948. @end table
  15949. The expression can contain the following constants:
  15950. @table @option
  15951. @item n
  15952. The (sequential) number of the filtered frame, starting from 0.
  15953. @item selected_n
  15954. The (sequential) number of the selected frame, starting from 0.
  15955. @item prev_selected_n
  15956. The sequential number of the last selected frame. It's NAN if undefined.
  15957. @item TB
  15958. The timebase of the input timestamps.
  15959. @item pts
  15960. The PTS (Presentation TimeStamp) of the filtered video frame,
  15961. expressed in @var{TB} units. It's NAN if undefined.
  15962. @item t
  15963. The PTS of the filtered video frame,
  15964. expressed in seconds. It's NAN if undefined.
  15965. @item prev_pts
  15966. The PTS of the previously filtered video frame. It's NAN if undefined.
  15967. @item prev_selected_pts
  15968. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15969. @item prev_selected_t
  15970. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15971. @item start_pts
  15972. The PTS of the first video frame in the video. It's NAN if undefined.
  15973. @item start_t
  15974. The time of the first video frame in the video. It's NAN if undefined.
  15975. @item pict_type @emph{(video only)}
  15976. The type of the filtered frame. It can assume one of the following
  15977. values:
  15978. @table @option
  15979. @item I
  15980. @item P
  15981. @item B
  15982. @item S
  15983. @item SI
  15984. @item SP
  15985. @item BI
  15986. @end table
  15987. @item interlace_type @emph{(video only)}
  15988. The frame interlace type. It can assume one of the following values:
  15989. @table @option
  15990. @item PROGRESSIVE
  15991. The frame is progressive (not interlaced).
  15992. @item TOPFIRST
  15993. The frame is top-field-first.
  15994. @item BOTTOMFIRST
  15995. The frame is bottom-field-first.
  15996. @end table
  15997. @item consumed_sample_n @emph{(audio only)}
  15998. the number of selected samples before the current frame
  15999. @item samples_n @emph{(audio only)}
  16000. the number of samples in the current frame
  16001. @item sample_rate @emph{(audio only)}
  16002. the input sample rate
  16003. @item key
  16004. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16005. @item pos
  16006. the position in the file of the filtered frame, -1 if the information
  16007. is not available (e.g. for synthetic video)
  16008. @item scene @emph{(video only)}
  16009. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16010. probability for the current frame to introduce a new scene, while a higher
  16011. value means the current frame is more likely to be one (see the example below)
  16012. @item concatdec_select
  16013. The concat demuxer can select only part of a concat input file by setting an
  16014. inpoint and an outpoint, but the output packets may not be entirely contained
  16015. in the selected interval. By using this variable, it is possible to skip frames
  16016. generated by the concat demuxer which are not exactly contained in the selected
  16017. interval.
  16018. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16019. and the @var{lavf.concat.duration} packet metadata values which are also
  16020. present in the decoded frames.
  16021. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16022. start_time and either the duration metadata is missing or the frame pts is less
  16023. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16024. missing.
  16025. That basically means that an input frame is selected if its pts is within the
  16026. interval set by the concat demuxer.
  16027. @end table
  16028. The default value of the select expression is "1".
  16029. @subsection Examples
  16030. @itemize
  16031. @item
  16032. Select all frames in input:
  16033. @example
  16034. select
  16035. @end example
  16036. The example above is the same as:
  16037. @example
  16038. select=1
  16039. @end example
  16040. @item
  16041. Skip all frames:
  16042. @example
  16043. select=0
  16044. @end example
  16045. @item
  16046. Select only I-frames:
  16047. @example
  16048. select='eq(pict_type\,I)'
  16049. @end example
  16050. @item
  16051. Select one frame every 100:
  16052. @example
  16053. select='not(mod(n\,100))'
  16054. @end example
  16055. @item
  16056. Select only frames contained in the 10-20 time interval:
  16057. @example
  16058. select=between(t\,10\,20)
  16059. @end example
  16060. @item
  16061. Select only I-frames contained in the 10-20 time interval:
  16062. @example
  16063. select=between(t\,10\,20)*eq(pict_type\,I)
  16064. @end example
  16065. @item
  16066. Select frames with a minimum distance of 10 seconds:
  16067. @example
  16068. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16069. @end example
  16070. @item
  16071. Use aselect to select only audio frames with samples number > 100:
  16072. @example
  16073. aselect='gt(samples_n\,100)'
  16074. @end example
  16075. @item
  16076. Create a mosaic of the first scenes:
  16077. @example
  16078. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16079. @end example
  16080. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16081. choice.
  16082. @item
  16083. Send even and odd frames to separate outputs, and compose them:
  16084. @example
  16085. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16086. @end example
  16087. @item
  16088. Select useful frames from an ffconcat file which is using inpoints and
  16089. outpoints but where the source files are not intra frame only.
  16090. @example
  16091. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16092. @end example
  16093. @end itemize
  16094. @section sendcmd, asendcmd
  16095. Send commands to filters in the filtergraph.
  16096. These filters read commands to be sent to other filters in the
  16097. filtergraph.
  16098. @code{sendcmd} must be inserted between two video filters,
  16099. @code{asendcmd} must be inserted between two audio filters, but apart
  16100. from that they act the same way.
  16101. The specification of commands can be provided in the filter arguments
  16102. with the @var{commands} option, or in a file specified by the
  16103. @var{filename} option.
  16104. These filters accept the following options:
  16105. @table @option
  16106. @item commands, c
  16107. Set the commands to be read and sent to the other filters.
  16108. @item filename, f
  16109. Set the filename of the commands to be read and sent to the other
  16110. filters.
  16111. @end table
  16112. @subsection Commands syntax
  16113. A commands description consists of a sequence of interval
  16114. specifications, comprising a list of commands to be executed when a
  16115. particular event related to that interval occurs. The occurring event
  16116. is typically the current frame time entering or leaving a given time
  16117. interval.
  16118. An interval is specified by the following syntax:
  16119. @example
  16120. @var{START}[-@var{END}] @var{COMMANDS};
  16121. @end example
  16122. The time interval is specified by the @var{START} and @var{END} times.
  16123. @var{END} is optional and defaults to the maximum time.
  16124. The current frame time is considered within the specified interval if
  16125. it is included in the interval [@var{START}, @var{END}), that is when
  16126. the time is greater or equal to @var{START} and is lesser than
  16127. @var{END}.
  16128. @var{COMMANDS} consists of a sequence of one or more command
  16129. specifications, separated by ",", relating to that interval. The
  16130. syntax of a command specification is given by:
  16131. @example
  16132. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16133. @end example
  16134. @var{FLAGS} is optional and specifies the type of events relating to
  16135. the time interval which enable sending the specified command, and must
  16136. be a non-null sequence of identifier flags separated by "+" or "|" and
  16137. enclosed between "[" and "]".
  16138. The following flags are recognized:
  16139. @table @option
  16140. @item enter
  16141. The command is sent when the current frame timestamp enters the
  16142. specified interval. In other words, the command is sent when the
  16143. previous frame timestamp was not in the given interval, and the
  16144. current is.
  16145. @item leave
  16146. The command is sent when the current frame timestamp leaves the
  16147. specified interval. In other words, the command is sent when the
  16148. previous frame timestamp was in the given interval, and the
  16149. current is not.
  16150. @end table
  16151. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16152. assumed.
  16153. @var{TARGET} specifies the target of the command, usually the name of
  16154. the filter class or a specific filter instance name.
  16155. @var{COMMAND} specifies the name of the command for the target filter.
  16156. @var{ARG} is optional and specifies the optional list of argument for
  16157. the given @var{COMMAND}.
  16158. Between one interval specification and another, whitespaces, or
  16159. sequences of characters starting with @code{#} until the end of line,
  16160. are ignored and can be used to annotate comments.
  16161. A simplified BNF description of the commands specification syntax
  16162. follows:
  16163. @example
  16164. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16165. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16166. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16167. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16168. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16169. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16170. @end example
  16171. @subsection Examples
  16172. @itemize
  16173. @item
  16174. Specify audio tempo change at second 4:
  16175. @example
  16176. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16177. @end example
  16178. @item
  16179. Target a specific filter instance:
  16180. @example
  16181. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16182. @end example
  16183. @item
  16184. Specify a list of drawtext and hue commands in a file.
  16185. @example
  16186. # show text in the interval 5-10
  16187. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16188. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16189. # desaturate the image in the interval 15-20
  16190. 15.0-20.0 [enter] hue s 0,
  16191. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16192. [leave] hue s 1,
  16193. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16194. # apply an exponential saturation fade-out effect, starting from time 25
  16195. 25 [enter] hue s exp(25-t)
  16196. @end example
  16197. A filtergraph allowing to read and process the above command list
  16198. stored in a file @file{test.cmd}, can be specified with:
  16199. @example
  16200. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16201. @end example
  16202. @end itemize
  16203. @anchor{setpts}
  16204. @section setpts, asetpts
  16205. Change the PTS (presentation timestamp) of the input frames.
  16206. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16207. This filter accepts the following options:
  16208. @table @option
  16209. @item expr
  16210. The expression which is evaluated for each frame to construct its timestamp.
  16211. @end table
  16212. The expression is evaluated through the eval API and can contain the following
  16213. constants:
  16214. @table @option
  16215. @item FRAME_RATE, FR
  16216. frame rate, only defined for constant frame-rate video
  16217. @item PTS
  16218. The presentation timestamp in input
  16219. @item N
  16220. The count of the input frame for video or the number of consumed samples,
  16221. not including the current frame for audio, starting from 0.
  16222. @item NB_CONSUMED_SAMPLES
  16223. The number of consumed samples, not including the current frame (only
  16224. audio)
  16225. @item NB_SAMPLES, S
  16226. The number of samples in the current frame (only audio)
  16227. @item SAMPLE_RATE, SR
  16228. The audio sample rate.
  16229. @item STARTPTS
  16230. The PTS of the first frame.
  16231. @item STARTT
  16232. the time in seconds of the first frame
  16233. @item INTERLACED
  16234. State whether the current frame is interlaced.
  16235. @item T
  16236. the time in seconds of the current frame
  16237. @item POS
  16238. original position in the file of the frame, or undefined if undefined
  16239. for the current frame
  16240. @item PREV_INPTS
  16241. The previous input PTS.
  16242. @item PREV_INT
  16243. previous input time in seconds
  16244. @item PREV_OUTPTS
  16245. The previous output PTS.
  16246. @item PREV_OUTT
  16247. previous output time in seconds
  16248. @item RTCTIME
  16249. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16250. instead.
  16251. @item RTCSTART
  16252. The wallclock (RTC) time at the start of the movie in microseconds.
  16253. @item TB
  16254. The timebase of the input timestamps.
  16255. @end table
  16256. @subsection Examples
  16257. @itemize
  16258. @item
  16259. Start counting PTS from zero
  16260. @example
  16261. setpts=PTS-STARTPTS
  16262. @end example
  16263. @item
  16264. Apply fast motion effect:
  16265. @example
  16266. setpts=0.5*PTS
  16267. @end example
  16268. @item
  16269. Apply slow motion effect:
  16270. @example
  16271. setpts=2.0*PTS
  16272. @end example
  16273. @item
  16274. Set fixed rate of 25 frames per second:
  16275. @example
  16276. setpts=N/(25*TB)
  16277. @end example
  16278. @item
  16279. Set fixed rate 25 fps with some jitter:
  16280. @example
  16281. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16282. @end example
  16283. @item
  16284. Apply an offset of 10 seconds to the input PTS:
  16285. @example
  16286. setpts=PTS+10/TB
  16287. @end example
  16288. @item
  16289. Generate timestamps from a "live source" and rebase onto the current timebase:
  16290. @example
  16291. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16292. @end example
  16293. @item
  16294. Generate timestamps by counting samples:
  16295. @example
  16296. asetpts=N/SR/TB
  16297. @end example
  16298. @end itemize
  16299. @section setrange
  16300. Force color range for the output video frame.
  16301. The @code{setrange} filter marks the color range property for the
  16302. output frames. It does not change the input frame, but only sets the
  16303. corresponding property, which affects how the frame is treated by
  16304. following filters.
  16305. The filter accepts the following options:
  16306. @table @option
  16307. @item range
  16308. Available values are:
  16309. @table @samp
  16310. @item auto
  16311. Keep the same color range property.
  16312. @item unspecified, unknown
  16313. Set the color range as unspecified.
  16314. @item limited, tv, mpeg
  16315. Set the color range as limited.
  16316. @item full, pc, jpeg
  16317. Set the color range as full.
  16318. @end table
  16319. @end table
  16320. @section settb, asettb
  16321. Set the timebase to use for the output frames timestamps.
  16322. It is mainly useful for testing timebase configuration.
  16323. It accepts the following parameters:
  16324. @table @option
  16325. @item expr, tb
  16326. The expression which is evaluated into the output timebase.
  16327. @end table
  16328. The value for @option{tb} is an arithmetic expression representing a
  16329. rational. The expression can contain the constants "AVTB" (the default
  16330. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16331. audio only). Default value is "intb".
  16332. @subsection Examples
  16333. @itemize
  16334. @item
  16335. Set the timebase to 1/25:
  16336. @example
  16337. settb=expr=1/25
  16338. @end example
  16339. @item
  16340. Set the timebase to 1/10:
  16341. @example
  16342. settb=expr=0.1
  16343. @end example
  16344. @item
  16345. Set the timebase to 1001/1000:
  16346. @example
  16347. settb=1+0.001
  16348. @end example
  16349. @item
  16350. Set the timebase to 2*intb:
  16351. @example
  16352. settb=2*intb
  16353. @end example
  16354. @item
  16355. Set the default timebase value:
  16356. @example
  16357. settb=AVTB
  16358. @end example
  16359. @end itemize
  16360. @section showcqt
  16361. Convert input audio to a video output representing frequency spectrum
  16362. logarithmically using Brown-Puckette constant Q transform algorithm with
  16363. direct frequency domain coefficient calculation (but the transform itself
  16364. is not really constant Q, instead the Q factor is actually variable/clamped),
  16365. with musical tone scale, from E0 to D#10.
  16366. The filter accepts the following options:
  16367. @table @option
  16368. @item size, s
  16369. Specify the video size for the output. It must be even. For the syntax of this option,
  16370. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16371. Default value is @code{1920x1080}.
  16372. @item fps, rate, r
  16373. Set the output frame rate. Default value is @code{25}.
  16374. @item bar_h
  16375. Set the bargraph height. It must be even. Default value is @code{-1} which
  16376. computes the bargraph height automatically.
  16377. @item axis_h
  16378. Set the axis height. It must be even. Default value is @code{-1} which computes
  16379. the axis height automatically.
  16380. @item sono_h
  16381. Set the sonogram height. It must be even. Default value is @code{-1} which
  16382. computes the sonogram height automatically.
  16383. @item fullhd
  16384. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16385. instead. Default value is @code{1}.
  16386. @item sono_v, volume
  16387. Specify the sonogram volume expression. It can contain variables:
  16388. @table @option
  16389. @item bar_v
  16390. the @var{bar_v} evaluated expression
  16391. @item frequency, freq, f
  16392. the frequency where it is evaluated
  16393. @item timeclamp, tc
  16394. the value of @var{timeclamp} option
  16395. @end table
  16396. and functions:
  16397. @table @option
  16398. @item a_weighting(f)
  16399. A-weighting of equal loudness
  16400. @item b_weighting(f)
  16401. B-weighting of equal loudness
  16402. @item c_weighting(f)
  16403. C-weighting of equal loudness.
  16404. @end table
  16405. Default value is @code{16}.
  16406. @item bar_v, volume2
  16407. Specify the bargraph volume expression. It can contain variables:
  16408. @table @option
  16409. @item sono_v
  16410. the @var{sono_v} evaluated expression
  16411. @item frequency, freq, f
  16412. the frequency where it is evaluated
  16413. @item timeclamp, tc
  16414. the value of @var{timeclamp} option
  16415. @end table
  16416. and functions:
  16417. @table @option
  16418. @item a_weighting(f)
  16419. A-weighting of equal loudness
  16420. @item b_weighting(f)
  16421. B-weighting of equal loudness
  16422. @item c_weighting(f)
  16423. C-weighting of equal loudness.
  16424. @end table
  16425. Default value is @code{sono_v}.
  16426. @item sono_g, gamma
  16427. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16428. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16429. Acceptable range is @code{[1, 7]}.
  16430. @item bar_g, gamma2
  16431. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16432. @code{[1, 7]}.
  16433. @item bar_t
  16434. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16435. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16436. @item timeclamp, tc
  16437. Specify the transform timeclamp. At low frequency, there is trade-off between
  16438. accuracy in time domain and frequency domain. If timeclamp is lower,
  16439. event in time domain is represented more accurately (such as fast bass drum),
  16440. otherwise event in frequency domain is represented more accurately
  16441. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16442. @item attack
  16443. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16444. limits future samples by applying asymmetric windowing in time domain, useful
  16445. when low latency is required. Accepted range is @code{[0, 1]}.
  16446. @item basefreq
  16447. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16448. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16449. @item endfreq
  16450. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16451. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16452. @item coeffclamp
  16453. This option is deprecated and ignored.
  16454. @item tlength
  16455. Specify the transform length in time domain. Use this option to control accuracy
  16456. trade-off between time domain and frequency domain at every frequency sample.
  16457. It can contain variables:
  16458. @table @option
  16459. @item frequency, freq, f
  16460. the frequency where it is evaluated
  16461. @item timeclamp, tc
  16462. the value of @var{timeclamp} option.
  16463. @end table
  16464. Default value is @code{384*tc/(384+tc*f)}.
  16465. @item count
  16466. Specify the transform count for every video frame. Default value is @code{6}.
  16467. Acceptable range is @code{[1, 30]}.
  16468. @item fcount
  16469. Specify the transform count for every single pixel. Default value is @code{0},
  16470. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16471. @item fontfile
  16472. Specify font file for use with freetype to draw the axis. If not specified,
  16473. use embedded font. Note that drawing with font file or embedded font is not
  16474. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16475. option instead.
  16476. @item font
  16477. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16478. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16479. @item fontcolor
  16480. Specify font color expression. This is arithmetic expression that should return
  16481. integer value 0xRRGGBB. It can contain variables:
  16482. @table @option
  16483. @item frequency, freq, f
  16484. the frequency where it is evaluated
  16485. @item timeclamp, tc
  16486. the value of @var{timeclamp} option
  16487. @end table
  16488. and functions:
  16489. @table @option
  16490. @item midi(f)
  16491. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16492. @item r(x), g(x), b(x)
  16493. red, green, and blue value of intensity x.
  16494. @end table
  16495. Default value is @code{st(0, (midi(f)-59.5)/12);
  16496. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16497. r(1-ld(1)) + b(ld(1))}.
  16498. @item axisfile
  16499. Specify image file to draw the axis. This option override @var{fontfile} and
  16500. @var{fontcolor} option.
  16501. @item axis, text
  16502. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16503. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16504. Default value is @code{1}.
  16505. @item csp
  16506. Set colorspace. The accepted values are:
  16507. @table @samp
  16508. @item unspecified
  16509. Unspecified (default)
  16510. @item bt709
  16511. BT.709
  16512. @item fcc
  16513. FCC
  16514. @item bt470bg
  16515. BT.470BG or BT.601-6 625
  16516. @item smpte170m
  16517. SMPTE-170M or BT.601-6 525
  16518. @item smpte240m
  16519. SMPTE-240M
  16520. @item bt2020ncl
  16521. BT.2020 with non-constant luminance
  16522. @end table
  16523. @item cscheme
  16524. Set spectrogram color scheme. This is list of floating point values with format
  16525. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16526. The default is @code{1|0.5|0|0|0.5|1}.
  16527. @end table
  16528. @subsection Examples
  16529. @itemize
  16530. @item
  16531. Playing audio while showing the spectrum:
  16532. @example
  16533. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16534. @end example
  16535. @item
  16536. Same as above, but with frame rate 30 fps:
  16537. @example
  16538. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16539. @end example
  16540. @item
  16541. Playing at 1280x720:
  16542. @example
  16543. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16544. @end example
  16545. @item
  16546. Disable sonogram display:
  16547. @example
  16548. sono_h=0
  16549. @end example
  16550. @item
  16551. A1 and its harmonics: A1, A2, (near)E3, A3:
  16552. @example
  16553. 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),
  16554. asplit[a][out1]; [a] showcqt [out0]'
  16555. @end example
  16556. @item
  16557. Same as above, but with more accuracy in frequency domain:
  16558. @example
  16559. 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),
  16560. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16561. @end example
  16562. @item
  16563. Custom volume:
  16564. @example
  16565. bar_v=10:sono_v=bar_v*a_weighting(f)
  16566. @end example
  16567. @item
  16568. Custom gamma, now spectrum is linear to the amplitude.
  16569. @example
  16570. bar_g=2:sono_g=2
  16571. @end example
  16572. @item
  16573. Custom tlength equation:
  16574. @example
  16575. 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)))'
  16576. @end example
  16577. @item
  16578. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16579. @example
  16580. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16581. @end example
  16582. @item
  16583. Custom font using fontconfig:
  16584. @example
  16585. font='Courier New,Monospace,mono|bold'
  16586. @end example
  16587. @item
  16588. Custom frequency range with custom axis using image file:
  16589. @example
  16590. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16591. @end example
  16592. @end itemize
  16593. @section showfreqs
  16594. Convert input audio to video output representing the audio power spectrum.
  16595. Audio amplitude is on Y-axis while frequency is on X-axis.
  16596. The filter accepts the following options:
  16597. @table @option
  16598. @item size, s
  16599. Specify size of video. For the syntax of this option, check the
  16600. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16601. Default is @code{1024x512}.
  16602. @item mode
  16603. Set display mode.
  16604. This set how each frequency bin will be represented.
  16605. It accepts the following values:
  16606. @table @samp
  16607. @item line
  16608. @item bar
  16609. @item dot
  16610. @end table
  16611. Default is @code{bar}.
  16612. @item ascale
  16613. Set amplitude scale.
  16614. It accepts the following values:
  16615. @table @samp
  16616. @item lin
  16617. Linear scale.
  16618. @item sqrt
  16619. Square root scale.
  16620. @item cbrt
  16621. Cubic root scale.
  16622. @item log
  16623. Logarithmic scale.
  16624. @end table
  16625. Default is @code{log}.
  16626. @item fscale
  16627. Set frequency scale.
  16628. It accepts the following values:
  16629. @table @samp
  16630. @item lin
  16631. Linear scale.
  16632. @item log
  16633. Logarithmic scale.
  16634. @item rlog
  16635. Reverse logarithmic scale.
  16636. @end table
  16637. Default is @code{lin}.
  16638. @item win_size
  16639. Set window size.
  16640. It accepts the following values:
  16641. @table @samp
  16642. @item w16
  16643. @item w32
  16644. @item w64
  16645. @item w128
  16646. @item w256
  16647. @item w512
  16648. @item w1024
  16649. @item w2048
  16650. @item w4096
  16651. @item w8192
  16652. @item w16384
  16653. @item w32768
  16654. @item w65536
  16655. @end table
  16656. Default is @code{w2048}
  16657. @item win_func
  16658. Set windowing function.
  16659. It accepts the following values:
  16660. @table @samp
  16661. @item rect
  16662. @item bartlett
  16663. @item hanning
  16664. @item hamming
  16665. @item blackman
  16666. @item welch
  16667. @item flattop
  16668. @item bharris
  16669. @item bnuttall
  16670. @item bhann
  16671. @item sine
  16672. @item nuttall
  16673. @item lanczos
  16674. @item gauss
  16675. @item tukey
  16676. @item dolph
  16677. @item cauchy
  16678. @item parzen
  16679. @item poisson
  16680. @item bohman
  16681. @end table
  16682. Default is @code{hanning}.
  16683. @item overlap
  16684. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16685. which means optimal overlap for selected window function will be picked.
  16686. @item averaging
  16687. Set time averaging. Setting this to 0 will display current maximal peaks.
  16688. Default is @code{1}, which means time averaging is disabled.
  16689. @item colors
  16690. Specify list of colors separated by space or by '|' which will be used to
  16691. draw channel frequencies. Unrecognized or missing colors will be replaced
  16692. by white color.
  16693. @item cmode
  16694. Set channel display mode.
  16695. It accepts the following values:
  16696. @table @samp
  16697. @item combined
  16698. @item separate
  16699. @end table
  16700. Default is @code{combined}.
  16701. @item minamp
  16702. Set minimum amplitude used in @code{log} amplitude scaler.
  16703. @end table
  16704. @anchor{showspectrum}
  16705. @section showspectrum
  16706. Convert input audio to a video output, representing the audio frequency
  16707. spectrum.
  16708. The filter accepts the following options:
  16709. @table @option
  16710. @item size, s
  16711. Specify the video size for the output. For the syntax of this option, check the
  16712. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16713. Default value is @code{640x512}.
  16714. @item slide
  16715. Specify how the spectrum should slide along the window.
  16716. It accepts the following values:
  16717. @table @samp
  16718. @item replace
  16719. the samples start again on the left when they reach the right
  16720. @item scroll
  16721. the samples scroll from right to left
  16722. @item fullframe
  16723. frames are only produced when the samples reach the right
  16724. @item rscroll
  16725. the samples scroll from left to right
  16726. @end table
  16727. Default value is @code{replace}.
  16728. @item mode
  16729. Specify display mode.
  16730. It accepts the following values:
  16731. @table @samp
  16732. @item combined
  16733. all channels are displayed in the same row
  16734. @item separate
  16735. all channels are displayed in separate rows
  16736. @end table
  16737. Default value is @samp{combined}.
  16738. @item color
  16739. Specify display color mode.
  16740. It accepts the following values:
  16741. @table @samp
  16742. @item channel
  16743. each channel is displayed in a separate color
  16744. @item intensity
  16745. each channel is displayed using the same color scheme
  16746. @item rainbow
  16747. each channel is displayed using the rainbow color scheme
  16748. @item moreland
  16749. each channel is displayed using the moreland color scheme
  16750. @item nebulae
  16751. each channel is displayed using the nebulae color scheme
  16752. @item fire
  16753. each channel is displayed using the fire color scheme
  16754. @item fiery
  16755. each channel is displayed using the fiery color scheme
  16756. @item fruit
  16757. each channel is displayed using the fruit color scheme
  16758. @item cool
  16759. each channel is displayed using the cool color scheme
  16760. @item magma
  16761. each channel is displayed using the magma color scheme
  16762. @item green
  16763. each channel is displayed using the green color scheme
  16764. @item viridis
  16765. each channel is displayed using the viridis color scheme
  16766. @item plasma
  16767. each channel is displayed using the plasma color scheme
  16768. @item cividis
  16769. each channel is displayed using the cividis color scheme
  16770. @item terrain
  16771. each channel is displayed using the terrain color scheme
  16772. @end table
  16773. Default value is @samp{channel}.
  16774. @item scale
  16775. Specify scale used for calculating intensity color values.
  16776. It accepts the following values:
  16777. @table @samp
  16778. @item lin
  16779. linear
  16780. @item sqrt
  16781. square root, default
  16782. @item cbrt
  16783. cubic root
  16784. @item log
  16785. logarithmic
  16786. @item 4thrt
  16787. 4th root
  16788. @item 5thrt
  16789. 5th root
  16790. @end table
  16791. Default value is @samp{sqrt}.
  16792. @item saturation
  16793. Set saturation modifier for displayed colors. Negative values provide
  16794. alternative color scheme. @code{0} is no saturation at all.
  16795. Saturation must be in [-10.0, 10.0] range.
  16796. Default value is @code{1}.
  16797. @item win_func
  16798. Set window function.
  16799. It accepts the following values:
  16800. @table @samp
  16801. @item rect
  16802. @item bartlett
  16803. @item hann
  16804. @item hanning
  16805. @item hamming
  16806. @item blackman
  16807. @item welch
  16808. @item flattop
  16809. @item bharris
  16810. @item bnuttall
  16811. @item bhann
  16812. @item sine
  16813. @item nuttall
  16814. @item lanczos
  16815. @item gauss
  16816. @item tukey
  16817. @item dolph
  16818. @item cauchy
  16819. @item parzen
  16820. @item poisson
  16821. @item bohman
  16822. @end table
  16823. Default value is @code{hann}.
  16824. @item orientation
  16825. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16826. @code{horizontal}. Default is @code{vertical}.
  16827. @item overlap
  16828. Set ratio of overlap window. Default value is @code{0}.
  16829. When value is @code{1} overlap is set to recommended size for specific
  16830. window function currently used.
  16831. @item gain
  16832. Set scale gain for calculating intensity color values.
  16833. Default value is @code{1}.
  16834. @item data
  16835. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16836. @item rotation
  16837. Set color rotation, must be in [-1.0, 1.0] range.
  16838. Default value is @code{0}.
  16839. @item start
  16840. Set start frequency from which to display spectrogram. Default is @code{0}.
  16841. @item stop
  16842. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16843. @item fps
  16844. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16845. @item legend
  16846. Draw time and frequency axes and legends. Default is disabled.
  16847. @end table
  16848. The usage is very similar to the showwaves filter; see the examples in that
  16849. section.
  16850. @subsection Examples
  16851. @itemize
  16852. @item
  16853. Large window with logarithmic color scaling:
  16854. @example
  16855. showspectrum=s=1280x480:scale=log
  16856. @end example
  16857. @item
  16858. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16859. @example
  16860. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16861. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16862. @end example
  16863. @end itemize
  16864. @section showspectrumpic
  16865. Convert input audio to a single video frame, representing the audio frequency
  16866. spectrum.
  16867. The filter accepts the following options:
  16868. @table @option
  16869. @item size, s
  16870. Specify the video size for the output. For the syntax of this option, check the
  16871. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16872. Default value is @code{4096x2048}.
  16873. @item mode
  16874. Specify display mode.
  16875. It accepts the following values:
  16876. @table @samp
  16877. @item combined
  16878. all channels are displayed in the same row
  16879. @item separate
  16880. all channels are displayed in separate rows
  16881. @end table
  16882. Default value is @samp{combined}.
  16883. @item color
  16884. Specify display color mode.
  16885. It accepts the following values:
  16886. @table @samp
  16887. @item channel
  16888. each channel is displayed in a separate color
  16889. @item intensity
  16890. each channel is displayed using the same color scheme
  16891. @item rainbow
  16892. each channel is displayed using the rainbow color scheme
  16893. @item moreland
  16894. each channel is displayed using the moreland color scheme
  16895. @item nebulae
  16896. each channel is displayed using the nebulae color scheme
  16897. @item fire
  16898. each channel is displayed using the fire color scheme
  16899. @item fiery
  16900. each channel is displayed using the fiery color scheme
  16901. @item fruit
  16902. each channel is displayed using the fruit color scheme
  16903. @item cool
  16904. each channel is displayed using the cool color scheme
  16905. @item magma
  16906. each channel is displayed using the magma color scheme
  16907. @item green
  16908. each channel is displayed using the green color scheme
  16909. @item viridis
  16910. each channel is displayed using the viridis color scheme
  16911. @item plasma
  16912. each channel is displayed using the plasma color scheme
  16913. @item cividis
  16914. each channel is displayed using the cividis color scheme
  16915. @item terrain
  16916. each channel is displayed using the terrain color scheme
  16917. @end table
  16918. Default value is @samp{intensity}.
  16919. @item scale
  16920. Specify scale used for calculating intensity color values.
  16921. It accepts the following values:
  16922. @table @samp
  16923. @item lin
  16924. linear
  16925. @item sqrt
  16926. square root, default
  16927. @item cbrt
  16928. cubic root
  16929. @item log
  16930. logarithmic
  16931. @item 4thrt
  16932. 4th root
  16933. @item 5thrt
  16934. 5th root
  16935. @end table
  16936. Default value is @samp{log}.
  16937. @item saturation
  16938. Set saturation modifier for displayed colors. Negative values provide
  16939. alternative color scheme. @code{0} is no saturation at all.
  16940. Saturation must be in [-10.0, 10.0] range.
  16941. Default value is @code{1}.
  16942. @item win_func
  16943. Set window function.
  16944. It accepts the following values:
  16945. @table @samp
  16946. @item rect
  16947. @item bartlett
  16948. @item hann
  16949. @item hanning
  16950. @item hamming
  16951. @item blackman
  16952. @item welch
  16953. @item flattop
  16954. @item bharris
  16955. @item bnuttall
  16956. @item bhann
  16957. @item sine
  16958. @item nuttall
  16959. @item lanczos
  16960. @item gauss
  16961. @item tukey
  16962. @item dolph
  16963. @item cauchy
  16964. @item parzen
  16965. @item poisson
  16966. @item bohman
  16967. @end table
  16968. Default value is @code{hann}.
  16969. @item orientation
  16970. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16971. @code{horizontal}. Default is @code{vertical}.
  16972. @item gain
  16973. Set scale gain for calculating intensity color values.
  16974. Default value is @code{1}.
  16975. @item legend
  16976. Draw time and frequency axes and legends. Default is enabled.
  16977. @item rotation
  16978. Set color rotation, must be in [-1.0, 1.0] range.
  16979. Default value is @code{0}.
  16980. @item start
  16981. Set start frequency from which to display spectrogram. Default is @code{0}.
  16982. @item stop
  16983. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16984. @end table
  16985. @subsection Examples
  16986. @itemize
  16987. @item
  16988. Extract an audio spectrogram of a whole audio track
  16989. in a 1024x1024 picture using @command{ffmpeg}:
  16990. @example
  16991. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16992. @end example
  16993. @end itemize
  16994. @section showvolume
  16995. Convert input audio volume to a video output.
  16996. The filter accepts the following options:
  16997. @table @option
  16998. @item rate, r
  16999. Set video rate.
  17000. @item b
  17001. Set border width, allowed range is [0, 5]. Default is 1.
  17002. @item w
  17003. Set channel width, allowed range is [80, 8192]. Default is 400.
  17004. @item h
  17005. Set channel height, allowed range is [1, 900]. Default is 20.
  17006. @item f
  17007. Set fade, allowed range is [0, 1]. Default is 0.95.
  17008. @item c
  17009. Set volume color expression.
  17010. The expression can use the following variables:
  17011. @table @option
  17012. @item VOLUME
  17013. Current max volume of channel in dB.
  17014. @item PEAK
  17015. Current peak.
  17016. @item CHANNEL
  17017. Current channel number, starting from 0.
  17018. @end table
  17019. @item t
  17020. If set, displays channel names. Default is enabled.
  17021. @item v
  17022. If set, displays volume values. Default is enabled.
  17023. @item o
  17024. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17025. default is @code{h}.
  17026. @item s
  17027. Set step size, allowed range is [0, 5]. Default is 0, which means
  17028. step is disabled.
  17029. @item p
  17030. Set background opacity, allowed range is [0, 1]. Default is 0.
  17031. @item m
  17032. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17033. default is @code{p}.
  17034. @item ds
  17035. Set display scale, can be linear: @code{lin} or log: @code{log},
  17036. default is @code{lin}.
  17037. @item dm
  17038. In second.
  17039. If set to > 0., display a line for the max level
  17040. in the previous seconds.
  17041. default is disabled: @code{0.}
  17042. @item dmc
  17043. The color of the max line. Use when @code{dm} option is set to > 0.
  17044. default is: @code{orange}
  17045. @end table
  17046. @section showwaves
  17047. Convert input audio to a video output, representing the samples waves.
  17048. The filter accepts the following options:
  17049. @table @option
  17050. @item size, s
  17051. Specify the video size for the output. For the syntax of this option, check the
  17052. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17053. Default value is @code{600x240}.
  17054. @item mode
  17055. Set display mode.
  17056. Available values are:
  17057. @table @samp
  17058. @item point
  17059. Draw a point for each sample.
  17060. @item line
  17061. Draw a vertical line for each sample.
  17062. @item p2p
  17063. Draw a point for each sample and a line between them.
  17064. @item cline
  17065. Draw a centered vertical line for each sample.
  17066. @end table
  17067. Default value is @code{point}.
  17068. @item n
  17069. Set the number of samples which are printed on the same column. A
  17070. larger value will decrease the frame rate. Must be a positive
  17071. integer. This option can be set only if the value for @var{rate}
  17072. is not explicitly specified.
  17073. @item rate, r
  17074. Set the (approximate) output frame rate. This is done by setting the
  17075. option @var{n}. Default value is "25".
  17076. @item split_channels
  17077. Set if channels should be drawn separately or overlap. Default value is 0.
  17078. @item colors
  17079. Set colors separated by '|' which are going to be used for drawing of each channel.
  17080. @item scale
  17081. Set amplitude scale.
  17082. Available values are:
  17083. @table @samp
  17084. @item lin
  17085. Linear.
  17086. @item log
  17087. Logarithmic.
  17088. @item sqrt
  17089. Square root.
  17090. @item cbrt
  17091. Cubic root.
  17092. @end table
  17093. Default is linear.
  17094. @item draw
  17095. Set the draw mode. This is mostly useful to set for high @var{n}.
  17096. Available values are:
  17097. @table @samp
  17098. @item scale
  17099. Scale pixel values for each drawn sample.
  17100. @item full
  17101. Draw every sample directly.
  17102. @end table
  17103. Default value is @code{scale}.
  17104. @end table
  17105. @subsection Examples
  17106. @itemize
  17107. @item
  17108. Output the input file audio and the corresponding video representation
  17109. at the same time:
  17110. @example
  17111. amovie=a.mp3,asplit[out0],showwaves[out1]
  17112. @end example
  17113. @item
  17114. Create a synthetic signal and show it with showwaves, forcing a
  17115. frame rate of 30 frames per second:
  17116. @example
  17117. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17118. @end example
  17119. @end itemize
  17120. @section showwavespic
  17121. Convert input audio to a single video frame, representing the samples waves.
  17122. The filter accepts the following options:
  17123. @table @option
  17124. @item size, s
  17125. Specify the video size for the output. For the syntax of this option, check the
  17126. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17127. Default value is @code{600x240}.
  17128. @item split_channels
  17129. Set if channels should be drawn separately or overlap. Default value is 0.
  17130. @item colors
  17131. Set colors separated by '|' which are going to be used for drawing of each channel.
  17132. @item scale
  17133. Set amplitude scale.
  17134. Available values are:
  17135. @table @samp
  17136. @item lin
  17137. Linear.
  17138. @item log
  17139. Logarithmic.
  17140. @item sqrt
  17141. Square root.
  17142. @item cbrt
  17143. Cubic root.
  17144. @end table
  17145. Default is linear.
  17146. @end table
  17147. @subsection Examples
  17148. @itemize
  17149. @item
  17150. Extract a channel split representation of the wave form of a whole audio track
  17151. in a 1024x800 picture using @command{ffmpeg}:
  17152. @example
  17153. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17154. @end example
  17155. @end itemize
  17156. @section sidedata, asidedata
  17157. Delete frame side data, or select frames based on it.
  17158. This filter accepts the following options:
  17159. @table @option
  17160. @item mode
  17161. Set mode of operation of the filter.
  17162. Can be one of the following:
  17163. @table @samp
  17164. @item select
  17165. Select every frame with side data of @code{type}.
  17166. @item delete
  17167. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17168. data in the frame.
  17169. @end table
  17170. @item type
  17171. Set side data type used with all modes. Must be set for @code{select} mode. For
  17172. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17173. in @file{libavutil/frame.h}. For example, to choose
  17174. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17175. @end table
  17176. @section spectrumsynth
  17177. Sythesize audio from 2 input video spectrums, first input stream represents
  17178. magnitude across time and second represents phase across time.
  17179. The filter will transform from frequency domain as displayed in videos back
  17180. to time domain as presented in audio output.
  17181. This filter is primarily created for reversing processed @ref{showspectrum}
  17182. filter outputs, but can synthesize sound from other spectrograms too.
  17183. But in such case results are going to be poor if the phase data is not
  17184. available, because in such cases phase data need to be recreated, usually
  17185. it's just recreated from random noise.
  17186. For best results use gray only output (@code{channel} color mode in
  17187. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17188. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17189. @code{data} option. Inputs videos should generally use @code{fullframe}
  17190. slide mode as that saves resources needed for decoding video.
  17191. The filter accepts the following options:
  17192. @table @option
  17193. @item sample_rate
  17194. Specify sample rate of output audio, the sample rate of audio from which
  17195. spectrum was generated may differ.
  17196. @item channels
  17197. Set number of channels represented in input video spectrums.
  17198. @item scale
  17199. Set scale which was used when generating magnitude input spectrum.
  17200. Can be @code{lin} or @code{log}. Default is @code{log}.
  17201. @item slide
  17202. Set slide which was used when generating inputs spectrums.
  17203. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17204. Default is @code{fullframe}.
  17205. @item win_func
  17206. Set window function used for resynthesis.
  17207. @item overlap
  17208. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17209. which means optimal overlap for selected window function will be picked.
  17210. @item orientation
  17211. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17212. Default is @code{vertical}.
  17213. @end table
  17214. @subsection Examples
  17215. @itemize
  17216. @item
  17217. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17218. then resynthesize videos back to audio with spectrumsynth:
  17219. @example
  17220. 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
  17221. 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
  17222. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17223. @end example
  17224. @end itemize
  17225. @section split, asplit
  17226. Split input into several identical outputs.
  17227. @code{asplit} works with audio input, @code{split} with video.
  17228. The filter accepts a single parameter which specifies the number of outputs. If
  17229. unspecified, it defaults to 2.
  17230. @subsection Examples
  17231. @itemize
  17232. @item
  17233. Create two separate outputs from the same input:
  17234. @example
  17235. [in] split [out0][out1]
  17236. @end example
  17237. @item
  17238. To create 3 or more outputs, you need to specify the number of
  17239. outputs, like in:
  17240. @example
  17241. [in] asplit=3 [out0][out1][out2]
  17242. @end example
  17243. @item
  17244. Create two separate outputs from the same input, one cropped and
  17245. one padded:
  17246. @example
  17247. [in] split [splitout1][splitout2];
  17248. [splitout1] crop=100:100:0:0 [cropout];
  17249. [splitout2] pad=200:200:100:100 [padout];
  17250. @end example
  17251. @item
  17252. Create 5 copies of the input audio with @command{ffmpeg}:
  17253. @example
  17254. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17255. @end example
  17256. @end itemize
  17257. @section zmq, azmq
  17258. Receive commands sent through a libzmq client, and forward them to
  17259. filters in the filtergraph.
  17260. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17261. must be inserted between two video filters, @code{azmq} between two
  17262. audio filters. Both are capable to send messages to any filter type.
  17263. To enable these filters you need to install the libzmq library and
  17264. headers and configure FFmpeg with @code{--enable-libzmq}.
  17265. For more information about libzmq see:
  17266. @url{http://www.zeromq.org/}
  17267. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17268. receives messages sent through a network interface defined by the
  17269. @option{bind_address} (or the abbreviation "@option{b}") option.
  17270. Default value of this option is @file{tcp://localhost:5555}. You may
  17271. want to alter this value to your needs, but do not forget to escape any
  17272. ':' signs (see @ref{filtergraph escaping}).
  17273. The received message must be in the form:
  17274. @example
  17275. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17276. @end example
  17277. @var{TARGET} specifies the target of the command, usually the name of
  17278. the filter class or a specific filter instance name. The default
  17279. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17280. but you can override this by using the @samp{filter_name@@id} syntax
  17281. (see @ref{Filtergraph syntax}).
  17282. @var{COMMAND} specifies the name of the command for the target filter.
  17283. @var{ARG} is optional and specifies the optional argument list for the
  17284. given @var{COMMAND}.
  17285. Upon reception, the message is processed and the corresponding command
  17286. is injected into the filtergraph. Depending on the result, the filter
  17287. will send a reply to the client, adopting the format:
  17288. @example
  17289. @var{ERROR_CODE} @var{ERROR_REASON}
  17290. @var{MESSAGE}
  17291. @end example
  17292. @var{MESSAGE} is optional.
  17293. @subsection Examples
  17294. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17295. be used to send commands processed by these filters.
  17296. Consider the following filtergraph generated by @command{ffplay}.
  17297. In this example the last overlay filter has an instance name. All other
  17298. filters will have default instance names.
  17299. @example
  17300. ffplay -dumpgraph 1 -f lavfi "
  17301. color=s=100x100:c=red [l];
  17302. color=s=100x100:c=blue [r];
  17303. nullsrc=s=200x100, zmq [bg];
  17304. [bg][l] overlay [bg+l];
  17305. [bg+l][r] overlay@@my=x=100 "
  17306. @end example
  17307. To change the color of the left side of the video, the following
  17308. command can be used:
  17309. @example
  17310. echo Parsed_color_0 c yellow | tools/zmqsend
  17311. @end example
  17312. To change the right side:
  17313. @example
  17314. echo Parsed_color_1 c pink | tools/zmqsend
  17315. @end example
  17316. To change the position of the right side:
  17317. @example
  17318. echo overlay@@my x 150 | tools/zmqsend
  17319. @end example
  17320. @c man end MULTIMEDIA FILTERS
  17321. @chapter Multimedia Sources
  17322. @c man begin MULTIMEDIA SOURCES
  17323. Below is a description of the currently available multimedia sources.
  17324. @section amovie
  17325. This is the same as @ref{movie} source, except it selects an audio
  17326. stream by default.
  17327. @anchor{movie}
  17328. @section movie
  17329. Read audio and/or video stream(s) from a movie container.
  17330. It accepts the following parameters:
  17331. @table @option
  17332. @item filename
  17333. The name of the resource to read (not necessarily a file; it can also be a
  17334. device or a stream accessed through some protocol).
  17335. @item format_name, f
  17336. Specifies the format assumed for the movie to read, and can be either
  17337. the name of a container or an input device. If not specified, the
  17338. format is guessed from @var{movie_name} or by probing.
  17339. @item seek_point, sp
  17340. Specifies the seek point in seconds. The frames will be output
  17341. starting from this seek point. The parameter is evaluated with
  17342. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17343. postfix. The default value is "0".
  17344. @item streams, s
  17345. Specifies the streams to read. Several streams can be specified,
  17346. separated by "+". The source will then have as many outputs, in the
  17347. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17348. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17349. respectively the default (best suited) video and audio stream. Default
  17350. is "dv", or "da" if the filter is called as "amovie".
  17351. @item stream_index, si
  17352. Specifies the index of the video stream to read. If the value is -1,
  17353. the most suitable video stream will be automatically selected. The default
  17354. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17355. audio instead of video.
  17356. @item loop
  17357. Specifies how many times to read the stream in sequence.
  17358. If the value is 0, the stream will be looped infinitely.
  17359. Default value is "1".
  17360. Note that when the movie is looped the source timestamps are not
  17361. changed, so it will generate non monotonically increasing timestamps.
  17362. @item discontinuity
  17363. Specifies the time difference between frames above which the point is
  17364. considered a timestamp discontinuity which is removed by adjusting the later
  17365. timestamps.
  17366. @end table
  17367. It allows overlaying a second video on top of the main input of
  17368. a filtergraph, as shown in this graph:
  17369. @example
  17370. input -----------> deltapts0 --> overlay --> output
  17371. ^
  17372. |
  17373. movie --> scale--> deltapts1 -------+
  17374. @end example
  17375. @subsection Examples
  17376. @itemize
  17377. @item
  17378. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17379. on top of the input labelled "in":
  17380. @example
  17381. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17382. [in] setpts=PTS-STARTPTS [main];
  17383. [main][over] overlay=16:16 [out]
  17384. @end example
  17385. @item
  17386. Read from a video4linux2 device, and overlay it on top of the input
  17387. labelled "in":
  17388. @example
  17389. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17390. [in] setpts=PTS-STARTPTS [main];
  17391. [main][over] overlay=16:16 [out]
  17392. @end example
  17393. @item
  17394. Read the first video stream and the audio stream with id 0x81 from
  17395. dvd.vob; the video is connected to the pad named "video" and the audio is
  17396. connected to the pad named "audio":
  17397. @example
  17398. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17399. @end example
  17400. @end itemize
  17401. @subsection Commands
  17402. Both movie and amovie support the following commands:
  17403. @table @option
  17404. @item seek
  17405. Perform seek using "av_seek_frame".
  17406. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17407. @itemize
  17408. @item
  17409. @var{stream_index}: If stream_index is -1, a default
  17410. stream is selected, and @var{timestamp} is automatically converted
  17411. from AV_TIME_BASE units to the stream specific time_base.
  17412. @item
  17413. @var{timestamp}: Timestamp in AVStream.time_base units
  17414. or, if no stream is specified, in AV_TIME_BASE units.
  17415. @item
  17416. @var{flags}: Flags which select direction and seeking mode.
  17417. @end itemize
  17418. @item get_duration
  17419. Get movie duration in AV_TIME_BASE units.
  17420. @end table
  17421. @c man end MULTIMEDIA SOURCES