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.

22780 lines
607KB

  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 commpression/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 deteced as noise are spaced less than this value then any
  475. sample inbetween 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. @end table
  755. @end table
  756. @subsection Examples
  757. @itemize
  758. @item
  759. Fade in first 15 seconds of audio:
  760. @example
  761. afade=t=in:ss=0:d=15
  762. @end example
  763. @item
  764. Fade out last 25 seconds of a 900 seconds audio:
  765. @example
  766. afade=t=out:st=875:d=25
  767. @end example
  768. @end itemize
  769. @section afftdn
  770. Denoise audio samples with FFT.
  771. A description of the accepted parameters follows.
  772. @table @option
  773. @item nr
  774. Set the noise reduction in dB, allowed range is 0.01 to 97.
  775. Default value is 12 dB.
  776. @item nf
  777. Set the noise floor in dB, allowed range is -80 to -20.
  778. Default value is -50 dB.
  779. @item nt
  780. Set the noise type.
  781. It accepts the following values:
  782. @table @option
  783. @item w
  784. Select white noise.
  785. @item v
  786. Select vinyl noise.
  787. @item s
  788. Select shellac noise.
  789. @item c
  790. Select custom noise, defined in @code{bn} option.
  791. Default value is white noise.
  792. @end table
  793. @item bn
  794. Set custom band noise for every one of 15 bands.
  795. Bands are separated by ' ' or '|'.
  796. @item rf
  797. Set the residual floor in dB, allowed range is -80 to -20.
  798. Default value is -38 dB.
  799. @item tn
  800. Enable noise tracking. By default is disabled.
  801. With this enabled, noise floor is automatically adjusted.
  802. @item tr
  803. Enable residual tracking. By default is disabled.
  804. @item om
  805. Set the output mode.
  806. It accepts the following values:
  807. @table @option
  808. @item i
  809. Pass input unchanged.
  810. @item o
  811. Pass noise filtered out.
  812. @item n
  813. Pass only noise.
  814. Default value is @var{o}.
  815. @end table
  816. @end table
  817. @subsection Commands
  818. This filter supports the following commands:
  819. @table @option
  820. @item sample_noise, sn
  821. Start or stop measuring noise profile.
  822. Syntax for the command is : "start" or "stop" string.
  823. After measuring noise profile is stopped it will be
  824. automatically applied in filtering.
  825. @item noise_reduction, nr
  826. Change noise reduction. Argument is single float number.
  827. Syntax for the command is : "@var{noise_reduction}"
  828. @item noise_floor, nf
  829. Change noise floor. Argument is single float number.
  830. Syntax for the command is : "@var{noise_floor}"
  831. @item output_mode, om
  832. Change output mode operation.
  833. Syntax for the command is : "i", "o" or "n" string.
  834. @end table
  835. @section afftfilt
  836. Apply arbitrary expressions to samples in frequency domain.
  837. @table @option
  838. @item real
  839. Set frequency domain real expression for each separate channel separated
  840. by '|'. Default is "re".
  841. If the number of input channels is greater than the number of
  842. expressions, the last specified expression is used for the remaining
  843. output channels.
  844. @item imag
  845. Set frequency domain imaginary expression for each separate channel
  846. separated by '|'. Default is "im".
  847. Each expression in @var{real} and @var{imag} can contain the following
  848. constants and functions:
  849. @table @option
  850. @item sr
  851. sample rate
  852. @item b
  853. current frequency bin number
  854. @item nb
  855. number of available bins
  856. @item ch
  857. channel number of the current expression
  858. @item chs
  859. number of channels
  860. @item pts
  861. current frame pts
  862. @item re
  863. current real part of frequency bin of current channel
  864. @item im
  865. current imaginary part of frequency bin of current channel
  866. @item real(b, ch)
  867. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  868. @item imag(b, ch)
  869. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  870. @end table
  871. @item win_size
  872. Set window size.
  873. It accepts the following values:
  874. @table @samp
  875. @item w16
  876. @item w32
  877. @item w64
  878. @item w128
  879. @item w256
  880. @item w512
  881. @item w1024
  882. @item w2048
  883. @item w4096
  884. @item w8192
  885. @item w16384
  886. @item w32768
  887. @item w65536
  888. @end table
  889. Default is @code{w4096}
  890. @item win_func
  891. Set window function. Default is @code{hann}.
  892. @item overlap
  893. Set window overlap. If set to 1, the recommended overlap for selected
  894. window function will be picked. Default is @code{0.75}.
  895. @end table
  896. @subsection Examples
  897. @itemize
  898. @item
  899. Leave almost only low frequencies in audio:
  900. @example
  901. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  902. @end example
  903. @end itemize
  904. @anchor{afir}
  905. @section afir
  906. Apply an arbitrary Frequency Impulse Response filter.
  907. This filter is designed for applying long FIR filters,
  908. up to 60 seconds long.
  909. It can be used as component for digital crossover filters,
  910. room equalization, cross talk cancellation, wavefield synthesis,
  911. auralization, ambiophonics, ambisonics and spatialization.
  912. This filter uses second stream as FIR coefficients.
  913. If second stream holds single channel, it will be used
  914. for all input channels in first stream, otherwise
  915. number of channels in second stream must be same as
  916. number of channels in first stream.
  917. It accepts the following parameters:
  918. @table @option
  919. @item dry
  920. Set dry gain. This sets input gain.
  921. @item wet
  922. Set wet gain. This sets final output gain.
  923. @item length
  924. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  925. @item gtype
  926. Enable applying gain measured from power of IR.
  927. Set which approach to use for auto gain measurement.
  928. @table @option
  929. @item none
  930. Do not apply any gain.
  931. @item peak
  932. select peak gain, very conservative approach. This is default value.
  933. @item dc
  934. select DC gain, limited application.
  935. @item gn
  936. select gain to noise approach, this is most popular one.
  937. @end table
  938. @item irgain
  939. Set gain to be applied to IR coefficients before filtering.
  940. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  941. @item irfmt
  942. Set format of IR stream. Can be @code{mono} or @code{input}.
  943. Default is @code{input}.
  944. @item maxir
  945. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  946. Allowed range is 0.1 to 60 seconds.
  947. @item response
  948. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  949. By default it is disabled.
  950. @item channel
  951. Set for which IR channel to display frequency response. By default is first channel
  952. displayed. This option is used only when @var{response} is enabled.
  953. @item size
  954. Set video stream size. This option is used only when @var{response} is enabled.
  955. @item rate
  956. Set video stream frame rate. This option is used only when @var{response} is enabled.
  957. @item minp
  958. Set minimal partition size used for convolution. Default is @var{8192}.
  959. Allowed range is from @var{8} to @var{32768}.
  960. Lower values decreases latency at cost of higher CPU usage.
  961. @item maxp
  962. Set maximal partition size used for convolution. Default is @var{8192}.
  963. Allowed range is from @var{8} to @var{32768}.
  964. Lower values may increase CPU usage.
  965. @end table
  966. @subsection Examples
  967. @itemize
  968. @item
  969. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  970. @example
  971. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  972. @end example
  973. @end itemize
  974. @anchor{aformat}
  975. @section aformat
  976. Set output format constraints for the input audio. The framework will
  977. negotiate the most appropriate format to minimize conversions.
  978. It accepts the following parameters:
  979. @table @option
  980. @item sample_fmts
  981. A '|'-separated list of requested sample formats.
  982. @item sample_rates
  983. A '|'-separated list of requested sample rates.
  984. @item channel_layouts
  985. A '|'-separated list of requested channel layouts.
  986. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  987. for the required syntax.
  988. @end table
  989. If a parameter is omitted, all values are allowed.
  990. Force the output to either unsigned 8-bit or signed 16-bit stereo
  991. @example
  992. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  993. @end example
  994. @section agate
  995. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  996. processing reduces disturbing noise between useful signals.
  997. Gating is done by detecting the volume below a chosen level @var{threshold}
  998. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  999. floor is set via @var{range}. Because an exact manipulation of the signal
  1000. would cause distortion of the waveform the reduction can be levelled over
  1001. time. This is done by setting @var{attack} and @var{release}.
  1002. @var{attack} determines how long the signal has to fall below the threshold
  1003. before any reduction will occur and @var{release} sets the time the signal
  1004. has to rise above the threshold to reduce the reduction again.
  1005. Shorter signals than the chosen attack time will be left untouched.
  1006. @table @option
  1007. @item level_in
  1008. Set input level before filtering.
  1009. Default is 1. Allowed range is from 0.015625 to 64.
  1010. @item range
  1011. Set the level of gain reduction when the signal is below the threshold.
  1012. Default is 0.06125. Allowed range is from 0 to 1.
  1013. @item threshold
  1014. If a signal rises above this level the gain reduction is released.
  1015. Default is 0.125. Allowed range is from 0 to 1.
  1016. @item ratio
  1017. Set a ratio by which the signal is reduced.
  1018. Default is 2. Allowed range is from 1 to 9000.
  1019. @item attack
  1020. Amount of milliseconds the signal has to rise above the threshold before gain
  1021. reduction stops.
  1022. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1023. @item release
  1024. Amount of milliseconds the signal has to fall below the threshold before the
  1025. reduction is increased again. Default is 250 milliseconds.
  1026. Allowed range is from 0.01 to 9000.
  1027. @item makeup
  1028. Set amount of amplification of signal after processing.
  1029. Default is 1. Allowed range is from 1 to 64.
  1030. @item knee
  1031. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1032. Default is 2.828427125. Allowed range is from 1 to 8.
  1033. @item detection
  1034. Choose if exact signal should be taken for detection or an RMS like one.
  1035. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1036. @item link
  1037. Choose if the average level between all channels or the louder channel affects
  1038. the reduction.
  1039. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1040. @end table
  1041. @section aiir
  1042. Apply an arbitrary Infinite Impulse Response filter.
  1043. It accepts the following parameters:
  1044. @table @option
  1045. @item z
  1046. Set numerator/zeros coefficients.
  1047. @item p
  1048. Set denominator/poles coefficients.
  1049. @item k
  1050. Set channels gains.
  1051. @item dry_gain
  1052. Set input gain.
  1053. @item wet_gain
  1054. Set output gain.
  1055. @item f
  1056. Set coefficients format.
  1057. @table @samp
  1058. @item tf
  1059. transfer function
  1060. @item zp
  1061. Z-plane zeros/poles, cartesian (default)
  1062. @item pr
  1063. Z-plane zeros/poles, polar radians
  1064. @item pd
  1065. Z-plane zeros/poles, polar degrees
  1066. @end table
  1067. @item r
  1068. Set kind of processing.
  1069. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1070. @item e
  1071. Set filtering precision.
  1072. @table @samp
  1073. @item dbl
  1074. double-precision floating-point (default)
  1075. @item flt
  1076. single-precision floating-point
  1077. @item i32
  1078. 32-bit integers
  1079. @item i16
  1080. 16-bit integers
  1081. @end table
  1082. @item response
  1083. Show IR frequency reponse, magnitude and phase in additional video stream.
  1084. By default it is disabled.
  1085. @item channel
  1086. Set for which IR channel to display frequency response. By default is first channel
  1087. displayed. This option is used only when @var{response} is enabled.
  1088. @item size
  1089. Set video stream size. This option is used only when @var{response} is enabled.
  1090. @end table
  1091. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1092. order.
  1093. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1094. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1095. imaginary unit.
  1096. Different coefficients and gains can be provided for every channel, in such case
  1097. use '|' to separate coefficients or gains. Last provided coefficients will be
  1098. used for all remaining channels.
  1099. @subsection Examples
  1100. @itemize
  1101. @item
  1102. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1103. @example
  1104. 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
  1105. @end example
  1106. @item
  1107. Same as above but in @code{zp} format:
  1108. @example
  1109. 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
  1110. @end example
  1111. @end itemize
  1112. @section alimiter
  1113. The limiter prevents an input signal from rising over a desired threshold.
  1114. This limiter uses lookahead technology to prevent your signal from distorting.
  1115. It means that there is a small delay after the signal is processed. Keep in mind
  1116. that the delay it produces is the attack time you set.
  1117. The filter accepts the following options:
  1118. @table @option
  1119. @item level_in
  1120. Set input gain. Default is 1.
  1121. @item level_out
  1122. Set output gain. Default is 1.
  1123. @item limit
  1124. Don't let signals above this level pass the limiter. Default is 1.
  1125. @item attack
  1126. The limiter will reach its attenuation level in this amount of time in
  1127. milliseconds. Default is 5 milliseconds.
  1128. @item release
  1129. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1130. Default is 50 milliseconds.
  1131. @item asc
  1132. When gain reduction is always needed ASC takes care of releasing to an
  1133. average reduction level rather than reaching a reduction of 0 in the release
  1134. time.
  1135. @item asc_level
  1136. Select how much the release time is affected by ASC, 0 means nearly no changes
  1137. in release time while 1 produces higher release times.
  1138. @item level
  1139. Auto level output signal. Default is enabled.
  1140. This normalizes audio back to 0dB if enabled.
  1141. @end table
  1142. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1143. with @ref{aresample} before applying this filter.
  1144. @section allpass
  1145. Apply a two-pole all-pass filter with central frequency (in Hz)
  1146. @var{frequency}, and filter-width @var{width}.
  1147. An all-pass filter changes the audio's frequency to phase relationship
  1148. without changing its frequency to amplitude relationship.
  1149. The filter accepts the following options:
  1150. @table @option
  1151. @item frequency, f
  1152. Set frequency in Hz.
  1153. @item width_type, t
  1154. Set method to specify band-width of filter.
  1155. @table @option
  1156. @item h
  1157. Hz
  1158. @item q
  1159. Q-Factor
  1160. @item o
  1161. octave
  1162. @item s
  1163. slope
  1164. @item k
  1165. kHz
  1166. @end table
  1167. @item width, w
  1168. Specify the band-width of a filter in width_type units.
  1169. @item channels, c
  1170. Specify which channels to filter, by default all available are filtered.
  1171. @end table
  1172. @subsection Commands
  1173. This filter supports the following commands:
  1174. @table @option
  1175. @item frequency, f
  1176. Change allpass frequency.
  1177. Syntax for the command is : "@var{frequency}"
  1178. @item width_type, t
  1179. Change allpass width_type.
  1180. Syntax for the command is : "@var{width_type}"
  1181. @item width, w
  1182. Change allpass width.
  1183. Syntax for the command is : "@var{width}"
  1184. @end table
  1185. @section aloop
  1186. Loop audio samples.
  1187. The filter accepts the following options:
  1188. @table @option
  1189. @item loop
  1190. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1191. Default is 0.
  1192. @item size
  1193. Set maximal number of samples. Default is 0.
  1194. @item start
  1195. Set first sample of loop. Default is 0.
  1196. @end table
  1197. @anchor{amerge}
  1198. @section amerge
  1199. Merge two or more audio streams into a single multi-channel stream.
  1200. The filter accepts the following options:
  1201. @table @option
  1202. @item inputs
  1203. Set the number of inputs. Default is 2.
  1204. @end table
  1205. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1206. the channel layout of the output will be set accordingly and the channels
  1207. will be reordered as necessary. If the channel layouts of the inputs are not
  1208. disjoint, the output will have all the channels of the first input then all
  1209. the channels of the second input, in that order, and the channel layout of
  1210. the output will be the default value corresponding to the total number of
  1211. channels.
  1212. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1213. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1214. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1215. first input, b1 is the first channel of the second input).
  1216. On the other hand, if both input are in stereo, the output channels will be
  1217. in the default order: a1, a2, b1, b2, and the channel layout will be
  1218. arbitrarily set to 4.0, which may or may not be the expected value.
  1219. All inputs must have the same sample rate, and format.
  1220. If inputs do not have the same duration, the output will stop with the
  1221. shortest.
  1222. @subsection Examples
  1223. @itemize
  1224. @item
  1225. Merge two mono files into a stereo stream:
  1226. @example
  1227. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1228. @end example
  1229. @item
  1230. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1231. @example
  1232. 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
  1233. @end example
  1234. @end itemize
  1235. @section amix
  1236. Mixes multiple audio inputs into a single output.
  1237. Note that this filter only supports float samples (the @var{amerge}
  1238. and @var{pan} audio filters support many formats). If the @var{amix}
  1239. input has integer samples then @ref{aresample} will be automatically
  1240. inserted to perform the conversion to float samples.
  1241. For example
  1242. @example
  1243. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1244. @end example
  1245. will mix 3 input audio streams to a single output with the same duration as the
  1246. first input and a dropout transition time of 3 seconds.
  1247. It accepts the following parameters:
  1248. @table @option
  1249. @item inputs
  1250. The number of inputs. If unspecified, it defaults to 2.
  1251. @item duration
  1252. How to determine the end-of-stream.
  1253. @table @option
  1254. @item longest
  1255. The duration of the longest input. (default)
  1256. @item shortest
  1257. The duration of the shortest input.
  1258. @item first
  1259. The duration of the first input.
  1260. @end table
  1261. @item dropout_transition
  1262. The transition time, in seconds, for volume renormalization when an input
  1263. stream ends. The default value is 2 seconds.
  1264. @item weights
  1265. Specify weight of each input audio stream as sequence.
  1266. Each weight is separated by space. By default all inputs have same weight.
  1267. @end table
  1268. @section amultiply
  1269. Multiply first audio stream with second audio stream and store result
  1270. in output audio stream. Multiplication is done by multiplying each
  1271. sample from first stream with sample at same position from second stream.
  1272. With this element-wise multiplication one can create amplitude fades and
  1273. amplitude modulations.
  1274. @section anequalizer
  1275. High-order parametric multiband equalizer for each channel.
  1276. It accepts the following parameters:
  1277. @table @option
  1278. @item params
  1279. This option string is in format:
  1280. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1281. Each equalizer band is separated by '|'.
  1282. @table @option
  1283. @item chn
  1284. Set channel number to which equalization will be applied.
  1285. If input doesn't have that channel the entry is ignored.
  1286. @item f
  1287. Set central frequency for band.
  1288. If input doesn't have that frequency the entry is ignored.
  1289. @item w
  1290. Set band width in hertz.
  1291. @item g
  1292. Set band gain in dB.
  1293. @item t
  1294. Set filter type for band, optional, can be:
  1295. @table @samp
  1296. @item 0
  1297. Butterworth, this is default.
  1298. @item 1
  1299. Chebyshev type 1.
  1300. @item 2
  1301. Chebyshev type 2.
  1302. @end table
  1303. @end table
  1304. @item curves
  1305. With this option activated frequency response of anequalizer is displayed
  1306. in video stream.
  1307. @item size
  1308. Set video stream size. Only useful if curves option is activated.
  1309. @item mgain
  1310. Set max gain that will be displayed. Only useful if curves option is activated.
  1311. Setting this to a reasonable value makes it possible to display gain which is derived from
  1312. neighbour bands which are too close to each other and thus produce higher gain
  1313. when both are activated.
  1314. @item fscale
  1315. Set frequency scale used to draw frequency response in video output.
  1316. Can be linear or logarithmic. Default is logarithmic.
  1317. @item colors
  1318. Set color for each channel curve which is going to be displayed in video stream.
  1319. This is list of color names separated by space or by '|'.
  1320. Unrecognised or missing colors will be replaced by white color.
  1321. @end table
  1322. @subsection Examples
  1323. @itemize
  1324. @item
  1325. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1326. for first 2 channels using Chebyshev type 1 filter:
  1327. @example
  1328. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1329. @end example
  1330. @end itemize
  1331. @subsection Commands
  1332. This filter supports the following commands:
  1333. @table @option
  1334. @item change
  1335. Alter existing filter parameters.
  1336. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1337. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1338. error is returned.
  1339. @var{freq} set new frequency parameter.
  1340. @var{width} set new width parameter in herz.
  1341. @var{gain} set new gain parameter in dB.
  1342. Full filter invocation with asendcmd may look like this:
  1343. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1344. @end table
  1345. @section anlmdn
  1346. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1347. Each sample is adjusted by looking for other samples with similar contexts. This
  1348. context similarity is defined by comparing their surrounding patches of size
  1349. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1350. The filter accepts the following options.
  1351. @table @option
  1352. @item s
  1353. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1354. @item p
  1355. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1356. Default value is 2 milliseconds.
  1357. @item r
  1358. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1359. Default value is 6 milliseconds.
  1360. @end table
  1361. @section anull
  1362. Pass the audio source unchanged to the output.
  1363. @section apad
  1364. Pad the end of an audio stream with silence.
  1365. This can be used together with @command{ffmpeg} @option{-shortest} to
  1366. extend audio streams to the same length as the video stream.
  1367. A description of the accepted options follows.
  1368. @table @option
  1369. @item packet_size
  1370. Set silence packet size. Default value is 4096.
  1371. @item pad_len
  1372. Set the number of samples of silence to add to the end. After the
  1373. value is reached, the stream is terminated. This option is mutually
  1374. exclusive with @option{whole_len}.
  1375. @item whole_len
  1376. Set the minimum total number of samples in the output audio stream. If
  1377. the value is longer than the input audio length, silence is added to
  1378. the end, until the value is reached. This option is mutually exclusive
  1379. with @option{pad_len}.
  1380. @item pad_dur
  1381. Specify the duration of samples of silence to add. See
  1382. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1383. for the accepted syntax. Used only if set to non-zero value.
  1384. @item whole_dur
  1385. Specify the minimum total duration in the output audio stream. See
  1386. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1387. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1388. the input audio length, silence is added to the end, until the value is reached.
  1389. This option is mutually exclusive with @option{pad_dur}
  1390. @end table
  1391. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1392. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1393. the input stream indefinitely.
  1394. @subsection Examples
  1395. @itemize
  1396. @item
  1397. Add 1024 samples of silence to the end of the input:
  1398. @example
  1399. apad=pad_len=1024
  1400. @end example
  1401. @item
  1402. Make sure the audio output will contain at least 10000 samples, pad
  1403. the input with silence if required:
  1404. @example
  1405. apad=whole_len=10000
  1406. @end example
  1407. @item
  1408. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1409. video stream will always result the shortest and will be converted
  1410. until the end in the output file when using the @option{shortest}
  1411. option:
  1412. @example
  1413. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1414. @end example
  1415. @end itemize
  1416. @section aphaser
  1417. Add a phasing effect to the input audio.
  1418. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1419. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1420. A description of the accepted parameters follows.
  1421. @table @option
  1422. @item in_gain
  1423. Set input gain. Default is 0.4.
  1424. @item out_gain
  1425. Set output gain. Default is 0.74
  1426. @item delay
  1427. Set delay in milliseconds. Default is 3.0.
  1428. @item decay
  1429. Set decay. Default is 0.4.
  1430. @item speed
  1431. Set modulation speed in Hz. Default is 0.5.
  1432. @item type
  1433. Set modulation type. Default is triangular.
  1434. It accepts the following values:
  1435. @table @samp
  1436. @item triangular, t
  1437. @item sinusoidal, s
  1438. @end table
  1439. @end table
  1440. @section apulsator
  1441. Audio pulsator is something between an autopanner and a tremolo.
  1442. But it can produce funny stereo effects as well. Pulsator changes the volume
  1443. of the left and right channel based on a LFO (low frequency oscillator) with
  1444. different waveforms and shifted phases.
  1445. This filter have the ability to define an offset between left and right
  1446. channel. An offset of 0 means that both LFO shapes match each other.
  1447. The left and right channel are altered equally - a conventional tremolo.
  1448. An offset of 50% means that the shape of the right channel is exactly shifted
  1449. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1450. an autopanner. At 1 both curves match again. Every setting in between moves the
  1451. phase shift gapless between all stages and produces some "bypassing" sounds with
  1452. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1453. the 0.5) the faster the signal passes from the left to the right speaker.
  1454. The filter accepts the following options:
  1455. @table @option
  1456. @item level_in
  1457. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1458. @item level_out
  1459. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1460. @item mode
  1461. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1462. sawup or sawdown. Default is sine.
  1463. @item amount
  1464. Set modulation. Define how much of original signal is affected by the LFO.
  1465. @item offset_l
  1466. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1467. @item offset_r
  1468. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1469. @item width
  1470. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1471. @item timing
  1472. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1473. @item bpm
  1474. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1475. is set to bpm.
  1476. @item ms
  1477. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1478. is set to ms.
  1479. @item hz
  1480. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1481. if timing is set to hz.
  1482. @end table
  1483. @anchor{aresample}
  1484. @section aresample
  1485. Resample the input audio to the specified parameters, using the
  1486. libswresample library. If none are specified then the filter will
  1487. automatically convert between its input and output.
  1488. This filter is also able to stretch/squeeze the audio data to make it match
  1489. the timestamps or to inject silence / cut out audio to make it match the
  1490. timestamps, do a combination of both or do neither.
  1491. The filter accepts the syntax
  1492. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1493. expresses a sample rate and @var{resampler_options} is a list of
  1494. @var{key}=@var{value} pairs, separated by ":". See the
  1495. @ref{Resampler Options,,"Resampler Options" section in the
  1496. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1497. for the complete list of supported options.
  1498. @subsection Examples
  1499. @itemize
  1500. @item
  1501. Resample the input audio to 44100Hz:
  1502. @example
  1503. aresample=44100
  1504. @end example
  1505. @item
  1506. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1507. samples per second compensation:
  1508. @example
  1509. aresample=async=1000
  1510. @end example
  1511. @end itemize
  1512. @section areverse
  1513. Reverse an audio clip.
  1514. Warning: This filter requires memory to buffer the entire clip, so trimming
  1515. is suggested.
  1516. @subsection Examples
  1517. @itemize
  1518. @item
  1519. Take the first 5 seconds of a clip, and reverse it.
  1520. @example
  1521. atrim=end=5,areverse
  1522. @end example
  1523. @end itemize
  1524. @section asetnsamples
  1525. Set the number of samples per each output audio frame.
  1526. The last output packet may contain a different number of samples, as
  1527. the filter will flush all the remaining samples when the input audio
  1528. signals its end.
  1529. The filter accepts the following options:
  1530. @table @option
  1531. @item nb_out_samples, n
  1532. Set the number of frames per each output audio frame. The number is
  1533. intended as the number of samples @emph{per each channel}.
  1534. Default value is 1024.
  1535. @item pad, p
  1536. If set to 1, the filter will pad the last audio frame with zeroes, so
  1537. that the last frame will contain the same number of samples as the
  1538. previous ones. Default value is 1.
  1539. @end table
  1540. For example, to set the number of per-frame samples to 1234 and
  1541. disable padding for the last frame, use:
  1542. @example
  1543. asetnsamples=n=1234:p=0
  1544. @end example
  1545. @section asetrate
  1546. Set the sample rate without altering the PCM data.
  1547. This will result in a change of speed and pitch.
  1548. The filter accepts the following options:
  1549. @table @option
  1550. @item sample_rate, r
  1551. Set the output sample rate. Default is 44100 Hz.
  1552. @end table
  1553. @section ashowinfo
  1554. Show a line containing various information for each input audio frame.
  1555. The input audio is not modified.
  1556. The shown line contains a sequence of key/value pairs of the form
  1557. @var{key}:@var{value}.
  1558. The following values are shown in the output:
  1559. @table @option
  1560. @item n
  1561. The (sequential) number of the input frame, starting from 0.
  1562. @item pts
  1563. The presentation timestamp of the input frame, in time base units; the time base
  1564. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1565. @item pts_time
  1566. The presentation timestamp of the input frame in seconds.
  1567. @item pos
  1568. position of the frame in the input stream, -1 if this information in
  1569. unavailable and/or meaningless (for example in case of synthetic audio)
  1570. @item fmt
  1571. The sample format.
  1572. @item chlayout
  1573. The channel layout.
  1574. @item rate
  1575. The sample rate for the audio frame.
  1576. @item nb_samples
  1577. The number of samples (per channel) in the frame.
  1578. @item checksum
  1579. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1580. audio, the data is treated as if all the planes were concatenated.
  1581. @item plane_checksums
  1582. A list of Adler-32 checksums for each data plane.
  1583. @end table
  1584. @anchor{astats}
  1585. @section astats
  1586. Display time domain statistical information about the audio channels.
  1587. Statistics are calculated and displayed for each audio channel and,
  1588. where applicable, an overall figure is also given.
  1589. It accepts the following option:
  1590. @table @option
  1591. @item length
  1592. Short window length in seconds, used for peak and trough RMS measurement.
  1593. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1594. @item metadata
  1595. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1596. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1597. disabled.
  1598. Available keys for each channel are:
  1599. DC_offset
  1600. Min_level
  1601. Max_level
  1602. Min_difference
  1603. Max_difference
  1604. Mean_difference
  1605. RMS_difference
  1606. Peak_level
  1607. RMS_peak
  1608. RMS_trough
  1609. Crest_factor
  1610. Flat_factor
  1611. Peak_count
  1612. Bit_depth
  1613. Dynamic_range
  1614. Zero_crossings
  1615. Zero_crossings_rate
  1616. and for Overall:
  1617. DC_offset
  1618. Min_level
  1619. Max_level
  1620. Min_difference
  1621. Max_difference
  1622. Mean_difference
  1623. RMS_difference
  1624. Peak_level
  1625. RMS_level
  1626. RMS_peak
  1627. RMS_trough
  1628. Flat_factor
  1629. Peak_count
  1630. Bit_depth
  1631. Number_of_samples
  1632. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1633. this @code{lavfi.astats.Overall.Peak_count}.
  1634. For description what each key means read below.
  1635. @item reset
  1636. Set number of frame after which stats are going to be recalculated.
  1637. Default is disabled.
  1638. @end table
  1639. A description of each shown parameter follows:
  1640. @table @option
  1641. @item DC offset
  1642. Mean amplitude displacement from zero.
  1643. @item Min level
  1644. Minimal sample level.
  1645. @item Max level
  1646. Maximal sample level.
  1647. @item Min difference
  1648. Minimal difference between two consecutive samples.
  1649. @item Max difference
  1650. Maximal difference between two consecutive samples.
  1651. @item Mean difference
  1652. Mean difference between two consecutive samples.
  1653. The average of each difference between two consecutive samples.
  1654. @item RMS difference
  1655. Root Mean Square difference between two consecutive samples.
  1656. @item Peak level dB
  1657. @item RMS level dB
  1658. Standard peak and RMS level measured in dBFS.
  1659. @item RMS peak dB
  1660. @item RMS trough dB
  1661. Peak and trough values for RMS level measured over a short window.
  1662. @item Crest factor
  1663. Standard ratio of peak to RMS level (note: not in dB).
  1664. @item Flat factor
  1665. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1666. (i.e. either @var{Min level} or @var{Max level}).
  1667. @item Peak count
  1668. Number of occasions (not the number of samples) that the signal attained either
  1669. @var{Min level} or @var{Max level}.
  1670. @item Bit depth
  1671. Overall bit depth of audio. Number of bits used for each sample.
  1672. @item Dynamic range
  1673. Measured dynamic range of audio in dB.
  1674. @item Zero crossings
  1675. Number of points where the waveform crosses the zero level axis.
  1676. @item Zero crossings rate
  1677. Rate of Zero crossings and number of audio samples.
  1678. @end table
  1679. @section atempo
  1680. Adjust audio tempo.
  1681. The filter accepts exactly one parameter, the audio tempo. If not
  1682. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1683. be in the [0.5, 100.0] range.
  1684. Note that tempo greater than 2 will skip some samples rather than
  1685. blend them in. If for any reason this is a concern it is always
  1686. possible to daisy-chain several instances of atempo to achieve the
  1687. desired product tempo.
  1688. @subsection Examples
  1689. @itemize
  1690. @item
  1691. Slow down audio to 80% tempo:
  1692. @example
  1693. atempo=0.8
  1694. @end example
  1695. @item
  1696. To speed up audio to 300% tempo:
  1697. @example
  1698. atempo=3
  1699. @end example
  1700. @item
  1701. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1702. @example
  1703. atempo=sqrt(3),atempo=sqrt(3)
  1704. @end example
  1705. @end itemize
  1706. @section atrim
  1707. Trim the input so that the output contains one continuous subpart of the input.
  1708. It accepts the following parameters:
  1709. @table @option
  1710. @item start
  1711. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1712. sample with the timestamp @var{start} will be the first sample in the output.
  1713. @item end
  1714. Specify time of the first audio sample that will be dropped, i.e. the
  1715. audio sample immediately preceding the one with the timestamp @var{end} will be
  1716. the last sample in the output.
  1717. @item start_pts
  1718. Same as @var{start}, except this option sets the start timestamp in samples
  1719. instead of seconds.
  1720. @item end_pts
  1721. Same as @var{end}, except this option sets the end timestamp in samples instead
  1722. of seconds.
  1723. @item duration
  1724. The maximum duration of the output in seconds.
  1725. @item start_sample
  1726. The number of the first sample that should be output.
  1727. @item end_sample
  1728. The number of the first sample that should be dropped.
  1729. @end table
  1730. @option{start}, @option{end}, and @option{duration} are expressed as time
  1731. duration specifications; see
  1732. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1733. Note that the first two sets of the start/end options and the @option{duration}
  1734. option look at the frame timestamp, while the _sample options simply count the
  1735. samples that pass through the filter. So start/end_pts and start/end_sample will
  1736. give different results when the timestamps are wrong, inexact or do not start at
  1737. zero. Also note that this filter does not modify the timestamps. If you wish
  1738. to have the output timestamps start at zero, insert the asetpts filter after the
  1739. atrim filter.
  1740. If multiple start or end options are set, this filter tries to be greedy and
  1741. keep all samples that match at least one of the specified constraints. To keep
  1742. only the part that matches all the constraints at once, chain multiple atrim
  1743. filters.
  1744. The defaults are such that all the input is kept. So it is possible to set e.g.
  1745. just the end values to keep everything before the specified time.
  1746. Examples:
  1747. @itemize
  1748. @item
  1749. Drop everything except the second minute of input:
  1750. @example
  1751. ffmpeg -i INPUT -af atrim=60:120
  1752. @end example
  1753. @item
  1754. Keep only the first 1000 samples:
  1755. @example
  1756. ffmpeg -i INPUT -af atrim=end_sample=1000
  1757. @end example
  1758. @end itemize
  1759. @section bandpass
  1760. Apply a two-pole Butterworth band-pass filter with central
  1761. frequency @var{frequency}, and (3dB-point) band-width width.
  1762. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1763. instead of the default: constant 0dB peak gain.
  1764. The filter roll off at 6dB per octave (20dB per decade).
  1765. The filter accepts the following options:
  1766. @table @option
  1767. @item frequency, f
  1768. Set the filter's central frequency. Default is @code{3000}.
  1769. @item csg
  1770. Constant skirt gain if set to 1. Defaults to 0.
  1771. @item width_type, t
  1772. Set method to specify band-width of filter.
  1773. @table @option
  1774. @item h
  1775. Hz
  1776. @item q
  1777. Q-Factor
  1778. @item o
  1779. octave
  1780. @item s
  1781. slope
  1782. @item k
  1783. kHz
  1784. @end table
  1785. @item width, w
  1786. Specify the band-width of a filter in width_type units.
  1787. @item channels, c
  1788. Specify which channels to filter, by default all available are filtered.
  1789. @end table
  1790. @subsection Commands
  1791. This filter supports the following commands:
  1792. @table @option
  1793. @item frequency, f
  1794. Change bandpass frequency.
  1795. Syntax for the command is : "@var{frequency}"
  1796. @item width_type, t
  1797. Change bandpass width_type.
  1798. Syntax for the command is : "@var{width_type}"
  1799. @item width, w
  1800. Change bandpass width.
  1801. Syntax for the command is : "@var{width}"
  1802. @end table
  1803. @section bandreject
  1804. Apply a two-pole Butterworth band-reject filter with central
  1805. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1806. The filter roll off at 6dB per octave (20dB per decade).
  1807. The filter accepts the following options:
  1808. @table @option
  1809. @item frequency, f
  1810. Set the filter's central frequency. Default is @code{3000}.
  1811. @item width_type, t
  1812. Set method to specify band-width of filter.
  1813. @table @option
  1814. @item h
  1815. Hz
  1816. @item q
  1817. Q-Factor
  1818. @item o
  1819. octave
  1820. @item s
  1821. slope
  1822. @item k
  1823. kHz
  1824. @end table
  1825. @item width, w
  1826. Specify the band-width of a filter in width_type units.
  1827. @item channels, c
  1828. Specify which channels to filter, by default all available are filtered.
  1829. @end table
  1830. @subsection Commands
  1831. This filter supports the following commands:
  1832. @table @option
  1833. @item frequency, f
  1834. Change bandreject frequency.
  1835. Syntax for the command is : "@var{frequency}"
  1836. @item width_type, t
  1837. Change bandreject width_type.
  1838. Syntax for the command is : "@var{width_type}"
  1839. @item width, w
  1840. Change bandreject width.
  1841. Syntax for the command is : "@var{width}"
  1842. @end table
  1843. @section bass, lowshelf
  1844. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1845. shelving filter with a response similar to that of a standard
  1846. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1847. The filter accepts the following options:
  1848. @table @option
  1849. @item gain, g
  1850. Give the gain at 0 Hz. Its useful range is about -20
  1851. (for a large cut) to +20 (for a large boost).
  1852. Beware of clipping when using a positive gain.
  1853. @item frequency, f
  1854. Set the filter's central frequency and so can be used
  1855. to extend or reduce the frequency range to be boosted or cut.
  1856. The default value is @code{100} Hz.
  1857. @item width_type, t
  1858. Set method to specify band-width of filter.
  1859. @table @option
  1860. @item h
  1861. Hz
  1862. @item q
  1863. Q-Factor
  1864. @item o
  1865. octave
  1866. @item s
  1867. slope
  1868. @item k
  1869. kHz
  1870. @end table
  1871. @item width, w
  1872. Determine how steep is the filter's shelf transition.
  1873. @item channels, c
  1874. Specify which channels to filter, by default all available are filtered.
  1875. @end table
  1876. @subsection Commands
  1877. This filter supports the following commands:
  1878. @table @option
  1879. @item frequency, f
  1880. Change bass frequency.
  1881. Syntax for the command is : "@var{frequency}"
  1882. @item width_type, t
  1883. Change bass width_type.
  1884. Syntax for the command is : "@var{width_type}"
  1885. @item width, w
  1886. Change bass width.
  1887. Syntax for the command is : "@var{width}"
  1888. @item gain, g
  1889. Change bass gain.
  1890. Syntax for the command is : "@var{gain}"
  1891. @end table
  1892. @section biquad
  1893. Apply a biquad IIR filter with the given coefficients.
  1894. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1895. are the numerator and denominator coefficients respectively.
  1896. and @var{channels}, @var{c} specify which channels to filter, by default all
  1897. available are filtered.
  1898. @subsection Commands
  1899. This filter supports the following commands:
  1900. @table @option
  1901. @item a0
  1902. @item a1
  1903. @item a2
  1904. @item b0
  1905. @item b1
  1906. @item b2
  1907. Change biquad parameter.
  1908. Syntax for the command is : "@var{value}"
  1909. @end table
  1910. @section bs2b
  1911. Bauer stereo to binaural transformation, which improves headphone listening of
  1912. stereo audio records.
  1913. To enable compilation of this filter you need to configure FFmpeg with
  1914. @code{--enable-libbs2b}.
  1915. It accepts the following parameters:
  1916. @table @option
  1917. @item profile
  1918. Pre-defined crossfeed level.
  1919. @table @option
  1920. @item default
  1921. Default level (fcut=700, feed=50).
  1922. @item cmoy
  1923. Chu Moy circuit (fcut=700, feed=60).
  1924. @item jmeier
  1925. Jan Meier circuit (fcut=650, feed=95).
  1926. @end table
  1927. @item fcut
  1928. Cut frequency (in Hz).
  1929. @item feed
  1930. Feed level (in Hz).
  1931. @end table
  1932. @section channelmap
  1933. Remap input channels to new locations.
  1934. It accepts the following parameters:
  1935. @table @option
  1936. @item map
  1937. Map channels from input to output. The argument is a '|'-separated list of
  1938. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1939. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1940. channel (e.g. FL for front left) or its index in the input channel layout.
  1941. @var{out_channel} is the name of the output channel or its index in the output
  1942. channel layout. If @var{out_channel} is not given then it is implicitly an
  1943. index, starting with zero and increasing by one for each mapping.
  1944. @item channel_layout
  1945. The channel layout of the output stream.
  1946. @end table
  1947. If no mapping is present, the filter will implicitly map input channels to
  1948. output channels, preserving indices.
  1949. @subsection Examples
  1950. @itemize
  1951. @item
  1952. For example, assuming a 5.1+downmix input MOV file,
  1953. @example
  1954. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1955. @end example
  1956. will create an output WAV file tagged as stereo from the downmix channels of
  1957. the input.
  1958. @item
  1959. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1960. @example
  1961. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1962. @end example
  1963. @end itemize
  1964. @section channelsplit
  1965. Split each channel from an input audio stream into a separate output stream.
  1966. It accepts the following parameters:
  1967. @table @option
  1968. @item channel_layout
  1969. The channel layout of the input stream. The default is "stereo".
  1970. @item channels
  1971. A channel layout describing the channels to be extracted as separate output streams
  1972. or "all" to extract each input channel as a separate stream. The default is "all".
  1973. Choosing channels not present in channel layout in the input will result in an error.
  1974. @end table
  1975. @subsection Examples
  1976. @itemize
  1977. @item
  1978. For example, assuming a stereo input MP3 file,
  1979. @example
  1980. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1981. @end example
  1982. will create an output Matroska file with two audio streams, one containing only
  1983. the left channel and the other the right channel.
  1984. @item
  1985. Split a 5.1 WAV file into per-channel files:
  1986. @example
  1987. ffmpeg -i in.wav -filter_complex
  1988. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1989. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1990. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1991. side_right.wav
  1992. @end example
  1993. @item
  1994. Extract only LFE from a 5.1 WAV file:
  1995. @example
  1996. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1997. -map '[LFE]' lfe.wav
  1998. @end example
  1999. @end itemize
  2000. @section chorus
  2001. Add a chorus effect to the audio.
  2002. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2003. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2004. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2005. The modulation depth defines the range the modulated delay is played before or after
  2006. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2007. sound tuned around the original one, like in a chorus where some vocals are slightly
  2008. off key.
  2009. It accepts the following parameters:
  2010. @table @option
  2011. @item in_gain
  2012. Set input gain. Default is 0.4.
  2013. @item out_gain
  2014. Set output gain. Default is 0.4.
  2015. @item delays
  2016. Set delays. A typical delay is around 40ms to 60ms.
  2017. @item decays
  2018. Set decays.
  2019. @item speeds
  2020. Set speeds.
  2021. @item depths
  2022. Set depths.
  2023. @end table
  2024. @subsection Examples
  2025. @itemize
  2026. @item
  2027. A single delay:
  2028. @example
  2029. chorus=0.7:0.9:55:0.4:0.25:2
  2030. @end example
  2031. @item
  2032. Two delays:
  2033. @example
  2034. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2035. @end example
  2036. @item
  2037. Fuller sounding chorus with three delays:
  2038. @example
  2039. 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
  2040. @end example
  2041. @end itemize
  2042. @section compand
  2043. Compress or expand the audio's dynamic range.
  2044. It accepts the following parameters:
  2045. @table @option
  2046. @item attacks
  2047. @item decays
  2048. A list of times in seconds for each channel over which the instantaneous level
  2049. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2050. increase of volume and @var{decays} refers to decrease of volume. For most
  2051. situations, the attack time (response to the audio getting louder) should be
  2052. shorter than the decay time, because the human ear is more sensitive to sudden
  2053. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2054. a typical value for decay is 0.8 seconds.
  2055. If specified number of attacks & decays is lower than number of channels, the last
  2056. set attack/decay will be used for all remaining channels.
  2057. @item points
  2058. A list of points for the transfer function, specified in dB relative to the
  2059. maximum possible signal amplitude. Each key points list must be defined using
  2060. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2061. @code{x0/y0 x1/y1 x2/y2 ....}
  2062. The input values must be in strictly increasing order but the transfer function
  2063. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2064. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2065. function are @code{-70/-70|-60/-20|1/0}.
  2066. @item soft-knee
  2067. Set the curve radius in dB for all joints. It defaults to 0.01.
  2068. @item gain
  2069. Set the additional gain in dB to be applied at all points on the transfer
  2070. function. This allows for easy adjustment of the overall gain.
  2071. It defaults to 0.
  2072. @item volume
  2073. Set an initial volume, in dB, to be assumed for each channel when filtering
  2074. starts. This permits the user to supply a nominal level initially, so that, for
  2075. example, a very large gain is not applied to initial signal levels before the
  2076. companding has begun to operate. A typical value for audio which is initially
  2077. quiet is -90 dB. It defaults to 0.
  2078. @item delay
  2079. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2080. delayed before being fed to the volume adjuster. Specifying a delay
  2081. approximately equal to the attack/decay times allows the filter to effectively
  2082. operate in predictive rather than reactive mode. It defaults to 0.
  2083. @end table
  2084. @subsection Examples
  2085. @itemize
  2086. @item
  2087. Make music with both quiet and loud passages suitable for listening to in a
  2088. noisy environment:
  2089. @example
  2090. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2091. @end example
  2092. Another example for audio with whisper and explosion parts:
  2093. @example
  2094. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2095. @end example
  2096. @item
  2097. A noise gate for when the noise is at a lower level than the signal:
  2098. @example
  2099. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2100. @end example
  2101. @item
  2102. Here is another noise gate, this time for when the noise is at a higher level
  2103. than the signal (making it, in some ways, similar to squelch):
  2104. @example
  2105. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2106. @end example
  2107. @item
  2108. 2:1 compression starting at -6dB:
  2109. @example
  2110. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2111. @end example
  2112. @item
  2113. 2:1 compression starting at -9dB:
  2114. @example
  2115. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2116. @end example
  2117. @item
  2118. 2:1 compression starting at -12dB:
  2119. @example
  2120. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2121. @end example
  2122. @item
  2123. 2:1 compression starting at -18dB:
  2124. @example
  2125. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2126. @end example
  2127. @item
  2128. 3:1 compression starting at -15dB:
  2129. @example
  2130. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2131. @end example
  2132. @item
  2133. Compressor/Gate:
  2134. @example
  2135. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2136. @end example
  2137. @item
  2138. Expander:
  2139. @example
  2140. 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
  2141. @end example
  2142. @item
  2143. Hard limiter at -6dB:
  2144. @example
  2145. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2146. @end example
  2147. @item
  2148. Hard limiter at -12dB:
  2149. @example
  2150. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2151. @end example
  2152. @item
  2153. Hard noise gate at -35 dB:
  2154. @example
  2155. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2156. @end example
  2157. @item
  2158. Soft limiter:
  2159. @example
  2160. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2161. @end example
  2162. @end itemize
  2163. @section compensationdelay
  2164. Compensation Delay Line is a metric based delay to compensate differing
  2165. positions of microphones or speakers.
  2166. For example, you have recorded guitar with two microphones placed in
  2167. different location. Because the front of sound wave has fixed speed in
  2168. normal conditions, the phasing of microphones can vary and depends on
  2169. their location and interposition. The best sound mix can be achieved when
  2170. these microphones are in phase (synchronized). Note that distance of
  2171. ~30 cm between microphones makes one microphone to capture signal in
  2172. antiphase to another microphone. That makes the final mix sounding moody.
  2173. This filter helps to solve phasing problems by adding different delays
  2174. to each microphone track and make them synchronized.
  2175. The best result can be reached when you take one track as base and
  2176. synchronize other tracks one by one with it.
  2177. Remember that synchronization/delay tolerance depends on sample rate, too.
  2178. Higher sample rates will give more tolerance.
  2179. It accepts the following parameters:
  2180. @table @option
  2181. @item mm
  2182. Set millimeters distance. This is compensation distance for fine tuning.
  2183. Default is 0.
  2184. @item cm
  2185. Set cm distance. This is compensation distance for tightening distance setup.
  2186. Default is 0.
  2187. @item m
  2188. Set meters distance. This is compensation distance for hard distance setup.
  2189. Default is 0.
  2190. @item dry
  2191. Set dry amount. Amount of unprocessed (dry) signal.
  2192. Default is 0.
  2193. @item wet
  2194. Set wet amount. Amount of processed (wet) signal.
  2195. Default is 1.
  2196. @item temp
  2197. Set temperature degree in Celsius. This is the temperature of the environment.
  2198. Default is 20.
  2199. @end table
  2200. @section crossfeed
  2201. Apply headphone crossfeed filter.
  2202. Crossfeed is the process of blending the left and right channels of stereo
  2203. audio recording.
  2204. It is mainly used to reduce extreme stereo separation of low frequencies.
  2205. The intent is to produce more speaker like sound to the listener.
  2206. The filter accepts the following options:
  2207. @table @option
  2208. @item strength
  2209. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2210. This sets gain of low shelf filter for side part of stereo image.
  2211. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2212. @item range
  2213. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2214. This sets cut off frequency of low shelf filter. Default is cut off near
  2215. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2216. @item level_in
  2217. Set input gain. Default is 0.9.
  2218. @item level_out
  2219. Set output gain. Default is 1.
  2220. @end table
  2221. @section crystalizer
  2222. Simple algorithm to expand audio dynamic range.
  2223. The filter accepts the following options:
  2224. @table @option
  2225. @item i
  2226. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2227. (unchanged sound) to 10.0 (maximum effect).
  2228. @item c
  2229. Enable clipping. By default is enabled.
  2230. @end table
  2231. @section dcshift
  2232. Apply a DC shift to the audio.
  2233. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2234. in the recording chain) from the audio. The effect of a DC offset is reduced
  2235. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2236. a signal has a DC offset.
  2237. @table @option
  2238. @item shift
  2239. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2240. the audio.
  2241. @item limitergain
  2242. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2243. used to prevent clipping.
  2244. @end table
  2245. @section drmeter
  2246. Measure audio dynamic range.
  2247. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2248. is found in transition material. And anything less that 8 have very poor dynamics
  2249. and is very compressed.
  2250. The filter accepts the following options:
  2251. @table @option
  2252. @item length
  2253. Set window length in seconds used to split audio into segments of equal length.
  2254. Default is 3 seconds.
  2255. @end table
  2256. @section dynaudnorm
  2257. Dynamic Audio Normalizer.
  2258. This filter applies a certain amount of gain to the input audio in order
  2259. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2260. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2261. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2262. This allows for applying extra gain to the "quiet" sections of the audio
  2263. while avoiding distortions or clipping the "loud" sections. In other words:
  2264. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2265. sections, in the sense that the volume of each section is brought to the
  2266. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2267. this goal *without* applying "dynamic range compressing". It will retain 100%
  2268. of the dynamic range *within* each section of the audio file.
  2269. @table @option
  2270. @item f
  2271. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2272. Default is 500 milliseconds.
  2273. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2274. referred to as frames. This is required, because a peak magnitude has no
  2275. meaning for just a single sample value. Instead, we need to determine the
  2276. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2277. normalizer would simply use the peak magnitude of the complete file, the
  2278. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2279. frame. The length of a frame is specified in milliseconds. By default, the
  2280. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2281. been found to give good results with most files.
  2282. Note that the exact frame length, in number of samples, will be determined
  2283. automatically, based on the sampling rate of the individual input audio file.
  2284. @item g
  2285. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2286. number. Default is 31.
  2287. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2288. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2289. is specified in frames, centered around the current frame. For the sake of
  2290. simplicity, this must be an odd number. Consequently, the default value of 31
  2291. takes into account the current frame, as well as the 15 preceding frames and
  2292. the 15 subsequent frames. Using a larger window results in a stronger
  2293. smoothing effect and thus in less gain variation, i.e. slower gain
  2294. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2295. effect and thus in more gain variation, i.e. faster gain adaptation.
  2296. In other words, the more you increase this value, the more the Dynamic Audio
  2297. Normalizer will behave like a "traditional" normalization filter. On the
  2298. contrary, the more you decrease this value, the more the Dynamic Audio
  2299. Normalizer will behave like a dynamic range compressor.
  2300. @item p
  2301. Set the target peak value. This specifies the highest permissible magnitude
  2302. level for the normalized audio input. This filter will try to approach the
  2303. target peak magnitude as closely as possible, but at the same time it also
  2304. makes sure that the normalized signal will never exceed the peak magnitude.
  2305. A frame's maximum local gain factor is imposed directly by the target peak
  2306. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2307. It is not recommended to go above this value.
  2308. @item m
  2309. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2310. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2311. factor for each input frame, i.e. the maximum gain factor that does not
  2312. result in clipping or distortion. The maximum gain factor is determined by
  2313. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2314. additionally bounds the frame's maximum gain factor by a predetermined
  2315. (global) maximum gain factor. This is done in order to avoid excessive gain
  2316. factors in "silent" or almost silent frames. By default, the maximum gain
  2317. factor is 10.0, For most inputs the default value should be sufficient and
  2318. it usually is not recommended to increase this value. Though, for input
  2319. with an extremely low overall volume level, it may be necessary to allow even
  2320. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2321. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2322. Instead, a "sigmoid" threshold function will be applied. This way, the
  2323. gain factors will smoothly approach the threshold value, but never exceed that
  2324. value.
  2325. @item r
  2326. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2327. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2328. This means that the maximum local gain factor for each frame is defined
  2329. (only) by the frame's highest magnitude sample. This way, the samples can
  2330. be amplified as much as possible without exceeding the maximum signal
  2331. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2332. Normalizer can also take into account the frame's root mean square,
  2333. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2334. determine the power of a time-varying signal. It is therefore considered
  2335. that the RMS is a better approximation of the "perceived loudness" than
  2336. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2337. frames to a constant RMS value, a uniform "perceived loudness" can be
  2338. established. If a target RMS value has been specified, a frame's local gain
  2339. factor is defined as the factor that would result in exactly that RMS value.
  2340. Note, however, that the maximum local gain factor is still restricted by the
  2341. frame's highest magnitude sample, in order to prevent clipping.
  2342. @item n
  2343. Enable channels coupling. By default is enabled.
  2344. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2345. amount. This means the same gain factor will be applied to all channels, i.e.
  2346. the maximum possible gain factor is determined by the "loudest" channel.
  2347. However, in some recordings, it may happen that the volume of the different
  2348. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2349. In this case, this option can be used to disable the channel coupling. This way,
  2350. the gain factor will be determined independently for each channel, depending
  2351. only on the individual channel's highest magnitude sample. This allows for
  2352. harmonizing the volume of the different channels.
  2353. @item c
  2354. Enable DC bias correction. By default is disabled.
  2355. An audio signal (in the time domain) is a sequence of sample values.
  2356. In the Dynamic Audio Normalizer these sample values are represented in the
  2357. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2358. audio signal, or "waveform", should be centered around the zero point.
  2359. That means if we calculate the mean value of all samples in a file, or in a
  2360. single frame, then the result should be 0.0 or at least very close to that
  2361. value. If, however, there is a significant deviation of the mean value from
  2362. 0.0, in either positive or negative direction, this is referred to as a
  2363. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2364. Audio Normalizer provides optional DC bias correction.
  2365. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2366. the mean value, or "DC correction" offset, of each input frame and subtract
  2367. that value from all of the frame's sample values which ensures those samples
  2368. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2369. boundaries, the DC correction offset values will be interpolated smoothly
  2370. between neighbouring frames.
  2371. @item b
  2372. Enable alternative boundary mode. By default is disabled.
  2373. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2374. around each frame. This includes the preceding frames as well as the
  2375. subsequent frames. However, for the "boundary" frames, located at the very
  2376. beginning and at the very end of the audio file, not all neighbouring
  2377. frames are available. In particular, for the first few frames in the audio
  2378. file, the preceding frames are not known. And, similarly, for the last few
  2379. frames in the audio file, the subsequent frames are not known. Thus, the
  2380. question arises which gain factors should be assumed for the missing frames
  2381. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2382. to deal with this situation. The default boundary mode assumes a gain factor
  2383. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2384. "fade out" at the beginning and at the end of the input, respectively.
  2385. @item s
  2386. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2387. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2388. compression. This means that signal peaks will not be pruned and thus the
  2389. full dynamic range will be retained within each local neighbourhood. However,
  2390. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2391. normalization algorithm with a more "traditional" compression.
  2392. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2393. (thresholding) function. If (and only if) the compression feature is enabled,
  2394. all input frames will be processed by a soft knee thresholding function prior
  2395. to the actual normalization process. Put simply, the thresholding function is
  2396. going to prune all samples whose magnitude exceeds a certain threshold value.
  2397. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2398. value. Instead, the threshold value will be adjusted for each individual
  2399. frame.
  2400. In general, smaller parameters result in stronger compression, and vice versa.
  2401. Values below 3.0 are not recommended, because audible distortion may appear.
  2402. @end table
  2403. @section earwax
  2404. Make audio easier to listen to on headphones.
  2405. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2406. so that when listened to on headphones the stereo image is moved from
  2407. inside your head (standard for headphones) to outside and in front of
  2408. the listener (standard for speakers).
  2409. Ported from SoX.
  2410. @section equalizer
  2411. Apply a two-pole peaking equalisation (EQ) filter. With this
  2412. filter, the signal-level at and around a selected frequency can
  2413. be increased or decreased, whilst (unlike bandpass and bandreject
  2414. filters) that at all other frequencies is unchanged.
  2415. In order to produce complex equalisation curves, this filter can
  2416. be given several times, each with a different central frequency.
  2417. The filter accepts the following options:
  2418. @table @option
  2419. @item frequency, f
  2420. Set the filter's central frequency in Hz.
  2421. @item width_type, t
  2422. Set method to specify band-width of filter.
  2423. @table @option
  2424. @item h
  2425. Hz
  2426. @item q
  2427. Q-Factor
  2428. @item o
  2429. octave
  2430. @item s
  2431. slope
  2432. @item k
  2433. kHz
  2434. @end table
  2435. @item width, w
  2436. Specify the band-width of a filter in width_type units.
  2437. @item gain, g
  2438. Set the required gain or attenuation in dB.
  2439. Beware of clipping when using a positive gain.
  2440. @item channels, c
  2441. Specify which channels to filter, by default all available are filtered.
  2442. @end table
  2443. @subsection Examples
  2444. @itemize
  2445. @item
  2446. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2447. @example
  2448. equalizer=f=1000:t=h:width=200:g=-10
  2449. @end example
  2450. @item
  2451. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2452. @example
  2453. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2454. @end example
  2455. @end itemize
  2456. @subsection Commands
  2457. This filter supports the following commands:
  2458. @table @option
  2459. @item frequency, f
  2460. Change equalizer frequency.
  2461. Syntax for the command is : "@var{frequency}"
  2462. @item width_type, t
  2463. Change equalizer width_type.
  2464. Syntax for the command is : "@var{width_type}"
  2465. @item width, w
  2466. Change equalizer width.
  2467. Syntax for the command is : "@var{width}"
  2468. @item gain, g
  2469. Change equalizer gain.
  2470. Syntax for the command is : "@var{gain}"
  2471. @end table
  2472. @section extrastereo
  2473. Linearly increases the difference between left and right channels which
  2474. adds some sort of "live" effect to playback.
  2475. The filter accepts the following options:
  2476. @table @option
  2477. @item m
  2478. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2479. (average of both channels), with 1.0 sound will be unchanged, with
  2480. -1.0 left and right channels will be swapped.
  2481. @item c
  2482. Enable clipping. By default is enabled.
  2483. @end table
  2484. @section firequalizer
  2485. Apply FIR Equalization using arbitrary frequency response.
  2486. The filter accepts the following option:
  2487. @table @option
  2488. @item gain
  2489. Set gain curve equation (in dB). The expression can contain variables:
  2490. @table @option
  2491. @item f
  2492. the evaluated frequency
  2493. @item sr
  2494. sample rate
  2495. @item ch
  2496. channel number, set to 0 when multichannels evaluation is disabled
  2497. @item chid
  2498. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2499. multichannels evaluation is disabled
  2500. @item chs
  2501. number of channels
  2502. @item chlayout
  2503. channel_layout, see libavutil/channel_layout.h
  2504. @end table
  2505. and functions:
  2506. @table @option
  2507. @item gain_interpolate(f)
  2508. interpolate gain on frequency f based on gain_entry
  2509. @item cubic_interpolate(f)
  2510. same as gain_interpolate, but smoother
  2511. @end table
  2512. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2513. @item gain_entry
  2514. Set gain entry for gain_interpolate function. The expression can
  2515. contain functions:
  2516. @table @option
  2517. @item entry(f, g)
  2518. store gain entry at frequency f with value g
  2519. @end table
  2520. This option is also available as command.
  2521. @item delay
  2522. Set filter delay in seconds. Higher value means more accurate.
  2523. Default is @code{0.01}.
  2524. @item accuracy
  2525. Set filter accuracy in Hz. Lower value means more accurate.
  2526. Default is @code{5}.
  2527. @item wfunc
  2528. Set window function. Acceptable values are:
  2529. @table @option
  2530. @item rectangular
  2531. rectangular window, useful when gain curve is already smooth
  2532. @item hann
  2533. hann window (default)
  2534. @item hamming
  2535. hamming window
  2536. @item blackman
  2537. blackman window
  2538. @item nuttall3
  2539. 3-terms continuous 1st derivative nuttall window
  2540. @item mnuttall3
  2541. minimum 3-terms discontinuous nuttall window
  2542. @item nuttall
  2543. 4-terms continuous 1st derivative nuttall window
  2544. @item bnuttall
  2545. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2546. @item bharris
  2547. blackman-harris window
  2548. @item tukey
  2549. tukey window
  2550. @end table
  2551. @item fixed
  2552. If enabled, use fixed number of audio samples. This improves speed when
  2553. filtering with large delay. Default is disabled.
  2554. @item multi
  2555. Enable multichannels evaluation on gain. Default is disabled.
  2556. @item zero_phase
  2557. Enable zero phase mode by subtracting timestamp to compensate delay.
  2558. Default is disabled.
  2559. @item scale
  2560. Set scale used by gain. Acceptable values are:
  2561. @table @option
  2562. @item linlin
  2563. linear frequency, linear gain
  2564. @item linlog
  2565. linear frequency, logarithmic (in dB) gain (default)
  2566. @item loglin
  2567. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2568. @item loglog
  2569. logarithmic frequency, logarithmic gain
  2570. @end table
  2571. @item dumpfile
  2572. Set file for dumping, suitable for gnuplot.
  2573. @item dumpscale
  2574. Set scale for dumpfile. Acceptable values are same with scale option.
  2575. Default is linlog.
  2576. @item fft2
  2577. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2578. Default is disabled.
  2579. @item min_phase
  2580. Enable minimum phase impulse response. Default is disabled.
  2581. @end table
  2582. @subsection Examples
  2583. @itemize
  2584. @item
  2585. lowpass at 1000 Hz:
  2586. @example
  2587. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2588. @end example
  2589. @item
  2590. lowpass at 1000 Hz with gain_entry:
  2591. @example
  2592. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2593. @end example
  2594. @item
  2595. custom equalization:
  2596. @example
  2597. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2598. @end example
  2599. @item
  2600. higher delay with zero phase to compensate delay:
  2601. @example
  2602. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2603. @end example
  2604. @item
  2605. lowpass on left channel, highpass on right channel:
  2606. @example
  2607. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2608. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2609. @end example
  2610. @end itemize
  2611. @section flanger
  2612. Apply a flanging effect to the audio.
  2613. The filter accepts the following options:
  2614. @table @option
  2615. @item delay
  2616. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2617. @item depth
  2618. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2619. @item regen
  2620. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2621. Default value is 0.
  2622. @item width
  2623. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2624. Default value is 71.
  2625. @item speed
  2626. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2627. @item shape
  2628. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2629. Default value is @var{sinusoidal}.
  2630. @item phase
  2631. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2632. Default value is 25.
  2633. @item interp
  2634. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2635. Default is @var{linear}.
  2636. @end table
  2637. @section haas
  2638. Apply Haas effect to audio.
  2639. Note that this makes most sense to apply on mono signals.
  2640. With this filter applied to mono signals it give some directionality and
  2641. stretches its stereo image.
  2642. The filter accepts the following options:
  2643. @table @option
  2644. @item level_in
  2645. Set input level. By default is @var{1}, or 0dB
  2646. @item level_out
  2647. Set output level. By default is @var{1}, or 0dB.
  2648. @item side_gain
  2649. Set gain applied to side part of signal. By default is @var{1}.
  2650. @item middle_source
  2651. Set kind of middle source. Can be one of the following:
  2652. @table @samp
  2653. @item left
  2654. Pick left channel.
  2655. @item right
  2656. Pick right channel.
  2657. @item mid
  2658. Pick middle part signal of stereo image.
  2659. @item side
  2660. Pick side part signal of stereo image.
  2661. @end table
  2662. @item middle_phase
  2663. Change middle phase. By default is disabled.
  2664. @item left_delay
  2665. Set left channel delay. By default is @var{2.05} milliseconds.
  2666. @item left_balance
  2667. Set left channel balance. By default is @var{-1}.
  2668. @item left_gain
  2669. Set left channel gain. By default is @var{1}.
  2670. @item left_phase
  2671. Change left phase. By default is disabled.
  2672. @item right_delay
  2673. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2674. @item right_balance
  2675. Set right channel balance. By default is @var{1}.
  2676. @item right_gain
  2677. Set right channel gain. By default is @var{1}.
  2678. @item right_phase
  2679. Change right phase. By default is enabled.
  2680. @end table
  2681. @section hdcd
  2682. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2683. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2684. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2685. of HDCD, and detects the Transient Filter flag.
  2686. @example
  2687. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2688. @end example
  2689. When using the filter with wav, note the default encoding for wav is 16-bit,
  2690. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2691. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2692. @example
  2693. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2694. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2695. @end example
  2696. The filter accepts the following options:
  2697. @table @option
  2698. @item disable_autoconvert
  2699. Disable any automatic format conversion or resampling in the filter graph.
  2700. @item process_stereo
  2701. Process the stereo channels together. If target_gain does not match between
  2702. channels, consider it invalid and use the last valid target_gain.
  2703. @item cdt_ms
  2704. Set the code detect timer period in ms.
  2705. @item force_pe
  2706. Always extend peaks above -3dBFS even if PE isn't signaled.
  2707. @item analyze_mode
  2708. Replace audio with a solid tone and adjust the amplitude to signal some
  2709. specific aspect of the decoding process. The output file can be loaded in
  2710. an audio editor alongside the original to aid analysis.
  2711. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2712. Modes are:
  2713. @table @samp
  2714. @item 0, off
  2715. Disabled
  2716. @item 1, lle
  2717. Gain adjustment level at each sample
  2718. @item 2, pe
  2719. Samples where peak extend occurs
  2720. @item 3, cdt
  2721. Samples where the code detect timer is active
  2722. @item 4, tgm
  2723. Samples where the target gain does not match between channels
  2724. @end table
  2725. @end table
  2726. @section headphone
  2727. Apply head-related transfer functions (HRTFs) to create virtual
  2728. loudspeakers around the user for binaural listening via headphones.
  2729. The HRIRs are provided via additional streams, for each channel
  2730. one stereo input stream is needed.
  2731. The filter accepts the following options:
  2732. @table @option
  2733. @item map
  2734. Set mapping of input streams for convolution.
  2735. The argument is a '|'-separated list of channel names in order as they
  2736. are given as additional stream inputs for filter.
  2737. This also specify number of input streams. Number of input streams
  2738. must be not less than number of channels in first stream plus one.
  2739. @item gain
  2740. Set gain applied to audio. Value is in dB. Default is 0.
  2741. @item type
  2742. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2743. processing audio in time domain which is slow.
  2744. @var{freq} is processing audio in frequency domain which is fast.
  2745. Default is @var{freq}.
  2746. @item lfe
  2747. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2748. @item size
  2749. Set size of frame in number of samples which will be processed at once.
  2750. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2751. @item hrir
  2752. Set format of hrir stream.
  2753. Default value is @var{stereo}. Alternative value is @var{multich}.
  2754. If value is set to @var{stereo}, number of additional streams should
  2755. be greater or equal to number of input channels in first input stream.
  2756. Also each additional stream should have stereo number of channels.
  2757. If value is set to @var{multich}, number of additional streams should
  2758. be exactly one. Also number of input channels of additional stream
  2759. should be equal or greater than twice number of channels of first input
  2760. stream.
  2761. @end table
  2762. @subsection Examples
  2763. @itemize
  2764. @item
  2765. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2766. each amovie filter use stereo file with IR coefficients as input.
  2767. The files give coefficients for each position of virtual loudspeaker:
  2768. @example
  2769. ffmpeg -i input.wav -lavfi-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],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2770. output.wav
  2771. @end example
  2772. @item
  2773. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2774. but now in @var{multich} @var{hrir} format.
  2775. @example
  2776. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2777. output.wav
  2778. @end example
  2779. @end itemize
  2780. @section highpass
  2781. Apply a high-pass filter with 3dB point frequency.
  2782. The filter can be either single-pole, or double-pole (the default).
  2783. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2784. The filter accepts the following options:
  2785. @table @option
  2786. @item frequency, f
  2787. Set frequency in Hz. Default is 3000.
  2788. @item poles, p
  2789. Set number of poles. Default is 2.
  2790. @item width_type, t
  2791. Set method to specify band-width of filter.
  2792. @table @option
  2793. @item h
  2794. Hz
  2795. @item q
  2796. Q-Factor
  2797. @item o
  2798. octave
  2799. @item s
  2800. slope
  2801. @item k
  2802. kHz
  2803. @end table
  2804. @item width, w
  2805. Specify the band-width of a filter in width_type units.
  2806. Applies only to double-pole filter.
  2807. The default is 0.707q and gives a Butterworth response.
  2808. @item channels, c
  2809. Specify which channels to filter, by default all available are filtered.
  2810. @end table
  2811. @subsection Commands
  2812. This filter supports the following commands:
  2813. @table @option
  2814. @item frequency, f
  2815. Change highpass frequency.
  2816. Syntax for the command is : "@var{frequency}"
  2817. @item width_type, t
  2818. Change highpass width_type.
  2819. Syntax for the command is : "@var{width_type}"
  2820. @item width, w
  2821. Change highpass width.
  2822. Syntax for the command is : "@var{width}"
  2823. @end table
  2824. @section join
  2825. Join multiple input streams into one multi-channel stream.
  2826. It accepts the following parameters:
  2827. @table @option
  2828. @item inputs
  2829. The number of input streams. It defaults to 2.
  2830. @item channel_layout
  2831. The desired output channel layout. It defaults to stereo.
  2832. @item map
  2833. Map channels from inputs to output. The argument is a '|'-separated list of
  2834. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2835. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2836. can be either the name of the input channel (e.g. FL for front left) or its
  2837. index in the specified input stream. @var{out_channel} is the name of the output
  2838. channel.
  2839. @end table
  2840. The filter will attempt to guess the mappings when they are not specified
  2841. explicitly. It does so by first trying to find an unused matching input channel
  2842. and if that fails it picks the first unused input channel.
  2843. Join 3 inputs (with properly set channel layouts):
  2844. @example
  2845. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2846. @end example
  2847. Build a 5.1 output from 6 single-channel streams:
  2848. @example
  2849. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2850. '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'
  2851. out
  2852. @end example
  2853. @section ladspa
  2854. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2855. To enable compilation of this filter you need to configure FFmpeg with
  2856. @code{--enable-ladspa}.
  2857. @table @option
  2858. @item file, f
  2859. Specifies the name of LADSPA plugin library to load. If the environment
  2860. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2861. each one of the directories specified by the colon separated list in
  2862. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2863. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2864. @file{/usr/lib/ladspa/}.
  2865. @item plugin, p
  2866. Specifies the plugin within the library. Some libraries contain only
  2867. one plugin, but others contain many of them. If this is not set filter
  2868. will list all available plugins within the specified library.
  2869. @item controls, c
  2870. Set the '|' separated list of controls which are zero or more floating point
  2871. values that determine the behavior of the loaded plugin (for example delay,
  2872. threshold or gain).
  2873. Controls need to be defined using the following syntax:
  2874. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2875. @var{valuei} is the value set on the @var{i}-th control.
  2876. Alternatively they can be also defined using the following syntax:
  2877. @var{value0}|@var{value1}|@var{value2}|..., where
  2878. @var{valuei} is the value set on the @var{i}-th control.
  2879. If @option{controls} is set to @code{help}, all available controls and
  2880. their valid ranges are printed.
  2881. @item sample_rate, s
  2882. Specify the sample rate, default to 44100. Only used if plugin have
  2883. zero inputs.
  2884. @item nb_samples, n
  2885. Set the number of samples per channel per each output frame, default
  2886. is 1024. Only used if plugin have zero inputs.
  2887. @item duration, d
  2888. Set the minimum duration of the sourced audio. See
  2889. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2890. for the accepted syntax.
  2891. Note that the resulting duration may be greater than the specified duration,
  2892. as the generated audio is always cut at the end of a complete frame.
  2893. If not specified, or the expressed duration is negative, the audio is
  2894. supposed to be generated forever.
  2895. Only used if plugin have zero inputs.
  2896. @end table
  2897. @subsection Examples
  2898. @itemize
  2899. @item
  2900. List all available plugins within amp (LADSPA example plugin) library:
  2901. @example
  2902. ladspa=file=amp
  2903. @end example
  2904. @item
  2905. List all available controls and their valid ranges for @code{vcf_notch}
  2906. plugin from @code{VCF} library:
  2907. @example
  2908. ladspa=f=vcf:p=vcf_notch:c=help
  2909. @end example
  2910. @item
  2911. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2912. plugin library:
  2913. @example
  2914. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2915. @end example
  2916. @item
  2917. Add reverberation to the audio using TAP-plugins
  2918. (Tom's Audio Processing plugins):
  2919. @example
  2920. ladspa=file=tap_reverb:tap_reverb
  2921. @end example
  2922. @item
  2923. Generate white noise, with 0.2 amplitude:
  2924. @example
  2925. ladspa=file=cmt:noise_source_white:c=c0=.2
  2926. @end example
  2927. @item
  2928. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2929. @code{C* Audio Plugin Suite} (CAPS) library:
  2930. @example
  2931. ladspa=file=caps:Click:c=c1=20'
  2932. @end example
  2933. @item
  2934. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2935. @example
  2936. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2937. @end example
  2938. @item
  2939. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2940. @code{SWH Plugins} collection:
  2941. @example
  2942. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2943. @end example
  2944. @item
  2945. Attenuate low frequencies using Multiband EQ from Steve Harris
  2946. @code{SWH Plugins} collection:
  2947. @example
  2948. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2949. @end example
  2950. @item
  2951. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2952. (CAPS) library:
  2953. @example
  2954. ladspa=caps:Narrower
  2955. @end example
  2956. @item
  2957. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2958. @example
  2959. ladspa=caps:White:.2
  2960. @end example
  2961. @item
  2962. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2963. @example
  2964. ladspa=caps:Fractal:c=c1=1
  2965. @end example
  2966. @item
  2967. Dynamic volume normalization using @code{VLevel} plugin:
  2968. @example
  2969. ladspa=vlevel-ladspa:vlevel_mono
  2970. @end example
  2971. @end itemize
  2972. @subsection Commands
  2973. This filter supports the following commands:
  2974. @table @option
  2975. @item cN
  2976. Modify the @var{N}-th control value.
  2977. If the specified value is not valid, it is ignored and prior one is kept.
  2978. @end table
  2979. @section loudnorm
  2980. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2981. Support for both single pass (livestreams, files) and double pass (files) modes.
  2982. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2983. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2984. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2985. The filter accepts the following options:
  2986. @table @option
  2987. @item I, i
  2988. Set integrated loudness target.
  2989. Range is -70.0 - -5.0. Default value is -24.0.
  2990. @item LRA, lra
  2991. Set loudness range target.
  2992. Range is 1.0 - 20.0. Default value is 7.0.
  2993. @item TP, tp
  2994. Set maximum true peak.
  2995. Range is -9.0 - +0.0. Default value is -2.0.
  2996. @item measured_I, measured_i
  2997. Measured IL of input file.
  2998. Range is -99.0 - +0.0.
  2999. @item measured_LRA, measured_lra
  3000. Measured LRA of input file.
  3001. Range is 0.0 - 99.0.
  3002. @item measured_TP, measured_tp
  3003. Measured true peak of input file.
  3004. Range is -99.0 - +99.0.
  3005. @item measured_thresh
  3006. Measured threshold of input file.
  3007. Range is -99.0 - +0.0.
  3008. @item offset
  3009. Set offset gain. Gain is applied before the true-peak limiter.
  3010. Range is -99.0 - +99.0. Default is +0.0.
  3011. @item linear
  3012. Normalize linearly if possible.
  3013. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3014. to be specified in order to use this mode.
  3015. Options are true or false. Default is true.
  3016. @item dual_mono
  3017. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3018. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3019. If set to @code{true}, this option will compensate for this effect.
  3020. Multi-channel input files are not affected by this option.
  3021. Options are true or false. Default is false.
  3022. @item print_format
  3023. Set print format for stats. Options are summary, json, or none.
  3024. Default value is none.
  3025. @end table
  3026. @section lowpass
  3027. Apply a low-pass filter with 3dB point frequency.
  3028. The filter can be either single-pole or double-pole (the default).
  3029. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3030. The filter accepts the following options:
  3031. @table @option
  3032. @item frequency, f
  3033. Set frequency in Hz. Default is 500.
  3034. @item poles, p
  3035. Set number of poles. Default is 2.
  3036. @item width_type, t
  3037. Set method to specify band-width of filter.
  3038. @table @option
  3039. @item h
  3040. Hz
  3041. @item q
  3042. Q-Factor
  3043. @item o
  3044. octave
  3045. @item s
  3046. slope
  3047. @item k
  3048. kHz
  3049. @end table
  3050. @item width, w
  3051. Specify the band-width of a filter in width_type units.
  3052. Applies only to double-pole filter.
  3053. The default is 0.707q and gives a Butterworth response.
  3054. @item channels, c
  3055. Specify which channels to filter, by default all available are filtered.
  3056. @end table
  3057. @subsection Examples
  3058. @itemize
  3059. @item
  3060. Lowpass only LFE channel, it LFE is not present it does nothing:
  3061. @example
  3062. lowpass=c=LFE
  3063. @end example
  3064. @end itemize
  3065. @subsection Commands
  3066. This filter supports the following commands:
  3067. @table @option
  3068. @item frequency, f
  3069. Change lowpass frequency.
  3070. Syntax for the command is : "@var{frequency}"
  3071. @item width_type, t
  3072. Change lowpass width_type.
  3073. Syntax for the command is : "@var{width_type}"
  3074. @item width, w
  3075. Change lowpass width.
  3076. Syntax for the command is : "@var{width}"
  3077. @end table
  3078. @section lv2
  3079. Load a LV2 (LADSPA Version 2) plugin.
  3080. To enable compilation of this filter you need to configure FFmpeg with
  3081. @code{--enable-lv2}.
  3082. @table @option
  3083. @item plugin, p
  3084. Specifies the plugin URI. You may need to escape ':'.
  3085. @item controls, c
  3086. Set the '|' separated list of controls which are zero or more floating point
  3087. values that determine the behavior of the loaded plugin (for example delay,
  3088. threshold or gain).
  3089. If @option{controls} is set to @code{help}, all available controls and
  3090. their valid ranges are printed.
  3091. @item sample_rate, s
  3092. Specify the sample rate, default to 44100. Only used if plugin have
  3093. zero inputs.
  3094. @item nb_samples, n
  3095. Set the number of samples per channel per each output frame, default
  3096. is 1024. Only used if plugin have zero inputs.
  3097. @item duration, d
  3098. Set the minimum duration of the sourced audio. See
  3099. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3100. for the accepted syntax.
  3101. Note that the resulting duration may be greater than the specified duration,
  3102. as the generated audio is always cut at the end of a complete frame.
  3103. If not specified, or the expressed duration is negative, the audio is
  3104. supposed to be generated forever.
  3105. Only used if plugin have zero inputs.
  3106. @end table
  3107. @subsection Examples
  3108. @itemize
  3109. @item
  3110. Apply bass enhancer plugin from Calf:
  3111. @example
  3112. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3113. @end example
  3114. @item
  3115. Apply vinyl plugin from Calf:
  3116. @example
  3117. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3118. @end example
  3119. @item
  3120. Apply bit crusher plugin from ArtyFX:
  3121. @example
  3122. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3123. @end example
  3124. @end itemize
  3125. @section mcompand
  3126. Multiband Compress or expand the audio's dynamic range.
  3127. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3128. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3129. response when absent compander action.
  3130. It accepts the following parameters:
  3131. @table @option
  3132. @item args
  3133. This option syntax is:
  3134. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3135. For explanation of each item refer to compand filter documentation.
  3136. @end table
  3137. @anchor{pan}
  3138. @section pan
  3139. Mix channels with specific gain levels. The filter accepts the output
  3140. channel layout followed by a set of channels definitions.
  3141. This filter is also designed to efficiently remap the channels of an audio
  3142. stream.
  3143. The filter accepts parameters of the form:
  3144. "@var{l}|@var{outdef}|@var{outdef}|..."
  3145. @table @option
  3146. @item l
  3147. output channel layout or number of channels
  3148. @item outdef
  3149. output channel specification, of the form:
  3150. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3151. @item out_name
  3152. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3153. number (c0, c1, etc.)
  3154. @item gain
  3155. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3156. @item in_name
  3157. input channel to use, see out_name for details; it is not possible to mix
  3158. named and numbered input channels
  3159. @end table
  3160. If the `=' in a channel specification is replaced by `<', then the gains for
  3161. that specification will be renormalized so that the total is 1, thus
  3162. avoiding clipping noise.
  3163. @subsection Mixing examples
  3164. For example, if you want to down-mix from stereo to mono, but with a bigger
  3165. factor for the left channel:
  3166. @example
  3167. pan=1c|c0=0.9*c0+0.1*c1
  3168. @end example
  3169. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3170. 7-channels surround:
  3171. @example
  3172. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3173. @end example
  3174. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3175. that should be preferred (see "-ac" option) unless you have very specific
  3176. needs.
  3177. @subsection Remapping examples
  3178. The channel remapping will be effective if, and only if:
  3179. @itemize
  3180. @item gain coefficients are zeroes or ones,
  3181. @item only one input per channel output,
  3182. @end itemize
  3183. If all these conditions are satisfied, the filter will notify the user ("Pure
  3184. channel mapping detected"), and use an optimized and lossless method to do the
  3185. remapping.
  3186. For example, if you have a 5.1 source and want a stereo audio stream by
  3187. dropping the extra channels:
  3188. @example
  3189. pan="stereo| c0=FL | c1=FR"
  3190. @end example
  3191. Given the same source, you can also switch front left and front right channels
  3192. and keep the input channel layout:
  3193. @example
  3194. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3195. @end example
  3196. If the input is a stereo audio stream, you can mute the front left channel (and
  3197. still keep the stereo channel layout) with:
  3198. @example
  3199. pan="stereo|c1=c1"
  3200. @end example
  3201. Still with a stereo audio stream input, you can copy the right channel in both
  3202. front left and right:
  3203. @example
  3204. pan="stereo| c0=FR | c1=FR"
  3205. @end example
  3206. @section replaygain
  3207. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3208. outputs it unchanged.
  3209. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3210. @section resample
  3211. Convert the audio sample format, sample rate and channel layout. It is
  3212. not meant to be used directly.
  3213. @section rubberband
  3214. Apply time-stretching and pitch-shifting with librubberband.
  3215. To enable compilation of this filter, you need to configure FFmpeg with
  3216. @code{--enable-librubberband}.
  3217. The filter accepts the following options:
  3218. @table @option
  3219. @item tempo
  3220. Set tempo scale factor.
  3221. @item pitch
  3222. Set pitch scale factor.
  3223. @item transients
  3224. Set transients detector.
  3225. Possible values are:
  3226. @table @var
  3227. @item crisp
  3228. @item mixed
  3229. @item smooth
  3230. @end table
  3231. @item detector
  3232. Set detector.
  3233. Possible values are:
  3234. @table @var
  3235. @item compound
  3236. @item percussive
  3237. @item soft
  3238. @end table
  3239. @item phase
  3240. Set phase.
  3241. Possible values are:
  3242. @table @var
  3243. @item laminar
  3244. @item independent
  3245. @end table
  3246. @item window
  3247. Set processing window size.
  3248. Possible values are:
  3249. @table @var
  3250. @item standard
  3251. @item short
  3252. @item long
  3253. @end table
  3254. @item smoothing
  3255. Set smoothing.
  3256. Possible values are:
  3257. @table @var
  3258. @item off
  3259. @item on
  3260. @end table
  3261. @item formant
  3262. Enable formant preservation when shift pitching.
  3263. Possible values are:
  3264. @table @var
  3265. @item shifted
  3266. @item preserved
  3267. @end table
  3268. @item pitchq
  3269. Set pitch quality.
  3270. Possible values are:
  3271. @table @var
  3272. @item quality
  3273. @item speed
  3274. @item consistency
  3275. @end table
  3276. @item channels
  3277. Set channels.
  3278. Possible values are:
  3279. @table @var
  3280. @item apart
  3281. @item together
  3282. @end table
  3283. @end table
  3284. @section sidechaincompress
  3285. This filter acts like normal compressor but has the ability to compress
  3286. detected signal using second input signal.
  3287. It needs two input streams and returns one output stream.
  3288. First input stream will be processed depending on second stream signal.
  3289. The filtered signal then can be filtered with other filters in later stages of
  3290. processing. See @ref{pan} and @ref{amerge} filter.
  3291. The filter accepts the following options:
  3292. @table @option
  3293. @item level_in
  3294. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3295. @item threshold
  3296. If a signal of second stream raises above this level it will affect the gain
  3297. reduction of first stream.
  3298. By default is 0.125. Range is between 0.00097563 and 1.
  3299. @item ratio
  3300. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3301. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3302. Default is 2. Range is between 1 and 20.
  3303. @item attack
  3304. Amount of milliseconds the signal has to rise above the threshold before gain
  3305. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3306. @item release
  3307. Amount of milliseconds the signal has to fall below the threshold before
  3308. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3309. @item makeup
  3310. Set the amount by how much signal will be amplified after processing.
  3311. Default is 1. Range is from 1 to 64.
  3312. @item knee
  3313. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3314. Default is 2.82843. Range is between 1 and 8.
  3315. @item link
  3316. Choose if the @code{average} level between all channels of side-chain stream
  3317. or the louder(@code{maximum}) channel of side-chain stream affects the
  3318. reduction. Default is @code{average}.
  3319. @item detection
  3320. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3321. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3322. @item level_sc
  3323. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3324. @item mix
  3325. How much to use compressed signal in output. Default is 1.
  3326. Range is between 0 and 1.
  3327. @end table
  3328. @subsection Examples
  3329. @itemize
  3330. @item
  3331. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3332. depending on the signal of 2nd input and later compressed signal to be
  3333. merged with 2nd input:
  3334. @example
  3335. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3336. @end example
  3337. @end itemize
  3338. @section sidechaingate
  3339. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3340. filter the detected signal before sending it to the gain reduction stage.
  3341. Normally a gate uses the full range signal to detect a level above the
  3342. threshold.
  3343. For example: If you cut all lower frequencies from your sidechain signal
  3344. the gate will decrease the volume of your track only if not enough highs
  3345. appear. With this technique you are able to reduce the resonation of a
  3346. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3347. guitar.
  3348. It needs two input streams and returns one output stream.
  3349. First input stream will be processed depending on second stream signal.
  3350. The filter accepts the following options:
  3351. @table @option
  3352. @item level_in
  3353. Set input level before filtering.
  3354. Default is 1. Allowed range is from 0.015625 to 64.
  3355. @item range
  3356. Set the level of gain reduction when the signal is below the threshold.
  3357. Default is 0.06125. Allowed range is from 0 to 1.
  3358. @item threshold
  3359. If a signal rises above this level the gain reduction is released.
  3360. Default is 0.125. Allowed range is from 0 to 1.
  3361. @item ratio
  3362. Set a ratio about which the signal is reduced.
  3363. Default is 2. Allowed range is from 1 to 9000.
  3364. @item attack
  3365. Amount of milliseconds the signal has to rise above the threshold before gain
  3366. reduction stops.
  3367. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3368. @item release
  3369. Amount of milliseconds the signal has to fall below the threshold before the
  3370. reduction is increased again. Default is 250 milliseconds.
  3371. Allowed range is from 0.01 to 9000.
  3372. @item makeup
  3373. Set amount of amplification of signal after processing.
  3374. Default is 1. Allowed range is from 1 to 64.
  3375. @item knee
  3376. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3377. Default is 2.828427125. Allowed range is from 1 to 8.
  3378. @item detection
  3379. Choose if exact signal should be taken for detection or an RMS like one.
  3380. Default is rms. Can be peak or rms.
  3381. @item link
  3382. Choose if the average level between all channels or the louder channel affects
  3383. the reduction.
  3384. Default is average. Can be average or maximum.
  3385. @item level_sc
  3386. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3387. @end table
  3388. @section silencedetect
  3389. Detect silence in an audio stream.
  3390. This filter logs a message when it detects that the input audio volume is less
  3391. or equal to a noise tolerance value for a duration greater or equal to the
  3392. minimum detected noise duration.
  3393. The printed times and duration are expressed in seconds.
  3394. The filter accepts the following options:
  3395. @table @option
  3396. @item noise, n
  3397. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3398. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3399. @item duration, d
  3400. Set silence duration until notification (default is 2 seconds).
  3401. @item mono, m
  3402. Process each channel separately, instead of combined. By default is disabled.
  3403. @end table
  3404. @subsection Examples
  3405. @itemize
  3406. @item
  3407. Detect 5 seconds of silence with -50dB noise tolerance:
  3408. @example
  3409. silencedetect=n=-50dB:d=5
  3410. @end example
  3411. @item
  3412. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3413. tolerance in @file{silence.mp3}:
  3414. @example
  3415. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3416. @end example
  3417. @end itemize
  3418. @section silenceremove
  3419. Remove silence from the beginning, middle or end of the audio.
  3420. The filter accepts the following options:
  3421. @table @option
  3422. @item start_periods
  3423. This value is used to indicate if audio should be trimmed at beginning of
  3424. the audio. A value of zero indicates no silence should be trimmed from the
  3425. beginning. When specifying a non-zero value, it trims audio up until it
  3426. finds non-silence. Normally, when trimming silence from beginning of audio
  3427. the @var{start_periods} will be @code{1} but it can be increased to higher
  3428. values to trim all audio up to specific count of non-silence periods.
  3429. Default value is @code{0}.
  3430. @item start_duration
  3431. Specify the amount of time that non-silence must be detected before it stops
  3432. trimming audio. By increasing the duration, bursts of noises can be treated
  3433. as silence and trimmed off. Default value is @code{0}.
  3434. @item start_threshold
  3435. This indicates what sample value should be treated as silence. For digital
  3436. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3437. you may wish to increase the value to account for background noise.
  3438. Can be specified in dB (in case "dB" is appended to the specified value)
  3439. or amplitude ratio. Default value is @code{0}.
  3440. @item start_silence
  3441. Specify max duration of silence at beginning that will be kept after
  3442. trimming. Default is 0, which is equal to trimming all samples detected
  3443. as silence.
  3444. @item start_mode
  3445. Specify mode of detection of silence end in start of multi-channel audio.
  3446. Can be @var{any} or @var{all}. Default is @var{any}.
  3447. With @var{any}, any sample that is detected as non-silence will cause
  3448. stopped trimming of silence.
  3449. With @var{all}, only if all channels are detected as non-silence will cause
  3450. stopped trimming of silence.
  3451. @item stop_periods
  3452. Set the count for trimming silence from the end of audio.
  3453. To remove silence from the middle of a file, specify a @var{stop_periods}
  3454. that is negative. This value is then treated as a positive value and is
  3455. used to indicate the effect should restart processing as specified by
  3456. @var{start_periods}, making it suitable for removing periods of silence
  3457. in the middle of the audio.
  3458. Default value is @code{0}.
  3459. @item stop_duration
  3460. Specify a duration of silence that must exist before audio is not copied any
  3461. more. By specifying a higher duration, silence that is wanted can be left in
  3462. the audio.
  3463. Default value is @code{0}.
  3464. @item stop_threshold
  3465. This is the same as @option{start_threshold} but for trimming silence from
  3466. the end of audio.
  3467. Can be specified in dB (in case "dB" is appended to the specified value)
  3468. or amplitude ratio. Default value is @code{0}.
  3469. @item stop_silence
  3470. Specify max duration of silence at end that will be kept after
  3471. trimming. Default is 0, which is equal to trimming all samples detected
  3472. as silence.
  3473. @item stop_mode
  3474. Specify mode of detection of silence start in end of multi-channel audio.
  3475. Can be @var{any} or @var{all}. Default is @var{any}.
  3476. With @var{any}, any sample that is detected as non-silence will cause
  3477. stopped trimming of silence.
  3478. With @var{all}, only if all channels are detected as non-silence will cause
  3479. stopped trimming of silence.
  3480. @item detection
  3481. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3482. and works better with digital silence which is exactly 0.
  3483. Default value is @code{rms}.
  3484. @item window
  3485. Set duration in number of seconds used to calculate size of window in number
  3486. of samples for detecting silence.
  3487. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3488. @end table
  3489. @subsection Examples
  3490. @itemize
  3491. @item
  3492. The following example shows how this filter can be used to start a recording
  3493. that does not contain the delay at the start which usually occurs between
  3494. pressing the record button and the start of the performance:
  3495. @example
  3496. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3497. @end example
  3498. @item
  3499. Trim all silence encountered from beginning to end where there is more than 1
  3500. second of silence in audio:
  3501. @example
  3502. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3503. @end example
  3504. @end itemize
  3505. @section sofalizer
  3506. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3507. loudspeakers around the user for binaural listening via headphones (audio
  3508. formats up to 9 channels supported).
  3509. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3510. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3511. Austrian Academy of Sciences.
  3512. To enable compilation of this filter you need to configure FFmpeg with
  3513. @code{--enable-libmysofa}.
  3514. The filter accepts the following options:
  3515. @table @option
  3516. @item sofa
  3517. Set the SOFA file used for rendering.
  3518. @item gain
  3519. Set gain applied to audio. Value is in dB. Default is 0.
  3520. @item rotation
  3521. Set rotation of virtual loudspeakers in deg. Default is 0.
  3522. @item elevation
  3523. Set elevation of virtual speakers in deg. Default is 0.
  3524. @item radius
  3525. Set distance in meters between loudspeakers and the listener with near-field
  3526. HRTFs. Default is 1.
  3527. @item type
  3528. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3529. processing audio in time domain which is slow.
  3530. @var{freq} is processing audio in frequency domain which is fast.
  3531. Default is @var{freq}.
  3532. @item speakers
  3533. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3534. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3535. Each virtual loudspeaker is described with short channel name following with
  3536. azimuth and elevation in degrees.
  3537. Each virtual loudspeaker description is separated by '|'.
  3538. For example to override front left and front right channel positions use:
  3539. 'speakers=FL 45 15|FR 345 15'.
  3540. Descriptions with unrecognised channel names are ignored.
  3541. @item lfegain
  3542. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3543. @item framesize
  3544. Set custom frame size in number of samples. Default is 1024.
  3545. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3546. is set to @var{freq}.
  3547. @item normalize
  3548. Should all IRs be normalized upon importing SOFA file.
  3549. By default is enabled.
  3550. @item interpolate
  3551. Should nearest IRs be interpolated with neighbor IRs if exact position
  3552. does not match. By default is disabled.
  3553. @item minphase
  3554. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3555. @item anglestep
  3556. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3557. @item radstep
  3558. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3559. @end table
  3560. @subsection Examples
  3561. @itemize
  3562. @item
  3563. Using ClubFritz6 sofa file:
  3564. @example
  3565. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3566. @end example
  3567. @item
  3568. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3569. @example
  3570. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3571. @end example
  3572. @item
  3573. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3574. and also with custom gain:
  3575. @example
  3576. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3577. @end example
  3578. @end itemize
  3579. @section stereotools
  3580. This filter has some handy utilities to manage stereo signals, for converting
  3581. M/S stereo recordings to L/R signal while having control over the parameters
  3582. or spreading the stereo image of master track.
  3583. The filter accepts the following options:
  3584. @table @option
  3585. @item level_in
  3586. Set input level before filtering for both channels. Defaults is 1.
  3587. Allowed range is from 0.015625 to 64.
  3588. @item level_out
  3589. Set output level after filtering for both channels. Defaults is 1.
  3590. Allowed range is from 0.015625 to 64.
  3591. @item balance_in
  3592. Set input balance between both channels. Default is 0.
  3593. Allowed range is from -1 to 1.
  3594. @item balance_out
  3595. Set output balance between both channels. Default is 0.
  3596. Allowed range is from -1 to 1.
  3597. @item softclip
  3598. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3599. clipping. Disabled by default.
  3600. @item mutel
  3601. Mute the left channel. Disabled by default.
  3602. @item muter
  3603. Mute the right channel. Disabled by default.
  3604. @item phasel
  3605. Change the phase of the left channel. Disabled by default.
  3606. @item phaser
  3607. Change the phase of the right channel. Disabled by default.
  3608. @item mode
  3609. Set stereo mode. Available values are:
  3610. @table @samp
  3611. @item lr>lr
  3612. Left/Right to Left/Right, this is default.
  3613. @item lr>ms
  3614. Left/Right to Mid/Side.
  3615. @item ms>lr
  3616. Mid/Side to Left/Right.
  3617. @item lr>ll
  3618. Left/Right to Left/Left.
  3619. @item lr>rr
  3620. Left/Right to Right/Right.
  3621. @item lr>l+r
  3622. Left/Right to Left + Right.
  3623. @item lr>rl
  3624. Left/Right to Right/Left.
  3625. @item ms>ll
  3626. Mid/Side to Left/Left.
  3627. @item ms>rr
  3628. Mid/Side to Right/Right.
  3629. @end table
  3630. @item slev
  3631. Set level of side signal. Default is 1.
  3632. Allowed range is from 0.015625 to 64.
  3633. @item sbal
  3634. Set balance of side signal. Default is 0.
  3635. Allowed range is from -1 to 1.
  3636. @item mlev
  3637. Set level of the middle signal. Default is 1.
  3638. Allowed range is from 0.015625 to 64.
  3639. @item mpan
  3640. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3641. @item base
  3642. Set stereo base between mono and inversed channels. Default is 0.
  3643. Allowed range is from -1 to 1.
  3644. @item delay
  3645. Set delay in milliseconds how much to delay left from right channel and
  3646. vice versa. Default is 0. Allowed range is from -20 to 20.
  3647. @item sclevel
  3648. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3649. @item phase
  3650. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3651. @item bmode_in, bmode_out
  3652. Set balance mode for balance_in/balance_out option.
  3653. Can be one of the following:
  3654. @table @samp
  3655. @item balance
  3656. Classic balance mode. Attenuate one channel at time.
  3657. Gain is raised up to 1.
  3658. @item amplitude
  3659. Similar as classic mode above but gain is raised up to 2.
  3660. @item power
  3661. Equal power distribution, from -6dB to +6dB range.
  3662. @end table
  3663. @end table
  3664. @subsection Examples
  3665. @itemize
  3666. @item
  3667. Apply karaoke like effect:
  3668. @example
  3669. stereotools=mlev=0.015625
  3670. @end example
  3671. @item
  3672. Convert M/S signal to L/R:
  3673. @example
  3674. "stereotools=mode=ms>lr"
  3675. @end example
  3676. @end itemize
  3677. @section stereowiden
  3678. This filter enhance the stereo effect by suppressing signal common to both
  3679. channels and by delaying the signal of left into right and vice versa,
  3680. thereby widening the stereo effect.
  3681. The filter accepts the following options:
  3682. @table @option
  3683. @item delay
  3684. Time in milliseconds of the delay of left signal into right and vice versa.
  3685. Default is 20 milliseconds.
  3686. @item feedback
  3687. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3688. effect of left signal in right output and vice versa which gives widening
  3689. effect. Default is 0.3.
  3690. @item crossfeed
  3691. Cross feed of left into right with inverted phase. This helps in suppressing
  3692. the mono. If the value is 1 it will cancel all the signal common to both
  3693. channels. Default is 0.3.
  3694. @item drymix
  3695. Set level of input signal of original channel. Default is 0.8.
  3696. @end table
  3697. @section superequalizer
  3698. Apply 18 band equalizer.
  3699. The filter accepts the following options:
  3700. @table @option
  3701. @item 1b
  3702. Set 65Hz band gain.
  3703. @item 2b
  3704. Set 92Hz band gain.
  3705. @item 3b
  3706. Set 131Hz band gain.
  3707. @item 4b
  3708. Set 185Hz band gain.
  3709. @item 5b
  3710. Set 262Hz band gain.
  3711. @item 6b
  3712. Set 370Hz band gain.
  3713. @item 7b
  3714. Set 523Hz band gain.
  3715. @item 8b
  3716. Set 740Hz band gain.
  3717. @item 9b
  3718. Set 1047Hz band gain.
  3719. @item 10b
  3720. Set 1480Hz band gain.
  3721. @item 11b
  3722. Set 2093Hz band gain.
  3723. @item 12b
  3724. Set 2960Hz band gain.
  3725. @item 13b
  3726. Set 4186Hz band gain.
  3727. @item 14b
  3728. Set 5920Hz band gain.
  3729. @item 15b
  3730. Set 8372Hz band gain.
  3731. @item 16b
  3732. Set 11840Hz band gain.
  3733. @item 17b
  3734. Set 16744Hz band gain.
  3735. @item 18b
  3736. Set 20000Hz band gain.
  3737. @end table
  3738. @section surround
  3739. Apply audio surround upmix filter.
  3740. This filter allows to produce multichannel output from audio stream.
  3741. The filter accepts the following options:
  3742. @table @option
  3743. @item chl_out
  3744. Set output channel layout. By default, this is @var{5.1}.
  3745. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3746. for the required syntax.
  3747. @item chl_in
  3748. Set input channel layout. By default, this is @var{stereo}.
  3749. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3750. for the required syntax.
  3751. @item level_in
  3752. Set input volume level. By default, this is @var{1}.
  3753. @item level_out
  3754. Set output volume level. By default, this is @var{1}.
  3755. @item lfe
  3756. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3757. @item lfe_low
  3758. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3759. @item lfe_high
  3760. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3761. @item fc_in
  3762. Set front center input volume. By default, this is @var{1}.
  3763. @item fc_out
  3764. Set front center output volume. By default, this is @var{1}.
  3765. @item lfe_in
  3766. Set LFE input volume. By default, this is @var{1}.
  3767. @item lfe_out
  3768. Set LFE output volume. By default, this is @var{1}.
  3769. @end table
  3770. @section treble, highshelf
  3771. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3772. shelving filter with a response similar to that of a standard
  3773. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3774. The filter accepts the following options:
  3775. @table @option
  3776. @item gain, g
  3777. Give the gain at whichever is the lower of ~22 kHz and the
  3778. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3779. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3780. @item frequency, f
  3781. Set the filter's central frequency and so can be used
  3782. to extend or reduce the frequency range to be boosted or cut.
  3783. The default value is @code{3000} Hz.
  3784. @item width_type, t
  3785. Set method to specify band-width of filter.
  3786. @table @option
  3787. @item h
  3788. Hz
  3789. @item q
  3790. Q-Factor
  3791. @item o
  3792. octave
  3793. @item s
  3794. slope
  3795. @item k
  3796. kHz
  3797. @end table
  3798. @item width, w
  3799. Determine how steep is the filter's shelf transition.
  3800. @item channels, c
  3801. Specify which channels to filter, by default all available are filtered.
  3802. @end table
  3803. @subsection Commands
  3804. This filter supports the following commands:
  3805. @table @option
  3806. @item frequency, f
  3807. Change treble frequency.
  3808. Syntax for the command is : "@var{frequency}"
  3809. @item width_type, t
  3810. Change treble width_type.
  3811. Syntax for the command is : "@var{width_type}"
  3812. @item width, w
  3813. Change treble width.
  3814. Syntax for the command is : "@var{width}"
  3815. @item gain, g
  3816. Change treble gain.
  3817. Syntax for the command is : "@var{gain}"
  3818. @end table
  3819. @section tremolo
  3820. Sinusoidal amplitude modulation.
  3821. The filter accepts the following options:
  3822. @table @option
  3823. @item f
  3824. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3825. (20 Hz or lower) will result in a tremolo effect.
  3826. This filter may also be used as a ring modulator by specifying
  3827. a modulation frequency higher than 20 Hz.
  3828. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3829. @item d
  3830. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3831. Default value is 0.5.
  3832. @end table
  3833. @section vibrato
  3834. Sinusoidal phase modulation.
  3835. The filter accepts the following options:
  3836. @table @option
  3837. @item f
  3838. Modulation frequency in Hertz.
  3839. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3840. @item d
  3841. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3842. Default value is 0.5.
  3843. @end table
  3844. @section volume
  3845. Adjust the input audio volume.
  3846. It accepts the following parameters:
  3847. @table @option
  3848. @item volume
  3849. Set audio volume expression.
  3850. Output values are clipped to the maximum value.
  3851. The output audio volume is given by the relation:
  3852. @example
  3853. @var{output_volume} = @var{volume} * @var{input_volume}
  3854. @end example
  3855. The default value for @var{volume} is "1.0".
  3856. @item precision
  3857. This parameter represents the mathematical precision.
  3858. It determines which input sample formats will be allowed, which affects the
  3859. precision of the volume scaling.
  3860. @table @option
  3861. @item fixed
  3862. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3863. @item float
  3864. 32-bit floating-point; this limits input sample format to FLT. (default)
  3865. @item double
  3866. 64-bit floating-point; this limits input sample format to DBL.
  3867. @end table
  3868. @item replaygain
  3869. Choose the behaviour on encountering ReplayGain side data in input frames.
  3870. @table @option
  3871. @item drop
  3872. Remove ReplayGain side data, ignoring its contents (the default).
  3873. @item ignore
  3874. Ignore ReplayGain side data, but leave it in the frame.
  3875. @item track
  3876. Prefer the track gain, if present.
  3877. @item album
  3878. Prefer the album gain, if present.
  3879. @end table
  3880. @item replaygain_preamp
  3881. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3882. Default value for @var{replaygain_preamp} is 0.0.
  3883. @item eval
  3884. Set when the volume expression is evaluated.
  3885. It accepts the following values:
  3886. @table @samp
  3887. @item once
  3888. only evaluate expression once during the filter initialization, or
  3889. when the @samp{volume} command is sent
  3890. @item frame
  3891. evaluate expression for each incoming frame
  3892. @end table
  3893. Default value is @samp{once}.
  3894. @end table
  3895. The volume expression can contain the following parameters.
  3896. @table @option
  3897. @item n
  3898. frame number (starting at zero)
  3899. @item nb_channels
  3900. number of channels
  3901. @item nb_consumed_samples
  3902. number of samples consumed by the filter
  3903. @item nb_samples
  3904. number of samples in the current frame
  3905. @item pos
  3906. original frame position in the file
  3907. @item pts
  3908. frame PTS
  3909. @item sample_rate
  3910. sample rate
  3911. @item startpts
  3912. PTS at start of stream
  3913. @item startt
  3914. time at start of stream
  3915. @item t
  3916. frame time
  3917. @item tb
  3918. timestamp timebase
  3919. @item volume
  3920. last set volume value
  3921. @end table
  3922. Note that when @option{eval} is set to @samp{once} only the
  3923. @var{sample_rate} and @var{tb} variables are available, all other
  3924. variables will evaluate to NAN.
  3925. @subsection Commands
  3926. This filter supports the following commands:
  3927. @table @option
  3928. @item volume
  3929. Modify the volume expression.
  3930. The command accepts the same syntax of the corresponding option.
  3931. If the specified expression is not valid, it is kept at its current
  3932. value.
  3933. @item replaygain_noclip
  3934. Prevent clipping by limiting the gain applied.
  3935. Default value for @var{replaygain_noclip} is 1.
  3936. @end table
  3937. @subsection Examples
  3938. @itemize
  3939. @item
  3940. Halve the input audio volume:
  3941. @example
  3942. volume=volume=0.5
  3943. volume=volume=1/2
  3944. volume=volume=-6.0206dB
  3945. @end example
  3946. In all the above example the named key for @option{volume} can be
  3947. omitted, for example like in:
  3948. @example
  3949. volume=0.5
  3950. @end example
  3951. @item
  3952. Increase input audio power by 6 decibels using fixed-point precision:
  3953. @example
  3954. volume=volume=6dB:precision=fixed
  3955. @end example
  3956. @item
  3957. Fade volume after time 10 with an annihilation period of 5 seconds:
  3958. @example
  3959. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3960. @end example
  3961. @end itemize
  3962. @section volumedetect
  3963. Detect the volume of the input video.
  3964. The filter has no parameters. The input is not modified. Statistics about
  3965. the volume will be printed in the log when the input stream end is reached.
  3966. In particular it will show the mean volume (root mean square), maximum
  3967. volume (on a per-sample basis), and the beginning of a histogram of the
  3968. registered volume values (from the maximum value to a cumulated 1/1000 of
  3969. the samples).
  3970. All volumes are in decibels relative to the maximum PCM value.
  3971. @subsection Examples
  3972. Here is an excerpt of the output:
  3973. @example
  3974. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3975. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3976. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3977. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3978. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3979. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3980. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3981. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3982. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3983. @end example
  3984. It means that:
  3985. @itemize
  3986. @item
  3987. The mean square energy is approximately -27 dB, or 10^-2.7.
  3988. @item
  3989. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3990. @item
  3991. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3992. @end itemize
  3993. In other words, raising the volume by +4 dB does not cause any clipping,
  3994. raising it by +5 dB causes clipping for 6 samples, etc.
  3995. @c man end AUDIO FILTERS
  3996. @chapter Audio Sources
  3997. @c man begin AUDIO SOURCES
  3998. Below is a description of the currently available audio sources.
  3999. @section abuffer
  4000. Buffer audio frames, and make them available to the filter chain.
  4001. This source is mainly intended for a programmatic use, in particular
  4002. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4003. It accepts the following parameters:
  4004. @table @option
  4005. @item time_base
  4006. The timebase which will be used for timestamps of submitted frames. It must be
  4007. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4008. @item sample_rate
  4009. The sample rate of the incoming audio buffers.
  4010. @item sample_fmt
  4011. The sample format of the incoming audio buffers.
  4012. Either a sample format name or its corresponding integer representation from
  4013. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4014. @item channel_layout
  4015. The channel layout of the incoming audio buffers.
  4016. Either a channel layout name from channel_layout_map in
  4017. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4018. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4019. @item channels
  4020. The number of channels of the incoming audio buffers.
  4021. If both @var{channels} and @var{channel_layout} are specified, then they
  4022. must be consistent.
  4023. @end table
  4024. @subsection Examples
  4025. @example
  4026. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4027. @end example
  4028. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4029. Since the sample format with name "s16p" corresponds to the number
  4030. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4031. equivalent to:
  4032. @example
  4033. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4034. @end example
  4035. @section aevalsrc
  4036. Generate an audio signal specified by an expression.
  4037. This source accepts in input one or more expressions (one for each
  4038. channel), which are evaluated and used to generate a corresponding
  4039. audio signal.
  4040. This source accepts the following options:
  4041. @table @option
  4042. @item exprs
  4043. Set the '|'-separated expressions list for each separate channel. In case the
  4044. @option{channel_layout} option is not specified, the selected channel layout
  4045. depends on the number of provided expressions. Otherwise the last
  4046. specified expression is applied to the remaining output channels.
  4047. @item channel_layout, c
  4048. Set the channel layout. The number of channels in the specified layout
  4049. must be equal to the number of specified expressions.
  4050. @item duration, d
  4051. Set the minimum duration of the sourced audio. See
  4052. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4053. for the accepted syntax.
  4054. Note that the resulting duration may be greater than the specified
  4055. duration, as the generated audio is always cut at the end of a
  4056. complete frame.
  4057. If not specified, or the expressed duration is negative, the audio is
  4058. supposed to be generated forever.
  4059. @item nb_samples, n
  4060. Set the number of samples per channel per each output frame,
  4061. default to 1024.
  4062. @item sample_rate, s
  4063. Specify the sample rate, default to 44100.
  4064. @end table
  4065. Each expression in @var{exprs} can contain the following constants:
  4066. @table @option
  4067. @item n
  4068. number of the evaluated sample, starting from 0
  4069. @item t
  4070. time of the evaluated sample expressed in seconds, starting from 0
  4071. @item s
  4072. sample rate
  4073. @end table
  4074. @subsection Examples
  4075. @itemize
  4076. @item
  4077. Generate silence:
  4078. @example
  4079. aevalsrc=0
  4080. @end example
  4081. @item
  4082. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4083. 8000 Hz:
  4084. @example
  4085. aevalsrc="sin(440*2*PI*t):s=8000"
  4086. @end example
  4087. @item
  4088. Generate a two channels signal, specify the channel layout (Front
  4089. Center + Back Center) explicitly:
  4090. @example
  4091. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4092. @end example
  4093. @item
  4094. Generate white noise:
  4095. @example
  4096. aevalsrc="-2+random(0)"
  4097. @end example
  4098. @item
  4099. Generate an amplitude modulated signal:
  4100. @example
  4101. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4102. @end example
  4103. @item
  4104. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4105. @example
  4106. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4107. @end example
  4108. @end itemize
  4109. @section anullsrc
  4110. The null audio source, return unprocessed audio frames. It is mainly useful
  4111. as a template and to be employed in analysis / debugging tools, or as
  4112. the source for filters which ignore the input data (for example the sox
  4113. synth filter).
  4114. This source accepts the following options:
  4115. @table @option
  4116. @item channel_layout, cl
  4117. Specifies the channel layout, and can be either an integer or a string
  4118. representing a channel layout. The default value of @var{channel_layout}
  4119. is "stereo".
  4120. Check the channel_layout_map definition in
  4121. @file{libavutil/channel_layout.c} for the mapping between strings and
  4122. channel layout values.
  4123. @item sample_rate, r
  4124. Specifies the sample rate, and defaults to 44100.
  4125. @item nb_samples, n
  4126. Set the number of samples per requested frames.
  4127. @end table
  4128. @subsection Examples
  4129. @itemize
  4130. @item
  4131. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4132. @example
  4133. anullsrc=r=48000:cl=4
  4134. @end example
  4135. @item
  4136. Do the same operation with a more obvious syntax:
  4137. @example
  4138. anullsrc=r=48000:cl=mono
  4139. @end example
  4140. @end itemize
  4141. All the parameters need to be explicitly defined.
  4142. @section flite
  4143. Synthesize a voice utterance using the libflite library.
  4144. To enable compilation of this filter you need to configure FFmpeg with
  4145. @code{--enable-libflite}.
  4146. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4147. The filter accepts the following options:
  4148. @table @option
  4149. @item list_voices
  4150. If set to 1, list the names of the available voices and exit
  4151. immediately. Default value is 0.
  4152. @item nb_samples, n
  4153. Set the maximum number of samples per frame. Default value is 512.
  4154. @item textfile
  4155. Set the filename containing the text to speak.
  4156. @item text
  4157. Set the text to speak.
  4158. @item voice, v
  4159. Set the voice to use for the speech synthesis. Default value is
  4160. @code{kal}. See also the @var{list_voices} option.
  4161. @end table
  4162. @subsection Examples
  4163. @itemize
  4164. @item
  4165. Read from file @file{speech.txt}, and synthesize the text using the
  4166. standard flite voice:
  4167. @example
  4168. flite=textfile=speech.txt
  4169. @end example
  4170. @item
  4171. Read the specified text selecting the @code{slt} voice:
  4172. @example
  4173. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4174. @end example
  4175. @item
  4176. Input text to ffmpeg:
  4177. @example
  4178. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4179. @end example
  4180. @item
  4181. Make @file{ffplay} speak the specified text, using @code{flite} and
  4182. the @code{lavfi} device:
  4183. @example
  4184. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4185. @end example
  4186. @end itemize
  4187. For more information about libflite, check:
  4188. @url{http://www.festvox.org/flite/}
  4189. @section anoisesrc
  4190. Generate a noise audio signal.
  4191. The filter accepts the following options:
  4192. @table @option
  4193. @item sample_rate, r
  4194. Specify the sample rate. Default value is 48000 Hz.
  4195. @item amplitude, a
  4196. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4197. is 1.0.
  4198. @item duration, d
  4199. Specify the duration of the generated audio stream. Not specifying this option
  4200. results in noise with an infinite length.
  4201. @item color, colour, c
  4202. Specify the color of noise. Available noise colors are white, pink, brown,
  4203. blue and violet. Default color is white.
  4204. @item seed, s
  4205. Specify a value used to seed the PRNG.
  4206. @item nb_samples, n
  4207. Set the number of samples per each output frame, default is 1024.
  4208. @end table
  4209. @subsection Examples
  4210. @itemize
  4211. @item
  4212. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4213. @example
  4214. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4215. @end example
  4216. @end itemize
  4217. @section hilbert
  4218. Generate odd-tap Hilbert transform FIR coefficients.
  4219. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4220. the signal by 90 degrees.
  4221. This is used in many matrix coding schemes and for analytic signal generation.
  4222. The process is often written as a multiplication by i (or j), the imaginary unit.
  4223. The filter accepts the following options:
  4224. @table @option
  4225. @item sample_rate, s
  4226. Set sample rate, default is 44100.
  4227. @item taps, t
  4228. Set length of FIR filter, default is 22051.
  4229. @item nb_samples, n
  4230. Set number of samples per each frame.
  4231. @item win_func, w
  4232. Set window function to be used when generating FIR coefficients.
  4233. @end table
  4234. @section sinc
  4235. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4236. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4237. The filter accepts the following options:
  4238. @table @option
  4239. @item sample_rate, r
  4240. Set sample rate, default is 44100.
  4241. @item nb_samples, n
  4242. Set number of samples per each frame. Default is 1024.
  4243. @item hp
  4244. Set high-pass frequency. Default is 0.
  4245. @item lp
  4246. Set low-pass frequency. Default is 0.
  4247. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4248. is higher than 0 then filter will create band-pass filter coefficients,
  4249. otherwise band-reject filter coefficients.
  4250. @item phase
  4251. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4252. @item beta
  4253. Set Kaiser window beta.
  4254. @item att
  4255. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4256. @item round
  4257. Enable rounding, by default is disabled.
  4258. @item hptaps
  4259. Set number of taps for high-pass filter.
  4260. @item lptaps
  4261. Set number of taps for low-pass filter.
  4262. @end table
  4263. @section sine
  4264. Generate an audio signal made of a sine wave with amplitude 1/8.
  4265. The audio signal is bit-exact.
  4266. The filter accepts the following options:
  4267. @table @option
  4268. @item frequency, f
  4269. Set the carrier frequency. Default is 440 Hz.
  4270. @item beep_factor, b
  4271. Enable a periodic beep every second with frequency @var{beep_factor} times
  4272. the carrier frequency. Default is 0, meaning the beep is disabled.
  4273. @item sample_rate, r
  4274. Specify the sample rate, default is 44100.
  4275. @item duration, d
  4276. Specify the duration of the generated audio stream.
  4277. @item samples_per_frame
  4278. Set the number of samples per output frame.
  4279. The expression can contain the following constants:
  4280. @table @option
  4281. @item n
  4282. The (sequential) number of the output audio frame, starting from 0.
  4283. @item pts
  4284. The PTS (Presentation TimeStamp) of the output audio frame,
  4285. expressed in @var{TB} units.
  4286. @item t
  4287. The PTS of the output audio frame, expressed in seconds.
  4288. @item TB
  4289. The timebase of the output audio frames.
  4290. @end table
  4291. Default is @code{1024}.
  4292. @end table
  4293. @subsection Examples
  4294. @itemize
  4295. @item
  4296. Generate a simple 440 Hz sine wave:
  4297. @example
  4298. sine
  4299. @end example
  4300. @item
  4301. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4302. @example
  4303. sine=220:4:d=5
  4304. sine=f=220:b=4:d=5
  4305. sine=frequency=220:beep_factor=4:duration=5
  4306. @end example
  4307. @item
  4308. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4309. pattern:
  4310. @example
  4311. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4312. @end example
  4313. @end itemize
  4314. @c man end AUDIO SOURCES
  4315. @chapter Audio Sinks
  4316. @c man begin AUDIO SINKS
  4317. Below is a description of the currently available audio sinks.
  4318. @section abuffersink
  4319. Buffer audio frames, and make them available to the end of filter chain.
  4320. This sink is mainly intended for programmatic use, in particular
  4321. through the interface defined in @file{libavfilter/buffersink.h}
  4322. or the options system.
  4323. It accepts a pointer to an AVABufferSinkContext structure, which
  4324. defines the incoming buffers' formats, to be passed as the opaque
  4325. parameter to @code{avfilter_init_filter} for initialization.
  4326. @section anullsink
  4327. Null audio sink; do absolutely nothing with the input audio. It is
  4328. mainly useful as a template and for use in analysis / debugging
  4329. tools.
  4330. @c man end AUDIO SINKS
  4331. @chapter Video Filters
  4332. @c man begin VIDEO FILTERS
  4333. When you configure your FFmpeg build, you can disable any of the
  4334. existing filters using @code{--disable-filters}.
  4335. The configure output will show the video filters included in your
  4336. build.
  4337. Below is a description of the currently available video filters.
  4338. @section alphaextract
  4339. Extract the alpha component from the input as a grayscale video. This
  4340. is especially useful with the @var{alphamerge} filter.
  4341. @section alphamerge
  4342. Add or replace the alpha component of the primary input with the
  4343. grayscale value of a second input. This is intended for use with
  4344. @var{alphaextract} to allow the transmission or storage of frame
  4345. sequences that have alpha in a format that doesn't support an alpha
  4346. channel.
  4347. For example, to reconstruct full frames from a normal YUV-encoded video
  4348. and a separate video created with @var{alphaextract}, you might use:
  4349. @example
  4350. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4351. @end example
  4352. Since this filter is designed for reconstruction, it operates on frame
  4353. sequences without considering timestamps, and terminates when either
  4354. input reaches end of stream. This will cause problems if your encoding
  4355. pipeline drops frames. If you're trying to apply an image as an
  4356. overlay to a video stream, consider the @var{overlay} filter instead.
  4357. @section amplify
  4358. Amplify differences between current pixel and pixels of adjacent frames in
  4359. same pixel location.
  4360. This filter accepts the following options:
  4361. @table @option
  4362. @item radius
  4363. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4364. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4365. @item factor
  4366. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4367. @item threshold
  4368. Set threshold for difference amplification. Any differrence greater or equal to
  4369. this value will not alter source pixel. Default is 10.
  4370. Allowed range is from 0 to 65535.
  4371. @item low
  4372. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4373. This option controls maximum possible value that will decrease source pixel value.
  4374. @item high
  4375. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4376. This option controls maximum possible value that will increase source pixel value.
  4377. @item planes
  4378. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4379. @end table
  4380. @section ass
  4381. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4382. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4383. Substation Alpha) subtitles files.
  4384. This filter accepts the following option in addition to the common options from
  4385. the @ref{subtitles} filter:
  4386. @table @option
  4387. @item shaping
  4388. Set the shaping engine
  4389. Available values are:
  4390. @table @samp
  4391. @item auto
  4392. The default libass shaping engine, which is the best available.
  4393. @item simple
  4394. Fast, font-agnostic shaper that can do only substitutions
  4395. @item complex
  4396. Slower shaper using OpenType for substitutions and positioning
  4397. @end table
  4398. The default is @code{auto}.
  4399. @end table
  4400. @section atadenoise
  4401. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4402. The filter accepts the following options:
  4403. @table @option
  4404. @item 0a
  4405. Set threshold A for 1st plane. Default is 0.02.
  4406. Valid range is 0 to 0.3.
  4407. @item 0b
  4408. Set threshold B for 1st plane. Default is 0.04.
  4409. Valid range is 0 to 5.
  4410. @item 1a
  4411. Set threshold A for 2nd plane. Default is 0.02.
  4412. Valid range is 0 to 0.3.
  4413. @item 1b
  4414. Set threshold B for 2nd plane. Default is 0.04.
  4415. Valid range is 0 to 5.
  4416. @item 2a
  4417. Set threshold A for 3rd plane. Default is 0.02.
  4418. Valid range is 0 to 0.3.
  4419. @item 2b
  4420. Set threshold B for 3rd plane. Default is 0.04.
  4421. Valid range is 0 to 5.
  4422. Threshold A is designed to react on abrupt changes in the input signal and
  4423. threshold B is designed to react on continuous changes in the input signal.
  4424. @item s
  4425. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4426. number in range [5, 129].
  4427. @item p
  4428. Set what planes of frame filter will use for averaging. Default is all.
  4429. @end table
  4430. @section avgblur
  4431. Apply average blur filter.
  4432. The filter accepts the following options:
  4433. @table @option
  4434. @item sizeX
  4435. Set horizontal radius size.
  4436. @item planes
  4437. Set which planes to filter. By default all planes are filtered.
  4438. @item sizeY
  4439. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4440. Default is @code{0}.
  4441. @end table
  4442. @section bbox
  4443. Compute the bounding box for the non-black pixels in the input frame
  4444. luminance plane.
  4445. This filter computes the bounding box containing all the pixels with a
  4446. luminance value greater than the minimum allowed value.
  4447. The parameters describing the bounding box are printed on the filter
  4448. log.
  4449. The filter accepts the following option:
  4450. @table @option
  4451. @item min_val
  4452. Set the minimal luminance value. Default is @code{16}.
  4453. @end table
  4454. @section bitplanenoise
  4455. Show and measure bit plane noise.
  4456. The filter accepts the following options:
  4457. @table @option
  4458. @item bitplane
  4459. Set which plane to analyze. Default is @code{1}.
  4460. @item filter
  4461. Filter out noisy pixels from @code{bitplane} set above.
  4462. Default is disabled.
  4463. @end table
  4464. @section blackdetect
  4465. Detect video intervals that are (almost) completely black. Can be
  4466. useful to detect chapter transitions, commercials, or invalid
  4467. recordings. Output lines contains the time for the start, end and
  4468. duration of the detected black interval expressed in seconds.
  4469. In order to display the output lines, you need to set the loglevel at
  4470. least to the AV_LOG_INFO value.
  4471. The filter accepts the following options:
  4472. @table @option
  4473. @item black_min_duration, d
  4474. Set the minimum detected black duration expressed in seconds. It must
  4475. be a non-negative floating point number.
  4476. Default value is 2.0.
  4477. @item picture_black_ratio_th, pic_th
  4478. Set the threshold for considering a picture "black".
  4479. Express the minimum value for the ratio:
  4480. @example
  4481. @var{nb_black_pixels} / @var{nb_pixels}
  4482. @end example
  4483. for which a picture is considered black.
  4484. Default value is 0.98.
  4485. @item pixel_black_th, pix_th
  4486. Set the threshold for considering a pixel "black".
  4487. The threshold expresses the maximum pixel luminance value for which a
  4488. pixel is considered "black". The provided value is scaled according to
  4489. the following equation:
  4490. @example
  4491. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4492. @end example
  4493. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4494. the input video format, the range is [0-255] for YUV full-range
  4495. formats and [16-235] for YUV non full-range formats.
  4496. Default value is 0.10.
  4497. @end table
  4498. The following example sets the maximum pixel threshold to the minimum
  4499. value, and detects only black intervals of 2 or more seconds:
  4500. @example
  4501. blackdetect=d=2:pix_th=0.00
  4502. @end example
  4503. @section blackframe
  4504. Detect frames that are (almost) completely black. Can be useful to
  4505. detect chapter transitions or commercials. Output lines consist of
  4506. the frame number of the detected frame, the percentage of blackness,
  4507. the position in the file if known or -1 and the timestamp in seconds.
  4508. In order to display the output lines, you need to set the loglevel at
  4509. least to the AV_LOG_INFO value.
  4510. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4511. The value represents the percentage of pixels in the picture that
  4512. are below the threshold value.
  4513. It accepts the following parameters:
  4514. @table @option
  4515. @item amount
  4516. The percentage of the pixels that have to be below the threshold; it defaults to
  4517. @code{98}.
  4518. @item threshold, thresh
  4519. The threshold below which a pixel value is considered black; it defaults to
  4520. @code{32}.
  4521. @end table
  4522. @section blend, tblend
  4523. Blend two video frames into each other.
  4524. The @code{blend} filter takes two input streams and outputs one
  4525. stream, the first input is the "top" layer and second input is
  4526. "bottom" layer. By default, the output terminates when the longest input terminates.
  4527. The @code{tblend} (time blend) filter takes two consecutive frames
  4528. from one single stream, and outputs the result obtained by blending
  4529. the new frame on top of the old frame.
  4530. A description of the accepted options follows.
  4531. @table @option
  4532. @item c0_mode
  4533. @item c1_mode
  4534. @item c2_mode
  4535. @item c3_mode
  4536. @item all_mode
  4537. Set blend mode for specific pixel component or all pixel components in case
  4538. of @var{all_mode}. Default value is @code{normal}.
  4539. Available values for component modes are:
  4540. @table @samp
  4541. @item addition
  4542. @item grainmerge
  4543. @item and
  4544. @item average
  4545. @item burn
  4546. @item darken
  4547. @item difference
  4548. @item grainextract
  4549. @item divide
  4550. @item dodge
  4551. @item freeze
  4552. @item exclusion
  4553. @item extremity
  4554. @item glow
  4555. @item hardlight
  4556. @item hardmix
  4557. @item heat
  4558. @item lighten
  4559. @item linearlight
  4560. @item multiply
  4561. @item multiply128
  4562. @item negation
  4563. @item normal
  4564. @item or
  4565. @item overlay
  4566. @item phoenix
  4567. @item pinlight
  4568. @item reflect
  4569. @item screen
  4570. @item softlight
  4571. @item subtract
  4572. @item vividlight
  4573. @item xor
  4574. @end table
  4575. @item c0_opacity
  4576. @item c1_opacity
  4577. @item c2_opacity
  4578. @item c3_opacity
  4579. @item all_opacity
  4580. Set blend opacity for specific pixel component or all pixel components in case
  4581. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4582. @item c0_expr
  4583. @item c1_expr
  4584. @item c2_expr
  4585. @item c3_expr
  4586. @item all_expr
  4587. Set blend expression for specific pixel component or all pixel components in case
  4588. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4589. The expressions can use the following variables:
  4590. @table @option
  4591. @item N
  4592. The sequential number of the filtered frame, starting from @code{0}.
  4593. @item X
  4594. @item Y
  4595. the coordinates of the current sample
  4596. @item W
  4597. @item H
  4598. the width and height of currently filtered plane
  4599. @item SW
  4600. @item SH
  4601. Width and height scale for the plane being filtered. It is the
  4602. ratio between the dimensions of the current plane to the luma plane,
  4603. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4604. the luma plane and @code{0.5,0.5} for the chroma planes.
  4605. @item T
  4606. Time of the current frame, expressed in seconds.
  4607. @item TOP, A
  4608. Value of pixel component at current location for first video frame (top layer).
  4609. @item BOTTOM, B
  4610. Value of pixel component at current location for second video frame (bottom layer).
  4611. @end table
  4612. @end table
  4613. The @code{blend} filter also supports the @ref{framesync} options.
  4614. @subsection Examples
  4615. @itemize
  4616. @item
  4617. Apply transition from bottom layer to top layer in first 10 seconds:
  4618. @example
  4619. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4620. @end example
  4621. @item
  4622. Apply linear horizontal transition from top layer to bottom layer:
  4623. @example
  4624. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4625. @end example
  4626. @item
  4627. Apply 1x1 checkerboard effect:
  4628. @example
  4629. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4630. @end example
  4631. @item
  4632. Apply uncover left effect:
  4633. @example
  4634. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4635. @end example
  4636. @item
  4637. Apply uncover down effect:
  4638. @example
  4639. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4640. @end example
  4641. @item
  4642. Apply uncover up-left effect:
  4643. @example
  4644. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4645. @end example
  4646. @item
  4647. Split diagonally video and shows top and bottom layer on each side:
  4648. @example
  4649. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4650. @end example
  4651. @item
  4652. Display differences between the current and the previous frame:
  4653. @example
  4654. tblend=all_mode=grainextract
  4655. @end example
  4656. @end itemize
  4657. @section bm3d
  4658. Denoise frames using Block-Matching 3D algorithm.
  4659. The filter accepts the following options.
  4660. @table @option
  4661. @item sigma
  4662. Set denoising strength. Default value is 1.
  4663. Allowed range is from 0 to 999.9.
  4664. The denoising algorith is very sensitive to sigma, so adjust it
  4665. according to the source.
  4666. @item block
  4667. Set local patch size. This sets dimensions in 2D.
  4668. @item bstep
  4669. Set sliding step for processing blocks. Default value is 4.
  4670. Allowed range is from 1 to 64.
  4671. Smaller values allows processing more reference blocks and is slower.
  4672. @item group
  4673. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4674. When set to 1, no block matching is done. Larger values allows more blocks
  4675. in single group.
  4676. Allowed range is from 1 to 256.
  4677. @item range
  4678. Set radius for search block matching. Default is 9.
  4679. Allowed range is from 1 to INT32_MAX.
  4680. @item mstep
  4681. Set step between two search locations for block matching. Default is 1.
  4682. Allowed range is from 1 to 64. Smaller is slower.
  4683. @item thmse
  4684. Set threshold of mean square error for block matching. Valid range is 0 to
  4685. INT32_MAX.
  4686. @item hdthr
  4687. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4688. Larger values results in stronger hard-thresholding filtering in frequency
  4689. domain.
  4690. @item estim
  4691. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4692. Default is @code{basic}.
  4693. @item ref
  4694. If enabled, filter will use 2nd stream for block matching.
  4695. Default is disabled for @code{basic} value of @var{estim} option,
  4696. and always enabled if value of @var{estim} is @code{final}.
  4697. @item planes
  4698. Set planes to filter. Default is all available except alpha.
  4699. @end table
  4700. @subsection Examples
  4701. @itemize
  4702. @item
  4703. Basic filtering with bm3d:
  4704. @example
  4705. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4706. @end example
  4707. @item
  4708. Same as above, but filtering only luma:
  4709. @example
  4710. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4711. @end example
  4712. @item
  4713. Same as above, but with both estimation modes:
  4714. @example
  4715. 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
  4716. @end example
  4717. @item
  4718. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4719. @example
  4720. 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
  4721. @end example
  4722. @end itemize
  4723. @section boxblur
  4724. Apply a boxblur algorithm to the input video.
  4725. It accepts the following parameters:
  4726. @table @option
  4727. @item luma_radius, lr
  4728. @item luma_power, lp
  4729. @item chroma_radius, cr
  4730. @item chroma_power, cp
  4731. @item alpha_radius, ar
  4732. @item alpha_power, ap
  4733. @end table
  4734. A description of the accepted options follows.
  4735. @table @option
  4736. @item luma_radius, lr
  4737. @item chroma_radius, cr
  4738. @item alpha_radius, ar
  4739. Set an expression for the box radius in pixels used for blurring the
  4740. corresponding input plane.
  4741. The radius value must be a non-negative number, and must not be
  4742. greater than the value of the expression @code{min(w,h)/2} for the
  4743. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4744. planes.
  4745. Default value for @option{luma_radius} is "2". If not specified,
  4746. @option{chroma_radius} and @option{alpha_radius} default to the
  4747. corresponding value set for @option{luma_radius}.
  4748. The expressions can contain the following constants:
  4749. @table @option
  4750. @item w
  4751. @item h
  4752. The input width and height in pixels.
  4753. @item cw
  4754. @item ch
  4755. The input chroma image width and height in pixels.
  4756. @item hsub
  4757. @item vsub
  4758. The horizontal and vertical chroma subsample values. For example, for the
  4759. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4760. @end table
  4761. @item luma_power, lp
  4762. @item chroma_power, cp
  4763. @item alpha_power, ap
  4764. Specify how many times the boxblur filter is applied to the
  4765. corresponding plane.
  4766. Default value for @option{luma_power} is 2. If not specified,
  4767. @option{chroma_power} and @option{alpha_power} default to the
  4768. corresponding value set for @option{luma_power}.
  4769. A value of 0 will disable the effect.
  4770. @end table
  4771. @subsection Examples
  4772. @itemize
  4773. @item
  4774. Apply a boxblur filter with the luma, chroma, and alpha radii
  4775. set to 2:
  4776. @example
  4777. boxblur=luma_radius=2:luma_power=1
  4778. boxblur=2:1
  4779. @end example
  4780. @item
  4781. Set the luma radius to 2, and alpha and chroma radius to 0:
  4782. @example
  4783. boxblur=2:1:cr=0:ar=0
  4784. @end example
  4785. @item
  4786. Set the luma and chroma radii to a fraction of the video dimension:
  4787. @example
  4788. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4789. @end example
  4790. @end itemize
  4791. @section bwdif
  4792. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4793. Deinterlacing Filter").
  4794. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4795. interpolation algorithms.
  4796. It accepts the following parameters:
  4797. @table @option
  4798. @item mode
  4799. The interlacing mode to adopt. It accepts one of the following values:
  4800. @table @option
  4801. @item 0, send_frame
  4802. Output one frame for each frame.
  4803. @item 1, send_field
  4804. Output one frame for each field.
  4805. @end table
  4806. The default value is @code{send_field}.
  4807. @item parity
  4808. The picture field parity assumed for the input interlaced video. It accepts one
  4809. of the following values:
  4810. @table @option
  4811. @item 0, tff
  4812. Assume the top field is first.
  4813. @item 1, bff
  4814. Assume the bottom field is first.
  4815. @item -1, auto
  4816. Enable automatic detection of field parity.
  4817. @end table
  4818. The default value is @code{auto}.
  4819. If the interlacing is unknown or the decoder does not export this information,
  4820. top field first will be assumed.
  4821. @item deint
  4822. Specify which frames to deinterlace. Accept one of the following
  4823. values:
  4824. @table @option
  4825. @item 0, all
  4826. Deinterlace all frames.
  4827. @item 1, interlaced
  4828. Only deinterlace frames marked as interlaced.
  4829. @end table
  4830. The default value is @code{all}.
  4831. @end table
  4832. @section chromahold
  4833. Remove all color information for all colors except for certain one.
  4834. The filter accepts the following options:
  4835. @table @option
  4836. @item color
  4837. The color which will not be replaced with neutral chroma.
  4838. @item similarity
  4839. Similarity percentage with the above color.
  4840. 0.01 matches only the exact key color, while 1.0 matches everything.
  4841. @item yuv
  4842. Signals that the color passed is already in YUV instead of RGB.
  4843. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4844. This can be used to pass exact YUV values as hexadecimal numbers.
  4845. @end table
  4846. @section chromakey
  4847. YUV colorspace color/chroma keying.
  4848. The filter accepts the following options:
  4849. @table @option
  4850. @item color
  4851. The color which will be replaced with transparency.
  4852. @item similarity
  4853. Similarity percentage with the key color.
  4854. 0.01 matches only the exact key color, while 1.0 matches everything.
  4855. @item blend
  4856. Blend percentage.
  4857. 0.0 makes pixels either fully transparent, or not transparent at all.
  4858. Higher values result in semi-transparent pixels, with a higher transparency
  4859. the more similar the pixels color is to the key color.
  4860. @item yuv
  4861. Signals that the color passed is already in YUV instead of RGB.
  4862. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4863. This can be used to pass exact YUV values as hexadecimal numbers.
  4864. @end table
  4865. @subsection Examples
  4866. @itemize
  4867. @item
  4868. Make every green pixel in the input image transparent:
  4869. @example
  4870. ffmpeg -i input.png -vf chromakey=green out.png
  4871. @end example
  4872. @item
  4873. Overlay a greenscreen-video on top of a static black background.
  4874. @example
  4875. 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
  4876. @end example
  4877. @end itemize
  4878. @section chromashift
  4879. Shift chroma pixels horizontally and/or vertically.
  4880. The filter accepts the following options:
  4881. @table @option
  4882. @item cbh
  4883. Set amount to shift chroma-blue horizontally.
  4884. @item cbv
  4885. Set amount to shift chroma-blue vertically.
  4886. @item crh
  4887. Set amount to shift chroma-red horizontally.
  4888. @item crv
  4889. Set amount to shift chroma-red vertically.
  4890. @item edge
  4891. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4892. @end table
  4893. @section ciescope
  4894. Display CIE color diagram with pixels overlaid onto it.
  4895. The filter accepts the following options:
  4896. @table @option
  4897. @item system
  4898. Set color system.
  4899. @table @samp
  4900. @item ntsc, 470m
  4901. @item ebu, 470bg
  4902. @item smpte
  4903. @item 240m
  4904. @item apple
  4905. @item widergb
  4906. @item cie1931
  4907. @item rec709, hdtv
  4908. @item uhdtv, rec2020
  4909. @end table
  4910. @item cie
  4911. Set CIE system.
  4912. @table @samp
  4913. @item xyy
  4914. @item ucs
  4915. @item luv
  4916. @end table
  4917. @item gamuts
  4918. Set what gamuts to draw.
  4919. See @code{system} option for available values.
  4920. @item size, s
  4921. Set ciescope size, by default set to 512.
  4922. @item intensity, i
  4923. Set intensity used to map input pixel values to CIE diagram.
  4924. @item contrast
  4925. Set contrast used to draw tongue colors that are out of active color system gamut.
  4926. @item corrgamma
  4927. Correct gamma displayed on scope, by default enabled.
  4928. @item showwhite
  4929. Show white point on CIE diagram, by default disabled.
  4930. @item gamma
  4931. Set input gamma. Used only with XYZ input color space.
  4932. @end table
  4933. @section codecview
  4934. Visualize information exported by some codecs.
  4935. Some codecs can export information through frames using side-data or other
  4936. means. For example, some MPEG based codecs export motion vectors through the
  4937. @var{export_mvs} flag in the codec @option{flags2} option.
  4938. The filter accepts the following option:
  4939. @table @option
  4940. @item mv
  4941. Set motion vectors to visualize.
  4942. Available flags for @var{mv} are:
  4943. @table @samp
  4944. @item pf
  4945. forward predicted MVs of P-frames
  4946. @item bf
  4947. forward predicted MVs of B-frames
  4948. @item bb
  4949. backward predicted MVs of B-frames
  4950. @end table
  4951. @item qp
  4952. Display quantization parameters using the chroma planes.
  4953. @item mv_type, mvt
  4954. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4955. Available flags for @var{mv_type} are:
  4956. @table @samp
  4957. @item fp
  4958. forward predicted MVs
  4959. @item bp
  4960. backward predicted MVs
  4961. @end table
  4962. @item frame_type, ft
  4963. Set frame type to visualize motion vectors of.
  4964. Available flags for @var{frame_type} are:
  4965. @table @samp
  4966. @item if
  4967. intra-coded frames (I-frames)
  4968. @item pf
  4969. predicted frames (P-frames)
  4970. @item bf
  4971. bi-directionally predicted frames (B-frames)
  4972. @end table
  4973. @end table
  4974. @subsection Examples
  4975. @itemize
  4976. @item
  4977. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4978. @example
  4979. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4980. @end example
  4981. @item
  4982. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4983. @example
  4984. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4985. @end example
  4986. @end itemize
  4987. @section colorbalance
  4988. Modify intensity of primary colors (red, green and blue) of input frames.
  4989. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4990. regions for the red-cyan, green-magenta or blue-yellow balance.
  4991. A positive adjustment value shifts the balance towards the primary color, a negative
  4992. value towards the complementary color.
  4993. The filter accepts the following options:
  4994. @table @option
  4995. @item rs
  4996. @item gs
  4997. @item bs
  4998. Adjust red, green and blue shadows (darkest pixels).
  4999. @item rm
  5000. @item gm
  5001. @item bm
  5002. Adjust red, green and blue midtones (medium pixels).
  5003. @item rh
  5004. @item gh
  5005. @item bh
  5006. Adjust red, green and blue highlights (brightest pixels).
  5007. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5008. @end table
  5009. @subsection Examples
  5010. @itemize
  5011. @item
  5012. Add red color cast to shadows:
  5013. @example
  5014. colorbalance=rs=.3
  5015. @end example
  5016. @end itemize
  5017. @section colorkey
  5018. RGB colorspace color keying.
  5019. The filter accepts the following options:
  5020. @table @option
  5021. @item color
  5022. The color which will be replaced with transparency.
  5023. @item similarity
  5024. Similarity percentage with the key color.
  5025. 0.01 matches only the exact key color, while 1.0 matches everything.
  5026. @item blend
  5027. Blend percentage.
  5028. 0.0 makes pixels either fully transparent, or not transparent at all.
  5029. Higher values result in semi-transparent pixels, with a higher transparency
  5030. the more similar the pixels color is to the key color.
  5031. @end table
  5032. @subsection Examples
  5033. @itemize
  5034. @item
  5035. Make every green pixel in the input image transparent:
  5036. @example
  5037. ffmpeg -i input.png -vf colorkey=green out.png
  5038. @end example
  5039. @item
  5040. Overlay a greenscreen-video on top of a static background image.
  5041. @example
  5042. 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
  5043. @end example
  5044. @end itemize
  5045. @section colorlevels
  5046. Adjust video input frames using levels.
  5047. The filter accepts the following options:
  5048. @table @option
  5049. @item rimin
  5050. @item gimin
  5051. @item bimin
  5052. @item aimin
  5053. Adjust red, green, blue and alpha input black point.
  5054. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5055. @item rimax
  5056. @item gimax
  5057. @item bimax
  5058. @item aimax
  5059. Adjust red, green, blue and alpha input white point.
  5060. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5061. Input levels are used to lighten highlights (bright tones), darken shadows
  5062. (dark tones), change the balance of bright and dark tones.
  5063. @item romin
  5064. @item gomin
  5065. @item bomin
  5066. @item aomin
  5067. Adjust red, green, blue and alpha output black point.
  5068. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5069. @item romax
  5070. @item gomax
  5071. @item bomax
  5072. @item aomax
  5073. Adjust red, green, blue and alpha output white point.
  5074. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5075. Output levels allows manual selection of a constrained output level range.
  5076. @end table
  5077. @subsection Examples
  5078. @itemize
  5079. @item
  5080. Make video output darker:
  5081. @example
  5082. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5083. @end example
  5084. @item
  5085. Increase contrast:
  5086. @example
  5087. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5088. @end example
  5089. @item
  5090. Make video output lighter:
  5091. @example
  5092. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5093. @end example
  5094. @item
  5095. Increase brightness:
  5096. @example
  5097. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5098. @end example
  5099. @end itemize
  5100. @section colorchannelmixer
  5101. Adjust video input frames by re-mixing color channels.
  5102. This filter modifies a color channel by adding the values associated to
  5103. the other channels of the same pixels. For example if the value to
  5104. modify is red, the output value will be:
  5105. @example
  5106. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5107. @end example
  5108. The filter accepts the following options:
  5109. @table @option
  5110. @item rr
  5111. @item rg
  5112. @item rb
  5113. @item ra
  5114. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5115. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5116. @item gr
  5117. @item gg
  5118. @item gb
  5119. @item ga
  5120. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5121. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5122. @item br
  5123. @item bg
  5124. @item bb
  5125. @item ba
  5126. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5127. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5128. @item ar
  5129. @item ag
  5130. @item ab
  5131. @item aa
  5132. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5133. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5134. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5135. @end table
  5136. @subsection Examples
  5137. @itemize
  5138. @item
  5139. Convert source to grayscale:
  5140. @example
  5141. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5142. @end example
  5143. @item
  5144. Simulate sepia tones:
  5145. @example
  5146. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5147. @end example
  5148. @end itemize
  5149. @section colormatrix
  5150. Convert color matrix.
  5151. The filter accepts the following options:
  5152. @table @option
  5153. @item src
  5154. @item dst
  5155. Specify the source and destination color matrix. Both values must be
  5156. specified.
  5157. The accepted values are:
  5158. @table @samp
  5159. @item bt709
  5160. BT.709
  5161. @item fcc
  5162. FCC
  5163. @item bt601
  5164. BT.601
  5165. @item bt470
  5166. BT.470
  5167. @item bt470bg
  5168. BT.470BG
  5169. @item smpte170m
  5170. SMPTE-170M
  5171. @item smpte240m
  5172. SMPTE-240M
  5173. @item bt2020
  5174. BT.2020
  5175. @end table
  5176. @end table
  5177. For example to convert from BT.601 to SMPTE-240M, use the command:
  5178. @example
  5179. colormatrix=bt601:smpte240m
  5180. @end example
  5181. @section colorspace
  5182. Convert colorspace, transfer characteristics or color primaries.
  5183. Input video needs to have an even size.
  5184. The filter accepts the following options:
  5185. @table @option
  5186. @anchor{all}
  5187. @item all
  5188. Specify all color properties at once.
  5189. The accepted values are:
  5190. @table @samp
  5191. @item bt470m
  5192. BT.470M
  5193. @item bt470bg
  5194. BT.470BG
  5195. @item bt601-6-525
  5196. BT.601-6 525
  5197. @item bt601-6-625
  5198. BT.601-6 625
  5199. @item bt709
  5200. BT.709
  5201. @item smpte170m
  5202. SMPTE-170M
  5203. @item smpte240m
  5204. SMPTE-240M
  5205. @item bt2020
  5206. BT.2020
  5207. @end table
  5208. @anchor{space}
  5209. @item space
  5210. Specify output colorspace.
  5211. The accepted values are:
  5212. @table @samp
  5213. @item bt709
  5214. BT.709
  5215. @item fcc
  5216. FCC
  5217. @item bt470bg
  5218. BT.470BG or BT.601-6 625
  5219. @item smpte170m
  5220. SMPTE-170M or BT.601-6 525
  5221. @item smpte240m
  5222. SMPTE-240M
  5223. @item ycgco
  5224. YCgCo
  5225. @item bt2020ncl
  5226. BT.2020 with non-constant luminance
  5227. @end table
  5228. @anchor{trc}
  5229. @item trc
  5230. Specify output transfer characteristics.
  5231. The accepted values are:
  5232. @table @samp
  5233. @item bt709
  5234. BT.709
  5235. @item bt470m
  5236. BT.470M
  5237. @item bt470bg
  5238. BT.470BG
  5239. @item gamma22
  5240. Constant gamma of 2.2
  5241. @item gamma28
  5242. Constant gamma of 2.8
  5243. @item smpte170m
  5244. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5245. @item smpte240m
  5246. SMPTE-240M
  5247. @item srgb
  5248. SRGB
  5249. @item iec61966-2-1
  5250. iec61966-2-1
  5251. @item iec61966-2-4
  5252. iec61966-2-4
  5253. @item xvycc
  5254. xvycc
  5255. @item bt2020-10
  5256. BT.2020 for 10-bits content
  5257. @item bt2020-12
  5258. BT.2020 for 12-bits content
  5259. @end table
  5260. @anchor{primaries}
  5261. @item primaries
  5262. Specify output color primaries.
  5263. The accepted values are:
  5264. @table @samp
  5265. @item bt709
  5266. BT.709
  5267. @item bt470m
  5268. BT.470M
  5269. @item bt470bg
  5270. BT.470BG or BT.601-6 625
  5271. @item smpte170m
  5272. SMPTE-170M or BT.601-6 525
  5273. @item smpte240m
  5274. SMPTE-240M
  5275. @item film
  5276. film
  5277. @item smpte431
  5278. SMPTE-431
  5279. @item smpte432
  5280. SMPTE-432
  5281. @item bt2020
  5282. BT.2020
  5283. @item jedec-p22
  5284. JEDEC P22 phosphors
  5285. @end table
  5286. @anchor{range}
  5287. @item range
  5288. Specify output color range.
  5289. The accepted values are:
  5290. @table @samp
  5291. @item tv
  5292. TV (restricted) range
  5293. @item mpeg
  5294. MPEG (restricted) range
  5295. @item pc
  5296. PC (full) range
  5297. @item jpeg
  5298. JPEG (full) range
  5299. @end table
  5300. @item format
  5301. Specify output color format.
  5302. The accepted values are:
  5303. @table @samp
  5304. @item yuv420p
  5305. YUV 4:2:0 planar 8-bits
  5306. @item yuv420p10
  5307. YUV 4:2:0 planar 10-bits
  5308. @item yuv420p12
  5309. YUV 4:2:0 planar 12-bits
  5310. @item yuv422p
  5311. YUV 4:2:2 planar 8-bits
  5312. @item yuv422p10
  5313. YUV 4:2:2 planar 10-bits
  5314. @item yuv422p12
  5315. YUV 4:2:2 planar 12-bits
  5316. @item yuv444p
  5317. YUV 4:4:4 planar 8-bits
  5318. @item yuv444p10
  5319. YUV 4:4:4 planar 10-bits
  5320. @item yuv444p12
  5321. YUV 4:4:4 planar 12-bits
  5322. @end table
  5323. @item fast
  5324. Do a fast conversion, which skips gamma/primary correction. This will take
  5325. significantly less CPU, but will be mathematically incorrect. To get output
  5326. compatible with that produced by the colormatrix filter, use fast=1.
  5327. @item dither
  5328. Specify dithering mode.
  5329. The accepted values are:
  5330. @table @samp
  5331. @item none
  5332. No dithering
  5333. @item fsb
  5334. Floyd-Steinberg dithering
  5335. @end table
  5336. @item wpadapt
  5337. Whitepoint adaptation mode.
  5338. The accepted values are:
  5339. @table @samp
  5340. @item bradford
  5341. Bradford whitepoint adaptation
  5342. @item vonkries
  5343. von Kries whitepoint adaptation
  5344. @item identity
  5345. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5346. @end table
  5347. @item iall
  5348. Override all input properties at once. Same accepted values as @ref{all}.
  5349. @item ispace
  5350. Override input colorspace. Same accepted values as @ref{space}.
  5351. @item iprimaries
  5352. Override input color primaries. Same accepted values as @ref{primaries}.
  5353. @item itrc
  5354. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5355. @item irange
  5356. Override input color range. Same accepted values as @ref{range}.
  5357. @end table
  5358. The filter converts the transfer characteristics, color space and color
  5359. primaries to the specified user values. The output value, if not specified,
  5360. is set to a default value based on the "all" property. If that property is
  5361. also not specified, the filter will log an error. The output color range and
  5362. format default to the same value as the input color range and format. The
  5363. input transfer characteristics, color space, color primaries and color range
  5364. should be set on the input data. If any of these are missing, the filter will
  5365. log an error and no conversion will take place.
  5366. For example to convert the input to SMPTE-240M, use the command:
  5367. @example
  5368. colorspace=smpte240m
  5369. @end example
  5370. @section convolution
  5371. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5372. The filter accepts the following options:
  5373. @table @option
  5374. @item 0m
  5375. @item 1m
  5376. @item 2m
  5377. @item 3m
  5378. Set matrix for each plane.
  5379. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5380. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5381. @item 0rdiv
  5382. @item 1rdiv
  5383. @item 2rdiv
  5384. @item 3rdiv
  5385. Set multiplier for calculated value for each plane.
  5386. If unset or 0, it will be sum of all matrix elements.
  5387. @item 0bias
  5388. @item 1bias
  5389. @item 2bias
  5390. @item 3bias
  5391. Set bias for each plane. This value is added to the result of the multiplication.
  5392. Useful for making the overall image brighter or darker. Default is 0.0.
  5393. @item 0mode
  5394. @item 1mode
  5395. @item 2mode
  5396. @item 3mode
  5397. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5398. Default is @var{square}.
  5399. @end table
  5400. @subsection Examples
  5401. @itemize
  5402. @item
  5403. Apply sharpen:
  5404. @example
  5405. 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"
  5406. @end example
  5407. @item
  5408. Apply blur:
  5409. @example
  5410. 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"
  5411. @end example
  5412. @item
  5413. Apply edge enhance:
  5414. @example
  5415. 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"
  5416. @end example
  5417. @item
  5418. Apply edge detect:
  5419. @example
  5420. 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"
  5421. @end example
  5422. @item
  5423. Apply laplacian edge detector which includes diagonals:
  5424. @example
  5425. 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"
  5426. @end example
  5427. @item
  5428. Apply emboss:
  5429. @example
  5430. 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"
  5431. @end example
  5432. @end itemize
  5433. @section convolve
  5434. Apply 2D convolution of video stream in frequency domain using second stream
  5435. as impulse.
  5436. The filter accepts the following options:
  5437. @table @option
  5438. @item planes
  5439. Set which planes to process.
  5440. @item impulse
  5441. Set which impulse video frames will be processed, can be @var{first}
  5442. or @var{all}. Default is @var{all}.
  5443. @end table
  5444. The @code{convolve} filter also supports the @ref{framesync} options.
  5445. @section copy
  5446. Copy the input video source unchanged to the output. This is mainly useful for
  5447. testing purposes.
  5448. @anchor{coreimage}
  5449. @section coreimage
  5450. Video filtering on GPU using Apple's CoreImage API on OSX.
  5451. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5452. processed by video hardware. However, software-based OpenGL implementations
  5453. exist which means there is no guarantee for hardware processing. It depends on
  5454. the respective OSX.
  5455. There are many filters and image generators provided by Apple that come with a
  5456. large variety of options. The filter has to be referenced by its name along
  5457. with its options.
  5458. The coreimage filter accepts the following options:
  5459. @table @option
  5460. @item list_filters
  5461. List all available filters and generators along with all their respective
  5462. options as well as possible minimum and maximum values along with the default
  5463. values.
  5464. @example
  5465. list_filters=true
  5466. @end example
  5467. @item filter
  5468. Specify all filters by their respective name and options.
  5469. Use @var{list_filters} to determine all valid filter names and options.
  5470. Numerical options are specified by a float value and are automatically clamped
  5471. to their respective value range. Vector and color options have to be specified
  5472. by a list of space separated float values. Character escaping has to be done.
  5473. A special option name @code{default} is available to use default options for a
  5474. filter.
  5475. It is required to specify either @code{default} or at least one of the filter options.
  5476. All omitted options are used with their default values.
  5477. The syntax of the filter string is as follows:
  5478. @example
  5479. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5480. @end example
  5481. @item output_rect
  5482. Specify a rectangle where the output of the filter chain is copied into the
  5483. input image. It is given by a list of space separated float values:
  5484. @example
  5485. output_rect=x\ y\ width\ height
  5486. @end example
  5487. If not given, the output rectangle equals the dimensions of the input image.
  5488. The output rectangle is automatically cropped at the borders of the input
  5489. image. Negative values are valid for each component.
  5490. @example
  5491. output_rect=25\ 25\ 100\ 100
  5492. @end example
  5493. @end table
  5494. Several filters can be chained for successive processing without GPU-HOST
  5495. transfers allowing for fast processing of complex filter chains.
  5496. Currently, only filters with zero (generators) or exactly one (filters) input
  5497. image and one output image are supported. Also, transition filters are not yet
  5498. usable as intended.
  5499. Some filters generate output images with additional padding depending on the
  5500. respective filter kernel. The padding is automatically removed to ensure the
  5501. filter output has the same size as the input image.
  5502. For image generators, the size of the output image is determined by the
  5503. previous output image of the filter chain or the input image of the whole
  5504. filterchain, respectively. The generators do not use the pixel information of
  5505. this image to generate their output. However, the generated output is
  5506. blended onto this image, resulting in partial or complete coverage of the
  5507. output image.
  5508. The @ref{coreimagesrc} video source can be used for generating input images
  5509. which are directly fed into the filter chain. By using it, providing input
  5510. images by another video source or an input video is not required.
  5511. @subsection Examples
  5512. @itemize
  5513. @item
  5514. List all filters available:
  5515. @example
  5516. coreimage=list_filters=true
  5517. @end example
  5518. @item
  5519. Use the CIBoxBlur filter with default options to blur an image:
  5520. @example
  5521. coreimage=filter=CIBoxBlur@@default
  5522. @end example
  5523. @item
  5524. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5525. its center at 100x100 and a radius of 50 pixels:
  5526. @example
  5527. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5528. @end example
  5529. @item
  5530. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5531. given as complete and escaped command-line for Apple's standard bash shell:
  5532. @example
  5533. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5534. @end example
  5535. @end itemize
  5536. @section crop
  5537. Crop the input video to given dimensions.
  5538. It accepts the following parameters:
  5539. @table @option
  5540. @item w, out_w
  5541. The width of the output video. It defaults to @code{iw}.
  5542. This expression is evaluated only once during the filter
  5543. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5544. @item h, out_h
  5545. The height of the output video. It defaults to @code{ih}.
  5546. This expression is evaluated only once during the filter
  5547. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5548. @item x
  5549. The horizontal position, in the input video, of the left edge of the output
  5550. video. It defaults to @code{(in_w-out_w)/2}.
  5551. This expression is evaluated per-frame.
  5552. @item y
  5553. The vertical position, in the input video, of the top edge of the output video.
  5554. It defaults to @code{(in_h-out_h)/2}.
  5555. This expression is evaluated per-frame.
  5556. @item keep_aspect
  5557. If set to 1 will force the output display aspect ratio
  5558. to be the same of the input, by changing the output sample aspect
  5559. ratio. It defaults to 0.
  5560. @item exact
  5561. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5562. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5563. It defaults to 0.
  5564. @end table
  5565. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5566. expressions containing the following constants:
  5567. @table @option
  5568. @item x
  5569. @item y
  5570. The computed values for @var{x} and @var{y}. They are evaluated for
  5571. each new frame.
  5572. @item in_w
  5573. @item in_h
  5574. The input width and height.
  5575. @item iw
  5576. @item ih
  5577. These are the same as @var{in_w} and @var{in_h}.
  5578. @item out_w
  5579. @item out_h
  5580. The output (cropped) width and height.
  5581. @item ow
  5582. @item oh
  5583. These are the same as @var{out_w} and @var{out_h}.
  5584. @item a
  5585. same as @var{iw} / @var{ih}
  5586. @item sar
  5587. input sample aspect ratio
  5588. @item dar
  5589. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5590. @item hsub
  5591. @item vsub
  5592. horizontal and vertical chroma subsample values. For example for the
  5593. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5594. @item n
  5595. The number of the input frame, starting from 0.
  5596. @item pos
  5597. the position in the file of the input frame, NAN if unknown
  5598. @item t
  5599. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5600. @end table
  5601. The expression for @var{out_w} may depend on the value of @var{out_h},
  5602. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5603. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5604. evaluated after @var{out_w} and @var{out_h}.
  5605. The @var{x} and @var{y} parameters specify the expressions for the
  5606. position of the top-left corner of the output (non-cropped) area. They
  5607. are evaluated for each frame. If the evaluated value is not valid, it
  5608. is approximated to the nearest valid value.
  5609. The expression for @var{x} may depend on @var{y}, and the expression
  5610. for @var{y} may depend on @var{x}.
  5611. @subsection Examples
  5612. @itemize
  5613. @item
  5614. Crop area with size 100x100 at position (12,34).
  5615. @example
  5616. crop=100:100:12:34
  5617. @end example
  5618. Using named options, the example above becomes:
  5619. @example
  5620. crop=w=100:h=100:x=12:y=34
  5621. @end example
  5622. @item
  5623. Crop the central input area with size 100x100:
  5624. @example
  5625. crop=100:100
  5626. @end example
  5627. @item
  5628. Crop the central input area with size 2/3 of the input video:
  5629. @example
  5630. crop=2/3*in_w:2/3*in_h
  5631. @end example
  5632. @item
  5633. Crop the input video central square:
  5634. @example
  5635. crop=out_w=in_h
  5636. crop=in_h
  5637. @end example
  5638. @item
  5639. Delimit the rectangle with the top-left corner placed at position
  5640. 100:100 and the right-bottom corner corresponding to the right-bottom
  5641. corner of the input image.
  5642. @example
  5643. crop=in_w-100:in_h-100:100:100
  5644. @end example
  5645. @item
  5646. Crop 10 pixels from the left and right borders, and 20 pixels from
  5647. the top and bottom borders
  5648. @example
  5649. crop=in_w-2*10:in_h-2*20
  5650. @end example
  5651. @item
  5652. Keep only the bottom right quarter of the input image:
  5653. @example
  5654. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5655. @end example
  5656. @item
  5657. Crop height for getting Greek harmony:
  5658. @example
  5659. crop=in_w:1/PHI*in_w
  5660. @end example
  5661. @item
  5662. Apply trembling effect:
  5663. @example
  5664. 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)
  5665. @end example
  5666. @item
  5667. Apply erratic camera effect depending on timestamp:
  5668. @example
  5669. 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)"
  5670. @end example
  5671. @item
  5672. Set x depending on the value of y:
  5673. @example
  5674. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5675. @end example
  5676. @end itemize
  5677. @subsection Commands
  5678. This filter supports the following commands:
  5679. @table @option
  5680. @item w, out_w
  5681. @item h, out_h
  5682. @item x
  5683. @item y
  5684. Set width/height of the output video and the horizontal/vertical position
  5685. in the input video.
  5686. The command accepts the same syntax of the corresponding option.
  5687. If the specified expression is not valid, it is kept at its current
  5688. value.
  5689. @end table
  5690. @section cropdetect
  5691. Auto-detect the crop size.
  5692. It calculates the necessary cropping parameters and prints the
  5693. recommended parameters via the logging system. The detected dimensions
  5694. correspond to the non-black area of the input video.
  5695. It accepts the following parameters:
  5696. @table @option
  5697. @item limit
  5698. Set higher black value threshold, which can be optionally specified
  5699. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5700. value greater to the set value is considered non-black. It defaults to 24.
  5701. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5702. on the bitdepth of the pixel format.
  5703. @item round
  5704. The value which the width/height should be divisible by. It defaults to
  5705. 16. The offset is automatically adjusted to center the video. Use 2 to
  5706. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5707. encoding to most video codecs.
  5708. @item reset_count, reset
  5709. Set the counter that determines after how many frames cropdetect will
  5710. reset the previously detected largest video area and start over to
  5711. detect the current optimal crop area. Default value is 0.
  5712. This can be useful when channel logos distort the video area. 0
  5713. indicates 'never reset', and returns the largest area encountered during
  5714. playback.
  5715. @end table
  5716. @anchor{cue}
  5717. @section cue
  5718. Delay video filtering until a given wallclock timestamp. The filter first
  5719. passes on @option{preroll} amount of frames, then it buffers at most
  5720. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5721. it forwards the buffered frames and also any subsequent frames coming in its
  5722. input.
  5723. The filter can be used synchronize the output of multiple ffmpeg processes for
  5724. realtime output devices like decklink. By putting the delay in the filtering
  5725. chain and pre-buffering frames the process can pass on data to output almost
  5726. immediately after the target wallclock timestamp is reached.
  5727. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5728. some use cases.
  5729. @table @option
  5730. @item cue
  5731. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5732. @item preroll
  5733. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5734. @item buffer
  5735. The maximum duration of content to buffer before waiting for the cue expressed
  5736. in seconds. Default is 0.
  5737. @end table
  5738. @anchor{curves}
  5739. @section curves
  5740. Apply color adjustments using curves.
  5741. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5742. component (red, green and blue) has its values defined by @var{N} key points
  5743. tied from each other using a smooth curve. The x-axis represents the pixel
  5744. values from the input frame, and the y-axis the new pixel values to be set for
  5745. the output frame.
  5746. By default, a component curve is defined by the two points @var{(0;0)} and
  5747. @var{(1;1)}. This creates a straight line where each original pixel value is
  5748. "adjusted" to its own value, which means no change to the image.
  5749. The filter allows you to redefine these two points and add some more. A new
  5750. curve (using a natural cubic spline interpolation) will be define to pass
  5751. smoothly through all these new coordinates. The new defined points needs to be
  5752. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5753. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5754. the vector spaces, the values will be clipped accordingly.
  5755. The filter accepts the following options:
  5756. @table @option
  5757. @item preset
  5758. Select one of the available color presets. This option can be used in addition
  5759. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5760. options takes priority on the preset values.
  5761. Available presets are:
  5762. @table @samp
  5763. @item none
  5764. @item color_negative
  5765. @item cross_process
  5766. @item darker
  5767. @item increase_contrast
  5768. @item lighter
  5769. @item linear_contrast
  5770. @item medium_contrast
  5771. @item negative
  5772. @item strong_contrast
  5773. @item vintage
  5774. @end table
  5775. Default is @code{none}.
  5776. @item master, m
  5777. Set the master key points. These points will define a second pass mapping. It
  5778. is sometimes called a "luminance" or "value" mapping. It can be used with
  5779. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5780. post-processing LUT.
  5781. @item red, r
  5782. Set the key points for the red component.
  5783. @item green, g
  5784. Set the key points for the green component.
  5785. @item blue, b
  5786. Set the key points for the blue component.
  5787. @item all
  5788. Set the key points for all components (not including master).
  5789. Can be used in addition to the other key points component
  5790. options. In this case, the unset component(s) will fallback on this
  5791. @option{all} setting.
  5792. @item psfile
  5793. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5794. @item plot
  5795. Save Gnuplot script of the curves in specified file.
  5796. @end table
  5797. To avoid some filtergraph syntax conflicts, each key points list need to be
  5798. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5799. @subsection Examples
  5800. @itemize
  5801. @item
  5802. Increase slightly the middle level of blue:
  5803. @example
  5804. curves=blue='0/0 0.5/0.58 1/1'
  5805. @end example
  5806. @item
  5807. Vintage effect:
  5808. @example
  5809. 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'
  5810. @end example
  5811. Here we obtain the following coordinates for each components:
  5812. @table @var
  5813. @item red
  5814. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5815. @item green
  5816. @code{(0;0) (0.50;0.48) (1;1)}
  5817. @item blue
  5818. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5819. @end table
  5820. @item
  5821. The previous example can also be achieved with the associated built-in preset:
  5822. @example
  5823. curves=preset=vintage
  5824. @end example
  5825. @item
  5826. Or simply:
  5827. @example
  5828. curves=vintage
  5829. @end example
  5830. @item
  5831. Use a Photoshop preset and redefine the points of the green component:
  5832. @example
  5833. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5834. @end example
  5835. @item
  5836. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5837. and @command{gnuplot}:
  5838. @example
  5839. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5840. gnuplot -p /tmp/curves.plt
  5841. @end example
  5842. @end itemize
  5843. @section datascope
  5844. Video data analysis filter.
  5845. This filter shows hexadecimal pixel values of part of video.
  5846. The filter accepts the following options:
  5847. @table @option
  5848. @item size, s
  5849. Set output video size.
  5850. @item x
  5851. Set x offset from where to pick pixels.
  5852. @item y
  5853. Set y offset from where to pick pixels.
  5854. @item mode
  5855. Set scope mode, can be one of the following:
  5856. @table @samp
  5857. @item mono
  5858. Draw hexadecimal pixel values with white color on black background.
  5859. @item color
  5860. Draw hexadecimal pixel values with input video pixel color on black
  5861. background.
  5862. @item color2
  5863. Draw hexadecimal pixel values on color background picked from input video,
  5864. the text color is picked in such way so its always visible.
  5865. @end table
  5866. @item axis
  5867. Draw rows and columns numbers on left and top of video.
  5868. @item opacity
  5869. Set background opacity.
  5870. @end table
  5871. @section dctdnoiz
  5872. Denoise frames using 2D DCT (frequency domain filtering).
  5873. This filter is not designed for real time.
  5874. The filter accepts the following options:
  5875. @table @option
  5876. @item sigma, s
  5877. Set the noise sigma constant.
  5878. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5879. coefficient (absolute value) below this threshold with be dropped.
  5880. If you need a more advanced filtering, see @option{expr}.
  5881. Default is @code{0}.
  5882. @item overlap
  5883. Set number overlapping pixels for each block. Since the filter can be slow, you
  5884. may want to reduce this value, at the cost of a less effective filter and the
  5885. risk of various artefacts.
  5886. If the overlapping value doesn't permit processing the whole input width or
  5887. height, a warning will be displayed and according borders won't be denoised.
  5888. Default value is @var{blocksize}-1, which is the best possible setting.
  5889. @item expr, e
  5890. Set the coefficient factor expression.
  5891. For each coefficient of a DCT block, this expression will be evaluated as a
  5892. multiplier value for the coefficient.
  5893. If this is option is set, the @option{sigma} option will be ignored.
  5894. The absolute value of the coefficient can be accessed through the @var{c}
  5895. variable.
  5896. @item n
  5897. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5898. @var{blocksize}, which is the width and height of the processed blocks.
  5899. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5900. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5901. on the speed processing. Also, a larger block size does not necessarily means a
  5902. better de-noising.
  5903. @end table
  5904. @subsection Examples
  5905. Apply a denoise with a @option{sigma} of @code{4.5}:
  5906. @example
  5907. dctdnoiz=4.5
  5908. @end example
  5909. The same operation can be achieved using the expression system:
  5910. @example
  5911. dctdnoiz=e='gte(c, 4.5*3)'
  5912. @end example
  5913. Violent denoise using a block size of @code{16x16}:
  5914. @example
  5915. dctdnoiz=15:n=4
  5916. @end example
  5917. @section deband
  5918. Remove banding artifacts from input video.
  5919. It works by replacing banded pixels with average value of referenced pixels.
  5920. The filter accepts the following options:
  5921. @table @option
  5922. @item 1thr
  5923. @item 2thr
  5924. @item 3thr
  5925. @item 4thr
  5926. Set banding detection threshold for each plane. Default is 0.02.
  5927. Valid range is 0.00003 to 0.5.
  5928. If difference between current pixel and reference pixel is less than threshold,
  5929. it will be considered as banded.
  5930. @item range, r
  5931. Banding detection range in pixels. Default is 16. If positive, random number
  5932. in range 0 to set value will be used. If negative, exact absolute value
  5933. will be used.
  5934. The range defines square of four pixels around current pixel.
  5935. @item direction, d
  5936. Set direction in radians from which four pixel will be compared. If positive,
  5937. random direction from 0 to set direction will be picked. If negative, exact of
  5938. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5939. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5940. column.
  5941. @item blur, b
  5942. If enabled, current pixel is compared with average value of all four
  5943. surrounding pixels. The default is enabled. If disabled current pixel is
  5944. compared with all four surrounding pixels. The pixel is considered banded
  5945. if only all four differences with surrounding pixels are less than threshold.
  5946. @item coupling, c
  5947. If enabled, current pixel is changed if and only if all pixel components are banded,
  5948. e.g. banding detection threshold is triggered for all color components.
  5949. The default is disabled.
  5950. @end table
  5951. @section deblock
  5952. Remove blocking artifacts from input video.
  5953. The filter accepts the following options:
  5954. @table @option
  5955. @item filter
  5956. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5957. This controls what kind of deblocking is applied.
  5958. @item block
  5959. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5960. @item alpha
  5961. @item beta
  5962. @item gamma
  5963. @item delta
  5964. Set blocking detection thresholds. Allowed range is 0 to 1.
  5965. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5966. Using higher threshold gives more deblocking strength.
  5967. Setting @var{alpha} controls threshold detection at exact edge of block.
  5968. Remaining options controls threshold detection near the edge. Each one for
  5969. below/above or left/right. Setting any of those to @var{0} disables
  5970. deblocking.
  5971. @item planes
  5972. Set planes to filter. Default is to filter all available planes.
  5973. @end table
  5974. @subsection Examples
  5975. @itemize
  5976. @item
  5977. Deblock using weak filter and block size of 4 pixels.
  5978. @example
  5979. deblock=filter=weak:block=4
  5980. @end example
  5981. @item
  5982. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5983. deblocking more edges.
  5984. @example
  5985. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5986. @end example
  5987. @item
  5988. Similar as above, but filter only first plane.
  5989. @example
  5990. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5991. @end example
  5992. @item
  5993. Similar as above, but filter only second and third plane.
  5994. @example
  5995. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5996. @end example
  5997. @end itemize
  5998. @anchor{decimate}
  5999. @section decimate
  6000. Drop duplicated frames at regular intervals.
  6001. The filter accepts the following options:
  6002. @table @option
  6003. @item cycle
  6004. Set the number of frames from which one will be dropped. Setting this to
  6005. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6006. Default is @code{5}.
  6007. @item dupthresh
  6008. Set the threshold for duplicate detection. If the difference metric for a frame
  6009. is less than or equal to this value, then it is declared as duplicate. Default
  6010. is @code{1.1}
  6011. @item scthresh
  6012. Set scene change threshold. Default is @code{15}.
  6013. @item blockx
  6014. @item blocky
  6015. Set the size of the x and y-axis blocks used during metric calculations.
  6016. Larger blocks give better noise suppression, but also give worse detection of
  6017. small movements. Must be a power of two. Default is @code{32}.
  6018. @item ppsrc
  6019. Mark main input as a pre-processed input and activate clean source input
  6020. stream. This allows the input to be pre-processed with various filters to help
  6021. the metrics calculation while keeping the frame selection lossless. When set to
  6022. @code{1}, the first stream is for the pre-processed input, and the second
  6023. stream is the clean source from where the kept frames are chosen. Default is
  6024. @code{0}.
  6025. @item chroma
  6026. Set whether or not chroma is considered in the metric calculations. Default is
  6027. @code{1}.
  6028. @end table
  6029. @section deconvolve
  6030. Apply 2D deconvolution of video stream in frequency domain using second stream
  6031. as impulse.
  6032. The filter accepts the following options:
  6033. @table @option
  6034. @item planes
  6035. Set which planes to process.
  6036. @item impulse
  6037. Set which impulse video frames will be processed, can be @var{first}
  6038. or @var{all}. Default is @var{all}.
  6039. @item noise
  6040. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6041. and height are not same and not power of 2 or if stream prior to convolving
  6042. had noise.
  6043. @end table
  6044. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6045. @section dedot
  6046. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6047. It accepts the following options:
  6048. @table @option
  6049. @item m
  6050. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6051. @var{rainbows} for cross-color reduction.
  6052. @item lt
  6053. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6054. @item tl
  6055. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6056. @item tc
  6057. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6058. @item ct
  6059. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6060. @end table
  6061. @section deflate
  6062. Apply deflate effect to the video.
  6063. This filter replaces the pixel by the local(3x3) average by taking into account
  6064. only values lower than the pixel.
  6065. It accepts the following options:
  6066. @table @option
  6067. @item threshold0
  6068. @item threshold1
  6069. @item threshold2
  6070. @item threshold3
  6071. Limit the maximum change for each plane, default is 65535.
  6072. If 0, plane will remain unchanged.
  6073. @end table
  6074. @section deflicker
  6075. Remove temporal frame luminance variations.
  6076. It accepts the following options:
  6077. @table @option
  6078. @item size, s
  6079. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6080. @item mode, m
  6081. Set averaging mode to smooth temporal luminance variations.
  6082. Available values are:
  6083. @table @samp
  6084. @item am
  6085. Arithmetic mean
  6086. @item gm
  6087. Geometric mean
  6088. @item hm
  6089. Harmonic mean
  6090. @item qm
  6091. Quadratic mean
  6092. @item cm
  6093. Cubic mean
  6094. @item pm
  6095. Power mean
  6096. @item median
  6097. Median
  6098. @end table
  6099. @item bypass
  6100. Do not actually modify frame. Useful when one only wants metadata.
  6101. @end table
  6102. @section dejudder
  6103. Remove judder produced by partially interlaced telecined content.
  6104. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6105. source was partially telecined content then the output of @code{pullup,dejudder}
  6106. will have a variable frame rate. May change the recorded frame rate of the
  6107. container. Aside from that change, this filter will not affect constant frame
  6108. rate video.
  6109. The option available in this filter is:
  6110. @table @option
  6111. @item cycle
  6112. Specify the length of the window over which the judder repeats.
  6113. Accepts any integer greater than 1. Useful values are:
  6114. @table @samp
  6115. @item 4
  6116. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6117. @item 5
  6118. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6119. @item 20
  6120. If a mixture of the two.
  6121. @end table
  6122. The default is @samp{4}.
  6123. @end table
  6124. @section delogo
  6125. Suppress a TV station logo by a simple interpolation of the surrounding
  6126. pixels. Just set a rectangle covering the logo and watch it disappear
  6127. (and sometimes something even uglier appear - your mileage may vary).
  6128. It accepts the following parameters:
  6129. @table @option
  6130. @item x
  6131. @item y
  6132. Specify the top left corner coordinates of the logo. They must be
  6133. specified.
  6134. @item w
  6135. @item h
  6136. Specify the width and height of the logo to clear. They must be
  6137. specified.
  6138. @item band, t
  6139. Specify the thickness of the fuzzy edge of the rectangle (added to
  6140. @var{w} and @var{h}). The default value is 1. This option is
  6141. deprecated, setting higher values should no longer be necessary and
  6142. is not recommended.
  6143. @item show
  6144. When set to 1, a green rectangle is drawn on the screen to simplify
  6145. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6146. The default value is 0.
  6147. The rectangle is drawn on the outermost pixels which will be (partly)
  6148. replaced with interpolated values. The values of the next pixels
  6149. immediately outside this rectangle in each direction will be used to
  6150. compute the interpolated pixel values inside the rectangle.
  6151. @end table
  6152. @subsection Examples
  6153. @itemize
  6154. @item
  6155. Set a rectangle covering the area with top left corner coordinates 0,0
  6156. and size 100x77, and a band of size 10:
  6157. @example
  6158. delogo=x=0:y=0:w=100:h=77:band=10
  6159. @end example
  6160. @end itemize
  6161. @section deshake
  6162. Attempt to fix small changes in horizontal and/or vertical shift. This
  6163. filter helps remove camera shake from hand-holding a camera, bumping a
  6164. tripod, moving on a vehicle, etc.
  6165. The filter accepts the following options:
  6166. @table @option
  6167. @item x
  6168. @item y
  6169. @item w
  6170. @item h
  6171. Specify a rectangular area where to limit the search for motion
  6172. vectors.
  6173. If desired the search for motion vectors can be limited to a
  6174. rectangular area of the frame defined by its top left corner, width
  6175. and height. These parameters have the same meaning as the drawbox
  6176. filter which can be used to visualise the position of the bounding
  6177. box.
  6178. This is useful when simultaneous movement of subjects within the frame
  6179. might be confused for camera motion by the motion vector search.
  6180. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6181. then the full frame is used. This allows later options to be set
  6182. without specifying the bounding box for the motion vector search.
  6183. Default - search the whole frame.
  6184. @item rx
  6185. @item ry
  6186. Specify the maximum extent of movement in x and y directions in the
  6187. range 0-64 pixels. Default 16.
  6188. @item edge
  6189. Specify how to generate pixels to fill blanks at the edge of the
  6190. frame. Available values are:
  6191. @table @samp
  6192. @item blank, 0
  6193. Fill zeroes at blank locations
  6194. @item original, 1
  6195. Original image at blank locations
  6196. @item clamp, 2
  6197. Extruded edge value at blank locations
  6198. @item mirror, 3
  6199. Mirrored edge at blank locations
  6200. @end table
  6201. Default value is @samp{mirror}.
  6202. @item blocksize
  6203. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6204. default 8.
  6205. @item contrast
  6206. Specify the contrast threshold for blocks. Only blocks with more than
  6207. the specified contrast (difference between darkest and lightest
  6208. pixels) will be considered. Range 1-255, default 125.
  6209. @item search
  6210. Specify the search strategy. Available values are:
  6211. @table @samp
  6212. @item exhaustive, 0
  6213. Set exhaustive search
  6214. @item less, 1
  6215. Set less exhaustive search.
  6216. @end table
  6217. Default value is @samp{exhaustive}.
  6218. @item filename
  6219. If set then a detailed log of the motion search is written to the
  6220. specified file.
  6221. @end table
  6222. @section despill
  6223. Remove unwanted contamination of foreground colors, caused by reflected color of
  6224. greenscreen or bluescreen.
  6225. This filter accepts the following options:
  6226. @table @option
  6227. @item type
  6228. Set what type of despill to use.
  6229. @item mix
  6230. Set how spillmap will be generated.
  6231. @item expand
  6232. Set how much to get rid of still remaining spill.
  6233. @item red
  6234. Controls amount of red in spill area.
  6235. @item green
  6236. Controls amount of green in spill area.
  6237. Should be -1 for greenscreen.
  6238. @item blue
  6239. Controls amount of blue in spill area.
  6240. Should be -1 for bluescreen.
  6241. @item brightness
  6242. Controls brightness of spill area, preserving colors.
  6243. @item alpha
  6244. Modify alpha from generated spillmap.
  6245. @end table
  6246. @section detelecine
  6247. Apply an exact inverse of the telecine operation. It requires a predefined
  6248. pattern specified using the pattern option which must be the same as that passed
  6249. to the telecine filter.
  6250. This filter accepts the following options:
  6251. @table @option
  6252. @item first_field
  6253. @table @samp
  6254. @item top, t
  6255. top field first
  6256. @item bottom, b
  6257. bottom field first
  6258. The default value is @code{top}.
  6259. @end table
  6260. @item pattern
  6261. A string of numbers representing the pulldown pattern you wish to apply.
  6262. The default value is @code{23}.
  6263. @item start_frame
  6264. A number representing position of the first frame with respect to the telecine
  6265. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6266. @end table
  6267. @section dilation
  6268. Apply dilation effect to the video.
  6269. This filter replaces the pixel by the local(3x3) maximum.
  6270. It accepts the following options:
  6271. @table @option
  6272. @item threshold0
  6273. @item threshold1
  6274. @item threshold2
  6275. @item threshold3
  6276. Limit the maximum change for each plane, default is 65535.
  6277. If 0, plane will remain unchanged.
  6278. @item coordinates
  6279. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6280. pixels are used.
  6281. Flags to local 3x3 coordinates maps like this:
  6282. 1 2 3
  6283. 4 5
  6284. 6 7 8
  6285. @end table
  6286. @section displace
  6287. Displace pixels as indicated by second and third input stream.
  6288. It takes three input streams and outputs one stream, the first input is the
  6289. source, and second and third input are displacement maps.
  6290. The second input specifies how much to displace pixels along the
  6291. x-axis, while the third input specifies how much to displace pixels
  6292. along the y-axis.
  6293. If one of displacement map streams terminates, last frame from that
  6294. displacement map will be used.
  6295. Note that once generated, displacements maps can be reused over and over again.
  6296. A description of the accepted options follows.
  6297. @table @option
  6298. @item edge
  6299. Set displace behavior for pixels that are out of range.
  6300. Available values are:
  6301. @table @samp
  6302. @item blank
  6303. Missing pixels are replaced by black pixels.
  6304. @item smear
  6305. Adjacent pixels will spread out to replace missing pixels.
  6306. @item wrap
  6307. Out of range pixels are wrapped so they point to pixels of other side.
  6308. @item mirror
  6309. Out of range pixels will be replaced with mirrored pixels.
  6310. @end table
  6311. Default is @samp{smear}.
  6312. @end table
  6313. @subsection Examples
  6314. @itemize
  6315. @item
  6316. Add ripple effect to rgb input of video size hd720:
  6317. @example
  6318. 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
  6319. @end example
  6320. @item
  6321. Add wave effect to rgb input of video size hd720:
  6322. @example
  6323. 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
  6324. @end example
  6325. @end itemize
  6326. @section drawbox
  6327. Draw a colored box on the input image.
  6328. It accepts the following parameters:
  6329. @table @option
  6330. @item x
  6331. @item y
  6332. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6333. @item width, w
  6334. @item height, h
  6335. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6336. the input width and height. It defaults to 0.
  6337. @item color, c
  6338. Specify the color of the box to write. For the general syntax of this option,
  6339. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6340. value @code{invert} is used, the box edge color is the same as the
  6341. video with inverted luma.
  6342. @item thickness, t
  6343. The expression which sets the thickness of the box edge.
  6344. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6345. See below for the list of accepted constants.
  6346. @item replace
  6347. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6348. will overwrite the video's color and alpha pixels.
  6349. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6350. @end table
  6351. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6352. following constants:
  6353. @table @option
  6354. @item dar
  6355. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6356. @item hsub
  6357. @item vsub
  6358. horizontal and vertical chroma subsample values. For example for the
  6359. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6360. @item in_h, ih
  6361. @item in_w, iw
  6362. The input width and height.
  6363. @item sar
  6364. The input sample aspect ratio.
  6365. @item x
  6366. @item y
  6367. The x and y offset coordinates where the box is drawn.
  6368. @item w
  6369. @item h
  6370. The width and height of the drawn box.
  6371. @item t
  6372. The thickness of the drawn box.
  6373. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6374. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6375. @end table
  6376. @subsection Examples
  6377. @itemize
  6378. @item
  6379. Draw a black box around the edge of the input image:
  6380. @example
  6381. drawbox
  6382. @end example
  6383. @item
  6384. Draw a box with color red and an opacity of 50%:
  6385. @example
  6386. drawbox=10:20:200:60:red@@0.5
  6387. @end example
  6388. The previous example can be specified as:
  6389. @example
  6390. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6391. @end example
  6392. @item
  6393. Fill the box with pink color:
  6394. @example
  6395. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6396. @end example
  6397. @item
  6398. Draw a 2-pixel red 2.40:1 mask:
  6399. @example
  6400. 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
  6401. @end example
  6402. @end itemize
  6403. @section drawgrid
  6404. Draw a grid on the input image.
  6405. It accepts the following parameters:
  6406. @table @option
  6407. @item x
  6408. @item y
  6409. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6410. @item width, w
  6411. @item height, h
  6412. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6413. input width and height, respectively, minus @code{thickness}, so image gets
  6414. framed. Default to 0.
  6415. @item color, c
  6416. Specify the color of the grid. For the general syntax of this option,
  6417. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6418. value @code{invert} is used, the grid color is the same as the
  6419. video with inverted luma.
  6420. @item thickness, t
  6421. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6422. See below for the list of accepted constants.
  6423. @item replace
  6424. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6425. will overwrite the video's color and alpha pixels.
  6426. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6427. @end table
  6428. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6429. following constants:
  6430. @table @option
  6431. @item dar
  6432. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6433. @item hsub
  6434. @item vsub
  6435. horizontal and vertical chroma subsample values. For example for the
  6436. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6437. @item in_h, ih
  6438. @item in_w, iw
  6439. The input grid cell width and height.
  6440. @item sar
  6441. The input sample aspect ratio.
  6442. @item x
  6443. @item y
  6444. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6445. @item w
  6446. @item h
  6447. The width and height of the drawn cell.
  6448. @item t
  6449. The thickness of the drawn cell.
  6450. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6451. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6452. @end table
  6453. @subsection Examples
  6454. @itemize
  6455. @item
  6456. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6457. @example
  6458. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6459. @end example
  6460. @item
  6461. Draw a white 3x3 grid with an opacity of 50%:
  6462. @example
  6463. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6464. @end example
  6465. @end itemize
  6466. @anchor{drawtext}
  6467. @section drawtext
  6468. Draw a text string or text from a specified file on top of a video, using the
  6469. libfreetype library.
  6470. To enable compilation of this filter, you need to configure FFmpeg with
  6471. @code{--enable-libfreetype}.
  6472. To enable default font fallback and the @var{font} option you need to
  6473. configure FFmpeg with @code{--enable-libfontconfig}.
  6474. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6475. @code{--enable-libfribidi}.
  6476. @subsection Syntax
  6477. It accepts the following parameters:
  6478. @table @option
  6479. @item box
  6480. Used to draw a box around text using the background color.
  6481. The value must be either 1 (enable) or 0 (disable).
  6482. The default value of @var{box} is 0.
  6483. @item boxborderw
  6484. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6485. The default value of @var{boxborderw} is 0.
  6486. @item boxcolor
  6487. The color to be used for drawing box around text. For the syntax of this
  6488. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6489. The default value of @var{boxcolor} is "white".
  6490. @item line_spacing
  6491. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6492. The default value of @var{line_spacing} is 0.
  6493. @item borderw
  6494. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6495. The default value of @var{borderw} is 0.
  6496. @item bordercolor
  6497. Set the color to be used for drawing border around text. For the syntax of this
  6498. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6499. The default value of @var{bordercolor} is "black".
  6500. @item expansion
  6501. Select how the @var{text} is expanded. Can be either @code{none},
  6502. @code{strftime} (deprecated) or
  6503. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6504. below for details.
  6505. @item basetime
  6506. Set a start time for the count. Value is in microseconds. Only applied
  6507. in the deprecated strftime expansion mode. To emulate in normal expansion
  6508. mode use the @code{pts} function, supplying the start time (in seconds)
  6509. as the second argument.
  6510. @item fix_bounds
  6511. If true, check and fix text coords to avoid clipping.
  6512. @item fontcolor
  6513. The color to be used for drawing fonts. For the syntax of this option, check
  6514. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6515. The default value of @var{fontcolor} is "black".
  6516. @item fontcolor_expr
  6517. String which is expanded the same way as @var{text} to obtain dynamic
  6518. @var{fontcolor} value. By default this option has empty value and is not
  6519. processed. When this option is set, it overrides @var{fontcolor} option.
  6520. @item font
  6521. The font family to be used for drawing text. By default Sans.
  6522. @item fontfile
  6523. The font file to be used for drawing text. The path must be included.
  6524. This parameter is mandatory if the fontconfig support is disabled.
  6525. @item alpha
  6526. Draw the text applying alpha blending. The value can
  6527. be a number between 0.0 and 1.0.
  6528. The expression accepts the same variables @var{x, y} as well.
  6529. The default value is 1.
  6530. Please see @var{fontcolor_expr}.
  6531. @item fontsize
  6532. The font size to be used for drawing text.
  6533. The default value of @var{fontsize} is 16.
  6534. @item text_shaping
  6535. If set to 1, attempt to shape the text (for example, reverse the order of
  6536. right-to-left text and join Arabic characters) before drawing it.
  6537. Otherwise, just draw the text exactly as given.
  6538. By default 1 (if supported).
  6539. @item ft_load_flags
  6540. The flags to be used for loading the fonts.
  6541. The flags map the corresponding flags supported by libfreetype, and are
  6542. a combination of the following values:
  6543. @table @var
  6544. @item default
  6545. @item no_scale
  6546. @item no_hinting
  6547. @item render
  6548. @item no_bitmap
  6549. @item vertical_layout
  6550. @item force_autohint
  6551. @item crop_bitmap
  6552. @item pedantic
  6553. @item ignore_global_advance_width
  6554. @item no_recurse
  6555. @item ignore_transform
  6556. @item monochrome
  6557. @item linear_design
  6558. @item no_autohint
  6559. @end table
  6560. Default value is "default".
  6561. For more information consult the documentation for the FT_LOAD_*
  6562. libfreetype flags.
  6563. @item shadowcolor
  6564. The color to be used for drawing a shadow behind the drawn text. For the
  6565. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6566. ffmpeg-utils manual,ffmpeg-utils}.
  6567. The default value of @var{shadowcolor} is "black".
  6568. @item shadowx
  6569. @item shadowy
  6570. The x and y offsets for the text shadow position with respect to the
  6571. position of the text. They can be either positive or negative
  6572. values. The default value for both is "0".
  6573. @item start_number
  6574. The starting frame number for the n/frame_num variable. The default value
  6575. is "0".
  6576. @item tabsize
  6577. The size in number of spaces to use for rendering the tab.
  6578. Default value is 4.
  6579. @item timecode
  6580. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6581. format. It can be used with or without text parameter. @var{timecode_rate}
  6582. option must be specified.
  6583. @item timecode_rate, rate, r
  6584. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6585. integer. Minimum value is "1".
  6586. Drop-frame timecode is supported for frame rates 30 & 60.
  6587. @item tc24hmax
  6588. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6589. Default is 0 (disabled).
  6590. @item text
  6591. The text string to be drawn. The text must be a sequence of UTF-8
  6592. encoded characters.
  6593. This parameter is mandatory if no file is specified with the parameter
  6594. @var{textfile}.
  6595. @item textfile
  6596. A text file containing text to be drawn. The text must be a sequence
  6597. of UTF-8 encoded characters.
  6598. This parameter is mandatory if no text string is specified with the
  6599. parameter @var{text}.
  6600. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6601. @item reload
  6602. If set to 1, the @var{textfile} will be reloaded before each frame.
  6603. Be sure to update it atomically, or it may be read partially, or even fail.
  6604. @item x
  6605. @item y
  6606. The expressions which specify the offsets where text will be drawn
  6607. within the video frame. They are relative to the top/left border of the
  6608. output image.
  6609. The default value of @var{x} and @var{y} is "0".
  6610. See below for the list of accepted constants and functions.
  6611. @end table
  6612. The parameters for @var{x} and @var{y} are expressions containing the
  6613. following constants and functions:
  6614. @table @option
  6615. @item dar
  6616. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6617. @item hsub
  6618. @item vsub
  6619. horizontal and vertical chroma subsample values. For example for the
  6620. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6621. @item line_h, lh
  6622. the height of each text line
  6623. @item main_h, h, H
  6624. the input height
  6625. @item main_w, w, W
  6626. the input width
  6627. @item max_glyph_a, ascent
  6628. the maximum distance from the baseline to the highest/upper grid
  6629. coordinate used to place a glyph outline point, for all the rendered
  6630. glyphs.
  6631. It is a positive value, due to the grid's orientation with the Y axis
  6632. upwards.
  6633. @item max_glyph_d, descent
  6634. the maximum distance from the baseline to the lowest grid coordinate
  6635. used to place a glyph outline point, for all the rendered glyphs.
  6636. This is a negative value, due to the grid's orientation, with the Y axis
  6637. upwards.
  6638. @item max_glyph_h
  6639. maximum glyph height, that is the maximum height for all the glyphs
  6640. contained in the rendered text, it is equivalent to @var{ascent} -
  6641. @var{descent}.
  6642. @item max_glyph_w
  6643. maximum glyph width, that is the maximum width for all the glyphs
  6644. contained in the rendered text
  6645. @item n
  6646. the number of input frame, starting from 0
  6647. @item rand(min, max)
  6648. return a random number included between @var{min} and @var{max}
  6649. @item sar
  6650. The input sample aspect ratio.
  6651. @item t
  6652. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6653. @item text_h, th
  6654. the height of the rendered text
  6655. @item text_w, tw
  6656. the width of the rendered text
  6657. @item x
  6658. @item y
  6659. the x and y offset coordinates where the text is drawn.
  6660. These parameters allow the @var{x} and @var{y} expressions to refer
  6661. each other, so you can for example specify @code{y=x/dar}.
  6662. @end table
  6663. @anchor{drawtext_expansion}
  6664. @subsection Text expansion
  6665. If @option{expansion} is set to @code{strftime},
  6666. the filter recognizes strftime() sequences in the provided text and
  6667. expands them accordingly. Check the documentation of strftime(). This
  6668. feature is deprecated.
  6669. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6670. If @option{expansion} is set to @code{normal} (which is the default),
  6671. the following expansion mechanism is used.
  6672. The backslash character @samp{\}, followed by any character, always expands to
  6673. the second character.
  6674. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6675. braces is a function name, possibly followed by arguments separated by ':'.
  6676. If the arguments contain special characters or delimiters (':' or '@}'),
  6677. they should be escaped.
  6678. Note that they probably must also be escaped as the value for the
  6679. @option{text} option in the filter argument string and as the filter
  6680. argument in the filtergraph description, and possibly also for the shell,
  6681. that makes up to four levels of escaping; using a text file avoids these
  6682. problems.
  6683. The following functions are available:
  6684. @table @command
  6685. @item expr, e
  6686. The expression evaluation result.
  6687. It must take one argument specifying the expression to be evaluated,
  6688. which accepts the same constants and functions as the @var{x} and
  6689. @var{y} values. Note that not all constants should be used, for
  6690. example the text size is not known when evaluating the expression, so
  6691. the constants @var{text_w} and @var{text_h} will have an undefined
  6692. value.
  6693. @item expr_int_format, eif
  6694. Evaluate the expression's value and output as formatted integer.
  6695. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6696. The second argument specifies the output format. Allowed values are @samp{x},
  6697. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6698. @code{printf} function.
  6699. The third parameter is optional and sets the number of positions taken by the output.
  6700. It can be used to add padding with zeros from the left.
  6701. @item gmtime
  6702. The time at which the filter is running, expressed in UTC.
  6703. It can accept an argument: a strftime() format string.
  6704. @item localtime
  6705. The time at which the filter is running, expressed in the local time zone.
  6706. It can accept an argument: a strftime() format string.
  6707. @item metadata
  6708. Frame metadata. Takes one or two arguments.
  6709. The first argument is mandatory and specifies the metadata key.
  6710. The second argument is optional and specifies a default value, used when the
  6711. metadata key is not found or empty.
  6712. @item n, frame_num
  6713. The frame number, starting from 0.
  6714. @item pict_type
  6715. A 1 character description of the current picture type.
  6716. @item pts
  6717. The timestamp of the current frame.
  6718. It can take up to three arguments.
  6719. The first argument is the format of the timestamp; it defaults to @code{flt}
  6720. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6721. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6722. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6723. @code{localtime} stands for the timestamp of the frame formatted as
  6724. local time zone time.
  6725. The second argument is an offset added to the timestamp.
  6726. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6727. supplied to present the hour part of the formatted timestamp in 24h format
  6728. (00-23).
  6729. If the format is set to @code{localtime} or @code{gmtime},
  6730. a third argument may be supplied: a strftime() format string.
  6731. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6732. @end table
  6733. @subsection Examples
  6734. @itemize
  6735. @item
  6736. Draw "Test Text" with font FreeSerif, using the default values for the
  6737. optional parameters.
  6738. @example
  6739. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6740. @end example
  6741. @item
  6742. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6743. and y=50 (counting from the top-left corner of the screen), text is
  6744. yellow with a red box around it. Both the text and the box have an
  6745. opacity of 20%.
  6746. @example
  6747. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6748. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6749. @end example
  6750. Note that the double quotes are not necessary if spaces are not used
  6751. within the parameter list.
  6752. @item
  6753. Show the text at the center of the video frame:
  6754. @example
  6755. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6756. @end example
  6757. @item
  6758. Show the text at a random position, switching to a new position every 30 seconds:
  6759. @example
  6760. 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)"
  6761. @end example
  6762. @item
  6763. Show a text line sliding from right to left in the last row of the video
  6764. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6765. with no newlines.
  6766. @example
  6767. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6768. @end example
  6769. @item
  6770. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6771. @example
  6772. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6773. @end example
  6774. @item
  6775. Draw a single green letter "g", at the center of the input video.
  6776. The glyph baseline is placed at half screen height.
  6777. @example
  6778. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6779. @end example
  6780. @item
  6781. Show text for 1 second every 3 seconds:
  6782. @example
  6783. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6784. @end example
  6785. @item
  6786. Use fontconfig to set the font. Note that the colons need to be escaped.
  6787. @example
  6788. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6789. @end example
  6790. @item
  6791. Print the date of a real-time encoding (see strftime(3)):
  6792. @example
  6793. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6794. @end example
  6795. @item
  6796. Show text fading in and out (appearing/disappearing):
  6797. @example
  6798. #!/bin/sh
  6799. DS=1.0 # display start
  6800. DE=10.0 # display end
  6801. FID=1.5 # fade in duration
  6802. FOD=5 # fade out duration
  6803. 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 @}"
  6804. @end example
  6805. @item
  6806. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6807. and the @option{fontsize} value are included in the @option{y} offset.
  6808. @example
  6809. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6810. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6811. @end example
  6812. @end itemize
  6813. For more information about libfreetype, check:
  6814. @url{http://www.freetype.org/}.
  6815. For more information about fontconfig, check:
  6816. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6817. For more information about libfribidi, check:
  6818. @url{http://fribidi.org/}.
  6819. @section edgedetect
  6820. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6821. The filter accepts the following options:
  6822. @table @option
  6823. @item low
  6824. @item high
  6825. Set low and high threshold values used by the Canny thresholding
  6826. algorithm.
  6827. The high threshold selects the "strong" edge pixels, which are then
  6828. connected through 8-connectivity with the "weak" edge pixels selected
  6829. by the low threshold.
  6830. @var{low} and @var{high} threshold values must be chosen in the range
  6831. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6832. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6833. is @code{50/255}.
  6834. @item mode
  6835. Define the drawing mode.
  6836. @table @samp
  6837. @item wires
  6838. Draw white/gray wires on black background.
  6839. @item colormix
  6840. Mix the colors to create a paint/cartoon effect.
  6841. @item canny
  6842. Apply Canny edge detector on all selected planes.
  6843. @end table
  6844. Default value is @var{wires}.
  6845. @item planes
  6846. Select planes for filtering. By default all available planes are filtered.
  6847. @end table
  6848. @subsection Examples
  6849. @itemize
  6850. @item
  6851. Standard edge detection with custom values for the hysteresis thresholding:
  6852. @example
  6853. edgedetect=low=0.1:high=0.4
  6854. @end example
  6855. @item
  6856. Painting effect without thresholding:
  6857. @example
  6858. edgedetect=mode=colormix:high=0
  6859. @end example
  6860. @end itemize
  6861. @section eq
  6862. Set brightness, contrast, saturation and approximate gamma adjustment.
  6863. The filter accepts the following options:
  6864. @table @option
  6865. @item contrast
  6866. Set the contrast expression. The value must be a float value in range
  6867. @code{-2.0} to @code{2.0}. The default value is "1".
  6868. @item brightness
  6869. Set the brightness expression. The value must be a float value in
  6870. range @code{-1.0} to @code{1.0}. The default value is "0".
  6871. @item saturation
  6872. Set the saturation expression. The value must be a float in
  6873. range @code{0.0} to @code{3.0}. The default value is "1".
  6874. @item gamma
  6875. Set the gamma expression. The value must be a float in range
  6876. @code{0.1} to @code{10.0}. The default value is "1".
  6877. @item gamma_r
  6878. Set the gamma expression for red. The value must be a float in
  6879. range @code{0.1} to @code{10.0}. The default value is "1".
  6880. @item gamma_g
  6881. Set the gamma expression for green. The value must be a float in range
  6882. @code{0.1} to @code{10.0}. The default value is "1".
  6883. @item gamma_b
  6884. Set the gamma expression for blue. The value must be a float in range
  6885. @code{0.1} to @code{10.0}. The default value is "1".
  6886. @item gamma_weight
  6887. Set the gamma weight expression. It can be used to reduce the effect
  6888. of a high gamma value on bright image areas, e.g. keep them from
  6889. getting overamplified and just plain white. The value must be a float
  6890. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6891. gamma correction all the way down while @code{1.0} leaves it at its
  6892. full strength. Default is "1".
  6893. @item eval
  6894. Set when the expressions for brightness, contrast, saturation and
  6895. gamma expressions are evaluated.
  6896. It accepts the following values:
  6897. @table @samp
  6898. @item init
  6899. only evaluate expressions once during the filter initialization or
  6900. when a command is processed
  6901. @item frame
  6902. evaluate expressions for each incoming frame
  6903. @end table
  6904. Default value is @samp{init}.
  6905. @end table
  6906. The expressions accept the following parameters:
  6907. @table @option
  6908. @item n
  6909. frame count of the input frame starting from 0
  6910. @item pos
  6911. byte position of the corresponding packet in the input file, NAN if
  6912. unspecified
  6913. @item r
  6914. frame rate of the input video, NAN if the input frame rate is unknown
  6915. @item t
  6916. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6917. @end table
  6918. @subsection Commands
  6919. The filter supports the following commands:
  6920. @table @option
  6921. @item contrast
  6922. Set the contrast expression.
  6923. @item brightness
  6924. Set the brightness expression.
  6925. @item saturation
  6926. Set the saturation expression.
  6927. @item gamma
  6928. Set the gamma expression.
  6929. @item gamma_r
  6930. Set the gamma_r expression.
  6931. @item gamma_g
  6932. Set gamma_g expression.
  6933. @item gamma_b
  6934. Set gamma_b expression.
  6935. @item gamma_weight
  6936. Set gamma_weight expression.
  6937. The command accepts the same syntax of the corresponding option.
  6938. If the specified expression is not valid, it is kept at its current
  6939. value.
  6940. @end table
  6941. @section erosion
  6942. Apply erosion effect to the video.
  6943. This filter replaces the pixel by the local(3x3) minimum.
  6944. It accepts the following options:
  6945. @table @option
  6946. @item threshold0
  6947. @item threshold1
  6948. @item threshold2
  6949. @item threshold3
  6950. Limit the maximum change for each plane, default is 65535.
  6951. If 0, plane will remain unchanged.
  6952. @item coordinates
  6953. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6954. pixels are used.
  6955. Flags to local 3x3 coordinates maps like this:
  6956. 1 2 3
  6957. 4 5
  6958. 6 7 8
  6959. @end table
  6960. @section extractplanes
  6961. Extract color channel components from input video stream into
  6962. separate grayscale video streams.
  6963. The filter accepts the following option:
  6964. @table @option
  6965. @item planes
  6966. Set plane(s) to extract.
  6967. Available values for planes are:
  6968. @table @samp
  6969. @item y
  6970. @item u
  6971. @item v
  6972. @item a
  6973. @item r
  6974. @item g
  6975. @item b
  6976. @end table
  6977. Choosing planes not available in the input will result in an error.
  6978. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6979. with @code{y}, @code{u}, @code{v} planes at same time.
  6980. @end table
  6981. @subsection Examples
  6982. @itemize
  6983. @item
  6984. Extract luma, u and v color channel component from input video frame
  6985. into 3 grayscale outputs:
  6986. @example
  6987. 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
  6988. @end example
  6989. @end itemize
  6990. @section elbg
  6991. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6992. For each input image, the filter will compute the optimal mapping from
  6993. the input to the output given the codebook length, that is the number
  6994. of distinct output colors.
  6995. This filter accepts the following options.
  6996. @table @option
  6997. @item codebook_length, l
  6998. Set codebook length. The value must be a positive integer, and
  6999. represents the number of distinct output colors. Default value is 256.
  7000. @item nb_steps, n
  7001. Set the maximum number of iterations to apply for computing the optimal
  7002. mapping. The higher the value the better the result and the higher the
  7003. computation time. Default value is 1.
  7004. @item seed, s
  7005. Set a random seed, must be an integer included between 0 and
  7006. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7007. will try to use a good random seed on a best effort basis.
  7008. @item pal8
  7009. Set pal8 output pixel format. This option does not work with codebook
  7010. length greater than 256.
  7011. @end table
  7012. @section entropy
  7013. Measure graylevel entropy in histogram of color channels of video frames.
  7014. It accepts the following parameters:
  7015. @table @option
  7016. @item mode
  7017. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7018. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7019. between neighbour histogram values.
  7020. @end table
  7021. @section fade
  7022. Apply a fade-in/out effect to the input video.
  7023. It accepts the following parameters:
  7024. @table @option
  7025. @item type, t
  7026. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7027. effect.
  7028. Default is @code{in}.
  7029. @item start_frame, s
  7030. Specify the number of the frame to start applying the fade
  7031. effect at. Default is 0.
  7032. @item nb_frames, n
  7033. The number of frames that the fade effect lasts. At the end of the
  7034. fade-in effect, the output video will have the same intensity as the input video.
  7035. At the end of the fade-out transition, the output video will be filled with the
  7036. selected @option{color}.
  7037. Default is 25.
  7038. @item alpha
  7039. If set to 1, fade only alpha channel, if one exists on the input.
  7040. Default value is 0.
  7041. @item start_time, st
  7042. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7043. effect. If both start_frame and start_time are specified, the fade will start at
  7044. whichever comes last. Default is 0.
  7045. @item duration, d
  7046. The number of seconds for which the fade effect has to last. At the end of the
  7047. fade-in effect the output video will have the same intensity as the input video,
  7048. at the end of the fade-out transition the output video will be filled with the
  7049. selected @option{color}.
  7050. If both duration and nb_frames are specified, duration is used. Default is 0
  7051. (nb_frames is used by default).
  7052. @item color, c
  7053. Specify the color of the fade. Default is "black".
  7054. @end table
  7055. @subsection Examples
  7056. @itemize
  7057. @item
  7058. Fade in the first 30 frames of video:
  7059. @example
  7060. fade=in:0:30
  7061. @end example
  7062. The command above is equivalent to:
  7063. @example
  7064. fade=t=in:s=0:n=30
  7065. @end example
  7066. @item
  7067. Fade out the last 45 frames of a 200-frame video:
  7068. @example
  7069. fade=out:155:45
  7070. fade=type=out:start_frame=155:nb_frames=45
  7071. @end example
  7072. @item
  7073. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7074. @example
  7075. fade=in:0:25, fade=out:975:25
  7076. @end example
  7077. @item
  7078. Make the first 5 frames yellow, then fade in from frame 5-24:
  7079. @example
  7080. fade=in:5:20:color=yellow
  7081. @end example
  7082. @item
  7083. Fade in alpha over first 25 frames of video:
  7084. @example
  7085. fade=in:0:25:alpha=1
  7086. @end example
  7087. @item
  7088. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7089. @example
  7090. fade=t=in:st=5.5:d=0.5
  7091. @end example
  7092. @end itemize
  7093. @section fftfilt
  7094. Apply arbitrary expressions to samples in frequency domain
  7095. @table @option
  7096. @item dc_Y
  7097. Adjust the dc value (gain) of the luma plane of the image. The filter
  7098. accepts an integer value in range @code{0} to @code{1000}. The default
  7099. value is set to @code{0}.
  7100. @item dc_U
  7101. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7102. filter accepts an integer value in range @code{0} to @code{1000}. The
  7103. default value is set to @code{0}.
  7104. @item dc_V
  7105. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7106. filter accepts an integer value in range @code{0} to @code{1000}. The
  7107. default value is set to @code{0}.
  7108. @item weight_Y
  7109. Set the frequency domain weight expression for the luma plane.
  7110. @item weight_U
  7111. Set the frequency domain weight expression for the 1st chroma plane.
  7112. @item weight_V
  7113. Set the frequency domain weight expression for the 2nd chroma plane.
  7114. @item eval
  7115. Set when the expressions are evaluated.
  7116. It accepts the following values:
  7117. @table @samp
  7118. @item init
  7119. Only evaluate expressions once during the filter initialization.
  7120. @item frame
  7121. Evaluate expressions for each incoming frame.
  7122. @end table
  7123. Default value is @samp{init}.
  7124. The filter accepts the following variables:
  7125. @item X
  7126. @item Y
  7127. The coordinates of the current sample.
  7128. @item W
  7129. @item H
  7130. The width and height of the image.
  7131. @item N
  7132. The number of input frame, starting from 0.
  7133. @end table
  7134. @subsection Examples
  7135. @itemize
  7136. @item
  7137. High-pass:
  7138. @example
  7139. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7140. @end example
  7141. @item
  7142. Low-pass:
  7143. @example
  7144. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7145. @end example
  7146. @item
  7147. Sharpen:
  7148. @example
  7149. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7150. @end example
  7151. @item
  7152. Blur:
  7153. @example
  7154. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7155. @end example
  7156. @end itemize
  7157. @section fftdnoiz
  7158. Denoise frames using 3D FFT (frequency domain filtering).
  7159. The filter accepts the following options:
  7160. @table @option
  7161. @item sigma
  7162. Set the noise sigma constant. This sets denoising strength.
  7163. Default value is 1. Allowed range is from 0 to 30.
  7164. Using very high sigma with low overlap may give blocking artifacts.
  7165. @item amount
  7166. Set amount of denoising. By default all detected noise is reduced.
  7167. Default value is 1. Allowed range is from 0 to 1.
  7168. @item block
  7169. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7170. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7171. block size in pixels is 2^4 which is 16.
  7172. @item overlap
  7173. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7174. @item prev
  7175. Set number of previous frames to use for denoising. By default is set to 0.
  7176. @item next
  7177. Set number of next frames to to use for denoising. By default is set to 0.
  7178. @item planes
  7179. Set planes which will be filtered, by default are all available filtered
  7180. except alpha.
  7181. @end table
  7182. @section field
  7183. Extract a single field from an interlaced image using stride
  7184. arithmetic to avoid wasting CPU time. The output frames are marked as
  7185. non-interlaced.
  7186. The filter accepts the following options:
  7187. @table @option
  7188. @item type
  7189. Specify whether to extract the top (if the value is @code{0} or
  7190. @code{top}) or the bottom field (if the value is @code{1} or
  7191. @code{bottom}).
  7192. @end table
  7193. @section fieldhint
  7194. Create new frames by copying the top and bottom fields from surrounding frames
  7195. supplied as numbers by the hint file.
  7196. @table @option
  7197. @item hint
  7198. Set file containing hints: absolute/relative frame numbers.
  7199. There must be one line for each frame in a clip. Each line must contain two
  7200. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7201. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7202. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7203. for @code{relative} mode. First number tells from which frame to pick up top
  7204. field and second number tells from which frame to pick up bottom field.
  7205. If optionally followed by @code{+} output frame will be marked as interlaced,
  7206. else if followed by @code{-} output frame will be marked as progressive, else
  7207. it will be marked same as input frame.
  7208. If line starts with @code{#} or @code{;} that line is skipped.
  7209. @item mode
  7210. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7211. @end table
  7212. Example of first several lines of @code{hint} file for @code{relative} mode:
  7213. @example
  7214. 0,0 - # first frame
  7215. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7216. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7217. 1,0 -
  7218. 0,0 -
  7219. 0,0 -
  7220. 1,0 -
  7221. 1,0 -
  7222. 1,0 -
  7223. 0,0 -
  7224. 0,0 -
  7225. 1,0 -
  7226. 1,0 -
  7227. 1,0 -
  7228. 0,0 -
  7229. @end example
  7230. @section fieldmatch
  7231. Field matching filter for inverse telecine. It is meant to reconstruct the
  7232. progressive frames from a telecined stream. The filter does not drop duplicated
  7233. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7234. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7235. The separation of the field matching and the decimation is notably motivated by
  7236. the possibility of inserting a de-interlacing filter fallback between the two.
  7237. If the source has mixed telecined and real interlaced content,
  7238. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7239. But these remaining combed frames will be marked as interlaced, and thus can be
  7240. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7241. In addition to the various configuration options, @code{fieldmatch} can take an
  7242. optional second stream, activated through the @option{ppsrc} option. If
  7243. enabled, the frames reconstruction will be based on the fields and frames from
  7244. this second stream. This allows the first input to be pre-processed in order to
  7245. help the various algorithms of the filter, while keeping the output lossless
  7246. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7247. or brightness/contrast adjustments can help.
  7248. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7249. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7250. which @code{fieldmatch} is based on. While the semantic and usage are very
  7251. close, some behaviour and options names can differ.
  7252. The @ref{decimate} filter currently only works for constant frame rate input.
  7253. If your input has mixed telecined (30fps) and progressive content with a lower
  7254. framerate like 24fps use the following filterchain to produce the necessary cfr
  7255. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7256. The filter accepts the following options:
  7257. @table @option
  7258. @item order
  7259. Specify the assumed field order of the input stream. Available values are:
  7260. @table @samp
  7261. @item auto
  7262. Auto detect parity (use FFmpeg's internal parity value).
  7263. @item bff
  7264. Assume bottom field first.
  7265. @item tff
  7266. Assume top field first.
  7267. @end table
  7268. Note that it is sometimes recommended not to trust the parity announced by the
  7269. stream.
  7270. Default value is @var{auto}.
  7271. @item mode
  7272. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7273. sense that it won't risk creating jerkiness due to duplicate frames when
  7274. possible, but if there are bad edits or blended fields it will end up
  7275. outputting combed frames when a good match might actually exist. On the other
  7276. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7277. but will almost always find a good frame if there is one. The other values are
  7278. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7279. jerkiness and creating duplicate frames versus finding good matches in sections
  7280. with bad edits, orphaned fields, blended fields, etc.
  7281. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7282. Available values are:
  7283. @table @samp
  7284. @item pc
  7285. 2-way matching (p/c)
  7286. @item pc_n
  7287. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7288. @item pc_u
  7289. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7290. @item pc_n_ub
  7291. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7292. still combed (p/c + n + u/b)
  7293. @item pcn
  7294. 3-way matching (p/c/n)
  7295. @item pcn_ub
  7296. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7297. detected as combed (p/c/n + u/b)
  7298. @end table
  7299. The parenthesis at the end indicate the matches that would be used for that
  7300. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7301. @var{top}).
  7302. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7303. the slowest.
  7304. Default value is @var{pc_n}.
  7305. @item ppsrc
  7306. Mark the main input stream as a pre-processed input, and enable the secondary
  7307. input stream as the clean source to pick the fields from. See the filter
  7308. introduction for more details. It is similar to the @option{clip2} feature from
  7309. VFM/TFM.
  7310. Default value is @code{0} (disabled).
  7311. @item field
  7312. Set the field to match from. It is recommended to set this to the same value as
  7313. @option{order} unless you experience matching failures with that setting. In
  7314. certain circumstances changing the field that is used to match from can have a
  7315. large impact on matching performance. Available values are:
  7316. @table @samp
  7317. @item auto
  7318. Automatic (same value as @option{order}).
  7319. @item bottom
  7320. Match from the bottom field.
  7321. @item top
  7322. Match from the top field.
  7323. @end table
  7324. Default value is @var{auto}.
  7325. @item mchroma
  7326. Set whether or not chroma is included during the match comparisons. In most
  7327. cases it is recommended to leave this enabled. You should set this to @code{0}
  7328. only if your clip has bad chroma problems such as heavy rainbowing or other
  7329. artifacts. Setting this to @code{0} could also be used to speed things up at
  7330. the cost of some accuracy.
  7331. Default value is @code{1}.
  7332. @item y0
  7333. @item y1
  7334. These define an exclusion band which excludes the lines between @option{y0} and
  7335. @option{y1} from being included in the field matching decision. An exclusion
  7336. band can be used to ignore subtitles, a logo, or other things that may
  7337. interfere with the matching. @option{y0} sets the starting scan line and
  7338. @option{y1} sets the ending line; all lines in between @option{y0} and
  7339. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7340. @option{y0} and @option{y1} to the same value will disable the feature.
  7341. @option{y0} and @option{y1} defaults to @code{0}.
  7342. @item scthresh
  7343. Set the scene change detection threshold as a percentage of maximum change on
  7344. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7345. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7346. @option{scthresh} is @code{[0.0, 100.0]}.
  7347. Default value is @code{12.0}.
  7348. @item combmatch
  7349. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7350. account the combed scores of matches when deciding what match to use as the
  7351. final match. Available values are:
  7352. @table @samp
  7353. @item none
  7354. No final matching based on combed scores.
  7355. @item sc
  7356. Combed scores are only used when a scene change is detected.
  7357. @item full
  7358. Use combed scores all the time.
  7359. @end table
  7360. Default is @var{sc}.
  7361. @item combdbg
  7362. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7363. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7364. Available values are:
  7365. @table @samp
  7366. @item none
  7367. No forced calculation.
  7368. @item pcn
  7369. Force p/c/n calculations.
  7370. @item pcnub
  7371. Force p/c/n/u/b calculations.
  7372. @end table
  7373. Default value is @var{none}.
  7374. @item cthresh
  7375. This is the area combing threshold used for combed frame detection. This
  7376. essentially controls how "strong" or "visible" combing must be to be detected.
  7377. Larger values mean combing must be more visible and smaller values mean combing
  7378. can be less visible or strong and still be detected. Valid settings are from
  7379. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7380. be detected as combed). This is basically a pixel difference value. A good
  7381. range is @code{[8, 12]}.
  7382. Default value is @code{9}.
  7383. @item chroma
  7384. Sets whether or not chroma is considered in the combed frame decision. Only
  7385. disable this if your source has chroma problems (rainbowing, etc.) that are
  7386. causing problems for the combed frame detection with chroma enabled. Actually,
  7387. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7388. where there is chroma only combing in the source.
  7389. Default value is @code{0}.
  7390. @item blockx
  7391. @item blocky
  7392. Respectively set the x-axis and y-axis size of the window used during combed
  7393. frame detection. This has to do with the size of the area in which
  7394. @option{combpel} pixels are required to be detected as combed for a frame to be
  7395. declared combed. See the @option{combpel} parameter description for more info.
  7396. Possible values are any number that is a power of 2 starting at 4 and going up
  7397. to 512.
  7398. Default value is @code{16}.
  7399. @item combpel
  7400. The number of combed pixels inside any of the @option{blocky} by
  7401. @option{blockx} size blocks on the frame for the frame to be detected as
  7402. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7403. setting controls "how much" combing there must be in any localized area (a
  7404. window defined by the @option{blockx} and @option{blocky} settings) on the
  7405. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7406. which point no frames will ever be detected as combed). This setting is known
  7407. as @option{MI} in TFM/VFM vocabulary.
  7408. Default value is @code{80}.
  7409. @end table
  7410. @anchor{p/c/n/u/b meaning}
  7411. @subsection p/c/n/u/b meaning
  7412. @subsubsection p/c/n
  7413. We assume the following telecined stream:
  7414. @example
  7415. Top fields: 1 2 2 3 4
  7416. Bottom fields: 1 2 3 4 4
  7417. @end example
  7418. The numbers correspond to the progressive frame the fields relate to. Here, the
  7419. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7420. When @code{fieldmatch} is configured to run a matching from bottom
  7421. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7422. @example
  7423. Input stream:
  7424. T 1 2 2 3 4
  7425. B 1 2 3 4 4 <-- matching reference
  7426. Matches: c c n n c
  7427. Output stream:
  7428. T 1 2 3 4 4
  7429. B 1 2 3 4 4
  7430. @end example
  7431. As a result of the field matching, we can see that some frames get duplicated.
  7432. To perform a complete inverse telecine, you need to rely on a decimation filter
  7433. after this operation. See for instance the @ref{decimate} filter.
  7434. The same operation now matching from top fields (@option{field}=@var{top})
  7435. looks like this:
  7436. @example
  7437. Input stream:
  7438. T 1 2 2 3 4 <-- matching reference
  7439. B 1 2 3 4 4
  7440. Matches: c c p p c
  7441. Output stream:
  7442. T 1 2 2 3 4
  7443. B 1 2 2 3 4
  7444. @end example
  7445. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7446. basically, they refer to the frame and field of the opposite parity:
  7447. @itemize
  7448. @item @var{p} matches the field of the opposite parity in the previous frame
  7449. @item @var{c} matches the field of the opposite parity in the current frame
  7450. @item @var{n} matches the field of the opposite parity in the next frame
  7451. @end itemize
  7452. @subsubsection u/b
  7453. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7454. from the opposite parity flag. In the following examples, we assume that we are
  7455. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7456. 'x' is placed above and below each matched fields.
  7457. With bottom matching (@option{field}=@var{bottom}):
  7458. @example
  7459. Match: c p n b u
  7460. x x x x x
  7461. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7462. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7463. x x x x x
  7464. Output frames:
  7465. 2 1 2 2 2
  7466. 2 2 2 1 3
  7467. @end example
  7468. With top matching (@option{field}=@var{top}):
  7469. @example
  7470. Match: c p n b u
  7471. x x x x x
  7472. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7473. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7474. x x x x x
  7475. Output frames:
  7476. 2 2 2 1 2
  7477. 2 1 3 2 2
  7478. @end example
  7479. @subsection Examples
  7480. Simple IVTC of a top field first telecined stream:
  7481. @example
  7482. fieldmatch=order=tff:combmatch=none, decimate
  7483. @end example
  7484. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7485. @example
  7486. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7487. @end example
  7488. @section fieldorder
  7489. Transform the field order of the input video.
  7490. It accepts the following parameters:
  7491. @table @option
  7492. @item order
  7493. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7494. for bottom field first.
  7495. @end table
  7496. The default value is @samp{tff}.
  7497. The transformation is done by shifting the picture content up or down
  7498. by one line, and filling the remaining line with appropriate picture content.
  7499. This method is consistent with most broadcast field order converters.
  7500. If the input video is not flagged as being interlaced, or it is already
  7501. flagged as being of the required output field order, then this filter does
  7502. not alter the incoming video.
  7503. It is very useful when converting to or from PAL DV material,
  7504. which is bottom field first.
  7505. For example:
  7506. @example
  7507. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7508. @end example
  7509. @section fifo, afifo
  7510. Buffer input images and send them when they are requested.
  7511. It is mainly useful when auto-inserted by the libavfilter
  7512. framework.
  7513. It does not take parameters.
  7514. @section fillborders
  7515. Fill borders of the input video, without changing video stream dimensions.
  7516. Sometimes video can have garbage at the four edges and you may not want to
  7517. crop video input to keep size multiple of some number.
  7518. This filter accepts the following options:
  7519. @table @option
  7520. @item left
  7521. Number of pixels to fill from left border.
  7522. @item right
  7523. Number of pixels to fill from right border.
  7524. @item top
  7525. Number of pixels to fill from top border.
  7526. @item bottom
  7527. Number of pixels to fill from bottom border.
  7528. @item mode
  7529. Set fill mode.
  7530. It accepts the following values:
  7531. @table @samp
  7532. @item smear
  7533. fill pixels using outermost pixels
  7534. @item mirror
  7535. fill pixels using mirroring
  7536. @item fixed
  7537. fill pixels with constant value
  7538. @end table
  7539. Default is @var{smear}.
  7540. @item color
  7541. Set color for pixels in fixed mode. Default is @var{black}.
  7542. @end table
  7543. @section find_rect
  7544. Find a rectangular object
  7545. It accepts the following options:
  7546. @table @option
  7547. @item object
  7548. Filepath of the object image, needs to be in gray8.
  7549. @item threshold
  7550. Detection threshold, default is 0.5.
  7551. @item mipmaps
  7552. Number of mipmaps, default is 3.
  7553. @item xmin, ymin, xmax, ymax
  7554. Specifies the rectangle in which to search.
  7555. @end table
  7556. @subsection Examples
  7557. @itemize
  7558. @item
  7559. Generate a representative palette of a given video using @command{ffmpeg}:
  7560. @example
  7561. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7562. @end example
  7563. @end itemize
  7564. @section cover_rect
  7565. Cover a rectangular object
  7566. It accepts the following options:
  7567. @table @option
  7568. @item cover
  7569. Filepath of the optional cover image, needs to be in yuv420.
  7570. @item mode
  7571. Set covering mode.
  7572. It accepts the following values:
  7573. @table @samp
  7574. @item cover
  7575. cover it by the supplied image
  7576. @item blur
  7577. cover it by interpolating the surrounding pixels
  7578. @end table
  7579. Default value is @var{blur}.
  7580. @end table
  7581. @subsection Examples
  7582. @itemize
  7583. @item
  7584. Generate a representative palette of a given video using @command{ffmpeg}:
  7585. @example
  7586. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7587. @end example
  7588. @end itemize
  7589. @section floodfill
  7590. Flood area with values of same pixel components with another values.
  7591. It accepts the following options:
  7592. @table @option
  7593. @item x
  7594. Set pixel x coordinate.
  7595. @item y
  7596. Set pixel y coordinate.
  7597. @item s0
  7598. Set source #0 component value.
  7599. @item s1
  7600. Set source #1 component value.
  7601. @item s2
  7602. Set source #2 component value.
  7603. @item s3
  7604. Set source #3 component value.
  7605. @item d0
  7606. Set destination #0 component value.
  7607. @item d1
  7608. Set destination #1 component value.
  7609. @item d2
  7610. Set destination #2 component value.
  7611. @item d3
  7612. Set destination #3 component value.
  7613. @end table
  7614. @anchor{format}
  7615. @section format
  7616. Convert the input video to one of the specified pixel formats.
  7617. Libavfilter will try to pick one that is suitable as input to
  7618. the next filter.
  7619. It accepts the following parameters:
  7620. @table @option
  7621. @item pix_fmts
  7622. A '|'-separated list of pixel format names, such as
  7623. "pix_fmts=yuv420p|monow|rgb24".
  7624. @end table
  7625. @subsection Examples
  7626. @itemize
  7627. @item
  7628. Convert the input video to the @var{yuv420p} format
  7629. @example
  7630. format=pix_fmts=yuv420p
  7631. @end example
  7632. Convert the input video to any of the formats in the list
  7633. @example
  7634. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7635. @end example
  7636. @end itemize
  7637. @anchor{fps}
  7638. @section fps
  7639. Convert the video to specified constant frame rate by duplicating or dropping
  7640. frames as necessary.
  7641. It accepts the following parameters:
  7642. @table @option
  7643. @item fps
  7644. The desired output frame rate. The default is @code{25}.
  7645. @item start_time
  7646. Assume the first PTS should be the given value, in seconds. This allows for
  7647. padding/trimming at the start of stream. By default, no assumption is made
  7648. about the first frame's expected PTS, so no padding or trimming is done.
  7649. For example, this could be set to 0 to pad the beginning with duplicates of
  7650. the first frame if a video stream starts after the audio stream or to trim any
  7651. frames with a negative PTS.
  7652. @item round
  7653. Timestamp (PTS) rounding method.
  7654. Possible values are:
  7655. @table @option
  7656. @item zero
  7657. round towards 0
  7658. @item inf
  7659. round away from 0
  7660. @item down
  7661. round towards -infinity
  7662. @item up
  7663. round towards +infinity
  7664. @item near
  7665. round to nearest
  7666. @end table
  7667. The default is @code{near}.
  7668. @item eof_action
  7669. Action performed when reading the last frame.
  7670. Possible values are:
  7671. @table @option
  7672. @item round
  7673. Use same timestamp rounding method as used for other frames.
  7674. @item pass
  7675. Pass through last frame if input duration has not been reached yet.
  7676. @end table
  7677. The default is @code{round}.
  7678. @end table
  7679. Alternatively, the options can be specified as a flat string:
  7680. @var{fps}[:@var{start_time}[:@var{round}]].
  7681. See also the @ref{setpts} filter.
  7682. @subsection Examples
  7683. @itemize
  7684. @item
  7685. A typical usage in order to set the fps to 25:
  7686. @example
  7687. fps=fps=25
  7688. @end example
  7689. @item
  7690. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7691. @example
  7692. fps=fps=film:round=near
  7693. @end example
  7694. @end itemize
  7695. @section framepack
  7696. Pack two different video streams into a stereoscopic video, setting proper
  7697. metadata on supported codecs. The two views should have the same size and
  7698. framerate and processing will stop when the shorter video ends. Please note
  7699. that you may conveniently adjust view properties with the @ref{scale} and
  7700. @ref{fps} filters.
  7701. It accepts the following parameters:
  7702. @table @option
  7703. @item format
  7704. The desired packing format. Supported values are:
  7705. @table @option
  7706. @item sbs
  7707. The views are next to each other (default).
  7708. @item tab
  7709. The views are on top of each other.
  7710. @item lines
  7711. The views are packed by line.
  7712. @item columns
  7713. The views are packed by column.
  7714. @item frameseq
  7715. The views are temporally interleaved.
  7716. @end table
  7717. @end table
  7718. Some examples:
  7719. @example
  7720. # Convert left and right views into a frame-sequential video
  7721. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7722. # Convert views into a side-by-side video with the same output resolution as the input
  7723. 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
  7724. @end example
  7725. @section framerate
  7726. Change the frame rate by interpolating new video output frames from the source
  7727. frames.
  7728. This filter is not designed to function correctly with interlaced media. If
  7729. you wish to change the frame rate of interlaced media then you are required
  7730. to deinterlace before this filter and re-interlace after this filter.
  7731. A description of the accepted options follows.
  7732. @table @option
  7733. @item fps
  7734. Specify the output frames per second. This option can also be specified
  7735. as a value alone. The default is @code{50}.
  7736. @item interp_start
  7737. Specify the start of a range where the output frame will be created as a
  7738. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7739. the default is @code{15}.
  7740. @item interp_end
  7741. Specify the end of a range where the output frame will be created as a
  7742. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7743. the default is @code{240}.
  7744. @item scene
  7745. Specify the level at which a scene change is detected as a value between
  7746. 0 and 100 to indicate a new scene; a low value reflects a low
  7747. probability for the current frame to introduce a new scene, while a higher
  7748. value means the current frame is more likely to be one.
  7749. The default is @code{8.2}.
  7750. @item flags
  7751. Specify flags influencing the filter process.
  7752. Available value for @var{flags} is:
  7753. @table @option
  7754. @item scene_change_detect, scd
  7755. Enable scene change detection using the value of the option @var{scene}.
  7756. This flag is enabled by default.
  7757. @end table
  7758. @end table
  7759. @section framestep
  7760. Select one frame every N-th frame.
  7761. This filter accepts the following option:
  7762. @table @option
  7763. @item step
  7764. Select frame after every @code{step} frames.
  7765. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7766. @end table
  7767. @section freezedetect
  7768. Detect frozen video.
  7769. This filter logs a message and sets frame metadata when it detects that the
  7770. input video has no significant change in content during a specified duration.
  7771. Video freeze detection calculates the mean average absolute difference of all
  7772. the components of video frames and compares it to a noise floor.
  7773. The printed times and duration are expressed in seconds. The
  7774. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7775. whose timestamp equals or exceeds the detection duration and it contains the
  7776. timestamp of the first frame of the freeze. The
  7777. @code{lavfi.freezedetect.freeze_duration} and
  7778. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7779. after the freeze.
  7780. The filter accepts the following options:
  7781. @table @option
  7782. @item noise, n
  7783. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7784. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7785. 0.001.
  7786. @item duration, d
  7787. Set freeze duration until notification (default is 2 seconds).
  7788. @end table
  7789. @anchor{frei0r}
  7790. @section frei0r
  7791. Apply a frei0r effect to the input video.
  7792. To enable the compilation of this filter, you need to install the frei0r
  7793. header and configure FFmpeg with @code{--enable-frei0r}.
  7794. It accepts the following parameters:
  7795. @table @option
  7796. @item filter_name
  7797. The name of the frei0r effect to load. If the environment variable
  7798. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7799. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7800. Otherwise, the standard frei0r paths are searched, in this order:
  7801. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7802. @file{/usr/lib/frei0r-1/}.
  7803. @item filter_params
  7804. A '|'-separated list of parameters to pass to the frei0r effect.
  7805. @end table
  7806. A frei0r effect parameter can be a boolean (its value is either
  7807. "y" or "n"), a double, a color (specified as
  7808. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7809. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7810. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7811. a position (specified as @var{X}/@var{Y}, where
  7812. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7813. The number and types of parameters depend on the loaded effect. If an
  7814. effect parameter is not specified, the default value is set.
  7815. @subsection Examples
  7816. @itemize
  7817. @item
  7818. Apply the distort0r effect, setting the first two double parameters:
  7819. @example
  7820. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7821. @end example
  7822. @item
  7823. Apply the colordistance effect, taking a color as the first parameter:
  7824. @example
  7825. frei0r=colordistance:0.2/0.3/0.4
  7826. frei0r=colordistance:violet
  7827. frei0r=colordistance:0x112233
  7828. @end example
  7829. @item
  7830. Apply the perspective effect, specifying the top left and top right image
  7831. positions:
  7832. @example
  7833. frei0r=perspective:0.2/0.2|0.8/0.2
  7834. @end example
  7835. @end itemize
  7836. For more information, see
  7837. @url{http://frei0r.dyne.org}
  7838. @section fspp
  7839. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7840. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7841. processing filter, one of them is performed once per block, not per pixel.
  7842. This allows for much higher speed.
  7843. The filter accepts the following options:
  7844. @table @option
  7845. @item quality
  7846. Set quality. This option defines the number of levels for averaging. It accepts
  7847. an integer in the range 4-5. Default value is @code{4}.
  7848. @item qp
  7849. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7850. If not set, the filter will use the QP from the video stream (if available).
  7851. @item strength
  7852. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7853. more details but also more artifacts, while higher values make the image smoother
  7854. but also blurrier. Default value is @code{0} − PSNR optimal.
  7855. @item use_bframe_qp
  7856. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7857. option may cause flicker since the B-Frames have often larger QP. Default is
  7858. @code{0} (not enabled).
  7859. @end table
  7860. @section gblur
  7861. Apply Gaussian blur filter.
  7862. The filter accepts the following options:
  7863. @table @option
  7864. @item sigma
  7865. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7866. @item steps
  7867. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7868. @item planes
  7869. Set which planes to filter. By default all planes are filtered.
  7870. @item sigmaV
  7871. Set vertical sigma, if negative it will be same as @code{sigma}.
  7872. Default is @code{-1}.
  7873. @end table
  7874. @section geq
  7875. Apply generic equation to each pixel.
  7876. The filter accepts the following options:
  7877. @table @option
  7878. @item lum_expr, lum
  7879. Set the luminance expression.
  7880. @item cb_expr, cb
  7881. Set the chrominance blue expression.
  7882. @item cr_expr, cr
  7883. Set the chrominance red expression.
  7884. @item alpha_expr, a
  7885. Set the alpha expression.
  7886. @item red_expr, r
  7887. Set the red expression.
  7888. @item green_expr, g
  7889. Set the green expression.
  7890. @item blue_expr, b
  7891. Set the blue expression.
  7892. @end table
  7893. The colorspace is selected according to the specified options. If one
  7894. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7895. options is specified, the filter will automatically select a YCbCr
  7896. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7897. @option{blue_expr} options is specified, it will select an RGB
  7898. colorspace.
  7899. If one of the chrominance expression is not defined, it falls back on the other
  7900. one. If no alpha expression is specified it will evaluate to opaque value.
  7901. If none of chrominance expressions are specified, they will evaluate
  7902. to the luminance expression.
  7903. The expressions can use the following variables and functions:
  7904. @table @option
  7905. @item N
  7906. The sequential number of the filtered frame, starting from @code{0}.
  7907. @item X
  7908. @item Y
  7909. The coordinates of the current sample.
  7910. @item W
  7911. @item H
  7912. The width and height of the image.
  7913. @item SW
  7914. @item SH
  7915. Width and height scale depending on the currently filtered plane. It is the
  7916. ratio between the corresponding luma plane number of pixels and the current
  7917. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7918. @code{0.5,0.5} for chroma planes.
  7919. @item T
  7920. Time of the current frame, expressed in seconds.
  7921. @item p(x, y)
  7922. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7923. plane.
  7924. @item lum(x, y)
  7925. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7926. plane.
  7927. @item cb(x, y)
  7928. Return the value of the pixel at location (@var{x},@var{y}) of the
  7929. blue-difference chroma plane. Return 0 if there is no such plane.
  7930. @item cr(x, y)
  7931. Return the value of the pixel at location (@var{x},@var{y}) of the
  7932. red-difference chroma plane. Return 0 if there is no such plane.
  7933. @item r(x, y)
  7934. @item g(x, y)
  7935. @item b(x, y)
  7936. Return the value of the pixel at location (@var{x},@var{y}) of the
  7937. red/green/blue component. Return 0 if there is no such component.
  7938. @item alpha(x, y)
  7939. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7940. plane. Return 0 if there is no such plane.
  7941. @end table
  7942. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7943. automatically clipped to the closer edge.
  7944. @subsection Examples
  7945. @itemize
  7946. @item
  7947. Flip the image horizontally:
  7948. @example
  7949. geq=p(W-X\,Y)
  7950. @end example
  7951. @item
  7952. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7953. wavelength of 100 pixels:
  7954. @example
  7955. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7956. @end example
  7957. @item
  7958. Generate a fancy enigmatic moving light:
  7959. @example
  7960. 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
  7961. @end example
  7962. @item
  7963. Generate a quick emboss effect:
  7964. @example
  7965. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7966. @end example
  7967. @item
  7968. Modify RGB components depending on pixel position:
  7969. @example
  7970. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7971. @end example
  7972. @item
  7973. Create a radial gradient that is the same size as the input (also see
  7974. the @ref{vignette} filter):
  7975. @example
  7976. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7977. @end example
  7978. @end itemize
  7979. @section gradfun
  7980. Fix the banding artifacts that are sometimes introduced into nearly flat
  7981. regions by truncation to 8-bit color depth.
  7982. Interpolate the gradients that should go where the bands are, and
  7983. dither them.
  7984. It is designed for playback only. Do not use it prior to
  7985. lossy compression, because compression tends to lose the dither and
  7986. bring back the bands.
  7987. It accepts the following parameters:
  7988. @table @option
  7989. @item strength
  7990. The maximum amount by which the filter will change any one pixel. This is also
  7991. the threshold for detecting nearly flat regions. Acceptable values range from
  7992. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7993. valid range.
  7994. @item radius
  7995. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7996. gradients, but also prevents the filter from modifying the pixels near detailed
  7997. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7998. values will be clipped to the valid range.
  7999. @end table
  8000. Alternatively, the options can be specified as a flat string:
  8001. @var{strength}[:@var{radius}]
  8002. @subsection Examples
  8003. @itemize
  8004. @item
  8005. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8006. @example
  8007. gradfun=3.5:8
  8008. @end example
  8009. @item
  8010. Specify radius, omitting the strength (which will fall-back to the default
  8011. value):
  8012. @example
  8013. gradfun=radius=8
  8014. @end example
  8015. @end itemize
  8016. @section graphmonitor, agraphmonitor
  8017. Show various filtergraph stats.
  8018. With this filter one can debug complete filtergraph.
  8019. Especially issues with links filling with queued frames.
  8020. The filter accepts the following options:
  8021. @table @option
  8022. @item size, s
  8023. Set video output size. Default is @var{hd720}.
  8024. @item opacity, o
  8025. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8026. @item mode, m
  8027. Set output mode, can be @var{fulll} or @var{compact}.
  8028. In @var{compact} mode only filters with some queued frames have displayed stats.
  8029. @item flags, f
  8030. Set flags which enable which stats are shown in video.
  8031. Available values for flags are:
  8032. @table @samp
  8033. @item queue
  8034. Display number of queued frames in each link.
  8035. @item frame_count_in
  8036. Display number of frames taken from filter.
  8037. @item frame_count_out
  8038. Display number of frames given out from filter.
  8039. @item pts
  8040. Display current filtered frame pts.
  8041. @item time
  8042. Display current filtered frame time.
  8043. @item timebase
  8044. Display time base for filter link.
  8045. @item format
  8046. Display used format for filter link.
  8047. @item size
  8048. Display video size or number of audio channels in case of audio used by filter link.
  8049. @item rate
  8050. Display video frame rate or sample rate in case of audio used by filter link.
  8051. @end table
  8052. @item rate, r
  8053. Set upper limit for video rate of output stream, Default value is @var{25}.
  8054. This guarantee that output video frame rate will not be higher than this value.
  8055. @end table
  8056. @section greyedge
  8057. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8058. and corrects the scene colors accordingly.
  8059. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8060. The filter accepts the following options:
  8061. @table @option
  8062. @item difford
  8063. The order of differentiation to be applied on the scene. Must be chosen in the range
  8064. [0,2] and default value is 1.
  8065. @item minknorm
  8066. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8067. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8068. max value instead of calculating Minkowski distance.
  8069. @item sigma
  8070. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8071. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8072. can't be euqal to 0 if @var{difford} is greater than 0.
  8073. @end table
  8074. @subsection Examples
  8075. @itemize
  8076. @item
  8077. Grey Edge:
  8078. @example
  8079. greyedge=difford=1:minknorm=5:sigma=2
  8080. @end example
  8081. @item
  8082. Max Edge:
  8083. @example
  8084. greyedge=difford=1:minknorm=0:sigma=2
  8085. @end example
  8086. @end itemize
  8087. @anchor{haldclut}
  8088. @section haldclut
  8089. Apply a Hald CLUT to a video stream.
  8090. First input is the video stream to process, and second one is the Hald CLUT.
  8091. The Hald CLUT input can be a simple picture or a complete video stream.
  8092. The filter accepts the following options:
  8093. @table @option
  8094. @item shortest
  8095. Force termination when the shortest input terminates. Default is @code{0}.
  8096. @item repeatlast
  8097. Continue applying the last CLUT after the end of the stream. A value of
  8098. @code{0} disable the filter after the last frame of the CLUT is reached.
  8099. Default is @code{1}.
  8100. @end table
  8101. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8102. filters share the same internals).
  8103. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8104. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8105. @subsection Workflow examples
  8106. @subsubsection Hald CLUT video stream
  8107. Generate an identity Hald CLUT stream altered with various effects:
  8108. @example
  8109. 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
  8110. @end example
  8111. Note: make sure you use a lossless codec.
  8112. Then use it with @code{haldclut} to apply it on some random stream:
  8113. @example
  8114. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8115. @end example
  8116. The Hald CLUT will be applied to the 10 first seconds (duration of
  8117. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8118. to the remaining frames of the @code{mandelbrot} stream.
  8119. @subsubsection Hald CLUT with preview
  8120. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8121. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8122. biggest possible square starting at the top left of the picture. The remaining
  8123. padding pixels (bottom or right) will be ignored. This area can be used to add
  8124. a preview of the Hald CLUT.
  8125. Typically, the following generated Hald CLUT will be supported by the
  8126. @code{haldclut} filter:
  8127. @example
  8128. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8129. pad=iw+320 [padded_clut];
  8130. smptebars=s=320x256, split [a][b];
  8131. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8132. [main][b] overlay=W-320" -frames:v 1 clut.png
  8133. @end example
  8134. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8135. bars are displayed on the right-top, and below the same color bars processed by
  8136. the color changes.
  8137. Then, the effect of this Hald CLUT can be visualized with:
  8138. @example
  8139. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8140. @end example
  8141. @section hflip
  8142. Flip the input video horizontally.
  8143. For example, to horizontally flip the input video with @command{ffmpeg}:
  8144. @example
  8145. ffmpeg -i in.avi -vf "hflip" out.avi
  8146. @end example
  8147. @section histeq
  8148. This filter applies a global color histogram equalization on a
  8149. per-frame basis.
  8150. It can be used to correct video that has a compressed range of pixel
  8151. intensities. The filter redistributes the pixel intensities to
  8152. equalize their distribution across the intensity range. It may be
  8153. viewed as an "automatically adjusting contrast filter". This filter is
  8154. useful only for correcting degraded or poorly captured source
  8155. video.
  8156. The filter accepts the following options:
  8157. @table @option
  8158. @item strength
  8159. Determine the amount of equalization to be applied. As the strength
  8160. is reduced, the distribution of pixel intensities more-and-more
  8161. approaches that of the input frame. The value must be a float number
  8162. in the range [0,1] and defaults to 0.200.
  8163. @item intensity
  8164. Set the maximum intensity that can generated and scale the output
  8165. values appropriately. The strength should be set as desired and then
  8166. the intensity can be limited if needed to avoid washing-out. The value
  8167. must be a float number in the range [0,1] and defaults to 0.210.
  8168. @item antibanding
  8169. Set the antibanding level. If enabled the filter will randomly vary
  8170. the luminance of output pixels by a small amount to avoid banding of
  8171. the histogram. Possible values are @code{none}, @code{weak} or
  8172. @code{strong}. It defaults to @code{none}.
  8173. @end table
  8174. @section histogram
  8175. Compute and draw a color distribution histogram for the input video.
  8176. The computed histogram is a representation of the color component
  8177. distribution in an image.
  8178. Standard histogram displays the color components distribution in an image.
  8179. Displays color graph for each color component. Shows distribution of
  8180. the Y, U, V, A or R, G, B components, depending on input format, in the
  8181. current frame. Below each graph a color component scale meter is shown.
  8182. The filter accepts the following options:
  8183. @table @option
  8184. @item level_height
  8185. Set height of level. Default value is @code{200}.
  8186. Allowed range is [50, 2048].
  8187. @item scale_height
  8188. Set height of color scale. Default value is @code{12}.
  8189. Allowed range is [0, 40].
  8190. @item display_mode
  8191. Set display mode.
  8192. It accepts the following values:
  8193. @table @samp
  8194. @item stack
  8195. Per color component graphs are placed below each other.
  8196. @item parade
  8197. Per color component graphs are placed side by side.
  8198. @item overlay
  8199. Presents information identical to that in the @code{parade}, except
  8200. that the graphs representing color components are superimposed directly
  8201. over one another.
  8202. @end table
  8203. Default is @code{stack}.
  8204. @item levels_mode
  8205. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8206. Default is @code{linear}.
  8207. @item components
  8208. Set what color components to display.
  8209. Default is @code{7}.
  8210. @item fgopacity
  8211. Set foreground opacity. Default is @code{0.7}.
  8212. @item bgopacity
  8213. Set background opacity. Default is @code{0.5}.
  8214. @end table
  8215. @subsection Examples
  8216. @itemize
  8217. @item
  8218. Calculate and draw histogram:
  8219. @example
  8220. ffplay -i input -vf histogram
  8221. @end example
  8222. @end itemize
  8223. @anchor{hqdn3d}
  8224. @section hqdn3d
  8225. This is a high precision/quality 3d denoise filter. It aims to reduce
  8226. image noise, producing smooth images and making still images really
  8227. still. It should enhance compressibility.
  8228. It accepts the following optional parameters:
  8229. @table @option
  8230. @item luma_spatial
  8231. A non-negative floating point number which specifies spatial luma strength.
  8232. It defaults to 4.0.
  8233. @item chroma_spatial
  8234. A non-negative floating point number which specifies spatial chroma strength.
  8235. It defaults to 3.0*@var{luma_spatial}/4.0.
  8236. @item luma_tmp
  8237. A floating point number which specifies luma temporal strength. It defaults to
  8238. 6.0*@var{luma_spatial}/4.0.
  8239. @item chroma_tmp
  8240. A floating point number which specifies chroma temporal strength. It defaults to
  8241. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8242. @end table
  8243. @anchor{hwdownload}
  8244. @section hwdownload
  8245. Download hardware frames to system memory.
  8246. The input must be in hardware frames, and the output a non-hardware format.
  8247. Not all formats will be supported on the output - it may be necessary to insert
  8248. an additional @option{format} filter immediately following in the graph to get
  8249. the output in a supported format.
  8250. @section hwmap
  8251. Map hardware frames to system memory or to another device.
  8252. This filter has several different modes of operation; which one is used depends
  8253. on the input and output formats:
  8254. @itemize
  8255. @item
  8256. Hardware frame input, normal frame output
  8257. Map the input frames to system memory and pass them to the output. If the
  8258. original hardware frame is later required (for example, after overlaying
  8259. something else on part of it), the @option{hwmap} filter can be used again
  8260. in the next mode to retrieve it.
  8261. @item
  8262. Normal frame input, hardware frame output
  8263. If the input is actually a software-mapped hardware frame, then unmap it -
  8264. that is, return the original hardware frame.
  8265. Otherwise, a device must be provided. Create new hardware surfaces on that
  8266. device for the output, then map them back to the software format at the input
  8267. and give those frames to the preceding filter. This will then act like the
  8268. @option{hwupload} filter, but may be able to avoid an additional copy when
  8269. the input is already in a compatible format.
  8270. @item
  8271. Hardware frame input and output
  8272. A device must be supplied for the output, either directly or with the
  8273. @option{derive_device} option. The input and output devices must be of
  8274. different types and compatible - the exact meaning of this is
  8275. system-dependent, but typically it means that they must refer to the same
  8276. underlying hardware context (for example, refer to the same graphics card).
  8277. If the input frames were originally created on the output device, then unmap
  8278. to retrieve the original frames.
  8279. Otherwise, map the frames to the output device - create new hardware frames
  8280. on the output corresponding to the frames on the input.
  8281. @end itemize
  8282. The following additional parameters are accepted:
  8283. @table @option
  8284. @item mode
  8285. Set the frame mapping mode. Some combination of:
  8286. @table @var
  8287. @item read
  8288. The mapped frame should be readable.
  8289. @item write
  8290. The mapped frame should be writeable.
  8291. @item overwrite
  8292. The mapping will always overwrite the entire frame.
  8293. This may improve performance in some cases, as the original contents of the
  8294. frame need not be loaded.
  8295. @item direct
  8296. The mapping must not involve any copying.
  8297. Indirect mappings to copies of frames are created in some cases where either
  8298. direct mapping is not possible or it would have unexpected properties.
  8299. Setting this flag ensures that the mapping is direct and will fail if that is
  8300. not possible.
  8301. @end table
  8302. Defaults to @var{read+write} if not specified.
  8303. @item derive_device @var{type}
  8304. Rather than using the device supplied at initialisation, instead derive a new
  8305. device of type @var{type} from the device the input frames exist on.
  8306. @item reverse
  8307. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8308. and map them back to the source. This may be necessary in some cases where
  8309. a mapping in one direction is required but only the opposite direction is
  8310. supported by the devices being used.
  8311. This option is dangerous - it may break the preceding filter in undefined
  8312. ways if there are any additional constraints on that filter's output.
  8313. Do not use it without fully understanding the implications of its use.
  8314. @end table
  8315. @anchor{hwupload}
  8316. @section hwupload
  8317. Upload system memory frames to hardware surfaces.
  8318. The device to upload to must be supplied when the filter is initialised. If
  8319. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8320. option.
  8321. @anchor{hwupload_cuda}
  8322. @section hwupload_cuda
  8323. Upload system memory frames to a CUDA device.
  8324. It accepts the following optional parameters:
  8325. @table @option
  8326. @item device
  8327. The number of the CUDA device to use
  8328. @end table
  8329. @section hqx
  8330. Apply a high-quality magnification filter designed for pixel art. This filter
  8331. was originally created by Maxim Stepin.
  8332. It accepts the following option:
  8333. @table @option
  8334. @item n
  8335. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8336. @code{hq3x} and @code{4} for @code{hq4x}.
  8337. Default is @code{3}.
  8338. @end table
  8339. @section hstack
  8340. Stack input videos horizontally.
  8341. All streams must be of same pixel format and of same height.
  8342. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8343. to create same output.
  8344. The filter accept the following option:
  8345. @table @option
  8346. @item inputs
  8347. Set number of input streams. Default is 2.
  8348. @item shortest
  8349. If set to 1, force the output to terminate when the shortest input
  8350. terminates. Default value is 0.
  8351. @end table
  8352. @section hue
  8353. Modify the hue and/or the saturation of the input.
  8354. It accepts the following parameters:
  8355. @table @option
  8356. @item h
  8357. Specify the hue angle as a number of degrees. It accepts an expression,
  8358. and defaults to "0".
  8359. @item s
  8360. Specify the saturation in the [-10,10] range. It accepts an expression and
  8361. defaults to "1".
  8362. @item H
  8363. Specify the hue angle as a number of radians. It accepts an
  8364. expression, and defaults to "0".
  8365. @item b
  8366. Specify the brightness in the [-10,10] range. It accepts an expression and
  8367. defaults to "0".
  8368. @end table
  8369. @option{h} and @option{H} are mutually exclusive, and can't be
  8370. specified at the same time.
  8371. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8372. expressions containing the following constants:
  8373. @table @option
  8374. @item n
  8375. frame count of the input frame starting from 0
  8376. @item pts
  8377. presentation timestamp of the input frame expressed in time base units
  8378. @item r
  8379. frame rate of the input video, NAN if the input frame rate is unknown
  8380. @item t
  8381. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8382. @item tb
  8383. time base of the input video
  8384. @end table
  8385. @subsection Examples
  8386. @itemize
  8387. @item
  8388. Set the hue to 90 degrees and the saturation to 1.0:
  8389. @example
  8390. hue=h=90:s=1
  8391. @end example
  8392. @item
  8393. Same command but expressing the hue in radians:
  8394. @example
  8395. hue=H=PI/2:s=1
  8396. @end example
  8397. @item
  8398. Rotate hue and make the saturation swing between 0
  8399. and 2 over a period of 1 second:
  8400. @example
  8401. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8402. @end example
  8403. @item
  8404. Apply a 3 seconds saturation fade-in effect starting at 0:
  8405. @example
  8406. hue="s=min(t/3\,1)"
  8407. @end example
  8408. The general fade-in expression can be written as:
  8409. @example
  8410. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8411. @end example
  8412. @item
  8413. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8414. @example
  8415. hue="s=max(0\, min(1\, (8-t)/3))"
  8416. @end example
  8417. The general fade-out expression can be written as:
  8418. @example
  8419. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8420. @end example
  8421. @end itemize
  8422. @subsection Commands
  8423. This filter supports the following commands:
  8424. @table @option
  8425. @item b
  8426. @item s
  8427. @item h
  8428. @item H
  8429. Modify the hue and/or the saturation and/or brightness of the input video.
  8430. The command accepts the same syntax of the corresponding option.
  8431. If the specified expression is not valid, it is kept at its current
  8432. value.
  8433. @end table
  8434. @section hysteresis
  8435. Grow first stream into second stream by connecting components.
  8436. This makes it possible to build more robust edge masks.
  8437. This filter accepts the following options:
  8438. @table @option
  8439. @item planes
  8440. Set which planes will be processed as bitmap, unprocessed planes will be
  8441. copied from first stream.
  8442. By default value 0xf, all planes will be processed.
  8443. @item threshold
  8444. Set threshold which is used in filtering. If pixel component value is higher than
  8445. this value filter algorithm for connecting components is activated.
  8446. By default value is 0.
  8447. @end table
  8448. @section idet
  8449. Detect video interlacing type.
  8450. This filter tries to detect if the input frames are interlaced, progressive,
  8451. top or bottom field first. It will also try to detect fields that are
  8452. repeated between adjacent frames (a sign of telecine).
  8453. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8454. Multiple frame detection incorporates the classification history of previous frames.
  8455. The filter will log these metadata values:
  8456. @table @option
  8457. @item single.current_frame
  8458. Detected type of current frame using single-frame detection. One of:
  8459. ``tff'' (top field first), ``bff'' (bottom field first),
  8460. ``progressive'', or ``undetermined''
  8461. @item single.tff
  8462. Cumulative number of frames detected as top field first using single-frame detection.
  8463. @item multiple.tff
  8464. Cumulative number of frames detected as top field first using multiple-frame detection.
  8465. @item single.bff
  8466. Cumulative number of frames detected as bottom field first using single-frame detection.
  8467. @item multiple.current_frame
  8468. Detected type of current frame using multiple-frame detection. One of:
  8469. ``tff'' (top field first), ``bff'' (bottom field first),
  8470. ``progressive'', or ``undetermined''
  8471. @item multiple.bff
  8472. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8473. @item single.progressive
  8474. Cumulative number of frames detected as progressive using single-frame detection.
  8475. @item multiple.progressive
  8476. Cumulative number of frames detected as progressive using multiple-frame detection.
  8477. @item single.undetermined
  8478. Cumulative number of frames that could not be classified using single-frame detection.
  8479. @item multiple.undetermined
  8480. Cumulative number of frames that could not be classified using multiple-frame detection.
  8481. @item repeated.current_frame
  8482. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8483. @item repeated.neither
  8484. Cumulative number of frames with no repeated field.
  8485. @item repeated.top
  8486. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8487. @item repeated.bottom
  8488. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8489. @end table
  8490. The filter accepts the following options:
  8491. @table @option
  8492. @item intl_thres
  8493. Set interlacing threshold.
  8494. @item prog_thres
  8495. Set progressive threshold.
  8496. @item rep_thres
  8497. Threshold for repeated field detection.
  8498. @item half_life
  8499. Number of frames after which a given frame's contribution to the
  8500. statistics is halved (i.e., it contributes only 0.5 to its
  8501. classification). The default of 0 means that all frames seen are given
  8502. full weight of 1.0 forever.
  8503. @item analyze_interlaced_flag
  8504. When this is not 0 then idet will use the specified number of frames to determine
  8505. if the interlaced flag is accurate, it will not count undetermined frames.
  8506. If the flag is found to be accurate it will be used without any further
  8507. computations, if it is found to be inaccurate it will be cleared without any
  8508. further computations. This allows inserting the idet filter as a low computational
  8509. method to clean up the interlaced flag
  8510. @end table
  8511. @section il
  8512. Deinterleave or interleave fields.
  8513. This filter allows one to process interlaced images fields without
  8514. deinterlacing them. Deinterleaving splits the input frame into 2
  8515. fields (so called half pictures). Odd lines are moved to the top
  8516. half of the output image, even lines to the bottom half.
  8517. You can process (filter) them independently and then re-interleave them.
  8518. The filter accepts the following options:
  8519. @table @option
  8520. @item luma_mode, l
  8521. @item chroma_mode, c
  8522. @item alpha_mode, a
  8523. Available values for @var{luma_mode}, @var{chroma_mode} and
  8524. @var{alpha_mode} are:
  8525. @table @samp
  8526. @item none
  8527. Do nothing.
  8528. @item deinterleave, d
  8529. Deinterleave fields, placing one above the other.
  8530. @item interleave, i
  8531. Interleave fields. Reverse the effect of deinterleaving.
  8532. @end table
  8533. Default value is @code{none}.
  8534. @item luma_swap, ls
  8535. @item chroma_swap, cs
  8536. @item alpha_swap, as
  8537. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8538. @end table
  8539. @section inflate
  8540. Apply inflate effect to the video.
  8541. This filter replaces the pixel by the local(3x3) average by taking into account
  8542. only values higher than the pixel.
  8543. It accepts the following options:
  8544. @table @option
  8545. @item threshold0
  8546. @item threshold1
  8547. @item threshold2
  8548. @item threshold3
  8549. Limit the maximum change for each plane, default is 65535.
  8550. If 0, plane will remain unchanged.
  8551. @end table
  8552. @section interlace
  8553. Simple interlacing filter from progressive contents. This interleaves upper (or
  8554. lower) lines from odd frames with lower (or upper) lines from even frames,
  8555. halving the frame rate and preserving image height.
  8556. @example
  8557. Original Original New Frame
  8558. Frame 'j' Frame 'j+1' (tff)
  8559. ========== =========== ==================
  8560. Line 0 --------------------> Frame 'j' Line 0
  8561. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8562. Line 2 ---------------------> Frame 'j' Line 2
  8563. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8564. ... ... ...
  8565. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8566. @end example
  8567. It accepts the following optional parameters:
  8568. @table @option
  8569. @item scan
  8570. This determines whether the interlaced frame is taken from the even
  8571. (tff - default) or odd (bff) lines of the progressive frame.
  8572. @item lowpass
  8573. Vertical lowpass filter to avoid twitter interlacing and
  8574. reduce moire patterns.
  8575. @table @samp
  8576. @item 0, off
  8577. Disable vertical lowpass filter
  8578. @item 1, linear
  8579. Enable linear filter (default)
  8580. @item 2, complex
  8581. Enable complex filter. This will slightly less reduce twitter and moire
  8582. but better retain detail and subjective sharpness impression.
  8583. @end table
  8584. @end table
  8585. @section kerndeint
  8586. Deinterlace input video by applying Donald Graft's adaptive kernel
  8587. deinterling. Work on interlaced parts of a video to produce
  8588. progressive frames.
  8589. The description of the accepted parameters follows.
  8590. @table @option
  8591. @item thresh
  8592. Set the threshold which affects the filter's tolerance when
  8593. determining if a pixel line must be processed. It must be an integer
  8594. in the range [0,255] and defaults to 10. A value of 0 will result in
  8595. applying the process on every pixels.
  8596. @item map
  8597. Paint pixels exceeding the threshold value to white if set to 1.
  8598. Default is 0.
  8599. @item order
  8600. Set the fields order. Swap fields if set to 1, leave fields alone if
  8601. 0. Default is 0.
  8602. @item sharp
  8603. Enable additional sharpening if set to 1. Default is 0.
  8604. @item twoway
  8605. Enable twoway sharpening if set to 1. Default is 0.
  8606. @end table
  8607. @subsection Examples
  8608. @itemize
  8609. @item
  8610. Apply default values:
  8611. @example
  8612. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8613. @end example
  8614. @item
  8615. Enable additional sharpening:
  8616. @example
  8617. kerndeint=sharp=1
  8618. @end example
  8619. @item
  8620. Paint processed pixels in white:
  8621. @example
  8622. kerndeint=map=1
  8623. @end example
  8624. @end itemize
  8625. @section lenscorrection
  8626. Correct radial lens distortion
  8627. This filter can be used to correct for radial distortion as can result from the use
  8628. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8629. one can use tools available for example as part of opencv or simply trial-and-error.
  8630. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8631. and extract the k1 and k2 coefficients from the resulting matrix.
  8632. Note that effectively the same filter is available in the open-source tools Krita and
  8633. Digikam from the KDE project.
  8634. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8635. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8636. brightness distribution, so you may want to use both filters together in certain
  8637. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8638. be applied before or after lens correction.
  8639. @subsection Options
  8640. The filter accepts the following options:
  8641. @table @option
  8642. @item cx
  8643. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8644. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8645. width. Default is 0.5.
  8646. @item cy
  8647. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8648. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8649. height. Default is 0.5.
  8650. @item k1
  8651. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8652. no correction. Default is 0.
  8653. @item k2
  8654. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8655. 0 means no correction. Default is 0.
  8656. @end table
  8657. The formula that generates the correction is:
  8658. @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)
  8659. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8660. distances from the focal point in the source and target images, respectively.
  8661. @section lensfun
  8662. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8663. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8664. to apply the lens correction. The filter will load the lensfun database and
  8665. query it to find the corresponding camera and lens entries in the database. As
  8666. long as these entries can be found with the given options, the filter can
  8667. perform corrections on frames. Note that incomplete strings will result in the
  8668. filter choosing the best match with the given options, and the filter will
  8669. output the chosen camera and lens models (logged with level "info"). You must
  8670. provide the make, camera model, and lens model as they are required.
  8671. The filter accepts the following options:
  8672. @table @option
  8673. @item make
  8674. The make of the camera (for example, "Canon"). This option is required.
  8675. @item model
  8676. The model of the camera (for example, "Canon EOS 100D"). This option is
  8677. required.
  8678. @item lens_model
  8679. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8680. option is required.
  8681. @item mode
  8682. The type of correction to apply. The following values are valid options:
  8683. @table @samp
  8684. @item vignetting
  8685. Enables fixing lens vignetting.
  8686. @item geometry
  8687. Enables fixing lens geometry. This is the default.
  8688. @item subpixel
  8689. Enables fixing chromatic aberrations.
  8690. @item vig_geo
  8691. Enables fixing lens vignetting and lens geometry.
  8692. @item vig_subpixel
  8693. Enables fixing lens vignetting and chromatic aberrations.
  8694. @item distortion
  8695. Enables fixing both lens geometry and chromatic aberrations.
  8696. @item all
  8697. Enables all possible corrections.
  8698. @end table
  8699. @item focal_length
  8700. The focal length of the image/video (zoom; expected constant for video). For
  8701. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8702. range should be chosen when using that lens. Default 18.
  8703. @item aperture
  8704. The aperture of the image/video (expected constant for video). Note that
  8705. aperture is only used for vignetting correction. Default 3.5.
  8706. @item focus_distance
  8707. The focus distance of the image/video (expected constant for video). Note that
  8708. focus distance is only used for vignetting and only slightly affects the
  8709. vignetting correction process. If unknown, leave it at the default value (which
  8710. is 1000).
  8711. @item target_geometry
  8712. The target geometry of the output image/video. The following values are valid
  8713. options:
  8714. @table @samp
  8715. @item rectilinear (default)
  8716. @item fisheye
  8717. @item panoramic
  8718. @item equirectangular
  8719. @item fisheye_orthographic
  8720. @item fisheye_stereographic
  8721. @item fisheye_equisolid
  8722. @item fisheye_thoby
  8723. @end table
  8724. @item reverse
  8725. Apply the reverse of image correction (instead of correcting distortion, apply
  8726. it).
  8727. @item interpolation
  8728. The type of interpolation used when correcting distortion. The following values
  8729. are valid options:
  8730. @table @samp
  8731. @item nearest
  8732. @item linear (default)
  8733. @item lanczos
  8734. @end table
  8735. @end table
  8736. @subsection Examples
  8737. @itemize
  8738. @item
  8739. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8740. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8741. aperture of "8.0".
  8742. @example
  8743. 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
  8744. @end example
  8745. @item
  8746. Apply the same as before, but only for the first 5 seconds of video.
  8747. @example
  8748. 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
  8749. @end example
  8750. @end itemize
  8751. @section libvmaf
  8752. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8753. score between two input videos.
  8754. The obtained VMAF score is printed through the logging system.
  8755. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8756. After installing the library it can be enabled using:
  8757. @code{./configure --enable-libvmaf --enable-version3}.
  8758. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8759. The filter has following options:
  8760. @table @option
  8761. @item model_path
  8762. Set the model path which is to be used for SVM.
  8763. Default value: @code{"vmaf_v0.6.1.pkl"}
  8764. @item log_path
  8765. Set the file path to be used to store logs.
  8766. @item log_fmt
  8767. Set the format of the log file (xml or json).
  8768. @item enable_transform
  8769. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8770. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8771. Default value: @code{false}
  8772. @item phone_model
  8773. Invokes the phone model which will generate VMAF scores higher than in the
  8774. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8775. @item psnr
  8776. Enables computing psnr along with vmaf.
  8777. @item ssim
  8778. Enables computing ssim along with vmaf.
  8779. @item ms_ssim
  8780. Enables computing ms_ssim along with vmaf.
  8781. @item pool
  8782. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8783. @item n_threads
  8784. Set number of threads to be used when computing vmaf.
  8785. @item n_subsample
  8786. Set interval for frame subsampling used when computing vmaf.
  8787. @item enable_conf_interval
  8788. Enables confidence interval.
  8789. @end table
  8790. This filter also supports the @ref{framesync} options.
  8791. On the below examples the input file @file{main.mpg} being processed is
  8792. compared with the reference file @file{ref.mpg}.
  8793. @example
  8794. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8795. @end example
  8796. Example with options:
  8797. @example
  8798. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8799. @end example
  8800. @section limiter
  8801. Limits the pixel components values to the specified range [min, max].
  8802. The filter accepts the following options:
  8803. @table @option
  8804. @item min
  8805. Lower bound. Defaults to the lowest allowed value for the input.
  8806. @item max
  8807. Upper bound. Defaults to the highest allowed value for the input.
  8808. @item planes
  8809. Specify which planes will be processed. Defaults to all available.
  8810. @end table
  8811. @section loop
  8812. Loop video frames.
  8813. The filter accepts the following options:
  8814. @table @option
  8815. @item loop
  8816. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8817. Default is 0.
  8818. @item size
  8819. Set maximal size in number of frames. Default is 0.
  8820. @item start
  8821. Set first frame of loop. Default is 0.
  8822. @end table
  8823. @subsection Examples
  8824. @itemize
  8825. @item
  8826. Loop single first frame infinitely:
  8827. @example
  8828. loop=loop=-1:size=1:start=0
  8829. @end example
  8830. @item
  8831. Loop single first frame 10 times:
  8832. @example
  8833. loop=loop=10:size=1:start=0
  8834. @end example
  8835. @item
  8836. Loop 10 first frames 5 times:
  8837. @example
  8838. loop=loop=5:size=10:start=0
  8839. @end example
  8840. @end itemize
  8841. @section lut1d
  8842. Apply a 1D LUT to an input video.
  8843. The filter accepts the following options:
  8844. @table @option
  8845. @item file
  8846. Set the 1D LUT file name.
  8847. Currently supported formats:
  8848. @table @samp
  8849. @item cube
  8850. Iridas
  8851. @end table
  8852. @item interp
  8853. Select interpolation mode.
  8854. Available values are:
  8855. @table @samp
  8856. @item nearest
  8857. Use values from the nearest defined point.
  8858. @item linear
  8859. Interpolate values using the linear interpolation.
  8860. @item cosine
  8861. Interpolate values using the cosine interpolation.
  8862. @item cubic
  8863. Interpolate values using the cubic interpolation.
  8864. @item spline
  8865. Interpolate values using the spline interpolation.
  8866. @end table
  8867. @end table
  8868. @anchor{lut3d}
  8869. @section lut3d
  8870. Apply a 3D LUT to an input video.
  8871. The filter accepts the following options:
  8872. @table @option
  8873. @item file
  8874. Set the 3D LUT file name.
  8875. Currently supported formats:
  8876. @table @samp
  8877. @item 3dl
  8878. AfterEffects
  8879. @item cube
  8880. Iridas
  8881. @item dat
  8882. DaVinci
  8883. @item m3d
  8884. Pandora
  8885. @end table
  8886. @item interp
  8887. Select interpolation mode.
  8888. Available values are:
  8889. @table @samp
  8890. @item nearest
  8891. Use values from the nearest defined point.
  8892. @item trilinear
  8893. Interpolate values using the 8 points defining a cube.
  8894. @item tetrahedral
  8895. Interpolate values using a tetrahedron.
  8896. @end table
  8897. @end table
  8898. This filter also supports the @ref{framesync} options.
  8899. @section lumakey
  8900. Turn certain luma values into transparency.
  8901. The filter accepts the following options:
  8902. @table @option
  8903. @item threshold
  8904. Set the luma which will be used as base for transparency.
  8905. Default value is @code{0}.
  8906. @item tolerance
  8907. Set the range of luma values to be keyed out.
  8908. Default value is @code{0}.
  8909. @item softness
  8910. Set the range of softness. Default value is @code{0}.
  8911. Use this to control gradual transition from zero to full transparency.
  8912. @end table
  8913. @section lut, lutrgb, lutyuv
  8914. Compute a look-up table for binding each pixel component input value
  8915. to an output value, and apply it to the input video.
  8916. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8917. to an RGB input video.
  8918. These filters accept the following parameters:
  8919. @table @option
  8920. @item c0
  8921. set first pixel component expression
  8922. @item c1
  8923. set second pixel component expression
  8924. @item c2
  8925. set third pixel component expression
  8926. @item c3
  8927. set fourth pixel component expression, corresponds to the alpha component
  8928. @item r
  8929. set red component expression
  8930. @item g
  8931. set green component expression
  8932. @item b
  8933. set blue component expression
  8934. @item a
  8935. alpha component expression
  8936. @item y
  8937. set Y/luminance component expression
  8938. @item u
  8939. set U/Cb component expression
  8940. @item v
  8941. set V/Cr component expression
  8942. @end table
  8943. Each of them specifies the expression to use for computing the lookup table for
  8944. the corresponding pixel component values.
  8945. The exact component associated to each of the @var{c*} options depends on the
  8946. format in input.
  8947. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8948. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8949. The expressions can contain the following constants and functions:
  8950. @table @option
  8951. @item w
  8952. @item h
  8953. The input width and height.
  8954. @item val
  8955. The input value for the pixel component.
  8956. @item clipval
  8957. The input value, clipped to the @var{minval}-@var{maxval} range.
  8958. @item maxval
  8959. The maximum value for the pixel component.
  8960. @item minval
  8961. The minimum value for the pixel component.
  8962. @item negval
  8963. The negated value for the pixel component value, clipped to the
  8964. @var{minval}-@var{maxval} range; it corresponds to the expression
  8965. "maxval-clipval+minval".
  8966. @item clip(val)
  8967. The computed value in @var{val}, clipped to the
  8968. @var{minval}-@var{maxval} range.
  8969. @item gammaval(gamma)
  8970. The computed gamma correction value of the pixel component value,
  8971. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8972. expression
  8973. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8974. @end table
  8975. All expressions default to "val".
  8976. @subsection Examples
  8977. @itemize
  8978. @item
  8979. Negate input video:
  8980. @example
  8981. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8982. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8983. @end example
  8984. The above is the same as:
  8985. @example
  8986. lutrgb="r=negval:g=negval:b=negval"
  8987. lutyuv="y=negval:u=negval:v=negval"
  8988. @end example
  8989. @item
  8990. Negate luminance:
  8991. @example
  8992. lutyuv=y=negval
  8993. @end example
  8994. @item
  8995. Remove chroma components, turning the video into a graytone image:
  8996. @example
  8997. lutyuv="u=128:v=128"
  8998. @end example
  8999. @item
  9000. Apply a luma burning effect:
  9001. @example
  9002. lutyuv="y=2*val"
  9003. @end example
  9004. @item
  9005. Remove green and blue components:
  9006. @example
  9007. lutrgb="g=0:b=0"
  9008. @end example
  9009. @item
  9010. Set a constant alpha channel value on input:
  9011. @example
  9012. format=rgba,lutrgb=a="maxval-minval/2"
  9013. @end example
  9014. @item
  9015. Correct luminance gamma by a factor of 0.5:
  9016. @example
  9017. lutyuv=y=gammaval(0.5)
  9018. @end example
  9019. @item
  9020. Discard least significant bits of luma:
  9021. @example
  9022. lutyuv=y='bitand(val, 128+64+32)'
  9023. @end example
  9024. @item
  9025. Technicolor like effect:
  9026. @example
  9027. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9028. @end example
  9029. @end itemize
  9030. @section lut2, tlut2
  9031. The @code{lut2} filter takes two input streams and outputs one
  9032. stream.
  9033. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9034. from one single stream.
  9035. This filter accepts the following parameters:
  9036. @table @option
  9037. @item c0
  9038. set first pixel component expression
  9039. @item c1
  9040. set second pixel component expression
  9041. @item c2
  9042. set third pixel component expression
  9043. @item c3
  9044. set fourth pixel component expression, corresponds to the alpha component
  9045. @item d
  9046. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9047. which means bit depth is automatically picked from first input format.
  9048. @end table
  9049. Each of them specifies the expression to use for computing the lookup table for
  9050. the corresponding pixel component values.
  9051. The exact component associated to each of the @var{c*} options depends on the
  9052. format in inputs.
  9053. The expressions can contain the following constants:
  9054. @table @option
  9055. @item w
  9056. @item h
  9057. The input width and height.
  9058. @item x
  9059. The first input value for the pixel component.
  9060. @item y
  9061. The second input value for the pixel component.
  9062. @item bdx
  9063. The first input video bit depth.
  9064. @item bdy
  9065. The second input video bit depth.
  9066. @end table
  9067. All expressions default to "x".
  9068. @subsection Examples
  9069. @itemize
  9070. @item
  9071. Highlight differences between two RGB video streams:
  9072. @example
  9073. 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)'
  9074. @end example
  9075. @item
  9076. Highlight differences between two YUV video streams:
  9077. @example
  9078. 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)'
  9079. @end example
  9080. @item
  9081. Show max difference between two video streams:
  9082. @example
  9083. 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)))'
  9084. @end example
  9085. @end itemize
  9086. @section maskedclamp
  9087. Clamp the first input stream with the second input and third input stream.
  9088. Returns the value of first stream to be between second input
  9089. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9090. This filter accepts the following options:
  9091. @table @option
  9092. @item undershoot
  9093. Default value is @code{0}.
  9094. @item overshoot
  9095. Default value is @code{0}.
  9096. @item planes
  9097. Set which planes will be processed as bitmap, unprocessed planes will be
  9098. copied from first stream.
  9099. By default value 0xf, all planes will be processed.
  9100. @end table
  9101. @section maskedmerge
  9102. Merge the first input stream with the second input stream using per pixel
  9103. weights in the third input stream.
  9104. A value of 0 in the third stream pixel component means that pixel component
  9105. from first stream is returned unchanged, while maximum value (eg. 255 for
  9106. 8-bit videos) means that pixel component from second stream is returned
  9107. unchanged. Intermediate values define the amount of merging between both
  9108. input stream's pixel components.
  9109. This filter accepts the following options:
  9110. @table @option
  9111. @item planes
  9112. Set which planes will be processed as bitmap, unprocessed planes will be
  9113. copied from first stream.
  9114. By default value 0xf, all planes will be processed.
  9115. @end table
  9116. @section maskfun
  9117. Create mask from input video.
  9118. For example it is useful to create motion masks after @code{tblend} filter.
  9119. This filter accepts the following options:
  9120. @table @option
  9121. @item low
  9122. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9123. @item high
  9124. Set high threshold. Any pixel component higher than this value will be set to max value
  9125. allowed for current pixel format.
  9126. @item planes
  9127. Set planes to filter, by default all available planes are filtered.
  9128. @item fill
  9129. Fill all frame pixels with this value.
  9130. @item sum
  9131. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9132. average, output frame will be completely filled with value set by @var{fill} option.
  9133. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9134. @end table
  9135. @section mcdeint
  9136. Apply motion-compensation deinterlacing.
  9137. It needs one field per frame as input and must thus be used together
  9138. with yadif=1/3 or equivalent.
  9139. This filter accepts the following options:
  9140. @table @option
  9141. @item mode
  9142. Set the deinterlacing mode.
  9143. It accepts one of the following values:
  9144. @table @samp
  9145. @item fast
  9146. @item medium
  9147. @item slow
  9148. use iterative motion estimation
  9149. @item extra_slow
  9150. like @samp{slow}, but use multiple reference frames.
  9151. @end table
  9152. Default value is @samp{fast}.
  9153. @item parity
  9154. Set the picture field parity assumed for the input video. It must be
  9155. one of the following values:
  9156. @table @samp
  9157. @item 0, tff
  9158. assume top field first
  9159. @item 1, bff
  9160. assume bottom field first
  9161. @end table
  9162. Default value is @samp{bff}.
  9163. @item qp
  9164. Set per-block quantization parameter (QP) used by the internal
  9165. encoder.
  9166. Higher values should result in a smoother motion vector field but less
  9167. optimal individual vectors. Default value is 1.
  9168. @end table
  9169. @section mergeplanes
  9170. Merge color channel components from several video streams.
  9171. The filter accepts up to 4 input streams, and merge selected input
  9172. planes to the output video.
  9173. This filter accepts the following options:
  9174. @table @option
  9175. @item mapping
  9176. Set input to output plane mapping. Default is @code{0}.
  9177. The mappings is specified as a bitmap. It should be specified as a
  9178. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9179. mapping for the first plane of the output stream. 'A' sets the number of
  9180. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9181. corresponding input to use (from 0 to 3). The rest of the mappings is
  9182. similar, 'Bb' describes the mapping for the output stream second
  9183. plane, 'Cc' describes the mapping for the output stream third plane and
  9184. 'Dd' describes the mapping for the output stream fourth plane.
  9185. @item format
  9186. Set output pixel format. Default is @code{yuva444p}.
  9187. @end table
  9188. @subsection Examples
  9189. @itemize
  9190. @item
  9191. Merge three gray video streams of same width and height into single video stream:
  9192. @example
  9193. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9194. @end example
  9195. @item
  9196. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9197. @example
  9198. [a0][a1]mergeplanes=0x00010210:yuva444p
  9199. @end example
  9200. @item
  9201. Swap Y and A plane in yuva444p stream:
  9202. @example
  9203. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9204. @end example
  9205. @item
  9206. Swap U and V plane in yuv420p stream:
  9207. @example
  9208. format=yuv420p,mergeplanes=0x000201:yuv420p
  9209. @end example
  9210. @item
  9211. Cast a rgb24 clip to yuv444p:
  9212. @example
  9213. format=rgb24,mergeplanes=0x000102:yuv444p
  9214. @end example
  9215. @end itemize
  9216. @section mestimate
  9217. Estimate and export motion vectors using block matching algorithms.
  9218. Motion vectors are stored in frame side data to be used by other filters.
  9219. This filter accepts the following options:
  9220. @table @option
  9221. @item method
  9222. Specify the motion estimation method. Accepts one of the following values:
  9223. @table @samp
  9224. @item esa
  9225. Exhaustive search algorithm.
  9226. @item tss
  9227. Three step search algorithm.
  9228. @item tdls
  9229. Two dimensional logarithmic search algorithm.
  9230. @item ntss
  9231. New three step search algorithm.
  9232. @item fss
  9233. Four step search algorithm.
  9234. @item ds
  9235. Diamond search algorithm.
  9236. @item hexbs
  9237. Hexagon-based search algorithm.
  9238. @item epzs
  9239. Enhanced predictive zonal search algorithm.
  9240. @item umh
  9241. Uneven multi-hexagon search algorithm.
  9242. @end table
  9243. Default value is @samp{esa}.
  9244. @item mb_size
  9245. Macroblock size. Default @code{16}.
  9246. @item search_param
  9247. Search parameter. Default @code{7}.
  9248. @end table
  9249. @section midequalizer
  9250. Apply Midway Image Equalization effect using two video streams.
  9251. Midway Image Equalization adjusts a pair of images to have the same
  9252. histogram, while maintaining their dynamics as much as possible. It's
  9253. useful for e.g. matching exposures from a pair of stereo cameras.
  9254. This filter has two inputs and one output, which must be of same pixel format, but
  9255. may be of different sizes. The output of filter is first input adjusted with
  9256. midway histogram of both inputs.
  9257. This filter accepts the following option:
  9258. @table @option
  9259. @item planes
  9260. Set which planes to process. Default is @code{15}, which is all available planes.
  9261. @end table
  9262. @section minterpolate
  9263. Convert the video to specified frame rate using motion interpolation.
  9264. This filter accepts the following options:
  9265. @table @option
  9266. @item fps
  9267. 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}.
  9268. @item mi_mode
  9269. Motion interpolation mode. Following values are accepted:
  9270. @table @samp
  9271. @item dup
  9272. Duplicate previous or next frame for interpolating new ones.
  9273. @item blend
  9274. Blend source frames. Interpolated frame is mean of previous and next frames.
  9275. @item mci
  9276. Motion compensated interpolation. Following options are effective when this mode is selected:
  9277. @table @samp
  9278. @item mc_mode
  9279. Motion compensation mode. Following values are accepted:
  9280. @table @samp
  9281. @item obmc
  9282. Overlapped block motion compensation.
  9283. @item aobmc
  9284. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9285. @end table
  9286. Default mode is @samp{obmc}.
  9287. @item me_mode
  9288. Motion estimation mode. Following values are accepted:
  9289. @table @samp
  9290. @item bidir
  9291. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9292. @item bilat
  9293. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9294. @end table
  9295. Default mode is @samp{bilat}.
  9296. @item me
  9297. The algorithm to be used for motion estimation. Following values are accepted:
  9298. @table @samp
  9299. @item esa
  9300. Exhaustive search algorithm.
  9301. @item tss
  9302. Three step search algorithm.
  9303. @item tdls
  9304. Two dimensional logarithmic search algorithm.
  9305. @item ntss
  9306. New three step search algorithm.
  9307. @item fss
  9308. Four step search algorithm.
  9309. @item ds
  9310. Diamond search algorithm.
  9311. @item hexbs
  9312. Hexagon-based search algorithm.
  9313. @item epzs
  9314. Enhanced predictive zonal search algorithm.
  9315. @item umh
  9316. Uneven multi-hexagon search algorithm.
  9317. @end table
  9318. Default algorithm is @samp{epzs}.
  9319. @item mb_size
  9320. Macroblock size. Default @code{16}.
  9321. @item search_param
  9322. Motion estimation search parameter. Default @code{32}.
  9323. @item vsbmc
  9324. 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).
  9325. @end table
  9326. @end table
  9327. @item scd
  9328. 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:
  9329. @table @samp
  9330. @item none
  9331. Disable scene change detection.
  9332. @item fdiff
  9333. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9334. @end table
  9335. Default method is @samp{fdiff}.
  9336. @item scd_threshold
  9337. Scene change detection threshold. Default is @code{5.0}.
  9338. @end table
  9339. @section mix
  9340. Mix several video input streams into one video stream.
  9341. A description of the accepted options follows.
  9342. @table @option
  9343. @item nb_inputs
  9344. The number of inputs. If unspecified, it defaults to 2.
  9345. @item weights
  9346. Specify weight of each input video stream as sequence.
  9347. Each weight is separated by space. If number of weights
  9348. is smaller than number of @var{frames} last specified
  9349. weight will be used for all remaining unset weights.
  9350. @item scale
  9351. Specify scale, if it is set it will be multiplied with sum
  9352. of each weight multiplied with pixel values to give final destination
  9353. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9354. @item duration
  9355. Specify how end of stream is determined.
  9356. @table @samp
  9357. @item longest
  9358. The duration of the longest input. (default)
  9359. @item shortest
  9360. The duration of the shortest input.
  9361. @item first
  9362. The duration of the first input.
  9363. @end table
  9364. @end table
  9365. @section mpdecimate
  9366. Drop frames that do not differ greatly from the previous frame in
  9367. order to reduce frame rate.
  9368. The main use of this filter is for very-low-bitrate encoding
  9369. (e.g. streaming over dialup modem), but it could in theory be used for
  9370. fixing movies that were inverse-telecined incorrectly.
  9371. A description of the accepted options follows.
  9372. @table @option
  9373. @item max
  9374. Set the maximum number of consecutive frames which can be dropped (if
  9375. positive), or the minimum interval between dropped frames (if
  9376. negative). If the value is 0, the frame is dropped disregarding the
  9377. number of previous sequentially dropped frames.
  9378. Default value is 0.
  9379. @item hi
  9380. @item lo
  9381. @item frac
  9382. Set the dropping threshold values.
  9383. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9384. represent actual pixel value differences, so a threshold of 64
  9385. corresponds to 1 unit of difference for each pixel, or the same spread
  9386. out differently over the block.
  9387. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9388. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9389. meaning the whole image) differ by more than a threshold of @option{lo}.
  9390. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9391. 64*5, and default value for @option{frac} is 0.33.
  9392. @end table
  9393. @section negate
  9394. Negate (invert) the input video.
  9395. It accepts the following option:
  9396. @table @option
  9397. @item negate_alpha
  9398. With value 1, it negates the alpha component, if present. Default value is 0.
  9399. @end table
  9400. @anchor{nlmeans}
  9401. @section nlmeans
  9402. Denoise frames using Non-Local Means algorithm.
  9403. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9404. context similarity is defined by comparing their surrounding patches of size
  9405. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9406. around the pixel.
  9407. Note that the research area defines centers for patches, which means some
  9408. patches will be made of pixels outside that research area.
  9409. The filter accepts the following options.
  9410. @table @option
  9411. @item s
  9412. Set denoising strength.
  9413. @item p
  9414. Set patch size.
  9415. @item pc
  9416. Same as @option{p} but for chroma planes.
  9417. The default value is @var{0} and means automatic.
  9418. @item r
  9419. Set research size.
  9420. @item rc
  9421. Same as @option{r} but for chroma planes.
  9422. The default value is @var{0} and means automatic.
  9423. @end table
  9424. @section nnedi
  9425. Deinterlace video using neural network edge directed interpolation.
  9426. This filter accepts the following options:
  9427. @table @option
  9428. @item weights
  9429. Mandatory option, without binary file filter can not work.
  9430. Currently file can be found here:
  9431. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9432. @item deint
  9433. Set which frames to deinterlace, by default it is @code{all}.
  9434. Can be @code{all} or @code{interlaced}.
  9435. @item field
  9436. Set mode of operation.
  9437. Can be one of the following:
  9438. @table @samp
  9439. @item af
  9440. Use frame flags, both fields.
  9441. @item a
  9442. Use frame flags, single field.
  9443. @item t
  9444. Use top field only.
  9445. @item b
  9446. Use bottom field only.
  9447. @item tf
  9448. Use both fields, top first.
  9449. @item bf
  9450. Use both fields, bottom first.
  9451. @end table
  9452. @item planes
  9453. Set which planes to process, by default filter process all frames.
  9454. @item nsize
  9455. Set size of local neighborhood around each pixel, used by the predictor neural
  9456. network.
  9457. Can be one of the following:
  9458. @table @samp
  9459. @item s8x6
  9460. @item s16x6
  9461. @item s32x6
  9462. @item s48x6
  9463. @item s8x4
  9464. @item s16x4
  9465. @item s32x4
  9466. @end table
  9467. @item nns
  9468. Set the number of neurons in predictor neural network.
  9469. Can be one of the following:
  9470. @table @samp
  9471. @item n16
  9472. @item n32
  9473. @item n64
  9474. @item n128
  9475. @item n256
  9476. @end table
  9477. @item qual
  9478. Controls the number of different neural network predictions that are blended
  9479. together to compute the final output value. Can be @code{fast}, default or
  9480. @code{slow}.
  9481. @item etype
  9482. Set which set of weights to use in the predictor.
  9483. Can be one of the following:
  9484. @table @samp
  9485. @item a
  9486. weights trained to minimize absolute error
  9487. @item s
  9488. weights trained to minimize squared error
  9489. @end table
  9490. @item pscrn
  9491. Controls whether or not the prescreener neural network is used to decide
  9492. which pixels should be processed by the predictor neural network and which
  9493. can be handled by simple cubic interpolation.
  9494. The prescreener is trained to know whether cubic interpolation will be
  9495. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9496. The computational complexity of the prescreener nn is much less than that of
  9497. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9498. using the prescreener generally results in much faster processing.
  9499. The prescreener is pretty accurate, so the difference between using it and not
  9500. using it is almost always unnoticeable.
  9501. Can be one of the following:
  9502. @table @samp
  9503. @item none
  9504. @item original
  9505. @item new
  9506. @end table
  9507. Default is @code{new}.
  9508. @item fapprox
  9509. Set various debugging flags.
  9510. @end table
  9511. @section noformat
  9512. Force libavfilter not to use any of the specified pixel formats for the
  9513. input to the next filter.
  9514. It accepts the following parameters:
  9515. @table @option
  9516. @item pix_fmts
  9517. A '|'-separated list of pixel format names, such as
  9518. pix_fmts=yuv420p|monow|rgb24".
  9519. @end table
  9520. @subsection Examples
  9521. @itemize
  9522. @item
  9523. Force libavfilter to use a format different from @var{yuv420p} for the
  9524. input to the vflip filter:
  9525. @example
  9526. noformat=pix_fmts=yuv420p,vflip
  9527. @end example
  9528. @item
  9529. Convert the input video to any of the formats not contained in the list:
  9530. @example
  9531. noformat=yuv420p|yuv444p|yuv410p
  9532. @end example
  9533. @end itemize
  9534. @section noise
  9535. Add noise on video input frame.
  9536. The filter accepts the following options:
  9537. @table @option
  9538. @item all_seed
  9539. @item c0_seed
  9540. @item c1_seed
  9541. @item c2_seed
  9542. @item c3_seed
  9543. Set noise seed for specific pixel component or all pixel components in case
  9544. of @var{all_seed}. Default value is @code{123457}.
  9545. @item all_strength, alls
  9546. @item c0_strength, c0s
  9547. @item c1_strength, c1s
  9548. @item c2_strength, c2s
  9549. @item c3_strength, c3s
  9550. Set noise strength for specific pixel component or all pixel components in case
  9551. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9552. @item all_flags, allf
  9553. @item c0_flags, c0f
  9554. @item c1_flags, c1f
  9555. @item c2_flags, c2f
  9556. @item c3_flags, c3f
  9557. Set pixel component flags or set flags for all components if @var{all_flags}.
  9558. Available values for component flags are:
  9559. @table @samp
  9560. @item a
  9561. averaged temporal noise (smoother)
  9562. @item p
  9563. mix random noise with a (semi)regular pattern
  9564. @item t
  9565. temporal noise (noise pattern changes between frames)
  9566. @item u
  9567. uniform noise (gaussian otherwise)
  9568. @end table
  9569. @end table
  9570. @subsection Examples
  9571. Add temporal and uniform noise to input video:
  9572. @example
  9573. noise=alls=20:allf=t+u
  9574. @end example
  9575. @section normalize
  9576. Normalize RGB video (aka histogram stretching, contrast stretching).
  9577. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9578. For each channel of each frame, the filter computes the input range and maps
  9579. it linearly to the user-specified output range. The output range defaults
  9580. to the full dynamic range from pure black to pure white.
  9581. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9582. changes in brightness) caused when small dark or bright objects enter or leave
  9583. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9584. video camera, and, like a video camera, it may cause a period of over- or
  9585. under-exposure of the video.
  9586. The R,G,B channels can be normalized independently, which may cause some
  9587. color shifting, or linked together as a single channel, which prevents
  9588. color shifting. Linked normalization preserves hue. Independent normalization
  9589. does not, so it can be used to remove some color casts. Independent and linked
  9590. normalization can be combined in any ratio.
  9591. The normalize filter accepts the following options:
  9592. @table @option
  9593. @item blackpt
  9594. @item whitept
  9595. Colors which define the output range. The minimum input value is mapped to
  9596. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9597. The defaults are black and white respectively. Specifying white for
  9598. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9599. normalized video. Shades of grey can be used to reduce the dynamic range
  9600. (contrast). Specifying saturated colors here can create some interesting
  9601. effects.
  9602. @item smoothing
  9603. The number of previous frames to use for temporal smoothing. The input range
  9604. of each channel is smoothed using a rolling average over the current frame
  9605. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9606. smoothing).
  9607. @item independence
  9608. Controls the ratio of independent (color shifting) channel normalization to
  9609. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9610. independent. Defaults to 1.0 (fully independent).
  9611. @item strength
  9612. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9613. expensive no-op. Defaults to 1.0 (full strength).
  9614. @end table
  9615. @subsection Examples
  9616. Stretch video contrast to use the full dynamic range, with no temporal
  9617. smoothing; may flicker depending on the source content:
  9618. @example
  9619. normalize=blackpt=black:whitept=white:smoothing=0
  9620. @end example
  9621. As above, but with 50 frames of temporal smoothing; flicker should be
  9622. reduced, depending on the source content:
  9623. @example
  9624. normalize=blackpt=black:whitept=white:smoothing=50
  9625. @end example
  9626. As above, but with hue-preserving linked channel normalization:
  9627. @example
  9628. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9629. @end example
  9630. As above, but with half strength:
  9631. @example
  9632. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9633. @end example
  9634. Map the darkest input color to red, the brightest input color to cyan:
  9635. @example
  9636. normalize=blackpt=red:whitept=cyan
  9637. @end example
  9638. @section null
  9639. Pass the video source unchanged to the output.
  9640. @section ocr
  9641. Optical Character Recognition
  9642. This filter uses Tesseract for optical character recognition. To enable
  9643. compilation of this filter, you need to configure FFmpeg with
  9644. @code{--enable-libtesseract}.
  9645. It accepts the following options:
  9646. @table @option
  9647. @item datapath
  9648. Set datapath to tesseract data. Default is to use whatever was
  9649. set at installation.
  9650. @item language
  9651. Set language, default is "eng".
  9652. @item whitelist
  9653. Set character whitelist.
  9654. @item blacklist
  9655. Set character blacklist.
  9656. @end table
  9657. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9658. @section ocv
  9659. Apply a video transform using libopencv.
  9660. To enable this filter, install the libopencv library and headers and
  9661. configure FFmpeg with @code{--enable-libopencv}.
  9662. It accepts the following parameters:
  9663. @table @option
  9664. @item filter_name
  9665. The name of the libopencv filter to apply.
  9666. @item filter_params
  9667. The parameters to pass to the libopencv filter. If not specified, the default
  9668. values are assumed.
  9669. @end table
  9670. Refer to the official libopencv documentation for more precise
  9671. information:
  9672. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9673. Several libopencv filters are supported; see the following subsections.
  9674. @anchor{dilate}
  9675. @subsection dilate
  9676. Dilate an image by using a specific structuring element.
  9677. It corresponds to the libopencv function @code{cvDilate}.
  9678. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9679. @var{struct_el} represents a structuring element, and has the syntax:
  9680. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9681. @var{cols} and @var{rows} represent the number of columns and rows of
  9682. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9683. point, and @var{shape} the shape for the structuring element. @var{shape}
  9684. must be "rect", "cross", "ellipse", or "custom".
  9685. If the value for @var{shape} is "custom", it must be followed by a
  9686. string of the form "=@var{filename}". The file with name
  9687. @var{filename} is assumed to represent a binary image, with each
  9688. printable character corresponding to a bright pixel. When a custom
  9689. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9690. or columns and rows of the read file are assumed instead.
  9691. The default value for @var{struct_el} is "3x3+0x0/rect".
  9692. @var{nb_iterations} specifies the number of times the transform is
  9693. applied to the image, and defaults to 1.
  9694. Some examples:
  9695. @example
  9696. # Use the default values
  9697. ocv=dilate
  9698. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9699. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9700. # Read the shape from the file diamond.shape, iterating two times.
  9701. # The file diamond.shape may contain a pattern of characters like this
  9702. # *
  9703. # ***
  9704. # *****
  9705. # ***
  9706. # *
  9707. # The specified columns and rows are ignored
  9708. # but the anchor point coordinates are not
  9709. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9710. @end example
  9711. @subsection erode
  9712. Erode an image by using a specific structuring element.
  9713. It corresponds to the libopencv function @code{cvErode}.
  9714. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9715. with the same syntax and semantics as the @ref{dilate} filter.
  9716. @subsection smooth
  9717. Smooth the input video.
  9718. The filter takes the following parameters:
  9719. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9720. @var{type} is the type of smooth filter to apply, and must be one of
  9721. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9722. or "bilateral". The default value is "gaussian".
  9723. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9724. depend on the smooth type. @var{param1} and
  9725. @var{param2} accept integer positive values or 0. @var{param3} and
  9726. @var{param4} accept floating point values.
  9727. The default value for @var{param1} is 3. The default value for the
  9728. other parameters is 0.
  9729. These parameters correspond to the parameters assigned to the
  9730. libopencv function @code{cvSmooth}.
  9731. @section oscilloscope
  9732. 2D Video Oscilloscope.
  9733. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9734. It accepts the following parameters:
  9735. @table @option
  9736. @item x
  9737. Set scope center x position.
  9738. @item y
  9739. Set scope center y position.
  9740. @item s
  9741. Set scope size, relative to frame diagonal.
  9742. @item t
  9743. Set scope tilt/rotation.
  9744. @item o
  9745. Set trace opacity.
  9746. @item tx
  9747. Set trace center x position.
  9748. @item ty
  9749. Set trace center y position.
  9750. @item tw
  9751. Set trace width, relative to width of frame.
  9752. @item th
  9753. Set trace height, relative to height of frame.
  9754. @item c
  9755. Set which components to trace. By default it traces first three components.
  9756. @item g
  9757. Draw trace grid. By default is enabled.
  9758. @item st
  9759. Draw some statistics. By default is enabled.
  9760. @item sc
  9761. Draw scope. By default is enabled.
  9762. @end table
  9763. @subsection Examples
  9764. @itemize
  9765. @item
  9766. Inspect full first row of video frame.
  9767. @example
  9768. oscilloscope=x=0.5:y=0:s=1
  9769. @end example
  9770. @item
  9771. Inspect full last row of video frame.
  9772. @example
  9773. oscilloscope=x=0.5:y=1:s=1
  9774. @end example
  9775. @item
  9776. Inspect full 5th line of video frame of height 1080.
  9777. @example
  9778. oscilloscope=x=0.5:y=5/1080:s=1
  9779. @end example
  9780. @item
  9781. Inspect full last column of video frame.
  9782. @example
  9783. oscilloscope=x=1:y=0.5:s=1:t=1
  9784. @end example
  9785. @end itemize
  9786. @anchor{overlay}
  9787. @section overlay
  9788. Overlay one video on top of another.
  9789. It takes two inputs and has one output. The first input is the "main"
  9790. video on which the second input is overlaid.
  9791. It accepts the following parameters:
  9792. A description of the accepted options follows.
  9793. @table @option
  9794. @item x
  9795. @item y
  9796. Set the expression for the x and y coordinates of the overlaid video
  9797. on the main video. Default value is "0" for both expressions. In case
  9798. the expression is invalid, it is set to a huge value (meaning that the
  9799. overlay will not be displayed within the output visible area).
  9800. @item eof_action
  9801. See @ref{framesync}.
  9802. @item eval
  9803. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9804. It accepts the following values:
  9805. @table @samp
  9806. @item init
  9807. only evaluate expressions once during the filter initialization or
  9808. when a command is processed
  9809. @item frame
  9810. evaluate expressions for each incoming frame
  9811. @end table
  9812. Default value is @samp{frame}.
  9813. @item shortest
  9814. See @ref{framesync}.
  9815. @item format
  9816. Set the format for the output video.
  9817. It accepts the following values:
  9818. @table @samp
  9819. @item yuv420
  9820. force YUV420 output
  9821. @item yuv422
  9822. force YUV422 output
  9823. @item yuv444
  9824. force YUV444 output
  9825. @item rgb
  9826. force packed RGB output
  9827. @item gbrp
  9828. force planar RGB output
  9829. @item auto
  9830. automatically pick format
  9831. @end table
  9832. Default value is @samp{yuv420}.
  9833. @item repeatlast
  9834. See @ref{framesync}.
  9835. @item alpha
  9836. Set format of alpha of the overlaid video, it can be @var{straight} or
  9837. @var{premultiplied}. Default is @var{straight}.
  9838. @end table
  9839. The @option{x}, and @option{y} expressions can contain the following
  9840. parameters.
  9841. @table @option
  9842. @item main_w, W
  9843. @item main_h, H
  9844. The main input width and height.
  9845. @item overlay_w, w
  9846. @item overlay_h, h
  9847. The overlay input width and height.
  9848. @item x
  9849. @item y
  9850. The computed values for @var{x} and @var{y}. They are evaluated for
  9851. each new frame.
  9852. @item hsub
  9853. @item vsub
  9854. horizontal and vertical chroma subsample values of the output
  9855. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9856. @var{vsub} is 1.
  9857. @item n
  9858. the number of input frame, starting from 0
  9859. @item pos
  9860. the position in the file of the input frame, NAN if unknown
  9861. @item t
  9862. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9863. @end table
  9864. This filter also supports the @ref{framesync} options.
  9865. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9866. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9867. when @option{eval} is set to @samp{init}.
  9868. Be aware that frames are taken from each input video in timestamp
  9869. order, hence, if their initial timestamps differ, it is a good idea
  9870. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9871. have them begin in the same zero timestamp, as the example for
  9872. the @var{movie} filter does.
  9873. You can chain together more overlays but you should test the
  9874. efficiency of such approach.
  9875. @subsection Commands
  9876. This filter supports the following commands:
  9877. @table @option
  9878. @item x
  9879. @item y
  9880. Modify the x and y of the overlay input.
  9881. The command accepts the same syntax of the corresponding option.
  9882. If the specified expression is not valid, it is kept at its current
  9883. value.
  9884. @end table
  9885. @subsection Examples
  9886. @itemize
  9887. @item
  9888. Draw the overlay at 10 pixels from the bottom right corner of the main
  9889. video:
  9890. @example
  9891. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9892. @end example
  9893. Using named options the example above becomes:
  9894. @example
  9895. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9896. @end example
  9897. @item
  9898. Insert a transparent PNG logo in the bottom left corner of the input,
  9899. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9900. @example
  9901. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9902. @end example
  9903. @item
  9904. Insert 2 different transparent PNG logos (second logo on bottom
  9905. right corner) using the @command{ffmpeg} tool:
  9906. @example
  9907. 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
  9908. @end example
  9909. @item
  9910. Add a transparent color layer on top of the main video; @code{WxH}
  9911. must specify the size of the main input to the overlay filter:
  9912. @example
  9913. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9914. @end example
  9915. @item
  9916. Play an original video and a filtered version (here with the deshake
  9917. filter) side by side using the @command{ffplay} tool:
  9918. @example
  9919. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9920. @end example
  9921. The above command is the same as:
  9922. @example
  9923. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9924. @end example
  9925. @item
  9926. Make a sliding overlay appearing from the left to the right top part of the
  9927. screen starting since time 2:
  9928. @example
  9929. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9930. @end example
  9931. @item
  9932. Compose output by putting two input videos side to side:
  9933. @example
  9934. ffmpeg -i left.avi -i right.avi -filter_complex "
  9935. nullsrc=size=200x100 [background];
  9936. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9937. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9938. [background][left] overlay=shortest=1 [background+left];
  9939. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9940. "
  9941. @end example
  9942. @item
  9943. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9944. @example
  9945. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9946. -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]'
  9947. masked.avi
  9948. @end example
  9949. @item
  9950. Chain several overlays in cascade:
  9951. @example
  9952. nullsrc=s=200x200 [bg];
  9953. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9954. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9955. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9956. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9957. [in3] null, [mid2] overlay=100:100 [out0]
  9958. @end example
  9959. @end itemize
  9960. @section owdenoise
  9961. Apply Overcomplete Wavelet denoiser.
  9962. The filter accepts the following options:
  9963. @table @option
  9964. @item depth
  9965. Set depth.
  9966. Larger depth values will denoise lower frequency components more, but
  9967. slow down filtering.
  9968. Must be an int in the range 8-16, default is @code{8}.
  9969. @item luma_strength, ls
  9970. Set luma strength.
  9971. Must be a double value in the range 0-1000, default is @code{1.0}.
  9972. @item chroma_strength, cs
  9973. Set chroma strength.
  9974. Must be a double value in the range 0-1000, default is @code{1.0}.
  9975. @end table
  9976. @anchor{pad}
  9977. @section pad
  9978. Add paddings to the input image, and place the original input at the
  9979. provided @var{x}, @var{y} coordinates.
  9980. It accepts the following parameters:
  9981. @table @option
  9982. @item width, w
  9983. @item height, h
  9984. Specify an expression for the size of the output image with the
  9985. paddings added. If the value for @var{width} or @var{height} is 0, the
  9986. corresponding input size is used for the output.
  9987. The @var{width} expression can reference the value set by the
  9988. @var{height} expression, and vice versa.
  9989. The default value of @var{width} and @var{height} is 0.
  9990. @item x
  9991. @item y
  9992. Specify the offsets to place the input image at within the padded area,
  9993. with respect to the top/left border of the output image.
  9994. The @var{x} expression can reference the value set by the @var{y}
  9995. expression, and vice versa.
  9996. The default value of @var{x} and @var{y} is 0.
  9997. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9998. so the input image is centered on the padded area.
  9999. @item color
  10000. Specify the color of the padded area. For the syntax of this option,
  10001. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10002. manual,ffmpeg-utils}.
  10003. The default value of @var{color} is "black".
  10004. @item eval
  10005. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10006. It accepts the following values:
  10007. @table @samp
  10008. @item init
  10009. Only evaluate expressions once during the filter initialization or when
  10010. a command is processed.
  10011. @item frame
  10012. Evaluate expressions for each incoming frame.
  10013. @end table
  10014. Default value is @samp{init}.
  10015. @item aspect
  10016. Pad to aspect instead to a resolution.
  10017. @end table
  10018. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10019. options are expressions containing the following constants:
  10020. @table @option
  10021. @item in_w
  10022. @item in_h
  10023. The input video width and height.
  10024. @item iw
  10025. @item ih
  10026. These are the same as @var{in_w} and @var{in_h}.
  10027. @item out_w
  10028. @item out_h
  10029. The output width and height (the size of the padded area), as
  10030. specified by the @var{width} and @var{height} expressions.
  10031. @item ow
  10032. @item oh
  10033. These are the same as @var{out_w} and @var{out_h}.
  10034. @item x
  10035. @item y
  10036. The x and y offsets as specified by the @var{x} and @var{y}
  10037. expressions, or NAN if not yet specified.
  10038. @item a
  10039. same as @var{iw} / @var{ih}
  10040. @item sar
  10041. input sample aspect ratio
  10042. @item dar
  10043. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10044. @item hsub
  10045. @item vsub
  10046. The horizontal and vertical chroma subsample values. For example for the
  10047. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10048. @end table
  10049. @subsection Examples
  10050. @itemize
  10051. @item
  10052. Add paddings with the color "violet" to the input video. The output video
  10053. size is 640x480, and the top-left corner of the input video is placed at
  10054. column 0, row 40
  10055. @example
  10056. pad=640:480:0:40:violet
  10057. @end example
  10058. The example above is equivalent to the following command:
  10059. @example
  10060. pad=width=640:height=480:x=0:y=40:color=violet
  10061. @end example
  10062. @item
  10063. Pad the input to get an output with dimensions increased by 3/2,
  10064. and put the input video at the center of the padded area:
  10065. @example
  10066. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10067. @end example
  10068. @item
  10069. Pad the input to get a squared output with size equal to the maximum
  10070. value between the input width and height, and put the input video at
  10071. the center of the padded area:
  10072. @example
  10073. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10074. @end example
  10075. @item
  10076. Pad the input to get a final w/h ratio of 16:9:
  10077. @example
  10078. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10079. @end example
  10080. @item
  10081. In case of anamorphic video, in order to set the output display aspect
  10082. correctly, it is necessary to use @var{sar} in the expression,
  10083. according to the relation:
  10084. @example
  10085. (ih * X / ih) * sar = output_dar
  10086. X = output_dar / sar
  10087. @end example
  10088. Thus the previous example needs to be modified to:
  10089. @example
  10090. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10091. @end example
  10092. @item
  10093. Double the output size and put the input video in the bottom-right
  10094. corner of the output padded area:
  10095. @example
  10096. pad="2*iw:2*ih:ow-iw:oh-ih"
  10097. @end example
  10098. @end itemize
  10099. @anchor{palettegen}
  10100. @section palettegen
  10101. Generate one palette for a whole video stream.
  10102. It accepts the following options:
  10103. @table @option
  10104. @item max_colors
  10105. Set the maximum number of colors to quantize in the palette.
  10106. Note: the palette will still contain 256 colors; the unused palette entries
  10107. will be black.
  10108. @item reserve_transparent
  10109. Create a palette of 255 colors maximum and reserve the last one for
  10110. transparency. Reserving the transparency color is useful for GIF optimization.
  10111. If not set, the maximum of colors in the palette will be 256. You probably want
  10112. to disable this option for a standalone image.
  10113. Set by default.
  10114. @item transparency_color
  10115. Set the color that will be used as background for transparency.
  10116. @item stats_mode
  10117. Set statistics mode.
  10118. It accepts the following values:
  10119. @table @samp
  10120. @item full
  10121. Compute full frame histograms.
  10122. @item diff
  10123. Compute histograms only for the part that differs from previous frame. This
  10124. might be relevant to give more importance to the moving part of your input if
  10125. the background is static.
  10126. @item single
  10127. Compute new histogram for each frame.
  10128. @end table
  10129. Default value is @var{full}.
  10130. @end table
  10131. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10132. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10133. color quantization of the palette. This information is also visible at
  10134. @var{info} logging level.
  10135. @subsection Examples
  10136. @itemize
  10137. @item
  10138. Generate a representative palette of a given video using @command{ffmpeg}:
  10139. @example
  10140. ffmpeg -i input.mkv -vf palettegen palette.png
  10141. @end example
  10142. @end itemize
  10143. @section paletteuse
  10144. Use a palette to downsample an input video stream.
  10145. The filter takes two inputs: one video stream and a palette. The palette must
  10146. be a 256 pixels image.
  10147. It accepts the following options:
  10148. @table @option
  10149. @item dither
  10150. Select dithering mode. Available algorithms are:
  10151. @table @samp
  10152. @item bayer
  10153. Ordered 8x8 bayer dithering (deterministic)
  10154. @item heckbert
  10155. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10156. Note: this dithering is sometimes considered "wrong" and is included as a
  10157. reference.
  10158. @item floyd_steinberg
  10159. Floyd and Steingberg dithering (error diffusion)
  10160. @item sierra2
  10161. Frankie Sierra dithering v2 (error diffusion)
  10162. @item sierra2_4a
  10163. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10164. @end table
  10165. Default is @var{sierra2_4a}.
  10166. @item bayer_scale
  10167. When @var{bayer} dithering is selected, this option defines the scale of the
  10168. pattern (how much the crosshatch pattern is visible). A low value means more
  10169. visible pattern for less banding, and higher value means less visible pattern
  10170. at the cost of more banding.
  10171. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10172. @item diff_mode
  10173. If set, define the zone to process
  10174. @table @samp
  10175. @item rectangle
  10176. Only the changing rectangle will be reprocessed. This is similar to GIF
  10177. cropping/offsetting compression mechanism. This option can be useful for speed
  10178. if only a part of the image is changing, and has use cases such as limiting the
  10179. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10180. moving scene (it leads to more deterministic output if the scene doesn't change
  10181. much, and as a result less moving noise and better GIF compression).
  10182. @end table
  10183. Default is @var{none}.
  10184. @item new
  10185. Take new palette for each output frame.
  10186. @item alpha_threshold
  10187. Sets the alpha threshold for transparency. Alpha values above this threshold
  10188. will be treated as completely opaque, and values below this threshold will be
  10189. treated as completely transparent.
  10190. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10191. @end table
  10192. @subsection Examples
  10193. @itemize
  10194. @item
  10195. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10196. using @command{ffmpeg}:
  10197. @example
  10198. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10199. @end example
  10200. @end itemize
  10201. @section perspective
  10202. Correct perspective of video not recorded perpendicular to the screen.
  10203. A description of the accepted parameters follows.
  10204. @table @option
  10205. @item x0
  10206. @item y0
  10207. @item x1
  10208. @item y1
  10209. @item x2
  10210. @item y2
  10211. @item x3
  10212. @item y3
  10213. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10214. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10215. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10216. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10217. then the corners of the source will be sent to the specified coordinates.
  10218. The expressions can use the following variables:
  10219. @table @option
  10220. @item W
  10221. @item H
  10222. the width and height of video frame.
  10223. @item in
  10224. Input frame count.
  10225. @item on
  10226. Output frame count.
  10227. @end table
  10228. @item interpolation
  10229. Set interpolation for perspective correction.
  10230. It accepts the following values:
  10231. @table @samp
  10232. @item linear
  10233. @item cubic
  10234. @end table
  10235. Default value is @samp{linear}.
  10236. @item sense
  10237. Set interpretation of coordinate options.
  10238. It accepts the following values:
  10239. @table @samp
  10240. @item 0, source
  10241. Send point in the source specified by the given coordinates to
  10242. the corners of the destination.
  10243. @item 1, destination
  10244. Send the corners of the source to the point in the destination specified
  10245. by the given coordinates.
  10246. Default value is @samp{source}.
  10247. @end table
  10248. @item eval
  10249. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10250. It accepts the following values:
  10251. @table @samp
  10252. @item init
  10253. only evaluate expressions once during the filter initialization or
  10254. when a command is processed
  10255. @item frame
  10256. evaluate expressions for each incoming frame
  10257. @end table
  10258. Default value is @samp{init}.
  10259. @end table
  10260. @section phase
  10261. Delay interlaced video by one field time so that the field order changes.
  10262. The intended use is to fix PAL movies that have been captured with the
  10263. opposite field order to the film-to-video transfer.
  10264. A description of the accepted parameters follows.
  10265. @table @option
  10266. @item mode
  10267. Set phase mode.
  10268. It accepts the following values:
  10269. @table @samp
  10270. @item t
  10271. Capture field order top-first, transfer bottom-first.
  10272. Filter will delay the bottom field.
  10273. @item b
  10274. Capture field order bottom-first, transfer top-first.
  10275. Filter will delay the top field.
  10276. @item p
  10277. Capture and transfer with the same field order. This mode only exists
  10278. for the documentation of the other options to refer to, but if you
  10279. actually select it, the filter will faithfully do nothing.
  10280. @item a
  10281. Capture field order determined automatically by field flags, transfer
  10282. opposite.
  10283. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10284. basis using field flags. If no field information is available,
  10285. then this works just like @samp{u}.
  10286. @item u
  10287. Capture unknown or varying, transfer opposite.
  10288. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10289. analyzing the images and selecting the alternative that produces best
  10290. match between the fields.
  10291. @item T
  10292. Capture top-first, transfer unknown or varying.
  10293. Filter selects among @samp{t} and @samp{p} using image analysis.
  10294. @item B
  10295. Capture bottom-first, transfer unknown or varying.
  10296. Filter selects among @samp{b} and @samp{p} using image analysis.
  10297. @item A
  10298. Capture determined by field flags, transfer unknown or varying.
  10299. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10300. image analysis. If no field information is available, then this works just
  10301. like @samp{U}. This is the default mode.
  10302. @item U
  10303. Both capture and transfer unknown or varying.
  10304. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10305. @end table
  10306. @end table
  10307. @section pixdesctest
  10308. Pixel format descriptor test filter, mainly useful for internal
  10309. testing. The output video should be equal to the input video.
  10310. For example:
  10311. @example
  10312. format=monow, pixdesctest
  10313. @end example
  10314. can be used to test the monowhite pixel format descriptor definition.
  10315. @section pixscope
  10316. Display sample values of color channels. Mainly useful for checking color
  10317. and levels. Minimum supported resolution is 640x480.
  10318. The filters accept the following options:
  10319. @table @option
  10320. @item x
  10321. Set scope X position, relative offset on X axis.
  10322. @item y
  10323. Set scope Y position, relative offset on Y axis.
  10324. @item w
  10325. Set scope width.
  10326. @item h
  10327. Set scope height.
  10328. @item o
  10329. Set window opacity. This window also holds statistics about pixel area.
  10330. @item wx
  10331. Set window X position, relative offset on X axis.
  10332. @item wy
  10333. Set window Y position, relative offset on Y axis.
  10334. @end table
  10335. @section pp
  10336. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10337. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10338. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10339. Each subfilter and some options have a short and a long name that can be used
  10340. interchangeably, i.e. dr/dering are the same.
  10341. The filters accept the following options:
  10342. @table @option
  10343. @item subfilters
  10344. Set postprocessing subfilters string.
  10345. @end table
  10346. All subfilters share common options to determine their scope:
  10347. @table @option
  10348. @item a/autoq
  10349. Honor the quality commands for this subfilter.
  10350. @item c/chrom
  10351. Do chrominance filtering, too (default).
  10352. @item y/nochrom
  10353. Do luminance filtering only (no chrominance).
  10354. @item n/noluma
  10355. Do chrominance filtering only (no luminance).
  10356. @end table
  10357. These options can be appended after the subfilter name, separated by a '|'.
  10358. Available subfilters are:
  10359. @table @option
  10360. @item hb/hdeblock[|difference[|flatness]]
  10361. Horizontal deblocking filter
  10362. @table @option
  10363. @item difference
  10364. Difference factor where higher values mean more deblocking (default: @code{32}).
  10365. @item flatness
  10366. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10367. @end table
  10368. @item vb/vdeblock[|difference[|flatness]]
  10369. Vertical deblocking filter
  10370. @table @option
  10371. @item difference
  10372. Difference factor where higher values mean more deblocking (default: @code{32}).
  10373. @item flatness
  10374. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10375. @end table
  10376. @item ha/hadeblock[|difference[|flatness]]
  10377. Accurate horizontal deblocking filter
  10378. @table @option
  10379. @item difference
  10380. Difference factor where higher values mean more deblocking (default: @code{32}).
  10381. @item flatness
  10382. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10383. @end table
  10384. @item va/vadeblock[|difference[|flatness]]
  10385. Accurate vertical deblocking filter
  10386. @table @option
  10387. @item difference
  10388. Difference factor where higher values mean more deblocking (default: @code{32}).
  10389. @item flatness
  10390. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10391. @end table
  10392. @end table
  10393. The horizontal and vertical deblocking filters share the difference and
  10394. flatness values so you cannot set different horizontal and vertical
  10395. thresholds.
  10396. @table @option
  10397. @item h1/x1hdeblock
  10398. Experimental horizontal deblocking filter
  10399. @item v1/x1vdeblock
  10400. Experimental vertical deblocking filter
  10401. @item dr/dering
  10402. Deringing filter
  10403. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10404. @table @option
  10405. @item threshold1
  10406. larger -> stronger filtering
  10407. @item threshold2
  10408. larger -> stronger filtering
  10409. @item threshold3
  10410. larger -> stronger filtering
  10411. @end table
  10412. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10413. @table @option
  10414. @item f/fullyrange
  10415. Stretch luminance to @code{0-255}.
  10416. @end table
  10417. @item lb/linblenddeint
  10418. Linear blend deinterlacing filter that deinterlaces the given block by
  10419. filtering all lines with a @code{(1 2 1)} filter.
  10420. @item li/linipoldeint
  10421. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10422. linearly interpolating every second line.
  10423. @item ci/cubicipoldeint
  10424. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10425. cubically interpolating every second line.
  10426. @item md/mediandeint
  10427. Median deinterlacing filter that deinterlaces the given block by applying a
  10428. median filter to every second line.
  10429. @item fd/ffmpegdeint
  10430. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10431. second line with a @code{(-1 4 2 4 -1)} filter.
  10432. @item l5/lowpass5
  10433. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10434. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10435. @item fq/forceQuant[|quantizer]
  10436. Overrides the quantizer table from the input with the constant quantizer you
  10437. specify.
  10438. @table @option
  10439. @item quantizer
  10440. Quantizer to use
  10441. @end table
  10442. @item de/default
  10443. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10444. @item fa/fast
  10445. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10446. @item ac
  10447. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10448. @end table
  10449. @subsection Examples
  10450. @itemize
  10451. @item
  10452. Apply horizontal and vertical deblocking, deringing and automatic
  10453. brightness/contrast:
  10454. @example
  10455. pp=hb/vb/dr/al
  10456. @end example
  10457. @item
  10458. Apply default filters without brightness/contrast correction:
  10459. @example
  10460. pp=de/-al
  10461. @end example
  10462. @item
  10463. Apply default filters and temporal denoiser:
  10464. @example
  10465. pp=default/tmpnoise|1|2|3
  10466. @end example
  10467. @item
  10468. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10469. automatically depending on available CPU time:
  10470. @example
  10471. pp=hb|y/vb|a
  10472. @end example
  10473. @end itemize
  10474. @section pp7
  10475. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10476. similar to spp = 6 with 7 point DCT, where only the center sample is
  10477. used after IDCT.
  10478. The filter accepts the following options:
  10479. @table @option
  10480. @item qp
  10481. Force a constant quantization parameter. It accepts an integer in range
  10482. 0 to 63. If not set, the filter will use the QP from the video stream
  10483. (if available).
  10484. @item mode
  10485. Set thresholding mode. Available modes are:
  10486. @table @samp
  10487. @item hard
  10488. Set hard thresholding.
  10489. @item soft
  10490. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10491. @item medium
  10492. Set medium thresholding (good results, default).
  10493. @end table
  10494. @end table
  10495. @section premultiply
  10496. Apply alpha premultiply effect to input video stream using first plane
  10497. of second stream as alpha.
  10498. Both streams must have same dimensions and same pixel format.
  10499. The filter accepts the following option:
  10500. @table @option
  10501. @item planes
  10502. Set which planes will be processed, unprocessed planes will be copied.
  10503. By default value 0xf, all planes will be processed.
  10504. @item inplace
  10505. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10506. @end table
  10507. @section prewitt
  10508. Apply prewitt operator to input video stream.
  10509. The filter accepts the following option:
  10510. @table @option
  10511. @item planes
  10512. Set which planes will be processed, unprocessed planes will be copied.
  10513. By default value 0xf, all planes will be processed.
  10514. @item scale
  10515. Set value which will be multiplied with filtered result.
  10516. @item delta
  10517. Set value which will be added to filtered result.
  10518. @end table
  10519. @anchor{program_opencl}
  10520. @section program_opencl
  10521. Filter video using an OpenCL program.
  10522. @table @option
  10523. @item source
  10524. OpenCL program source file.
  10525. @item kernel
  10526. Kernel name in program.
  10527. @item inputs
  10528. Number of inputs to the filter. Defaults to 1.
  10529. @item size, s
  10530. Size of output frames. Defaults to the same as the first input.
  10531. @end table
  10532. The program source file must contain a kernel function with the given name,
  10533. which will be run once for each plane of the output. Each run on a plane
  10534. gets enqueued as a separate 2D global NDRange with one work-item for each
  10535. pixel to be generated. The global ID offset for each work-item is therefore
  10536. the coordinates of a pixel in the destination image.
  10537. The kernel function needs to take the following arguments:
  10538. @itemize
  10539. @item
  10540. Destination image, @var{__write_only image2d_t}.
  10541. This image will become the output; the kernel should write all of it.
  10542. @item
  10543. Frame index, @var{unsigned int}.
  10544. This is a counter starting from zero and increasing by one for each frame.
  10545. @item
  10546. Source images, @var{__read_only image2d_t}.
  10547. These are the most recent images on each input. The kernel may read from
  10548. them to generate the output, but they can't be written to.
  10549. @end itemize
  10550. Example programs:
  10551. @itemize
  10552. @item
  10553. Copy the input to the output (output must be the same size as the input).
  10554. @verbatim
  10555. __kernel void copy(__write_only image2d_t destination,
  10556. unsigned int index,
  10557. __read_only image2d_t source)
  10558. {
  10559. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10560. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10561. float4 value = read_imagef(source, sampler, location);
  10562. write_imagef(destination, location, value);
  10563. }
  10564. @end verbatim
  10565. @item
  10566. Apply a simple transformation, rotating the input by an amount increasing
  10567. with the index counter. Pixel values are linearly interpolated by the
  10568. sampler, and the output need not have the same dimensions as the input.
  10569. @verbatim
  10570. __kernel void rotate_image(__write_only image2d_t dst,
  10571. unsigned int index,
  10572. __read_only image2d_t src)
  10573. {
  10574. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10575. CLK_FILTER_LINEAR);
  10576. float angle = (float)index / 100.0f;
  10577. float2 dst_dim = convert_float2(get_image_dim(dst));
  10578. float2 src_dim = convert_float2(get_image_dim(src));
  10579. float2 dst_cen = dst_dim / 2.0f;
  10580. float2 src_cen = src_dim / 2.0f;
  10581. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10582. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10583. float2 src_pos = {
  10584. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10585. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10586. };
  10587. src_pos = src_pos * src_dim / dst_dim;
  10588. float2 src_loc = src_pos + src_cen;
  10589. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10590. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10591. write_imagef(dst, dst_loc, 0.5f);
  10592. else
  10593. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10594. }
  10595. @end verbatim
  10596. @item
  10597. Blend two inputs together, with the amount of each input used varying
  10598. with the index counter.
  10599. @verbatim
  10600. __kernel void blend_images(__write_only image2d_t dst,
  10601. unsigned int index,
  10602. __read_only image2d_t src1,
  10603. __read_only image2d_t src2)
  10604. {
  10605. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10606. CLK_FILTER_LINEAR);
  10607. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10608. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10609. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10610. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10611. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10612. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10613. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10614. }
  10615. @end verbatim
  10616. @end itemize
  10617. @section pseudocolor
  10618. Alter frame colors in video with pseudocolors.
  10619. This filter accept the following options:
  10620. @table @option
  10621. @item c0
  10622. set pixel first component expression
  10623. @item c1
  10624. set pixel second component expression
  10625. @item c2
  10626. set pixel third component expression
  10627. @item c3
  10628. set pixel fourth component expression, corresponds to the alpha component
  10629. @item i
  10630. set component to use as base for altering colors
  10631. @end table
  10632. Each of them specifies the expression to use for computing the lookup table for
  10633. the corresponding pixel component values.
  10634. The expressions can contain the following constants and functions:
  10635. @table @option
  10636. @item w
  10637. @item h
  10638. The input width and height.
  10639. @item val
  10640. The input value for the pixel component.
  10641. @item ymin, umin, vmin, amin
  10642. The minimum allowed component value.
  10643. @item ymax, umax, vmax, amax
  10644. The maximum allowed component value.
  10645. @end table
  10646. All expressions default to "val".
  10647. @subsection Examples
  10648. @itemize
  10649. @item
  10650. Change too high luma values to gradient:
  10651. @example
  10652. 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'"
  10653. @end example
  10654. @end itemize
  10655. @section psnr
  10656. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10657. Ratio) between two input videos.
  10658. This filter takes in input two input videos, the first input is
  10659. considered the "main" source and is passed unchanged to the
  10660. output. The second input is used as a "reference" video for computing
  10661. the PSNR.
  10662. Both video inputs must have the same resolution and pixel format for
  10663. this filter to work correctly. Also it assumes that both inputs
  10664. have the same number of frames, which are compared one by one.
  10665. The obtained average PSNR is printed through the logging system.
  10666. The filter stores the accumulated MSE (mean squared error) of each
  10667. frame, and at the end of the processing it is averaged across all frames
  10668. equally, and the following formula is applied to obtain the PSNR:
  10669. @example
  10670. PSNR = 10*log10(MAX^2/MSE)
  10671. @end example
  10672. Where MAX is the average of the maximum values of each component of the
  10673. image.
  10674. The description of the accepted parameters follows.
  10675. @table @option
  10676. @item stats_file, f
  10677. If specified the filter will use the named file to save the PSNR of
  10678. each individual frame. When filename equals "-" the data is sent to
  10679. standard output.
  10680. @item stats_version
  10681. Specifies which version of the stats file format to use. Details of
  10682. each format are written below.
  10683. Default value is 1.
  10684. @item stats_add_max
  10685. Determines whether the max value is output to the stats log.
  10686. Default value is 0.
  10687. Requires stats_version >= 2. If this is set and stats_version < 2,
  10688. the filter will return an error.
  10689. @end table
  10690. This filter also supports the @ref{framesync} options.
  10691. The file printed if @var{stats_file} is selected, contains a sequence of
  10692. key/value pairs of the form @var{key}:@var{value} for each compared
  10693. couple of frames.
  10694. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10695. the list of per-frame-pair stats, with key value pairs following the frame
  10696. format with the following parameters:
  10697. @table @option
  10698. @item psnr_log_version
  10699. The version of the log file format. Will match @var{stats_version}.
  10700. @item fields
  10701. A comma separated list of the per-frame-pair parameters included in
  10702. the log.
  10703. @end table
  10704. A description of each shown per-frame-pair parameter follows:
  10705. @table @option
  10706. @item n
  10707. sequential number of the input frame, starting from 1
  10708. @item mse_avg
  10709. Mean Square Error pixel-by-pixel average difference of the compared
  10710. frames, averaged over all the image components.
  10711. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10712. Mean Square Error pixel-by-pixel average difference of the compared
  10713. frames for the component specified by the suffix.
  10714. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10715. Peak Signal to Noise ratio of the compared frames for the component
  10716. specified by the suffix.
  10717. @item max_avg, max_y, max_u, max_v
  10718. Maximum allowed value for each channel, and average over all
  10719. channels.
  10720. @end table
  10721. For example:
  10722. @example
  10723. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10724. [main][ref] psnr="stats_file=stats.log" [out]
  10725. @end example
  10726. On this example the input file being processed is compared with the
  10727. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10728. is stored in @file{stats.log}.
  10729. @anchor{pullup}
  10730. @section pullup
  10731. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10732. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10733. content.
  10734. The pullup filter is designed to take advantage of future context in making
  10735. its decisions. This filter is stateless in the sense that it does not lock
  10736. onto a pattern to follow, but it instead looks forward to the following
  10737. fields in order to identify matches and rebuild progressive frames.
  10738. To produce content with an even framerate, insert the fps filter after
  10739. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10740. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10741. The filter accepts the following options:
  10742. @table @option
  10743. @item jl
  10744. @item jr
  10745. @item jt
  10746. @item jb
  10747. These options set the amount of "junk" to ignore at the left, right, top, and
  10748. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10749. while top and bottom are in units of 2 lines.
  10750. The default is 8 pixels on each side.
  10751. @item sb
  10752. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10753. filter generating an occasional mismatched frame, but it may also cause an
  10754. excessive number of frames to be dropped during high motion sequences.
  10755. Conversely, setting it to -1 will make filter match fields more easily.
  10756. This may help processing of video where there is slight blurring between
  10757. the fields, but may also cause there to be interlaced frames in the output.
  10758. Default value is @code{0}.
  10759. @item mp
  10760. Set the metric plane to use. It accepts the following values:
  10761. @table @samp
  10762. @item l
  10763. Use luma plane.
  10764. @item u
  10765. Use chroma blue plane.
  10766. @item v
  10767. Use chroma red plane.
  10768. @end table
  10769. This option may be set to use chroma plane instead of the default luma plane
  10770. for doing filter's computations. This may improve accuracy on very clean
  10771. source material, but more likely will decrease accuracy, especially if there
  10772. is chroma noise (rainbow effect) or any grayscale video.
  10773. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10774. load and make pullup usable in realtime on slow machines.
  10775. @end table
  10776. For best results (without duplicated frames in the output file) it is
  10777. necessary to change the output frame rate. For example, to inverse
  10778. telecine NTSC input:
  10779. @example
  10780. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10781. @end example
  10782. @section qp
  10783. Change video quantization parameters (QP).
  10784. The filter accepts the following option:
  10785. @table @option
  10786. @item qp
  10787. Set expression for quantization parameter.
  10788. @end table
  10789. The expression is evaluated through the eval API and can contain, among others,
  10790. the following constants:
  10791. @table @var
  10792. @item known
  10793. 1 if index is not 129, 0 otherwise.
  10794. @item qp
  10795. Sequential index starting from -129 to 128.
  10796. @end table
  10797. @subsection Examples
  10798. @itemize
  10799. @item
  10800. Some equation like:
  10801. @example
  10802. qp=2+2*sin(PI*qp)
  10803. @end example
  10804. @end itemize
  10805. @section random
  10806. Flush video frames from internal cache of frames into a random order.
  10807. No frame is discarded.
  10808. Inspired by @ref{frei0r} nervous filter.
  10809. @table @option
  10810. @item frames
  10811. Set size in number of frames of internal cache, in range from @code{2} to
  10812. @code{512}. Default is @code{30}.
  10813. @item seed
  10814. Set seed for random number generator, must be an integer included between
  10815. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10816. less than @code{0}, the filter will try to use a good random seed on a
  10817. best effort basis.
  10818. @end table
  10819. @section readeia608
  10820. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10821. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10822. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10823. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10824. @table @option
  10825. @item lavfi.readeia608.X.cc
  10826. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10827. @item lavfi.readeia608.X.line
  10828. The number of the line on which the EIA-608 data was identified and read.
  10829. @end table
  10830. This filter accepts the following options:
  10831. @table @option
  10832. @item scan_min
  10833. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10834. @item scan_max
  10835. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10836. @item mac
  10837. Set minimal acceptable amplitude change for sync codes detection.
  10838. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10839. @item spw
  10840. Set the ratio of width reserved for sync code detection.
  10841. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10842. @item mhd
  10843. Set the max peaks height difference for sync code detection.
  10844. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10845. @item mpd
  10846. Set max peaks period difference for sync code detection.
  10847. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10848. @item msd
  10849. Set the first two max start code bits differences.
  10850. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10851. @item bhd
  10852. Set the minimum ratio of bits height compared to 3rd start code bit.
  10853. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10854. @item th_w
  10855. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10856. @item th_b
  10857. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10858. @item chp
  10859. Enable checking the parity bit. In the event of a parity error, the filter will output
  10860. @code{0x00} for that character. Default is false.
  10861. @end table
  10862. @subsection Examples
  10863. @itemize
  10864. @item
  10865. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10866. @example
  10867. 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
  10868. @end example
  10869. @end itemize
  10870. @section readvitc
  10871. Read vertical interval timecode (VITC) information from the top lines of a
  10872. video frame.
  10873. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10874. timecode value, if a valid timecode has been detected. Further metadata key
  10875. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10876. timecode data has been found or not.
  10877. This filter accepts the following options:
  10878. @table @option
  10879. @item scan_max
  10880. Set the maximum number of lines to scan for VITC data. If the value is set to
  10881. @code{-1} the full video frame is scanned. Default is @code{45}.
  10882. @item thr_b
  10883. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10884. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10885. @item thr_w
  10886. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10887. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10888. @end table
  10889. @subsection Examples
  10890. @itemize
  10891. @item
  10892. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10893. draw @code{--:--:--:--} as a placeholder:
  10894. @example
  10895. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10896. @end example
  10897. @end itemize
  10898. @section remap
  10899. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10900. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10901. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10902. value for pixel will be used for destination pixel.
  10903. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10904. will have Xmap/Ymap video stream dimensions.
  10905. Xmap and Ymap input video streams are 16bit depth, single channel.
  10906. @section removegrain
  10907. The removegrain filter is a spatial denoiser for progressive video.
  10908. @table @option
  10909. @item m0
  10910. Set mode for the first plane.
  10911. @item m1
  10912. Set mode for the second plane.
  10913. @item m2
  10914. Set mode for the third plane.
  10915. @item m3
  10916. Set mode for the fourth plane.
  10917. @end table
  10918. Range of mode is from 0 to 24. Description of each mode follows:
  10919. @table @var
  10920. @item 0
  10921. Leave input plane unchanged. Default.
  10922. @item 1
  10923. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10924. @item 2
  10925. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10926. @item 3
  10927. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10928. @item 4
  10929. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10930. This is equivalent to a median filter.
  10931. @item 5
  10932. Line-sensitive clipping giving the minimal change.
  10933. @item 6
  10934. Line-sensitive clipping, intermediate.
  10935. @item 7
  10936. Line-sensitive clipping, intermediate.
  10937. @item 8
  10938. Line-sensitive clipping, intermediate.
  10939. @item 9
  10940. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10941. @item 10
  10942. Replaces the target pixel with the closest neighbour.
  10943. @item 11
  10944. [1 2 1] horizontal and vertical kernel blur.
  10945. @item 12
  10946. Same as mode 11.
  10947. @item 13
  10948. Bob mode, interpolates top field from the line where the neighbours
  10949. pixels are the closest.
  10950. @item 14
  10951. Bob mode, interpolates bottom field from the line where the neighbours
  10952. pixels are the closest.
  10953. @item 15
  10954. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10955. interpolation formula.
  10956. @item 16
  10957. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10958. interpolation formula.
  10959. @item 17
  10960. Clips the pixel with the minimum and maximum of respectively the maximum and
  10961. minimum of each pair of opposite neighbour pixels.
  10962. @item 18
  10963. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10964. the current pixel is minimal.
  10965. @item 19
  10966. Replaces the pixel with the average of its 8 neighbours.
  10967. @item 20
  10968. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10969. @item 21
  10970. Clips pixels using the averages of opposite neighbour.
  10971. @item 22
  10972. Same as mode 21 but simpler and faster.
  10973. @item 23
  10974. Small edge and halo removal, but reputed useless.
  10975. @item 24
  10976. Similar as 23.
  10977. @end table
  10978. @section removelogo
  10979. Suppress a TV station logo, using an image file to determine which
  10980. pixels comprise the logo. It works by filling in the pixels that
  10981. comprise the logo with neighboring pixels.
  10982. The filter accepts the following options:
  10983. @table @option
  10984. @item filename, f
  10985. Set the filter bitmap file, which can be any image format supported by
  10986. libavformat. The width and height of the image file must match those of the
  10987. video stream being processed.
  10988. @end table
  10989. Pixels in the provided bitmap image with a value of zero are not
  10990. considered part of the logo, non-zero pixels are considered part of
  10991. the logo. If you use white (255) for the logo and black (0) for the
  10992. rest, you will be safe. For making the filter bitmap, it is
  10993. recommended to take a screen capture of a black frame with the logo
  10994. visible, and then using a threshold filter followed by the erode
  10995. filter once or twice.
  10996. If needed, little splotches can be fixed manually. Remember that if
  10997. logo pixels are not covered, the filter quality will be much
  10998. reduced. Marking too many pixels as part of the logo does not hurt as
  10999. much, but it will increase the amount of blurring needed to cover over
  11000. the image and will destroy more information than necessary, and extra
  11001. pixels will slow things down on a large logo.
  11002. @section repeatfields
  11003. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11004. fields based on its value.
  11005. @section reverse
  11006. Reverse a video clip.
  11007. Warning: This filter requires memory to buffer the entire clip, so trimming
  11008. is suggested.
  11009. @subsection Examples
  11010. @itemize
  11011. @item
  11012. Take the first 5 seconds of a clip, and reverse it.
  11013. @example
  11014. trim=end=5,reverse
  11015. @end example
  11016. @end itemize
  11017. @section rgbashift
  11018. Shift R/G/B/A pixels horizontally and/or vertically.
  11019. The filter accepts the following options:
  11020. @table @option
  11021. @item rh
  11022. Set amount to shift red horizontally.
  11023. @item rv
  11024. Set amount to shift red vertically.
  11025. @item gh
  11026. Set amount to shift green horizontally.
  11027. @item gv
  11028. Set amount to shift green vertically.
  11029. @item bh
  11030. Set amount to shift blue horizontally.
  11031. @item bv
  11032. Set amount to shift blue vertically.
  11033. @item ah
  11034. Set amount to shift alpha horizontally.
  11035. @item av
  11036. Set amount to shift alpha vertically.
  11037. @item edge
  11038. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11039. @end table
  11040. @section roberts
  11041. Apply roberts cross operator to input video stream.
  11042. The filter accepts the following option:
  11043. @table @option
  11044. @item planes
  11045. Set which planes will be processed, unprocessed planes will be copied.
  11046. By default value 0xf, all planes will be processed.
  11047. @item scale
  11048. Set value which will be multiplied with filtered result.
  11049. @item delta
  11050. Set value which will be added to filtered result.
  11051. @end table
  11052. @section rotate
  11053. Rotate video by an arbitrary angle expressed in radians.
  11054. The filter accepts the following options:
  11055. A description of the optional parameters follows.
  11056. @table @option
  11057. @item angle, a
  11058. Set an expression for the angle by which to rotate the input video
  11059. clockwise, expressed as a number of radians. A negative value will
  11060. result in a counter-clockwise rotation. By default it is set to "0".
  11061. This expression is evaluated for each frame.
  11062. @item out_w, ow
  11063. Set the output width expression, default value is "iw".
  11064. This expression is evaluated just once during configuration.
  11065. @item out_h, oh
  11066. Set the output height expression, default value is "ih".
  11067. This expression is evaluated just once during configuration.
  11068. @item bilinear
  11069. Enable bilinear interpolation if set to 1, a value of 0 disables
  11070. it. Default value is 1.
  11071. @item fillcolor, c
  11072. Set the color used to fill the output area not covered by the rotated
  11073. image. For the general syntax of this option, check the
  11074. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11075. If the special value "none" is selected then no
  11076. background is printed (useful for example if the background is never shown).
  11077. Default value is "black".
  11078. @end table
  11079. The expressions for the angle and the output size can contain the
  11080. following constants and functions:
  11081. @table @option
  11082. @item n
  11083. sequential number of the input frame, starting from 0. It is always NAN
  11084. before the first frame is filtered.
  11085. @item t
  11086. time in seconds of the input frame, it is set to 0 when the filter is
  11087. configured. It is always NAN before the first frame is filtered.
  11088. @item hsub
  11089. @item vsub
  11090. horizontal and vertical chroma subsample values. For example for the
  11091. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11092. @item in_w, iw
  11093. @item in_h, ih
  11094. the input video width and height
  11095. @item out_w, ow
  11096. @item out_h, oh
  11097. the output width and height, that is the size of the padded area as
  11098. specified by the @var{width} and @var{height} expressions
  11099. @item rotw(a)
  11100. @item roth(a)
  11101. the minimal width/height required for completely containing the input
  11102. video rotated by @var{a} radians.
  11103. These are only available when computing the @option{out_w} and
  11104. @option{out_h} expressions.
  11105. @end table
  11106. @subsection Examples
  11107. @itemize
  11108. @item
  11109. Rotate the input by PI/6 radians clockwise:
  11110. @example
  11111. rotate=PI/6
  11112. @end example
  11113. @item
  11114. Rotate the input by PI/6 radians counter-clockwise:
  11115. @example
  11116. rotate=-PI/6
  11117. @end example
  11118. @item
  11119. Rotate the input by 45 degrees clockwise:
  11120. @example
  11121. rotate=45*PI/180
  11122. @end example
  11123. @item
  11124. Apply a constant rotation with period T, starting from an angle of PI/3:
  11125. @example
  11126. rotate=PI/3+2*PI*t/T
  11127. @end example
  11128. @item
  11129. Make the input video rotation oscillating with a period of T
  11130. seconds and an amplitude of A radians:
  11131. @example
  11132. rotate=A*sin(2*PI/T*t)
  11133. @end example
  11134. @item
  11135. Rotate the video, output size is chosen so that the whole rotating
  11136. input video is always completely contained in the output:
  11137. @example
  11138. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11139. @end example
  11140. @item
  11141. Rotate the video, reduce the output size so that no background is ever
  11142. shown:
  11143. @example
  11144. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11145. @end example
  11146. @end itemize
  11147. @subsection Commands
  11148. The filter supports the following commands:
  11149. @table @option
  11150. @item a, angle
  11151. Set the angle expression.
  11152. The command accepts the same syntax of the corresponding option.
  11153. If the specified expression is not valid, it is kept at its current
  11154. value.
  11155. @end table
  11156. @section sab
  11157. Apply Shape Adaptive Blur.
  11158. The filter accepts the following options:
  11159. @table @option
  11160. @item luma_radius, lr
  11161. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11162. value is 1.0. A greater value will result in a more blurred image, and
  11163. in slower processing.
  11164. @item luma_pre_filter_radius, lpfr
  11165. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11166. value is 1.0.
  11167. @item luma_strength, ls
  11168. Set luma maximum difference between pixels to still be considered, must
  11169. be a value in the 0.1-100.0 range, default value is 1.0.
  11170. @item chroma_radius, cr
  11171. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11172. greater value will result in a more blurred image, and in slower
  11173. processing.
  11174. @item chroma_pre_filter_radius, cpfr
  11175. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11176. @item chroma_strength, cs
  11177. Set chroma maximum difference between pixels to still be considered,
  11178. must be a value in the -0.9-100.0 range.
  11179. @end table
  11180. Each chroma option value, if not explicitly specified, is set to the
  11181. corresponding luma option value.
  11182. @anchor{scale}
  11183. @section scale
  11184. Scale (resize) the input video, using the libswscale library.
  11185. The scale filter forces the output display aspect ratio to be the same
  11186. of the input, by changing the output sample aspect ratio.
  11187. If the input image format is different from the format requested by
  11188. the next filter, the scale filter will convert the input to the
  11189. requested format.
  11190. @subsection Options
  11191. The filter accepts the following options, or any of the options
  11192. supported by the libswscale scaler.
  11193. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11194. the complete list of scaler options.
  11195. @table @option
  11196. @item width, w
  11197. @item height, h
  11198. Set the output video dimension expression. Default value is the input
  11199. dimension.
  11200. If the @var{width} or @var{w} value is 0, the input width is used for
  11201. the output. If the @var{height} or @var{h} value is 0, the input height
  11202. is used for the output.
  11203. If one and only one of the values is -n with n >= 1, the scale filter
  11204. will use a value that maintains the aspect ratio of the input image,
  11205. calculated from the other specified dimension. After that it will,
  11206. however, make sure that the calculated dimension is divisible by n and
  11207. adjust the value if necessary.
  11208. If both values are -n with n >= 1, the behavior will be identical to
  11209. both values being set to 0 as previously detailed.
  11210. See below for the list of accepted constants for use in the dimension
  11211. expression.
  11212. @item eval
  11213. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11214. @table @samp
  11215. @item init
  11216. Only evaluate expressions once during the filter initialization or when a command is processed.
  11217. @item frame
  11218. Evaluate expressions for each incoming frame.
  11219. @end table
  11220. Default value is @samp{init}.
  11221. @item interl
  11222. Set the interlacing mode. It accepts the following values:
  11223. @table @samp
  11224. @item 1
  11225. Force interlaced aware scaling.
  11226. @item 0
  11227. Do not apply interlaced scaling.
  11228. @item -1
  11229. Select interlaced aware scaling depending on whether the source frames
  11230. are flagged as interlaced or not.
  11231. @end table
  11232. Default value is @samp{0}.
  11233. @item flags
  11234. Set libswscale scaling flags. See
  11235. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11236. complete list of values. If not explicitly specified the filter applies
  11237. the default flags.
  11238. @item param0, param1
  11239. Set libswscale input parameters for scaling algorithms that need them. See
  11240. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11241. complete documentation. If not explicitly specified the filter applies
  11242. empty parameters.
  11243. @item size, s
  11244. Set the video size. For the syntax of this option, check the
  11245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11246. @item in_color_matrix
  11247. @item out_color_matrix
  11248. Set in/output YCbCr color space type.
  11249. This allows the autodetected value to be overridden as well as allows forcing
  11250. a specific value used for the output and encoder.
  11251. If not specified, the color space type depends on the pixel format.
  11252. Possible values:
  11253. @table @samp
  11254. @item auto
  11255. Choose automatically.
  11256. @item bt709
  11257. Format conforming to International Telecommunication Union (ITU)
  11258. Recommendation BT.709.
  11259. @item fcc
  11260. Set color space conforming to the United States Federal Communications
  11261. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11262. @item bt601
  11263. Set color space conforming to:
  11264. @itemize
  11265. @item
  11266. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11267. @item
  11268. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11269. @item
  11270. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11271. @end itemize
  11272. @item smpte240m
  11273. Set color space conforming to SMPTE ST 240:1999.
  11274. @end table
  11275. @item in_range
  11276. @item out_range
  11277. Set in/output YCbCr sample range.
  11278. This allows the autodetected value to be overridden as well as allows forcing
  11279. a specific value used for the output and encoder. If not specified, the
  11280. range depends on the pixel format. Possible values:
  11281. @table @samp
  11282. @item auto/unknown
  11283. Choose automatically.
  11284. @item jpeg/full/pc
  11285. Set full range (0-255 in case of 8-bit luma).
  11286. @item mpeg/limited/tv
  11287. Set "MPEG" range (16-235 in case of 8-bit luma).
  11288. @end table
  11289. @item force_original_aspect_ratio
  11290. Enable decreasing or increasing output video width or height if necessary to
  11291. keep the original aspect ratio. Possible values:
  11292. @table @samp
  11293. @item disable
  11294. Scale the video as specified and disable this feature.
  11295. @item decrease
  11296. The output video dimensions will automatically be decreased if needed.
  11297. @item increase
  11298. The output video dimensions will automatically be increased if needed.
  11299. @end table
  11300. One useful instance of this option is that when you know a specific device's
  11301. maximum allowed resolution, you can use this to limit the output video to
  11302. that, while retaining the aspect ratio. For example, device A allows
  11303. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11304. decrease) and specifying 1280x720 to the command line makes the output
  11305. 1280x533.
  11306. Please note that this is a different thing than specifying -1 for @option{w}
  11307. or @option{h}, you still need to specify the output resolution for this option
  11308. to work.
  11309. @end table
  11310. The values of the @option{w} and @option{h} options are expressions
  11311. containing the following constants:
  11312. @table @var
  11313. @item in_w
  11314. @item in_h
  11315. The input width and height
  11316. @item iw
  11317. @item ih
  11318. These are the same as @var{in_w} and @var{in_h}.
  11319. @item out_w
  11320. @item out_h
  11321. The output (scaled) width and height
  11322. @item ow
  11323. @item oh
  11324. These are the same as @var{out_w} and @var{out_h}
  11325. @item a
  11326. The same as @var{iw} / @var{ih}
  11327. @item sar
  11328. input sample aspect ratio
  11329. @item dar
  11330. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11331. @item hsub
  11332. @item vsub
  11333. horizontal and vertical input chroma subsample values. For example for the
  11334. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11335. @item ohsub
  11336. @item ovsub
  11337. horizontal and vertical output chroma subsample values. For example for the
  11338. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11339. @end table
  11340. @subsection Examples
  11341. @itemize
  11342. @item
  11343. Scale the input video to a size of 200x100
  11344. @example
  11345. scale=w=200:h=100
  11346. @end example
  11347. This is equivalent to:
  11348. @example
  11349. scale=200:100
  11350. @end example
  11351. or:
  11352. @example
  11353. scale=200x100
  11354. @end example
  11355. @item
  11356. Specify a size abbreviation for the output size:
  11357. @example
  11358. scale=qcif
  11359. @end example
  11360. which can also be written as:
  11361. @example
  11362. scale=size=qcif
  11363. @end example
  11364. @item
  11365. Scale the input to 2x:
  11366. @example
  11367. scale=w=2*iw:h=2*ih
  11368. @end example
  11369. @item
  11370. The above is the same as:
  11371. @example
  11372. scale=2*in_w:2*in_h
  11373. @end example
  11374. @item
  11375. Scale the input to 2x with forced interlaced scaling:
  11376. @example
  11377. scale=2*iw:2*ih:interl=1
  11378. @end example
  11379. @item
  11380. Scale the input to half size:
  11381. @example
  11382. scale=w=iw/2:h=ih/2
  11383. @end example
  11384. @item
  11385. Increase the width, and set the height to the same size:
  11386. @example
  11387. scale=3/2*iw:ow
  11388. @end example
  11389. @item
  11390. Seek Greek harmony:
  11391. @example
  11392. scale=iw:1/PHI*iw
  11393. scale=ih*PHI:ih
  11394. @end example
  11395. @item
  11396. Increase the height, and set the width to 3/2 of the height:
  11397. @example
  11398. scale=w=3/2*oh:h=3/5*ih
  11399. @end example
  11400. @item
  11401. Increase the size, making the size a multiple of the chroma
  11402. subsample values:
  11403. @example
  11404. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11405. @end example
  11406. @item
  11407. Increase the width to a maximum of 500 pixels,
  11408. keeping the same aspect ratio as the input:
  11409. @example
  11410. scale=w='min(500\, iw*3/2):h=-1'
  11411. @end example
  11412. @item
  11413. Make pixels square by combining scale and setsar:
  11414. @example
  11415. scale='trunc(ih*dar):ih',setsar=1/1
  11416. @end example
  11417. @item
  11418. Make pixels square by combining scale and setsar,
  11419. making sure the resulting resolution is even (required by some codecs):
  11420. @example
  11421. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11422. @end example
  11423. @end itemize
  11424. @subsection Commands
  11425. This filter supports the following commands:
  11426. @table @option
  11427. @item width, w
  11428. @item height, h
  11429. Set the output video dimension expression.
  11430. The command accepts the same syntax of the corresponding option.
  11431. If the specified expression is not valid, it is kept at its current
  11432. value.
  11433. @end table
  11434. @section scale_npp
  11435. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11436. format conversion on CUDA video frames. Setting the output width and height
  11437. works in the same way as for the @var{scale} filter.
  11438. The following additional options are accepted:
  11439. @table @option
  11440. @item format
  11441. The pixel format of the output CUDA frames. If set to the string "same" (the
  11442. default), the input format will be kept. Note that automatic format negotiation
  11443. and conversion is not yet supported for hardware frames
  11444. @item interp_algo
  11445. The interpolation algorithm used for resizing. One of the following:
  11446. @table @option
  11447. @item nn
  11448. Nearest neighbour.
  11449. @item linear
  11450. @item cubic
  11451. @item cubic2p_bspline
  11452. 2-parameter cubic (B=1, C=0)
  11453. @item cubic2p_catmullrom
  11454. 2-parameter cubic (B=0, C=1/2)
  11455. @item cubic2p_b05c03
  11456. 2-parameter cubic (B=1/2, C=3/10)
  11457. @item super
  11458. Supersampling
  11459. @item lanczos
  11460. @end table
  11461. @end table
  11462. @section scale2ref
  11463. Scale (resize) the input video, based on a reference video.
  11464. See the scale filter for available options, scale2ref supports the same but
  11465. uses the reference video instead of the main input as basis. scale2ref also
  11466. supports the following additional constants for the @option{w} and
  11467. @option{h} options:
  11468. @table @var
  11469. @item main_w
  11470. @item main_h
  11471. The main input video's width and height
  11472. @item main_a
  11473. The same as @var{main_w} / @var{main_h}
  11474. @item main_sar
  11475. The main input video's sample aspect ratio
  11476. @item main_dar, mdar
  11477. The main input video's display aspect ratio. Calculated from
  11478. @code{(main_w / main_h) * main_sar}.
  11479. @item main_hsub
  11480. @item main_vsub
  11481. The main input video's horizontal and vertical chroma subsample values.
  11482. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11483. is 1.
  11484. @end table
  11485. @subsection Examples
  11486. @itemize
  11487. @item
  11488. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11489. @example
  11490. 'scale2ref[b][a];[a][b]overlay'
  11491. @end example
  11492. @end itemize
  11493. @anchor{selectivecolor}
  11494. @section selectivecolor
  11495. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11496. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11497. by the "purity" of the color (that is, how saturated it already is).
  11498. This filter is similar to the Adobe Photoshop Selective Color tool.
  11499. The filter accepts the following options:
  11500. @table @option
  11501. @item correction_method
  11502. Select color correction method.
  11503. Available values are:
  11504. @table @samp
  11505. @item absolute
  11506. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11507. component value).
  11508. @item relative
  11509. Specified adjustments are relative to the original component value.
  11510. @end table
  11511. Default is @code{absolute}.
  11512. @item reds
  11513. Adjustments for red pixels (pixels where the red component is the maximum)
  11514. @item yellows
  11515. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11516. @item greens
  11517. Adjustments for green pixels (pixels where the green component is the maximum)
  11518. @item cyans
  11519. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11520. @item blues
  11521. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11522. @item magentas
  11523. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11524. @item whites
  11525. Adjustments for white pixels (pixels where all components are greater than 128)
  11526. @item neutrals
  11527. Adjustments for all pixels except pure black and pure white
  11528. @item blacks
  11529. Adjustments for black pixels (pixels where all components are lesser than 128)
  11530. @item psfile
  11531. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11532. @end table
  11533. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11534. 4 space separated floating point adjustment values in the [-1,1] range,
  11535. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11536. pixels of its range.
  11537. @subsection Examples
  11538. @itemize
  11539. @item
  11540. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11541. increase magenta by 27% in blue areas:
  11542. @example
  11543. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11544. @end example
  11545. @item
  11546. Use a Photoshop selective color preset:
  11547. @example
  11548. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11549. @end example
  11550. @end itemize
  11551. @anchor{separatefields}
  11552. @section separatefields
  11553. The @code{separatefields} takes a frame-based video input and splits
  11554. each frame into its components fields, producing a new half height clip
  11555. with twice the frame rate and twice the frame count.
  11556. This filter use field-dominance information in frame to decide which
  11557. of each pair of fields to place first in the output.
  11558. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11559. @section setdar, setsar
  11560. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11561. output video.
  11562. This is done by changing the specified Sample (aka Pixel) Aspect
  11563. Ratio, according to the following equation:
  11564. @example
  11565. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11566. @end example
  11567. Keep in mind that the @code{setdar} filter does not modify the pixel
  11568. dimensions of the video frame. Also, the display aspect ratio set by
  11569. this filter may be changed by later filters in the filterchain,
  11570. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11571. applied.
  11572. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11573. the filter output video.
  11574. Note that as a consequence of the application of this filter, the
  11575. output display aspect ratio will change according to the equation
  11576. above.
  11577. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11578. filter may be changed by later filters in the filterchain, e.g. if
  11579. another "setsar" or a "setdar" filter is applied.
  11580. It accepts the following parameters:
  11581. @table @option
  11582. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11583. Set the aspect ratio used by the filter.
  11584. The parameter can be a floating point number string, an expression, or
  11585. a string of the form @var{num}:@var{den}, where @var{num} and
  11586. @var{den} are the numerator and denominator of the aspect ratio. If
  11587. the parameter is not specified, it is assumed the value "0".
  11588. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11589. should be escaped.
  11590. @item max
  11591. Set the maximum integer value to use for expressing numerator and
  11592. denominator when reducing the expressed aspect ratio to a rational.
  11593. Default value is @code{100}.
  11594. @end table
  11595. The parameter @var{sar} is an expression containing
  11596. the following constants:
  11597. @table @option
  11598. @item E, PI, PHI
  11599. These are approximated values for the mathematical constants e
  11600. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11601. @item w, h
  11602. The input width and height.
  11603. @item a
  11604. These are the same as @var{w} / @var{h}.
  11605. @item sar
  11606. The input sample aspect ratio.
  11607. @item dar
  11608. The input display aspect ratio. It is the same as
  11609. (@var{w} / @var{h}) * @var{sar}.
  11610. @item hsub, vsub
  11611. Horizontal and vertical chroma subsample values. For example, for the
  11612. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11613. @end table
  11614. @subsection Examples
  11615. @itemize
  11616. @item
  11617. To change the display aspect ratio to 16:9, specify one of the following:
  11618. @example
  11619. setdar=dar=1.77777
  11620. setdar=dar=16/9
  11621. @end example
  11622. @item
  11623. To change the sample aspect ratio to 10:11, specify:
  11624. @example
  11625. setsar=sar=10/11
  11626. @end example
  11627. @item
  11628. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11629. 1000 in the aspect ratio reduction, use the command:
  11630. @example
  11631. setdar=ratio=16/9:max=1000
  11632. @end example
  11633. @end itemize
  11634. @anchor{setfield}
  11635. @section setfield
  11636. Force field for the output video frame.
  11637. The @code{setfield} filter marks the interlace type field for the
  11638. output frames. It does not change the input frame, but only sets the
  11639. corresponding property, which affects how the frame is treated by
  11640. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11641. The filter accepts the following options:
  11642. @table @option
  11643. @item mode
  11644. Available values are:
  11645. @table @samp
  11646. @item auto
  11647. Keep the same field property.
  11648. @item bff
  11649. Mark the frame as bottom-field-first.
  11650. @item tff
  11651. Mark the frame as top-field-first.
  11652. @item prog
  11653. Mark the frame as progressive.
  11654. @end table
  11655. @end table
  11656. @anchor{setparams}
  11657. @section setparams
  11658. Force frame parameter for the output video frame.
  11659. The @code{setparams} filter marks interlace and color range for the
  11660. output frames. It does not change the input frame, but only sets the
  11661. corresponding property, which affects how the frame is treated by
  11662. filters/encoders.
  11663. @table @option
  11664. @item field_mode
  11665. Available values are:
  11666. @table @samp
  11667. @item auto
  11668. Keep the same field property (default).
  11669. @item bff
  11670. Mark the frame as bottom-field-first.
  11671. @item tff
  11672. Mark the frame as top-field-first.
  11673. @item prog
  11674. Mark the frame as progressive.
  11675. @end table
  11676. @item range
  11677. Available values are:
  11678. @table @samp
  11679. @item auto
  11680. Keep the same color range property (default).
  11681. @item unspecified, unknown
  11682. Mark the frame as unspecified color range.
  11683. @item limited, tv, mpeg
  11684. Mark the frame as limited range.
  11685. @item full, pc, jpeg
  11686. Mark the frame as full range.
  11687. @end table
  11688. @item color_primaries
  11689. Set the color primaries.
  11690. Available values are:
  11691. @table @samp
  11692. @item auto
  11693. Keep the same color primaries property (default).
  11694. @item bt709
  11695. @item unknown
  11696. @item bt470m
  11697. @item bt470bg
  11698. @item smpte170m
  11699. @item smpte240m
  11700. @item film
  11701. @item bt2020
  11702. @item smpte428
  11703. @item smpte431
  11704. @item smpte432
  11705. @item jedec-p22
  11706. @end table
  11707. @item color_trc
  11708. Set the color transfert.
  11709. Available values are:
  11710. @table @samp
  11711. @item auto
  11712. Keep the same color trc property (default).
  11713. @item bt709
  11714. @item unknown
  11715. @item bt470m
  11716. @item bt470bg
  11717. @item smpte170m
  11718. @item smpte240m
  11719. @item linear
  11720. @item log100
  11721. @item log316
  11722. @item iec61966-2-4
  11723. @item bt1361e
  11724. @item iec61966-2-1
  11725. @item bt2020-10
  11726. @item bt2020-12
  11727. @item smpte2084
  11728. @item smpte428
  11729. @item arib-std-b67
  11730. @end table
  11731. @item colorspace
  11732. Set the colorspace.
  11733. Available values are:
  11734. @table @samp
  11735. @item auto
  11736. Keep the same colorspace property (default).
  11737. @item gbr
  11738. @item bt709
  11739. @item unknown
  11740. @item fcc
  11741. @item bt470bg
  11742. @item smpte170m
  11743. @item smpte240m
  11744. @item ycgco
  11745. @item bt2020nc
  11746. @item bt2020c
  11747. @item smpte2085
  11748. @item chroma-derived-nc
  11749. @item chroma-derived-c
  11750. @item ictcp
  11751. @end table
  11752. @end table
  11753. @section showinfo
  11754. Show a line containing various information for each input video frame.
  11755. The input video is not modified.
  11756. This filter supports the following options:
  11757. @table @option
  11758. @item checksum
  11759. Calculate checksums of each plane. By default enabled.
  11760. @end table
  11761. The shown line contains a sequence of key/value pairs of the form
  11762. @var{key}:@var{value}.
  11763. The following values are shown in the output:
  11764. @table @option
  11765. @item n
  11766. The (sequential) number of the input frame, starting from 0.
  11767. @item pts
  11768. The Presentation TimeStamp of the input frame, expressed as a number of
  11769. time base units. The time base unit depends on the filter input pad.
  11770. @item pts_time
  11771. The Presentation TimeStamp of the input frame, expressed as a number of
  11772. seconds.
  11773. @item pos
  11774. The position of the frame in the input stream, or -1 if this information is
  11775. unavailable and/or meaningless (for example in case of synthetic video).
  11776. @item fmt
  11777. The pixel format name.
  11778. @item sar
  11779. The sample aspect ratio of the input frame, expressed in the form
  11780. @var{num}/@var{den}.
  11781. @item s
  11782. The size of the input frame. For the syntax of this option, check the
  11783. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11784. @item i
  11785. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11786. for bottom field first).
  11787. @item iskey
  11788. This is 1 if the frame is a key frame, 0 otherwise.
  11789. @item type
  11790. The picture type of the input frame ("I" for an I-frame, "P" for a
  11791. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11792. Also refer to the documentation of the @code{AVPictureType} enum and of
  11793. the @code{av_get_picture_type_char} function defined in
  11794. @file{libavutil/avutil.h}.
  11795. @item checksum
  11796. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11797. @item plane_checksum
  11798. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11799. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11800. @end table
  11801. @section showpalette
  11802. Displays the 256 colors palette of each frame. This filter is only relevant for
  11803. @var{pal8} pixel format frames.
  11804. It accepts the following option:
  11805. @table @option
  11806. @item s
  11807. Set the size of the box used to represent one palette color entry. Default is
  11808. @code{30} (for a @code{30x30} pixel box).
  11809. @end table
  11810. @section shuffleframes
  11811. Reorder and/or duplicate and/or drop video frames.
  11812. It accepts the following parameters:
  11813. @table @option
  11814. @item mapping
  11815. Set the destination indexes of input frames.
  11816. This is space or '|' separated list of indexes that maps input frames to output
  11817. frames. Number of indexes also sets maximal value that each index may have.
  11818. '-1' index have special meaning and that is to drop frame.
  11819. @end table
  11820. The first frame has the index 0. The default is to keep the input unchanged.
  11821. @subsection Examples
  11822. @itemize
  11823. @item
  11824. Swap second and third frame of every three frames of the input:
  11825. @example
  11826. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11827. @end example
  11828. @item
  11829. Swap 10th and 1st frame of every ten frames of the input:
  11830. @example
  11831. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11832. @end example
  11833. @end itemize
  11834. @section shuffleplanes
  11835. Reorder and/or duplicate video planes.
  11836. It accepts the following parameters:
  11837. @table @option
  11838. @item map0
  11839. The index of the input plane to be used as the first output plane.
  11840. @item map1
  11841. The index of the input plane to be used as the second output plane.
  11842. @item map2
  11843. The index of the input plane to be used as the third output plane.
  11844. @item map3
  11845. The index of the input plane to be used as the fourth output plane.
  11846. @end table
  11847. The first plane has the index 0. The default is to keep the input unchanged.
  11848. @subsection Examples
  11849. @itemize
  11850. @item
  11851. Swap the second and third planes of the input:
  11852. @example
  11853. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11854. @end example
  11855. @end itemize
  11856. @anchor{signalstats}
  11857. @section signalstats
  11858. Evaluate various visual metrics that assist in determining issues associated
  11859. with the digitization of analog video media.
  11860. By default the filter will log these metadata values:
  11861. @table @option
  11862. @item YMIN
  11863. Display the minimal Y value contained within the input frame. Expressed in
  11864. range of [0-255].
  11865. @item YLOW
  11866. Display the Y value at the 10% percentile within the input frame. Expressed in
  11867. range of [0-255].
  11868. @item YAVG
  11869. Display the average Y value within the input frame. Expressed in range of
  11870. [0-255].
  11871. @item YHIGH
  11872. Display the Y value at the 90% percentile within the input frame. Expressed in
  11873. range of [0-255].
  11874. @item YMAX
  11875. Display the maximum Y value contained within the input frame. Expressed in
  11876. range of [0-255].
  11877. @item UMIN
  11878. Display the minimal U value contained within the input frame. Expressed in
  11879. range of [0-255].
  11880. @item ULOW
  11881. Display the U value at the 10% percentile within the input frame. Expressed in
  11882. range of [0-255].
  11883. @item UAVG
  11884. Display the average U value within the input frame. Expressed in range of
  11885. [0-255].
  11886. @item UHIGH
  11887. Display the U value at the 90% percentile within the input frame. Expressed in
  11888. range of [0-255].
  11889. @item UMAX
  11890. Display the maximum U value contained within the input frame. Expressed in
  11891. range of [0-255].
  11892. @item VMIN
  11893. Display the minimal V value contained within the input frame. Expressed in
  11894. range of [0-255].
  11895. @item VLOW
  11896. Display the V value at the 10% percentile within the input frame. Expressed in
  11897. range of [0-255].
  11898. @item VAVG
  11899. Display the average V value within the input frame. Expressed in range of
  11900. [0-255].
  11901. @item VHIGH
  11902. Display the V value at the 90% percentile within the input frame. Expressed in
  11903. range of [0-255].
  11904. @item VMAX
  11905. Display the maximum V value contained within the input frame. Expressed in
  11906. range of [0-255].
  11907. @item SATMIN
  11908. Display the minimal saturation value contained within the input frame.
  11909. Expressed in range of [0-~181.02].
  11910. @item SATLOW
  11911. Display the saturation value at the 10% percentile within the input frame.
  11912. Expressed in range of [0-~181.02].
  11913. @item SATAVG
  11914. Display the average saturation value within the input frame. Expressed in range
  11915. of [0-~181.02].
  11916. @item SATHIGH
  11917. Display the saturation value at the 90% percentile within the input frame.
  11918. Expressed in range of [0-~181.02].
  11919. @item SATMAX
  11920. Display the maximum saturation value contained within the input frame.
  11921. Expressed in range of [0-~181.02].
  11922. @item HUEMED
  11923. Display the median value for hue within the input frame. Expressed in range of
  11924. [0-360].
  11925. @item HUEAVG
  11926. Display the average value for hue within the input frame. Expressed in range of
  11927. [0-360].
  11928. @item YDIF
  11929. Display the average of sample value difference between all values of the Y
  11930. plane in the current frame and corresponding values of the previous input frame.
  11931. Expressed in range of [0-255].
  11932. @item UDIF
  11933. Display the average of sample value difference between all values of the U
  11934. plane in the current frame and corresponding values of the previous input frame.
  11935. Expressed in range of [0-255].
  11936. @item VDIF
  11937. Display the average of sample value difference between all values of the V
  11938. plane in the current frame and corresponding values of the previous input frame.
  11939. Expressed in range of [0-255].
  11940. @item YBITDEPTH
  11941. Display bit depth of Y plane in current frame.
  11942. Expressed in range of [0-16].
  11943. @item UBITDEPTH
  11944. Display bit depth of U plane in current frame.
  11945. Expressed in range of [0-16].
  11946. @item VBITDEPTH
  11947. Display bit depth of V plane in current frame.
  11948. Expressed in range of [0-16].
  11949. @end table
  11950. The filter accepts the following options:
  11951. @table @option
  11952. @item stat
  11953. @item out
  11954. @option{stat} specify an additional form of image analysis.
  11955. @option{out} output video with the specified type of pixel highlighted.
  11956. Both options accept the following values:
  11957. @table @samp
  11958. @item tout
  11959. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11960. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11961. include the results of video dropouts, head clogs, or tape tracking issues.
  11962. @item vrep
  11963. Identify @var{vertical line repetition}. Vertical line repetition includes
  11964. similar rows of pixels within a frame. In born-digital video vertical line
  11965. repetition is common, but this pattern is uncommon in video digitized from an
  11966. analog source. When it occurs in video that results from the digitization of an
  11967. analog source it can indicate concealment from a dropout compensator.
  11968. @item brng
  11969. Identify pixels that fall outside of legal broadcast range.
  11970. @end table
  11971. @item color, c
  11972. Set the highlight color for the @option{out} option. The default color is
  11973. yellow.
  11974. @end table
  11975. @subsection Examples
  11976. @itemize
  11977. @item
  11978. Output data of various video metrics:
  11979. @example
  11980. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11981. @end example
  11982. @item
  11983. Output specific data about the minimum and maximum values of the Y plane per frame:
  11984. @example
  11985. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11986. @end example
  11987. @item
  11988. Playback video while highlighting pixels that are outside of broadcast range in red.
  11989. @example
  11990. ffplay example.mov -vf signalstats="out=brng:color=red"
  11991. @end example
  11992. @item
  11993. Playback video with signalstats metadata drawn over the frame.
  11994. @example
  11995. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11996. @end example
  11997. The contents of signalstat_drawtext.txt used in the command are:
  11998. @example
  11999. time %@{pts:hms@}
  12000. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12001. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12002. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12003. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12004. @end example
  12005. @end itemize
  12006. @anchor{signature}
  12007. @section signature
  12008. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12009. input. In this case the matching between the inputs can be calculated additionally.
  12010. The filter always passes through the first input. The signature of each stream can
  12011. be written into a file.
  12012. It accepts the following options:
  12013. @table @option
  12014. @item detectmode
  12015. Enable or disable the matching process.
  12016. Available values are:
  12017. @table @samp
  12018. @item off
  12019. Disable the calculation of a matching (default).
  12020. @item full
  12021. Calculate the matching for the whole video and output whether the whole video
  12022. matches or only parts.
  12023. @item fast
  12024. Calculate only until a matching is found or the video ends. Should be faster in
  12025. some cases.
  12026. @end table
  12027. @item nb_inputs
  12028. Set the number of inputs. The option value must be a non negative integer.
  12029. Default value is 1.
  12030. @item filename
  12031. Set the path to which the output is written. If there is more than one input,
  12032. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12033. integer), that will be replaced with the input number. If no filename is
  12034. specified, no output will be written. This is the default.
  12035. @item format
  12036. Choose the output format.
  12037. Available values are:
  12038. @table @samp
  12039. @item binary
  12040. Use the specified binary representation (default).
  12041. @item xml
  12042. Use the specified xml representation.
  12043. @end table
  12044. @item th_d
  12045. Set threshold to detect one word as similar. The option value must be an integer
  12046. greater than zero. The default value is 9000.
  12047. @item th_dc
  12048. Set threshold to detect all words as similar. The option value must be an integer
  12049. greater than zero. The default value is 60000.
  12050. @item th_xh
  12051. Set threshold to detect frames as similar. The option value must be an integer
  12052. greater than zero. The default value is 116.
  12053. @item th_di
  12054. Set the minimum length of a sequence in frames to recognize it as matching
  12055. sequence. The option value must be a non negative integer value.
  12056. The default value is 0.
  12057. @item th_it
  12058. Set the minimum relation, that matching frames to all frames must have.
  12059. The option value must be a double value between 0 and 1. The default value is 0.5.
  12060. @end table
  12061. @subsection Examples
  12062. @itemize
  12063. @item
  12064. To calculate the signature of an input video and store it in signature.bin:
  12065. @example
  12066. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12067. @end example
  12068. @item
  12069. To detect whether two videos match and store the signatures in XML format in
  12070. signature0.xml and signature1.xml:
  12071. @example
  12072. 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 -
  12073. @end example
  12074. @end itemize
  12075. @anchor{smartblur}
  12076. @section smartblur
  12077. Blur the input video without impacting the outlines.
  12078. It accepts the following options:
  12079. @table @option
  12080. @item luma_radius, lr
  12081. Set the luma radius. The option value must be a float number in
  12082. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12083. used to blur the image (slower if larger). Default value is 1.0.
  12084. @item luma_strength, ls
  12085. Set the luma strength. The option value must be a float number
  12086. in the range [-1.0,1.0] that configures the blurring. A value included
  12087. in [0.0,1.0] will blur the image whereas a value included in
  12088. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12089. @item luma_threshold, lt
  12090. Set the luma threshold used as a coefficient to determine
  12091. whether a pixel should be blurred or not. The option value must be an
  12092. integer in the range [-30,30]. A value of 0 will filter all the image,
  12093. a value included in [0,30] will filter flat areas and a value included
  12094. in [-30,0] will filter edges. Default value is 0.
  12095. @item chroma_radius, cr
  12096. Set the chroma radius. The option value must be a float number in
  12097. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12098. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12099. @item chroma_strength, cs
  12100. Set the chroma strength. The option value must be a float number
  12101. in the range [-1.0,1.0] that configures the blurring. A value included
  12102. in [0.0,1.0] will blur the image whereas a value included in
  12103. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12104. @item chroma_threshold, ct
  12105. Set the chroma threshold used as a coefficient to determine
  12106. whether a pixel should be blurred or not. The option value must be an
  12107. integer in the range [-30,30]. A value of 0 will filter all the image,
  12108. a value included in [0,30] will filter flat areas and a value included
  12109. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12110. @end table
  12111. If a chroma option is not explicitly set, the corresponding luma value
  12112. is set.
  12113. @section ssim
  12114. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12115. This filter takes in input two input videos, the first input is
  12116. considered the "main" source and is passed unchanged to the
  12117. output. The second input is used as a "reference" video for computing
  12118. the SSIM.
  12119. Both video inputs must have the same resolution and pixel format for
  12120. this filter to work correctly. Also it assumes that both inputs
  12121. have the same number of frames, which are compared one by one.
  12122. The filter stores the calculated SSIM of each frame.
  12123. The description of the accepted parameters follows.
  12124. @table @option
  12125. @item stats_file, f
  12126. If specified the filter will use the named file to save the SSIM of
  12127. each individual frame. When filename equals "-" the data is sent to
  12128. standard output.
  12129. @end table
  12130. The file printed if @var{stats_file} is selected, contains a sequence of
  12131. key/value pairs of the form @var{key}:@var{value} for each compared
  12132. couple of frames.
  12133. A description of each shown parameter follows:
  12134. @table @option
  12135. @item n
  12136. sequential number of the input frame, starting from 1
  12137. @item Y, U, V, R, G, B
  12138. SSIM of the compared frames for the component specified by the suffix.
  12139. @item All
  12140. SSIM of the compared frames for the whole frame.
  12141. @item dB
  12142. Same as above but in dB representation.
  12143. @end table
  12144. This filter also supports the @ref{framesync} options.
  12145. For example:
  12146. @example
  12147. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12148. [main][ref] ssim="stats_file=stats.log" [out]
  12149. @end example
  12150. On this example the input file being processed is compared with the
  12151. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12152. is stored in @file{stats.log}.
  12153. Another example with both psnr and ssim at same time:
  12154. @example
  12155. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12156. @end example
  12157. @section stereo3d
  12158. Convert between different stereoscopic image formats.
  12159. The filters accept the following options:
  12160. @table @option
  12161. @item in
  12162. Set stereoscopic image format of input.
  12163. Available values for input image formats are:
  12164. @table @samp
  12165. @item sbsl
  12166. side by side parallel (left eye left, right eye right)
  12167. @item sbsr
  12168. side by side crosseye (right eye left, left eye right)
  12169. @item sbs2l
  12170. side by side parallel with half width resolution
  12171. (left eye left, right eye right)
  12172. @item sbs2r
  12173. side by side crosseye with half width resolution
  12174. (right eye left, left eye right)
  12175. @item abl
  12176. above-below (left eye above, right eye below)
  12177. @item abr
  12178. above-below (right eye above, left eye below)
  12179. @item ab2l
  12180. above-below with half height resolution
  12181. (left eye above, right eye below)
  12182. @item ab2r
  12183. above-below with half height resolution
  12184. (right eye above, left eye below)
  12185. @item al
  12186. alternating frames (left eye first, right eye second)
  12187. @item ar
  12188. alternating frames (right eye first, left eye second)
  12189. @item irl
  12190. interleaved rows (left eye has top row, right eye starts on next row)
  12191. @item irr
  12192. interleaved rows (right eye has top row, left eye starts on next row)
  12193. @item icl
  12194. interleaved columns, left eye first
  12195. @item icr
  12196. interleaved columns, right eye first
  12197. Default value is @samp{sbsl}.
  12198. @end table
  12199. @item out
  12200. Set stereoscopic image format of output.
  12201. @table @samp
  12202. @item sbsl
  12203. side by side parallel (left eye left, right eye right)
  12204. @item sbsr
  12205. side by side crosseye (right eye left, left eye right)
  12206. @item sbs2l
  12207. side by side parallel with half width resolution
  12208. (left eye left, right eye right)
  12209. @item sbs2r
  12210. side by side crosseye with half width resolution
  12211. (right eye left, left eye right)
  12212. @item abl
  12213. above-below (left eye above, right eye below)
  12214. @item abr
  12215. above-below (right eye above, left eye below)
  12216. @item ab2l
  12217. above-below with half height resolution
  12218. (left eye above, right eye below)
  12219. @item ab2r
  12220. above-below with half height resolution
  12221. (right eye above, left eye below)
  12222. @item al
  12223. alternating frames (left eye first, right eye second)
  12224. @item ar
  12225. alternating frames (right eye first, left eye second)
  12226. @item irl
  12227. interleaved rows (left eye has top row, right eye starts on next row)
  12228. @item irr
  12229. interleaved rows (right eye has top row, left eye starts on next row)
  12230. @item arbg
  12231. anaglyph red/blue gray
  12232. (red filter on left eye, blue filter on right eye)
  12233. @item argg
  12234. anaglyph red/green gray
  12235. (red filter on left eye, green filter on right eye)
  12236. @item arcg
  12237. anaglyph red/cyan gray
  12238. (red filter on left eye, cyan filter on right eye)
  12239. @item arch
  12240. anaglyph red/cyan half colored
  12241. (red filter on left eye, cyan filter on right eye)
  12242. @item arcc
  12243. anaglyph red/cyan color
  12244. (red filter on left eye, cyan filter on right eye)
  12245. @item arcd
  12246. anaglyph red/cyan color optimized with the least squares projection of dubois
  12247. (red filter on left eye, cyan filter on right eye)
  12248. @item agmg
  12249. anaglyph green/magenta gray
  12250. (green filter on left eye, magenta filter on right eye)
  12251. @item agmh
  12252. anaglyph green/magenta half colored
  12253. (green filter on left eye, magenta filter on right eye)
  12254. @item agmc
  12255. anaglyph green/magenta colored
  12256. (green filter on left eye, magenta filter on right eye)
  12257. @item agmd
  12258. anaglyph green/magenta color optimized with the least squares projection of dubois
  12259. (green filter on left eye, magenta filter on right eye)
  12260. @item aybg
  12261. anaglyph yellow/blue gray
  12262. (yellow filter on left eye, blue filter on right eye)
  12263. @item aybh
  12264. anaglyph yellow/blue half colored
  12265. (yellow filter on left eye, blue filter on right eye)
  12266. @item aybc
  12267. anaglyph yellow/blue colored
  12268. (yellow filter on left eye, blue filter on right eye)
  12269. @item aybd
  12270. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12271. (yellow filter on left eye, blue filter on right eye)
  12272. @item ml
  12273. mono output (left eye only)
  12274. @item mr
  12275. mono output (right eye only)
  12276. @item chl
  12277. checkerboard, left eye first
  12278. @item chr
  12279. checkerboard, right eye first
  12280. @item icl
  12281. interleaved columns, left eye first
  12282. @item icr
  12283. interleaved columns, right eye first
  12284. @item hdmi
  12285. HDMI frame pack
  12286. @end table
  12287. Default value is @samp{arcd}.
  12288. @end table
  12289. @subsection Examples
  12290. @itemize
  12291. @item
  12292. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12293. @example
  12294. stereo3d=sbsl:aybd
  12295. @end example
  12296. @item
  12297. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12298. @example
  12299. stereo3d=abl:sbsr
  12300. @end example
  12301. @end itemize
  12302. @section streamselect, astreamselect
  12303. Select video or audio streams.
  12304. The filter accepts the following options:
  12305. @table @option
  12306. @item inputs
  12307. Set number of inputs. Default is 2.
  12308. @item map
  12309. Set input indexes to remap to outputs.
  12310. @end table
  12311. @subsection Commands
  12312. The @code{streamselect} and @code{astreamselect} filter supports the following
  12313. commands:
  12314. @table @option
  12315. @item map
  12316. Set input indexes to remap to outputs.
  12317. @end table
  12318. @subsection Examples
  12319. @itemize
  12320. @item
  12321. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12322. @example
  12323. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12324. @end example
  12325. @item
  12326. Same as above, but for audio:
  12327. @example
  12328. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12329. @end example
  12330. @end itemize
  12331. @section sobel
  12332. Apply sobel operator to input video stream.
  12333. The filter accepts the following option:
  12334. @table @option
  12335. @item planes
  12336. Set which planes will be processed, unprocessed planes will be copied.
  12337. By default value 0xf, all planes will be processed.
  12338. @item scale
  12339. Set value which will be multiplied with filtered result.
  12340. @item delta
  12341. Set value which will be added to filtered result.
  12342. @end table
  12343. @anchor{spp}
  12344. @section spp
  12345. Apply a simple postprocessing filter that compresses and decompresses the image
  12346. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12347. and average the results.
  12348. The filter accepts the following options:
  12349. @table @option
  12350. @item quality
  12351. Set quality. This option defines the number of levels for averaging. It accepts
  12352. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12353. effect. A value of @code{6} means the higher quality. For each increment of
  12354. that value the speed drops by a factor of approximately 2. Default value is
  12355. @code{3}.
  12356. @item qp
  12357. Force a constant quantization parameter. If not set, the filter will use the QP
  12358. from the video stream (if available).
  12359. @item mode
  12360. Set thresholding mode. Available modes are:
  12361. @table @samp
  12362. @item hard
  12363. Set hard thresholding (default).
  12364. @item soft
  12365. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12366. @end table
  12367. @item use_bframe_qp
  12368. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12369. option may cause flicker since the B-Frames have often larger QP. Default is
  12370. @code{0} (not enabled).
  12371. @end table
  12372. @section sr
  12373. Scale the input by applying one of the super-resolution methods based on
  12374. convolutional neural networks. Supported models:
  12375. @itemize
  12376. @item
  12377. Super-Resolution Convolutional Neural Network model (SRCNN).
  12378. See @url{https://arxiv.org/abs/1501.00092}.
  12379. @item
  12380. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12381. See @url{https://arxiv.org/abs/1609.05158}.
  12382. @end itemize
  12383. Training scripts as well as scripts for model generation are provided in
  12384. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12385. The filter accepts the following options:
  12386. @table @option
  12387. @item dnn_backend
  12388. Specify which DNN backend to use for model loading and execution. This option accepts
  12389. the following values:
  12390. @table @samp
  12391. @item native
  12392. Native implementation of DNN loading and execution.
  12393. @item tensorflow
  12394. TensorFlow backend. To enable this backend you
  12395. need to install the TensorFlow for C library (see
  12396. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12397. @code{--enable-libtensorflow}
  12398. @end table
  12399. Default value is @samp{native}.
  12400. @item model
  12401. Set path to model file specifying network architecture and its parameters.
  12402. Note that different backends use different file formats. TensorFlow backend
  12403. can load files for both formats, while native backend can load files for only
  12404. its format.
  12405. @item scale_factor
  12406. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12407. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12408. input upscaled using bicubic upscaling with proper scale factor.
  12409. @end table
  12410. @anchor{subtitles}
  12411. @section subtitles
  12412. Draw subtitles on top of input video using the libass library.
  12413. To enable compilation of this filter you need to configure FFmpeg with
  12414. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12415. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12416. Alpha) subtitles format.
  12417. The filter accepts the following options:
  12418. @table @option
  12419. @item filename, f
  12420. Set the filename of the subtitle file to read. It must be specified.
  12421. @item original_size
  12422. Specify the size of the original video, the video for which the ASS file
  12423. was composed. For the syntax of this option, check the
  12424. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12425. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12426. correctly scale the fonts if the aspect ratio has been changed.
  12427. @item fontsdir
  12428. Set a directory path containing fonts that can be used by the filter.
  12429. These fonts will be used in addition to whatever the font provider uses.
  12430. @item alpha
  12431. Process alpha channel, by default alpha channel is untouched.
  12432. @item charenc
  12433. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12434. useful if not UTF-8.
  12435. @item stream_index, si
  12436. Set subtitles stream index. @code{subtitles} filter only.
  12437. @item force_style
  12438. Override default style or script info parameters of the subtitles. It accepts a
  12439. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12440. @end table
  12441. If the first key is not specified, it is assumed that the first value
  12442. specifies the @option{filename}.
  12443. For example, to render the file @file{sub.srt} on top of the input
  12444. video, use the command:
  12445. @example
  12446. subtitles=sub.srt
  12447. @end example
  12448. which is equivalent to:
  12449. @example
  12450. subtitles=filename=sub.srt
  12451. @end example
  12452. To render the default subtitles stream from file @file{video.mkv}, use:
  12453. @example
  12454. subtitles=video.mkv
  12455. @end example
  12456. To render the second subtitles stream from that file, use:
  12457. @example
  12458. subtitles=video.mkv:si=1
  12459. @end example
  12460. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12461. @code{DejaVu Serif}, use:
  12462. @example
  12463. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12464. @end example
  12465. @section super2xsai
  12466. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12467. Interpolate) pixel art scaling algorithm.
  12468. Useful for enlarging pixel art images without reducing sharpness.
  12469. @section swaprect
  12470. Swap two rectangular objects in video.
  12471. This filter accepts the following options:
  12472. @table @option
  12473. @item w
  12474. Set object width.
  12475. @item h
  12476. Set object height.
  12477. @item x1
  12478. Set 1st rect x coordinate.
  12479. @item y1
  12480. Set 1st rect y coordinate.
  12481. @item x2
  12482. Set 2nd rect x coordinate.
  12483. @item y2
  12484. Set 2nd rect y coordinate.
  12485. All expressions are evaluated once for each frame.
  12486. @end table
  12487. The all options are expressions containing the following constants:
  12488. @table @option
  12489. @item w
  12490. @item h
  12491. The input width and height.
  12492. @item a
  12493. same as @var{w} / @var{h}
  12494. @item sar
  12495. input sample aspect ratio
  12496. @item dar
  12497. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12498. @item n
  12499. The number of the input frame, starting from 0.
  12500. @item t
  12501. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12502. @item pos
  12503. the position in the file of the input frame, NAN if unknown
  12504. @end table
  12505. @section swapuv
  12506. Swap U & V plane.
  12507. @section telecine
  12508. Apply telecine process to the video.
  12509. This filter accepts the following options:
  12510. @table @option
  12511. @item first_field
  12512. @table @samp
  12513. @item top, t
  12514. top field first
  12515. @item bottom, b
  12516. bottom field first
  12517. The default value is @code{top}.
  12518. @end table
  12519. @item pattern
  12520. A string of numbers representing the pulldown pattern you wish to apply.
  12521. The default value is @code{23}.
  12522. @end table
  12523. @example
  12524. Some typical patterns:
  12525. NTSC output (30i):
  12526. 27.5p: 32222
  12527. 24p: 23 (classic)
  12528. 24p: 2332 (preferred)
  12529. 20p: 33
  12530. 18p: 334
  12531. 16p: 3444
  12532. PAL output (25i):
  12533. 27.5p: 12222
  12534. 24p: 222222222223 ("Euro pulldown")
  12535. 16.67p: 33
  12536. 16p: 33333334
  12537. @end example
  12538. @section threshold
  12539. Apply threshold effect to video stream.
  12540. This filter needs four video streams to perform thresholding.
  12541. First stream is stream we are filtering.
  12542. Second stream is holding threshold values, third stream is holding min values,
  12543. and last, fourth stream is holding max values.
  12544. The filter accepts the following option:
  12545. @table @option
  12546. @item planes
  12547. Set which planes will be processed, unprocessed planes will be copied.
  12548. By default value 0xf, all planes will be processed.
  12549. @end table
  12550. For example if first stream pixel's component value is less then threshold value
  12551. of pixel component from 2nd threshold stream, third stream value will picked,
  12552. otherwise fourth stream pixel component value will be picked.
  12553. Using color source filter one can perform various types of thresholding:
  12554. @subsection Examples
  12555. @itemize
  12556. @item
  12557. Binary threshold, using gray color as threshold:
  12558. @example
  12559. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12560. @end example
  12561. @item
  12562. Inverted binary threshold, using gray color as threshold:
  12563. @example
  12564. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12565. @end example
  12566. @item
  12567. Truncate binary threshold, using gray color as threshold:
  12568. @example
  12569. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12570. @end example
  12571. @item
  12572. Threshold to zero, using gray color as threshold:
  12573. @example
  12574. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12575. @end example
  12576. @item
  12577. Inverted threshold to zero, using gray color as threshold:
  12578. @example
  12579. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12580. @end example
  12581. @end itemize
  12582. @section thumbnail
  12583. Select the most representative frame in a given sequence of consecutive frames.
  12584. The filter accepts the following options:
  12585. @table @option
  12586. @item n
  12587. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12588. will pick one of them, and then handle the next batch of @var{n} frames until
  12589. the end. Default is @code{100}.
  12590. @end table
  12591. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12592. value will result in a higher memory usage, so a high value is not recommended.
  12593. @subsection Examples
  12594. @itemize
  12595. @item
  12596. Extract one picture each 50 frames:
  12597. @example
  12598. thumbnail=50
  12599. @end example
  12600. @item
  12601. Complete example of a thumbnail creation with @command{ffmpeg}:
  12602. @example
  12603. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12604. @end example
  12605. @end itemize
  12606. @section tile
  12607. Tile several successive frames together.
  12608. The filter accepts the following options:
  12609. @table @option
  12610. @item layout
  12611. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12612. this option, check the
  12613. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12614. @item nb_frames
  12615. Set the maximum number of frames to render in the given area. It must be less
  12616. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12617. the area will be used.
  12618. @item margin
  12619. Set the outer border margin in pixels.
  12620. @item padding
  12621. Set the inner border thickness (i.e. the number of pixels between frames). For
  12622. more advanced padding options (such as having different values for the edges),
  12623. refer to the pad video filter.
  12624. @item color
  12625. Specify the color of the unused area. For the syntax of this option, check the
  12626. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12627. The default value of @var{color} is "black".
  12628. @item overlap
  12629. Set the number of frames to overlap when tiling several successive frames together.
  12630. The value must be between @code{0} and @var{nb_frames - 1}.
  12631. @item init_padding
  12632. Set the number of frames to initially be empty before displaying first output frame.
  12633. This controls how soon will one get first output frame.
  12634. The value must be between @code{0} and @var{nb_frames - 1}.
  12635. @end table
  12636. @subsection Examples
  12637. @itemize
  12638. @item
  12639. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12640. @example
  12641. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12642. @end example
  12643. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12644. duplicating each output frame to accommodate the originally detected frame
  12645. rate.
  12646. @item
  12647. Display @code{5} pictures in an area of @code{3x2} frames,
  12648. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12649. mixed flat and named options:
  12650. @example
  12651. tile=3x2:nb_frames=5:padding=7:margin=2
  12652. @end example
  12653. @end itemize
  12654. @section tinterlace
  12655. Perform various types of temporal field interlacing.
  12656. Frames are counted starting from 1, so the first input frame is
  12657. considered odd.
  12658. The filter accepts the following options:
  12659. @table @option
  12660. @item mode
  12661. Specify the mode of the interlacing. This option can also be specified
  12662. as a value alone. See below for a list of values for this option.
  12663. Available values are:
  12664. @table @samp
  12665. @item merge, 0
  12666. Move odd frames into the upper field, even into the lower field,
  12667. generating a double height frame at half frame rate.
  12668. @example
  12669. ------> time
  12670. Input:
  12671. Frame 1 Frame 2 Frame 3 Frame 4
  12672. 11111 22222 33333 44444
  12673. 11111 22222 33333 44444
  12674. 11111 22222 33333 44444
  12675. 11111 22222 33333 44444
  12676. Output:
  12677. 11111 33333
  12678. 22222 44444
  12679. 11111 33333
  12680. 22222 44444
  12681. 11111 33333
  12682. 22222 44444
  12683. 11111 33333
  12684. 22222 44444
  12685. @end example
  12686. @item drop_even, 1
  12687. Only output odd frames, even frames are dropped, generating a frame with
  12688. unchanged height at half frame rate.
  12689. @example
  12690. ------> time
  12691. Input:
  12692. Frame 1 Frame 2 Frame 3 Frame 4
  12693. 11111 22222 33333 44444
  12694. 11111 22222 33333 44444
  12695. 11111 22222 33333 44444
  12696. 11111 22222 33333 44444
  12697. Output:
  12698. 11111 33333
  12699. 11111 33333
  12700. 11111 33333
  12701. 11111 33333
  12702. @end example
  12703. @item drop_odd, 2
  12704. Only output even frames, odd frames are dropped, generating a frame with
  12705. unchanged height at half frame rate.
  12706. @example
  12707. ------> time
  12708. Input:
  12709. Frame 1 Frame 2 Frame 3 Frame 4
  12710. 11111 22222 33333 44444
  12711. 11111 22222 33333 44444
  12712. 11111 22222 33333 44444
  12713. 11111 22222 33333 44444
  12714. Output:
  12715. 22222 44444
  12716. 22222 44444
  12717. 22222 44444
  12718. 22222 44444
  12719. @end example
  12720. @item pad, 3
  12721. Expand each frame to full height, but pad alternate lines with black,
  12722. generating a frame with double height at the same input frame rate.
  12723. @example
  12724. ------> time
  12725. Input:
  12726. Frame 1 Frame 2 Frame 3 Frame 4
  12727. 11111 22222 33333 44444
  12728. 11111 22222 33333 44444
  12729. 11111 22222 33333 44444
  12730. 11111 22222 33333 44444
  12731. Output:
  12732. 11111 ..... 33333 .....
  12733. ..... 22222 ..... 44444
  12734. 11111 ..... 33333 .....
  12735. ..... 22222 ..... 44444
  12736. 11111 ..... 33333 .....
  12737. ..... 22222 ..... 44444
  12738. 11111 ..... 33333 .....
  12739. ..... 22222 ..... 44444
  12740. @end example
  12741. @item interleave_top, 4
  12742. Interleave the upper field from odd frames with the lower field from
  12743. even frames, generating a frame with unchanged height at half frame rate.
  12744. @example
  12745. ------> time
  12746. Input:
  12747. Frame 1 Frame 2 Frame 3 Frame 4
  12748. 11111<- 22222 33333<- 44444
  12749. 11111 22222<- 33333 44444<-
  12750. 11111<- 22222 33333<- 44444
  12751. 11111 22222<- 33333 44444<-
  12752. Output:
  12753. 11111 33333
  12754. 22222 44444
  12755. 11111 33333
  12756. 22222 44444
  12757. @end example
  12758. @item interleave_bottom, 5
  12759. Interleave the lower field from odd frames with the upper field from
  12760. even frames, generating a frame with unchanged height at half frame rate.
  12761. @example
  12762. ------> time
  12763. Input:
  12764. Frame 1 Frame 2 Frame 3 Frame 4
  12765. 11111 22222<- 33333 44444<-
  12766. 11111<- 22222 33333<- 44444
  12767. 11111 22222<- 33333 44444<-
  12768. 11111<- 22222 33333<- 44444
  12769. Output:
  12770. 22222 44444
  12771. 11111 33333
  12772. 22222 44444
  12773. 11111 33333
  12774. @end example
  12775. @item interlacex2, 6
  12776. Double frame rate with unchanged height. Frames are inserted each
  12777. containing the second temporal field from the previous input frame and
  12778. the first temporal field from the next input frame. This mode relies on
  12779. the top_field_first flag. Useful for interlaced video displays with no
  12780. field synchronisation.
  12781. @example
  12782. ------> time
  12783. Input:
  12784. Frame 1 Frame 2 Frame 3 Frame 4
  12785. 11111 22222 33333 44444
  12786. 11111 22222 33333 44444
  12787. 11111 22222 33333 44444
  12788. 11111 22222 33333 44444
  12789. Output:
  12790. 11111 22222 22222 33333 33333 44444 44444
  12791. 11111 11111 22222 22222 33333 33333 44444
  12792. 11111 22222 22222 33333 33333 44444 44444
  12793. 11111 11111 22222 22222 33333 33333 44444
  12794. @end example
  12795. @item mergex2, 7
  12796. Move odd frames into the upper field, even into the lower field,
  12797. generating a double height frame at same frame rate.
  12798. @example
  12799. ------> time
  12800. Input:
  12801. Frame 1 Frame 2 Frame 3 Frame 4
  12802. 11111 22222 33333 44444
  12803. 11111 22222 33333 44444
  12804. 11111 22222 33333 44444
  12805. 11111 22222 33333 44444
  12806. Output:
  12807. 11111 33333 33333 55555
  12808. 22222 22222 44444 44444
  12809. 11111 33333 33333 55555
  12810. 22222 22222 44444 44444
  12811. 11111 33333 33333 55555
  12812. 22222 22222 44444 44444
  12813. 11111 33333 33333 55555
  12814. 22222 22222 44444 44444
  12815. @end example
  12816. @end table
  12817. Numeric values are deprecated but are accepted for backward
  12818. compatibility reasons.
  12819. Default mode is @code{merge}.
  12820. @item flags
  12821. Specify flags influencing the filter process.
  12822. Available value for @var{flags} is:
  12823. @table @option
  12824. @item low_pass_filter, vlfp
  12825. Enable linear vertical low-pass filtering in the filter.
  12826. Vertical low-pass filtering is required when creating an interlaced
  12827. destination from a progressive source which contains high-frequency
  12828. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12829. patterning.
  12830. @item complex_filter, cvlfp
  12831. Enable complex vertical low-pass filtering.
  12832. This will slightly less reduce interlace 'twitter' and Moire
  12833. patterning but better retain detail and subjective sharpness impression.
  12834. @end table
  12835. Vertical low-pass filtering can only be enabled for @option{mode}
  12836. @var{interleave_top} and @var{interleave_bottom}.
  12837. @end table
  12838. @section tmix
  12839. Mix successive video frames.
  12840. A description of the accepted options follows.
  12841. @table @option
  12842. @item frames
  12843. The number of successive frames to mix. If unspecified, it defaults to 3.
  12844. @item weights
  12845. Specify weight of each input video frame.
  12846. Each weight is separated by space. If number of weights is smaller than
  12847. number of @var{frames} last specified weight will be used for all remaining
  12848. unset weights.
  12849. @item scale
  12850. Specify scale, if it is set it will be multiplied with sum
  12851. of each weight multiplied with pixel values to give final destination
  12852. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12853. @end table
  12854. @subsection Examples
  12855. @itemize
  12856. @item
  12857. Average 7 successive frames:
  12858. @example
  12859. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12860. @end example
  12861. @item
  12862. Apply simple temporal convolution:
  12863. @example
  12864. tmix=frames=3:weights="-1 3 -1"
  12865. @end example
  12866. @item
  12867. Similar as above but only showing temporal differences:
  12868. @example
  12869. tmix=frames=3:weights="-1 2 -1":scale=1
  12870. @end example
  12871. @end itemize
  12872. @anchor{tonemap}
  12873. @section tonemap
  12874. Tone map colors from different dynamic ranges.
  12875. This filter expects data in single precision floating point, as it needs to
  12876. operate on (and can output) out-of-range values. Another filter, such as
  12877. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12878. The tonemapping algorithms implemented only work on linear light, so input
  12879. data should be linearized beforehand (and possibly correctly tagged).
  12880. @example
  12881. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12882. @end example
  12883. @subsection Options
  12884. The filter accepts the following options.
  12885. @table @option
  12886. @item tonemap
  12887. Set the tone map algorithm to use.
  12888. Possible values are:
  12889. @table @var
  12890. @item none
  12891. Do not apply any tone map, only desaturate overbright pixels.
  12892. @item clip
  12893. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12894. in-range values, while distorting out-of-range values.
  12895. @item linear
  12896. Stretch the entire reference gamut to a linear multiple of the display.
  12897. @item gamma
  12898. Fit a logarithmic transfer between the tone curves.
  12899. @item reinhard
  12900. Preserve overall image brightness with a simple curve, using nonlinear
  12901. contrast, which results in flattening details and degrading color accuracy.
  12902. @item hable
  12903. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12904. of slightly darkening everything. Use it when detail preservation is more
  12905. important than color and brightness accuracy.
  12906. @item mobius
  12907. Smoothly map out-of-range values, while retaining contrast and colors for
  12908. in-range material as much as possible. Use it when color accuracy is more
  12909. important than detail preservation.
  12910. @end table
  12911. Default is none.
  12912. @item param
  12913. Tune the tone mapping algorithm.
  12914. This affects the following algorithms:
  12915. @table @var
  12916. @item none
  12917. Ignored.
  12918. @item linear
  12919. Specifies the scale factor to use while stretching.
  12920. Default to 1.0.
  12921. @item gamma
  12922. Specifies the exponent of the function.
  12923. Default to 1.8.
  12924. @item clip
  12925. Specify an extra linear coefficient to multiply into the signal before clipping.
  12926. Default to 1.0.
  12927. @item reinhard
  12928. Specify the local contrast coefficient at the display peak.
  12929. Default to 0.5, which means that in-gamut values will be about half as bright
  12930. as when clipping.
  12931. @item hable
  12932. Ignored.
  12933. @item mobius
  12934. Specify the transition point from linear to mobius transform. Every value
  12935. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12936. more accurate the result will be, at the cost of losing bright details.
  12937. Default to 0.3, which due to the steep initial slope still preserves in-range
  12938. colors fairly accurately.
  12939. @end table
  12940. @item desat
  12941. Apply desaturation for highlights that exceed this level of brightness. The
  12942. higher the parameter, the more color information will be preserved. This
  12943. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12944. (smoothly) turning into white instead. This makes images feel more natural,
  12945. at the cost of reducing information about out-of-range colors.
  12946. The default of 2.0 is somewhat conservative and will mostly just apply to
  12947. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12948. This option works only if the input frame has a supported color tag.
  12949. @item peak
  12950. Override signal/nominal/reference peak with this value. Useful when the
  12951. embedded peak information in display metadata is not reliable or when tone
  12952. mapping from a lower range to a higher range.
  12953. @end table
  12954. @section tpad
  12955. Temporarily pad video frames.
  12956. The filter accepts the following options:
  12957. @table @option
  12958. @item start
  12959. Specify number of delay frames before input video stream.
  12960. @item stop
  12961. Specify number of padding frames after input video stream.
  12962. Set to -1 to pad indefinitely.
  12963. @item start_mode
  12964. Set kind of frames added to beginning of stream.
  12965. Can be either @var{add} or @var{clone}.
  12966. With @var{add} frames of solid-color are added.
  12967. With @var{clone} frames are clones of first frame.
  12968. @item stop_mode
  12969. Set kind of frames added to end of stream.
  12970. Can be either @var{add} or @var{clone}.
  12971. With @var{add} frames of solid-color are added.
  12972. With @var{clone} frames are clones of last frame.
  12973. @item start_duration, stop_duration
  12974. Specify the duration of the start/stop delay. See
  12975. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12976. for the accepted syntax.
  12977. These options override @var{start} and @var{stop}.
  12978. @item color
  12979. Specify the color of the padded area. For the syntax of this option,
  12980. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12981. manual,ffmpeg-utils}.
  12982. The default value of @var{color} is "black".
  12983. @end table
  12984. @anchor{transpose}
  12985. @section transpose
  12986. Transpose rows with columns in the input video and optionally flip it.
  12987. It accepts the following parameters:
  12988. @table @option
  12989. @item dir
  12990. Specify the transposition direction.
  12991. Can assume the following values:
  12992. @table @samp
  12993. @item 0, 4, cclock_flip
  12994. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12995. @example
  12996. L.R L.l
  12997. . . -> . .
  12998. l.r R.r
  12999. @end example
  13000. @item 1, 5, clock
  13001. Rotate by 90 degrees clockwise, that is:
  13002. @example
  13003. L.R l.L
  13004. . . -> . .
  13005. l.r r.R
  13006. @end example
  13007. @item 2, 6, cclock
  13008. Rotate by 90 degrees counterclockwise, that is:
  13009. @example
  13010. L.R R.r
  13011. . . -> . .
  13012. l.r L.l
  13013. @end example
  13014. @item 3, 7, clock_flip
  13015. Rotate by 90 degrees clockwise and vertically flip, that is:
  13016. @example
  13017. L.R r.R
  13018. . . -> . .
  13019. l.r l.L
  13020. @end example
  13021. @end table
  13022. For values between 4-7, the transposition is only done if the input
  13023. video geometry is portrait and not landscape. These values are
  13024. deprecated, the @code{passthrough} option should be used instead.
  13025. Numerical values are deprecated, and should be dropped in favor of
  13026. symbolic constants.
  13027. @item passthrough
  13028. Do not apply the transposition if the input geometry matches the one
  13029. specified by the specified value. It accepts the following values:
  13030. @table @samp
  13031. @item none
  13032. Always apply transposition.
  13033. @item portrait
  13034. Preserve portrait geometry (when @var{height} >= @var{width}).
  13035. @item landscape
  13036. Preserve landscape geometry (when @var{width} >= @var{height}).
  13037. @end table
  13038. Default value is @code{none}.
  13039. @end table
  13040. For example to rotate by 90 degrees clockwise and preserve portrait
  13041. layout:
  13042. @example
  13043. transpose=dir=1:passthrough=portrait
  13044. @end example
  13045. The command above can also be specified as:
  13046. @example
  13047. transpose=1:portrait
  13048. @end example
  13049. @section transpose_npp
  13050. Transpose rows with columns in the input video and optionally flip it.
  13051. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13052. It accepts the following parameters:
  13053. @table @option
  13054. @item dir
  13055. Specify the transposition direction.
  13056. Can assume the following values:
  13057. @table @samp
  13058. @item cclock_flip
  13059. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13060. @item clock
  13061. Rotate by 90 degrees clockwise.
  13062. @item cclock
  13063. Rotate by 90 degrees counterclockwise.
  13064. @item clock_flip
  13065. Rotate by 90 degrees clockwise and vertically flip.
  13066. @end table
  13067. @item passthrough
  13068. Do not apply the transposition if the input geometry matches the one
  13069. specified by the specified value. It accepts the following values:
  13070. @table @samp
  13071. @item none
  13072. Always apply transposition. (default)
  13073. @item portrait
  13074. Preserve portrait geometry (when @var{height} >= @var{width}).
  13075. @item landscape
  13076. Preserve landscape geometry (when @var{width} >= @var{height}).
  13077. @end table
  13078. @end table
  13079. @section trim
  13080. Trim the input so that the output contains one continuous subpart of the input.
  13081. It accepts the following parameters:
  13082. @table @option
  13083. @item start
  13084. Specify the time of the start of the kept section, i.e. the frame with the
  13085. timestamp @var{start} will be the first frame in the output.
  13086. @item end
  13087. Specify the time of the first frame that will be dropped, i.e. the frame
  13088. immediately preceding the one with the timestamp @var{end} will be the last
  13089. frame in the output.
  13090. @item start_pts
  13091. This is the same as @var{start}, except this option sets the start timestamp
  13092. in timebase units instead of seconds.
  13093. @item end_pts
  13094. This is the same as @var{end}, except this option sets the end timestamp
  13095. in timebase units instead of seconds.
  13096. @item duration
  13097. The maximum duration of the output in seconds.
  13098. @item start_frame
  13099. The number of the first frame that should be passed to the output.
  13100. @item end_frame
  13101. The number of the first frame that should be dropped.
  13102. @end table
  13103. @option{start}, @option{end}, and @option{duration} are expressed as time
  13104. duration specifications; see
  13105. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13106. for the accepted syntax.
  13107. Note that the first two sets of the start/end options and the @option{duration}
  13108. option look at the frame timestamp, while the _frame variants simply count the
  13109. frames that pass through the filter. Also note that this filter does not modify
  13110. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13111. setpts filter after the trim filter.
  13112. If multiple start or end options are set, this filter tries to be greedy and
  13113. keep all the frames that match at least one of the specified constraints. To keep
  13114. only the part that matches all the constraints at once, chain multiple trim
  13115. filters.
  13116. The defaults are such that all the input is kept. So it is possible to set e.g.
  13117. just the end values to keep everything before the specified time.
  13118. Examples:
  13119. @itemize
  13120. @item
  13121. Drop everything except the second minute of input:
  13122. @example
  13123. ffmpeg -i INPUT -vf trim=60:120
  13124. @end example
  13125. @item
  13126. Keep only the first second:
  13127. @example
  13128. ffmpeg -i INPUT -vf trim=duration=1
  13129. @end example
  13130. @end itemize
  13131. @section unpremultiply
  13132. Apply alpha unpremultiply effect to input video stream using first plane
  13133. of second stream as alpha.
  13134. Both streams must have same dimensions and same pixel format.
  13135. The filter accepts the following option:
  13136. @table @option
  13137. @item planes
  13138. Set which planes will be processed, unprocessed planes will be copied.
  13139. By default value 0xf, all planes will be processed.
  13140. If the format has 1 or 2 components, then luma is bit 0.
  13141. If the format has 3 or 4 components:
  13142. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13143. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13144. If present, the alpha channel is always the last bit.
  13145. @item inplace
  13146. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13147. @end table
  13148. @anchor{unsharp}
  13149. @section unsharp
  13150. Sharpen or blur the input video.
  13151. It accepts the following parameters:
  13152. @table @option
  13153. @item luma_msize_x, lx
  13154. Set the luma matrix horizontal size. It must be an odd integer between
  13155. 3 and 23. The default value is 5.
  13156. @item luma_msize_y, ly
  13157. Set the luma matrix vertical size. It must be an odd integer between 3
  13158. and 23. The default value is 5.
  13159. @item luma_amount, la
  13160. Set the luma effect strength. It must be a floating point number, reasonable
  13161. values lay between -1.5 and 1.5.
  13162. Negative values will blur the input video, while positive values will
  13163. sharpen it, a value of zero will disable the effect.
  13164. Default value is 1.0.
  13165. @item chroma_msize_x, cx
  13166. Set the chroma matrix horizontal size. It must be an odd integer
  13167. between 3 and 23. The default value is 5.
  13168. @item chroma_msize_y, cy
  13169. Set the chroma matrix vertical size. It must be an odd integer
  13170. between 3 and 23. The default value is 5.
  13171. @item chroma_amount, ca
  13172. Set the chroma effect strength. It must be a floating point number, reasonable
  13173. values lay between -1.5 and 1.5.
  13174. Negative values will blur the input video, while positive values will
  13175. sharpen it, a value of zero will disable the effect.
  13176. Default value is 0.0.
  13177. @end table
  13178. All parameters are optional and default to the equivalent of the
  13179. string '5:5:1.0:5:5:0.0'.
  13180. @subsection Examples
  13181. @itemize
  13182. @item
  13183. Apply strong luma sharpen effect:
  13184. @example
  13185. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13186. @end example
  13187. @item
  13188. Apply a strong blur of both luma and chroma parameters:
  13189. @example
  13190. unsharp=7:7:-2:7:7:-2
  13191. @end example
  13192. @end itemize
  13193. @section uspp
  13194. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13195. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13196. shifts and average the results.
  13197. The way this differs from the behavior of spp is that uspp actually encodes &
  13198. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13199. DCT similar to MJPEG.
  13200. The filter accepts the following options:
  13201. @table @option
  13202. @item quality
  13203. Set quality. This option defines the number of levels for averaging. It accepts
  13204. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13205. effect. A value of @code{8} means the higher quality. For each increment of
  13206. that value the speed drops by a factor of approximately 2. Default value is
  13207. @code{3}.
  13208. @item qp
  13209. Force a constant quantization parameter. If not set, the filter will use the QP
  13210. from the video stream (if available).
  13211. @end table
  13212. @section vaguedenoiser
  13213. Apply a wavelet based denoiser.
  13214. It transforms each frame from the video input into the wavelet domain,
  13215. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13216. the obtained coefficients. It does an inverse wavelet transform after.
  13217. Due to wavelet properties, it should give a nice smoothed result, and
  13218. reduced noise, without blurring picture features.
  13219. This filter accepts the following options:
  13220. @table @option
  13221. @item threshold
  13222. The filtering strength. The higher, the more filtered the video will be.
  13223. Hard thresholding can use a higher threshold than soft thresholding
  13224. before the video looks overfiltered. Default value is 2.
  13225. @item method
  13226. The filtering method the filter will use.
  13227. It accepts the following values:
  13228. @table @samp
  13229. @item hard
  13230. All values under the threshold will be zeroed.
  13231. @item soft
  13232. All values under the threshold will be zeroed. All values above will be
  13233. reduced by the threshold.
  13234. @item garrote
  13235. Scales or nullifies coefficients - intermediary between (more) soft and
  13236. (less) hard thresholding.
  13237. @end table
  13238. Default is garrote.
  13239. @item nsteps
  13240. Number of times, the wavelet will decompose the picture. Picture can't
  13241. be decomposed beyond a particular point (typically, 8 for a 640x480
  13242. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13243. @item percent
  13244. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13245. @item planes
  13246. A list of the planes to process. By default all planes are processed.
  13247. @end table
  13248. @section vectorscope
  13249. Display 2 color component values in the two dimensional graph (which is called
  13250. a vectorscope).
  13251. This filter accepts the following options:
  13252. @table @option
  13253. @item mode, m
  13254. Set vectorscope mode.
  13255. It accepts the following values:
  13256. @table @samp
  13257. @item gray
  13258. Gray values are displayed on graph, higher brightness means more pixels have
  13259. same component color value on location in graph. This is the default mode.
  13260. @item color
  13261. Gray values are displayed on graph. Surrounding pixels values which are not
  13262. present in video frame are drawn in gradient of 2 color components which are
  13263. set by option @code{x} and @code{y}. The 3rd color component is static.
  13264. @item color2
  13265. Actual color components values present in video frame are displayed on graph.
  13266. @item color3
  13267. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13268. on graph increases value of another color component, which is luminance by
  13269. default values of @code{x} and @code{y}.
  13270. @item color4
  13271. Actual colors present in video frame are displayed on graph. If two different
  13272. colors map to same position on graph then color with higher value of component
  13273. not present in graph is picked.
  13274. @item color5
  13275. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13276. component picked from radial gradient.
  13277. @end table
  13278. @item x
  13279. Set which color component will be represented on X-axis. Default is @code{1}.
  13280. @item y
  13281. Set which color component will be represented on Y-axis. Default is @code{2}.
  13282. @item intensity, i
  13283. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13284. of color component which represents frequency of (X, Y) location in graph.
  13285. @item envelope, e
  13286. @table @samp
  13287. @item none
  13288. No envelope, this is default.
  13289. @item instant
  13290. Instant envelope, even darkest single pixel will be clearly highlighted.
  13291. @item peak
  13292. Hold maximum and minimum values presented in graph over time. This way you
  13293. can still spot out of range values without constantly looking at vectorscope.
  13294. @item peak+instant
  13295. Peak and instant envelope combined together.
  13296. @end table
  13297. @item graticule, g
  13298. Set what kind of graticule to draw.
  13299. @table @samp
  13300. @item none
  13301. @item green
  13302. @item color
  13303. @end table
  13304. @item opacity, o
  13305. Set graticule opacity.
  13306. @item flags, f
  13307. Set graticule flags.
  13308. @table @samp
  13309. @item white
  13310. Draw graticule for white point.
  13311. @item black
  13312. Draw graticule for black point.
  13313. @item name
  13314. Draw color points short names.
  13315. @end table
  13316. @item bgopacity, b
  13317. Set background opacity.
  13318. @item lthreshold, l
  13319. Set low threshold for color component not represented on X or Y axis.
  13320. Values lower than this value will be ignored. Default is 0.
  13321. Note this value is multiplied with actual max possible value one pixel component
  13322. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13323. is 0.1 * 255 = 25.
  13324. @item hthreshold, h
  13325. Set high threshold for color component not represented on X or Y axis.
  13326. Values higher than this value will be ignored. Default is 1.
  13327. Note this value is multiplied with actual max possible value one pixel component
  13328. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13329. is 0.9 * 255 = 230.
  13330. @item colorspace, c
  13331. Set what kind of colorspace to use when drawing graticule.
  13332. @table @samp
  13333. @item auto
  13334. @item 601
  13335. @item 709
  13336. @end table
  13337. Default is auto.
  13338. @end table
  13339. @anchor{vidstabdetect}
  13340. @section vidstabdetect
  13341. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13342. @ref{vidstabtransform} for pass 2.
  13343. This filter generates a file with relative translation and rotation
  13344. transform information about subsequent frames, which is then used by
  13345. the @ref{vidstabtransform} filter.
  13346. To enable compilation of this filter you need to configure FFmpeg with
  13347. @code{--enable-libvidstab}.
  13348. This filter accepts the following options:
  13349. @table @option
  13350. @item result
  13351. Set the path to the file used to write the transforms information.
  13352. Default value is @file{transforms.trf}.
  13353. @item shakiness
  13354. Set how shaky the video is and how quick the camera is. It accepts an
  13355. integer in the range 1-10, a value of 1 means little shakiness, a
  13356. value of 10 means strong shakiness. Default value is 5.
  13357. @item accuracy
  13358. Set the accuracy of the detection process. It must be a value in the
  13359. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13360. accuracy. Default value is 15.
  13361. @item stepsize
  13362. Set stepsize of the search process. The region around minimum is
  13363. scanned with 1 pixel resolution. Default value is 6.
  13364. @item mincontrast
  13365. Set minimum contrast. Below this value a local measurement field is
  13366. discarded. Must be a floating point value in the range 0-1. Default
  13367. value is 0.3.
  13368. @item tripod
  13369. Set reference frame number for tripod mode.
  13370. If enabled, the motion of the frames is compared to a reference frame
  13371. in the filtered stream, identified by the specified number. The idea
  13372. is to compensate all movements in a more-or-less static scene and keep
  13373. the camera view absolutely still.
  13374. If set to 0, it is disabled. The frames are counted starting from 1.
  13375. @item show
  13376. Show fields and transforms in the resulting frames. It accepts an
  13377. integer in the range 0-2. Default value is 0, which disables any
  13378. visualization.
  13379. @end table
  13380. @subsection Examples
  13381. @itemize
  13382. @item
  13383. Use default values:
  13384. @example
  13385. vidstabdetect
  13386. @end example
  13387. @item
  13388. Analyze strongly shaky movie and put the results in file
  13389. @file{mytransforms.trf}:
  13390. @example
  13391. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13392. @end example
  13393. @item
  13394. Visualize the result of internal transformations in the resulting
  13395. video:
  13396. @example
  13397. vidstabdetect=show=1
  13398. @end example
  13399. @item
  13400. Analyze a video with medium shakiness using @command{ffmpeg}:
  13401. @example
  13402. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13403. @end example
  13404. @end itemize
  13405. @anchor{vidstabtransform}
  13406. @section vidstabtransform
  13407. Video stabilization/deshaking: pass 2 of 2,
  13408. see @ref{vidstabdetect} for pass 1.
  13409. Read a file with transform information for each frame and
  13410. apply/compensate them. Together with the @ref{vidstabdetect}
  13411. filter this can be used to deshake videos. See also
  13412. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13413. the @ref{unsharp} filter, see below.
  13414. To enable compilation of this filter you need to configure FFmpeg with
  13415. @code{--enable-libvidstab}.
  13416. @subsection Options
  13417. @table @option
  13418. @item input
  13419. Set path to the file used to read the transforms. Default value is
  13420. @file{transforms.trf}.
  13421. @item smoothing
  13422. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13423. camera movements. Default value is 10.
  13424. For example a number of 10 means that 21 frames are used (10 in the
  13425. past and 10 in the future) to smoothen the motion in the video. A
  13426. larger value leads to a smoother video, but limits the acceleration of
  13427. the camera (pan/tilt movements). 0 is a special case where a static
  13428. camera is simulated.
  13429. @item optalgo
  13430. Set the camera path optimization algorithm.
  13431. Accepted values are:
  13432. @table @samp
  13433. @item gauss
  13434. gaussian kernel low-pass filter on camera motion (default)
  13435. @item avg
  13436. averaging on transformations
  13437. @end table
  13438. @item maxshift
  13439. Set maximal number of pixels to translate frames. Default value is -1,
  13440. meaning no limit.
  13441. @item maxangle
  13442. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13443. value is -1, meaning no limit.
  13444. @item crop
  13445. Specify how to deal with borders that may be visible due to movement
  13446. compensation.
  13447. Available values are:
  13448. @table @samp
  13449. @item keep
  13450. keep image information from previous frame (default)
  13451. @item black
  13452. fill the border black
  13453. @end table
  13454. @item invert
  13455. Invert transforms if set to 1. Default value is 0.
  13456. @item relative
  13457. Consider transforms as relative to previous frame if set to 1,
  13458. absolute if set to 0. Default value is 0.
  13459. @item zoom
  13460. Set percentage to zoom. A positive value will result in a zoom-in
  13461. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13462. zoom).
  13463. @item optzoom
  13464. Set optimal zooming to avoid borders.
  13465. Accepted values are:
  13466. @table @samp
  13467. @item 0
  13468. disabled
  13469. @item 1
  13470. optimal static zoom value is determined (only very strong movements
  13471. will lead to visible borders) (default)
  13472. @item 2
  13473. optimal adaptive zoom value is determined (no borders will be
  13474. visible), see @option{zoomspeed}
  13475. @end table
  13476. Note that the value given at zoom is added to the one calculated here.
  13477. @item zoomspeed
  13478. Set percent to zoom maximally each frame (enabled when
  13479. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13480. 0.25.
  13481. @item interpol
  13482. Specify type of interpolation.
  13483. Available values are:
  13484. @table @samp
  13485. @item no
  13486. no interpolation
  13487. @item linear
  13488. linear only horizontal
  13489. @item bilinear
  13490. linear in both directions (default)
  13491. @item bicubic
  13492. cubic in both directions (slow)
  13493. @end table
  13494. @item tripod
  13495. Enable virtual tripod mode if set to 1, which is equivalent to
  13496. @code{relative=0:smoothing=0}. Default value is 0.
  13497. Use also @code{tripod} option of @ref{vidstabdetect}.
  13498. @item debug
  13499. Increase log verbosity if set to 1. Also the detected global motions
  13500. are written to the temporary file @file{global_motions.trf}. Default
  13501. value is 0.
  13502. @end table
  13503. @subsection Examples
  13504. @itemize
  13505. @item
  13506. Use @command{ffmpeg} for a typical stabilization with default values:
  13507. @example
  13508. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13509. @end example
  13510. Note the use of the @ref{unsharp} filter which is always recommended.
  13511. @item
  13512. Zoom in a bit more and load transform data from a given file:
  13513. @example
  13514. vidstabtransform=zoom=5:input="mytransforms.trf"
  13515. @end example
  13516. @item
  13517. Smoothen the video even more:
  13518. @example
  13519. vidstabtransform=smoothing=30
  13520. @end example
  13521. @end itemize
  13522. @section vflip
  13523. Flip the input video vertically.
  13524. For example, to vertically flip a video with @command{ffmpeg}:
  13525. @example
  13526. ffmpeg -i in.avi -vf "vflip" out.avi
  13527. @end example
  13528. @section vfrdet
  13529. Detect variable frame rate video.
  13530. This filter tries to detect if the input is variable or constant frame rate.
  13531. At end it will output number of frames detected as having variable delta pts,
  13532. and ones with constant delta pts.
  13533. If there was frames with variable delta, than it will also show min and max delta
  13534. encountered.
  13535. @section vibrance
  13536. Boost or alter saturation.
  13537. The filter accepts the following options:
  13538. @table @option
  13539. @item intensity
  13540. Set strength of boost if positive value or strength of alter if negative value.
  13541. Default is 0. Allowed range is from -2 to 2.
  13542. @item rbal
  13543. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13544. @item gbal
  13545. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13546. @item bbal
  13547. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13548. @item rlum
  13549. Set the red luma coefficient.
  13550. @item glum
  13551. Set the green luma coefficient.
  13552. @item blum
  13553. Set the blue luma coefficient.
  13554. @end table
  13555. @anchor{vignette}
  13556. @section vignette
  13557. Make or reverse a natural vignetting effect.
  13558. The filter accepts the following options:
  13559. @table @option
  13560. @item angle, a
  13561. Set lens angle expression as a number of radians.
  13562. The value is clipped in the @code{[0,PI/2]} range.
  13563. Default value: @code{"PI/5"}
  13564. @item x0
  13565. @item y0
  13566. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13567. by default.
  13568. @item mode
  13569. Set forward/backward mode.
  13570. Available modes are:
  13571. @table @samp
  13572. @item forward
  13573. The larger the distance from the central point, the darker the image becomes.
  13574. @item backward
  13575. The larger the distance from the central point, the brighter the image becomes.
  13576. This can be used to reverse a vignette effect, though there is no automatic
  13577. detection to extract the lens @option{angle} and other settings (yet). It can
  13578. also be used to create a burning effect.
  13579. @end table
  13580. Default value is @samp{forward}.
  13581. @item eval
  13582. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13583. It accepts the following values:
  13584. @table @samp
  13585. @item init
  13586. Evaluate expressions only once during the filter initialization.
  13587. @item frame
  13588. Evaluate expressions for each incoming frame. This is way slower than the
  13589. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13590. allows advanced dynamic expressions.
  13591. @end table
  13592. Default value is @samp{init}.
  13593. @item dither
  13594. Set dithering to reduce the circular banding effects. Default is @code{1}
  13595. (enabled).
  13596. @item aspect
  13597. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13598. Setting this value to the SAR of the input will make a rectangular vignetting
  13599. following the dimensions of the video.
  13600. Default is @code{1/1}.
  13601. @end table
  13602. @subsection Expressions
  13603. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13604. following parameters.
  13605. @table @option
  13606. @item w
  13607. @item h
  13608. input width and height
  13609. @item n
  13610. the number of input frame, starting from 0
  13611. @item pts
  13612. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13613. @var{TB} units, NAN if undefined
  13614. @item r
  13615. frame rate of the input video, NAN if the input frame rate is unknown
  13616. @item t
  13617. the PTS (Presentation TimeStamp) of the filtered video frame,
  13618. expressed in seconds, NAN if undefined
  13619. @item tb
  13620. time base of the input video
  13621. @end table
  13622. @subsection Examples
  13623. @itemize
  13624. @item
  13625. Apply simple strong vignetting effect:
  13626. @example
  13627. vignette=PI/4
  13628. @end example
  13629. @item
  13630. Make a flickering vignetting:
  13631. @example
  13632. vignette='PI/4+random(1)*PI/50':eval=frame
  13633. @end example
  13634. @end itemize
  13635. @section vmafmotion
  13636. Obtain the average vmaf motion score of a video.
  13637. It is one of the component filters of VMAF.
  13638. The obtained average motion score is printed through the logging system.
  13639. In the below example the input file @file{ref.mpg} is being processed and score
  13640. is computed.
  13641. @example
  13642. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13643. @end example
  13644. @section vstack
  13645. Stack input videos vertically.
  13646. All streams must be of same pixel format and of same width.
  13647. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13648. to create same output.
  13649. The filter accept the following option:
  13650. @table @option
  13651. @item inputs
  13652. Set number of input streams. Default is 2.
  13653. @item shortest
  13654. If set to 1, force the output to terminate when the shortest input
  13655. terminates. Default value is 0.
  13656. @end table
  13657. @section w3fdif
  13658. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13659. Deinterlacing Filter").
  13660. Based on the process described by Martin Weston for BBC R&D, and
  13661. implemented based on the de-interlace algorithm written by Jim
  13662. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13663. uses filter coefficients calculated by BBC R&D.
  13664. There are two sets of filter coefficients, so called "simple":
  13665. and "complex". Which set of filter coefficients is used can
  13666. be set by passing an optional parameter:
  13667. @table @option
  13668. @item filter
  13669. Set the interlacing filter coefficients. Accepts one of the following values:
  13670. @table @samp
  13671. @item simple
  13672. Simple filter coefficient set.
  13673. @item complex
  13674. More-complex filter coefficient set.
  13675. @end table
  13676. Default value is @samp{complex}.
  13677. @item deint
  13678. Specify which frames to deinterlace. Accept one of the following values:
  13679. @table @samp
  13680. @item all
  13681. Deinterlace all frames,
  13682. @item interlaced
  13683. Only deinterlace frames marked as interlaced.
  13684. @end table
  13685. Default value is @samp{all}.
  13686. @end table
  13687. @section waveform
  13688. Video waveform monitor.
  13689. The waveform monitor plots color component intensity. By default luminance
  13690. only. Each column of the waveform corresponds to a column of pixels in the
  13691. source video.
  13692. It accepts the following options:
  13693. @table @option
  13694. @item mode, m
  13695. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13696. In row mode, the graph on the left side represents color component value 0 and
  13697. the right side represents value = 255. In column mode, the top side represents
  13698. color component value = 0 and bottom side represents value = 255.
  13699. @item intensity, i
  13700. Set intensity. Smaller values are useful to find out how many values of the same
  13701. luminance are distributed across input rows/columns.
  13702. Default value is @code{0.04}. Allowed range is [0, 1].
  13703. @item mirror, r
  13704. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13705. In mirrored mode, higher values will be represented on the left
  13706. side for @code{row} mode and at the top for @code{column} mode. Default is
  13707. @code{1} (mirrored).
  13708. @item display, d
  13709. Set display mode.
  13710. It accepts the following values:
  13711. @table @samp
  13712. @item overlay
  13713. Presents information identical to that in the @code{parade}, except
  13714. that the graphs representing color components are superimposed directly
  13715. over one another.
  13716. This display mode makes it easier to spot relative differences or similarities
  13717. in overlapping areas of the color components that are supposed to be identical,
  13718. such as neutral whites, grays, or blacks.
  13719. @item stack
  13720. Display separate graph for the color components side by side in
  13721. @code{row} mode or one below the other in @code{column} mode.
  13722. @item parade
  13723. Display separate graph for the color components side by side in
  13724. @code{column} mode or one below the other in @code{row} mode.
  13725. Using this display mode makes it easy to spot color casts in the highlights
  13726. and shadows of an image, by comparing the contours of the top and the bottom
  13727. graphs of each waveform. Since whites, grays, and blacks are characterized
  13728. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13729. should display three waveforms of roughly equal width/height. If not, the
  13730. correction is easy to perform by making level adjustments the three waveforms.
  13731. @end table
  13732. Default is @code{stack}.
  13733. @item components, c
  13734. Set which color components to display. Default is 1, which means only luminance
  13735. or red color component if input is in RGB colorspace. If is set for example to
  13736. 7 it will display all 3 (if) available color components.
  13737. @item envelope, e
  13738. @table @samp
  13739. @item none
  13740. No envelope, this is default.
  13741. @item instant
  13742. Instant envelope, minimum and maximum values presented in graph will be easily
  13743. visible even with small @code{step} value.
  13744. @item peak
  13745. Hold minimum and maximum values presented in graph across time. This way you
  13746. can still spot out of range values without constantly looking at waveforms.
  13747. @item peak+instant
  13748. Peak and instant envelope combined together.
  13749. @end table
  13750. @item filter, f
  13751. @table @samp
  13752. @item lowpass
  13753. No filtering, this is default.
  13754. @item flat
  13755. Luma and chroma combined together.
  13756. @item aflat
  13757. Similar as above, but shows difference between blue and red chroma.
  13758. @item xflat
  13759. Similar as above, but use different colors.
  13760. @item chroma
  13761. Displays only chroma.
  13762. @item color
  13763. Displays actual color value on waveform.
  13764. @item acolor
  13765. Similar as above, but with luma showing frequency of chroma values.
  13766. @end table
  13767. @item graticule, g
  13768. Set which graticule to display.
  13769. @table @samp
  13770. @item none
  13771. Do not display graticule.
  13772. @item green
  13773. Display green graticule showing legal broadcast ranges.
  13774. @item orange
  13775. Display orange graticule showing legal broadcast ranges.
  13776. @end table
  13777. @item opacity, o
  13778. Set graticule opacity.
  13779. @item flags, fl
  13780. Set graticule flags.
  13781. @table @samp
  13782. @item numbers
  13783. Draw numbers above lines. By default enabled.
  13784. @item dots
  13785. Draw dots instead of lines.
  13786. @end table
  13787. @item scale, s
  13788. Set scale used for displaying graticule.
  13789. @table @samp
  13790. @item digital
  13791. @item millivolts
  13792. @item ire
  13793. @end table
  13794. Default is digital.
  13795. @item bgopacity, b
  13796. Set background opacity.
  13797. @end table
  13798. @section weave, doubleweave
  13799. The @code{weave} takes a field-based video input and join
  13800. each two sequential fields into single frame, producing a new double
  13801. height clip with half the frame rate and half the frame count.
  13802. The @code{doubleweave} works same as @code{weave} but without
  13803. halving frame rate and frame count.
  13804. It accepts the following option:
  13805. @table @option
  13806. @item first_field
  13807. Set first field. Available values are:
  13808. @table @samp
  13809. @item top, t
  13810. Set the frame as top-field-first.
  13811. @item bottom, b
  13812. Set the frame as bottom-field-first.
  13813. @end table
  13814. @end table
  13815. @subsection Examples
  13816. @itemize
  13817. @item
  13818. Interlace video using @ref{select} and @ref{separatefields} filter:
  13819. @example
  13820. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13821. @end example
  13822. @end itemize
  13823. @section xbr
  13824. Apply the xBR high-quality magnification filter which is designed for pixel
  13825. art. It follows a set of edge-detection rules, see
  13826. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13827. It accepts the following option:
  13828. @table @option
  13829. @item n
  13830. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13831. @code{3xBR} and @code{4} for @code{4xBR}.
  13832. Default is @code{3}.
  13833. @end table
  13834. @section xstack
  13835. Stack video inputs into custom layout.
  13836. All streams must be of same pixel format.
  13837. The filter accept the following option:
  13838. @table @option
  13839. @item inputs
  13840. Set number of input streams. Default is 2.
  13841. @item layout
  13842. Specify layout of inputs.
  13843. This option requires the desired layout configuration to be explicitly set by the user.
  13844. This sets position of each video input in output. Each input
  13845. is separated by '|'.
  13846. The first number represents the column, and the second number represents the row.
  13847. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13848. where X is video input from which to take width or height.
  13849. Multiple values can be used when separated by '+'. In such
  13850. case values are summed together.
  13851. @item shortest
  13852. If set to 1, force the output to terminate when the shortest input
  13853. terminates. Default value is 0.
  13854. @end table
  13855. @subsection Examples
  13856. @itemize
  13857. @item
  13858. Display 4 inputs into 2x2 grid,
  13859. note that if inputs are of different sizes unused gaps might appear,
  13860. as not all of output video is used.
  13861. @example
  13862. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13863. @end example
  13864. @item
  13865. Display 4 inputs into 1x4 grid,
  13866. note that if inputs are of different sizes unused gaps might appear,
  13867. as not all of output video is used.
  13868. @example
  13869. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13870. @end example
  13871. @item
  13872. Display 9 inputs into 3x3 grid,
  13873. note that if inputs are of different sizes unused gaps might appear,
  13874. as not all of output video is used.
  13875. @example
  13876. 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
  13877. @end example
  13878. @end itemize
  13879. @anchor{yadif}
  13880. @section yadif
  13881. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13882. filter").
  13883. It accepts the following parameters:
  13884. @table @option
  13885. @item mode
  13886. The interlacing mode to adopt. It accepts one of the following values:
  13887. @table @option
  13888. @item 0, send_frame
  13889. Output one frame for each frame.
  13890. @item 1, send_field
  13891. Output one frame for each field.
  13892. @item 2, send_frame_nospatial
  13893. Like @code{send_frame}, but it skips the spatial interlacing check.
  13894. @item 3, send_field_nospatial
  13895. Like @code{send_field}, but it skips the spatial interlacing check.
  13896. @end table
  13897. The default value is @code{send_frame}.
  13898. @item parity
  13899. The picture field parity assumed for the input interlaced video. It accepts one
  13900. of the following values:
  13901. @table @option
  13902. @item 0, tff
  13903. Assume the top field is first.
  13904. @item 1, bff
  13905. Assume the bottom field is first.
  13906. @item -1, auto
  13907. Enable automatic detection of field parity.
  13908. @end table
  13909. The default value is @code{auto}.
  13910. If the interlacing is unknown or the decoder does not export this information,
  13911. top field first will be assumed.
  13912. @item deint
  13913. Specify which frames to deinterlace. Accept one of the following
  13914. values:
  13915. @table @option
  13916. @item 0, all
  13917. Deinterlace all frames.
  13918. @item 1, interlaced
  13919. Only deinterlace frames marked as interlaced.
  13920. @end table
  13921. The default value is @code{all}.
  13922. @end table
  13923. @section yadif_cuda
  13924. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13925. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13926. and/or nvenc.
  13927. It accepts the following parameters:
  13928. @table @option
  13929. @item mode
  13930. The interlacing mode to adopt. It accepts one of the following values:
  13931. @table @option
  13932. @item 0, send_frame
  13933. Output one frame for each frame.
  13934. @item 1, send_field
  13935. Output one frame for each field.
  13936. @item 2, send_frame_nospatial
  13937. Like @code{send_frame}, but it skips the spatial interlacing check.
  13938. @item 3, send_field_nospatial
  13939. Like @code{send_field}, but it skips the spatial interlacing check.
  13940. @end table
  13941. The default value is @code{send_frame}.
  13942. @item parity
  13943. The picture field parity assumed for the input interlaced video. It accepts one
  13944. of the following values:
  13945. @table @option
  13946. @item 0, tff
  13947. Assume the top field is first.
  13948. @item 1, bff
  13949. Assume the bottom field is first.
  13950. @item -1, auto
  13951. Enable automatic detection of field parity.
  13952. @end table
  13953. The default value is @code{auto}.
  13954. If the interlacing is unknown or the decoder does not export this information,
  13955. top field first will be assumed.
  13956. @item deint
  13957. Specify which frames to deinterlace. Accept one of the following
  13958. values:
  13959. @table @option
  13960. @item 0, all
  13961. Deinterlace all frames.
  13962. @item 1, interlaced
  13963. Only deinterlace frames marked as interlaced.
  13964. @end table
  13965. The default value is @code{all}.
  13966. @end table
  13967. @section zoompan
  13968. Apply Zoom & Pan effect.
  13969. This filter accepts the following options:
  13970. @table @option
  13971. @item zoom, z
  13972. Set the zoom expression. Default is 1.
  13973. @item x
  13974. @item y
  13975. Set the x and y expression. Default is 0.
  13976. @item d
  13977. Set the duration expression in number of frames.
  13978. This sets for how many number of frames effect will last for
  13979. single input image.
  13980. @item s
  13981. Set the output image size, default is 'hd720'.
  13982. @item fps
  13983. Set the output frame rate, default is '25'.
  13984. @end table
  13985. Each expression can contain the following constants:
  13986. @table @option
  13987. @item in_w, iw
  13988. Input width.
  13989. @item in_h, ih
  13990. Input height.
  13991. @item out_w, ow
  13992. Output width.
  13993. @item out_h, oh
  13994. Output height.
  13995. @item in
  13996. Input frame count.
  13997. @item on
  13998. Output frame count.
  13999. @item x
  14000. @item y
  14001. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14002. for current input frame.
  14003. @item px
  14004. @item py
  14005. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14006. not yet such frame (first input frame).
  14007. @item zoom
  14008. Last calculated zoom from 'z' expression for current input frame.
  14009. @item pzoom
  14010. Last calculated zoom of last output frame of previous input frame.
  14011. @item duration
  14012. Number of output frames for current input frame. Calculated from 'd' expression
  14013. for each input frame.
  14014. @item pduration
  14015. number of output frames created for previous input frame
  14016. @item a
  14017. Rational number: input width / input height
  14018. @item sar
  14019. sample aspect ratio
  14020. @item dar
  14021. display aspect ratio
  14022. @end table
  14023. @subsection Examples
  14024. @itemize
  14025. @item
  14026. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14027. @example
  14028. 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
  14029. @end example
  14030. @item
  14031. Zoom-in up to 1.5 and pan always at center of picture:
  14032. @example
  14033. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14034. @end example
  14035. @item
  14036. Same as above but without pausing:
  14037. @example
  14038. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14039. @end example
  14040. @end itemize
  14041. @anchor{zscale}
  14042. @section zscale
  14043. Scale (resize) the input video, using the z.lib library:
  14044. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14045. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14046. The zscale filter forces the output display aspect ratio to be the same
  14047. as the input, by changing the output sample aspect ratio.
  14048. If the input image format is different from the format requested by
  14049. the next filter, the zscale filter will convert the input to the
  14050. requested format.
  14051. @subsection Options
  14052. The filter accepts the following options.
  14053. @table @option
  14054. @item width, w
  14055. @item height, h
  14056. Set the output video dimension expression. Default value is the input
  14057. dimension.
  14058. If the @var{width} or @var{w} value is 0, the input width is used for
  14059. the output. If the @var{height} or @var{h} value is 0, the input height
  14060. is used for the output.
  14061. If one and only one of the values is -n with n >= 1, the zscale filter
  14062. will use a value that maintains the aspect ratio of the input image,
  14063. calculated from the other specified dimension. After that it will,
  14064. however, make sure that the calculated dimension is divisible by n and
  14065. adjust the value if necessary.
  14066. If both values are -n with n >= 1, the behavior will be identical to
  14067. both values being set to 0 as previously detailed.
  14068. See below for the list of accepted constants for use in the dimension
  14069. expression.
  14070. @item size, s
  14071. Set the video size. For the syntax of this option, check the
  14072. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14073. @item dither, d
  14074. Set the dither type.
  14075. Possible values are:
  14076. @table @var
  14077. @item none
  14078. @item ordered
  14079. @item random
  14080. @item error_diffusion
  14081. @end table
  14082. Default is none.
  14083. @item filter, f
  14084. Set the resize filter type.
  14085. Possible values are:
  14086. @table @var
  14087. @item point
  14088. @item bilinear
  14089. @item bicubic
  14090. @item spline16
  14091. @item spline36
  14092. @item lanczos
  14093. @end table
  14094. Default is bilinear.
  14095. @item range, r
  14096. Set the color range.
  14097. Possible values are:
  14098. @table @var
  14099. @item input
  14100. @item limited
  14101. @item full
  14102. @end table
  14103. Default is same as input.
  14104. @item primaries, p
  14105. Set the color primaries.
  14106. Possible values are:
  14107. @table @var
  14108. @item input
  14109. @item 709
  14110. @item unspecified
  14111. @item 170m
  14112. @item 240m
  14113. @item 2020
  14114. @end table
  14115. Default is same as input.
  14116. @item transfer, t
  14117. Set the transfer characteristics.
  14118. Possible values are:
  14119. @table @var
  14120. @item input
  14121. @item 709
  14122. @item unspecified
  14123. @item 601
  14124. @item linear
  14125. @item 2020_10
  14126. @item 2020_12
  14127. @item smpte2084
  14128. @item iec61966-2-1
  14129. @item arib-std-b67
  14130. @end table
  14131. Default is same as input.
  14132. @item matrix, m
  14133. Set the colorspace matrix.
  14134. Possible value are:
  14135. @table @var
  14136. @item input
  14137. @item 709
  14138. @item unspecified
  14139. @item 470bg
  14140. @item 170m
  14141. @item 2020_ncl
  14142. @item 2020_cl
  14143. @end table
  14144. Default is same as input.
  14145. @item rangein, rin
  14146. Set the input color range.
  14147. Possible values are:
  14148. @table @var
  14149. @item input
  14150. @item limited
  14151. @item full
  14152. @end table
  14153. Default is same as input.
  14154. @item primariesin, pin
  14155. Set the input color primaries.
  14156. Possible values are:
  14157. @table @var
  14158. @item input
  14159. @item 709
  14160. @item unspecified
  14161. @item 170m
  14162. @item 240m
  14163. @item 2020
  14164. @end table
  14165. Default is same as input.
  14166. @item transferin, tin
  14167. Set the input transfer characteristics.
  14168. Possible values are:
  14169. @table @var
  14170. @item input
  14171. @item 709
  14172. @item unspecified
  14173. @item 601
  14174. @item linear
  14175. @item 2020_10
  14176. @item 2020_12
  14177. @end table
  14178. Default is same as input.
  14179. @item matrixin, min
  14180. Set the input colorspace matrix.
  14181. Possible value are:
  14182. @table @var
  14183. @item input
  14184. @item 709
  14185. @item unspecified
  14186. @item 470bg
  14187. @item 170m
  14188. @item 2020_ncl
  14189. @item 2020_cl
  14190. @end table
  14191. @item chromal, c
  14192. Set the output chroma location.
  14193. Possible values are:
  14194. @table @var
  14195. @item input
  14196. @item left
  14197. @item center
  14198. @item topleft
  14199. @item top
  14200. @item bottomleft
  14201. @item bottom
  14202. @end table
  14203. @item chromalin, cin
  14204. Set the input chroma location.
  14205. Possible values are:
  14206. @table @var
  14207. @item input
  14208. @item left
  14209. @item center
  14210. @item topleft
  14211. @item top
  14212. @item bottomleft
  14213. @item bottom
  14214. @end table
  14215. @item npl
  14216. Set the nominal peak luminance.
  14217. @end table
  14218. The values of the @option{w} and @option{h} options are expressions
  14219. containing the following constants:
  14220. @table @var
  14221. @item in_w
  14222. @item in_h
  14223. The input width and height
  14224. @item iw
  14225. @item ih
  14226. These are the same as @var{in_w} and @var{in_h}.
  14227. @item out_w
  14228. @item out_h
  14229. The output (scaled) width and height
  14230. @item ow
  14231. @item oh
  14232. These are the same as @var{out_w} and @var{out_h}
  14233. @item a
  14234. The same as @var{iw} / @var{ih}
  14235. @item sar
  14236. input sample aspect ratio
  14237. @item dar
  14238. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14239. @item hsub
  14240. @item vsub
  14241. horizontal and vertical input chroma subsample values. For example for the
  14242. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14243. @item ohsub
  14244. @item ovsub
  14245. horizontal and vertical output chroma subsample values. For example for the
  14246. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14247. @end table
  14248. @table @option
  14249. @end table
  14250. @c man end VIDEO FILTERS
  14251. @chapter OpenCL Video Filters
  14252. @c man begin OPENCL VIDEO FILTERS
  14253. Below is a description of the currently available OpenCL video filters.
  14254. To enable compilation of these filters you need to configure FFmpeg with
  14255. @code{--enable-opencl}.
  14256. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14257. @table @option
  14258. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14259. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14260. given device parameters.
  14261. @item -filter_hw_device @var{name}
  14262. Pass the hardware device called @var{name} to all filters in any filter graph.
  14263. @end table
  14264. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14265. @itemize
  14266. @item
  14267. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14268. @example
  14269. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14270. @end example
  14271. @end itemize
  14272. 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.
  14273. @section avgblur_opencl
  14274. Apply average blur filter.
  14275. The filter accepts the following options:
  14276. @table @option
  14277. @item sizeX
  14278. Set horizontal radius size.
  14279. Range is @code{[1, 1024]} and default value is @code{1}.
  14280. @item planes
  14281. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14282. @item sizeY
  14283. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14284. @end table
  14285. @subsection Example
  14286. @itemize
  14287. @item
  14288. 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.
  14289. @example
  14290. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14291. @end example
  14292. @end itemize
  14293. @section boxblur_opencl
  14294. Apply a boxblur algorithm to the input video.
  14295. It accepts the following parameters:
  14296. @table @option
  14297. @item luma_radius, lr
  14298. @item luma_power, lp
  14299. @item chroma_radius, cr
  14300. @item chroma_power, cp
  14301. @item alpha_radius, ar
  14302. @item alpha_power, ap
  14303. @end table
  14304. A description of the accepted options follows.
  14305. @table @option
  14306. @item luma_radius, lr
  14307. @item chroma_radius, cr
  14308. @item alpha_radius, ar
  14309. Set an expression for the box radius in pixels used for blurring the
  14310. corresponding input plane.
  14311. The radius value must be a non-negative number, and must not be
  14312. greater than the value of the expression @code{min(w,h)/2} for the
  14313. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14314. planes.
  14315. Default value for @option{luma_radius} is "2". If not specified,
  14316. @option{chroma_radius} and @option{alpha_radius} default to the
  14317. corresponding value set for @option{luma_radius}.
  14318. The expressions can contain the following constants:
  14319. @table @option
  14320. @item w
  14321. @item h
  14322. The input width and height in pixels.
  14323. @item cw
  14324. @item ch
  14325. The input chroma image width and height in pixels.
  14326. @item hsub
  14327. @item vsub
  14328. The horizontal and vertical chroma subsample values. For example, for the
  14329. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14330. @end table
  14331. @item luma_power, lp
  14332. @item chroma_power, cp
  14333. @item alpha_power, ap
  14334. Specify how many times the boxblur filter is applied to the
  14335. corresponding plane.
  14336. Default value for @option{luma_power} is 2. If not specified,
  14337. @option{chroma_power} and @option{alpha_power} default to the
  14338. corresponding value set for @option{luma_power}.
  14339. A value of 0 will disable the effect.
  14340. @end table
  14341. @subsection Examples
  14342. 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.
  14343. @itemize
  14344. @item
  14345. Apply a boxblur filter with the luma, chroma, and alpha radius
  14346. 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.
  14347. @example
  14348. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14349. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14350. @end example
  14351. @item
  14352. 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.
  14353. For the luma plane, a 2x2 box radius will be run once.
  14354. For the chroma plane, a 4x4 box radius will be run 5 times.
  14355. For the alpha plane, a 3x3 box radius will be run 7 times.
  14356. @example
  14357. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14358. @end example
  14359. @end itemize
  14360. @section convolution_opencl
  14361. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14362. The filter accepts the following options:
  14363. @table @option
  14364. @item 0m
  14365. @item 1m
  14366. @item 2m
  14367. @item 3m
  14368. Set matrix for each plane.
  14369. Matrix is sequence of 9, 25 or 49 signed numbers.
  14370. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14371. @item 0rdiv
  14372. @item 1rdiv
  14373. @item 2rdiv
  14374. @item 3rdiv
  14375. Set multiplier for calculated value for each plane.
  14376. If unset or 0, it will be sum of all matrix elements.
  14377. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14378. @item 0bias
  14379. @item 1bias
  14380. @item 2bias
  14381. @item 3bias
  14382. Set bias for each plane. This value is added to the result of the multiplication.
  14383. Useful for making the overall image brighter or darker.
  14384. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14385. @end table
  14386. @subsection Examples
  14387. @itemize
  14388. @item
  14389. Apply sharpen:
  14390. @example
  14391. -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
  14392. @end example
  14393. @item
  14394. Apply blur:
  14395. @example
  14396. -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
  14397. @end example
  14398. @item
  14399. Apply edge enhance:
  14400. @example
  14401. -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
  14402. @end example
  14403. @item
  14404. Apply edge detect:
  14405. @example
  14406. -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
  14407. @end example
  14408. @item
  14409. Apply laplacian edge detector which includes diagonals:
  14410. @example
  14411. -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
  14412. @end example
  14413. @item
  14414. Apply emboss:
  14415. @example
  14416. -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
  14417. @end example
  14418. @end itemize
  14419. @section dilation_opencl
  14420. Apply dilation effect to the video.
  14421. This filter replaces the pixel by the local(3x3) maximum.
  14422. It accepts the following options:
  14423. @table @option
  14424. @item threshold0
  14425. @item threshold1
  14426. @item threshold2
  14427. @item threshold3
  14428. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14429. If @code{0}, plane will remain unchanged.
  14430. @item coordinates
  14431. Flag which specifies the pixel to refer to.
  14432. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14433. Flags to local 3x3 coordinates region centered on @code{x}:
  14434. 1 2 3
  14435. 4 x 5
  14436. 6 7 8
  14437. @end table
  14438. @subsection Example
  14439. @itemize
  14440. @item
  14441. 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.
  14442. @example
  14443. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14444. @end example
  14445. @end itemize
  14446. @section erosion_opencl
  14447. Apply erosion effect to the video.
  14448. This filter replaces the pixel by the local(3x3) minimum.
  14449. It accepts the following options:
  14450. @table @option
  14451. @item threshold0
  14452. @item threshold1
  14453. @item threshold2
  14454. @item threshold3
  14455. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14456. If @code{0}, plane will remain unchanged.
  14457. @item coordinates
  14458. Flag which specifies the pixel to refer to.
  14459. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14460. Flags to local 3x3 coordinates region centered on @code{x}:
  14461. 1 2 3
  14462. 4 x 5
  14463. 6 7 8
  14464. @end table
  14465. @subsection Example
  14466. @itemize
  14467. @item
  14468. 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.
  14469. @example
  14470. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14471. @end example
  14472. @end itemize
  14473. @section overlay_opencl
  14474. Overlay one video on top of another.
  14475. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14476. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14477. The filter accepts the following options:
  14478. @table @option
  14479. @item x
  14480. Set the x coordinate of the overlaid video on the main video.
  14481. Default value is @code{0}.
  14482. @item y
  14483. Set the x coordinate of the overlaid video on the main video.
  14484. Default value is @code{0}.
  14485. @end table
  14486. @subsection Examples
  14487. @itemize
  14488. @item
  14489. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14490. @example
  14491. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14492. @end example
  14493. @item
  14494. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14495. @example
  14496. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14497. @end example
  14498. @end itemize
  14499. @section prewitt_opencl
  14500. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14501. The filter accepts the following option:
  14502. @table @option
  14503. @item planes
  14504. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14505. @item scale
  14506. Set value which will be multiplied with filtered result.
  14507. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14508. @item delta
  14509. Set value which will be added to filtered result.
  14510. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14511. @end table
  14512. @subsection Example
  14513. @itemize
  14514. @item
  14515. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14516. @example
  14517. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14518. @end example
  14519. @end itemize
  14520. @section roberts_opencl
  14521. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14522. The filter accepts the following option:
  14523. @table @option
  14524. @item planes
  14525. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14526. @item scale
  14527. Set value which will be multiplied with filtered result.
  14528. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14529. @item delta
  14530. Set value which will be added to filtered result.
  14531. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14532. @end table
  14533. @subsection Example
  14534. @itemize
  14535. @item
  14536. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14537. @example
  14538. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14539. @end example
  14540. @end itemize
  14541. @section sobel_opencl
  14542. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14543. The filter accepts the following option:
  14544. @table @option
  14545. @item planes
  14546. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14547. @item scale
  14548. Set value which will be multiplied with filtered result.
  14549. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14550. @item delta
  14551. Set value which will be added to filtered result.
  14552. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14553. @end table
  14554. @subsection Example
  14555. @itemize
  14556. @item
  14557. Apply sobel operator with scale set to 2 and delta set to 10
  14558. @example
  14559. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14560. @end example
  14561. @end itemize
  14562. @section tonemap_opencl
  14563. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14564. It accepts the following parameters:
  14565. @table @option
  14566. @item tonemap
  14567. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14568. @item param
  14569. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14570. @item desat
  14571. Apply desaturation for highlights that exceed this level of brightness. The
  14572. higher the parameter, the more color information will be preserved. This
  14573. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14574. (smoothly) turning into white instead. This makes images feel more natural,
  14575. at the cost of reducing information about out-of-range colors.
  14576. The default value is 0.5, and the algorithm here is a little different from
  14577. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14578. @item threshold
  14579. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14580. is used to detect whether the scene has changed or not. If the distance beween
  14581. the current frame average brightness and the current running average exceeds
  14582. a threshold value, we would re-calculate scene average and peak brightness.
  14583. The default value is 0.2.
  14584. @item format
  14585. Specify the output pixel format.
  14586. Currently supported formats are:
  14587. @table @var
  14588. @item p010
  14589. @item nv12
  14590. @end table
  14591. @item range, r
  14592. Set the output color range.
  14593. Possible values are:
  14594. @table @var
  14595. @item tv/mpeg
  14596. @item pc/jpeg
  14597. @end table
  14598. Default is same as input.
  14599. @item primaries, p
  14600. Set the output color primaries.
  14601. Possible values are:
  14602. @table @var
  14603. @item bt709
  14604. @item bt2020
  14605. @end table
  14606. Default is same as input.
  14607. @item transfer, t
  14608. Set the output transfer characteristics.
  14609. Possible values are:
  14610. @table @var
  14611. @item bt709
  14612. @item bt2020
  14613. @end table
  14614. Default is bt709.
  14615. @item matrix, m
  14616. Set the output colorspace matrix.
  14617. Possible value are:
  14618. @table @var
  14619. @item bt709
  14620. @item bt2020
  14621. @end table
  14622. Default is same as input.
  14623. @end table
  14624. @subsection Example
  14625. @itemize
  14626. @item
  14627. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14628. @example
  14629. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14630. @end example
  14631. @end itemize
  14632. @section unsharp_opencl
  14633. Sharpen or blur the input video.
  14634. It accepts the following parameters:
  14635. @table @option
  14636. @item luma_msize_x, lx
  14637. Set the luma matrix horizontal size.
  14638. Range is @code{[1, 23]} and default value is @code{5}.
  14639. @item luma_msize_y, ly
  14640. Set the luma matrix vertical size.
  14641. Range is @code{[1, 23]} and default value is @code{5}.
  14642. @item luma_amount, la
  14643. Set the luma effect strength.
  14644. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14645. Negative values will blur the input video, while positive values will
  14646. sharpen it, a value of zero will disable the effect.
  14647. @item chroma_msize_x, cx
  14648. Set the chroma matrix horizontal size.
  14649. Range is @code{[1, 23]} and default value is @code{5}.
  14650. @item chroma_msize_y, cy
  14651. Set the chroma matrix vertical size.
  14652. Range is @code{[1, 23]} and default value is @code{5}.
  14653. @item chroma_amount, ca
  14654. Set the chroma effect strength.
  14655. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14656. Negative values will blur the input video, while positive values will
  14657. sharpen it, a value of zero will disable the effect.
  14658. @end table
  14659. All parameters are optional and default to the equivalent of the
  14660. string '5:5:1.0:5:5:0.0'.
  14661. @subsection Examples
  14662. @itemize
  14663. @item
  14664. Apply strong luma sharpen effect:
  14665. @example
  14666. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14667. @end example
  14668. @item
  14669. Apply a strong blur of both luma and chroma parameters:
  14670. @example
  14671. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14672. @end example
  14673. @end itemize
  14674. @c man end OPENCL VIDEO FILTERS
  14675. @chapter Video Sources
  14676. @c man begin VIDEO SOURCES
  14677. Below is a description of the currently available video sources.
  14678. @section buffer
  14679. Buffer video frames, and make them available to the filter chain.
  14680. This source is mainly intended for a programmatic use, in particular
  14681. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14682. It accepts the following parameters:
  14683. @table @option
  14684. @item video_size
  14685. Specify the size (width and height) of the buffered video frames. For the
  14686. syntax of this option, check the
  14687. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14688. @item width
  14689. The input video width.
  14690. @item height
  14691. The input video height.
  14692. @item pix_fmt
  14693. A string representing the pixel format of the buffered video frames.
  14694. It may be a number corresponding to a pixel format, or a pixel format
  14695. name.
  14696. @item time_base
  14697. Specify the timebase assumed by the timestamps of the buffered frames.
  14698. @item frame_rate
  14699. Specify the frame rate expected for the video stream.
  14700. @item pixel_aspect, sar
  14701. The sample (pixel) aspect ratio of the input video.
  14702. @item sws_param
  14703. Specify the optional parameters to be used for the scale filter which
  14704. is automatically inserted when an input change is detected in the
  14705. input size or format.
  14706. @item hw_frames_ctx
  14707. When using a hardware pixel format, this should be a reference to an
  14708. AVHWFramesContext describing input frames.
  14709. @end table
  14710. For example:
  14711. @example
  14712. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14713. @end example
  14714. will instruct the source to accept video frames with size 320x240 and
  14715. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14716. square pixels (1:1 sample aspect ratio).
  14717. Since the pixel format with name "yuv410p" corresponds to the number 6
  14718. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14719. this example corresponds to:
  14720. @example
  14721. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14722. @end example
  14723. Alternatively, the options can be specified as a flat string, but this
  14724. syntax is deprecated:
  14725. @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}]
  14726. @section cellauto
  14727. Create a pattern generated by an elementary cellular automaton.
  14728. The initial state of the cellular automaton can be defined through the
  14729. @option{filename} and @option{pattern} options. If such options are
  14730. not specified an initial state is created randomly.
  14731. At each new frame a new row in the video is filled with the result of
  14732. the cellular automaton next generation. The behavior when the whole
  14733. frame is filled is defined by the @option{scroll} option.
  14734. This source accepts the following options:
  14735. @table @option
  14736. @item filename, f
  14737. Read the initial cellular automaton state, i.e. the starting row, from
  14738. the specified file.
  14739. In the file, each non-whitespace character is considered an alive
  14740. cell, a newline will terminate the row, and further characters in the
  14741. file will be ignored.
  14742. @item pattern, p
  14743. Read the initial cellular automaton state, i.e. the starting row, from
  14744. the specified string.
  14745. Each non-whitespace character in the string is considered an alive
  14746. cell, a newline will terminate the row, and further characters in the
  14747. string will be ignored.
  14748. @item rate, r
  14749. Set the video rate, that is the number of frames generated per second.
  14750. Default is 25.
  14751. @item random_fill_ratio, ratio
  14752. Set the random fill ratio for the initial cellular automaton row. It
  14753. is a floating point number value ranging from 0 to 1, defaults to
  14754. 1/PHI.
  14755. This option is ignored when a file or a pattern is specified.
  14756. @item random_seed, seed
  14757. Set the seed for filling randomly the initial row, must be an integer
  14758. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14759. set to -1, the filter will try to use a good random seed on a best
  14760. effort basis.
  14761. @item rule
  14762. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14763. Default value is 110.
  14764. @item size, s
  14765. Set the size of the output video. For the syntax of this option, check the
  14766. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14767. If @option{filename} or @option{pattern} is specified, the size is set
  14768. by default to the width of the specified initial state row, and the
  14769. height is set to @var{width} * PHI.
  14770. If @option{size} is set, it must contain the width of the specified
  14771. pattern string, and the specified pattern will be centered in the
  14772. larger row.
  14773. If a filename or a pattern string is not specified, the size value
  14774. defaults to "320x518" (used for a randomly generated initial state).
  14775. @item scroll
  14776. If set to 1, scroll the output upward when all the rows in the output
  14777. have been already filled. If set to 0, the new generated row will be
  14778. written over the top row just after the bottom row is filled.
  14779. Defaults to 1.
  14780. @item start_full, full
  14781. If set to 1, completely fill the output with generated rows before
  14782. outputting the first frame.
  14783. This is the default behavior, for disabling set the value to 0.
  14784. @item stitch
  14785. If set to 1, stitch the left and right row edges together.
  14786. This is the default behavior, for disabling set the value to 0.
  14787. @end table
  14788. @subsection Examples
  14789. @itemize
  14790. @item
  14791. Read the initial state from @file{pattern}, and specify an output of
  14792. size 200x400.
  14793. @example
  14794. cellauto=f=pattern:s=200x400
  14795. @end example
  14796. @item
  14797. Generate a random initial row with a width of 200 cells, with a fill
  14798. ratio of 2/3:
  14799. @example
  14800. cellauto=ratio=2/3:s=200x200
  14801. @end example
  14802. @item
  14803. Create a pattern generated by rule 18 starting by a single alive cell
  14804. centered on an initial row with width 100:
  14805. @example
  14806. cellauto=p=@@:s=100x400:full=0:rule=18
  14807. @end example
  14808. @item
  14809. Specify a more elaborated initial pattern:
  14810. @example
  14811. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14812. @end example
  14813. @end itemize
  14814. @anchor{coreimagesrc}
  14815. @section coreimagesrc
  14816. Video source generated on GPU using Apple's CoreImage API on OSX.
  14817. This video source is a specialized version of the @ref{coreimage} video filter.
  14818. Use a core image generator at the beginning of the applied filterchain to
  14819. generate the content.
  14820. The coreimagesrc video source accepts the following options:
  14821. @table @option
  14822. @item list_generators
  14823. List all available generators along with all their respective options as well as
  14824. possible minimum and maximum values along with the default values.
  14825. @example
  14826. list_generators=true
  14827. @end example
  14828. @item size, s
  14829. Specify the size of the sourced video. For the syntax of this option, check the
  14830. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14831. The default value is @code{320x240}.
  14832. @item rate, r
  14833. Specify the frame rate of the sourced video, as the number of frames
  14834. generated per second. It has to be a string in the format
  14835. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14836. number or a valid video frame rate abbreviation. The default value is
  14837. "25".
  14838. @item sar
  14839. Set the sample aspect ratio of the sourced video.
  14840. @item duration, d
  14841. Set the duration of the sourced video. See
  14842. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14843. for the accepted syntax.
  14844. If not specified, or the expressed duration is negative, the video is
  14845. supposed to be generated forever.
  14846. @end table
  14847. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14848. A complete filterchain can be used for further processing of the
  14849. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14850. and examples for details.
  14851. @subsection Examples
  14852. @itemize
  14853. @item
  14854. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14855. given as complete and escaped command-line for Apple's standard bash shell:
  14856. @example
  14857. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14858. @end example
  14859. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14860. need for a nullsrc video source.
  14861. @end itemize
  14862. @section mandelbrot
  14863. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14864. point specified with @var{start_x} and @var{start_y}.
  14865. This source accepts the following options:
  14866. @table @option
  14867. @item end_pts
  14868. Set the terminal pts value. Default value is 400.
  14869. @item end_scale
  14870. Set the terminal scale value.
  14871. Must be a floating point value. Default value is 0.3.
  14872. @item inner
  14873. Set the inner coloring mode, that is the algorithm used to draw the
  14874. Mandelbrot fractal internal region.
  14875. It shall assume one of the following values:
  14876. @table @option
  14877. @item black
  14878. Set black mode.
  14879. @item convergence
  14880. Show time until convergence.
  14881. @item mincol
  14882. Set color based on point closest to the origin of the iterations.
  14883. @item period
  14884. Set period mode.
  14885. @end table
  14886. Default value is @var{mincol}.
  14887. @item bailout
  14888. Set the bailout value. Default value is 10.0.
  14889. @item maxiter
  14890. Set the maximum of iterations performed by the rendering
  14891. algorithm. Default value is 7189.
  14892. @item outer
  14893. Set outer coloring mode.
  14894. It shall assume one of following values:
  14895. @table @option
  14896. @item iteration_count
  14897. Set iteration cound mode.
  14898. @item normalized_iteration_count
  14899. set normalized iteration count mode.
  14900. @end table
  14901. Default value is @var{normalized_iteration_count}.
  14902. @item rate, r
  14903. Set frame rate, expressed as number of frames per second. Default
  14904. value is "25".
  14905. @item size, s
  14906. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14907. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14908. @item start_scale
  14909. Set the initial scale value. Default value is 3.0.
  14910. @item start_x
  14911. Set the initial x position. Must be a floating point value between
  14912. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14913. @item start_y
  14914. Set the initial y position. Must be a floating point value between
  14915. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14916. @end table
  14917. @section mptestsrc
  14918. Generate various test patterns, as generated by the MPlayer test filter.
  14919. The size of the generated video is fixed, and is 256x256.
  14920. This source is useful in particular for testing encoding features.
  14921. This source accepts the following options:
  14922. @table @option
  14923. @item rate, r
  14924. Specify the frame rate of the sourced video, as the number of frames
  14925. generated per second. It has to be a string in the format
  14926. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14927. number or a valid video frame rate abbreviation. The default value is
  14928. "25".
  14929. @item duration, d
  14930. Set the duration of the sourced video. See
  14931. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14932. for the accepted syntax.
  14933. If not specified, or the expressed duration is negative, the video is
  14934. supposed to be generated forever.
  14935. @item test, t
  14936. Set the number or the name of the test to perform. Supported tests are:
  14937. @table @option
  14938. @item dc_luma
  14939. @item dc_chroma
  14940. @item freq_luma
  14941. @item freq_chroma
  14942. @item amp_luma
  14943. @item amp_chroma
  14944. @item cbp
  14945. @item mv
  14946. @item ring1
  14947. @item ring2
  14948. @item all
  14949. @end table
  14950. Default value is "all", which will cycle through the list of all tests.
  14951. @end table
  14952. Some examples:
  14953. @example
  14954. mptestsrc=t=dc_luma
  14955. @end example
  14956. will generate a "dc_luma" test pattern.
  14957. @section frei0r_src
  14958. Provide a frei0r source.
  14959. To enable compilation of this filter you need to install the frei0r
  14960. header and configure FFmpeg with @code{--enable-frei0r}.
  14961. This source accepts the following parameters:
  14962. @table @option
  14963. @item size
  14964. The size of the video to generate. For the syntax of this option, check the
  14965. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14966. @item framerate
  14967. The framerate of the generated video. It may be a string of the form
  14968. @var{num}/@var{den} or a frame rate abbreviation.
  14969. @item filter_name
  14970. The name to the frei0r source to load. For more information regarding frei0r and
  14971. how to set the parameters, read the @ref{frei0r} section in the video filters
  14972. documentation.
  14973. @item filter_params
  14974. A '|'-separated list of parameters to pass to the frei0r source.
  14975. @end table
  14976. For example, to generate a frei0r partik0l source with size 200x200
  14977. and frame rate 10 which is overlaid on the overlay filter main input:
  14978. @example
  14979. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14980. @end example
  14981. @section life
  14982. Generate a life pattern.
  14983. This source is based on a generalization of John Conway's life game.
  14984. The sourced input represents a life grid, each pixel represents a cell
  14985. which can be in one of two possible states, alive or dead. Every cell
  14986. interacts with its eight neighbours, which are the cells that are
  14987. horizontally, vertically, or diagonally adjacent.
  14988. At each interaction the grid evolves according to the adopted rule,
  14989. which specifies the number of neighbor alive cells which will make a
  14990. cell stay alive or born. The @option{rule} option allows one to specify
  14991. the rule to adopt.
  14992. This source accepts the following options:
  14993. @table @option
  14994. @item filename, f
  14995. Set the file from which to read the initial grid state. In the file,
  14996. each non-whitespace character is considered an alive cell, and newline
  14997. is used to delimit the end of each row.
  14998. If this option is not specified, the initial grid is generated
  14999. randomly.
  15000. @item rate, r
  15001. Set the video rate, that is the number of frames generated per second.
  15002. Default is 25.
  15003. @item random_fill_ratio, ratio
  15004. Set the random fill ratio for the initial random grid. It is a
  15005. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15006. It is ignored when a file is specified.
  15007. @item random_seed, seed
  15008. Set the seed for filling the initial random grid, must be an integer
  15009. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15010. set to -1, the filter will try to use a good random seed on a best
  15011. effort basis.
  15012. @item rule
  15013. Set the life rule.
  15014. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15015. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15016. @var{NS} specifies the number of alive neighbor cells which make a
  15017. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15018. which make a dead cell to become alive (i.e. to "born").
  15019. "s" and "b" can be used in place of "S" and "B", respectively.
  15020. Alternatively a rule can be specified by an 18-bits integer. The 9
  15021. high order bits are used to encode the next cell state if it is alive
  15022. for each number of neighbor alive cells, the low order bits specify
  15023. the rule for "borning" new cells. Higher order bits encode for an
  15024. higher number of neighbor cells.
  15025. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15026. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15027. Default value is "S23/B3", which is the original Conway's game of life
  15028. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15029. cells, and will born a new cell if there are three alive cells around
  15030. a dead cell.
  15031. @item size, s
  15032. Set the size of the output video. For the syntax of this option, check the
  15033. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15034. If @option{filename} is specified, the size is set by default to the
  15035. same size of the input file. If @option{size} is set, it must contain
  15036. the size specified in the input file, and the initial grid defined in
  15037. that file is centered in the larger resulting area.
  15038. If a filename is not specified, the size value defaults to "320x240"
  15039. (used for a randomly generated initial grid).
  15040. @item stitch
  15041. If set to 1, stitch the left and right grid edges together, and the
  15042. top and bottom edges also. Defaults to 1.
  15043. @item mold
  15044. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15045. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15046. value from 0 to 255.
  15047. @item life_color
  15048. Set the color of living (or new born) cells.
  15049. @item death_color
  15050. Set the color of dead cells. If @option{mold} is set, this is the first color
  15051. used to represent a dead cell.
  15052. @item mold_color
  15053. Set mold color, for definitely dead and moldy cells.
  15054. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15055. ffmpeg-utils manual,ffmpeg-utils}.
  15056. @end table
  15057. @subsection Examples
  15058. @itemize
  15059. @item
  15060. Read a grid from @file{pattern}, and center it on a grid of size
  15061. 300x300 pixels:
  15062. @example
  15063. life=f=pattern:s=300x300
  15064. @end example
  15065. @item
  15066. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15067. @example
  15068. life=ratio=2/3:s=200x200
  15069. @end example
  15070. @item
  15071. Specify a custom rule for evolving a randomly generated grid:
  15072. @example
  15073. life=rule=S14/B34
  15074. @end example
  15075. @item
  15076. Full example with slow death effect (mold) using @command{ffplay}:
  15077. @example
  15078. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15079. @end example
  15080. @end itemize
  15081. @anchor{allrgb}
  15082. @anchor{allyuv}
  15083. @anchor{color}
  15084. @anchor{haldclutsrc}
  15085. @anchor{nullsrc}
  15086. @anchor{pal75bars}
  15087. @anchor{pal100bars}
  15088. @anchor{rgbtestsrc}
  15089. @anchor{smptebars}
  15090. @anchor{smptehdbars}
  15091. @anchor{testsrc}
  15092. @anchor{testsrc2}
  15093. @anchor{yuvtestsrc}
  15094. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15095. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15096. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15097. The @code{color} source provides an uniformly colored input.
  15098. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15099. @ref{haldclut} filter.
  15100. The @code{nullsrc} source returns unprocessed video frames. It is
  15101. mainly useful to be employed in analysis / debugging tools, or as the
  15102. source for filters which ignore the input data.
  15103. The @code{pal75bars} source generates a color bars pattern, based on
  15104. EBU PAL recommendations with 75% color levels.
  15105. The @code{pal100bars} source generates a color bars pattern, based on
  15106. EBU PAL recommendations with 100% color levels.
  15107. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15108. detecting RGB vs BGR issues. You should see a red, green and blue
  15109. stripe from top to bottom.
  15110. The @code{smptebars} source generates a color bars pattern, based on
  15111. the SMPTE Engineering Guideline EG 1-1990.
  15112. The @code{smptehdbars} source generates a color bars pattern, based on
  15113. the SMPTE RP 219-2002.
  15114. The @code{testsrc} source generates a test video pattern, showing a
  15115. color pattern, a scrolling gradient and a timestamp. This is mainly
  15116. intended for testing purposes.
  15117. The @code{testsrc2} source is similar to testsrc, but supports more
  15118. pixel formats instead of just @code{rgb24}. This allows using it as an
  15119. input for other tests without requiring a format conversion.
  15120. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15121. see a y, cb and cr stripe from top to bottom.
  15122. The sources accept the following parameters:
  15123. @table @option
  15124. @item level
  15125. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15126. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15127. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15128. coded on a @code{1/(N*N)} scale.
  15129. @item color, c
  15130. Specify the color of the source, only available in the @code{color}
  15131. source. For the syntax of this option, check the
  15132. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15133. @item size, s
  15134. Specify the size of the sourced video. For the syntax of this option, check the
  15135. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15136. The default value is @code{320x240}.
  15137. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15138. @code{haldclutsrc} filters.
  15139. @item rate, r
  15140. Specify the frame rate of the sourced video, as the number of frames
  15141. generated per second. It has to be a string in the format
  15142. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15143. number or a valid video frame rate abbreviation. The default value is
  15144. "25".
  15145. @item duration, d
  15146. Set the duration of the sourced video. See
  15147. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15148. for the accepted syntax.
  15149. If not specified, or the expressed duration is negative, the video is
  15150. supposed to be generated forever.
  15151. @item sar
  15152. Set the sample aspect ratio of the sourced video.
  15153. @item alpha
  15154. Specify the alpha (opacity) of the background, only available in the
  15155. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15156. 255 (fully opaque, the default).
  15157. @item decimals, n
  15158. Set the number of decimals to show in the timestamp, only available in the
  15159. @code{testsrc} source.
  15160. The displayed timestamp value will correspond to the original
  15161. timestamp value multiplied by the power of 10 of the specified
  15162. value. Default value is 0.
  15163. @end table
  15164. @subsection Examples
  15165. @itemize
  15166. @item
  15167. Generate a video with a duration of 5.3 seconds, with size
  15168. 176x144 and a frame rate of 10 frames per second:
  15169. @example
  15170. testsrc=duration=5.3:size=qcif:rate=10
  15171. @end example
  15172. @item
  15173. The following graph description will generate a red source
  15174. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15175. frames per second:
  15176. @example
  15177. color=c=red@@0.2:s=qcif:r=10
  15178. @end example
  15179. @item
  15180. If the input content is to be ignored, @code{nullsrc} can be used. The
  15181. following command generates noise in the luminance plane by employing
  15182. the @code{geq} filter:
  15183. @example
  15184. nullsrc=s=256x256, geq=random(1)*255:128:128
  15185. @end example
  15186. @end itemize
  15187. @subsection Commands
  15188. The @code{color} source supports the following commands:
  15189. @table @option
  15190. @item c, color
  15191. Set the color of the created image. Accepts the same syntax of the
  15192. corresponding @option{color} option.
  15193. @end table
  15194. @section openclsrc
  15195. Generate video using an OpenCL program.
  15196. @table @option
  15197. @item source
  15198. OpenCL program source file.
  15199. @item kernel
  15200. Kernel name in program.
  15201. @item size, s
  15202. Size of frames to generate. This must be set.
  15203. @item format
  15204. Pixel format to use for the generated frames. This must be set.
  15205. @item rate, r
  15206. Number of frames generated every second. Default value is '25'.
  15207. @end table
  15208. For details of how the program loading works, see the @ref{program_opencl}
  15209. filter.
  15210. Example programs:
  15211. @itemize
  15212. @item
  15213. Generate a colour ramp by setting pixel values from the position of the pixel
  15214. in the output image. (Note that this will work with all pixel formats, but
  15215. the generated output will not be the same.)
  15216. @verbatim
  15217. __kernel void ramp(__write_only image2d_t dst,
  15218. unsigned int index)
  15219. {
  15220. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15221. float4 val;
  15222. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15223. write_imagef(dst, loc, val);
  15224. }
  15225. @end verbatim
  15226. @item
  15227. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15228. @verbatim
  15229. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15230. unsigned int index)
  15231. {
  15232. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15233. float4 value = 0.0f;
  15234. int x = loc.x + index;
  15235. int y = loc.y + index;
  15236. while (x > 0 || y > 0) {
  15237. if (x % 3 == 1 && y % 3 == 1) {
  15238. value = 1.0f;
  15239. break;
  15240. }
  15241. x /= 3;
  15242. y /= 3;
  15243. }
  15244. write_imagef(dst, loc, value);
  15245. }
  15246. @end verbatim
  15247. @end itemize
  15248. @c man end VIDEO SOURCES
  15249. @chapter Video Sinks
  15250. @c man begin VIDEO SINKS
  15251. Below is a description of the currently available video sinks.
  15252. @section buffersink
  15253. Buffer video frames, and make them available to the end of the filter
  15254. graph.
  15255. This sink is mainly intended for programmatic use, in particular
  15256. through the interface defined in @file{libavfilter/buffersink.h}
  15257. or the options system.
  15258. It accepts a pointer to an AVBufferSinkContext structure, which
  15259. defines the incoming buffers' formats, to be passed as the opaque
  15260. parameter to @code{avfilter_init_filter} for initialization.
  15261. @section nullsink
  15262. Null video sink: do absolutely nothing with the input video. It is
  15263. mainly useful as a template and for use in analysis / debugging
  15264. tools.
  15265. @c man end VIDEO SINKS
  15266. @chapter Multimedia Filters
  15267. @c man begin MULTIMEDIA FILTERS
  15268. Below is a description of the currently available multimedia filters.
  15269. @section abitscope
  15270. Convert input audio to a video output, displaying the audio bit scope.
  15271. The filter accepts the following options:
  15272. @table @option
  15273. @item rate, r
  15274. Set frame rate, expressed as number of frames per second. Default
  15275. value is "25".
  15276. @item size, s
  15277. Specify the video size for the output. For the syntax of this option, check the
  15278. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15279. Default value is @code{1024x256}.
  15280. @item colors
  15281. Specify list of colors separated by space or by '|' which will be used to
  15282. draw channels. Unrecognized or missing colors will be replaced
  15283. by white color.
  15284. @end table
  15285. @section ahistogram
  15286. Convert input audio to a video output, displaying the volume histogram.
  15287. The filter accepts the following options:
  15288. @table @option
  15289. @item dmode
  15290. Specify how histogram is calculated.
  15291. It accepts the following values:
  15292. @table @samp
  15293. @item single
  15294. Use single histogram for all channels.
  15295. @item separate
  15296. Use separate histogram for each channel.
  15297. @end table
  15298. Default is @code{single}.
  15299. @item rate, r
  15300. Set frame rate, expressed as number of frames per second. Default
  15301. value is "25".
  15302. @item size, s
  15303. Specify the video size for the output. For the syntax of this option, check the
  15304. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15305. Default value is @code{hd720}.
  15306. @item scale
  15307. Set display scale.
  15308. It accepts the following values:
  15309. @table @samp
  15310. @item log
  15311. logarithmic
  15312. @item sqrt
  15313. square root
  15314. @item cbrt
  15315. cubic root
  15316. @item lin
  15317. linear
  15318. @item rlog
  15319. reverse logarithmic
  15320. @end table
  15321. Default is @code{log}.
  15322. @item ascale
  15323. Set amplitude scale.
  15324. It accepts the following values:
  15325. @table @samp
  15326. @item log
  15327. logarithmic
  15328. @item lin
  15329. linear
  15330. @end table
  15331. Default is @code{log}.
  15332. @item acount
  15333. Set how much frames to accumulate in histogram.
  15334. Defauls is 1. Setting this to -1 accumulates all frames.
  15335. @item rheight
  15336. Set histogram ratio of window height.
  15337. @item slide
  15338. Set sonogram sliding.
  15339. It accepts the following values:
  15340. @table @samp
  15341. @item replace
  15342. replace old rows with new ones.
  15343. @item scroll
  15344. scroll from top to bottom.
  15345. @end table
  15346. Default is @code{replace}.
  15347. @end table
  15348. @section aphasemeter
  15349. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15350. representing mean phase of current audio frame. A video output can also be produced and is
  15351. enabled by default. The audio is passed through as first output.
  15352. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15353. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15354. and @code{1} means channels are in phase.
  15355. The filter accepts the following options, all related to its video output:
  15356. @table @option
  15357. @item rate, r
  15358. Set the output frame rate. Default value is @code{25}.
  15359. @item size, s
  15360. Set the video size for the output. For the syntax of this option, check the
  15361. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15362. Default value is @code{800x400}.
  15363. @item rc
  15364. @item gc
  15365. @item bc
  15366. Specify the red, green, blue contrast. Default values are @code{2},
  15367. @code{7} and @code{1}.
  15368. Allowed range is @code{[0, 255]}.
  15369. @item mpc
  15370. Set color which will be used for drawing median phase. If color is
  15371. @code{none} which is default, no median phase value will be drawn.
  15372. @item video
  15373. Enable video output. Default is enabled.
  15374. @end table
  15375. @section avectorscope
  15376. Convert input audio to a video output, representing the audio vector
  15377. scope.
  15378. The filter is used to measure the difference between channels of stereo
  15379. audio stream. A monoaural signal, consisting of identical left and right
  15380. signal, results in straight vertical line. Any stereo separation is visible
  15381. as a deviation from this line, creating a Lissajous figure.
  15382. If the straight (or deviation from it) but horizontal line appears this
  15383. indicates that the left and right channels are out of phase.
  15384. The filter accepts the following options:
  15385. @table @option
  15386. @item mode, m
  15387. Set the vectorscope mode.
  15388. Available values are:
  15389. @table @samp
  15390. @item lissajous
  15391. Lissajous rotated by 45 degrees.
  15392. @item lissajous_xy
  15393. Same as above but not rotated.
  15394. @item polar
  15395. Shape resembling half of circle.
  15396. @end table
  15397. Default value is @samp{lissajous}.
  15398. @item size, s
  15399. Set the video size for the output. For the syntax of this option, check the
  15400. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15401. Default value is @code{400x400}.
  15402. @item rate, r
  15403. Set the output frame rate. Default value is @code{25}.
  15404. @item rc
  15405. @item gc
  15406. @item bc
  15407. @item ac
  15408. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15409. @code{160}, @code{80} and @code{255}.
  15410. Allowed range is @code{[0, 255]}.
  15411. @item rf
  15412. @item gf
  15413. @item bf
  15414. @item af
  15415. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15416. @code{10}, @code{5} and @code{5}.
  15417. Allowed range is @code{[0, 255]}.
  15418. @item zoom
  15419. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15420. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15421. @item draw
  15422. Set the vectorscope drawing mode.
  15423. Available values are:
  15424. @table @samp
  15425. @item dot
  15426. Draw dot for each sample.
  15427. @item line
  15428. Draw line between previous and current sample.
  15429. @end table
  15430. Default value is @samp{dot}.
  15431. @item scale
  15432. Specify amplitude scale of audio samples.
  15433. Available values are:
  15434. @table @samp
  15435. @item lin
  15436. Linear.
  15437. @item sqrt
  15438. Square root.
  15439. @item cbrt
  15440. Cubic root.
  15441. @item log
  15442. Logarithmic.
  15443. @end table
  15444. @item swap
  15445. Swap left channel axis with right channel axis.
  15446. @item mirror
  15447. Mirror axis.
  15448. @table @samp
  15449. @item none
  15450. No mirror.
  15451. @item x
  15452. Mirror only x axis.
  15453. @item y
  15454. Mirror only y axis.
  15455. @item xy
  15456. Mirror both axis.
  15457. @end table
  15458. @end table
  15459. @subsection Examples
  15460. @itemize
  15461. @item
  15462. Complete example using @command{ffplay}:
  15463. @example
  15464. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15465. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15466. @end example
  15467. @end itemize
  15468. @section bench, abench
  15469. Benchmark part of a filtergraph.
  15470. The filter accepts the following options:
  15471. @table @option
  15472. @item action
  15473. Start or stop a timer.
  15474. Available values are:
  15475. @table @samp
  15476. @item start
  15477. Get the current time, set it as frame metadata (using the key
  15478. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15479. @item stop
  15480. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15481. the input frame metadata to get the time difference. Time difference, average,
  15482. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15483. @code{min}) are then printed. The timestamps are expressed in seconds.
  15484. @end table
  15485. @end table
  15486. @subsection Examples
  15487. @itemize
  15488. @item
  15489. Benchmark @ref{selectivecolor} filter:
  15490. @example
  15491. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15492. @end example
  15493. @end itemize
  15494. @section concat
  15495. Concatenate audio and video streams, joining them together one after the
  15496. other.
  15497. The filter works on segments of synchronized video and audio streams. All
  15498. segments must have the same number of streams of each type, and that will
  15499. also be the number of streams at output.
  15500. The filter accepts the following options:
  15501. @table @option
  15502. @item n
  15503. Set the number of segments. Default is 2.
  15504. @item v
  15505. Set the number of output video streams, that is also the number of video
  15506. streams in each segment. Default is 1.
  15507. @item a
  15508. Set the number of output audio streams, that is also the number of audio
  15509. streams in each segment. Default is 0.
  15510. @item unsafe
  15511. Activate unsafe mode: do not fail if segments have a different format.
  15512. @end table
  15513. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15514. @var{a} audio outputs.
  15515. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15516. segment, in the same order as the outputs, then the inputs for the second
  15517. segment, etc.
  15518. Related streams do not always have exactly the same duration, for various
  15519. reasons including codec frame size or sloppy authoring. For that reason,
  15520. related synchronized streams (e.g. a video and its audio track) should be
  15521. concatenated at once. The concat filter will use the duration of the longest
  15522. stream in each segment (except the last one), and if necessary pad shorter
  15523. audio streams with silence.
  15524. For this filter to work correctly, all segments must start at timestamp 0.
  15525. All corresponding streams must have the same parameters in all segments; the
  15526. filtering system will automatically select a common pixel format for video
  15527. streams, and a common sample format, sample rate and channel layout for
  15528. audio streams, but other settings, such as resolution, must be converted
  15529. explicitly by the user.
  15530. Different frame rates are acceptable but will result in variable frame rate
  15531. at output; be sure to configure the output file to handle it.
  15532. @subsection Examples
  15533. @itemize
  15534. @item
  15535. Concatenate an opening, an episode and an ending, all in bilingual version
  15536. (video in stream 0, audio in streams 1 and 2):
  15537. @example
  15538. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15539. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15540. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15541. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15542. @end example
  15543. @item
  15544. Concatenate two parts, handling audio and video separately, using the
  15545. (a)movie sources, and adjusting the resolution:
  15546. @example
  15547. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15548. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15549. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15550. @end example
  15551. Note that a desync will happen at the stitch if the audio and video streams
  15552. do not have exactly the same duration in the first file.
  15553. @end itemize
  15554. @subsection Commands
  15555. This filter supports the following commands:
  15556. @table @option
  15557. @item next
  15558. Close the current segment and step to the next one
  15559. @end table
  15560. @section drawgraph, adrawgraph
  15561. Draw a graph using input video or audio metadata.
  15562. It accepts the following parameters:
  15563. @table @option
  15564. @item m1
  15565. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15566. @item fg1
  15567. Set 1st foreground color expression.
  15568. @item m2
  15569. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15570. @item fg2
  15571. Set 2nd foreground color expression.
  15572. @item m3
  15573. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15574. @item fg3
  15575. Set 3rd foreground color expression.
  15576. @item m4
  15577. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15578. @item fg4
  15579. Set 4th foreground color expression.
  15580. @item min
  15581. Set minimal value of metadata value.
  15582. @item max
  15583. Set maximal value of metadata value.
  15584. @item bg
  15585. Set graph background color. Default is white.
  15586. @item mode
  15587. Set graph mode.
  15588. Available values for mode is:
  15589. @table @samp
  15590. @item bar
  15591. @item dot
  15592. @item line
  15593. @end table
  15594. Default is @code{line}.
  15595. @item slide
  15596. Set slide mode.
  15597. Available values for slide is:
  15598. @table @samp
  15599. @item frame
  15600. Draw new frame when right border is reached.
  15601. @item replace
  15602. Replace old columns with new ones.
  15603. @item scroll
  15604. Scroll from right to left.
  15605. @item rscroll
  15606. Scroll from left to right.
  15607. @item picture
  15608. Draw single picture.
  15609. @end table
  15610. Default is @code{frame}.
  15611. @item size
  15612. Set size of graph video. For the syntax of this option, check the
  15613. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15614. The default value is @code{900x256}.
  15615. The foreground color expressions can use the following variables:
  15616. @table @option
  15617. @item MIN
  15618. Minimal value of metadata value.
  15619. @item MAX
  15620. Maximal value of metadata value.
  15621. @item VAL
  15622. Current metadata key value.
  15623. @end table
  15624. The color is defined as 0xAABBGGRR.
  15625. @end table
  15626. Example using metadata from @ref{signalstats} filter:
  15627. @example
  15628. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15629. @end example
  15630. Example using metadata from @ref{ebur128} filter:
  15631. @example
  15632. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15633. @end example
  15634. @anchor{ebur128}
  15635. @section ebur128
  15636. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15637. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15638. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15639. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15640. The filter also has a video output (see the @var{video} option) with a real
  15641. time graph to observe the loudness evolution. The graphic contains the logged
  15642. message mentioned above, so it is not printed anymore when this option is set,
  15643. unless the verbose logging is set. The main graphing area contains the
  15644. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15645. the momentary loudness (400 milliseconds), but can optionally be configured
  15646. to instead display short-term loudness (see @var{gauge}).
  15647. The green area marks a +/- 1LU target range around the target loudness
  15648. (-23LUFS by default, unless modified through @var{target}).
  15649. More information about the Loudness Recommendation EBU R128 on
  15650. @url{http://tech.ebu.ch/loudness}.
  15651. The filter accepts the following options:
  15652. @table @option
  15653. @item video
  15654. Activate the video output. The audio stream is passed unchanged whether this
  15655. option is set or no. The video stream will be the first output stream if
  15656. activated. Default is @code{0}.
  15657. @item size
  15658. Set the video size. This option is for video only. For the syntax of this
  15659. option, check the
  15660. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15661. Default and minimum resolution is @code{640x480}.
  15662. @item meter
  15663. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15664. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15665. other integer value between this range is allowed.
  15666. @item metadata
  15667. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15668. into 100ms output frames, each of them containing various loudness information
  15669. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15670. Default is @code{0}.
  15671. @item framelog
  15672. Force the frame logging level.
  15673. Available values are:
  15674. @table @samp
  15675. @item info
  15676. information logging level
  15677. @item verbose
  15678. verbose logging level
  15679. @end table
  15680. By default, the logging level is set to @var{info}. If the @option{video} or
  15681. the @option{metadata} options are set, it switches to @var{verbose}.
  15682. @item peak
  15683. Set peak mode(s).
  15684. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15685. values are:
  15686. @table @samp
  15687. @item none
  15688. Disable any peak mode (default).
  15689. @item sample
  15690. Enable sample-peak mode.
  15691. Simple peak mode looking for the higher sample value. It logs a message
  15692. for sample-peak (identified by @code{SPK}).
  15693. @item true
  15694. Enable true-peak mode.
  15695. If enabled, the peak lookup is done on an over-sampled version of the input
  15696. stream for better peak accuracy. It logs a message for true-peak.
  15697. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15698. This mode requires a build with @code{libswresample}.
  15699. @end table
  15700. @item dualmono
  15701. Treat mono input files as "dual mono". If a mono file is intended for playback
  15702. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15703. If set to @code{true}, this option will compensate for this effect.
  15704. Multi-channel input files are not affected by this option.
  15705. @item panlaw
  15706. Set a specific pan law to be used for the measurement of dual mono files.
  15707. This parameter is optional, and has a default value of -3.01dB.
  15708. @item target
  15709. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15710. This parameter is optional and has a default value of -23LUFS as specified
  15711. by EBU R128. However, material published online may prefer a level of -16LUFS
  15712. (e.g. for use with podcasts or video platforms).
  15713. @item gauge
  15714. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15715. @code{shortterm}. By default the momentary value will be used, but in certain
  15716. scenarios it may be more useful to observe the short term value instead (e.g.
  15717. live mixing).
  15718. @item scale
  15719. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15720. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15721. video output, not the summary or continuous log output.
  15722. @end table
  15723. @subsection Examples
  15724. @itemize
  15725. @item
  15726. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15727. @example
  15728. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15729. @end example
  15730. @item
  15731. Run an analysis with @command{ffmpeg}:
  15732. @example
  15733. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15734. @end example
  15735. @end itemize
  15736. @section interleave, ainterleave
  15737. Temporally interleave frames from several inputs.
  15738. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15739. These filters read frames from several inputs and send the oldest
  15740. queued frame to the output.
  15741. Input streams must have well defined, monotonically increasing frame
  15742. timestamp values.
  15743. In order to submit one frame to output, these filters need to enqueue
  15744. at least one frame for each input, so they cannot work in case one
  15745. input is not yet terminated and will not receive incoming frames.
  15746. For example consider the case when one input is a @code{select} filter
  15747. which always drops input frames. The @code{interleave} filter will keep
  15748. reading from that input, but it will never be able to send new frames
  15749. to output until the input sends an end-of-stream signal.
  15750. Also, depending on inputs synchronization, the filters will drop
  15751. frames in case one input receives more frames than the other ones, and
  15752. the queue is already filled.
  15753. These filters accept the following options:
  15754. @table @option
  15755. @item nb_inputs, n
  15756. Set the number of different inputs, it is 2 by default.
  15757. @end table
  15758. @subsection Examples
  15759. @itemize
  15760. @item
  15761. Interleave frames belonging to different streams using @command{ffmpeg}:
  15762. @example
  15763. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15764. @end example
  15765. @item
  15766. Add flickering blur effect:
  15767. @example
  15768. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15769. @end example
  15770. @end itemize
  15771. @section metadata, ametadata
  15772. Manipulate frame metadata.
  15773. This filter accepts the following options:
  15774. @table @option
  15775. @item mode
  15776. Set mode of operation of the filter.
  15777. Can be one of the following:
  15778. @table @samp
  15779. @item select
  15780. If both @code{value} and @code{key} is set, select frames
  15781. which have such metadata. If only @code{key} is set, select
  15782. every frame that has such key in metadata.
  15783. @item add
  15784. Add new metadata @code{key} and @code{value}. If key is already available
  15785. do nothing.
  15786. @item modify
  15787. Modify value of already present key.
  15788. @item delete
  15789. If @code{value} is set, delete only keys that have such value.
  15790. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15791. the frame.
  15792. @item print
  15793. Print key and its value if metadata was found. If @code{key} is not set print all
  15794. metadata values available in frame.
  15795. @end table
  15796. @item key
  15797. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15798. @item value
  15799. Set metadata value which will be used. This option is mandatory for
  15800. @code{modify} and @code{add} mode.
  15801. @item function
  15802. Which function to use when comparing metadata value and @code{value}.
  15803. Can be one of following:
  15804. @table @samp
  15805. @item same_str
  15806. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15807. @item starts_with
  15808. Values are interpreted as strings, returns true if metadata value starts with
  15809. the @code{value} option string.
  15810. @item less
  15811. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15812. @item equal
  15813. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15814. @item greater
  15815. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15816. @item expr
  15817. Values are interpreted as floats, returns true if expression from option @code{expr}
  15818. evaluates to true.
  15819. @end table
  15820. @item expr
  15821. Set expression which is used when @code{function} is set to @code{expr}.
  15822. The expression is evaluated through the eval API and can contain the following
  15823. constants:
  15824. @table @option
  15825. @item VALUE1
  15826. Float representation of @code{value} from metadata key.
  15827. @item VALUE2
  15828. Float representation of @code{value} as supplied by user in @code{value} option.
  15829. @end table
  15830. @item file
  15831. If specified in @code{print} mode, output is written to the named file. Instead of
  15832. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15833. for standard output. If @code{file} option is not set, output is written to the log
  15834. with AV_LOG_INFO loglevel.
  15835. @end table
  15836. @subsection Examples
  15837. @itemize
  15838. @item
  15839. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15840. between 0 and 1.
  15841. @example
  15842. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15843. @end example
  15844. @item
  15845. Print silencedetect output to file @file{metadata.txt}.
  15846. @example
  15847. silencedetect,ametadata=mode=print:file=metadata.txt
  15848. @end example
  15849. @item
  15850. Direct all metadata to a pipe with file descriptor 4.
  15851. @example
  15852. metadata=mode=print:file='pipe\:4'
  15853. @end example
  15854. @end itemize
  15855. @section perms, aperms
  15856. Set read/write permissions for the output frames.
  15857. These filters are mainly aimed at developers to test direct path in the
  15858. following filter in the filtergraph.
  15859. The filters accept the following options:
  15860. @table @option
  15861. @item mode
  15862. Select the permissions mode.
  15863. It accepts the following values:
  15864. @table @samp
  15865. @item none
  15866. Do nothing. This is the default.
  15867. @item ro
  15868. Set all the output frames read-only.
  15869. @item rw
  15870. Set all the output frames directly writable.
  15871. @item toggle
  15872. Make the frame read-only if writable, and writable if read-only.
  15873. @item random
  15874. Set each output frame read-only or writable randomly.
  15875. @end table
  15876. @item seed
  15877. Set the seed for the @var{random} mode, must be an integer included between
  15878. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15879. @code{-1}, the filter will try to use a good random seed on a best effort
  15880. basis.
  15881. @end table
  15882. Note: in case of auto-inserted filter between the permission filter and the
  15883. following one, the permission might not be received as expected in that
  15884. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15885. perms/aperms filter can avoid this problem.
  15886. @section realtime, arealtime
  15887. Slow down filtering to match real time approximately.
  15888. These filters will pause the filtering for a variable amount of time to
  15889. match the output rate with the input timestamps.
  15890. They are similar to the @option{re} option to @code{ffmpeg}.
  15891. They accept the following options:
  15892. @table @option
  15893. @item limit
  15894. Time limit for the pauses. Any pause longer than that will be considered
  15895. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15896. @end table
  15897. @anchor{select}
  15898. @section select, aselect
  15899. Select frames to pass in output.
  15900. This filter accepts the following options:
  15901. @table @option
  15902. @item expr, e
  15903. Set expression, which is evaluated for each input frame.
  15904. If the expression is evaluated to zero, the frame is discarded.
  15905. If the evaluation result is negative or NaN, the frame is sent to the
  15906. first output; otherwise it is sent to the output with index
  15907. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15908. For example a value of @code{1.2} corresponds to the output with index
  15909. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15910. @item outputs, n
  15911. Set the number of outputs. The output to which to send the selected
  15912. frame is based on the result of the evaluation. Default value is 1.
  15913. @end table
  15914. The expression can contain the following constants:
  15915. @table @option
  15916. @item n
  15917. The (sequential) number of the filtered frame, starting from 0.
  15918. @item selected_n
  15919. The (sequential) number of the selected frame, starting from 0.
  15920. @item prev_selected_n
  15921. The sequential number of the last selected frame. It's NAN if undefined.
  15922. @item TB
  15923. The timebase of the input timestamps.
  15924. @item pts
  15925. The PTS (Presentation TimeStamp) of the filtered video frame,
  15926. expressed in @var{TB} units. It's NAN if undefined.
  15927. @item t
  15928. The PTS of the filtered video frame,
  15929. expressed in seconds. It's NAN if undefined.
  15930. @item prev_pts
  15931. The PTS of the previously filtered video frame. It's NAN if undefined.
  15932. @item prev_selected_pts
  15933. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15934. @item prev_selected_t
  15935. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15936. @item start_pts
  15937. The PTS of the first video frame in the video. It's NAN if undefined.
  15938. @item start_t
  15939. The time of the first video frame in the video. It's NAN if undefined.
  15940. @item pict_type @emph{(video only)}
  15941. The type of the filtered frame. It can assume one of the following
  15942. values:
  15943. @table @option
  15944. @item I
  15945. @item P
  15946. @item B
  15947. @item S
  15948. @item SI
  15949. @item SP
  15950. @item BI
  15951. @end table
  15952. @item interlace_type @emph{(video only)}
  15953. The frame interlace type. It can assume one of the following values:
  15954. @table @option
  15955. @item PROGRESSIVE
  15956. The frame is progressive (not interlaced).
  15957. @item TOPFIRST
  15958. The frame is top-field-first.
  15959. @item BOTTOMFIRST
  15960. The frame is bottom-field-first.
  15961. @end table
  15962. @item consumed_sample_n @emph{(audio only)}
  15963. the number of selected samples before the current frame
  15964. @item samples_n @emph{(audio only)}
  15965. the number of samples in the current frame
  15966. @item sample_rate @emph{(audio only)}
  15967. the input sample rate
  15968. @item key
  15969. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15970. @item pos
  15971. the position in the file of the filtered frame, -1 if the information
  15972. is not available (e.g. for synthetic video)
  15973. @item scene @emph{(video only)}
  15974. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15975. probability for the current frame to introduce a new scene, while a higher
  15976. value means the current frame is more likely to be one (see the example below)
  15977. @item concatdec_select
  15978. The concat demuxer can select only part of a concat input file by setting an
  15979. inpoint and an outpoint, but the output packets may not be entirely contained
  15980. in the selected interval. By using this variable, it is possible to skip frames
  15981. generated by the concat demuxer which are not exactly contained in the selected
  15982. interval.
  15983. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15984. and the @var{lavf.concat.duration} packet metadata values which are also
  15985. present in the decoded frames.
  15986. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15987. start_time and either the duration metadata is missing or the frame pts is less
  15988. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15989. missing.
  15990. That basically means that an input frame is selected if its pts is within the
  15991. interval set by the concat demuxer.
  15992. @end table
  15993. The default value of the select expression is "1".
  15994. @subsection Examples
  15995. @itemize
  15996. @item
  15997. Select all frames in input:
  15998. @example
  15999. select
  16000. @end example
  16001. The example above is the same as:
  16002. @example
  16003. select=1
  16004. @end example
  16005. @item
  16006. Skip all frames:
  16007. @example
  16008. select=0
  16009. @end example
  16010. @item
  16011. Select only I-frames:
  16012. @example
  16013. select='eq(pict_type\,I)'
  16014. @end example
  16015. @item
  16016. Select one frame every 100:
  16017. @example
  16018. select='not(mod(n\,100))'
  16019. @end example
  16020. @item
  16021. Select only frames contained in the 10-20 time interval:
  16022. @example
  16023. select=between(t\,10\,20)
  16024. @end example
  16025. @item
  16026. Select only I-frames contained in the 10-20 time interval:
  16027. @example
  16028. select=between(t\,10\,20)*eq(pict_type\,I)
  16029. @end example
  16030. @item
  16031. Select frames with a minimum distance of 10 seconds:
  16032. @example
  16033. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16034. @end example
  16035. @item
  16036. Use aselect to select only audio frames with samples number > 100:
  16037. @example
  16038. aselect='gt(samples_n\,100)'
  16039. @end example
  16040. @item
  16041. Create a mosaic of the first scenes:
  16042. @example
  16043. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16044. @end example
  16045. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16046. choice.
  16047. @item
  16048. Send even and odd frames to separate outputs, and compose them:
  16049. @example
  16050. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16051. @end example
  16052. @item
  16053. Select useful frames from an ffconcat file which is using inpoints and
  16054. outpoints but where the source files are not intra frame only.
  16055. @example
  16056. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16057. @end example
  16058. @end itemize
  16059. @section sendcmd, asendcmd
  16060. Send commands to filters in the filtergraph.
  16061. These filters read commands to be sent to other filters in the
  16062. filtergraph.
  16063. @code{sendcmd} must be inserted between two video filters,
  16064. @code{asendcmd} must be inserted between two audio filters, but apart
  16065. from that they act the same way.
  16066. The specification of commands can be provided in the filter arguments
  16067. with the @var{commands} option, or in a file specified by the
  16068. @var{filename} option.
  16069. These filters accept the following options:
  16070. @table @option
  16071. @item commands, c
  16072. Set the commands to be read and sent to the other filters.
  16073. @item filename, f
  16074. Set the filename of the commands to be read and sent to the other
  16075. filters.
  16076. @end table
  16077. @subsection Commands syntax
  16078. A commands description consists of a sequence of interval
  16079. specifications, comprising a list of commands to be executed when a
  16080. particular event related to that interval occurs. The occurring event
  16081. is typically the current frame time entering or leaving a given time
  16082. interval.
  16083. An interval is specified by the following syntax:
  16084. @example
  16085. @var{START}[-@var{END}] @var{COMMANDS};
  16086. @end example
  16087. The time interval is specified by the @var{START} and @var{END} times.
  16088. @var{END} is optional and defaults to the maximum time.
  16089. The current frame time is considered within the specified interval if
  16090. it is included in the interval [@var{START}, @var{END}), that is when
  16091. the time is greater or equal to @var{START} and is lesser than
  16092. @var{END}.
  16093. @var{COMMANDS} consists of a sequence of one or more command
  16094. specifications, separated by ",", relating to that interval. The
  16095. syntax of a command specification is given by:
  16096. @example
  16097. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16098. @end example
  16099. @var{FLAGS} is optional and specifies the type of events relating to
  16100. the time interval which enable sending the specified command, and must
  16101. be a non-null sequence of identifier flags separated by "+" or "|" and
  16102. enclosed between "[" and "]".
  16103. The following flags are recognized:
  16104. @table @option
  16105. @item enter
  16106. The command is sent when the current frame timestamp enters the
  16107. specified interval. In other words, the command is sent when the
  16108. previous frame timestamp was not in the given interval, and the
  16109. current is.
  16110. @item leave
  16111. The command is sent when the current frame timestamp leaves the
  16112. specified interval. In other words, the command is sent when the
  16113. previous frame timestamp was in the given interval, and the
  16114. current is not.
  16115. @end table
  16116. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16117. assumed.
  16118. @var{TARGET} specifies the target of the command, usually the name of
  16119. the filter class or a specific filter instance name.
  16120. @var{COMMAND} specifies the name of the command for the target filter.
  16121. @var{ARG} is optional and specifies the optional list of argument for
  16122. the given @var{COMMAND}.
  16123. Between one interval specification and another, whitespaces, or
  16124. sequences of characters starting with @code{#} until the end of line,
  16125. are ignored and can be used to annotate comments.
  16126. A simplified BNF description of the commands specification syntax
  16127. follows:
  16128. @example
  16129. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16130. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16131. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16132. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16133. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16134. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16135. @end example
  16136. @subsection Examples
  16137. @itemize
  16138. @item
  16139. Specify audio tempo change at second 4:
  16140. @example
  16141. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16142. @end example
  16143. @item
  16144. Target a specific filter instance:
  16145. @example
  16146. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16147. @end example
  16148. @item
  16149. Specify a list of drawtext and hue commands in a file.
  16150. @example
  16151. # show text in the interval 5-10
  16152. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16153. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16154. # desaturate the image in the interval 15-20
  16155. 15.0-20.0 [enter] hue s 0,
  16156. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16157. [leave] hue s 1,
  16158. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16159. # apply an exponential saturation fade-out effect, starting from time 25
  16160. 25 [enter] hue s exp(25-t)
  16161. @end example
  16162. A filtergraph allowing to read and process the above command list
  16163. stored in a file @file{test.cmd}, can be specified with:
  16164. @example
  16165. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16166. @end example
  16167. @end itemize
  16168. @anchor{setpts}
  16169. @section setpts, asetpts
  16170. Change the PTS (presentation timestamp) of the input frames.
  16171. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16172. This filter accepts the following options:
  16173. @table @option
  16174. @item expr
  16175. The expression which is evaluated for each frame to construct its timestamp.
  16176. @end table
  16177. The expression is evaluated through the eval API and can contain the following
  16178. constants:
  16179. @table @option
  16180. @item FRAME_RATE, FR
  16181. frame rate, only defined for constant frame-rate video
  16182. @item PTS
  16183. The presentation timestamp in input
  16184. @item N
  16185. The count of the input frame for video or the number of consumed samples,
  16186. not including the current frame for audio, starting from 0.
  16187. @item NB_CONSUMED_SAMPLES
  16188. The number of consumed samples, not including the current frame (only
  16189. audio)
  16190. @item NB_SAMPLES, S
  16191. The number of samples in the current frame (only audio)
  16192. @item SAMPLE_RATE, SR
  16193. The audio sample rate.
  16194. @item STARTPTS
  16195. The PTS of the first frame.
  16196. @item STARTT
  16197. the time in seconds of the first frame
  16198. @item INTERLACED
  16199. State whether the current frame is interlaced.
  16200. @item T
  16201. the time in seconds of the current frame
  16202. @item POS
  16203. original position in the file of the frame, or undefined if undefined
  16204. for the current frame
  16205. @item PREV_INPTS
  16206. The previous input PTS.
  16207. @item PREV_INT
  16208. previous input time in seconds
  16209. @item PREV_OUTPTS
  16210. The previous output PTS.
  16211. @item PREV_OUTT
  16212. previous output time in seconds
  16213. @item RTCTIME
  16214. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16215. instead.
  16216. @item RTCSTART
  16217. The wallclock (RTC) time at the start of the movie in microseconds.
  16218. @item TB
  16219. The timebase of the input timestamps.
  16220. @end table
  16221. @subsection Examples
  16222. @itemize
  16223. @item
  16224. Start counting PTS from zero
  16225. @example
  16226. setpts=PTS-STARTPTS
  16227. @end example
  16228. @item
  16229. Apply fast motion effect:
  16230. @example
  16231. setpts=0.5*PTS
  16232. @end example
  16233. @item
  16234. Apply slow motion effect:
  16235. @example
  16236. setpts=2.0*PTS
  16237. @end example
  16238. @item
  16239. Set fixed rate of 25 frames per second:
  16240. @example
  16241. setpts=N/(25*TB)
  16242. @end example
  16243. @item
  16244. Set fixed rate 25 fps with some jitter:
  16245. @example
  16246. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16247. @end example
  16248. @item
  16249. Apply an offset of 10 seconds to the input PTS:
  16250. @example
  16251. setpts=PTS+10/TB
  16252. @end example
  16253. @item
  16254. Generate timestamps from a "live source" and rebase onto the current timebase:
  16255. @example
  16256. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16257. @end example
  16258. @item
  16259. Generate timestamps by counting samples:
  16260. @example
  16261. asetpts=N/SR/TB
  16262. @end example
  16263. @end itemize
  16264. @section setrange
  16265. Force color range for the output video frame.
  16266. The @code{setrange} filter marks the color range property for the
  16267. output frames. It does not change the input frame, but only sets the
  16268. corresponding property, which affects how the frame is treated by
  16269. following filters.
  16270. The filter accepts the following options:
  16271. @table @option
  16272. @item range
  16273. Available values are:
  16274. @table @samp
  16275. @item auto
  16276. Keep the same color range property.
  16277. @item unspecified, unknown
  16278. Set the color range as unspecified.
  16279. @item limited, tv, mpeg
  16280. Set the color range as limited.
  16281. @item full, pc, jpeg
  16282. Set the color range as full.
  16283. @end table
  16284. @end table
  16285. @section settb, asettb
  16286. Set the timebase to use for the output frames timestamps.
  16287. It is mainly useful for testing timebase configuration.
  16288. It accepts the following parameters:
  16289. @table @option
  16290. @item expr, tb
  16291. The expression which is evaluated into the output timebase.
  16292. @end table
  16293. The value for @option{tb} is an arithmetic expression representing a
  16294. rational. The expression can contain the constants "AVTB" (the default
  16295. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16296. audio only). Default value is "intb".
  16297. @subsection Examples
  16298. @itemize
  16299. @item
  16300. Set the timebase to 1/25:
  16301. @example
  16302. settb=expr=1/25
  16303. @end example
  16304. @item
  16305. Set the timebase to 1/10:
  16306. @example
  16307. settb=expr=0.1
  16308. @end example
  16309. @item
  16310. Set the timebase to 1001/1000:
  16311. @example
  16312. settb=1+0.001
  16313. @end example
  16314. @item
  16315. Set the timebase to 2*intb:
  16316. @example
  16317. settb=2*intb
  16318. @end example
  16319. @item
  16320. Set the default timebase value:
  16321. @example
  16322. settb=AVTB
  16323. @end example
  16324. @end itemize
  16325. @section showcqt
  16326. Convert input audio to a video output representing frequency spectrum
  16327. logarithmically using Brown-Puckette constant Q transform algorithm with
  16328. direct frequency domain coefficient calculation (but the transform itself
  16329. is not really constant Q, instead the Q factor is actually variable/clamped),
  16330. with musical tone scale, from E0 to D#10.
  16331. The filter accepts the following options:
  16332. @table @option
  16333. @item size, s
  16334. Specify the video size for the output. It must be even. For the syntax of this option,
  16335. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16336. Default value is @code{1920x1080}.
  16337. @item fps, rate, r
  16338. Set the output frame rate. Default value is @code{25}.
  16339. @item bar_h
  16340. Set the bargraph height. It must be even. Default value is @code{-1} which
  16341. computes the bargraph height automatically.
  16342. @item axis_h
  16343. Set the axis height. It must be even. Default value is @code{-1} which computes
  16344. the axis height automatically.
  16345. @item sono_h
  16346. Set the sonogram height. It must be even. Default value is @code{-1} which
  16347. computes the sonogram height automatically.
  16348. @item fullhd
  16349. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16350. instead. Default value is @code{1}.
  16351. @item sono_v, volume
  16352. Specify the sonogram volume expression. It can contain variables:
  16353. @table @option
  16354. @item bar_v
  16355. the @var{bar_v} evaluated expression
  16356. @item frequency, freq, f
  16357. the frequency where it is evaluated
  16358. @item timeclamp, tc
  16359. the value of @var{timeclamp} option
  16360. @end table
  16361. and functions:
  16362. @table @option
  16363. @item a_weighting(f)
  16364. A-weighting of equal loudness
  16365. @item b_weighting(f)
  16366. B-weighting of equal loudness
  16367. @item c_weighting(f)
  16368. C-weighting of equal loudness.
  16369. @end table
  16370. Default value is @code{16}.
  16371. @item bar_v, volume2
  16372. Specify the bargraph volume expression. It can contain variables:
  16373. @table @option
  16374. @item sono_v
  16375. the @var{sono_v} evaluated expression
  16376. @item frequency, freq, f
  16377. the frequency where it is evaluated
  16378. @item timeclamp, tc
  16379. the value of @var{timeclamp} option
  16380. @end table
  16381. and functions:
  16382. @table @option
  16383. @item a_weighting(f)
  16384. A-weighting of equal loudness
  16385. @item b_weighting(f)
  16386. B-weighting of equal loudness
  16387. @item c_weighting(f)
  16388. C-weighting of equal loudness.
  16389. @end table
  16390. Default value is @code{sono_v}.
  16391. @item sono_g, gamma
  16392. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16393. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16394. Acceptable range is @code{[1, 7]}.
  16395. @item bar_g, gamma2
  16396. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16397. @code{[1, 7]}.
  16398. @item bar_t
  16399. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16400. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16401. @item timeclamp, tc
  16402. Specify the transform timeclamp. At low frequency, there is trade-off between
  16403. accuracy in time domain and frequency domain. If timeclamp is lower,
  16404. event in time domain is represented more accurately (such as fast bass drum),
  16405. otherwise event in frequency domain is represented more accurately
  16406. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16407. @item attack
  16408. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16409. limits future samples by applying asymmetric windowing in time domain, useful
  16410. when low latency is required. Accepted range is @code{[0, 1]}.
  16411. @item basefreq
  16412. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16413. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16414. @item endfreq
  16415. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16416. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16417. @item coeffclamp
  16418. This option is deprecated and ignored.
  16419. @item tlength
  16420. Specify the transform length in time domain. Use this option to control accuracy
  16421. trade-off between time domain and frequency domain at every frequency sample.
  16422. It can contain variables:
  16423. @table @option
  16424. @item frequency, freq, f
  16425. the frequency where it is evaluated
  16426. @item timeclamp, tc
  16427. the value of @var{timeclamp} option.
  16428. @end table
  16429. Default value is @code{384*tc/(384+tc*f)}.
  16430. @item count
  16431. Specify the transform count for every video frame. Default value is @code{6}.
  16432. Acceptable range is @code{[1, 30]}.
  16433. @item fcount
  16434. Specify the transform count for every single pixel. Default value is @code{0},
  16435. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16436. @item fontfile
  16437. Specify font file for use with freetype to draw the axis. If not specified,
  16438. use embedded font. Note that drawing with font file or embedded font is not
  16439. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16440. option instead.
  16441. @item font
  16442. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16443. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16444. @item fontcolor
  16445. Specify font color expression. This is arithmetic expression that should return
  16446. integer value 0xRRGGBB. It can contain variables:
  16447. @table @option
  16448. @item frequency, freq, f
  16449. the frequency where it is evaluated
  16450. @item timeclamp, tc
  16451. the value of @var{timeclamp} option
  16452. @end table
  16453. and functions:
  16454. @table @option
  16455. @item midi(f)
  16456. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16457. @item r(x), g(x), b(x)
  16458. red, green, and blue value of intensity x.
  16459. @end table
  16460. Default value is @code{st(0, (midi(f)-59.5)/12);
  16461. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16462. r(1-ld(1)) + b(ld(1))}.
  16463. @item axisfile
  16464. Specify image file to draw the axis. This option override @var{fontfile} and
  16465. @var{fontcolor} option.
  16466. @item axis, text
  16467. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16468. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16469. Default value is @code{1}.
  16470. @item csp
  16471. Set colorspace. The accepted values are:
  16472. @table @samp
  16473. @item unspecified
  16474. Unspecified (default)
  16475. @item bt709
  16476. BT.709
  16477. @item fcc
  16478. FCC
  16479. @item bt470bg
  16480. BT.470BG or BT.601-6 625
  16481. @item smpte170m
  16482. SMPTE-170M or BT.601-6 525
  16483. @item smpte240m
  16484. SMPTE-240M
  16485. @item bt2020ncl
  16486. BT.2020 with non-constant luminance
  16487. @end table
  16488. @item cscheme
  16489. Set spectrogram color scheme. This is list of floating point values with format
  16490. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16491. The default is @code{1|0.5|0|0|0.5|1}.
  16492. @end table
  16493. @subsection Examples
  16494. @itemize
  16495. @item
  16496. Playing audio while showing the spectrum:
  16497. @example
  16498. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16499. @end example
  16500. @item
  16501. Same as above, but with frame rate 30 fps:
  16502. @example
  16503. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16504. @end example
  16505. @item
  16506. Playing at 1280x720:
  16507. @example
  16508. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16509. @end example
  16510. @item
  16511. Disable sonogram display:
  16512. @example
  16513. sono_h=0
  16514. @end example
  16515. @item
  16516. A1 and its harmonics: A1, A2, (near)E3, A3:
  16517. @example
  16518. 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),
  16519. asplit[a][out1]; [a] showcqt [out0]'
  16520. @end example
  16521. @item
  16522. Same as above, but with more accuracy in frequency domain:
  16523. @example
  16524. 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),
  16525. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16526. @end example
  16527. @item
  16528. Custom volume:
  16529. @example
  16530. bar_v=10:sono_v=bar_v*a_weighting(f)
  16531. @end example
  16532. @item
  16533. Custom gamma, now spectrum is linear to the amplitude.
  16534. @example
  16535. bar_g=2:sono_g=2
  16536. @end example
  16537. @item
  16538. Custom tlength equation:
  16539. @example
  16540. 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)))'
  16541. @end example
  16542. @item
  16543. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16544. @example
  16545. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16546. @end example
  16547. @item
  16548. Custom font using fontconfig:
  16549. @example
  16550. font='Courier New,Monospace,mono|bold'
  16551. @end example
  16552. @item
  16553. Custom frequency range with custom axis using image file:
  16554. @example
  16555. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16556. @end example
  16557. @end itemize
  16558. @section showfreqs
  16559. Convert input audio to video output representing the audio power spectrum.
  16560. Audio amplitude is on Y-axis while frequency is on X-axis.
  16561. The filter accepts the following options:
  16562. @table @option
  16563. @item size, s
  16564. Specify size of video. For the syntax of this option, check the
  16565. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16566. Default is @code{1024x512}.
  16567. @item mode
  16568. Set display mode.
  16569. This set how each frequency bin will be represented.
  16570. It accepts the following values:
  16571. @table @samp
  16572. @item line
  16573. @item bar
  16574. @item dot
  16575. @end table
  16576. Default is @code{bar}.
  16577. @item ascale
  16578. Set amplitude scale.
  16579. It accepts the following values:
  16580. @table @samp
  16581. @item lin
  16582. Linear scale.
  16583. @item sqrt
  16584. Square root scale.
  16585. @item cbrt
  16586. Cubic root scale.
  16587. @item log
  16588. Logarithmic scale.
  16589. @end table
  16590. Default is @code{log}.
  16591. @item fscale
  16592. Set frequency scale.
  16593. It accepts the following values:
  16594. @table @samp
  16595. @item lin
  16596. Linear scale.
  16597. @item log
  16598. Logarithmic scale.
  16599. @item rlog
  16600. Reverse logarithmic scale.
  16601. @end table
  16602. Default is @code{lin}.
  16603. @item win_size
  16604. Set window size.
  16605. It accepts the following values:
  16606. @table @samp
  16607. @item w16
  16608. @item w32
  16609. @item w64
  16610. @item w128
  16611. @item w256
  16612. @item w512
  16613. @item w1024
  16614. @item w2048
  16615. @item w4096
  16616. @item w8192
  16617. @item w16384
  16618. @item w32768
  16619. @item w65536
  16620. @end table
  16621. Default is @code{w2048}
  16622. @item win_func
  16623. Set windowing function.
  16624. It accepts the following values:
  16625. @table @samp
  16626. @item rect
  16627. @item bartlett
  16628. @item hanning
  16629. @item hamming
  16630. @item blackman
  16631. @item welch
  16632. @item flattop
  16633. @item bharris
  16634. @item bnuttall
  16635. @item bhann
  16636. @item sine
  16637. @item nuttall
  16638. @item lanczos
  16639. @item gauss
  16640. @item tukey
  16641. @item dolph
  16642. @item cauchy
  16643. @item parzen
  16644. @item poisson
  16645. @item bohman
  16646. @end table
  16647. Default is @code{hanning}.
  16648. @item overlap
  16649. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16650. which means optimal overlap for selected window function will be picked.
  16651. @item averaging
  16652. Set time averaging. Setting this to 0 will display current maximal peaks.
  16653. Default is @code{1}, which means time averaging is disabled.
  16654. @item colors
  16655. Specify list of colors separated by space or by '|' which will be used to
  16656. draw channel frequencies. Unrecognized or missing colors will be replaced
  16657. by white color.
  16658. @item cmode
  16659. Set channel display mode.
  16660. It accepts the following values:
  16661. @table @samp
  16662. @item combined
  16663. @item separate
  16664. @end table
  16665. Default is @code{combined}.
  16666. @item minamp
  16667. Set minimum amplitude used in @code{log} amplitude scaler.
  16668. @end table
  16669. @anchor{showspectrum}
  16670. @section showspectrum
  16671. Convert input audio to a video output, representing the audio frequency
  16672. spectrum.
  16673. The filter accepts the following options:
  16674. @table @option
  16675. @item size, s
  16676. Specify the video size for the output. For the syntax of this option, check the
  16677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16678. Default value is @code{640x512}.
  16679. @item slide
  16680. Specify how the spectrum should slide along the window.
  16681. It accepts the following values:
  16682. @table @samp
  16683. @item replace
  16684. the samples start again on the left when they reach the right
  16685. @item scroll
  16686. the samples scroll from right to left
  16687. @item fullframe
  16688. frames are only produced when the samples reach the right
  16689. @item rscroll
  16690. the samples scroll from left to right
  16691. @end table
  16692. Default value is @code{replace}.
  16693. @item mode
  16694. Specify display mode.
  16695. It accepts the following values:
  16696. @table @samp
  16697. @item combined
  16698. all channels are displayed in the same row
  16699. @item separate
  16700. all channels are displayed in separate rows
  16701. @end table
  16702. Default value is @samp{combined}.
  16703. @item color
  16704. Specify display color mode.
  16705. It accepts the following values:
  16706. @table @samp
  16707. @item channel
  16708. each channel is displayed in a separate color
  16709. @item intensity
  16710. each channel is displayed using the same color scheme
  16711. @item rainbow
  16712. each channel is displayed using the rainbow color scheme
  16713. @item moreland
  16714. each channel is displayed using the moreland color scheme
  16715. @item nebulae
  16716. each channel is displayed using the nebulae color scheme
  16717. @item fire
  16718. each channel is displayed using the fire color scheme
  16719. @item fiery
  16720. each channel is displayed using the fiery color scheme
  16721. @item fruit
  16722. each channel is displayed using the fruit color scheme
  16723. @item cool
  16724. each channel is displayed using the cool color scheme
  16725. @item magma
  16726. each channel is displayed using the magma color scheme
  16727. @item green
  16728. each channel is displayed using the green color scheme
  16729. @item viridis
  16730. each channel is displayed using the viridis color scheme
  16731. @item plasma
  16732. each channel is displayed using the plasma color scheme
  16733. @item cividis
  16734. each channel is displayed using the cividis color scheme
  16735. @item terrain
  16736. each channel is displayed using the terrain color scheme
  16737. @end table
  16738. Default value is @samp{channel}.
  16739. @item scale
  16740. Specify scale used for calculating intensity color values.
  16741. It accepts the following values:
  16742. @table @samp
  16743. @item lin
  16744. linear
  16745. @item sqrt
  16746. square root, default
  16747. @item cbrt
  16748. cubic root
  16749. @item log
  16750. logarithmic
  16751. @item 4thrt
  16752. 4th root
  16753. @item 5thrt
  16754. 5th root
  16755. @end table
  16756. Default value is @samp{sqrt}.
  16757. @item saturation
  16758. Set saturation modifier for displayed colors. Negative values provide
  16759. alternative color scheme. @code{0} is no saturation at all.
  16760. Saturation must be in [-10.0, 10.0] range.
  16761. Default value is @code{1}.
  16762. @item win_func
  16763. Set window function.
  16764. It accepts the following values:
  16765. @table @samp
  16766. @item rect
  16767. @item bartlett
  16768. @item hann
  16769. @item hanning
  16770. @item hamming
  16771. @item blackman
  16772. @item welch
  16773. @item flattop
  16774. @item bharris
  16775. @item bnuttall
  16776. @item bhann
  16777. @item sine
  16778. @item nuttall
  16779. @item lanczos
  16780. @item gauss
  16781. @item tukey
  16782. @item dolph
  16783. @item cauchy
  16784. @item parzen
  16785. @item poisson
  16786. @item bohman
  16787. @end table
  16788. Default value is @code{hann}.
  16789. @item orientation
  16790. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16791. @code{horizontal}. Default is @code{vertical}.
  16792. @item overlap
  16793. Set ratio of overlap window. Default value is @code{0}.
  16794. When value is @code{1} overlap is set to recommended size for specific
  16795. window function currently used.
  16796. @item gain
  16797. Set scale gain for calculating intensity color values.
  16798. Default value is @code{1}.
  16799. @item data
  16800. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16801. @item rotation
  16802. Set color rotation, must be in [-1.0, 1.0] range.
  16803. Default value is @code{0}.
  16804. @item start
  16805. Set start frequency from which to display spectrogram. Default is @code{0}.
  16806. @item stop
  16807. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16808. @item fps
  16809. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16810. @item legend
  16811. Draw time and frequency axes and legends. Default is disabled.
  16812. @end table
  16813. The usage is very similar to the showwaves filter; see the examples in that
  16814. section.
  16815. @subsection Examples
  16816. @itemize
  16817. @item
  16818. Large window with logarithmic color scaling:
  16819. @example
  16820. showspectrum=s=1280x480:scale=log
  16821. @end example
  16822. @item
  16823. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16824. @example
  16825. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16826. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16827. @end example
  16828. @end itemize
  16829. @section showspectrumpic
  16830. Convert input audio to a single video frame, representing the audio frequency
  16831. spectrum.
  16832. The filter accepts the following options:
  16833. @table @option
  16834. @item size, s
  16835. Specify the video size for the output. For the syntax of this option, check the
  16836. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16837. Default value is @code{4096x2048}.
  16838. @item mode
  16839. Specify display mode.
  16840. It accepts the following values:
  16841. @table @samp
  16842. @item combined
  16843. all channels are displayed in the same row
  16844. @item separate
  16845. all channels are displayed in separate rows
  16846. @end table
  16847. Default value is @samp{combined}.
  16848. @item color
  16849. Specify display color mode.
  16850. It accepts the following values:
  16851. @table @samp
  16852. @item channel
  16853. each channel is displayed in a separate color
  16854. @item intensity
  16855. each channel is displayed using the same color scheme
  16856. @item rainbow
  16857. each channel is displayed using the rainbow color scheme
  16858. @item moreland
  16859. each channel is displayed using the moreland color scheme
  16860. @item nebulae
  16861. each channel is displayed using the nebulae color scheme
  16862. @item fire
  16863. each channel is displayed using the fire color scheme
  16864. @item fiery
  16865. each channel is displayed using the fiery color scheme
  16866. @item fruit
  16867. each channel is displayed using the fruit color scheme
  16868. @item cool
  16869. each channel is displayed using the cool color scheme
  16870. @item magma
  16871. each channel is displayed using the magma color scheme
  16872. @item green
  16873. each channel is displayed using the green color scheme
  16874. @item viridis
  16875. each channel is displayed using the viridis color scheme
  16876. @item plasma
  16877. each channel is displayed using the plasma color scheme
  16878. @item cividis
  16879. each channel is displayed using the cividis color scheme
  16880. @item terrain
  16881. each channel is displayed using the terrain color scheme
  16882. @end table
  16883. Default value is @samp{intensity}.
  16884. @item scale
  16885. Specify scale used for calculating intensity color values.
  16886. It accepts the following values:
  16887. @table @samp
  16888. @item lin
  16889. linear
  16890. @item sqrt
  16891. square root, default
  16892. @item cbrt
  16893. cubic root
  16894. @item log
  16895. logarithmic
  16896. @item 4thrt
  16897. 4th root
  16898. @item 5thrt
  16899. 5th root
  16900. @end table
  16901. Default value is @samp{log}.
  16902. @item saturation
  16903. Set saturation modifier for displayed colors. Negative values provide
  16904. alternative color scheme. @code{0} is no saturation at all.
  16905. Saturation must be in [-10.0, 10.0] range.
  16906. Default value is @code{1}.
  16907. @item win_func
  16908. Set window function.
  16909. It accepts the following values:
  16910. @table @samp
  16911. @item rect
  16912. @item bartlett
  16913. @item hann
  16914. @item hanning
  16915. @item hamming
  16916. @item blackman
  16917. @item welch
  16918. @item flattop
  16919. @item bharris
  16920. @item bnuttall
  16921. @item bhann
  16922. @item sine
  16923. @item nuttall
  16924. @item lanczos
  16925. @item gauss
  16926. @item tukey
  16927. @item dolph
  16928. @item cauchy
  16929. @item parzen
  16930. @item poisson
  16931. @item bohman
  16932. @end table
  16933. Default value is @code{hann}.
  16934. @item orientation
  16935. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16936. @code{horizontal}. Default is @code{vertical}.
  16937. @item gain
  16938. Set scale gain for calculating intensity color values.
  16939. Default value is @code{1}.
  16940. @item legend
  16941. Draw time and frequency axes and legends. Default is enabled.
  16942. @item rotation
  16943. Set color rotation, must be in [-1.0, 1.0] range.
  16944. Default value is @code{0}.
  16945. @item start
  16946. Set start frequency from which to display spectrogram. Default is @code{0}.
  16947. @item stop
  16948. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16949. @end table
  16950. @subsection Examples
  16951. @itemize
  16952. @item
  16953. Extract an audio spectrogram of a whole audio track
  16954. in a 1024x1024 picture using @command{ffmpeg}:
  16955. @example
  16956. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16957. @end example
  16958. @end itemize
  16959. @section showvolume
  16960. Convert input audio volume to a video output.
  16961. The filter accepts the following options:
  16962. @table @option
  16963. @item rate, r
  16964. Set video rate.
  16965. @item b
  16966. Set border width, allowed range is [0, 5]. Default is 1.
  16967. @item w
  16968. Set channel width, allowed range is [80, 8192]. Default is 400.
  16969. @item h
  16970. Set channel height, allowed range is [1, 900]. Default is 20.
  16971. @item f
  16972. Set fade, allowed range is [0, 1]. Default is 0.95.
  16973. @item c
  16974. Set volume color expression.
  16975. The expression can use the following variables:
  16976. @table @option
  16977. @item VOLUME
  16978. Current max volume of channel in dB.
  16979. @item PEAK
  16980. Current peak.
  16981. @item CHANNEL
  16982. Current channel number, starting from 0.
  16983. @end table
  16984. @item t
  16985. If set, displays channel names. Default is enabled.
  16986. @item v
  16987. If set, displays volume values. Default is enabled.
  16988. @item o
  16989. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16990. default is @code{h}.
  16991. @item s
  16992. Set step size, allowed range is [0, 5]. Default is 0, which means
  16993. step is disabled.
  16994. @item p
  16995. Set background opacity, allowed range is [0, 1]. Default is 0.
  16996. @item m
  16997. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16998. default is @code{p}.
  16999. @item ds
  17000. Set display scale, can be linear: @code{lin} or log: @code{log},
  17001. default is @code{lin}.
  17002. @item dm
  17003. In second.
  17004. If set to > 0., display a line for the max level
  17005. in the previous seconds.
  17006. default is disabled: @code{0.}
  17007. @item dmc
  17008. The color of the max line. Use when @code{dm} option is set to > 0.
  17009. default is: @code{orange}
  17010. @end table
  17011. @section showwaves
  17012. Convert input audio to a video output, representing the samples waves.
  17013. The filter accepts the following options:
  17014. @table @option
  17015. @item size, s
  17016. Specify the video size for the output. For the syntax of this option, check the
  17017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17018. Default value is @code{600x240}.
  17019. @item mode
  17020. Set display mode.
  17021. Available values are:
  17022. @table @samp
  17023. @item point
  17024. Draw a point for each sample.
  17025. @item line
  17026. Draw a vertical line for each sample.
  17027. @item p2p
  17028. Draw a point for each sample and a line between them.
  17029. @item cline
  17030. Draw a centered vertical line for each sample.
  17031. @end table
  17032. Default value is @code{point}.
  17033. @item n
  17034. Set the number of samples which are printed on the same column. A
  17035. larger value will decrease the frame rate. Must be a positive
  17036. integer. This option can be set only if the value for @var{rate}
  17037. is not explicitly specified.
  17038. @item rate, r
  17039. Set the (approximate) output frame rate. This is done by setting the
  17040. option @var{n}. Default value is "25".
  17041. @item split_channels
  17042. Set if channels should be drawn separately or overlap. Default value is 0.
  17043. @item colors
  17044. Set colors separated by '|' which are going to be used for drawing of each channel.
  17045. @item scale
  17046. Set amplitude scale.
  17047. Available values are:
  17048. @table @samp
  17049. @item lin
  17050. Linear.
  17051. @item log
  17052. Logarithmic.
  17053. @item sqrt
  17054. Square root.
  17055. @item cbrt
  17056. Cubic root.
  17057. @end table
  17058. Default is linear.
  17059. @item draw
  17060. Set the draw mode. This is mostly useful to set for high @var{n}.
  17061. Available values are:
  17062. @table @samp
  17063. @item scale
  17064. Scale pixel values for each drawn sample.
  17065. @item full
  17066. Draw every sample directly.
  17067. @end table
  17068. Default value is @code{scale}.
  17069. @end table
  17070. @subsection Examples
  17071. @itemize
  17072. @item
  17073. Output the input file audio and the corresponding video representation
  17074. at the same time:
  17075. @example
  17076. amovie=a.mp3,asplit[out0],showwaves[out1]
  17077. @end example
  17078. @item
  17079. Create a synthetic signal and show it with showwaves, forcing a
  17080. frame rate of 30 frames per second:
  17081. @example
  17082. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17083. @end example
  17084. @end itemize
  17085. @section showwavespic
  17086. Convert input audio to a single video frame, representing the samples waves.
  17087. The filter accepts the following options:
  17088. @table @option
  17089. @item size, s
  17090. Specify the video size for the output. For the syntax of this option, check the
  17091. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17092. Default value is @code{600x240}.
  17093. @item split_channels
  17094. Set if channels should be drawn separately or overlap. Default value is 0.
  17095. @item colors
  17096. Set colors separated by '|' which are going to be used for drawing of each channel.
  17097. @item scale
  17098. Set amplitude scale.
  17099. Available values are:
  17100. @table @samp
  17101. @item lin
  17102. Linear.
  17103. @item log
  17104. Logarithmic.
  17105. @item sqrt
  17106. Square root.
  17107. @item cbrt
  17108. Cubic root.
  17109. @end table
  17110. Default is linear.
  17111. @end table
  17112. @subsection Examples
  17113. @itemize
  17114. @item
  17115. Extract a channel split representation of the wave form of a whole audio track
  17116. in a 1024x800 picture using @command{ffmpeg}:
  17117. @example
  17118. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17119. @end example
  17120. @end itemize
  17121. @section sidedata, asidedata
  17122. Delete frame side data, or select frames based on it.
  17123. This filter accepts the following options:
  17124. @table @option
  17125. @item mode
  17126. Set mode of operation of the filter.
  17127. Can be one of the following:
  17128. @table @samp
  17129. @item select
  17130. Select every frame with side data of @code{type}.
  17131. @item delete
  17132. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17133. data in the frame.
  17134. @end table
  17135. @item type
  17136. Set side data type used with all modes. Must be set for @code{select} mode. For
  17137. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17138. in @file{libavutil/frame.h}. For example, to choose
  17139. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17140. @end table
  17141. @section spectrumsynth
  17142. Sythesize audio from 2 input video spectrums, first input stream represents
  17143. magnitude across time and second represents phase across time.
  17144. The filter will transform from frequency domain as displayed in videos back
  17145. to time domain as presented in audio output.
  17146. This filter is primarily created for reversing processed @ref{showspectrum}
  17147. filter outputs, but can synthesize sound from other spectrograms too.
  17148. But in such case results are going to be poor if the phase data is not
  17149. available, because in such cases phase data need to be recreated, usually
  17150. its just recreated from random noise.
  17151. For best results use gray only output (@code{channel} color mode in
  17152. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17153. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17154. @code{data} option. Inputs videos should generally use @code{fullframe}
  17155. slide mode as that saves resources needed for decoding video.
  17156. The filter accepts the following options:
  17157. @table @option
  17158. @item sample_rate
  17159. Specify sample rate of output audio, the sample rate of audio from which
  17160. spectrum was generated may differ.
  17161. @item channels
  17162. Set number of channels represented in input video spectrums.
  17163. @item scale
  17164. Set scale which was used when generating magnitude input spectrum.
  17165. Can be @code{lin} or @code{log}. Default is @code{log}.
  17166. @item slide
  17167. Set slide which was used when generating inputs spectrums.
  17168. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17169. Default is @code{fullframe}.
  17170. @item win_func
  17171. Set window function used for resynthesis.
  17172. @item overlap
  17173. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17174. which means optimal overlap for selected window function will be picked.
  17175. @item orientation
  17176. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17177. Default is @code{vertical}.
  17178. @end table
  17179. @subsection Examples
  17180. @itemize
  17181. @item
  17182. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17183. then resynthesize videos back to audio with spectrumsynth:
  17184. @example
  17185. 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
  17186. 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
  17187. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17188. @end example
  17189. @end itemize
  17190. @section split, asplit
  17191. Split input into several identical outputs.
  17192. @code{asplit} works with audio input, @code{split} with video.
  17193. The filter accepts a single parameter which specifies the number of outputs. If
  17194. unspecified, it defaults to 2.
  17195. @subsection Examples
  17196. @itemize
  17197. @item
  17198. Create two separate outputs from the same input:
  17199. @example
  17200. [in] split [out0][out1]
  17201. @end example
  17202. @item
  17203. To create 3 or more outputs, you need to specify the number of
  17204. outputs, like in:
  17205. @example
  17206. [in] asplit=3 [out0][out1][out2]
  17207. @end example
  17208. @item
  17209. Create two separate outputs from the same input, one cropped and
  17210. one padded:
  17211. @example
  17212. [in] split [splitout1][splitout2];
  17213. [splitout1] crop=100:100:0:0 [cropout];
  17214. [splitout2] pad=200:200:100:100 [padout];
  17215. @end example
  17216. @item
  17217. Create 5 copies of the input audio with @command{ffmpeg}:
  17218. @example
  17219. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17220. @end example
  17221. @end itemize
  17222. @section zmq, azmq
  17223. Receive commands sent through a libzmq client, and forward them to
  17224. filters in the filtergraph.
  17225. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17226. must be inserted between two video filters, @code{azmq} between two
  17227. audio filters. Both are capable to send messages to any filter type.
  17228. To enable these filters you need to install the libzmq library and
  17229. headers and configure FFmpeg with @code{--enable-libzmq}.
  17230. For more information about libzmq see:
  17231. @url{http://www.zeromq.org/}
  17232. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17233. receives messages sent through a network interface defined by the
  17234. @option{bind_address} (or the abbreviation "@option{b}") option.
  17235. Default value of this option is @file{tcp://localhost:5555}. You may
  17236. want to alter this value to your needs, but do not forget to escape any
  17237. ':' signs (see @ref{filtergraph escaping}).
  17238. The received message must be in the form:
  17239. @example
  17240. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17241. @end example
  17242. @var{TARGET} specifies the target of the command, usually the name of
  17243. the filter class or a specific filter instance name. The default
  17244. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17245. but you can override this by using the @samp{filter_name@@id} syntax
  17246. (see @ref{Filtergraph syntax}).
  17247. @var{COMMAND} specifies the name of the command for the target filter.
  17248. @var{ARG} is optional and specifies the optional argument list for the
  17249. given @var{COMMAND}.
  17250. Upon reception, the message is processed and the corresponding command
  17251. is injected into the filtergraph. Depending on the result, the filter
  17252. will send a reply to the client, adopting the format:
  17253. @example
  17254. @var{ERROR_CODE} @var{ERROR_REASON}
  17255. @var{MESSAGE}
  17256. @end example
  17257. @var{MESSAGE} is optional.
  17258. @subsection Examples
  17259. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17260. be used to send commands processed by these filters.
  17261. Consider the following filtergraph generated by @command{ffplay}.
  17262. In this example the last overlay filter has an instance name. All other
  17263. filters will have default instance names.
  17264. @example
  17265. ffplay -dumpgraph 1 -f lavfi "
  17266. color=s=100x100:c=red [l];
  17267. color=s=100x100:c=blue [r];
  17268. nullsrc=s=200x100, zmq [bg];
  17269. [bg][l] overlay [bg+l];
  17270. [bg+l][r] overlay@@my=x=100 "
  17271. @end example
  17272. To change the color of the left side of the video, the following
  17273. command can be used:
  17274. @example
  17275. echo Parsed_color_0 c yellow | tools/zmqsend
  17276. @end example
  17277. To change the right side:
  17278. @example
  17279. echo Parsed_color_1 c pink | tools/zmqsend
  17280. @end example
  17281. To change the position of the right side:
  17282. @example
  17283. echo overlay@@my x 150 | tools/zmqsend
  17284. @end example
  17285. @c man end MULTIMEDIA FILTERS
  17286. @chapter Multimedia Sources
  17287. @c man begin MULTIMEDIA SOURCES
  17288. Below is a description of the currently available multimedia sources.
  17289. @section amovie
  17290. This is the same as @ref{movie} source, except it selects an audio
  17291. stream by default.
  17292. @anchor{movie}
  17293. @section movie
  17294. Read audio and/or video stream(s) from a movie container.
  17295. It accepts the following parameters:
  17296. @table @option
  17297. @item filename
  17298. The name of the resource to read (not necessarily a file; it can also be a
  17299. device or a stream accessed through some protocol).
  17300. @item format_name, f
  17301. Specifies the format assumed for the movie to read, and can be either
  17302. the name of a container or an input device. If not specified, the
  17303. format is guessed from @var{movie_name} or by probing.
  17304. @item seek_point, sp
  17305. Specifies the seek point in seconds. The frames will be output
  17306. starting from this seek point. The parameter is evaluated with
  17307. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17308. postfix. The default value is "0".
  17309. @item streams, s
  17310. Specifies the streams to read. Several streams can be specified,
  17311. separated by "+". The source will then have as many outputs, in the
  17312. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17313. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17314. respectively the default (best suited) video and audio stream. Default
  17315. is "dv", or "da" if the filter is called as "amovie".
  17316. @item stream_index, si
  17317. Specifies the index of the video stream to read. If the value is -1,
  17318. the most suitable video stream will be automatically selected. The default
  17319. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17320. audio instead of video.
  17321. @item loop
  17322. Specifies how many times to read the stream in sequence.
  17323. If the value is 0, the stream will be looped infinitely.
  17324. Default value is "1".
  17325. Note that when the movie is looped the source timestamps are not
  17326. changed, so it will generate non monotonically increasing timestamps.
  17327. @item discontinuity
  17328. Specifies the time difference between frames above which the point is
  17329. considered a timestamp discontinuity which is removed by adjusting the later
  17330. timestamps.
  17331. @end table
  17332. It allows overlaying a second video on top of the main input of
  17333. a filtergraph, as shown in this graph:
  17334. @example
  17335. input -----------> deltapts0 --> overlay --> output
  17336. ^
  17337. |
  17338. movie --> scale--> deltapts1 -------+
  17339. @end example
  17340. @subsection Examples
  17341. @itemize
  17342. @item
  17343. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17344. on top of the input labelled "in":
  17345. @example
  17346. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17347. [in] setpts=PTS-STARTPTS [main];
  17348. [main][over] overlay=16:16 [out]
  17349. @end example
  17350. @item
  17351. Read from a video4linux2 device, and overlay it on top of the input
  17352. labelled "in":
  17353. @example
  17354. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17355. [in] setpts=PTS-STARTPTS [main];
  17356. [main][over] overlay=16:16 [out]
  17357. @end example
  17358. @item
  17359. Read the first video stream and the audio stream with id 0x81 from
  17360. dvd.vob; the video is connected to the pad named "video" and the audio is
  17361. connected to the pad named "audio":
  17362. @example
  17363. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17364. @end example
  17365. @end itemize
  17366. @subsection Commands
  17367. Both movie and amovie support the following commands:
  17368. @table @option
  17369. @item seek
  17370. Perform seek using "av_seek_frame".
  17371. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17372. @itemize
  17373. @item
  17374. @var{stream_index}: If stream_index is -1, a default
  17375. stream is selected, and @var{timestamp} is automatically converted
  17376. from AV_TIME_BASE units to the stream specific time_base.
  17377. @item
  17378. @var{timestamp}: Timestamp in AVStream.time_base units
  17379. or, if no stream is specified, in AV_TIME_BASE units.
  17380. @item
  17381. @var{flags}: Flags which select direction and seeking mode.
  17382. @end itemize
  17383. @item get_duration
  17384. Get movie duration in AV_TIME_BASE units.
  17385. @end table
  17386. @c man end MULTIMEDIA SOURCES