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.

21491 lines
571KB

  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. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  537. the second channel (and any other channels that may be present) unchanged.
  538. @example
  539. adelay=1500|0|500
  540. @end example
  541. @item
  542. Delay second channel by 500 samples, the third channel by 700 samples and leave
  543. the first channel (and any other channels that may be present) unchanged.
  544. @example
  545. adelay=0|500S|700S
  546. @end example
  547. @end itemize
  548. @section aderivative, aintegral
  549. Compute derivative/integral of audio stream.
  550. Applying both filters one after another produces original audio.
  551. @section aecho
  552. Apply echoing to the input audio.
  553. Echoes are reflected sound and can occur naturally amongst mountains
  554. (and sometimes large buildings) when talking or shouting; digital echo
  555. effects emulate this behaviour and are often used to help fill out the
  556. sound of a single instrument or vocal. The time difference between the
  557. original signal and the reflection is the @code{delay}, and the
  558. loudness of the reflected signal is the @code{decay}.
  559. Multiple echoes can have different delays and decays.
  560. A description of the accepted parameters follows.
  561. @table @option
  562. @item in_gain
  563. Set input gain of reflected signal. Default is @code{0.6}.
  564. @item out_gain
  565. Set output gain of reflected signal. Default is @code{0.3}.
  566. @item delays
  567. Set list of time intervals in milliseconds between original signal and reflections
  568. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  569. Default is @code{1000}.
  570. @item decays
  571. Set list of loudness of reflected signals separated by '|'.
  572. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  573. Default is @code{0.5}.
  574. @end table
  575. @subsection Examples
  576. @itemize
  577. @item
  578. Make it sound as if there are twice as many instruments as are actually playing:
  579. @example
  580. aecho=0.8:0.88:60:0.4
  581. @end example
  582. @item
  583. If delay is very short, then it sound like a (metallic) robot playing music:
  584. @example
  585. aecho=0.8:0.88:6:0.4
  586. @end example
  587. @item
  588. A longer delay will sound like an open air concert in the mountains:
  589. @example
  590. aecho=0.8:0.9:1000:0.3
  591. @end example
  592. @item
  593. Same as above but with one more mountain:
  594. @example
  595. aecho=0.8:0.9:1000|1800:0.3|0.25
  596. @end example
  597. @end itemize
  598. @section aemphasis
  599. Audio emphasis filter creates or restores material directly taken from LPs or
  600. emphased CDs with different filter curves. E.g. to store music on vinyl the
  601. signal has to be altered by a filter first to even out the disadvantages of
  602. this recording medium.
  603. Once the material is played back the inverse filter has to be applied to
  604. restore the distortion of the frequency response.
  605. The filter accepts the following options:
  606. @table @option
  607. @item level_in
  608. Set input gain.
  609. @item level_out
  610. Set output gain.
  611. @item mode
  612. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  613. use @code{production} mode. Default is @code{reproduction} mode.
  614. @item type
  615. Set filter type. Selects medium. Can be one of the following:
  616. @table @option
  617. @item col
  618. select Columbia.
  619. @item emi
  620. select EMI.
  621. @item bsi
  622. select BSI (78RPM).
  623. @item riaa
  624. select RIAA.
  625. @item cd
  626. select Compact Disc (CD).
  627. @item 50fm
  628. select 50µs (FM).
  629. @item 75fm
  630. select 75µs (FM).
  631. @item 50kf
  632. select 50µs (FM-KF).
  633. @item 75kf
  634. select 75µs (FM-KF).
  635. @end table
  636. @end table
  637. @section aeval
  638. Modify an audio signal according to the specified expressions.
  639. This filter accepts one or more expressions (one for each channel),
  640. which are evaluated and used to modify a corresponding audio signal.
  641. It accepts the following parameters:
  642. @table @option
  643. @item exprs
  644. Set the '|'-separated expressions list for each separate channel. If
  645. the number of input channels is greater than the number of
  646. expressions, the last specified expression is used for the remaining
  647. output channels.
  648. @item channel_layout, c
  649. Set output channel layout. If not specified, the channel layout is
  650. specified by the number of expressions. If set to @samp{same}, it will
  651. use by default the same input channel layout.
  652. @end table
  653. Each expression in @var{exprs} can contain the following constants and functions:
  654. @table @option
  655. @item ch
  656. channel number of the current expression
  657. @item n
  658. number of the evaluated sample, starting from 0
  659. @item s
  660. sample rate
  661. @item t
  662. time of the evaluated sample expressed in seconds
  663. @item nb_in_channels
  664. @item nb_out_channels
  665. input and output number of channels
  666. @item val(CH)
  667. the value of input channel with number @var{CH}
  668. @end table
  669. Note: this filter is slow. For faster processing you should use a
  670. dedicated filter.
  671. @subsection Examples
  672. @itemize
  673. @item
  674. Half volume:
  675. @example
  676. aeval=val(ch)/2:c=same
  677. @end example
  678. @item
  679. Invert phase of the second channel:
  680. @example
  681. aeval=val(0)|-val(1)
  682. @end example
  683. @end itemize
  684. @anchor{afade}
  685. @section afade
  686. Apply fade-in/out effect to input audio.
  687. A description of the accepted parameters follows.
  688. @table @option
  689. @item type, t
  690. Specify the effect type, can be either @code{in} for fade-in, or
  691. @code{out} for a fade-out effect. Default is @code{in}.
  692. @item start_sample, ss
  693. Specify the number of the start sample for starting to apply the fade
  694. effect. Default is 0.
  695. @item nb_samples, ns
  696. Specify the number of samples for which the fade effect has to last. At
  697. the end of the fade-in effect the output audio will have the same
  698. volume as the input audio, at the end of the fade-out transition
  699. the output audio will be silence. Default is 44100.
  700. @item start_time, st
  701. Specify the start time of the fade effect. Default is 0.
  702. The value must be specified as a time duration; see
  703. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  704. for the accepted syntax.
  705. If set this option is used instead of @var{start_sample}.
  706. @item duration, d
  707. Specify the duration of the fade effect. See
  708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  709. for the accepted syntax.
  710. At the end of the fade-in effect the output audio will have the same
  711. volume as the input audio, at the end of the fade-out transition
  712. the output audio will be silence.
  713. By default the duration is determined by @var{nb_samples}.
  714. If set this option is used instead of @var{nb_samples}.
  715. @item curve
  716. Set curve for fade transition.
  717. It accepts the following values:
  718. @table @option
  719. @item tri
  720. select triangular, linear slope (default)
  721. @item qsin
  722. select quarter of sine wave
  723. @item hsin
  724. select half of sine wave
  725. @item esin
  726. select exponential sine wave
  727. @item log
  728. select logarithmic
  729. @item ipar
  730. select inverted parabola
  731. @item qua
  732. select quadratic
  733. @item cub
  734. select cubic
  735. @item squ
  736. select square root
  737. @item cbr
  738. select cubic root
  739. @item par
  740. select parabola
  741. @item exp
  742. select exponential
  743. @item iqsin
  744. select inverted quarter of sine wave
  745. @item ihsin
  746. select inverted half of sine wave
  747. @item dese
  748. select double-exponential seat
  749. @item desi
  750. select double-exponential sigmoid
  751. @item losi
  752. select logistic sigmoid
  753. @end table
  754. @end table
  755. @subsection Examples
  756. @itemize
  757. @item
  758. Fade in first 15 seconds of audio:
  759. @example
  760. afade=t=in:ss=0:d=15
  761. @end example
  762. @item
  763. Fade out last 25 seconds of a 900 seconds audio:
  764. @example
  765. afade=t=out:st=875:d=25
  766. @end example
  767. @end itemize
  768. @section afftdn
  769. Denoise audio samples with FFT.
  770. A description of the accepted parameters follows.
  771. @table @option
  772. @item nr
  773. Set the noise reduction in dB, allowed range is 0.01 to 97.
  774. Default value is 12 dB.
  775. @item nf
  776. Set the noise floor in dB, allowed range is -80 to -20.
  777. Default value is -50 dB.
  778. @item nt
  779. Set the noise type.
  780. It accepts the following values:
  781. @table @option
  782. @item w
  783. Select white noise.
  784. @item v
  785. Select vinyl noise.
  786. @item s
  787. Select shellac noise.
  788. @item c
  789. Select custom noise, defined in @code{bn} option.
  790. Default value is white noise.
  791. @end table
  792. @item bn
  793. Set custom band noise for every one of 15 bands.
  794. Bands are separated by ' ' or '|'.
  795. @item rf
  796. Set the residual floor in dB, allowed range is -80 to -20.
  797. Default value is -38 dB.
  798. @item tn
  799. Enable noise tracking. By default is disabled.
  800. With this enabled, noise floor is automatically adjusted.
  801. @item tr
  802. Enable residual tracking. By default is disabled.
  803. @item om
  804. Set the output mode.
  805. It accepts the following values:
  806. @table @option
  807. @item i
  808. Pass input unchanged.
  809. @item o
  810. Pass noise filtered out.
  811. @item n
  812. Pass only noise.
  813. Default value is @var{o}.
  814. @end table
  815. @end table
  816. @subsection Commands
  817. This filter supports the following commands:
  818. @table @option
  819. @item sample_noise, sn
  820. Start or stop measuring noise profile.
  821. Syntax for the command is : "start" or "stop" string.
  822. After measuring noise profile is stopped it will be
  823. automatically applied in filtering.
  824. @item noise_reduction, nr
  825. Change noise reduction. Argument is single float number.
  826. Syntax for the command is : "@var{noise_reduction}"
  827. @item noise_floor, nf
  828. Change noise floor. Argument is single float number.
  829. Syntax for the command is : "@var{noise_floor}"
  830. @item output_mode, om
  831. Change output mode operation.
  832. Syntax for the command is : "i", "o" or "n" string.
  833. @end table
  834. @section afftfilt
  835. Apply arbitrary expressions to samples in frequency domain.
  836. @table @option
  837. @item real
  838. Set frequency domain real expression for each separate channel separated
  839. by '|'. Default is "1".
  840. If the number of input channels is greater than the number of
  841. expressions, the last specified expression is used for the remaining
  842. output channels.
  843. @item imag
  844. Set frequency domain imaginary expression for each separate channel
  845. separated by '|'. If not set, @var{real} option is used.
  846. Each expression in @var{real} and @var{imag} can contain the following
  847. constants:
  848. @table @option
  849. @item sr
  850. sample rate
  851. @item b
  852. current frequency bin number
  853. @item nb
  854. number of available bins
  855. @item ch
  856. channel number of the current expression
  857. @item chs
  858. number of channels
  859. @item pts
  860. current frame pts
  861. @end table
  862. @item win_size
  863. Set window size.
  864. It accepts the following values:
  865. @table @samp
  866. @item w16
  867. @item w32
  868. @item w64
  869. @item w128
  870. @item w256
  871. @item w512
  872. @item w1024
  873. @item w2048
  874. @item w4096
  875. @item w8192
  876. @item w16384
  877. @item w32768
  878. @item w65536
  879. @end table
  880. Default is @code{w4096}
  881. @item win_func
  882. Set window function. Default is @code{hann}.
  883. @item overlap
  884. Set window overlap. If set to 1, the recommended overlap for selected
  885. window function will be picked. Default is @code{0.75}.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Leave almost only low frequencies in audio:
  891. @example
  892. afftfilt="1-clip((b/nb)*b,0,1)"
  893. @end example
  894. @end itemize
  895. @anchor{afir}
  896. @section afir
  897. Apply an arbitrary Frequency Impulse Response filter.
  898. This filter is designed for applying long FIR filters,
  899. up to 60 seconds long.
  900. It can be used as component for digital crossover filters,
  901. room equalization, cross talk cancellation, wavefield synthesis,
  902. auralization, ambiophonics and ambisonics.
  903. This filter uses second stream as FIR coefficients.
  904. If second stream holds single channel, it will be used
  905. for all input channels in first stream, otherwise
  906. number of channels in second stream must be same as
  907. number of channels in first stream.
  908. It accepts the following parameters:
  909. @table @option
  910. @item dry
  911. Set dry gain. This sets input gain.
  912. @item wet
  913. Set wet gain. This sets final output gain.
  914. @item length
  915. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  916. @item gtype
  917. Enable applying gain measured from power of IR.
  918. Set which approach to use for auto gain measurement.
  919. @table @option
  920. @item none
  921. Do not apply any gain.
  922. @item peak
  923. select peak gain, very conservative approach. This is default value.
  924. @item dc
  925. select DC gain, limited application.
  926. @item gn
  927. select gain to noise approach, this is most popular one.
  928. @end table
  929. @item irgain
  930. Set gain to be applied to IR coefficients before filtering.
  931. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  932. @item irfmt
  933. Set format of IR stream. Can be @code{mono} or @code{input}.
  934. Default is @code{input}.
  935. @item maxir
  936. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  937. Allowed range is 0.1 to 60 seconds.
  938. @item response
  939. Show IR frequency reponse, magnitude and phase in additional video stream.
  940. By default it is disabled.
  941. @item channel
  942. Set for which IR channel to display frequency response. By default is first channel
  943. displayed. This option is used only when @var{response} is enabled.
  944. @item size
  945. Set video stream size. This option is used only when @var{response} is enabled.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  951. @example
  952. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  953. @end example
  954. @end itemize
  955. @anchor{aformat}
  956. @section aformat
  957. Set output format constraints for the input audio. The framework will
  958. negotiate the most appropriate format to minimize conversions.
  959. It accepts the following parameters:
  960. @table @option
  961. @item sample_fmts
  962. A '|'-separated list of requested sample formats.
  963. @item sample_rates
  964. A '|'-separated list of requested sample rates.
  965. @item channel_layouts
  966. A '|'-separated list of requested channel layouts.
  967. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  968. for the required syntax.
  969. @end table
  970. If a parameter is omitted, all values are allowed.
  971. Force the output to either unsigned 8-bit or signed 16-bit stereo
  972. @example
  973. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  974. @end example
  975. @section agate
  976. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  977. processing reduces disturbing noise between useful signals.
  978. Gating is done by detecting the volume below a chosen level @var{threshold}
  979. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  980. floor is set via @var{range}. Because an exact manipulation of the signal
  981. would cause distortion of the waveform the reduction can be levelled over
  982. time. This is done by setting @var{attack} and @var{release}.
  983. @var{attack} determines how long the signal has to fall below the threshold
  984. before any reduction will occur and @var{release} sets the time the signal
  985. has to rise above the threshold to reduce the reduction again.
  986. Shorter signals than the chosen attack time will be left untouched.
  987. @table @option
  988. @item level_in
  989. Set input level before filtering.
  990. Default is 1. Allowed range is from 0.015625 to 64.
  991. @item range
  992. Set the level of gain reduction when the signal is below the threshold.
  993. Default is 0.06125. Allowed range is from 0 to 1.
  994. @item threshold
  995. If a signal rises above this level the gain reduction is released.
  996. Default is 0.125. Allowed range is from 0 to 1.
  997. @item ratio
  998. Set a ratio by which the signal is reduced.
  999. Default is 2. Allowed range is from 1 to 9000.
  1000. @item attack
  1001. Amount of milliseconds the signal has to rise above the threshold before gain
  1002. reduction stops.
  1003. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1004. @item release
  1005. Amount of milliseconds the signal has to fall below the threshold before the
  1006. reduction is increased again. Default is 250 milliseconds.
  1007. Allowed range is from 0.01 to 9000.
  1008. @item makeup
  1009. Set amount of amplification of signal after processing.
  1010. Default is 1. Allowed range is from 1 to 64.
  1011. @item knee
  1012. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1013. Default is 2.828427125. Allowed range is from 1 to 8.
  1014. @item detection
  1015. Choose if exact signal should be taken for detection or an RMS like one.
  1016. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1017. @item link
  1018. Choose if the average level between all channels or the louder channel affects
  1019. the reduction.
  1020. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1021. @end table
  1022. @section aiir
  1023. Apply an arbitrary Infinite Impulse Response filter.
  1024. It accepts the following parameters:
  1025. @table @option
  1026. @item z
  1027. Set numerator/zeros coefficients.
  1028. @item p
  1029. Set denominator/poles coefficients.
  1030. @item k
  1031. Set channels gains.
  1032. @item dry_gain
  1033. Set input gain.
  1034. @item wet_gain
  1035. Set output gain.
  1036. @item f
  1037. Set coefficients format.
  1038. @table @samp
  1039. @item tf
  1040. transfer function
  1041. @item zp
  1042. Z-plane zeros/poles, cartesian (default)
  1043. @item pr
  1044. Z-plane zeros/poles, polar radians
  1045. @item pd
  1046. Z-plane zeros/poles, polar degrees
  1047. @end table
  1048. @item r
  1049. Set kind of processing.
  1050. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1051. @item e
  1052. Set filtering precision.
  1053. @table @samp
  1054. @item dbl
  1055. double-precision floating-point (default)
  1056. @item flt
  1057. single-precision floating-point
  1058. @item i32
  1059. 32-bit integers
  1060. @item i16
  1061. 16-bit integers
  1062. @end table
  1063. @item response
  1064. Show IR frequency reponse, magnitude and phase in additional video stream.
  1065. By default it is disabled.
  1066. @item channel
  1067. Set for which IR channel to display frequency response. By default is first channel
  1068. displayed. This option is used only when @var{response} is enabled.
  1069. @item size
  1070. Set video stream size. This option is used only when @var{response} is enabled.
  1071. @end table
  1072. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1073. order.
  1074. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1075. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1076. imaginary unit.
  1077. Different coefficients and gains can be provided for every channel, in such case
  1078. use '|' to separate coefficients or gains. Last provided coefficients will be
  1079. used for all remaining channels.
  1080. @subsection Examples
  1081. @itemize
  1082. @item
  1083. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1084. @example
  1085. 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
  1086. @end example
  1087. @item
  1088. Same as above but in @code{zp} format:
  1089. @example
  1090. 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
  1091. @end example
  1092. @end itemize
  1093. @section alimiter
  1094. The limiter prevents an input signal from rising over a desired threshold.
  1095. This limiter uses lookahead technology to prevent your signal from distorting.
  1096. It means that there is a small delay after the signal is processed. Keep in mind
  1097. that the delay it produces is the attack time you set.
  1098. The filter accepts the following options:
  1099. @table @option
  1100. @item level_in
  1101. Set input gain. Default is 1.
  1102. @item level_out
  1103. Set output gain. Default is 1.
  1104. @item limit
  1105. Don't let signals above this level pass the limiter. Default is 1.
  1106. @item attack
  1107. The limiter will reach its attenuation level in this amount of time in
  1108. milliseconds. Default is 5 milliseconds.
  1109. @item release
  1110. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1111. Default is 50 milliseconds.
  1112. @item asc
  1113. When gain reduction is always needed ASC takes care of releasing to an
  1114. average reduction level rather than reaching a reduction of 0 in the release
  1115. time.
  1116. @item asc_level
  1117. Select how much the release time is affected by ASC, 0 means nearly no changes
  1118. in release time while 1 produces higher release times.
  1119. @item level
  1120. Auto level output signal. Default is enabled.
  1121. This normalizes audio back to 0dB if enabled.
  1122. @end table
  1123. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1124. with @ref{aresample} before applying this filter.
  1125. @section allpass
  1126. Apply a two-pole all-pass filter with central frequency (in Hz)
  1127. @var{frequency}, and filter-width @var{width}.
  1128. An all-pass filter changes the audio's frequency to phase relationship
  1129. without changing its frequency to amplitude relationship.
  1130. The filter accepts the following options:
  1131. @table @option
  1132. @item frequency, f
  1133. Set frequency in Hz.
  1134. @item width_type, t
  1135. Set method to specify band-width of filter.
  1136. @table @option
  1137. @item h
  1138. Hz
  1139. @item q
  1140. Q-Factor
  1141. @item o
  1142. octave
  1143. @item s
  1144. slope
  1145. @item k
  1146. kHz
  1147. @end table
  1148. @item width, w
  1149. Specify the band-width of a filter in width_type units.
  1150. @item channels, c
  1151. Specify which channels to filter, by default all available are filtered.
  1152. @end table
  1153. @subsection Commands
  1154. This filter supports the following commands:
  1155. @table @option
  1156. @item frequency, f
  1157. Change allpass frequency.
  1158. Syntax for the command is : "@var{frequency}"
  1159. @item width_type, t
  1160. Change allpass width_type.
  1161. Syntax for the command is : "@var{width_type}"
  1162. @item width, w
  1163. Change allpass width.
  1164. Syntax for the command is : "@var{width}"
  1165. @end table
  1166. @section aloop
  1167. Loop audio samples.
  1168. The filter accepts the following options:
  1169. @table @option
  1170. @item loop
  1171. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1172. Default is 0.
  1173. @item size
  1174. Set maximal number of samples. Default is 0.
  1175. @item start
  1176. Set first sample of loop. Default is 0.
  1177. @end table
  1178. @anchor{amerge}
  1179. @section amerge
  1180. Merge two or more audio streams into a single multi-channel stream.
  1181. The filter accepts the following options:
  1182. @table @option
  1183. @item inputs
  1184. Set the number of inputs. Default is 2.
  1185. @end table
  1186. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1187. the channel layout of the output will be set accordingly and the channels
  1188. will be reordered as necessary. If the channel layouts of the inputs are not
  1189. disjoint, the output will have all the channels of the first input then all
  1190. the channels of the second input, in that order, and the channel layout of
  1191. the output will be the default value corresponding to the total number of
  1192. channels.
  1193. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1194. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1195. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1196. first input, b1 is the first channel of the second input).
  1197. On the other hand, if both input are in stereo, the output channels will be
  1198. in the default order: a1, a2, b1, b2, and the channel layout will be
  1199. arbitrarily set to 4.0, which may or may not be the expected value.
  1200. All inputs must have the same sample rate, and format.
  1201. If inputs do not have the same duration, the output will stop with the
  1202. shortest.
  1203. @subsection Examples
  1204. @itemize
  1205. @item
  1206. Merge two mono files into a stereo stream:
  1207. @example
  1208. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1209. @end example
  1210. @item
  1211. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1212. @example
  1213. 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
  1214. @end example
  1215. @end itemize
  1216. @section amix
  1217. Mixes multiple audio inputs into a single output.
  1218. Note that this filter only supports float samples (the @var{amerge}
  1219. and @var{pan} audio filters support many formats). If the @var{amix}
  1220. input has integer samples then @ref{aresample} will be automatically
  1221. inserted to perform the conversion to float samples.
  1222. For example
  1223. @example
  1224. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1225. @end example
  1226. will mix 3 input audio streams to a single output with the same duration as the
  1227. first input and a dropout transition time of 3 seconds.
  1228. It accepts the following parameters:
  1229. @table @option
  1230. @item inputs
  1231. The number of inputs. If unspecified, it defaults to 2.
  1232. @item duration
  1233. How to determine the end-of-stream.
  1234. @table @option
  1235. @item longest
  1236. The duration of the longest input. (default)
  1237. @item shortest
  1238. The duration of the shortest input.
  1239. @item first
  1240. The duration of the first input.
  1241. @end table
  1242. @item dropout_transition
  1243. The transition time, in seconds, for volume renormalization when an input
  1244. stream ends. The default value is 2 seconds.
  1245. @item weights
  1246. Specify weight of each input audio stream as sequence.
  1247. Each weight is separated by space. By default all inputs have same weight.
  1248. @end table
  1249. @section amultiply
  1250. Multiply first audio stream with second audio stream and store result
  1251. in output audio stream. Multiplication is done by multiplying each
  1252. sample from first stream with sample at same position from second stream.
  1253. With this element-wise multiplication one can create amplitude fades and
  1254. amplitude modulations.
  1255. @section anequalizer
  1256. High-order parametric multiband equalizer for each channel.
  1257. It accepts the following parameters:
  1258. @table @option
  1259. @item params
  1260. This option string is in format:
  1261. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1262. Each equalizer band is separated by '|'.
  1263. @table @option
  1264. @item chn
  1265. Set channel number to which equalization will be applied.
  1266. If input doesn't have that channel the entry is ignored.
  1267. @item f
  1268. Set central frequency for band.
  1269. If input doesn't have that frequency the entry is ignored.
  1270. @item w
  1271. Set band width in hertz.
  1272. @item g
  1273. Set band gain in dB.
  1274. @item t
  1275. Set filter type for band, optional, can be:
  1276. @table @samp
  1277. @item 0
  1278. Butterworth, this is default.
  1279. @item 1
  1280. Chebyshev type 1.
  1281. @item 2
  1282. Chebyshev type 2.
  1283. @end table
  1284. @end table
  1285. @item curves
  1286. With this option activated frequency response of anequalizer is displayed
  1287. in video stream.
  1288. @item size
  1289. Set video stream size. Only useful if curves option is activated.
  1290. @item mgain
  1291. Set max gain that will be displayed. Only useful if curves option is activated.
  1292. Setting this to a reasonable value makes it possible to display gain which is derived from
  1293. neighbour bands which are too close to each other and thus produce higher gain
  1294. when both are activated.
  1295. @item fscale
  1296. Set frequency scale used to draw frequency response in video output.
  1297. Can be linear or logarithmic. Default is logarithmic.
  1298. @item colors
  1299. Set color for each channel curve which is going to be displayed in video stream.
  1300. This is list of color names separated by space or by '|'.
  1301. Unrecognised or missing colors will be replaced by white color.
  1302. @end table
  1303. @subsection Examples
  1304. @itemize
  1305. @item
  1306. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1307. for first 2 channels using Chebyshev type 1 filter:
  1308. @example
  1309. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1310. @end example
  1311. @end itemize
  1312. @subsection Commands
  1313. This filter supports the following commands:
  1314. @table @option
  1315. @item change
  1316. Alter existing filter parameters.
  1317. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1318. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1319. error is returned.
  1320. @var{freq} set new frequency parameter.
  1321. @var{width} set new width parameter in herz.
  1322. @var{gain} set new gain parameter in dB.
  1323. Full filter invocation with asendcmd may look like this:
  1324. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1325. @end table
  1326. @section anull
  1327. Pass the audio source unchanged to the output.
  1328. @section apad
  1329. Pad the end of an audio stream with silence.
  1330. This can be used together with @command{ffmpeg} @option{-shortest} to
  1331. extend audio streams to the same length as the video stream.
  1332. A description of the accepted options follows.
  1333. @table @option
  1334. @item packet_size
  1335. Set silence packet size. Default value is 4096.
  1336. @item pad_len
  1337. Set the number of samples of silence to add to the end. After the
  1338. value is reached, the stream is terminated. This option is mutually
  1339. exclusive with @option{whole_len}.
  1340. @item whole_len
  1341. Set the minimum total number of samples in the output audio stream. If
  1342. the value is longer than the input audio length, silence is added to
  1343. the end, until the value is reached. This option is mutually exclusive
  1344. with @option{pad_len}.
  1345. @end table
  1346. If neither the @option{pad_len} nor the @option{whole_len} option is
  1347. set, the filter will add silence to the end of the input stream
  1348. indefinitely.
  1349. @subsection Examples
  1350. @itemize
  1351. @item
  1352. Add 1024 samples of silence to the end of the input:
  1353. @example
  1354. apad=pad_len=1024
  1355. @end example
  1356. @item
  1357. Make sure the audio output will contain at least 10000 samples, pad
  1358. the input with silence if required:
  1359. @example
  1360. apad=whole_len=10000
  1361. @end example
  1362. @item
  1363. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1364. video stream will always result the shortest and will be converted
  1365. until the end in the output file when using the @option{shortest}
  1366. option:
  1367. @example
  1368. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1369. @end example
  1370. @end itemize
  1371. @section aphaser
  1372. Add a phasing effect to the input audio.
  1373. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1374. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1375. A description of the accepted parameters follows.
  1376. @table @option
  1377. @item in_gain
  1378. Set input gain. Default is 0.4.
  1379. @item out_gain
  1380. Set output gain. Default is 0.74
  1381. @item delay
  1382. Set delay in milliseconds. Default is 3.0.
  1383. @item decay
  1384. Set decay. Default is 0.4.
  1385. @item speed
  1386. Set modulation speed in Hz. Default is 0.5.
  1387. @item type
  1388. Set modulation type. Default is triangular.
  1389. It accepts the following values:
  1390. @table @samp
  1391. @item triangular, t
  1392. @item sinusoidal, s
  1393. @end table
  1394. @end table
  1395. @section apulsator
  1396. Audio pulsator is something between an autopanner and a tremolo.
  1397. But it can produce funny stereo effects as well. Pulsator changes the volume
  1398. of the left and right channel based on a LFO (low frequency oscillator) with
  1399. different waveforms and shifted phases.
  1400. This filter have the ability to define an offset between left and right
  1401. channel. An offset of 0 means that both LFO shapes match each other.
  1402. The left and right channel are altered equally - a conventional tremolo.
  1403. An offset of 50% means that the shape of the right channel is exactly shifted
  1404. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1405. an autopanner. At 1 both curves match again. Every setting in between moves the
  1406. phase shift gapless between all stages and produces some "bypassing" sounds with
  1407. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1408. the 0.5) the faster the signal passes from the left to the right speaker.
  1409. The filter accepts the following options:
  1410. @table @option
  1411. @item level_in
  1412. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1413. @item level_out
  1414. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1415. @item mode
  1416. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1417. sawup or sawdown. Default is sine.
  1418. @item amount
  1419. Set modulation. Define how much of original signal is affected by the LFO.
  1420. @item offset_l
  1421. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1422. @item offset_r
  1423. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1424. @item width
  1425. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1426. @item timing
  1427. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1428. @item bpm
  1429. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1430. is set to bpm.
  1431. @item ms
  1432. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1433. is set to ms.
  1434. @item hz
  1435. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1436. if timing is set to hz.
  1437. @end table
  1438. @anchor{aresample}
  1439. @section aresample
  1440. Resample the input audio to the specified parameters, using the
  1441. libswresample library. If none are specified then the filter will
  1442. automatically convert between its input and output.
  1443. This filter is also able to stretch/squeeze the audio data to make it match
  1444. the timestamps or to inject silence / cut out audio to make it match the
  1445. timestamps, do a combination of both or do neither.
  1446. The filter accepts the syntax
  1447. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1448. expresses a sample rate and @var{resampler_options} is a list of
  1449. @var{key}=@var{value} pairs, separated by ":". See the
  1450. @ref{Resampler Options,,"Resampler Options" section in the
  1451. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1452. for the complete list of supported options.
  1453. @subsection Examples
  1454. @itemize
  1455. @item
  1456. Resample the input audio to 44100Hz:
  1457. @example
  1458. aresample=44100
  1459. @end example
  1460. @item
  1461. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1462. samples per second compensation:
  1463. @example
  1464. aresample=async=1000
  1465. @end example
  1466. @end itemize
  1467. @section areverse
  1468. Reverse an audio clip.
  1469. Warning: This filter requires memory to buffer the entire clip, so trimming
  1470. is suggested.
  1471. @subsection Examples
  1472. @itemize
  1473. @item
  1474. Take the first 5 seconds of a clip, and reverse it.
  1475. @example
  1476. atrim=end=5,areverse
  1477. @end example
  1478. @end itemize
  1479. @section asetnsamples
  1480. Set the number of samples per each output audio frame.
  1481. The last output packet may contain a different number of samples, as
  1482. the filter will flush all the remaining samples when the input audio
  1483. signals its end.
  1484. The filter accepts the following options:
  1485. @table @option
  1486. @item nb_out_samples, n
  1487. Set the number of frames per each output audio frame. The number is
  1488. intended as the number of samples @emph{per each channel}.
  1489. Default value is 1024.
  1490. @item pad, p
  1491. If set to 1, the filter will pad the last audio frame with zeroes, so
  1492. that the last frame will contain the same number of samples as the
  1493. previous ones. Default value is 1.
  1494. @end table
  1495. For example, to set the number of per-frame samples to 1234 and
  1496. disable padding for the last frame, use:
  1497. @example
  1498. asetnsamples=n=1234:p=0
  1499. @end example
  1500. @section asetrate
  1501. Set the sample rate without altering the PCM data.
  1502. This will result in a change of speed and pitch.
  1503. The filter accepts the following options:
  1504. @table @option
  1505. @item sample_rate, r
  1506. Set the output sample rate. Default is 44100 Hz.
  1507. @end table
  1508. @section ashowinfo
  1509. Show a line containing various information for each input audio frame.
  1510. The input audio is not modified.
  1511. The shown line contains a sequence of key/value pairs of the form
  1512. @var{key}:@var{value}.
  1513. The following values are shown in the output:
  1514. @table @option
  1515. @item n
  1516. The (sequential) number of the input frame, starting from 0.
  1517. @item pts
  1518. The presentation timestamp of the input frame, in time base units; the time base
  1519. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1520. @item pts_time
  1521. The presentation timestamp of the input frame in seconds.
  1522. @item pos
  1523. position of the frame in the input stream, -1 if this information in
  1524. unavailable and/or meaningless (for example in case of synthetic audio)
  1525. @item fmt
  1526. The sample format.
  1527. @item chlayout
  1528. The channel layout.
  1529. @item rate
  1530. The sample rate for the audio frame.
  1531. @item nb_samples
  1532. The number of samples (per channel) in the frame.
  1533. @item checksum
  1534. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1535. audio, the data is treated as if all the planes were concatenated.
  1536. @item plane_checksums
  1537. A list of Adler-32 checksums for each data plane.
  1538. @end table
  1539. @anchor{astats}
  1540. @section astats
  1541. Display time domain statistical information about the audio channels.
  1542. Statistics are calculated and displayed for each audio channel and,
  1543. where applicable, an overall figure is also given.
  1544. It accepts the following option:
  1545. @table @option
  1546. @item length
  1547. Short window length in seconds, used for peak and trough RMS measurement.
  1548. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1549. @item metadata
  1550. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1551. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1552. disabled.
  1553. Available keys for each channel are:
  1554. DC_offset
  1555. Min_level
  1556. Max_level
  1557. Min_difference
  1558. Max_difference
  1559. Mean_difference
  1560. RMS_difference
  1561. Peak_level
  1562. RMS_peak
  1563. RMS_trough
  1564. Crest_factor
  1565. Flat_factor
  1566. Peak_count
  1567. Bit_depth
  1568. Dynamic_range
  1569. Zero_crossings
  1570. Zero_crossings_rate
  1571. and for Overall:
  1572. DC_offset
  1573. Min_level
  1574. Max_level
  1575. Min_difference
  1576. Max_difference
  1577. Mean_difference
  1578. RMS_difference
  1579. Peak_level
  1580. RMS_level
  1581. RMS_peak
  1582. RMS_trough
  1583. Flat_factor
  1584. Peak_count
  1585. Bit_depth
  1586. Number_of_samples
  1587. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1588. this @code{lavfi.astats.Overall.Peak_count}.
  1589. For description what each key means read below.
  1590. @item reset
  1591. Set number of frame after which stats are going to be recalculated.
  1592. Default is disabled.
  1593. @end table
  1594. A description of each shown parameter follows:
  1595. @table @option
  1596. @item DC offset
  1597. Mean amplitude displacement from zero.
  1598. @item Min level
  1599. Minimal sample level.
  1600. @item Max level
  1601. Maximal sample level.
  1602. @item Min difference
  1603. Minimal difference between two consecutive samples.
  1604. @item Max difference
  1605. Maximal difference between two consecutive samples.
  1606. @item Mean difference
  1607. Mean difference between two consecutive samples.
  1608. The average of each difference between two consecutive samples.
  1609. @item RMS difference
  1610. Root Mean Square difference between two consecutive samples.
  1611. @item Peak level dB
  1612. @item RMS level dB
  1613. Standard peak and RMS level measured in dBFS.
  1614. @item RMS peak dB
  1615. @item RMS trough dB
  1616. Peak and trough values for RMS level measured over a short window.
  1617. @item Crest factor
  1618. Standard ratio of peak to RMS level (note: not in dB).
  1619. @item Flat factor
  1620. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1621. (i.e. either @var{Min level} or @var{Max level}).
  1622. @item Peak count
  1623. Number of occasions (not the number of samples) that the signal attained either
  1624. @var{Min level} or @var{Max level}.
  1625. @item Bit depth
  1626. Overall bit depth of audio. Number of bits used for each sample.
  1627. @item Dynamic range
  1628. Measured dynamic range of audio in dB.
  1629. @item Zero crossings
  1630. Number of points where the waveform crosses the zero level axis.
  1631. @item Zero crossings rate
  1632. Rate of Zero crossings and number of audio samples.
  1633. @end table
  1634. @section atempo
  1635. Adjust audio tempo.
  1636. The filter accepts exactly one parameter, the audio tempo. If not
  1637. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1638. be in the [0.5, 100.0] range.
  1639. Note that tempo greater than 2 will skip some samples rather than
  1640. blend them in. If for any reason this is a concern it is always
  1641. possible to daisy-chain several instances of atempo to achieve the
  1642. desired product tempo.
  1643. @subsection Examples
  1644. @itemize
  1645. @item
  1646. Slow down audio to 80% tempo:
  1647. @example
  1648. atempo=0.8
  1649. @end example
  1650. @item
  1651. To speed up audio to 300% tempo:
  1652. @example
  1653. atempo=3
  1654. @end example
  1655. @item
  1656. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1657. @example
  1658. atempo=sqrt(3),atempo=sqrt(3)
  1659. @end example
  1660. @end itemize
  1661. @section atrim
  1662. Trim the input so that the output contains one continuous subpart of the input.
  1663. It accepts the following parameters:
  1664. @table @option
  1665. @item start
  1666. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1667. sample with the timestamp @var{start} will be the first sample in the output.
  1668. @item end
  1669. Specify time of the first audio sample that will be dropped, i.e. the
  1670. audio sample immediately preceding the one with the timestamp @var{end} will be
  1671. the last sample in the output.
  1672. @item start_pts
  1673. Same as @var{start}, except this option sets the start timestamp in samples
  1674. instead of seconds.
  1675. @item end_pts
  1676. Same as @var{end}, except this option sets the end timestamp in samples instead
  1677. of seconds.
  1678. @item duration
  1679. The maximum duration of the output in seconds.
  1680. @item start_sample
  1681. The number of the first sample that should be output.
  1682. @item end_sample
  1683. The number of the first sample that should be dropped.
  1684. @end table
  1685. @option{start}, @option{end}, and @option{duration} are expressed as time
  1686. duration specifications; see
  1687. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1688. Note that the first two sets of the start/end options and the @option{duration}
  1689. option look at the frame timestamp, while the _sample options simply count the
  1690. samples that pass through the filter. So start/end_pts and start/end_sample will
  1691. give different results when the timestamps are wrong, inexact or do not start at
  1692. zero. Also note that this filter does not modify the timestamps. If you wish
  1693. to have the output timestamps start at zero, insert the asetpts filter after the
  1694. atrim filter.
  1695. If multiple start or end options are set, this filter tries to be greedy and
  1696. keep all samples that match at least one of the specified constraints. To keep
  1697. only the part that matches all the constraints at once, chain multiple atrim
  1698. filters.
  1699. The defaults are such that all the input is kept. So it is possible to set e.g.
  1700. just the end values to keep everything before the specified time.
  1701. Examples:
  1702. @itemize
  1703. @item
  1704. Drop everything except the second minute of input:
  1705. @example
  1706. ffmpeg -i INPUT -af atrim=60:120
  1707. @end example
  1708. @item
  1709. Keep only the first 1000 samples:
  1710. @example
  1711. ffmpeg -i INPUT -af atrim=end_sample=1000
  1712. @end example
  1713. @end itemize
  1714. @section bandpass
  1715. Apply a two-pole Butterworth band-pass filter with central
  1716. frequency @var{frequency}, and (3dB-point) band-width width.
  1717. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1718. instead of the default: constant 0dB peak gain.
  1719. The filter roll off at 6dB per octave (20dB per decade).
  1720. The filter accepts the following options:
  1721. @table @option
  1722. @item frequency, f
  1723. Set the filter's central frequency. Default is @code{3000}.
  1724. @item csg
  1725. Constant skirt gain if set to 1. Defaults to 0.
  1726. @item width_type, t
  1727. Set method to specify band-width of filter.
  1728. @table @option
  1729. @item h
  1730. Hz
  1731. @item q
  1732. Q-Factor
  1733. @item o
  1734. octave
  1735. @item s
  1736. slope
  1737. @item k
  1738. kHz
  1739. @end table
  1740. @item width, w
  1741. Specify the band-width of a filter in width_type units.
  1742. @item channels, c
  1743. Specify which channels to filter, by default all available are filtered.
  1744. @end table
  1745. @subsection Commands
  1746. This filter supports the following commands:
  1747. @table @option
  1748. @item frequency, f
  1749. Change bandpass frequency.
  1750. Syntax for the command is : "@var{frequency}"
  1751. @item width_type, t
  1752. Change bandpass width_type.
  1753. Syntax for the command is : "@var{width_type}"
  1754. @item width, w
  1755. Change bandpass width.
  1756. Syntax for the command is : "@var{width}"
  1757. @end table
  1758. @section bandreject
  1759. Apply a two-pole Butterworth band-reject filter with central
  1760. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1761. The filter roll off at 6dB per octave (20dB per decade).
  1762. The filter accepts the following options:
  1763. @table @option
  1764. @item frequency, f
  1765. Set the filter's central frequency. Default is @code{3000}.
  1766. @item width_type, t
  1767. Set method to specify band-width of filter.
  1768. @table @option
  1769. @item h
  1770. Hz
  1771. @item q
  1772. Q-Factor
  1773. @item o
  1774. octave
  1775. @item s
  1776. slope
  1777. @item k
  1778. kHz
  1779. @end table
  1780. @item width, w
  1781. Specify the band-width of a filter in width_type units.
  1782. @item channels, c
  1783. Specify which channels to filter, by default all available are filtered.
  1784. @end table
  1785. @subsection Commands
  1786. This filter supports the following commands:
  1787. @table @option
  1788. @item frequency, f
  1789. Change bandreject frequency.
  1790. Syntax for the command is : "@var{frequency}"
  1791. @item width_type, t
  1792. Change bandreject width_type.
  1793. Syntax for the command is : "@var{width_type}"
  1794. @item width, w
  1795. Change bandreject width.
  1796. Syntax for the command is : "@var{width}"
  1797. @end table
  1798. @section bass, lowshelf
  1799. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1800. shelving filter with a response similar to that of a standard
  1801. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1802. The filter accepts the following options:
  1803. @table @option
  1804. @item gain, g
  1805. Give the gain at 0 Hz. Its useful range is about -20
  1806. (for a large cut) to +20 (for a large boost).
  1807. Beware of clipping when using a positive gain.
  1808. @item frequency, f
  1809. Set the filter's central frequency and so can be used
  1810. to extend or reduce the frequency range to be boosted or cut.
  1811. The default value is @code{100} Hz.
  1812. @item width_type, t
  1813. Set method to specify band-width of filter.
  1814. @table @option
  1815. @item h
  1816. Hz
  1817. @item q
  1818. Q-Factor
  1819. @item o
  1820. octave
  1821. @item s
  1822. slope
  1823. @item k
  1824. kHz
  1825. @end table
  1826. @item width, w
  1827. Determine how steep is the filter's shelf transition.
  1828. @item channels, c
  1829. Specify which channels to filter, by default all available are filtered.
  1830. @end table
  1831. @subsection Commands
  1832. This filter supports the following commands:
  1833. @table @option
  1834. @item frequency, f
  1835. Change bass frequency.
  1836. Syntax for the command is : "@var{frequency}"
  1837. @item width_type, t
  1838. Change bass width_type.
  1839. Syntax for the command is : "@var{width_type}"
  1840. @item width, w
  1841. Change bass width.
  1842. Syntax for the command is : "@var{width}"
  1843. @item gain, g
  1844. Change bass gain.
  1845. Syntax for the command is : "@var{gain}"
  1846. @end table
  1847. @section biquad
  1848. Apply a biquad IIR filter with the given coefficients.
  1849. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1850. are the numerator and denominator coefficients respectively.
  1851. and @var{channels}, @var{c} specify which channels to filter, by default all
  1852. available are filtered.
  1853. @subsection Commands
  1854. This filter supports the following commands:
  1855. @table @option
  1856. @item a0
  1857. @item a1
  1858. @item a2
  1859. @item b0
  1860. @item b1
  1861. @item b2
  1862. Change biquad parameter.
  1863. Syntax for the command is : "@var{value}"
  1864. @end table
  1865. @section bs2b
  1866. Bauer stereo to binaural transformation, which improves headphone listening of
  1867. stereo audio records.
  1868. To enable compilation of this filter you need to configure FFmpeg with
  1869. @code{--enable-libbs2b}.
  1870. It accepts the following parameters:
  1871. @table @option
  1872. @item profile
  1873. Pre-defined crossfeed level.
  1874. @table @option
  1875. @item default
  1876. Default level (fcut=700, feed=50).
  1877. @item cmoy
  1878. Chu Moy circuit (fcut=700, feed=60).
  1879. @item jmeier
  1880. Jan Meier circuit (fcut=650, feed=95).
  1881. @end table
  1882. @item fcut
  1883. Cut frequency (in Hz).
  1884. @item feed
  1885. Feed level (in Hz).
  1886. @end table
  1887. @section channelmap
  1888. Remap input channels to new locations.
  1889. It accepts the following parameters:
  1890. @table @option
  1891. @item map
  1892. Map channels from input to output. The argument is a '|'-separated list of
  1893. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1894. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1895. channel (e.g. FL for front left) or its index in the input channel layout.
  1896. @var{out_channel} is the name of the output channel or its index in the output
  1897. channel layout. If @var{out_channel} is not given then it is implicitly an
  1898. index, starting with zero and increasing by one for each mapping.
  1899. @item channel_layout
  1900. The channel layout of the output stream.
  1901. @end table
  1902. If no mapping is present, the filter will implicitly map input channels to
  1903. output channels, preserving indices.
  1904. @subsection Examples
  1905. @itemize
  1906. @item
  1907. For example, assuming a 5.1+downmix input MOV file,
  1908. @example
  1909. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1910. @end example
  1911. will create an output WAV file tagged as stereo from the downmix channels of
  1912. the input.
  1913. @item
  1914. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1915. @example
  1916. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1917. @end example
  1918. @end itemize
  1919. @section channelsplit
  1920. Split each channel from an input audio stream into a separate output stream.
  1921. It accepts the following parameters:
  1922. @table @option
  1923. @item channel_layout
  1924. The channel layout of the input stream. The default is "stereo".
  1925. @item channels
  1926. A channel layout describing the channels to be extracted as separate output streams
  1927. or "all" to extract each input channel as a separate stream. The default is "all".
  1928. Choosing channels not present in channel layout in the input will result in an error.
  1929. @end table
  1930. @subsection Examples
  1931. @itemize
  1932. @item
  1933. For example, assuming a stereo input MP3 file,
  1934. @example
  1935. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1936. @end example
  1937. will create an output Matroska file with two audio streams, one containing only
  1938. the left channel and the other the right channel.
  1939. @item
  1940. Split a 5.1 WAV file into per-channel files:
  1941. @example
  1942. ffmpeg -i in.wav -filter_complex
  1943. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1944. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1945. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1946. side_right.wav
  1947. @end example
  1948. @item
  1949. Extract only LFE from a 5.1 WAV file:
  1950. @example
  1951. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1952. -map '[LFE]' lfe.wav
  1953. @end example
  1954. @end itemize
  1955. @section chorus
  1956. Add a chorus effect to the audio.
  1957. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1958. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1959. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1960. The modulation depth defines the range the modulated delay is played before or after
  1961. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1962. sound tuned around the original one, like in a chorus where some vocals are slightly
  1963. off key.
  1964. It accepts the following parameters:
  1965. @table @option
  1966. @item in_gain
  1967. Set input gain. Default is 0.4.
  1968. @item out_gain
  1969. Set output gain. Default is 0.4.
  1970. @item delays
  1971. Set delays. A typical delay is around 40ms to 60ms.
  1972. @item decays
  1973. Set decays.
  1974. @item speeds
  1975. Set speeds.
  1976. @item depths
  1977. Set depths.
  1978. @end table
  1979. @subsection Examples
  1980. @itemize
  1981. @item
  1982. A single delay:
  1983. @example
  1984. chorus=0.7:0.9:55:0.4:0.25:2
  1985. @end example
  1986. @item
  1987. Two delays:
  1988. @example
  1989. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1990. @end example
  1991. @item
  1992. Fuller sounding chorus with three delays:
  1993. @example
  1994. 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
  1995. @end example
  1996. @end itemize
  1997. @section compand
  1998. Compress or expand the audio's dynamic range.
  1999. It accepts the following parameters:
  2000. @table @option
  2001. @item attacks
  2002. @item decays
  2003. A list of times in seconds for each channel over which the instantaneous level
  2004. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2005. increase of volume and @var{decays} refers to decrease of volume. For most
  2006. situations, the attack time (response to the audio getting louder) should be
  2007. shorter than the decay time, because the human ear is more sensitive to sudden
  2008. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2009. a typical value for decay is 0.8 seconds.
  2010. If specified number of attacks & decays is lower than number of channels, the last
  2011. set attack/decay will be used for all remaining channels.
  2012. @item points
  2013. A list of points for the transfer function, specified in dB relative to the
  2014. maximum possible signal amplitude. Each key points list must be defined using
  2015. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2016. @code{x0/y0 x1/y1 x2/y2 ....}
  2017. The input values must be in strictly increasing order but the transfer function
  2018. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2019. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2020. function are @code{-70/-70|-60/-20|1/0}.
  2021. @item soft-knee
  2022. Set the curve radius in dB for all joints. It defaults to 0.01.
  2023. @item gain
  2024. Set the additional gain in dB to be applied at all points on the transfer
  2025. function. This allows for easy adjustment of the overall gain.
  2026. It defaults to 0.
  2027. @item volume
  2028. Set an initial volume, in dB, to be assumed for each channel when filtering
  2029. starts. This permits the user to supply a nominal level initially, so that, for
  2030. example, a very large gain is not applied to initial signal levels before the
  2031. companding has begun to operate. A typical value for audio which is initially
  2032. quiet is -90 dB. It defaults to 0.
  2033. @item delay
  2034. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2035. delayed before being fed to the volume adjuster. Specifying a delay
  2036. approximately equal to the attack/decay times allows the filter to effectively
  2037. operate in predictive rather than reactive mode. It defaults to 0.
  2038. @end table
  2039. @subsection Examples
  2040. @itemize
  2041. @item
  2042. Make music with both quiet and loud passages suitable for listening to in a
  2043. noisy environment:
  2044. @example
  2045. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2046. @end example
  2047. Another example for audio with whisper and explosion parts:
  2048. @example
  2049. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2050. @end example
  2051. @item
  2052. A noise gate for when the noise is at a lower level than the signal:
  2053. @example
  2054. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2055. @end example
  2056. @item
  2057. Here is another noise gate, this time for when the noise is at a higher level
  2058. than the signal (making it, in some ways, similar to squelch):
  2059. @example
  2060. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2061. @end example
  2062. @item
  2063. 2:1 compression starting at -6dB:
  2064. @example
  2065. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2066. @end example
  2067. @item
  2068. 2:1 compression starting at -9dB:
  2069. @example
  2070. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2071. @end example
  2072. @item
  2073. 2:1 compression starting at -12dB:
  2074. @example
  2075. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2076. @end example
  2077. @item
  2078. 2:1 compression starting at -18dB:
  2079. @example
  2080. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2081. @end example
  2082. @item
  2083. 3:1 compression starting at -15dB:
  2084. @example
  2085. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2086. @end example
  2087. @item
  2088. Compressor/Gate:
  2089. @example
  2090. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2091. @end example
  2092. @item
  2093. Expander:
  2094. @example
  2095. 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
  2096. @end example
  2097. @item
  2098. Hard limiter at -6dB:
  2099. @example
  2100. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2101. @end example
  2102. @item
  2103. Hard limiter at -12dB:
  2104. @example
  2105. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2106. @end example
  2107. @item
  2108. Hard noise gate at -35 dB:
  2109. @example
  2110. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2111. @end example
  2112. @item
  2113. Soft limiter:
  2114. @example
  2115. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2116. @end example
  2117. @end itemize
  2118. @section compensationdelay
  2119. Compensation Delay Line is a metric based delay to compensate differing
  2120. positions of microphones or speakers.
  2121. For example, you have recorded guitar with two microphones placed in
  2122. different location. Because the front of sound wave has fixed speed in
  2123. normal conditions, the phasing of microphones can vary and depends on
  2124. their location and interposition. The best sound mix can be achieved when
  2125. these microphones are in phase (synchronized). Note that distance of
  2126. ~30 cm between microphones makes one microphone to capture signal in
  2127. antiphase to another microphone. That makes the final mix sounding moody.
  2128. This filter helps to solve phasing problems by adding different delays
  2129. to each microphone track and make them synchronized.
  2130. The best result can be reached when you take one track as base and
  2131. synchronize other tracks one by one with it.
  2132. Remember that synchronization/delay tolerance depends on sample rate, too.
  2133. Higher sample rates will give more tolerance.
  2134. It accepts the following parameters:
  2135. @table @option
  2136. @item mm
  2137. Set millimeters distance. This is compensation distance for fine tuning.
  2138. Default is 0.
  2139. @item cm
  2140. Set cm distance. This is compensation distance for tightening distance setup.
  2141. Default is 0.
  2142. @item m
  2143. Set meters distance. This is compensation distance for hard distance setup.
  2144. Default is 0.
  2145. @item dry
  2146. Set dry amount. Amount of unprocessed (dry) signal.
  2147. Default is 0.
  2148. @item wet
  2149. Set wet amount. Amount of processed (wet) signal.
  2150. Default is 1.
  2151. @item temp
  2152. Set temperature degree in Celsius. This is the temperature of the environment.
  2153. Default is 20.
  2154. @end table
  2155. @section crossfeed
  2156. Apply headphone crossfeed filter.
  2157. Crossfeed is the process of blending the left and right channels of stereo
  2158. audio recording.
  2159. It is mainly used to reduce extreme stereo separation of low frequencies.
  2160. The intent is to produce more speaker like sound to the listener.
  2161. The filter accepts the following options:
  2162. @table @option
  2163. @item strength
  2164. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2165. This sets gain of low shelf filter for side part of stereo image.
  2166. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2167. @item range
  2168. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2169. This sets cut off frequency of low shelf filter. Default is cut off near
  2170. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2171. @item level_in
  2172. Set input gain. Default is 0.9.
  2173. @item level_out
  2174. Set output gain. Default is 1.
  2175. @end table
  2176. @section crystalizer
  2177. Simple algorithm to expand audio dynamic range.
  2178. The filter accepts the following options:
  2179. @table @option
  2180. @item i
  2181. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2182. (unchanged sound) to 10.0 (maximum effect).
  2183. @item c
  2184. Enable clipping. By default is enabled.
  2185. @end table
  2186. @section dcshift
  2187. Apply a DC shift to the audio.
  2188. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2189. in the recording chain) from the audio. The effect of a DC offset is reduced
  2190. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2191. a signal has a DC offset.
  2192. @table @option
  2193. @item shift
  2194. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2195. the audio.
  2196. @item limitergain
  2197. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2198. used to prevent clipping.
  2199. @end table
  2200. @section drmeter
  2201. Measure audio dynamic range.
  2202. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2203. is found in transition material. And anything less that 8 have very poor dynamics
  2204. and is very compressed.
  2205. The filter accepts the following options:
  2206. @table @option
  2207. @item length
  2208. Set window length in seconds used to split audio into segments of equal length.
  2209. Default is 3 seconds.
  2210. @end table
  2211. @section dynaudnorm
  2212. Dynamic Audio Normalizer.
  2213. This filter applies a certain amount of gain to the input audio in order
  2214. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2215. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2216. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2217. This allows for applying extra gain to the "quiet" sections of the audio
  2218. while avoiding distortions or clipping the "loud" sections. In other words:
  2219. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2220. sections, in the sense that the volume of each section is brought to the
  2221. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2222. this goal *without* applying "dynamic range compressing". It will retain 100%
  2223. of the dynamic range *within* each section of the audio file.
  2224. @table @option
  2225. @item f
  2226. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2227. Default is 500 milliseconds.
  2228. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2229. referred to as frames. This is required, because a peak magnitude has no
  2230. meaning for just a single sample value. Instead, we need to determine the
  2231. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2232. normalizer would simply use the peak magnitude of the complete file, the
  2233. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2234. frame. The length of a frame is specified in milliseconds. By default, the
  2235. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2236. been found to give good results with most files.
  2237. Note that the exact frame length, in number of samples, will be determined
  2238. automatically, based on the sampling rate of the individual input audio file.
  2239. @item g
  2240. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2241. number. Default is 31.
  2242. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2243. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2244. is specified in frames, centered around the current frame. For the sake of
  2245. simplicity, this must be an odd number. Consequently, the default value of 31
  2246. takes into account the current frame, as well as the 15 preceding frames and
  2247. the 15 subsequent frames. Using a larger window results in a stronger
  2248. smoothing effect and thus in less gain variation, i.e. slower gain
  2249. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2250. effect and thus in more gain variation, i.e. faster gain adaptation.
  2251. In other words, the more you increase this value, the more the Dynamic Audio
  2252. Normalizer will behave like a "traditional" normalization filter. On the
  2253. contrary, the more you decrease this value, the more the Dynamic Audio
  2254. Normalizer will behave like a dynamic range compressor.
  2255. @item p
  2256. Set the target peak value. This specifies the highest permissible magnitude
  2257. level for the normalized audio input. This filter will try to approach the
  2258. target peak magnitude as closely as possible, but at the same time it also
  2259. makes sure that the normalized signal will never exceed the peak magnitude.
  2260. A frame's maximum local gain factor is imposed directly by the target peak
  2261. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2262. It is not recommended to go above this value.
  2263. @item m
  2264. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2265. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2266. factor for each input frame, i.e. the maximum gain factor that does not
  2267. result in clipping or distortion. The maximum gain factor is determined by
  2268. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2269. additionally bounds the frame's maximum gain factor by a predetermined
  2270. (global) maximum gain factor. This is done in order to avoid excessive gain
  2271. factors in "silent" or almost silent frames. By default, the maximum gain
  2272. factor is 10.0, For most inputs the default value should be sufficient and
  2273. it usually is not recommended to increase this value. Though, for input
  2274. with an extremely low overall volume level, it may be necessary to allow even
  2275. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2276. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2277. Instead, a "sigmoid" threshold function will be applied. This way, the
  2278. gain factors will smoothly approach the threshold value, but never exceed that
  2279. value.
  2280. @item r
  2281. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2282. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2283. This means that the maximum local gain factor for each frame is defined
  2284. (only) by the frame's highest magnitude sample. This way, the samples can
  2285. be amplified as much as possible without exceeding the maximum signal
  2286. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2287. Normalizer can also take into account the frame's root mean square,
  2288. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2289. determine the power of a time-varying signal. It is therefore considered
  2290. that the RMS is a better approximation of the "perceived loudness" than
  2291. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2292. frames to a constant RMS value, a uniform "perceived loudness" can be
  2293. established. If a target RMS value has been specified, a frame's local gain
  2294. factor is defined as the factor that would result in exactly that RMS value.
  2295. Note, however, that the maximum local gain factor is still restricted by the
  2296. frame's highest magnitude sample, in order to prevent clipping.
  2297. @item n
  2298. Enable channels coupling. By default is enabled.
  2299. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2300. amount. This means the same gain factor will be applied to all channels, i.e.
  2301. the maximum possible gain factor is determined by the "loudest" channel.
  2302. However, in some recordings, it may happen that the volume of the different
  2303. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2304. In this case, this option can be used to disable the channel coupling. This way,
  2305. the gain factor will be determined independently for each channel, depending
  2306. only on the individual channel's highest magnitude sample. This allows for
  2307. harmonizing the volume of the different channels.
  2308. @item c
  2309. Enable DC bias correction. By default is disabled.
  2310. An audio signal (in the time domain) is a sequence of sample values.
  2311. In the Dynamic Audio Normalizer these sample values are represented in the
  2312. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2313. audio signal, or "waveform", should be centered around the zero point.
  2314. That means if we calculate the mean value of all samples in a file, or in a
  2315. single frame, then the result should be 0.0 or at least very close to that
  2316. value. If, however, there is a significant deviation of the mean value from
  2317. 0.0, in either positive or negative direction, this is referred to as a
  2318. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2319. Audio Normalizer provides optional DC bias correction.
  2320. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2321. the mean value, or "DC correction" offset, of each input frame and subtract
  2322. that value from all of the frame's sample values which ensures those samples
  2323. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2324. boundaries, the DC correction offset values will be interpolated smoothly
  2325. between neighbouring frames.
  2326. @item b
  2327. Enable alternative boundary mode. By default is disabled.
  2328. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2329. around each frame. This includes the preceding frames as well as the
  2330. subsequent frames. However, for the "boundary" frames, located at the very
  2331. beginning and at the very end of the audio file, not all neighbouring
  2332. frames are available. In particular, for the first few frames in the audio
  2333. file, the preceding frames are not known. And, similarly, for the last few
  2334. frames in the audio file, the subsequent frames are not known. Thus, the
  2335. question arises which gain factors should be assumed for the missing frames
  2336. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2337. to deal with this situation. The default boundary mode assumes a gain factor
  2338. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2339. "fade out" at the beginning and at the end of the input, respectively.
  2340. @item s
  2341. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2342. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2343. compression. This means that signal peaks will not be pruned and thus the
  2344. full dynamic range will be retained within each local neighbourhood. However,
  2345. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2346. normalization algorithm with a more "traditional" compression.
  2347. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2348. (thresholding) function. If (and only if) the compression feature is enabled,
  2349. all input frames will be processed by a soft knee thresholding function prior
  2350. to the actual normalization process. Put simply, the thresholding function is
  2351. going to prune all samples whose magnitude exceeds a certain threshold value.
  2352. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2353. value. Instead, the threshold value will be adjusted for each individual
  2354. frame.
  2355. In general, smaller parameters result in stronger compression, and vice versa.
  2356. Values below 3.0 are not recommended, because audible distortion may appear.
  2357. @end table
  2358. @section earwax
  2359. Make audio easier to listen to on headphones.
  2360. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2361. so that when listened to on headphones the stereo image is moved from
  2362. inside your head (standard for headphones) to outside and in front of
  2363. the listener (standard for speakers).
  2364. Ported from SoX.
  2365. @section equalizer
  2366. Apply a two-pole peaking equalisation (EQ) filter. With this
  2367. filter, the signal-level at and around a selected frequency can
  2368. be increased or decreased, whilst (unlike bandpass and bandreject
  2369. filters) that at all other frequencies is unchanged.
  2370. In order to produce complex equalisation curves, this filter can
  2371. be given several times, each with a different central frequency.
  2372. The filter accepts the following options:
  2373. @table @option
  2374. @item frequency, f
  2375. Set the filter's central frequency in Hz.
  2376. @item width_type, t
  2377. Set method to specify band-width of filter.
  2378. @table @option
  2379. @item h
  2380. Hz
  2381. @item q
  2382. Q-Factor
  2383. @item o
  2384. octave
  2385. @item s
  2386. slope
  2387. @item k
  2388. kHz
  2389. @end table
  2390. @item width, w
  2391. Specify the band-width of a filter in width_type units.
  2392. @item gain, g
  2393. Set the required gain or attenuation in dB.
  2394. Beware of clipping when using a positive gain.
  2395. @item channels, c
  2396. Specify which channels to filter, by default all available are filtered.
  2397. @end table
  2398. @subsection Examples
  2399. @itemize
  2400. @item
  2401. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2402. @example
  2403. equalizer=f=1000:t=h:width=200:g=-10
  2404. @end example
  2405. @item
  2406. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2407. @example
  2408. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2409. @end example
  2410. @end itemize
  2411. @subsection Commands
  2412. This filter supports the following commands:
  2413. @table @option
  2414. @item frequency, f
  2415. Change equalizer frequency.
  2416. Syntax for the command is : "@var{frequency}"
  2417. @item width_type, t
  2418. Change equalizer width_type.
  2419. Syntax for the command is : "@var{width_type}"
  2420. @item width, w
  2421. Change equalizer width.
  2422. Syntax for the command is : "@var{width}"
  2423. @item gain, g
  2424. Change equalizer gain.
  2425. Syntax for the command is : "@var{gain}"
  2426. @end table
  2427. @section extrastereo
  2428. Linearly increases the difference between left and right channels which
  2429. adds some sort of "live" effect to playback.
  2430. The filter accepts the following options:
  2431. @table @option
  2432. @item m
  2433. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2434. (average of both channels), with 1.0 sound will be unchanged, with
  2435. -1.0 left and right channels will be swapped.
  2436. @item c
  2437. Enable clipping. By default is enabled.
  2438. @end table
  2439. @section firequalizer
  2440. Apply FIR Equalization using arbitrary frequency response.
  2441. The filter accepts the following option:
  2442. @table @option
  2443. @item gain
  2444. Set gain curve equation (in dB). The expression can contain variables:
  2445. @table @option
  2446. @item f
  2447. the evaluated frequency
  2448. @item sr
  2449. sample rate
  2450. @item ch
  2451. channel number, set to 0 when multichannels evaluation is disabled
  2452. @item chid
  2453. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2454. multichannels evaluation is disabled
  2455. @item chs
  2456. number of channels
  2457. @item chlayout
  2458. channel_layout, see libavutil/channel_layout.h
  2459. @end table
  2460. and functions:
  2461. @table @option
  2462. @item gain_interpolate(f)
  2463. interpolate gain on frequency f based on gain_entry
  2464. @item cubic_interpolate(f)
  2465. same as gain_interpolate, but smoother
  2466. @end table
  2467. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2468. @item gain_entry
  2469. Set gain entry for gain_interpolate function. The expression can
  2470. contain functions:
  2471. @table @option
  2472. @item entry(f, g)
  2473. store gain entry at frequency f with value g
  2474. @end table
  2475. This option is also available as command.
  2476. @item delay
  2477. Set filter delay in seconds. Higher value means more accurate.
  2478. Default is @code{0.01}.
  2479. @item accuracy
  2480. Set filter accuracy in Hz. Lower value means more accurate.
  2481. Default is @code{5}.
  2482. @item wfunc
  2483. Set window function. Acceptable values are:
  2484. @table @option
  2485. @item rectangular
  2486. rectangular window, useful when gain curve is already smooth
  2487. @item hann
  2488. hann window (default)
  2489. @item hamming
  2490. hamming window
  2491. @item blackman
  2492. blackman window
  2493. @item nuttall3
  2494. 3-terms continuous 1st derivative nuttall window
  2495. @item mnuttall3
  2496. minimum 3-terms discontinuous nuttall window
  2497. @item nuttall
  2498. 4-terms continuous 1st derivative nuttall window
  2499. @item bnuttall
  2500. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2501. @item bharris
  2502. blackman-harris window
  2503. @item tukey
  2504. tukey window
  2505. @end table
  2506. @item fixed
  2507. If enabled, use fixed number of audio samples. This improves speed when
  2508. filtering with large delay. Default is disabled.
  2509. @item multi
  2510. Enable multichannels evaluation on gain. Default is disabled.
  2511. @item zero_phase
  2512. Enable zero phase mode by subtracting timestamp to compensate delay.
  2513. Default is disabled.
  2514. @item scale
  2515. Set scale used by gain. Acceptable values are:
  2516. @table @option
  2517. @item linlin
  2518. linear frequency, linear gain
  2519. @item linlog
  2520. linear frequency, logarithmic (in dB) gain (default)
  2521. @item loglin
  2522. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2523. @item loglog
  2524. logarithmic frequency, logarithmic gain
  2525. @end table
  2526. @item dumpfile
  2527. Set file for dumping, suitable for gnuplot.
  2528. @item dumpscale
  2529. Set scale for dumpfile. Acceptable values are same with scale option.
  2530. Default is linlog.
  2531. @item fft2
  2532. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2533. Default is disabled.
  2534. @item min_phase
  2535. Enable minimum phase impulse response. Default is disabled.
  2536. @end table
  2537. @subsection Examples
  2538. @itemize
  2539. @item
  2540. lowpass at 1000 Hz:
  2541. @example
  2542. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2543. @end example
  2544. @item
  2545. lowpass at 1000 Hz with gain_entry:
  2546. @example
  2547. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2548. @end example
  2549. @item
  2550. custom equalization:
  2551. @example
  2552. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2553. @end example
  2554. @item
  2555. higher delay with zero phase to compensate delay:
  2556. @example
  2557. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2558. @end example
  2559. @item
  2560. lowpass on left channel, highpass on right channel:
  2561. @example
  2562. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2563. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2564. @end example
  2565. @end itemize
  2566. @section flanger
  2567. Apply a flanging effect to the audio.
  2568. The filter accepts the following options:
  2569. @table @option
  2570. @item delay
  2571. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2572. @item depth
  2573. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2574. @item regen
  2575. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2576. Default value is 0.
  2577. @item width
  2578. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2579. Default value is 71.
  2580. @item speed
  2581. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2582. @item shape
  2583. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2584. Default value is @var{sinusoidal}.
  2585. @item phase
  2586. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2587. Default value is 25.
  2588. @item interp
  2589. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2590. Default is @var{linear}.
  2591. @end table
  2592. @section haas
  2593. Apply Haas effect to audio.
  2594. Note that this makes most sense to apply on mono signals.
  2595. With this filter applied to mono signals it give some directionality and
  2596. stretches its stereo image.
  2597. The filter accepts the following options:
  2598. @table @option
  2599. @item level_in
  2600. Set input level. By default is @var{1}, or 0dB
  2601. @item level_out
  2602. Set output level. By default is @var{1}, or 0dB.
  2603. @item side_gain
  2604. Set gain applied to side part of signal. By default is @var{1}.
  2605. @item middle_source
  2606. Set kind of middle source. Can be one of the following:
  2607. @table @samp
  2608. @item left
  2609. Pick left channel.
  2610. @item right
  2611. Pick right channel.
  2612. @item mid
  2613. Pick middle part signal of stereo image.
  2614. @item side
  2615. Pick side part signal of stereo image.
  2616. @end table
  2617. @item middle_phase
  2618. Change middle phase. By default is disabled.
  2619. @item left_delay
  2620. Set left channel delay. By default is @var{2.05} milliseconds.
  2621. @item left_balance
  2622. Set left channel balance. By default is @var{-1}.
  2623. @item left_gain
  2624. Set left channel gain. By default is @var{1}.
  2625. @item left_phase
  2626. Change left phase. By default is disabled.
  2627. @item right_delay
  2628. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2629. @item right_balance
  2630. Set right channel balance. By default is @var{1}.
  2631. @item right_gain
  2632. Set right channel gain. By default is @var{1}.
  2633. @item right_phase
  2634. Change right phase. By default is enabled.
  2635. @end table
  2636. @section hdcd
  2637. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2638. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2639. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2640. of HDCD, and detects the Transient Filter flag.
  2641. @example
  2642. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2643. @end example
  2644. When using the filter with wav, note the default encoding for wav is 16-bit,
  2645. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2646. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2647. @example
  2648. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2649. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2650. @end example
  2651. The filter accepts the following options:
  2652. @table @option
  2653. @item disable_autoconvert
  2654. Disable any automatic format conversion or resampling in the filter graph.
  2655. @item process_stereo
  2656. Process the stereo channels together. If target_gain does not match between
  2657. channels, consider it invalid and use the last valid target_gain.
  2658. @item cdt_ms
  2659. Set the code detect timer period in ms.
  2660. @item force_pe
  2661. Always extend peaks above -3dBFS even if PE isn't signaled.
  2662. @item analyze_mode
  2663. Replace audio with a solid tone and adjust the amplitude to signal some
  2664. specific aspect of the decoding process. The output file can be loaded in
  2665. an audio editor alongside the original to aid analysis.
  2666. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2667. Modes are:
  2668. @table @samp
  2669. @item 0, off
  2670. Disabled
  2671. @item 1, lle
  2672. Gain adjustment level at each sample
  2673. @item 2, pe
  2674. Samples where peak extend occurs
  2675. @item 3, cdt
  2676. Samples where the code detect timer is active
  2677. @item 4, tgm
  2678. Samples where the target gain does not match between channels
  2679. @end table
  2680. @end table
  2681. @section headphone
  2682. Apply head-related transfer functions (HRTFs) to create virtual
  2683. loudspeakers around the user for binaural listening via headphones.
  2684. The HRIRs are provided via additional streams, for each channel
  2685. one stereo input stream is needed.
  2686. The filter accepts the following options:
  2687. @table @option
  2688. @item map
  2689. Set mapping of input streams for convolution.
  2690. The argument is a '|'-separated list of channel names in order as they
  2691. are given as additional stream inputs for filter.
  2692. This also specify number of input streams. Number of input streams
  2693. must be not less than number of channels in first stream plus one.
  2694. @item gain
  2695. Set gain applied to audio. Value is in dB. Default is 0.
  2696. @item type
  2697. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2698. processing audio in time domain which is slow.
  2699. @var{freq} is processing audio in frequency domain which is fast.
  2700. Default is @var{freq}.
  2701. @item lfe
  2702. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2703. @item size
  2704. Set size of frame in number of samples which will be processed at once.
  2705. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2706. @item hrir
  2707. Set format of hrir stream.
  2708. Default value is @var{stereo}. Alternative value is @var{multich}.
  2709. If value is set to @var{stereo}, number of additional streams should
  2710. be greater or equal to number of input channels in first input stream.
  2711. Also each additional stream should have stereo number of channels.
  2712. If value is set to @var{multich}, number of additional streams should
  2713. be exactly one. Also number of input channels of additional stream
  2714. should be equal or greater than twice number of channels of first input
  2715. stream.
  2716. @end table
  2717. @subsection Examples
  2718. @itemize
  2719. @item
  2720. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2721. each amovie filter use stereo file with IR coefficients as input.
  2722. The files give coefficients for each position of virtual loudspeaker:
  2723. @example
  2724. 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"
  2725. output.wav
  2726. @end example
  2727. @item
  2728. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2729. but now in @var{multich} @var{hrir} format.
  2730. @example
  2731. 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"
  2732. output.wav
  2733. @end example
  2734. @end itemize
  2735. @section highpass
  2736. Apply a high-pass filter with 3dB point frequency.
  2737. The filter can be either single-pole, or double-pole (the default).
  2738. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2739. The filter accepts the following options:
  2740. @table @option
  2741. @item frequency, f
  2742. Set frequency in Hz. Default is 3000.
  2743. @item poles, p
  2744. Set number of poles. Default is 2.
  2745. @item width_type, t
  2746. Set method to specify band-width of filter.
  2747. @table @option
  2748. @item h
  2749. Hz
  2750. @item q
  2751. Q-Factor
  2752. @item o
  2753. octave
  2754. @item s
  2755. slope
  2756. @item k
  2757. kHz
  2758. @end table
  2759. @item width, w
  2760. Specify the band-width of a filter in width_type units.
  2761. Applies only to double-pole filter.
  2762. The default is 0.707q and gives a Butterworth response.
  2763. @item channels, c
  2764. Specify which channels to filter, by default all available are filtered.
  2765. @end table
  2766. @subsection Commands
  2767. This filter supports the following commands:
  2768. @table @option
  2769. @item frequency, f
  2770. Change highpass frequency.
  2771. Syntax for the command is : "@var{frequency}"
  2772. @item width_type, t
  2773. Change highpass width_type.
  2774. Syntax for the command is : "@var{width_type}"
  2775. @item width, w
  2776. Change highpass width.
  2777. Syntax for the command is : "@var{width}"
  2778. @end table
  2779. @section join
  2780. Join multiple input streams into one multi-channel stream.
  2781. It accepts the following parameters:
  2782. @table @option
  2783. @item inputs
  2784. The number of input streams. It defaults to 2.
  2785. @item channel_layout
  2786. The desired output channel layout. It defaults to stereo.
  2787. @item map
  2788. Map channels from inputs to output. The argument is a '|'-separated list of
  2789. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2790. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2791. can be either the name of the input channel (e.g. FL for front left) or its
  2792. index in the specified input stream. @var{out_channel} is the name of the output
  2793. channel.
  2794. @end table
  2795. The filter will attempt to guess the mappings when they are not specified
  2796. explicitly. It does so by first trying to find an unused matching input channel
  2797. and if that fails it picks the first unused input channel.
  2798. Join 3 inputs (with properly set channel layouts):
  2799. @example
  2800. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2801. @end example
  2802. Build a 5.1 output from 6 single-channel streams:
  2803. @example
  2804. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2805. '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'
  2806. out
  2807. @end example
  2808. @section ladspa
  2809. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2810. To enable compilation of this filter you need to configure FFmpeg with
  2811. @code{--enable-ladspa}.
  2812. @table @option
  2813. @item file, f
  2814. Specifies the name of LADSPA plugin library to load. If the environment
  2815. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2816. each one of the directories specified by the colon separated list in
  2817. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2818. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2819. @file{/usr/lib/ladspa/}.
  2820. @item plugin, p
  2821. Specifies the plugin within the library. Some libraries contain only
  2822. one plugin, but others contain many of them. If this is not set filter
  2823. will list all available plugins within the specified library.
  2824. @item controls, c
  2825. Set the '|' separated list of controls which are zero or more floating point
  2826. values that determine the behavior of the loaded plugin (for example delay,
  2827. threshold or gain).
  2828. Controls need to be defined using the following syntax:
  2829. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2830. @var{valuei} is the value set on the @var{i}-th control.
  2831. Alternatively they can be also defined using the following syntax:
  2832. @var{value0}|@var{value1}|@var{value2}|..., where
  2833. @var{valuei} is the value set on the @var{i}-th control.
  2834. If @option{controls} is set to @code{help}, all available controls and
  2835. their valid ranges are printed.
  2836. @item sample_rate, s
  2837. Specify the sample rate, default to 44100. Only used if plugin have
  2838. zero inputs.
  2839. @item nb_samples, n
  2840. Set the number of samples per channel per each output frame, default
  2841. is 1024. Only used if plugin have zero inputs.
  2842. @item duration, d
  2843. Set the minimum duration of the sourced audio. See
  2844. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2845. for the accepted syntax.
  2846. Note that the resulting duration may be greater than the specified duration,
  2847. as the generated audio is always cut at the end of a complete frame.
  2848. If not specified, or the expressed duration is negative, the audio is
  2849. supposed to be generated forever.
  2850. Only used if plugin have zero inputs.
  2851. @end table
  2852. @subsection Examples
  2853. @itemize
  2854. @item
  2855. List all available plugins within amp (LADSPA example plugin) library:
  2856. @example
  2857. ladspa=file=amp
  2858. @end example
  2859. @item
  2860. List all available controls and their valid ranges for @code{vcf_notch}
  2861. plugin from @code{VCF} library:
  2862. @example
  2863. ladspa=f=vcf:p=vcf_notch:c=help
  2864. @end example
  2865. @item
  2866. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2867. plugin library:
  2868. @example
  2869. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2870. @end example
  2871. @item
  2872. Add reverberation to the audio using TAP-plugins
  2873. (Tom's Audio Processing plugins):
  2874. @example
  2875. ladspa=file=tap_reverb:tap_reverb
  2876. @end example
  2877. @item
  2878. Generate white noise, with 0.2 amplitude:
  2879. @example
  2880. ladspa=file=cmt:noise_source_white:c=c0=.2
  2881. @end example
  2882. @item
  2883. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2884. @code{C* Audio Plugin Suite} (CAPS) library:
  2885. @example
  2886. ladspa=file=caps:Click:c=c1=20'
  2887. @end example
  2888. @item
  2889. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2890. @example
  2891. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2892. @end example
  2893. @item
  2894. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2895. @code{SWH Plugins} collection:
  2896. @example
  2897. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2898. @end example
  2899. @item
  2900. Attenuate low frequencies using Multiband EQ from Steve Harris
  2901. @code{SWH Plugins} collection:
  2902. @example
  2903. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2904. @end example
  2905. @item
  2906. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2907. (CAPS) library:
  2908. @example
  2909. ladspa=caps:Narrower
  2910. @end example
  2911. @item
  2912. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2913. @example
  2914. ladspa=caps:White:.2
  2915. @end example
  2916. @item
  2917. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2918. @example
  2919. ladspa=caps:Fractal:c=c1=1
  2920. @end example
  2921. @item
  2922. Dynamic volume normalization using @code{VLevel} plugin:
  2923. @example
  2924. ladspa=vlevel-ladspa:vlevel_mono
  2925. @end example
  2926. @end itemize
  2927. @subsection Commands
  2928. This filter supports the following commands:
  2929. @table @option
  2930. @item cN
  2931. Modify the @var{N}-th control value.
  2932. If the specified value is not valid, it is ignored and prior one is kept.
  2933. @end table
  2934. @section loudnorm
  2935. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2936. Support for both single pass (livestreams, files) and double pass (files) modes.
  2937. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2938. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2939. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item I, i
  2943. Set integrated loudness target.
  2944. Range is -70.0 - -5.0. Default value is -24.0.
  2945. @item LRA, lra
  2946. Set loudness range target.
  2947. Range is 1.0 - 20.0. Default value is 7.0.
  2948. @item TP, tp
  2949. Set maximum true peak.
  2950. Range is -9.0 - +0.0. Default value is -2.0.
  2951. @item measured_I, measured_i
  2952. Measured IL of input file.
  2953. Range is -99.0 - +0.0.
  2954. @item measured_LRA, measured_lra
  2955. Measured LRA of input file.
  2956. Range is 0.0 - 99.0.
  2957. @item measured_TP, measured_tp
  2958. Measured true peak of input file.
  2959. Range is -99.0 - +99.0.
  2960. @item measured_thresh
  2961. Measured threshold of input file.
  2962. Range is -99.0 - +0.0.
  2963. @item offset
  2964. Set offset gain. Gain is applied before the true-peak limiter.
  2965. Range is -99.0 - +99.0. Default is +0.0.
  2966. @item linear
  2967. Normalize linearly if possible.
  2968. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2969. to be specified in order to use this mode.
  2970. Options are true or false. Default is true.
  2971. @item dual_mono
  2972. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2973. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2974. If set to @code{true}, this option will compensate for this effect.
  2975. Multi-channel input files are not affected by this option.
  2976. Options are true or false. Default is false.
  2977. @item print_format
  2978. Set print format for stats. Options are summary, json, or none.
  2979. Default value is none.
  2980. @end table
  2981. @section lowpass
  2982. Apply a low-pass filter with 3dB point frequency.
  2983. The filter can be either single-pole or double-pole (the default).
  2984. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2985. The filter accepts the following options:
  2986. @table @option
  2987. @item frequency, f
  2988. Set frequency in Hz. Default is 500.
  2989. @item poles, p
  2990. Set number of poles. Default is 2.
  2991. @item width_type, t
  2992. Set method to specify band-width of filter.
  2993. @table @option
  2994. @item h
  2995. Hz
  2996. @item q
  2997. Q-Factor
  2998. @item o
  2999. octave
  3000. @item s
  3001. slope
  3002. @item k
  3003. kHz
  3004. @end table
  3005. @item width, w
  3006. Specify the band-width of a filter in width_type units.
  3007. Applies only to double-pole filter.
  3008. The default is 0.707q and gives a Butterworth response.
  3009. @item channels, c
  3010. Specify which channels to filter, by default all available are filtered.
  3011. @end table
  3012. @subsection Examples
  3013. @itemize
  3014. @item
  3015. Lowpass only LFE channel, it LFE is not present it does nothing:
  3016. @example
  3017. lowpass=c=LFE
  3018. @end example
  3019. @end itemize
  3020. @subsection Commands
  3021. This filter supports the following commands:
  3022. @table @option
  3023. @item frequency, f
  3024. Change lowpass frequency.
  3025. Syntax for the command is : "@var{frequency}"
  3026. @item width_type, t
  3027. Change lowpass width_type.
  3028. Syntax for the command is : "@var{width_type}"
  3029. @item width, w
  3030. Change lowpass width.
  3031. Syntax for the command is : "@var{width}"
  3032. @end table
  3033. @section lv2
  3034. Load a LV2 (LADSPA Version 2) plugin.
  3035. To enable compilation of this filter you need to configure FFmpeg with
  3036. @code{--enable-lv2}.
  3037. @table @option
  3038. @item plugin, p
  3039. Specifies the plugin URI. You may need to escape ':'.
  3040. @item controls, c
  3041. Set the '|' separated list of controls which are zero or more floating point
  3042. values that determine the behavior of the loaded plugin (for example delay,
  3043. threshold or gain).
  3044. If @option{controls} is set to @code{help}, all available controls and
  3045. their valid ranges are printed.
  3046. @item sample_rate, s
  3047. Specify the sample rate, default to 44100. Only used if plugin have
  3048. zero inputs.
  3049. @item nb_samples, n
  3050. Set the number of samples per channel per each output frame, default
  3051. is 1024. Only used if plugin have zero inputs.
  3052. @item duration, d
  3053. Set the minimum duration of the sourced audio. See
  3054. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3055. for the accepted syntax.
  3056. Note that the resulting duration may be greater than the specified duration,
  3057. as the generated audio is always cut at the end of a complete frame.
  3058. If not specified, or the expressed duration is negative, the audio is
  3059. supposed to be generated forever.
  3060. Only used if plugin have zero inputs.
  3061. @end table
  3062. @subsection Examples
  3063. @itemize
  3064. @item
  3065. Apply bass enhancer plugin from Calf:
  3066. @example
  3067. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3068. @end example
  3069. @item
  3070. Apply vinyl plugin from Calf:
  3071. @example
  3072. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3073. @end example
  3074. @item
  3075. Apply bit crusher plugin from ArtyFX:
  3076. @example
  3077. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3078. @end example
  3079. @end itemize
  3080. @section mcompand
  3081. Multiband Compress or expand the audio's dynamic range.
  3082. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3083. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3084. response when absent compander action.
  3085. It accepts the following parameters:
  3086. @table @option
  3087. @item args
  3088. This option syntax is:
  3089. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3090. For explanation of each item refer to compand filter documentation.
  3091. @end table
  3092. @anchor{pan}
  3093. @section pan
  3094. Mix channels with specific gain levels. The filter accepts the output
  3095. channel layout followed by a set of channels definitions.
  3096. This filter is also designed to efficiently remap the channels of an audio
  3097. stream.
  3098. The filter accepts parameters of the form:
  3099. "@var{l}|@var{outdef}|@var{outdef}|..."
  3100. @table @option
  3101. @item l
  3102. output channel layout or number of channels
  3103. @item outdef
  3104. output channel specification, of the form:
  3105. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3106. @item out_name
  3107. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3108. number (c0, c1, etc.)
  3109. @item gain
  3110. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3111. @item in_name
  3112. input channel to use, see out_name for details; it is not possible to mix
  3113. named and numbered input channels
  3114. @end table
  3115. If the `=' in a channel specification is replaced by `<', then the gains for
  3116. that specification will be renormalized so that the total is 1, thus
  3117. avoiding clipping noise.
  3118. @subsection Mixing examples
  3119. For example, if you want to down-mix from stereo to mono, but with a bigger
  3120. factor for the left channel:
  3121. @example
  3122. pan=1c|c0=0.9*c0+0.1*c1
  3123. @end example
  3124. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3125. 7-channels surround:
  3126. @example
  3127. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3128. @end example
  3129. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3130. that should be preferred (see "-ac" option) unless you have very specific
  3131. needs.
  3132. @subsection Remapping examples
  3133. The channel remapping will be effective if, and only if:
  3134. @itemize
  3135. @item gain coefficients are zeroes or ones,
  3136. @item only one input per channel output,
  3137. @end itemize
  3138. If all these conditions are satisfied, the filter will notify the user ("Pure
  3139. channel mapping detected"), and use an optimized and lossless method to do the
  3140. remapping.
  3141. For example, if you have a 5.1 source and want a stereo audio stream by
  3142. dropping the extra channels:
  3143. @example
  3144. pan="stereo| c0=FL | c1=FR"
  3145. @end example
  3146. Given the same source, you can also switch front left and front right channels
  3147. and keep the input channel layout:
  3148. @example
  3149. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3150. @end example
  3151. If the input is a stereo audio stream, you can mute the front left channel (and
  3152. still keep the stereo channel layout) with:
  3153. @example
  3154. pan="stereo|c1=c1"
  3155. @end example
  3156. Still with a stereo audio stream input, you can copy the right channel in both
  3157. front left and right:
  3158. @example
  3159. pan="stereo| c0=FR | c1=FR"
  3160. @end example
  3161. @section replaygain
  3162. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3163. outputs it unchanged.
  3164. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3165. @section resample
  3166. Convert the audio sample format, sample rate and channel layout. It is
  3167. not meant to be used directly.
  3168. @section rubberband
  3169. Apply time-stretching and pitch-shifting with librubberband.
  3170. To enable compilation of this filter, you need to configure FFmpeg with
  3171. @code{--enable-librubberband}.
  3172. The filter accepts the following options:
  3173. @table @option
  3174. @item tempo
  3175. Set tempo scale factor.
  3176. @item pitch
  3177. Set pitch scale factor.
  3178. @item transients
  3179. Set transients detector.
  3180. Possible values are:
  3181. @table @var
  3182. @item crisp
  3183. @item mixed
  3184. @item smooth
  3185. @end table
  3186. @item detector
  3187. Set detector.
  3188. Possible values are:
  3189. @table @var
  3190. @item compound
  3191. @item percussive
  3192. @item soft
  3193. @end table
  3194. @item phase
  3195. Set phase.
  3196. Possible values are:
  3197. @table @var
  3198. @item laminar
  3199. @item independent
  3200. @end table
  3201. @item window
  3202. Set processing window size.
  3203. Possible values are:
  3204. @table @var
  3205. @item standard
  3206. @item short
  3207. @item long
  3208. @end table
  3209. @item smoothing
  3210. Set smoothing.
  3211. Possible values are:
  3212. @table @var
  3213. @item off
  3214. @item on
  3215. @end table
  3216. @item formant
  3217. Enable formant preservation when shift pitching.
  3218. Possible values are:
  3219. @table @var
  3220. @item shifted
  3221. @item preserved
  3222. @end table
  3223. @item pitchq
  3224. Set pitch quality.
  3225. Possible values are:
  3226. @table @var
  3227. @item quality
  3228. @item speed
  3229. @item consistency
  3230. @end table
  3231. @item channels
  3232. Set channels.
  3233. Possible values are:
  3234. @table @var
  3235. @item apart
  3236. @item together
  3237. @end table
  3238. @end table
  3239. @section sidechaincompress
  3240. This filter acts like normal compressor but has the ability to compress
  3241. detected signal using second input signal.
  3242. It needs two input streams and returns one output stream.
  3243. First input stream will be processed depending on second stream signal.
  3244. The filtered signal then can be filtered with other filters in later stages of
  3245. processing. See @ref{pan} and @ref{amerge} filter.
  3246. The filter accepts the following options:
  3247. @table @option
  3248. @item level_in
  3249. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3250. @item threshold
  3251. If a signal of second stream raises above this level it will affect the gain
  3252. reduction of first stream.
  3253. By default is 0.125. Range is between 0.00097563 and 1.
  3254. @item ratio
  3255. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3256. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3257. Default is 2. Range is between 1 and 20.
  3258. @item attack
  3259. Amount of milliseconds the signal has to rise above the threshold before gain
  3260. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3261. @item release
  3262. Amount of milliseconds the signal has to fall below the threshold before
  3263. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3264. @item makeup
  3265. Set the amount by how much signal will be amplified after processing.
  3266. Default is 1. Range is from 1 to 64.
  3267. @item knee
  3268. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3269. Default is 2.82843. Range is between 1 and 8.
  3270. @item link
  3271. Choose if the @code{average} level between all channels of side-chain stream
  3272. or the louder(@code{maximum}) channel of side-chain stream affects the
  3273. reduction. Default is @code{average}.
  3274. @item detection
  3275. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3276. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3277. @item level_sc
  3278. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3279. @item mix
  3280. How much to use compressed signal in output. Default is 1.
  3281. Range is between 0 and 1.
  3282. @end table
  3283. @subsection Examples
  3284. @itemize
  3285. @item
  3286. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3287. depending on the signal of 2nd input and later compressed signal to be
  3288. merged with 2nd input:
  3289. @example
  3290. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3291. @end example
  3292. @end itemize
  3293. @section sidechaingate
  3294. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3295. filter the detected signal before sending it to the gain reduction stage.
  3296. Normally a gate uses the full range signal to detect a level above the
  3297. threshold.
  3298. For example: If you cut all lower frequencies from your sidechain signal
  3299. the gate will decrease the volume of your track only if not enough highs
  3300. appear. With this technique you are able to reduce the resonation of a
  3301. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3302. guitar.
  3303. It needs two input streams and returns one output stream.
  3304. First input stream will be processed depending on second stream signal.
  3305. The filter accepts the following options:
  3306. @table @option
  3307. @item level_in
  3308. Set input level before filtering.
  3309. Default is 1. Allowed range is from 0.015625 to 64.
  3310. @item range
  3311. Set the level of gain reduction when the signal is below the threshold.
  3312. Default is 0.06125. Allowed range is from 0 to 1.
  3313. @item threshold
  3314. If a signal rises above this level the gain reduction is released.
  3315. Default is 0.125. Allowed range is from 0 to 1.
  3316. @item ratio
  3317. Set a ratio about which the signal is reduced.
  3318. Default is 2. Allowed range is from 1 to 9000.
  3319. @item attack
  3320. Amount of milliseconds the signal has to rise above the threshold before gain
  3321. reduction stops.
  3322. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3323. @item release
  3324. Amount of milliseconds the signal has to fall below the threshold before the
  3325. reduction is increased again. Default is 250 milliseconds.
  3326. Allowed range is from 0.01 to 9000.
  3327. @item makeup
  3328. Set amount of amplification of signal after processing.
  3329. Default is 1. Allowed range is from 1 to 64.
  3330. @item knee
  3331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3332. Default is 2.828427125. Allowed range is from 1 to 8.
  3333. @item detection
  3334. Choose if exact signal should be taken for detection or an RMS like one.
  3335. Default is rms. Can be peak or rms.
  3336. @item link
  3337. Choose if the average level between all channels or the louder channel affects
  3338. the reduction.
  3339. Default is average. Can be average or maximum.
  3340. @item level_sc
  3341. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3342. @end table
  3343. @section silencedetect
  3344. Detect silence in an audio stream.
  3345. This filter logs a message when it detects that the input audio volume is less
  3346. or equal to a noise tolerance value for a duration greater or equal to the
  3347. minimum detected noise duration.
  3348. The printed times and duration are expressed in seconds.
  3349. The filter accepts the following options:
  3350. @table @option
  3351. @item noise, n
  3352. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3353. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3354. @item duration, d
  3355. Set silence duration until notification (default is 2 seconds).
  3356. @item mono, m
  3357. Process each channel separately, instead of combined. By default is disabled.
  3358. @end table
  3359. @subsection Examples
  3360. @itemize
  3361. @item
  3362. Detect 5 seconds of silence with -50dB noise tolerance:
  3363. @example
  3364. silencedetect=n=-50dB:d=5
  3365. @end example
  3366. @item
  3367. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3368. tolerance in @file{silence.mp3}:
  3369. @example
  3370. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3371. @end example
  3372. @end itemize
  3373. @section silenceremove
  3374. Remove silence from the beginning, middle or end of the audio.
  3375. The filter accepts the following options:
  3376. @table @option
  3377. @item start_periods
  3378. This value is used to indicate if audio should be trimmed at beginning of
  3379. the audio. A value of zero indicates no silence should be trimmed from the
  3380. beginning. When specifying a non-zero value, it trims audio up until it
  3381. finds non-silence. Normally, when trimming silence from beginning of audio
  3382. the @var{start_periods} will be @code{1} but it can be increased to higher
  3383. values to trim all audio up to specific count of non-silence periods.
  3384. Default value is @code{0}.
  3385. @item start_duration
  3386. Specify the amount of time that non-silence must be detected before it stops
  3387. trimming audio. By increasing the duration, bursts of noises can be treated
  3388. as silence and trimmed off. Default value is @code{0}.
  3389. @item start_threshold
  3390. This indicates what sample value should be treated as silence. For digital
  3391. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3392. you may wish to increase the value to account for background noise.
  3393. Can be specified in dB (in case "dB" is appended to the specified value)
  3394. or amplitude ratio. Default value is @code{0}.
  3395. @item stop_periods
  3396. Set the count for trimming silence from the end of audio.
  3397. To remove silence from the middle of a file, specify a @var{stop_periods}
  3398. that is negative. This value is then treated as a positive value and is
  3399. used to indicate the effect should restart processing as specified by
  3400. @var{start_periods}, making it suitable for removing periods of silence
  3401. in the middle of the audio.
  3402. Default value is @code{0}.
  3403. @item stop_duration
  3404. Specify a duration of silence that must exist before audio is not copied any
  3405. more. By specifying a higher duration, silence that is wanted can be left in
  3406. the audio.
  3407. Default value is @code{0}.
  3408. @item stop_threshold
  3409. This is the same as @option{start_threshold} but for trimming silence from
  3410. the end of audio.
  3411. Can be specified in dB (in case "dB" is appended to the specified value)
  3412. or amplitude ratio. Default value is @code{0}.
  3413. @item leave_silence
  3414. This indicates that @var{stop_duration} length of audio should be left intact
  3415. at the beginning of each period of silence.
  3416. For example, if you want to remove long pauses between words but do not want
  3417. to remove the pauses completely. Default value is @code{0}.
  3418. @item detection
  3419. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3420. and works better with digital silence which is exactly 0.
  3421. Default value is @code{rms}.
  3422. @item window
  3423. Set ratio used to calculate size of window for detecting silence.
  3424. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3425. @end table
  3426. @subsection Examples
  3427. @itemize
  3428. @item
  3429. The following example shows how this filter can be used to start a recording
  3430. that does not contain the delay at the start which usually occurs between
  3431. pressing the record button and the start of the performance:
  3432. @example
  3433. silenceremove=1:5:0.02
  3434. @end example
  3435. @item
  3436. Trim all silence encountered from beginning to end where there is more than 1
  3437. second of silence in audio:
  3438. @example
  3439. silenceremove=0:0:0:-1:1:-90dB
  3440. @end example
  3441. @end itemize
  3442. @section sofalizer
  3443. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3444. loudspeakers around the user for binaural listening via headphones (audio
  3445. formats up to 9 channels supported).
  3446. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3447. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3448. Austrian Academy of Sciences.
  3449. To enable compilation of this filter you need to configure FFmpeg with
  3450. @code{--enable-libmysofa}.
  3451. The filter accepts the following options:
  3452. @table @option
  3453. @item sofa
  3454. Set the SOFA file used for rendering.
  3455. @item gain
  3456. Set gain applied to audio. Value is in dB. Default is 0.
  3457. @item rotation
  3458. Set rotation of virtual loudspeakers in deg. Default is 0.
  3459. @item elevation
  3460. Set elevation of virtual speakers in deg. Default is 0.
  3461. @item radius
  3462. Set distance in meters between loudspeakers and the listener with near-field
  3463. HRTFs. Default is 1.
  3464. @item type
  3465. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3466. processing audio in time domain which is slow.
  3467. @var{freq} is processing audio in frequency domain which is fast.
  3468. Default is @var{freq}.
  3469. @item speakers
  3470. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3471. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3472. Each virtual loudspeaker is described with short channel name following with
  3473. azimuth and elevation in degrees.
  3474. Each virtual loudspeaker description is separated by '|'.
  3475. For example to override front left and front right channel positions use:
  3476. 'speakers=FL 45 15|FR 345 15'.
  3477. Descriptions with unrecognised channel names are ignored.
  3478. @item lfegain
  3479. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3480. @end table
  3481. @subsection Examples
  3482. @itemize
  3483. @item
  3484. Using ClubFritz6 sofa file:
  3485. @example
  3486. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3487. @end example
  3488. @item
  3489. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3490. @example
  3491. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3492. @end example
  3493. @item
  3494. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3495. and also with custom gain:
  3496. @example
  3497. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3498. @end example
  3499. @end itemize
  3500. @section stereotools
  3501. This filter has some handy utilities to manage stereo signals, for converting
  3502. M/S stereo recordings to L/R signal while having control over the parameters
  3503. or spreading the stereo image of master track.
  3504. The filter accepts the following options:
  3505. @table @option
  3506. @item level_in
  3507. Set input level before filtering for both channels. Defaults is 1.
  3508. Allowed range is from 0.015625 to 64.
  3509. @item level_out
  3510. Set output level after filtering for both channels. Defaults is 1.
  3511. Allowed range is from 0.015625 to 64.
  3512. @item balance_in
  3513. Set input balance between both channels. Default is 0.
  3514. Allowed range is from -1 to 1.
  3515. @item balance_out
  3516. Set output balance between both channels. Default is 0.
  3517. Allowed range is from -1 to 1.
  3518. @item softclip
  3519. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3520. clipping. Disabled by default.
  3521. @item mutel
  3522. Mute the left channel. Disabled by default.
  3523. @item muter
  3524. Mute the right channel. Disabled by default.
  3525. @item phasel
  3526. Change the phase of the left channel. Disabled by default.
  3527. @item phaser
  3528. Change the phase of the right channel. Disabled by default.
  3529. @item mode
  3530. Set stereo mode. Available values are:
  3531. @table @samp
  3532. @item lr>lr
  3533. Left/Right to Left/Right, this is default.
  3534. @item lr>ms
  3535. Left/Right to Mid/Side.
  3536. @item ms>lr
  3537. Mid/Side to Left/Right.
  3538. @item lr>ll
  3539. Left/Right to Left/Left.
  3540. @item lr>rr
  3541. Left/Right to Right/Right.
  3542. @item lr>l+r
  3543. Left/Right to Left + Right.
  3544. @item lr>rl
  3545. Left/Right to Right/Left.
  3546. @item ms>ll
  3547. Mid/Side to Left/Left.
  3548. @item ms>rr
  3549. Mid/Side to Right/Right.
  3550. @end table
  3551. @item slev
  3552. Set level of side signal. Default is 1.
  3553. Allowed range is from 0.015625 to 64.
  3554. @item sbal
  3555. Set balance of side signal. Default is 0.
  3556. Allowed range is from -1 to 1.
  3557. @item mlev
  3558. Set level of the middle signal. Default is 1.
  3559. Allowed range is from 0.015625 to 64.
  3560. @item mpan
  3561. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3562. @item base
  3563. Set stereo base between mono and inversed channels. Default is 0.
  3564. Allowed range is from -1 to 1.
  3565. @item delay
  3566. Set delay in milliseconds how much to delay left from right channel and
  3567. vice versa. Default is 0. Allowed range is from -20 to 20.
  3568. @item sclevel
  3569. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3570. @item phase
  3571. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3572. @item bmode_in, bmode_out
  3573. Set balance mode for balance_in/balance_out option.
  3574. Can be one of the following:
  3575. @table @samp
  3576. @item balance
  3577. Classic balance mode. Attenuate one channel at time.
  3578. Gain is raised up to 1.
  3579. @item amplitude
  3580. Similar as classic mode above but gain is raised up to 2.
  3581. @item power
  3582. Equal power distribution, from -6dB to +6dB range.
  3583. @end table
  3584. @end table
  3585. @subsection Examples
  3586. @itemize
  3587. @item
  3588. Apply karaoke like effect:
  3589. @example
  3590. stereotools=mlev=0.015625
  3591. @end example
  3592. @item
  3593. Convert M/S signal to L/R:
  3594. @example
  3595. "stereotools=mode=ms>lr"
  3596. @end example
  3597. @end itemize
  3598. @section stereowiden
  3599. This filter enhance the stereo effect by suppressing signal common to both
  3600. channels and by delaying the signal of left into right and vice versa,
  3601. thereby widening the stereo effect.
  3602. The filter accepts the following options:
  3603. @table @option
  3604. @item delay
  3605. Time in milliseconds of the delay of left signal into right and vice versa.
  3606. Default is 20 milliseconds.
  3607. @item feedback
  3608. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3609. effect of left signal in right output and vice versa which gives widening
  3610. effect. Default is 0.3.
  3611. @item crossfeed
  3612. Cross feed of left into right with inverted phase. This helps in suppressing
  3613. the mono. If the value is 1 it will cancel all the signal common to both
  3614. channels. Default is 0.3.
  3615. @item drymix
  3616. Set level of input signal of original channel. Default is 0.8.
  3617. @end table
  3618. @section superequalizer
  3619. Apply 18 band equalizer.
  3620. The filter accepts the following options:
  3621. @table @option
  3622. @item 1b
  3623. Set 65Hz band gain.
  3624. @item 2b
  3625. Set 92Hz band gain.
  3626. @item 3b
  3627. Set 131Hz band gain.
  3628. @item 4b
  3629. Set 185Hz band gain.
  3630. @item 5b
  3631. Set 262Hz band gain.
  3632. @item 6b
  3633. Set 370Hz band gain.
  3634. @item 7b
  3635. Set 523Hz band gain.
  3636. @item 8b
  3637. Set 740Hz band gain.
  3638. @item 9b
  3639. Set 1047Hz band gain.
  3640. @item 10b
  3641. Set 1480Hz band gain.
  3642. @item 11b
  3643. Set 2093Hz band gain.
  3644. @item 12b
  3645. Set 2960Hz band gain.
  3646. @item 13b
  3647. Set 4186Hz band gain.
  3648. @item 14b
  3649. Set 5920Hz band gain.
  3650. @item 15b
  3651. Set 8372Hz band gain.
  3652. @item 16b
  3653. Set 11840Hz band gain.
  3654. @item 17b
  3655. Set 16744Hz band gain.
  3656. @item 18b
  3657. Set 20000Hz band gain.
  3658. @end table
  3659. @section surround
  3660. Apply audio surround upmix filter.
  3661. This filter allows to produce multichannel output from audio stream.
  3662. The filter accepts the following options:
  3663. @table @option
  3664. @item chl_out
  3665. Set output channel layout. By default, this is @var{5.1}.
  3666. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3667. for the required syntax.
  3668. @item chl_in
  3669. Set input channel layout. By default, this is @var{stereo}.
  3670. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3671. for the required syntax.
  3672. @item level_in
  3673. Set input volume level. By default, this is @var{1}.
  3674. @item level_out
  3675. Set output volume level. By default, this is @var{1}.
  3676. @item lfe
  3677. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3678. @item lfe_low
  3679. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3680. @item lfe_high
  3681. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3682. @item fc_in
  3683. Set front center input volume. By default, this is @var{1}.
  3684. @item fc_out
  3685. Set front center output volume. By default, this is @var{1}.
  3686. @item lfe_in
  3687. Set LFE input volume. By default, this is @var{1}.
  3688. @item lfe_out
  3689. Set LFE output volume. By default, this is @var{1}.
  3690. @end table
  3691. @section treble, highshelf
  3692. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3693. shelving filter with a response similar to that of a standard
  3694. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3695. The filter accepts the following options:
  3696. @table @option
  3697. @item gain, g
  3698. Give the gain at whichever is the lower of ~22 kHz and the
  3699. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3700. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3701. @item frequency, f
  3702. Set the filter's central frequency and so can be used
  3703. to extend or reduce the frequency range to be boosted or cut.
  3704. The default value is @code{3000} Hz.
  3705. @item width_type, t
  3706. Set method to specify band-width of filter.
  3707. @table @option
  3708. @item h
  3709. Hz
  3710. @item q
  3711. Q-Factor
  3712. @item o
  3713. octave
  3714. @item s
  3715. slope
  3716. @item k
  3717. kHz
  3718. @end table
  3719. @item width, w
  3720. Determine how steep is the filter's shelf transition.
  3721. @item channels, c
  3722. Specify which channels to filter, by default all available are filtered.
  3723. @end table
  3724. @subsection Commands
  3725. This filter supports the following commands:
  3726. @table @option
  3727. @item frequency, f
  3728. Change treble frequency.
  3729. Syntax for the command is : "@var{frequency}"
  3730. @item width_type, t
  3731. Change treble width_type.
  3732. Syntax for the command is : "@var{width_type}"
  3733. @item width, w
  3734. Change treble width.
  3735. Syntax for the command is : "@var{width}"
  3736. @item gain, g
  3737. Change treble gain.
  3738. Syntax for the command is : "@var{gain}"
  3739. @end table
  3740. @section tremolo
  3741. Sinusoidal amplitude modulation.
  3742. The filter accepts the following options:
  3743. @table @option
  3744. @item f
  3745. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3746. (20 Hz or lower) will result in a tremolo effect.
  3747. This filter may also be used as a ring modulator by specifying
  3748. a modulation frequency higher than 20 Hz.
  3749. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3750. @item d
  3751. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3752. Default value is 0.5.
  3753. @end table
  3754. @section vibrato
  3755. Sinusoidal phase modulation.
  3756. The filter accepts the following options:
  3757. @table @option
  3758. @item f
  3759. Modulation frequency in Hertz.
  3760. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3761. @item d
  3762. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3763. Default value is 0.5.
  3764. @end table
  3765. @section volume
  3766. Adjust the input audio volume.
  3767. It accepts the following parameters:
  3768. @table @option
  3769. @item volume
  3770. Set audio volume expression.
  3771. Output values are clipped to the maximum value.
  3772. The output audio volume is given by the relation:
  3773. @example
  3774. @var{output_volume} = @var{volume} * @var{input_volume}
  3775. @end example
  3776. The default value for @var{volume} is "1.0".
  3777. @item precision
  3778. This parameter represents the mathematical precision.
  3779. It determines which input sample formats will be allowed, which affects the
  3780. precision of the volume scaling.
  3781. @table @option
  3782. @item fixed
  3783. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3784. @item float
  3785. 32-bit floating-point; this limits input sample format to FLT. (default)
  3786. @item double
  3787. 64-bit floating-point; this limits input sample format to DBL.
  3788. @end table
  3789. @item replaygain
  3790. Choose the behaviour on encountering ReplayGain side data in input frames.
  3791. @table @option
  3792. @item drop
  3793. Remove ReplayGain side data, ignoring its contents (the default).
  3794. @item ignore
  3795. Ignore ReplayGain side data, but leave it in the frame.
  3796. @item track
  3797. Prefer the track gain, if present.
  3798. @item album
  3799. Prefer the album gain, if present.
  3800. @end table
  3801. @item replaygain_preamp
  3802. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3803. Default value for @var{replaygain_preamp} is 0.0.
  3804. @item eval
  3805. Set when the volume expression is evaluated.
  3806. It accepts the following values:
  3807. @table @samp
  3808. @item once
  3809. only evaluate expression once during the filter initialization, or
  3810. when the @samp{volume} command is sent
  3811. @item frame
  3812. evaluate expression for each incoming frame
  3813. @end table
  3814. Default value is @samp{once}.
  3815. @end table
  3816. The volume expression can contain the following parameters.
  3817. @table @option
  3818. @item n
  3819. frame number (starting at zero)
  3820. @item nb_channels
  3821. number of channels
  3822. @item nb_consumed_samples
  3823. number of samples consumed by the filter
  3824. @item nb_samples
  3825. number of samples in the current frame
  3826. @item pos
  3827. original frame position in the file
  3828. @item pts
  3829. frame PTS
  3830. @item sample_rate
  3831. sample rate
  3832. @item startpts
  3833. PTS at start of stream
  3834. @item startt
  3835. time at start of stream
  3836. @item t
  3837. frame time
  3838. @item tb
  3839. timestamp timebase
  3840. @item volume
  3841. last set volume value
  3842. @end table
  3843. Note that when @option{eval} is set to @samp{once} only the
  3844. @var{sample_rate} and @var{tb} variables are available, all other
  3845. variables will evaluate to NAN.
  3846. @subsection Commands
  3847. This filter supports the following commands:
  3848. @table @option
  3849. @item volume
  3850. Modify the volume expression.
  3851. The command accepts the same syntax of the corresponding option.
  3852. If the specified expression is not valid, it is kept at its current
  3853. value.
  3854. @item replaygain_noclip
  3855. Prevent clipping by limiting the gain applied.
  3856. Default value for @var{replaygain_noclip} is 1.
  3857. @end table
  3858. @subsection Examples
  3859. @itemize
  3860. @item
  3861. Halve the input audio volume:
  3862. @example
  3863. volume=volume=0.5
  3864. volume=volume=1/2
  3865. volume=volume=-6.0206dB
  3866. @end example
  3867. In all the above example the named key for @option{volume} can be
  3868. omitted, for example like in:
  3869. @example
  3870. volume=0.5
  3871. @end example
  3872. @item
  3873. Increase input audio power by 6 decibels using fixed-point precision:
  3874. @example
  3875. volume=volume=6dB:precision=fixed
  3876. @end example
  3877. @item
  3878. Fade volume after time 10 with an annihilation period of 5 seconds:
  3879. @example
  3880. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3881. @end example
  3882. @end itemize
  3883. @section volumedetect
  3884. Detect the volume of the input video.
  3885. The filter has no parameters. The input is not modified. Statistics about
  3886. the volume will be printed in the log when the input stream end is reached.
  3887. In particular it will show the mean volume (root mean square), maximum
  3888. volume (on a per-sample basis), and the beginning of a histogram of the
  3889. registered volume values (from the maximum value to a cumulated 1/1000 of
  3890. the samples).
  3891. All volumes are in decibels relative to the maximum PCM value.
  3892. @subsection Examples
  3893. Here is an excerpt of the output:
  3894. @example
  3895. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3896. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3897. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3898. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3899. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3900. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3901. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3902. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3903. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3904. @end example
  3905. It means that:
  3906. @itemize
  3907. @item
  3908. The mean square energy is approximately -27 dB, or 10^-2.7.
  3909. @item
  3910. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3911. @item
  3912. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3913. @end itemize
  3914. In other words, raising the volume by +4 dB does not cause any clipping,
  3915. raising it by +5 dB causes clipping for 6 samples, etc.
  3916. @c man end AUDIO FILTERS
  3917. @chapter Audio Sources
  3918. @c man begin AUDIO SOURCES
  3919. Below is a description of the currently available audio sources.
  3920. @section abuffer
  3921. Buffer audio frames, and make them available to the filter chain.
  3922. This source is mainly intended for a programmatic use, in particular
  3923. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3924. It accepts the following parameters:
  3925. @table @option
  3926. @item time_base
  3927. The timebase which will be used for timestamps of submitted frames. It must be
  3928. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3929. @item sample_rate
  3930. The sample rate of the incoming audio buffers.
  3931. @item sample_fmt
  3932. The sample format of the incoming audio buffers.
  3933. Either a sample format name or its corresponding integer representation from
  3934. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3935. @item channel_layout
  3936. The channel layout of the incoming audio buffers.
  3937. Either a channel layout name from channel_layout_map in
  3938. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3939. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3940. @item channels
  3941. The number of channels of the incoming audio buffers.
  3942. If both @var{channels} and @var{channel_layout} are specified, then they
  3943. must be consistent.
  3944. @end table
  3945. @subsection Examples
  3946. @example
  3947. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3948. @end example
  3949. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3950. Since the sample format with name "s16p" corresponds to the number
  3951. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3952. equivalent to:
  3953. @example
  3954. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3955. @end example
  3956. @section aevalsrc
  3957. Generate an audio signal specified by an expression.
  3958. This source accepts in input one or more expressions (one for each
  3959. channel), which are evaluated and used to generate a corresponding
  3960. audio signal.
  3961. This source accepts the following options:
  3962. @table @option
  3963. @item exprs
  3964. Set the '|'-separated expressions list for each separate channel. In case the
  3965. @option{channel_layout} option is not specified, the selected channel layout
  3966. depends on the number of provided expressions. Otherwise the last
  3967. specified expression is applied to the remaining output channels.
  3968. @item channel_layout, c
  3969. Set the channel layout. The number of channels in the specified layout
  3970. must be equal to the number of specified expressions.
  3971. @item duration, d
  3972. Set the minimum duration of the sourced audio. See
  3973. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3974. for the accepted syntax.
  3975. Note that the resulting duration may be greater than the specified
  3976. duration, as the generated audio is always cut at the end of a
  3977. complete frame.
  3978. If not specified, or the expressed duration is negative, the audio is
  3979. supposed to be generated forever.
  3980. @item nb_samples, n
  3981. Set the number of samples per channel per each output frame,
  3982. default to 1024.
  3983. @item sample_rate, s
  3984. Specify the sample rate, default to 44100.
  3985. @end table
  3986. Each expression in @var{exprs} can contain the following constants:
  3987. @table @option
  3988. @item n
  3989. number of the evaluated sample, starting from 0
  3990. @item t
  3991. time of the evaluated sample expressed in seconds, starting from 0
  3992. @item s
  3993. sample rate
  3994. @end table
  3995. @subsection Examples
  3996. @itemize
  3997. @item
  3998. Generate silence:
  3999. @example
  4000. aevalsrc=0
  4001. @end example
  4002. @item
  4003. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4004. 8000 Hz:
  4005. @example
  4006. aevalsrc="sin(440*2*PI*t):s=8000"
  4007. @end example
  4008. @item
  4009. Generate a two channels signal, specify the channel layout (Front
  4010. Center + Back Center) explicitly:
  4011. @example
  4012. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4013. @end example
  4014. @item
  4015. Generate white noise:
  4016. @example
  4017. aevalsrc="-2+random(0)"
  4018. @end example
  4019. @item
  4020. Generate an amplitude modulated signal:
  4021. @example
  4022. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4023. @end example
  4024. @item
  4025. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4026. @example
  4027. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4028. @end example
  4029. @end itemize
  4030. @section anullsrc
  4031. The null audio source, return unprocessed audio frames. It is mainly useful
  4032. as a template and to be employed in analysis / debugging tools, or as
  4033. the source for filters which ignore the input data (for example the sox
  4034. synth filter).
  4035. This source accepts the following options:
  4036. @table @option
  4037. @item channel_layout, cl
  4038. Specifies the channel layout, and can be either an integer or a string
  4039. representing a channel layout. The default value of @var{channel_layout}
  4040. is "stereo".
  4041. Check the channel_layout_map definition in
  4042. @file{libavutil/channel_layout.c} for the mapping between strings and
  4043. channel layout values.
  4044. @item sample_rate, r
  4045. Specifies the sample rate, and defaults to 44100.
  4046. @item nb_samples, n
  4047. Set the number of samples per requested frames.
  4048. @end table
  4049. @subsection Examples
  4050. @itemize
  4051. @item
  4052. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4053. @example
  4054. anullsrc=r=48000:cl=4
  4055. @end example
  4056. @item
  4057. Do the same operation with a more obvious syntax:
  4058. @example
  4059. anullsrc=r=48000:cl=mono
  4060. @end example
  4061. @end itemize
  4062. All the parameters need to be explicitly defined.
  4063. @section flite
  4064. Synthesize a voice utterance using the libflite library.
  4065. To enable compilation of this filter you need to configure FFmpeg with
  4066. @code{--enable-libflite}.
  4067. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4068. The filter accepts the following options:
  4069. @table @option
  4070. @item list_voices
  4071. If set to 1, list the names of the available voices and exit
  4072. immediately. Default value is 0.
  4073. @item nb_samples, n
  4074. Set the maximum number of samples per frame. Default value is 512.
  4075. @item textfile
  4076. Set the filename containing the text to speak.
  4077. @item text
  4078. Set the text to speak.
  4079. @item voice, v
  4080. Set the voice to use for the speech synthesis. Default value is
  4081. @code{kal}. See also the @var{list_voices} option.
  4082. @end table
  4083. @subsection Examples
  4084. @itemize
  4085. @item
  4086. Read from file @file{speech.txt}, and synthesize the text using the
  4087. standard flite voice:
  4088. @example
  4089. flite=textfile=speech.txt
  4090. @end example
  4091. @item
  4092. Read the specified text selecting the @code{slt} voice:
  4093. @example
  4094. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4095. @end example
  4096. @item
  4097. Input text to ffmpeg:
  4098. @example
  4099. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4100. @end example
  4101. @item
  4102. Make @file{ffplay} speak the specified text, using @code{flite} and
  4103. the @code{lavfi} device:
  4104. @example
  4105. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4106. @end example
  4107. @end itemize
  4108. For more information about libflite, check:
  4109. @url{http://www.festvox.org/flite/}
  4110. @section anoisesrc
  4111. Generate a noise audio signal.
  4112. The filter accepts the following options:
  4113. @table @option
  4114. @item sample_rate, r
  4115. Specify the sample rate. Default value is 48000 Hz.
  4116. @item amplitude, a
  4117. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4118. is 1.0.
  4119. @item duration, d
  4120. Specify the duration of the generated audio stream. Not specifying this option
  4121. results in noise with an infinite length.
  4122. @item color, colour, c
  4123. Specify the color of noise. Available noise colors are white, pink, brown,
  4124. blue and violet. Default color is white.
  4125. @item seed, s
  4126. Specify a value used to seed the PRNG.
  4127. @item nb_samples, n
  4128. Set the number of samples per each output frame, default is 1024.
  4129. @end table
  4130. @subsection Examples
  4131. @itemize
  4132. @item
  4133. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4134. @example
  4135. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4136. @end example
  4137. @end itemize
  4138. @section hilbert
  4139. Generate odd-tap Hilbert transform FIR coefficients.
  4140. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4141. the signal by 90 degrees.
  4142. This is used in many matrix coding schemes and for analytic signal generation.
  4143. The process is often written as a multiplication by i (or j), the imaginary unit.
  4144. The filter accepts the following options:
  4145. @table @option
  4146. @item sample_rate, s
  4147. Set sample rate, default is 44100.
  4148. @item taps, t
  4149. Set length of FIR filter, default is 22051.
  4150. @item nb_samples, n
  4151. Set number of samples per each frame.
  4152. @item win_func, w
  4153. Set window function to be used when generating FIR coefficients.
  4154. @end table
  4155. @section sine
  4156. Generate an audio signal made of a sine wave with amplitude 1/8.
  4157. The audio signal is bit-exact.
  4158. The filter accepts the following options:
  4159. @table @option
  4160. @item frequency, f
  4161. Set the carrier frequency. Default is 440 Hz.
  4162. @item beep_factor, b
  4163. Enable a periodic beep every second with frequency @var{beep_factor} times
  4164. the carrier frequency. Default is 0, meaning the beep is disabled.
  4165. @item sample_rate, r
  4166. Specify the sample rate, default is 44100.
  4167. @item duration, d
  4168. Specify the duration of the generated audio stream.
  4169. @item samples_per_frame
  4170. Set the number of samples per output frame.
  4171. The expression can contain the following constants:
  4172. @table @option
  4173. @item n
  4174. The (sequential) number of the output audio frame, starting from 0.
  4175. @item pts
  4176. The PTS (Presentation TimeStamp) of the output audio frame,
  4177. expressed in @var{TB} units.
  4178. @item t
  4179. The PTS of the output audio frame, expressed in seconds.
  4180. @item TB
  4181. The timebase of the output audio frames.
  4182. @end table
  4183. Default is @code{1024}.
  4184. @end table
  4185. @subsection Examples
  4186. @itemize
  4187. @item
  4188. Generate a simple 440 Hz sine wave:
  4189. @example
  4190. sine
  4191. @end example
  4192. @item
  4193. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4194. @example
  4195. sine=220:4:d=5
  4196. sine=f=220:b=4:d=5
  4197. sine=frequency=220:beep_factor=4:duration=5
  4198. @end example
  4199. @item
  4200. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4201. pattern:
  4202. @example
  4203. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4204. @end example
  4205. @end itemize
  4206. @c man end AUDIO SOURCES
  4207. @chapter Audio Sinks
  4208. @c man begin AUDIO SINKS
  4209. Below is a description of the currently available audio sinks.
  4210. @section abuffersink
  4211. Buffer audio frames, and make them available to the end of filter chain.
  4212. This sink is mainly intended for programmatic use, in particular
  4213. through the interface defined in @file{libavfilter/buffersink.h}
  4214. or the options system.
  4215. It accepts a pointer to an AVABufferSinkContext structure, which
  4216. defines the incoming buffers' formats, to be passed as the opaque
  4217. parameter to @code{avfilter_init_filter} for initialization.
  4218. @section anullsink
  4219. Null audio sink; do absolutely nothing with the input audio. It is
  4220. mainly useful as a template and for use in analysis / debugging
  4221. tools.
  4222. @c man end AUDIO SINKS
  4223. @chapter Video Filters
  4224. @c man begin VIDEO FILTERS
  4225. When you configure your FFmpeg build, you can disable any of the
  4226. existing filters using @code{--disable-filters}.
  4227. The configure output will show the video filters included in your
  4228. build.
  4229. Below is a description of the currently available video filters.
  4230. @section alphaextract
  4231. Extract the alpha component from the input as a grayscale video. This
  4232. is especially useful with the @var{alphamerge} filter.
  4233. @section alphamerge
  4234. Add or replace the alpha component of the primary input with the
  4235. grayscale value of a second input. This is intended for use with
  4236. @var{alphaextract} to allow the transmission or storage of frame
  4237. sequences that have alpha in a format that doesn't support an alpha
  4238. channel.
  4239. For example, to reconstruct full frames from a normal YUV-encoded video
  4240. and a separate video created with @var{alphaextract}, you might use:
  4241. @example
  4242. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4243. @end example
  4244. Since this filter is designed for reconstruction, it operates on frame
  4245. sequences without considering timestamps, and terminates when either
  4246. input reaches end of stream. This will cause problems if your encoding
  4247. pipeline drops frames. If you're trying to apply an image as an
  4248. overlay to a video stream, consider the @var{overlay} filter instead.
  4249. @section amplify
  4250. Amplify differences between current pixel and pixels of adjacent frames in
  4251. same pixel location.
  4252. This filter accepts the following options:
  4253. @table @option
  4254. @item radius
  4255. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4256. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4257. @item factor
  4258. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4259. @item threshold
  4260. Set threshold for difference amplification. Any differrence greater or equal to
  4261. this value will not alter source pixel. Default is 10.
  4262. Allowed range is from 0 to 65535.
  4263. @item low
  4264. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4265. This option controls maximum possible value that will decrease source pixel value.
  4266. @item high
  4267. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4268. This option controls maximum possible value that will increase source pixel value.
  4269. @item planes
  4270. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4271. @end table
  4272. @section ass
  4273. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4274. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4275. Substation Alpha) subtitles files.
  4276. This filter accepts the following option in addition to the common options from
  4277. the @ref{subtitles} filter:
  4278. @table @option
  4279. @item shaping
  4280. Set the shaping engine
  4281. Available values are:
  4282. @table @samp
  4283. @item auto
  4284. The default libass shaping engine, which is the best available.
  4285. @item simple
  4286. Fast, font-agnostic shaper that can do only substitutions
  4287. @item complex
  4288. Slower shaper using OpenType for substitutions and positioning
  4289. @end table
  4290. The default is @code{auto}.
  4291. @end table
  4292. @section atadenoise
  4293. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4294. The filter accepts the following options:
  4295. @table @option
  4296. @item 0a
  4297. Set threshold A for 1st plane. Default is 0.02.
  4298. Valid range is 0 to 0.3.
  4299. @item 0b
  4300. Set threshold B for 1st plane. Default is 0.04.
  4301. Valid range is 0 to 5.
  4302. @item 1a
  4303. Set threshold A for 2nd plane. Default is 0.02.
  4304. Valid range is 0 to 0.3.
  4305. @item 1b
  4306. Set threshold B for 2nd plane. Default is 0.04.
  4307. Valid range is 0 to 5.
  4308. @item 2a
  4309. Set threshold A for 3rd plane. Default is 0.02.
  4310. Valid range is 0 to 0.3.
  4311. @item 2b
  4312. Set threshold B for 3rd plane. Default is 0.04.
  4313. Valid range is 0 to 5.
  4314. Threshold A is designed to react on abrupt changes in the input signal and
  4315. threshold B is designed to react on continuous changes in the input signal.
  4316. @item s
  4317. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4318. number in range [5, 129].
  4319. @item p
  4320. Set what planes of frame filter will use for averaging. Default is all.
  4321. @end table
  4322. @section avgblur
  4323. Apply average blur filter.
  4324. The filter accepts the following options:
  4325. @table @option
  4326. @item sizeX
  4327. Set horizontal radius size.
  4328. @item planes
  4329. Set which planes to filter. By default all planes are filtered.
  4330. @item sizeY
  4331. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4332. Default is @code{0}.
  4333. @end table
  4334. @section bbox
  4335. Compute the bounding box for the non-black pixels in the input frame
  4336. luminance plane.
  4337. This filter computes the bounding box containing all the pixels with a
  4338. luminance value greater than the minimum allowed value.
  4339. The parameters describing the bounding box are printed on the filter
  4340. log.
  4341. The filter accepts the following option:
  4342. @table @option
  4343. @item min_val
  4344. Set the minimal luminance value. Default is @code{16}.
  4345. @end table
  4346. @section bitplanenoise
  4347. Show and measure bit plane noise.
  4348. The filter accepts the following options:
  4349. @table @option
  4350. @item bitplane
  4351. Set which plane to analyze. Default is @code{1}.
  4352. @item filter
  4353. Filter out noisy pixels from @code{bitplane} set above.
  4354. Default is disabled.
  4355. @end table
  4356. @section blackdetect
  4357. Detect video intervals that are (almost) completely black. Can be
  4358. useful to detect chapter transitions, commercials, or invalid
  4359. recordings. Output lines contains the time for the start, end and
  4360. duration of the detected black interval expressed in seconds.
  4361. In order to display the output lines, you need to set the loglevel at
  4362. least to the AV_LOG_INFO value.
  4363. The filter accepts the following options:
  4364. @table @option
  4365. @item black_min_duration, d
  4366. Set the minimum detected black duration expressed in seconds. It must
  4367. be a non-negative floating point number.
  4368. Default value is 2.0.
  4369. @item picture_black_ratio_th, pic_th
  4370. Set the threshold for considering a picture "black".
  4371. Express the minimum value for the ratio:
  4372. @example
  4373. @var{nb_black_pixels} / @var{nb_pixels}
  4374. @end example
  4375. for which a picture is considered black.
  4376. Default value is 0.98.
  4377. @item pixel_black_th, pix_th
  4378. Set the threshold for considering a pixel "black".
  4379. The threshold expresses the maximum pixel luminance value for which a
  4380. pixel is considered "black". The provided value is scaled according to
  4381. the following equation:
  4382. @example
  4383. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4384. @end example
  4385. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4386. the input video format, the range is [0-255] for YUV full-range
  4387. formats and [16-235] for YUV non full-range formats.
  4388. Default value is 0.10.
  4389. @end table
  4390. The following example sets the maximum pixel threshold to the minimum
  4391. value, and detects only black intervals of 2 or more seconds:
  4392. @example
  4393. blackdetect=d=2:pix_th=0.00
  4394. @end example
  4395. @section blackframe
  4396. Detect frames that are (almost) completely black. Can be useful to
  4397. detect chapter transitions or commercials. Output lines consist of
  4398. the frame number of the detected frame, the percentage of blackness,
  4399. the position in the file if known or -1 and the timestamp in seconds.
  4400. In order to display the output lines, you need to set the loglevel at
  4401. least to the AV_LOG_INFO value.
  4402. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4403. The value represents the percentage of pixels in the picture that
  4404. are below the threshold value.
  4405. It accepts the following parameters:
  4406. @table @option
  4407. @item amount
  4408. The percentage of the pixels that have to be below the threshold; it defaults to
  4409. @code{98}.
  4410. @item threshold, thresh
  4411. The threshold below which a pixel value is considered black; it defaults to
  4412. @code{32}.
  4413. @end table
  4414. @section blend, tblend
  4415. Blend two video frames into each other.
  4416. The @code{blend} filter takes two input streams and outputs one
  4417. stream, the first input is the "top" layer and second input is
  4418. "bottom" layer. By default, the output terminates when the longest input terminates.
  4419. The @code{tblend} (time blend) filter takes two consecutive frames
  4420. from one single stream, and outputs the result obtained by blending
  4421. the new frame on top of the old frame.
  4422. A description of the accepted options follows.
  4423. @table @option
  4424. @item c0_mode
  4425. @item c1_mode
  4426. @item c2_mode
  4427. @item c3_mode
  4428. @item all_mode
  4429. Set blend mode for specific pixel component or all pixel components in case
  4430. of @var{all_mode}. Default value is @code{normal}.
  4431. Available values for component modes are:
  4432. @table @samp
  4433. @item addition
  4434. @item grainmerge
  4435. @item and
  4436. @item average
  4437. @item burn
  4438. @item darken
  4439. @item difference
  4440. @item grainextract
  4441. @item divide
  4442. @item dodge
  4443. @item freeze
  4444. @item exclusion
  4445. @item extremity
  4446. @item glow
  4447. @item hardlight
  4448. @item hardmix
  4449. @item heat
  4450. @item lighten
  4451. @item linearlight
  4452. @item multiply
  4453. @item multiply128
  4454. @item negation
  4455. @item normal
  4456. @item or
  4457. @item overlay
  4458. @item phoenix
  4459. @item pinlight
  4460. @item reflect
  4461. @item screen
  4462. @item softlight
  4463. @item subtract
  4464. @item vividlight
  4465. @item xor
  4466. @end table
  4467. @item c0_opacity
  4468. @item c1_opacity
  4469. @item c2_opacity
  4470. @item c3_opacity
  4471. @item all_opacity
  4472. Set blend opacity for specific pixel component or all pixel components in case
  4473. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4474. @item c0_expr
  4475. @item c1_expr
  4476. @item c2_expr
  4477. @item c3_expr
  4478. @item all_expr
  4479. Set blend expression for specific pixel component or all pixel components in case
  4480. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4481. The expressions can use the following variables:
  4482. @table @option
  4483. @item N
  4484. The sequential number of the filtered frame, starting from @code{0}.
  4485. @item X
  4486. @item Y
  4487. the coordinates of the current sample
  4488. @item W
  4489. @item H
  4490. the width and height of currently filtered plane
  4491. @item SW
  4492. @item SH
  4493. Width and height scale for the plane being filtered. It is the
  4494. ratio between the dimensions of the current plane to the luma plane,
  4495. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4496. the luma plane and @code{0.5,0.5} for the chroma planes.
  4497. @item T
  4498. Time of the current frame, expressed in seconds.
  4499. @item TOP, A
  4500. Value of pixel component at current location for first video frame (top layer).
  4501. @item BOTTOM, B
  4502. Value of pixel component at current location for second video frame (bottom layer).
  4503. @end table
  4504. @end table
  4505. The @code{blend} filter also supports the @ref{framesync} options.
  4506. @subsection Examples
  4507. @itemize
  4508. @item
  4509. Apply transition from bottom layer to top layer in first 10 seconds:
  4510. @example
  4511. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4512. @end example
  4513. @item
  4514. Apply linear horizontal transition from top layer to bottom layer:
  4515. @example
  4516. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4517. @end example
  4518. @item
  4519. Apply 1x1 checkerboard effect:
  4520. @example
  4521. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4522. @end example
  4523. @item
  4524. Apply uncover left effect:
  4525. @example
  4526. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4527. @end example
  4528. @item
  4529. Apply uncover down effect:
  4530. @example
  4531. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4532. @end example
  4533. @item
  4534. Apply uncover up-left effect:
  4535. @example
  4536. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4537. @end example
  4538. @item
  4539. Split diagonally video and shows top and bottom layer on each side:
  4540. @example
  4541. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4542. @end example
  4543. @item
  4544. Display differences between the current and the previous frame:
  4545. @example
  4546. tblend=all_mode=grainextract
  4547. @end example
  4548. @end itemize
  4549. @section bm3d
  4550. Denoise frames using Block-Matching 3D algorithm.
  4551. The filter accepts the following options.
  4552. @table @option
  4553. @item sigma
  4554. Set denoising strength. Default value is 1.
  4555. Allowed range is from 0 to 999.9.
  4556. The denoising algorith is very sensitive to sigma, so adjust it
  4557. according to the source.
  4558. @item block
  4559. Set local patch size. This sets dimensions in 2D.
  4560. @item bstep
  4561. Set sliding step for processing blocks. Default value is 4.
  4562. Allowed range is from 1 to 64.
  4563. Smaller values allows processing more reference blocks and is slower.
  4564. @item group
  4565. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4566. When set to 1, no block matching is done. Larger values allows more blocks
  4567. in single group.
  4568. Allowed range is from 1 to 256.
  4569. @item range
  4570. Set radius for search block matching. Default is 9.
  4571. Allowed range is from 1 to INT32_MAX.
  4572. @item mstep
  4573. Set step between two search locations for block matching. Default is 1.
  4574. Allowed range is from 1 to 64. Smaller is slower.
  4575. @item thmse
  4576. Set threshold of mean square error for block matching. Valid range is 0 to
  4577. INT32_MAX.
  4578. @item hdthr
  4579. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4580. Larger values results in stronger hard-thresholding filtering in frequency
  4581. domain.
  4582. @item estim
  4583. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4584. Default is @code{basic}.
  4585. @item ref
  4586. If enabled, filter will use 2nd stream for block matching.
  4587. Default is disabled for @code{basic} value of @var{estim} option,
  4588. and always enabled if value of @var{estim} is @code{final}.
  4589. @item planes
  4590. Set planes to filter. Default is all available except alpha.
  4591. @end table
  4592. @subsection Examples
  4593. @itemize
  4594. @item
  4595. Basic filtering with bm3d:
  4596. @example
  4597. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4598. @end example
  4599. @item
  4600. Same as above, but filtering only luma:
  4601. @example
  4602. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4603. @end example
  4604. @item
  4605. Same as above, but with both estimation modes:
  4606. @example
  4607. 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
  4608. @end example
  4609. @item
  4610. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4611. @example
  4612. 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
  4613. @end example
  4614. @end itemize
  4615. @section boxblur
  4616. Apply a boxblur algorithm to the input video.
  4617. It accepts the following parameters:
  4618. @table @option
  4619. @item luma_radius, lr
  4620. @item luma_power, lp
  4621. @item chroma_radius, cr
  4622. @item chroma_power, cp
  4623. @item alpha_radius, ar
  4624. @item alpha_power, ap
  4625. @end table
  4626. A description of the accepted options follows.
  4627. @table @option
  4628. @item luma_radius, lr
  4629. @item chroma_radius, cr
  4630. @item alpha_radius, ar
  4631. Set an expression for the box radius in pixels used for blurring the
  4632. corresponding input plane.
  4633. The radius value must be a non-negative number, and must not be
  4634. greater than the value of the expression @code{min(w,h)/2} for the
  4635. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4636. planes.
  4637. Default value for @option{luma_radius} is "2". If not specified,
  4638. @option{chroma_radius} and @option{alpha_radius} default to the
  4639. corresponding value set for @option{luma_radius}.
  4640. The expressions can contain the following constants:
  4641. @table @option
  4642. @item w
  4643. @item h
  4644. The input width and height in pixels.
  4645. @item cw
  4646. @item ch
  4647. The input chroma image width and height in pixels.
  4648. @item hsub
  4649. @item vsub
  4650. The horizontal and vertical chroma subsample values. For example, for the
  4651. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4652. @end table
  4653. @item luma_power, lp
  4654. @item chroma_power, cp
  4655. @item alpha_power, ap
  4656. Specify how many times the boxblur filter is applied to the
  4657. corresponding plane.
  4658. Default value for @option{luma_power} is 2. If not specified,
  4659. @option{chroma_power} and @option{alpha_power} default to the
  4660. corresponding value set for @option{luma_power}.
  4661. A value of 0 will disable the effect.
  4662. @end table
  4663. @subsection Examples
  4664. @itemize
  4665. @item
  4666. Apply a boxblur filter with the luma, chroma, and alpha radii
  4667. set to 2:
  4668. @example
  4669. boxblur=luma_radius=2:luma_power=1
  4670. boxblur=2:1
  4671. @end example
  4672. @item
  4673. Set the luma radius to 2, and alpha and chroma radius to 0:
  4674. @example
  4675. boxblur=2:1:cr=0:ar=0
  4676. @end example
  4677. @item
  4678. Set the luma and chroma radii to a fraction of the video dimension:
  4679. @example
  4680. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4681. @end example
  4682. @end itemize
  4683. @section bwdif
  4684. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4685. Deinterlacing Filter").
  4686. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4687. interpolation algorithms.
  4688. It accepts the following parameters:
  4689. @table @option
  4690. @item mode
  4691. The interlacing mode to adopt. It accepts one of the following values:
  4692. @table @option
  4693. @item 0, send_frame
  4694. Output one frame for each frame.
  4695. @item 1, send_field
  4696. Output one frame for each field.
  4697. @end table
  4698. The default value is @code{send_field}.
  4699. @item parity
  4700. The picture field parity assumed for the input interlaced video. It accepts one
  4701. of the following values:
  4702. @table @option
  4703. @item 0, tff
  4704. Assume the top field is first.
  4705. @item 1, bff
  4706. Assume the bottom field is first.
  4707. @item -1, auto
  4708. Enable automatic detection of field parity.
  4709. @end table
  4710. The default value is @code{auto}.
  4711. If the interlacing is unknown or the decoder does not export this information,
  4712. top field first will be assumed.
  4713. @item deint
  4714. Specify which frames to deinterlace. Accept one of the following
  4715. values:
  4716. @table @option
  4717. @item 0, all
  4718. Deinterlace all frames.
  4719. @item 1, interlaced
  4720. Only deinterlace frames marked as interlaced.
  4721. @end table
  4722. The default value is @code{all}.
  4723. @end table
  4724. @section chromakey
  4725. YUV colorspace color/chroma keying.
  4726. The filter accepts the following options:
  4727. @table @option
  4728. @item color
  4729. The color which will be replaced with transparency.
  4730. @item similarity
  4731. Similarity percentage with the key color.
  4732. 0.01 matches only the exact key color, while 1.0 matches everything.
  4733. @item blend
  4734. Blend percentage.
  4735. 0.0 makes pixels either fully transparent, or not transparent at all.
  4736. Higher values result in semi-transparent pixels, with a higher transparency
  4737. the more similar the pixels color is to the key color.
  4738. @item yuv
  4739. Signals that the color passed is already in YUV instead of RGB.
  4740. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4741. This can be used to pass exact YUV values as hexadecimal numbers.
  4742. @end table
  4743. @subsection Examples
  4744. @itemize
  4745. @item
  4746. Make every green pixel in the input image transparent:
  4747. @example
  4748. ffmpeg -i input.png -vf chromakey=green out.png
  4749. @end example
  4750. @item
  4751. Overlay a greenscreen-video on top of a static black background.
  4752. @example
  4753. 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
  4754. @end example
  4755. @end itemize
  4756. @section ciescope
  4757. Display CIE color diagram with pixels overlaid onto it.
  4758. The filter accepts the following options:
  4759. @table @option
  4760. @item system
  4761. Set color system.
  4762. @table @samp
  4763. @item ntsc, 470m
  4764. @item ebu, 470bg
  4765. @item smpte
  4766. @item 240m
  4767. @item apple
  4768. @item widergb
  4769. @item cie1931
  4770. @item rec709, hdtv
  4771. @item uhdtv, rec2020
  4772. @end table
  4773. @item cie
  4774. Set CIE system.
  4775. @table @samp
  4776. @item xyy
  4777. @item ucs
  4778. @item luv
  4779. @end table
  4780. @item gamuts
  4781. Set what gamuts to draw.
  4782. See @code{system} option for available values.
  4783. @item size, s
  4784. Set ciescope size, by default set to 512.
  4785. @item intensity, i
  4786. Set intensity used to map input pixel values to CIE diagram.
  4787. @item contrast
  4788. Set contrast used to draw tongue colors that are out of active color system gamut.
  4789. @item corrgamma
  4790. Correct gamma displayed on scope, by default enabled.
  4791. @item showwhite
  4792. Show white point on CIE diagram, by default disabled.
  4793. @item gamma
  4794. Set input gamma. Used only with XYZ input color space.
  4795. @end table
  4796. @section codecview
  4797. Visualize information exported by some codecs.
  4798. Some codecs can export information through frames using side-data or other
  4799. means. For example, some MPEG based codecs export motion vectors through the
  4800. @var{export_mvs} flag in the codec @option{flags2} option.
  4801. The filter accepts the following option:
  4802. @table @option
  4803. @item mv
  4804. Set motion vectors to visualize.
  4805. Available flags for @var{mv} are:
  4806. @table @samp
  4807. @item pf
  4808. forward predicted MVs of P-frames
  4809. @item bf
  4810. forward predicted MVs of B-frames
  4811. @item bb
  4812. backward predicted MVs of B-frames
  4813. @end table
  4814. @item qp
  4815. Display quantization parameters using the chroma planes.
  4816. @item mv_type, mvt
  4817. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4818. Available flags for @var{mv_type} are:
  4819. @table @samp
  4820. @item fp
  4821. forward predicted MVs
  4822. @item bp
  4823. backward predicted MVs
  4824. @end table
  4825. @item frame_type, ft
  4826. Set frame type to visualize motion vectors of.
  4827. Available flags for @var{frame_type} are:
  4828. @table @samp
  4829. @item if
  4830. intra-coded frames (I-frames)
  4831. @item pf
  4832. predicted frames (P-frames)
  4833. @item bf
  4834. bi-directionally predicted frames (B-frames)
  4835. @end table
  4836. @end table
  4837. @subsection Examples
  4838. @itemize
  4839. @item
  4840. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4841. @example
  4842. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4843. @end example
  4844. @item
  4845. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4846. @example
  4847. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4848. @end example
  4849. @end itemize
  4850. @section colorbalance
  4851. Modify intensity of primary colors (red, green and blue) of input frames.
  4852. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4853. regions for the red-cyan, green-magenta or blue-yellow balance.
  4854. A positive adjustment value shifts the balance towards the primary color, a negative
  4855. value towards the complementary color.
  4856. The filter accepts the following options:
  4857. @table @option
  4858. @item rs
  4859. @item gs
  4860. @item bs
  4861. Adjust red, green and blue shadows (darkest pixels).
  4862. @item rm
  4863. @item gm
  4864. @item bm
  4865. Adjust red, green and blue midtones (medium pixels).
  4866. @item rh
  4867. @item gh
  4868. @item bh
  4869. Adjust red, green and blue highlights (brightest pixels).
  4870. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4871. @end table
  4872. @subsection Examples
  4873. @itemize
  4874. @item
  4875. Add red color cast to shadows:
  4876. @example
  4877. colorbalance=rs=.3
  4878. @end example
  4879. @end itemize
  4880. @section colorkey
  4881. RGB colorspace color keying.
  4882. The filter accepts the following options:
  4883. @table @option
  4884. @item color
  4885. The color which will be replaced with transparency.
  4886. @item similarity
  4887. Similarity percentage with the key color.
  4888. 0.01 matches only the exact key color, while 1.0 matches everything.
  4889. @item blend
  4890. Blend percentage.
  4891. 0.0 makes pixels either fully transparent, or not transparent at all.
  4892. Higher values result in semi-transparent pixels, with a higher transparency
  4893. the more similar the pixels color is to the key color.
  4894. @end table
  4895. @subsection Examples
  4896. @itemize
  4897. @item
  4898. Make every green pixel in the input image transparent:
  4899. @example
  4900. ffmpeg -i input.png -vf colorkey=green out.png
  4901. @end example
  4902. @item
  4903. Overlay a greenscreen-video on top of a static background image.
  4904. @example
  4905. 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
  4906. @end example
  4907. @end itemize
  4908. @section colorlevels
  4909. Adjust video input frames using levels.
  4910. The filter accepts the following options:
  4911. @table @option
  4912. @item rimin
  4913. @item gimin
  4914. @item bimin
  4915. @item aimin
  4916. Adjust red, green, blue and alpha input black point.
  4917. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4918. @item rimax
  4919. @item gimax
  4920. @item bimax
  4921. @item aimax
  4922. Adjust red, green, blue and alpha input white point.
  4923. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4924. Input levels are used to lighten highlights (bright tones), darken shadows
  4925. (dark tones), change the balance of bright and dark tones.
  4926. @item romin
  4927. @item gomin
  4928. @item bomin
  4929. @item aomin
  4930. Adjust red, green, blue and alpha output black point.
  4931. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4932. @item romax
  4933. @item gomax
  4934. @item bomax
  4935. @item aomax
  4936. Adjust red, green, blue and alpha output white point.
  4937. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4938. Output levels allows manual selection of a constrained output level range.
  4939. @end table
  4940. @subsection Examples
  4941. @itemize
  4942. @item
  4943. Make video output darker:
  4944. @example
  4945. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4946. @end example
  4947. @item
  4948. Increase contrast:
  4949. @example
  4950. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4951. @end example
  4952. @item
  4953. Make video output lighter:
  4954. @example
  4955. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4956. @end example
  4957. @item
  4958. Increase brightness:
  4959. @example
  4960. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4961. @end example
  4962. @end itemize
  4963. @section colorchannelmixer
  4964. Adjust video input frames by re-mixing color channels.
  4965. This filter modifies a color channel by adding the values associated to
  4966. the other channels of the same pixels. For example if the value to
  4967. modify is red, the output value will be:
  4968. @example
  4969. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4970. @end example
  4971. The filter accepts the following options:
  4972. @table @option
  4973. @item rr
  4974. @item rg
  4975. @item rb
  4976. @item ra
  4977. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4978. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4979. @item gr
  4980. @item gg
  4981. @item gb
  4982. @item ga
  4983. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4984. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4985. @item br
  4986. @item bg
  4987. @item bb
  4988. @item ba
  4989. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4990. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4991. @item ar
  4992. @item ag
  4993. @item ab
  4994. @item aa
  4995. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4996. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4997. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4998. @end table
  4999. @subsection Examples
  5000. @itemize
  5001. @item
  5002. Convert source to grayscale:
  5003. @example
  5004. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5005. @end example
  5006. @item
  5007. Simulate sepia tones:
  5008. @example
  5009. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5010. @end example
  5011. @end itemize
  5012. @section colormatrix
  5013. Convert color matrix.
  5014. The filter accepts the following options:
  5015. @table @option
  5016. @item src
  5017. @item dst
  5018. Specify the source and destination color matrix. Both values must be
  5019. specified.
  5020. The accepted values are:
  5021. @table @samp
  5022. @item bt709
  5023. BT.709
  5024. @item fcc
  5025. FCC
  5026. @item bt601
  5027. BT.601
  5028. @item bt470
  5029. BT.470
  5030. @item bt470bg
  5031. BT.470BG
  5032. @item smpte170m
  5033. SMPTE-170M
  5034. @item smpte240m
  5035. SMPTE-240M
  5036. @item bt2020
  5037. BT.2020
  5038. @end table
  5039. @end table
  5040. For example to convert from BT.601 to SMPTE-240M, use the command:
  5041. @example
  5042. colormatrix=bt601:smpte240m
  5043. @end example
  5044. @section colorspace
  5045. Convert colorspace, transfer characteristics or color primaries.
  5046. Input video needs to have an even size.
  5047. The filter accepts the following options:
  5048. @table @option
  5049. @anchor{all}
  5050. @item all
  5051. Specify all color properties at once.
  5052. The accepted values are:
  5053. @table @samp
  5054. @item bt470m
  5055. BT.470M
  5056. @item bt470bg
  5057. BT.470BG
  5058. @item bt601-6-525
  5059. BT.601-6 525
  5060. @item bt601-6-625
  5061. BT.601-6 625
  5062. @item bt709
  5063. BT.709
  5064. @item smpte170m
  5065. SMPTE-170M
  5066. @item smpte240m
  5067. SMPTE-240M
  5068. @item bt2020
  5069. BT.2020
  5070. @end table
  5071. @anchor{space}
  5072. @item space
  5073. Specify output colorspace.
  5074. The accepted values are:
  5075. @table @samp
  5076. @item bt709
  5077. BT.709
  5078. @item fcc
  5079. FCC
  5080. @item bt470bg
  5081. BT.470BG or BT.601-6 625
  5082. @item smpte170m
  5083. SMPTE-170M or BT.601-6 525
  5084. @item smpte240m
  5085. SMPTE-240M
  5086. @item ycgco
  5087. YCgCo
  5088. @item bt2020ncl
  5089. BT.2020 with non-constant luminance
  5090. @end table
  5091. @anchor{trc}
  5092. @item trc
  5093. Specify output transfer characteristics.
  5094. The accepted values are:
  5095. @table @samp
  5096. @item bt709
  5097. BT.709
  5098. @item bt470m
  5099. BT.470M
  5100. @item bt470bg
  5101. BT.470BG
  5102. @item gamma22
  5103. Constant gamma of 2.2
  5104. @item gamma28
  5105. Constant gamma of 2.8
  5106. @item smpte170m
  5107. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5108. @item smpte240m
  5109. SMPTE-240M
  5110. @item srgb
  5111. SRGB
  5112. @item iec61966-2-1
  5113. iec61966-2-1
  5114. @item iec61966-2-4
  5115. iec61966-2-4
  5116. @item xvycc
  5117. xvycc
  5118. @item bt2020-10
  5119. BT.2020 for 10-bits content
  5120. @item bt2020-12
  5121. BT.2020 for 12-bits content
  5122. @end table
  5123. @anchor{primaries}
  5124. @item primaries
  5125. Specify output color primaries.
  5126. The accepted values are:
  5127. @table @samp
  5128. @item bt709
  5129. BT.709
  5130. @item bt470m
  5131. BT.470M
  5132. @item bt470bg
  5133. BT.470BG or BT.601-6 625
  5134. @item smpte170m
  5135. SMPTE-170M or BT.601-6 525
  5136. @item smpte240m
  5137. SMPTE-240M
  5138. @item film
  5139. film
  5140. @item smpte431
  5141. SMPTE-431
  5142. @item smpte432
  5143. SMPTE-432
  5144. @item bt2020
  5145. BT.2020
  5146. @item jedec-p22
  5147. JEDEC P22 phosphors
  5148. @end table
  5149. @anchor{range}
  5150. @item range
  5151. Specify output color range.
  5152. The accepted values are:
  5153. @table @samp
  5154. @item tv
  5155. TV (restricted) range
  5156. @item mpeg
  5157. MPEG (restricted) range
  5158. @item pc
  5159. PC (full) range
  5160. @item jpeg
  5161. JPEG (full) range
  5162. @end table
  5163. @item format
  5164. Specify output color format.
  5165. The accepted values are:
  5166. @table @samp
  5167. @item yuv420p
  5168. YUV 4:2:0 planar 8-bits
  5169. @item yuv420p10
  5170. YUV 4:2:0 planar 10-bits
  5171. @item yuv420p12
  5172. YUV 4:2:0 planar 12-bits
  5173. @item yuv422p
  5174. YUV 4:2:2 planar 8-bits
  5175. @item yuv422p10
  5176. YUV 4:2:2 planar 10-bits
  5177. @item yuv422p12
  5178. YUV 4:2:2 planar 12-bits
  5179. @item yuv444p
  5180. YUV 4:4:4 planar 8-bits
  5181. @item yuv444p10
  5182. YUV 4:4:4 planar 10-bits
  5183. @item yuv444p12
  5184. YUV 4:4:4 planar 12-bits
  5185. @end table
  5186. @item fast
  5187. Do a fast conversion, which skips gamma/primary correction. This will take
  5188. significantly less CPU, but will be mathematically incorrect. To get output
  5189. compatible with that produced by the colormatrix filter, use fast=1.
  5190. @item dither
  5191. Specify dithering mode.
  5192. The accepted values are:
  5193. @table @samp
  5194. @item none
  5195. No dithering
  5196. @item fsb
  5197. Floyd-Steinberg dithering
  5198. @end table
  5199. @item wpadapt
  5200. Whitepoint adaptation mode.
  5201. The accepted values are:
  5202. @table @samp
  5203. @item bradford
  5204. Bradford whitepoint adaptation
  5205. @item vonkries
  5206. von Kries whitepoint adaptation
  5207. @item identity
  5208. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5209. @end table
  5210. @item iall
  5211. Override all input properties at once. Same accepted values as @ref{all}.
  5212. @item ispace
  5213. Override input colorspace. Same accepted values as @ref{space}.
  5214. @item iprimaries
  5215. Override input color primaries. Same accepted values as @ref{primaries}.
  5216. @item itrc
  5217. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5218. @item irange
  5219. Override input color range. Same accepted values as @ref{range}.
  5220. @end table
  5221. The filter converts the transfer characteristics, color space and color
  5222. primaries to the specified user values. The output value, if not specified,
  5223. is set to a default value based on the "all" property. If that property is
  5224. also not specified, the filter will log an error. The output color range and
  5225. format default to the same value as the input color range and format. The
  5226. input transfer characteristics, color space, color primaries and color range
  5227. should be set on the input data. If any of these are missing, the filter will
  5228. log an error and no conversion will take place.
  5229. For example to convert the input to SMPTE-240M, use the command:
  5230. @example
  5231. colorspace=smpte240m
  5232. @end example
  5233. @section convolution
  5234. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5235. The filter accepts the following options:
  5236. @table @option
  5237. @item 0m
  5238. @item 1m
  5239. @item 2m
  5240. @item 3m
  5241. Set matrix for each plane.
  5242. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5243. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5244. @item 0rdiv
  5245. @item 1rdiv
  5246. @item 2rdiv
  5247. @item 3rdiv
  5248. Set multiplier for calculated value for each plane.
  5249. If unset or 0, it will be sum of all matrix elements.
  5250. @item 0bias
  5251. @item 1bias
  5252. @item 2bias
  5253. @item 3bias
  5254. Set bias for each plane. This value is added to the result of the multiplication.
  5255. Useful for making the overall image brighter or darker. Default is 0.0.
  5256. @item 0mode
  5257. @item 1mode
  5258. @item 2mode
  5259. @item 3mode
  5260. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5261. Default is @var{square}.
  5262. @end table
  5263. @subsection Examples
  5264. @itemize
  5265. @item
  5266. Apply sharpen:
  5267. @example
  5268. 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"
  5269. @end example
  5270. @item
  5271. Apply blur:
  5272. @example
  5273. 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"
  5274. @end example
  5275. @item
  5276. Apply edge enhance:
  5277. @example
  5278. 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"
  5279. @end example
  5280. @item
  5281. Apply edge detect:
  5282. @example
  5283. 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"
  5284. @end example
  5285. @item
  5286. Apply laplacian edge detector which includes diagonals:
  5287. @example
  5288. 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"
  5289. @end example
  5290. @item
  5291. Apply emboss:
  5292. @example
  5293. 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"
  5294. @end example
  5295. @end itemize
  5296. @section convolve
  5297. Apply 2D convolution of video stream in frequency domain using second stream
  5298. as impulse.
  5299. The filter accepts the following options:
  5300. @table @option
  5301. @item planes
  5302. Set which planes to process.
  5303. @item impulse
  5304. Set which impulse video frames will be processed, can be @var{first}
  5305. or @var{all}. Default is @var{all}.
  5306. @end table
  5307. The @code{convolve} filter also supports the @ref{framesync} options.
  5308. @section copy
  5309. Copy the input video source unchanged to the output. This is mainly useful for
  5310. testing purposes.
  5311. @anchor{coreimage}
  5312. @section coreimage
  5313. Video filtering on GPU using Apple's CoreImage API on OSX.
  5314. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5315. processed by video hardware. However, software-based OpenGL implementations
  5316. exist which means there is no guarantee for hardware processing. It depends on
  5317. the respective OSX.
  5318. There are many filters and image generators provided by Apple that come with a
  5319. large variety of options. The filter has to be referenced by its name along
  5320. with its options.
  5321. The coreimage filter accepts the following options:
  5322. @table @option
  5323. @item list_filters
  5324. List all available filters and generators along with all their respective
  5325. options as well as possible minimum and maximum values along with the default
  5326. values.
  5327. @example
  5328. list_filters=true
  5329. @end example
  5330. @item filter
  5331. Specify all filters by their respective name and options.
  5332. Use @var{list_filters} to determine all valid filter names and options.
  5333. Numerical options are specified by a float value and are automatically clamped
  5334. to their respective value range. Vector and color options have to be specified
  5335. by a list of space separated float values. Character escaping has to be done.
  5336. A special option name @code{default} is available to use default options for a
  5337. filter.
  5338. It is required to specify either @code{default} or at least one of the filter options.
  5339. All omitted options are used with their default values.
  5340. The syntax of the filter string is as follows:
  5341. @example
  5342. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5343. @end example
  5344. @item output_rect
  5345. Specify a rectangle where the output of the filter chain is copied into the
  5346. input image. It is given by a list of space separated float values:
  5347. @example
  5348. output_rect=x\ y\ width\ height
  5349. @end example
  5350. If not given, the output rectangle equals the dimensions of the input image.
  5351. The output rectangle is automatically cropped at the borders of the input
  5352. image. Negative values are valid for each component.
  5353. @example
  5354. output_rect=25\ 25\ 100\ 100
  5355. @end example
  5356. @end table
  5357. Several filters can be chained for successive processing without GPU-HOST
  5358. transfers allowing for fast processing of complex filter chains.
  5359. Currently, only filters with zero (generators) or exactly one (filters) input
  5360. image and one output image are supported. Also, transition filters are not yet
  5361. usable as intended.
  5362. Some filters generate output images with additional padding depending on the
  5363. respective filter kernel. The padding is automatically removed to ensure the
  5364. filter output has the same size as the input image.
  5365. For image generators, the size of the output image is determined by the
  5366. previous output image of the filter chain or the input image of the whole
  5367. filterchain, respectively. The generators do not use the pixel information of
  5368. this image to generate their output. However, the generated output is
  5369. blended onto this image, resulting in partial or complete coverage of the
  5370. output image.
  5371. The @ref{coreimagesrc} video source can be used for generating input images
  5372. which are directly fed into the filter chain. By using it, providing input
  5373. images by another video source or an input video is not required.
  5374. @subsection Examples
  5375. @itemize
  5376. @item
  5377. List all filters available:
  5378. @example
  5379. coreimage=list_filters=true
  5380. @end example
  5381. @item
  5382. Use the CIBoxBlur filter with default options to blur an image:
  5383. @example
  5384. coreimage=filter=CIBoxBlur@@default
  5385. @end example
  5386. @item
  5387. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5388. its center at 100x100 and a radius of 50 pixels:
  5389. @example
  5390. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5391. @end example
  5392. @item
  5393. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5394. given as complete and escaped command-line for Apple's standard bash shell:
  5395. @example
  5396. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5397. @end example
  5398. @end itemize
  5399. @section crop
  5400. Crop the input video to given dimensions.
  5401. It accepts the following parameters:
  5402. @table @option
  5403. @item w, out_w
  5404. The width of the output video. It defaults to @code{iw}.
  5405. This expression is evaluated only once during the filter
  5406. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5407. @item h, out_h
  5408. The height of the output video. It defaults to @code{ih}.
  5409. This expression is evaluated only once during the filter
  5410. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5411. @item x
  5412. The horizontal position, in the input video, of the left edge of the output
  5413. video. It defaults to @code{(in_w-out_w)/2}.
  5414. This expression is evaluated per-frame.
  5415. @item y
  5416. The vertical position, in the input video, of the top edge of the output video.
  5417. It defaults to @code{(in_h-out_h)/2}.
  5418. This expression is evaluated per-frame.
  5419. @item keep_aspect
  5420. If set to 1 will force the output display aspect ratio
  5421. to be the same of the input, by changing the output sample aspect
  5422. ratio. It defaults to 0.
  5423. @item exact
  5424. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5425. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5426. It defaults to 0.
  5427. @end table
  5428. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5429. expressions containing the following constants:
  5430. @table @option
  5431. @item x
  5432. @item y
  5433. The computed values for @var{x} and @var{y}. They are evaluated for
  5434. each new frame.
  5435. @item in_w
  5436. @item in_h
  5437. The input width and height.
  5438. @item iw
  5439. @item ih
  5440. These are the same as @var{in_w} and @var{in_h}.
  5441. @item out_w
  5442. @item out_h
  5443. The output (cropped) width and height.
  5444. @item ow
  5445. @item oh
  5446. These are the same as @var{out_w} and @var{out_h}.
  5447. @item a
  5448. same as @var{iw} / @var{ih}
  5449. @item sar
  5450. input sample aspect ratio
  5451. @item dar
  5452. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5453. @item hsub
  5454. @item vsub
  5455. horizontal and vertical chroma subsample values. For example for the
  5456. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5457. @item n
  5458. The number of the input frame, starting from 0.
  5459. @item pos
  5460. the position in the file of the input frame, NAN if unknown
  5461. @item t
  5462. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5463. @end table
  5464. The expression for @var{out_w} may depend on the value of @var{out_h},
  5465. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5466. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5467. evaluated after @var{out_w} and @var{out_h}.
  5468. The @var{x} and @var{y} parameters specify the expressions for the
  5469. position of the top-left corner of the output (non-cropped) area. They
  5470. are evaluated for each frame. If the evaluated value is not valid, it
  5471. is approximated to the nearest valid value.
  5472. The expression for @var{x} may depend on @var{y}, and the expression
  5473. for @var{y} may depend on @var{x}.
  5474. @subsection Examples
  5475. @itemize
  5476. @item
  5477. Crop area with size 100x100 at position (12,34).
  5478. @example
  5479. crop=100:100:12:34
  5480. @end example
  5481. Using named options, the example above becomes:
  5482. @example
  5483. crop=w=100:h=100:x=12:y=34
  5484. @end example
  5485. @item
  5486. Crop the central input area with size 100x100:
  5487. @example
  5488. crop=100:100
  5489. @end example
  5490. @item
  5491. Crop the central input area with size 2/3 of the input video:
  5492. @example
  5493. crop=2/3*in_w:2/3*in_h
  5494. @end example
  5495. @item
  5496. Crop the input video central square:
  5497. @example
  5498. crop=out_w=in_h
  5499. crop=in_h
  5500. @end example
  5501. @item
  5502. Delimit the rectangle with the top-left corner placed at position
  5503. 100:100 and the right-bottom corner corresponding to the right-bottom
  5504. corner of the input image.
  5505. @example
  5506. crop=in_w-100:in_h-100:100:100
  5507. @end example
  5508. @item
  5509. Crop 10 pixels from the left and right borders, and 20 pixels from
  5510. the top and bottom borders
  5511. @example
  5512. crop=in_w-2*10:in_h-2*20
  5513. @end example
  5514. @item
  5515. Keep only the bottom right quarter of the input image:
  5516. @example
  5517. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5518. @end example
  5519. @item
  5520. Crop height for getting Greek harmony:
  5521. @example
  5522. crop=in_w:1/PHI*in_w
  5523. @end example
  5524. @item
  5525. Apply trembling effect:
  5526. @example
  5527. 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)
  5528. @end example
  5529. @item
  5530. Apply erratic camera effect depending on timestamp:
  5531. @example
  5532. 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)"
  5533. @end example
  5534. @item
  5535. Set x depending on the value of y:
  5536. @example
  5537. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5538. @end example
  5539. @end itemize
  5540. @subsection Commands
  5541. This filter supports the following commands:
  5542. @table @option
  5543. @item w, out_w
  5544. @item h, out_h
  5545. @item x
  5546. @item y
  5547. Set width/height of the output video and the horizontal/vertical position
  5548. in the input video.
  5549. The command accepts the same syntax of the corresponding option.
  5550. If the specified expression is not valid, it is kept at its current
  5551. value.
  5552. @end table
  5553. @section cropdetect
  5554. Auto-detect the crop size.
  5555. It calculates the necessary cropping parameters and prints the
  5556. recommended parameters via the logging system. The detected dimensions
  5557. correspond to the non-black area of the input video.
  5558. It accepts the following parameters:
  5559. @table @option
  5560. @item limit
  5561. Set higher black value threshold, which can be optionally specified
  5562. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5563. value greater to the set value is considered non-black. It defaults to 24.
  5564. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5565. on the bitdepth of the pixel format.
  5566. @item round
  5567. The value which the width/height should be divisible by. It defaults to
  5568. 16. The offset is automatically adjusted to center the video. Use 2 to
  5569. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5570. encoding to most video codecs.
  5571. @item reset_count, reset
  5572. Set the counter that determines after how many frames cropdetect will
  5573. reset the previously detected largest video area and start over to
  5574. detect the current optimal crop area. Default value is 0.
  5575. This can be useful when channel logos distort the video area. 0
  5576. indicates 'never reset', and returns the largest area encountered during
  5577. playback.
  5578. @end table
  5579. @anchor{cue}
  5580. @section cue
  5581. Delay video filtering until a given wallclock timestamp. The filter first
  5582. passes on @option{preroll} amount of frames, then it buffers at most
  5583. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5584. it forwards the buffered frames and also any subsequent frames coming in its
  5585. input.
  5586. The filter can be used synchronize the output of multiple ffmpeg processes for
  5587. realtime output devices like decklink. By putting the delay in the filtering
  5588. chain and pre-buffering frames the process can pass on data to output almost
  5589. immediately after the target wallclock timestamp is reached.
  5590. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5591. some use cases.
  5592. @table @option
  5593. @item cue
  5594. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5595. @item preroll
  5596. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5597. @item buffer
  5598. The maximum duration of content to buffer before waiting for the cue expressed
  5599. in seconds. Default is 0.
  5600. @end table
  5601. @anchor{curves}
  5602. @section curves
  5603. Apply color adjustments using curves.
  5604. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5605. component (red, green and blue) has its values defined by @var{N} key points
  5606. tied from each other using a smooth curve. The x-axis represents the pixel
  5607. values from the input frame, and the y-axis the new pixel values to be set for
  5608. the output frame.
  5609. By default, a component curve is defined by the two points @var{(0;0)} and
  5610. @var{(1;1)}. This creates a straight line where each original pixel value is
  5611. "adjusted" to its own value, which means no change to the image.
  5612. The filter allows you to redefine these two points and add some more. A new
  5613. curve (using a natural cubic spline interpolation) will be define to pass
  5614. smoothly through all these new coordinates. The new defined points needs to be
  5615. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5616. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5617. the vector spaces, the values will be clipped accordingly.
  5618. The filter accepts the following options:
  5619. @table @option
  5620. @item preset
  5621. Select one of the available color presets. This option can be used in addition
  5622. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5623. options takes priority on the preset values.
  5624. Available presets are:
  5625. @table @samp
  5626. @item none
  5627. @item color_negative
  5628. @item cross_process
  5629. @item darker
  5630. @item increase_contrast
  5631. @item lighter
  5632. @item linear_contrast
  5633. @item medium_contrast
  5634. @item negative
  5635. @item strong_contrast
  5636. @item vintage
  5637. @end table
  5638. Default is @code{none}.
  5639. @item master, m
  5640. Set the master key points. These points will define a second pass mapping. It
  5641. is sometimes called a "luminance" or "value" mapping. It can be used with
  5642. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5643. post-processing LUT.
  5644. @item red, r
  5645. Set the key points for the red component.
  5646. @item green, g
  5647. Set the key points for the green component.
  5648. @item blue, b
  5649. Set the key points for the blue component.
  5650. @item all
  5651. Set the key points for all components (not including master).
  5652. Can be used in addition to the other key points component
  5653. options. In this case, the unset component(s) will fallback on this
  5654. @option{all} setting.
  5655. @item psfile
  5656. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5657. @item plot
  5658. Save Gnuplot script of the curves in specified file.
  5659. @end table
  5660. To avoid some filtergraph syntax conflicts, each key points list need to be
  5661. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5662. @subsection Examples
  5663. @itemize
  5664. @item
  5665. Increase slightly the middle level of blue:
  5666. @example
  5667. curves=blue='0/0 0.5/0.58 1/1'
  5668. @end example
  5669. @item
  5670. Vintage effect:
  5671. @example
  5672. 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'
  5673. @end example
  5674. Here we obtain the following coordinates for each components:
  5675. @table @var
  5676. @item red
  5677. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5678. @item green
  5679. @code{(0;0) (0.50;0.48) (1;1)}
  5680. @item blue
  5681. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5682. @end table
  5683. @item
  5684. The previous example can also be achieved with the associated built-in preset:
  5685. @example
  5686. curves=preset=vintage
  5687. @end example
  5688. @item
  5689. Or simply:
  5690. @example
  5691. curves=vintage
  5692. @end example
  5693. @item
  5694. Use a Photoshop preset and redefine the points of the green component:
  5695. @example
  5696. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5697. @end example
  5698. @item
  5699. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5700. and @command{gnuplot}:
  5701. @example
  5702. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5703. gnuplot -p /tmp/curves.plt
  5704. @end example
  5705. @end itemize
  5706. @section datascope
  5707. Video data analysis filter.
  5708. This filter shows hexadecimal pixel values of part of video.
  5709. The filter accepts the following options:
  5710. @table @option
  5711. @item size, s
  5712. Set output video size.
  5713. @item x
  5714. Set x offset from where to pick pixels.
  5715. @item y
  5716. Set y offset from where to pick pixels.
  5717. @item mode
  5718. Set scope mode, can be one of the following:
  5719. @table @samp
  5720. @item mono
  5721. Draw hexadecimal pixel values with white color on black background.
  5722. @item color
  5723. Draw hexadecimal pixel values with input video pixel color on black
  5724. background.
  5725. @item color2
  5726. Draw hexadecimal pixel values on color background picked from input video,
  5727. the text color is picked in such way so its always visible.
  5728. @end table
  5729. @item axis
  5730. Draw rows and columns numbers on left and top of video.
  5731. @item opacity
  5732. Set background opacity.
  5733. @end table
  5734. @section dctdnoiz
  5735. Denoise frames using 2D DCT (frequency domain filtering).
  5736. This filter is not designed for real time.
  5737. The filter accepts the following options:
  5738. @table @option
  5739. @item sigma, s
  5740. Set the noise sigma constant.
  5741. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5742. coefficient (absolute value) below this threshold with be dropped.
  5743. If you need a more advanced filtering, see @option{expr}.
  5744. Default is @code{0}.
  5745. @item overlap
  5746. Set number overlapping pixels for each block. Since the filter can be slow, you
  5747. may want to reduce this value, at the cost of a less effective filter and the
  5748. risk of various artefacts.
  5749. If the overlapping value doesn't permit processing the whole input width or
  5750. height, a warning will be displayed and according borders won't be denoised.
  5751. Default value is @var{blocksize}-1, which is the best possible setting.
  5752. @item expr, e
  5753. Set the coefficient factor expression.
  5754. For each coefficient of a DCT block, this expression will be evaluated as a
  5755. multiplier value for the coefficient.
  5756. If this is option is set, the @option{sigma} option will be ignored.
  5757. The absolute value of the coefficient can be accessed through the @var{c}
  5758. variable.
  5759. @item n
  5760. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5761. @var{blocksize}, which is the width and height of the processed blocks.
  5762. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5763. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5764. on the speed processing. Also, a larger block size does not necessarily means a
  5765. better de-noising.
  5766. @end table
  5767. @subsection Examples
  5768. Apply a denoise with a @option{sigma} of @code{4.5}:
  5769. @example
  5770. dctdnoiz=4.5
  5771. @end example
  5772. The same operation can be achieved using the expression system:
  5773. @example
  5774. dctdnoiz=e='gte(c, 4.5*3)'
  5775. @end example
  5776. Violent denoise using a block size of @code{16x16}:
  5777. @example
  5778. dctdnoiz=15:n=4
  5779. @end example
  5780. @section deband
  5781. Remove banding artifacts from input video.
  5782. It works by replacing banded pixels with average value of referenced pixels.
  5783. The filter accepts the following options:
  5784. @table @option
  5785. @item 1thr
  5786. @item 2thr
  5787. @item 3thr
  5788. @item 4thr
  5789. Set banding detection threshold for each plane. Default is 0.02.
  5790. Valid range is 0.00003 to 0.5.
  5791. If difference between current pixel and reference pixel is less than threshold,
  5792. it will be considered as banded.
  5793. @item range, r
  5794. Banding detection range in pixels. Default is 16. If positive, random number
  5795. in range 0 to set value will be used. If negative, exact absolute value
  5796. will be used.
  5797. The range defines square of four pixels around current pixel.
  5798. @item direction, d
  5799. Set direction in radians from which four pixel will be compared. If positive,
  5800. random direction from 0 to set direction will be picked. If negative, exact of
  5801. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5802. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5803. column.
  5804. @item blur, b
  5805. If enabled, current pixel is compared with average value of all four
  5806. surrounding pixels. The default is enabled. If disabled current pixel is
  5807. compared with all four surrounding pixels. The pixel is considered banded
  5808. if only all four differences with surrounding pixels are less than threshold.
  5809. @item coupling, c
  5810. If enabled, current pixel is changed if and only if all pixel components are banded,
  5811. e.g. banding detection threshold is triggered for all color components.
  5812. The default is disabled.
  5813. @end table
  5814. @section deblock
  5815. Remove blocking artifacts from input video.
  5816. The filter accepts the following options:
  5817. @table @option
  5818. @item filter
  5819. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5820. This controls what kind of deblocking is applied.
  5821. @item block
  5822. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5823. @item alpha
  5824. @item beta
  5825. @item gamma
  5826. @item delta
  5827. Set blocking detection thresholds. Allowed range is 0 to 1.
  5828. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5829. Using higher threshold gives more deblocking strength.
  5830. Setting @var{alpha} controls threshold detection at exact edge of block.
  5831. Remaining options controls threshold detection near the edge. Each one for
  5832. below/above or left/right. Setting any of those to @var{0} disables
  5833. deblocking.
  5834. @item planes
  5835. Set planes to filter. Default is to filter all available planes.
  5836. @end table
  5837. @subsection Examples
  5838. @itemize
  5839. @item
  5840. Deblock using weak filter and block size of 4 pixels.
  5841. @example
  5842. deblock=filter=weak:block=4
  5843. @end example
  5844. @item
  5845. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5846. deblocking more edges.
  5847. @example
  5848. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5849. @end example
  5850. @item
  5851. Similar as above, but filter only first plane.
  5852. @example
  5853. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5854. @end example
  5855. @item
  5856. Similar as above, but filter only second and third plane.
  5857. @example
  5858. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5859. @end example
  5860. @end itemize
  5861. @anchor{decimate}
  5862. @section decimate
  5863. Drop duplicated frames at regular intervals.
  5864. The filter accepts the following options:
  5865. @table @option
  5866. @item cycle
  5867. Set the number of frames from which one will be dropped. Setting this to
  5868. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5869. Default is @code{5}.
  5870. @item dupthresh
  5871. Set the threshold for duplicate detection. If the difference metric for a frame
  5872. is less than or equal to this value, then it is declared as duplicate. Default
  5873. is @code{1.1}
  5874. @item scthresh
  5875. Set scene change threshold. Default is @code{15}.
  5876. @item blockx
  5877. @item blocky
  5878. Set the size of the x and y-axis blocks used during metric calculations.
  5879. Larger blocks give better noise suppression, but also give worse detection of
  5880. small movements. Must be a power of two. Default is @code{32}.
  5881. @item ppsrc
  5882. Mark main input as a pre-processed input and activate clean source input
  5883. stream. This allows the input to be pre-processed with various filters to help
  5884. the metrics calculation while keeping the frame selection lossless. When set to
  5885. @code{1}, the first stream is for the pre-processed input, and the second
  5886. stream is the clean source from where the kept frames are chosen. Default is
  5887. @code{0}.
  5888. @item chroma
  5889. Set whether or not chroma is considered in the metric calculations. Default is
  5890. @code{1}.
  5891. @end table
  5892. @section deconvolve
  5893. Apply 2D deconvolution of video stream in frequency domain using second stream
  5894. as impulse.
  5895. The filter accepts the following options:
  5896. @table @option
  5897. @item planes
  5898. Set which planes to process.
  5899. @item impulse
  5900. Set which impulse video frames will be processed, can be @var{first}
  5901. or @var{all}. Default is @var{all}.
  5902. @item noise
  5903. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5904. and height are not same and not power of 2 or if stream prior to convolving
  5905. had noise.
  5906. @end table
  5907. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5908. @section deflate
  5909. Apply deflate effect to the video.
  5910. This filter replaces the pixel by the local(3x3) average by taking into account
  5911. only values lower than the pixel.
  5912. It accepts the following options:
  5913. @table @option
  5914. @item threshold0
  5915. @item threshold1
  5916. @item threshold2
  5917. @item threshold3
  5918. Limit the maximum change for each plane, default is 65535.
  5919. If 0, plane will remain unchanged.
  5920. @end table
  5921. @section deflicker
  5922. Remove temporal frame luminance variations.
  5923. It accepts the following options:
  5924. @table @option
  5925. @item size, s
  5926. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5927. @item mode, m
  5928. Set averaging mode to smooth temporal luminance variations.
  5929. Available values are:
  5930. @table @samp
  5931. @item am
  5932. Arithmetic mean
  5933. @item gm
  5934. Geometric mean
  5935. @item hm
  5936. Harmonic mean
  5937. @item qm
  5938. Quadratic mean
  5939. @item cm
  5940. Cubic mean
  5941. @item pm
  5942. Power mean
  5943. @item median
  5944. Median
  5945. @end table
  5946. @item bypass
  5947. Do not actually modify frame. Useful when one only wants metadata.
  5948. @end table
  5949. @section dejudder
  5950. Remove judder produced by partially interlaced telecined content.
  5951. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5952. source was partially telecined content then the output of @code{pullup,dejudder}
  5953. will have a variable frame rate. May change the recorded frame rate of the
  5954. container. Aside from that change, this filter will not affect constant frame
  5955. rate video.
  5956. The option available in this filter is:
  5957. @table @option
  5958. @item cycle
  5959. Specify the length of the window over which the judder repeats.
  5960. Accepts any integer greater than 1. Useful values are:
  5961. @table @samp
  5962. @item 4
  5963. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5964. @item 5
  5965. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5966. @item 20
  5967. If a mixture of the two.
  5968. @end table
  5969. The default is @samp{4}.
  5970. @end table
  5971. @section delogo
  5972. Suppress a TV station logo by a simple interpolation of the surrounding
  5973. pixels. Just set a rectangle covering the logo and watch it disappear
  5974. (and sometimes something even uglier appear - your mileage may vary).
  5975. It accepts the following parameters:
  5976. @table @option
  5977. @item x
  5978. @item y
  5979. Specify the top left corner coordinates of the logo. They must be
  5980. specified.
  5981. @item w
  5982. @item h
  5983. Specify the width and height of the logo to clear. They must be
  5984. specified.
  5985. @item band, t
  5986. Specify the thickness of the fuzzy edge of the rectangle (added to
  5987. @var{w} and @var{h}). The default value is 1. This option is
  5988. deprecated, setting higher values should no longer be necessary and
  5989. is not recommended.
  5990. @item show
  5991. When set to 1, a green rectangle is drawn on the screen to simplify
  5992. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5993. The default value is 0.
  5994. The rectangle is drawn on the outermost pixels which will be (partly)
  5995. replaced with interpolated values. The values of the next pixels
  5996. immediately outside this rectangle in each direction will be used to
  5997. compute the interpolated pixel values inside the rectangle.
  5998. @end table
  5999. @subsection Examples
  6000. @itemize
  6001. @item
  6002. Set a rectangle covering the area with top left corner coordinates 0,0
  6003. and size 100x77, and a band of size 10:
  6004. @example
  6005. delogo=x=0:y=0:w=100:h=77:band=10
  6006. @end example
  6007. @end itemize
  6008. @section deshake
  6009. Attempt to fix small changes in horizontal and/or vertical shift. This
  6010. filter helps remove camera shake from hand-holding a camera, bumping a
  6011. tripod, moving on a vehicle, etc.
  6012. The filter accepts the following options:
  6013. @table @option
  6014. @item x
  6015. @item y
  6016. @item w
  6017. @item h
  6018. Specify a rectangular area where to limit the search for motion
  6019. vectors.
  6020. If desired the search for motion vectors can be limited to a
  6021. rectangular area of the frame defined by its top left corner, width
  6022. and height. These parameters have the same meaning as the drawbox
  6023. filter which can be used to visualise the position of the bounding
  6024. box.
  6025. This is useful when simultaneous movement of subjects within the frame
  6026. might be confused for camera motion by the motion vector search.
  6027. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6028. then the full frame is used. This allows later options to be set
  6029. without specifying the bounding box for the motion vector search.
  6030. Default - search the whole frame.
  6031. @item rx
  6032. @item ry
  6033. Specify the maximum extent of movement in x and y directions in the
  6034. range 0-64 pixels. Default 16.
  6035. @item edge
  6036. Specify how to generate pixels to fill blanks at the edge of the
  6037. frame. Available values are:
  6038. @table @samp
  6039. @item blank, 0
  6040. Fill zeroes at blank locations
  6041. @item original, 1
  6042. Original image at blank locations
  6043. @item clamp, 2
  6044. Extruded edge value at blank locations
  6045. @item mirror, 3
  6046. Mirrored edge at blank locations
  6047. @end table
  6048. Default value is @samp{mirror}.
  6049. @item blocksize
  6050. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6051. default 8.
  6052. @item contrast
  6053. Specify the contrast threshold for blocks. Only blocks with more than
  6054. the specified contrast (difference between darkest and lightest
  6055. pixels) will be considered. Range 1-255, default 125.
  6056. @item search
  6057. Specify the search strategy. Available values are:
  6058. @table @samp
  6059. @item exhaustive, 0
  6060. Set exhaustive search
  6061. @item less, 1
  6062. Set less exhaustive search.
  6063. @end table
  6064. Default value is @samp{exhaustive}.
  6065. @item filename
  6066. If set then a detailed log of the motion search is written to the
  6067. specified file.
  6068. @end table
  6069. @section despill
  6070. Remove unwanted contamination of foreground colors, caused by reflected color of
  6071. greenscreen or bluescreen.
  6072. This filter accepts the following options:
  6073. @table @option
  6074. @item type
  6075. Set what type of despill to use.
  6076. @item mix
  6077. Set how spillmap will be generated.
  6078. @item expand
  6079. Set how much to get rid of still remaining spill.
  6080. @item red
  6081. Controls amount of red in spill area.
  6082. @item green
  6083. Controls amount of green in spill area.
  6084. Should be -1 for greenscreen.
  6085. @item blue
  6086. Controls amount of blue in spill area.
  6087. Should be -1 for bluescreen.
  6088. @item brightness
  6089. Controls brightness of spill area, preserving colors.
  6090. @item alpha
  6091. Modify alpha from generated spillmap.
  6092. @end table
  6093. @section detelecine
  6094. Apply an exact inverse of the telecine operation. It requires a predefined
  6095. pattern specified using the pattern option which must be the same as that passed
  6096. to the telecine filter.
  6097. This filter accepts the following options:
  6098. @table @option
  6099. @item first_field
  6100. @table @samp
  6101. @item top, t
  6102. top field first
  6103. @item bottom, b
  6104. bottom field first
  6105. The default value is @code{top}.
  6106. @end table
  6107. @item pattern
  6108. A string of numbers representing the pulldown pattern you wish to apply.
  6109. The default value is @code{23}.
  6110. @item start_frame
  6111. A number representing position of the first frame with respect to the telecine
  6112. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6113. @end table
  6114. @section dilation
  6115. Apply dilation effect to the video.
  6116. This filter replaces the pixel by the local(3x3) maximum.
  6117. It accepts the following options:
  6118. @table @option
  6119. @item threshold0
  6120. @item threshold1
  6121. @item threshold2
  6122. @item threshold3
  6123. Limit the maximum change for each plane, default is 65535.
  6124. If 0, plane will remain unchanged.
  6125. @item coordinates
  6126. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6127. pixels are used.
  6128. Flags to local 3x3 coordinates maps like this:
  6129. 1 2 3
  6130. 4 5
  6131. 6 7 8
  6132. @end table
  6133. @section displace
  6134. Displace pixels as indicated by second and third input stream.
  6135. It takes three input streams and outputs one stream, the first input is the
  6136. source, and second and third input are displacement maps.
  6137. The second input specifies how much to displace pixels along the
  6138. x-axis, while the third input specifies how much to displace pixels
  6139. along the y-axis.
  6140. If one of displacement map streams terminates, last frame from that
  6141. displacement map will be used.
  6142. Note that once generated, displacements maps can be reused over and over again.
  6143. A description of the accepted options follows.
  6144. @table @option
  6145. @item edge
  6146. Set displace behavior for pixels that are out of range.
  6147. Available values are:
  6148. @table @samp
  6149. @item blank
  6150. Missing pixels are replaced by black pixels.
  6151. @item smear
  6152. Adjacent pixels will spread out to replace missing pixels.
  6153. @item wrap
  6154. Out of range pixels are wrapped so they point to pixels of other side.
  6155. @item mirror
  6156. Out of range pixels will be replaced with mirrored pixels.
  6157. @end table
  6158. Default is @samp{smear}.
  6159. @end table
  6160. @subsection Examples
  6161. @itemize
  6162. @item
  6163. Add ripple effect to rgb input of video size hd720:
  6164. @example
  6165. 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
  6166. @end example
  6167. @item
  6168. Add wave effect to rgb input of video size hd720:
  6169. @example
  6170. 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
  6171. @end example
  6172. @end itemize
  6173. @section drawbox
  6174. Draw a colored box on the input image.
  6175. It accepts the following parameters:
  6176. @table @option
  6177. @item x
  6178. @item y
  6179. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6180. @item width, w
  6181. @item height, h
  6182. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6183. the input width and height. It defaults to 0.
  6184. @item color, c
  6185. Specify the color of the box to write. For the general syntax of this option,
  6186. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6187. value @code{invert} is used, the box edge color is the same as the
  6188. video with inverted luma.
  6189. @item thickness, t
  6190. The expression which sets the thickness of the box edge.
  6191. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6192. See below for the list of accepted constants.
  6193. @item replace
  6194. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6195. will overwrite the video's color and alpha pixels.
  6196. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6197. @end table
  6198. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6199. following constants:
  6200. @table @option
  6201. @item dar
  6202. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6203. @item hsub
  6204. @item vsub
  6205. horizontal and vertical chroma subsample values. For example for the
  6206. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6207. @item in_h, ih
  6208. @item in_w, iw
  6209. The input width and height.
  6210. @item sar
  6211. The input sample aspect ratio.
  6212. @item x
  6213. @item y
  6214. The x and y offset coordinates where the box is drawn.
  6215. @item w
  6216. @item h
  6217. The width and height of the drawn box.
  6218. @item t
  6219. The thickness of the drawn box.
  6220. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6221. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6222. @end table
  6223. @subsection Examples
  6224. @itemize
  6225. @item
  6226. Draw a black box around the edge of the input image:
  6227. @example
  6228. drawbox
  6229. @end example
  6230. @item
  6231. Draw a box with color red and an opacity of 50%:
  6232. @example
  6233. drawbox=10:20:200:60:red@@0.5
  6234. @end example
  6235. The previous example can be specified as:
  6236. @example
  6237. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6238. @end example
  6239. @item
  6240. Fill the box with pink color:
  6241. @example
  6242. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6243. @end example
  6244. @item
  6245. Draw a 2-pixel red 2.40:1 mask:
  6246. @example
  6247. 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
  6248. @end example
  6249. @end itemize
  6250. @section drawgrid
  6251. Draw a grid on the input image.
  6252. It accepts the following parameters:
  6253. @table @option
  6254. @item x
  6255. @item y
  6256. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6257. @item width, w
  6258. @item height, h
  6259. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6260. input width and height, respectively, minus @code{thickness}, so image gets
  6261. framed. Default to 0.
  6262. @item color, c
  6263. Specify the color of the grid. For the general syntax of this option,
  6264. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6265. value @code{invert} is used, the grid color is the same as the
  6266. video with inverted luma.
  6267. @item thickness, t
  6268. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6269. See below for the list of accepted constants.
  6270. @item replace
  6271. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6272. will overwrite the video's color and alpha pixels.
  6273. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6274. @end table
  6275. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6276. following constants:
  6277. @table @option
  6278. @item dar
  6279. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6280. @item hsub
  6281. @item vsub
  6282. horizontal and vertical chroma subsample values. For example for the
  6283. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6284. @item in_h, ih
  6285. @item in_w, iw
  6286. The input grid cell width and height.
  6287. @item sar
  6288. The input sample aspect ratio.
  6289. @item x
  6290. @item y
  6291. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6292. @item w
  6293. @item h
  6294. The width and height of the drawn cell.
  6295. @item t
  6296. The thickness of the drawn cell.
  6297. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6298. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6299. @end table
  6300. @subsection Examples
  6301. @itemize
  6302. @item
  6303. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6304. @example
  6305. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6306. @end example
  6307. @item
  6308. Draw a white 3x3 grid with an opacity of 50%:
  6309. @example
  6310. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6311. @end example
  6312. @end itemize
  6313. @anchor{drawtext}
  6314. @section drawtext
  6315. Draw a text string or text from a specified file on top of a video, using the
  6316. libfreetype library.
  6317. To enable compilation of this filter, you need to configure FFmpeg with
  6318. @code{--enable-libfreetype}.
  6319. To enable default font fallback and the @var{font} option you need to
  6320. configure FFmpeg with @code{--enable-libfontconfig}.
  6321. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6322. @code{--enable-libfribidi}.
  6323. @subsection Syntax
  6324. It accepts the following parameters:
  6325. @table @option
  6326. @item box
  6327. Used to draw a box around text using the background color.
  6328. The value must be either 1 (enable) or 0 (disable).
  6329. The default value of @var{box} is 0.
  6330. @item boxborderw
  6331. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6332. The default value of @var{boxborderw} is 0.
  6333. @item boxcolor
  6334. The color to be used for drawing box around text. For the syntax of this
  6335. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6336. The default value of @var{boxcolor} is "white".
  6337. @item line_spacing
  6338. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6339. The default value of @var{line_spacing} is 0.
  6340. @item borderw
  6341. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6342. The default value of @var{borderw} is 0.
  6343. @item bordercolor
  6344. Set the color to be used for drawing border around text. For the syntax of this
  6345. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6346. The default value of @var{bordercolor} is "black".
  6347. @item expansion
  6348. Select how the @var{text} is expanded. Can be either @code{none},
  6349. @code{strftime} (deprecated) or
  6350. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6351. below for details.
  6352. @item basetime
  6353. Set a start time for the count. Value is in microseconds. Only applied
  6354. in the deprecated strftime expansion mode. To emulate in normal expansion
  6355. mode use the @code{pts} function, supplying the start time (in seconds)
  6356. as the second argument.
  6357. @item fix_bounds
  6358. If true, check and fix text coords to avoid clipping.
  6359. @item fontcolor
  6360. The color to be used for drawing fonts. For the syntax of this option, check
  6361. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6362. The default value of @var{fontcolor} is "black".
  6363. @item fontcolor_expr
  6364. String which is expanded the same way as @var{text} to obtain dynamic
  6365. @var{fontcolor} value. By default this option has empty value and is not
  6366. processed. When this option is set, it overrides @var{fontcolor} option.
  6367. @item font
  6368. The font family to be used for drawing text. By default Sans.
  6369. @item fontfile
  6370. The font file to be used for drawing text. The path must be included.
  6371. This parameter is mandatory if the fontconfig support is disabled.
  6372. @item alpha
  6373. Draw the text applying alpha blending. The value can
  6374. be a number between 0.0 and 1.0.
  6375. The expression accepts the same variables @var{x, y} as well.
  6376. The default value is 1.
  6377. Please see @var{fontcolor_expr}.
  6378. @item fontsize
  6379. The font size to be used for drawing text.
  6380. The default value of @var{fontsize} is 16.
  6381. @item text_shaping
  6382. If set to 1, attempt to shape the text (for example, reverse the order of
  6383. right-to-left text and join Arabic characters) before drawing it.
  6384. Otherwise, just draw the text exactly as given.
  6385. By default 1 (if supported).
  6386. @item ft_load_flags
  6387. The flags to be used for loading the fonts.
  6388. The flags map the corresponding flags supported by libfreetype, and are
  6389. a combination of the following values:
  6390. @table @var
  6391. @item default
  6392. @item no_scale
  6393. @item no_hinting
  6394. @item render
  6395. @item no_bitmap
  6396. @item vertical_layout
  6397. @item force_autohint
  6398. @item crop_bitmap
  6399. @item pedantic
  6400. @item ignore_global_advance_width
  6401. @item no_recurse
  6402. @item ignore_transform
  6403. @item monochrome
  6404. @item linear_design
  6405. @item no_autohint
  6406. @end table
  6407. Default value is "default".
  6408. For more information consult the documentation for the FT_LOAD_*
  6409. libfreetype flags.
  6410. @item shadowcolor
  6411. The color to be used for drawing a shadow behind the drawn text. For the
  6412. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6413. ffmpeg-utils manual,ffmpeg-utils}.
  6414. The default value of @var{shadowcolor} is "black".
  6415. @item shadowx
  6416. @item shadowy
  6417. The x and y offsets for the text shadow position with respect to the
  6418. position of the text. They can be either positive or negative
  6419. values. The default value for both is "0".
  6420. @item start_number
  6421. The starting frame number for the n/frame_num variable. The default value
  6422. is "0".
  6423. @item tabsize
  6424. The size in number of spaces to use for rendering the tab.
  6425. Default value is 4.
  6426. @item timecode
  6427. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6428. format. It can be used with or without text parameter. @var{timecode_rate}
  6429. option must be specified.
  6430. @item timecode_rate, rate, r
  6431. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6432. integer. Minimum value is "1".
  6433. Drop-frame timecode is supported for frame rates 30 & 60.
  6434. @item tc24hmax
  6435. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6436. Default is 0 (disabled).
  6437. @item text
  6438. The text string to be drawn. The text must be a sequence of UTF-8
  6439. encoded characters.
  6440. This parameter is mandatory if no file is specified with the parameter
  6441. @var{textfile}.
  6442. @item textfile
  6443. A text file containing text to be drawn. The text must be a sequence
  6444. of UTF-8 encoded characters.
  6445. This parameter is mandatory if no text string is specified with the
  6446. parameter @var{text}.
  6447. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6448. @item reload
  6449. If set to 1, the @var{textfile} will be reloaded before each frame.
  6450. Be sure to update it atomically, or it may be read partially, or even fail.
  6451. @item x
  6452. @item y
  6453. The expressions which specify the offsets where text will be drawn
  6454. within the video frame. They are relative to the top/left border of the
  6455. output image.
  6456. The default value of @var{x} and @var{y} is "0".
  6457. See below for the list of accepted constants and functions.
  6458. @end table
  6459. The parameters for @var{x} and @var{y} are expressions containing the
  6460. following constants and functions:
  6461. @table @option
  6462. @item dar
  6463. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6464. @item hsub
  6465. @item vsub
  6466. horizontal and vertical chroma subsample values. For example for the
  6467. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6468. @item line_h, lh
  6469. the height of each text line
  6470. @item main_h, h, H
  6471. the input height
  6472. @item main_w, w, W
  6473. the input width
  6474. @item max_glyph_a, ascent
  6475. the maximum distance from the baseline to the highest/upper grid
  6476. coordinate used to place a glyph outline point, for all the rendered
  6477. glyphs.
  6478. It is a positive value, due to the grid's orientation with the Y axis
  6479. upwards.
  6480. @item max_glyph_d, descent
  6481. the maximum distance from the baseline to the lowest grid coordinate
  6482. used to place a glyph outline point, for all the rendered glyphs.
  6483. This is a negative value, due to the grid's orientation, with the Y axis
  6484. upwards.
  6485. @item max_glyph_h
  6486. maximum glyph height, that is the maximum height for all the glyphs
  6487. contained in the rendered text, it is equivalent to @var{ascent} -
  6488. @var{descent}.
  6489. @item max_glyph_w
  6490. maximum glyph width, that is the maximum width for all the glyphs
  6491. contained in the rendered text
  6492. @item n
  6493. the number of input frame, starting from 0
  6494. @item rand(min, max)
  6495. return a random number included between @var{min} and @var{max}
  6496. @item sar
  6497. The input sample aspect ratio.
  6498. @item t
  6499. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6500. @item text_h, th
  6501. the height of the rendered text
  6502. @item text_w, tw
  6503. the width of the rendered text
  6504. @item x
  6505. @item y
  6506. the x and y offset coordinates where the text is drawn.
  6507. These parameters allow the @var{x} and @var{y} expressions to refer
  6508. each other, so you can for example specify @code{y=x/dar}.
  6509. @end table
  6510. @anchor{drawtext_expansion}
  6511. @subsection Text expansion
  6512. If @option{expansion} is set to @code{strftime},
  6513. the filter recognizes strftime() sequences in the provided text and
  6514. expands them accordingly. Check the documentation of strftime(). This
  6515. feature is deprecated.
  6516. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6517. If @option{expansion} is set to @code{normal} (which is the default),
  6518. the following expansion mechanism is used.
  6519. The backslash character @samp{\}, followed by any character, always expands to
  6520. the second character.
  6521. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6522. braces is a function name, possibly followed by arguments separated by ':'.
  6523. If the arguments contain special characters or delimiters (':' or '@}'),
  6524. they should be escaped.
  6525. Note that they probably must also be escaped as the value for the
  6526. @option{text} option in the filter argument string and as the filter
  6527. argument in the filtergraph description, and possibly also for the shell,
  6528. that makes up to four levels of escaping; using a text file avoids these
  6529. problems.
  6530. The following functions are available:
  6531. @table @command
  6532. @item expr, e
  6533. The expression evaluation result.
  6534. It must take one argument specifying the expression to be evaluated,
  6535. which accepts the same constants and functions as the @var{x} and
  6536. @var{y} values. Note that not all constants should be used, for
  6537. example the text size is not known when evaluating the expression, so
  6538. the constants @var{text_w} and @var{text_h} will have an undefined
  6539. value.
  6540. @item expr_int_format, eif
  6541. Evaluate the expression's value and output as formatted integer.
  6542. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6543. The second argument specifies the output format. Allowed values are @samp{x},
  6544. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6545. @code{printf} function.
  6546. The third parameter is optional and sets the number of positions taken by the output.
  6547. It can be used to add padding with zeros from the left.
  6548. @item gmtime
  6549. The time at which the filter is running, expressed in UTC.
  6550. It can accept an argument: a strftime() format string.
  6551. @item localtime
  6552. The time at which the filter is running, expressed in the local time zone.
  6553. It can accept an argument: a strftime() format string.
  6554. @item metadata
  6555. Frame metadata. Takes one or two arguments.
  6556. The first argument is mandatory and specifies the metadata key.
  6557. The second argument is optional and specifies a default value, used when the
  6558. metadata key is not found or empty.
  6559. @item n, frame_num
  6560. The frame number, starting from 0.
  6561. @item pict_type
  6562. A 1 character description of the current picture type.
  6563. @item pts
  6564. The timestamp of the current frame.
  6565. It can take up to three arguments.
  6566. The first argument is the format of the timestamp; it defaults to @code{flt}
  6567. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6568. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6569. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6570. @code{localtime} stands for the timestamp of the frame formatted as
  6571. local time zone time.
  6572. The second argument is an offset added to the timestamp.
  6573. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6574. supplied to present the hour part of the formatted timestamp in 24h format
  6575. (00-23).
  6576. If the format is set to @code{localtime} or @code{gmtime},
  6577. a third argument may be supplied: a strftime() format string.
  6578. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6579. @end table
  6580. @subsection Examples
  6581. @itemize
  6582. @item
  6583. Draw "Test Text" with font FreeSerif, using the default values for the
  6584. optional parameters.
  6585. @example
  6586. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6587. @end example
  6588. @item
  6589. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6590. and y=50 (counting from the top-left corner of the screen), text is
  6591. yellow with a red box around it. Both the text and the box have an
  6592. opacity of 20%.
  6593. @example
  6594. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6595. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6596. @end example
  6597. Note that the double quotes are not necessary if spaces are not used
  6598. within the parameter list.
  6599. @item
  6600. Show the text at the center of the video frame:
  6601. @example
  6602. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6603. @end example
  6604. @item
  6605. Show the text at a random position, switching to a new position every 30 seconds:
  6606. @example
  6607. 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)"
  6608. @end example
  6609. @item
  6610. Show a text line sliding from right to left in the last row of the video
  6611. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6612. with no newlines.
  6613. @example
  6614. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6615. @end example
  6616. @item
  6617. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6618. @example
  6619. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6620. @end example
  6621. @item
  6622. Draw a single green letter "g", at the center of the input video.
  6623. The glyph baseline is placed at half screen height.
  6624. @example
  6625. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6626. @end example
  6627. @item
  6628. Show text for 1 second every 3 seconds:
  6629. @example
  6630. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6631. @end example
  6632. @item
  6633. Use fontconfig to set the font. Note that the colons need to be escaped.
  6634. @example
  6635. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6636. @end example
  6637. @item
  6638. Print the date of a real-time encoding (see strftime(3)):
  6639. @example
  6640. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6641. @end example
  6642. @item
  6643. Show text fading in and out (appearing/disappearing):
  6644. @example
  6645. #!/bin/sh
  6646. DS=1.0 # display start
  6647. DE=10.0 # display end
  6648. FID=1.5 # fade in duration
  6649. FOD=5 # fade out duration
  6650. 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 @}"
  6651. @end example
  6652. @item
  6653. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6654. and the @option{fontsize} value are included in the @option{y} offset.
  6655. @example
  6656. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6657. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6658. @end example
  6659. @end itemize
  6660. For more information about libfreetype, check:
  6661. @url{http://www.freetype.org/}.
  6662. For more information about fontconfig, check:
  6663. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6664. For more information about libfribidi, check:
  6665. @url{http://fribidi.org/}.
  6666. @section edgedetect
  6667. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6668. The filter accepts the following options:
  6669. @table @option
  6670. @item low
  6671. @item high
  6672. Set low and high threshold values used by the Canny thresholding
  6673. algorithm.
  6674. The high threshold selects the "strong" edge pixels, which are then
  6675. connected through 8-connectivity with the "weak" edge pixels selected
  6676. by the low threshold.
  6677. @var{low} and @var{high} threshold values must be chosen in the range
  6678. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6679. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6680. is @code{50/255}.
  6681. @item mode
  6682. Define the drawing mode.
  6683. @table @samp
  6684. @item wires
  6685. Draw white/gray wires on black background.
  6686. @item colormix
  6687. Mix the colors to create a paint/cartoon effect.
  6688. @item canny
  6689. Apply Canny edge detector on all selected planes.
  6690. @end table
  6691. Default value is @var{wires}.
  6692. @item planes
  6693. Select planes for filtering. By default all available planes are filtered.
  6694. @end table
  6695. @subsection Examples
  6696. @itemize
  6697. @item
  6698. Standard edge detection with custom values for the hysteresis thresholding:
  6699. @example
  6700. edgedetect=low=0.1:high=0.4
  6701. @end example
  6702. @item
  6703. Painting effect without thresholding:
  6704. @example
  6705. edgedetect=mode=colormix:high=0
  6706. @end example
  6707. @end itemize
  6708. @section eq
  6709. Set brightness, contrast, saturation and approximate gamma adjustment.
  6710. The filter accepts the following options:
  6711. @table @option
  6712. @item contrast
  6713. Set the contrast expression. The value must be a float value in range
  6714. @code{-2.0} to @code{2.0}. The default value is "1".
  6715. @item brightness
  6716. Set the brightness expression. The value must be a float value in
  6717. range @code{-1.0} to @code{1.0}. The default value is "0".
  6718. @item saturation
  6719. Set the saturation expression. The value must be a float in
  6720. range @code{0.0} to @code{3.0}. The default value is "1".
  6721. @item gamma
  6722. Set the gamma expression. The value must be a float in range
  6723. @code{0.1} to @code{10.0}. The default value is "1".
  6724. @item gamma_r
  6725. Set the gamma expression for red. The value must be a float in
  6726. range @code{0.1} to @code{10.0}. The default value is "1".
  6727. @item gamma_g
  6728. Set the gamma expression for green. The value must be a float in range
  6729. @code{0.1} to @code{10.0}. The default value is "1".
  6730. @item gamma_b
  6731. Set the gamma expression for blue. The value must be a float in range
  6732. @code{0.1} to @code{10.0}. The default value is "1".
  6733. @item gamma_weight
  6734. Set the gamma weight expression. It can be used to reduce the effect
  6735. of a high gamma value on bright image areas, e.g. keep them from
  6736. getting overamplified and just plain white. The value must be a float
  6737. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6738. gamma correction all the way down while @code{1.0} leaves it at its
  6739. full strength. Default is "1".
  6740. @item eval
  6741. Set when the expressions for brightness, contrast, saturation and
  6742. gamma expressions are evaluated.
  6743. It accepts the following values:
  6744. @table @samp
  6745. @item init
  6746. only evaluate expressions once during the filter initialization or
  6747. when a command is processed
  6748. @item frame
  6749. evaluate expressions for each incoming frame
  6750. @end table
  6751. Default value is @samp{init}.
  6752. @end table
  6753. The expressions accept the following parameters:
  6754. @table @option
  6755. @item n
  6756. frame count of the input frame starting from 0
  6757. @item pos
  6758. byte position of the corresponding packet in the input file, NAN if
  6759. unspecified
  6760. @item r
  6761. frame rate of the input video, NAN if the input frame rate is unknown
  6762. @item t
  6763. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6764. @end table
  6765. @subsection Commands
  6766. The filter supports the following commands:
  6767. @table @option
  6768. @item contrast
  6769. Set the contrast expression.
  6770. @item brightness
  6771. Set the brightness expression.
  6772. @item saturation
  6773. Set the saturation expression.
  6774. @item gamma
  6775. Set the gamma expression.
  6776. @item gamma_r
  6777. Set the gamma_r expression.
  6778. @item gamma_g
  6779. Set gamma_g expression.
  6780. @item gamma_b
  6781. Set gamma_b expression.
  6782. @item gamma_weight
  6783. Set gamma_weight expression.
  6784. The command accepts the same syntax of the corresponding option.
  6785. If the specified expression is not valid, it is kept at its current
  6786. value.
  6787. @end table
  6788. @section erosion
  6789. Apply erosion effect to the video.
  6790. This filter replaces the pixel by the local(3x3) minimum.
  6791. It accepts the following options:
  6792. @table @option
  6793. @item threshold0
  6794. @item threshold1
  6795. @item threshold2
  6796. @item threshold3
  6797. Limit the maximum change for each plane, default is 65535.
  6798. If 0, plane will remain unchanged.
  6799. @item coordinates
  6800. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6801. pixels are used.
  6802. Flags to local 3x3 coordinates maps like this:
  6803. 1 2 3
  6804. 4 5
  6805. 6 7 8
  6806. @end table
  6807. @section extractplanes
  6808. Extract color channel components from input video stream into
  6809. separate grayscale video streams.
  6810. The filter accepts the following option:
  6811. @table @option
  6812. @item planes
  6813. Set plane(s) to extract.
  6814. Available values for planes are:
  6815. @table @samp
  6816. @item y
  6817. @item u
  6818. @item v
  6819. @item a
  6820. @item r
  6821. @item g
  6822. @item b
  6823. @end table
  6824. Choosing planes not available in the input will result in an error.
  6825. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6826. with @code{y}, @code{u}, @code{v} planes at same time.
  6827. @end table
  6828. @subsection Examples
  6829. @itemize
  6830. @item
  6831. Extract luma, u and v color channel component from input video frame
  6832. into 3 grayscale outputs:
  6833. @example
  6834. 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
  6835. @end example
  6836. @end itemize
  6837. @section elbg
  6838. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6839. For each input image, the filter will compute the optimal mapping from
  6840. the input to the output given the codebook length, that is the number
  6841. of distinct output colors.
  6842. This filter accepts the following options.
  6843. @table @option
  6844. @item codebook_length, l
  6845. Set codebook length. The value must be a positive integer, and
  6846. represents the number of distinct output colors. Default value is 256.
  6847. @item nb_steps, n
  6848. Set the maximum number of iterations to apply for computing the optimal
  6849. mapping. The higher the value the better the result and the higher the
  6850. computation time. Default value is 1.
  6851. @item seed, s
  6852. Set a random seed, must be an integer included between 0 and
  6853. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6854. will try to use a good random seed on a best effort basis.
  6855. @item pal8
  6856. Set pal8 output pixel format. This option does not work with codebook
  6857. length greater than 256.
  6858. @end table
  6859. @section entropy
  6860. Measure graylevel entropy in histogram of color channels of video frames.
  6861. It accepts the following parameters:
  6862. @table @option
  6863. @item mode
  6864. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6865. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6866. between neighbour histogram values.
  6867. @end table
  6868. @section fade
  6869. Apply a fade-in/out effect to the input video.
  6870. It accepts the following parameters:
  6871. @table @option
  6872. @item type, t
  6873. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6874. effect.
  6875. Default is @code{in}.
  6876. @item start_frame, s
  6877. Specify the number of the frame to start applying the fade
  6878. effect at. Default is 0.
  6879. @item nb_frames, n
  6880. The number of frames that the fade effect lasts. At the end of the
  6881. fade-in effect, the output video will have the same intensity as the input video.
  6882. At the end of the fade-out transition, the output video will be filled with the
  6883. selected @option{color}.
  6884. Default is 25.
  6885. @item alpha
  6886. If set to 1, fade only alpha channel, if one exists on the input.
  6887. Default value is 0.
  6888. @item start_time, st
  6889. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6890. effect. If both start_frame and start_time are specified, the fade will start at
  6891. whichever comes last. Default is 0.
  6892. @item duration, d
  6893. The number of seconds for which the fade effect has to last. At the end of the
  6894. fade-in effect the output video will have the same intensity as the input video,
  6895. at the end of the fade-out transition the output video will be filled with the
  6896. selected @option{color}.
  6897. If both duration and nb_frames are specified, duration is used. Default is 0
  6898. (nb_frames is used by default).
  6899. @item color, c
  6900. Specify the color of the fade. Default is "black".
  6901. @end table
  6902. @subsection Examples
  6903. @itemize
  6904. @item
  6905. Fade in the first 30 frames of video:
  6906. @example
  6907. fade=in:0:30
  6908. @end example
  6909. The command above is equivalent to:
  6910. @example
  6911. fade=t=in:s=0:n=30
  6912. @end example
  6913. @item
  6914. Fade out the last 45 frames of a 200-frame video:
  6915. @example
  6916. fade=out:155:45
  6917. fade=type=out:start_frame=155:nb_frames=45
  6918. @end example
  6919. @item
  6920. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6921. @example
  6922. fade=in:0:25, fade=out:975:25
  6923. @end example
  6924. @item
  6925. Make the first 5 frames yellow, then fade in from frame 5-24:
  6926. @example
  6927. fade=in:5:20:color=yellow
  6928. @end example
  6929. @item
  6930. Fade in alpha over first 25 frames of video:
  6931. @example
  6932. fade=in:0:25:alpha=1
  6933. @end example
  6934. @item
  6935. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6936. @example
  6937. fade=t=in:st=5.5:d=0.5
  6938. @end example
  6939. @end itemize
  6940. @section fftfilt
  6941. Apply arbitrary expressions to samples in frequency domain
  6942. @table @option
  6943. @item dc_Y
  6944. Adjust the dc value (gain) of the luma plane of the image. The filter
  6945. accepts an integer value in range @code{0} to @code{1000}. The default
  6946. value is set to @code{0}.
  6947. @item dc_U
  6948. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6949. filter accepts an integer value in range @code{0} to @code{1000}. The
  6950. default value is set to @code{0}.
  6951. @item dc_V
  6952. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6953. filter accepts an integer value in range @code{0} to @code{1000}. The
  6954. default value is set to @code{0}.
  6955. @item weight_Y
  6956. Set the frequency domain weight expression for the luma plane.
  6957. @item weight_U
  6958. Set the frequency domain weight expression for the 1st chroma plane.
  6959. @item weight_V
  6960. Set the frequency domain weight expression for the 2nd chroma plane.
  6961. @item eval
  6962. Set when the expressions are evaluated.
  6963. It accepts the following values:
  6964. @table @samp
  6965. @item init
  6966. Only evaluate expressions once during the filter initialization.
  6967. @item frame
  6968. Evaluate expressions for each incoming frame.
  6969. @end table
  6970. Default value is @samp{init}.
  6971. The filter accepts the following variables:
  6972. @item X
  6973. @item Y
  6974. The coordinates of the current sample.
  6975. @item W
  6976. @item H
  6977. The width and height of the image.
  6978. @item N
  6979. The number of input frame, starting from 0.
  6980. @end table
  6981. @subsection Examples
  6982. @itemize
  6983. @item
  6984. High-pass:
  6985. @example
  6986. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6987. @end example
  6988. @item
  6989. Low-pass:
  6990. @example
  6991. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6992. @end example
  6993. @item
  6994. Sharpen:
  6995. @example
  6996. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6997. @end example
  6998. @item
  6999. Blur:
  7000. @example
  7001. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7002. @end example
  7003. @end itemize
  7004. @section fftdnoiz
  7005. Denoise frames using 3D FFT (frequency domain filtering).
  7006. The filter accepts the following options:
  7007. @table @option
  7008. @item sigma
  7009. Set the noise sigma constant. This sets denoising strength.
  7010. Default value is 1. Allowed range is from 0 to 30.
  7011. Using very high sigma with low overlap may give blocking artifacts.
  7012. @item amount
  7013. Set amount of denoising. By default all detected noise is reduced.
  7014. Default value is 1. Allowed range is from 0 to 1.
  7015. @item block
  7016. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7017. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7018. block size in pixels is 2^4 which is 16.
  7019. @item overlap
  7020. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7021. @item prev
  7022. Set number of previous frames to use for denoising. By default is set to 0.
  7023. @item next
  7024. Set number of next frames to to use for denoising. By default is set to 0.
  7025. @item planes
  7026. Set planes which will be filtered, by default are all available filtered
  7027. except alpha.
  7028. @end table
  7029. @section field
  7030. Extract a single field from an interlaced image using stride
  7031. arithmetic to avoid wasting CPU time. The output frames are marked as
  7032. non-interlaced.
  7033. The filter accepts the following options:
  7034. @table @option
  7035. @item type
  7036. Specify whether to extract the top (if the value is @code{0} or
  7037. @code{top}) or the bottom field (if the value is @code{1} or
  7038. @code{bottom}).
  7039. @end table
  7040. @section fieldhint
  7041. Create new frames by copying the top and bottom fields from surrounding frames
  7042. supplied as numbers by the hint file.
  7043. @table @option
  7044. @item hint
  7045. Set file containing hints: absolute/relative frame numbers.
  7046. There must be one line for each frame in a clip. Each line must contain two
  7047. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7048. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7049. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7050. for @code{relative} mode. First number tells from which frame to pick up top
  7051. field and second number tells from which frame to pick up bottom field.
  7052. If optionally followed by @code{+} output frame will be marked as interlaced,
  7053. else if followed by @code{-} output frame will be marked as progressive, else
  7054. it will be marked same as input frame.
  7055. If line starts with @code{#} or @code{;} that line is skipped.
  7056. @item mode
  7057. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7058. @end table
  7059. Example of first several lines of @code{hint} file for @code{relative} mode:
  7060. @example
  7061. 0,0 - # first frame
  7062. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7063. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7064. 1,0 -
  7065. 0,0 -
  7066. 0,0 -
  7067. 1,0 -
  7068. 1,0 -
  7069. 1,0 -
  7070. 0,0 -
  7071. 0,0 -
  7072. 1,0 -
  7073. 1,0 -
  7074. 1,0 -
  7075. 0,0 -
  7076. @end example
  7077. @section fieldmatch
  7078. Field matching filter for inverse telecine. It is meant to reconstruct the
  7079. progressive frames from a telecined stream. The filter does not drop duplicated
  7080. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7081. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7082. The separation of the field matching and the decimation is notably motivated by
  7083. the possibility of inserting a de-interlacing filter fallback between the two.
  7084. If the source has mixed telecined and real interlaced content,
  7085. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7086. But these remaining combed frames will be marked as interlaced, and thus can be
  7087. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7088. In addition to the various configuration options, @code{fieldmatch} can take an
  7089. optional second stream, activated through the @option{ppsrc} option. If
  7090. enabled, the frames reconstruction will be based on the fields and frames from
  7091. this second stream. This allows the first input to be pre-processed in order to
  7092. help the various algorithms of the filter, while keeping the output lossless
  7093. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7094. or brightness/contrast adjustments can help.
  7095. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7096. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7097. which @code{fieldmatch} is based on. While the semantic and usage are very
  7098. close, some behaviour and options names can differ.
  7099. The @ref{decimate} filter currently only works for constant frame rate input.
  7100. If your input has mixed telecined (30fps) and progressive content with a lower
  7101. framerate like 24fps use the following filterchain to produce the necessary cfr
  7102. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7103. The filter accepts the following options:
  7104. @table @option
  7105. @item order
  7106. Specify the assumed field order of the input stream. Available values are:
  7107. @table @samp
  7108. @item auto
  7109. Auto detect parity (use FFmpeg's internal parity value).
  7110. @item bff
  7111. Assume bottom field first.
  7112. @item tff
  7113. Assume top field first.
  7114. @end table
  7115. Note that it is sometimes recommended not to trust the parity announced by the
  7116. stream.
  7117. Default value is @var{auto}.
  7118. @item mode
  7119. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7120. sense that it won't risk creating jerkiness due to duplicate frames when
  7121. possible, but if there are bad edits or blended fields it will end up
  7122. outputting combed frames when a good match might actually exist. On the other
  7123. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7124. but will almost always find a good frame if there is one. The other values are
  7125. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7126. jerkiness and creating duplicate frames versus finding good matches in sections
  7127. with bad edits, orphaned fields, blended fields, etc.
  7128. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7129. Available values are:
  7130. @table @samp
  7131. @item pc
  7132. 2-way matching (p/c)
  7133. @item pc_n
  7134. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7135. @item pc_u
  7136. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7137. @item pc_n_ub
  7138. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7139. still combed (p/c + n + u/b)
  7140. @item pcn
  7141. 3-way matching (p/c/n)
  7142. @item pcn_ub
  7143. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7144. detected as combed (p/c/n + u/b)
  7145. @end table
  7146. The parenthesis at the end indicate the matches that would be used for that
  7147. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7148. @var{top}).
  7149. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7150. the slowest.
  7151. Default value is @var{pc_n}.
  7152. @item ppsrc
  7153. Mark the main input stream as a pre-processed input, and enable the secondary
  7154. input stream as the clean source to pick the fields from. See the filter
  7155. introduction for more details. It is similar to the @option{clip2} feature from
  7156. VFM/TFM.
  7157. Default value is @code{0} (disabled).
  7158. @item field
  7159. Set the field to match from. It is recommended to set this to the same value as
  7160. @option{order} unless you experience matching failures with that setting. In
  7161. certain circumstances changing the field that is used to match from can have a
  7162. large impact on matching performance. Available values are:
  7163. @table @samp
  7164. @item auto
  7165. Automatic (same value as @option{order}).
  7166. @item bottom
  7167. Match from the bottom field.
  7168. @item top
  7169. Match from the top field.
  7170. @end table
  7171. Default value is @var{auto}.
  7172. @item mchroma
  7173. Set whether or not chroma is included during the match comparisons. In most
  7174. cases it is recommended to leave this enabled. You should set this to @code{0}
  7175. only if your clip has bad chroma problems such as heavy rainbowing or other
  7176. artifacts. Setting this to @code{0} could also be used to speed things up at
  7177. the cost of some accuracy.
  7178. Default value is @code{1}.
  7179. @item y0
  7180. @item y1
  7181. These define an exclusion band which excludes the lines between @option{y0} and
  7182. @option{y1} from being included in the field matching decision. An exclusion
  7183. band can be used to ignore subtitles, a logo, or other things that may
  7184. interfere with the matching. @option{y0} sets the starting scan line and
  7185. @option{y1} sets the ending line; all lines in between @option{y0} and
  7186. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7187. @option{y0} and @option{y1} to the same value will disable the feature.
  7188. @option{y0} and @option{y1} defaults to @code{0}.
  7189. @item scthresh
  7190. Set the scene change detection threshold as a percentage of maximum change on
  7191. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7192. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7193. @option{scthresh} is @code{[0.0, 100.0]}.
  7194. Default value is @code{12.0}.
  7195. @item combmatch
  7196. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7197. account the combed scores of matches when deciding what match to use as the
  7198. final match. Available values are:
  7199. @table @samp
  7200. @item none
  7201. No final matching based on combed scores.
  7202. @item sc
  7203. Combed scores are only used when a scene change is detected.
  7204. @item full
  7205. Use combed scores all the time.
  7206. @end table
  7207. Default is @var{sc}.
  7208. @item combdbg
  7209. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7210. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7211. Available values are:
  7212. @table @samp
  7213. @item none
  7214. No forced calculation.
  7215. @item pcn
  7216. Force p/c/n calculations.
  7217. @item pcnub
  7218. Force p/c/n/u/b calculations.
  7219. @end table
  7220. Default value is @var{none}.
  7221. @item cthresh
  7222. This is the area combing threshold used for combed frame detection. This
  7223. essentially controls how "strong" or "visible" combing must be to be detected.
  7224. Larger values mean combing must be more visible and smaller values mean combing
  7225. can be less visible or strong and still be detected. Valid settings are from
  7226. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7227. be detected as combed). This is basically a pixel difference value. A good
  7228. range is @code{[8, 12]}.
  7229. Default value is @code{9}.
  7230. @item chroma
  7231. Sets whether or not chroma is considered in the combed frame decision. Only
  7232. disable this if your source has chroma problems (rainbowing, etc.) that are
  7233. causing problems for the combed frame detection with chroma enabled. Actually,
  7234. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7235. where there is chroma only combing in the source.
  7236. Default value is @code{0}.
  7237. @item blockx
  7238. @item blocky
  7239. Respectively set the x-axis and y-axis size of the window used during combed
  7240. frame detection. This has to do with the size of the area in which
  7241. @option{combpel} pixels are required to be detected as combed for a frame to be
  7242. declared combed. See the @option{combpel} parameter description for more info.
  7243. Possible values are any number that is a power of 2 starting at 4 and going up
  7244. to 512.
  7245. Default value is @code{16}.
  7246. @item combpel
  7247. The number of combed pixels inside any of the @option{blocky} by
  7248. @option{blockx} size blocks on the frame for the frame to be detected as
  7249. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7250. setting controls "how much" combing there must be in any localized area (a
  7251. window defined by the @option{blockx} and @option{blocky} settings) on the
  7252. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7253. which point no frames will ever be detected as combed). This setting is known
  7254. as @option{MI} in TFM/VFM vocabulary.
  7255. Default value is @code{80}.
  7256. @end table
  7257. @anchor{p/c/n/u/b meaning}
  7258. @subsection p/c/n/u/b meaning
  7259. @subsubsection p/c/n
  7260. We assume the following telecined stream:
  7261. @example
  7262. Top fields: 1 2 2 3 4
  7263. Bottom fields: 1 2 3 4 4
  7264. @end example
  7265. The numbers correspond to the progressive frame the fields relate to. Here, the
  7266. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7267. When @code{fieldmatch} is configured to run a matching from bottom
  7268. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7269. @example
  7270. Input stream:
  7271. T 1 2 2 3 4
  7272. B 1 2 3 4 4 <-- matching reference
  7273. Matches: c c n n c
  7274. Output stream:
  7275. T 1 2 3 4 4
  7276. B 1 2 3 4 4
  7277. @end example
  7278. As a result of the field matching, we can see that some frames get duplicated.
  7279. To perform a complete inverse telecine, you need to rely on a decimation filter
  7280. after this operation. See for instance the @ref{decimate} filter.
  7281. The same operation now matching from top fields (@option{field}=@var{top})
  7282. looks like this:
  7283. @example
  7284. Input stream:
  7285. T 1 2 2 3 4 <-- matching reference
  7286. B 1 2 3 4 4
  7287. Matches: c c p p c
  7288. Output stream:
  7289. T 1 2 2 3 4
  7290. B 1 2 2 3 4
  7291. @end example
  7292. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7293. basically, they refer to the frame and field of the opposite parity:
  7294. @itemize
  7295. @item @var{p} matches the field of the opposite parity in the previous frame
  7296. @item @var{c} matches the field of the opposite parity in the current frame
  7297. @item @var{n} matches the field of the opposite parity in the next frame
  7298. @end itemize
  7299. @subsubsection u/b
  7300. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7301. from the opposite parity flag. In the following examples, we assume that we are
  7302. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7303. 'x' is placed above and below each matched fields.
  7304. With bottom matching (@option{field}=@var{bottom}):
  7305. @example
  7306. Match: c p n b u
  7307. x x x x x
  7308. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7309. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7310. x x x x x
  7311. Output frames:
  7312. 2 1 2 2 2
  7313. 2 2 2 1 3
  7314. @end example
  7315. With top matching (@option{field}=@var{top}):
  7316. @example
  7317. Match: c p n b u
  7318. x x x x x
  7319. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7320. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7321. x x x x x
  7322. Output frames:
  7323. 2 2 2 1 2
  7324. 2 1 3 2 2
  7325. @end example
  7326. @subsection Examples
  7327. Simple IVTC of a top field first telecined stream:
  7328. @example
  7329. fieldmatch=order=tff:combmatch=none, decimate
  7330. @end example
  7331. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7332. @example
  7333. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7334. @end example
  7335. @section fieldorder
  7336. Transform the field order of the input video.
  7337. It accepts the following parameters:
  7338. @table @option
  7339. @item order
  7340. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7341. for bottom field first.
  7342. @end table
  7343. The default value is @samp{tff}.
  7344. The transformation is done by shifting the picture content up or down
  7345. by one line, and filling the remaining line with appropriate picture content.
  7346. This method is consistent with most broadcast field order converters.
  7347. If the input video is not flagged as being interlaced, or it is already
  7348. flagged as being of the required output field order, then this filter does
  7349. not alter the incoming video.
  7350. It is very useful when converting to or from PAL DV material,
  7351. which is bottom field first.
  7352. For example:
  7353. @example
  7354. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7355. @end example
  7356. @section fifo, afifo
  7357. Buffer input images and send them when they are requested.
  7358. It is mainly useful when auto-inserted by the libavfilter
  7359. framework.
  7360. It does not take parameters.
  7361. @section fillborders
  7362. Fill borders of the input video, without changing video stream dimensions.
  7363. Sometimes video can have garbage at the four edges and you may not want to
  7364. crop video input to keep size multiple of some number.
  7365. This filter accepts the following options:
  7366. @table @option
  7367. @item left
  7368. Number of pixels to fill from left border.
  7369. @item right
  7370. Number of pixels to fill from right border.
  7371. @item top
  7372. Number of pixels to fill from top border.
  7373. @item bottom
  7374. Number of pixels to fill from bottom border.
  7375. @item mode
  7376. Set fill mode.
  7377. It accepts the following values:
  7378. @table @samp
  7379. @item smear
  7380. fill pixels using outermost pixels
  7381. @item mirror
  7382. fill pixels using mirroring
  7383. @item fixed
  7384. fill pixels with constant value
  7385. @end table
  7386. Default is @var{smear}.
  7387. @item color
  7388. Set color for pixels in fixed mode. Default is @var{black}.
  7389. @end table
  7390. @section find_rect
  7391. Find a rectangular object
  7392. It accepts the following options:
  7393. @table @option
  7394. @item object
  7395. Filepath of the object image, needs to be in gray8.
  7396. @item threshold
  7397. Detection threshold, default is 0.5.
  7398. @item mipmaps
  7399. Number of mipmaps, default is 3.
  7400. @item xmin, ymin, xmax, ymax
  7401. Specifies the rectangle in which to search.
  7402. @end table
  7403. @subsection Examples
  7404. @itemize
  7405. @item
  7406. Generate a representative palette of a given video using @command{ffmpeg}:
  7407. @example
  7408. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7409. @end example
  7410. @end itemize
  7411. @section cover_rect
  7412. Cover a rectangular object
  7413. It accepts the following options:
  7414. @table @option
  7415. @item cover
  7416. Filepath of the optional cover image, needs to be in yuv420.
  7417. @item mode
  7418. Set covering mode.
  7419. It accepts the following values:
  7420. @table @samp
  7421. @item cover
  7422. cover it by the supplied image
  7423. @item blur
  7424. cover it by interpolating the surrounding pixels
  7425. @end table
  7426. Default value is @var{blur}.
  7427. @end table
  7428. @subsection Examples
  7429. @itemize
  7430. @item
  7431. Generate a representative palette of a given video using @command{ffmpeg}:
  7432. @example
  7433. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7434. @end example
  7435. @end itemize
  7436. @section floodfill
  7437. Flood area with values of same pixel components with another values.
  7438. It accepts the following options:
  7439. @table @option
  7440. @item x
  7441. Set pixel x coordinate.
  7442. @item y
  7443. Set pixel y coordinate.
  7444. @item s0
  7445. Set source #0 component value.
  7446. @item s1
  7447. Set source #1 component value.
  7448. @item s2
  7449. Set source #2 component value.
  7450. @item s3
  7451. Set source #3 component value.
  7452. @item d0
  7453. Set destination #0 component value.
  7454. @item d1
  7455. Set destination #1 component value.
  7456. @item d2
  7457. Set destination #2 component value.
  7458. @item d3
  7459. Set destination #3 component value.
  7460. @end table
  7461. @anchor{format}
  7462. @section format
  7463. Convert the input video to one of the specified pixel formats.
  7464. Libavfilter will try to pick one that is suitable as input to
  7465. the next filter.
  7466. It accepts the following parameters:
  7467. @table @option
  7468. @item pix_fmts
  7469. A '|'-separated list of pixel format names, such as
  7470. "pix_fmts=yuv420p|monow|rgb24".
  7471. @end table
  7472. @subsection Examples
  7473. @itemize
  7474. @item
  7475. Convert the input video to the @var{yuv420p} format
  7476. @example
  7477. format=pix_fmts=yuv420p
  7478. @end example
  7479. Convert the input video to any of the formats in the list
  7480. @example
  7481. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7482. @end example
  7483. @end itemize
  7484. @anchor{fps}
  7485. @section fps
  7486. Convert the video to specified constant frame rate by duplicating or dropping
  7487. frames as necessary.
  7488. It accepts the following parameters:
  7489. @table @option
  7490. @item fps
  7491. The desired output frame rate. The default is @code{25}.
  7492. @item start_time
  7493. Assume the first PTS should be the given value, in seconds. This allows for
  7494. padding/trimming at the start of stream. By default, no assumption is made
  7495. about the first frame's expected PTS, so no padding or trimming is done.
  7496. For example, this could be set to 0 to pad the beginning with duplicates of
  7497. the first frame if a video stream starts after the audio stream or to trim any
  7498. frames with a negative PTS.
  7499. @item round
  7500. Timestamp (PTS) rounding method.
  7501. Possible values are:
  7502. @table @option
  7503. @item zero
  7504. round towards 0
  7505. @item inf
  7506. round away from 0
  7507. @item down
  7508. round towards -infinity
  7509. @item up
  7510. round towards +infinity
  7511. @item near
  7512. round to nearest
  7513. @end table
  7514. The default is @code{near}.
  7515. @item eof_action
  7516. Action performed when reading the last frame.
  7517. Possible values are:
  7518. @table @option
  7519. @item round
  7520. Use same timestamp rounding method as used for other frames.
  7521. @item pass
  7522. Pass through last frame if input duration has not been reached yet.
  7523. @end table
  7524. The default is @code{round}.
  7525. @end table
  7526. Alternatively, the options can be specified as a flat string:
  7527. @var{fps}[:@var{start_time}[:@var{round}]].
  7528. See also the @ref{setpts} filter.
  7529. @subsection Examples
  7530. @itemize
  7531. @item
  7532. A typical usage in order to set the fps to 25:
  7533. @example
  7534. fps=fps=25
  7535. @end example
  7536. @item
  7537. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7538. @example
  7539. fps=fps=film:round=near
  7540. @end example
  7541. @end itemize
  7542. @section framepack
  7543. Pack two different video streams into a stereoscopic video, setting proper
  7544. metadata on supported codecs. The two views should have the same size and
  7545. framerate and processing will stop when the shorter video ends. Please note
  7546. that you may conveniently adjust view properties with the @ref{scale} and
  7547. @ref{fps} filters.
  7548. It accepts the following parameters:
  7549. @table @option
  7550. @item format
  7551. The desired packing format. Supported values are:
  7552. @table @option
  7553. @item sbs
  7554. The views are next to each other (default).
  7555. @item tab
  7556. The views are on top of each other.
  7557. @item lines
  7558. The views are packed by line.
  7559. @item columns
  7560. The views are packed by column.
  7561. @item frameseq
  7562. The views are temporally interleaved.
  7563. @end table
  7564. @end table
  7565. Some examples:
  7566. @example
  7567. # Convert left and right views into a frame-sequential video
  7568. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7569. # Convert views into a side-by-side video with the same output resolution as the input
  7570. 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
  7571. @end example
  7572. @section framerate
  7573. Change the frame rate by interpolating new video output frames from the source
  7574. frames.
  7575. This filter is not designed to function correctly with interlaced media. If
  7576. you wish to change the frame rate of interlaced media then you are required
  7577. to deinterlace before this filter and re-interlace after this filter.
  7578. A description of the accepted options follows.
  7579. @table @option
  7580. @item fps
  7581. Specify the output frames per second. This option can also be specified
  7582. as a value alone. The default is @code{50}.
  7583. @item interp_start
  7584. Specify the start of a range where the output frame will be created as a
  7585. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7586. the default is @code{15}.
  7587. @item interp_end
  7588. Specify the end of a range where the output frame will be created as a
  7589. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7590. the default is @code{240}.
  7591. @item scene
  7592. Specify the level at which a scene change is detected as a value between
  7593. 0 and 100 to indicate a new scene; a low value reflects a low
  7594. probability for the current frame to introduce a new scene, while a higher
  7595. value means the current frame is more likely to be one.
  7596. The default is @code{8.2}.
  7597. @item flags
  7598. Specify flags influencing the filter process.
  7599. Available value for @var{flags} is:
  7600. @table @option
  7601. @item scene_change_detect, scd
  7602. Enable scene change detection using the value of the option @var{scene}.
  7603. This flag is enabled by default.
  7604. @end table
  7605. @end table
  7606. @section framestep
  7607. Select one frame every N-th frame.
  7608. This filter accepts the following option:
  7609. @table @option
  7610. @item step
  7611. Select frame after every @code{step} frames.
  7612. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7613. @end table
  7614. @anchor{frei0r}
  7615. @section frei0r
  7616. Apply a frei0r effect to the input video.
  7617. To enable the compilation of this filter, you need to install the frei0r
  7618. header and configure FFmpeg with @code{--enable-frei0r}.
  7619. It accepts the following parameters:
  7620. @table @option
  7621. @item filter_name
  7622. The name of the frei0r effect to load. If the environment variable
  7623. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7624. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7625. Otherwise, the standard frei0r paths are searched, in this order:
  7626. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7627. @file{/usr/lib/frei0r-1/}.
  7628. @item filter_params
  7629. A '|'-separated list of parameters to pass to the frei0r effect.
  7630. @end table
  7631. A frei0r effect parameter can be a boolean (its value is either
  7632. "y" or "n"), a double, a color (specified as
  7633. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7634. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7635. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7636. a position (specified as @var{X}/@var{Y}, where
  7637. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7638. The number and types of parameters depend on the loaded effect. If an
  7639. effect parameter is not specified, the default value is set.
  7640. @subsection Examples
  7641. @itemize
  7642. @item
  7643. Apply the distort0r effect, setting the first two double parameters:
  7644. @example
  7645. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7646. @end example
  7647. @item
  7648. Apply the colordistance effect, taking a color as the first parameter:
  7649. @example
  7650. frei0r=colordistance:0.2/0.3/0.4
  7651. frei0r=colordistance:violet
  7652. frei0r=colordistance:0x112233
  7653. @end example
  7654. @item
  7655. Apply the perspective effect, specifying the top left and top right image
  7656. positions:
  7657. @example
  7658. frei0r=perspective:0.2/0.2|0.8/0.2
  7659. @end example
  7660. @end itemize
  7661. For more information, see
  7662. @url{http://frei0r.dyne.org}
  7663. @section fspp
  7664. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7665. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7666. processing filter, one of them is performed once per block, not per pixel.
  7667. This allows for much higher speed.
  7668. The filter accepts the following options:
  7669. @table @option
  7670. @item quality
  7671. Set quality. This option defines the number of levels for averaging. It accepts
  7672. an integer in the range 4-5. Default value is @code{4}.
  7673. @item qp
  7674. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7675. If not set, the filter will use the QP from the video stream (if available).
  7676. @item strength
  7677. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7678. more details but also more artifacts, while higher values make the image smoother
  7679. but also blurrier. Default value is @code{0} − PSNR optimal.
  7680. @item use_bframe_qp
  7681. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7682. option may cause flicker since the B-Frames have often larger QP. Default is
  7683. @code{0} (not enabled).
  7684. @end table
  7685. @section gblur
  7686. Apply Gaussian blur filter.
  7687. The filter accepts the following options:
  7688. @table @option
  7689. @item sigma
  7690. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7691. @item steps
  7692. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7693. @item planes
  7694. Set which planes to filter. By default all planes are filtered.
  7695. @item sigmaV
  7696. Set vertical sigma, if negative it will be same as @code{sigma}.
  7697. Default is @code{-1}.
  7698. @end table
  7699. @section geq
  7700. The filter accepts the following options:
  7701. @table @option
  7702. @item lum_expr, lum
  7703. Set the luminance expression.
  7704. @item cb_expr, cb
  7705. Set the chrominance blue expression.
  7706. @item cr_expr, cr
  7707. Set the chrominance red expression.
  7708. @item alpha_expr, a
  7709. Set the alpha expression.
  7710. @item red_expr, r
  7711. Set the red expression.
  7712. @item green_expr, g
  7713. Set the green expression.
  7714. @item blue_expr, b
  7715. Set the blue expression.
  7716. @end table
  7717. The colorspace is selected according to the specified options. If one
  7718. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7719. options is specified, the filter will automatically select a YCbCr
  7720. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7721. @option{blue_expr} options is specified, it will select an RGB
  7722. colorspace.
  7723. If one of the chrominance expression is not defined, it falls back on the other
  7724. one. If no alpha expression is specified it will evaluate to opaque value.
  7725. If none of chrominance expressions are specified, they will evaluate
  7726. to the luminance expression.
  7727. The expressions can use the following variables and functions:
  7728. @table @option
  7729. @item N
  7730. The sequential number of the filtered frame, starting from @code{0}.
  7731. @item X
  7732. @item Y
  7733. The coordinates of the current sample.
  7734. @item W
  7735. @item H
  7736. The width and height of the image.
  7737. @item SW
  7738. @item SH
  7739. Width and height scale depending on the currently filtered plane. It is the
  7740. ratio between the corresponding luma plane number of pixels and the current
  7741. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7742. @code{0.5,0.5} for chroma planes.
  7743. @item T
  7744. Time of the current frame, expressed in seconds.
  7745. @item p(x, y)
  7746. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7747. plane.
  7748. @item lum(x, y)
  7749. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7750. plane.
  7751. @item cb(x, y)
  7752. Return the value of the pixel at location (@var{x},@var{y}) of the
  7753. blue-difference chroma plane. Return 0 if there is no such plane.
  7754. @item cr(x, y)
  7755. Return the value of the pixel at location (@var{x},@var{y}) of the
  7756. red-difference chroma plane. Return 0 if there is no such plane.
  7757. @item r(x, y)
  7758. @item g(x, y)
  7759. @item b(x, y)
  7760. Return the value of the pixel at location (@var{x},@var{y}) of the
  7761. red/green/blue component. Return 0 if there is no such component.
  7762. @item alpha(x, y)
  7763. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7764. plane. Return 0 if there is no such plane.
  7765. @end table
  7766. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7767. automatically clipped to the closer edge.
  7768. @subsection Examples
  7769. @itemize
  7770. @item
  7771. Flip the image horizontally:
  7772. @example
  7773. geq=p(W-X\,Y)
  7774. @end example
  7775. @item
  7776. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7777. wavelength of 100 pixels:
  7778. @example
  7779. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7780. @end example
  7781. @item
  7782. Generate a fancy enigmatic moving light:
  7783. @example
  7784. 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
  7785. @end example
  7786. @item
  7787. Generate a quick emboss effect:
  7788. @example
  7789. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7790. @end example
  7791. @item
  7792. Modify RGB components depending on pixel position:
  7793. @example
  7794. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7795. @end example
  7796. @item
  7797. Create a radial gradient that is the same size as the input (also see
  7798. the @ref{vignette} filter):
  7799. @example
  7800. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7801. @end example
  7802. @end itemize
  7803. @section gradfun
  7804. Fix the banding artifacts that are sometimes introduced into nearly flat
  7805. regions by truncation to 8-bit color depth.
  7806. Interpolate the gradients that should go where the bands are, and
  7807. dither them.
  7808. It is designed for playback only. Do not use it prior to
  7809. lossy compression, because compression tends to lose the dither and
  7810. bring back the bands.
  7811. It accepts the following parameters:
  7812. @table @option
  7813. @item strength
  7814. The maximum amount by which the filter will change any one pixel. This is also
  7815. the threshold for detecting nearly flat regions. Acceptable values range from
  7816. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7817. valid range.
  7818. @item radius
  7819. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7820. gradients, but also prevents the filter from modifying the pixels near detailed
  7821. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7822. values will be clipped to the valid range.
  7823. @end table
  7824. Alternatively, the options can be specified as a flat string:
  7825. @var{strength}[:@var{radius}]
  7826. @subsection Examples
  7827. @itemize
  7828. @item
  7829. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7830. @example
  7831. gradfun=3.5:8
  7832. @end example
  7833. @item
  7834. Specify radius, omitting the strength (which will fall-back to the default
  7835. value):
  7836. @example
  7837. gradfun=radius=8
  7838. @end example
  7839. @end itemize
  7840. @section greyedge
  7841. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7842. and corrects the scene colors accordingly.
  7843. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7844. The filter accepts the following options:
  7845. @table @option
  7846. @item difford
  7847. The order of differentiation to be applied on the scene. Must be chosen in the range
  7848. [0,2] and default value is 1.
  7849. @item minknorm
  7850. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7851. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  7852. max value instead of calculating Minkowski distance.
  7853. @item sigma
  7854. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7855. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  7856. can't be euqal to 0 if @var{difford} is greater than 0.
  7857. @end table
  7858. @subsection Examples
  7859. @itemize
  7860. @item
  7861. Grey Edge:
  7862. @example
  7863. greyedge=difford=1:minknorm=5:sigma=2
  7864. @end example
  7865. @item
  7866. Max Edge:
  7867. @example
  7868. greyedge=difford=1:minknorm=0:sigma=2
  7869. @end example
  7870. @end itemize
  7871. @anchor{haldclut}
  7872. @section haldclut
  7873. Apply a Hald CLUT to a video stream.
  7874. First input is the video stream to process, and second one is the Hald CLUT.
  7875. The Hald CLUT input can be a simple picture or a complete video stream.
  7876. The filter accepts the following options:
  7877. @table @option
  7878. @item shortest
  7879. Force termination when the shortest input terminates. Default is @code{0}.
  7880. @item repeatlast
  7881. Continue applying the last CLUT after the end of the stream. A value of
  7882. @code{0} disable the filter after the last frame of the CLUT is reached.
  7883. Default is @code{1}.
  7884. @end table
  7885. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7886. filters share the same internals).
  7887. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7888. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7889. @subsection Workflow examples
  7890. @subsubsection Hald CLUT video stream
  7891. Generate an identity Hald CLUT stream altered with various effects:
  7892. @example
  7893. 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
  7894. @end example
  7895. Note: make sure you use a lossless codec.
  7896. Then use it with @code{haldclut} to apply it on some random stream:
  7897. @example
  7898. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7899. @end example
  7900. The Hald CLUT will be applied to the 10 first seconds (duration of
  7901. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7902. to the remaining frames of the @code{mandelbrot} stream.
  7903. @subsubsection Hald CLUT with preview
  7904. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7905. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7906. biggest possible square starting at the top left of the picture. The remaining
  7907. padding pixels (bottom or right) will be ignored. This area can be used to add
  7908. a preview of the Hald CLUT.
  7909. Typically, the following generated Hald CLUT will be supported by the
  7910. @code{haldclut} filter:
  7911. @example
  7912. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7913. pad=iw+320 [padded_clut];
  7914. smptebars=s=320x256, split [a][b];
  7915. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7916. [main][b] overlay=W-320" -frames:v 1 clut.png
  7917. @end example
  7918. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7919. bars are displayed on the right-top, and below the same color bars processed by
  7920. the color changes.
  7921. Then, the effect of this Hald CLUT can be visualized with:
  7922. @example
  7923. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7924. @end example
  7925. @section hflip
  7926. Flip the input video horizontally.
  7927. For example, to horizontally flip the input video with @command{ffmpeg}:
  7928. @example
  7929. ffmpeg -i in.avi -vf "hflip" out.avi
  7930. @end example
  7931. @section histeq
  7932. This filter applies a global color histogram equalization on a
  7933. per-frame basis.
  7934. It can be used to correct video that has a compressed range of pixel
  7935. intensities. The filter redistributes the pixel intensities to
  7936. equalize their distribution across the intensity range. It may be
  7937. viewed as an "automatically adjusting contrast filter". This filter is
  7938. useful only for correcting degraded or poorly captured source
  7939. video.
  7940. The filter accepts the following options:
  7941. @table @option
  7942. @item strength
  7943. Determine the amount of equalization to be applied. As the strength
  7944. is reduced, the distribution of pixel intensities more-and-more
  7945. approaches that of the input frame. The value must be a float number
  7946. in the range [0,1] and defaults to 0.200.
  7947. @item intensity
  7948. Set the maximum intensity that can generated and scale the output
  7949. values appropriately. The strength should be set as desired and then
  7950. the intensity can be limited if needed to avoid washing-out. The value
  7951. must be a float number in the range [0,1] and defaults to 0.210.
  7952. @item antibanding
  7953. Set the antibanding level. If enabled the filter will randomly vary
  7954. the luminance of output pixels by a small amount to avoid banding of
  7955. the histogram. Possible values are @code{none}, @code{weak} or
  7956. @code{strong}. It defaults to @code{none}.
  7957. @end table
  7958. @section histogram
  7959. Compute and draw a color distribution histogram for the input video.
  7960. The computed histogram is a representation of the color component
  7961. distribution in an image.
  7962. Standard histogram displays the color components distribution in an image.
  7963. Displays color graph for each color component. Shows distribution of
  7964. the Y, U, V, A or R, G, B components, depending on input format, in the
  7965. current frame. Below each graph a color component scale meter is shown.
  7966. The filter accepts the following options:
  7967. @table @option
  7968. @item level_height
  7969. Set height of level. Default value is @code{200}.
  7970. Allowed range is [50, 2048].
  7971. @item scale_height
  7972. Set height of color scale. Default value is @code{12}.
  7973. Allowed range is [0, 40].
  7974. @item display_mode
  7975. Set display mode.
  7976. It accepts the following values:
  7977. @table @samp
  7978. @item stack
  7979. Per color component graphs are placed below each other.
  7980. @item parade
  7981. Per color component graphs are placed side by side.
  7982. @item overlay
  7983. Presents information identical to that in the @code{parade}, except
  7984. that the graphs representing color components are superimposed directly
  7985. over one another.
  7986. @end table
  7987. Default is @code{stack}.
  7988. @item levels_mode
  7989. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7990. Default is @code{linear}.
  7991. @item components
  7992. Set what color components to display.
  7993. Default is @code{7}.
  7994. @item fgopacity
  7995. Set foreground opacity. Default is @code{0.7}.
  7996. @item bgopacity
  7997. Set background opacity. Default is @code{0.5}.
  7998. @end table
  7999. @subsection Examples
  8000. @itemize
  8001. @item
  8002. Calculate and draw histogram:
  8003. @example
  8004. ffplay -i input -vf histogram
  8005. @end example
  8006. @end itemize
  8007. @anchor{hqdn3d}
  8008. @section hqdn3d
  8009. This is a high precision/quality 3d denoise filter. It aims to reduce
  8010. image noise, producing smooth images and making still images really
  8011. still. It should enhance compressibility.
  8012. It accepts the following optional parameters:
  8013. @table @option
  8014. @item luma_spatial
  8015. A non-negative floating point number which specifies spatial luma strength.
  8016. It defaults to 4.0.
  8017. @item chroma_spatial
  8018. A non-negative floating point number which specifies spatial chroma strength.
  8019. It defaults to 3.0*@var{luma_spatial}/4.0.
  8020. @item luma_tmp
  8021. A floating point number which specifies luma temporal strength. It defaults to
  8022. 6.0*@var{luma_spatial}/4.0.
  8023. @item chroma_tmp
  8024. A floating point number which specifies chroma temporal strength. It defaults to
  8025. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8026. @end table
  8027. @section hwdownload
  8028. Download hardware frames to system memory.
  8029. The input must be in hardware frames, and the output a non-hardware format.
  8030. Not all formats will be supported on the output - it may be necessary to insert
  8031. an additional @option{format} filter immediately following in the graph to get
  8032. the output in a supported format.
  8033. @section hwmap
  8034. Map hardware frames to system memory or to another device.
  8035. This filter has several different modes of operation; which one is used depends
  8036. on the input and output formats:
  8037. @itemize
  8038. @item
  8039. Hardware frame input, normal frame output
  8040. Map the input frames to system memory and pass them to the output. If the
  8041. original hardware frame is later required (for example, after overlaying
  8042. something else on part of it), the @option{hwmap} filter can be used again
  8043. in the next mode to retrieve it.
  8044. @item
  8045. Normal frame input, hardware frame output
  8046. If the input is actually a software-mapped hardware frame, then unmap it -
  8047. that is, return the original hardware frame.
  8048. Otherwise, a device must be provided. Create new hardware surfaces on that
  8049. device for the output, then map them back to the software format at the input
  8050. and give those frames to the preceding filter. This will then act like the
  8051. @option{hwupload} filter, but may be able to avoid an additional copy when
  8052. the input is already in a compatible format.
  8053. @item
  8054. Hardware frame input and output
  8055. A device must be supplied for the output, either directly or with the
  8056. @option{derive_device} option. The input and output devices must be of
  8057. different types and compatible - the exact meaning of this is
  8058. system-dependent, but typically it means that they must refer to the same
  8059. underlying hardware context (for example, refer to the same graphics card).
  8060. If the input frames were originally created on the output device, then unmap
  8061. to retrieve the original frames.
  8062. Otherwise, map the frames to the output device - create new hardware frames
  8063. on the output corresponding to the frames on the input.
  8064. @end itemize
  8065. The following additional parameters are accepted:
  8066. @table @option
  8067. @item mode
  8068. Set the frame mapping mode. Some combination of:
  8069. @table @var
  8070. @item read
  8071. The mapped frame should be readable.
  8072. @item write
  8073. The mapped frame should be writeable.
  8074. @item overwrite
  8075. The mapping will always overwrite the entire frame.
  8076. This may improve performance in some cases, as the original contents of the
  8077. frame need not be loaded.
  8078. @item direct
  8079. The mapping must not involve any copying.
  8080. Indirect mappings to copies of frames are created in some cases where either
  8081. direct mapping is not possible or it would have unexpected properties.
  8082. Setting this flag ensures that the mapping is direct and will fail if that is
  8083. not possible.
  8084. @end table
  8085. Defaults to @var{read+write} if not specified.
  8086. @item derive_device @var{type}
  8087. Rather than using the device supplied at initialisation, instead derive a new
  8088. device of type @var{type} from the device the input frames exist on.
  8089. @item reverse
  8090. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8091. and map them back to the source. This may be necessary in some cases where
  8092. a mapping in one direction is required but only the opposite direction is
  8093. supported by the devices being used.
  8094. This option is dangerous - it may break the preceding filter in undefined
  8095. ways if there are any additional constraints on that filter's output.
  8096. Do not use it without fully understanding the implications of its use.
  8097. @end table
  8098. @section hwupload
  8099. Upload system memory frames to hardware surfaces.
  8100. The device to upload to must be supplied when the filter is initialised. If
  8101. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8102. option.
  8103. @anchor{hwupload_cuda}
  8104. @section hwupload_cuda
  8105. Upload system memory frames to a CUDA device.
  8106. It accepts the following optional parameters:
  8107. @table @option
  8108. @item device
  8109. The number of the CUDA device to use
  8110. @end table
  8111. @section hqx
  8112. Apply a high-quality magnification filter designed for pixel art. This filter
  8113. was originally created by Maxim Stepin.
  8114. It accepts the following option:
  8115. @table @option
  8116. @item n
  8117. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8118. @code{hq3x} and @code{4} for @code{hq4x}.
  8119. Default is @code{3}.
  8120. @end table
  8121. @section hstack
  8122. Stack input videos horizontally.
  8123. All streams must be of same pixel format and of same height.
  8124. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8125. to create same output.
  8126. The filter accept the following option:
  8127. @table @option
  8128. @item inputs
  8129. Set number of input streams. Default is 2.
  8130. @item shortest
  8131. If set to 1, force the output to terminate when the shortest input
  8132. terminates. Default value is 0.
  8133. @end table
  8134. @section hue
  8135. Modify the hue and/or the saturation of the input.
  8136. It accepts the following parameters:
  8137. @table @option
  8138. @item h
  8139. Specify the hue angle as a number of degrees. It accepts an expression,
  8140. and defaults to "0".
  8141. @item s
  8142. Specify the saturation in the [-10,10] range. It accepts an expression and
  8143. defaults to "1".
  8144. @item H
  8145. Specify the hue angle as a number of radians. It accepts an
  8146. expression, and defaults to "0".
  8147. @item b
  8148. Specify the brightness in the [-10,10] range. It accepts an expression and
  8149. defaults to "0".
  8150. @end table
  8151. @option{h} and @option{H} are mutually exclusive, and can't be
  8152. specified at the same time.
  8153. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8154. expressions containing the following constants:
  8155. @table @option
  8156. @item n
  8157. frame count of the input frame starting from 0
  8158. @item pts
  8159. presentation timestamp of the input frame expressed in time base units
  8160. @item r
  8161. frame rate of the input video, NAN if the input frame rate is unknown
  8162. @item t
  8163. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8164. @item tb
  8165. time base of the input video
  8166. @end table
  8167. @subsection Examples
  8168. @itemize
  8169. @item
  8170. Set the hue to 90 degrees and the saturation to 1.0:
  8171. @example
  8172. hue=h=90:s=1
  8173. @end example
  8174. @item
  8175. Same command but expressing the hue in radians:
  8176. @example
  8177. hue=H=PI/2:s=1
  8178. @end example
  8179. @item
  8180. Rotate hue and make the saturation swing between 0
  8181. and 2 over a period of 1 second:
  8182. @example
  8183. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8184. @end example
  8185. @item
  8186. Apply a 3 seconds saturation fade-in effect starting at 0:
  8187. @example
  8188. hue="s=min(t/3\,1)"
  8189. @end example
  8190. The general fade-in expression can be written as:
  8191. @example
  8192. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8193. @end example
  8194. @item
  8195. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8196. @example
  8197. hue="s=max(0\, min(1\, (8-t)/3))"
  8198. @end example
  8199. The general fade-out expression can be written as:
  8200. @example
  8201. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8202. @end example
  8203. @end itemize
  8204. @subsection Commands
  8205. This filter supports the following commands:
  8206. @table @option
  8207. @item b
  8208. @item s
  8209. @item h
  8210. @item H
  8211. Modify the hue and/or the saturation and/or brightness of the input video.
  8212. The command accepts the same syntax of the corresponding option.
  8213. If the specified expression is not valid, it is kept at its current
  8214. value.
  8215. @end table
  8216. @section hysteresis
  8217. Grow first stream into second stream by connecting components.
  8218. This makes it possible to build more robust edge masks.
  8219. This filter accepts the following options:
  8220. @table @option
  8221. @item planes
  8222. Set which planes will be processed as bitmap, unprocessed planes will be
  8223. copied from first stream.
  8224. By default value 0xf, all planes will be processed.
  8225. @item threshold
  8226. Set threshold which is used in filtering. If pixel component value is higher than
  8227. this value filter algorithm for connecting components is activated.
  8228. By default value is 0.
  8229. @end table
  8230. @section idet
  8231. Detect video interlacing type.
  8232. This filter tries to detect if the input frames are interlaced, progressive,
  8233. top or bottom field first. It will also try to detect fields that are
  8234. repeated between adjacent frames (a sign of telecine).
  8235. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8236. Multiple frame detection incorporates the classification history of previous frames.
  8237. The filter will log these metadata values:
  8238. @table @option
  8239. @item single.current_frame
  8240. Detected type of current frame using single-frame detection. One of:
  8241. ``tff'' (top field first), ``bff'' (bottom field first),
  8242. ``progressive'', or ``undetermined''
  8243. @item single.tff
  8244. Cumulative number of frames detected as top field first using single-frame detection.
  8245. @item multiple.tff
  8246. Cumulative number of frames detected as top field first using multiple-frame detection.
  8247. @item single.bff
  8248. Cumulative number of frames detected as bottom field first using single-frame detection.
  8249. @item multiple.current_frame
  8250. Detected type of current frame using multiple-frame detection. One of:
  8251. ``tff'' (top field first), ``bff'' (bottom field first),
  8252. ``progressive'', or ``undetermined''
  8253. @item multiple.bff
  8254. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8255. @item single.progressive
  8256. Cumulative number of frames detected as progressive using single-frame detection.
  8257. @item multiple.progressive
  8258. Cumulative number of frames detected as progressive using multiple-frame detection.
  8259. @item single.undetermined
  8260. Cumulative number of frames that could not be classified using single-frame detection.
  8261. @item multiple.undetermined
  8262. Cumulative number of frames that could not be classified using multiple-frame detection.
  8263. @item repeated.current_frame
  8264. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8265. @item repeated.neither
  8266. Cumulative number of frames with no repeated field.
  8267. @item repeated.top
  8268. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8269. @item repeated.bottom
  8270. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8271. @end table
  8272. The filter accepts the following options:
  8273. @table @option
  8274. @item intl_thres
  8275. Set interlacing threshold.
  8276. @item prog_thres
  8277. Set progressive threshold.
  8278. @item rep_thres
  8279. Threshold for repeated field detection.
  8280. @item half_life
  8281. Number of frames after which a given frame's contribution to the
  8282. statistics is halved (i.e., it contributes only 0.5 to its
  8283. classification). The default of 0 means that all frames seen are given
  8284. full weight of 1.0 forever.
  8285. @item analyze_interlaced_flag
  8286. When this is not 0 then idet will use the specified number of frames to determine
  8287. if the interlaced flag is accurate, it will not count undetermined frames.
  8288. If the flag is found to be accurate it will be used without any further
  8289. computations, if it is found to be inaccurate it will be cleared without any
  8290. further computations. This allows inserting the idet filter as a low computational
  8291. method to clean up the interlaced flag
  8292. @end table
  8293. @section il
  8294. Deinterleave or interleave fields.
  8295. This filter allows one to process interlaced images fields without
  8296. deinterlacing them. Deinterleaving splits the input frame into 2
  8297. fields (so called half pictures). Odd lines are moved to the top
  8298. half of the output image, even lines to the bottom half.
  8299. You can process (filter) them independently and then re-interleave them.
  8300. The filter accepts the following options:
  8301. @table @option
  8302. @item luma_mode, l
  8303. @item chroma_mode, c
  8304. @item alpha_mode, a
  8305. Available values for @var{luma_mode}, @var{chroma_mode} and
  8306. @var{alpha_mode} are:
  8307. @table @samp
  8308. @item none
  8309. Do nothing.
  8310. @item deinterleave, d
  8311. Deinterleave fields, placing one above the other.
  8312. @item interleave, i
  8313. Interleave fields. Reverse the effect of deinterleaving.
  8314. @end table
  8315. Default value is @code{none}.
  8316. @item luma_swap, ls
  8317. @item chroma_swap, cs
  8318. @item alpha_swap, as
  8319. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8320. @end table
  8321. @section inflate
  8322. Apply inflate effect to the video.
  8323. This filter replaces the pixel by the local(3x3) average by taking into account
  8324. only values higher than the pixel.
  8325. It accepts the following options:
  8326. @table @option
  8327. @item threshold0
  8328. @item threshold1
  8329. @item threshold2
  8330. @item threshold3
  8331. Limit the maximum change for each plane, default is 65535.
  8332. If 0, plane will remain unchanged.
  8333. @end table
  8334. @section interlace
  8335. Simple interlacing filter from progressive contents. This interleaves upper (or
  8336. lower) lines from odd frames with lower (or upper) lines from even frames,
  8337. halving the frame rate and preserving image height.
  8338. @example
  8339. Original Original New Frame
  8340. Frame 'j' Frame 'j+1' (tff)
  8341. ========== =========== ==================
  8342. Line 0 --------------------> Frame 'j' Line 0
  8343. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8344. Line 2 ---------------------> Frame 'j' Line 2
  8345. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8346. ... ... ...
  8347. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8348. @end example
  8349. It accepts the following optional parameters:
  8350. @table @option
  8351. @item scan
  8352. This determines whether the interlaced frame is taken from the even
  8353. (tff - default) or odd (bff) lines of the progressive frame.
  8354. @item lowpass
  8355. Vertical lowpass filter to avoid twitter interlacing and
  8356. reduce moire patterns.
  8357. @table @samp
  8358. @item 0, off
  8359. Disable vertical lowpass filter
  8360. @item 1, linear
  8361. Enable linear filter (default)
  8362. @item 2, complex
  8363. Enable complex filter. This will slightly less reduce twitter and moire
  8364. but better retain detail and subjective sharpness impression.
  8365. @end table
  8366. @end table
  8367. @section kerndeint
  8368. Deinterlace input video by applying Donald Graft's adaptive kernel
  8369. deinterling. Work on interlaced parts of a video to produce
  8370. progressive frames.
  8371. The description of the accepted parameters follows.
  8372. @table @option
  8373. @item thresh
  8374. Set the threshold which affects the filter's tolerance when
  8375. determining if a pixel line must be processed. It must be an integer
  8376. in the range [0,255] and defaults to 10. A value of 0 will result in
  8377. applying the process on every pixels.
  8378. @item map
  8379. Paint pixels exceeding the threshold value to white if set to 1.
  8380. Default is 0.
  8381. @item order
  8382. Set the fields order. Swap fields if set to 1, leave fields alone if
  8383. 0. Default is 0.
  8384. @item sharp
  8385. Enable additional sharpening if set to 1. Default is 0.
  8386. @item twoway
  8387. Enable twoway sharpening if set to 1. Default is 0.
  8388. @end table
  8389. @subsection Examples
  8390. @itemize
  8391. @item
  8392. Apply default values:
  8393. @example
  8394. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8395. @end example
  8396. @item
  8397. Enable additional sharpening:
  8398. @example
  8399. kerndeint=sharp=1
  8400. @end example
  8401. @item
  8402. Paint processed pixels in white:
  8403. @example
  8404. kerndeint=map=1
  8405. @end example
  8406. @end itemize
  8407. @section lenscorrection
  8408. Correct radial lens distortion
  8409. This filter can be used to correct for radial distortion as can result from the use
  8410. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8411. one can use tools available for example as part of opencv or simply trial-and-error.
  8412. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8413. and extract the k1 and k2 coefficients from the resulting matrix.
  8414. Note that effectively the same filter is available in the open-source tools Krita and
  8415. Digikam from the KDE project.
  8416. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8417. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8418. brightness distribution, so you may want to use both filters together in certain
  8419. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8420. be applied before or after lens correction.
  8421. @subsection Options
  8422. The filter accepts the following options:
  8423. @table @option
  8424. @item cx
  8425. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8426. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8427. width. Default is 0.5.
  8428. @item cy
  8429. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8430. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8431. height. Default is 0.5.
  8432. @item k1
  8433. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8434. no correction. Default is 0.
  8435. @item k2
  8436. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8437. 0 means no correction. Default is 0.
  8438. @end table
  8439. The formula that generates the correction is:
  8440. @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)
  8441. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8442. distances from the focal point in the source and target images, respectively.
  8443. @section lensfun
  8444. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8445. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8446. to apply the lens correction. The filter will load the lensfun database and
  8447. query it to find the corresponding camera and lens entries in the database. As
  8448. long as these entries can be found with the given options, the filter can
  8449. perform corrections on frames. Note that incomplete strings will result in the
  8450. filter choosing the best match with the given options, and the filter will
  8451. output the chosen camera and lens models (logged with level "info"). You must
  8452. provide the make, camera model, and lens model as they are required.
  8453. The filter accepts the following options:
  8454. @table @option
  8455. @item make
  8456. The make of the camera (for example, "Canon"). This option is required.
  8457. @item model
  8458. The model of the camera (for example, "Canon EOS 100D"). This option is
  8459. required.
  8460. @item lens_model
  8461. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8462. option is required.
  8463. @item mode
  8464. The type of correction to apply. The following values are valid options:
  8465. @table @samp
  8466. @item vignetting
  8467. Enables fixing lens vignetting.
  8468. @item geometry
  8469. Enables fixing lens geometry. This is the default.
  8470. @item subpixel
  8471. Enables fixing chromatic aberrations.
  8472. @item vig_geo
  8473. Enables fixing lens vignetting and lens geometry.
  8474. @item vig_subpixel
  8475. Enables fixing lens vignetting and chromatic aberrations.
  8476. @item distortion
  8477. Enables fixing both lens geometry and chromatic aberrations.
  8478. @item all
  8479. Enables all possible corrections.
  8480. @end table
  8481. @item focal_length
  8482. The focal length of the image/video (zoom; expected constant for video). For
  8483. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8484. range should be chosen when using that lens. Default 18.
  8485. @item aperture
  8486. The aperture of the image/video (expected constant for video). Note that
  8487. aperture is only used for vignetting correction. Default 3.5.
  8488. @item focus_distance
  8489. The focus distance of the image/video (expected constant for video). Note that
  8490. focus distance is only used for vignetting and only slightly affects the
  8491. vignetting correction process. If unknown, leave it at the default value (which
  8492. is 1000).
  8493. @item target_geometry
  8494. The target geometry of the output image/video. The following values are valid
  8495. options:
  8496. @table @samp
  8497. @item rectilinear (default)
  8498. @item fisheye
  8499. @item panoramic
  8500. @item equirectangular
  8501. @item fisheye_orthographic
  8502. @item fisheye_stereographic
  8503. @item fisheye_equisolid
  8504. @item fisheye_thoby
  8505. @end table
  8506. @item reverse
  8507. Apply the reverse of image correction (instead of correcting distortion, apply
  8508. it).
  8509. @item interpolation
  8510. The type of interpolation used when correcting distortion. The following values
  8511. are valid options:
  8512. @table @samp
  8513. @item nearest
  8514. @item linear (default)
  8515. @item lanczos
  8516. @end table
  8517. @end table
  8518. @subsection Examples
  8519. @itemize
  8520. @item
  8521. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8522. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8523. aperture of "8.0".
  8524. @example
  8525. 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
  8526. @end example
  8527. @item
  8528. Apply the same as before, but only for the first 5 seconds of video.
  8529. @example
  8530. 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
  8531. @end example
  8532. @end itemize
  8533. @section libvmaf
  8534. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8535. score between two input videos.
  8536. The obtained VMAF score is printed through the logging system.
  8537. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8538. After installing the library it can be enabled using:
  8539. @code{./configure --enable-libvmaf --enable-version3}.
  8540. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8541. The filter has following options:
  8542. @table @option
  8543. @item model_path
  8544. Set the model path which is to be used for SVM.
  8545. Default value: @code{"vmaf_v0.6.1.pkl"}
  8546. @item log_path
  8547. Set the file path to be used to store logs.
  8548. @item log_fmt
  8549. Set the format of the log file (xml or json).
  8550. @item enable_transform
  8551. Enables transform for computing vmaf.
  8552. @item phone_model
  8553. Invokes the phone model which will generate VMAF scores higher than in the
  8554. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8555. @item psnr
  8556. Enables computing psnr along with vmaf.
  8557. @item ssim
  8558. Enables computing ssim along with vmaf.
  8559. @item ms_ssim
  8560. Enables computing ms_ssim along with vmaf.
  8561. @item pool
  8562. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8563. @item n_threads
  8564. Set number of threads to be used when computing vmaf.
  8565. @item n_subsample
  8566. Set interval for frame subsampling used when computing vmaf.
  8567. @item enable_conf_interval
  8568. Enables confidence interval.
  8569. @end table
  8570. This filter also supports the @ref{framesync} options.
  8571. On the below examples the input file @file{main.mpg} being processed is
  8572. compared with the reference file @file{ref.mpg}.
  8573. @example
  8574. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8575. @end example
  8576. Example with options:
  8577. @example
  8578. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8579. @end example
  8580. @section limiter
  8581. Limits the pixel components values to the specified range [min, max].
  8582. The filter accepts the following options:
  8583. @table @option
  8584. @item min
  8585. Lower bound. Defaults to the lowest allowed value for the input.
  8586. @item max
  8587. Upper bound. Defaults to the highest allowed value for the input.
  8588. @item planes
  8589. Specify which planes will be processed. Defaults to all available.
  8590. @end table
  8591. @section loop
  8592. Loop video frames.
  8593. The filter accepts the following options:
  8594. @table @option
  8595. @item loop
  8596. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8597. Default is 0.
  8598. @item size
  8599. Set maximal size in number of frames. Default is 0.
  8600. @item start
  8601. Set first frame of loop. Default is 0.
  8602. @end table
  8603. @section lut1d
  8604. Apply a 1D LUT to an input video.
  8605. The filter accepts the following options:
  8606. @table @option
  8607. @item file
  8608. Set the 1D LUT file name.
  8609. Currently supported formats:
  8610. @table @samp
  8611. @item cube
  8612. Iridas
  8613. @end table
  8614. @item interp
  8615. Select interpolation mode.
  8616. Available values are:
  8617. @table @samp
  8618. @item nearest
  8619. Use values from the nearest defined point.
  8620. @item linear
  8621. Interpolate values using the linear interpolation.
  8622. @item cubic
  8623. Interpolate values using the cubic interpolation.
  8624. @end table
  8625. @end table
  8626. @anchor{lut3d}
  8627. @section lut3d
  8628. Apply a 3D LUT to an input video.
  8629. The filter accepts the following options:
  8630. @table @option
  8631. @item file
  8632. Set the 3D LUT file name.
  8633. Currently supported formats:
  8634. @table @samp
  8635. @item 3dl
  8636. AfterEffects
  8637. @item cube
  8638. Iridas
  8639. @item dat
  8640. DaVinci
  8641. @item m3d
  8642. Pandora
  8643. @end table
  8644. @item interp
  8645. Select interpolation mode.
  8646. Available values are:
  8647. @table @samp
  8648. @item nearest
  8649. Use values from the nearest defined point.
  8650. @item trilinear
  8651. Interpolate values using the 8 points defining a cube.
  8652. @item tetrahedral
  8653. Interpolate values using a tetrahedron.
  8654. @end table
  8655. @end table
  8656. This filter also supports the @ref{framesync} options.
  8657. @section lumakey
  8658. Turn certain luma values into transparency.
  8659. The filter accepts the following options:
  8660. @table @option
  8661. @item threshold
  8662. Set the luma which will be used as base for transparency.
  8663. Default value is @code{0}.
  8664. @item tolerance
  8665. Set the range of luma values to be keyed out.
  8666. Default value is @code{0}.
  8667. @item softness
  8668. Set the range of softness. Default value is @code{0}.
  8669. Use this to control gradual transition from zero to full transparency.
  8670. @end table
  8671. @section lut, lutrgb, lutyuv
  8672. Compute a look-up table for binding each pixel component input value
  8673. to an output value, and apply it to the input video.
  8674. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8675. to an RGB input video.
  8676. These filters accept the following parameters:
  8677. @table @option
  8678. @item c0
  8679. set first pixel component expression
  8680. @item c1
  8681. set second pixel component expression
  8682. @item c2
  8683. set third pixel component expression
  8684. @item c3
  8685. set fourth pixel component expression, corresponds to the alpha component
  8686. @item r
  8687. set red component expression
  8688. @item g
  8689. set green component expression
  8690. @item b
  8691. set blue component expression
  8692. @item a
  8693. alpha component expression
  8694. @item y
  8695. set Y/luminance component expression
  8696. @item u
  8697. set U/Cb component expression
  8698. @item v
  8699. set V/Cr component expression
  8700. @end table
  8701. Each of them specifies the expression to use for computing the lookup table for
  8702. the corresponding pixel component values.
  8703. The exact component associated to each of the @var{c*} options depends on the
  8704. format in input.
  8705. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8706. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8707. The expressions can contain the following constants and functions:
  8708. @table @option
  8709. @item w
  8710. @item h
  8711. The input width and height.
  8712. @item val
  8713. The input value for the pixel component.
  8714. @item clipval
  8715. The input value, clipped to the @var{minval}-@var{maxval} range.
  8716. @item maxval
  8717. The maximum value for the pixel component.
  8718. @item minval
  8719. The minimum value for the pixel component.
  8720. @item negval
  8721. The negated value for the pixel component value, clipped to the
  8722. @var{minval}-@var{maxval} range; it corresponds to the expression
  8723. "maxval-clipval+minval".
  8724. @item clip(val)
  8725. The computed value in @var{val}, clipped to the
  8726. @var{minval}-@var{maxval} range.
  8727. @item gammaval(gamma)
  8728. The computed gamma correction value of the pixel component value,
  8729. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8730. expression
  8731. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8732. @end table
  8733. All expressions default to "val".
  8734. @subsection Examples
  8735. @itemize
  8736. @item
  8737. Negate input video:
  8738. @example
  8739. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8740. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8741. @end example
  8742. The above is the same as:
  8743. @example
  8744. lutrgb="r=negval:g=negval:b=negval"
  8745. lutyuv="y=negval:u=negval:v=negval"
  8746. @end example
  8747. @item
  8748. Negate luminance:
  8749. @example
  8750. lutyuv=y=negval
  8751. @end example
  8752. @item
  8753. Remove chroma components, turning the video into a graytone image:
  8754. @example
  8755. lutyuv="u=128:v=128"
  8756. @end example
  8757. @item
  8758. Apply a luma burning effect:
  8759. @example
  8760. lutyuv="y=2*val"
  8761. @end example
  8762. @item
  8763. Remove green and blue components:
  8764. @example
  8765. lutrgb="g=0:b=0"
  8766. @end example
  8767. @item
  8768. Set a constant alpha channel value on input:
  8769. @example
  8770. format=rgba,lutrgb=a="maxval-minval/2"
  8771. @end example
  8772. @item
  8773. Correct luminance gamma by a factor of 0.5:
  8774. @example
  8775. lutyuv=y=gammaval(0.5)
  8776. @end example
  8777. @item
  8778. Discard least significant bits of luma:
  8779. @example
  8780. lutyuv=y='bitand(val, 128+64+32)'
  8781. @end example
  8782. @item
  8783. Technicolor like effect:
  8784. @example
  8785. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8786. @end example
  8787. @end itemize
  8788. @section lut2, tlut2
  8789. The @code{lut2} filter takes two input streams and outputs one
  8790. stream.
  8791. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8792. from one single stream.
  8793. This filter accepts the following parameters:
  8794. @table @option
  8795. @item c0
  8796. set first pixel component expression
  8797. @item c1
  8798. set second pixel component expression
  8799. @item c2
  8800. set third pixel component expression
  8801. @item c3
  8802. set fourth pixel component expression, corresponds to the alpha component
  8803. @end table
  8804. Each of them specifies the expression to use for computing the lookup table for
  8805. the corresponding pixel component values.
  8806. The exact component associated to each of the @var{c*} options depends on the
  8807. format in inputs.
  8808. The expressions can contain the following constants:
  8809. @table @option
  8810. @item w
  8811. @item h
  8812. The input width and height.
  8813. @item x
  8814. The first input value for the pixel component.
  8815. @item y
  8816. The second input value for the pixel component.
  8817. @item bdx
  8818. The first input video bit depth.
  8819. @item bdy
  8820. The second input video bit depth.
  8821. @end table
  8822. All expressions default to "x".
  8823. @subsection Examples
  8824. @itemize
  8825. @item
  8826. Highlight differences between two RGB video streams:
  8827. @example
  8828. 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)'
  8829. @end example
  8830. @item
  8831. Highlight differences between two YUV video streams:
  8832. @example
  8833. 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)'
  8834. @end example
  8835. @item
  8836. Show max difference between two video streams:
  8837. @example
  8838. 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)))'
  8839. @end example
  8840. @end itemize
  8841. @section maskedclamp
  8842. Clamp the first input stream with the second input and third input stream.
  8843. Returns the value of first stream to be between second input
  8844. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8845. This filter accepts the following options:
  8846. @table @option
  8847. @item undershoot
  8848. Default value is @code{0}.
  8849. @item overshoot
  8850. Default value is @code{0}.
  8851. @item planes
  8852. Set which planes will be processed as bitmap, unprocessed planes will be
  8853. copied from first stream.
  8854. By default value 0xf, all planes will be processed.
  8855. @end table
  8856. @section maskedmerge
  8857. Merge the first input stream with the second input stream using per pixel
  8858. weights in the third input stream.
  8859. A value of 0 in the third stream pixel component means that pixel component
  8860. from first stream is returned unchanged, while maximum value (eg. 255 for
  8861. 8-bit videos) means that pixel component from second stream is returned
  8862. unchanged. Intermediate values define the amount of merging between both
  8863. input stream's pixel components.
  8864. This filter accepts the following options:
  8865. @table @option
  8866. @item planes
  8867. Set which planes will be processed as bitmap, unprocessed planes will be
  8868. copied from first stream.
  8869. By default value 0xf, all planes will be processed.
  8870. @end table
  8871. @section mcdeint
  8872. Apply motion-compensation deinterlacing.
  8873. It needs one field per frame as input and must thus be used together
  8874. with yadif=1/3 or equivalent.
  8875. This filter accepts the following options:
  8876. @table @option
  8877. @item mode
  8878. Set the deinterlacing mode.
  8879. It accepts one of the following values:
  8880. @table @samp
  8881. @item fast
  8882. @item medium
  8883. @item slow
  8884. use iterative motion estimation
  8885. @item extra_slow
  8886. like @samp{slow}, but use multiple reference frames.
  8887. @end table
  8888. Default value is @samp{fast}.
  8889. @item parity
  8890. Set the picture field parity assumed for the input video. It must be
  8891. one of the following values:
  8892. @table @samp
  8893. @item 0, tff
  8894. assume top field first
  8895. @item 1, bff
  8896. assume bottom field first
  8897. @end table
  8898. Default value is @samp{bff}.
  8899. @item qp
  8900. Set per-block quantization parameter (QP) used by the internal
  8901. encoder.
  8902. Higher values should result in a smoother motion vector field but less
  8903. optimal individual vectors. Default value is 1.
  8904. @end table
  8905. @section mergeplanes
  8906. Merge color channel components from several video streams.
  8907. The filter accepts up to 4 input streams, and merge selected input
  8908. planes to the output video.
  8909. This filter accepts the following options:
  8910. @table @option
  8911. @item mapping
  8912. Set input to output plane mapping. Default is @code{0}.
  8913. The mappings is specified as a bitmap. It should be specified as a
  8914. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8915. mapping for the first plane of the output stream. 'A' sets the number of
  8916. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8917. corresponding input to use (from 0 to 3). The rest of the mappings is
  8918. similar, 'Bb' describes the mapping for the output stream second
  8919. plane, 'Cc' describes the mapping for the output stream third plane and
  8920. 'Dd' describes the mapping for the output stream fourth plane.
  8921. @item format
  8922. Set output pixel format. Default is @code{yuva444p}.
  8923. @end table
  8924. @subsection Examples
  8925. @itemize
  8926. @item
  8927. Merge three gray video streams of same width and height into single video stream:
  8928. @example
  8929. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8930. @end example
  8931. @item
  8932. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8933. @example
  8934. [a0][a1]mergeplanes=0x00010210:yuva444p
  8935. @end example
  8936. @item
  8937. Swap Y and A plane in yuva444p stream:
  8938. @example
  8939. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8940. @end example
  8941. @item
  8942. Swap U and V plane in yuv420p stream:
  8943. @example
  8944. format=yuv420p,mergeplanes=0x000201:yuv420p
  8945. @end example
  8946. @item
  8947. Cast a rgb24 clip to yuv444p:
  8948. @example
  8949. format=rgb24,mergeplanes=0x000102:yuv444p
  8950. @end example
  8951. @end itemize
  8952. @section mestimate
  8953. Estimate and export motion vectors using block matching algorithms.
  8954. Motion vectors are stored in frame side data to be used by other filters.
  8955. This filter accepts the following options:
  8956. @table @option
  8957. @item method
  8958. Specify the motion estimation method. Accepts one of the following values:
  8959. @table @samp
  8960. @item esa
  8961. Exhaustive search algorithm.
  8962. @item tss
  8963. Three step search algorithm.
  8964. @item tdls
  8965. Two dimensional logarithmic search algorithm.
  8966. @item ntss
  8967. New three step search algorithm.
  8968. @item fss
  8969. Four step search algorithm.
  8970. @item ds
  8971. Diamond search algorithm.
  8972. @item hexbs
  8973. Hexagon-based search algorithm.
  8974. @item epzs
  8975. Enhanced predictive zonal search algorithm.
  8976. @item umh
  8977. Uneven multi-hexagon search algorithm.
  8978. @end table
  8979. Default value is @samp{esa}.
  8980. @item mb_size
  8981. Macroblock size. Default @code{16}.
  8982. @item search_param
  8983. Search parameter. Default @code{7}.
  8984. @end table
  8985. @section midequalizer
  8986. Apply Midway Image Equalization effect using two video streams.
  8987. Midway Image Equalization adjusts a pair of images to have the same
  8988. histogram, while maintaining their dynamics as much as possible. It's
  8989. useful for e.g. matching exposures from a pair of stereo cameras.
  8990. This filter has two inputs and one output, which must be of same pixel format, but
  8991. may be of different sizes. The output of filter is first input adjusted with
  8992. midway histogram of both inputs.
  8993. This filter accepts the following option:
  8994. @table @option
  8995. @item planes
  8996. Set which planes to process. Default is @code{15}, which is all available planes.
  8997. @end table
  8998. @section minterpolate
  8999. Convert the video to specified frame rate using motion interpolation.
  9000. This filter accepts the following options:
  9001. @table @option
  9002. @item fps
  9003. 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}.
  9004. @item mi_mode
  9005. Motion interpolation mode. Following values are accepted:
  9006. @table @samp
  9007. @item dup
  9008. Duplicate previous or next frame for interpolating new ones.
  9009. @item blend
  9010. Blend source frames. Interpolated frame is mean of previous and next frames.
  9011. @item mci
  9012. Motion compensated interpolation. Following options are effective when this mode is selected:
  9013. @table @samp
  9014. @item mc_mode
  9015. Motion compensation mode. Following values are accepted:
  9016. @table @samp
  9017. @item obmc
  9018. Overlapped block motion compensation.
  9019. @item aobmc
  9020. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9021. @end table
  9022. Default mode is @samp{obmc}.
  9023. @item me_mode
  9024. Motion estimation mode. Following values are accepted:
  9025. @table @samp
  9026. @item bidir
  9027. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9028. @item bilat
  9029. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9030. @end table
  9031. Default mode is @samp{bilat}.
  9032. @item me
  9033. The algorithm to be used for motion estimation. Following values are accepted:
  9034. @table @samp
  9035. @item esa
  9036. Exhaustive search algorithm.
  9037. @item tss
  9038. Three step search algorithm.
  9039. @item tdls
  9040. Two dimensional logarithmic search algorithm.
  9041. @item ntss
  9042. New three step search algorithm.
  9043. @item fss
  9044. Four step search algorithm.
  9045. @item ds
  9046. Diamond search algorithm.
  9047. @item hexbs
  9048. Hexagon-based search algorithm.
  9049. @item epzs
  9050. Enhanced predictive zonal search algorithm.
  9051. @item umh
  9052. Uneven multi-hexagon search algorithm.
  9053. @end table
  9054. Default algorithm is @samp{epzs}.
  9055. @item mb_size
  9056. Macroblock size. Default @code{16}.
  9057. @item search_param
  9058. Motion estimation search parameter. Default @code{32}.
  9059. @item vsbmc
  9060. 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).
  9061. @end table
  9062. @end table
  9063. @item scd
  9064. 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:
  9065. @table @samp
  9066. @item none
  9067. Disable scene change detection.
  9068. @item fdiff
  9069. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9070. @end table
  9071. Default method is @samp{fdiff}.
  9072. @item scd_threshold
  9073. Scene change detection threshold. Default is @code{5.0}.
  9074. @end table
  9075. @section mix
  9076. Mix several video input streams into one video stream.
  9077. A description of the accepted options follows.
  9078. @table @option
  9079. @item nb_inputs
  9080. The number of inputs. If unspecified, it defaults to 2.
  9081. @item weights
  9082. Specify weight of each input video stream as sequence.
  9083. Each weight is separated by space. If number of weights
  9084. is smaller than number of @var{frames} last specified
  9085. weight will be used for all remaining unset weights.
  9086. @item scale
  9087. Specify scale, if it is set it will be multiplied with sum
  9088. of each weight multiplied with pixel values to give final destination
  9089. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9090. @item duration
  9091. Specify how end of stream is determined.
  9092. @table @samp
  9093. @item longest
  9094. The duration of the longest input. (default)
  9095. @item shortest
  9096. The duration of the shortest input.
  9097. @item first
  9098. The duration of the first input.
  9099. @end table
  9100. @end table
  9101. @section mpdecimate
  9102. Drop frames that do not differ greatly from the previous frame in
  9103. order to reduce frame rate.
  9104. The main use of this filter is for very-low-bitrate encoding
  9105. (e.g. streaming over dialup modem), but it could in theory be used for
  9106. fixing movies that were inverse-telecined incorrectly.
  9107. A description of the accepted options follows.
  9108. @table @option
  9109. @item max
  9110. Set the maximum number of consecutive frames which can be dropped (if
  9111. positive), or the minimum interval between dropped frames (if
  9112. negative). If the value is 0, the frame is dropped disregarding the
  9113. number of previous sequentially dropped frames.
  9114. Default value is 0.
  9115. @item hi
  9116. @item lo
  9117. @item frac
  9118. Set the dropping threshold values.
  9119. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9120. represent actual pixel value differences, so a threshold of 64
  9121. corresponds to 1 unit of difference for each pixel, or the same spread
  9122. out differently over the block.
  9123. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9124. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9125. meaning the whole image) differ by more than a threshold of @option{lo}.
  9126. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9127. 64*5, and default value for @option{frac} is 0.33.
  9128. @end table
  9129. @section negate
  9130. Negate (invert) the input video.
  9131. It accepts the following option:
  9132. @table @option
  9133. @item negate_alpha
  9134. With value 1, it negates the alpha component, if present. Default value is 0.
  9135. @end table
  9136. @anchor{nlmeans}
  9137. @section nlmeans
  9138. Denoise frames using Non-Local Means algorithm.
  9139. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9140. context similarity is defined by comparing their surrounding patches of size
  9141. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9142. around the pixel.
  9143. Note that the research area defines centers for patches, which means some
  9144. patches will be made of pixels outside that research area.
  9145. The filter accepts the following options.
  9146. @table @option
  9147. @item s
  9148. Set denoising strength.
  9149. @item p
  9150. Set patch size.
  9151. @item pc
  9152. Same as @option{p} but for chroma planes.
  9153. The default value is @var{0} and means automatic.
  9154. @item r
  9155. Set research size.
  9156. @item rc
  9157. Same as @option{r} but for chroma planes.
  9158. The default value is @var{0} and means automatic.
  9159. @end table
  9160. @section nnedi
  9161. Deinterlace video using neural network edge directed interpolation.
  9162. This filter accepts the following options:
  9163. @table @option
  9164. @item weights
  9165. Mandatory option, without binary file filter can not work.
  9166. Currently file can be found here:
  9167. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9168. @item deint
  9169. Set which frames to deinterlace, by default it is @code{all}.
  9170. Can be @code{all} or @code{interlaced}.
  9171. @item field
  9172. Set mode of operation.
  9173. Can be one of the following:
  9174. @table @samp
  9175. @item af
  9176. Use frame flags, both fields.
  9177. @item a
  9178. Use frame flags, single field.
  9179. @item t
  9180. Use top field only.
  9181. @item b
  9182. Use bottom field only.
  9183. @item tf
  9184. Use both fields, top first.
  9185. @item bf
  9186. Use both fields, bottom first.
  9187. @end table
  9188. @item planes
  9189. Set which planes to process, by default filter process all frames.
  9190. @item nsize
  9191. Set size of local neighborhood around each pixel, used by the predictor neural
  9192. network.
  9193. Can be one of the following:
  9194. @table @samp
  9195. @item s8x6
  9196. @item s16x6
  9197. @item s32x6
  9198. @item s48x6
  9199. @item s8x4
  9200. @item s16x4
  9201. @item s32x4
  9202. @end table
  9203. @item nns
  9204. Set the number of neurons in predictor neural network.
  9205. Can be one of the following:
  9206. @table @samp
  9207. @item n16
  9208. @item n32
  9209. @item n64
  9210. @item n128
  9211. @item n256
  9212. @end table
  9213. @item qual
  9214. Controls the number of different neural network predictions that are blended
  9215. together to compute the final output value. Can be @code{fast}, default or
  9216. @code{slow}.
  9217. @item etype
  9218. Set which set of weights to use in the predictor.
  9219. Can be one of the following:
  9220. @table @samp
  9221. @item a
  9222. weights trained to minimize absolute error
  9223. @item s
  9224. weights trained to minimize squared error
  9225. @end table
  9226. @item pscrn
  9227. Controls whether or not the prescreener neural network is used to decide
  9228. which pixels should be processed by the predictor neural network and which
  9229. can be handled by simple cubic interpolation.
  9230. The prescreener is trained to know whether cubic interpolation will be
  9231. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9232. The computational complexity of the prescreener nn is much less than that of
  9233. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9234. using the prescreener generally results in much faster processing.
  9235. The prescreener is pretty accurate, so the difference between using it and not
  9236. using it is almost always unnoticeable.
  9237. Can be one of the following:
  9238. @table @samp
  9239. @item none
  9240. @item original
  9241. @item new
  9242. @end table
  9243. Default is @code{new}.
  9244. @item fapprox
  9245. Set various debugging flags.
  9246. @end table
  9247. @section noformat
  9248. Force libavfilter not to use any of the specified pixel formats for the
  9249. input to the next filter.
  9250. It accepts the following parameters:
  9251. @table @option
  9252. @item pix_fmts
  9253. A '|'-separated list of pixel format names, such as
  9254. pix_fmts=yuv420p|monow|rgb24".
  9255. @end table
  9256. @subsection Examples
  9257. @itemize
  9258. @item
  9259. Force libavfilter to use a format different from @var{yuv420p} for the
  9260. input to the vflip filter:
  9261. @example
  9262. noformat=pix_fmts=yuv420p,vflip
  9263. @end example
  9264. @item
  9265. Convert the input video to any of the formats not contained in the list:
  9266. @example
  9267. noformat=yuv420p|yuv444p|yuv410p
  9268. @end example
  9269. @end itemize
  9270. @section noise
  9271. Add noise on video input frame.
  9272. The filter accepts the following options:
  9273. @table @option
  9274. @item all_seed
  9275. @item c0_seed
  9276. @item c1_seed
  9277. @item c2_seed
  9278. @item c3_seed
  9279. Set noise seed for specific pixel component or all pixel components in case
  9280. of @var{all_seed}. Default value is @code{123457}.
  9281. @item all_strength, alls
  9282. @item c0_strength, c0s
  9283. @item c1_strength, c1s
  9284. @item c2_strength, c2s
  9285. @item c3_strength, c3s
  9286. Set noise strength for specific pixel component or all pixel components in case
  9287. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9288. @item all_flags, allf
  9289. @item c0_flags, c0f
  9290. @item c1_flags, c1f
  9291. @item c2_flags, c2f
  9292. @item c3_flags, c3f
  9293. Set pixel component flags or set flags for all components if @var{all_flags}.
  9294. Available values for component flags are:
  9295. @table @samp
  9296. @item a
  9297. averaged temporal noise (smoother)
  9298. @item p
  9299. mix random noise with a (semi)regular pattern
  9300. @item t
  9301. temporal noise (noise pattern changes between frames)
  9302. @item u
  9303. uniform noise (gaussian otherwise)
  9304. @end table
  9305. @end table
  9306. @subsection Examples
  9307. Add temporal and uniform noise to input video:
  9308. @example
  9309. noise=alls=20:allf=t+u
  9310. @end example
  9311. @section normalize
  9312. Normalize RGB video (aka histogram stretching, contrast stretching).
  9313. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9314. For each channel of each frame, the filter computes the input range and maps
  9315. it linearly to the user-specified output range. The output range defaults
  9316. to the full dynamic range from pure black to pure white.
  9317. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9318. changes in brightness) caused when small dark or bright objects enter or leave
  9319. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9320. video camera, and, like a video camera, it may cause a period of over- or
  9321. under-exposure of the video.
  9322. The R,G,B channels can be normalized independently, which may cause some
  9323. color shifting, or linked together as a single channel, which prevents
  9324. color shifting. Linked normalization preserves hue. Independent normalization
  9325. does not, so it can be used to remove some color casts. Independent and linked
  9326. normalization can be combined in any ratio.
  9327. The normalize filter accepts the following options:
  9328. @table @option
  9329. @item blackpt
  9330. @item whitept
  9331. Colors which define the output range. The minimum input value is mapped to
  9332. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9333. The defaults are black and white respectively. Specifying white for
  9334. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9335. normalized video. Shades of grey can be used to reduce the dynamic range
  9336. (contrast). Specifying saturated colors here can create some interesting
  9337. effects.
  9338. @item smoothing
  9339. The number of previous frames to use for temporal smoothing. The input range
  9340. of each channel is smoothed using a rolling average over the current frame
  9341. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9342. smoothing).
  9343. @item independence
  9344. Controls the ratio of independent (color shifting) channel normalization to
  9345. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9346. independent. Defaults to 1.0 (fully independent).
  9347. @item strength
  9348. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9349. expensive no-op. Defaults to 1.0 (full strength).
  9350. @end table
  9351. @subsection Examples
  9352. Stretch video contrast to use the full dynamic range, with no temporal
  9353. smoothing; may flicker depending on the source content:
  9354. @example
  9355. normalize=blackpt=black:whitept=white:smoothing=0
  9356. @end example
  9357. As above, but with 50 frames of temporal smoothing; flicker should be
  9358. reduced, depending on the source content:
  9359. @example
  9360. normalize=blackpt=black:whitept=white:smoothing=50
  9361. @end example
  9362. As above, but with hue-preserving linked channel normalization:
  9363. @example
  9364. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9365. @end example
  9366. As above, but with half strength:
  9367. @example
  9368. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9369. @end example
  9370. Map the darkest input color to red, the brightest input color to cyan:
  9371. @example
  9372. normalize=blackpt=red:whitept=cyan
  9373. @end example
  9374. @section null
  9375. Pass the video source unchanged to the output.
  9376. @section ocr
  9377. Optical Character Recognition
  9378. This filter uses Tesseract for optical character recognition. To enable
  9379. compilation of this filter, you need to configure FFmpeg with
  9380. @code{--enable-libtesseract}.
  9381. It accepts the following options:
  9382. @table @option
  9383. @item datapath
  9384. Set datapath to tesseract data. Default is to use whatever was
  9385. set at installation.
  9386. @item language
  9387. Set language, default is "eng".
  9388. @item whitelist
  9389. Set character whitelist.
  9390. @item blacklist
  9391. Set character blacklist.
  9392. @end table
  9393. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9394. @section ocv
  9395. Apply a video transform using libopencv.
  9396. To enable this filter, install the libopencv library and headers and
  9397. configure FFmpeg with @code{--enable-libopencv}.
  9398. It accepts the following parameters:
  9399. @table @option
  9400. @item filter_name
  9401. The name of the libopencv filter to apply.
  9402. @item filter_params
  9403. The parameters to pass to the libopencv filter. If not specified, the default
  9404. values are assumed.
  9405. @end table
  9406. Refer to the official libopencv documentation for more precise
  9407. information:
  9408. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9409. Several libopencv filters are supported; see the following subsections.
  9410. @anchor{dilate}
  9411. @subsection dilate
  9412. Dilate an image by using a specific structuring element.
  9413. It corresponds to the libopencv function @code{cvDilate}.
  9414. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9415. @var{struct_el} represents a structuring element, and has the syntax:
  9416. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9417. @var{cols} and @var{rows} represent the number of columns and rows of
  9418. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9419. point, and @var{shape} the shape for the structuring element. @var{shape}
  9420. must be "rect", "cross", "ellipse", or "custom".
  9421. If the value for @var{shape} is "custom", it must be followed by a
  9422. string of the form "=@var{filename}". The file with name
  9423. @var{filename} is assumed to represent a binary image, with each
  9424. printable character corresponding to a bright pixel. When a custom
  9425. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9426. or columns and rows of the read file are assumed instead.
  9427. The default value for @var{struct_el} is "3x3+0x0/rect".
  9428. @var{nb_iterations} specifies the number of times the transform is
  9429. applied to the image, and defaults to 1.
  9430. Some examples:
  9431. @example
  9432. # Use the default values
  9433. ocv=dilate
  9434. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9435. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9436. # Read the shape from the file diamond.shape, iterating two times.
  9437. # The file diamond.shape may contain a pattern of characters like this
  9438. # *
  9439. # ***
  9440. # *****
  9441. # ***
  9442. # *
  9443. # The specified columns and rows are ignored
  9444. # but the anchor point coordinates are not
  9445. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9446. @end example
  9447. @subsection erode
  9448. Erode an image by using a specific structuring element.
  9449. It corresponds to the libopencv function @code{cvErode}.
  9450. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9451. with the same syntax and semantics as the @ref{dilate} filter.
  9452. @subsection smooth
  9453. Smooth the input video.
  9454. The filter takes the following parameters:
  9455. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9456. @var{type} is the type of smooth filter to apply, and must be one of
  9457. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9458. or "bilateral". The default value is "gaussian".
  9459. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9460. depend on the smooth type. @var{param1} and
  9461. @var{param2} accept integer positive values or 0. @var{param3} and
  9462. @var{param4} accept floating point values.
  9463. The default value for @var{param1} is 3. The default value for the
  9464. other parameters is 0.
  9465. These parameters correspond to the parameters assigned to the
  9466. libopencv function @code{cvSmooth}.
  9467. @section oscilloscope
  9468. 2D Video Oscilloscope.
  9469. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9470. It accepts the following parameters:
  9471. @table @option
  9472. @item x
  9473. Set scope center x position.
  9474. @item y
  9475. Set scope center y position.
  9476. @item s
  9477. Set scope size, relative to frame diagonal.
  9478. @item t
  9479. Set scope tilt/rotation.
  9480. @item o
  9481. Set trace opacity.
  9482. @item tx
  9483. Set trace center x position.
  9484. @item ty
  9485. Set trace center y position.
  9486. @item tw
  9487. Set trace width, relative to width of frame.
  9488. @item th
  9489. Set trace height, relative to height of frame.
  9490. @item c
  9491. Set which components to trace. By default it traces first three components.
  9492. @item g
  9493. Draw trace grid. By default is enabled.
  9494. @item st
  9495. Draw some statistics. By default is enabled.
  9496. @item sc
  9497. Draw scope. By default is enabled.
  9498. @end table
  9499. @subsection Examples
  9500. @itemize
  9501. @item
  9502. Inspect full first row of video frame.
  9503. @example
  9504. oscilloscope=x=0.5:y=0:s=1
  9505. @end example
  9506. @item
  9507. Inspect full last row of video frame.
  9508. @example
  9509. oscilloscope=x=0.5:y=1:s=1
  9510. @end example
  9511. @item
  9512. Inspect full 5th line of video frame of height 1080.
  9513. @example
  9514. oscilloscope=x=0.5:y=5/1080:s=1
  9515. @end example
  9516. @item
  9517. Inspect full last column of video frame.
  9518. @example
  9519. oscilloscope=x=1:y=0.5:s=1:t=1
  9520. @end example
  9521. @end itemize
  9522. @anchor{overlay}
  9523. @section overlay
  9524. Overlay one video on top of another.
  9525. It takes two inputs and has one output. The first input is the "main"
  9526. video on which the second input is overlaid.
  9527. It accepts the following parameters:
  9528. A description of the accepted options follows.
  9529. @table @option
  9530. @item x
  9531. @item y
  9532. Set the expression for the x and y coordinates of the overlaid video
  9533. on the main video. Default value is "0" for both expressions. In case
  9534. the expression is invalid, it is set to a huge value (meaning that the
  9535. overlay will not be displayed within the output visible area).
  9536. @item eof_action
  9537. See @ref{framesync}.
  9538. @item eval
  9539. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9540. It accepts the following values:
  9541. @table @samp
  9542. @item init
  9543. only evaluate expressions once during the filter initialization or
  9544. when a command is processed
  9545. @item frame
  9546. evaluate expressions for each incoming frame
  9547. @end table
  9548. Default value is @samp{frame}.
  9549. @item shortest
  9550. See @ref{framesync}.
  9551. @item format
  9552. Set the format for the output video.
  9553. It accepts the following values:
  9554. @table @samp
  9555. @item yuv420
  9556. force YUV420 output
  9557. @item yuv422
  9558. force YUV422 output
  9559. @item yuv444
  9560. force YUV444 output
  9561. @item rgb
  9562. force packed RGB output
  9563. @item gbrp
  9564. force planar RGB output
  9565. @item auto
  9566. automatically pick format
  9567. @end table
  9568. Default value is @samp{yuv420}.
  9569. @item repeatlast
  9570. See @ref{framesync}.
  9571. @item alpha
  9572. Set format of alpha of the overlaid video, it can be @var{straight} or
  9573. @var{premultiplied}. Default is @var{straight}.
  9574. @end table
  9575. The @option{x}, and @option{y} expressions can contain the following
  9576. parameters.
  9577. @table @option
  9578. @item main_w, W
  9579. @item main_h, H
  9580. The main input width and height.
  9581. @item overlay_w, w
  9582. @item overlay_h, h
  9583. The overlay input width and height.
  9584. @item x
  9585. @item y
  9586. The computed values for @var{x} and @var{y}. They are evaluated for
  9587. each new frame.
  9588. @item hsub
  9589. @item vsub
  9590. horizontal and vertical chroma subsample values of the output
  9591. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9592. @var{vsub} is 1.
  9593. @item n
  9594. the number of input frame, starting from 0
  9595. @item pos
  9596. the position in the file of the input frame, NAN if unknown
  9597. @item t
  9598. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9599. @end table
  9600. This filter also supports the @ref{framesync} options.
  9601. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9602. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9603. when @option{eval} is set to @samp{init}.
  9604. Be aware that frames are taken from each input video in timestamp
  9605. order, hence, if their initial timestamps differ, it is a good idea
  9606. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9607. have them begin in the same zero timestamp, as the example for
  9608. the @var{movie} filter does.
  9609. You can chain together more overlays but you should test the
  9610. efficiency of such approach.
  9611. @subsection Commands
  9612. This filter supports the following commands:
  9613. @table @option
  9614. @item x
  9615. @item y
  9616. Modify the x and y of the overlay input.
  9617. The command accepts the same syntax of the corresponding option.
  9618. If the specified expression is not valid, it is kept at its current
  9619. value.
  9620. @end table
  9621. @subsection Examples
  9622. @itemize
  9623. @item
  9624. Draw the overlay at 10 pixels from the bottom right corner of the main
  9625. video:
  9626. @example
  9627. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9628. @end example
  9629. Using named options the example above becomes:
  9630. @example
  9631. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9632. @end example
  9633. @item
  9634. Insert a transparent PNG logo in the bottom left corner of the input,
  9635. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9636. @example
  9637. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9638. @end example
  9639. @item
  9640. Insert 2 different transparent PNG logos (second logo on bottom
  9641. right corner) using the @command{ffmpeg} tool:
  9642. @example
  9643. 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
  9644. @end example
  9645. @item
  9646. Add a transparent color layer on top of the main video; @code{WxH}
  9647. must specify the size of the main input to the overlay filter:
  9648. @example
  9649. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9650. @end example
  9651. @item
  9652. Play an original video and a filtered version (here with the deshake
  9653. filter) side by side using the @command{ffplay} tool:
  9654. @example
  9655. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9656. @end example
  9657. The above command is the same as:
  9658. @example
  9659. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9660. @end example
  9661. @item
  9662. Make a sliding overlay appearing from the left to the right top part of the
  9663. screen starting since time 2:
  9664. @example
  9665. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9666. @end example
  9667. @item
  9668. Compose output by putting two input videos side to side:
  9669. @example
  9670. ffmpeg -i left.avi -i right.avi -filter_complex "
  9671. nullsrc=size=200x100 [background];
  9672. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9673. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9674. [background][left] overlay=shortest=1 [background+left];
  9675. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9676. "
  9677. @end example
  9678. @item
  9679. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9680. @example
  9681. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9682. -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]'
  9683. masked.avi
  9684. @end example
  9685. @item
  9686. Chain several overlays in cascade:
  9687. @example
  9688. nullsrc=s=200x200 [bg];
  9689. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9690. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9691. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9692. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9693. [in3] null, [mid2] overlay=100:100 [out0]
  9694. @end example
  9695. @end itemize
  9696. @section owdenoise
  9697. Apply Overcomplete Wavelet denoiser.
  9698. The filter accepts the following options:
  9699. @table @option
  9700. @item depth
  9701. Set depth.
  9702. Larger depth values will denoise lower frequency components more, but
  9703. slow down filtering.
  9704. Must be an int in the range 8-16, default is @code{8}.
  9705. @item luma_strength, ls
  9706. Set luma strength.
  9707. Must be a double value in the range 0-1000, default is @code{1.0}.
  9708. @item chroma_strength, cs
  9709. Set chroma strength.
  9710. Must be a double value in the range 0-1000, default is @code{1.0}.
  9711. @end table
  9712. @anchor{pad}
  9713. @section pad
  9714. Add paddings to the input image, and place the original input at the
  9715. provided @var{x}, @var{y} coordinates.
  9716. It accepts the following parameters:
  9717. @table @option
  9718. @item width, w
  9719. @item height, h
  9720. Specify an expression for the size of the output image with the
  9721. paddings added. If the value for @var{width} or @var{height} is 0, the
  9722. corresponding input size is used for the output.
  9723. The @var{width} expression can reference the value set by the
  9724. @var{height} expression, and vice versa.
  9725. The default value of @var{width} and @var{height} is 0.
  9726. @item x
  9727. @item y
  9728. Specify the offsets to place the input image at within the padded area,
  9729. with respect to the top/left border of the output image.
  9730. The @var{x} expression can reference the value set by the @var{y}
  9731. expression, and vice versa.
  9732. The default value of @var{x} and @var{y} is 0.
  9733. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9734. so the input image is centered on the padded area.
  9735. @item color
  9736. Specify the color of the padded area. For the syntax of this option,
  9737. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9738. manual,ffmpeg-utils}.
  9739. The default value of @var{color} is "black".
  9740. @item eval
  9741. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9742. It accepts the following values:
  9743. @table @samp
  9744. @item init
  9745. Only evaluate expressions once during the filter initialization or when
  9746. a command is processed.
  9747. @item frame
  9748. Evaluate expressions for each incoming frame.
  9749. @end table
  9750. Default value is @samp{init}.
  9751. @item aspect
  9752. Pad to aspect instead to a resolution.
  9753. @end table
  9754. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9755. options are expressions containing the following constants:
  9756. @table @option
  9757. @item in_w
  9758. @item in_h
  9759. The input video width and height.
  9760. @item iw
  9761. @item ih
  9762. These are the same as @var{in_w} and @var{in_h}.
  9763. @item out_w
  9764. @item out_h
  9765. The output width and height (the size of the padded area), as
  9766. specified by the @var{width} and @var{height} expressions.
  9767. @item ow
  9768. @item oh
  9769. These are the same as @var{out_w} and @var{out_h}.
  9770. @item x
  9771. @item y
  9772. The x and y offsets as specified by the @var{x} and @var{y}
  9773. expressions, or NAN if not yet specified.
  9774. @item a
  9775. same as @var{iw} / @var{ih}
  9776. @item sar
  9777. input sample aspect ratio
  9778. @item dar
  9779. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9780. @item hsub
  9781. @item vsub
  9782. The horizontal and vertical chroma subsample values. For example for the
  9783. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9784. @end table
  9785. @subsection Examples
  9786. @itemize
  9787. @item
  9788. Add paddings with the color "violet" to the input video. The output video
  9789. size is 640x480, and the top-left corner of the input video is placed at
  9790. column 0, row 40
  9791. @example
  9792. pad=640:480:0:40:violet
  9793. @end example
  9794. The example above is equivalent to the following command:
  9795. @example
  9796. pad=width=640:height=480:x=0:y=40:color=violet
  9797. @end example
  9798. @item
  9799. Pad the input to get an output with dimensions increased by 3/2,
  9800. and put the input video at the center of the padded area:
  9801. @example
  9802. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9803. @end example
  9804. @item
  9805. Pad the input to get a squared output with size equal to the maximum
  9806. value between the input width and height, and put the input video at
  9807. the center of the padded area:
  9808. @example
  9809. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9810. @end example
  9811. @item
  9812. Pad the input to get a final w/h ratio of 16:9:
  9813. @example
  9814. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9815. @end example
  9816. @item
  9817. In case of anamorphic video, in order to set the output display aspect
  9818. correctly, it is necessary to use @var{sar} in the expression,
  9819. according to the relation:
  9820. @example
  9821. (ih * X / ih) * sar = output_dar
  9822. X = output_dar / sar
  9823. @end example
  9824. Thus the previous example needs to be modified to:
  9825. @example
  9826. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9827. @end example
  9828. @item
  9829. Double the output size and put the input video in the bottom-right
  9830. corner of the output padded area:
  9831. @example
  9832. pad="2*iw:2*ih:ow-iw:oh-ih"
  9833. @end example
  9834. @end itemize
  9835. @anchor{palettegen}
  9836. @section palettegen
  9837. Generate one palette for a whole video stream.
  9838. It accepts the following options:
  9839. @table @option
  9840. @item max_colors
  9841. Set the maximum number of colors to quantize in the palette.
  9842. Note: the palette will still contain 256 colors; the unused palette entries
  9843. will be black.
  9844. @item reserve_transparent
  9845. Create a palette of 255 colors maximum and reserve the last one for
  9846. transparency. Reserving the transparency color is useful for GIF optimization.
  9847. If not set, the maximum of colors in the palette will be 256. You probably want
  9848. to disable this option for a standalone image.
  9849. Set by default.
  9850. @item transparency_color
  9851. Set the color that will be used as background for transparency.
  9852. @item stats_mode
  9853. Set statistics mode.
  9854. It accepts the following values:
  9855. @table @samp
  9856. @item full
  9857. Compute full frame histograms.
  9858. @item diff
  9859. Compute histograms only for the part that differs from previous frame. This
  9860. might be relevant to give more importance to the moving part of your input if
  9861. the background is static.
  9862. @item single
  9863. Compute new histogram for each frame.
  9864. @end table
  9865. Default value is @var{full}.
  9866. @end table
  9867. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9868. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9869. color quantization of the palette. This information is also visible at
  9870. @var{info} logging level.
  9871. @subsection Examples
  9872. @itemize
  9873. @item
  9874. Generate a representative palette of a given video using @command{ffmpeg}:
  9875. @example
  9876. ffmpeg -i input.mkv -vf palettegen palette.png
  9877. @end example
  9878. @end itemize
  9879. @section paletteuse
  9880. Use a palette to downsample an input video stream.
  9881. The filter takes two inputs: one video stream and a palette. The palette must
  9882. be a 256 pixels image.
  9883. It accepts the following options:
  9884. @table @option
  9885. @item dither
  9886. Select dithering mode. Available algorithms are:
  9887. @table @samp
  9888. @item bayer
  9889. Ordered 8x8 bayer dithering (deterministic)
  9890. @item heckbert
  9891. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9892. Note: this dithering is sometimes considered "wrong" and is included as a
  9893. reference.
  9894. @item floyd_steinberg
  9895. Floyd and Steingberg dithering (error diffusion)
  9896. @item sierra2
  9897. Frankie Sierra dithering v2 (error diffusion)
  9898. @item sierra2_4a
  9899. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9900. @end table
  9901. Default is @var{sierra2_4a}.
  9902. @item bayer_scale
  9903. When @var{bayer} dithering is selected, this option defines the scale of the
  9904. pattern (how much the crosshatch pattern is visible). A low value means more
  9905. visible pattern for less banding, and higher value means less visible pattern
  9906. at the cost of more banding.
  9907. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9908. @item diff_mode
  9909. If set, define the zone to process
  9910. @table @samp
  9911. @item rectangle
  9912. Only the changing rectangle will be reprocessed. This is similar to GIF
  9913. cropping/offsetting compression mechanism. This option can be useful for speed
  9914. if only a part of the image is changing, and has use cases such as limiting the
  9915. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9916. moving scene (it leads to more deterministic output if the scene doesn't change
  9917. much, and as a result less moving noise and better GIF compression).
  9918. @end table
  9919. Default is @var{none}.
  9920. @item new
  9921. Take new palette for each output frame.
  9922. @item alpha_threshold
  9923. Sets the alpha threshold for transparency. Alpha values above this threshold
  9924. will be treated as completely opaque, and values below this threshold will be
  9925. treated as completely transparent.
  9926. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9927. @end table
  9928. @subsection Examples
  9929. @itemize
  9930. @item
  9931. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9932. using @command{ffmpeg}:
  9933. @example
  9934. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9935. @end example
  9936. @end itemize
  9937. @section perspective
  9938. Correct perspective of video not recorded perpendicular to the screen.
  9939. A description of the accepted parameters follows.
  9940. @table @option
  9941. @item x0
  9942. @item y0
  9943. @item x1
  9944. @item y1
  9945. @item x2
  9946. @item y2
  9947. @item x3
  9948. @item y3
  9949. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9950. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9951. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9952. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9953. then the corners of the source will be sent to the specified coordinates.
  9954. The expressions can use the following variables:
  9955. @table @option
  9956. @item W
  9957. @item H
  9958. the width and height of video frame.
  9959. @item in
  9960. Input frame count.
  9961. @item on
  9962. Output frame count.
  9963. @end table
  9964. @item interpolation
  9965. Set interpolation for perspective correction.
  9966. It accepts the following values:
  9967. @table @samp
  9968. @item linear
  9969. @item cubic
  9970. @end table
  9971. Default value is @samp{linear}.
  9972. @item sense
  9973. Set interpretation of coordinate options.
  9974. It accepts the following values:
  9975. @table @samp
  9976. @item 0, source
  9977. Send point in the source specified by the given coordinates to
  9978. the corners of the destination.
  9979. @item 1, destination
  9980. Send the corners of the source to the point in the destination specified
  9981. by the given coordinates.
  9982. Default value is @samp{source}.
  9983. @end table
  9984. @item eval
  9985. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9986. It accepts the following values:
  9987. @table @samp
  9988. @item init
  9989. only evaluate expressions once during the filter initialization or
  9990. when a command is processed
  9991. @item frame
  9992. evaluate expressions for each incoming frame
  9993. @end table
  9994. Default value is @samp{init}.
  9995. @end table
  9996. @section phase
  9997. Delay interlaced video by one field time so that the field order changes.
  9998. The intended use is to fix PAL movies that have been captured with the
  9999. opposite field order to the film-to-video transfer.
  10000. A description of the accepted parameters follows.
  10001. @table @option
  10002. @item mode
  10003. Set phase mode.
  10004. It accepts the following values:
  10005. @table @samp
  10006. @item t
  10007. Capture field order top-first, transfer bottom-first.
  10008. Filter will delay the bottom field.
  10009. @item b
  10010. Capture field order bottom-first, transfer top-first.
  10011. Filter will delay the top field.
  10012. @item p
  10013. Capture and transfer with the same field order. This mode only exists
  10014. for the documentation of the other options to refer to, but if you
  10015. actually select it, the filter will faithfully do nothing.
  10016. @item a
  10017. Capture field order determined automatically by field flags, transfer
  10018. opposite.
  10019. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10020. basis using field flags. If no field information is available,
  10021. then this works just like @samp{u}.
  10022. @item u
  10023. Capture unknown or varying, transfer opposite.
  10024. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10025. analyzing the images and selecting the alternative that produces best
  10026. match between the fields.
  10027. @item T
  10028. Capture top-first, transfer unknown or varying.
  10029. Filter selects among @samp{t} and @samp{p} using image analysis.
  10030. @item B
  10031. Capture bottom-first, transfer unknown or varying.
  10032. Filter selects among @samp{b} and @samp{p} using image analysis.
  10033. @item A
  10034. Capture determined by field flags, transfer unknown or varying.
  10035. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10036. image analysis. If no field information is available, then this works just
  10037. like @samp{U}. This is the default mode.
  10038. @item U
  10039. Both capture and transfer unknown or varying.
  10040. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10041. @end table
  10042. @end table
  10043. @section pixdesctest
  10044. Pixel format descriptor test filter, mainly useful for internal
  10045. testing. The output video should be equal to the input video.
  10046. For example:
  10047. @example
  10048. format=monow, pixdesctest
  10049. @end example
  10050. can be used to test the monowhite pixel format descriptor definition.
  10051. @section pixscope
  10052. Display sample values of color channels. Mainly useful for checking color
  10053. and levels. Minimum supported resolution is 640x480.
  10054. The filters accept the following options:
  10055. @table @option
  10056. @item x
  10057. Set scope X position, relative offset on X axis.
  10058. @item y
  10059. Set scope Y position, relative offset on Y axis.
  10060. @item w
  10061. Set scope width.
  10062. @item h
  10063. Set scope height.
  10064. @item o
  10065. Set window opacity. This window also holds statistics about pixel area.
  10066. @item wx
  10067. Set window X position, relative offset on X axis.
  10068. @item wy
  10069. Set window Y position, relative offset on Y axis.
  10070. @end table
  10071. @section pp
  10072. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10073. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10074. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10075. Each subfilter and some options have a short and a long name that can be used
  10076. interchangeably, i.e. dr/dering are the same.
  10077. The filters accept the following options:
  10078. @table @option
  10079. @item subfilters
  10080. Set postprocessing subfilters string.
  10081. @end table
  10082. All subfilters share common options to determine their scope:
  10083. @table @option
  10084. @item a/autoq
  10085. Honor the quality commands for this subfilter.
  10086. @item c/chrom
  10087. Do chrominance filtering, too (default).
  10088. @item y/nochrom
  10089. Do luminance filtering only (no chrominance).
  10090. @item n/noluma
  10091. Do chrominance filtering only (no luminance).
  10092. @end table
  10093. These options can be appended after the subfilter name, separated by a '|'.
  10094. Available subfilters are:
  10095. @table @option
  10096. @item hb/hdeblock[|difference[|flatness]]
  10097. Horizontal deblocking filter
  10098. @table @option
  10099. @item difference
  10100. Difference factor where higher values mean more deblocking (default: @code{32}).
  10101. @item flatness
  10102. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10103. @end table
  10104. @item vb/vdeblock[|difference[|flatness]]
  10105. Vertical deblocking filter
  10106. @table @option
  10107. @item difference
  10108. Difference factor where higher values mean more deblocking (default: @code{32}).
  10109. @item flatness
  10110. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10111. @end table
  10112. @item ha/hadeblock[|difference[|flatness]]
  10113. Accurate horizontal deblocking filter
  10114. @table @option
  10115. @item difference
  10116. Difference factor where higher values mean more deblocking (default: @code{32}).
  10117. @item flatness
  10118. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10119. @end table
  10120. @item va/vadeblock[|difference[|flatness]]
  10121. Accurate vertical deblocking filter
  10122. @table @option
  10123. @item difference
  10124. Difference factor where higher values mean more deblocking (default: @code{32}).
  10125. @item flatness
  10126. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10127. @end table
  10128. @end table
  10129. The horizontal and vertical deblocking filters share the difference and
  10130. flatness values so you cannot set different horizontal and vertical
  10131. thresholds.
  10132. @table @option
  10133. @item h1/x1hdeblock
  10134. Experimental horizontal deblocking filter
  10135. @item v1/x1vdeblock
  10136. Experimental vertical deblocking filter
  10137. @item dr/dering
  10138. Deringing filter
  10139. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10140. @table @option
  10141. @item threshold1
  10142. larger -> stronger filtering
  10143. @item threshold2
  10144. larger -> stronger filtering
  10145. @item threshold3
  10146. larger -> stronger filtering
  10147. @end table
  10148. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10149. @table @option
  10150. @item f/fullyrange
  10151. Stretch luminance to @code{0-255}.
  10152. @end table
  10153. @item lb/linblenddeint
  10154. Linear blend deinterlacing filter that deinterlaces the given block by
  10155. filtering all lines with a @code{(1 2 1)} filter.
  10156. @item li/linipoldeint
  10157. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10158. linearly interpolating every second line.
  10159. @item ci/cubicipoldeint
  10160. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10161. cubically interpolating every second line.
  10162. @item md/mediandeint
  10163. Median deinterlacing filter that deinterlaces the given block by applying a
  10164. median filter to every second line.
  10165. @item fd/ffmpegdeint
  10166. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10167. second line with a @code{(-1 4 2 4 -1)} filter.
  10168. @item l5/lowpass5
  10169. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10170. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10171. @item fq/forceQuant[|quantizer]
  10172. Overrides the quantizer table from the input with the constant quantizer you
  10173. specify.
  10174. @table @option
  10175. @item quantizer
  10176. Quantizer to use
  10177. @end table
  10178. @item de/default
  10179. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10180. @item fa/fast
  10181. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10182. @item ac
  10183. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10184. @end table
  10185. @subsection Examples
  10186. @itemize
  10187. @item
  10188. Apply horizontal and vertical deblocking, deringing and automatic
  10189. brightness/contrast:
  10190. @example
  10191. pp=hb/vb/dr/al
  10192. @end example
  10193. @item
  10194. Apply default filters without brightness/contrast correction:
  10195. @example
  10196. pp=de/-al
  10197. @end example
  10198. @item
  10199. Apply default filters and temporal denoiser:
  10200. @example
  10201. pp=default/tmpnoise|1|2|3
  10202. @end example
  10203. @item
  10204. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10205. automatically depending on available CPU time:
  10206. @example
  10207. pp=hb|y/vb|a
  10208. @end example
  10209. @end itemize
  10210. @section pp7
  10211. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10212. similar to spp = 6 with 7 point DCT, where only the center sample is
  10213. used after IDCT.
  10214. The filter accepts the following options:
  10215. @table @option
  10216. @item qp
  10217. Force a constant quantization parameter. It accepts an integer in range
  10218. 0 to 63. If not set, the filter will use the QP from the video stream
  10219. (if available).
  10220. @item mode
  10221. Set thresholding mode. Available modes are:
  10222. @table @samp
  10223. @item hard
  10224. Set hard thresholding.
  10225. @item soft
  10226. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10227. @item medium
  10228. Set medium thresholding (good results, default).
  10229. @end table
  10230. @end table
  10231. @section premultiply
  10232. Apply alpha premultiply effect to input video stream using first plane
  10233. of second stream as alpha.
  10234. Both streams must have same dimensions and same pixel format.
  10235. The filter accepts the following option:
  10236. @table @option
  10237. @item planes
  10238. Set which planes will be processed, unprocessed planes will be copied.
  10239. By default value 0xf, all planes will be processed.
  10240. @item inplace
  10241. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10242. @end table
  10243. @section prewitt
  10244. Apply prewitt operator to input video stream.
  10245. The filter accepts the following option:
  10246. @table @option
  10247. @item planes
  10248. Set which planes will be processed, unprocessed planes will be copied.
  10249. By default value 0xf, all planes will be processed.
  10250. @item scale
  10251. Set value which will be multiplied with filtered result.
  10252. @item delta
  10253. Set value which will be added to filtered result.
  10254. @end table
  10255. @anchor{program_opencl}
  10256. @section program_opencl
  10257. Filter video using an OpenCL program.
  10258. @table @option
  10259. @item source
  10260. OpenCL program source file.
  10261. @item kernel
  10262. Kernel name in program.
  10263. @item inputs
  10264. Number of inputs to the filter. Defaults to 1.
  10265. @item size, s
  10266. Size of output frames. Defaults to the same as the first input.
  10267. @end table
  10268. The program source file must contain a kernel function with the given name,
  10269. which will be run once for each plane of the output. Each run on a plane
  10270. gets enqueued as a separate 2D global NDRange with one work-item for each
  10271. pixel to be generated. The global ID offset for each work-item is therefore
  10272. the coordinates of a pixel in the destination image.
  10273. The kernel function needs to take the following arguments:
  10274. @itemize
  10275. @item
  10276. Destination image, @var{__write_only image2d_t}.
  10277. This image will become the output; the kernel should write all of it.
  10278. @item
  10279. Frame index, @var{unsigned int}.
  10280. This is a counter starting from zero and increasing by one for each frame.
  10281. @item
  10282. Source images, @var{__read_only image2d_t}.
  10283. These are the most recent images on each input. The kernel may read from
  10284. them to generate the output, but they can't be written to.
  10285. @end itemize
  10286. Example programs:
  10287. @itemize
  10288. @item
  10289. Copy the input to the output (output must be the same size as the input).
  10290. @verbatim
  10291. __kernel void copy(__write_only image2d_t destination,
  10292. unsigned int index,
  10293. __read_only image2d_t source)
  10294. {
  10295. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10296. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10297. float4 value = read_imagef(source, sampler, location);
  10298. write_imagef(destination, location, value);
  10299. }
  10300. @end verbatim
  10301. @item
  10302. Apply a simple transformation, rotating the input by an amount increasing
  10303. with the index counter. Pixel values are linearly interpolated by the
  10304. sampler, and the output need not have the same dimensions as the input.
  10305. @verbatim
  10306. __kernel void rotate_image(__write_only image2d_t dst,
  10307. unsigned int index,
  10308. __read_only image2d_t src)
  10309. {
  10310. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10311. CLK_FILTER_LINEAR);
  10312. float angle = (float)index / 100.0f;
  10313. float2 dst_dim = convert_float2(get_image_dim(dst));
  10314. float2 src_dim = convert_float2(get_image_dim(src));
  10315. float2 dst_cen = dst_dim / 2.0f;
  10316. float2 src_cen = src_dim / 2.0f;
  10317. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10318. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10319. float2 src_pos = {
  10320. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10321. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10322. };
  10323. src_pos = src_pos * src_dim / dst_dim;
  10324. float2 src_loc = src_pos + src_cen;
  10325. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10326. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10327. write_imagef(dst, dst_loc, 0.5f);
  10328. else
  10329. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10330. }
  10331. @end verbatim
  10332. @item
  10333. Blend two inputs together, with the amount of each input used varying
  10334. with the index counter.
  10335. @verbatim
  10336. __kernel void blend_images(__write_only image2d_t dst,
  10337. unsigned int index,
  10338. __read_only image2d_t src1,
  10339. __read_only image2d_t src2)
  10340. {
  10341. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10342. CLK_FILTER_LINEAR);
  10343. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10344. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10345. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10346. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10347. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10348. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10349. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10350. }
  10351. @end verbatim
  10352. @end itemize
  10353. @section pseudocolor
  10354. Alter frame colors in video with pseudocolors.
  10355. This filter accept the following options:
  10356. @table @option
  10357. @item c0
  10358. set pixel first component expression
  10359. @item c1
  10360. set pixel second component expression
  10361. @item c2
  10362. set pixel third component expression
  10363. @item c3
  10364. set pixel fourth component expression, corresponds to the alpha component
  10365. @item i
  10366. set component to use as base for altering colors
  10367. @end table
  10368. Each of them specifies the expression to use for computing the lookup table for
  10369. the corresponding pixel component values.
  10370. The expressions can contain the following constants and functions:
  10371. @table @option
  10372. @item w
  10373. @item h
  10374. The input width and height.
  10375. @item val
  10376. The input value for the pixel component.
  10377. @item ymin, umin, vmin, amin
  10378. The minimum allowed component value.
  10379. @item ymax, umax, vmax, amax
  10380. The maximum allowed component value.
  10381. @end table
  10382. All expressions default to "val".
  10383. @subsection Examples
  10384. @itemize
  10385. @item
  10386. Change too high luma values to gradient:
  10387. @example
  10388. 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'"
  10389. @end example
  10390. @end itemize
  10391. @section psnr
  10392. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10393. Ratio) between two input videos.
  10394. This filter takes in input two input videos, the first input is
  10395. considered the "main" source and is passed unchanged to the
  10396. output. The second input is used as a "reference" video for computing
  10397. the PSNR.
  10398. Both video inputs must have the same resolution and pixel format for
  10399. this filter to work correctly. Also it assumes that both inputs
  10400. have the same number of frames, which are compared one by one.
  10401. The obtained average PSNR is printed through the logging system.
  10402. The filter stores the accumulated MSE (mean squared error) of each
  10403. frame, and at the end of the processing it is averaged across all frames
  10404. equally, and the following formula is applied to obtain the PSNR:
  10405. @example
  10406. PSNR = 10*log10(MAX^2/MSE)
  10407. @end example
  10408. Where MAX is the average of the maximum values of each component of the
  10409. image.
  10410. The description of the accepted parameters follows.
  10411. @table @option
  10412. @item stats_file, f
  10413. If specified the filter will use the named file to save the PSNR of
  10414. each individual frame. When filename equals "-" the data is sent to
  10415. standard output.
  10416. @item stats_version
  10417. Specifies which version of the stats file format to use. Details of
  10418. each format are written below.
  10419. Default value is 1.
  10420. @item stats_add_max
  10421. Determines whether the max value is output to the stats log.
  10422. Default value is 0.
  10423. Requires stats_version >= 2. If this is set and stats_version < 2,
  10424. the filter will return an error.
  10425. @end table
  10426. This filter also supports the @ref{framesync} options.
  10427. The file printed if @var{stats_file} is selected, contains a sequence of
  10428. key/value pairs of the form @var{key}:@var{value} for each compared
  10429. couple of frames.
  10430. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10431. the list of per-frame-pair stats, with key value pairs following the frame
  10432. format with the following parameters:
  10433. @table @option
  10434. @item psnr_log_version
  10435. The version of the log file format. Will match @var{stats_version}.
  10436. @item fields
  10437. A comma separated list of the per-frame-pair parameters included in
  10438. the log.
  10439. @end table
  10440. A description of each shown per-frame-pair parameter follows:
  10441. @table @option
  10442. @item n
  10443. sequential number of the input frame, starting from 1
  10444. @item mse_avg
  10445. Mean Square Error pixel-by-pixel average difference of the compared
  10446. frames, averaged over all the image components.
  10447. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10448. Mean Square Error pixel-by-pixel average difference of the compared
  10449. frames for the component specified by the suffix.
  10450. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10451. Peak Signal to Noise ratio of the compared frames for the component
  10452. specified by the suffix.
  10453. @item max_avg, max_y, max_u, max_v
  10454. Maximum allowed value for each channel, and average over all
  10455. channels.
  10456. @end table
  10457. For example:
  10458. @example
  10459. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10460. [main][ref] psnr="stats_file=stats.log" [out]
  10461. @end example
  10462. On this example the input file being processed is compared with the
  10463. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10464. is stored in @file{stats.log}.
  10465. @anchor{pullup}
  10466. @section pullup
  10467. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10468. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10469. content.
  10470. The pullup filter is designed to take advantage of future context in making
  10471. its decisions. This filter is stateless in the sense that it does not lock
  10472. onto a pattern to follow, but it instead looks forward to the following
  10473. fields in order to identify matches and rebuild progressive frames.
  10474. To produce content with an even framerate, insert the fps filter after
  10475. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10476. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10477. The filter accepts the following options:
  10478. @table @option
  10479. @item jl
  10480. @item jr
  10481. @item jt
  10482. @item jb
  10483. These options set the amount of "junk" to ignore at the left, right, top, and
  10484. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10485. while top and bottom are in units of 2 lines.
  10486. The default is 8 pixels on each side.
  10487. @item sb
  10488. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10489. filter generating an occasional mismatched frame, but it may also cause an
  10490. excessive number of frames to be dropped during high motion sequences.
  10491. Conversely, setting it to -1 will make filter match fields more easily.
  10492. This may help processing of video where there is slight blurring between
  10493. the fields, but may also cause there to be interlaced frames in the output.
  10494. Default value is @code{0}.
  10495. @item mp
  10496. Set the metric plane to use. It accepts the following values:
  10497. @table @samp
  10498. @item l
  10499. Use luma plane.
  10500. @item u
  10501. Use chroma blue plane.
  10502. @item v
  10503. Use chroma red plane.
  10504. @end table
  10505. This option may be set to use chroma plane instead of the default luma plane
  10506. for doing filter's computations. This may improve accuracy on very clean
  10507. source material, but more likely will decrease accuracy, especially if there
  10508. is chroma noise (rainbow effect) or any grayscale video.
  10509. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10510. load and make pullup usable in realtime on slow machines.
  10511. @end table
  10512. For best results (without duplicated frames in the output file) it is
  10513. necessary to change the output frame rate. For example, to inverse
  10514. telecine NTSC input:
  10515. @example
  10516. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10517. @end example
  10518. @section qp
  10519. Change video quantization parameters (QP).
  10520. The filter accepts the following option:
  10521. @table @option
  10522. @item qp
  10523. Set expression for quantization parameter.
  10524. @end table
  10525. The expression is evaluated through the eval API and can contain, among others,
  10526. the following constants:
  10527. @table @var
  10528. @item known
  10529. 1 if index is not 129, 0 otherwise.
  10530. @item qp
  10531. Sequential index starting from -129 to 128.
  10532. @end table
  10533. @subsection Examples
  10534. @itemize
  10535. @item
  10536. Some equation like:
  10537. @example
  10538. qp=2+2*sin(PI*qp)
  10539. @end example
  10540. @end itemize
  10541. @section random
  10542. Flush video frames from internal cache of frames into a random order.
  10543. No frame is discarded.
  10544. Inspired by @ref{frei0r} nervous filter.
  10545. @table @option
  10546. @item frames
  10547. Set size in number of frames of internal cache, in range from @code{2} to
  10548. @code{512}. Default is @code{30}.
  10549. @item seed
  10550. Set seed for random number generator, must be an integer included between
  10551. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10552. less than @code{0}, the filter will try to use a good random seed on a
  10553. best effort basis.
  10554. @end table
  10555. @section readeia608
  10556. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10557. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10558. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10559. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10560. @table @option
  10561. @item lavfi.readeia608.X.cc
  10562. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10563. @item lavfi.readeia608.X.line
  10564. The number of the line on which the EIA-608 data was identified and read.
  10565. @end table
  10566. This filter accepts the following options:
  10567. @table @option
  10568. @item scan_min
  10569. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10570. @item scan_max
  10571. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10572. @item mac
  10573. Set minimal acceptable amplitude change for sync codes detection.
  10574. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10575. @item spw
  10576. Set the ratio of width reserved for sync code detection.
  10577. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10578. @item mhd
  10579. Set the max peaks height difference for sync code detection.
  10580. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10581. @item mpd
  10582. Set max peaks period difference for sync code detection.
  10583. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10584. @item msd
  10585. Set the first two max start code bits differences.
  10586. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10587. @item bhd
  10588. Set the minimum ratio of bits height compared to 3rd start code bit.
  10589. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10590. @item th_w
  10591. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10592. @item th_b
  10593. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10594. @item chp
  10595. Enable checking the parity bit. In the event of a parity error, the filter will output
  10596. @code{0x00} for that character. Default is false.
  10597. @end table
  10598. @subsection Examples
  10599. @itemize
  10600. @item
  10601. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10602. @example
  10603. 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
  10604. @end example
  10605. @end itemize
  10606. @section readvitc
  10607. Read vertical interval timecode (VITC) information from the top lines of a
  10608. video frame.
  10609. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10610. timecode value, if a valid timecode has been detected. Further metadata key
  10611. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10612. timecode data has been found or not.
  10613. This filter accepts the following options:
  10614. @table @option
  10615. @item scan_max
  10616. Set the maximum number of lines to scan for VITC data. If the value is set to
  10617. @code{-1} the full video frame is scanned. Default is @code{45}.
  10618. @item thr_b
  10619. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10620. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10621. @item thr_w
  10622. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10623. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10624. @end table
  10625. @subsection Examples
  10626. @itemize
  10627. @item
  10628. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10629. draw @code{--:--:--:--} as a placeholder:
  10630. @example
  10631. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10632. @end example
  10633. @end itemize
  10634. @section remap
  10635. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10636. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10637. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10638. value for pixel will be used for destination pixel.
  10639. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10640. will have Xmap/Ymap video stream dimensions.
  10641. Xmap and Ymap input video streams are 16bit depth, single channel.
  10642. @section removegrain
  10643. The removegrain filter is a spatial denoiser for progressive video.
  10644. @table @option
  10645. @item m0
  10646. Set mode for the first plane.
  10647. @item m1
  10648. Set mode for the second plane.
  10649. @item m2
  10650. Set mode for the third plane.
  10651. @item m3
  10652. Set mode for the fourth plane.
  10653. @end table
  10654. Range of mode is from 0 to 24. Description of each mode follows:
  10655. @table @var
  10656. @item 0
  10657. Leave input plane unchanged. Default.
  10658. @item 1
  10659. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10660. @item 2
  10661. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10662. @item 3
  10663. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10664. @item 4
  10665. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10666. This is equivalent to a median filter.
  10667. @item 5
  10668. Line-sensitive clipping giving the minimal change.
  10669. @item 6
  10670. Line-sensitive clipping, intermediate.
  10671. @item 7
  10672. Line-sensitive clipping, intermediate.
  10673. @item 8
  10674. Line-sensitive clipping, intermediate.
  10675. @item 9
  10676. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10677. @item 10
  10678. Replaces the target pixel with the closest neighbour.
  10679. @item 11
  10680. [1 2 1] horizontal and vertical kernel blur.
  10681. @item 12
  10682. Same as mode 11.
  10683. @item 13
  10684. Bob mode, interpolates top field from the line where the neighbours
  10685. pixels are the closest.
  10686. @item 14
  10687. Bob mode, interpolates bottom field from the line where the neighbours
  10688. pixels are the closest.
  10689. @item 15
  10690. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10691. interpolation formula.
  10692. @item 16
  10693. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10694. interpolation formula.
  10695. @item 17
  10696. Clips the pixel with the minimum and maximum of respectively the maximum and
  10697. minimum of each pair of opposite neighbour pixels.
  10698. @item 18
  10699. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10700. the current pixel is minimal.
  10701. @item 19
  10702. Replaces the pixel with the average of its 8 neighbours.
  10703. @item 20
  10704. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10705. @item 21
  10706. Clips pixels using the averages of opposite neighbour.
  10707. @item 22
  10708. Same as mode 21 but simpler and faster.
  10709. @item 23
  10710. Small edge and halo removal, but reputed useless.
  10711. @item 24
  10712. Similar as 23.
  10713. @end table
  10714. @section removelogo
  10715. Suppress a TV station logo, using an image file to determine which
  10716. pixels comprise the logo. It works by filling in the pixels that
  10717. comprise the logo with neighboring pixels.
  10718. The filter accepts the following options:
  10719. @table @option
  10720. @item filename, f
  10721. Set the filter bitmap file, which can be any image format supported by
  10722. libavformat. The width and height of the image file must match those of the
  10723. video stream being processed.
  10724. @end table
  10725. Pixels in the provided bitmap image with a value of zero are not
  10726. considered part of the logo, non-zero pixels are considered part of
  10727. the logo. If you use white (255) for the logo and black (0) for the
  10728. rest, you will be safe. For making the filter bitmap, it is
  10729. recommended to take a screen capture of a black frame with the logo
  10730. visible, and then using a threshold filter followed by the erode
  10731. filter once or twice.
  10732. If needed, little splotches can be fixed manually. Remember that if
  10733. logo pixels are not covered, the filter quality will be much
  10734. reduced. Marking too many pixels as part of the logo does not hurt as
  10735. much, but it will increase the amount of blurring needed to cover over
  10736. the image and will destroy more information than necessary, and extra
  10737. pixels will slow things down on a large logo.
  10738. @section repeatfields
  10739. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10740. fields based on its value.
  10741. @section reverse
  10742. Reverse a video clip.
  10743. Warning: This filter requires memory to buffer the entire clip, so trimming
  10744. is suggested.
  10745. @subsection Examples
  10746. @itemize
  10747. @item
  10748. Take the first 5 seconds of a clip, and reverse it.
  10749. @example
  10750. trim=end=5,reverse
  10751. @end example
  10752. @end itemize
  10753. @section roberts
  10754. Apply roberts cross operator to input video stream.
  10755. The filter accepts the following option:
  10756. @table @option
  10757. @item planes
  10758. Set which planes will be processed, unprocessed planes will be copied.
  10759. By default value 0xf, all planes will be processed.
  10760. @item scale
  10761. Set value which will be multiplied with filtered result.
  10762. @item delta
  10763. Set value which will be added to filtered result.
  10764. @end table
  10765. @section rotate
  10766. Rotate video by an arbitrary angle expressed in radians.
  10767. The filter accepts the following options:
  10768. A description of the optional parameters follows.
  10769. @table @option
  10770. @item angle, a
  10771. Set an expression for the angle by which to rotate the input video
  10772. clockwise, expressed as a number of radians. A negative value will
  10773. result in a counter-clockwise rotation. By default it is set to "0".
  10774. This expression is evaluated for each frame.
  10775. @item out_w, ow
  10776. Set the output width expression, default value is "iw".
  10777. This expression is evaluated just once during configuration.
  10778. @item out_h, oh
  10779. Set the output height expression, default value is "ih".
  10780. This expression is evaluated just once during configuration.
  10781. @item bilinear
  10782. Enable bilinear interpolation if set to 1, a value of 0 disables
  10783. it. Default value is 1.
  10784. @item fillcolor, c
  10785. Set the color used to fill the output area not covered by the rotated
  10786. image. For the general syntax of this option, check the
  10787. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10788. If the special value "none" is selected then no
  10789. background is printed (useful for example if the background is never shown).
  10790. Default value is "black".
  10791. @end table
  10792. The expressions for the angle and the output size can contain the
  10793. following constants and functions:
  10794. @table @option
  10795. @item n
  10796. sequential number of the input frame, starting from 0. It is always NAN
  10797. before the first frame is filtered.
  10798. @item t
  10799. time in seconds of the input frame, it is set to 0 when the filter is
  10800. configured. It is always NAN before the first frame is filtered.
  10801. @item hsub
  10802. @item vsub
  10803. horizontal and vertical chroma subsample values. For example for the
  10804. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10805. @item in_w, iw
  10806. @item in_h, ih
  10807. the input video width and height
  10808. @item out_w, ow
  10809. @item out_h, oh
  10810. the output width and height, that is the size of the padded area as
  10811. specified by the @var{width} and @var{height} expressions
  10812. @item rotw(a)
  10813. @item roth(a)
  10814. the minimal width/height required for completely containing the input
  10815. video rotated by @var{a} radians.
  10816. These are only available when computing the @option{out_w} and
  10817. @option{out_h} expressions.
  10818. @end table
  10819. @subsection Examples
  10820. @itemize
  10821. @item
  10822. Rotate the input by PI/6 radians clockwise:
  10823. @example
  10824. rotate=PI/6
  10825. @end example
  10826. @item
  10827. Rotate the input by PI/6 radians counter-clockwise:
  10828. @example
  10829. rotate=-PI/6
  10830. @end example
  10831. @item
  10832. Rotate the input by 45 degrees clockwise:
  10833. @example
  10834. rotate=45*PI/180
  10835. @end example
  10836. @item
  10837. Apply a constant rotation with period T, starting from an angle of PI/3:
  10838. @example
  10839. rotate=PI/3+2*PI*t/T
  10840. @end example
  10841. @item
  10842. Make the input video rotation oscillating with a period of T
  10843. seconds and an amplitude of A radians:
  10844. @example
  10845. rotate=A*sin(2*PI/T*t)
  10846. @end example
  10847. @item
  10848. Rotate the video, output size is chosen so that the whole rotating
  10849. input video is always completely contained in the output:
  10850. @example
  10851. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10852. @end example
  10853. @item
  10854. Rotate the video, reduce the output size so that no background is ever
  10855. shown:
  10856. @example
  10857. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10858. @end example
  10859. @end itemize
  10860. @subsection Commands
  10861. The filter supports the following commands:
  10862. @table @option
  10863. @item a, angle
  10864. Set the angle expression.
  10865. The command accepts the same syntax of the corresponding option.
  10866. If the specified expression is not valid, it is kept at its current
  10867. value.
  10868. @end table
  10869. @section sab
  10870. Apply Shape Adaptive Blur.
  10871. The filter accepts the following options:
  10872. @table @option
  10873. @item luma_radius, lr
  10874. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10875. value is 1.0. A greater value will result in a more blurred image, and
  10876. in slower processing.
  10877. @item luma_pre_filter_radius, lpfr
  10878. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10879. value is 1.0.
  10880. @item luma_strength, ls
  10881. Set luma maximum difference between pixels to still be considered, must
  10882. be a value in the 0.1-100.0 range, default value is 1.0.
  10883. @item chroma_radius, cr
  10884. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10885. greater value will result in a more blurred image, and in slower
  10886. processing.
  10887. @item chroma_pre_filter_radius, cpfr
  10888. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10889. @item chroma_strength, cs
  10890. Set chroma maximum difference between pixels to still be considered,
  10891. must be a value in the -0.9-100.0 range.
  10892. @end table
  10893. Each chroma option value, if not explicitly specified, is set to the
  10894. corresponding luma option value.
  10895. @anchor{scale}
  10896. @section scale
  10897. Scale (resize) the input video, using the libswscale library.
  10898. The scale filter forces the output display aspect ratio to be the same
  10899. of the input, by changing the output sample aspect ratio.
  10900. If the input image format is different from the format requested by
  10901. the next filter, the scale filter will convert the input to the
  10902. requested format.
  10903. @subsection Options
  10904. The filter accepts the following options, or any of the options
  10905. supported by the libswscale scaler.
  10906. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10907. the complete list of scaler options.
  10908. @table @option
  10909. @item width, w
  10910. @item height, h
  10911. Set the output video dimension expression. Default value is the input
  10912. dimension.
  10913. If the @var{width} or @var{w} value is 0, the input width is used for
  10914. the output. If the @var{height} or @var{h} value is 0, the input height
  10915. is used for the output.
  10916. If one and only one of the values is -n with n >= 1, the scale filter
  10917. will use a value that maintains the aspect ratio of the input image,
  10918. calculated from the other specified dimension. After that it will,
  10919. however, make sure that the calculated dimension is divisible by n and
  10920. adjust the value if necessary.
  10921. If both values are -n with n >= 1, the behavior will be identical to
  10922. both values being set to 0 as previously detailed.
  10923. See below for the list of accepted constants for use in the dimension
  10924. expression.
  10925. @item eval
  10926. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10927. @table @samp
  10928. @item init
  10929. Only evaluate expressions once during the filter initialization or when a command is processed.
  10930. @item frame
  10931. Evaluate expressions for each incoming frame.
  10932. @end table
  10933. Default value is @samp{init}.
  10934. @item interl
  10935. Set the interlacing mode. It accepts the following values:
  10936. @table @samp
  10937. @item 1
  10938. Force interlaced aware scaling.
  10939. @item 0
  10940. Do not apply interlaced scaling.
  10941. @item -1
  10942. Select interlaced aware scaling depending on whether the source frames
  10943. are flagged as interlaced or not.
  10944. @end table
  10945. Default value is @samp{0}.
  10946. @item flags
  10947. Set libswscale scaling flags. See
  10948. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10949. complete list of values. If not explicitly specified the filter applies
  10950. the default flags.
  10951. @item param0, param1
  10952. Set libswscale input parameters for scaling algorithms that need them. See
  10953. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10954. complete documentation. If not explicitly specified the filter applies
  10955. empty parameters.
  10956. @item size, s
  10957. Set the video size. For the syntax of this option, check the
  10958. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10959. @item in_color_matrix
  10960. @item out_color_matrix
  10961. Set in/output YCbCr color space type.
  10962. This allows the autodetected value to be overridden as well as allows forcing
  10963. a specific value used for the output and encoder.
  10964. If not specified, the color space type depends on the pixel format.
  10965. Possible values:
  10966. @table @samp
  10967. @item auto
  10968. Choose automatically.
  10969. @item bt709
  10970. Format conforming to International Telecommunication Union (ITU)
  10971. Recommendation BT.709.
  10972. @item fcc
  10973. Set color space conforming to the United States Federal Communications
  10974. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10975. @item bt601
  10976. Set color space conforming to:
  10977. @itemize
  10978. @item
  10979. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10980. @item
  10981. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10982. @item
  10983. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10984. @end itemize
  10985. @item smpte240m
  10986. Set color space conforming to SMPTE ST 240:1999.
  10987. @end table
  10988. @item in_range
  10989. @item out_range
  10990. Set in/output YCbCr sample range.
  10991. This allows the autodetected value to be overridden as well as allows forcing
  10992. a specific value used for the output and encoder. If not specified, the
  10993. range depends on the pixel format. Possible values:
  10994. @table @samp
  10995. @item auto/unknown
  10996. Choose automatically.
  10997. @item jpeg/full/pc
  10998. Set full range (0-255 in case of 8-bit luma).
  10999. @item mpeg/limited/tv
  11000. Set "MPEG" range (16-235 in case of 8-bit luma).
  11001. @end table
  11002. @item force_original_aspect_ratio
  11003. Enable decreasing or increasing output video width or height if necessary to
  11004. keep the original aspect ratio. Possible values:
  11005. @table @samp
  11006. @item disable
  11007. Scale the video as specified and disable this feature.
  11008. @item decrease
  11009. The output video dimensions will automatically be decreased if needed.
  11010. @item increase
  11011. The output video dimensions will automatically be increased if needed.
  11012. @end table
  11013. One useful instance of this option is that when you know a specific device's
  11014. maximum allowed resolution, you can use this to limit the output video to
  11015. that, while retaining the aspect ratio. For example, device A allows
  11016. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11017. decrease) and specifying 1280x720 to the command line makes the output
  11018. 1280x533.
  11019. Please note that this is a different thing than specifying -1 for @option{w}
  11020. or @option{h}, you still need to specify the output resolution for this option
  11021. to work.
  11022. @end table
  11023. The values of the @option{w} and @option{h} options are expressions
  11024. containing the following constants:
  11025. @table @var
  11026. @item in_w
  11027. @item in_h
  11028. The input width and height
  11029. @item iw
  11030. @item ih
  11031. These are the same as @var{in_w} and @var{in_h}.
  11032. @item out_w
  11033. @item out_h
  11034. The output (scaled) width and height
  11035. @item ow
  11036. @item oh
  11037. These are the same as @var{out_w} and @var{out_h}
  11038. @item a
  11039. The same as @var{iw} / @var{ih}
  11040. @item sar
  11041. input sample aspect ratio
  11042. @item dar
  11043. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11044. @item hsub
  11045. @item vsub
  11046. horizontal and vertical input chroma subsample values. For example for the
  11047. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11048. @item ohsub
  11049. @item ovsub
  11050. horizontal and vertical output chroma subsample values. For example for the
  11051. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11052. @end table
  11053. @subsection Examples
  11054. @itemize
  11055. @item
  11056. Scale the input video to a size of 200x100
  11057. @example
  11058. scale=w=200:h=100
  11059. @end example
  11060. This is equivalent to:
  11061. @example
  11062. scale=200:100
  11063. @end example
  11064. or:
  11065. @example
  11066. scale=200x100
  11067. @end example
  11068. @item
  11069. Specify a size abbreviation for the output size:
  11070. @example
  11071. scale=qcif
  11072. @end example
  11073. which can also be written as:
  11074. @example
  11075. scale=size=qcif
  11076. @end example
  11077. @item
  11078. Scale the input to 2x:
  11079. @example
  11080. scale=w=2*iw:h=2*ih
  11081. @end example
  11082. @item
  11083. The above is the same as:
  11084. @example
  11085. scale=2*in_w:2*in_h
  11086. @end example
  11087. @item
  11088. Scale the input to 2x with forced interlaced scaling:
  11089. @example
  11090. scale=2*iw:2*ih:interl=1
  11091. @end example
  11092. @item
  11093. Scale the input to half size:
  11094. @example
  11095. scale=w=iw/2:h=ih/2
  11096. @end example
  11097. @item
  11098. Increase the width, and set the height to the same size:
  11099. @example
  11100. scale=3/2*iw:ow
  11101. @end example
  11102. @item
  11103. Seek Greek harmony:
  11104. @example
  11105. scale=iw:1/PHI*iw
  11106. scale=ih*PHI:ih
  11107. @end example
  11108. @item
  11109. Increase the height, and set the width to 3/2 of the height:
  11110. @example
  11111. scale=w=3/2*oh:h=3/5*ih
  11112. @end example
  11113. @item
  11114. Increase the size, making the size a multiple of the chroma
  11115. subsample values:
  11116. @example
  11117. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11118. @end example
  11119. @item
  11120. Increase the width to a maximum of 500 pixels,
  11121. keeping the same aspect ratio as the input:
  11122. @example
  11123. scale=w='min(500\, iw*3/2):h=-1'
  11124. @end example
  11125. @item
  11126. Make pixels square by combining scale and setsar:
  11127. @example
  11128. scale='trunc(ih*dar):ih',setsar=1/1
  11129. @end example
  11130. @item
  11131. Make pixels square by combining scale and setsar,
  11132. making sure the resulting resolution is even (required by some codecs):
  11133. @example
  11134. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11135. @end example
  11136. @end itemize
  11137. @subsection Commands
  11138. This filter supports the following commands:
  11139. @table @option
  11140. @item width, w
  11141. @item height, h
  11142. Set the output video dimension expression.
  11143. The command accepts the same syntax of the corresponding option.
  11144. If the specified expression is not valid, it is kept at its current
  11145. value.
  11146. @end table
  11147. @section scale_npp
  11148. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11149. format conversion on CUDA video frames. Setting the output width and height
  11150. works in the same way as for the @var{scale} filter.
  11151. The following additional options are accepted:
  11152. @table @option
  11153. @item format
  11154. The pixel format of the output CUDA frames. If set to the string "same" (the
  11155. default), the input format will be kept. Note that automatic format negotiation
  11156. and conversion is not yet supported for hardware frames
  11157. @item interp_algo
  11158. The interpolation algorithm used for resizing. One of the following:
  11159. @table @option
  11160. @item nn
  11161. Nearest neighbour.
  11162. @item linear
  11163. @item cubic
  11164. @item cubic2p_bspline
  11165. 2-parameter cubic (B=1, C=0)
  11166. @item cubic2p_catmullrom
  11167. 2-parameter cubic (B=0, C=1/2)
  11168. @item cubic2p_b05c03
  11169. 2-parameter cubic (B=1/2, C=3/10)
  11170. @item super
  11171. Supersampling
  11172. @item lanczos
  11173. @end table
  11174. @end table
  11175. @section scale2ref
  11176. Scale (resize) the input video, based on a reference video.
  11177. See the scale filter for available options, scale2ref supports the same but
  11178. uses the reference video instead of the main input as basis. scale2ref also
  11179. supports the following additional constants for the @option{w} and
  11180. @option{h} options:
  11181. @table @var
  11182. @item main_w
  11183. @item main_h
  11184. The main input video's width and height
  11185. @item main_a
  11186. The same as @var{main_w} / @var{main_h}
  11187. @item main_sar
  11188. The main input video's sample aspect ratio
  11189. @item main_dar, mdar
  11190. The main input video's display aspect ratio. Calculated from
  11191. @code{(main_w / main_h) * main_sar}.
  11192. @item main_hsub
  11193. @item main_vsub
  11194. The main input video's horizontal and vertical chroma subsample values.
  11195. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11196. is 1.
  11197. @end table
  11198. @subsection Examples
  11199. @itemize
  11200. @item
  11201. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11202. @example
  11203. 'scale2ref[b][a];[a][b]overlay'
  11204. @end example
  11205. @end itemize
  11206. @anchor{selectivecolor}
  11207. @section selectivecolor
  11208. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11209. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11210. by the "purity" of the color (that is, how saturated it already is).
  11211. This filter is similar to the Adobe Photoshop Selective Color tool.
  11212. The filter accepts the following options:
  11213. @table @option
  11214. @item correction_method
  11215. Select color correction method.
  11216. Available values are:
  11217. @table @samp
  11218. @item absolute
  11219. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11220. component value).
  11221. @item relative
  11222. Specified adjustments are relative to the original component value.
  11223. @end table
  11224. Default is @code{absolute}.
  11225. @item reds
  11226. Adjustments for red pixels (pixels where the red component is the maximum)
  11227. @item yellows
  11228. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11229. @item greens
  11230. Adjustments for green pixels (pixels where the green component is the maximum)
  11231. @item cyans
  11232. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11233. @item blues
  11234. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11235. @item magentas
  11236. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11237. @item whites
  11238. Adjustments for white pixels (pixels where all components are greater than 128)
  11239. @item neutrals
  11240. Adjustments for all pixels except pure black and pure white
  11241. @item blacks
  11242. Adjustments for black pixels (pixels where all components are lesser than 128)
  11243. @item psfile
  11244. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11245. @end table
  11246. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11247. 4 space separated floating point adjustment values in the [-1,1] range,
  11248. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11249. pixels of its range.
  11250. @subsection Examples
  11251. @itemize
  11252. @item
  11253. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11254. increase magenta by 27% in blue areas:
  11255. @example
  11256. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11257. @end example
  11258. @item
  11259. Use a Photoshop selective color preset:
  11260. @example
  11261. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11262. @end example
  11263. @end itemize
  11264. @anchor{separatefields}
  11265. @section separatefields
  11266. The @code{separatefields} takes a frame-based video input and splits
  11267. each frame into its components fields, producing a new half height clip
  11268. with twice the frame rate and twice the frame count.
  11269. This filter use field-dominance information in frame to decide which
  11270. of each pair of fields to place first in the output.
  11271. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11272. @section setdar, setsar
  11273. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11274. output video.
  11275. This is done by changing the specified Sample (aka Pixel) Aspect
  11276. Ratio, according to the following equation:
  11277. @example
  11278. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11279. @end example
  11280. Keep in mind that the @code{setdar} filter does not modify the pixel
  11281. dimensions of the video frame. Also, the display aspect ratio set by
  11282. this filter may be changed by later filters in the filterchain,
  11283. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11284. applied.
  11285. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11286. the filter output video.
  11287. Note that as a consequence of the application of this filter, the
  11288. output display aspect ratio will change according to the equation
  11289. above.
  11290. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11291. filter may be changed by later filters in the filterchain, e.g. if
  11292. another "setsar" or a "setdar" filter is applied.
  11293. It accepts the following parameters:
  11294. @table @option
  11295. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11296. Set the aspect ratio used by the filter.
  11297. The parameter can be a floating point number string, an expression, or
  11298. a string of the form @var{num}:@var{den}, where @var{num} and
  11299. @var{den} are the numerator and denominator of the aspect ratio. If
  11300. the parameter is not specified, it is assumed the value "0".
  11301. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11302. should be escaped.
  11303. @item max
  11304. Set the maximum integer value to use for expressing numerator and
  11305. denominator when reducing the expressed aspect ratio to a rational.
  11306. Default value is @code{100}.
  11307. @end table
  11308. The parameter @var{sar} is an expression containing
  11309. the following constants:
  11310. @table @option
  11311. @item E, PI, PHI
  11312. These are approximated values for the mathematical constants e
  11313. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11314. @item w, h
  11315. The input width and height.
  11316. @item a
  11317. These are the same as @var{w} / @var{h}.
  11318. @item sar
  11319. The input sample aspect ratio.
  11320. @item dar
  11321. The input display aspect ratio. It is the same as
  11322. (@var{w} / @var{h}) * @var{sar}.
  11323. @item hsub, vsub
  11324. Horizontal and vertical chroma subsample values. For example, for the
  11325. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11326. @end table
  11327. @subsection Examples
  11328. @itemize
  11329. @item
  11330. To change the display aspect ratio to 16:9, specify one of the following:
  11331. @example
  11332. setdar=dar=1.77777
  11333. setdar=dar=16/9
  11334. @end example
  11335. @item
  11336. To change the sample aspect ratio to 10:11, specify:
  11337. @example
  11338. setsar=sar=10/11
  11339. @end example
  11340. @item
  11341. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11342. 1000 in the aspect ratio reduction, use the command:
  11343. @example
  11344. setdar=ratio=16/9:max=1000
  11345. @end example
  11346. @end itemize
  11347. @anchor{setfield}
  11348. @section setfield
  11349. Force field for the output video frame.
  11350. The @code{setfield} filter marks the interlace type field for the
  11351. output frames. It does not change the input frame, but only sets the
  11352. corresponding property, which affects how the frame is treated by
  11353. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11354. The filter accepts the following options:
  11355. @table @option
  11356. @item mode
  11357. Available values are:
  11358. @table @samp
  11359. @item auto
  11360. Keep the same field property.
  11361. @item bff
  11362. Mark the frame as bottom-field-first.
  11363. @item tff
  11364. Mark the frame as top-field-first.
  11365. @item prog
  11366. Mark the frame as progressive.
  11367. @end table
  11368. @end table
  11369. @section showinfo
  11370. Show a line containing various information for each input video frame.
  11371. The input video is not modified.
  11372. The shown line contains a sequence of key/value pairs of the form
  11373. @var{key}:@var{value}.
  11374. The following values are shown in the output:
  11375. @table @option
  11376. @item n
  11377. The (sequential) number of the input frame, starting from 0.
  11378. @item pts
  11379. The Presentation TimeStamp of the input frame, expressed as a number of
  11380. time base units. The time base unit depends on the filter input pad.
  11381. @item pts_time
  11382. The Presentation TimeStamp of the input frame, expressed as a number of
  11383. seconds.
  11384. @item pos
  11385. The position of the frame in the input stream, or -1 if this information is
  11386. unavailable and/or meaningless (for example in case of synthetic video).
  11387. @item fmt
  11388. The pixel format name.
  11389. @item sar
  11390. The sample aspect ratio of the input frame, expressed in the form
  11391. @var{num}/@var{den}.
  11392. @item s
  11393. The size of the input frame. For the syntax of this option, check the
  11394. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11395. @item i
  11396. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11397. for bottom field first).
  11398. @item iskey
  11399. This is 1 if the frame is a key frame, 0 otherwise.
  11400. @item type
  11401. The picture type of the input frame ("I" for an I-frame, "P" for a
  11402. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11403. Also refer to the documentation of the @code{AVPictureType} enum and of
  11404. the @code{av_get_picture_type_char} function defined in
  11405. @file{libavutil/avutil.h}.
  11406. @item checksum
  11407. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11408. @item plane_checksum
  11409. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11410. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11411. @end table
  11412. @section showpalette
  11413. Displays the 256 colors palette of each frame. This filter is only relevant for
  11414. @var{pal8} pixel format frames.
  11415. It accepts the following option:
  11416. @table @option
  11417. @item s
  11418. Set the size of the box used to represent one palette color entry. Default is
  11419. @code{30} (for a @code{30x30} pixel box).
  11420. @end table
  11421. @section shuffleframes
  11422. Reorder and/or duplicate and/or drop video frames.
  11423. It accepts the following parameters:
  11424. @table @option
  11425. @item mapping
  11426. Set the destination indexes of input frames.
  11427. This is space or '|' separated list of indexes that maps input frames to output
  11428. frames. Number of indexes also sets maximal value that each index may have.
  11429. '-1' index have special meaning and that is to drop frame.
  11430. @end table
  11431. The first frame has the index 0. The default is to keep the input unchanged.
  11432. @subsection Examples
  11433. @itemize
  11434. @item
  11435. Swap second and third frame of every three frames of the input:
  11436. @example
  11437. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11438. @end example
  11439. @item
  11440. Swap 10th and 1st frame of every ten frames of the input:
  11441. @example
  11442. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11443. @end example
  11444. @end itemize
  11445. @section shuffleplanes
  11446. Reorder and/or duplicate video planes.
  11447. It accepts the following parameters:
  11448. @table @option
  11449. @item map0
  11450. The index of the input plane to be used as the first output plane.
  11451. @item map1
  11452. The index of the input plane to be used as the second output plane.
  11453. @item map2
  11454. The index of the input plane to be used as the third output plane.
  11455. @item map3
  11456. The index of the input plane to be used as the fourth output plane.
  11457. @end table
  11458. The first plane has the index 0. The default is to keep the input unchanged.
  11459. @subsection Examples
  11460. @itemize
  11461. @item
  11462. Swap the second and third planes of the input:
  11463. @example
  11464. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11465. @end example
  11466. @end itemize
  11467. @anchor{signalstats}
  11468. @section signalstats
  11469. Evaluate various visual metrics that assist in determining issues associated
  11470. with the digitization of analog video media.
  11471. By default the filter will log these metadata values:
  11472. @table @option
  11473. @item YMIN
  11474. Display the minimal Y value contained within the input frame. Expressed in
  11475. range of [0-255].
  11476. @item YLOW
  11477. Display the Y value at the 10% percentile within the input frame. Expressed in
  11478. range of [0-255].
  11479. @item YAVG
  11480. Display the average Y value within the input frame. Expressed in range of
  11481. [0-255].
  11482. @item YHIGH
  11483. Display the Y value at the 90% percentile within the input frame. Expressed in
  11484. range of [0-255].
  11485. @item YMAX
  11486. Display the maximum Y value contained within the input frame. Expressed in
  11487. range of [0-255].
  11488. @item UMIN
  11489. Display the minimal U value contained within the input frame. Expressed in
  11490. range of [0-255].
  11491. @item ULOW
  11492. Display the U value at the 10% percentile within the input frame. Expressed in
  11493. range of [0-255].
  11494. @item UAVG
  11495. Display the average U value within the input frame. Expressed in range of
  11496. [0-255].
  11497. @item UHIGH
  11498. Display the U value at the 90% percentile within the input frame. Expressed in
  11499. range of [0-255].
  11500. @item UMAX
  11501. Display the maximum U value contained within the input frame. Expressed in
  11502. range of [0-255].
  11503. @item VMIN
  11504. Display the minimal V value contained within the input frame. Expressed in
  11505. range of [0-255].
  11506. @item VLOW
  11507. Display the V value at the 10% percentile within the input frame. Expressed in
  11508. range of [0-255].
  11509. @item VAVG
  11510. Display the average V value within the input frame. Expressed in range of
  11511. [0-255].
  11512. @item VHIGH
  11513. Display the V value at the 90% percentile within the input frame. Expressed in
  11514. range of [0-255].
  11515. @item VMAX
  11516. Display the maximum V value contained within the input frame. Expressed in
  11517. range of [0-255].
  11518. @item SATMIN
  11519. Display the minimal saturation value contained within the input frame.
  11520. Expressed in range of [0-~181.02].
  11521. @item SATLOW
  11522. Display the saturation value at the 10% percentile within the input frame.
  11523. Expressed in range of [0-~181.02].
  11524. @item SATAVG
  11525. Display the average saturation value within the input frame. Expressed in range
  11526. of [0-~181.02].
  11527. @item SATHIGH
  11528. Display the saturation value at the 90% percentile within the input frame.
  11529. Expressed in range of [0-~181.02].
  11530. @item SATMAX
  11531. Display the maximum saturation value contained within the input frame.
  11532. Expressed in range of [0-~181.02].
  11533. @item HUEMED
  11534. Display the median value for hue within the input frame. Expressed in range of
  11535. [0-360].
  11536. @item HUEAVG
  11537. Display the average value for hue within the input frame. Expressed in range of
  11538. [0-360].
  11539. @item YDIF
  11540. Display the average of sample value difference between all values of the Y
  11541. plane in the current frame and corresponding values of the previous input frame.
  11542. Expressed in range of [0-255].
  11543. @item UDIF
  11544. Display the average of sample value difference between all values of the U
  11545. plane in the current frame and corresponding values of the previous input frame.
  11546. Expressed in range of [0-255].
  11547. @item VDIF
  11548. Display the average of sample value difference between all values of the V
  11549. plane in the current frame and corresponding values of the previous input frame.
  11550. Expressed in range of [0-255].
  11551. @item YBITDEPTH
  11552. Display bit depth of Y plane in current frame.
  11553. Expressed in range of [0-16].
  11554. @item UBITDEPTH
  11555. Display bit depth of U plane in current frame.
  11556. Expressed in range of [0-16].
  11557. @item VBITDEPTH
  11558. Display bit depth of V plane in current frame.
  11559. Expressed in range of [0-16].
  11560. @end table
  11561. The filter accepts the following options:
  11562. @table @option
  11563. @item stat
  11564. @item out
  11565. @option{stat} specify an additional form of image analysis.
  11566. @option{out} output video with the specified type of pixel highlighted.
  11567. Both options accept the following values:
  11568. @table @samp
  11569. @item tout
  11570. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11571. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11572. include the results of video dropouts, head clogs, or tape tracking issues.
  11573. @item vrep
  11574. Identify @var{vertical line repetition}. Vertical line repetition includes
  11575. similar rows of pixels within a frame. In born-digital video vertical line
  11576. repetition is common, but this pattern is uncommon in video digitized from an
  11577. analog source. When it occurs in video that results from the digitization of an
  11578. analog source it can indicate concealment from a dropout compensator.
  11579. @item brng
  11580. Identify pixels that fall outside of legal broadcast range.
  11581. @end table
  11582. @item color, c
  11583. Set the highlight color for the @option{out} option. The default color is
  11584. yellow.
  11585. @end table
  11586. @subsection Examples
  11587. @itemize
  11588. @item
  11589. Output data of various video metrics:
  11590. @example
  11591. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11592. @end example
  11593. @item
  11594. Output specific data about the minimum and maximum values of the Y plane per frame:
  11595. @example
  11596. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11597. @end example
  11598. @item
  11599. Playback video while highlighting pixels that are outside of broadcast range in red.
  11600. @example
  11601. ffplay example.mov -vf signalstats="out=brng:color=red"
  11602. @end example
  11603. @item
  11604. Playback video with signalstats metadata drawn over the frame.
  11605. @example
  11606. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11607. @end example
  11608. The contents of signalstat_drawtext.txt used in the command are:
  11609. @example
  11610. time %@{pts:hms@}
  11611. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11612. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11613. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11614. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11615. @end example
  11616. @end itemize
  11617. @anchor{signature}
  11618. @section signature
  11619. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11620. input. In this case the matching between the inputs can be calculated additionally.
  11621. The filter always passes through the first input. The signature of each stream can
  11622. be written into a file.
  11623. It accepts the following options:
  11624. @table @option
  11625. @item detectmode
  11626. Enable or disable the matching process.
  11627. Available values are:
  11628. @table @samp
  11629. @item off
  11630. Disable the calculation of a matching (default).
  11631. @item full
  11632. Calculate the matching for the whole video and output whether the whole video
  11633. matches or only parts.
  11634. @item fast
  11635. Calculate only until a matching is found or the video ends. Should be faster in
  11636. some cases.
  11637. @end table
  11638. @item nb_inputs
  11639. Set the number of inputs. The option value must be a non negative integer.
  11640. Default value is 1.
  11641. @item filename
  11642. Set the path to which the output is written. If there is more than one input,
  11643. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11644. integer), that will be replaced with the input number. If no filename is
  11645. specified, no output will be written. This is the default.
  11646. @item format
  11647. Choose the output format.
  11648. Available values are:
  11649. @table @samp
  11650. @item binary
  11651. Use the specified binary representation (default).
  11652. @item xml
  11653. Use the specified xml representation.
  11654. @end table
  11655. @item th_d
  11656. Set threshold to detect one word as similar. The option value must be an integer
  11657. greater than zero. The default value is 9000.
  11658. @item th_dc
  11659. Set threshold to detect all words as similar. The option value must be an integer
  11660. greater than zero. The default value is 60000.
  11661. @item th_xh
  11662. Set threshold to detect frames as similar. The option value must be an integer
  11663. greater than zero. The default value is 116.
  11664. @item th_di
  11665. Set the minimum length of a sequence in frames to recognize it as matching
  11666. sequence. The option value must be a non negative integer value.
  11667. The default value is 0.
  11668. @item th_it
  11669. Set the minimum relation, that matching frames to all frames must have.
  11670. The option value must be a double value between 0 and 1. The default value is 0.5.
  11671. @end table
  11672. @subsection Examples
  11673. @itemize
  11674. @item
  11675. To calculate the signature of an input video and store it in signature.bin:
  11676. @example
  11677. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11678. @end example
  11679. @item
  11680. To detect whether two videos match and store the signatures in XML format in
  11681. signature0.xml and signature1.xml:
  11682. @example
  11683. 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 -
  11684. @end example
  11685. @end itemize
  11686. @anchor{smartblur}
  11687. @section smartblur
  11688. Blur the input video without impacting the outlines.
  11689. It accepts the following options:
  11690. @table @option
  11691. @item luma_radius, lr
  11692. Set the luma radius. The option value must be a float number in
  11693. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11694. used to blur the image (slower if larger). Default value is 1.0.
  11695. @item luma_strength, ls
  11696. Set the luma strength. The option value must be a float number
  11697. in the range [-1.0,1.0] that configures the blurring. A value included
  11698. in [0.0,1.0] will blur the image whereas a value included in
  11699. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11700. @item luma_threshold, lt
  11701. Set the luma threshold used as a coefficient to determine
  11702. whether a pixel should be blurred or not. The option value must be an
  11703. integer in the range [-30,30]. A value of 0 will filter all the image,
  11704. a value included in [0,30] will filter flat areas and a value included
  11705. in [-30,0] will filter edges. Default value is 0.
  11706. @item chroma_radius, cr
  11707. Set the chroma radius. The option value must be a float number in
  11708. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11709. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11710. @item chroma_strength, cs
  11711. Set the chroma strength. The option value must be a float number
  11712. in the range [-1.0,1.0] that configures the blurring. A value included
  11713. in [0.0,1.0] will blur the image whereas a value included in
  11714. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11715. @item chroma_threshold, ct
  11716. Set the chroma threshold used as a coefficient to determine
  11717. whether a pixel should be blurred or not. The option value must be an
  11718. integer in the range [-30,30]. A value of 0 will filter all the image,
  11719. a value included in [0,30] will filter flat areas and a value included
  11720. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11721. @end table
  11722. If a chroma option is not explicitly set, the corresponding luma value
  11723. is set.
  11724. @section ssim
  11725. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11726. This filter takes in input two input videos, the first input is
  11727. considered the "main" source and is passed unchanged to the
  11728. output. The second input is used as a "reference" video for computing
  11729. the SSIM.
  11730. Both video inputs must have the same resolution and pixel format for
  11731. this filter to work correctly. Also it assumes that both inputs
  11732. have the same number of frames, which are compared one by one.
  11733. The filter stores the calculated SSIM of each frame.
  11734. The description of the accepted parameters follows.
  11735. @table @option
  11736. @item stats_file, f
  11737. If specified the filter will use the named file to save the SSIM of
  11738. each individual frame. When filename equals "-" the data is sent to
  11739. standard output.
  11740. @end table
  11741. The file printed if @var{stats_file} is selected, contains a sequence of
  11742. key/value pairs of the form @var{key}:@var{value} for each compared
  11743. couple of frames.
  11744. A description of each shown parameter follows:
  11745. @table @option
  11746. @item n
  11747. sequential number of the input frame, starting from 1
  11748. @item Y, U, V, R, G, B
  11749. SSIM of the compared frames for the component specified by the suffix.
  11750. @item All
  11751. SSIM of the compared frames for the whole frame.
  11752. @item dB
  11753. Same as above but in dB representation.
  11754. @end table
  11755. This filter also supports the @ref{framesync} options.
  11756. For example:
  11757. @example
  11758. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11759. [main][ref] ssim="stats_file=stats.log" [out]
  11760. @end example
  11761. On this example the input file being processed is compared with the
  11762. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11763. is stored in @file{stats.log}.
  11764. Another example with both psnr and ssim at same time:
  11765. @example
  11766. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11767. @end example
  11768. @section stereo3d
  11769. Convert between different stereoscopic image formats.
  11770. The filters accept the following options:
  11771. @table @option
  11772. @item in
  11773. Set stereoscopic image format of input.
  11774. Available values for input image formats are:
  11775. @table @samp
  11776. @item sbsl
  11777. side by side parallel (left eye left, right eye right)
  11778. @item sbsr
  11779. side by side crosseye (right eye left, left eye right)
  11780. @item sbs2l
  11781. side by side parallel with half width resolution
  11782. (left eye left, right eye right)
  11783. @item sbs2r
  11784. side by side crosseye with half width resolution
  11785. (right eye left, left eye right)
  11786. @item abl
  11787. above-below (left eye above, right eye below)
  11788. @item abr
  11789. above-below (right eye above, left eye below)
  11790. @item ab2l
  11791. above-below with half height resolution
  11792. (left eye above, right eye below)
  11793. @item ab2r
  11794. above-below with half height resolution
  11795. (right eye above, left eye below)
  11796. @item al
  11797. alternating frames (left eye first, right eye second)
  11798. @item ar
  11799. alternating frames (right eye first, left eye second)
  11800. @item irl
  11801. interleaved rows (left eye has top row, right eye starts on next row)
  11802. @item irr
  11803. interleaved rows (right eye has top row, left eye starts on next row)
  11804. @item icl
  11805. interleaved columns, left eye first
  11806. @item icr
  11807. interleaved columns, right eye first
  11808. Default value is @samp{sbsl}.
  11809. @end table
  11810. @item out
  11811. Set stereoscopic image format of output.
  11812. @table @samp
  11813. @item sbsl
  11814. side by side parallel (left eye left, right eye right)
  11815. @item sbsr
  11816. side by side crosseye (right eye left, left eye right)
  11817. @item sbs2l
  11818. side by side parallel with half width resolution
  11819. (left eye left, right eye right)
  11820. @item sbs2r
  11821. side by side crosseye with half width resolution
  11822. (right eye left, left eye right)
  11823. @item abl
  11824. above-below (left eye above, right eye below)
  11825. @item abr
  11826. above-below (right eye above, left eye below)
  11827. @item ab2l
  11828. above-below with half height resolution
  11829. (left eye above, right eye below)
  11830. @item ab2r
  11831. above-below with half height resolution
  11832. (right eye above, left eye below)
  11833. @item al
  11834. alternating frames (left eye first, right eye second)
  11835. @item ar
  11836. alternating frames (right eye first, left eye second)
  11837. @item irl
  11838. interleaved rows (left eye has top row, right eye starts on next row)
  11839. @item irr
  11840. interleaved rows (right eye has top row, left eye starts on next row)
  11841. @item arbg
  11842. anaglyph red/blue gray
  11843. (red filter on left eye, blue filter on right eye)
  11844. @item argg
  11845. anaglyph red/green gray
  11846. (red filter on left eye, green filter on right eye)
  11847. @item arcg
  11848. anaglyph red/cyan gray
  11849. (red filter on left eye, cyan filter on right eye)
  11850. @item arch
  11851. anaglyph red/cyan half colored
  11852. (red filter on left eye, cyan filter on right eye)
  11853. @item arcc
  11854. anaglyph red/cyan color
  11855. (red filter on left eye, cyan filter on right eye)
  11856. @item arcd
  11857. anaglyph red/cyan color optimized with the least squares projection of dubois
  11858. (red filter on left eye, cyan filter on right eye)
  11859. @item agmg
  11860. anaglyph green/magenta gray
  11861. (green filter on left eye, magenta filter on right eye)
  11862. @item agmh
  11863. anaglyph green/magenta half colored
  11864. (green filter on left eye, magenta filter on right eye)
  11865. @item agmc
  11866. anaglyph green/magenta colored
  11867. (green filter on left eye, magenta filter on right eye)
  11868. @item agmd
  11869. anaglyph green/magenta color optimized with the least squares projection of dubois
  11870. (green filter on left eye, magenta filter on right eye)
  11871. @item aybg
  11872. anaglyph yellow/blue gray
  11873. (yellow filter on left eye, blue filter on right eye)
  11874. @item aybh
  11875. anaglyph yellow/blue half colored
  11876. (yellow filter on left eye, blue filter on right eye)
  11877. @item aybc
  11878. anaglyph yellow/blue colored
  11879. (yellow filter on left eye, blue filter on right eye)
  11880. @item aybd
  11881. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11882. (yellow filter on left eye, blue filter on right eye)
  11883. @item ml
  11884. mono output (left eye only)
  11885. @item mr
  11886. mono output (right eye only)
  11887. @item chl
  11888. checkerboard, left eye first
  11889. @item chr
  11890. checkerboard, right eye first
  11891. @item icl
  11892. interleaved columns, left eye first
  11893. @item icr
  11894. interleaved columns, right eye first
  11895. @item hdmi
  11896. HDMI frame pack
  11897. @end table
  11898. Default value is @samp{arcd}.
  11899. @end table
  11900. @subsection Examples
  11901. @itemize
  11902. @item
  11903. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11904. @example
  11905. stereo3d=sbsl:aybd
  11906. @end example
  11907. @item
  11908. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11909. @example
  11910. stereo3d=abl:sbsr
  11911. @end example
  11912. @end itemize
  11913. @section streamselect, astreamselect
  11914. Select video or audio streams.
  11915. The filter accepts the following options:
  11916. @table @option
  11917. @item inputs
  11918. Set number of inputs. Default is 2.
  11919. @item map
  11920. Set input indexes to remap to outputs.
  11921. @end table
  11922. @subsection Commands
  11923. The @code{streamselect} and @code{astreamselect} filter supports the following
  11924. commands:
  11925. @table @option
  11926. @item map
  11927. Set input indexes to remap to outputs.
  11928. @end table
  11929. @subsection Examples
  11930. @itemize
  11931. @item
  11932. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11933. @example
  11934. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11935. @end example
  11936. @item
  11937. Same as above, but for audio:
  11938. @example
  11939. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11940. @end example
  11941. @end itemize
  11942. @section sobel
  11943. Apply sobel operator to input video stream.
  11944. The filter accepts the following option:
  11945. @table @option
  11946. @item planes
  11947. Set which planes will be processed, unprocessed planes will be copied.
  11948. By default value 0xf, all planes will be processed.
  11949. @item scale
  11950. Set value which will be multiplied with filtered result.
  11951. @item delta
  11952. Set value which will be added to filtered result.
  11953. @end table
  11954. @anchor{spp}
  11955. @section spp
  11956. Apply a simple postprocessing filter that compresses and decompresses the image
  11957. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11958. and average the results.
  11959. The filter accepts the following options:
  11960. @table @option
  11961. @item quality
  11962. Set quality. This option defines the number of levels for averaging. It accepts
  11963. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11964. effect. A value of @code{6} means the higher quality. For each increment of
  11965. that value the speed drops by a factor of approximately 2. Default value is
  11966. @code{3}.
  11967. @item qp
  11968. Force a constant quantization parameter. If not set, the filter will use the QP
  11969. from the video stream (if available).
  11970. @item mode
  11971. Set thresholding mode. Available modes are:
  11972. @table @samp
  11973. @item hard
  11974. Set hard thresholding (default).
  11975. @item soft
  11976. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11977. @end table
  11978. @item use_bframe_qp
  11979. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11980. option may cause flicker since the B-Frames have often larger QP. Default is
  11981. @code{0} (not enabled).
  11982. @end table
  11983. @section sr
  11984. Scale the input by applying one of the super-resolution methods based on
  11985. convolutional neural networks. Supported models:
  11986. @itemize
  11987. @item
  11988. Super-Resolution Convolutional Neural Network model (SRCNN).
  11989. See @url{https://arxiv.org/abs/1501.00092}.
  11990. @item
  11991. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  11992. See @url{https://arxiv.org/abs/1609.05158}.
  11993. @end itemize
  11994. Training scripts as well as scripts for model generation are provided in
  11995. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  11996. The filter accepts the following options:
  11997. @table @option
  11998. @item dnn_backend
  11999. Specify which DNN backend to use for model loading and execution. This option accepts
  12000. the following values:
  12001. @table @samp
  12002. @item native
  12003. Native implementation of DNN loading and execution.
  12004. @item tensorflow
  12005. TensorFlow backend. To enable this backend you
  12006. need to install the TensorFlow for C library (see
  12007. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12008. @code{--enable-libtensorflow}
  12009. @end table
  12010. Default value is @samp{native}.
  12011. @item model
  12012. Set path to model file specifying network architecture and its parameters.
  12013. Note that different backends use different file formats. TensorFlow backend
  12014. can load files for both formats, while native backend can load files for only
  12015. its format.
  12016. @item scale_factor
  12017. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12018. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12019. input upscaled using bicubic upscaling with proper scale factor.
  12020. @end table
  12021. @anchor{subtitles}
  12022. @section subtitles
  12023. Draw subtitles on top of input video using the libass library.
  12024. To enable compilation of this filter you need to configure FFmpeg with
  12025. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12026. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12027. Alpha) subtitles format.
  12028. The filter accepts the following options:
  12029. @table @option
  12030. @item filename, f
  12031. Set the filename of the subtitle file to read. It must be specified.
  12032. @item original_size
  12033. Specify the size of the original video, the video for which the ASS file
  12034. was composed. For the syntax of this option, check the
  12035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12036. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12037. correctly scale the fonts if the aspect ratio has been changed.
  12038. @item fontsdir
  12039. Set a directory path containing fonts that can be used by the filter.
  12040. These fonts will be used in addition to whatever the font provider uses.
  12041. @item alpha
  12042. Process alpha channel, by default alpha channel is untouched.
  12043. @item charenc
  12044. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12045. useful if not UTF-8.
  12046. @item stream_index, si
  12047. Set subtitles stream index. @code{subtitles} filter only.
  12048. @item force_style
  12049. Override default style or script info parameters of the subtitles. It accepts a
  12050. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12051. @end table
  12052. If the first key is not specified, it is assumed that the first value
  12053. specifies the @option{filename}.
  12054. For example, to render the file @file{sub.srt} on top of the input
  12055. video, use the command:
  12056. @example
  12057. subtitles=sub.srt
  12058. @end example
  12059. which is equivalent to:
  12060. @example
  12061. subtitles=filename=sub.srt
  12062. @end example
  12063. To render the default subtitles stream from file @file{video.mkv}, use:
  12064. @example
  12065. subtitles=video.mkv
  12066. @end example
  12067. To render the second subtitles stream from that file, use:
  12068. @example
  12069. subtitles=video.mkv:si=1
  12070. @end example
  12071. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12072. @code{DejaVu Serif}, use:
  12073. @example
  12074. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12075. @end example
  12076. @section super2xsai
  12077. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12078. Interpolate) pixel art scaling algorithm.
  12079. Useful for enlarging pixel art images without reducing sharpness.
  12080. @section swaprect
  12081. Swap two rectangular objects in video.
  12082. This filter accepts the following options:
  12083. @table @option
  12084. @item w
  12085. Set object width.
  12086. @item h
  12087. Set object height.
  12088. @item x1
  12089. Set 1st rect x coordinate.
  12090. @item y1
  12091. Set 1st rect y coordinate.
  12092. @item x2
  12093. Set 2nd rect x coordinate.
  12094. @item y2
  12095. Set 2nd rect y coordinate.
  12096. All expressions are evaluated once for each frame.
  12097. @end table
  12098. The all options are expressions containing the following constants:
  12099. @table @option
  12100. @item w
  12101. @item h
  12102. The input width and height.
  12103. @item a
  12104. same as @var{w} / @var{h}
  12105. @item sar
  12106. input sample aspect ratio
  12107. @item dar
  12108. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12109. @item n
  12110. The number of the input frame, starting from 0.
  12111. @item t
  12112. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12113. @item pos
  12114. the position in the file of the input frame, NAN if unknown
  12115. @end table
  12116. @section swapuv
  12117. Swap U & V plane.
  12118. @section telecine
  12119. Apply telecine process to the video.
  12120. This filter accepts the following options:
  12121. @table @option
  12122. @item first_field
  12123. @table @samp
  12124. @item top, t
  12125. top field first
  12126. @item bottom, b
  12127. bottom field first
  12128. The default value is @code{top}.
  12129. @end table
  12130. @item pattern
  12131. A string of numbers representing the pulldown pattern you wish to apply.
  12132. The default value is @code{23}.
  12133. @end table
  12134. @example
  12135. Some typical patterns:
  12136. NTSC output (30i):
  12137. 27.5p: 32222
  12138. 24p: 23 (classic)
  12139. 24p: 2332 (preferred)
  12140. 20p: 33
  12141. 18p: 334
  12142. 16p: 3444
  12143. PAL output (25i):
  12144. 27.5p: 12222
  12145. 24p: 222222222223 ("Euro pulldown")
  12146. 16.67p: 33
  12147. 16p: 33333334
  12148. @end example
  12149. @section threshold
  12150. Apply threshold effect to video stream.
  12151. This filter needs four video streams to perform thresholding.
  12152. First stream is stream we are filtering.
  12153. Second stream is holding threshold values, third stream is holding min values,
  12154. and last, fourth stream is holding max values.
  12155. The filter accepts the following option:
  12156. @table @option
  12157. @item planes
  12158. Set which planes will be processed, unprocessed planes will be copied.
  12159. By default value 0xf, all planes will be processed.
  12160. @end table
  12161. For example if first stream pixel's component value is less then threshold value
  12162. of pixel component from 2nd threshold stream, third stream value will picked,
  12163. otherwise fourth stream pixel component value will be picked.
  12164. Using color source filter one can perform various types of thresholding:
  12165. @subsection Examples
  12166. @itemize
  12167. @item
  12168. Binary threshold, using gray color as threshold:
  12169. @example
  12170. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12171. @end example
  12172. @item
  12173. Inverted binary threshold, using gray color as threshold:
  12174. @example
  12175. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12176. @end example
  12177. @item
  12178. Truncate binary threshold, using gray color as threshold:
  12179. @example
  12180. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12181. @end example
  12182. @item
  12183. Threshold to zero, using gray color as threshold:
  12184. @example
  12185. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12186. @end example
  12187. @item
  12188. Inverted threshold to zero, using gray color as threshold:
  12189. @example
  12190. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12191. @end example
  12192. @end itemize
  12193. @section thumbnail
  12194. Select the most representative frame in a given sequence of consecutive frames.
  12195. The filter accepts the following options:
  12196. @table @option
  12197. @item n
  12198. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12199. will pick one of them, and then handle the next batch of @var{n} frames until
  12200. the end. Default is @code{100}.
  12201. @end table
  12202. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12203. value will result in a higher memory usage, so a high value is not recommended.
  12204. @subsection Examples
  12205. @itemize
  12206. @item
  12207. Extract one picture each 50 frames:
  12208. @example
  12209. thumbnail=50
  12210. @end example
  12211. @item
  12212. Complete example of a thumbnail creation with @command{ffmpeg}:
  12213. @example
  12214. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12215. @end example
  12216. @end itemize
  12217. @section tile
  12218. Tile several successive frames together.
  12219. The filter accepts the following options:
  12220. @table @option
  12221. @item layout
  12222. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12223. this option, check the
  12224. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12225. @item nb_frames
  12226. Set the maximum number of frames to render in the given area. It must be less
  12227. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12228. the area will be used.
  12229. @item margin
  12230. Set the outer border margin in pixels.
  12231. @item padding
  12232. Set the inner border thickness (i.e. the number of pixels between frames). For
  12233. more advanced padding options (such as having different values for the edges),
  12234. refer to the pad video filter.
  12235. @item color
  12236. Specify the color of the unused area. For the syntax of this option, check the
  12237. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12238. The default value of @var{color} is "black".
  12239. @item overlap
  12240. Set the number of frames to overlap when tiling several successive frames together.
  12241. The value must be between @code{0} and @var{nb_frames - 1}.
  12242. @item init_padding
  12243. Set the number of frames to initially be empty before displaying first output frame.
  12244. This controls how soon will one get first output frame.
  12245. The value must be between @code{0} and @var{nb_frames - 1}.
  12246. @end table
  12247. @subsection Examples
  12248. @itemize
  12249. @item
  12250. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12251. @example
  12252. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12253. @end example
  12254. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12255. duplicating each output frame to accommodate the originally detected frame
  12256. rate.
  12257. @item
  12258. Display @code{5} pictures in an area of @code{3x2} frames,
  12259. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12260. mixed flat and named options:
  12261. @example
  12262. tile=3x2:nb_frames=5:padding=7:margin=2
  12263. @end example
  12264. @end itemize
  12265. @section tinterlace
  12266. Perform various types of temporal field interlacing.
  12267. Frames are counted starting from 1, so the first input frame is
  12268. considered odd.
  12269. The filter accepts the following options:
  12270. @table @option
  12271. @item mode
  12272. Specify the mode of the interlacing. This option can also be specified
  12273. as a value alone. See below for a list of values for this option.
  12274. Available values are:
  12275. @table @samp
  12276. @item merge, 0
  12277. Move odd frames into the upper field, even into the lower field,
  12278. generating a double height frame at half frame rate.
  12279. @example
  12280. ------> time
  12281. Input:
  12282. Frame 1 Frame 2 Frame 3 Frame 4
  12283. 11111 22222 33333 44444
  12284. 11111 22222 33333 44444
  12285. 11111 22222 33333 44444
  12286. 11111 22222 33333 44444
  12287. Output:
  12288. 11111 33333
  12289. 22222 44444
  12290. 11111 33333
  12291. 22222 44444
  12292. 11111 33333
  12293. 22222 44444
  12294. 11111 33333
  12295. 22222 44444
  12296. @end example
  12297. @item drop_even, 1
  12298. Only output odd frames, even frames are dropped, generating a frame with
  12299. unchanged height at half frame rate.
  12300. @example
  12301. ------> time
  12302. Input:
  12303. Frame 1 Frame 2 Frame 3 Frame 4
  12304. 11111 22222 33333 44444
  12305. 11111 22222 33333 44444
  12306. 11111 22222 33333 44444
  12307. 11111 22222 33333 44444
  12308. Output:
  12309. 11111 33333
  12310. 11111 33333
  12311. 11111 33333
  12312. 11111 33333
  12313. @end example
  12314. @item drop_odd, 2
  12315. Only output even frames, odd frames are dropped, generating a frame with
  12316. unchanged height at half frame rate.
  12317. @example
  12318. ------> time
  12319. Input:
  12320. Frame 1 Frame 2 Frame 3 Frame 4
  12321. 11111 22222 33333 44444
  12322. 11111 22222 33333 44444
  12323. 11111 22222 33333 44444
  12324. 11111 22222 33333 44444
  12325. Output:
  12326. 22222 44444
  12327. 22222 44444
  12328. 22222 44444
  12329. 22222 44444
  12330. @end example
  12331. @item pad, 3
  12332. Expand each frame to full height, but pad alternate lines with black,
  12333. generating a frame with double height at the same input frame rate.
  12334. @example
  12335. ------> time
  12336. Input:
  12337. Frame 1 Frame 2 Frame 3 Frame 4
  12338. 11111 22222 33333 44444
  12339. 11111 22222 33333 44444
  12340. 11111 22222 33333 44444
  12341. 11111 22222 33333 44444
  12342. Output:
  12343. 11111 ..... 33333 .....
  12344. ..... 22222 ..... 44444
  12345. 11111 ..... 33333 .....
  12346. ..... 22222 ..... 44444
  12347. 11111 ..... 33333 .....
  12348. ..... 22222 ..... 44444
  12349. 11111 ..... 33333 .....
  12350. ..... 22222 ..... 44444
  12351. @end example
  12352. @item interleave_top, 4
  12353. Interleave the upper field from odd frames with the lower field from
  12354. even frames, generating a frame with unchanged height at half frame rate.
  12355. @example
  12356. ------> time
  12357. Input:
  12358. Frame 1 Frame 2 Frame 3 Frame 4
  12359. 11111<- 22222 33333<- 44444
  12360. 11111 22222<- 33333 44444<-
  12361. 11111<- 22222 33333<- 44444
  12362. 11111 22222<- 33333 44444<-
  12363. Output:
  12364. 11111 33333
  12365. 22222 44444
  12366. 11111 33333
  12367. 22222 44444
  12368. @end example
  12369. @item interleave_bottom, 5
  12370. Interleave the lower field from odd frames with the upper field from
  12371. even frames, generating a frame with unchanged height at half frame rate.
  12372. @example
  12373. ------> time
  12374. Input:
  12375. Frame 1 Frame 2 Frame 3 Frame 4
  12376. 11111 22222<- 33333 44444<-
  12377. 11111<- 22222 33333<- 44444
  12378. 11111 22222<- 33333 44444<-
  12379. 11111<- 22222 33333<- 44444
  12380. Output:
  12381. 22222 44444
  12382. 11111 33333
  12383. 22222 44444
  12384. 11111 33333
  12385. @end example
  12386. @item interlacex2, 6
  12387. Double frame rate with unchanged height. Frames are inserted each
  12388. containing the second temporal field from the previous input frame and
  12389. the first temporal field from the next input frame. This mode relies on
  12390. the top_field_first flag. Useful for interlaced video displays with no
  12391. field synchronisation.
  12392. @example
  12393. ------> time
  12394. Input:
  12395. Frame 1 Frame 2 Frame 3 Frame 4
  12396. 11111 22222 33333 44444
  12397. 11111 22222 33333 44444
  12398. 11111 22222 33333 44444
  12399. 11111 22222 33333 44444
  12400. Output:
  12401. 11111 22222 22222 33333 33333 44444 44444
  12402. 11111 11111 22222 22222 33333 33333 44444
  12403. 11111 22222 22222 33333 33333 44444 44444
  12404. 11111 11111 22222 22222 33333 33333 44444
  12405. @end example
  12406. @item mergex2, 7
  12407. Move odd frames into the upper field, even into the lower field,
  12408. generating a double height frame at same frame rate.
  12409. @example
  12410. ------> time
  12411. Input:
  12412. Frame 1 Frame 2 Frame 3 Frame 4
  12413. 11111 22222 33333 44444
  12414. 11111 22222 33333 44444
  12415. 11111 22222 33333 44444
  12416. 11111 22222 33333 44444
  12417. Output:
  12418. 11111 33333 33333 55555
  12419. 22222 22222 44444 44444
  12420. 11111 33333 33333 55555
  12421. 22222 22222 44444 44444
  12422. 11111 33333 33333 55555
  12423. 22222 22222 44444 44444
  12424. 11111 33333 33333 55555
  12425. 22222 22222 44444 44444
  12426. @end example
  12427. @end table
  12428. Numeric values are deprecated but are accepted for backward
  12429. compatibility reasons.
  12430. Default mode is @code{merge}.
  12431. @item flags
  12432. Specify flags influencing the filter process.
  12433. Available value for @var{flags} is:
  12434. @table @option
  12435. @item low_pass_filter, vlfp
  12436. Enable linear vertical low-pass filtering in the filter.
  12437. Vertical low-pass filtering is required when creating an interlaced
  12438. destination from a progressive source which contains high-frequency
  12439. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12440. patterning.
  12441. @item complex_filter, cvlfp
  12442. Enable complex vertical low-pass filtering.
  12443. This will slightly less reduce interlace 'twitter' and Moire
  12444. patterning but better retain detail and subjective sharpness impression.
  12445. @end table
  12446. Vertical low-pass filtering can only be enabled for @option{mode}
  12447. @var{interleave_top} and @var{interleave_bottom}.
  12448. @end table
  12449. @section tmix
  12450. Mix successive video frames.
  12451. A description of the accepted options follows.
  12452. @table @option
  12453. @item frames
  12454. The number of successive frames to mix. If unspecified, it defaults to 3.
  12455. @item weights
  12456. Specify weight of each input video frame.
  12457. Each weight is separated by space. If number of weights is smaller than
  12458. number of @var{frames} last specified weight will be used for all remaining
  12459. unset weights.
  12460. @item scale
  12461. Specify scale, if it is set it will be multiplied with sum
  12462. of each weight multiplied with pixel values to give final destination
  12463. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12464. @end table
  12465. @subsection Examples
  12466. @itemize
  12467. @item
  12468. Average 7 successive frames:
  12469. @example
  12470. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12471. @end example
  12472. @item
  12473. Apply simple temporal convolution:
  12474. @example
  12475. tmix=frames=3:weights="-1 3 -1"
  12476. @end example
  12477. @item
  12478. Similar as above but only showing temporal differences:
  12479. @example
  12480. tmix=frames=3:weights="-1 2 -1":scale=1
  12481. @end example
  12482. @end itemize
  12483. @section tonemap
  12484. Tone map colors from different dynamic ranges.
  12485. This filter expects data in single precision floating point, as it needs to
  12486. operate on (and can output) out-of-range values. Another filter, such as
  12487. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12488. The tonemapping algorithms implemented only work on linear light, so input
  12489. data should be linearized beforehand (and possibly correctly tagged).
  12490. @example
  12491. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12492. @end example
  12493. @subsection Options
  12494. The filter accepts the following options.
  12495. @table @option
  12496. @item tonemap
  12497. Set the tone map algorithm to use.
  12498. Possible values are:
  12499. @table @var
  12500. @item none
  12501. Do not apply any tone map, only desaturate overbright pixels.
  12502. @item clip
  12503. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12504. in-range values, while distorting out-of-range values.
  12505. @item linear
  12506. Stretch the entire reference gamut to a linear multiple of the display.
  12507. @item gamma
  12508. Fit a logarithmic transfer between the tone curves.
  12509. @item reinhard
  12510. Preserve overall image brightness with a simple curve, using nonlinear
  12511. contrast, which results in flattening details and degrading color accuracy.
  12512. @item hable
  12513. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12514. of slightly darkening everything. Use it when detail preservation is more
  12515. important than color and brightness accuracy.
  12516. @item mobius
  12517. Smoothly map out-of-range values, while retaining contrast and colors for
  12518. in-range material as much as possible. Use it when color accuracy is more
  12519. important than detail preservation.
  12520. @end table
  12521. Default is none.
  12522. @item param
  12523. Tune the tone mapping algorithm.
  12524. This affects the following algorithms:
  12525. @table @var
  12526. @item none
  12527. Ignored.
  12528. @item linear
  12529. Specifies the scale factor to use while stretching.
  12530. Default to 1.0.
  12531. @item gamma
  12532. Specifies the exponent of the function.
  12533. Default to 1.8.
  12534. @item clip
  12535. Specify an extra linear coefficient to multiply into the signal before clipping.
  12536. Default to 1.0.
  12537. @item reinhard
  12538. Specify the local contrast coefficient at the display peak.
  12539. Default to 0.5, which means that in-gamut values will be about half as bright
  12540. as when clipping.
  12541. @item hable
  12542. Ignored.
  12543. @item mobius
  12544. Specify the transition point from linear to mobius transform. Every value
  12545. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12546. more accurate the result will be, at the cost of losing bright details.
  12547. Default to 0.3, which due to the steep initial slope still preserves in-range
  12548. colors fairly accurately.
  12549. @end table
  12550. @item desat
  12551. Apply desaturation for highlights that exceed this level of brightness. The
  12552. higher the parameter, the more color information will be preserved. This
  12553. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12554. (smoothly) turning into white instead. This makes images feel more natural,
  12555. at the cost of reducing information about out-of-range colors.
  12556. The default of 2.0 is somewhat conservative and will mostly just apply to
  12557. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12558. This option works only if the input frame has a supported color tag.
  12559. @item peak
  12560. Override signal/nominal/reference peak with this value. Useful when the
  12561. embedded peak information in display metadata is not reliable or when tone
  12562. mapping from a lower range to a higher range.
  12563. @end table
  12564. @anchor{transpose}
  12565. @section transpose
  12566. Transpose rows with columns in the input video and optionally flip it.
  12567. It accepts the following parameters:
  12568. @table @option
  12569. @item dir
  12570. Specify the transposition direction.
  12571. Can assume the following values:
  12572. @table @samp
  12573. @item 0, 4, cclock_flip
  12574. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12575. @example
  12576. L.R L.l
  12577. . . -> . .
  12578. l.r R.r
  12579. @end example
  12580. @item 1, 5, clock
  12581. Rotate by 90 degrees clockwise, that is:
  12582. @example
  12583. L.R l.L
  12584. . . -> . .
  12585. l.r r.R
  12586. @end example
  12587. @item 2, 6, cclock
  12588. Rotate by 90 degrees counterclockwise, that is:
  12589. @example
  12590. L.R R.r
  12591. . . -> . .
  12592. l.r L.l
  12593. @end example
  12594. @item 3, 7, clock_flip
  12595. Rotate by 90 degrees clockwise and vertically flip, that is:
  12596. @example
  12597. L.R r.R
  12598. . . -> . .
  12599. l.r l.L
  12600. @end example
  12601. @end table
  12602. For values between 4-7, the transposition is only done if the input
  12603. video geometry is portrait and not landscape. These values are
  12604. deprecated, the @code{passthrough} option should be used instead.
  12605. Numerical values are deprecated, and should be dropped in favor of
  12606. symbolic constants.
  12607. @item passthrough
  12608. Do not apply the transposition if the input geometry matches the one
  12609. specified by the specified value. It accepts the following values:
  12610. @table @samp
  12611. @item none
  12612. Always apply transposition.
  12613. @item portrait
  12614. Preserve portrait geometry (when @var{height} >= @var{width}).
  12615. @item landscape
  12616. Preserve landscape geometry (when @var{width} >= @var{height}).
  12617. @end table
  12618. Default value is @code{none}.
  12619. @end table
  12620. For example to rotate by 90 degrees clockwise and preserve portrait
  12621. layout:
  12622. @example
  12623. transpose=dir=1:passthrough=portrait
  12624. @end example
  12625. The command above can also be specified as:
  12626. @example
  12627. transpose=1:portrait
  12628. @end example
  12629. @section transpose_npp
  12630. Transpose rows with columns in the input video and optionally flip it.
  12631. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  12632. It accepts the following parameters:
  12633. @table @option
  12634. @item dir
  12635. Specify the transposition direction.
  12636. Can assume the following values:
  12637. @table @samp
  12638. @item cclock_flip
  12639. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  12640. @item clock
  12641. Rotate by 90 degrees clockwise.
  12642. @item cclock
  12643. Rotate by 90 degrees counterclockwise.
  12644. @item clock_flip
  12645. Rotate by 90 degrees clockwise and vertically flip.
  12646. @end table
  12647. @item passthrough
  12648. Do not apply the transposition if the input geometry matches the one
  12649. specified by the specified value. It accepts the following values:
  12650. @table @samp
  12651. @item none
  12652. Always apply transposition. (default)
  12653. @item portrait
  12654. Preserve portrait geometry (when @var{height} >= @var{width}).
  12655. @item landscape
  12656. Preserve landscape geometry (when @var{width} >= @var{height}).
  12657. @end table
  12658. @end table
  12659. @section trim
  12660. Trim the input so that the output contains one continuous subpart of the input.
  12661. It accepts the following parameters:
  12662. @table @option
  12663. @item start
  12664. Specify the time of the start of the kept section, i.e. the frame with the
  12665. timestamp @var{start} will be the first frame in the output.
  12666. @item end
  12667. Specify the time of the first frame that will be dropped, i.e. the frame
  12668. immediately preceding the one with the timestamp @var{end} will be the last
  12669. frame in the output.
  12670. @item start_pts
  12671. This is the same as @var{start}, except this option sets the start timestamp
  12672. in timebase units instead of seconds.
  12673. @item end_pts
  12674. This is the same as @var{end}, except this option sets the end timestamp
  12675. in timebase units instead of seconds.
  12676. @item duration
  12677. The maximum duration of the output in seconds.
  12678. @item start_frame
  12679. The number of the first frame that should be passed to the output.
  12680. @item end_frame
  12681. The number of the first frame that should be dropped.
  12682. @end table
  12683. @option{start}, @option{end}, and @option{duration} are expressed as time
  12684. duration specifications; see
  12685. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12686. for the accepted syntax.
  12687. Note that the first two sets of the start/end options and the @option{duration}
  12688. option look at the frame timestamp, while the _frame variants simply count the
  12689. frames that pass through the filter. Also note that this filter does not modify
  12690. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12691. setpts filter after the trim filter.
  12692. If multiple start or end options are set, this filter tries to be greedy and
  12693. keep all the frames that match at least one of the specified constraints. To keep
  12694. only the part that matches all the constraints at once, chain multiple trim
  12695. filters.
  12696. The defaults are such that all the input is kept. So it is possible to set e.g.
  12697. just the end values to keep everything before the specified time.
  12698. Examples:
  12699. @itemize
  12700. @item
  12701. Drop everything except the second minute of input:
  12702. @example
  12703. ffmpeg -i INPUT -vf trim=60:120
  12704. @end example
  12705. @item
  12706. Keep only the first second:
  12707. @example
  12708. ffmpeg -i INPUT -vf trim=duration=1
  12709. @end example
  12710. @end itemize
  12711. @section unpremultiply
  12712. Apply alpha unpremultiply effect to input video stream using first plane
  12713. of second stream as alpha.
  12714. Both streams must have same dimensions and same pixel format.
  12715. The filter accepts the following option:
  12716. @table @option
  12717. @item planes
  12718. Set which planes will be processed, unprocessed planes will be copied.
  12719. By default value 0xf, all planes will be processed.
  12720. If the format has 1 or 2 components, then luma is bit 0.
  12721. If the format has 3 or 4 components:
  12722. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12723. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12724. If present, the alpha channel is always the last bit.
  12725. @item inplace
  12726. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12727. @end table
  12728. @anchor{unsharp}
  12729. @section unsharp
  12730. Sharpen or blur the input video.
  12731. It accepts the following parameters:
  12732. @table @option
  12733. @item luma_msize_x, lx
  12734. Set the luma matrix horizontal size. It must be an odd integer between
  12735. 3 and 23. The default value is 5.
  12736. @item luma_msize_y, ly
  12737. Set the luma matrix vertical size. It must be an odd integer between 3
  12738. and 23. The default value is 5.
  12739. @item luma_amount, la
  12740. Set the luma effect strength. It must be a floating point number, reasonable
  12741. values lay between -1.5 and 1.5.
  12742. Negative values will blur the input video, while positive values will
  12743. sharpen it, a value of zero will disable the effect.
  12744. Default value is 1.0.
  12745. @item chroma_msize_x, cx
  12746. Set the chroma matrix horizontal size. It must be an odd integer
  12747. between 3 and 23. The default value is 5.
  12748. @item chroma_msize_y, cy
  12749. Set the chroma matrix vertical size. It must be an odd integer
  12750. between 3 and 23. The default value is 5.
  12751. @item chroma_amount, ca
  12752. Set the chroma effect strength. It must be a floating point number, reasonable
  12753. values lay between -1.5 and 1.5.
  12754. Negative values will blur the input video, while positive values will
  12755. sharpen it, a value of zero will disable the effect.
  12756. Default value is 0.0.
  12757. @end table
  12758. All parameters are optional and default to the equivalent of the
  12759. string '5:5:1.0:5:5:0.0'.
  12760. @subsection Examples
  12761. @itemize
  12762. @item
  12763. Apply strong luma sharpen effect:
  12764. @example
  12765. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12766. @end example
  12767. @item
  12768. Apply a strong blur of both luma and chroma parameters:
  12769. @example
  12770. unsharp=7:7:-2:7:7:-2
  12771. @end example
  12772. @end itemize
  12773. @section uspp
  12774. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12775. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12776. shifts and average the results.
  12777. The way this differs from the behavior of spp is that uspp actually encodes &
  12778. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12779. DCT similar to MJPEG.
  12780. The filter accepts the following options:
  12781. @table @option
  12782. @item quality
  12783. Set quality. This option defines the number of levels for averaging. It accepts
  12784. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12785. effect. A value of @code{8} means the higher quality. For each increment of
  12786. that value the speed drops by a factor of approximately 2. Default value is
  12787. @code{3}.
  12788. @item qp
  12789. Force a constant quantization parameter. If not set, the filter will use the QP
  12790. from the video stream (if available).
  12791. @end table
  12792. @section vaguedenoiser
  12793. Apply a wavelet based denoiser.
  12794. It transforms each frame from the video input into the wavelet domain,
  12795. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12796. the obtained coefficients. It does an inverse wavelet transform after.
  12797. Due to wavelet properties, it should give a nice smoothed result, and
  12798. reduced noise, without blurring picture features.
  12799. This filter accepts the following options:
  12800. @table @option
  12801. @item threshold
  12802. The filtering strength. The higher, the more filtered the video will be.
  12803. Hard thresholding can use a higher threshold than soft thresholding
  12804. before the video looks overfiltered. Default value is 2.
  12805. @item method
  12806. The filtering method the filter will use.
  12807. It accepts the following values:
  12808. @table @samp
  12809. @item hard
  12810. All values under the threshold will be zeroed.
  12811. @item soft
  12812. All values under the threshold will be zeroed. All values above will be
  12813. reduced by the threshold.
  12814. @item garrote
  12815. Scales or nullifies coefficients - intermediary between (more) soft and
  12816. (less) hard thresholding.
  12817. @end table
  12818. Default is garrote.
  12819. @item nsteps
  12820. Number of times, the wavelet will decompose the picture. Picture can't
  12821. be decomposed beyond a particular point (typically, 8 for a 640x480
  12822. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12823. @item percent
  12824. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12825. @item planes
  12826. A list of the planes to process. By default all planes are processed.
  12827. @end table
  12828. @section vectorscope
  12829. Display 2 color component values in the two dimensional graph (which is called
  12830. a vectorscope).
  12831. This filter accepts the following options:
  12832. @table @option
  12833. @item mode, m
  12834. Set vectorscope mode.
  12835. It accepts the following values:
  12836. @table @samp
  12837. @item gray
  12838. Gray values are displayed on graph, higher brightness means more pixels have
  12839. same component color value on location in graph. This is the default mode.
  12840. @item color
  12841. Gray values are displayed on graph. Surrounding pixels values which are not
  12842. present in video frame are drawn in gradient of 2 color components which are
  12843. set by option @code{x} and @code{y}. The 3rd color component is static.
  12844. @item color2
  12845. Actual color components values present in video frame are displayed on graph.
  12846. @item color3
  12847. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12848. on graph increases value of another color component, which is luminance by
  12849. default values of @code{x} and @code{y}.
  12850. @item color4
  12851. Actual colors present in video frame are displayed on graph. If two different
  12852. colors map to same position on graph then color with higher value of component
  12853. not present in graph is picked.
  12854. @item color5
  12855. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12856. component picked from radial gradient.
  12857. @end table
  12858. @item x
  12859. Set which color component will be represented on X-axis. Default is @code{1}.
  12860. @item y
  12861. Set which color component will be represented on Y-axis. Default is @code{2}.
  12862. @item intensity, i
  12863. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12864. of color component which represents frequency of (X, Y) location in graph.
  12865. @item envelope, e
  12866. @table @samp
  12867. @item none
  12868. No envelope, this is default.
  12869. @item instant
  12870. Instant envelope, even darkest single pixel will be clearly highlighted.
  12871. @item peak
  12872. Hold maximum and minimum values presented in graph over time. This way you
  12873. can still spot out of range values without constantly looking at vectorscope.
  12874. @item peak+instant
  12875. Peak and instant envelope combined together.
  12876. @end table
  12877. @item graticule, g
  12878. Set what kind of graticule to draw.
  12879. @table @samp
  12880. @item none
  12881. @item green
  12882. @item color
  12883. @end table
  12884. @item opacity, o
  12885. Set graticule opacity.
  12886. @item flags, f
  12887. Set graticule flags.
  12888. @table @samp
  12889. @item white
  12890. Draw graticule for white point.
  12891. @item black
  12892. Draw graticule for black point.
  12893. @item name
  12894. Draw color points short names.
  12895. @end table
  12896. @item bgopacity, b
  12897. Set background opacity.
  12898. @item lthreshold, l
  12899. Set low threshold for color component not represented on X or Y axis.
  12900. Values lower than this value will be ignored. Default is 0.
  12901. Note this value is multiplied with actual max possible value one pixel component
  12902. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12903. is 0.1 * 255 = 25.
  12904. @item hthreshold, h
  12905. Set high threshold for color component not represented on X or Y axis.
  12906. Values higher than this value will be ignored. Default is 1.
  12907. Note this value is multiplied with actual max possible value one pixel component
  12908. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12909. is 0.9 * 255 = 230.
  12910. @item colorspace, c
  12911. Set what kind of colorspace to use when drawing graticule.
  12912. @table @samp
  12913. @item auto
  12914. @item 601
  12915. @item 709
  12916. @end table
  12917. Default is auto.
  12918. @end table
  12919. @anchor{vidstabdetect}
  12920. @section vidstabdetect
  12921. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12922. @ref{vidstabtransform} for pass 2.
  12923. This filter generates a file with relative translation and rotation
  12924. transform information about subsequent frames, which is then used by
  12925. the @ref{vidstabtransform} filter.
  12926. To enable compilation of this filter you need to configure FFmpeg with
  12927. @code{--enable-libvidstab}.
  12928. This filter accepts the following options:
  12929. @table @option
  12930. @item result
  12931. Set the path to the file used to write the transforms information.
  12932. Default value is @file{transforms.trf}.
  12933. @item shakiness
  12934. Set how shaky the video is and how quick the camera is. It accepts an
  12935. integer in the range 1-10, a value of 1 means little shakiness, a
  12936. value of 10 means strong shakiness. Default value is 5.
  12937. @item accuracy
  12938. Set the accuracy of the detection process. It must be a value in the
  12939. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12940. accuracy. Default value is 15.
  12941. @item stepsize
  12942. Set stepsize of the search process. The region around minimum is
  12943. scanned with 1 pixel resolution. Default value is 6.
  12944. @item mincontrast
  12945. Set minimum contrast. Below this value a local measurement field is
  12946. discarded. Must be a floating point value in the range 0-1. Default
  12947. value is 0.3.
  12948. @item tripod
  12949. Set reference frame number for tripod mode.
  12950. If enabled, the motion of the frames is compared to a reference frame
  12951. in the filtered stream, identified by the specified number. The idea
  12952. is to compensate all movements in a more-or-less static scene and keep
  12953. the camera view absolutely still.
  12954. If set to 0, it is disabled. The frames are counted starting from 1.
  12955. @item show
  12956. Show fields and transforms in the resulting frames. It accepts an
  12957. integer in the range 0-2. Default value is 0, which disables any
  12958. visualization.
  12959. @end table
  12960. @subsection Examples
  12961. @itemize
  12962. @item
  12963. Use default values:
  12964. @example
  12965. vidstabdetect
  12966. @end example
  12967. @item
  12968. Analyze strongly shaky movie and put the results in file
  12969. @file{mytransforms.trf}:
  12970. @example
  12971. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12972. @end example
  12973. @item
  12974. Visualize the result of internal transformations in the resulting
  12975. video:
  12976. @example
  12977. vidstabdetect=show=1
  12978. @end example
  12979. @item
  12980. Analyze a video with medium shakiness using @command{ffmpeg}:
  12981. @example
  12982. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12983. @end example
  12984. @end itemize
  12985. @anchor{vidstabtransform}
  12986. @section vidstabtransform
  12987. Video stabilization/deshaking: pass 2 of 2,
  12988. see @ref{vidstabdetect} for pass 1.
  12989. Read a file with transform information for each frame and
  12990. apply/compensate them. Together with the @ref{vidstabdetect}
  12991. filter this can be used to deshake videos. See also
  12992. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12993. the @ref{unsharp} filter, see below.
  12994. To enable compilation of this filter you need to configure FFmpeg with
  12995. @code{--enable-libvidstab}.
  12996. @subsection Options
  12997. @table @option
  12998. @item input
  12999. Set path to the file used to read the transforms. Default value is
  13000. @file{transforms.trf}.
  13001. @item smoothing
  13002. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13003. camera movements. Default value is 10.
  13004. For example a number of 10 means that 21 frames are used (10 in the
  13005. past and 10 in the future) to smoothen the motion in the video. A
  13006. larger value leads to a smoother video, but limits the acceleration of
  13007. the camera (pan/tilt movements). 0 is a special case where a static
  13008. camera is simulated.
  13009. @item optalgo
  13010. Set the camera path optimization algorithm.
  13011. Accepted values are:
  13012. @table @samp
  13013. @item gauss
  13014. gaussian kernel low-pass filter on camera motion (default)
  13015. @item avg
  13016. averaging on transformations
  13017. @end table
  13018. @item maxshift
  13019. Set maximal number of pixels to translate frames. Default value is -1,
  13020. meaning no limit.
  13021. @item maxangle
  13022. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13023. value is -1, meaning no limit.
  13024. @item crop
  13025. Specify how to deal with borders that may be visible due to movement
  13026. compensation.
  13027. Available values are:
  13028. @table @samp
  13029. @item keep
  13030. keep image information from previous frame (default)
  13031. @item black
  13032. fill the border black
  13033. @end table
  13034. @item invert
  13035. Invert transforms if set to 1. Default value is 0.
  13036. @item relative
  13037. Consider transforms as relative to previous frame if set to 1,
  13038. absolute if set to 0. Default value is 0.
  13039. @item zoom
  13040. Set percentage to zoom. A positive value will result in a zoom-in
  13041. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13042. zoom).
  13043. @item optzoom
  13044. Set optimal zooming to avoid borders.
  13045. Accepted values are:
  13046. @table @samp
  13047. @item 0
  13048. disabled
  13049. @item 1
  13050. optimal static zoom value is determined (only very strong movements
  13051. will lead to visible borders) (default)
  13052. @item 2
  13053. optimal adaptive zoom value is determined (no borders will be
  13054. visible), see @option{zoomspeed}
  13055. @end table
  13056. Note that the value given at zoom is added to the one calculated here.
  13057. @item zoomspeed
  13058. Set percent to zoom maximally each frame (enabled when
  13059. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13060. 0.25.
  13061. @item interpol
  13062. Specify type of interpolation.
  13063. Available values are:
  13064. @table @samp
  13065. @item no
  13066. no interpolation
  13067. @item linear
  13068. linear only horizontal
  13069. @item bilinear
  13070. linear in both directions (default)
  13071. @item bicubic
  13072. cubic in both directions (slow)
  13073. @end table
  13074. @item tripod
  13075. Enable virtual tripod mode if set to 1, which is equivalent to
  13076. @code{relative=0:smoothing=0}. Default value is 0.
  13077. Use also @code{tripod} option of @ref{vidstabdetect}.
  13078. @item debug
  13079. Increase log verbosity if set to 1. Also the detected global motions
  13080. are written to the temporary file @file{global_motions.trf}. Default
  13081. value is 0.
  13082. @end table
  13083. @subsection Examples
  13084. @itemize
  13085. @item
  13086. Use @command{ffmpeg} for a typical stabilization with default values:
  13087. @example
  13088. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13089. @end example
  13090. Note the use of the @ref{unsharp} filter which is always recommended.
  13091. @item
  13092. Zoom in a bit more and load transform data from a given file:
  13093. @example
  13094. vidstabtransform=zoom=5:input="mytransforms.trf"
  13095. @end example
  13096. @item
  13097. Smoothen the video even more:
  13098. @example
  13099. vidstabtransform=smoothing=30
  13100. @end example
  13101. @end itemize
  13102. @section vflip
  13103. Flip the input video vertically.
  13104. For example, to vertically flip a video with @command{ffmpeg}:
  13105. @example
  13106. ffmpeg -i in.avi -vf "vflip" out.avi
  13107. @end example
  13108. @section vfrdet
  13109. Detect variable frame rate video.
  13110. This filter tries to detect if the input is variable or constant frame rate.
  13111. At end it will output number of frames detected as having variable delta pts,
  13112. and ones with constant delta pts.
  13113. If there was frames with variable delta, than it will also show min and max delta
  13114. encountered.
  13115. @anchor{vignette}
  13116. @section vignette
  13117. Make or reverse a natural vignetting effect.
  13118. The filter accepts the following options:
  13119. @table @option
  13120. @item angle, a
  13121. Set lens angle expression as a number of radians.
  13122. The value is clipped in the @code{[0,PI/2]} range.
  13123. Default value: @code{"PI/5"}
  13124. @item x0
  13125. @item y0
  13126. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13127. by default.
  13128. @item mode
  13129. Set forward/backward mode.
  13130. Available modes are:
  13131. @table @samp
  13132. @item forward
  13133. The larger the distance from the central point, the darker the image becomes.
  13134. @item backward
  13135. The larger the distance from the central point, the brighter the image becomes.
  13136. This can be used to reverse a vignette effect, though there is no automatic
  13137. detection to extract the lens @option{angle} and other settings (yet). It can
  13138. also be used to create a burning effect.
  13139. @end table
  13140. Default value is @samp{forward}.
  13141. @item eval
  13142. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13143. It accepts the following values:
  13144. @table @samp
  13145. @item init
  13146. Evaluate expressions only once during the filter initialization.
  13147. @item frame
  13148. Evaluate expressions for each incoming frame. This is way slower than the
  13149. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13150. allows advanced dynamic expressions.
  13151. @end table
  13152. Default value is @samp{init}.
  13153. @item dither
  13154. Set dithering to reduce the circular banding effects. Default is @code{1}
  13155. (enabled).
  13156. @item aspect
  13157. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13158. Setting this value to the SAR of the input will make a rectangular vignetting
  13159. following the dimensions of the video.
  13160. Default is @code{1/1}.
  13161. @end table
  13162. @subsection Expressions
  13163. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13164. following parameters.
  13165. @table @option
  13166. @item w
  13167. @item h
  13168. input width and height
  13169. @item n
  13170. the number of input frame, starting from 0
  13171. @item pts
  13172. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13173. @var{TB} units, NAN if undefined
  13174. @item r
  13175. frame rate of the input video, NAN if the input frame rate is unknown
  13176. @item t
  13177. the PTS (Presentation TimeStamp) of the filtered video frame,
  13178. expressed in seconds, NAN if undefined
  13179. @item tb
  13180. time base of the input video
  13181. @end table
  13182. @subsection Examples
  13183. @itemize
  13184. @item
  13185. Apply simple strong vignetting effect:
  13186. @example
  13187. vignette=PI/4
  13188. @end example
  13189. @item
  13190. Make a flickering vignetting:
  13191. @example
  13192. vignette='PI/4+random(1)*PI/50':eval=frame
  13193. @end example
  13194. @end itemize
  13195. @section vmafmotion
  13196. Obtain the average vmaf motion score of a video.
  13197. It is one of the component filters of VMAF.
  13198. The obtained average motion score is printed through the logging system.
  13199. In the below example the input file @file{ref.mpg} is being processed and score
  13200. is computed.
  13201. @example
  13202. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13203. @end example
  13204. @section vstack
  13205. Stack input videos vertically.
  13206. All streams must be of same pixel format and of same width.
  13207. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13208. to create same output.
  13209. The filter accept the following option:
  13210. @table @option
  13211. @item inputs
  13212. Set number of input streams. Default is 2.
  13213. @item shortest
  13214. If set to 1, force the output to terminate when the shortest input
  13215. terminates. Default value is 0.
  13216. @end table
  13217. @section w3fdif
  13218. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13219. Deinterlacing Filter").
  13220. Based on the process described by Martin Weston for BBC R&D, and
  13221. implemented based on the de-interlace algorithm written by Jim
  13222. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13223. uses filter coefficients calculated by BBC R&D.
  13224. There are two sets of filter coefficients, so called "simple":
  13225. and "complex". Which set of filter coefficients is used can
  13226. be set by passing an optional parameter:
  13227. @table @option
  13228. @item filter
  13229. Set the interlacing filter coefficients. Accepts one of the following values:
  13230. @table @samp
  13231. @item simple
  13232. Simple filter coefficient set.
  13233. @item complex
  13234. More-complex filter coefficient set.
  13235. @end table
  13236. Default value is @samp{complex}.
  13237. @item deint
  13238. Specify which frames to deinterlace. Accept one of the following values:
  13239. @table @samp
  13240. @item all
  13241. Deinterlace all frames,
  13242. @item interlaced
  13243. Only deinterlace frames marked as interlaced.
  13244. @end table
  13245. Default value is @samp{all}.
  13246. @end table
  13247. @section waveform
  13248. Video waveform monitor.
  13249. The waveform monitor plots color component intensity. By default luminance
  13250. only. Each column of the waveform corresponds to a column of pixels in the
  13251. source video.
  13252. It accepts the following options:
  13253. @table @option
  13254. @item mode, m
  13255. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13256. In row mode, the graph on the left side represents color component value 0 and
  13257. the right side represents value = 255. In column mode, the top side represents
  13258. color component value = 0 and bottom side represents value = 255.
  13259. @item intensity, i
  13260. Set intensity. Smaller values are useful to find out how many values of the same
  13261. luminance are distributed across input rows/columns.
  13262. Default value is @code{0.04}. Allowed range is [0, 1].
  13263. @item mirror, r
  13264. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13265. In mirrored mode, higher values will be represented on the left
  13266. side for @code{row} mode and at the top for @code{column} mode. Default is
  13267. @code{1} (mirrored).
  13268. @item display, d
  13269. Set display mode.
  13270. It accepts the following values:
  13271. @table @samp
  13272. @item overlay
  13273. Presents information identical to that in the @code{parade}, except
  13274. that the graphs representing color components are superimposed directly
  13275. over one another.
  13276. This display mode makes it easier to spot relative differences or similarities
  13277. in overlapping areas of the color components that are supposed to be identical,
  13278. such as neutral whites, grays, or blacks.
  13279. @item stack
  13280. Display separate graph for the color components side by side in
  13281. @code{row} mode or one below the other in @code{column} mode.
  13282. @item parade
  13283. Display separate graph for the color components side by side in
  13284. @code{column} mode or one below the other in @code{row} mode.
  13285. Using this display mode makes it easy to spot color casts in the highlights
  13286. and shadows of an image, by comparing the contours of the top and the bottom
  13287. graphs of each waveform. Since whites, grays, and blacks are characterized
  13288. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13289. should display three waveforms of roughly equal width/height. If not, the
  13290. correction is easy to perform by making level adjustments the three waveforms.
  13291. @end table
  13292. Default is @code{stack}.
  13293. @item components, c
  13294. Set which color components to display. Default is 1, which means only luminance
  13295. or red color component if input is in RGB colorspace. If is set for example to
  13296. 7 it will display all 3 (if) available color components.
  13297. @item envelope, e
  13298. @table @samp
  13299. @item none
  13300. No envelope, this is default.
  13301. @item instant
  13302. Instant envelope, minimum and maximum values presented in graph will be easily
  13303. visible even with small @code{step} value.
  13304. @item peak
  13305. Hold minimum and maximum values presented in graph across time. This way you
  13306. can still spot out of range values without constantly looking at waveforms.
  13307. @item peak+instant
  13308. Peak and instant envelope combined together.
  13309. @end table
  13310. @item filter, f
  13311. @table @samp
  13312. @item lowpass
  13313. No filtering, this is default.
  13314. @item flat
  13315. Luma and chroma combined together.
  13316. @item aflat
  13317. Similar as above, but shows difference between blue and red chroma.
  13318. @item xflat
  13319. Similar as above, but use different colors.
  13320. @item chroma
  13321. Displays only chroma.
  13322. @item color
  13323. Displays actual color value on waveform.
  13324. @item acolor
  13325. Similar as above, but with luma showing frequency of chroma values.
  13326. @end table
  13327. @item graticule, g
  13328. Set which graticule to display.
  13329. @table @samp
  13330. @item none
  13331. Do not display graticule.
  13332. @item green
  13333. Display green graticule showing legal broadcast ranges.
  13334. @item orange
  13335. Display orange graticule showing legal broadcast ranges.
  13336. @end table
  13337. @item opacity, o
  13338. Set graticule opacity.
  13339. @item flags, fl
  13340. Set graticule flags.
  13341. @table @samp
  13342. @item numbers
  13343. Draw numbers above lines. By default enabled.
  13344. @item dots
  13345. Draw dots instead of lines.
  13346. @end table
  13347. @item scale, s
  13348. Set scale used for displaying graticule.
  13349. @table @samp
  13350. @item digital
  13351. @item millivolts
  13352. @item ire
  13353. @end table
  13354. Default is digital.
  13355. @item bgopacity, b
  13356. Set background opacity.
  13357. @end table
  13358. @section weave, doubleweave
  13359. The @code{weave} takes a field-based video input and join
  13360. each two sequential fields into single frame, producing a new double
  13361. height clip with half the frame rate and half the frame count.
  13362. The @code{doubleweave} works same as @code{weave} but without
  13363. halving frame rate and frame count.
  13364. It accepts the following option:
  13365. @table @option
  13366. @item first_field
  13367. Set first field. Available values are:
  13368. @table @samp
  13369. @item top, t
  13370. Set the frame as top-field-first.
  13371. @item bottom, b
  13372. Set the frame as bottom-field-first.
  13373. @end table
  13374. @end table
  13375. @subsection Examples
  13376. @itemize
  13377. @item
  13378. Interlace video using @ref{select} and @ref{separatefields} filter:
  13379. @example
  13380. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13381. @end example
  13382. @end itemize
  13383. @section xbr
  13384. Apply the xBR high-quality magnification filter which is designed for pixel
  13385. art. It follows a set of edge-detection rules, see
  13386. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13387. It accepts the following option:
  13388. @table @option
  13389. @item n
  13390. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13391. @code{3xBR} and @code{4} for @code{4xBR}.
  13392. Default is @code{3}.
  13393. @end table
  13394. @anchor{yadif}
  13395. @section yadif
  13396. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13397. filter").
  13398. It accepts the following parameters:
  13399. @table @option
  13400. @item mode
  13401. The interlacing mode to adopt. It accepts one of the following values:
  13402. @table @option
  13403. @item 0, send_frame
  13404. Output one frame for each frame.
  13405. @item 1, send_field
  13406. Output one frame for each field.
  13407. @item 2, send_frame_nospatial
  13408. Like @code{send_frame}, but it skips the spatial interlacing check.
  13409. @item 3, send_field_nospatial
  13410. Like @code{send_field}, but it skips the spatial interlacing check.
  13411. @end table
  13412. The default value is @code{send_frame}.
  13413. @item parity
  13414. The picture field parity assumed for the input interlaced video. It accepts one
  13415. of the following values:
  13416. @table @option
  13417. @item 0, tff
  13418. Assume the top field is first.
  13419. @item 1, bff
  13420. Assume the bottom field is first.
  13421. @item -1, auto
  13422. Enable automatic detection of field parity.
  13423. @end table
  13424. The default value is @code{auto}.
  13425. If the interlacing is unknown or the decoder does not export this information,
  13426. top field first will be assumed.
  13427. @item deint
  13428. Specify which frames to deinterlace. Accept one of the following
  13429. values:
  13430. @table @option
  13431. @item 0, all
  13432. Deinterlace all frames.
  13433. @item 1, interlaced
  13434. Only deinterlace frames marked as interlaced.
  13435. @end table
  13436. The default value is @code{all}.
  13437. @end table
  13438. @section zoompan
  13439. Apply Zoom & Pan effect.
  13440. This filter accepts the following options:
  13441. @table @option
  13442. @item zoom, z
  13443. Set the zoom expression. Default is 1.
  13444. @item x
  13445. @item y
  13446. Set the x and y expression. Default is 0.
  13447. @item d
  13448. Set the duration expression in number of frames.
  13449. This sets for how many number of frames effect will last for
  13450. single input image.
  13451. @item s
  13452. Set the output image size, default is 'hd720'.
  13453. @item fps
  13454. Set the output frame rate, default is '25'.
  13455. @end table
  13456. Each expression can contain the following constants:
  13457. @table @option
  13458. @item in_w, iw
  13459. Input width.
  13460. @item in_h, ih
  13461. Input height.
  13462. @item out_w, ow
  13463. Output width.
  13464. @item out_h, oh
  13465. Output height.
  13466. @item in
  13467. Input frame count.
  13468. @item on
  13469. Output frame count.
  13470. @item x
  13471. @item y
  13472. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13473. for current input frame.
  13474. @item px
  13475. @item py
  13476. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13477. not yet such frame (first input frame).
  13478. @item zoom
  13479. Last calculated zoom from 'z' expression for current input frame.
  13480. @item pzoom
  13481. Last calculated zoom of last output frame of previous input frame.
  13482. @item duration
  13483. Number of output frames for current input frame. Calculated from 'd' expression
  13484. for each input frame.
  13485. @item pduration
  13486. number of output frames created for previous input frame
  13487. @item a
  13488. Rational number: input width / input height
  13489. @item sar
  13490. sample aspect ratio
  13491. @item dar
  13492. display aspect ratio
  13493. @end table
  13494. @subsection Examples
  13495. @itemize
  13496. @item
  13497. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13498. @example
  13499. 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
  13500. @end example
  13501. @item
  13502. Zoom-in up to 1.5 and pan always at center of picture:
  13503. @example
  13504. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13505. @end example
  13506. @item
  13507. Same as above but without pausing:
  13508. @example
  13509. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13510. @end example
  13511. @end itemize
  13512. @anchor{zscale}
  13513. @section zscale
  13514. Scale (resize) the input video, using the z.lib library:
  13515. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13516. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13517. The zscale filter forces the output display aspect ratio to be the same
  13518. as the input, by changing the output sample aspect ratio.
  13519. If the input image format is different from the format requested by
  13520. the next filter, the zscale filter will convert the input to the
  13521. requested format.
  13522. @subsection Options
  13523. The filter accepts the following options.
  13524. @table @option
  13525. @item width, w
  13526. @item height, h
  13527. Set the output video dimension expression. Default value is the input
  13528. dimension.
  13529. If the @var{width} or @var{w} value is 0, the input width is used for
  13530. the output. If the @var{height} or @var{h} value is 0, the input height
  13531. is used for the output.
  13532. If one and only one of the values is -n with n >= 1, the zscale filter
  13533. will use a value that maintains the aspect ratio of the input image,
  13534. calculated from the other specified dimension. After that it will,
  13535. however, make sure that the calculated dimension is divisible by n and
  13536. adjust the value if necessary.
  13537. If both values are -n with n >= 1, the behavior will be identical to
  13538. both values being set to 0 as previously detailed.
  13539. See below for the list of accepted constants for use in the dimension
  13540. expression.
  13541. @item size, s
  13542. Set the video size. For the syntax of this option, check the
  13543. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13544. @item dither, d
  13545. Set the dither type.
  13546. Possible values are:
  13547. @table @var
  13548. @item none
  13549. @item ordered
  13550. @item random
  13551. @item error_diffusion
  13552. @end table
  13553. Default is none.
  13554. @item filter, f
  13555. Set the resize filter type.
  13556. Possible values are:
  13557. @table @var
  13558. @item point
  13559. @item bilinear
  13560. @item bicubic
  13561. @item spline16
  13562. @item spline36
  13563. @item lanczos
  13564. @end table
  13565. Default is bilinear.
  13566. @item range, r
  13567. Set the color range.
  13568. Possible values are:
  13569. @table @var
  13570. @item input
  13571. @item limited
  13572. @item full
  13573. @end table
  13574. Default is same as input.
  13575. @item primaries, p
  13576. Set the color primaries.
  13577. Possible values are:
  13578. @table @var
  13579. @item input
  13580. @item 709
  13581. @item unspecified
  13582. @item 170m
  13583. @item 240m
  13584. @item 2020
  13585. @end table
  13586. Default is same as input.
  13587. @item transfer, t
  13588. Set the transfer characteristics.
  13589. Possible values are:
  13590. @table @var
  13591. @item input
  13592. @item 709
  13593. @item unspecified
  13594. @item 601
  13595. @item linear
  13596. @item 2020_10
  13597. @item 2020_12
  13598. @item smpte2084
  13599. @item iec61966-2-1
  13600. @item arib-std-b67
  13601. @end table
  13602. Default is same as input.
  13603. @item matrix, m
  13604. Set the colorspace matrix.
  13605. Possible value are:
  13606. @table @var
  13607. @item input
  13608. @item 709
  13609. @item unspecified
  13610. @item 470bg
  13611. @item 170m
  13612. @item 2020_ncl
  13613. @item 2020_cl
  13614. @end table
  13615. Default is same as input.
  13616. @item rangein, rin
  13617. Set the input color range.
  13618. Possible values are:
  13619. @table @var
  13620. @item input
  13621. @item limited
  13622. @item full
  13623. @end table
  13624. Default is same as input.
  13625. @item primariesin, pin
  13626. Set the input color primaries.
  13627. Possible values are:
  13628. @table @var
  13629. @item input
  13630. @item 709
  13631. @item unspecified
  13632. @item 170m
  13633. @item 240m
  13634. @item 2020
  13635. @end table
  13636. Default is same as input.
  13637. @item transferin, tin
  13638. Set the input transfer characteristics.
  13639. Possible values are:
  13640. @table @var
  13641. @item input
  13642. @item 709
  13643. @item unspecified
  13644. @item 601
  13645. @item linear
  13646. @item 2020_10
  13647. @item 2020_12
  13648. @end table
  13649. Default is same as input.
  13650. @item matrixin, min
  13651. Set the input colorspace matrix.
  13652. Possible value are:
  13653. @table @var
  13654. @item input
  13655. @item 709
  13656. @item unspecified
  13657. @item 470bg
  13658. @item 170m
  13659. @item 2020_ncl
  13660. @item 2020_cl
  13661. @end table
  13662. @item chromal, c
  13663. Set the output chroma location.
  13664. Possible values are:
  13665. @table @var
  13666. @item input
  13667. @item left
  13668. @item center
  13669. @item topleft
  13670. @item top
  13671. @item bottomleft
  13672. @item bottom
  13673. @end table
  13674. @item chromalin, cin
  13675. Set the input chroma location.
  13676. Possible values are:
  13677. @table @var
  13678. @item input
  13679. @item left
  13680. @item center
  13681. @item topleft
  13682. @item top
  13683. @item bottomleft
  13684. @item bottom
  13685. @end table
  13686. @item npl
  13687. Set the nominal peak luminance.
  13688. @end table
  13689. The values of the @option{w} and @option{h} options are expressions
  13690. containing the following constants:
  13691. @table @var
  13692. @item in_w
  13693. @item in_h
  13694. The input width and height
  13695. @item iw
  13696. @item ih
  13697. These are the same as @var{in_w} and @var{in_h}.
  13698. @item out_w
  13699. @item out_h
  13700. The output (scaled) width and height
  13701. @item ow
  13702. @item oh
  13703. These are the same as @var{out_w} and @var{out_h}
  13704. @item a
  13705. The same as @var{iw} / @var{ih}
  13706. @item sar
  13707. input sample aspect ratio
  13708. @item dar
  13709. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13710. @item hsub
  13711. @item vsub
  13712. horizontal and vertical input chroma subsample values. For example for the
  13713. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13714. @item ohsub
  13715. @item ovsub
  13716. horizontal and vertical output chroma subsample values. For example for the
  13717. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13718. @end table
  13719. @table @option
  13720. @end table
  13721. @c man end VIDEO FILTERS
  13722. @chapter Video Sources
  13723. @c man begin VIDEO SOURCES
  13724. Below is a description of the currently available video sources.
  13725. @section buffer
  13726. Buffer video frames, and make them available to the filter chain.
  13727. This source is mainly intended for a programmatic use, in particular
  13728. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13729. It accepts the following parameters:
  13730. @table @option
  13731. @item video_size
  13732. Specify the size (width and height) of the buffered video frames. For the
  13733. syntax of this option, check the
  13734. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13735. @item width
  13736. The input video width.
  13737. @item height
  13738. The input video height.
  13739. @item pix_fmt
  13740. A string representing the pixel format of the buffered video frames.
  13741. It may be a number corresponding to a pixel format, or a pixel format
  13742. name.
  13743. @item time_base
  13744. Specify the timebase assumed by the timestamps of the buffered frames.
  13745. @item frame_rate
  13746. Specify the frame rate expected for the video stream.
  13747. @item pixel_aspect, sar
  13748. The sample (pixel) aspect ratio of the input video.
  13749. @item sws_param
  13750. Specify the optional parameters to be used for the scale filter which
  13751. is automatically inserted when an input change is detected in the
  13752. input size or format.
  13753. @item hw_frames_ctx
  13754. When using a hardware pixel format, this should be a reference to an
  13755. AVHWFramesContext describing input frames.
  13756. @end table
  13757. For example:
  13758. @example
  13759. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13760. @end example
  13761. will instruct the source to accept video frames with size 320x240 and
  13762. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13763. square pixels (1:1 sample aspect ratio).
  13764. Since the pixel format with name "yuv410p" corresponds to the number 6
  13765. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13766. this example corresponds to:
  13767. @example
  13768. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13769. @end example
  13770. Alternatively, the options can be specified as a flat string, but this
  13771. syntax is deprecated:
  13772. @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}]
  13773. @section cellauto
  13774. Create a pattern generated by an elementary cellular automaton.
  13775. The initial state of the cellular automaton can be defined through the
  13776. @option{filename} and @option{pattern} options. If such options are
  13777. not specified an initial state is created randomly.
  13778. At each new frame a new row in the video is filled with the result of
  13779. the cellular automaton next generation. The behavior when the whole
  13780. frame is filled is defined by the @option{scroll} option.
  13781. This source accepts the following options:
  13782. @table @option
  13783. @item filename, f
  13784. Read the initial cellular automaton state, i.e. the starting row, from
  13785. the specified file.
  13786. In the file, each non-whitespace character is considered an alive
  13787. cell, a newline will terminate the row, and further characters in the
  13788. file will be ignored.
  13789. @item pattern, p
  13790. Read the initial cellular automaton state, i.e. the starting row, from
  13791. the specified string.
  13792. Each non-whitespace character in the string is considered an alive
  13793. cell, a newline will terminate the row, and further characters in the
  13794. string will be ignored.
  13795. @item rate, r
  13796. Set the video rate, that is the number of frames generated per second.
  13797. Default is 25.
  13798. @item random_fill_ratio, ratio
  13799. Set the random fill ratio for the initial cellular automaton row. It
  13800. is a floating point number value ranging from 0 to 1, defaults to
  13801. 1/PHI.
  13802. This option is ignored when a file or a pattern is specified.
  13803. @item random_seed, seed
  13804. Set the seed for filling randomly the initial row, must be an integer
  13805. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13806. set to -1, the filter will try to use a good random seed on a best
  13807. effort basis.
  13808. @item rule
  13809. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13810. Default value is 110.
  13811. @item size, s
  13812. Set the size of the output video. For the syntax of this option, check the
  13813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13814. If @option{filename} or @option{pattern} is specified, the size is set
  13815. by default to the width of the specified initial state row, and the
  13816. height is set to @var{width} * PHI.
  13817. If @option{size} is set, it must contain the width of the specified
  13818. pattern string, and the specified pattern will be centered in the
  13819. larger row.
  13820. If a filename or a pattern string is not specified, the size value
  13821. defaults to "320x518" (used for a randomly generated initial state).
  13822. @item scroll
  13823. If set to 1, scroll the output upward when all the rows in the output
  13824. have been already filled. If set to 0, the new generated row will be
  13825. written over the top row just after the bottom row is filled.
  13826. Defaults to 1.
  13827. @item start_full, full
  13828. If set to 1, completely fill the output with generated rows before
  13829. outputting the first frame.
  13830. This is the default behavior, for disabling set the value to 0.
  13831. @item stitch
  13832. If set to 1, stitch the left and right row edges together.
  13833. This is the default behavior, for disabling set the value to 0.
  13834. @end table
  13835. @subsection Examples
  13836. @itemize
  13837. @item
  13838. Read the initial state from @file{pattern}, and specify an output of
  13839. size 200x400.
  13840. @example
  13841. cellauto=f=pattern:s=200x400
  13842. @end example
  13843. @item
  13844. Generate a random initial row with a width of 200 cells, with a fill
  13845. ratio of 2/3:
  13846. @example
  13847. cellauto=ratio=2/3:s=200x200
  13848. @end example
  13849. @item
  13850. Create a pattern generated by rule 18 starting by a single alive cell
  13851. centered on an initial row with width 100:
  13852. @example
  13853. cellauto=p=@@:s=100x400:full=0:rule=18
  13854. @end example
  13855. @item
  13856. Specify a more elaborated initial pattern:
  13857. @example
  13858. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13859. @end example
  13860. @end itemize
  13861. @anchor{coreimagesrc}
  13862. @section coreimagesrc
  13863. Video source generated on GPU using Apple's CoreImage API on OSX.
  13864. This video source is a specialized version of the @ref{coreimage} video filter.
  13865. Use a core image generator at the beginning of the applied filterchain to
  13866. generate the content.
  13867. The coreimagesrc video source accepts the following options:
  13868. @table @option
  13869. @item list_generators
  13870. List all available generators along with all their respective options as well as
  13871. possible minimum and maximum values along with the default values.
  13872. @example
  13873. list_generators=true
  13874. @end example
  13875. @item size, s
  13876. Specify the size of the sourced video. For the syntax of this option, check the
  13877. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13878. The default value is @code{320x240}.
  13879. @item rate, r
  13880. Specify the frame rate of the sourced video, as the number of frames
  13881. generated per second. It has to be a string in the format
  13882. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13883. number or a valid video frame rate abbreviation. The default value is
  13884. "25".
  13885. @item sar
  13886. Set the sample aspect ratio of the sourced video.
  13887. @item duration, d
  13888. Set the duration of the sourced video. See
  13889. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13890. for the accepted syntax.
  13891. If not specified, or the expressed duration is negative, the video is
  13892. supposed to be generated forever.
  13893. @end table
  13894. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13895. A complete filterchain can be used for further processing of the
  13896. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13897. and examples for details.
  13898. @subsection Examples
  13899. @itemize
  13900. @item
  13901. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13902. given as complete and escaped command-line for Apple's standard bash shell:
  13903. @example
  13904. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13905. @end example
  13906. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13907. need for a nullsrc video source.
  13908. @end itemize
  13909. @section mandelbrot
  13910. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13911. point specified with @var{start_x} and @var{start_y}.
  13912. This source accepts the following options:
  13913. @table @option
  13914. @item end_pts
  13915. Set the terminal pts value. Default value is 400.
  13916. @item end_scale
  13917. Set the terminal scale value.
  13918. Must be a floating point value. Default value is 0.3.
  13919. @item inner
  13920. Set the inner coloring mode, that is the algorithm used to draw the
  13921. Mandelbrot fractal internal region.
  13922. It shall assume one of the following values:
  13923. @table @option
  13924. @item black
  13925. Set black mode.
  13926. @item convergence
  13927. Show time until convergence.
  13928. @item mincol
  13929. Set color based on point closest to the origin of the iterations.
  13930. @item period
  13931. Set period mode.
  13932. @end table
  13933. Default value is @var{mincol}.
  13934. @item bailout
  13935. Set the bailout value. Default value is 10.0.
  13936. @item maxiter
  13937. Set the maximum of iterations performed by the rendering
  13938. algorithm. Default value is 7189.
  13939. @item outer
  13940. Set outer coloring mode.
  13941. It shall assume one of following values:
  13942. @table @option
  13943. @item iteration_count
  13944. Set iteration cound mode.
  13945. @item normalized_iteration_count
  13946. set normalized iteration count mode.
  13947. @end table
  13948. Default value is @var{normalized_iteration_count}.
  13949. @item rate, r
  13950. Set frame rate, expressed as number of frames per second. Default
  13951. value is "25".
  13952. @item size, s
  13953. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13954. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13955. @item start_scale
  13956. Set the initial scale value. Default value is 3.0.
  13957. @item start_x
  13958. Set the initial x position. Must be a floating point value between
  13959. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13960. @item start_y
  13961. Set the initial y position. Must be a floating point value between
  13962. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13963. @end table
  13964. @section mptestsrc
  13965. Generate various test patterns, as generated by the MPlayer test filter.
  13966. The size of the generated video is fixed, and is 256x256.
  13967. This source is useful in particular for testing encoding features.
  13968. This source accepts the following options:
  13969. @table @option
  13970. @item rate, r
  13971. Specify the frame rate of the sourced video, as the number of frames
  13972. generated per second. It has to be a string in the format
  13973. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13974. number or a valid video frame rate abbreviation. The default value is
  13975. "25".
  13976. @item duration, d
  13977. Set the duration of the sourced video. See
  13978. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13979. for the accepted syntax.
  13980. If not specified, or the expressed duration is negative, the video is
  13981. supposed to be generated forever.
  13982. @item test, t
  13983. Set the number or the name of the test to perform. Supported tests are:
  13984. @table @option
  13985. @item dc_luma
  13986. @item dc_chroma
  13987. @item freq_luma
  13988. @item freq_chroma
  13989. @item amp_luma
  13990. @item amp_chroma
  13991. @item cbp
  13992. @item mv
  13993. @item ring1
  13994. @item ring2
  13995. @item all
  13996. @end table
  13997. Default value is "all", which will cycle through the list of all tests.
  13998. @end table
  13999. Some examples:
  14000. @example
  14001. mptestsrc=t=dc_luma
  14002. @end example
  14003. will generate a "dc_luma" test pattern.
  14004. @section frei0r_src
  14005. Provide a frei0r source.
  14006. To enable compilation of this filter you need to install the frei0r
  14007. header and configure FFmpeg with @code{--enable-frei0r}.
  14008. This source accepts the following parameters:
  14009. @table @option
  14010. @item size
  14011. The size of the video to generate. For the syntax of this option, check the
  14012. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14013. @item framerate
  14014. The framerate of the generated video. It may be a string of the form
  14015. @var{num}/@var{den} or a frame rate abbreviation.
  14016. @item filter_name
  14017. The name to the frei0r source to load. For more information regarding frei0r and
  14018. how to set the parameters, read the @ref{frei0r} section in the video filters
  14019. documentation.
  14020. @item filter_params
  14021. A '|'-separated list of parameters to pass to the frei0r source.
  14022. @end table
  14023. For example, to generate a frei0r partik0l source with size 200x200
  14024. and frame rate 10 which is overlaid on the overlay filter main input:
  14025. @example
  14026. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14027. @end example
  14028. @section life
  14029. Generate a life pattern.
  14030. This source is based on a generalization of John Conway's life game.
  14031. The sourced input represents a life grid, each pixel represents a cell
  14032. which can be in one of two possible states, alive or dead. Every cell
  14033. interacts with its eight neighbours, which are the cells that are
  14034. horizontally, vertically, or diagonally adjacent.
  14035. At each interaction the grid evolves according to the adopted rule,
  14036. which specifies the number of neighbor alive cells which will make a
  14037. cell stay alive or born. The @option{rule} option allows one to specify
  14038. the rule to adopt.
  14039. This source accepts the following options:
  14040. @table @option
  14041. @item filename, f
  14042. Set the file from which to read the initial grid state. In the file,
  14043. each non-whitespace character is considered an alive cell, and newline
  14044. is used to delimit the end of each row.
  14045. If this option is not specified, the initial grid is generated
  14046. randomly.
  14047. @item rate, r
  14048. Set the video rate, that is the number of frames generated per second.
  14049. Default is 25.
  14050. @item random_fill_ratio, ratio
  14051. Set the random fill ratio for the initial random grid. It is a
  14052. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  14053. It is ignored when a file is specified.
  14054. @item random_seed, seed
  14055. Set the seed for filling the initial random grid, must be an integer
  14056. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14057. set to -1, the filter will try to use a good random seed on a best
  14058. effort basis.
  14059. @item rule
  14060. Set the life rule.
  14061. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  14062. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  14063. @var{NS} specifies the number of alive neighbor cells which make a
  14064. live cell stay alive, and @var{NB} the number of alive neighbor cells
  14065. which make a dead cell to become alive (i.e. to "born").
  14066. "s" and "b" can be used in place of "S" and "B", respectively.
  14067. Alternatively a rule can be specified by an 18-bits integer. The 9
  14068. high order bits are used to encode the next cell state if it is alive
  14069. for each number of neighbor alive cells, the low order bits specify
  14070. the rule for "borning" new cells. Higher order bits encode for an
  14071. higher number of neighbor cells.
  14072. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  14073. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  14074. Default value is "S23/B3", which is the original Conway's game of life
  14075. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  14076. cells, and will born a new cell if there are three alive cells around
  14077. a dead cell.
  14078. @item size, s
  14079. Set the size of the output video. For the syntax of this option, check the
  14080. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14081. If @option{filename} is specified, the size is set by default to the
  14082. same size of the input file. If @option{size} is set, it must contain
  14083. the size specified in the input file, and the initial grid defined in
  14084. that file is centered in the larger resulting area.
  14085. If a filename is not specified, the size value defaults to "320x240"
  14086. (used for a randomly generated initial grid).
  14087. @item stitch
  14088. If set to 1, stitch the left and right grid edges together, and the
  14089. top and bottom edges also. Defaults to 1.
  14090. @item mold
  14091. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  14092. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  14093. value from 0 to 255.
  14094. @item life_color
  14095. Set the color of living (or new born) cells.
  14096. @item death_color
  14097. Set the color of dead cells. If @option{mold} is set, this is the first color
  14098. used to represent a dead cell.
  14099. @item mold_color
  14100. Set mold color, for definitely dead and moldy cells.
  14101. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  14102. ffmpeg-utils manual,ffmpeg-utils}.
  14103. @end table
  14104. @subsection Examples
  14105. @itemize
  14106. @item
  14107. Read a grid from @file{pattern}, and center it on a grid of size
  14108. 300x300 pixels:
  14109. @example
  14110. life=f=pattern:s=300x300
  14111. @end example
  14112. @item
  14113. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  14114. @example
  14115. life=ratio=2/3:s=200x200
  14116. @end example
  14117. @item
  14118. Specify a custom rule for evolving a randomly generated grid:
  14119. @example
  14120. life=rule=S14/B34
  14121. @end example
  14122. @item
  14123. Full example with slow death effect (mold) using @command{ffplay}:
  14124. @example
  14125. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  14126. @end example
  14127. @end itemize
  14128. @anchor{allrgb}
  14129. @anchor{allyuv}
  14130. @anchor{color}
  14131. @anchor{haldclutsrc}
  14132. @anchor{nullsrc}
  14133. @anchor{pal75bars}
  14134. @anchor{pal100bars}
  14135. @anchor{rgbtestsrc}
  14136. @anchor{smptebars}
  14137. @anchor{smptehdbars}
  14138. @anchor{testsrc}
  14139. @anchor{testsrc2}
  14140. @anchor{yuvtestsrc}
  14141. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  14142. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  14143. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  14144. The @code{color} source provides an uniformly colored input.
  14145. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  14146. @ref{haldclut} filter.
  14147. The @code{nullsrc} source returns unprocessed video frames. It is
  14148. mainly useful to be employed in analysis / debugging tools, or as the
  14149. source for filters which ignore the input data.
  14150. The @code{pal75bars} source generates a color bars pattern, based on
  14151. EBU PAL recommendations with 75% color levels.
  14152. The @code{pal100bars} source generates a color bars pattern, based on
  14153. EBU PAL recommendations with 100% color levels.
  14154. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  14155. detecting RGB vs BGR issues. You should see a red, green and blue
  14156. stripe from top to bottom.
  14157. The @code{smptebars} source generates a color bars pattern, based on
  14158. the SMPTE Engineering Guideline EG 1-1990.
  14159. The @code{smptehdbars} source generates a color bars pattern, based on
  14160. the SMPTE RP 219-2002.
  14161. The @code{testsrc} source generates a test video pattern, showing a
  14162. color pattern, a scrolling gradient and a timestamp. This is mainly
  14163. intended for testing purposes.
  14164. The @code{testsrc2} source is similar to testsrc, but supports more
  14165. pixel formats instead of just @code{rgb24}. This allows using it as an
  14166. input for other tests without requiring a format conversion.
  14167. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  14168. see a y, cb and cr stripe from top to bottom.
  14169. The sources accept the following parameters:
  14170. @table @option
  14171. @item level
  14172. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  14173. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  14174. pixels to be used as identity matrix for 3D lookup tables. Each component is
  14175. coded on a @code{1/(N*N)} scale.
  14176. @item color, c
  14177. Specify the color of the source, only available in the @code{color}
  14178. source. For the syntax of this option, check the
  14179. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14180. @item size, s
  14181. Specify the size of the sourced video. For the syntax of this option, check the
  14182. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14183. The default value is @code{320x240}.
  14184. This option is not available with the @code{allrgb}, @code{allyuv}, and
  14185. @code{haldclutsrc} filters.
  14186. @item rate, r
  14187. Specify the frame rate of the sourced video, as the number of frames
  14188. generated per second. It has to be a string in the format
  14189. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14190. number or a valid video frame rate abbreviation. The default value is
  14191. "25".
  14192. @item duration, d
  14193. Set the duration of the sourced video. See
  14194. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14195. for the accepted syntax.
  14196. If not specified, or the expressed duration is negative, the video is
  14197. supposed to be generated forever.
  14198. @item sar
  14199. Set the sample aspect ratio of the sourced video.
  14200. @item alpha
  14201. Specify the alpha (opacity) of the background, only available in the
  14202. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  14203. 255 (fully opaque, the default).
  14204. @item decimals, n
  14205. Set the number of decimals to show in the timestamp, only available in the
  14206. @code{testsrc} source.
  14207. The displayed timestamp value will correspond to the original
  14208. timestamp value multiplied by the power of 10 of the specified
  14209. value. Default value is 0.
  14210. @end table
  14211. @subsection Examples
  14212. @itemize
  14213. @item
  14214. Generate a video with a duration of 5.3 seconds, with size
  14215. 176x144 and a frame rate of 10 frames per second:
  14216. @example
  14217. testsrc=duration=5.3:size=qcif:rate=10
  14218. @end example
  14219. @item
  14220. The following graph description will generate a red source
  14221. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  14222. frames per second:
  14223. @example
  14224. color=c=red@@0.2:s=qcif:r=10
  14225. @end example
  14226. @item
  14227. If the input content is to be ignored, @code{nullsrc} can be used. The
  14228. following command generates noise in the luminance plane by employing
  14229. the @code{geq} filter:
  14230. @example
  14231. nullsrc=s=256x256, geq=random(1)*255:128:128
  14232. @end example
  14233. @end itemize
  14234. @subsection Commands
  14235. The @code{color} source supports the following commands:
  14236. @table @option
  14237. @item c, color
  14238. Set the color of the created image. Accepts the same syntax of the
  14239. corresponding @option{color} option.
  14240. @end table
  14241. @section openclsrc
  14242. Generate video using an OpenCL program.
  14243. @table @option
  14244. @item source
  14245. OpenCL program source file.
  14246. @item kernel
  14247. Kernel name in program.
  14248. @item size, s
  14249. Size of frames to generate. This must be set.
  14250. @item format
  14251. Pixel format to use for the generated frames. This must be set.
  14252. @item rate, r
  14253. Number of frames generated every second. Default value is '25'.
  14254. @end table
  14255. For details of how the program loading works, see the @ref{program_opencl}
  14256. filter.
  14257. Example programs:
  14258. @itemize
  14259. @item
  14260. Generate a colour ramp by setting pixel values from the position of the pixel
  14261. in the output image. (Note that this will work with all pixel formats, but
  14262. the generated output will not be the same.)
  14263. @verbatim
  14264. __kernel void ramp(__write_only image2d_t dst,
  14265. unsigned int index)
  14266. {
  14267. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14268. float4 val;
  14269. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  14270. write_imagef(dst, loc, val);
  14271. }
  14272. @end verbatim
  14273. @item
  14274. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  14275. @verbatim
  14276. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  14277. unsigned int index)
  14278. {
  14279. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14280. float4 value = 0.0f;
  14281. int x = loc.x + index;
  14282. int y = loc.y + index;
  14283. while (x > 0 || y > 0) {
  14284. if (x % 3 == 1 && y % 3 == 1) {
  14285. value = 1.0f;
  14286. break;
  14287. }
  14288. x /= 3;
  14289. y /= 3;
  14290. }
  14291. write_imagef(dst, loc, value);
  14292. }
  14293. @end verbatim
  14294. @end itemize
  14295. @c man end VIDEO SOURCES
  14296. @chapter Video Sinks
  14297. @c man begin VIDEO SINKS
  14298. Below is a description of the currently available video sinks.
  14299. @section buffersink
  14300. Buffer video frames, and make them available to the end of the filter
  14301. graph.
  14302. This sink is mainly intended for programmatic use, in particular
  14303. through the interface defined in @file{libavfilter/buffersink.h}
  14304. or the options system.
  14305. It accepts a pointer to an AVBufferSinkContext structure, which
  14306. defines the incoming buffers' formats, to be passed as the opaque
  14307. parameter to @code{avfilter_init_filter} for initialization.
  14308. @section nullsink
  14309. Null video sink: do absolutely nothing with the input video. It is
  14310. mainly useful as a template and for use in analysis / debugging
  14311. tools.
  14312. @c man end VIDEO SINKS
  14313. @chapter Multimedia Filters
  14314. @c man begin MULTIMEDIA FILTERS
  14315. Below is a description of the currently available multimedia filters.
  14316. @section abitscope
  14317. Convert input audio to a video output, displaying the audio bit scope.
  14318. The filter accepts the following options:
  14319. @table @option
  14320. @item rate, r
  14321. Set frame rate, expressed as number of frames per second. Default
  14322. value is "25".
  14323. @item size, s
  14324. Specify the video size for the output. For the syntax of this option, check the
  14325. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14326. Default value is @code{1024x256}.
  14327. @item colors
  14328. Specify list of colors separated by space or by '|' which will be used to
  14329. draw channels. Unrecognized or missing colors will be replaced
  14330. by white color.
  14331. @end table
  14332. @section ahistogram
  14333. Convert input audio to a video output, displaying the volume histogram.
  14334. The filter accepts the following options:
  14335. @table @option
  14336. @item dmode
  14337. Specify how histogram is calculated.
  14338. It accepts the following values:
  14339. @table @samp
  14340. @item single
  14341. Use single histogram for all channels.
  14342. @item separate
  14343. Use separate histogram for each channel.
  14344. @end table
  14345. Default is @code{single}.
  14346. @item rate, r
  14347. Set frame rate, expressed as number of frames per second. Default
  14348. value is "25".
  14349. @item size, s
  14350. Specify the video size for the output. For the syntax of this option, check the
  14351. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14352. Default value is @code{hd720}.
  14353. @item scale
  14354. Set display scale.
  14355. It accepts the following values:
  14356. @table @samp
  14357. @item log
  14358. logarithmic
  14359. @item sqrt
  14360. square root
  14361. @item cbrt
  14362. cubic root
  14363. @item lin
  14364. linear
  14365. @item rlog
  14366. reverse logarithmic
  14367. @end table
  14368. Default is @code{log}.
  14369. @item ascale
  14370. Set amplitude scale.
  14371. It accepts the following values:
  14372. @table @samp
  14373. @item log
  14374. logarithmic
  14375. @item lin
  14376. linear
  14377. @end table
  14378. Default is @code{log}.
  14379. @item acount
  14380. Set how much frames to accumulate in histogram.
  14381. Defauls is 1. Setting this to -1 accumulates all frames.
  14382. @item rheight
  14383. Set histogram ratio of window height.
  14384. @item slide
  14385. Set sonogram sliding.
  14386. It accepts the following values:
  14387. @table @samp
  14388. @item replace
  14389. replace old rows with new ones.
  14390. @item scroll
  14391. scroll from top to bottom.
  14392. @end table
  14393. Default is @code{replace}.
  14394. @end table
  14395. @section aphasemeter
  14396. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  14397. representing mean phase of current audio frame. A video output can also be produced and is
  14398. enabled by default. The audio is passed through as first output.
  14399. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  14400. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  14401. and @code{1} means channels are in phase.
  14402. The filter accepts the following options, all related to its video output:
  14403. @table @option
  14404. @item rate, r
  14405. Set the output frame rate. Default value is @code{25}.
  14406. @item size, s
  14407. Set the video size for the output. For the syntax of this option, check the
  14408. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14409. Default value is @code{800x400}.
  14410. @item rc
  14411. @item gc
  14412. @item bc
  14413. Specify the red, green, blue contrast. Default values are @code{2},
  14414. @code{7} and @code{1}.
  14415. Allowed range is @code{[0, 255]}.
  14416. @item mpc
  14417. Set color which will be used for drawing median phase. If color is
  14418. @code{none} which is default, no median phase value will be drawn.
  14419. @item video
  14420. Enable video output. Default is enabled.
  14421. @end table
  14422. @section avectorscope
  14423. Convert input audio to a video output, representing the audio vector
  14424. scope.
  14425. The filter is used to measure the difference between channels of stereo
  14426. audio stream. A monoaural signal, consisting of identical left and right
  14427. signal, results in straight vertical line. Any stereo separation is visible
  14428. as a deviation from this line, creating a Lissajous figure.
  14429. If the straight (or deviation from it) but horizontal line appears this
  14430. indicates that the left and right channels are out of phase.
  14431. The filter accepts the following options:
  14432. @table @option
  14433. @item mode, m
  14434. Set the vectorscope mode.
  14435. Available values are:
  14436. @table @samp
  14437. @item lissajous
  14438. Lissajous rotated by 45 degrees.
  14439. @item lissajous_xy
  14440. Same as above but not rotated.
  14441. @item polar
  14442. Shape resembling half of circle.
  14443. @end table
  14444. Default value is @samp{lissajous}.
  14445. @item size, s
  14446. Set the video size for the output. For the syntax of this option, check the
  14447. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14448. Default value is @code{400x400}.
  14449. @item rate, r
  14450. Set the output frame rate. Default value is @code{25}.
  14451. @item rc
  14452. @item gc
  14453. @item bc
  14454. @item ac
  14455. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14456. @code{160}, @code{80} and @code{255}.
  14457. Allowed range is @code{[0, 255]}.
  14458. @item rf
  14459. @item gf
  14460. @item bf
  14461. @item af
  14462. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14463. @code{10}, @code{5} and @code{5}.
  14464. Allowed range is @code{[0, 255]}.
  14465. @item zoom
  14466. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14467. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14468. @item draw
  14469. Set the vectorscope drawing mode.
  14470. Available values are:
  14471. @table @samp
  14472. @item dot
  14473. Draw dot for each sample.
  14474. @item line
  14475. Draw line between previous and current sample.
  14476. @end table
  14477. Default value is @samp{dot}.
  14478. @item scale
  14479. Specify amplitude scale of audio samples.
  14480. Available values are:
  14481. @table @samp
  14482. @item lin
  14483. Linear.
  14484. @item sqrt
  14485. Square root.
  14486. @item cbrt
  14487. Cubic root.
  14488. @item log
  14489. Logarithmic.
  14490. @end table
  14491. @item swap
  14492. Swap left channel axis with right channel axis.
  14493. @item mirror
  14494. Mirror axis.
  14495. @table @samp
  14496. @item none
  14497. No mirror.
  14498. @item x
  14499. Mirror only x axis.
  14500. @item y
  14501. Mirror only y axis.
  14502. @item xy
  14503. Mirror both axis.
  14504. @end table
  14505. @end table
  14506. @subsection Examples
  14507. @itemize
  14508. @item
  14509. Complete example using @command{ffplay}:
  14510. @example
  14511. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14512. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14513. @end example
  14514. @end itemize
  14515. @section bench, abench
  14516. Benchmark part of a filtergraph.
  14517. The filter accepts the following options:
  14518. @table @option
  14519. @item action
  14520. Start or stop a timer.
  14521. Available values are:
  14522. @table @samp
  14523. @item start
  14524. Get the current time, set it as frame metadata (using the key
  14525. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14526. @item stop
  14527. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14528. the input frame metadata to get the time difference. Time difference, average,
  14529. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14530. @code{min}) are then printed. The timestamps are expressed in seconds.
  14531. @end table
  14532. @end table
  14533. @subsection Examples
  14534. @itemize
  14535. @item
  14536. Benchmark @ref{selectivecolor} filter:
  14537. @example
  14538. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14539. @end example
  14540. @end itemize
  14541. @section concat
  14542. Concatenate audio and video streams, joining them together one after the
  14543. other.
  14544. The filter works on segments of synchronized video and audio streams. All
  14545. segments must have the same number of streams of each type, and that will
  14546. also be the number of streams at output.
  14547. The filter accepts the following options:
  14548. @table @option
  14549. @item n
  14550. Set the number of segments. Default is 2.
  14551. @item v
  14552. Set the number of output video streams, that is also the number of video
  14553. streams in each segment. Default is 1.
  14554. @item a
  14555. Set the number of output audio streams, that is also the number of audio
  14556. streams in each segment. Default is 0.
  14557. @item unsafe
  14558. Activate unsafe mode: do not fail if segments have a different format.
  14559. @end table
  14560. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14561. @var{a} audio outputs.
  14562. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14563. segment, in the same order as the outputs, then the inputs for the second
  14564. segment, etc.
  14565. Related streams do not always have exactly the same duration, for various
  14566. reasons including codec frame size or sloppy authoring. For that reason,
  14567. related synchronized streams (e.g. a video and its audio track) should be
  14568. concatenated at once. The concat filter will use the duration of the longest
  14569. stream in each segment (except the last one), and if necessary pad shorter
  14570. audio streams with silence.
  14571. For this filter to work correctly, all segments must start at timestamp 0.
  14572. All corresponding streams must have the same parameters in all segments; the
  14573. filtering system will automatically select a common pixel format for video
  14574. streams, and a common sample format, sample rate and channel layout for
  14575. audio streams, but other settings, such as resolution, must be converted
  14576. explicitly by the user.
  14577. Different frame rates are acceptable but will result in variable frame rate
  14578. at output; be sure to configure the output file to handle it.
  14579. @subsection Examples
  14580. @itemize
  14581. @item
  14582. Concatenate an opening, an episode and an ending, all in bilingual version
  14583. (video in stream 0, audio in streams 1 and 2):
  14584. @example
  14585. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14586. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14587. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14588. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14589. @end example
  14590. @item
  14591. Concatenate two parts, handling audio and video separately, using the
  14592. (a)movie sources, and adjusting the resolution:
  14593. @example
  14594. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14595. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14596. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14597. @end example
  14598. Note that a desync will happen at the stitch if the audio and video streams
  14599. do not have exactly the same duration in the first file.
  14600. @end itemize
  14601. @subsection Commands
  14602. This filter supports the following commands:
  14603. @table @option
  14604. @item next
  14605. Close the current segment and step to the next one
  14606. @end table
  14607. @section drawgraph, adrawgraph
  14608. Draw a graph using input video or audio metadata.
  14609. It accepts the following parameters:
  14610. @table @option
  14611. @item m1
  14612. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14613. @item fg1
  14614. Set 1st foreground color expression.
  14615. @item m2
  14616. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14617. @item fg2
  14618. Set 2nd foreground color expression.
  14619. @item m3
  14620. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14621. @item fg3
  14622. Set 3rd foreground color expression.
  14623. @item m4
  14624. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14625. @item fg4
  14626. Set 4th foreground color expression.
  14627. @item min
  14628. Set minimal value of metadata value.
  14629. @item max
  14630. Set maximal value of metadata value.
  14631. @item bg
  14632. Set graph background color. Default is white.
  14633. @item mode
  14634. Set graph mode.
  14635. Available values for mode is:
  14636. @table @samp
  14637. @item bar
  14638. @item dot
  14639. @item line
  14640. @end table
  14641. Default is @code{line}.
  14642. @item slide
  14643. Set slide mode.
  14644. Available values for slide is:
  14645. @table @samp
  14646. @item frame
  14647. Draw new frame when right border is reached.
  14648. @item replace
  14649. Replace old columns with new ones.
  14650. @item scroll
  14651. Scroll from right to left.
  14652. @item rscroll
  14653. Scroll from left to right.
  14654. @item picture
  14655. Draw single picture.
  14656. @end table
  14657. Default is @code{frame}.
  14658. @item size
  14659. Set size of graph video. For the syntax of this option, check the
  14660. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14661. The default value is @code{900x256}.
  14662. The foreground color expressions can use the following variables:
  14663. @table @option
  14664. @item MIN
  14665. Minimal value of metadata value.
  14666. @item MAX
  14667. Maximal value of metadata value.
  14668. @item VAL
  14669. Current metadata key value.
  14670. @end table
  14671. The color is defined as 0xAABBGGRR.
  14672. @end table
  14673. Example using metadata from @ref{signalstats} filter:
  14674. @example
  14675. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14676. @end example
  14677. Example using metadata from @ref{ebur128} filter:
  14678. @example
  14679. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14680. @end example
  14681. @anchor{ebur128}
  14682. @section ebur128
  14683. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14684. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14685. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14686. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14687. The filter also has a video output (see the @var{video} option) with a real
  14688. time graph to observe the loudness evolution. The graphic contains the logged
  14689. message mentioned above, so it is not printed anymore when this option is set,
  14690. unless the verbose logging is set. The main graphing area contains the
  14691. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14692. the momentary loudness (400 milliseconds), but can optionally be configured
  14693. to instead display short-term loudness (see @var{gauge}).
  14694. The green area marks a +/- 1LU target range around the target loudness
  14695. (-23LUFS by default, unless modified through @var{target}).
  14696. More information about the Loudness Recommendation EBU R128 on
  14697. @url{http://tech.ebu.ch/loudness}.
  14698. The filter accepts the following options:
  14699. @table @option
  14700. @item video
  14701. Activate the video output. The audio stream is passed unchanged whether this
  14702. option is set or no. The video stream will be the first output stream if
  14703. activated. Default is @code{0}.
  14704. @item size
  14705. Set the video size. This option is for video only. For the syntax of this
  14706. option, check the
  14707. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14708. Default and minimum resolution is @code{640x480}.
  14709. @item meter
  14710. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14711. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14712. other integer value between this range is allowed.
  14713. @item metadata
  14714. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14715. into 100ms output frames, each of them containing various loudness information
  14716. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14717. Default is @code{0}.
  14718. @item framelog
  14719. Force the frame logging level.
  14720. Available values are:
  14721. @table @samp
  14722. @item info
  14723. information logging level
  14724. @item verbose
  14725. verbose logging level
  14726. @end table
  14727. By default, the logging level is set to @var{info}. If the @option{video} or
  14728. the @option{metadata} options are set, it switches to @var{verbose}.
  14729. @item peak
  14730. Set peak mode(s).
  14731. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14732. values are:
  14733. @table @samp
  14734. @item none
  14735. Disable any peak mode (default).
  14736. @item sample
  14737. Enable sample-peak mode.
  14738. Simple peak mode looking for the higher sample value. It logs a message
  14739. for sample-peak (identified by @code{SPK}).
  14740. @item true
  14741. Enable true-peak mode.
  14742. If enabled, the peak lookup is done on an over-sampled version of the input
  14743. stream for better peak accuracy. It logs a message for true-peak.
  14744. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14745. This mode requires a build with @code{libswresample}.
  14746. @end table
  14747. @item dualmono
  14748. Treat mono input files as "dual mono". If a mono file is intended for playback
  14749. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14750. If set to @code{true}, this option will compensate for this effect.
  14751. Multi-channel input files are not affected by this option.
  14752. @item panlaw
  14753. Set a specific pan law to be used for the measurement of dual mono files.
  14754. This parameter is optional, and has a default value of -3.01dB.
  14755. @item target
  14756. Set a specific target level (in LUFS) used as relative zero in the visualization.
  14757. This parameter is optional and has a default value of -23LUFS as specified
  14758. by EBU R128. However, material published online may prefer a level of -16LUFS
  14759. (e.g. for use with podcasts or video platforms).
  14760. @item gauge
  14761. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  14762. @code{shortterm}. By default the momentary value will be used, but in certain
  14763. scenarios it may be more useful to observe the short term value instead (e.g.
  14764. live mixing).
  14765. @item scale
  14766. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  14767. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  14768. video output, not the summary or continuous log output.
  14769. @end table
  14770. @subsection Examples
  14771. @itemize
  14772. @item
  14773. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14774. @example
  14775. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14776. @end example
  14777. @item
  14778. Run an analysis with @command{ffmpeg}:
  14779. @example
  14780. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14781. @end example
  14782. @end itemize
  14783. @section interleave, ainterleave
  14784. Temporally interleave frames from several inputs.
  14785. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14786. These filters read frames from several inputs and send the oldest
  14787. queued frame to the output.
  14788. Input streams must have well defined, monotonically increasing frame
  14789. timestamp values.
  14790. In order to submit one frame to output, these filters need to enqueue
  14791. at least one frame for each input, so they cannot work in case one
  14792. input is not yet terminated and will not receive incoming frames.
  14793. For example consider the case when one input is a @code{select} filter
  14794. which always drops input frames. The @code{interleave} filter will keep
  14795. reading from that input, but it will never be able to send new frames
  14796. to output until the input sends an end-of-stream signal.
  14797. Also, depending on inputs synchronization, the filters will drop
  14798. frames in case one input receives more frames than the other ones, and
  14799. the queue is already filled.
  14800. These filters accept the following options:
  14801. @table @option
  14802. @item nb_inputs, n
  14803. Set the number of different inputs, it is 2 by default.
  14804. @end table
  14805. @subsection Examples
  14806. @itemize
  14807. @item
  14808. Interleave frames belonging to different streams using @command{ffmpeg}:
  14809. @example
  14810. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14811. @end example
  14812. @item
  14813. Add flickering blur effect:
  14814. @example
  14815. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14816. @end example
  14817. @end itemize
  14818. @section metadata, ametadata
  14819. Manipulate frame metadata.
  14820. This filter accepts the following options:
  14821. @table @option
  14822. @item mode
  14823. Set mode of operation of the filter.
  14824. Can be one of the following:
  14825. @table @samp
  14826. @item select
  14827. If both @code{value} and @code{key} is set, select frames
  14828. which have such metadata. If only @code{key} is set, select
  14829. every frame that has such key in metadata.
  14830. @item add
  14831. Add new metadata @code{key} and @code{value}. If key is already available
  14832. do nothing.
  14833. @item modify
  14834. Modify value of already present key.
  14835. @item delete
  14836. If @code{value} is set, delete only keys that have such value.
  14837. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14838. the frame.
  14839. @item print
  14840. Print key and its value if metadata was found. If @code{key} is not set print all
  14841. metadata values available in frame.
  14842. @end table
  14843. @item key
  14844. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14845. @item value
  14846. Set metadata value which will be used. This option is mandatory for
  14847. @code{modify} and @code{add} mode.
  14848. @item function
  14849. Which function to use when comparing metadata value and @code{value}.
  14850. Can be one of following:
  14851. @table @samp
  14852. @item same_str
  14853. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14854. @item starts_with
  14855. Values are interpreted as strings, returns true if metadata value starts with
  14856. the @code{value} option string.
  14857. @item less
  14858. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14859. @item equal
  14860. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14861. @item greater
  14862. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14863. @item expr
  14864. Values are interpreted as floats, returns true if expression from option @code{expr}
  14865. evaluates to true.
  14866. @end table
  14867. @item expr
  14868. Set expression which is used when @code{function} is set to @code{expr}.
  14869. The expression is evaluated through the eval API and can contain the following
  14870. constants:
  14871. @table @option
  14872. @item VALUE1
  14873. Float representation of @code{value} from metadata key.
  14874. @item VALUE2
  14875. Float representation of @code{value} as supplied by user in @code{value} option.
  14876. @end table
  14877. @item file
  14878. If specified in @code{print} mode, output is written to the named file. Instead of
  14879. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14880. for standard output. If @code{file} option is not set, output is written to the log
  14881. with AV_LOG_INFO loglevel.
  14882. @end table
  14883. @subsection Examples
  14884. @itemize
  14885. @item
  14886. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14887. between 0 and 1.
  14888. @example
  14889. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14890. @end example
  14891. @item
  14892. Print silencedetect output to file @file{metadata.txt}.
  14893. @example
  14894. silencedetect,ametadata=mode=print:file=metadata.txt
  14895. @end example
  14896. @item
  14897. Direct all metadata to a pipe with file descriptor 4.
  14898. @example
  14899. metadata=mode=print:file='pipe\:4'
  14900. @end example
  14901. @end itemize
  14902. @section perms, aperms
  14903. Set read/write permissions for the output frames.
  14904. These filters are mainly aimed at developers to test direct path in the
  14905. following filter in the filtergraph.
  14906. The filters accept the following options:
  14907. @table @option
  14908. @item mode
  14909. Select the permissions mode.
  14910. It accepts the following values:
  14911. @table @samp
  14912. @item none
  14913. Do nothing. This is the default.
  14914. @item ro
  14915. Set all the output frames read-only.
  14916. @item rw
  14917. Set all the output frames directly writable.
  14918. @item toggle
  14919. Make the frame read-only if writable, and writable if read-only.
  14920. @item random
  14921. Set each output frame read-only or writable randomly.
  14922. @end table
  14923. @item seed
  14924. Set the seed for the @var{random} mode, must be an integer included between
  14925. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14926. @code{-1}, the filter will try to use a good random seed on a best effort
  14927. basis.
  14928. @end table
  14929. Note: in case of auto-inserted filter between the permission filter and the
  14930. following one, the permission might not be received as expected in that
  14931. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14932. perms/aperms filter can avoid this problem.
  14933. @section realtime, arealtime
  14934. Slow down filtering to match real time approximately.
  14935. These filters will pause the filtering for a variable amount of time to
  14936. match the output rate with the input timestamps.
  14937. They are similar to the @option{re} option to @code{ffmpeg}.
  14938. They accept the following options:
  14939. @table @option
  14940. @item limit
  14941. Time limit for the pauses. Any pause longer than that will be considered
  14942. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14943. @end table
  14944. @anchor{select}
  14945. @section select, aselect
  14946. Select frames to pass in output.
  14947. This filter accepts the following options:
  14948. @table @option
  14949. @item expr, e
  14950. Set expression, which is evaluated for each input frame.
  14951. If the expression is evaluated to zero, the frame is discarded.
  14952. If the evaluation result is negative or NaN, the frame is sent to the
  14953. first output; otherwise it is sent to the output with index
  14954. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14955. For example a value of @code{1.2} corresponds to the output with index
  14956. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14957. @item outputs, n
  14958. Set the number of outputs. The output to which to send the selected
  14959. frame is based on the result of the evaluation. Default value is 1.
  14960. @end table
  14961. The expression can contain the following constants:
  14962. @table @option
  14963. @item n
  14964. The (sequential) number of the filtered frame, starting from 0.
  14965. @item selected_n
  14966. The (sequential) number of the selected frame, starting from 0.
  14967. @item prev_selected_n
  14968. The sequential number of the last selected frame. It's NAN if undefined.
  14969. @item TB
  14970. The timebase of the input timestamps.
  14971. @item pts
  14972. The PTS (Presentation TimeStamp) of the filtered video frame,
  14973. expressed in @var{TB} units. It's NAN if undefined.
  14974. @item t
  14975. The PTS of the filtered video frame,
  14976. expressed in seconds. It's NAN if undefined.
  14977. @item prev_pts
  14978. The PTS of the previously filtered video frame. It's NAN if undefined.
  14979. @item prev_selected_pts
  14980. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14981. @item prev_selected_t
  14982. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14983. @item start_pts
  14984. The PTS of the first video frame in the video. It's NAN if undefined.
  14985. @item start_t
  14986. The time of the first video frame in the video. It's NAN if undefined.
  14987. @item pict_type @emph{(video only)}
  14988. The type of the filtered frame. It can assume one of the following
  14989. values:
  14990. @table @option
  14991. @item I
  14992. @item P
  14993. @item B
  14994. @item S
  14995. @item SI
  14996. @item SP
  14997. @item BI
  14998. @end table
  14999. @item interlace_type @emph{(video only)}
  15000. The frame interlace type. It can assume one of the following values:
  15001. @table @option
  15002. @item PROGRESSIVE
  15003. The frame is progressive (not interlaced).
  15004. @item TOPFIRST
  15005. The frame is top-field-first.
  15006. @item BOTTOMFIRST
  15007. The frame is bottom-field-first.
  15008. @end table
  15009. @item consumed_sample_n @emph{(audio only)}
  15010. the number of selected samples before the current frame
  15011. @item samples_n @emph{(audio only)}
  15012. the number of samples in the current frame
  15013. @item sample_rate @emph{(audio only)}
  15014. the input sample rate
  15015. @item key
  15016. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15017. @item pos
  15018. the position in the file of the filtered frame, -1 if the information
  15019. is not available (e.g. for synthetic video)
  15020. @item scene @emph{(video only)}
  15021. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15022. probability for the current frame to introduce a new scene, while a higher
  15023. value means the current frame is more likely to be one (see the example below)
  15024. @item concatdec_select
  15025. The concat demuxer can select only part of a concat input file by setting an
  15026. inpoint and an outpoint, but the output packets may not be entirely contained
  15027. in the selected interval. By using this variable, it is possible to skip frames
  15028. generated by the concat demuxer which are not exactly contained in the selected
  15029. interval.
  15030. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15031. and the @var{lavf.concat.duration} packet metadata values which are also
  15032. present in the decoded frames.
  15033. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15034. start_time and either the duration metadata is missing or the frame pts is less
  15035. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15036. missing.
  15037. That basically means that an input frame is selected if its pts is within the
  15038. interval set by the concat demuxer.
  15039. @end table
  15040. The default value of the select expression is "1".
  15041. @subsection Examples
  15042. @itemize
  15043. @item
  15044. Select all frames in input:
  15045. @example
  15046. select
  15047. @end example
  15048. The example above is the same as:
  15049. @example
  15050. select=1
  15051. @end example
  15052. @item
  15053. Skip all frames:
  15054. @example
  15055. select=0
  15056. @end example
  15057. @item
  15058. Select only I-frames:
  15059. @example
  15060. select='eq(pict_type\,I)'
  15061. @end example
  15062. @item
  15063. Select one frame every 100:
  15064. @example
  15065. select='not(mod(n\,100))'
  15066. @end example
  15067. @item
  15068. Select only frames contained in the 10-20 time interval:
  15069. @example
  15070. select=between(t\,10\,20)
  15071. @end example
  15072. @item
  15073. Select only I-frames contained in the 10-20 time interval:
  15074. @example
  15075. select=between(t\,10\,20)*eq(pict_type\,I)
  15076. @end example
  15077. @item
  15078. Select frames with a minimum distance of 10 seconds:
  15079. @example
  15080. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  15081. @end example
  15082. @item
  15083. Use aselect to select only audio frames with samples number > 100:
  15084. @example
  15085. aselect='gt(samples_n\,100)'
  15086. @end example
  15087. @item
  15088. Create a mosaic of the first scenes:
  15089. @example
  15090. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  15091. @end example
  15092. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  15093. choice.
  15094. @item
  15095. Send even and odd frames to separate outputs, and compose them:
  15096. @example
  15097. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  15098. @end example
  15099. @item
  15100. Select useful frames from an ffconcat file which is using inpoints and
  15101. outpoints but where the source files are not intra frame only.
  15102. @example
  15103. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  15104. @end example
  15105. @end itemize
  15106. @section sendcmd, asendcmd
  15107. Send commands to filters in the filtergraph.
  15108. These filters read commands to be sent to other filters in the
  15109. filtergraph.
  15110. @code{sendcmd} must be inserted between two video filters,
  15111. @code{asendcmd} must be inserted between two audio filters, but apart
  15112. from that they act the same way.
  15113. The specification of commands can be provided in the filter arguments
  15114. with the @var{commands} option, or in a file specified by the
  15115. @var{filename} option.
  15116. These filters accept the following options:
  15117. @table @option
  15118. @item commands, c
  15119. Set the commands to be read and sent to the other filters.
  15120. @item filename, f
  15121. Set the filename of the commands to be read and sent to the other
  15122. filters.
  15123. @end table
  15124. @subsection Commands syntax
  15125. A commands description consists of a sequence of interval
  15126. specifications, comprising a list of commands to be executed when a
  15127. particular event related to that interval occurs. The occurring event
  15128. is typically the current frame time entering or leaving a given time
  15129. interval.
  15130. An interval is specified by the following syntax:
  15131. @example
  15132. @var{START}[-@var{END}] @var{COMMANDS};
  15133. @end example
  15134. The time interval is specified by the @var{START} and @var{END} times.
  15135. @var{END} is optional and defaults to the maximum time.
  15136. The current frame time is considered within the specified interval if
  15137. it is included in the interval [@var{START}, @var{END}), that is when
  15138. the time is greater or equal to @var{START} and is lesser than
  15139. @var{END}.
  15140. @var{COMMANDS} consists of a sequence of one or more command
  15141. specifications, separated by ",", relating to that interval. The
  15142. syntax of a command specification is given by:
  15143. @example
  15144. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  15145. @end example
  15146. @var{FLAGS} is optional and specifies the type of events relating to
  15147. the time interval which enable sending the specified command, and must
  15148. be a non-null sequence of identifier flags separated by "+" or "|" and
  15149. enclosed between "[" and "]".
  15150. The following flags are recognized:
  15151. @table @option
  15152. @item enter
  15153. The command is sent when the current frame timestamp enters the
  15154. specified interval. In other words, the command is sent when the
  15155. previous frame timestamp was not in the given interval, and the
  15156. current is.
  15157. @item leave
  15158. The command is sent when the current frame timestamp leaves the
  15159. specified interval. In other words, the command is sent when the
  15160. previous frame timestamp was in the given interval, and the
  15161. current is not.
  15162. @end table
  15163. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  15164. assumed.
  15165. @var{TARGET} specifies the target of the command, usually the name of
  15166. the filter class or a specific filter instance name.
  15167. @var{COMMAND} specifies the name of the command for the target filter.
  15168. @var{ARG} is optional and specifies the optional list of argument for
  15169. the given @var{COMMAND}.
  15170. Between one interval specification and another, whitespaces, or
  15171. sequences of characters starting with @code{#} until the end of line,
  15172. are ignored and can be used to annotate comments.
  15173. A simplified BNF description of the commands specification syntax
  15174. follows:
  15175. @example
  15176. @var{COMMAND_FLAG} ::= "enter" | "leave"
  15177. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  15178. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  15179. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  15180. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  15181. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  15182. @end example
  15183. @subsection Examples
  15184. @itemize
  15185. @item
  15186. Specify audio tempo change at second 4:
  15187. @example
  15188. asendcmd=c='4.0 atempo tempo 1.5',atempo
  15189. @end example
  15190. @item
  15191. Target a specific filter instance:
  15192. @example
  15193. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  15194. @end example
  15195. @item
  15196. Specify a list of drawtext and hue commands in a file.
  15197. @example
  15198. # show text in the interval 5-10
  15199. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  15200. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  15201. # desaturate the image in the interval 15-20
  15202. 15.0-20.0 [enter] hue s 0,
  15203. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  15204. [leave] hue s 1,
  15205. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  15206. # apply an exponential saturation fade-out effect, starting from time 25
  15207. 25 [enter] hue s exp(25-t)
  15208. @end example
  15209. A filtergraph allowing to read and process the above command list
  15210. stored in a file @file{test.cmd}, can be specified with:
  15211. @example
  15212. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  15213. @end example
  15214. @end itemize
  15215. @anchor{setpts}
  15216. @section setpts, asetpts
  15217. Change the PTS (presentation timestamp) of the input frames.
  15218. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  15219. This filter accepts the following options:
  15220. @table @option
  15221. @item expr
  15222. The expression which is evaluated for each frame to construct its timestamp.
  15223. @end table
  15224. The expression is evaluated through the eval API and can contain the following
  15225. constants:
  15226. @table @option
  15227. @item FRAME_RATE, FR
  15228. frame rate, only defined for constant frame-rate video
  15229. @item PTS
  15230. The presentation timestamp in input
  15231. @item N
  15232. The count of the input frame for video or the number of consumed samples,
  15233. not including the current frame for audio, starting from 0.
  15234. @item NB_CONSUMED_SAMPLES
  15235. The number of consumed samples, not including the current frame (only
  15236. audio)
  15237. @item NB_SAMPLES, S
  15238. The number of samples in the current frame (only audio)
  15239. @item SAMPLE_RATE, SR
  15240. The audio sample rate.
  15241. @item STARTPTS
  15242. The PTS of the first frame.
  15243. @item STARTT
  15244. the time in seconds of the first frame
  15245. @item INTERLACED
  15246. State whether the current frame is interlaced.
  15247. @item T
  15248. the time in seconds of the current frame
  15249. @item POS
  15250. original position in the file of the frame, or undefined if undefined
  15251. for the current frame
  15252. @item PREV_INPTS
  15253. The previous input PTS.
  15254. @item PREV_INT
  15255. previous input time in seconds
  15256. @item PREV_OUTPTS
  15257. The previous output PTS.
  15258. @item PREV_OUTT
  15259. previous output time in seconds
  15260. @item RTCTIME
  15261. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  15262. instead.
  15263. @item RTCSTART
  15264. The wallclock (RTC) time at the start of the movie in microseconds.
  15265. @item TB
  15266. The timebase of the input timestamps.
  15267. @end table
  15268. @subsection Examples
  15269. @itemize
  15270. @item
  15271. Start counting PTS from zero
  15272. @example
  15273. setpts=PTS-STARTPTS
  15274. @end example
  15275. @item
  15276. Apply fast motion effect:
  15277. @example
  15278. setpts=0.5*PTS
  15279. @end example
  15280. @item
  15281. Apply slow motion effect:
  15282. @example
  15283. setpts=2.0*PTS
  15284. @end example
  15285. @item
  15286. Set fixed rate of 25 frames per second:
  15287. @example
  15288. setpts=N/(25*TB)
  15289. @end example
  15290. @item
  15291. Set fixed rate 25 fps with some jitter:
  15292. @example
  15293. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  15294. @end example
  15295. @item
  15296. Apply an offset of 10 seconds to the input PTS:
  15297. @example
  15298. setpts=PTS+10/TB
  15299. @end example
  15300. @item
  15301. Generate timestamps from a "live source" and rebase onto the current timebase:
  15302. @example
  15303. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  15304. @end example
  15305. @item
  15306. Generate timestamps by counting samples:
  15307. @example
  15308. asetpts=N/SR/TB
  15309. @end example
  15310. @end itemize
  15311. @section setrange
  15312. Force color range for the output video frame.
  15313. The @code{setrange} filter marks the color range property for the
  15314. output frames. It does not change the input frame, but only sets the
  15315. corresponding property, which affects how the frame is treated by
  15316. following filters.
  15317. The filter accepts the following options:
  15318. @table @option
  15319. @item range
  15320. Available values are:
  15321. @table @samp
  15322. @item auto
  15323. Keep the same color range property.
  15324. @item unspecified, unknown
  15325. Set the color range as unspecified.
  15326. @item limited, tv, mpeg
  15327. Set the color range as limited.
  15328. @item full, pc, jpeg
  15329. Set the color range as full.
  15330. @end table
  15331. @end table
  15332. @section settb, asettb
  15333. Set the timebase to use for the output frames timestamps.
  15334. It is mainly useful for testing timebase configuration.
  15335. It accepts the following parameters:
  15336. @table @option
  15337. @item expr, tb
  15338. The expression which is evaluated into the output timebase.
  15339. @end table
  15340. The value for @option{tb} is an arithmetic expression representing a
  15341. rational. The expression can contain the constants "AVTB" (the default
  15342. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  15343. audio only). Default value is "intb".
  15344. @subsection Examples
  15345. @itemize
  15346. @item
  15347. Set the timebase to 1/25:
  15348. @example
  15349. settb=expr=1/25
  15350. @end example
  15351. @item
  15352. Set the timebase to 1/10:
  15353. @example
  15354. settb=expr=0.1
  15355. @end example
  15356. @item
  15357. Set the timebase to 1001/1000:
  15358. @example
  15359. settb=1+0.001
  15360. @end example
  15361. @item
  15362. Set the timebase to 2*intb:
  15363. @example
  15364. settb=2*intb
  15365. @end example
  15366. @item
  15367. Set the default timebase value:
  15368. @example
  15369. settb=AVTB
  15370. @end example
  15371. @end itemize
  15372. @section showcqt
  15373. Convert input audio to a video output representing frequency spectrum
  15374. logarithmically using Brown-Puckette constant Q transform algorithm with
  15375. direct frequency domain coefficient calculation (but the transform itself
  15376. is not really constant Q, instead the Q factor is actually variable/clamped),
  15377. with musical tone scale, from E0 to D#10.
  15378. The filter accepts the following options:
  15379. @table @option
  15380. @item size, s
  15381. Specify the video size for the output. It must be even. For the syntax of this option,
  15382. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15383. Default value is @code{1920x1080}.
  15384. @item fps, rate, r
  15385. Set the output frame rate. Default value is @code{25}.
  15386. @item bar_h
  15387. Set the bargraph height. It must be even. Default value is @code{-1} which
  15388. computes the bargraph height automatically.
  15389. @item axis_h
  15390. Set the axis height. It must be even. Default value is @code{-1} which computes
  15391. the axis height automatically.
  15392. @item sono_h
  15393. Set the sonogram height. It must be even. Default value is @code{-1} which
  15394. computes the sonogram height automatically.
  15395. @item fullhd
  15396. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  15397. instead. Default value is @code{1}.
  15398. @item sono_v, volume
  15399. Specify the sonogram volume expression. It can contain variables:
  15400. @table @option
  15401. @item bar_v
  15402. the @var{bar_v} evaluated expression
  15403. @item frequency, freq, f
  15404. the frequency where it is evaluated
  15405. @item timeclamp, tc
  15406. the value of @var{timeclamp} option
  15407. @end table
  15408. and functions:
  15409. @table @option
  15410. @item a_weighting(f)
  15411. A-weighting of equal loudness
  15412. @item b_weighting(f)
  15413. B-weighting of equal loudness
  15414. @item c_weighting(f)
  15415. C-weighting of equal loudness.
  15416. @end table
  15417. Default value is @code{16}.
  15418. @item bar_v, volume2
  15419. Specify the bargraph volume expression. It can contain variables:
  15420. @table @option
  15421. @item sono_v
  15422. the @var{sono_v} evaluated expression
  15423. @item frequency, freq, f
  15424. the frequency where it is evaluated
  15425. @item timeclamp, tc
  15426. the value of @var{timeclamp} option
  15427. @end table
  15428. and functions:
  15429. @table @option
  15430. @item a_weighting(f)
  15431. A-weighting of equal loudness
  15432. @item b_weighting(f)
  15433. B-weighting of equal loudness
  15434. @item c_weighting(f)
  15435. C-weighting of equal loudness.
  15436. @end table
  15437. Default value is @code{sono_v}.
  15438. @item sono_g, gamma
  15439. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  15440. higher gamma makes the spectrum having more range. Default value is @code{3}.
  15441. Acceptable range is @code{[1, 7]}.
  15442. @item bar_g, gamma2
  15443. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15444. @code{[1, 7]}.
  15445. @item bar_t
  15446. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15447. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15448. @item timeclamp, tc
  15449. Specify the transform timeclamp. At low frequency, there is trade-off between
  15450. accuracy in time domain and frequency domain. If timeclamp is lower,
  15451. event in time domain is represented more accurately (such as fast bass drum),
  15452. otherwise event in frequency domain is represented more accurately
  15453. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15454. @item attack
  15455. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15456. limits future samples by applying asymmetric windowing in time domain, useful
  15457. when low latency is required. Accepted range is @code{[0, 1]}.
  15458. @item basefreq
  15459. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15460. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15461. @item endfreq
  15462. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15463. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15464. @item coeffclamp
  15465. This option is deprecated and ignored.
  15466. @item tlength
  15467. Specify the transform length in time domain. Use this option to control accuracy
  15468. trade-off between time domain and frequency domain at every frequency sample.
  15469. It can contain variables:
  15470. @table @option
  15471. @item frequency, freq, f
  15472. the frequency where it is evaluated
  15473. @item timeclamp, tc
  15474. the value of @var{timeclamp} option.
  15475. @end table
  15476. Default value is @code{384*tc/(384+tc*f)}.
  15477. @item count
  15478. Specify the transform count for every video frame. Default value is @code{6}.
  15479. Acceptable range is @code{[1, 30]}.
  15480. @item fcount
  15481. Specify the transform count for every single pixel. Default value is @code{0},
  15482. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15483. @item fontfile
  15484. Specify font file for use with freetype to draw the axis. If not specified,
  15485. use embedded font. Note that drawing with font file or embedded font is not
  15486. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15487. option instead.
  15488. @item font
  15489. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15490. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15491. @item fontcolor
  15492. Specify font color expression. This is arithmetic expression that should return
  15493. integer value 0xRRGGBB. It can contain variables:
  15494. @table @option
  15495. @item frequency, freq, f
  15496. the frequency where it is evaluated
  15497. @item timeclamp, tc
  15498. the value of @var{timeclamp} option
  15499. @end table
  15500. and functions:
  15501. @table @option
  15502. @item midi(f)
  15503. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15504. @item r(x), g(x), b(x)
  15505. red, green, and blue value of intensity x.
  15506. @end table
  15507. Default value is @code{st(0, (midi(f)-59.5)/12);
  15508. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15509. r(1-ld(1)) + b(ld(1))}.
  15510. @item axisfile
  15511. Specify image file to draw the axis. This option override @var{fontfile} and
  15512. @var{fontcolor} option.
  15513. @item axis, text
  15514. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15515. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15516. Default value is @code{1}.
  15517. @item csp
  15518. Set colorspace. The accepted values are:
  15519. @table @samp
  15520. @item unspecified
  15521. Unspecified (default)
  15522. @item bt709
  15523. BT.709
  15524. @item fcc
  15525. FCC
  15526. @item bt470bg
  15527. BT.470BG or BT.601-6 625
  15528. @item smpte170m
  15529. SMPTE-170M or BT.601-6 525
  15530. @item smpte240m
  15531. SMPTE-240M
  15532. @item bt2020ncl
  15533. BT.2020 with non-constant luminance
  15534. @end table
  15535. @item cscheme
  15536. Set spectrogram color scheme. This is list of floating point values with format
  15537. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15538. The default is @code{1|0.5|0|0|0.5|1}.
  15539. @end table
  15540. @subsection Examples
  15541. @itemize
  15542. @item
  15543. Playing audio while showing the spectrum:
  15544. @example
  15545. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15546. @end example
  15547. @item
  15548. Same as above, but with frame rate 30 fps:
  15549. @example
  15550. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15551. @end example
  15552. @item
  15553. Playing at 1280x720:
  15554. @example
  15555. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15556. @end example
  15557. @item
  15558. Disable sonogram display:
  15559. @example
  15560. sono_h=0
  15561. @end example
  15562. @item
  15563. A1 and its harmonics: A1, A2, (near)E3, A3:
  15564. @example
  15565. 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),
  15566. asplit[a][out1]; [a] showcqt [out0]'
  15567. @end example
  15568. @item
  15569. Same as above, but with more accuracy in frequency domain:
  15570. @example
  15571. 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),
  15572. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15573. @end example
  15574. @item
  15575. Custom volume:
  15576. @example
  15577. bar_v=10:sono_v=bar_v*a_weighting(f)
  15578. @end example
  15579. @item
  15580. Custom gamma, now spectrum is linear to the amplitude.
  15581. @example
  15582. bar_g=2:sono_g=2
  15583. @end example
  15584. @item
  15585. Custom tlength equation:
  15586. @example
  15587. 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)))'
  15588. @end example
  15589. @item
  15590. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15591. @example
  15592. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15593. @end example
  15594. @item
  15595. Custom font using fontconfig:
  15596. @example
  15597. font='Courier New,Monospace,mono|bold'
  15598. @end example
  15599. @item
  15600. Custom frequency range with custom axis using image file:
  15601. @example
  15602. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15603. @end example
  15604. @end itemize
  15605. @section showfreqs
  15606. Convert input audio to video output representing the audio power spectrum.
  15607. Audio amplitude is on Y-axis while frequency is on X-axis.
  15608. The filter accepts the following options:
  15609. @table @option
  15610. @item size, s
  15611. Specify size of video. For the syntax of this option, check the
  15612. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15613. Default is @code{1024x512}.
  15614. @item mode
  15615. Set display mode.
  15616. This set how each frequency bin will be represented.
  15617. It accepts the following values:
  15618. @table @samp
  15619. @item line
  15620. @item bar
  15621. @item dot
  15622. @end table
  15623. Default is @code{bar}.
  15624. @item ascale
  15625. Set amplitude scale.
  15626. It accepts the following values:
  15627. @table @samp
  15628. @item lin
  15629. Linear scale.
  15630. @item sqrt
  15631. Square root scale.
  15632. @item cbrt
  15633. Cubic root scale.
  15634. @item log
  15635. Logarithmic scale.
  15636. @end table
  15637. Default is @code{log}.
  15638. @item fscale
  15639. Set frequency scale.
  15640. It accepts the following values:
  15641. @table @samp
  15642. @item lin
  15643. Linear scale.
  15644. @item log
  15645. Logarithmic scale.
  15646. @item rlog
  15647. Reverse logarithmic scale.
  15648. @end table
  15649. Default is @code{lin}.
  15650. @item win_size
  15651. Set window size.
  15652. It accepts the following values:
  15653. @table @samp
  15654. @item w16
  15655. @item w32
  15656. @item w64
  15657. @item w128
  15658. @item w256
  15659. @item w512
  15660. @item w1024
  15661. @item w2048
  15662. @item w4096
  15663. @item w8192
  15664. @item w16384
  15665. @item w32768
  15666. @item w65536
  15667. @end table
  15668. Default is @code{w2048}
  15669. @item win_func
  15670. Set windowing function.
  15671. It accepts the following values:
  15672. @table @samp
  15673. @item rect
  15674. @item bartlett
  15675. @item hanning
  15676. @item hamming
  15677. @item blackman
  15678. @item welch
  15679. @item flattop
  15680. @item bharris
  15681. @item bnuttall
  15682. @item bhann
  15683. @item sine
  15684. @item nuttall
  15685. @item lanczos
  15686. @item gauss
  15687. @item tukey
  15688. @item dolph
  15689. @item cauchy
  15690. @item parzen
  15691. @item poisson
  15692. @end table
  15693. Default is @code{hanning}.
  15694. @item overlap
  15695. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15696. which means optimal overlap for selected window function will be picked.
  15697. @item averaging
  15698. Set time averaging. Setting this to 0 will display current maximal peaks.
  15699. Default is @code{1}, which means time averaging is disabled.
  15700. @item colors
  15701. Specify list of colors separated by space or by '|' which will be used to
  15702. draw channel frequencies. Unrecognized or missing colors will be replaced
  15703. by white color.
  15704. @item cmode
  15705. Set channel display mode.
  15706. It accepts the following values:
  15707. @table @samp
  15708. @item combined
  15709. @item separate
  15710. @end table
  15711. Default is @code{combined}.
  15712. @item minamp
  15713. Set minimum amplitude used in @code{log} amplitude scaler.
  15714. @end table
  15715. @anchor{showspectrum}
  15716. @section showspectrum
  15717. Convert input audio to a video output, representing the audio frequency
  15718. spectrum.
  15719. The filter accepts the following options:
  15720. @table @option
  15721. @item size, s
  15722. Specify the video size for the output. For the syntax of this option, check the
  15723. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15724. Default value is @code{640x512}.
  15725. @item slide
  15726. Specify how the spectrum should slide along the window.
  15727. It accepts the following values:
  15728. @table @samp
  15729. @item replace
  15730. the samples start again on the left when they reach the right
  15731. @item scroll
  15732. the samples scroll from right to left
  15733. @item fullframe
  15734. frames are only produced when the samples reach the right
  15735. @item rscroll
  15736. the samples scroll from left to right
  15737. @end table
  15738. Default value is @code{replace}.
  15739. @item mode
  15740. Specify display mode.
  15741. It accepts the following values:
  15742. @table @samp
  15743. @item combined
  15744. all channels are displayed in the same row
  15745. @item separate
  15746. all channels are displayed in separate rows
  15747. @end table
  15748. Default value is @samp{combined}.
  15749. @item color
  15750. Specify display color mode.
  15751. It accepts the following values:
  15752. @table @samp
  15753. @item channel
  15754. each channel is displayed in a separate color
  15755. @item intensity
  15756. each channel is displayed using the same color scheme
  15757. @item rainbow
  15758. each channel is displayed using the rainbow color scheme
  15759. @item moreland
  15760. each channel is displayed using the moreland color scheme
  15761. @item nebulae
  15762. each channel is displayed using the nebulae color scheme
  15763. @item fire
  15764. each channel is displayed using the fire color scheme
  15765. @item fiery
  15766. each channel is displayed using the fiery color scheme
  15767. @item fruit
  15768. each channel is displayed using the fruit color scheme
  15769. @item cool
  15770. each channel is displayed using the cool color scheme
  15771. @item magma
  15772. each channel is displayed using the magma color scheme
  15773. @item green
  15774. each channel is displayed using the green color scheme
  15775. @end table
  15776. Default value is @samp{channel}.
  15777. @item scale
  15778. Specify scale used for calculating intensity color values.
  15779. It accepts the following values:
  15780. @table @samp
  15781. @item lin
  15782. linear
  15783. @item sqrt
  15784. square root, default
  15785. @item cbrt
  15786. cubic root
  15787. @item log
  15788. logarithmic
  15789. @item 4thrt
  15790. 4th root
  15791. @item 5thrt
  15792. 5th root
  15793. @end table
  15794. Default value is @samp{sqrt}.
  15795. @item saturation
  15796. Set saturation modifier for displayed colors. Negative values provide
  15797. alternative color scheme. @code{0} is no saturation at all.
  15798. Saturation must be in [-10.0, 10.0] range.
  15799. Default value is @code{1}.
  15800. @item win_func
  15801. Set window function.
  15802. It accepts the following values:
  15803. @table @samp
  15804. @item rect
  15805. @item bartlett
  15806. @item hann
  15807. @item hanning
  15808. @item hamming
  15809. @item blackman
  15810. @item welch
  15811. @item flattop
  15812. @item bharris
  15813. @item bnuttall
  15814. @item bhann
  15815. @item sine
  15816. @item nuttall
  15817. @item lanczos
  15818. @item gauss
  15819. @item tukey
  15820. @item dolph
  15821. @item cauchy
  15822. @item parzen
  15823. @item poisson
  15824. @end table
  15825. Default value is @code{hann}.
  15826. @item orientation
  15827. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15828. @code{horizontal}. Default is @code{vertical}.
  15829. @item overlap
  15830. Set ratio of overlap window. Default value is @code{0}.
  15831. When value is @code{1} overlap is set to recommended size for specific
  15832. window function currently used.
  15833. @item gain
  15834. Set scale gain for calculating intensity color values.
  15835. Default value is @code{1}.
  15836. @item data
  15837. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15838. @item rotation
  15839. Set color rotation, must be in [-1.0, 1.0] range.
  15840. Default value is @code{0}.
  15841. @item start
  15842. Set start frequency from which to display spectrogram. Default is @code{0}.
  15843. @item stop
  15844. Set stop frequency to which to display spectrogram. Default is @code{0}.
  15845. @item fps
  15846. Set upper frame rate limit. Default is @code{auto}, unlimited.
  15847. @item legend
  15848. Draw time and frequency axes and legends. Default is disabled.
  15849. @end table
  15850. The usage is very similar to the showwaves filter; see the examples in that
  15851. section.
  15852. @subsection Examples
  15853. @itemize
  15854. @item
  15855. Large window with logarithmic color scaling:
  15856. @example
  15857. showspectrum=s=1280x480:scale=log
  15858. @end example
  15859. @item
  15860. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15861. @example
  15862. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15863. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15864. @end example
  15865. @end itemize
  15866. @section showspectrumpic
  15867. Convert input audio to a single video frame, representing the audio frequency
  15868. spectrum.
  15869. The filter accepts the following options:
  15870. @table @option
  15871. @item size, s
  15872. Specify the video size for the output. For the syntax of this option, check the
  15873. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15874. Default value is @code{4096x2048}.
  15875. @item mode
  15876. Specify display mode.
  15877. It accepts the following values:
  15878. @table @samp
  15879. @item combined
  15880. all channels are displayed in the same row
  15881. @item separate
  15882. all channels are displayed in separate rows
  15883. @end table
  15884. Default value is @samp{combined}.
  15885. @item color
  15886. Specify display color mode.
  15887. It accepts the following values:
  15888. @table @samp
  15889. @item channel
  15890. each channel is displayed in a separate color
  15891. @item intensity
  15892. each channel is displayed using the same color scheme
  15893. @item rainbow
  15894. each channel is displayed using the rainbow color scheme
  15895. @item moreland
  15896. each channel is displayed using the moreland color scheme
  15897. @item nebulae
  15898. each channel is displayed using the nebulae color scheme
  15899. @item fire
  15900. each channel is displayed using the fire color scheme
  15901. @item fiery
  15902. each channel is displayed using the fiery color scheme
  15903. @item fruit
  15904. each channel is displayed using the fruit color scheme
  15905. @item cool
  15906. each channel is displayed using the cool color scheme
  15907. @item magma
  15908. each channel is displayed using the magma color scheme
  15909. @item green
  15910. each channel is displayed using the green color scheme
  15911. @end table
  15912. Default value is @samp{intensity}.
  15913. @item scale
  15914. Specify scale used for calculating intensity color values.
  15915. It accepts the following values:
  15916. @table @samp
  15917. @item lin
  15918. linear
  15919. @item sqrt
  15920. square root, default
  15921. @item cbrt
  15922. cubic root
  15923. @item log
  15924. logarithmic
  15925. @item 4thrt
  15926. 4th root
  15927. @item 5thrt
  15928. 5th root
  15929. @end table
  15930. Default value is @samp{log}.
  15931. @item saturation
  15932. Set saturation modifier for displayed colors. Negative values provide
  15933. alternative color scheme. @code{0} is no saturation at all.
  15934. Saturation must be in [-10.0, 10.0] range.
  15935. Default value is @code{1}.
  15936. @item win_func
  15937. Set window function.
  15938. It accepts the following values:
  15939. @table @samp
  15940. @item rect
  15941. @item bartlett
  15942. @item hann
  15943. @item hanning
  15944. @item hamming
  15945. @item blackman
  15946. @item welch
  15947. @item flattop
  15948. @item bharris
  15949. @item bnuttall
  15950. @item bhann
  15951. @item sine
  15952. @item nuttall
  15953. @item lanczos
  15954. @item gauss
  15955. @item tukey
  15956. @item dolph
  15957. @item cauchy
  15958. @item parzen
  15959. @item poisson
  15960. @end table
  15961. Default value is @code{hann}.
  15962. @item orientation
  15963. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15964. @code{horizontal}. Default is @code{vertical}.
  15965. @item gain
  15966. Set scale gain for calculating intensity color values.
  15967. Default value is @code{1}.
  15968. @item legend
  15969. Draw time and frequency axes and legends. Default is enabled.
  15970. @item rotation
  15971. Set color rotation, must be in [-1.0, 1.0] range.
  15972. Default value is @code{0}.
  15973. @item start
  15974. Set start frequency from which to display spectrogram. Default is @code{0}.
  15975. @item stop
  15976. Set stop frequency to which to display spectrogram. Default is @code{0}.
  15977. @end table
  15978. @subsection Examples
  15979. @itemize
  15980. @item
  15981. Extract an audio spectrogram of a whole audio track
  15982. in a 1024x1024 picture using @command{ffmpeg}:
  15983. @example
  15984. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15985. @end example
  15986. @end itemize
  15987. @section showvolume
  15988. Convert input audio volume to a video output.
  15989. The filter accepts the following options:
  15990. @table @option
  15991. @item rate, r
  15992. Set video rate.
  15993. @item b
  15994. Set border width, allowed range is [0, 5]. Default is 1.
  15995. @item w
  15996. Set channel width, allowed range is [80, 8192]. Default is 400.
  15997. @item h
  15998. Set channel height, allowed range is [1, 900]. Default is 20.
  15999. @item f
  16000. Set fade, allowed range is [0, 1]. Default is 0.95.
  16001. @item c
  16002. Set volume color expression.
  16003. The expression can use the following variables:
  16004. @table @option
  16005. @item VOLUME
  16006. Current max volume of channel in dB.
  16007. @item PEAK
  16008. Current peak.
  16009. @item CHANNEL
  16010. Current channel number, starting from 0.
  16011. @end table
  16012. @item t
  16013. If set, displays channel names. Default is enabled.
  16014. @item v
  16015. If set, displays volume values. Default is enabled.
  16016. @item o
  16017. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16018. default is @code{h}.
  16019. @item s
  16020. Set step size, allowed range is [0, 5]. Default is 0, which means
  16021. step is disabled.
  16022. @item p
  16023. Set background opacity, allowed range is [0, 1]. Default is 0.
  16024. @item m
  16025. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16026. default is @code{p}.
  16027. @item ds
  16028. Set display scale, can be linear: @code{lin} or log: @code{log},
  16029. default is @code{lin}.
  16030. @item dm
  16031. In second.
  16032. If set to > 0., display a line for the max level
  16033. in the previous seconds.
  16034. default is disabled: @code{0.}
  16035. @item dmc
  16036. The color of the max line. Use when @code{dm} option is set to > 0.
  16037. default is: @code{orange}
  16038. @end table
  16039. @section showwaves
  16040. Convert input audio to a video output, representing the samples waves.
  16041. The filter accepts the following options:
  16042. @table @option
  16043. @item size, s
  16044. Specify the video size for the output. For the syntax of this option, check the
  16045. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16046. Default value is @code{600x240}.
  16047. @item mode
  16048. Set display mode.
  16049. Available values are:
  16050. @table @samp
  16051. @item point
  16052. Draw a point for each sample.
  16053. @item line
  16054. Draw a vertical line for each sample.
  16055. @item p2p
  16056. Draw a point for each sample and a line between them.
  16057. @item cline
  16058. Draw a centered vertical line for each sample.
  16059. @end table
  16060. Default value is @code{point}.
  16061. @item n
  16062. Set the number of samples which are printed on the same column. A
  16063. larger value will decrease the frame rate. Must be a positive
  16064. integer. This option can be set only if the value for @var{rate}
  16065. is not explicitly specified.
  16066. @item rate, r
  16067. Set the (approximate) output frame rate. This is done by setting the
  16068. option @var{n}. Default value is "25".
  16069. @item split_channels
  16070. Set if channels should be drawn separately or overlap. Default value is 0.
  16071. @item colors
  16072. Set colors separated by '|' which are going to be used for drawing of each channel.
  16073. @item scale
  16074. Set amplitude scale.
  16075. Available values are:
  16076. @table @samp
  16077. @item lin
  16078. Linear.
  16079. @item log
  16080. Logarithmic.
  16081. @item sqrt
  16082. Square root.
  16083. @item cbrt
  16084. Cubic root.
  16085. @end table
  16086. Default is linear.
  16087. @item draw
  16088. Set the draw mode. This is mostly useful to set for high @var{n}.
  16089. Available values are:
  16090. @table @samp
  16091. @item scale
  16092. Scale pixel values for each drawn sample.
  16093. @item full
  16094. Draw every sample directly.
  16095. @end table
  16096. Default value is @code{scale}.
  16097. @end table
  16098. @subsection Examples
  16099. @itemize
  16100. @item
  16101. Output the input file audio and the corresponding video representation
  16102. at the same time:
  16103. @example
  16104. amovie=a.mp3,asplit[out0],showwaves[out1]
  16105. @end example
  16106. @item
  16107. Create a synthetic signal and show it with showwaves, forcing a
  16108. frame rate of 30 frames per second:
  16109. @example
  16110. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  16111. @end example
  16112. @end itemize
  16113. @section showwavespic
  16114. Convert input audio to a single video frame, representing the samples waves.
  16115. The filter accepts the following options:
  16116. @table @option
  16117. @item size, s
  16118. Specify the video size for the output. For the syntax of this option, check the
  16119. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16120. Default value is @code{600x240}.
  16121. @item split_channels
  16122. Set if channels should be drawn separately or overlap. Default value is 0.
  16123. @item colors
  16124. Set colors separated by '|' which are going to be used for drawing of each channel.
  16125. @item scale
  16126. Set amplitude scale.
  16127. Available values are:
  16128. @table @samp
  16129. @item lin
  16130. Linear.
  16131. @item log
  16132. Logarithmic.
  16133. @item sqrt
  16134. Square root.
  16135. @item cbrt
  16136. Cubic root.
  16137. @end table
  16138. Default is linear.
  16139. @end table
  16140. @subsection Examples
  16141. @itemize
  16142. @item
  16143. Extract a channel split representation of the wave form of a whole audio track
  16144. in a 1024x800 picture using @command{ffmpeg}:
  16145. @example
  16146. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  16147. @end example
  16148. @end itemize
  16149. @section sidedata, asidedata
  16150. Delete frame side data, or select frames based on it.
  16151. This filter accepts the following options:
  16152. @table @option
  16153. @item mode
  16154. Set mode of operation of the filter.
  16155. Can be one of the following:
  16156. @table @samp
  16157. @item select
  16158. Select every frame with side data of @code{type}.
  16159. @item delete
  16160. Delete side data of @code{type}. If @code{type} is not set, delete all side
  16161. data in the frame.
  16162. @end table
  16163. @item type
  16164. Set side data type used with all modes. Must be set for @code{select} mode. For
  16165. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  16166. in @file{libavutil/frame.h}. For example, to choose
  16167. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  16168. @end table
  16169. @section spectrumsynth
  16170. Sythesize audio from 2 input video spectrums, first input stream represents
  16171. magnitude across time and second represents phase across time.
  16172. The filter will transform from frequency domain as displayed in videos back
  16173. to time domain as presented in audio output.
  16174. This filter is primarily created for reversing processed @ref{showspectrum}
  16175. filter outputs, but can synthesize sound from other spectrograms too.
  16176. But in such case results are going to be poor if the phase data is not
  16177. available, because in such cases phase data need to be recreated, usually
  16178. its just recreated from random noise.
  16179. For best results use gray only output (@code{channel} color mode in
  16180. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  16181. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  16182. @code{data} option. Inputs videos should generally use @code{fullframe}
  16183. slide mode as that saves resources needed for decoding video.
  16184. The filter accepts the following options:
  16185. @table @option
  16186. @item sample_rate
  16187. Specify sample rate of output audio, the sample rate of audio from which
  16188. spectrum was generated may differ.
  16189. @item channels
  16190. Set number of channels represented in input video spectrums.
  16191. @item scale
  16192. Set scale which was used when generating magnitude input spectrum.
  16193. Can be @code{lin} or @code{log}. Default is @code{log}.
  16194. @item slide
  16195. Set slide which was used when generating inputs spectrums.
  16196. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  16197. Default is @code{fullframe}.
  16198. @item win_func
  16199. Set window function used for resynthesis.
  16200. @item overlap
  16201. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16202. which means optimal overlap for selected window function will be picked.
  16203. @item orientation
  16204. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  16205. Default is @code{vertical}.
  16206. @end table
  16207. @subsection Examples
  16208. @itemize
  16209. @item
  16210. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  16211. then resynthesize videos back to audio with spectrumsynth:
  16212. @example
  16213. 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
  16214. 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
  16215. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  16216. @end example
  16217. @end itemize
  16218. @section split, asplit
  16219. Split input into several identical outputs.
  16220. @code{asplit} works with audio input, @code{split} with video.
  16221. The filter accepts a single parameter which specifies the number of outputs. If
  16222. unspecified, it defaults to 2.
  16223. @subsection Examples
  16224. @itemize
  16225. @item
  16226. Create two separate outputs from the same input:
  16227. @example
  16228. [in] split [out0][out1]
  16229. @end example
  16230. @item
  16231. To create 3 or more outputs, you need to specify the number of
  16232. outputs, like in:
  16233. @example
  16234. [in] asplit=3 [out0][out1][out2]
  16235. @end example
  16236. @item
  16237. Create two separate outputs from the same input, one cropped and
  16238. one padded:
  16239. @example
  16240. [in] split [splitout1][splitout2];
  16241. [splitout1] crop=100:100:0:0 [cropout];
  16242. [splitout2] pad=200:200:100:100 [padout];
  16243. @end example
  16244. @item
  16245. Create 5 copies of the input audio with @command{ffmpeg}:
  16246. @example
  16247. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  16248. @end example
  16249. @end itemize
  16250. @section zmq, azmq
  16251. Receive commands sent through a libzmq client, and forward them to
  16252. filters in the filtergraph.
  16253. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  16254. must be inserted between two video filters, @code{azmq} between two
  16255. audio filters. Both are capable to send messages to any filter type.
  16256. To enable these filters you need to install the libzmq library and
  16257. headers and configure FFmpeg with @code{--enable-libzmq}.
  16258. For more information about libzmq see:
  16259. @url{http://www.zeromq.org/}
  16260. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  16261. receives messages sent through a network interface defined by the
  16262. @option{bind_address} (or the abbreviation "@option{b}") option.
  16263. Default value of this option is @file{tcp://localhost:5555}. You may
  16264. want to alter this value to your needs, but do not forget to escape any
  16265. ':' signs (see @ref{filtergraph escaping}).
  16266. The received message must be in the form:
  16267. @example
  16268. @var{TARGET} @var{COMMAND} [@var{ARG}]
  16269. @end example
  16270. @var{TARGET} specifies the target of the command, usually the name of
  16271. the filter class or a specific filter instance name. The default
  16272. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  16273. but you can override this by using the @samp{filter_name@@id} syntax
  16274. (see @ref{Filtergraph syntax}).
  16275. @var{COMMAND} specifies the name of the command for the target filter.
  16276. @var{ARG} is optional and specifies the optional argument list for the
  16277. given @var{COMMAND}.
  16278. Upon reception, the message is processed and the corresponding command
  16279. is injected into the filtergraph. Depending on the result, the filter
  16280. will send a reply to the client, adopting the format:
  16281. @example
  16282. @var{ERROR_CODE} @var{ERROR_REASON}
  16283. @var{MESSAGE}
  16284. @end example
  16285. @var{MESSAGE} is optional.
  16286. @subsection Examples
  16287. Look at @file{tools/zmqsend} for an example of a zmq client which can
  16288. be used to send commands processed by these filters.
  16289. Consider the following filtergraph generated by @command{ffplay}.
  16290. In this example the last overlay filter has an instance name. All other
  16291. filters will have default instance names.
  16292. @example
  16293. ffplay -dumpgraph 1 -f lavfi "
  16294. color=s=100x100:c=red [l];
  16295. color=s=100x100:c=blue [r];
  16296. nullsrc=s=200x100, zmq [bg];
  16297. [bg][l] overlay [bg+l];
  16298. [bg+l][r] overlay@@my=x=100 "
  16299. @end example
  16300. To change the color of the left side of the video, the following
  16301. command can be used:
  16302. @example
  16303. echo Parsed_color_0 c yellow | tools/zmqsend
  16304. @end example
  16305. To change the right side:
  16306. @example
  16307. echo Parsed_color_1 c pink | tools/zmqsend
  16308. @end example
  16309. To change the position of the right side:
  16310. @example
  16311. echo overlay@@my x 150 | tools/zmqsend
  16312. @end example
  16313. @c man end MULTIMEDIA FILTERS
  16314. @chapter Multimedia Sources
  16315. @c man begin MULTIMEDIA SOURCES
  16316. Below is a description of the currently available multimedia sources.
  16317. @section amovie
  16318. This is the same as @ref{movie} source, except it selects an audio
  16319. stream by default.
  16320. @anchor{movie}
  16321. @section movie
  16322. Read audio and/or video stream(s) from a movie container.
  16323. It accepts the following parameters:
  16324. @table @option
  16325. @item filename
  16326. The name of the resource to read (not necessarily a file; it can also be a
  16327. device or a stream accessed through some protocol).
  16328. @item format_name, f
  16329. Specifies the format assumed for the movie to read, and can be either
  16330. the name of a container or an input device. If not specified, the
  16331. format is guessed from @var{movie_name} or by probing.
  16332. @item seek_point, sp
  16333. Specifies the seek point in seconds. The frames will be output
  16334. starting from this seek point. The parameter is evaluated with
  16335. @code{av_strtod}, so the numerical value may be suffixed by an IS
  16336. postfix. The default value is "0".
  16337. @item streams, s
  16338. Specifies the streams to read. Several streams can be specified,
  16339. separated by "+". The source will then have as many outputs, in the
  16340. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  16341. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  16342. respectively the default (best suited) video and audio stream. Default
  16343. is "dv", or "da" if the filter is called as "amovie".
  16344. @item stream_index, si
  16345. Specifies the index of the video stream to read. If the value is -1,
  16346. the most suitable video stream will be automatically selected. The default
  16347. value is "-1". Deprecated. If the filter is called "amovie", it will select
  16348. audio instead of video.
  16349. @item loop
  16350. Specifies how many times to read the stream in sequence.
  16351. If the value is 0, the stream will be looped infinitely.
  16352. Default value is "1".
  16353. Note that when the movie is looped the source timestamps are not
  16354. changed, so it will generate non monotonically increasing timestamps.
  16355. @item discontinuity
  16356. Specifies the time difference between frames above which the point is
  16357. considered a timestamp discontinuity which is removed by adjusting the later
  16358. timestamps.
  16359. @end table
  16360. It allows overlaying a second video on top of the main input of
  16361. a filtergraph, as shown in this graph:
  16362. @example
  16363. input -----------> deltapts0 --> overlay --> output
  16364. ^
  16365. |
  16366. movie --> scale--> deltapts1 -------+
  16367. @end example
  16368. @subsection Examples
  16369. @itemize
  16370. @item
  16371. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  16372. on top of the input labelled "in":
  16373. @example
  16374. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16375. [in] setpts=PTS-STARTPTS [main];
  16376. [main][over] overlay=16:16 [out]
  16377. @end example
  16378. @item
  16379. Read from a video4linux2 device, and overlay it on top of the input
  16380. labelled "in":
  16381. @example
  16382. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16383. [in] setpts=PTS-STARTPTS [main];
  16384. [main][over] overlay=16:16 [out]
  16385. @end example
  16386. @item
  16387. Read the first video stream and the audio stream with id 0x81 from
  16388. dvd.vob; the video is connected to the pad named "video" and the audio is
  16389. connected to the pad named "audio":
  16390. @example
  16391. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  16392. @end example
  16393. @end itemize
  16394. @subsection Commands
  16395. Both movie and amovie support the following commands:
  16396. @table @option
  16397. @item seek
  16398. Perform seek using "av_seek_frame".
  16399. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  16400. @itemize
  16401. @item
  16402. @var{stream_index}: If stream_index is -1, a default
  16403. stream is selected, and @var{timestamp} is automatically converted
  16404. from AV_TIME_BASE units to the stream specific time_base.
  16405. @item
  16406. @var{timestamp}: Timestamp in AVStream.time_base units
  16407. or, if no stream is specified, in AV_TIME_BASE units.
  16408. @item
  16409. @var{flags}: Flags which select direction and seeking mode.
  16410. @end itemize
  16411. @item get_duration
  16412. Get movie duration in AV_TIME_BASE units.
  16413. @end table
  16414. @c man end MULTIMEDIA SOURCES